Exemplo n.º 1
0
/**
 * Scan the EXTENSIONS_DIR or ENTERPRISE_DIR.'/'.EXTENSIONS_DIR for search
 * the files extensions.
 *
 * @param bool $enterprise
 */
function extensions_get_extensions($enterprise = false)
{
    $dir = EXTENSIONS_DIR;
    $handle = false;
    if ($enterprise) {
        $dir = ENTERPRISE_DIR . '/' . EXTENSIONS_DIR;
    }
    if (file_exists($dir)) {
        $handle = @opendir($dir);
    }
    if (empty($handle)) {
        return;
    }
    $file = readdir($handle);
    $extensions = array();
    $ignores = array('.', '..');
    while ($file !== false) {
        if (in_array($file, $ignores)) {
            $file = readdir($handle);
            continue;
        }
        $filepath = realpath($dir . "/" . $file);
        if (!is_readable($filepath) || is_dir($filepath) || !preg_match("/.*\\.php\$/", $filepath)) {
            $file = readdir($handle);
            continue;
        }
        $extension['file'] = $file;
        $extension['side_menu'] = '';
        $extension['godmode_side_menu'] = '';
        $extension['tab'] = '';
        $extension['main_function'] = '';
        $extension['godmode_function'] = '';
        $extension['tab_function'] = '';
        $extension['enterprise'] = $enterprise;
        $extension['dir'] = $dir;
        $extensions[$file] = $extension;
        $file = readdir($handle);
    }
    /* Load extensions in enterprise directory */
    if (!$enterprise && file_exists(ENTERPRISE_DIR . '/' . EXTENSIONS_DIR)) {
        return array_merge($extensions, extensions_get_extensions(true));
    }
    return $extensions;
}
Exemplo n.º 2
0
    $config["baseurl"] = $config["base_url_dir"];
}
// Detect enterprise version
// NOTE: If you override this value without enterprise code, you will break
// the code and get several problems!
if (file_exists($config["homedir"] . "/" . ENTERPRISE_DIR . "/include/functions_db.php")) {
    $config["enteprise"] = 1;
} else {
    $config["enteprise"] = 0;
}
if (!defined('EXTENSIONS_DIR')) {
    define('EXTENSIONS_DIR', 'extensions');
}
require_once $config["homedir"] . "/include/functions_extensions.php";
// Fill an array with data of the extensions
$config["extensions"] = extensions_get_extensions();
// Read remaining config tokens from DB
if (!mysql_connect($config["dbhost"], $config["dbuser"], $config["dbpass"])) {
    include $config["homedir"] . "/general/error_databaseconnect.php";
    exit;
}
mysql_select_db($config["dbname"]);
require_once $config["homedir"] . '/include/functions.php';
require_once $config["homedir"] . '/include/functions_db.php';
require_once $config["homedir"] . '/include/functions_config.php';
require_once $config["homedir"] . '/include/streams.php';
require_once $config["homedir"] . '/include/gettext.php';
require_once $config["homedir"] . '/include/constants.php';
// Load config from database
load_config();
// Activate log on disk for errors and other information