Changeset 1029

Show
Ignore:
Timestamp:
11/24/05 18:14:45 (3 years ago)
Author:
sdcosta
Message:

Fix for #145 and #131

Location:
trunk/rss/admin
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/admin/config.php

    r1011 r1029  
    246246 
    247247            $active_plugins= getConfig('rss.config.plugins'); 
     248            $rss_plugins = getPlugins(); 
    248249            $cntr = 0; 
    249             $d = dir('../plugins'); 
    250             $files = array(); 
    251             while (false !== ($entry = $d->read())) { 
    252                 if ( 
    253                     $entry != "CVS" && 
    254                     substr($entry,0,1) != "." 
    255                 ) { 
    256                     $info = getPluginInfo($entry); 
     250            if ($rss_plugins) { 
     251                foreach($rss_plugins as $entry => $info ) { 
    257252                    $active= in_array($entry,$active_plugins); 
    258  
    259253                    if (count($info)) { 
    260254                        echo "<tr class=\"" 
     
    276270                } 
    277271            } 
    278             $d->close(); 
    279272            echo "</table>\n<p>"; 
    280273 
     
    494487            $active=array(); 
    495488            foreach($_REQUEST as $rkey=>$rentry) { 
    496                 if (preg_match('/_gregarius_plugin.([a-zA-Z0-9_]+).php/',$rkey,$matches)) { 
     489                if (preg_match('/_gregarius_plugin.([a-zA-Z0-9_\/\-]+).php/',$rkey,$matches)) { 
    497490                    $active[] = ($matches[1] .".php"); 
    498491                } 
  • trunk/rss/admin/index.php

    r1025 r1029  
    286286} 
    287287 
     288/** 
     289* This function returns an associative array with all the php files that are 
     290* plugins and their plugin info.  
     291 
     292* Following the wordpress model (and code) we search for plugins in the plugins 
     293* directory and each subdirectory 1 level deep. 
     294*/ 
     295function getPlugins() { 
     296 
     297    $plugin_dir_files = array();  
     298    $rss_plugins = array();  
     299    $plugin_dir = '../' . RSS_PLUGINS_DIR; 
     300 
     301    $d = @dir($plugin_dir); 
     302    //Put all the *.php files in the plugin dir and 1 level below into $plugin_dir_files 
     303        while (($file = $d->read()) !== false) { 
     304            if ( $file != "CVS" && (substr($file,0,1) != ".")) { 
     305        if(is_dir($plugin_dir . '/' . $file)) { 
     306                   $plugins_subdir = @dir($plugin_dir . '/' . $file); 
     307                   if ($plugins_subdir) { 
     308                      while(($subfile = $plugins_subdir->read()) !== false) { 
     309                          if ( preg_match('|^\.+$|', $subfile) ) { 
     310                                  continue; 
     311              } 
     312                          if ( preg_match('|\.php$|', $subfile) ) { 
     313                                  $plugin_dir_files[] = "$file/$subfile"; 
     314              } 
     315                      }  
     316                  } 
     317        } else { 
     318                        if ( preg_match('|\.php$|', $file) ) { 
     319                $plugin_dir_files[] =  $file; 
     320            } 
     321        } 
     322        } 
     323    } 
     324 
     325    // See which of the php files in $plugin_dir_files are really plugins 
     326    foreach($plugin_dir_files as $plugin_dir_file) { 
     327        $info = getPluginInfo($plugin_dir_file); 
     328        if (count($info)){ 
     329            $rss_plugins[$plugin_dir_file] = $info; 
     330        } 
     331    } 
     332 
     333    //return an associative array with the plugin files and their info 
     334    return $rss_plugins; 
     335} 
    288336 
    289337function getLanguages() {