includes/pageutils.php
changeset 907 44851d7e9bda
parent 898 c75754f5b1da
child 909 94c1ff984286
equal deleted inserted replaced
906:c949e82b8f49 907:44851d7e9bda
  1108     }
  1108     }
  1109     if(!$session->get_permissions('clear_logs') && !defined('IN_ENANO_INSTALL'))
  1109     if(!$session->get_permissions('clear_logs') && !defined('IN_ENANO_INSTALL'))
  1110     {
  1110     {
  1111       return $lang->get('etc_access_denied');
  1111       return $lang->get('etc_access_denied');
  1112     }
  1112     }
       
  1113     if ( !$session->sid_super )
       
  1114     {
       
  1115       return $lang->get('etc_access_denied_need_reauth');
       
  1116     }
  1113     $e = $db->sql_query('DELETE FROM ' . table_prefix.'logs WHERE page_id=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $db->escape($namespace) . '\';');
  1117     $e = $db->sql_query('DELETE FROM ' . table_prefix.'logs WHERE page_id=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $db->escape($namespace) . '\';');
  1114     if(!$e) $db->_die('The log entries could not be deleted.');
  1118     if(!$e) $db->_die('The log entries could not be deleted.');
  1115     
  1119     
  1116     // If the page exists, make a backup of it in case it gets spammed/vandalized
  1120     // If the page exists, make a backup of it in case it gets spammed/vandalized
  1117     // If not, the admin's probably deleting a trash page
  1121     // If not, the admin's probably deleting a trash page
  1146     if ( empty($x) )
  1150     if ( empty($x) )
  1147     {
  1151     {
  1148       return $lang->get('ajax_delete_need_reason');
  1152       return $lang->get('ajax_delete_need_reason');
  1149     }
  1153     }
  1150     if(!$perms->get_permissions('delete_page')) return('Administrative privileges are required to delete pages, you loser.');
  1154     if(!$perms->get_permissions('delete_page')) return('Administrative privileges are required to delete pages, you loser.');
       
  1155     
       
  1156     if ( !$session->sid_super )
       
  1157     {
       
  1158       return $lang->get('etc_access_denied_need_reauth');
       
  1159     }
       
  1160     
  1151     $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.enano_date('d M Y h:i a').'\', \'page\', \'delete\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($reason)) . '\')');
  1161     $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.enano_date('d M Y h:i a').'\', \'page\', \'delete\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($reason)) . '\')');
  1152     if(!$e) $db->_die('The page log entry could not be inserted.');
  1162     if(!$e) $db->_die('The page log entry could not be inserted.');
  1153     $e = $db->sql_query('DELETE FROM ' . table_prefix.'categories WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1163     $e = $db->sql_query('DELETE FROM ' . table_prefix.'categories WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1154     if(!$e) $db->_die('The page categorization entries could not be deleted.');
  1164     if(!$e) $db->_die('The page categorization entries could not be deleted.');
  1155     $e = $db->sql_query('DELETE FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1165     $e = $db->sql_query('DELETE FROM ' . table_prefix.'comments WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1677     if(!$session->get_permissions('edit_acl') && ( $session->user_level < USER_LEVEL_ADMIN || !defined('ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL')) )
  1687     if(!$session->get_permissions('edit_acl') && ( $session->user_level < USER_LEVEL_ADMIN || !defined('ACL_ALWAYS_ALLOW_ADMIN_EDIT_ACL')) )
  1678     {
  1688     {
  1679       return Array(
  1689       return Array(
  1680         'mode' => 'error',
  1690         'mode' => 'error',
  1681         'error' => $lang->get('acl_err_access_denied')
  1691         'error' => $lang->get('acl_err_access_denied')
       
  1692         );
       
  1693     }
       
  1694     if ( !$session->sid_super )
       
  1695     {
       
  1696       return Array(
       
  1697         'mode' => 'error',
       
  1698         'error' => $lang->get('etc_access_denied_need_reauth')
  1682         );
  1699         );
  1683     }
  1700     }
  1684     $parms['page_id'] = ( isset($parms['page_id']) ) ? $parms['page_id'] : false;
  1701     $parms['page_id'] = ( isset($parms['page_id']) ) ? $parms['page_id'] : false;
  1685     $parms['namespace'] = ( isset($parms['namespace']) ) ? $parms['namespace'] : false;
  1702     $parms['namespace'] = ( isset($parms['namespace']) ) ? $parms['namespace'] : false;
  1686     $page_id =& $parms['page_id'];
  1703     $page_id =& $parms['page_id'];