[geeklog-cvs] geeklog: Merge with upstream

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Mar 10 17:17:40 EST 2012


changeset 8518:05359d207063
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/05359d207063
user: Rouslan Placella <rouslan at placella.com>
date: Sat Mar 10 22:17:08 2012 +0000
description:
Merge with upstream

diffstat:

 plugins/spamx/autoinstall.php       |   6 +++-
 plugins/spamx/functions.inc         |  43 ++++++++++++++++++++++++------------
 plugins/spamx/install_updates.php   |   3 +-
 plugins/spamx/sql/mssql_updates.php |  36 ++++++++++++++++++++++++++----
 plugins/spamx/sql/mysql_updates.php |  36 ++++++++++++++++++++++++++----
 plugins/spamx/sql/pgsql_updates.php |  36 ++++++++++++++++++++++++++----
 system/classes/story.class.php      |  41 +++++++++++++++++++---------------
 system/lib-user.php                 |   4 +++
 8 files changed, 154 insertions(+), 51 deletions(-)

diffs (truncated from 399 to 300 lines):

diff -r fe888cdcfd1f -r 05359d207063 plugins/spamx/autoinstall.php
--- a/plugins/spamx/autoinstall.php	Sat Mar 10 22:15:21 2012 +0000
+++ b/plugins/spamx/autoinstall.php	Sat Mar 10 22:17:08 2012 +0000
@@ -64,12 +64,14 @@
     $features = array(
         $pi_name . '.admin'                 => 'Full access to ' . $pi_display_name . ' plugin',
         $pi_name . '.skip'                  =>  'Skip checking posts for Spam', 
-        'config.' . $pi_name . '.tab_main'  => 'Access to configure Spam-x main settings'
+        'config.' . $pi_name . '.tab_main'  => 'Access to configure Spam-x main settings',
+        'config.' . $pi_name . '.tab_modules'  => 'Access to configure Spam-x modules'
     );
 
     $mappings = array(
         $pi_name . '.admin'                 => array($pi_admin),
-        'config.' . $pi_name . '.tab_main'  => array($pi_admin)
+        'config.' . $pi_name . '.tab_main'  => array($pi_admin),
+        'config.' . $pi_name . '.tab_modules'  => array($pi_admin)
     );
 
     $tables = array(
diff -r fe888cdcfd1f -r 05359d207063 plugins/spamx/functions.inc
--- a/plugins/spamx/functions.inc	Sat Mar 10 22:15:21 2012 +0000
+++ b/plugins/spamx/functions.inc	Sat Mar 10 22:17:08 2012 +0000
@@ -235,20 +235,22 @@
                 }
             }            
 
-            // Remove admin override since not needed anymore
-            $c = config::get_instance();
-            $c->del('admin_override', 'spamx');
-
-            // late fix: ensure 'notification_email' option can be disabled
-            $result = DB_query("SELECT value, default_value FROM {$_TABLES['conf_values']} WHERE name = 'notification_email' AND group_name = 'spamx'");
-            list($value, $default_value) = DB_fetchArray($result);
-            if ($value != 'unset') {
-                if (substr($default_value, 0, 6) != 'unset:') {
-                    $unset = addslashes('unset:' . $default_value);
-                    DB_query("UPDATE {$_TABLES['conf_values']} SET default_value = '$unset' WHERE name = 'notification_email' AND group_name = 'spamx'");
+            if (! $current_config) {
+                // Remove admin override since not needed anymore
+                $c = config::get_instance();
+                $c->del('admin_override', 'spamx');
+    
+                // late fix: ensure 'notification_email' option can be disabled
+                $result = DB_query("SELECT value, default_value FROM {$_TABLES['conf_values']} WHERE name = 'notification_email' AND group_name = 'spamx'");
+                list($value, $default_value) = DB_fetchArray($result);
+                if ($value != 'unset') {
+                    if (substr($default_value, 0, 6) != 'unset:') {
+                        $unset = addslashes('unset:' . $default_value);
+                        DB_query("UPDATE {$_TABLES['conf_values']} SET default_value = '$unset' WHERE name = 'notification_email' AND group_name = 'spamx'");
+                    }
                 }
             }
-
+            
             $current_version = '1.2.1';
             break;
 
@@ -262,9 +264,9 @@
 
             if (! $current_config) {
                 spamx_update_ConfValues_1_2_1();  
-
-                spamx_update_ConfigSecurity_1_2_1();
             }
+            
+            spamx_update_ConfigSecurity_1_2_1();
 
             $current_version = '1.2.2';
             break;
@@ -278,8 +280,19 @@
             }            
 
             if (! $current_config) {
-                spamx_update_ConfValues_1_2_2();  
+                // Update to Config Tables must be performed here and not in regualar SQL update array since if config is current then they shouldn't be run   
+                // Set new Tab column to whatever fieldset is
+                $sql = "UPDATE {$_TABLES['conf_values']} SET tab = fieldset WHERE group_name = 'spamx'";
+                DB_query($sql);
+                
+                // Rename the action config option since it is causes JavaScript issues in the config and IE 8
+                $sql = "UPDATE {$_TABLES['conf_values']} SET name = 'spamx_name' WHERE name = 'action'";
+                DB_query($sql);   
+                
+                spamx_update_ConfValues_1_2_2();
             }
+            
+            spamx_update_ConfigSecurity_1_2_2();
 
             $current_version = '1.3.0';
             break;            
diff -r fe888cdcfd1f -r 05359d207063 plugins/spamx/install_updates.php
--- a/plugins/spamx/install_updates.php	Sat Mar 10 22:15:21 2012 +0000
+++ b/plugins/spamx/install_updates.php	Sat Mar 10 22:17:08 2012 +0000
@@ -17,7 +17,8 @@
 function spamx_update_ConfValues_1_2_2()
 {
     global $_CONF, $_SPX_DEFAULT;
-
+    
+    // Now add in new Config options
     require_once $_CONF['path_system'] . 'classes/config.class.php';
     
     $c = config::get_instance();
diff -r fe888cdcfd1f -r 05359d207063 plugins/spamx/sql/mssql_updates.php
--- a/plugins/spamx/sql/mssql_updates.php	Sat Mar 10 22:15:21 2012 +0000
+++ b/plugins/spamx/sql/mssql_updates.php	Sat Mar 10 22:17:08 2012 +0000
@@ -40,11 +40,11 @@
     ),
     
     '1.2.1' => array(
-        // Set new Tab column to whatever fieldset is
-        "UPDATE {$_TABLES['conf_values']} SET tab = fieldset WHERE group_name = 'spamx'",   
-        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_main', 'Access to configure Spam-x main settings', 0)", 
-        // Rename the action config option since it is causes JavaScript issues in the config and IE 8
-        "UPDATE {$_TABLES['conf_values']} SET name = 'spamx_name' WHERE name = 'action'"        
+        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_main', 'Access to configure Spam-x main settings', 0)" 
+    ),
+
+    '1.2.2' => array(
+        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_modules', 'Access to configure Spam-x modules', 0)" 
     )    
     
 );
@@ -75,4 +75,30 @@
 
 }
 
+/**
+ * Add in new security rights for the Group "Spamx Admin"
+ *
+ */
+function spamx_update_ConfigSecurity_1_2_2()
+{
+    global $_TABLES;
+    
+    // Add in security rights for Spam-x Admin
+    $group_id = DB_getItem($_TABLES['groups'], 'grp_id',
+                            "grp_name = 'Spamx Admin'");
+
+    if ($group_id > 0) {
+        $ft_names[] = 'config.spamx.tab_modules';
+        
+        foreach ($ft_names as $name) {
+            $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = '$name'");         
+            if ($ft_id > 0) {
+                $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($ft_id, $group_id)";
+                DB_query($sql);
+            }
+        }        
+    }    
+
+}
+
 ?>
diff -r fe888cdcfd1f -r 05359d207063 plugins/spamx/sql/mysql_updates.php
--- a/plugins/spamx/sql/mysql_updates.php	Sat Mar 10 22:15:21 2012 +0000
+++ b/plugins/spamx/sql/mysql_updates.php	Sat Mar 10 22:17:08 2012 +0000
@@ -40,11 +40,11 @@
     ),
     
     '1.2.1' => array(
-        // Set new Tab column to whatever fieldset is
-        "UPDATE {$_TABLES['conf_values']} SET tab = fieldset WHERE group_name = 'spamx'",   
-        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_main', 'Access to configure Spam-x main settings', 0)",
-        // Rename the action config option since it is causes JavaScript issues in the config and IE 8
-        "UPDATE {$_TABLES['conf_values']} SET name = 'spamx_name' WHERE name = 'action'"
+        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_main', 'Access to configure Spam-x main settings', 0)"
+    ),
+
+    '1.2.2' => array(
+        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_modules', 'Access to configure Spam-x modules', 0)" 
     )    
     
 );
@@ -75,4 +75,30 @@
 
 }
 
+/**
+ * Add in new security rights for the Group "Spamx Admin"
+ *
+ */
+function spamx_update_ConfigSecurity_1_2_2()
+{
+    global $_TABLES;
+    
+    // Add in security rights for Spam-x Admin
+    $group_id = DB_getItem($_TABLES['groups'], 'grp_id',
+                            "grp_name = 'Spamx Admin'");
+
+    if ($group_id > 0) {
+        $ft_names[] = 'config.spamx.tab_modules';
+        
+        foreach ($ft_names as $name) {
+            $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = '$name'");         
+            if ($ft_id > 0) {
+                $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($ft_id, $group_id)";
+                DB_query($sql);
+            }
+        }        
+    }    
+
+}
+
 ?>
diff -r fe888cdcfd1f -r 05359d207063 plugins/spamx/sql/pgsql_updates.php
--- a/plugins/spamx/sql/pgsql_updates.php	Sat Mar 10 22:15:21 2012 +0000
+++ b/plugins/spamx/sql/pgsql_updates.php	Sat Mar 10 22:17:08 2012 +0000
@@ -35,11 +35,11 @@
 $_UPDATES = array(
     
     '1.2.1' => array(
-        // Set new Tab column to whatever fieldset is
-        "UPDATE {$_TABLES['conf_values']} SET tab = fieldset WHERE group_name = 'spamx'",   
-        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_main', 'Access to configure Spam-x main settings', 0)", 
-        // Rename the action config option since it is causes JavaScript issues in the config and IE 8
-        "UPDATE {$_TABLES['conf_values']} SET name = 'spamx_name' WHERE name = 'action'"        
+        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_main', 'Access to configure Spam-x main settings', 0)" 
+    ),
+
+    '1.2.2' => array(
+        "INSERT INTO {$_TABLES['features']} (ft_name, ft_descr, ft_gl_core) VALUES ('config.spamx.tab_modules', 'Access to configure Spam-x modules', 0)" 
     )    
     
 );
@@ -70,4 +70,30 @@
 
 }
 
+/**
+ * Add in new security rights for the Group "Spamx Admin"
+ *
+ */
+function spamx_update_ConfigSecurity_1_2_2()
+{
+    global $_TABLES;
+    
+    // Add in security rights for Spam-x Admin
+    $group_id = DB_getItem($_TABLES['groups'], 'grp_id',
+                            "grp_name = 'Spamx Admin'");
+
+    if ($group_id > 0) {
+        $ft_names[] = 'config.spamx.tab_modules';
+        
+        foreach ($ft_names as $name) {
+            $ft_id = DB_getItem($_TABLES['features'], 'ft_id', "ft_name = '$name'");         
+            if ($ft_id > 0) {
+                $sql = "INSERT INTO {$_TABLES['access']} (acc_ft_id, acc_grp_id) VALUES ($ft_id, $group_id)";
+                DB_query($sql);
+            }
+        }        
+    }    
+
+}
+
 ?>
diff -r fe888cdcfd1f -r 05359d207063 system/classes/story.class.php
--- a/system/classes/story.class.php	Sat Mar 10 22:15:21 2012 +0000
+++ b/system/classes/story.class.php	Sat Mar 10 22:17:08 2012 +0000
@@ -909,9 +909,9 @@
         $this->_topic = $topic['topic'];
         $this->_imageurl = $topic['imageurl'];
 
-        /* Then load the title, intro and body */
+        /* Then load the title, page title, intro and body */
         if (($array['postmode'] == 'html') || ($array['postmode'] == 'adveditor') || ($array['postmode'] == 'wikitext')) {
-            $this->_htmlLoadStory($array['title'], $array['introtext'], $array['bodytext']);
+            $this->_htmlLoadStory($array['title'], $array['page_title'], $array['introtext'], $array['bodytext']);
 
             if ($this->_postmode == 'adveditor') {
                 $this->_advanced_editor_mode = 1;
@@ -921,7 +921,7 @@
             }
         } else {
             $this->_advanced_editor_mode = 0;
-            $this->_plainTextLoadStory($array['title'], $array['introtext'], $array['bodytext']);
+            $this->_plainTextLoadStory($array['title'], $array['page_title'], $array['introtext'], $array['bodytext']);
         }
 
         if (empty($this->_title) || empty($this->_introtext)) {
@@ -1010,9 +1010,9 @@
             $array['bodytext'] = '';
         }
 
-        /* Then load the title, intro and body */
+        /* Then load the title, page title, intro and body */
         if (($array['postmode'] == 'html') || ($array['postmode'] == 'adveditor')) {
-            $this->_htmlLoadStory($array['title'], $array['introtext'], $array['bodytext']);
+            $this->_htmlLoadStory($array['title'], $array['page_title'], $array['introtext'], $array['bodytext']);
 
             if ($this->_postmode == 'adveditor') {
                 $this->_advanced_editor_mode = 1;
@@ -1022,7 +1022,7 @@
             }
         } else {
             $this->_advanced_editor_mode = 0;
-            $this->_plainTextLoadStory($array['title'], $array['introtext'], $array['bodytext']);
+            $this->_plainTextLoadStory($array['title'], $array['page_title'], $array['introtext'], $array['bodytext']);
         }



More information about the geeklog-cvs mailing list