[geeklog-hg] geeklog: Merged with upstream

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Feb 25 07:15:33 EST 2014


changeset 9506:d41e390c5f5e
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/d41e390c5f5e
user: Kenji ITO <mystralkk at gmail.com>
date: Tue Feb 25 21:15:00 2014 +0900
description:
Merged with upstream

diffstat:

 plugins/calendar/functions.inc                                          |    1 +
 plugins/spamx/SFSbase.class.php                                         |   13 +-
 plugins/spamx/functions.inc                                             |    8 +-
 public_html/admin/plugins/calendar/index.php                            |    1 +
 public_html/admin/story.php                                             |    1 +
 public_html/javascript/jquery_ui/jquery-ui-timepicker-addon-i18n.min.js |  Bin 
 public_html/javascript/topic_control.js                                 |    6 +-
 system/classes/scripts.class.php                                        |    1 +
 system/lib-topic.php                                                    |  176 ++++-----
 9 files changed, 107 insertions(+), 100 deletions(-)

diffs (truncated from 361 to 300 lines):

diff -r 95fd2be3e8bb -r d41e390c5f5e plugins/calendar/functions.inc
--- a/plugins/calendar/functions.inc	Tue Feb 25 16:46:38 2014 +0900
+++ b/plugins/calendar/functions.inc	Tue Feb 25 21:15:00 2014 +0900
@@ -738,6 +738,7 @@
     $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
     $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
     $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
+    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
     $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
 
     $langCode = COM_getLangIso639Code();
diff -r 95fd2be3e8bb -r d41e390c5f5e plugins/spamx/SFSbase.class.php
--- a/plugins/spamx/SFSbase.class.php	Tue Feb 25 16:46:38 2014 +0900
+++ b/plugins/spamx/SFSbase.class.php	Tue Feb 25 21:15:00 2014 +0900
@@ -109,11 +109,16 @@
             SPAMX_log ("SFS: spammer IP detected: " . $ip);
             
             // Add IP to SFS IP list... assuming sfs runs after ip check so no dups
-            $timestamp = DB_escapeString(date('Y-m-d H:i:s'));
+            // Double Check for IP address just in case
             $db_ip = DB_escapeString($ip);
-            $sql = "INSERT INTO {$_TABLES['spamx']} (name, value, regdate) 
-                    VALUES ('IP', '$db_ip', '$timestamp')";
-            DB_query($sql);
+            $result = DB_query("SELECT value FROM {$_TABLES['spamx']}
+                    WHERE name='IP' AND value='$db_ip'", 1);
+            if (DB_numRows($result) == 0) { // Not in db so add            
+                $timestamp = DB_escapeString(date('Y-m-d H:i:s'));
+                $sql = "INSERT INTO {$_TABLES['spamx']} (name, value, regdate) 
+                        VALUES ('IP', '$db_ip', '$timestamp')";
+                DB_query($sql);
+            }
         } else if ($this->_verbose) {
             SPAMX_log ("SFS: spammer IP not detected: " . $ip);
         }
diff -r 95fd2be3e8bb -r d41e390c5f5e plugins/spamx/functions.inc
--- a/plugins/spamx/functions.inc	Tue Feb 25 16:46:38 2014 +0900
+++ b/plugins/spamx/functions.inc	Tue Feb 25 21:15:00 2014 +0900
@@ -136,11 +136,15 @@
  */
 function plugin_getadminoption_spamx()
 {
-    global $_CONF, $LANG_SX00;
+    global $_CONF, $LANG_SX00, $_TABLES;
 
     if (SEC_hasRights('spamx.admin')) {
+        $result = DB_query ("SELECT count(*) AS cnt FROM {$_TABLES['spamx']}");
+        $A = DB_fetchArray ($result);
+        $count = $A['cnt'];
+       
         return array($LANG_SX00['plugin_name'],
-            $_CONF['site_admin_url'] . '/plugins/spamx/index.php', '', 'tools');
+            $_CONF['site_admin_url'] . '/plugins/spamx/index.php', $count, 'tools');
     }
 }
 
diff -r 95fd2be3e8bb -r d41e390c5f5e public_html/admin/plugins/calendar/index.php
--- a/public_html/admin/plugins/calendar/index.php	Tue Feb 25 16:46:38 2014 +0900
+++ b/public_html/admin/plugins/calendar/index.php	Tue Feb 25 21:15:00 2014 +0900
@@ -83,6 +83,7 @@
     $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
     $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
     $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
+    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
     $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
 
     // Add JavaScript
diff -r 95fd2be3e8bb -r d41e390c5f5e public_html/admin/story.php
--- a/public_html/admin/story.php	Tue Feb 25 16:46:38 2014 +0900
+++ b/public_html/admin/story.php	Tue Feb 25 21:15:00 2014 +0900
@@ -754,6 +754,7 @@
     $_SCRIPTS->setJavaScriptLibrary('jquery.ui.datepicker');
     $_SCRIPTS->setJavaScriptLibrary('jquery-ui-i18n');
     $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon');
+    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-timepicker-addon-i18n');
 //    $_SCRIPTS->setJavaScriptLibrary('jquery-ui-slideraccess');
     $_SCRIPTS->setJavaScriptFile('datetimepicker', '/javascript/datetimepicker.js');
 
diff -r 95fd2be3e8bb -r d41e390c5f5e public_html/javascript/jquery_ui/jquery-ui-timepicker-addon-i18n.min.js
Binary file public_html/javascript/jquery_ui/jquery-ui-timepicker-addon-i18n.min.js has changed
diff -r 95fd2be3e8bb -r d41e390c5f5e public_html/javascript/topic_control.js
--- a/public_html/javascript/topic_control.js	Tue Feb 25 16:46:38 2014 +0900
+++ b/public_html/javascript/topic_control.js	Tue Feb 25 21:15:00 2014 +0900
@@ -107,7 +107,7 @@
     }
 
     $display = ($('#tid option:selected').size() == 0)
-                 ? 'none' : 'inline-block';
+             ? 'none' : 'inline-block';
     if ($('#panel_radio_options').is(':visible') &&
         !$('#topic_option_selectedtopics').is(':checked')) {
         $display = 'none';
@@ -123,7 +123,3 @@
     $('#panel_inherit_options').css('display', $inherit);
     $('#panel_default_options').css('display', $defalut);
 }
-
-$(function() {
-    changeTopicControlDisplay();
-});
diff -r 95fd2be3e8bb -r d41e390c5f5e system/classes/scripts.class.php
--- a/system/classes/scripts.class.php	Tue Feb 25 16:46:38 2014 +0900
+++ b/system/classes/scripts.class.php	Tue Feb 25 21:15:00 2014 +0900
@@ -165,6 +165,7 @@
 
         // jQuery Timepicker Addon (http://trentrichardson.com/examples/timepicker/)
         $names[] = 'jquery-ui-timepicker-addon';
+        $names[] = 'jquery-ui-timepicker-addon-i18n';
         $names[] = 'jquery-ui-slideraccess';
 
         // Set jQuery UI Effects
diff -r 95fd2be3e8bb -r d41e390c5f5e system/lib-topic.php
--- a/system/lib-topic.php	Tue Feb 25 16:46:38 2014 +0900
+++ b/system/lib-topic.php	Tue Feb 25 21:15:00 2014 +0900
@@ -840,23 +840,22 @@
 function TOPIC_getTopicSelectionControl($type, $id, $show_options = false, $show_inherit = false, $show_default = false)
 {
     global $_CONF, $LANG27, $_TABLES, $topic, $_SCRIPTS;
-    
+
     $tids = array();
     $inherit_tids = array();
     $default_tid = '';
     // Set Default Topic Option
+    $topic_option = TOPIC_SELECTED_OPTION;
     if ($show_options) {
         $topic_option = TOPIC_ALL_OPTION; // Default to all topics so things will work similar to how topics handled before Geeklog 2.0.0
-    } else {
-        $topic_option = TOPIC_SELECTED_OPTION;
     }
-    
+
     // Do they have any access to topics first?
-    
+
     // Retrieve Topic options
     $from_db = true;
     if (empty($type) || empty($id)) {
-        $from_db = false; 
+        $from_db = false;
     }
     if (!$from_db) {
          // see if a selection control variable is_a set. If not then first time for display of control
@@ -864,24 +863,23 @@
             TOPIC_getDataTopicSelectionControl($topic_option, $tids, $inherit_tids, $default_tid);
         } else {
             // Figure out if we set current topic for first display or use default topic
-            if ($topic_option == TOPIC_SELECTED_OPTION AND empty($tids)) {
+            if ($topic_option == TOPIC_SELECTED_OPTION && empty($tids)) {
                 if ($topic == '') {
-                    $tids = (DB_getItem($_TABLES['topics'], 'tid', 'is_default = 1' . COM_getPermSQL('AND')));
+                    $tids = DB_getItem($_TABLES['topics'], 'tid', 'is_default = 1' . COM_getPermSQL('AND'));
                 } else {
                     $tids = $topic;
                 }
             }
         }
-    } else {    
+    } else {
         $sql = "SELECT * FROM {$_TABLES['topic_assignments']} WHERE type = '$type' AND id ='$id'";
-    
+
         $result = DB_query($sql);
         $B = DB_fetchArray($result);
         $nrows = DB_numRows($result);
         if ($nrows > 0) {
             if ($B['tid'] == TOPIC_ALL_OPTION || $B['tid'] == TOPIC_HOMEONLY_OPTION) {
                 $topic_option = $B['tid'];
-                $A['tid'] ='';
             } else {
                 $topic_option = TOPIC_SELECTED_OPTION;
                 $tids = array();
@@ -891,7 +889,7 @@
                 }
                 if ($B['tdefault'] == 1) {
                     $default_tid = $B['tid'];
-                }        
+                }
                 for ($i = 1; $i < $nrows; $i++) {
                     $B = DB_fetchArray($result);
                     $tids[] = $B['tid'];
@@ -915,102 +913,102 @@
 
     $topic_templates = COM_newTemplate($_CONF['path_layout'] . 'admin/common');
     $topic_templates->set_file(array('editor' => 'edit_topics.thtml'));
-    
+
     $_SCRIPTS->setJavaScriptLibrary('jquery');
     $_SCRIPTS->setJavascriptFile('topic_control', '/javascript/topic_control.js');
-    
+
     $topiclist = TOPIC_getTopicListSelect($tids, false);
+    if (!$show_options && $topiclist == '') { // If access to no topics return nothing
+        return '';
+    }
+
+    $topic_hide = false; // If false then topics multi select box will be visible
+    $val_hide = 'display:none;';
     if ($topiclist == '') { // Topics do not exist
-        $topic_templates->set_var('topic_option_hide', 'display: none;');
-        $topic_templates->set_var('topic_hide', 'display: none;');
+        $topic_hide = true;
+        $topic_templates->set_var('topic_option_hide', $val_hide);
     } else {
         $topic_templates->set_var('topic_options', $topiclist);
     }
-    
-//    // If no topic selection then do not show inherit or default
-//    if (empty($tids)) {
-//        $show_inherit = false;
-//        $show_default = false;
-//    }
-    
+
+    if ($show_options && $topic_option !== TOPIC_SELECTED_OPTION) {
+        $topic_hide = true;
+    }
+    $inherit_hide = true; // If false then inhert topic selection will be visible
+    $default_hide = true; // If false then default topic selection will be visible
+    if (!$topic_hide) {
+        $inherit_hide = $show_inherit ? false : true;
+        $default_hide = $show_default ? false : true;
+    }
+
     if ($show_options) {
         $topic_templates->set_var('topic_options_hide', '0');
         $topic_info = $LANG27[41];
-        if ($topic_option == TOPIC_ALL_OPTION) {
-            $topic_templates->set_var('all_checked', 'checked="checked"');
-            $topic_templates->set_var('homeonly_checked', '');
-            $topic_templates->set_var('selectedtopics_checked', '');
-            
-//            $show_inherit = false;
-//            $show_default = false;            
-        } elseif ($topic_option == TOPIC_HOMEONLY_OPTION) {
-            $topic_templates->set_var('all_checked', '');
-            $topic_templates->set_var('homeonly_checked', 'checked="checked"');
-            $topic_templates->set_var('selectedtopics_checked', '');
+        $val_checked = 'checked="checked"';
+        $all_checked            = ($topic_option == TOPIC_ALL_OPTION)      ? $val_checked : '';
+        $homeonly_checked       = ($topic_option == TOPIC_HOMEONLY_OPTION) ? $val_checked : '';
+        $selectedtopics_checked = ($topic_option == TOPIC_SELECTED_OPTION) ? $val_checked : '';
+        // if no topics found cannot check so set default
+        if ($topic_option == TOPIC_SELECTED_OPTION && $topiclist == '') {
+            $all_checked = $val_checked;
+            $selectedtopics_checked = '';
+        }
+        $topic_templates->set_var('all_checked', $val_checked);
+        $topic_templates->set_var('homeonly_checked', $homeonly_checked);
+        $topic_templates->set_var('selectedtopics_checked', $selectedtopics_checked);
+    } else {
+        $topic_templates->set_var('options_hide', $val_hide);
+        $topic_templates->set_var('topic_options_hide', '1');
+    }
 
-//            $show_inherit = false;
-//            $show_default = false;            
-        } else{
-            $topic_templates->set_var('homeonly_checked', '');
-            
-            // if no topics found cannot check so set default
-            if ($topiclist == '') {
-                $topic_templates->set_var('all_checked', 'checked="checked"');
-                $topic_templates->set_var('selectedtopics_checked', '');
+    $opt_dummy = '<option value="dummy">dummy</option>';
+    $inherit_options = $opt_dummy;
+    $topic_inherit_hide = '1';
+    if ($show_inherit) {
+        $topic_inherit_hide = '0';
+        $topic_info .= $LANG27[42];
+        if (!empty($inherit_tids)) {
+            if ($from_db) {
+                $inherit_options = TOPIC_getOtherListSelect($type, $id, $inherit_tids);
             } else {
-                $topic_templates->set_var('all_checked', '');
-                $topic_templates->set_var('selectedtopics_checked', 'checked="checked"');
+                $inherit_options = TOPIC_getOtherListSelect($type, $id, $inherit_tids, $tids);
             }
+        } else {
+            $inherit_hide = true;
         }
-    } else {
-        $topic_templates->set_var('options_hide', 'display: none;');
-        $topic_templates->set_var('topic_options_hide', '1');          
     }
-    
-    if (!$show_options && $topiclist == '') { // If access to no topics return nothing
-        return '';
+
+    $default_options = $opt_dummy;
+    $topic_default_hide = '1';
+    if ($show_default) {
+        $topic_default_hide = '0';
+        $topic_info .= $LANG27[43];
+        if (!empty($default_tid)) {
+            if ($from_db) {
+                $default_options = TOPIC_getOtherListSelect($type, $id, $default_tid);
+            } else {
+                $default_options = TOPIC_getOtherListSelect($type, $id, $default_tid, $tids);
+            }



More information about the geeklog-cvs mailing list