Example #1
0
function online_format(&$online)
{
    global $conf, $grouplist;
    if (empty($online)) {
        return;
    }
    $online['last_date_fmt'] = date('Y-n-j', $online['last_date']);
    $online['groupname'] = $grouplist[$online['gid']]['name'];
    $user = $online['uid'] ? user_read_cache($online['uid']) : user_guest();
    $online['username'] = $user['username'];
}
Example #2
0
<?php

// 创建新帖
!defined('DEBUG') and exit('Access Denied.');
include './xiunophp/xn_html_safe.func.php';
include './xiunophp/image.func.php';
$action = param(1);
$user = user_read($uid);
empty($user) and $user = user_guest();
if ($action == 'create') {
    $tid = param(2);
    $quick = param(3);
    $thread = thread_read($tid);
    empty($thread) and message(3, '主题不存在:' . $tid);
    $fid = $thread['fid'];
    $forum = forum_read($fid);
    empty($forum) and message(3, '板块不存在:' . $fid);
    $r = forum_access_user($fid, $gid, 'allowpost');
    if (!$r) {
        if ($gid == 0) {
            $r = forum_access_user($fid, 101, 'allowpost');
            $r and user_login_check($user);
        }
        message(10, '您(' . $user['groupname'] . ')无权限在此版块发帖');
    }
    $conf['ipaccess_on'] and !ipaccess_check($longip, 'posts') and message(-1, '您的 IP 今日回帖数达到上限,请明天再来。');
    if ($method == 'GET') {
        check_standard_browser();
        include './flarum/view/post_create.htm';
    } else {
        $agree = param('agree', 0);
Example #3
0
function user_token_get($s = '', $cookipre = '')
{
    global $conf;
    empty($cookipre) and $cookipre = APP_NAME;
    $guest = user_guest();
    if (!$s) {
        $s = param($cookipre . '_token');
    }
    if (!$s) {
        return $guest;
    }
    $s2 = decrypt($s, $conf['auth_key']);
    if (!$s2) {
        return $guest;
    }
    $arr = explode("\t", $s2);
    if (count($arr) < 7) {
        return $guest;
    }
    $token = array();
    $token['uid'] = $arr[0];
    $token['gid'] = $arr[1];
    $token['time'] = $arr[2];
    $token['ip'] = $arr[3];
    $token['password'] = $arr[4];
    $token['avatar'] = $arr[5];
    $dir = substr(sprintf("%09d", $token['uid']), 0, 3);
    $token['avatar_url'] = $token['avatar'] ? $conf['upload_url'] . "avatar/{$dir}/{$token['uid']}.png?" . $token['avatar'] : 'static/avatar.png';
    $token['username'] = $arr[6];
    // if($token['password'] != $user['password']) return array(); // 修改密码,需要重新登录
    return $token;
}
Example #4
0
function post_format(&$post)
{
    global $conf;
    if (empty($post)) {
        return;
    }
    $post['create_date_fmt'] = humandate($post['create_date']);
    $user = $post['uid'] ? user_read_cache($post['uid']) : user_guest();
    $post['username'] = $user['username'];
    $post['user_avatar_url'] = $user['avatar_url'];
    !isset($post['floor']) and $post['floor'] = '';
    $post['agrees_class'] = 'agrees_' . thread_get_level($post['agrees'], $conf['agrees_level']);
    // 权限判断
    global $uid, $sid, $longip;
    $post['allowupdate'] = $uid != 0 && $uid == $post['uid'] || $uid == 0 && $post['uid'] == 0 && $post['userip'] == $longip && $post['sid'] == $sid ? 1 : 0;
    $post['allowdelete'] = $uid != 0 && $uid == $post['uid'] || $uid == 0 && $post['uid'] == 0 && $post['userip'] == $longip && $post['sid'] == $sid ? 1 : 0;
    $post['user_url'] = "user-{$post['uid']}" . ($post['uid'] ? '' : "-{$post['pid']}") . ".htm";
}
function thread_format(&$thread)
{
    global $conf, $forumlist;
    if (empty($thread)) {
        return;
    }
    $thread['create_date_fmt'] = humandate($thread['create_date']);
    $thread['last_date_fmt'] = humandate($thread['last_date']);
    $user = user_read_cache($thread['uid']);
    empty($user) and $user = user_guest();
    $thread['username'] = $user['username'];
    $thread['user_avatar_url'] = $user['avatar_url'];
    $forum = $forumlist[$thread['fid']];
    $thread['forumname'] = $forum['name'];
    if ($thread['last_date'] == $thread['create_date']) {
        //$thread['last_date'] = 0;
        $thread['last_date_fmt'] = '';
        $thread['lastuid'] = 0;
        $thread['lastusername'] = '';
    } else {
        $lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
        $thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : '******';
    }
    $thread['seo_url'] = $conf['seo_url_rewrite'] && $thread['url_on'] ? thread_url_read($thread['tid']) : '';
    $thread['url'] = $thread['seo_url'] ? $thread['seo_url'] : "thread-{$thread['tid']}.htm";
    $thread['user_url'] = "user-{$thread['uid']}" . ($thread['uid'] ? '' : "-{$thread['firstpid']}") . ".htm";
    $n = $thread['agrees'] + $thread['posts'];
    $agree_level = thread_get_level($n, $conf['agrees_level']);
    $thread['posts_class'] = 'posts_' . thread_get_level($thread['posts'], $conf['posts_level']);
    $thread['agrees_class'] = 'agrees_' . $agree_level;
    $thread['thread_class'] = 'thread_agrees_' . $agree_level;
    $thread['top_class'] = $thread['top'] ? 'thread_top_' . $thread['top'] : '';
}
Example #6
0
            user_update($_uid, array('password' => $password));
            online_unset('reset_email');
            online_unset('reset_verifycode');
            message(0, '修改成功');
        }
    }
} else {
    $_uid = param(1, 0);
    $pid = param(2, 0);
    // 接受 pid,通过 pid 查询 userip
    if ($_uid == 0) {
        $post = post_read($pid);
        $_ip = long2ip($post['userip']);
        $_ip_url = xn_urlencode($_ip);
        $banip = banip_read_by_ip($_ip);
        $_user = user_guest();
    } else {
        $banip = array();
        $_user = user_read($_uid);
        $_ip = long2ip($_user['create_ip']);
        $banip = banip_read_by_ip($_ip);
        $_ip_url = xn_urlencode($_ip);
        empty($_user) and message(0, '用户不存在');
    }
    $header['title'] = $_user['username'];
    include './flarum/view/user_profile.htm';
}
// 获取用户来路
function user_http_referer()
{
    $referer = param('referer');
Example #7
0
    $class = "ProductionController@";
    Route::get("production/{slug}/play", $class . "getPlay");
    Route::get("production/{slug}/play/{id_chapter}/", $class . "getPlayChapter");
    Route::post("production/ajax/get/video", $class . "ajax_getVideoUrl");
    Route::get("get/source/video/{token}/{id_video}/{time}", $class . "getVideoSource");
    Route::get("production/{slug}/play/{id_chapter}/", $class . "getPlayChapter");
    //Reproductor de video
    // Route::get("media/videoplayer/play/", $class . "videoPlayer");
}
//*****************************************************
//VISITANTES*********************************************
//*****************************************************
Route::group(["namespace" => "Frontend", "middleware" => ["secure.connection"]], function () {
    home_guest();
    productions_guest();
    user_guest();
    persons_guest();
});
function user_guest()
{
    $class = "UserController@";
    Route::post("user/post/create/account", $class . "postCreateAccount");
}
function home_guest()
{
    $class = "HomeController@";
    Route::get("doc/terms", $class . "getTerms");
    Route::get("doc/privacypolicy", $class . "getPrivacyPolicy");
    Route::get("doc/cookies-policy", $class . "getCookiesPolicy");
    Route::get("doc/help", $class . "getHelp");
    Route::get("catalogue", $class . "getCatalogue");