Ejemplo n.º 1
0
function cs_cache_info()
{
    $info = cs_paths('uploads/cache');
    unset($info['index.html'], $info['.htaccess'], $info['web.config']);
    $form = array();
    foreach ($info as $filename => $num) {
        $form[$filename] = array('name' => $filename, 'time' => filemtime('uploads/cache/' . $filename), 'size' => filesize('uploads/cache/' . $filename));
    }
    $form = array_values($form);
    return $form;
}
Ejemplo n.º 2
0
function cs_cache_dirs($dir, $lang, $return_startup = 0)
{
    # $cs_lang and $cs_main are needed for info.php file content parsing
    global $cs_lang, $cs_main;
    $cachename = $dir . '_' . $lang;
    $content = cs_cache_load($cachename);
    if ($content === false) {
        $startup = array();
        $cs_lang_old = $cs_lang;
        $info = array();
        $dirlist = cs_paths($dir);
        unset($dirlist['index.html'], $dirlist['.htaccess'], $dirlist['web.config']);
        $directories = array_keys($dirlist);
        foreach ($directories as $target) {
            $this_info = $dir . '/' . $target . '/info.php';
            if (file_exists($this_info)) {
                $mod_info = array('show' => array());
                include $this_info;
                $name = empty($mod_info['name']) ? '[' . $target . ']' : $mod_info['name'];
                if (isset($info[$name])) {
                    cs_error($this_info, 'cs_cache_dirs - Translated name "' . $name . '" is already in use');
                } else {
                    $info[$name] = $mod_info;
                    $info[$name]['name'] = $name;
                    $info[$name]['dir'] = $target;
                    if ($dir == 'mods' and !empty($mod_info['startup'])) {
                        $startup[$target] = TRUE;
                    }
                }
                unset($info[$name]['text'], $info[$name]['url'], $info[$name]['team'], $info[$name]['creator']);
            } elseif (is_dir($dir . '/' . $target)) {
                cs_error($this_info, 'cs_cache_dirs - Required file not found');
            }
        }
        ksort($info);
        $cs_lang = $cs_lang_old;
        if ($dir == 'mods' and cs_cache_load('startup') === false) {
            cs_cache_save('startup', array_keys($startup));
        }
        cs_cache_save($cachename, $info);
        return empty($return_startup) ? $info : array_keys($startup);
    } else {
        return empty($return_startup) ? $content : cs_cache_load('startup');
    }
}
Ejemplo n.º 3
0
<?php

// ClanSphere 2010 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('install');
$sql_files = cs_paths('system/database');
unset($sql_files['pdo.php']);
$setup_exists = file_exists('setup.php') ? 1 : 0;
if (empty($setup_exists) and (isset($_POST['create']) or isset($_POST['view']))) {
    $cs_db['hash'] = $_POST['hash'];
    $cs_db['type'] = $_POST['type'];
    $cs_db['subtype'] = $_POST['subtype'];
    $cs_db['place'] = $_POST['place'];
    $cs_db['user'] = $_POST['user'];
    $cs_db['pwd'] = $_POST['pwd'];
    $cs_db['name'] = $_POST['name'];
    $cs_db['prefix'] = $_POST['prefix'];
    $log['save_actions'] = !empty($_POST['save_actions']) ? $_POST['save_actions'] : 0;
    $log['save_errors'] = !empty($_POST['save_errors']) ? $_POST['save_errors'] : 0;
    $error = 0;
    $errormsg = '';
    if (empty($cs_db['hash'])) {
        $error++;
        $errormsg .= $cs_lang['no_hash'] . cs_html_br(1);
    }
    if (empty($cs_db['type'])) {
        $error++;
        $errormsg .= $cs_lang['no_type'] . cs_html_br(1);
    }
    if (empty($cs_db['name'])) {
        $error++;
Ejemplo n.º 4
0
// $Id$
$cs_lang = cs_translate('clansphere');
$data = array();
$data['charset']['result_setup_file'] = '';
$data['charset']['result_tpl_setting'] = '';
$data['charset']['result_web_setting'] = '';
$data['charset']['result_sql_setting'] = '';
# Check for correct setup.php charset information
$charset = strtolower($cs_main['charset']);
if ($charset != 'utf-8' and cs_substr($charset, 0, 9) != 'iso-8859-') {
    $data['charset']['result_setup_file'] = $cs_lang['charset_unexpected'] . ' : ' . $cs_main['charset'];
    $data['charset']['result_setup_file'] .= cs_html_br(2) . $cs_lang['charset_unexpected_hint'];
}
# Check every .htm file in the activated template for a matching charset definition
$tpl_charset = array();
$tpl_files = cs_paths('templates/' . $cs_main['def_tpl']);
foreach ($tpl_files as $file => $int) {
    if (strtolower(substr($file, -4, 4)) == '.htm') {
        $filename = 'templates/' . $cs_main['def_tpl'] . '/' . $file;
        $fp = fopen($filename, 'r');
        $tpl_content = fread($fp, filesize($filename));
        fclose($fp);
        preg_match_all("=(charset|encoding)\\s*\\=\\s*\"*(.*?)(\\s+|\")=si", $tpl_content, $tpl_check);
        if (empty($tpl_check[2])) {
            $data['charset']['result_tpl_setting'] .= $cs_lang['charset_missing'] . cs_html_br(1);
            $data['charset']['result_tpl_setting'] .= $cs_lang['file'] . ': ' . $filename . cs_html_br(2);
        }
        foreach ($tpl_check[2] as $found) {
            $foundlow = strtolower($found);
            if ($foundlow != '{func:charset}' and $foundlow != $charset) {
                $data['charset']['result_tpl_setting'] .= $cs_lang['charset_unexpected'] . ' : ' . $found . cs_html_br(1);