Exemplo n.º 1
0
$site_url = '';
@(include_once PS_ROOTDIR . "/config.php");
// Initialize our global variables for PsychoStats.
// Lets be nice to the global Name Space.
$db = null;
$cms = null;
// global PsychoCMS object
$PHP_SELF = $_SERVER['PHP_SELF'];
// this is used so much we make sure it's global
// Sanitize PHP_SELF and avoid XSS attacks.
// We use the constant in places we know we'll be outputting $PHP_SELF to the user
define(SAFE_PHP_SELF, htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'));
// create database handle
$db = PsychoDB::create(array('dbtype' => 'mysql', 'delaystart' => true, 'fatal' => false));
// start the PS CMS object
$cms = new PsychoCMS(array('dbhandle' => &$db, 'plugin_dir' => PS_ROOTDIR . '/plugins', 'site_url' => $site_url));
// this session will not actually store a session in a database or file.
// it's mearly used in the install for cookie support.
$cms->session = new PsychoSession(array('cms' => $cms, 'cookiename' => 'ps_install_sess', 'cookiesalt' => '', 'cookiecompress' => true, 'cookieencode' => true, 'cookielifeoptions' => 0, 'dbhandle' => $db, 'delaystart' => true));
$cms->init(true);
// quick init; no plugins, session or user
$cms->init_theme('default', array('theme_default' => 'default', 'theme_opt' => 'install_theme', 'in_db' => false, 'force_theme' => true, 'fetch_compile' => false, 'compile_id' => 'install', 'compile_dir' => null, 'js_compress' => false, 'css_compress' => false, 'template_dir' => dirname(__FILE__) . '/themes', 'theme_url' => null));
$cms->theme->load_styles();
$cms->theme->assign(array('SELF' => SAFE_PHP_SELF, 'install_version' => PS_INSTALL_VERSION));
// ----------------------------------
function init_session_opts($delete = false)
{
    global $cms;
    $opts = $cms->session->load_session_options();
    if ($delete || !$opts || !$opts['install']) {
        $cms->session->set_opts(array('install' => uniqid(rand(), true)), true);
Exemplo n.º 2
0
if (empty($t['roles_dir'])) {
    $t['roles_dir'] = catfile($t['root_img_dir'], 'roles');
}
if (empty($t['roles_url'])) {
    $t['roles_url'] = catfile($t['root_img_url'], 'roles');
}
if (empty($t['flags_dir'])) {
    $t['flags_dir'] = catfile($t['root_img_dir'], 'flags');
}
if (empty($t['flags_url'])) {
    $t['flags_url'] = catfile($t['root_img_url'], 'flags');
}
if (empty($t['icons_dir'])) {
    $t['icons_dir'] = catfile($t['root_img_dir'], 'icons');
}
if (empty($t['icons_url'])) {
    $t['icons_url'] = catfile($t['root_img_url'], 'icons');
}
if (empty($t['maps_dir'])) {
    $t['maps_dir'] = catfile($t['root_img_dir'], 'maps');
}
if (empty($t['maps_url'])) {
    $t['maps_url'] = catfile($t['root_img_url'], 'maps');
}
// verify the compile_dir is valid. create it if possible.
// If the dir is not valid try to find a valid directory or at least print out why.
// TODO ...
unset($t);
// start the PS CMS object
$cms = new PsychoCMS(array('dbhandle' => &$ps->db, 'plugin_dir' => PS_ROOTDIR . '/plugins', 'site_url' => $site_url));
$cms->init();