[geeklog-cvs] geeklog-1.3/public_html users.php,1.77,1.77.2.1
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Mon May 31 06:43:46 EDT 2004
Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv13406/public_html
Modified Files:
Tag: geeklog_1_3_9_1
users.php
Log Message:
Don't list stories or comments in the user profile if the current user isn't allowed to see the topics they were posted under (bug #208)
Index: users.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/users.php,v
retrieving revision 1.77
retrieving revision 1.77.2.1
diff -C2 -d -r1.77 -r1.77.2.1
*** users.php 21 Feb 2004 19:15:56 -0000 1.77
--- users.php 31 May 2004 10:43:43 -0000 1.77.2.1
***************
*** 139,147 ****
$user_templates->set_var('headline_postingstats', $LANG04[83]);
// list of last 10 stories by this user
! $sql = "SELECT sid,title,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} WHERE (uid = $user) AND (draft_flag = 0) AND (date <= NOW())" . COM_getPermSQL ('AND');
! $sql .= " ORDER BY unixdate DESC LIMIT 10";
! $result = DB_query($sql);
! $nrows = DB_numRows($result);
if ($nrows > 0) {
for ($i = 1; $i <= $nrows; $i++) {
--- 139,161 ----
$user_templates->set_var('headline_postingstats', $LANG04[83]);
+ $result = DB_query ("SELECT tid FROM {$_TABLES['topics']}"
+ . COM_getPermSQL ());
+ $nrows = DB_numRows ($result);
+ $tids = array ();
+ for ($i = 0; $i < $nrows; $i++) {
+ $T = DB_fetchArray ($result);
+ $tids[] = $T['tid'];
+ }
+ $topics = "'" . implode ("','", $tids) . "'";
+
// list of last 10 stories by this user
! if (sizeof ($tids) > 0) {
! $sql = "SELECT sid,title,UNIX_TIMESTAMP(date) AS unixdate FROM {$_TABLES['stories']} WHERE (uid = $user) AND (draft_flag = 0) AND (date <= NOW()) AND (tid IN ($topics))" . COM_getPermSQL ('AND');
! $sql .= " ORDER BY unixdate DESC LIMIT 10";
! $result = DB_query($sql);
! $nrows = DB_numRows($result);
! } else {
! $nrows = 0;
! }
if ($nrows > 0) {
for ($i = 1; $i <= $nrows; $i++) {
***************
*** 162,174 ****
// list of last 10 comments by this user
- // first, get a list of all stories the current visitor has access to
- $sql = "SELECT sid FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW())" . COM_getPermSQL ('AND');
- $result = DB_query($sql);
- $numsids = DB_numRows($result);
$sidArray = array();
! for ($i = 1; $i <= $numsids; $i++) {
! $S = DB_fetchArray ($result);
! $sidArray[] = $S['sid'];
}
// add all polls the current visitor has access to
$sql = "SELECT qid FROM {$_TABLES['pollquestions']}" . COM_getPermSQL ();
--- 176,191 ----
// list of last 10 comments by this user
$sidArray = array();
! if (sizeof ($tids) > 0) {
! // first, get a list of all stories the current visitor has access to
! $sql = "SELECT sid FROM {$_TABLES['stories']} WHERE (draft_flag = 0) AND (date <= NOW()) AND (tid IN ($topics))" . COM_getPermSQL ('AND');
! $result = DB_query($sql);
! $numsids = DB_numRows($result);
! for ($i = 1; $i <= $numsids; $i++) {
! $S = DB_fetchArray ($result);
! $sidArray[] = $S['sid'];
! }
}
+
// add all polls the current visitor has access to
$sql = "SELECT qid FROM {$_TABLES['pollquestions']}" . COM_getPermSQL ();
More information about the geeklog-cvs
mailing list