includes/pageprocess.php
changeset 698 40f9528b6348
parent 696 bd5069e1f19a
child 741 a216e412c439
equal deleted inserted replaced
697:8e9ba8b131fa 698:40f9528b6348
   638    */
   638    */
   639   
   639   
   640   function rollback_log_entry($log_id)
   640   function rollback_log_entry($log_id)
   641   {
   641   {
   642     global $db, $session, $paths, $template, $plugins; // Common objects
   642     global $db, $session, $paths, $template, $plugins; // Common objects
       
   643     global $cache;
   643     
   644     
   644     // Verify permissions
   645     // Verify permissions
   645     if ( !$this->perms->get_permissions('history_rollback') )
   646     if ( !$this->perms->get_permissions('history_rollback') )
   646     {
   647     {
   647       return array(
   648       return array(
   696         
   697         
   697         // Raising a previously dead page has implications...
   698         // Raising a previously dead page has implications...
   698         
   699         
   699         // FIXME: l10n
   700         // FIXME: l10n
   700         // rollback_extra is required because usually only moderators can undo page deletion AND restore the content.
   701         // rollback_extra is required because usually only moderators can undo page deletion AND restore the content.
       
   702         // potential flaw here - once recreated, can past revisions be restored by users without rollback_extra? should
       
   703         // probably modify editor routine to deny revert access if the timestamp < timestamp of last deletion if any.
   701         if ( !$this->perms->get_permissions('history_rollback_extra') )
   704         if ( !$this->perms->get_permissions('history_rollback_extra') )
   702           return 'Administrative privileges are required for page undeletion.';
   705           return 'Administrative privileges are required for page undeletion.';
   703         
   706         
   704         // Rolling back the deletion of a page that was since created?
   707         // Rolling back the deletion of a page that was since created?
   705         $pathskey = $paths->nslist[ $this->namespace ] . $this->page_id;
   708         $pathskey = $paths->nslist[ $this->namespace ] . $this->page_id;
   735         $page_text = $db->escape($page_text);
   738         $page_text = $db->escape($page_text);
   736         $e = $db->sql_query('INSERT INTO ' . table_prefix."page_text(page_id, namespace, page_text) VALUES\n"
   739         $e = $db->sql_query('INSERT INTO ' . table_prefix."page_text(page_id, namespace, page_text) VALUES\n"
   737                           . "  ( '$this->page_id', '$this->namespace', '$page_text' );");
   740                           . "  ( '$this->page_id', '$this->namespace', '$page_text' );");
   738         if ( !$e )
   741         if ( !$e )
   739           $db->die_json();
   742           $db->die_json();
       
   743         
       
   744         $cache->purge('page_meta');
   740         
   745         
   741         return array(
   746         return array(
   742             'success' => true,
   747             'success' => true,
   743             'dateline' => $dateline,
   748             'dateline' => $dateline,
   744             'action' => $log_entry['action']
   749             'action' => $log_entry['action']