Пример #1
0
}
$validfields = array('done');
$cms->theme->assign_request_vars($validfields, true);
if ($done) {
    $cms->session->delete_cookie('_opts');
    gotopage("../admin/logsources.php");
}
// make DB connection
load_db_opts();
$db->config(array('dbtype' => $dbtype, 'dbhost' => $dbhost, 'dbport' => $dbport, 'dbname' => $dbname, 'dbuser' => $dbuser, 'dbpass' => $dbpass, 'dbtblprefix' => $dbtblprefix));
$db->clear_errors();
$db->connect();
if (!$db->connected || !$db->dbexists($db->dbname)) {
    if ($ajax_request) {
        print "<script type='text/javascript'>window.location = 'go.php?s=db&re=1&install=" . urlencode($install) . "';</script>";
        exit;
    } else {
        gotopage("go.php?s=db&re=1&install=" . urlencode($install));
    }
}
// now that the DB connection should be valid, reinitialize, so we'll have full access to user and session objects
$cms->init();
$ps = PsychoStats::create(array('dbhandle' => &$db));
$ps->theme_setup($cms->theme);
$cms->theme->assign(array());
if ($ajax_request) {
    //	sleep(1);
    $pagename = 'go-done-results';
    $cms->tiny_page($pagename, $pagename);
    exit;
}
Пример #2
0
$dbtype = $dbhost = $dbport = $dbname = $dbuser = $dbpass = $dbtblprefix = '';
require_once PS_ROOTDIR . "/config.php";
// Initialize our global variables for PsychoStats.
// Lets be nice to the global Name Space.
$ps = null;
// global PsychoStats object
$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'));
// start PS object; all $dbxxxx variables are loaded from config.php
#$ps = new PS(array(
$ps = PsychoStats::create(array('fatal' => 0, 'dbtype' => $dbtype, 'dbhost' => $dbhost, 'dbport' => $dbport, 'dbname' => $dbname, 'dbuser' => $dbuser, 'dbpass' => $dbpass, 'dbtblprefix' => $dbtblprefix));
// initialize some defaults if no pre-set values are present for required directories and urls
$t =& $ps->conf['theme'];
//shortcut
if (empty($t['script_url'])) {
    $t['script_url'] = dirname($_SERVER['SCRIPT_NAME']);
    //dirname($PHP_SELF);
    if (defined("PSYCHOSTATS_ADMIN_PAGE") or defined("PSYCHOSTATS_SUBPAGE")) {
        $t['script_url'] = dirname($t['script_url']);
    }
}
// template directory is figured out here now, instead of leaving it null for theme class so that the admin
// pages can properly detect the main theme directory.
if (empty($t['template_dir'])) {
    $t['template_dir'] = catfile(PS_ROOTDIR, 'themes');
}