plugins/admin/PageManager.php
changeset 898 c75754f5b1da
parent 801 eb8b23f11744
child 953 323c4cd1aa37
equal deleted inserted replaced
897:f31c252c52c1 898:c75754f5b1da
    26     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    26     echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>';
    27     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>';
    28     return;
    28     return;
    29   }
    29   }
    30   
    30   
       
    31   require_once(ENANO_ROOT . '/includes/pageutils.php');
       
    32   
    31   echo '<h3>' . $lang->get('acppm_heading_main') . '</h3>';
    33   echo '<h3>' . $lang->get('acppm_heading_main') . '</h3>';
    32   $show_select = true;
    34   $show_select = true;
    33   
    35   
    34   if ( isset($_REQUEST['action']) || isset($_REQUEST['source']) )
    36   if ( isset($_REQUEST['action']) || isset($_REQUEST['source']) )
    35   {
    37   {
   158               $page_id_changed = ( $_POST['page_urlname'] !== $dataset['urlname'] );
   160               $page_id_changed = ( $_POST['page_urlname'] !== $dataset['urlname'] );
   159               $dataset['urlname'] = sanitize_page_id($page_urlname);
   161               $dataset['urlname'] = sanitize_page_id($page_urlname);
   160             }
   162             }
   161             
   163             
   162             // Field: namespace
   164             // Field: namespace
   163             $namespace = $_POST['page_namespace'];
   165             $namespace_new = $_POST['page_namespace'];
   164             if ( !isset($paths->nslist[ $namespace ]) )
   166             if ( !isset($paths->nslist[ $namespace ]) )
   165             {
   167             {
   166               $errors[] = $lang->get('acppm_err_invalid_namespace');
   168               $errors[] = $lang->get('acppm_err_invalid_namespace');
   167             }
   169             }
   168             else
   170             else
   169             {
   171             {
   170               $namespace_changed = ( $_POST['page_namespace'] !== $dataset['namespace'] );
   172               $namespace_changed = ( $_POST['page_namespace'] !== $dataset['namespace'] );
   171               $dataset['namespace'] = $namespace;
   173               $dataset['namespace'] = $namespace_new;
   172             }
   174             }
   173             
   175             
   174             // Field: comments enabled
   176             // Field: comments enabled
   175             $dataset['comments_on'] = ( isset($_POST['comments_on']) ) ? 1 : 0;
   177             $dataset['comments_on'] = ( isset($_POST['comments_on']) ) ? 1 : 0;
   176             
   178             
   252                   {
   254                   {
   253                     if ( !$db->sql_query($q) )
   255                     if ( !$db->sql_query($q) )
   254                       $db->_die('PageManager running slave update query after page ID/namespace change');
   256                       $db->_die('PageManager running slave update query after page ID/namespace change');
   255                   }
   257                   }
   256                   
   258                   
       
   259                   // If we're going File -> other, remove files
       
   260                   if ( $namespace_db === 'File' )
       
   261                   {
       
   262                     PageUtils::delete_page_files($page_id);
       
   263                   }
       
   264                   
   257                   // update $paths with the new pathskey
   265                   // update $paths with the new pathskey
   258                   $new_pathskey = $paths->nslist[$namespace_new] . $page_id_new;
   266                   $new_pathskey = $paths->nslist[$namespace_new] . $page_id_new;
   259                   $paths->pages[$new_pathskey] =& $paths->pages[$pathskey];
   267                   $paths->pages[$new_pathskey] =& $paths->pages[$pathskey];
   260                 }
   268                 }
   261                 
   269                 
   316                 {lang:acppm_lbl_namespace}
   324                 {lang:acppm_lbl_namespace}
   317               </td>
   325               </td>
   318               <td class="row1">
   326               <td class="row1">
   319                 <select name="page_namespace">
   327                 <select name="page_namespace">
   320                 {NAMESPACE_LIST}</select>
   328                 {NAMESPACE_LIST}</select>
       
   329                 <!-- BEGIN is_file -->
       
   330                 <br />
       
   331                 {lang:acppm_msg_file_ns_warning}
       
   332                 <!-- END is_file -->
   321               </td>
   333               </td>
   322             </tr>
   334             </tr>
   323             
   335             
   324             <tr>
   336             <tr>
   325               <th colspan="2" class="subhead">
   337               <th colspan="2" class="subhead">
   479             'protected_off'   => ( $dataset['protected'] == 0 ),
   491             'protected_off'   => ( $dataset['protected'] == 0 ),
   480             'protected_on'    => ( $dataset['protected'] == 1 ),
   492             'protected_on'    => ( $dataset['protected'] == 1 ),
   481             'protected_semi'  => ( $dataset['protected'] == 2 ),
   493             'protected_semi'  => ( $dataset['protected'] == 2 ),
   482             'wikimode_off'    => ( $dataset['wiki_mode'] == 0 ),
   494             'wikimode_off'    => ( $dataset['wiki_mode'] == 0 ),
   483             'wikimode_on'     => ( $dataset['wiki_mode'] == 1 ),
   495             'wikimode_on'     => ( $dataset['wiki_mode'] == 1 ),
   484             'wikimode_global' => ( $dataset['wiki_mode'] == 2 )
   496             'wikimode_global' => ( $dataset['wiki_mode'] == 2 ),
       
   497             'is_file'         => ( $dataset['namespace'] == 'File' )
   485           ));
   498           ));
   486         
   499         
   487         if ( isset($errors) )
   500         if ( isset($errors) )
   488         {
   501         {
   489           echo '<div class="error-box">';
   502           echo '<div class="error-box">';