plugins/SpecialAdmin.php
changeset 9 1e61232606d6
parent 0 902822492a68
child 15 ad5986a53197
equal deleted inserted replaced
8:4bb20dddef00 9:1e61232606d6
   503   {
   503   {
   504     echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
   504     echo '<h3>Error: Not authenticated</h3><p>It looks like your administration session is invalid or you are not authorized to access this administration page. Please <a href="' . makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true) . '">re-authenticate</a> to continue.</p>';
   505     return;
   505     return;
   506   }
   506   }
   507   
   507   
   508   
   508   if(isset($_GET['action']))
   509   if(isset($_GET['action'])) {
   509   {
   510     switch($_GET['action']) {
   510     switch($_GET['action'])
       
   511     {
   511       case "enable":
   512       case "enable":
   512         setConfig('plugin_'.$_GET['plugin'], '1');
   513         setConfig('plugin_'.$_GET['plugin'], '1');
   513         break;
   514         break;
   514       case "disable":
   515       case "disable":
   515         if($_GET['plugin']!='admin.php') setConfig('plugin_'.$_GET['plugin'], '0');
   516         if ( $_GET['plugin'] != 'SpecialAdmin.php' )
   516         else echo('<h3>Error disabling plugin</h3><p>The administration panel plugin cannot be disabled.</p>');
   517         {
       
   518           setConfig('plugin_'.$_GET['plugin'], '0');
       
   519         }
       
   520         else 
       
   521         {
       
   522           echo('<h3>Error disabling plugin</h3><p>The administration panel plugin cannot be disabled.</p>');
       
   523         }
   517         break;
   524         break;
   518     }
   525     }
   519   }
   526   }
   520   $dir = './plugins/';
   527   $dir = './plugins/';
   521   $plugin_list = Array();
   528   $plugin_list = Array();
   522   $system = Array();
   529   $system = Array();
   523   if (is_dir($dir)) {
   530   
   524     if ($dh = opendir($dir)) {
   531   if (is_dir($dir))
   525       while (($file = readdir($dh)) !== false) {
   532   {
       
   533     if ($dh = opendir($dir))
       
   534     {
       
   535       while (($file = readdir($dh)) !== false)
       
   536       {
   526         if(preg_match('#^(.*?)\.php$#is', $file) && $file != 'index.php')
   537         if(preg_match('#^(.*?)\.php$#is', $file) && $file != 'index.php')
   527         {
   538         {
   528           if ( in_array($file, $plugins->system_plugins) )
   539           if ( in_array($file, $plugins->system_plugins) )
   529           {
   540           {
   530             $thelist =& $system;
   541             $thelist =& $system;
   552           $thelist[$file]['aweb'] = $f[5];
   563           $thelist[$file]['aweb'] = $f[5];
   553         }
   564         }
   554       }
   565       }
   555       closedir($dh);
   566       closedir($dh);
   556     }
   567     }
       
   568     else
       
   569     {
       
   570       echo '<div class="error-box">The plugins/ directory could not be opened.</div>';
       
   571       return;
       
   572     }
       
   573   }
       
   574   else
       
   575   {
       
   576     echo '<div class="error-box">The plugins/ directory is missing from your Enano installation.</div>';
       
   577     return;
   557   }
   578   }
   558   echo('<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">
   579   echo('<div class="tblholder"><table border="0" width="100%" cellspacing="1" cellpadding="4">
   559       <tr><th>Plugin filename</th><th>Plugin name</th><th>Description</th><th>Author</th><th>Version</th><th></th></tr>');
   580       <tr><th>Plugin filename</th><th>Plugin name</th><th>Description</th><th>Author</th><th>Version</th><th></th></tr>');
   560     $plugin_files = array_keys($plugin_list);
   581     $plugin_files = array_keys($plugin_list);
   561     $cls = 'row2';
   582     $cls = 'row2';