[geeklog-cvs] geeklog: Merged changes

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Mar 25 14:17:01 EDT 2010


changeset 7832:f918cdabd25a
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/f918cdabd25a
user: Tom <websitemaster at cogeco.net>
date: Thu Mar 25 14:15:55 2010 -0400
description:
Merged changes

diffstat:

 plugins/links/functions.inc                    |   2 +-
 plugins/staticpages/sql/pgsql_install.php      |   2 +
 public_html/admin/install/index.php            |   6 +-
 public_html/admin/install/language/english.php |   3 +-
 public_html/admin/install/lib-install.php      |  20 ++++-
 public_html/docs/history                       |   2 +
 public_html/lib-common.php                     |   2 +
 public_html/usersettings.php                   |   4 +-
 sql/pgsql_tableanddata.php                     |   8 +-
 system/databases/mssql.class.php               |  99 ++++--------------------
 system/databases/pgsql.class.php               |  97 ++++++++++++++++++-----
 system/lib-database.php                        |  70 +++++++++++++++++
 12 files changed, 198 insertions(+), 117 deletions(-)

diffs (truncated from 500 to 300 lines):

diff -r 6d81a99b94d7 -r f918cdabd25a plugins/links/functions.inc
--- a/plugins/links/functions.inc	Thu Mar 25 14:07:50 2010 -0400
+++ b/plugins/links/functions.inc	Thu Mar 25 14:15:55 2010 -0400
@@ -479,7 +479,7 @@
 
     $feeds = array ();
 
-    $result = DB_query ("SELECT cid,category FROM {$_TABLES['linkcategories']} GROUP BY category ORDER BY category ASC");
+    $result = DB_query ("SELECT cid,category FROM {$_TABLES['linkcategories']} GROUP BY cid,category ORDER BY category ASC");
     $num = DB_numRows ($result);
 
     if ($num > 0) {
diff -r 6d81a99b94d7 -r f918cdabd25a plugins/staticpages/sql/pgsql_install.php
--- a/plugins/staticpages/sql/pgsql_install.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/plugins/staticpages/sql/pgsql_install.php	Thu Mar 25 14:15:55 2010 -0400
@@ -46,6 +46,8 @@
   sp_label varchar(64) default NULL,
   draft_flag int default '0',
   commentcode int NOT NULL default '0',
+  meta_description TEXT NULL,
+  meta_keywords TEXT NULL,
   owner_id int NOT NULL default '1',
   group_id int NOT NULL default '1',
   perm_owner int NOT NULL default '3',
diff -r 6d81a99b94d7 -r f918cdabd25a public_html/admin/install/index.php
--- a/public_html/admin/install/index.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/public_html/admin/install/index.php	Thu Mar 25 14:15:55 2010 -0400
@@ -222,7 +222,11 @@
             $display .= '<h2>' . $LANG_INSTALL[104] . '</h2><p>'
                      . $LANG_INSTALL[105] . '</p>'
                      . INST_showReturnFormData($_POST) . LB;
-
+        // Check for blank password in production environment
+        } else if (!INST_dbPasswordCheck($site_url, $DB)) {
+            $display .= '<h2>' . $LANG_INSTALL[54] . '</h2><p>'
+                     . $LANG_INSTALL[107] . '</p>'
+                     . INST_showReturnFormData($_POST) . LB;
         // Check if we can connect to the database
         } else if (!INST_dbConnect($DB)) { 
             $display .= '<h2>' . $LANG_INSTALL[54] . '</h2><p>'
diff -r 6d81a99b94d7 -r f918cdabd25a public_html/admin/install/language/english.php
--- a/public_html/admin/install/language/english.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/public_html/admin/install/language/english.php	Thu Mar 25 14:15:55 2010 -0400
@@ -155,7 +155,8 @@
     103 => 'and configure additional plugins',
     104 => 'Incorrect Admin Directory Path',
     105 => 'Sorry, but the admin directory path you entered does not appear to be correct. Please go back and try again.',
-    106 => 'PostgreSQL'
+    106 => 'PostgreSQL',
+    107 => 'Database Password is required for production environments.'
 );
 
 // +---------------------------------------------------------------------------+
diff -r 6d81a99b94d7 -r f918cdabd25a public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/public_html/admin/install/lib-install.php	Thu Mar 25 14:15:55 2010 -0400
@@ -440,9 +440,6 @@
  */
 function INST_dbConnect($db)
 {
-    if (empty($db['pass'])) {
-        return false;
-    }
     $db_handle = false;
     switch ($db['type']) {
     case 'mysql-innodb':
@@ -1272,5 +1269,20 @@
 
     return $retval;
 }
-
+/**
+* Check for blank database password in production environment
+*
+* @param   array   $db Database    information
+* @param   string  $site_url       The site's URL
+* @return  boolean                 True if password is set or it is a local server
+*
+*/
+function INST_dbPasswordCheck($site_url, $db)
+{
+    if (!empty($db['pass']) || (isset($site_url)  && (strpos($site_url, '127.0.0.1') !== false)  || (strpos($site_url, 'localhost') !== false))) {
+        return true;
+    } else {
+        return false;
+    }
+}
 ?>
diff -r 6d81a99b94d7 -r f918cdabd25a public_html/docs/history
--- a/public_html/docs/history	Thu Mar 25 14:07:50 2010 -0400
+++ b/public_html/docs/history	Thu Mar 25 14:15:55 2010 -0400
@@ -4,6 +4,8 @@
 ------------
 - A new right called htmlfilter.skip allows user groups to skip any html   
   filtering on posts (feature request #0000952) [Tom]
+- Allow empty database passwords only for local installs (bug #0000923, patch
+  provided by Chetan)
 - New Plugin API PLG_getWhatsNewComment for adding comments from plugins to the 
   Whats New Block and the User Profile page (feature request #0000835) [Tom]
 - Truncated stories in Feeds now will have any open html tags closed. 
diff -r 6d81a99b94d7 -r f918cdabd25a public_html/lib-common.php
--- a/public_html/lib-common.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/public_html/lib-common.php	Thu Mar 25 14:15:55 2010 -0400
@@ -2824,6 +2824,8 @@
 */
 function COM_refresh($url)
 {
+    header('Content-Type: text/html; charset=' . COM_getCharset());
+
     return "<html><head><meta http-equiv=\"refresh\" content=\"0; URL=$url\"></head></html>\n";
 }
 
diff -r 6d81a99b94d7 -r f918cdabd25a public_html/usersettings.php
--- a/public_html/usersettings.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/public_html/usersettings.php	Thu Mar 25 14:15:55 2010 -0400
@@ -542,13 +542,13 @@
     $preferences->set_var('timezone_selector', $selection);
     $preferences->set_var('lang_timezone', $LANG04[158]);
 
-    if ($A['noicons'] == '1') {
+    if (isset ($A['noicons']) && $A['noicons'] == '1') {
         $preferences->set_var ('noicons_checked', 'checked="checked"');
     } else {
         $preferences->set_var ('noicons_checked', '');
     }
 
-    if ($A['noboxes'] == 1) {
+    if (isset ($A['noboxes']) && $A['noboxes'] == '1') {
         $preferences->set_var ('noboxes_checked', 'checked="checked"');
     } else {
         $preferences->set_var ('noboxes_checked', '');
diff -r 6d81a99b94d7 -r f918cdabd25a sql/pgsql_tableanddata.php
--- a/sql/pgsql_tableanddata.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/sql/pgsql_tableanddata.php	Thu Mar 25 14:15:55 2010 -0400
@@ -449,8 +449,8 @@
   uid smallint NOT NULL default '1',
   tids varchar(255) NOT NULL default '',
   etids text,
-  aids varchar(255) NOT NULL default '',
-  boxes varchar(255) NOT NULL default '',
+  aids varchar(255) NOT NULL default '0',
+  boxes varchar(255) NOT NULL default '0',
   noboxes smallint NOT NULL default '0',
   maxstories smallint default NULL,
   PRIMARY KEY  (uid)
@@ -720,8 +720,8 @@
 $_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (1,'nested','ASC',100) ";
 $_DATA[] = "INSERT INTO {$_TABLES['usercomment']} (uid, commentmode, commentorder, commentlimit) VALUES (2,'threaded','ASC',100) ";
 
-$_DATA[] = "INSERT INTO {$_TABLES['userindex']} (uid, tids, etids, aids, boxes, noboxes, maxstories) VALUES (1,'','-','','',0,NULL) ";
-$_DATA[] = "INSERT INTO {$_TABLES['userindex']} (uid, tids, etids, aids, boxes, noboxes, maxstories) VALUES (2,'','','','',0,NULL) ";
+$_DATA[] = "INSERT INTO {$_TABLES['userindex']} (uid, tids, etids, aids, boxes, noboxes, maxstories) VALUES (1,'','-','0','0',0,0) ";
+$_DATA[] = "INSERT INTO {$_TABLES['userindex']} (uid, tids, etids, aids, boxes, noboxes, maxstories) VALUES (2,'','','0','0',0,0) ";
 
 $_DATA[] = "INSERT INTO {$_TABLES['userinfo']} (uid, about, pgpkey, userspace, tokens, totalcomments, lastgranted) VALUES (1,NULL,NULL,'',0,0,0) ";
 $_DATA[] = "INSERT INTO {$_TABLES['userinfo']} (uid, about, pgpkey, userspace, tokens, totalcomments, lastgranted) VALUES (2,NULL,NULL,'',0,0,0) ";
diff -r 6d81a99b94d7 -r f918cdabd25a system/databases/mssql.class.php
--- a/system/databases/mssql.class.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/system/databases/mssql.class.php	Thu Mar 25 14:15:55 2010 -0400
@@ -1081,91 +1081,26 @@
        return $string;
        
     }
-  
-    
-    
-    
-    
-    
-    //since nothing can do this properly, i had to write it myself.
-    //trick is that a string csv may have a comma within a delimited csv field which explode
-    //cant handle
-    function parse_csv_sql_string($csv){
-        $len=strlen($csv);
-        $mode=0;        //mode=0 for non string, mode=1 for string
-        $retArray=array();
-        $thisValue='';
-        for($x=0;$x<$len;$x++){
-            //loop thru the string
-            if($csv[$x]=="'"){
-                if($x!=0){
-                    if($csv[$x-1]!="\\"){
-                        //this means that the preceeding char is not escape.. thus this is either the end of a mode 1 or the beginning of a mode 1
-                        if($mode==1){
-                            $mode=0;
-                            //this means that we are done this string value
-                            //dont add this character to the string
-                            }
-                        else{
-                            $mode=1;
-                            //dont add this character to the string....
-                            }
-                        }
-                    else{//this is a character to add.....
-                        $thisValue=$thisValue . $csv[$x];
-                        }
-                    }
-                else{//x==0
-                    $mode=1;
-                    }
-            }//end if csv
-            elseif($csv[$x]==","){
-                if($mode==1){
-                    //this means that the comma falls INSIDE of a string. its a keeper
-                    $thisValue=$thisValue . $csv[$x];
-                    }
-                else{//this is the dilineation between fields.. pop this value
-                    array_push($retArray, $thisValue);
-                    $thisValue='';
-                    $mode=0;
-                    }
-                }//end elseif
-                
-            else{
-                //just add it!
-                $thisValue=$thisValue . $csv[$x];
-                }//end else
-        }//end for
-        array_push($retArray, $thisValue);
-        return $retArray;
-    }//end function  
-    
-    
-    
-    //thanks to php.net for this
-function array_push_associative(&$arr) {
-  $ret = 0;
-  $args = func_get_args();
-  foreach ($args as $arg) {
-      if (is_array($arg)) {
-          foreach ($arg as $key => $value) {
-              @$arr[$key] = $value;
-              $ret++;
-          }
-      }else{
-          @$arr[$arg] = "";
-      }
-  }
-  return $ret;
-} 
- 
 
 
+    // thanks to php.net for this
+    function array_push_associative(&$arr)
+    {
+        $ret = 0;
+        $args = func_get_args();
+        foreach ($args as $arg) {
+            if (is_array($arg)) {
+                foreach ($arg as $key => $value) {
+                    @$arr[$key] = $value;
+                    $ret++;
+                }
+            } else {
+                @$arr[$arg] = "";
+            }
+        }
 
-
-
-
-
+        return $ret;
+    }
 
 
     /**
diff -r 6d81a99b94d7 -r f918cdabd25a system/databases/pgsql.class.php
--- a/system/databases/pgsql.class.php	Thu Mar 25 14:07:50 2010 -0400
+++ b/system/databases/pgsql.class.php	Thu Mar 25 14:15:55 2010 -0400
@@ -398,8 +398,9 @@
         else
         {
             unset($row); unset($result);
-            $fields_array = explode(',',$fields);
-            $values_array = explode(',',$values);
+            $fields_array = explode(',',$fields);      
+            $values_array = DBINT_parseCsvSqlString($values);
+            $values = str_replace('0000-00-00 00:00:00','NOW()',$values);
             $row = array();              
             $sql = 'SELECT pg_attribute.attname FROM pg_index, pg_class, pg_attribute 
                     WHERE pg_class.oid = \''.$table.'\'::regclass AND 
@@ -416,30 +417,79 @@
             $counter=count($row);
             if(!empty($row[0]))
             {
-                $key = array_search($row[0][0],$fields_array);
-                if($key!==FALSE) //$fields contains the primary key already
-                {
-                 $sql = "DELETE FROM $table WHERE {$row[0][0]}='{$values_array[$key]}'";
-                 $result = $this->dbQuery($sql);
-                }
+            	print_r($row);
+          		$key = array_search($row[0][0],$fields_array);
+          		if($key!==FALSE)
+          		{
+          			$sql = "DELETE FROM $table WHERE ";
+	                $uniqno = count($row);
+	                for($i=0;$i<$uniqno;$i++)



More information about the geeklog-cvs mailing list