[geeklog-cvs] geeklog: ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Jan 26 15:53:32 EST 2010


changeset 7625:8adc4d41c628
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/8adc4d41c628
user: stan <yankees26an at gmail.com>
date: Sat Jul 04 23:55:37 2009 -0400
description:
...

diffstat:

 public_html/admin/sectest.php           |   7 +++++--
 public_html/users.php                   |  10 +++++++---
 system/classes/search.class.php         |  39 ++++++++++++++-------------------------
 system/classes/searchcriteria.class.php |   4 ++++
 system/lib-plugins.php                  |  29 +++++++++++------------------
 5 files changed, 41 insertions(+), 48 deletions(-)

diffs (278 lines):

diff -r d84e2e6d7158 -r 8adc4d41c628 public_html/admin/sectest.php
--- a/public_html/admin/sectest.php	Tue Jun 30 00:05:56 2009 -0400
+++ b/public_html/admin/sectest.php	Sat Jul 04 23:55:37 2009 -0400
@@ -369,11 +369,14 @@
     $display .= '<p class="warningsmall"><strong>'
              . $LANG_SECTEST['please_fix'] . '</strong></p>';
 
-    DB_save($_TABLES['vars'], 'name,value', "'security_check','0'");
+    //DB_save($_TABLES['vars'], 'name,value', "'security_check','0'");
+    DB_query("UPDATE {$_TABLES['vars']} SET name='security_check', value ='0'");
 } else {
     $display .= '<p>' . $LANG_SECTEST['please_note'] . '</p>';
 
-    DB_save($_TABLES['vars'], 'name,value', "'security_check','1'");
+    //DB_save($_TABLES['vars'], 'name,value', "'security_check','1'");
+    DB_query("UPDATE {$_TABLES['vars']} SET name='security_check', value ='1'");
+
 }
 
 $ml = COM_createLink('geeklog-announce',
diff -r d84e2e6d7158 -r 8adc4d41c628 public_html/users.php
--- a/public_html/users.php	Tue Jun 30 00:05:56 2009 -0400
+++ b/public_html/users.php	Sat Jul 04 23:55:37 2009 -0400
@@ -258,13 +258,14 @@
             $sidArray[] = $S['sid'];
         }
     }
-
+    unset($sql);
+    $sql = array();
     $sidList = implode("', '",$sidArray);
     $sidList = "'$sidList'";
 
     // then, find all comments by the user in those stories
     $sql['mysql'] = "SELECT sid,title,cid,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['comments']} WHERE (uid = $user) GROUP BY sid,title,cid,UNIX_TIMESTAMP(date)";
-    $sql['pgsql'] = "SELECT sid,title,cid,date_part('epoch',date) AS unixdate FROM {$_TABLES['comments']} WHERE (uid = $user) GROUP BY sid,title,cid,date_poart('epoch',date)";
+    $sql['pgsql'] = "SELECT sid,title,cid,date_part('epoch',date) AS unixdate FROM {$_TABLES['comments']} WHERE (uid = $user) GROUP BY sid,title,cid,date_part('epoch',date)";
     $sql['mssql'] = "SELECT sid,title,cid,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['comments']} WHERE (uid = $user) GROUP BY sid,title,cid,UNIX_TIMESTAMP(date)";
 
     // SQL NOTE:  Using a HAVING clause is usually faster than a where if the
@@ -273,7 +274,10 @@
     //     $sql .= " AND (sid in ($sidList))";
     // }
     if (!empty ($sidList)) {
-        $sql .= " HAVING sid in ($sidList)";
+        $sql['mysql'] .= " HAVING sid in ($sidList)";
+        $sql['mssql'] .= " HAVING sid in ($sidList)";
+        $sql['pgsql'] .= " HAVING sid in ($sidList)";
+
     }
     $sql['mysql'] .= " ORDER BY unixdate DESC LIMIT 10";
     $sql['pgsql'] .= " ORDER BY unixdate DESC LIMIT 10";
diff -r d84e2e6d7158 -r 8adc4d41c628 system/classes/search.class.php
--- a/system/classes/search.class.php	Tue Jun 30 00:05:56 2009 -0400
+++ b/system/classes/search.class.php	Sat Jul 04 23:55:37 2009 -0400
@@ -352,9 +352,8 @@
         // Make sure the query is SQL safe
         $query = trim(addslashes($this->_query));
 
-        $sql = "SELECT s.sid AS id, s.title AS title, s.introtext AS description, ";
-        $sql .= "UNIX_TIMESTAMP(s.date) AS date, s.uid AS uid, s.hits AS hits, ";
-        $sql .= "CONCAT('/article.php?story=',s.sid) AS url ";
+        $sql = "SELECT s.sid AS id, s.title AS title, s.introtext AS description, UNIX_TIMESTAMP(s.date) AS date, s.uid AS uid, s.hits AS hits,";
+        $sql .= ($_DB_dbms=='pgsql')? "'/article.php?story='||s.sid AS url ":"CONCAT('/article.php?story=',s.sid) AS url ";
         $sql .= "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u ";
         $sql .= "WHERE (draft_flag = 0) AND (date <= NOW()) AND (u.uid = s.uid) ";
         $sql .= COM_getPermSQL('AND') . COM_getTopicSQL('AND') . COM_getLangSQL('sid', 'AND') . ' ';
@@ -379,7 +378,7 @@
         }
 
         $search = new SearchCriteria('stories', $LANG09[65]);
-        $columns = array('title' => 'title', 'introtext', 'bodytext');
+        $columns = array('introtext', 'bodytext', 'title' => 'title');
         list($sql, $ftsql) = $search->buildSearchSQL($this->_keyType, $query, $columns, $sql);
         $search->setSQL($sql);
         $search->setFTSQL($ftsql);
@@ -405,8 +404,7 @@
         // Make sure the query is SQL safe
         $query = trim(addslashes($this->_query));
 
-        $sql = "SELECT c.cid AS id, c.title AS title, c.comment AS description, ";
-        $sql .= "UNIX_TIMESTAMP(c.date) AS date, c.uid AS uid, ";
+        $sql = "SELECT c.cid AS id, c.title AS title, c.comment AS description, UNIX_TIMESTAMP(c.date) AS date, c.uid AS uid, '0' AS hits, ";
 
         // MSSQL has a problem when concatenating numeric values
         if ($_DB_dbms == 'mssql') {
@@ -440,7 +438,7 @@
         }
 
         $search = new SearchCriteria('comments', $LANG09[66]);
-        $columns = array('title' => 'c.title', 'comment');
+        $columns = array('comment', 'title' => 'c.title');
         list($sql, $ftsql) = $search->buildSearchSQL($this->_keyType, $query, $columns, $sql);
         $search->setSQL($sql);
         $search->setFTSQL($ftsql);
@@ -635,9 +633,9 @@
                                 SQL_TITLE =>      $label,
                                 'title' =>        $col_title == -1 ? '<i>' . $LANG09[70] . '</i>' : $old_row[$col_title],
                                 'description' =>  $col_desc == -1 ? '<i>' . $LANG09[70] . '</i>' : $old_row[$col_desc],
-                                'date' =>         $col_date == -1 ? 'LF_NULL' : $date,
-                                'uid' =>          $col_user == -1 ? 'LF_NULL' : $old_row[$col_user],
-                                'hits' =>         $col_hits == -1 ? 'LF_NULL' : str_replace(',', '', $old_row[$col_hits])
+                                'date' =>         $col_date == -1 ? ' ' : $date,
+                                'uid' =>          $col_user == -1 ? ' ' : $old_row[$col_user],
+                                'hits' =>         $col_hits == -1 ? '0' : str_replace(',', '', $old_row[$col_hits])
                             );
                     preg_match('/href="([^"]+)"/i', $api_results['title'], $links);
                     $api_results['url'] = empty($links) ? '#' : $links[1];
@@ -663,21 +661,18 @@
         if ($this->_keyType == 'any')
         {
             $searchQuery = str_replace(' ', "</b>' " . $LANG09[57] . " '<b>", $escquery);
-            $searchQuery = "'<b>$searchQuery</b>'";
+            $searchQuery = "<b>'$searchQuery'</b>";
         }
         else if ($this->_keyType == 'all')
         {
             $searchQuery = str_replace(' ', "</b>' " . $LANG09[56] . " '<b>", $escquery);
-            $searchQuery = "'<b>$searchQuery</b>'";
+            $searchQuery = "<b>'$searchQuery'</b>";
         }
         else
         {
             $searchQuery = $LANG09[55] . " '<b>$escquery</b>'";
         }
 
-        // Clean the query string so that sprintf works as expected
-        $searchQuery = str_replace("%", "%%", $searchQuery);
-
         $retval = "{$LANG09[25]} $searchQuery. ";
         if (count($results) == 0)
         {
@@ -688,8 +683,7 @@
         }
         else
         {
-            $retval .= $LANG09[64] . " ($searchtime {$LANG09[27]}). ";
-            $retval .= str_replace("%", "%%", COM_createLink($LANG09[61], $url.'refine'));
+            $retval .= $LANG09[64] . " ($searchtime {$LANG09[27]}). " . COM_createLink($LANG09[61], $url.'refine');
             $retval = '<p>' . $retval . '</p>' . LB;
             $retval = $obj->getFormattedOutput($results, $LANG09[11], $retval, '', $_CONF['search_show_sort'], $_CONF['search_show_limit']);
         }
@@ -757,13 +751,8 @@
                 $row['description'] = stripslashes($this->_shortenText($this->_query, $row['description'], $this->_wordlength));
             }
 
-            if ($row['date'] != 'LF_NULL') {
-                $row['date'] = strftime($_CONF['daytime'], intval($row['date']));
-            }
-
-            if ($row['hits'] != 'LF_NULL') {
-                $row['hits'] = COM_NumberFormat($row['hits']) . ' '; // simple solution to a silly problem!
-            }
+            $row['date'] = strftime($_CONF['daytime'], intval($row['date']));
+            $row['hits'] = COM_NumberFormat($row['hits']) . ' '; // simple solution to a silly problem!
         }
 
         return $row;
@@ -906,7 +895,7 @@
     *
     * @param   string  $haystack  string to search in
     * @param   string  $needle    string to search for
-    * @return  mixed              first pos of $needle in $haystack, or false
+    * @return  mixed              first pos of $needle in $haystack, or false 
     *
     */
     function _stripos($haystack, $needle)
diff -r d84e2e6d7158 -r 8adc4d41c628 system/classes/searchcriteria.class.php
--- a/system/classes/searchcriteria.class.php	Tue Jun 30 00:05:56 2009 -0400
+++ b/system/classes/searchcriteria.class.php	Sat Jul 04 23:55:37 2009 -0400
@@ -127,6 +127,8 @@
 
             $ftwords['mysql'] = '+' . str_replace(' ', ' +', $query);
             $ftwords['mssql'] = '"' . str_replace(' ', '" AND "', $query) . '"';
+            $ftwords['pgsql'] = '"' . str_replace(' ', '" AND "', $query) . '"';
+
         }
         else if ($keyType == 'any')
         {
@@ -134,6 +136,7 @@
             $words = explode(' ', $query);
             $sep = 'OR ';
             $ftwords['mysql'] = $query;
+            $ftwords['pgsql'] = $query;
             $ftwords['mssql'] = '"' . str_replace(' ', '" OR "', $query) . '"';
         }
         else
@@ -149,6 +152,7 @@
                 $ftwords['mysql'] = $query;
             }
             $ftwords['mssql'] = '"' . $query . '"';
+            $ftwords['pgsql'] = '"' . $query . '"';
         }
 
         $titles = (isset($_GET['title']) && isset($columns['title'])) ? true : false;
diff -r d84e2e6d7158 -r 8adc4d41c628 system/lib-plugins.php
--- a/system/lib-plugins.php	Tue Jun 30 00:05:56 2009 -0400
+++ b/system/lib-plugins.php	Sat Jul 04 23:55:37 2009 -0400
@@ -242,26 +242,21 @@
         }
 
         // removing tables
-        $num_tables = count($remvars['tables']);
-        for ($i = 0; $i < $num_tables; $i++) {
-            if (isset($_TABLES[$remvars['tables'][$i]])) {
-                COM_errorLog("Dropping table {$_TABLES[$remvars['tables'][$i]]}", 1);
-                DB_query("DROP TABLE {$_TABLES[$remvars['tables'][$i]]}", 1);
-                COM_errorLog('...success', 1);
-            }
+        for ($i=0; $i < count($remvars['tables']); $i++) {
+            COM_errorLog ("Dropping table {$_TABLES[$remvars['tables'][$i]]}", 1);
+            DB_query ("DROP TABLE {$_TABLES[$remvars['tables'][$i]]}", 1    );
+            COM_errorLog ('...success', 1);
         }
 
         // removing variables
-        $num_vars = count($remvars['vars']);
-        for ($i = 0; $i < $num_vars; $i++) {
+        for ($i = 0; $i < count($remvars['vars']); $i++) {
             COM_errorLog ("Removing variable {$remvars['vars'][$i]}", 1);
             DB_delete($_TABLES['vars'], 'name', $remvars['vars'][$i]);
             COM_errorLog ('...success', 1);
         }
 
         // removing groups
-        $num_groups = count($remvars['groups']);
-        for ($i = 0; $i < $num_groups; $i++) {
+        for ($i = 0; $i < count($remvars['groups']); $i++) {
             $grp_id = DB_getItem ($_TABLES['groups'], 'grp_id',
                                   "grp_name = '{$remvars['groups'][$i]}'");
             if (!empty($grp_id)) {
@@ -275,8 +270,7 @@
         }
 
         // removing features
-        $num_features = count($remvars['features']);
-        for ($i = 0; $i < $num_features; $i++) {
+        for ($i = 0; $i < count($remvars['features']); $i++) {
             $access_id = DB_getItem ($_TABLES['features'], 'ft_id',
                                     "ft_name = '{$remvars['features'][$i]}'");
             if (!empty($access_id)) {
@@ -320,8 +314,7 @@
         COM_errorLog ('...success', 1);
 
         // uninstall php-blocks
-        $num_blocks = count($remvars['php_blocks']);
-        for ($i = 0; $i < $num_blocks; $i++) {
+        for ($i = 0; $i < count($remvars['php_blocks']); $i++) {
             DB_delete($_TABLES['blocks'], array('type',     'phpblockfn'),
                                           array('phpblock', $remvars['php_blocks'][$i]));
         }
@@ -1791,7 +1784,7 @@
   * @param  string  $feedType       Type of feed format (RSS/Atom/etc)
   * @param  string  $feedVersion    Type of feed version (RSS 1.0 etc)
   * @param  string  $topic          The topic for the feed.
-  * @param  string  $fid            The ID of the feed being fetched.
+  * @param  string  $fid            The ID of the feed being fethed.
   * @return array                   list of extension tags
   *
   */
@@ -1827,7 +1820,7 @@
   * @param  string  $feedType       Type of feed format (RSS/Atom/etc)
   * @param  string  $feedVersion    Type of feed version (RSS 1.0 etc)
   * @param  string  $topic          The topic for the feed.
-  * @param  string  $fid            The ID of the feed being fetched.
+  * @param  string  $fid            The ID of the feed being fethed.
   * @return array                   list of extension namespaces
   *
   */
@@ -1862,7 +1855,7 @@
   * @param  string  $feedType       Type of feed format (RSS/Atom/etc)
   * @param  string  $feedVersion    Type of feed version (RSS 1.0 etc)
   * @param  string  $topic          The topic for the feed.
-  * @param  string  $fid            The ID of the feed being fetched.
+  * @param  string  $fid            The ID of the feed being fethed.
   * @return array                   list of meta tag extensions
   *
   */



More information about the geeklog-cvs mailing list