コード例 #1
0
ファイル: lib_login.php プロジェクト: nilswalk/privatesquare
function login_check_login()
{
    if (!$GLOBALS['cfg']['enable_feature_signin']) {
        return 0;
    }
    if ($GLOBALS['cfg']['user']['id']) {
        return 1;
    }
    $auth_cookie = login_get_cookie($GLOBALS['cfg']['auth_cookie_name']);
    if (!$auth_cookie) {
        return 0;
    }
    $auth_cookie = crypto_decrypt($auth_cookie, $GLOBALS['cfg']['crypto_cookie_secret']);
    list($user_id, $password) = explode(':', $auth_cookie, 2);
    if (!$user_id) {
        return 0;
    }
    $user = users_get_by_id($user_id);
    if (!$user) {
        return 0;
    }
    if ($user['deleted']) {
        return 0;
    }
    if ($user['password'] !== $password) {
        return 0;
    }
    $GLOBALS['cfg']['user'] = $user;
    return 1;
}
コード例 #2
0
function invite_codes_get_by_cookie($cookie = '')
{
    $cookie = login_get_cookie('invite');
    if (!$cookie) {
        return null;
    }
    $cookie = crypto_decrypt($cookie, $GLOBALS['cfg']['crypt_invite_secret']);
    if (!$cookie) {
        return null;
    }
    $cookie = explode("-", $cookie, 2);
    if (count($cookie) != 2) {
        return null;
    }
    return invite_codes_get_by_code($cookie[0], $cookie[1]);
}
コード例 #3
0
<?php

include "include/init.php";
login_ensure_loggedin();
loadlib("flickr_backups");
loadlib("invite_codes");
$backups = flickr_backups_for_user($GLOBALS['cfg']['user']);
$registered = count($backups) ? 1 : 0;
if (!$registered && !$GLOBALS['cfg']['backups_enable_registrations']) {
    error_disabled();
}
if ($GLOBALS['cfg']['enable_feature_invite_codes']) {
    if (!$registered && !invite_codes_get_by_cookie()) {
        $cookie = login_get_cookie('invite');
        if (!$cookie) {
            header("location: /invite/?redir=" . urlencode("account/flickr/backups"));
            exit;
        }
    }
}
features_ensure_enabled("backups");
$map = flickr_backups_type_map('string keys');
$GLOBALS['smarty']->assign_by_ref("map", $map);
$crumb_key = 'backups';
$smarty->assign("crumb_key", $crumb_key);
$crumb_ok = crumb_check($crumb_key);
if ($crumb_ok) {
    if (post_str("setup")) {
        $created = array();
        $details = array();
        foreach ($map as $ignore => $type_id) {