plugins/admin/PageManager.php
changeset 635 b3a33b661681
parent 536 218a627eb53e
child 685 17ebe24cdf85
equal deleted inserted replaced
634:8d951a34537e 635:b3a33b661681
    16 
    16 
    17 function page_Admin_PageManager()
    17 function page_Admin_PageManager()
    18 {
    18 {
    19   global $db, $session, $paths, $template, $plugins; // Common objects
    19   global $db, $session, $paths, $template, $plugins; // Common objects
    20   global $lang;
    20   global $lang;
       
    21   global $cache;
       
    22   
    21   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
    23   if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN )
    22   {
    24   {
    23     $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
    25     $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true);
    24     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    26     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    25     echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
    27     echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>';
   249                   foreach ( $sql as $q )
   251                   foreach ( $sql as $q )
   250                   {
   252                   {
   251                     if ( !$db->sql_query($q) )
   253                     if ( !$db->sql_query($q) )
   252                       $db->_die('PageManager running slave update query after page ID/namespace change');
   254                       $db->_die('PageManager running slave update query after page ID/namespace change');
   253                   }
   255                   }
       
   256                   
       
   257                   // update $paths with the new pathskey
       
   258                   $new_pathskey = $paths->nslist[$namespace_new] . $page_id_new;
       
   259                   $paths->pages[$new_pathskey] =& $paths->pages[$pathskey];
   254                 }
   260                 }
   255                 
   261                 
   256                 // Did we change the name of the page? If so, make PageUtils log it
   262                 // Did we change the name of the page? If so, make PageProcessor log it
   257                 if ( $dataset_backup['name'] != $dataset['name'] )
   263                 if ( $dataset_backup['name'] != $dataset['name'] )
   258                 {
   264                 {
   259                   PageUtils::rename($page_id_new, $namespace_new, $dataset['name']);
   265                   $page = new PageProcessor($page_id_new, $namespace_new);
       
   266                   $page->rename_page($dataset['name']);
   260                 }
   267                 }
       
   268                 
       
   269                 // Finally, clear the metadata cache
       
   270                 $cache->purge('page_meta');
   261               }
   271               }
   262               
   272               
   263               // Did the user ask to delete the page?
   273               // Did the user ask to delete the page?
       
   274               // I know it's a bit pointless to delete the page only after validating and processing the whole form, but what the heck :)
   264               if ( isset($_POST['delete']) )
   275               if ( isset($_POST['delete']) )
   265               {
   276               {
   266                 PageUtils::deletepage($page_id_new, $namespace_new, $lang->get('acppm_delete_reason'));
   277                 PageUtils::deletepage($page_id_new, $namespace_new, $lang->get('acppm_delete_reason'));
   267               }
   278               }
   268               
   279