Example #1
0
    l10n::lang($dlang);
    l10n::set(dirname(__FILE__) . '/../locales/' . $dlang . '/main');
}
$page_url = http::getHost() . $_SERVER['REQUEST_URI'];
$change_pwd = $core->auth->allowPassChange() && isset($_POST['new_pwd']) && isset($_POST['new_pwd_c']) && isset($_POST['login_data']);
$login_data = !empty($_POST['login_data']) ? html::escapeHTML($_POST['login_data']) : null;
$recover = $core->auth->allowPassChange() && !empty($_REQUEST['recover']);
$safe_mode = !empty($_REQUEST['safe_mode']);
$akey = $core->auth->allowPassChange() && !empty($_GET['akey']) ? $_GET['akey'] : null;
$user_id = $user_pwd = $user_key = $user_email = null;
$err = $msg = null;
# Auto upgrade
if (empty($_GET) && empty($_POST)) {
    require dirname(__FILE__) . '/../inc/dbschema/upgrade.php';
    try {
        if (($changes = dotclearUpgrade($core)) !== false) {
            $msg = __('Dotclear has been upgraded.') . '<!-- ' . $changes . ' -->';
        }
    } catch (Exception $e) {
        $err = $e->getMessage();
    }
}
# If we have POST login informations, go throug auth process
if (!empty($_POST['user_id']) && !empty($_POST['user_pwd'])) {
    $user_id = !empty($_POST['user_id']) ? $_POST['user_id'] : null;
    $user_pwd = !empty($_POST['user_pwd']) ? $_POST['user_pwd'] : null;
} elseif (isset($_COOKIE['dc_admin']) && strlen($_COOKIE['dc_admin']) == 104) {
    # If we have a remember cookie, go through auth process with user_key
    $user_id = substr($_COOKIE['dc_admin'], 40);
    $user_id = @unpack('a32', @pack('H*', $user_id));
    if (is_array($user_id)) {
Example #2
0
}
try {
    if (isset($_SERVER['argv'][1])) {
        $dc_conf = $_SERVER['argv'][1];
    } elseif (isset($_SERVER['DC_RC_PATH'])) {
        $dc_conf = realpath($_SERVER['DC_RC_PATH']);
    } else {
        $dc_conf = dirname(__FILE__) . '/../config.php';
    }
    if (!is_file($dc_conf)) {
        throw new Exception(sprintf('%s is not a file', $dc_conf));
    }
    $_SERVER['DC_RC_PATH'] = $dc_conf;
    unset($dc_conf);
    require dirname(__FILE__) . '/../prepend.php';
    require dirname(__FILE__) . '/upgrade.php';
    echo "Starting upgrade process\n";
    $core->con->begin();
    try {
        $changes = dotclearUpgrade($core);
    } catch (Exception $e) {
        $core->con->rollback();
        throw $e;
    }
    $core->con->commit();
    echo 'Upgrade process successfully completed (' . $changes . "). \n";
    exit(0);
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
    exit(1);
}