[geeklog-cvs] Geeklog-1.x/public_html/admin/plugins/links index.php, 1.56, 1.57

Dirk Haun dhaun at qs1489.pair.com
Sat Apr 12 15:51:17 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin/plugins/links
In directory qs1489.pair.com:/tmp/cvs-serv49626/public_html/admin/plugins/links

Modified Files:
	index.php 
Log Message:
Fixed deleting link submissions from the Links editor


Index: index.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/plugins/links/index.php,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** index.php	29 Feb 2008 08:22:52 -0000	1.56
--- index.php	12 Apr 2008 19:51:15 -0000	1.57
***************
*** 45,49 ****
   * @copyright Copyright © 2005-2007
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  * @author Trinity Bays <trinity93 at steubentech.com>
   * @author Tony Bibbs <tony at tonybibbs.com>
   * @author Tom Willett <twillett at users.sourceforge.net>
--- 45,49 ----
   * @copyright Copyright © 2005-2007
   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
!  * @author Trinity Bays <trinity93 at gmail.com>
   * @author Tony Bibbs <tony at tonybibbs.com>
   * @author Tom Willett <twillett at users.sourceforge.net>
***************
*** 166,169 ****
--- 166,174 ----
          $link_templates->set_var ('delete_option_no_confirmation',
                                    sprintf ($delbutton, ''));
+         if ($mode == 'editsubmission') {
+             $link_templates->set_var('submission_option',
+                 '<input type="hidden" name="type" value="submission"'
+                 . XHTML . '>');
+         }
      }
      $link_templates->set_var('lang_linktitle', $LANG_LINKS_ADMIN[3]);
***************
*** 428,451 ****
  *
  * @param    string  $lid    id of link to delete
  * @return   string          HTML redirect
  *
  */
! function deleteLink ($lid)
  {
      global $_CONF, $_TABLES, $_USER;
  
!     $result = DB_query ("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['links']} WHERE lid ='$lid'");
!     $A = DB_fetchArray ($result);
!     $access = SEC_hasAccess ($A['owner_id'], $A['group_id'], $A['perm_owner'],
!             $A['perm_group'], $A['perm_members'], $A['perm_anon']);
!     if ($access < 3) {
!         COM_accessLog ("User {$_USER['username']} tried to illegally delete link $lid.");
!         return COM_refresh ($_CONF['site_admin_url'] . '/plugins/links/index.php');
!     }
  
!     DB_delete ($_TABLES['links'], 'lid', $lid);
  
!     return COM_refresh ($_CONF['site_admin_url']
!                         . '/plugins/links/index.php?msg=3');
  }
  
--- 433,474 ----
  *
  * @param    string  $lid    id of link to delete
+ * @param    string  $type   'submission' when attempting to delete a submission
  * @return   string          HTML redirect
  *
  */
! function deleteLink($lid, $type = '')
  {
      global $_CONF, $_TABLES, $_USER;
  
!     if (empty($type)) { // delete regular link
!         $result = DB_query("SELECT owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['links']} WHERE lid ='$lid'");
!         $A = DB_fetchArray($result);
!         $access = SEC_hasAccess($A['owner_id'], $A['group_id'],
!                     $A['perm_owner'], $A['perm_group'], $A['perm_members'],
!                     $A['perm_anon']);
!         if ($access < 3) {
!             COM_accessLog("User {$_USER['username']} tried to illegally delete link $lid.");
!             return COM_refresh($_CONF['site_admin_url']
!                                . '/plugins/links/index.php');
!         }
  
!         DB_delete($_TABLES['links'], 'lid', $lid);
  
!         return COM_refresh($_CONF['site_admin_url']
!                            . '/plugins/links/index.php?msg=3');
!     } elseif ($type == 'submission') {
!         if (plugin_ismoderator_links()) {
!             DB_delete($_TABLES['linksubmission'], 'lid', $lid);
! 
!             return COM_refresh($_CONF['site_admin_url']
!                                . '/plugins/links/index.php?msg=3');
!         } else {
!             COM_accessLog("User {$_USER['username']} tried to illegally delete link submission $lid.");
!         }
!     } else {
!         COM_errorLog("User {$_USER['username']} tried to illegally delete link $lid of type $type.");
!     }
! 
!     return COM_refresh($_CONF['site_admin_url'] . '/plugins/links/index.php');
  }
  
***************
*** 462,466 ****
          $display .= COM_refresh ($_CONF['site_admin_url'] . '/plugins/links/index.php');
      } else {
!         $display .= deleteLink ($lid);
      }
  } else if (($mode == $LANG_ADMIN['save']) && !empty ($LANG_ADMIN['save'])) {
--- 485,493 ----
          $display .= COM_refresh ($_CONF['site_admin_url'] . '/plugins/links/index.php');
      } else {
!         $type = '';
!         if (isset($_POST['type'])) {
!             $type = COM_applyFilter($_POST['type']);
!         }
!         $display .= deleteLink($lid, $type);
      }
  } else if (($mode == $LANG_ADMIN['save']) && !empty ($LANG_ADMIN['save'])) {




More information about the geeklog-cvs mailing list