|
From: FlorinCB <ory...@us...> - 2008-08-30 04:37:19
|
Update of /cvsroot/mxbb/mx_smartor/album_mod/modules In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19871 Modified Files: album_rdf.php album_rss.php Log Message: rss fix for phpbb3 backend Index: album_rss.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/modules/album_rss.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** album_rss.php 13 Mar 2008 08:35:58 -0000 1.3 --- album_rss.php 30 Aug 2008 04:37:11 -0000 1.4 *************** *** 121,125 **** "; - // If not set, set the output count to 50 $count = ( isset($HTTP_GET_VARS['c']) ) ? intval($HTTP_GET_VARS['c']) : 25; --- 121,124 ---- *************** *** 153,194 **** } } ! $sql_not_allowed_cat=(empty($not_allowed_cat))?"":"AND pic_cat_id NOT IN ($not_allowed_cat)"; } // End check permissions ! $NotErrorFlag=false; ! $sql_limit_time=""; ! if (!$no_limit and isset($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'])) { ! $NotErrorFlag=true; ! $NotModifiedSince=strtotime($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']); ! if($NotModifiedSince>0){ ! $sql_limit_time="AND pic_time > ".$NotModifiedSince; ! $sql_limit_comment_time="AND comment_time > ".$NotModifiedSince; ! } ! } ! ! $sql = "SELECT pic_id, pic_title, pic_time, pic_desc, pic_username, pic_cat_id, pic_approval, cat_title ! FROM ".ALBUM_TABLE. " LEFT JOIN ".ALBUM_CAT_TABLE." ON (cat_id = pic_cat_id) ! WHERE pic_approval=$check_sel ! $sql_not_allowed_cat $sql_cat_where $sql_limit_time ! ORDER BY pic_time DESC ! LIMIT $count"; ! ! $picrow = $db->sql_query($sql); ! if ( !$picrow ) ! { ! die("Failed obtaining list of active pictures"); ! } ! else ! { ! $topics = $db->sql_fetchrowset($picrow); } ! $LastPostTime=0; ! if ( count($topics) == 0 ) { ! die("No pictures found"); } ! else { // $topics contains all interesting data for ($i = 0; $i < count($topics); $i++) --- 152,216 ---- } } ! $sql_not_allowed_cat = (empty($not_allowed_cat)) ? "" : "AND p.pic_cat_id NOT IN ($not_allowed_cat)"; } // End check permissions ! $NotErrorFlag = false; ! $sql_limit_time = ""; ! if (!$no_limit and isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) { ! $NotErrorFlag = true; ! $NotModifiedSince = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); ! if($NotModifiedSince > 0) ! { ! $sql_limit_time = "AND p.pic_time > ". $NotModifiedSince; ! $sql_limit_comment_time = "AND p.comment_time > ". $NotModifiedSince; ! } } ! ! $sql = "SELECT COUNT(p.pic_id) AS count ! FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c ! WHERE p.pic_cat_id = c.cat_id ! AND p.pic_approval = $check_sel ! $sql_not_allowed_cat ! $sql_cat_where ! $sql_limit_time ! ORDER BY pic_time DESC"; ! if ( !($result = $db->sql_query_limit($sql, $count)) ) { ! $rss .= " ! <item> ! <title>" . "Error: Could not count pics." . "</title> ! <description>" . $sql ."</description> ! </item>"; } ! ! $row = $db->sql_fetchrow($result); ! ! $total_pics = $row['count']; ! ! if ($total_pics > 0) { + $sql = "SELECT p.*, c.* + FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c + WHERE p.pic_cat_id = c.cat_id + AND p.pic_approval = $check_sel + $sql_not_allowed_cat + $sql_cat_where + $sql_limit_time + ORDER BY pic_time DESC"; + + if ( !($result = $db->sql_query_limit($sql, $count)) ) + { + die("Failed obtaining list of active pictures"); + } + + $LastPostTime = 0; + + $topics = array(); + while($picrow = $db->sql_fetchrow($result)) + { + $topics[] = $picrow; + } + // $topics contains all interesting data for ($i = 0; $i < count($topics); $i++) *************** *** 201,217 **** //$description = htmlspecialchars($entry_data[$i]['entry_text']); $description = htmlentities($description); ! $description .= $lang['Pic_Desc'].": ".nl2br($topics[$i]['pic_desc']); $pic_time = date('D, j M Y G:i:s T',$topics[$i]['pic_time']); $rss .= " ! <item> ! <title>" . $title . "</title> ! <link>" . $url . "</link> ! <description>" . $description ."</description> ! <pubDate>". $pic_time ."</pubDate> ! </item> ! "; } } // Create RDF footer --- 223,248 ---- //$description = htmlspecialchars($entry_data[$i]['entry_text']); $description = htmlentities($description); ! $description .= $lang['Pic_Desc'].": ".nl2br($topics[$i]['pic_desc']); $pic_time = date('D, j M Y G:i:s T',$topics[$i]['pic_time']); $rss .= " ! <item> ! <title>" . $title . "</title> ! <link>" . $url . "</link> ! <description>" . $description ."</description> ! <pubDate>". $pic_time ."</pubDate> ! </item>"; ! } } + else + { + $total_pics = ($total_pics) ? intval($total_pics) : 0; + $rss .= " + <item> + <title>" . $total_pics . " pictures found." . "</title> + <description>" . "No images have been added ?" ."</description> + </item>"; + } // Create RDF footer *************** *** 226,230 **** // Output the RDF ! echo $rss; ?> \ No newline at end of file --- 257,262 ---- // Output the RDF ! ! die("$rss"); ?> \ No newline at end of file Index: album_rdf.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_mod/modules/album_rdf.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** album_rdf.php 13 Mar 2008 08:35:58 -0000 1.3 --- album_rdf.php 30 Aug 2008 04:37:11 -0000 1.4 *************** *** 150,173 **** $sql = "SELECT pic_id, pic_title, pic_time, pic_desc, pic_username, pic_cat_id, pic_approval, cat_title ! FROM ".ALBUM_TABLE. " LEFT JOIN ".ALBUM_CAT_TABLE." ON (cat_id = pic_cat_id) ! WHERE pic_approval=$check_sel $sql_not_allowed_cat $sql_cat_where $sql_limit_time ! ORDER BY pic_time DESC ! LIMIT $count"; ! ! $picrow = $db->sql_query($sql); ! if ( !$picrow ) { ! die("Failed obtaining list of active pictures"); } ! else { ! $topics = $db->sql_fetchrowset($picrow); } ! $LastPostTime=0; if ( count($topics) == 0 ) { ! die("No pictures found"); } else --- 150,180 ---- $sql = "SELECT pic_id, pic_title, pic_time, pic_desc, pic_username, pic_cat_id, pic_approval, cat_title ! FROM " . ALBUM_TABLE . " LEFT JOIN ". ALBUM_CAT_TABLE ." ON (cat_id = pic_cat_id) ! WHERE pic_approval = $check_sel $sql_not_allowed_cat $sql_cat_where $sql_limit_time ! ORDER BY pic_time DESC"; ! if ( !($result = $db->sql_query_limit($sql, $count)) ) { ! die("Failed obtaining list of active pictures"); } ! ! $topics = array(); ! while($picrow = $db->sql_fetchrow($result)) { ! $topics[] = $picrow; } ! ! //$topics = $db->sql_fetchrowset($picrow); ! ! $LastPostTime = 0; ! if ( count($topics) == 0 ) { ! $rss .= " ! <item> ! <title>" . "No pictures found." . "</title> ! <description>" . "Images have not been added yet ?" ."</description> ! </item>"; } else |