[geeklog-cvs] geeklog: core works , mostly

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


changeset 7623:09f77b7a02ed
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/09f77b7a02ed
user: stan <yankees26an at gmail.com>
date: Fri Jun 26 12:53:14 2009 -0400
description:
core works , mostly

diffstat:

 public_html/admin/moderation.php |    2 +-
 public_html/index.php            |   18 +-
 public_html/lib-common.php       |  707 +++++++++++++++++++------------------------
 sql/pgsql_tableanddata.php       |   17 +-
 system/databases/pgsql.class.php |   17 +-
 system/lib-database.php          |    1 +
 system/lib-security.php          |   35 +-
 system/lib-syndication.php       |    4 +-
 8 files changed, 358 insertions(+), 443 deletions(-)

diffs (truncated from 1760 to 300 lines):

diff -r e257344c13fb -r 09f77b7a02ed public_html/admin/moderation.php
--- a/public_html/admin/moderation.php	Sat Jun 20 23:42:32 2009 -0400
+++ b/public_html/admin/moderation.php	Fri Jun 26 12:53:14 2009 -0400
@@ -288,7 +288,7 @@
         $section_title = $LANG29[35];
         $section_help = 'ccstorysubmission.html';
     } elseif ($type == 'comment') {
-        $sql = "SELECT cid AS id,title,comment,date,uid,type,sid "
+        $sql = "SELECT cid AS id,title,comment,date,uid "
               . "FROM {$_TABLES['commentsubmissions']} "
               . "ORDER BY cid ASC";
         $H = array($LANG29[10], $LANG29[36], $LANG29[14]);
diff -r e257344c13fb -r 09f77b7a02ed public_html/index.php
--- a/public_html/index.php	Sat Jun 20 23:42:32 2009 -0400
+++ b/public_html/index.php	Fri Jun 26 12:53:14 2009 -0400
@@ -85,10 +85,10 @@
          . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND"
          . $sql . "ORDER BY featured DESC, date DESC LIMIT 0, 1";
          
-    $msql['pgsql']="SELECT s.title "
+      $msql['pgsql']="SELECT s.title "
      . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, "
-     . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid)"
-     . $sql . "ORDER BY featured DESC, date DESC LIMIT 1, OFFSET 0";
+     . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND"
+     . $sql . "ORDER BY featured DESC, date DESC LIMIT 1 OFFSET 0";
          
     $result = DB_query ($msql);
 
@@ -287,13 +287,12 @@
          . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, "
          . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND"
          . $sql . "ORDER BY featured DESC, date DESC LIMIT $offset, $limit";
-         
-$msql['pgsql']="SELECT s.*, UNIX_TIMESTAMP(s.date) AS unixdate, "
-         . 'UNIX_TIMESTAMP(s.expire) as expireunix, '
+$msql['pgsql']="SELECT s.*, date_part('epoch',s.date) AS unixdate, "
+         . 'date_part(\'epoch\',s.expire) as expireunix, '
          . $userfields . ", t.topic, t.imageurl "
          . "FROM {$_TABLES['stories']} AS s, {$_TABLES['users']} AS u, "
-         . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) "
-         . $sql . "ORDER BY featured DESC, date DESC LIMIT $limit, OFFSET $offset";
+         . "{$_TABLES['topics']} AS t WHERE (s.uid = u.uid) AND (s.tid = t.tid) AND "
+         . $sql . "ORDER BY featured DESC, date DESC LIMIT $limit OFFSET $offset";
 
 $result = DB_query ($msql);
 
@@ -304,7 +303,7 @@
 $num_pages = ceil ($D['count'] / $limit);
 
 if ( $A = DB_fetchArray( $result ) ) {
-
+    $varme= 'inside fetcha rray';
     $story = new Story();
     $story->loadFromArray($A);
     if ( $_CONF['showfirstasfeatured'] == 1 ) {
@@ -343,6 +342,7 @@
         $display .= COM_printPageNavigation ($base_url, $page, $num_pages);
     }
 } else { // no stories to display
+    $varme = 'not in fetch array!';
     if (!isset ($_CONF['hide_no_news_msg']) ||
             ($_CONF['hide_no_news_msg'] == 0)) {
         $display .= COM_startBlock ($LANG05[1], '',
diff -r e257344c13fb -r 09f77b7a02ed public_html/lib-common.php
--- a/public_html/lib-common.php	Sat Jun 20 23:42:32 2009 -0400
+++ b/public_html/lib-common.php	Fri Jun 26 12:53:14 2009 -0400
@@ -2,13 +2,13 @@
 
 /* Reminder: always indent with 4 spaces (no tabs). */
 // +---------------------------------------------------------------------------+
-// | Geeklog 1.6                                                               |
+// | Geeklog 1.5                                                               |
 // +---------------------------------------------------------------------------+
 // | lib-common.php                                                            |
 // |                                                                           |
 // | Geeklog common library.                                                   |
 // +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2009 by the following authors:                         |
+// | Copyright (C) 2000-2008 by the following authors:                         |
 // |                                                                           |
 // | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
 // |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
@@ -32,6 +32,8 @@
 // | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
 // |                                                                           |
 // +---------------------------------------------------------------------------+
+//
+// $Id: lib-common.php,v 1.728 2008/09/21 08:37:09 dhaun Exp $
 
 // Prevent PHP from reporting uninitialized variables
 error_reporting( E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR );
@@ -53,46 +55,38 @@
 * Turn this on to get various debug messages from the code in this library
 * @global Boolean $_COM_VERBOSE
 */
+
 $_COM_VERBOSE = false;
 
 /**
-* Prevent getting any surprise values. But we should really stop
-* using $_REQUEST altogether.
-*/
-$_REQUEST = array_merge($_GET, $_POST);
-
-/**
-* Here, we shall establish an error handler. This will mean that whenever a
-* php level error is encountered, our own code handles it. This will hopefuly
-* go someway towards preventing nasties like path exposures from ever being
-* possible. That is, unless someone has overridden our error handler with one
-* with a path exposure issue...
-*
-* Must make sure that the function hasn't been disabled before calling it.
-*
-*/
-if (function_exists('motherfucker_set_error_handler')) {
-    if (PHP_VERSION >= 5) {
+  * Here, we shall establish an error handler. This will mean that whenever a
+  * php level error is encountered, our own code handles it. This will hopefuly
+  * go someway towards preventing nasties like path exposures from ever being
+  * possible. That is, unless someone has overridden our error handler with one
+  * with a path exposure issue...
+  *
+  * Must make sure that the function hasn't been disabled before calling it.
+  *
+  */
+if( function_exists('fuckset_error_handler') )
+{
+    if( PHP_VERSION >= 5 )
+    {
         /* Tell the error handler to use the default error reporting options.
-         * You may like to change this to use it in more/less cases, if so,
+         * you may like to change this to use it in more/less cases, if so,
          * just use the syntax used in the call to error_reporting() above.
          */
-        $defaultErrorHandler = set_error_handler('COM_handleError',
-                                                 error_reporting());
+        $defaultErrorHandler = set_error_handler('COM_handleError', error_reporting());
     } else {
         $defaultErrorHandler = set_error_handler('COM_handleError');
     }
 }
 
-/**
+/*
 * Configuration Include:
 * You do NOT need to modify anything here any more!
 */
-require_once 'siteconfig.php';
-
-/**
-* Configuration class
-*/
+require_once 'siteconfig.php' ;
 require_once $_CONF['path_system'] . 'classes/config.class.php';
 
 $config =& config::get_instance();
@@ -145,18 +139,39 @@
 * If needed, add our PEAR path to the list of include paths
 *
 */
-if (! $_CONF['have_pear']) {
-    $curPHPIncludePath = get_include_path();
-    if (empty($curPHPIncludePath)) {
-        $curPHPIncludePath = $_CONF['path_pear'];
-    } else {
-        $curPHPIncludePath = $_CONF['path_pear'] . PATH_SEPARATOR
-                           . $curPHPIncludePath;
-    }
-
-    if (set_include_path($curPHPIncludePath) === false) {
-        COM_errorLog('set_include_path failed - there may be problems using the PEAR classes.', 1);
-    }
+if( !$_CONF['have_pear'] )
+{
+    $curPHPIncludePath = ini_get( 'include_path' );
+    if( defined( 'PATH_SEPARATOR' ))
+    {
+        $separator = PATH_SEPARATOR;
+    }
+    else
+    {
+        // prior to PHP 4.3.0, we have to guess the correct separator ...
+        $separator = ';';
+        if( strpos( $curPHPIncludePath, $separator ) === false )
+        {
+            $separator = ':';
+        }
+    }
+    if( ini_set( 'include_path', $_CONF['path_pear'] . $separator
+                                 . $curPHPIncludePath ) === false )
+    {
+        COM_errorLog( 'ini_set failed - there may be problems using the PEAR classes.', 1);
+    }
+}
+
+
+/**
+* This is necessary to ensure compatibility with PHP 4.1.x
+*
+*/
+if( !function_exists( 'is_a' ))
+{
+    require_once( 'PHP/Compat.php' );
+
+    PHP_Compat::loadFunction( 'is_a' );
 }
 
 
@@ -173,6 +188,8 @@
 * Include URL class
 *
 * This provides optional URL rewriting functionality.
+* Please note this code is still experimental and is only currently used by the
+* staticpages plugin.
 */
 
 require_once( $_CONF['path_system'] . 'classes/url.class.php' );
@@ -180,7 +197,7 @@
 
 /**
 * This is our HTML template class.  It is the same one found in PHPLib and is
-* licensed under the LGPL.  See that file for details.
+* licensed under the LGPL.  See that file for details
 *
 */
 
@@ -222,9 +239,8 @@
 * This is the custom library.
 *
 * It is the sandbox for every Geeklog Admin to play in.
-* The lib-custom.php as shipped will never contain required code,
-* so it's safe to always use your own copy.
-* This should hold all custom hacks to make upgrading easier.
+* We will never modify this file.  This should hold all custom
+* hacks to make upgrading easier.
 *
 */
 
@@ -260,6 +276,9 @@
 require_once( $_CONF['path_system'] . 'lib-mbyte.php' );
 
 // Set theme
+// Need to modify this code to check if theme was cached in user cookie.  That
+// way if user logged in and set theme and then logged out we would still know
+// which theme to show them.
 
 $usetheme = '';
 if( isset( $_POST['usetheme'] ))
@@ -308,20 +327,10 @@
     require_once $_CONF['path_layout'] . 'functions.php';
 }
 
-/**
-* ensure XHTML constant is defined to avoid problems elsewhere
-*/
+// ensure XHTML constant is defined to avoid problems elsewhere
+
 if (!defined('XHTML')) {
-    switch ($_CONF['doctype']) {
-    case 'xhtml10transitional':
-    case 'xhtml10strict':
-        define('XHTML', ' /');
-        break;
-
-    default:
-        define('XHTML', '');
-        break;
-    }
+    define('XHTML', '');
 }
 
 // themes can now specify the default image type
@@ -359,13 +368,13 @@
 // Handle Who's Online block
 if (COM_isAnonUser() && isset($_SERVER['REMOTE_ADDR'])) {
     // The following code handles anonymous users so they show up properly
-    DB_delete($_TABLES['sessions'], array('remote_ip', 'uid'),
-                                    array($_SERVER['REMOTE_ADDR'], 1));
+    DB_query( "DELETE FROM {$_TABLES['sessions']} WHERE remote_ip = '{$_SERVER['REMOTE_ADDR']}' AND uid = 1" );
 
     $tries = 0;
     do
     {
         // Build a useless sess_id (needed for insert to work properly)
+        mt_srand(( double )microtime() * 1000000 );
         $sess_id = mt_rand();
         $curtime = time();
 
@@ -385,7 +394,7 @@
 *
 */
 
-require_once 'C:\wamp\www\geeklog\public_html\admin\install\language\english.php';
+require_once $_CONF['path_language'] . $_CONF['language'] . '.php';
 
 if (empty($LANG_DIRECTION)) {
     // default to left-to-right
@@ -436,7 +445,7 @@
 {



More information about the geeklog-cvs mailing list