Merging in changes from stable
authorDan
Sat, 20 Oct 2007 21:44:13 -0400
changeset 193 ebe99e82a59a
parent 187 9dbbec5e6096 (current diff)
parent 192 9237767a23ae (diff)
child 204 473cc747022a
Merging in changes from stable
includes/common.php
includes/functions.php
includes/render.php
includes/sessions.php
includes/template.php
plugins/SpecialAdmin.php
plugins/SpecialUserFuncs.php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cron.php	Sat Oct 20 21:44:13 2007 -0400
@@ -0,0 +1,54 @@
+<?php
+
+/*
+ * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
+ * Version 1.0.2 (Coblynau)
+ * Copyright (C) 2006-2007 Dan Fuhry
+ *
+ * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
+ */
+
+//
+// cron.php - Maintenance tasks that should be run periodically
+//
+
+// The cron script is triggered by way of an image. This is a 1x1px transparent GIF.
+define('ENANO_GIF_SPACER', base64_decode('R0lGODlhAQABAIAAAP///////yH+FUNyZWF0ZWQgd2l0aCBUaGUgR0lNUAAh+QQBCgABACwAAAAAAQABAAACAkwBADs='));
+
+// Don't need a page to load, all we should need is the Enano API
+$_GET['title'] = 'Enano:Cron';
+require('includes/common.php');
+
+global $db, $session, $paths, $template, $plugins; // Common objects
+
+// Hope now that plugins are loaded :-)
+$last_run = ( $x = getConfig('cron_last_run') ) ? $x : 0;
+$time = strval(time());
+setConfig('cron_last_run', $time);
+
+global $cron_tasks;
+
+foreach ( $cron_tasks as $interval => $tasks )
+{
+  $last_run_threshold = time() - ( $interval * 3600 );
+  if ( $last_run_threshold >= $last_run )
+  {
+    foreach ( $tasks as $task )
+    {
+      @call_user_func($task);
+    }
+  }
+}
+
+header('Pragma: no-cache');
+header('Cache-control: no-cache');
+header('Expires: Thu, 1 Jan 1970 00:00:01 GMT');
+header('Content-type: image/gif');
+
+echo ENANO_GIF_SPACER;
+
+?>
--- a/includes/clientside/sbedit.js	Sun Oct 14 20:51:15 2007 -0400
+++ b/includes/clientside/sbedit.js	Sat Oct 20 21:44:13 2007 -0400
@@ -123,3 +123,71 @@
     });
 }
 
+function ajaxRenameSidebarStage1(parent, id)
+{
+  var oldname = parent.firstChild.nodeValue;
+  parent.removeChild(parent.firstChild);
+  parent.ondblclick = function() {};
+  parent._idcache = id;
+  var input = document.createElement('input');
+  input.type = 'text';
+  input.sbedit_id = id;
+  input.oldvalue = oldname;
+  input.onkeyup = function(e)
+  {
+    if ( typeof(e) != 'object' )
+      return false;
+    if ( !e.keyCode )
+      return false;
+    if ( e.keyCode == 13 )
+    {
+      ajaxRenameSidebarStage2(this);
+    }
+    if ( e.keyCode == 27 )
+    {
+      ajaxRenameSidebarCancel(this);
+    }
+  };
+  input.onblur = function()
+  {
+    ajaxRenameSidebarCancel(this);
+  };
+  input.value = oldname;
+  input.style.fontSize = '7pt';
+  parent.appendChild(input);
+  input.focus();
+}
+
+function ajaxRenameSidebarStage2(input)
+{
+  var newname = input.value;
+  var id = input.sbedit_id;
+  var parent = input.parentNode;
+  parent.removeChild(input);
+  parent.appendChild(document.createTextNode(newname));
+  parent.ondblclick = function() { ajaxRenameSidebarStage1(this, this._idcache); return false; };
+  var img = document.createElement('img');
+  img.src = scriptPath + '/images/loading.gif';
+  parent.appendChild(img);
+  newname = ajaxEscape(newname);
+  ajaxPost(makeUrlNS('Special', 'EditSidebar', 'ajax&noheaders&action=rename&id='+id), 'newname=' +newname, function()
+    {
+      if ( ajax.readyState == 4 )
+      {
+        parent.removeChild(img);
+        if ( ajax.responseText != 'GOOD' )
+          new messagebox(MB_OK|MB_ICONSTOP, 'Error renaming block', ajax.responseText);
+      }
+    });
+}
+
+function ajaxRenameSidebarCancel(input)
+{
+  var newname = input.oldvalue;
+  var id = input.sbedit_id;
+  var parent = input.parentNode;
+  parent.removeChild(input);
+  parent.appendChild(document.createTextNode(newname));
+  parent.ondblclick = function() { ajaxRenameSidebarStage1(this, this._idcache); return false; };
+}
+
--- a/includes/clientside/static/loader.js	Sun Oct 14 20:51:15 2007 -0400
+++ b/includes/clientside/static/loader.js	Sat Oct 20 21:44:13 2007 -0400
@@ -1,27 +1,8 @@
 // Some final stuff - loader routines, etc.
 
-var __tmpEnanoStartup9843275;
-  
-function enanoStartup(e) {
-  if ( !e )
-  {
-    // Delay initting sliders until images are loaded
-    if ( typeof(window.onload) == 'function' )
-      __tmpEnanoStartup9843275 = window.onload;
-    else
-      __tmpEnanoStartup9843275 = function(){};
-    window.onload = function(e){__tmpEnanoStartup9843275(e);initSliders();};
-  }
-  else
-  {
-    initSliders();
-  }
-}
-
 function mdgInnerLoader(e)
 {
   jws.startup();
-  enanoStartup(e);
   if(window.location.hash == '#comments') ajaxComments();
   window.onkeydown=isKeyPressed;
   window.onkeyup=function(e) { isKeyPressed(e); };
@@ -34,6 +15,7 @@
   {
     dbx_set_key();
   }
+  initSliders();
   runOnloadHooks(e);
 }
 if(window.onload) var ld = window.onload;
--- a/plugins/PrivateMessages.php	Sun Oct 14 20:51:15 2007 -0400
+++ b/plugins/PrivateMessages.php	Sat Oct 20 21:44:13 2007 -0400
@@ -4,13 +4,13 @@
 Plugin URI: http://enanocms.org/
 Description: Provides the page Special:PrivateMessages, which is used to manage private message functions. Also handles buddy lists.
 Author: Dan Fuhry
-Version: 1.0.1
+Version: 1.0.2
 Author URI: http://enanocms.org/
 */
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 2
+ * Version 1.0.2
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/plugins/SpecialCSS.php	Sun Oct 14 20:51:15 2007 -0400
+++ b/plugins/SpecialCSS.php	Sat Oct 20 21:44:13 2007 -0400
@@ -4,13 +4,13 @@
 Plugin URI: http://enanocms.org/
 Description: Provides the page Special:CSS, which is used in template files to reference the style sheet. Disabling or deleting this plugin will result in site instability.
 Author: Dan Fuhry
-Version: 1.0.1
+Version: 1.0.2
 Author URI: http://enanocms.org/
 */
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 2
+ * Version 1.0.2
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/plugins/SpecialGroups.php	Sun Oct 14 20:51:15 2007 -0400
+++ b/plugins/SpecialGroups.php	Sat Oct 20 21:44:13 2007 -0400
@@ -4,13 +4,13 @@
 Plugin URI: http://enanocms.org/
 Description: Provides group moderators and site administrators with the ability to control who is part of their groups. 
 Author: Dan Fuhry
-Version: 1.0.1
+Version: 1.0.2
 Author URI: http://enanocms.org/
 */
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 2
+ * Version 1.0.2
  * Copyright (C) 2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/plugins/SpecialPageFuncs.php	Sun Oct 14 20:51:15 2007 -0400
+++ b/plugins/SpecialPageFuncs.php	Sat Oct 20 21:44:13 2007 -0400
@@ -4,13 +4,13 @@
 Plugin URI: http://enanocms.org/
 Description: Provides the page Special:CreatePage, which can be used to create new pages. Also adds the About Enano and GNU General Public License pages.
 Author: Dan Fuhry
-Version: 1.0.1
+Version: 1.0.2
 Author URI: http://enanocms.org/
 */
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 2
+ * Version 1.0.2
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/plugins/SpecialSearch.php	Sun Oct 14 20:51:15 2007 -0400
+++ b/plugins/SpecialSearch.php	Sat Oct 20 21:44:13 2007 -0400
@@ -4,13 +4,13 @@
 Plugin URI: http://enanocms.org/
 Description: Provides the page Special:Search, which is a frontend to the Enano search engine.
 Author: Dan Fuhry
-Version: 1.0.1
+Version: 1.0.2
 Author URI: http://enanocms.org/
 */
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 2
+ * Version 1.0.2
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
--- a/plugins/SpecialUpdownload.php	Sun Oct 14 20:51:15 2007 -0400
+++ b/plugins/SpecialUpdownload.php	Sat Oct 20 21:44:13 2007 -0400
@@ -4,13 +4,13 @@
 Plugin URI: http://enanocms.org/
 Description: Provides the pages Special:UploadFile and Special:DownloadFile. UploadFile is used to upload files to the site, and DownloadFile fetches the file from the database, creates thumbnails if necessary, and sends the file to the user.
 Author: Dan Fuhry
-Version: 1.0.1
+Version: 1.0.2
 Author URI: http://enanocms.org/
 */
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 2
+ * Version 1.0.2
  * Copyright (C) 2006-2007 Dan Fuhry
  * SpecialUpdownload.php - handles uploading and downloading of user-uploaded files - possibly the most rigorously security-enforcing script in all of Enano, although sessions.php comes in a close second
  *
@@ -59,8 +59,14 @@
     {
       $file = false;
     }
-    if(!is_array($file)) die_friendly('Upload failed', '<p>The server could not retrieve the array $_FILES[\'data\'].</p>');
-    if($file['size'] == 0 || $file['size'] > (int)getConfig('max_file_size')) die_friendly('Upload failed', '<p>The file you uploaded is either too large or 0 bytes in length.</p>');
+    if ( !is_array($file) )
+    {
+      die_friendly('Upload failed', '<p>The server could not retrieve the array $_FILES[\'data\'].</p>');
+    }
+    if ( $file['size'] == 0 || $file['size'] > (int)getConfig('max_file_size') )
+    {
+      die_friendly('Upload failed', '<p>The file you uploaded is either too large or 0 bytes in length.</p>');
+    }
     /*
     $allowed_mime_types = Array(
         'text/plain',
@@ -88,7 +94,7 @@
     */
     $types = fetch_allowed_extensions();
     $ext = substr($file['name'], strrpos($file['name'], '.')+1, strlen($file['name']));
-    if(!isset($types[$ext]) || ( isset($types[$ext]) && !$types[$ext] ) )
+    if ( !isset($types[$ext]) || ( isset($types[$ext]) && !$types[$ext] ) )
     {
       die_friendly('Upload failed', '<p>The file type ".'.$ext.'" is not allowed.</p>');
     }
--- a/plugins/SpecialUserPrefs.php	Sun Oct 14 20:51:15 2007 -0400
+++ b/plugins/SpecialUserPrefs.php	Sat Oct 20 21:44:13 2007 -0400
@@ -4,13 +4,13 @@
 Plugin URI: http://enanocms.org/
 Description: Provides the page Special:Preferences.
 Author: Dan Fuhry
-Version: 1.0.1
+Version: 1.0.2
 Author URI: http://enanocms.org/
 */
 
 /*
  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
- * Version 1.0 release candidate 2
+ * Version 1.0.2
  * Copyright (C) 2006-2007 Dan Fuhry
  *
  * This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU General Public License
--- a/themes/oxygen/footer.tpl	Sun Oct 14 20:51:15 2007 -0400
+++ b/themes/oxygen/footer.tpl	Sat Oct 20 21:44:13 2007 -0400
@@ -13,6 +13,8 @@
             <div id="credits">
               <b>{COPYRIGHT}</b><br />
               Website engine powered by <a href="<!-- BEGIN stupid_mode -->http://enanocms.org/<!-- BEGINELSE stupid_mode -->{URL_ABOUT_ENANO}<!-- END stupid_mode -->">Enano</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.1</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="http://jigsaw.w3.org/css-validator/validator?uri=referer">Valid CSS</a>&nbsp;&nbsp;|&nbsp;&nbsp;Generated in [[GenTime]]sec
+              <!-- Do not remove this line or scheduled tasks will not run. -->
+              <img alt=" " src="{SCRIPTPATH}/cron.php" width="1" height="1" />
             </div>
           
           </td><td id="mdg-btr"></td></tr>
--- a/themes/stpatty/footer.tpl	Sun Oct 14 20:51:15 2007 -0400
+++ b/themes/stpatty/footer.tpl	Sat Oct 20 21:44:13 2007 -0400
@@ -11,6 +11,8 @@
                  -->
           <b>{COPYRIGHT}</b><br />
           Powered by <a href="<!-- BEGIN stupid_mode -->http://enanocms.org/<!-- BEGINELSE stupid_mode -->{URL_ABOUT_ENANO}<!-- END stupid_mode -->">Enano</a>  |  <a href="http://validator.w3.org/check?uri=referer">Valid XHTML 1.1</a>  |  <a href="http://jigsaw.w3.org/css-validator/validator?uri=referer">Valid CSS</a>  |  [[Stats]]
+          <!-- Do not remove this line or scheduled tasks will not run. -->
+          <img alt=" " src="{SCRIPTPATH}/cron.php" width="1" height="1" />
         </div>
       </div>
     </div>