[geeklog-cvs] geeklog-1.3/public_html/admin story.php,1.100,1.101
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Sun Aug 31 14:58:56 EDT 2003
Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin
In directory geeklog_prod:/tmp/cvs-serv15200/public_html/admin
Modified Files:
story.php
Log Message:
Added the ability to filter topics and only show stories for a single topic from a listbox.
Index: story.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/story.php,v
retrieving revision 1.100
retrieving revision 1.101
diff -C2 -d -r1.100 -r1.101
*** story.php 12 Aug 2003 21:10:05 -0000 1.100
--- story.php 31 Aug 2003 18:58:54 -0000 1.101
***************
*** 413,417 ****
function liststories($page = 1)
{
! global $_TABLES, $LANG24, $_CONF, $LANG_ACCESS, $_USER, $_GROUPS;
$display = '';
--- 413,417 ----
function liststories($page = 1)
{
! global $_TABLES, $LANG24, $_CONF, $LANG_ACCESS, $_USER, $_GROUPS,$HTTP_POST_VARS,$HTTP_GET_VARS;
$display = '';
***************
*** 437,459 ****
$story_templates->set_var('lang_featured', $LANG24[32]);
if (empty($page)) {
$page = 1;
}
! $excludetopics = '';
! $topicsql = "SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL ();
! $tresult = DB_query ($topicsql);
! $trows = DB_numRows ($tresult);
! if ($trows > 0) {
! $tids = array ();
! for ($i = 0; $i < $trows; $i++) {
! $T = DB_fetchArray ($tresult);
! $tids[] = $T['tid'];
! }
! if (sizeof ($tids) > 0) {
! $excludetopics = " WHERE (tid IN ('" . implode ("','", $tids) . "'))";
! }
}
$limit = (50 * $page) - 50;
$result = DB_query("SELECT *,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} " . $excludetopics . "ORDER BY date DESC LIMIT $limit,50");
--- 437,487 ----
$story_templates->set_var('lang_featured', $LANG24[32]);
+ $current_topic = $topic;
+ if (!empty ($HTTP_GET_VARS['tid'])) {
+ $current_topic = $HTTP_GET_VARS['tid'];
+ } elseif (!empty ($HTTP_POST_VARS['tid'])) {
+ $current_topic = $HTTP_POST_VARS['tid'];
+ } else {
+ $current_topic = 'all';
+ }
if (empty($page)) {
$page = 1;
}
! if ($current_topic == 'all') {
! $excludetopics = '';
! $topicsql = "SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL ();
! $tresult = DB_query( $topicsql );
! $trows = DB_numRows( $tresult );
! if( $trows > 0 )
! {
! $excludetopics .= " WHERE (";
! for( $i = 1; $i <= $trows; $i++ ) {
! $T = DB_fetchArray ($tresult);
! if ($i > 1) {
! $excludetopics .= " OR ";
! }
! $excludetopics .= "tid = '{$T['tid']}'";
! $seltopics .= '<option value="' .$T['tid']. '"';
! if ($current_topic == "{$T['tid']}") {
! $seltopics .= ' selected="selected"';
! }
! $seltopics .= '>' . $T['tid'] . '</option>' . LB;
! }
! $excludetopics .= ") ";
! }
!
! } else {
! $excludetopics = " WHERE tid = '$current_topic' ";
! $seltopics = COM_topicList ('tid,topic', $current_topic);
}
+ $alltopics = '<option value="all"';
+ if ($current_topic == 'all') {
+ $alltopics .= ' selected="selected"';
+ }
+ $alltopics .= '>' . "All" . '</option>' . LB;
+ $story_templates->set_var ('topic_selection', '<select name="tid" style="width: 125px" onchange="this.form.submit()">' . $alltopics . $seltopics . '</select>');
+
$limit = (50 * $page) - 50;
$result = DB_query("SELECT *,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} " . $excludetopics . "ORDER BY date DESC LIMIT $limit,50");
***************
*** 485,489 ****
}
$story_templates->set_var('story_author', DB_getItem($_TABLES['users'],'username',"uid = {$A['uid']}"));
! $story_templates->set_var('story_date', $curtime[0]);
$story_templates->set_var('story_topic', $A['tid']);
if ($A['featured'] == 1) {
--- 513,517 ----
}
$story_templates->set_var('story_author', DB_getItem($_TABLES['users'],'username',"uid = {$A['uid']}"));
! $story_templates->set_var('story_date', strftime($_CONF['shortdate'], $curtime[1]));
$story_templates->set_var('story_topic', $A['tid']);
if ($A['featured'] == 1) {
***************
*** 519,523 ****
$story_templates->set_var('nextpage_link','');
}
! $baseurl = $_CONF['site_admin_url'] . '/story.php?mode=list';
$numpages = ceil ($numstories / 50);
$story_templates->set_var ('google_paging',
--- 547,551 ----
$story_templates->set_var('nextpage_link','');
}
! $baseurl = $_CONF['site_admin_url'] . '/story.php?mode=list&tid=' .$current_topic;
$numpages = ceil ($numstories / 50);
$story_templates->set_var ('google_paging',
More information about the geeklog-cvs
mailing list