[geeklog-hg] geeklog: Merged with upstream

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Wed Jan 8 21:03:03 EST 2014


changeset 9403:944e16f996b9
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/944e16f996b9
user: Tom <websitemaster at cogeco.net>
date: Wed Jan 08 21:02:09 2014 -0500
description:
Merged with upstream

diffstat:

 plugins/spamx/BlackList.Examine.class.php                |  16 ++-
 plugins/spamx/IP.Examine.class.php                       |   6 +-
 public_html/admin/plugins.php                            |  26 +++-
 public_html/admin/syndication.php                        |  63 +++++++----
 public_html/article.php                                  |   2 +-
 public_html/javascript/dialog_help.js                    |  35 ++++++
 public_html/layout/denim/header.thtml                    |   2 +-
 public_html/layout/denim/users/storyrow.thtml            |   2 +-
 public_html/layout/modern_curve/header.thtml             |   2 +-
 public_html/layout/modern_curve/users/storyrow.thtml     |   2 +-
 public_html/layout/professional/users/storyrow.thtml     |   2 +-
 public_html/layout/professional_css/header.thtml         |   2 +-
 public_html/layout/professional_css/users/storyrow.thtml |   2 +-
 public_html/lib-common.php                               |  85 ++++++---------
 system/classes/config.class.php                          |   4 +-
 system/classes/scripts.class.php                         |  73 +++++++++++--
 system/classes/search.class.php                          |  64 ++++++-----
 system/classes/template.class.php                        |  34 ++++++
 system/lib-user.php                                      |   4 +-
 19 files changed, 286 insertions(+), 140 deletions(-)

diffs (truncated from 910 to 300 lines):

diff -r d95ee4274ef3 -r 944e16f996b9 plugins/spamx/BlackList.Examine.class.php
--- a/plugins/spamx/BlackList.Examine.class.php	Sat Jan 04 17:29:10 2014 -0500
+++ b/plugins/spamx/BlackList.Examine.class.php	Wed Jan 08 21:02:09 2014 -0500
@@ -33,6 +33,18 @@
     /**
      * No Constructor Use BaseCommand constructor
      */
+
+    // Callback functions for preg_replace_callback()
+    protected function callbackDecimal($str)
+    {
+        return chr($str);
+    }
+
+    protected function callbackHex($str)
+    {
+        return chr('0x' . $str);
+    }
+
     /**
      * Here we do the work
      */
@@ -55,9 +67,9 @@
         // named entities
         $comment = html_entity_decode ($comment);
         // decimal notation
-        $comment = preg_replace ('/&#(\d+);/me', "chr(\\1)", $comment);
+        $comment = preg_replace_callback('/&#(\d+);/m', array($this, 'callbackDecimal'), $comment);
         // hex notation
-        $comment = preg_replace ('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $comment);
+        $comment = preg_replace_callback('/&#x([a-f0-9]+);/mi', array($this, 'callbackHex'), $comment);
         $ans = 0;
         for ($i = 1; $i <= $nrows; $i++) {
             list ($val) = DB_fetchArray ($result);
diff -r d95ee4274ef3 -r 944e16f996b9 plugins/spamx/IP.Examine.class.php
--- a/plugins/spamx/IP.Examine.class.php	Sat Jan 04 17:29:10 2014 -0500
+++ b/plugins/spamx/IP.Examine.class.php	Wed Jan 08 21:02:09 2014 -0500
@@ -128,14 +128,14 @@
     /**
      * Private internal method to match an IP address against an address range
      *
+     * Original authors: dh06 and Stephane, taken from
+     * @link http://www.php.net/manual/en/function.ip2long.php#70707
+     *
      * @param   string  $ip     IP address to check
      * @param   string  $range  IP address range to check against
      * @return  boolean         true if IP falls into the IP range, else false
      * @access  private
      *
-     * Original authors: dh06 and Stephane, taken from
-     * @link http://www.php.net/manual/en/function.ip2long.php#70707
-     *
      */
     function _matchRange($ip, $range)
     {
diff -r d95ee4274ef3 -r 944e16f996b9 public_html/admin/plugins.php
--- a/public_html/admin/plugins.php	Sat Jan 04 17:29:10 2014 -0500
+++ b/public_html/admin/plugins.php	Wed Jan 08 21:02:09 2014 -0500
@@ -731,10 +731,16 @@
                     $pi_was_enabled = ($A['pi_enabled'] == 1);
                 }
 
+				$callback = 'plugin_enablestatechange_' . $dirname;
+
                 if ($pi_was_enabled) {
                     // disable temporarily while we move the files around
-                    DB_change($_TABLES['plugins'], 'pi_enabled', 0,
-                                                   'pi_name', $dirname);
+                    if (is_callable($callback)) {
+                        changePluginStatus($dirname);
+                    } else {
+                        DB_change($_TABLES['plugins'], 'pi_enabled', 0,
+                                                       'pi_name', $dirname);
+                    }
                 }
 
                 require_once 'System.php';
@@ -779,10 +785,13 @@
                 $fdata = fread($fhandle, filesize($plugin_inst));
                 fclose($fhandle);
             }
-
+/*
             // Remove the plugin from data/
             require_once 'System.php';
             @System::rm('-rf ' . $_CONF['path'] . 'data/' . $dirname);
+*/
+            // Some plugins seem to expect files under the data directory to
+            // be unchanged while they are disabled.  Let's leave the files untouched.
 
             /**
              * One time I wanted to install a muffler on my car and
@@ -834,6 +843,8 @@
             unset($archive); // Collect some garbage
 
             // cleanup when uploading a new version
+            require_once 'System.php';
+
             if ($pi_did_exist) {
                 $plugin_dir = $_CONF['path'] . 'plugins/' . $dirname;
                 if (file_exists($plugin_dir . '.previous')) {
@@ -851,8 +862,13 @@
                 }
 
                 if ($pi_was_enabled) {
-                    DB_change($_TABLES['plugins'], 'pi_enabled', 1,
-                                                   'pi_name', $dirname);
+                    // Enable the plugin again
+                    if (is_callable($callback)) {
+                        changePluginStatus($dirname);
+                    } else {
+                        DB_change($_TABLES['plugins'], 'pi_enabled', 1,
+                                                       'pi_name', $dirname);
+                    }
                 }
             }
 
diff -r d95ee4274ef3 -r 944e16f996b9 public_html/admin/syndication.php
--- a/public_html/admin/syndication.php	Sat Jan 04 17:29:10 2014 -0500
+++ b/public_html/admin/syndication.php	Wed Jan 08 21:02:09 2014 -0500
@@ -234,7 +234,7 @@
         $fid = $A['fid'];
     }
     if ($fid == 0) {
-        if (!empty ($type)) { // set defaults
+        if (!empty($type)) { // set defaults
             $A['fid'] = $fid;
             $A['type'] = $type;
             $A['topic'] = '::all';
@@ -457,6 +457,7 @@
     }
 
     // Make sure correct format returned and correct file extenstion
+    $A['filename'] = COM_sanitizeFilename($A['filename'], true);
     $file_parts = pathinfo($A['filename']);
     $A['filename'] = ''; // Clear out filename. If it doesn't get recreated then we know there is an error
     if (!empty($file_parts['filename'])) {
@@ -465,31 +466,31 @@
             if ($A['format'] == ($f['name'] . '-' . $f['version'])) {
                 switch($f['name'])
                 {
-                    case "Atom":
-                        if ($file_parts['extension'] != "atm" OR $file_parts['extension'] != "xml") {
-                            $A['filename'] = $file_parts['filename'] . '.atm'; 
+                    case 'Atom':
+                        if (!in_array(@$file_parts['extension'], array('atm', 'xml'))) {
+                            $file_parts['extension'] = 'xml';
                         }
+
+                        $A['filename'] = $file_parts['filename'] . '.' . $file_parts['extension'];
                         break;
-                    
-                    case "RSS":
-                        if ($file_parts['extension'] != "rss" OR $file_parts['extension'] != "xml") {
-                            $A['filename'] = $file_parts['filename'] . '.rss';
+
+                    case 'RSS':
+                        if (!in_array(@$file_parts['extension'], array('rss', 'xml'))) {
+                            $file_parts['extension'] = 'rss';
                         }
+
+                        $A['filename'] = $file_parts['filename'] . '.' . $file_parts['extension'];
                         break;
-                        
-                    case "RDF":
-                        if ($file_parts['extension'] != "rdf") {
-                            $A['filename'] = $file_parts['filename'] . '.rdf';
-                        }
+
+                    case 'RDF':
+                        $A['filename'] = $file_parts['filename'] . '.rdf';
                         break;
-                        
                 }
-                
             }
         }
     }
-    if (empty ($A['title']) || empty ($A['description']) ||
-            empty ($A['filename'])) {
+    if (empty($A['title']) || empty($A['description']) ||
+            empty($A['filename'])) {
         $retval = COM_showMessageText($LANG33[39], $LANG33[38])
                 . editfeed ($A['fid'], $A['type']);
         $retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG33[38]));
@@ -516,19 +517,33 @@
     }
 
     // we can compensate if these are missing ...
-    if (empty ($A['charset'])) {
+	if (!empty($A['charset'])) {
+		$A['charset'] = preg_replace('/[^0-9a-zA-Z_\-]/', '', $A['charset']);
+	}
+
+    if (empty($A['charset'])) {
         $A['charset'] = $_CONF['default_charset'];
-        if (empty ($A['charset'])) {
+        if (empty($A['charset'])) {
             $A['charset'] = 'UTF-8';
         }
     }
-    if (empty ($A['language'])) {
+
+    if (!empty($A['language'])) {
+		$A['language'] = preg_replace('/[^0-9a-zA-Z_\.\-]/', '', $A['language']);
+	}
+
+    if (empty($A['language'])) {
         $A['language'] = $_CONF['rdf_language'];
-        if (empty ($A['language'])) {
+        if (empty($A['language'])) {
             $A['language'] = $_CONF['locale'];
         }
     }
-    if (empty ($A['content_length']) || ($A['content_length'] < 0)) {
+
+	if (!empty($A['content_length'])) {
+		$A['content_length'] = intval($A['content_length'], 10);
+	}
+
+    if (empty($A['content_length']) || ($A['content_length'] < 0)) {
         $A['content_length'] = 0;
     }
 
@@ -595,14 +610,14 @@
     $mode = $_REQUEST['mode'];
 }
 if ($mode == 'edit') {
-    if (empty ($_REQUEST['fid'])) {
+    if (empty($_REQUEST['fid'])) {
         $display .= newfeed ();
     } else {
         $display .= editfeed (COM_applyFilter($_REQUEST['fid']));
         $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG33[24]));
     }
 }
-elseif (($mode == $LANG33[1]) && !empty ($LANG33[1]))
+elseif (($mode == $LANG33[1]) && !empty($LANG33[1]))
 {
     $display .= editfeed (0, COM_applyFilter($_REQUEST['type']));
     $display = COM_createHTMLDocument($display, array('pagetitle' => $LANG33[24]));
diff -r d95ee4274ef3 -r 944e16f996b9 public_html/article.php
--- a/public_html/article.php	Sat Jan 04 17:29:10 2014 -0500
+++ b/public_html/article.php	Wed Jan 08 21:02:09 2014 -0500
@@ -391,8 +391,8 @@
                 $story_page = 1;
             } else {
                 $story_page = $mode;
+                $mode = '';
             }
-            $mode = '';
             
             if( $story_page <= 0 ) {
                 $story_page = 1;
diff -r d95ee4274ef3 -r 944e16f996b9 public_html/javascript/dialog_help.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/javascript/dialog_help.js	Wed Jan 08 21:02:09 2014 -0500
@@ -0,0 +1,35 @@
+$(function() {
+    $('a.blocktitle').each(function() {
+        var $link = $(this);
+        $link.one('click', function() {
+
+            var $loading = $('<div style="margin: auto; padding-top: 90px; width: 32px; height: 32px">'
+                + '<img src="' + geeklog.layout_url + '/images/loading.gif" alt="loading"' + geeklog.xhtml + '></div>');
+
+            var $dialog = $('<div></div>')
+                .append($loading.clone());
+
+            var buttons_obj = new Object();
+            buttons_obj[geeklog.lang.close] = function() {
+                $dialog.dialog("close");
+            };
+
+            $dialog
+                .load($link.attr('href')+ ' #content')
+                .dialog({
+                    title: $link.attr("title"),
+                    width: 500,
+                    height: 300,
+                    buttons: buttons_obj,
+                });
+
+            $link.click(function() {
+                $dialog.dialog("open");
+
+                return false;
+            });
+
+            return false;
+        });
+    });
+});
diff -r d95ee4274ef3 -r 944e16f996b9 public_html/layout/denim/header.thtml
--- a/public_html/layout/denim/header.thtml	Sat Jan 04 17:29:10 2014 -0500
+++ b/public_html/layout/denim/header.thtml	Wed Jan 08 21:02:09 2014 -0500
@@ -2,7 +2,7 @@
 <html{lang_attribute}{xmlns}>
 
 <head profile="http://www.w3.org/2003/g/data-view">



More information about the geeklog-cvs mailing list