/** * Pick up and install any new plugins * * Search for plugins that exist in the filesystem but are not registered with * Geeklog. If they support auto install, install them now. * * @return void * */ function INST_autoinstallNewPlugins() { global $_CONF, $_TABLES, $_DB_dbms, $_DB_table_prefix; $newplugins = array(); clearstatcache(); $plugins_dir = $_CONF['path'] . 'plugins/'; $fd = opendir($plugins_dir); while (($plugin = @readdir($fd)) == TRUE) { if ($plugin != '.' && $plugin != '..' && $plugin != 'CVS' && substr($plugin, 0, 1) != '.' && substr($plugin, 0, 1) != '_' && is_dir($plugins_dir . $plugin)) { if (DB_count($_TABLES['plugins'], 'pi_name', $plugin) == 0) { // found a new plugin: remember name, keep on searching $newplugins[] = $plugin; } } } // automatically install all new plugins that come with a autoinstall.php foreach ($newplugins as $pi_name) { $plugin_inst = $_CONF['path'] . 'plugins/' . $pi_name . '/autoinstall.php'; if (file_exists($plugin_inst)) { require_once $plugin_inst; $check_compatible = 'plugin_compatible_with_this_version_' . $pi_name; if (function_exists($check_compatible)) { if (!$check_compatible($pi_name)) { continue; // with next plugin } } $auto_install = 'plugin_autoinstall_' . $pi_name; if (!function_exists($auto_install)) { continue; // with next plugin } $inst_parms = $auto_install($pi_name); if ($inst_parms === false || empty($inst_parms)) { continue; // with next plugin } INST_pluginAutoinstall($pi_name, $inst_parms); } } }
$check_compatible = 'plugin_compatible_with_this_version_' . $pi_name; if (function_exists($check_compatible)) { if (!$check_compatible($pi_name)) { continue; // with next plugin } } $auto_install = 'plugin_autoinstall_' . $pi_name; if (!function_exists($auto_install)) { continue; // with next plugin } $inst_parms = $auto_install($pi_name); if ($inst_parms === false || empty($inst_parms)) { continue; // with next plugin } INST_pluginAutoinstall($pi_name, $inst_parms); } } } // Done! header('Location: success.php?language=' . $language); break; } // End switch ($step) } // end if (php_v()) $display .= INST_getFooter(); header('Content-Type: text/html; charset=' . COM_getCharset()); echo $display;