Example #1
0
set_include_path(INCLUDE_PATH);
include LIB_DIR . 'global.php';
require_once LIB_DIR . 'Util.php';
require_once LIB_DIR . 'DB.php';
/* end of update include_path and include scripts */
if (!isset($cfg) || !is_array($cfg)) {
    $cfg = array();
}
//define some library paths
$cfg['HTML_PURIFIER'] = 'htmlpurifier/library/HTMLPurifier.auto.php';
$cfg['SOLR_CLIENT'] = 'Apache/Solr/Service.php';
$cfg['MINIFY_PATH'] = DOC_ROOT . 'libx/min/';
$cfg['TIKA_SERVER'] = DOC_ROOT . 'libx/tika-server.jar';
if (file_exists(DOC_ROOT . 'config.ini')) {
    //load main config so that we can connect to casebox db and read configuration for core
    $cfg = Config::loadConfigFile(DOC_ROOT . 'config.ini') + $cfg;
    if (isset($cfg['db_host']) && isset($cfg['db_user']) && isset($cfg['db_pass']) && isset($cfg['db_port'])) {
        //conect to db using global params from config.ini
        DB\connect($cfg);
    }
} else {
    //Usually this appears when installing casebox and
    //a message instead of a complex error should be enough
    echo "Config file doesnt exist\n";
    // trigger_error("WARNING: file not exists " . DOC_ROOT . 'config.ini', E_USER_WARNING);
}
//define global prefix used
define('CB\\PREFIX', (empty($cfg['prefix']) ? 'cb' : $cfg['prefix']) . '_');
define('CB\\IS_DEBUG_HOST', empty($_SERVER['SERVER_NAME']) || !empty($cfg['debug_hosts']) && Util\isInValues($_SERVER['REMOTE_ADDR'], $cfg['debug_hosts']) || Util\is_cli());
define('CB\\IS_DEVEL_SERVER', !empty($cfg['_dev_mode']) && (strpos($_SERVER['SERVER_NAME'], '.d.') !== false || !empty($cfg['_dev_hosts']) && Util\isInValues($_SERVER['REMOTE_ADDR'], $cfg['_dev_hosts'])));
//analize python option
Example #2
0
/**
 * Nyx - Compile project
 *
 * Compile project and generate www/ files
 *
 * @copyright Noumenia (C) 2015 - All rights reserved - Software Development - www.noumenia.gr
 * @license GNU GPL v3.0
 * @package nyx
 * @subpackage compile
 */
// No direct access - loadable only
if (!defined('NYX_IN')) {
    die("No Access");
}
// Load project config file
$rc = Config::loadConfigFile();
if ($rc === false) {
    exit(9);
}
// Clean www directory
$wwwDir = Config::read('pwd') . '/www';
Log::debug('Clean www directory: ' . $wwwDir);
if (is_dir($wwwDir)) {
    exec('/usr/bin/rm -rf ' . escapeshellarg($wwwDir));
}
// Create www directory
Log::debug('Create www directory: ' . $wwwDir);
$rc = mkdir($wwwDir);
if ($rc === false) {
    Log::error('Error creating www directory: ' . $wwwDir);
    exit(9);