Location: PHPKode > projects > MembersGear > membersgear/admin/index.php
<?php

require_once "../config/config.php"; 
$phyDir=PHYSICAL_DIR;
$web_url=WEB_URL;

if(file_exists("plugins"))
 {
     $enabledPlugins=array();
     $tempArray= array();
     $ignore = array( 'cgi-bin', '.', '..' );
     $dh = @opendir( "plugins" );
     $counter=0;
     while( false !== ( $file = readdir( $dh ) ) )
       {
         
           if( !in_array( $file, $ignore ) )
            {
 
              if(is_dir("$phyDir/admin/plugins/$file")) 
               {
                   $plugin=false;
                   $ConfigFile="$phyDir/admin/plugins/$file/config.inc";
                   $settingFile="$phyDir/admin/plugins/$file/setting.php"; 
                   $pluginFile="$phyDir/admin/plugins/$file/plugin.php";  
                   $pluginImageEnable="$phyDir/admin/plugins/$file/images/enabled.gif";  
                   $pluginImageDisabled="$phyDir/admin/plugins/$file/images/disabled.gif"; 
             
                 
                    if(file_exists($ConfigFile) and file_exists($settingFile) and file_exists($pluginFile) and  file_exists($pluginImageEnable) and file_exists($pluginImageDisabled) )
                     {
                         
                               $fileconc = $ConfigFile;
                               $lines =  file($fileconc);
                               $plugName=false;
                               $plugStatus=false;
                               foreach ($lines as $line)
                                {
                                   $fileCont=split("=", $line);
                                   if(is_array($fileCont))
                                    {
                                       if(strcasecmp(trim($fileCont[0]),'NAME')==0)
                                        {
                                          $pluginName=$fileCont[1];
                                          $plugName=true;
                                     
                                         }
                                         else if(strcasecmp(trim($fileCont[0]),'STATUS')==0) 
                                          {
                                             $pluginStatus=$fileCont[1];
                                              if(strcasecmp(trim($fileCont[1]),'ENABLED')==0 or strcasecmp(trim($fileCont[1]),'DISABLED')==0)
                                              {
                                                $plugStatus=true;
                                             
                                                }
                                         
                                            }
                                     
                                           if($plugStatus==true and $plugName==true)
                                               break;  
                                       }
                              
                             }                                              

                            if($plugStatus==true and $plugName==true)   
                              { 
                                     $pluginName=trim($pluginName);
                                     $status=trim($pluginStatus);
                                     
                                     if(strcasecmp(trim($status),'DISABLED')==0)
                                      {
                                        $conrolPanelImage=$web_url."/admin/plugins/$file/images/disabled.gif" ;
                                        $tempArray['status']='Disabled';
                                      } 
                                     else if(strcasecmp(trim($status),'ENABLED')==0) 
                                      {                                              
                                         $conrolPanelImage=$web_url."/admin/plugins/$file/images/enabled.gif";
                                         $tempArray['status']='Enabled'; 
                                      }  
                                        
                                     $settingpathRelative=$web_url."/admin/plugins/$file/setting.php";    
                                            
                                     $tempArray['name']=$pluginName;
                                     $tempArray['imagpath']=$conrolPanelImage; 
                                     $tempArray['insPath']=$settingpathRelative;
                                     
                                     $enabledPlugins[$counter]=$tempArray;
                                     unset($tempArray); 
                                    // unset(NAME);
                                     //unset(STATUS);
                                     $counter++;
                              }      
                        }   
                      
                    }
             
             
                 } 
            
            
             
           }
     
   }  
     
 
if($counter>0)
    $smarty->assign('plugins',$enabledPlugins); 
else
   $smarty->assign('plugins','false');     
$smarty->display('admin_controlpanel.tpl');

?>
Return current item: MembersGear