|
From: Josh <jel...@us...> - 2007-08-05 18:23:41
|
Update of /cvsroot/cmsforme/CMSformE In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16432 Modified Files: index.php Log Message: Add a couple of compatibility queries Index: index.php =================================================================== RCS file: /cvsroot/cmsforme/CMSformE/index.php,v retrieving revision 1.64 retrieving revision 1.65 diff -u -d -r1.64 -r1.65 --- index.php 12 Feb 2007 23:51:18 -0000 1.64 +++ index.php 5 Aug 2007 18:23:36 -0000 1.65 @@ -33,10 +33,11 @@ $mode = ( isset( $_REQUEST['mode'] ) ) ? htmlspecialchars( strtolower( $_REQUEST['mode'] ) ) : ''; $news_type = ( isset( $_REQUEST['type'] ) ) ? htmlspecialchars( strtolower( $_REQUEST['type'] ) ) : ''; $poster_id = ( isset( $_REQUEST['u'] ) ) ? (int) $_REQUEST['u'] : 0; +$start = ( isset( $_REQUEST['start'] ) ) ? (int) $_REQUEST['start'] : 0; function display_news( $article_id = '' ) { - global $Database, $Template, $mode, $user, $lang, $post_limit, $page_name, $poster_id, $news_type; + global $Database, $Template, $mode, $user, $lang, $post_limit, $page_name, $poster_id, $news_type, $start; // Limit SQL query if article number is specified if( $article_id != '' ) @@ -71,8 +72,21 @@ WHERE u.user_id = n.user_id AND nt.post_id = n.post_id $post_limit - ORDER BY n.post_time DESC - LIMIT 0,20"; // TODO: LIMIT clause + ORDER BY n.post_time DESC"; + + // todo: config variable for number of articles per page. + switch ( DB_TYPE ) + { + case 'mysql': + case 'mysqli': + $sql .= " LIMIT $start, 25"; + break; + + case 'postgresql': + default: + $sql .= " LIMIT 25 OFFSET $start"; + break; + } if( !( $result = $Database->query( $sql ) ) ) { |