plugins/admin/PageManager.php
changeset 898 c75754f5b1da
parent 801 eb8b23f11744
child 953 323c4cd1aa37
--- a/plugins/admin/PageManager.php	Sat Apr 11 16:58:32 2009 -0400
+++ b/plugins/admin/PageManager.php	Sat Apr 11 22:32:45 2009 -0400
@@ -28,6 +28,8 @@
     return;
   }
   
+  require_once(ENANO_ROOT . '/includes/pageutils.php');
+  
   echo '<h3>' . $lang->get('acppm_heading_main') . '</h3>';
   $show_select = true;
   
@@ -160,7 +162,7 @@
             }
             
             // Field: namespace
-            $namespace = $_POST['page_namespace'];
+            $namespace_new = $_POST['page_namespace'];
             if ( !isset($paths->nslist[ $namespace ]) )
             {
               $errors[] = $lang->get('acppm_err_invalid_namespace');
@@ -168,7 +170,7 @@
             else
             {
               $namespace_changed = ( $_POST['page_namespace'] !== $dataset['namespace'] );
-              $dataset['namespace'] = $namespace;
+              $dataset['namespace'] = $namespace_new;
             }
             
             // Field: comments enabled
@@ -254,6 +256,12 @@
                       $db->_die('PageManager running slave update query after page ID/namespace change');
                   }
                   
+                  // If we're going File -> other, remove files
+                  if ( $namespace_db === 'File' )
+                  {
+                    PageUtils::delete_page_files($page_id);
+                  }
+                  
                   // update $paths with the new pathskey
                   $new_pathskey = $paths->nslist[$namespace_new] . $page_id_new;
                   $paths->pages[$new_pathskey] =& $paths->pages[$pathskey];
@@ -318,6 +326,10 @@
               <td class="row1">
                 <select name="page_namespace">
                 {NAMESPACE_LIST}</select>
+                <!-- BEGIN is_file -->
+                <br />
+                {lang:acppm_msg_file_ns_warning}
+                <!-- END is_file -->
               </td>
             </tr>
             
@@ -481,7 +493,8 @@
             'protected_semi'  => ( $dataset['protected'] == 2 ),
             'wikimode_off'    => ( $dataset['wiki_mode'] == 0 ),
             'wikimode_on'     => ( $dataset['wiki_mode'] == 1 ),
-            'wikimode_global' => ( $dataset['wiki_mode'] == 2 )
+            'wikimode_global' => ( $dataset['wiki_mode'] == 2 ),
+            'is_file'         => ( $dataset['namespace'] == 'File' )
           ));
         
         if ( isset($errors) )