[geeklog-cvs] geeklog-1.3/public_html links.php,1.28,1.29

dhaun at geeklog.net dhaun at geeklog.net
Sat Oct 11 08:38:44 EDT 2003


Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory geeklog_prod:/tmp/cvs-serv3332

Modified Files:
	links.php 
Log Message:
Changed to use COM_getPermSQL().


Index: links.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/links.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** links.php	7 Sep 2003 09:32:14 -0000	1.28
--- links.php	11 Oct 2003 12:38:42 -0000	1.29
***************
*** 6,18 ****
  // +---------------------------------------------------------------------------+
  // | links.php                                                                 |
- // | This is the links page                                                    |
  // |                                                                           |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000,2001,2002 by the following authors:                    |
  // |                                                                           |
! // | Authors: Tony Bibbs       - tony at tonybibbs.com                            |
! // |          Mark Limburg     - mlimburg at users.sourceforge.net                |
! // |          Jason Wittenburg - jwhitten at securitygeeks.com                    |
! // |          Tom Willett      - tomw at pigstye.net                              |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
--- 6,18 ----
  // +---------------------------------------------------------------------------+
  // | links.php                                                                 |
  // |                                                                           |
+ // | This is the links page                                                    |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2000-2003 by the following authors:                         |
  // |                                                                           |
! // | Authors: Tony Bibbs        - tony at tonybibbs.com                           |
! // |          Mark Limburg      - mlimburg at users.sourceforge.net               |
! // |          Jason Whittenburg - jwhitten at securitygeeks.com                   |
! // |          Tom Willett       - tomw at pigstye.net                             |
  // +---------------------------------------------------------------------------+
  // |                                                                           |
***************
*** 59,77 ****
      $linklist->set_file(array('linklist'=>'links.thtml','catlinks'=>'categorylinks.thtml','link'=>'linkdetails.thtml','catnav'=>'categorynavigation.thtml','catrow'=>'categoryrow.thtml','catcol'=>'categorycol.thtml','actcol'=>'categoryactivecol.thtml','pagenav'=>'pagenavigation.thtml'));
  
-     $permsql = "(";
-     if (!empty ($_USER['uid'])) {
-         $groupList = '';
-         foreach ($_GROUPS as $grp) {
-             $groupList .= $grp . ',';
-         }
-         $groupList = substr ($groupList, 0, -1);
-         $permsql .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
-         $permsql .= "(group_id IN ($groupList) AND perm_group >= 2) OR ";
-         $permsql .= "(perm_members >= 2) OR ";
-     }
-     $permsql .= "(perm_anon >= 2))";
- 
      if ($_CONF['linkcols'] > 0) {
!         $result = DB_query("SELECT DISTINCT category FROM {$_TABLES['links']} WHERE {$permsql} ORDER BY category");
          $nrows  = DB_numRows($result);
          if ($nrows > 0) {
--- 59,64 ----
      $linklist->set_file(array('linklist'=>'links.thtml','catlinks'=>'categorylinks.thtml','link'=>'linkdetails.thtml','catnav'=>'categorynavigation.thtml','catrow'=>'categoryrow.thtml','catcol'=>'categorycol.thtml','actcol'=>'categoryactivecol.thtml','pagenav'=>'pagenavigation.thtml'));
  
      if ($_CONF['linkcols'] > 0) {
!         $result = DB_query("SELECT DISTINCT category FROM {$_TABLES['links']}" . COM_getPermSQL () . " ORDER BY category");
          $nrows  = DB_numRows($result);
          if ($nrows > 0) {
***************
*** 80,84 ****
                  $C = DB_fetchArray($result);
                  $cat = addslashes ($C['category']);
!                 $result1 = DB_query ("SELECT count(*) AS count FROM {$_TABLES['links']} WHERE category = '{$cat}' AND {$permsql}");
                  $D = DB_fetchArray($result1);
                  if (empty ($C['category'])) {
--- 67,71 ----
                  $C = DB_fetchArray($result);
                  $cat = addslashes ($C['category']);
!                 $result1 = DB_query ("SELECT COUNT(*) AS count FROM {$_TABLES['links']} WHERE category = '{$cat}'" . COM_getPermSQL ('AND'));
                  $D = DB_fetchArray($result1);
                  if (empty ($C['category'])) {
***************
*** 115,128 ****
      $linklist->set_var('lang_addalink', $LANG06[3]);
  
!     $sql = "SELECT lid,category,url,description,title,hits FROM {$_TABLES['links']} WHERE ";
      if ($_CONF['linkcols'] > 0) {
          if (isset ($category)) {
!             $sql .= "category = '$category' AND ";
          } else {
!             $sql .= "category = '' AND ";
          }
      }
!     $sql .= "{$permsql} ";
!     $sql .= "ORDER BY category asc,title";
      $result = DB_query($sql);
      $nrows = DB_numRows($result);
--- 102,117 ----
      $linklist->set_var('lang_addalink', $LANG06[3]);
  
!     $sql = "SELECT lid,category,url,description,title,hits FROM {$_TABLES['links']}";
      if ($_CONF['linkcols'] > 0) {
          if (isset ($category)) {
!             $sql .= " WHERE category = '$category'";
          } else {
!             $sql .= " WHERE category = ''";
          }
+         $sql .= COM_getPermSQL ('AND');
+     } else {
+         $sql .= COM_getPermSQL ();
      }
!     $sql .= " ORDER BY category asc,title";
      $result = DB_query($sql);
      $nrows = DB_numRows($result);
***************
*** 131,135 ****
          $end = 10;
  
!         $result = DB_query("SELECT lid,url,title,description,hits from {$_TABLES['links']} WHERE (hits > 0) AND ({$permsql}) ORDER BY hits DESC LIMIT 10");
          $nrows  = DB_numRows($result);
          if ($nrows > 0) {
--- 120,124 ----
          $end = 10;
  
!         $result = DB_query("SELECT lid,url,title,description,hits from {$_TABLES['links']} WHERE (hits > 0)" . COM_getPermSQL ('AND') . " ORDER BY hits DESC LIMIT 10");
          $nrows  = DB_numRows($result);
          if ($nrows > 0) {





More information about the geeklog-cvs mailing list