public function list_action() { if ($this->is_post()) { foreach ($_POST as $key => $val) { if ($key == 'start_date' or $key == 'end_date') { $val = base64_encode($val); } if ($key == 'keyword' or $key == 'user_name') { $val = rawurlencode($val); } $param[] = $key . '-' . $val; } H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url('/admin/article/list/' . implode('__', $param))), 1, null)); } $where = array(); if ($_GET['keyword']) { $where[] = "(`title` LIKE '%" . $this->model('article')->quote($_GET['keyword']) . "%')"; } if ($_GET['start_date']) { $where[] = 'add_time >= ' . strtotime(base64_decode($_GET['start_date'])); } if ($_GET['end_date']) { $where[] = 'add_time <= ' . strtotime('+1 day', strtotime(base64_decode($_GET['end_date']))); } if ($_GET['user_name']) { $user_info = $this->model('account')->get_user_info_by_username($_GET['user_name']); $where[] = 'uid = ' . intval($user_info['uid']); } if ($_GET['comment_count_min']) { $where[] = 'comments >= ' . intval($_GET['comment_count_min']); } if ($_GET['answer_count_max']) { $where[] = 'comments <= ' . intval($_GET['comment_count_max']); } if ($articles_list = $this->model('article')->fetch_page('article', implode(' AND ', $where), 'id DESC', $_GET['page'], $this->per_page)) { $search_articles_total = $this->model('article')->found_rows(); } if ($articles_list) { foreach ($articles_list as $key => $val) { $articles_list_uids[$val['uid']] = $val['uid']; } if ($articles_list_uids) { $articles_list_user_infos = $this->model('account')->get_user_info_by_uids($articles_list_uids); } foreach ($articles_list as $key => $val) { $articles_list[$key]['user_info'] = $articles_list_user_infos[$val['uid']]; } } $url_param = array(); foreach ($_GET as $key => $val) { if (!in_array($key, array('app', 'c', 'act', 'page'))) { $url_param[] = $key . '-' . $val; } } TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/admin/article/list/') . implode('__', $url_param), 'total_rows' => $search_articles_total, 'per_page' => $this->per_page))->create_links()); $this->crumb(AWS_APP::lang()->_t('文章管理'), 'admin/article/list/'); TPL::assign('articles_count', $search_articles_total); TPL::assign('list', $articles_list); TPL::output('admin/article/list'); }
public function index_action() { if ($_GET['tag']) { $this->crumb(AWS_APP::lang()->_t('标签') . ': ' . $_GET['tag'], '/favorite/tag-' . $_GET['tag']); } //边栏可能感兴趣的人或话题 if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'favorite/index')) { $recommend_users_topics = $this->model('module')->recommend_users_topics($this->user_id); TPL::assign('sidebar_recommend_users_topics', $recommend_users_topics); } if ($action_list = $this->model('favorite')->get_item_list($_GET['tag'], $this->user_id, calc_page_limit($_GET['page'], get_setting('contents_per_page')))) { foreach ($action_list as $key => $val) { $item_ids[] = $val['item_id']; } TPL::assign('list', $action_list); } else { if (!$_GET['page'] or $_GET['page'] == 1) { $this->model('favorite')->remove_favorite_tag(null, null, $_GET['tag'], $this->user_id); } } if ($item_ids) { $favorite_items_tags = $this->model('favorite')->get_favorite_items_tags_by_item_id($this->user_id, $item_ids); TPL::assign('favorite_items_tags', $favorite_items_tags); } TPL::assign('favorite_tags', $this->model('favorite')->get_favorite_tags($this->user_id)); TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/favorite/tag-' . $_GET['tag']), 'total_rows' => $this->model('favorite')->count_favorite_items($this->user_id, $_GET['tag']), 'per_page' => get_setting('contents_per_page')))->create_links()); TPL::output('favorite/index'); }
/** * */ public function index_action() { $mpa = $this->getMpaccount(); if ($mpa->asparent === 'Y') { $params = array(); $params['mpaccount'] = $mpa; \TPL::assign('params', $params); $this->view_action('/mp/user/send/parentmp'); } else { /** * 是否开通了支持发送消息的接口 */ $mpaccount = $this->getMpaccount(); $apis = $this->model('mp\\mpaccount')->getApis($mpaccount->mpid); $canWxGroup = $mpaccount->mpsrc === 'wx' && ($apis->wx_group_push === 'Y' && $apis->wx_fansgroup === 'Y'); $canYxGroup = $mpaccount->mpsrc === 'yx' && ($apis->yx_group_push === 'Y' && $apis->yx_fansgroup === 'Y'); $canMember = $apis->mpsrc === 'qy' || $apis->mpsrc === 'yx' && $apis->yx_p2p === 'Y'; $canSend = $canWxGroup || $canYxGroup || $canMember; if ($canSend) { $this->view_action('/mp/user/send/main'); } else { $this->view_action('/mp/user/send/unsupport'); } } }
public function index_action() { if (!$this->user_id) { HTTP::redirect('/explore/'); } if (!$this->user_info['email']) { HTTP::redirect('/account/complete_profile/'); } // 边栏可能感兴趣的人或话题 if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'home/index')) { $recommend_users_topics = $this->model('module')->recommend_users_topics($this->user_id); TPL::assign('sidebar_recommend_users_topics', $recommend_users_topics); } // 边栏热门用户 if (TPL::is_output('block/sidebar_hot_users.tpl.htm', 'home/index')) { $sidebar_hot_users = $this->model('module')->sidebar_hot_users($this->user_id); TPL::assign('sidebar_hot_users', $sidebar_hot_users); } $this->crumb(AWS_APP::lang()->_t('动态'), '/home/'); TPL::import_js('js/app/index.js'); if ($_GET['first_login']) { TPL::import_js('js/ajaxupload.js'); } TPL::output('home/index'); }
public function service_group_list_action() { $this->crumb(AWS_APP::lang()->_t('客服组管理'), 'admin/ticket/service_group_list/'); TPL::assign('groups_list', $this->model('account')->get_user_group_list(2, 2)); TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(403)); TPL::output('admin/ticket/service_group_list'); }
public function list_action() { if ($_GET['feature_id']) { $topic_ids = $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']); } else { $topic_ids = explode(',', $_GET['topic_id']); } if ($_GET['per_page']) { $per_page = intval($_GET['per_page']); } else { $per_page = get_setting('contents_per_page'); } if ($_GET['sort_type'] == 'hot') { $posts_list = $this->model('posts')->get_hot_posts($_GET['post_type'], $_GET['category'], $topic_ids, $_GET['day'], $_GET['page'], $per_page); } else { $posts_list = $this->model('posts')->get_posts_list($_GET['post_type'], $_GET['page'], $per_page, $_GET['sort_type'], $topic_ids, $_GET['category'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']); } if (!is_mobile() and $posts_list) { foreach ($posts_list as $key => $val) { if ($val['answer_count']) { $posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']); } } } TPL::assign('posts_list', $posts_list); if (is_mobile()) { TPL::output('m/ajax/explore_list'); } else { TPL::output('explore/ajax/list'); } }
public function index_action() { if (is_digits($_GET['id'])) { $feature_info = $this->model('feature')->get_feature_by_id($_GET['id']); } else { $feature_info = $this->model('feature')->get_feature_by_url_token($_GET['id']); } if (!$feature_info) { header('HTTP/1.1 404 Not Found'); H::redirect_msg(AWS_APP::lang()->_t('专题不存在'), '/'); } if (!$feature_info['enabled']) { H::redirect_msg(AWS_APP::lang()->_t('专题未启用'), '/'); } if ($feature_info['url_token'] != $_GET['id'] and !$_GET['sort_type'] and !$_GET['is_recommend']) { HTTP::redirect('/feature/' . $feature_info['url_token']); } if (!($topic_list = $this->model('topic')->get_topics_by_ids($this->model('feature')->get_topics_by_feature_id($feature_info['id'])))) { H::redirect_msg(AWS_APP::lang()->_t('专题下必须包含一个以上话题'), '/'); } if ($feature_info['seo_title']) { TPL::assign('page_title', $feature_info['seo_title']); } else { $this->crumb($feature_info['title'], '/feature/' . $feature_info['url_token']); } TPL::assign('sidebar_hot_topics', $topic_list); TPL::assign('feature_info', $feature_info); TPL::import_js('js/app/feature.js'); TPL::output('feature/detail'); }
/** * 设置页面参数 */ public function view_action($path) { $features = $this->model('mp\\mpaccount')->getFeatures($this->mpid); \TPL::assign('can_member_card', $features->can_member_card); \TPL::assign('can_member_checkin', $features->can_member_checkin); parent::view_action($path); }
/** * */ public function index_action($id = null) { if ($id) { $c = $this->model('app\\contribute')->byId($id); /** * belong to channel */ $c->channels = $this->model('matter\\channel')->byMatter($id, 'contribute'); /** * 参与人 */ $c->initiator = $this->model('app\\contribute')->userAcls($this->mpid, $id, 'I'); $c->reviewer = $this->model('app\\contribute')->userAcls($this->mpid, $id, 'R'); $c->typesetter = $this->model('app\\contribute')->userAcls($this->mpid, $id, 'T'); /** * return */ $channels = \TMS_APP::model('matter\\channel')->byMpid($this->mpid); $params = array('mpid' => $this->mpid, 'app' => $c, 'channels' => $channels); \TPL::assign('params', $params); $this->view_action('/mp/app/contribute/edit'); } else { $this->view_action('/mp/app/contribute'); } }
/** * 仅附件处理中的preg_replace_callback()的每次搜索时的回调 * @param array $matches preg_replace_callback()搜索时返回给第二参数的结果 * @return string 取出附件的加载模板字符串 */ function parse_attachs_callback($matches) { if ($attach = AWS_APP::model('publish')->get_attach_by_id($matches[1])) { TPL::assign('attach', $attach); return TPL::output('question/ajax/load_attach', false); } }
/** * 走马灯抽奖页面 */ public function index_action($aid) { $app = $this->model('app\\enroll')->byId($aid); \TPL::assign('enroll', $app); \TPL::output('/op/enroll/lottery'); exit; }
public function search_result_action() { if (!in_array($_GET['search_type'], array('questions', 'topics', 'users', 'articles'))) { $_GET['search_type'] = null; } $search_result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['search_type'], $_GET['page'], get_setting('contents_per_page'), null, $_GET['is_recommend']); if ($this->user_id and $search_result) { foreach ($search_result as $key => $val) { switch ($val['type']) { case 'questions': $search_result[$key]['focus'] = $this->model('question')->has_focus_question($val['search_id'], $this->user_id); break; case 'topics': $search_result[$key]['focus'] = $this->model('topic')->has_focus_topic($this->user_id, $val['search_id']); break; case 'users': $search_result[$key]['focus'] = $this->model('follow')->user_follow_check($this->user_id, $val['search_id']); break; } } } TPL::assign('search_result', $search_result); if (is_mobile()) { TPL::output('m/ajax/search_result'); } else { TPL::output('search/ajax/search_result'); } }
/** * 返回页面 */ public function afterOAuth($mpid, $page, $openid) { $page = $this->model('app\\merchant\\page')->byId($page); \TPL::assign('title', $page->title); \TPL::output('/app/merchant/shelf'); exit; }
/** * */ public function index_action($aid, $page) { $options = array('cascaded' => 'N'); $app = $this->model('app\\enroll')->byId($aid, $options); \TPL::assign('title', $app->title); \TPL::output('/op/enroll/page'); exit; }
public static function redirect_msg($message, $url = NULL, $interval = 5) { TPL::assign('message', $message); TPL::assign('url_bit', HTTP::parse_redirect_url($url)); TPL::assign('interval', $interval); TPL::output('global/show_message'); die; }
public function get_mail_template($user_name, $subject, $message, $link = null, $link_title = null) { TPL::assign('user_name', $user_name); TPL::assign('subject', $subject); TPL::assign('message', $message); TPL::assign('link', $link); TPL::assign('link_title', $link_title); return TPL::output('global/email_template', false); }
public function edit_action() { $this->crumb(AWS_APP::lang()->_t('编辑页面'), "admin/page/edit/"); if (!($page_info = $this->model('page')->get_page_by_url_id($_GET['id']))) { H::redirect_msg(AWS_APP::lang()->_t('页面不存在'), '/admin/page/'); } TPL::assign('page_info', $page_info); TPL::output('admin/page/publish'); }
public function edit_action() { if (!($category_info = $this->model('system')->get_category_info($_GET['category_id']))) { H::redirect_msg(AWS_APP::lang()->_t('指定分类不存在'), '/admin/category/list/'); } TPL::assign('category', $category_info); TPL::assign('category_option', $this->model('system')->build_category_html($category_info['type'], 0, $category['parent_id'], null, false)); TPL::output('admin/category/edit'); }
public function search_result_action() { if (!in_array($_GET['search_type'], array('questions', 'topics', 'users', 'articles'))) { $_GET['search_type'] = null; } $search_result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['search_type'], $_GET['page'], get_setting('contents_per_page'), null, $_GET['is_recommend']); if ($search_result) { foreach ($search_result as $key => $val) { switch ($val['type']) { case 'questions': $search_result_questions[] = $this->model('question')->get_question_info_by_id($val['search_id']); break; case 'topics': $search_result_topics[] = $this->model('topic')->get_topic_by_id($val['search_id']); break; case 'users': $search_result_users[] = $this->model('account')->get_user_info_by_uid($val['search_id']); break; default: $search_result_articles[] = $this->model('article')->get_article_info_by_id($val['search_id']); } } } // 问题缩略图 foreach ($search_result_questions as $key => $value) { if ($value['has_attach']) { $value['attachs'] = $this->model('publish')->get_attach('question', $value['question_id'], 'min'); } $search_result_questions[$key] = $value; } // 专题关注 foreach ($search_result_topics as $key => $value) { $search_result_topics[$key]['has_focus'] = $this->model('topic')->has_focus_topic($this->user_id, $value['topic_id']); } // 文章缩略图 foreach ($search_result_articles as $key => $value) { if ($value['has_attach']) { $value['attachs'] = $this->model('publish')->get_attach('article', $value['id'], 'min'); } $search_result_articles[$key] = $value; } // 用户关注 foreach ($search_result_users as $key => $value) { $search_result_users[$key]['follow_check'] = $this->model('follow')->user_follow_check($this->user_id, $value['uid']); } TPL::assign('search_result_questions', $search_result_questions); TPL::assign('search_result_users', $search_result_users); TPL::assign('search_result_topics', $search_result_topics); TPL::assign('search_result_articles', $search_result_articles); TPL::assign('search_result', $search_result); if (is_mobile()) { TPL::output('m/ajax/search_result'); } else { TPL::output('search/ajax/search_result'); } }
/** * 信息墙大屏幕页面 * * $mpid * $wall * */ public function index_action($mpid, $wall) { $model = $this->model('app\\wall'); $w = $model->byId($wall, 'title'); \TPL::assign('title', $w->title); $params = array(); \TPL::assign('params', $params); \TPL::output('/op/wall/page'); exit; }
public function list_action() { if ($recommend_homepage_list = $this->model('recommend')->fetch_page('recommend_homepage', 'id > 0', ' add_time DESC', $_GET['page'], $this->per_page)) { $total_rows = $this->model('recommend')->found_rows(); foreach ($recommend_homepage_list as $key => $val) { switch ($val['item_type']) { case 'question': $val['item_tag'] = '问题(精选)'; $val['item_link'] = 'question/' . $val['item_id']; $question_info = $this->model('question')->get_question_info_by_id($val['item_id']); if ($question_info) { $val['item_title'] = $question_info['question_content']; } else { $val['item_title'] = '问题 #' . $val['item_id']; } break; case 'article': $val['item_tag'] = '文章(精选)'; $val['item_link'] = 'article/' . $val['item_id']; $article_info = $this->model('article')->get_article_info_by_id($val['item_id']); if ($article_info) { $val['item_title'] = $article_info['title']; } else { $val['item_title'] = '文章 #' . $val['item_id']; } break; case 'topic': $val['item_tag'] = '专题(精选)'; $val['item_link'] = 'topic/' . $val['item_id']; $topic_info = $this->model('topic')->get_topic_by_id($val['item_id']); if ($topic_info) { $val['item_title'] = $topic_info['topic_title']; } else { $val['item_title'] = '专题 #' . $val['item_id']; } break; case 'top_question': $val['item_tag'] = '问题(置顶)'; $val['item_link'] = 'question/' . $val['item_id']; $question_info = $this->model('question')->get_question_info_by_id($val['item_id']); if ($question_info) { $val['item_title'] = $question_info['question_content']; } else { $val['item_title'] = '问题 #' . $val['item_id']; } break; } $recommend_homepage_list[$key] = $val; } } TPL::assign('recommend_homepage_list', $recommend_homepage_list); TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/admin/recommend/list/') . implode('__', $url_param), 'total_rows' => $total_rows, 'per_page' => $this->per_page))->create_links()); $this->crumb(AWS_APP::lang()->_t('首页精选管理'), 'admin/recommend/list/'); TPL::output('admin/recommend/list'); }
public function edit_action() { if ($_GET['id']) { $slide_info = $this->model('slide')->get_slide_by_id($_GET['id']); if (!$slide_info) { H::redirect_msg(AWS_APP::lang()->_t('指定幻灯片不存在'), '/admin/slide/list/'); } TPL::assign('slide_info', $slide_info); } TPL::output('admin/slide/edit'); }
public function index_action() { if ($order_list = $this->model('project')->get_sponsored_order_list($_GET['id'], $this->user_id, $_GET['page'], get_setting('contents_per_page'))) { TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/project/sponsored/' . $_GET['id']), 'total_rows' => $this->model('project')->found_rows(), 'per_page' => get_setting('contents_per_page')))->create_links()); foreach ($order_list as $key => $val) { $order_list[$key]['order_status'] = $this->model('project')->get_order_status($val); } } TPL::assign('order_list', $order_list); TPL::output('project/sponsored/index'); }
public function list_action() { if ($log = $this->model('integral')->fetch_all('integral_log', 'uid = ' . $this->user_id, 'time DESC', intval($_GET['page']) * 10 . ', ' . $this->per_page)) { foreach ($log as $key => $val) { $parse_items[$val['id']] = array('item_id' => $val['item_id'], 'action' => $val['action']); } TPL::assign('log', $log); TPL::assign('log_detail', $this->model('integral')->parse_log_item($parse_items)); } TPL::output('integral/ajax/list'); }
/** * 进入发起订单页 * * 要求当前用户必须是关注用户 * * @param string $mpid mpid'id * @param int $product * @param int $sku * */ public function index_action($mpid, $shop, $mocker = null, $code = null) { /** * 获得当前访问用户 */ $openid = $this->doAuth($mpid, $code, $mocker); $options = array('fields' => 'title', 'cascaded' => 'N'); $page = $this->model('app\\merchant\\page')->byType('cart', $shop, 0, 0, $options); $page = $page[0]; \TPL::assign('title', $page->title); \TPL::output('/app/merchant/cart'); exit; }
public function nav_menu_action() { $this->crumb(AWS_APP::lang()->_t('导航设置'), 'admin/nav_menu/'); if (!$this->user_info['permission']['is_administortar']) { H::redirect_msg(AWS_APP::lang()->_t('你没有访问权限, 请重新登录'), '/'); } TPL::assign('nav_menu_list', $this->model('menu')->get_nav_menu_list()); TPL::assign('category_list', $this->model('system')->build_category_html('question', 0, 0, null, true)); TPL::assign('setting', get_setting()); TPL::import_js(array('js/fileupload.js')); TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(307)); TPL::output('admin/nav_menu'); }
/** * */ public function __construct() { parent::__construct(); $mpa = $this->model('mp\\mpaccount')->byId($this->mpid); $prights = $this->model('mp\\permission')->hasMpRight($this->mpid, array('reply_text', 'reply_menu', 'reply_qrcode', 'reply_other'), 'read'); $entries = array(); (true === $prights || $prights['reply_text']['read_p'] === 'Y') && ($entries['text'] = array('title' => '文本消息')); (true === $prights || $prights['reply_menu']['read_p'] === 'Y') && ($entries['menu'] = array('title' => '菜单事件')); $mpa->asparent === 'N' && (true === $prights || $prights['reply_qrcode']['read_p'] === 'Y') && ($entries['qrcode'] = array('title' => '扫二维码')); (true === $prights || $prights['reply_other']['read_p'] === 'Y') && ($entries['other'] = array('title' => '其他事件')); $entries['timer'] = array('title' => '定时推送'); \TPL::assign('reply_view_entries', $entries); }
public function index_action() { if ($_POST['q']) { HTTP::redirect('/search/q-' . base64_encode($_POST['q'])); } $keyword = htmlspecialchars(base64_decode($_GET['q'])); $this->crumb($keyword, '/search/q-' . urlencode($keyword)); if (!$keyword) { HTTP::redirect('/'); } TPL::assign('keyword', $keyword); TPL::assign('split_keyword', implode(' ', $this->model('system')->analysis_keyword($keyword))); TPL::output('search/index'); }
/** * 进入商品展示页 * * @param string $mpid mpid'id * @param int $shop shop'id * @param int $catelog * @param int $product * * @return */ public function index_action($mpid, $shop, $catelog, $product, $mocker = null, $code = null) { //$openid = $this->doAuth($mpid, $code, $mocker); $options = array('fields' => 'title', 'cascaded' => 'N'); $page = $this->model('app\\merchant\\page')->byType('product', $shop, $catelog, 0, $options); if (empty($page)) { $this->outputError('指定的页面不存在'); } else { $page = $page[0]; \TPL::assign('title', $page->title); \TPL::output('/app/merchant/product'); exit; } }
public function edit_action() { $this->crumb(AWS_APP::lang()->_t('编辑专题'), "admin/feature/list/"); if ($topics_list = $this->model('topic')->get_topics_by_ids($this->model('feature')->get_topics_by_feature_id($_GET['feature_id']))) { foreach ($topics_list as $key => $val) { $feature_topics[] = $val['topic_title']; } if ($feature_topics) { TPL::assign('feature_topics', implode("\n", $feature_topics)); } } TPL::assign('feature', $this->model('feature')->get_feature_by_id($_GET['feature_id'])); TPL::output('admin/feature/edit'); }