Ejemplo n.º 1
0
 /**
  * Update The Lobby Core (Software)
  */
 public static function software()
 {
     if (\Lobby\Modules::exists("admin")) {
         $admin_previously_installed = true;
     }
     $latest_version = getOption("lobby_latest_version");
     $url = \Lobby\Server::download("lobby", $latest_version);
     $zipFile = L_DIR . "/contents/update/" . $latest_version . ".zip";
     self::zipFile($url, $zipFile);
     // Make the Zip Object
     $zip = new \ZipArchive();
     if ($zip->open($zipFile) != "true") {
         \Lobby::log("Unable to open downloaded Zip File.");
         ser("Error", "Unable to open Zip File.  <a href='update.php'>Try again</a>");
     }
     \Lobby::log("Upgrading Lobby Software From {$zipFile}");
     /**
      * Extract New Version
      */
     $zip->extractTo(L_DIR);
     $zip->close();
     \Lobby\FS::remove($zipFile);
     self::finish_software_update(isset($admin_previously_installed));
     return L_URL . "/admin/about.php?updated=1&oldver={$oldVer}" . \H::csrf("g");
 }
Ejemplo n.º 2
0
 public function remove_slide_action()
 {
     if (!$this->model('slide')->remove_slide($_POST['id'])) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('删除幻灯片失败')));
     }
     H::ajax_json_output(AWS_APP::RSM(null, 1, null));
 }
Ejemplo n.º 3
0
 function binding_callback_action()
 {
     $oauth = new Services_Weibo_WeiboOAuth(get_setting('sina_akey'), get_setting('sina_skey'));
     if ($_GET['uid'] and $this->user_info['permission']['is_administortar']) {
         $user_id = intval($_GET['uid']);
         $user_info = $this->model('account')->get_user_info_by_uid($user_id);
         if (empty($user_info)) {
             H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本地用户不存在,无法绑定')));
         }
         $sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/uid-' . $user_id)));
     } else {
         $user_id = $this->user_id;
         AWS_APP::session()->sina_token = $oauth->getAccessToken('code', array('code' => $_GET['code'], 'redirect_uri' => get_js_url('/account/sina/binding_callback/')));
         $sina_token = AWS_APP::session()->sina_token;
         $redirect = get_js_url('/account/setting/openid/');
     }
     $client = new Services_Weibo_WeiboClient(get_setting('sina_akey'), get_setting('sina_skey'), $sina_token['access_token']);
     $uid_get = $client->get_uid();
     $sina_profile = $client->show_user_by_id($uid_get['uid']);
     if ($sina_profile['error']) {
         H::redirect_msg(AWS_APP::lang()->_t('与微博通信出错, 错误代码: %s', $sina_profile['error']), "/account/setting/openid/");
     }
     if (!$this->model('integral')->fetch_log($user_id, 'BIND_OPENID')) {
         $this->model('integral')->process($user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '绑定 OPEN ID');
     }
     //$this->model('openid_weibo')->bind_account($sina_profile, get_js_url('/account/setting/openid/'), $user_id, $last_key['oauth_token'], $last_key['oauth_token_secret'], $sina_token);
     $this->model('openid_weibo')->bind_account($sina_profile, $redirect, $user_id, $sina_token);
 }
Ejemplo n.º 4
0
 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');
 }
Ejemplo n.º 5
0
 public function _filterWord($data, $htmlspecialchars = true)
 {
     if ($htmlspecialchars) {
         $data = H::htmlspecialchars($data);
     }
     return $data;
 }
Ejemplo n.º 6
0
 public function send_action()
 {
     if (trim($_POST['message']) == '') {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入私信内容')));
     }
     if (!($recipient_user = $this->model('account')->get_user_info_by_username($_POST['recipient']))) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('接收私信的用户不存在')));
     }
     if ($recipient_user['uid'] == $this->user_id) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('不能给自己发私信')));
     }
     if ($recipient_user['inbox_recv']) {
         if (!$this->model('message')->check_permission($recipient_user['uid'], $this->user_id)) {
             H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('对方设置了只有 Ta 关注的人才能给 Ta 发送私信')));
         }
     }
     // !注: 来路检测后面不能再放报错提示
     if (!valid_post_hash($_POST['post_hash'])) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('页面停留时间过长,或内容已提交,请刷新页面')));
     }
     $this->model('message')->send_message($this->user_id, $recipient_user['uid'], $_POST['message']);
     if ($_POST['return_url']) {
         $rsm = array('url' => get_js_url(strip_tags($_POST['return_url'])));
     } else {
         $rsm = array('url' => get_js_url('/inbox/'));
     }
     H::ajax_json_output(AWS_APP::RSM($rsm, 1, null));
 }
Ejemplo n.º 7
0
 public function apply_action()
 {
     $site_name = $_POST['site_name'];
     $site_url = $_POST['site_url'];
     //此处就是控制器(C)指派模型(M)的过程,表示调用models\link.php中的is_exist_url()
     //用于判断该网站地址是否已经存在
     //对提交的参数进行简单的判断
     if ($this->model('link')->is_exist_url1($site_name, $site_url)) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('邮件已发送,请勿重复发送!')));
     }
     if (trim($site_name) == '') {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入客户邮箱!')));
     }
     if (!$this->model('link')->checkEmail($site_name)) {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入正确的邮箱!')));
     }
     if (trim($site_url) == '') {
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('请输入邮件内容!')));
     }
     //表示调用models\link.php中的apply(),将申请数据插入数据库中
     if (!$this->model('link')->apply($site_name, $site_url)) {
         $this->model('link')->sendEmail($site_name, $site_url);
     }
     H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('发送成功,请关闭对话框!')));
 }
Ejemplo n.º 8
0
 public function sign_in_action()
 {
     if ($_GET['uid'] != $this->user_id) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('签到失败!')));
     }
     if ($this->model('sign')->is_signed_today($_GET['uid'])) {
         H::ajax_json_output(AWS_APP::RSM(array('is_signed' => true)), 1, null);
     }
     $continous = $this->model('sign')->sign_in($_GET['uid']);
     $integral_every_day = get_setting('sign_integral_every_day');
     $integral_seventh_day = get_setting('sign_integral_seventh_day');
     // 积分操作
     $is_seventh_day = false;
     if ($continous < 0) {
         H::ajax_json_output(AWS_APP::RSM(array('is_signed' => true)), 1, null);
     } else {
         if ($continous == 6) {
             $integral = $integral_seventh_day;
             $integral_message = '连续7天签到积分';
             $is_seventh_day = true;
         } else {
             $integral = $integral_every_day;
             $integral_message = '每日签到积分';
         }
     }
     $this->model('integral')->process($_GET['uid'], 'SIGN_IN', $integral, $integral_message, $_GET['uid']);
     H::ajax_json_output(AWS_APP::RSM(array('is_signed' => false, 'continous' => $continous, 'integral_every_day' => $integral_every_day, 'integral_seventh_day' => $integral_seventh_day, 'user_integral' => $this->user_info['integral'] + $integral)), 1, null);
 }
Ejemplo n.º 9
0
 public function alipay_action()
 {
     $result = $this->model('payment_alipay')->verifyReturn();
     $order = $this->model('payment')->get_order($_GET['out_trade_no']);
     if ($result and $_GET['total_fee'] == $order['amount']) {
         if ($_GET['extra_common_param']) {
             $params = json_decode(base64_decode(urldecode($_GET['extra_common_param'])), TRUE);
         } else {
             if ($order['extra_param']) {
                 $params = unserialize($order['extra_param']);
             }
         }
         if (!$order['terrace_id']) {
             $this->model('payment')->set_order_terrace_id($_GET['trade_no'], $order['order_id']);
             $this->model('payment')->set_payment_id('ALIPAY', $order['order_id']);
             if ($params['pay_to_project_order_id']) {
                 if (!$this->model('payment')->pay_to_project_order_id($order['order_id'], $params['pay_to_project_order_id'])) {
                     H::redirect_msg('订单处理失败,如有疑问请联系客服人员,网站订单编号:' . $params['pay_to_project_order_id']);
                 }
             }
         }
         if ($params['pay_to_project_order_id']) {
             $this->callback_url = '/project/sponsored/';
         }
         H::redirect_msg('支付成功, 交易金额: ' . $order['amount'], $this->callback_url);
     } else {
         H::redirect_msg('交易失败,如有疑问请联系客服人员,支付宝订单编号:' . $_GET['out_trade_no']);
     }
 }
Ejemplo n.º 10
0
 public function generate_sitemap_action()
 {
     $return_url = '/admin/settings/category-sitemap';
     switch ($this->model('sitemap')->generate_sitemap_all($_GET['reset'])) {
         case sitemap_class::SITEMAP_SUCCESS:
             H::redirect_msg(AWS_APP::lang()->_t('sitemap生成成功,请等待系统自动返回...'), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_EXIST:
             H::redirect_msg(AWS_APP::lang()->_t('错误:sitemap根目录不存在'), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_WRITABLE:
             H::redirect_msg(AWS_APP::lang()->_t('错误:目录%s不可写,请联系后台管理员进行设置', $sitemap_dir), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_EXIST_M:
             H::redirect_msg(AWS_APP::lang()->_t('错误:sitemap根目录(移动版)不存在'), $return_url);
             break;
         case sitemap_class::SITEMAP_DIR_NOT_WRITABLE_M:
             H::redirect_msg(AWS_APP::lang()->_t('错误:目录%s不可写,请联系后台管理员进行设置', $sitemap_dir_m), $return_url);
             break;
         case sitemap_class::SITEMAP_BASE_URL_NULL:
             H::redirect_msg(AWS_APP::lang()->_t('错误:网站根链接不能为空'), $return_url);
             break;
         case sitemap_class::SITEMAP_BASE_URL_NULL_M:
             H::redirect_msg(AWS_APP::lang()->_t('错误:网站根链接(移动版)不能为空'), $return_url);
             break;
         default:
             break;
     }
 }
Ejemplo n.º 11
0
 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');
 }
Ejemplo n.º 12
0
 public function read_action()
 {
     if (!($dialog = $this->model('message')->get_dialog_by_id($_GET['id']))) {
         H::redirect_msg(AWS_APP::lang()->_t('指定的站内信不存在'), '/inbox/');
     }
     if ($dialog['recipient_uid'] != $this->user_id and $dialog['sender_uid'] != $this->user_id) {
         H::redirect_msg(AWS_APP::lang()->_t('指定的站内信不存在'), '/inbox/');
     }
     $this->model('message')->set_message_read($_GET['id'], $this->user_id);
     if ($list = $this->model('message')->get_message_by_dialog_id($_GET['id'])) {
         if ($dialog['sender_uid'] != $this->user_id) {
             $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['sender_uid']);
         } else {
             $recipient_user = $this->model('account')->get_user_info_by_uid($dialog['recipient_uid']);
         }
         foreach ($list as $key => $val) {
             if ($dialog['sender_uid'] == $this->user_id and $val['sender_remove']) {
                 unset($list[$key]);
             } else {
                 if ($dialog['sender_uid'] != $this->user_id and $val['recipient_remove']) {
                     unset($list[$key]);
                 } else {
                     $list[$key]['message'] = FORMAT::parse_links($val['message']);
                     $list[$key]['user_name'] = $recipient_user['user_name'];
                     $list[$key]['url_token'] = $recipient_user['url_token'];
                     $list[$key]['profile_update_time'] = $recipient_user['profile_update_time'];
                 }
             }
         }
     }
     $this->crumb(AWS_APP::lang()->_t('私信对话') . ': ' . $recipient_user['user_name'], '/inbox/read/' . intval($_GET['id']));
     TPL::assign('list', $list);
     TPL::assign('recipient_user', $recipient_user);
     TPL::output('inbox/read');
 }
Ejemplo n.º 13
0
 public function setup()
 {
     if (!$this->user_info['permission']['is_administortar']) {
         H::redirect_msg(AWS_APP::lang()->_t('你没有访问权限, 请重新登录'), '/');
     }
     TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(304));
 }
Ejemplo n.º 14
0
 public function index_action()
 {
     $_GET['per_page'] = $_GET['per_page'] ? intval($_GET['per_page']) : get_setting('contents_per_page');
     $result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['type'], $_GET['page'], $_GET['per_page'], $_GET['topic_ids'], $_GET['is_recommend']);
     if (!$result) {
         $result = array();
     }
     if ($_GET['is_question_id'] and is_digits($_GET['q'])) {
         $question_info = $this->model('question')->get_question_info_by_id($_GET['q']);
         if ($question_info) {
             $result[] = $this->model('search')->prase_result_info($question_info);
         }
     }
     if ($result) {
         $key_arr = array('type', 'search_id', 'name', 'detail');
         foreach ($result as $key => $val) {
             foreach ($val as $k => $v) {
                 if (!in_array($k, $key_arr)) {
                     unset($result[$key][$k]);
                 }
             }
         }
     }
     H::ajax_json_output(AWS_APP::RSM(array('total_rows' => count($result), 'rows' => $result), 1, null));
 }
Ejemplo n.º 15
0
Archivo: HLog.php Proyecto: HWeiXin/wx
 /**
  * 保存日志
  * @return bool
  */
 public function save()
 {
     $content_arr = $this->getSaveContent();
     if (empty($content_arr)) {
         return false;
     }
     $suffix = '.log';
     $path = H::app()->log_path . '/' . date('Y/m/d');
     if ($this->makeDir($path)) {
         foreach ($content_arr as $file_name => $log_arr) {
             $file_arr = glob($path . '/' . $file_name . '*.log');
             $num = count($file_arr);
             if ($num > 0) {
                 $file_path = $file_arr[$num - 1];
                 $file_size = filesize($file_path) / 1024;
                 if ($file_size >= $this->_max_size) {
                     $num++;
                 }
             } else {
                 $num++;
             }
             $file_path = $path . '/' . $file_name . '_' . $num . $suffix;
             //写入方式打开,将文件指针指向文件末尾。如果文件不存在则尝试创建
             $handle = fopen($file_path, 'a');
             if ($handle) {
                 foreach ($log_arr as $content) {
                     fwrite($handle, $content);
                 }
                 fclose($handle);
             }
         }
     }
     $this->_log_arr = array();
     return true;
 }
Ejemplo n.º 16
0
 public function action_email($action, $email, $link, $data = array(), $server = 'master')
 {
     if (!H::valid_email($email)) {
         $user_info = $this->model('account')->get_user_info_by_uid($email);
         if ($user_info['email_settings'][$action] == 'N') {
             return false;
         }
         $email = $user_info['email'];
     }
     if (!$email) {
         return false;
     }
     $email_message = (array) AWS_APP::config()->get('email_message');
     foreach ($email_message[$action] as $key => $val) {
         ${$key} = str_replace('[#user_name#]', $data['user_name'], $val);
         ${$key} = str_replace('[#site_name#]', get_setting('site_name'), ${$key});
         foreach ($data as $k => $v) {
             ${$key} = str_replace('[#' . $k . '#]', $data[$k], ${$key});
         }
     }
     if (in_array($action, array('VALID_EMAIL', 'INVITE_REG', 'FIND_PASSWORD'))) {
         return $this->send($email, $subject, $message, $link, null, $server);
     } else {
         return $this->insert('mail_queue', array('send_to' => $email, 'subject' => $subject, 'message' => $this->get_mail_template($user_info['user_name'], $subject, $message, $link)));
     }
 }
Ejemplo n.º 17
0
 /**
  * Check if the credentials given can be used to establish a
  * connection with the DB server
  */
 public static function checkDatabaseConnection()
 {
     try {
         $db = new \PDO("mysql:dbname=" . self::$database['dbname'] . ";host=" . self::$database['host'] . ";port=" . self::$database['port'], self::$database['username'], self::$database['password'], array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION));
         self::$dbh = $db;
         $notable = false;
         $tables = array("options", "data");
         // The Tables of Lobby
         foreach ($tables as $tableName) {
             $results = self::$dbh->prepare("SHOW TABLES LIKE ?");
             $results->execute(array(self::$database['prefix'] . $tableName));
             if (!$results || $results->rowCount() == 0) {
                 $notable = true;
             }
         }
         if (!$notable) {
             /* There are database tables */
             ser("Error", "Lobby Tables with prefix <b>" . self::$database['prefix'] . "</b> exists. Delete (DROP) those tables and <a href='install.php?step=2" . \H::csrf("g") . "'>try again.</a>");
             return false;
         }
     } catch (\PDOException $Exception) {
         ser("Error", "Unable to connect. Make sure that the settings you entered are correct. <cl/><a href='install.php?step=2'>Try Again</a>");
         return false;
     }
 }
Ejemplo n.º 18
0
 public function rule_action()
 {
     $this->crumb(AWS_APP::lang()->_t('%s 积分规则', get_setting('site_name')));
     if (get_setting('integral_system_enabled') != 'Y') {
         H::redirect_msg(AWS_APP::lang()->_t('本站未启用积分系统'), '/');
     }
     TPL::output('integral/rule');
 }
 public function index_action()
 {
     if ($_POST['mobile_app_secret']) {
         $this->model('myapi')->save_mobile_app_secret(trim($_POST['mobile_app_secret']));
         H::ajax_json_output(AWS_APP::RSM(null, '-1', AWS_APP::lang()->_t('保存设置成功')));
     }
     TPL::output('admin/mobile_app_config');
 }
Ejemplo n.º 20
0
 public function save_order_action()
 {
     if (!$_POST['id']) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请选择订单')));
     }
     $this->model('project')->update_order($_POST['id'], $_POST);
     H::ajax_json_output(AWS_APP::RSM(null, 1, null));
 }
Ejemplo n.º 21
0
 public function index_action()
 {
     if (!$this->user_info['email']) {
         H::redirect_msg(AWS_APP::lang()->_t('当前帐号没有提供 Email, 此功能不可用'));
     }
     $this->crumb(AWS_APP::lang()->_t('邀请好友'), '/invitation/');
     TPL::output('invitation/index');
 }
Ejemplo n.º 22
0
 public function mail_action()
 {
     if ($task = $this->model('edm')->get_task_info($_GET['id'])) {
         echo str_replace('[EMAIL]', '*****@*****.**', $task['message']);
     } else {
         H::redirect_msg(AWS_APP::lang()->_t('您所访问的资源不存在'));
     }
 }
Ejemplo n.º 23
0
 public function search_action()
 {
     if ($result = $this->model('search')->search($_GET['q'], $_GET['type'], 1, $_GET['limit'], $_GET['topic_ids'])) {
         H::ajax_json_output($result);
     } else {
         H::ajax_json_output(array());
     }
 }
Ejemplo n.º 24
0
 public function setup()
 {
     $this->crumb(AWS_APP::lang()->_t('首页精选管理'), "admin/recommend/list/");
     if (!$this->user_info['permission']['is_administortar']) {
         H::redirect_msg(AWS_APP::lang()->_t('你没有访问权限, 请重新登录'), '/');
     }
     TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(603));
 }
Ejemplo n.º 25
0
 function __construct($message)
 {
     if ($_POST['_post_type'] == 'ajax') {
         H::ajax_json_output(AWS_APP::RSM(null, -1, 'SDK 异常: ' . $message));
     } else {
         H::redirect_msg('SDK 异常: ' . $message);
     }
 }
Ejemplo n.º 26
0
 public function index_action()
 {
     if (!$this->user_id) {
         H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('请先登录或注册')));
     }
     $this->per_page = get_setting('contents_per_page');
     if ($_GET['per_page']) {
         $this->per_page = intval($_GET['per_page']);
     }
     //$data = $this->model('myhome')->home_activity($this->user_id, (intval($_GET['page']) * $this->per_page) . ", {$this->per_page}");
     $data = $this->model('actions')->home_activity($this->user_id, intval($_GET['page']) * $this->per_page . ", {$this->per_page}");
     if (!is_array($data)) {
         $data = array();
     } else {
         $data_key = array('history_id', 'associate_action', 'user_info', 'answer_info', 'question_info', 'article_info', 'comment_info', 'add_time');
         $user_info_key = array('uid', 'user_name', 'signature');
         $article_info_key = array('id', 'title', 'message', 'comments', 'views', 'add_time');
         $answer_info_key = array('answer_id', 'answer_content', 'add_time', 'against_count', 'agree_count');
         $question_info_key = array('question_id', 'question_content', 'add_time', 'update_time', 'answer_count', 'agree_count');
         foreach ($data as $key => $val) {
             foreach ($val as $k => $v) {
                 if (!in_array($k, $data_key)) {
                     unset($data[$key][$k]);
                 }
             }
             if ($val['user_info']) {
                 foreach ($val['user_info'] as $k => $v) {
                     if (!in_array($k, $user_info_key)) {
                         unset($data[$key]['user_info'][$k]);
                     }
                 }
                 $data[$key]['user_info']['avatar_file'] = get_avatar_url($data[$key]['user_info']['uid'], 'mid');
             }
             if ($val['article_info']) {
                 foreach ($val['article_info'] as $k => $v) {
                     if (!in_array($k, $article_info_key)) {
                         unset($data[$key]['article_info'][$k]);
                     }
                 }
             }
             if ($val['answer_info']) {
                 foreach ($val['answer_info'] as $k => $v) {
                     if (!in_array($k, $answer_info_key)) {
                         unset($data[$key]['answer_info'][$k]);
                     }
                 }
             }
             if ($val['question_info']) {
                 foreach ($val['question_info'] as $k => $v) {
                     if (!in_array($k, $question_info_key)) {
                         unset($data[$key]['question_info'][$k]);
                     }
                 }
             }
         }
     }
     H::ajax_json_output(AWS_APP::RSM(array('total_rows' => count($data), 'rows' => array_values($data)), 1, null));
 }
Ejemplo n.º 27
0
 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');
 }
Ejemplo n.º 28
0
 public function read_notification_action()
 {
     if (isset($_GET['notification_id'])) {
         $this->model('notify')->read_notification($_GET['notification_id'], $this->user_id);
     } else {
         $this->model('notify')->mark_read_all($this->user_id);
     }
     H::ajax_json_output(AWS_APP::RSM(null, 1, null));
 }
Ejemplo n.º 29
0
 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');
 }
Ejemplo n.º 30
0
 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');
 }