includes/pageprocess.php
changeset 904 10076b28194b
parent 877 e9ee4e246f96
child 907 44851d7e9bda
equal deleted inserted replaced
903:b8db9a7946fc 904:10076b28194b
   835    */
   835    */
   836   
   836   
   837   function protect_page($protection_level, $reason)
   837   function protect_page($protection_level, $reason)
   838   {
   838   {
   839     global $db, $session, $paths, $template, $plugins; // Common objects
   839     global $db, $session, $paths, $template, $plugins; // Common objects
       
   840     global $cache;
   840     
   841     
   841     // Validate permissions
   842     // Validate permissions
   842     if ( !$this->perms->get_permissions('protect') )
   843     if ( !$this->perms->get_permissions('protect') )
   843     {
   844     {
   844       return array(
   845       return array(
   899     
   900     
   900     // Perform the actual protection
   901     // Perform the actual protection
   901     $q = $db->sql_query('UPDATE ' . table_prefix . "pages SET protected = $protection_level WHERE urlname = '{$this->page_id}' AND namespace = '{$this->namespace}';");
   902     $q = $db->sql_query('UPDATE ' . table_prefix . "pages SET protected = $protection_level WHERE urlname = '{$this->page_id}' AND namespace = '{$this->namespace}';");
   902     if ( !$q )
   903     if ( !$q )
   903       $db->die_json();
   904       $db->die_json();
       
   905     
       
   906     $cache->purge('page_meta');
   904     
   907     
   905     return array(
   908     return array(
   906       'success' => true
   909       'success' => true
   907       );
   910       );
   908   }
   911   }