plugins/SpecialAdmin.php
changeset 953 323c4cd1aa37
parent 939 32a43ae3649b
child 954 995d36f39ba3
equal deleted inserted replaced
952:d52dfa1f08da 953:323c4cd1aa37
    42     'namespace'=>'Special',
    42     'namespace'=>'Special',
    43     'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
    43     'special'=>0,'visible'=>1,'comments_on'=>0,'protected'=>1,'delvotes'=>0,'delvote_ips'=>'',
    44     ));
    44     ));
    45 }
    45 }
    46 
    46 
    47 $plugins->attachHook('session_started', 'SpecialAdmin_theme_init();');
       
    48 $plugins->attachHook('common_post', 'SpecialAdmin_include();');
    47 $plugins->attachHook('common_post', 'SpecialAdmin_include();');
    49 
       
    50 function SpecialAdmin_theme_init()
       
    51 {
       
    52   global $db, $session, $paths, $template, $plugins; // Common objects
       
    53   
       
    54   // Admin pages that were too enormous to be in this file were split off into the plugins/admin/ directory in 1.0.1.
       
    55   // Only load these files if we're looking to load the admin panel
       
    56   list($pid, $ns) = RenderMan::strToPageID($paths->get_pageid_from_url());
       
    57   if ( $ns == 'Admin' || ( $pid == 'Administration' && $ns == 'Special' ) )
       
    58   {
       
    59     // Set the theme
       
    60     $session->theme = 'admin';
       
    61     $session->style = 'default';
       
    62     
       
    63     $template->add_header('<script type="text/javascript" src="' . cdnPath . '/includes/clientside/static/admin-menu.js"></script>');
       
    64   }
       
    65 }
       
    66 
    48 
    67 function SpecialAdmin_include()
    49 function SpecialAdmin_include()
    68 {
    50 {
    69   global $db, $session, $paths, $template, $plugins; // Common objects
    51   global $db, $session, $paths, $template, $plugins; // Common objects
    70   
    52   
   130     if(isset($_POST['wiki_mode_require_login'])) setConfig('wiki_mode_require_login', '1');
   112     if(isset($_POST['wiki_mode_require_login'])) setConfig('wiki_mode_require_login', '1');
   131     else                                         setConfig('wiki_mode_require_login', '0');
   113     else                                         setConfig('wiki_mode_require_login', '0');
   132     if(isset($_POST['editmsg']))                 setConfig('wiki_edit_notice', '1');
   114     if(isset($_POST['editmsg']))                 setConfig('wiki_edit_notice', '1');
   133     else                                         setConfig('wiki_edit_notice', '0');
   115     else                                         setConfig('wiki_edit_notice', '0');
   134     setConfig('wiki_edit_notice_text', $_POST['editmsg_text']);
   116     setConfig('wiki_edit_notice_text', $_POST['editmsg_text']);
       
   117     $cache->purge('wiki_edit_notice');
   135     if(isset($_POST['guest_edit_require_captcha'])) setConfig('guest_edit_require_captcha', '1');
   118     if(isset($_POST['guest_edit_require_captcha'])) setConfig('guest_edit_require_captcha', '1');
   136     else                                         setConfig('guest_edit_require_captcha', '0');
   119     else                                         setConfig('guest_edit_require_captcha', '0');
   137     
   120     
   138     // Stats
   121     // Stats
   139     if(isset($_POST['log_hits']))                setConfig('log_hits', '1');
   122     if(isset($_POST['log_hits']))                setConfig('log_hits', '1');
  2076     redirect(makeUrlNS('Special', 'Login/'.$paths->page, 'level='.USER_LEVEL_ADMIN), 'Not authorized', 'You need an authorization level of '.USER_LEVEL_ADMIN.' to use this page, your auth level is: ' . $session->auth_level, 0);
  2059     redirect(makeUrlNS('Special', 'Login/'.$paths->page, 'level='.USER_LEVEL_ADMIN), 'Not authorized', 'You need an authorization level of '.USER_LEVEL_ADMIN.' to use this page, your auth level is: ' . $session->auth_level, 0);
  2077     exit;
  2060     exit;
  2078   }
  2061   }
  2079   else
  2062   else
  2080   {
  2063   {
       
  2064     $template->set_theme('admin', 'default');
       
  2065     $template->add_header('<script type="text/javascript" src="' . cdnPath . '/includes/clientside/static/admin-menu.js"></script>');
       
  2066     
  2081     if( !isset( $_GET['noheaders'] ) ) 
  2067     if( !isset( $_GET['noheaders'] ) ) 
  2082     {
  2068     {
  2083       $template->header();
  2069       $template->header();
  2084     }
  2070     }
  2085     echo $lang->get('adm_page_tagline');
  2071     echo $lang->get('adm_page_tagline');