本文整理汇总了PHP中TPL::import_css方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::import_css方法的具体用法?PHP TPL::import_css怎么用?PHP TPL::import_css使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::import_css方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index_action
public function index_action()
{
if ($_GET['id']) {
if (!($question_info = $this->model('question')->get_question_info_by_id($_GET['id']))) {
H::redirect_msg(AWS_APP::lang()->_t('指定问题不存在'));
}
if (!$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator'] and !$this->user_info['permission']['edit_question'] and $question_info['published_uid'] != $this->user_id) {
H::redirect_msg(AWS_APP::lang()->_t('你没有权限编辑这个问题'), '/question/' . $question_info['question_id']);
}
} else {
if (!$this->user_info['permission']['publish_question']) {
H::redirect_msg(AWS_APP::lang()->_t('你所在用户组没有权限发布问题'));
} else {
if ($this->is_post() and $_POST['question_detail']) {
$question_info = array('question_content' => htmlspecialchars($_POST['question_content']), 'question_detail' => htmlspecialchars($_POST['question_detail']), 'category_id' => intval($_POST['category_id']));
} else {
$draft_content = $this->model('draft')->get_data(1, 'question', $this->user_id);
$question_info = array('question_content' => htmlspecialchars($_POST['question_content']), 'question_detail' => htmlspecialchars($draft_content['message']));
}
}
}
if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y' and !$_GET['id']) {
H::redirect_msg(AWS_APP::lang()->_t('你的剩余积分已经不足以进行此操作'));
}
if ($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'] or $question_info['published_uid'] == $this->user_id and $_GET['id'] or !$_GET['id']) {
TPL::assign('attach_access_key', md5($this->user_id . time()));
}
if (!$question_info['category_id']) {
$question_info['category_id'] = $_GET['category_id'] ? intval($_GET['category_id']) : 0;
}
if (get_setting('category_enable') == 'Y') {
TPL::assign('question_category_list', $this->model('system')->build_category_html('question', 0, $question_info['category_id']));
}
if ($modify_reason = $this->model('question')->get_modify_reason()) {
TPL::assign('modify_reason', $modify_reason);
}
TPL::assign('human_valid', human_valid('question_valid_hour'));
TPL::import_js('js/app/publish.js');
TPL::import_js('js/jquery.barrating.min.js');
TPL::import_css('css/publish.css');
TPL::import_js('js/icheck.min.js');
TPL::import_css('css/icheck/square/blue.css');
TPL::import_js('js/quiz.js');
TPL::import_css('css/quiz.css');
if (get_setting('advanced_editor_enable') == 'Y') {
import_editor_static_files();
}
if (get_setting('upload_enable') == 'Y') {
// fileupload
TPL::import_js('js/fileupload.js');
}
// 答题选项
if (intval($question_info['quiz_id']) > 0) {
$question_quiz = $this->model('quiz')->get_question_quiz_info_by_id($question_info['quiz_id']);
TPL::assign('question_quiz', $question_quiz);
}
TPL::assign('question_info', $question_info);
TPL::assign('recent_topics', @unserialize($this->user_info['recent_topics']));
TPL::output('publish/index');
}
示例2: setup
public function setup()
{
HTTP::no_cache_header();
TPL::import_clean();
TPL::import_css(array('mobile/css/icon.css', 'mobile/css/mobile.css'));
TPL::import_js(array('js/jquery.2.js', 'js/jquery.form.js', 'mobile/js/framework.js', 'mobile/js/aws-mobile.js', 'mobile/js/app.js', 'mobile/js/aw-mobile-template.js'));
}
示例3: setup
public function setup()
{
if (get_setting('project_enabled') != 'Y') {
H::redirect_msg(AWS_APP::lang()->_t('活动系统未启用'), '/');
}
$this->crumb(AWS_APP::lang()->_t('活动'), '/project/');
TPL::import_css('css/project.css');
}
示例4: index_action
public function index_action()
{
if (isset($_GET['notification_id'])) {
$this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
}
if (is_mobile()) {
HTTP::redirect('/m/people/' . $_GET['id']);
}
if (is_digits($_GET['id'])) {
if (!($user = $this->model('account')->get_user_info_by_uid($_GET['id'], TRUE))) {
$user = $this->model('account')->get_user_info_by_username($_GET['id'], TRUE);
}
} else {
if ($user = $this->model('account')->get_user_info_by_username($_GET['id'], TRUE)) {
} else {
$user = $this->model('account')->get_user_info_by_url_token($_GET['id'], TRUE);
}
}
if (!$user) {
header('HTTP/1.1 404 Not Found');
H::redirect_msg(AWS_APP::lang()->_t('用户不存在'), '/');
}
if ($user['forbidden'] and !$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
header('HTTP/1.1 404 Not Found');
H::redirect_msg(AWS_APP::lang()->_t('该用户已被封禁'), '/');
}
if (urldecode($user['url_token']) != $_GET['id']) {
HTTP::redirect('/people/' . $user['url_token']);
}
$this->model('people')->update_views($user['uid']);
TPL::assign('user', $user);
$job_info = $this->model('account')->get_jobs_by_id($user['job_id']);
TPL::assign('job_name', $job_info['job_name']);
if ($user['weibo_visit']) {
if ($users_sina = $this->model('openid_weibo_oauth')->get_weibo_user_by_uid($user['uid'])) {
TPL::assign('sina_weibo_url', 'http://www.weibo.com/' . $users_sina['id']);
}
}
TPL::assign('education_experience_list', $this->model('education')->get_education_experience_list($user['uid']));
$jobs_list = $this->model('work')->get_jobs_list();
if ($work_experience_list = $this->model('work')->get_work_experience_list($user['uid'])) {
foreach ($work_experience_list as $key => $val) {
$work_experience_list[$key]['job_name'] = $jobs_list[$val['job_id']];
}
}
TPL::assign('work_experience_list', $work_experience_list);
TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $user['uid']));
$this->crumb(AWS_APP::lang()->_t('%s 的个人主页', $user['user_name']), 'people/' . $user['url_token']);
TPL::import_css('css/user.css');
TPL::assign('reputation_topics', $this->model('people')->get_user_reputation_topic($user['uid'], $user['reputation'], 12));
TPL::assign('fans_list', $this->model('follow')->get_user_fans($user['uid'], 5));
TPL::assign('friends_list', $this->model('follow')->get_user_friends($user['uid'], 5));
TPL::assign('focus_topics', $this->model('topic')->get_focus_topic_list($user['uid'], 10));
TPL::assign('user_actions_questions', $this->model('actions')->get_user_actions($user['uid'], 5, ACTION_LOG::ADD_QUESTION, $this->user_id));
TPL::assign('user_actions_answers', $this->model('actions')->get_user_actions($user['uid'], 5, ACTION_LOG::ANSWER_QUESTION, $this->user_id));
TPL::assign('user_actions', $this->model('actions')->get_user_actions($user['uid'], 5, implode(',', array(ACTION_LOG::ADD_QUESTION, ACTION_LOG::ANSWER_QUESTION, ACTION_LOG::ADD_REQUESTION_FOCUS, ACTION_LOG::ADD_AGREE, ACTION_LOG::ADD_TOPIC, ACTION_LOG::ADD_TOPIC_FOCUS, ACTION_LOG::ADD_ARTICLE)), $this->user_id));
TPL::output('people/index');
}
示例5: login_action
public function login_action()
{
if (!$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator']) {
H::redirect_msg(AWS_APP::lang()->_t('你没有访问权限, 请重新登录'), '/');
} else {
if (AWS_APP::session()->admin_login) {
HTTP::redirect('/admin/');
}
}
TPL::import_css('admin/css/login.css');
TPL::output('admin/login');
}
示例6: qq_login_callback_action
public function qq_login_callback_action()
{
if ($this->is_post() and AWS_APP::session()->qq_profile and AWS_APP::session()->QQConnect) {
if (get_setting('register_type') == 'close') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站目前关闭注册')));
} else {
if (get_setting('register_type') == 'invite') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过邀请注册')));
} else {
if (get_setting('register_type') == 'weixin') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过微信注册')));
}
}
}
if (trim($_POST['user_name']) == '') {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, AWS_APP::lang()->_t('请输入真实姓名')));
} else {
if ($this->model('account')->check_username($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, AWS_APP::lang()->_t('真实姓名已经存在')));
} else {
if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, $check_rs));
} else {
if ($this->model('account')->check_username_sensitive_words($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, AWS_APP::lang()->_t('真实姓名中包含敏感词或系统保留字')));
}
}
}
}
if ($this->model('account')->check_email($_POST['email'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'email'), -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确')));
}
if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'userPassword'), -1, AWS_APP::lang()->_t('密码长度不符合规则')));
}
if (!$_POST['agreement_chk']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用户协议才能继续')));
}
if (get_setting('ucenter_enabled') == 'Y') {
$result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email'], true);
if (is_array($result)) {
$uid = $result['user_info']['uid'];
} else {
H::ajax_json_output(AWS_APP::RSM(null, -1, $result));
}
} else {
$uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']);
if (get_setting('register_valid_type') == 'email') {
$this->model('active')->new_valid_email($uid);
}
if (get_setting('register_valid_type') != 'approval') {
$this->model('active')->active_user_by_uid($uid);
}
}
if ($uid) {
$this->model('openid_qq')->bind_account(AWS_APP::session()->qq_profile, null, $uid, true);
if (AWS_APP::session()->qq_profile['figureurl_2']) {
$this->model('account')->associate_remote_avatar($uid, AWS_APP::session()->qq_profile['figureurl_2']);
}
H::ajax_json_output(AWS_APP::RSM(null, 1, null));
} else {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('与 QQ 通信出错 (Register), 请重新登录')));
}
} else {
if (!$_GET['code']) {
H::redirect_msg(AWS_APP::lang()->_t('与 QQ 通信出错, 请重新登录'), "/account/login/");
}
if (!AWS_APP::session()->QQConnect['access_token']) {
if (!$this->model('openid_qq')->request_access_token(get_js_url('/account/openid/qq_login_callback/'))) {
H::redirect_msg(AWS_APP::lang()->_t('与 QQ 通信出错, 请重新登录'), "/account/login/");
}
}
if (!AWS_APP::session()->QQConnect['access_token'] or !($uinfo = $this->model('openid_qq')->request_user_info())) {
H::redirect_msg(AWS_APP::lang()->_t('与 QQ 通信出错, 请重新登录'), "/account/login/");
}
AWS_APP::session()->qq_profile = $uinfo;
if ($qq_user = $this->model('openid_qq')->get_user_info_by_open_id(load_class('Services_Tencent_QQConnect_V2')->get_openid())) {
$user_info = $this->model('account')->get_user_info_by_uid($qq_user['uid']);
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], false));
$this->model('openid_qq')->update_token($qq_user['name'], AWS_APP::session()->QQConnect['access_token']);
HTTP::redirect('/');
} else {
if ($this->user_id) {
$this->model('openid_qq')->bind_account($this->model('openid_qq')->request_user_info(), '/', $this->user_id);
} else {
if (get_setting('register_type') == 'close') {
H::redirect_msg(AWS_APP::lang()->_t('本站目前关闭注册'));
} else {
if (get_setting('register_type') == 'invite') {
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过邀请注册'));
} else {
$this->crumb(AWS_APP::lang()->_t('完善资料'), '/account/login/');
TPL::assign('user_name', str_replace(' ', '_', AWS_APP::session()->qq_profile['nickname']));
TPL::import_css('css/register.css');
TPL::output('account/openid/callback');
}
}
}
}
}
//.........这里部分代码省略.........
示例7: index_action
//.........这里部分代码省略.........
$answer['user_rated_uninterested'] = $answer_users_rated_uninterested[$answer['answer_id']];
$answer['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($answer['answer_content']))));
$answer['agree_users'] = $answer_agree_users[$answer['answer_id']];
$answer['agree_status'] = $answer_vote_status[$answer['answer_id']];
if ($question_info['best_answer'] == $answer['answer_id'] and intval($_GET['page']) < 2) {
$answers[0] = $answer;
} else {
$answers[] = $answer;
}
}
if (!$answers[0]) {
unset($answers[0]);
}
if (get_setting('answer_unique') == 'Y') {
if ($this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id)) {
TPL::assign('user_answered', 1);
} else {
TPL::assign('user_answered', 0);
}
}
TPL::assign('answers', $answers);
TPL::assign('answer_count', $answer_count);
}
if ($this->user_id) {
TPL::assign('question_thanks', $this->model('question')->get_question_thanks($question_info['question_id'], $this->user_id));
TPL::assign('invite_users', $this->model('question')->get_invite_users($question_info['question_id']));
TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $question_info['published_uid']));
if ($this->user_info['draft_count'] > 0) {
TPL::assign('draft_content', $this->model('draft')->get_data($question_info['question_id'], 'answer', $this->user_id));
}
}
$question_info['question_detail'] = FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($question_info['question_detail'])));
TPL::assign('question_info', $question_info);
TPL::assign('question_focus', $this->model('question')->has_focus_question($question_info['question_id'], $this->user_id));
$question_topics = $this->model('topic')->get_topics_by_item_id($question_info['question_id'], 'question');
if (sizeof($question_topics) == 0 and $this->user_id) {
$related_topics = $this->model('question')->get_related_topics($question_info['question_content']);
TPL::assign('related_topics', $related_topics);
}
TPL::assign('question_topics', $question_topics);
TPL::assign('question_related_list', $this->model('question')->get_related_question_list($question_info['question_id'], $question_info['question_content']));
TPL::assign('question_related_links', $this->model('related')->get_related_links('question', $question_info['question_id']));
if ($this->user_id) {
if ($question_topics) {
foreach ($question_topics as $key => $val) {
$question_topic_ids[] = $val['topic_id'];
}
}
if ($helpful_users = $this->model('topic')->get_helpful_users_by_topic_ids($question_topic_ids, 17)) {
foreach ($helpful_users as $key => $val) {
if ($val['user_info']['uid'] == $this->user_id) {
unset($helpful_users[$key]);
} else {
$helpful_users[$key]['has_invite'] = $this->model('question')->has_question_invite($question_info['question_id'], $val['user_info']['uid'], $this->user_id);
$helpful_users[$key]['experience'] = end($helpful_users[$key]['experience']);
}
}
TPL::assign('helpful_users', $helpful_users);
}
}
$this->crumb($question_info['question_content'], '/question/' . $question_info['question_id']);
if ($_GET['column'] == 'log') {
$this->crumb(AWS_APP::lang()->_t('日志'), '/question/id-' . $question_info['question_id'] . '__column-log');
} else {
TPL::assign('human_valid', human_valid('answer_valid_hour'));
if ($this->user_id) {
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/question/id-' . $question_info['question_id'] . '__sort_key-' . $_GET['sort_key'] . '__sort-' . $_GET['sort'] . '__uid-' . $_GET['uid']), 'total_rows' => $answer_count, 'per_page' => 100))->create_links());
}
}
TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($question_info['question_content'])));
TPL::set_meta('description', $question_info['question_content'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($question_info['question_detail'])), 0, 128, 'UTF-8', '...'));
if (get_setting('advanced_editor_enable') == 'Y') {
import_editor_static_files();
}
if (get_setting('upload_enable') == 'Y') {
// fileupload
TPL::import_js('js/fileupload.js');
}
TPL::assign('attach_access_key', md5($this->user_id . time()));
TPL::assign('redirect_message', $redirect_message);
$recommend_posts = $this->model('posts')->get_recommend_posts_by_topic_ids($question_topic_ids);
if ($recommend_posts) {
foreach ($recommend_posts as $key => $value) {
if ($value['question_id'] and $value['question_id'] == $question_info['question_id']) {
unset($recommend_posts[$key]);
break;
}
}
TPL::assign('recommend_posts', $recommend_posts);
}
// 答题选项
if (intval($question_info['quiz_id']) > 0) {
$question_quiz = $this->model('quiz')->get_question_quiz_info_by_id($question_info['quiz_id']);
TPL::import_js('js/quiz.js');
TPL::import_css('css/quiz.css');
TPL::import_js('js/app/question.js');
TPL::assign('question_quiz', $question_quiz);
}
TPL::output('question/index');
}
示例8: __construct
public function __construct()
{
parent::__construct(false);
if ($_GET['app'] != 'admin') {
return false;
}
TPL::import_clean();
if (defined('SYSTEM_LANG')) {
TPL::import_js(base_url() . '/language/' . SYSTEM_LANG . '.js');
}
if (HTTP::is_browser('ie', 8)) {
TPL::import_js('js/jquery.js');
} else {
TPL::import_js('js/jquery.2.js');
}
TPL::import_js(array('admin/js/aws_admin.js', 'admin/js/aws_admin_template.js', 'js/jquery.form.js', 'admin/js/framework.js', 'admin/js/global.js'));
TPL::import_css(array('admin/css/common.css'));
if (in_array($_GET['act'], array('login', 'login_process'))) {
return true;
}
if ($admin_info = H::decode_hash(AWS_APP::session()->admin_login)) {
if ($admin_info['uid'] != $this->user_id or $admin_info['UA'] != $_SERVER['HTTP_USER_AGENT'] or !AWS_APP::session()->permission['is_administortar'] and !AWS_APP::session()->permission['is_moderator']) {
unset(AWS_APP::session()->admin_login);
if ($_POST['_post_type'] == 'ajax') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('会话超时, 请重新登录')));
} else {
H::redirect_msg(AWS_APP::lang()->_t('会话超时, 请重新登录'), '/admin/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
}
} else {
if ($_POST['_post_type'] == 'ajax') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('会话超时, 请重新登录')));
} else {
HTTP::redirect('/admin/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
}
$this->setup();
}
示例9: bind_action
public function bind_action()
{
if (AWS_APP::session()->weibo_user) {
$weibo_user_info = AWS_APP::session()->weibo_user;
unset(AWS_APP::session()->weibo_user);
}
if ($_GET['error'] == 'access_denied') {
H::redirect_msg(AWS_APP::lang()->_t('授权失败'), '/account/login/');
}
if ($this->user_id) {
$weibo_user = $this->model('openid_weibo_oauth')->get_weibo_user_by_uid($this->user_id);
if ($weibo_user) {
H::redirect_msg(AWS_APP::lang()->_t('此账号已绑定微博账号'), '/account/login/');
}
}
$callback_url = '/account/openid/weibo/bind/';
if ($_GET['return_url']) {
$callback_url .= 'return_url-' . $_GET['return_url'];
}
if ($_GET['code']) {
if ($_GET['code'] != $weibo_user_info['authorization_code']) {
$this->model('openid_weibo_oauth')->authorization_code = $_GET['code'];
$this->model('openid_weibo_oauth')->redirect_url = $callback_url;
if (!$this->model('openid_weibo_oauth')->oauth2_login()) {
H::redirect_msg($this->model('openid_weibo_oauth')->error_msg, '/account/login/');
}
$weibo_user_info = $this->model('openid_weibo_oauth')->user_info;
}
if (!$weibo_user_info) {
H::redirect_msg(AWS_APP::lang()->_t('微博登录失败,用户信息不存在'), '/account/login/');
}
$weibo_user = $this->model('openid_weibo_oauth')->get_weibo_user_by_id($weibo_user_info['id']);
if ($this->user_id) {
if ($weibo_user) {
H::redirect_msg(AWS_APP::lang()->_t('此微博账号已被绑定'), '/account/login/');
}
$this->model('openid_weibo_oauth')->bind_account($weibo_user_info, $this->user_id);
if (!$this->model('integral')->fetch_log($this->user_id, 'BIND_OPENID')) {
$this->model('integral')->process($this->user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '绑定 OPEN ID');
}
HTTP::redirect('/account/setting/openid/');
} else {
if ($weibo_user) {
$user = $this->model('account')->get_user_info_by_uid($weibo_user['uid']);
if (!$user) {
$this->model('openid_weibo_oauth')->unbind_account($weibo_user['uid']);
H::redirect_msg(AWS_APP::lang()->_t('本地用户不存在'), '/account/login/');
}
$this->model('openid_weibo_oauth')->update_user_info($weibo_user['id'], $weibo_user_info);
if (get_setting('register_valid_type') == 'approval' and $user['group_id'] == 3) {
$redirect_url = '/account/valid_approval/';
} else {
if ($_GET['state']) {
$state = base64_url_decode($_GET['state']);
}
if (get_setting('ucenter_enabled') == 'Y') {
$redirect_url = '/account/sync_login/';
if ($state['return_url']) {
$redirect_url .= 'url-' . base64_encode($state['return_url']);
}
} else {
if ($state['return_url']) {
$redirect_url = $state['return_url'];
} else {
$redirect_url = '/';
}
}
HTTP::set_cookie('_user_login', get_login_cookie_hash($user['user_name'], $user['password'], $user['salt'], $user['uid'], false));
if (get_setting('register_valid_type') == 'email' and !$user['valid_email']) {
AWS_APP::session()->valid_email = $user['email'];
}
}
HTTP::redirect($redirect_url);
} else {
switch (get_setting('register_type')) {
case 'close':
H::redirect_msg(AWS_APP::lang()->_t('本站目前关闭注册'), '/account/login/');
break;
case 'invite':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过邀请注册'), '/account/login/');
break;
case 'weixin':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过微信注册'), '/account/login/');
break;
}
AWS_APP::session()->weibo_user = $weibo_user_info;
$this->crumb(AWS_APP::lang()->_t('完善资料'), '/account/login/');
TPL::assign('register_url', 'account/ajax/weibo/register/');
$user_name = str_replace('-', '', AWS_APP::session()->weibo_user['screen_name']);
while ($this->model('account')->check_username($user_name) || !$this->model('account')->is_valid_username($user_name) || $this->model('account')->check_username_sensitive_words($user_name)) {
$user_name = $this->model('account')->random_username();
}
TPL::assign('user_name', $user_name);
TPL::assign('sns_type', 'weibo');
TPL::import_css('css/register.css');
TPL::output('account/openid/callback');
}
}
} else {
$state = $_GET['return_url'] ? base64_url_encode(array('return_url' => base64_decode($_GET['return_url']))) : null;
//.........这里部分代码省略.........
示例10: setup
public function setup()
{
if ($_GET['ignore_ua_check'] == 'FALSE') {
HTTP::set_cookie('_ignore_ua_check', 'FALSE');
}
if (!is_mobile()) {
switch ($_GET['act']) {
default:
HTTP::redirect('/');
break;
case 'home':
HTTP::redirect('/home/');
break;
case 'login':
HTTP::redirect('/account/login/');
break;
case 'question':
HTTP::redirect('/question/' . $_GET['id']);
break;
case 'register':
HTTP::redirect('/account/register/');
break;
case 'topic':
HTTP::redirect('/topic/' . $_GET['id']);
break;
case 'people':
HTTP::redirect('/people/' . $_GET['id']);
break;
case 'article':
HTTP::redirect('/article/' . $_GET['id']);
break;
}
}
if (!$this->user_id and !$this->user_info['permission']['visit_site'] and $_GET['act'] != 'login' and $_GET['act'] != 'register') {
HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
switch ($_GET['act']) {
default:
if (!$this->user_id) {
HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
break;
case 'index':
case 'explore':
case 'login':
case 'question':
case 'register':
case 'topic':
case 'search':
case 'people':
case 'article':
case 'find_password':
case 'find_password_success':
case 'find_password_modify':
// Public page..
break;
}
TPL::import_clean();
TPL::import_css(array('mobile/css/mobile.css'));
TPL::import_js(array('js/jquery.2.js', 'js/jquery.form.js', 'mobile/js/framework.js', 'mobile/js/aws-mobile.js', 'mobile/js/app.js', 'mobile/js/aw-mobile-template.js'));
}
示例11: index_action
//.........这里部分代码省略.........
}
TPL::assign('exclude_uids', $exclude_uids);
$recommend_users = $this->model('question')->get_recommend_users_by_category_id($question_info['category_id'], $exclude_uids, get_setting('user_question_invite_recommend'));
if ($recommend_users) {
$uids = null;
foreach ($recommend_users as $key => $val) {
$uids[] = $val['uid'];
}
$users_info = $this->model('account')->get_user_info_by_uids($uids, true);
foreach ($recommend_users as $key => $val) {
$recommend_users[$key]['user_info'] = $users_info[$val['uid']];
}
}
TPL::assign('recommend_users', $recommend_users);
TPL::assign('invited_user_count', $this->model('question')->get_invited_user_count($question_info['question_id']));
// if ($this->user_id)
// {
// if ($question_topics)
// {
// foreach ($question_topics AS $key => $val)
// {
// $question_topic_ids[] = $val['topic_id'];
// }
// }
// if ($recommend_users = $this->model('topic')->get_recommend_users_by_topic_ids($question_topic_ids, 17))
// {
// foreach ($recommend_users AS $key => $val)
// {
// if ($val['user_info']['uid'] == $this->user_id)
// {
// unset($recommend_users[$key]);
// }
// else
// {
// $recommend_users[$key]['has_invite'] = $this->model('question')->has_question_invite($question_info['question_id'], $val['user_info']['uid'], $this->user_id);
// $recommend_users[$key]['experience'] = end($recommend_users[$key]['experience']);
// }
// }
// TPL::assign('recommend_users', $recommend_users);
// }
// }
$this->crumb($question_info['question_content'], '/question/' . $question_info['question_id']);
if ($_GET['column'] == 'log') {
// $this->crumb(AWS_APP::lang()->_t('日志'), '/question/id-' . $question_info['question_id'] . '__column-log');
} else {
TPL::assign('human_valid', human_valid('answer_valid_hour'));
if ($this->user_id) {
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/question/id-' . $question_info['question_id'] . '__sort_key-' . $_GET['sort_key'] . '__sort-' . $_GET['sort'] . '__uid-' . $_GET['uid']), 'total_rows' => $answer_count, 'per_page' => 100))->create_links());
}
}
TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($question_info['question_content'])));
TPL::set_meta('description', $question_info['question_content'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($question_info['question_detail'])), 0, 128, 'UTF-8', '...'));
if (get_setting('advanced_editor_enable') == 'Y') {
import_editor_static_files();
}
if (get_setting('upload_enable') == 'Y') {
// fileupload
TPL::import_js('js/fileupload.js');
}
TPL::assign('redirect_message', $redirect_message);
$recommend_posts = $this->model('posts')->get_recommend_posts_by_topic_ids($question_topic_ids);
if ($recommend_posts) {
foreach ($recommend_posts as $key => $value) {
if ($value['question_id'] and $value['question_id'] == $question_info['question_id']) {
unset($recommend_posts[$key]);
break;
}
}
TPL::assign('recommend_posts', $recommend_posts);
}
// 是否进行出题成功提示
if ($this->user_id == $question_info['published_uid'] and $question_info['is_first']) {
TPL::assign('is_first_visited', true);
TPL::assign('publish_integral', get_setting('integral_system_config_new_question'));
TPL::assign('user_integral', $this->user_info['integral']);
$this->model('question')->set_is_first_visited($question_info['question_id'], 0);
}
// 答题动态信息
$question_quiz_record = $this->model('quiz')->get_question_quiz_record_list_page($question_info['question_id'], 1, 5);
TPL::assign('question_quiz_record', $question_quiz_record);
// // 添加题目解析提示提示
// if($this->user_id == $question_info['published_uid'] AND !$question_info['solution_id'])
// {
// TPL::assign('show_add_solution_hint', true);
// }
// 获取上一道题目和下一道题目的信息
// $question_info_next = $this->model('question')->get_next_question_info($question_info['question_id']);
// $question_info_previous = $this->model('question')->get_previous_question_info($question_info['question_id']);
// TPL::assign('question_info_next', $question_info_next);
// TPL::assign('question_info_previous', $question_info_previous);
TPL::import_js('js/app/question.js');
TPL::import_js('js/bootstrap-growl.min.js');
TPL::import_js('js/quiz.js');
TPL::import_css('css/quiz.css');
TPL::import_js('js/sweetalert.min.js');
TPL::import_css('css/sweetalert.css');
TPL::import_js('js/jquery-qrcode.min.js');
TPL::import_js('js/share.js');
TPL::output('question/index');
}
示例12: setup
public function setup()
{
$this->crumb(AWS_APP::lang()->_t('找回密码'), '/account/find_password/');
TPL::import_css('css/register.css');
}
示例13: setup
public function setup()
{
if ($_GET['ignore_ua_check'] == 'FALSE') {
HTTP::set_cookie('_ignore_ua_check', 'FALSE');
}
if (!is_mobile()) {
switch ($_GET['act']) {
default:
HTTP::redirect('/');
break;
case 'home':
HTTP::redirect('/home/');
break;
case 'login':
HTTP::redirect('/account/login/');
break;
case 'question':
HTTP::redirect('/question/' . $_GET['id']);
break;
case 'register':
HTTP::redirect('/account/register/');
break;
case 'topic':
HTTP::redirect('/topic/' . $_GET['id']);
break;
case 'people':
HTTP::redirect('/people/' . $_GET['id']);
break;
case 'article':
HTTP::redirect('/article/' . $_GET['id']);
break;
}
}
if (!$this->user_id and !$this->user_info['permission']['visit_site'] and $_GET['act'] != 'login' and $_GET['act'] != 'register') {
HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
switch ($_GET['act']) {
default:
if (!$this->user_id) {
HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
}
break;
case 'index':
case 'explore':
case 'login':
case 'question':
case 'register':
case 'topic':
case 'search':
case 'people':
case 'article':
case 'find_password':
case 'find_password_success':
case 'find_password_modify':
// Public page..
break;
}
TPL::import_clean();
TPL::import_css(array('mobile/css/mobile.css'));
TPL::import_js(array('js/jquery.2.js', 'js/jquery.form.js', 'mobile/js/framework.js', 'mobile/js/aws-mobile.js', 'mobile/js/app.js', 'mobile/js/aw-mobile-template.js'));
if (in_weixin()) {
$noncestr = mt_rand(1000000000, 9999999999.0);
TPL::assign('weixin_noncestr', $noncestr);
$jsapi_ticket = $this->model('openid_weixin_weixin')->get_jsapi_ticket($this->model('openid_weixin_weixin')->get_access_token(get_setting('weixin_app_id'), get_setting('weixin_app_secret')));
$url = ($_SERVER['HTTPS'] and !in_array(strtolower($_SERVER['HTTPS']), array('off', 'no'))) ? 'https' : 'http';
$url .= '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
TPL::assign('weixin_signature', $this->model('openid_weixin_weixin')->generate_jsapi_ticket_signature($jsapi_ticket, $noncestr, TIMESTAMP, $url));
}
}
示例14: bind_action
public function bind_action()
{
if (AWS_APP::session()->twitter_request_token) {
$twitter_request_token = AWS_APP::session()->twitter_request_token;
unset(AWS_APP::session()->twitter_request_token);
}
if (AWS_APP::session()->twitter_user) {
$twitter_user_info = AWS_APP::session()->twitter_user;
unset(AWS_APP::session()->twitter_user);
}
if ($_GET['denied']) {
H::redirect_msg(AWS_APP::lang()->_t('授权失败'), '/account/login/');
}
if ($this->user_id) {
$twitter_user = $this->model('openid_twitter')->get_twitter_user_by_uid($this->user_id);
if ($twitter_user) {
H::redirect_msg(AWS_APP::lang()->_t('此账号已绑定 Twitter 账号'), '/account/login/');
}
}
if ($_GET['oauth_token']) {
if (!$twitter_user_info) {
if ($_GET['oauth_token'] != $twitter_request_token['oauth_token']) {
H::redirect_msg(AWS_APP::lang()->_t('oauth token 不一致'), '/account/login/');
}
if (!$_GET['oauth_verifier']) {
H::redirect_msg(AWS_APP::lang()->_t('oauth verifier 为空'), '/account/login/');
}
$this->model('openid_twitter')->request_token = $twitter_request_token;
$this->model('openid_twitter')->request_token['oauth_verifier'] = $_GET['oauth_verifier'];
if (!$this->model('openid_twitter')->get_user_info()) {
H::redirect_msg($this->model('openid_twitter')->error_msg, '/account/login/');
}
$twitter_user_info = $this->model('openid_twitter')->user_info;
}
if (!$twitter_user_info) {
H::redirect_msg(AWS_APP::lang()->_t('Twitter 登录失败,用户信息不存在'), '/account/login/');
}
$twitter_user = $this->model('openid_twitter')->get_twitter_user_by_id($twitter_user_info['id']);
if ($this->user_id) {
if ($twitter_user) {
H::redirect_msg(AWS_APP::lang()->_t('此 Twitter 账号已被绑定'), '/account/login/');
}
$this->model('openid_twitter')->bind_account($twitter_user_info, $this->user_id);
if (!$this->model('integral')->fetch_log($this->user_id, 'BIND_OPENID')) {
$this->model('integral')->process($this->user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '绑定 OPEN ID');
}
HTTP::redirect('/account/setting/openid/');
} else {
if ($twitter_user) {
$user = $this->model('account')->get_user_info_by_uid($twitter_user['uid']);
if (!$user) {
$this->model('openid_twitter')->unbind_account($twitter_user['uid']);
H::redirect_msg(AWS_APP::lang()->_t('本地用户不存在'), '/account/login/');
}
$this->model('openid_twitter')->update_user_info($twitter_user['id'], $twitter_user_info);
if (get_setting('register_valid_type') == 'approval' and $user['group_id'] == 3) {
$redirect_url = '/account/valid_approval/';
} else {
if (get_setting('ucenter_enabled') == 'Y') {
$redirect_url = '/account/sync_login/';
if ($_GET['return_url']) {
$redirect_url .= 'url-' . $_GET['return_url'];
}
} else {
if ($state['return_url']) {
$redirect_url = $state['return_url'];
} else {
$redirect_url = '/';
}
}
HTTP::set_cookie('_user_login', get_login_cookie_hash($user['user_name'], $user['password'], $user['salt'], $user['uid'], false));
if (get_setting('register_valid_type') == 'email' and !$user['valid_email']) {
AWS_APP::session()->valid_email = $user['email'];
}
}
HTTP::redirect($redirect_url);
} else {
switch (get_setting('register_type')) {
case 'close':
H::redirect_msg(AWS_APP::lang()->_t('本站目前关闭注册'), '/account/login/');
break;
case 'invite':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过邀请注册'), '/account/login/');
break;
case 'weixin':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过微信注册'), '/account/login/');
break;
}
AWS_APP::session()->twitter_user = $twitter_user_info;
$this->crumb(AWS_APP::lang()->_t('完善资料'), '/account/login/');
TPL::assign('register_url', '/account/ajax/twitter/register/');
TPL::assign('user_name', AWS_APP::session()->twitter_user['name']);
TPL::import_css('css/register.css');
TPL::output('account/openid/callback');
}
}
} else {
$this->model('openid_twitter')->oauth_callback = '/account/openid/twitter/bind/';
if ($_GET['return_url']) {
$this->model('openid_twitter')->oauth_callback .= 'return_url-' . $_GET['return_url'];
//.........这里部分代码省略.........
示例15: valid_approval_action
public function valid_approval_action()
{
if ($this->user_id and $this->user_info['group_id'] != 3) {
HTTP::redirect('/');
}
TPL::import_css('css/register.css');
TPL::output('account/valid_approval');
}