示例#1
0
 * @brief Automatic installation of plugins and activation
 */
global $cn;
/******************************************************************************
 * Scan the plugin folder and file in each subfolder a property file and
 * store them into an array a_plugin
 ******************************************************************************
 */
$dirscan = scandir(NOALYSS_PLUGIN);
$nb_dirscan = count($dirscan);
$a_plugin = array();
for ($e = 0; $e < $nb_dirscan; $e++) {
    if ($dirscan[$e] != '.' && $dirscan[$e] != '..' && is_dir(NOALYSS_PLUGIN . '/' . $dirscan[$e])) {
        $dir_plugin = $dirscan[$e];
        if (file_exists(NOALYSS_PLUGIN . '/' . $dir_plugin . '/plugin.xml')) {
            $extension = Extension::read_definition(NOALYSS_PLUGIN . '/' . $dir_plugin . '/plugin.xml');
            for ($i = 0; $i < count($extension); $i++) {
                $a_plugin[] = clone $extension[$i];
            }
        }
    }
}
$nb_plugin = count($a_plugin);
/**
 * available profiles
 */
$a_profile = $cn->get_array('select p_id,p_name from profile where p_id > 0 order by p_name');
$nb_profile = count($a_profile);
/******************************************************************************
 * save 
 ******************************************************************************/