Пример #1
0
/**
 * @deprecated
 * @desc Loads a configuration file. You choose a bases path, and you specify a folder name in which you file should be found, if it doesn't exist, it will take a file in another folder.
 * It's very interesting when you want to
 * @param string $dir_path Path of the file (relative from this page).
 * @param string $require_dir The name of the folder in which the configuration file should be. This folder must be in the bases file ($dir_path). If this directory doesn't exist, another will be read.
 * @param string $ini_name The name of the configuration file you want to know.
 * @return string[] The configuration values contained in the file $dir_path/$require_dir/$ini_name.
 */
function load_ini_file($dir_path, $require_dir, $ini_name = 'config.ini')
{
    $dir = find_require_dir($dir_path, $require_dir, false);
    $file = $dir_path . $dir . '/' . $ini_name;
    if (file_exists($file)) {
        $result = parse_ini_file($file);
    } else {
        $result = false;
    }
    return $result;
}
Пример #2
0
    define('SID', 'sid=' . $User->get_attribute('session_id') . '&suid=' . $User->get_attribute('user_id'));
    define('SID2', 'sid=' . $User->get_attribute('session_id') . '&suid=' . $User->get_attribute('user_id'));
} else {
    define('SID', '');
    define('SID2', '');
}
$user_theme = $User->get_attribute('user_theme');
if ($CONFIG_USER['force_theme'] == 1 || !isset($THEME_CONFIG[$user_theme]['secure']) || !$User->check_level($THEME_CONFIG[$user_theme]['secure'])) {
    $user_theme = $CONFIG['theme'];
}
$User->set_user_theme(find_require_dir(PATH_TO_ROOT . '/templates/', $user_theme));
$user_lang = $User->get_attribute('user_lang');
if (!isset($LANGS_CONFIG[$user_lang]['secure']) || !$User->check_level($LANGS_CONFIG[$user_lang]['secure'])) {
    $user_lang = $CONFIG['lang'];
}
$User->set_user_lang(find_require_dir(PATH_TO_ROOT . '/lang/', $user_lang));
$LANG = array();
require_once PATH_TO_ROOT . '/lang/' . get_ulang() . '/main.php';
require_once PATH_TO_ROOT . '/lang/' . get_ulang() . '/errors.php';
$Cache->load('day');
if (gmdate_format('j', time(), TIMEZONE_SITE) != $_record_day && !empty($_record_day)) {
    import('io/filesystem/file');
    $lock_file = new File(PATH_TO_ROOT . '/cache/changeday_lock');
    if (!$lock_file->exists()) {
        $lock_file->write('');
        $lock_file->flush();
    }
    $lock_file->lock(false);
    $yesterday_timestamp = time() - 86400;
    if ((int) $Sql->query("\n\t    SELECT COUNT(*)\n            FROM " . DB_TABLE_STATS . "\n            WHERE stats_year = '" . gmdate_format('Y', $yesterday_timestamp, TIMEZONE_SYSTEM) . "' AND\n                stats_month = '" . gmdate_format('m', $yesterday_timestamp, TIMEZONE_SYSTEM) . "' AND\n                stats_day = '" . gmdate_format('d', $yesterday_timestamp, TIMEZONE_SYSTEM) . "'", __LINE__, __FILE__) == 0) {
        $Cache->generate_file('day');
Пример #3
0
function get_ini_config($dir_path, $require_dir, $ini_name = 'config.ini')
{
    $dir = find_require_dir($dir_path, $require_dir, false);
    import('io/filesystem/file');
    $module_config_file = new File($dir_path . $dir . '/config.ini', READ);
    $module_config_file->open();
    $module_config_text = $module_config_file->get_contents();
    $result = array();
    if (preg_match('`;config="(.*)"\\s*$`s', $module_config_text, $result)) {
        return str_replace('\\n', "\r\n", $result[1]);
    } else {
        return '';
    }
}