Beispiel #1
0
 public function constants($key, $constants = array(), $sensitive = true)
 {
     if (CACHE_STATUS) {
         apc_define_constants($key, $constants, $sensitive);
     }
     return false;
 }
Beispiel #2
0
 public function constants($key, $constants = array(), $sensitive = TRUE)
 {
     if (_cacheStatus) {
         apc_define_constants($key, $constants, $sensitive);
     }
     return FALSE;
 }
Beispiel #3
0
 function _apc_const($key, $constants = false, $case_sen = true)
 {
     // pass empty $constants array() to delete constants
     if ($values == false) {
         return apc_load_constants($key, $case_sen);
     } else {
         return apc_define_constants($key, $constants);
     }
 }
Beispiel #4
0
    $cf['KU_TRIPS'] = serialize($cf['KU_TRIPS']);
    $cf['KU_LINELENGTH'] = $cf['KU_LINELENGTH'] * 15;
    if (substr($cf['KU_WEBFOLDER'], -2) == '//') {
        $cf['KU_WEBFOLDER'] = substr($cf['KU_WEBFOLDER'], 0, -1);
    }
    if (substr($cf['KU_BOARDSFOLDER'], -2) == '//') {
        $cf['KU_BOARDSFOLDER'] = substr($cf['KU_BOARDSFOLDER'], 0, -1);
    }
    if (substr($cf['KU_CGIFOLDER'], -2) == '//') {
        $cf['KU_CGIFOLDER'] = substr($cf['KU_CGIFOLDER'], 0, -1);
    }
    $cf['KU_WEBPATH'] = trim($cf['KU_WEBPATH'], '/');
    $cf['KU_BOARDSPATH'] = trim($cf['KU_BOARDSPATH'], '/');
    $cf['KU_CGIPATH'] = trim($cf['KU_CGIPATH'], '/');
    if ($cf['KU_APC']) {
        apc_define_constants('config', $cf);
    }
    while (list($key, $value) = each($cf)) {
        define($key, $value);
    }
    unset($cf);
}
// DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING OR ELSE BAD THINGS MAY HAPPEN
$modules_loaded = array();
$required = array(KU_ROOTDIR, KU_WEBFOLDER, KU_WEBPATH);
if (in_array('CHANGEME', $required) || in_array('', $required)) {
    echo 'You must set KU_ROOTDIR, KU_WEBFOLDER, and KU_WEBPATH before installation will finish!';
    die;
}
require KU_ROOTDIR . 'lib/gettext/gettext.inc.php';
require KU_ROOTDIR . 'lib/adodb/adodb.inc.php';
Beispiel #5
0
<?php

/**
 * @category Public
 * @package  Bootstrap
 */
$appRootPath = realpath(__DIR__ . '/../');
//boosted index
$constants = array('ERROR_REPORT_MAIL' => '*****@*****.**', 'ERROR_REPORT_SUBJECT' => 'ZFCore: Error occurred in application', 'APPLICATION_ROOT_PATH' => $appRootPath, 'APPLICATION_PATH' => $appRootPath . '/application', 'APPLICATION_ENV' => ($env = getenv('APPLICATION_ENV')) ? $env : 'production', 'PUBLIC_PATH' => __DIR__, 'DS' => DIRECTORY_SEPARATOR, 'START_TIMER' => microtime(true));
apc_define_constants('ZFCoreTransitionConstants', $constants);
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array($appRootPath . '/library', get_include_path())));
require $appRootPath . '/vendor/autoload.php';
/**
 * Register error handler
 */
require_once 'Core/ErrorHandler.php';
register_shutdown_function(array('Core_ErrorHandler', 'handler'));
set_error_handler(array('Core_ErrorHandler', 'handler'));
try {
    $config = APPLICATION_PATH . '/configs/application.yaml';
    if (APPLICATION_ENV != 'development') {
        if (realpath($config)) {
            require_once 'Zend/Cache.php';
            $frontendOptions = array("lifetime" => 60 * 60 * 24, "automatic_serialization" => true, "automatic_cleaning_factor" => 1, "ignore_user_abort" => true);
            $backendOptions = array("file_name_prefix" => APPLICATION_ENV . "_config", "cache_dir" => $appRootPath . "/data/cache", "cache_file_umask" => 0644);
            // getting a Zend_Cache_Core object
            $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
            if (!($result = $cache->load('application'))) {
                require_once 'Zend/Config/Yaml.php';
                require_once 'Core/Config/Yaml.php';
Beispiel #6
0
 /**
  * Stores the given array constants to the APC
  * @param mixed The index to be used
  * @param array The constants to store. Use as key => value
  */
 public final function storeConstantsArray($key, array $constants)
 {
     apc_define_constants($this->getIndexKey($key), $constants);
     self::$apcIterator = null;
 }
Beispiel #7
0
 /**
  * Задает набор констант
  *
  * @param string $key
  * @param array  $constants
  *
  * @return array
  */
 public static function define_constants($key, array $constants, $case_sensitive = true)
 {
     return apc_define_constants($key, $constants, $case_sensitive);
 }
Beispiel #8
0
     */
    if ($result == TRUE) {
        set_include_path(get_include_path() . PATH_SEPARATOR . INCLUDE_PATH);
    } else {
        /*
         * Load constants from the config file.
         */
        if ((include INCLUDE_PATH . '/config.inc.php') === FALSE) {
            die('Cannot run without a config.inc.php file. See the installation documentation.');
        }
        define('APC_RUNNING', TRUE);
        /*
         * And then save them to APC.
         */
        $constants = get_defined_constants(TRUE);
        apc_define_constants('config', $constants['user']);
    }
}
/*
 * Include the functions that drive the site.
 */
require 'functions.inc.php';
/*
 * Connect to the database.
 */
try {
    $db = new Database(PDO_DSN, PDO_USERNAME, PDO_PASSWORD, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_SILENT));
} catch (PDOException $e) {
    /*
     * If we get error 1049, that means that no database of this name could be found. This means
     * that The State Decoded has not yet been installed. Redirect to the admin section.
function constants_define($key_, array $constants_)
{
    return apc_define_constants(COMPONENTS_CACHE_NAMESPACE . "-{$key_}", $constants_, true);
}
Beispiel #10
0
 /**
  * Load Constants from APC
  */
 public static function initialize_ConstantsAndPaths()
 {
     // ensure that apc is loaded as extension
     define('APC', (bool) extension_loaded('apc'));
     // try to load constants from APC
     if (APC === true) {
         // constants retrieved from APC
         apc_load_constants('CLANSUITE_CONSTANTS', true);
         return;
     }
     // if apc is off or
     // if apc is on, but apc_load_constants did not retrieve any constants yet (first run)
     // then define constants
     if (APC === false or defined('NL') == false) {
         self::define_ConstantsAndPaths();
         /**
          * Store Constants to APC
          */
         if (APC === true) {
             // catch user-defined constants as array
             $constantsarray = get_defined_constants(true);
             // remove starttime constant
             unset($constantsarray['user']['STARTTIME']);
             apc_define_constants('CLANSUITE_CONSTANTS', $constantsarray['user'], false);
             unset($constantsarray);
         }
     }
     /**
      * SET INCLUDE PATHS
      *
      * We set INCLUDE PATHS for PEAR and other 3th party Libraries by defining an paths array first.
      * We are not setting the clansuite core path here, because files located there are handled via autoloading.
      *
      * The $paths array is set to the php environment with set_include_path().
      * Note, that for set_include_path() to work properly the path order is important!
      * <first path to look>:<second path>:<etc>:
      *
      * If you need to add something: use or absolute path constants (ROOT*) or realpath($your_path).
      */
     $paths = array(dirname(KOCH), KOCH, ROOT, ROOT_VENDOR, ROOT_LIBRARIES, ROOT_LIBRARIES . 'PEAR' . DIRECTORY_SEPARATOR);
     // attach original include paths
     set_include_path(implode($paths, PATH_SEPARATOR) . PATH_SEPARATOR . get_include_path());
     //var_dump(get_include_path());
     unset($paths);
 }