[geeklog-cvs] geeklog-1.3/public_html index.php,1.46,1.47

geeklog-cvs-admin at lists.geeklog.net geeklog-cvs-admin at lists.geeklog.net
Thu May 15 11:25:24 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory internal.geeklog.net:/tmp/cvs-serv4036

Modified Files:
	index.php 
Log Message:
This fixes the same problems as the replacement index.php for 1.3.7sr1, i.e. the topic permissions and the "google paging" (right blocks on empty topics have already been fixed in an earlier revision).


Index: index.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/index.php,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** index.php	8 May 2003 17:23:10 -0000	1.46
--- index.php	15 May 2003 15:25:21 -0000	1.47
***************
*** 182,186 ****
  COM_featuredCheck();
  
! $sql = "SELECT *,unix_timestamp(date) AS day FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0)";
  
  // if a topic was provided only select those stories.
--- 182,186 ----
  COM_featuredCheck();
  
! $sql = "FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0)";
  
  // if a topic was provided only select those stories.
***************
*** 191,207 ****
  }
  
! $sql .= " AND (";
! if (!empty ($_USER['uid'])) {
!     $groupList = '';
!     foreach ($_GROUPS as $grp) {
!         $groupList .= $grp . ',';
!     }
!     $groupList = substr ($groupList, 0, -1);
!     $sql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
!     $sql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
!     $sql .= "(perm_members >= 2))";
! } else {
!     $sql .= "perm_anon >= 2)";
! }
  
  if (!empty($U['aids'])) {
--- 191,195 ----
  }
  
! $sql .= COM_getPermSQL ('AND');
  
  if (!empty($U['aids'])) {
***************
*** 221,224 ****
--- 209,225 ----
  }
  
+ $tresult = DB_query ("SELECT tid FROM {$_TABLES['topics']}" . COM_getPermSQL());
+ $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) {
+         $sql .= "AND (tid IN ('" . implode ("','", $tids) . "')) ";
+     }
+ }
+ 
  if ($newstories) {
      $sql .= "AND (date >= (NOW() - INTERVAL {$_CONF['newstoriesinterval']} SECOND)) ";
***************
*** 226,258 ****
  
  $offset = ($page - 1) * $limit;
! $sql .= "ORDER BY featured DESC, date DESC LIMIT $offset, $limit";
! 
! $result = DB_query($sql);
! $nrows = DB_numRows($result);
! 
! $countsql = "SELECT count(*) AS count FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0)";
! if (!empty($topic)) {
!     $countsql = $countsql . " AND tid='$topic'";
! } elseif (!$newstories) {
!     $countsql = $countsql . ' AND frontpage = 1';
! }
! 
! $countsql .= " AND (";
! if (!empty ($_USER['uid'])) {
!     // Note: $groupList re-used from above
!     $countsql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
!     $countsql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
!     $countsql .= "(perm_members >= 2))";
! } else {
!     $countsql .= "perm_anon >= 2)";
! }
  
! if ($newstories) {
!     $countsql .= " AND (date >= (NOW() - INTERVAL {$_CONF['newstoriesinterval']} SECOND))";
! }
  
! $data = DB_query($countsql);
! $D = DB_fetchArray($data);
! $num_pages = ceil($D['count'] / $limit);
  
  if ($nrows > 0) {
--- 227,239 ----
  
  $offset = ($page - 1) * $limit;
! $sql .= "ORDER BY featured DESC, date DESC";
  
! $result = DB_query ("SELECT *,unix_timestamp(date) AS day " . $sql
!         . " LIMIT $offset, $limit");
! $nrows = DB_numRows ($result);
  
! $data = DB_query ("SELECT count(*) AS count " . $sql);
! $D = DB_fetchArray ($data);
! $num_pages = ceil ($D['count'] / $limit);
  
  if ($nrows > 0) {





More information about the geeklog-cvs mailing list