예제 #1
0
 static function save_cookies($user)
 {
     cookie_put('login', $user->name);
     cookie_put('pass_hash', $user->password_hash);
     $_SESSION[CONFIG::app_name]['user_id'] = $user->id;
 }
function save_tags_to_cookie()
{
    if (!empty(Request::$params->tags)) {
        $tags = Request::$params->tags;
    } elseif (!empty(Request::$params->post) && !empty(Request::$params->post['tags'])) {
        $tags = explode(' ', strtolower(Request::$params->post['tags']));
    } else {
        return;
    }
    $tags = TagAlias::to_aliased($tags);
    if (!empty($_COOKIE["recent_tags"])) {
        $tags = array_merge($tags, explode(' ', $_COOKIE["recent_tags"]));
    }
    $tags = array_unique(array_filter($tags));
    cookie_put("recent_tags", implode(' ', array_slice($tags, 0, 20)));
}
예제 #3
0
    foreach ($queries as $query) {
        DB::execute_sql($query);
    }
    extract($_POST);
    $password_hash = md5($name . $password);
    $user_id = DB::insert('users (created_at, name, password_hash, level, show_advanced_editing) VALUES (?, ?, ?, ?, ?)', gmd(), $name, $password_hash, 50, 1);
    DB::insert('user_blacklisted_tags VALUES (?, ?)', $user_id, implode("\r\n", CONFIG::$default_blacklists));
    DB::update("table_data set row_count = row_count + 1 where name = 'users'");
    $dp = ROOT . 'public/data/';
    foreach (array($dp, "{$dp}/avatars", "{$dp}/export", "{$dp}/image", "{$dp}/import", "{$dp}/jpeg", "{$dp}/preview", "{$dp}/sample") as $dir) {
        @mkdir($dir);
    }
    unlink('index.php');
    rename('index_.php', 'index.php');
    cookie_put('login', $name);
    cookie_put('pass_hash', $password_hash);
    notice('Installation completed');
    header('Location: /');
    exit;
}
if (function_exists('finfo_open')) {
    $finfo = "Enabled";
    $finfo_class = "good";
} else {
    $finfo = "Not enabled";
    $finfo_class = "bad";
}
if (class_exists('PDO')) {
    $pdo = "Enabled";
    $pdo_class = "good";
} else {