Example #1
0
 /**
  */
 public function logout()
 {
     if ($access_token = $this->input['access_token']) {
         $data['access_token'] = $access_token;
     } else {
         $this->errorOutput(NO_ACCESS_TOKEN);
     }
     $Members = new members();
     $device_token = $Members->check_device_token(trim($this->input['device_token']));
     $udid = $Members->check_udid(trim($this->input['uuid']));
     if ($device_token === 0) {
         $this->errorOutput(ERROR_DEVICE_TOKEN);
     }
     if ($udid === 0) {
         $this->errorOutput(ERROR_UDID);
     }
     $auth = new auth();
     $logoutInfo = $auth->logout($data);
     //会员痕迹
     $member_trace_data = array('member_id' => $logoutInfo['user_id'], 'member_name' => $logoutInfo['user_name'], 'content_id' => $logoutInfo['user_id'], 'title' => $logoutInfo['user_name'], 'type' => 'logout', 'op_type' => '退出', 'appid' => $logoutInfo['appid'], 'appname' => $logoutInfo['display_name'], 'create_time' => TIMENOW, 'ip' => hg_getip(), 'device_token' => $device_token, 'udid' => $udid);
     $mMember = new member();
     $mMember->member_trace_create($member_trace_data);
     $_logoutInfo = array('member_id' => $logoutInfo['user_id'], 'member_name' => $logoutInfo['user_name'], 'is_member' => $logoutInfo['is_member'], 'logout' => $logoutInfo['logout']);
     $this->addItem($_logoutInfo);
     $this->output();
 }
Example #2
0
 public function checkbind()
 {
     try {
         $platform_id = $this->input['platform_id'];
         $type = $this->input['type'];
         $identifierUserSystem = new identifierUserSystem();
         $identifier = $identifierUserSystem->setIdentifier((int) $this->input['identifier'])->checkIdentifier();
         //多用户系统
         $check_Bind = new check_Bind();
         $member_id = $check_Bind->bind_to_memberid($platform_id, $type, true, $identifier);
         $is_bind = $check_Bind->check_bind($member_id, $type, 0);
         if ($is_bind) {
             $Members = new members();
             $is_bind = array_merge($is_bind, $Members->get_member_info(' AND member_id = ' . $member_id, 'member_name,type'));
         }
         if (is_array($is_bind)) {
             foreach ($is_bind as $k => $v) {
                 $this->addItem_withkey($k, $v);
             }
         } else {
             $this->addItem_withkey('is_bind', $is_bind);
         }
         $this->output();
     } catch (Exception $e) {
         $this->errorOutput($e->getMessage(), $e->getCode());
     }
 }
Example #3
0
 public function setMemberId($_memberId, $isMust = 1)
 {
     $Members = new members();
     if ($_memberId) {
         $this->memberId = $_memberId ? (int) $_memberId : 0;
         if (!$Members->checkuser($this->memberId)) {
             throw new Exception(NO_MEMBER, 200);
         }
     } elseif ($isMust) {
         throw new Exception(NO_MEMBER_ID, 200);
     }
 }
Example #4
0
 public function overdueproceess()
 {
     $time = 2100;
     //过期时间
     $db = new Core();
     /**
      * 查询与订单号相关的商品,订单中相关信息如积分等
      */
     $query = "SELECT \n    \t          g.*,\n    \t          o.order_id as new_order_id,\n    \t          o.pay_credits as pay_credits,\n    \t          o.user_id as user_id,\n    \t\t      o.integral_status as integral_status\n    \t          FROM " . DB_PREFIX . "goodslist g\n                  LEFT JOIN " . DB_PREFIX . "order o\n                  ON g.order_id=o.id\n                  WHERE o.pay_status = 1 \n                  and o.create_time<" . (time() - $time) . " limit 0,100";
     $goodses = $db->query($query);
     if (!$goodses) {
         return;
     }
     $ids = array();
     $newgoodses = array();
     foreach ($goodses as $goods) {
         $newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['id'] = $goods['goods_id'];
         $newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['goods_number'] += $goods['goods_number'];
         $newgoodses[$goods['bundle_id']]['goods'][$goods['goods_id']]['bundle_id'] = $goods['bundle_id'];
         $ids[] = $goods['order_id'];
         $credits[$goods['user_id']]['id'] = $goods['order_id'];
         $credits[$goods['user_id']]['order_id'] = $goods['new_order_id'];
         $credits[$goods['user_id']]['credit'] = $goods['pay_credits'];
         $credits[$goods['user_id']]['integral_status'] = $goods['integral_status'];
         //积分的状态
     }
     $this->BundleGoods = $newgoodses;
     foreach ($newgoodses as $bundle_id => $bundlegoodses) {
         $curl = $bundle_id . "curl";
         $this->{$curl} = $this->create_curl_obj($bundle_id);
         $this->init_curl($bundle_id);
         //$Re_Minus_updateStores = $this -> opBundle('updateStore', array('operation' => 'plus'));
     }
     $Re_Minus_updateStores = $this->opBundle('updateStore', array('operation' => 'plus'));
     $orderids = implode(",", $ids);
     if (!$orderids) {
         return false;
     }
     require_once CUR_CONF_PATH . 'lib/sms.class.php';
     require_once ROOT_PATH . 'lib/class/members.class.php';
     $members = new members();
     foreach ($credits as $user => $v) {
         if (!$v['credit']) {
             continue;
         }
         $re = $members->return_credit($user, $v['credit'], $v['order_id'], 'payments', 'OrderUpdate', 'cancle', '订单:' . $v['order_id'] . '被系统取消:' . $v['title'], $v['integral_status'], '取消订单');
         if (!$re['logid']) {
             return false;
         }
     }
     $query = "UPDATE " . DB_PREFIX . "order \n                  SET order_status=24,pay_status=3,is_completed=23\n                  WHERE pay_status=1 and id in(" . $orderids . ")";
     $result = $db->query_update($query);
 }
Example #5
0
 public function update()
 {
     /**权限**/
     $this->verify_content_prms(array('_action' => 'manage'));
     /*******/
     if (!isset($this->input['id']) || !$this->input['id']) {
         $this->errorOutput("NO_ORDER_ID");
     }
     $id = (int) $this->input['id'];
     if (!isset($this->input['tracestep'])) {
         $this->errorOutput("NO_TRACE_STEP");
     }
     $tracestep = (int) $this->input['tracestep'];
     if (!array_key_exists($tracestep, $this->delivery_tracing_conf)) {
         $this->errorOutput("NO_TRACE_STEP_ILLEGAL");
     }
     $this->get_orderinfo($id);
     if ($this->Order['delivery_tracing'] > $tracestep && !$this->settings['is_back']) {
         $this->errorOutput("NO_TRACE_STEP_ERROR");
     }
     //
     if ($tracestep == 10 && $this->Order['integral_status']) {
         require_once ROOT_PATH . 'lib/class/members.class.php';
         //echo json_encode($order[0]);exit();
         $members = new members();
         if ($this->Order['pay_credits']) {
             $re = $members->finalFrozenCredit($this->Order['user_id'], $this->Order['order_id'], 'payments', 'OrderUpdate', $this->Order['pay_credits'], $this->Order['integral_status']);
         }
     }
     $params['ip'] = hg_getip();
     $params['user_id'] = $this->user['user_id'];
     $params['user_name'] = $this->user['user_name'];
     $params['create_time'] = TIMENOW;
     $params['update_time'] = TIMENOW;
     $params['order_id'] = $this->Order['id'];
     $params['order_code'] = $this->Order['order_id'];
     $params['tracestep'] = $tracestep;
     $params['longitude'] = $this->input['longitude'];
     $params['latitude'] = $this->input['latitude'];
     $params['id'] = $this->obj->insert('delivery_trace', $params);
     $up_info = array('delivery_tracing' => $tracestep);
     if ($tracestep == 4) {
         $express_name = $this->input['express_name'];
         $express_no = $this->input['express_no'];
         $up_info['express_name'] = $express_name;
         $up_info['express_no'] = $express_no;
     }
     $this->obj->update('order', $up_info, " where id={$id} ");
     $this->addItem($params);
     $this->output();
 }
Example #6
0
 /**
  *
  * 获取需要的条件
  */
 private function get_condition()
 {
     $Members = new members();
     if ($this->user['user_id'] || $this->input['member_id']) {
         $this->member_id = $this->input['member_id'] ? intval($this->input['member_id']) : ($this->user['user_id'] ? $this->user['user_id'] : 0);
         if (!$Members->checkuser($this->member_id)) {
             $this->errorOutput(NO_MEMBER);
         }
     } elseif (!$this->member_id) {
         $this->errorOutput(NO_MEMBER_ID);
     }
     if ($this->input['mark']) {
         $this->mark = trim($this->input['mark']);
         $memberMySet = new memberMySet();
         if (!$memberMySet->count(array('mark' => $this->mark))) {
             $this->errorOutput(MARK_ERROR);
         }
     } else {
         $this->errorOutput(NO_MARK_ERROR);
     }
     if ($this->input['total']) {
         $this->total = trim($this->input['total']);
         if (!is_numeric($this->total)) {
             $this->errorOutput(TOTAL_ERROR);
         }
         $this->total = (int) $this->total;
     }
     if ($this->input['math']) {
         if (intval($this->input['math']) == 1) {
             $this->math[total] = '+';
         } elseif (intval($this->input['math']) == 2) {
             $this->math[total] = '-';
         }
     }
     if ($this->input['totalsum']) {
         $this->totalsum = trim($this->input['totalsum']);
         if (!is_numeric($this->totalsum)) {
             $this->errorOutput(TOTAL_ERROR);
         }
         $this->totalsum = (int) $this->totalsum;
     }
     if (intval($this->input['summath']) == 1) {
         $this->math[totalsum] = '+';
     } elseif (intval($this->input['summath']) == 2) {
         $this->math[totalsum] = '-';
     }
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load database
     $this->db = new Database();
     $this->session = Session::instance();
     if (!$this->auth->logged_in('login')) {
         url::redirect('login');
     }
     // Check if user has the right to see the user dashboard
     if (!$this->auth->has_permission('member_ui')) {
         // This user isn't allowed in the admin panel
         url::redirect('/');
     }
     // Themes Helper
     $this->themes = new Themes();
     $this->themes->admin = TRUE;
     // Set Table Prefix
     $this->table_prefix = Kohana::config('database.default.table_prefix');
     $this->template->admin_name = $this->user->name;
     // Retrieve Default Settings
     $this->template->site_name = Kohana::config('settings.site_name');
     $this->themes->api_url = Kohana::config('settings.api_url');
     // Javascript Header
     $this->themes->map_enabled = FALSE;
     $this->themes->flot_enabled = FALSE;
     $this->themes->treeview_enabled = FALSE;
     $this->themes->protochart_enabled = FALSE;
     $this->themes->colorpicker_enabled = FALSE;
     $this->themes->editor_enabled = FALSE;
     $this->themes->tablerowsort_enabled = FALSE;
     $this->themes->autocomplete_enabled = FALSE;
     $this->themes->json2_enabled = FALSE;
     $this->themes->js = '';
     $this->template->form_error = FALSE;
     // Initialize some variables for raphael impact charts
     $this->themes->raphael_enabled = FALSE;
     $this->themes->impact_json = '';
     // Generate main tab navigation list.
     $this->template->main_tabs = members::main_tabs();
     $this->template->this_page = "";
     // Header Nav
     $header_nav = new View('header_nav');
     $this->template->header_nav = $header_nav;
     $this->template->header_nav->loggedin_user = FALSE;
     if (isset(Auth::instance()->get_user()->id)) {
         // Load User
         $this->template->header_nav->loggedin_role = Auth::instance()->get_user()->dashboard();
         $this->template->header_nav->loggedin_user = Auth::instance()->get_user();
     }
     $this->template->header_nav->site_name = Kohana::config('settings.site_name');
     Event::add('ushahidi_filter.view_pre_render.members_layout', array($this, '_pre_render'));
 }
Example #8
0
 public function View($id)
 {
     global $db;
     $db->select('EventsComments', array('CommentID' => $id), $limit = false, $order = false, $where_mode = "AND", $print_query = false, $What = "*", $innerJoin = "");
     if (!$db->error) {
         $result = $db->row_array();
         members::View($result['memberID']);
     }
 }
Example #9
0
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load database
     $this->db = new Database();
     $this->session = Session::instance();
     if (!$this->auth->logged_in('login') or !$this->auth->logged_in('member')) {
         url::redirect('login');
     }
     // Set Table Prefix
     $this->table_prefix = Kohana::config('database.default.table_prefix');
     // Get Session Information
     $this->user = new User_Model($_SESSION['auth_user']->id);
     $this->template->admin_name = $this->user->name;
     // Retrieve Default Settings
     $this->template->site_name = Kohana::config('settings.site_name');
     $this->template->api_url = Kohana::config('settings.api_url');
     // Javascript Header
     $this->template->map_enabled = FALSE;
     $this->template->flot_enabled = FALSE;
     $this->template->treeview_enabled = FALSE;
     $this->template->protochart_enabled = FALSE;
     $this->template->colorpicker_enabled = FALSE;
     $this->template->editor_enabled = FALSE;
     $this->template->tablerowsort_enabled = FALSE;
     $this->template->autocomplete_enabled = FALSE;
     $this->template->json2_enabled = FALSE;
     $this->template->js = '';
     $this->template->form_error = FALSE;
     // Initialize some variables for raphael impact charts
     $this->template->raphael_enabled = FALSE;
     $this->template->impact_json = '';
     // Generate main tab navigation list.
     $this->template->main_tabs = members::main_tabs();
     $this->template->this_page = "";
     // Load profiler
     // $profiler = new Profiler;
     // Header Nav
     $header_nav = new View('header_nav');
     $this->template->header_nav = $header_nav;
     $this->template->header_nav->loggedin_user = FALSE;
     if (isset(Auth::instance()->get_user()->id)) {
         // Load User
         $this->template->header_nav->loggedin_role = Auth::instance()->logged_in('member') ? "members" : "admin";
         $this->template->header_nav->loggedin_user = Auth::instance()->get_user();
     }
     $this->template->header_nav->site_name = Kohana::config('settings.site_name');
 }
Example #10
0
 /**
  * 
  * 获取还未自定义积分规则的应用标识和名称 ...
  */
 public function getNotSetApp()
 {
     if ($this->input[id]) {
         $this->addItem(array());
         $this->output();
     }
     $appInfo = $this->CreditRulesDiy->getApp();
     $Members = new members();
     $creditRules = new creditrules();
     $appid = array();
     if ($appInfo && is_array($appInfo)) {
         $appid = array_keys($appInfo);
         $appDiyRule = $Members->getDiyRulesInfo($appid, true);
         $diyRule = $creditRules->getDiyRules();
         $diyRuleKey = array();
         if (is_array($diyRule)) {
             $diyRuleKey = array_keys($diyRule);
         }
         foreach ($appDiyRule as $k => $v) {
             $noSetRuleKey = array();
             if (is_array($v)) {
                 $setRuleKey = array_keys($v);
                 $noSetRuleKey = array_diff($diyRuleKey, $setRuleKey);
             }
             if (empty($noSetRuleKey)) {
                 unset($appInfo[$k]);
             }
         }
         foreach ($appInfo as $k => $v) {
             $this->addItem_withkey($k, $v);
         }
     } else {
         $this->addItem($appid);
     }
     $this->output();
 }
Example #11
0
 public function MemberSshow($condition = '')
 {
     $member_id = array();
     $info = $this->show($condition);
     $info && is_array($info) && ($member_id = array_keys($info));
     $memberInfo = members::get_member_name($member_id);
     foreach ($info as $uid => $credits) {
         if ($member_name = $memberInfo[$uid]) {
             $info[$uid]['member_name'] = (string) $member_name;
         } else {
             $info[$uid]['u_id'] = 0;
             $info[$uid]['member_name'] = '用户不存在或已被删除';
         }
     }
     return $info;
 }
Example #12
0
 /**
  * 投票接口
  * @param $id int 投票ID
  * @param $option_id string 选项id (1,2,3)
  * @param $verify_code string 验证码
  * @param $other_title string 用户提交过来的其他选项
  * 
  */
 public function vote_add()
 {
     $id = intval($this->input['id']);
     $option_id = trim($this->input['option_id']);
     $verify_code = trim($this->input['verify_code']);
     $other_title = trim($this->input['other_title']);
     $ip = hg_getip();
     $appid = intval($this->user['appid']);
     $appname = $this->user['display_name'];
     $user_id = intval($this->user['user_id']);
     $verifycode = trim($this->input['verify_code']);
     $session_id = trim($this->input['session_id']);
     $device_token = trim($this->input['device_token']);
     $uuid = $this->input['uuid'];
     if (!$id) {
         $this->errorOutput('NO_ID');
     }
     if (!$option_id) {
         $this->errorOutput('NO_OPTION_ID');
     }
     //取投票数据
     $vote = $this->mVote->get_vote_by_id($id);
     $vote = $vote[0];
     if (empty($vote)) {
         $this->errorOutput('该投票不存在或删除');
     }
     //审核状态
     if (!$vote['status']) {
         $this->errorOutput('该投票未审核');
     }
     //开启状态
     if (!$vote['is_open']) {
         $this->errorOutput('该投票已关闭');
     }
     //有效期验证
     if ($vote['end_time'] && strtotime($vote['end_time']) < TIMENOW) {
         $this->errorOutput('该投票已过期');
     }
     //有效期验证
     if ($vote['start_time'] && strtotime($vote['start_time']) > TIMENOW) {
         $this->errorOutput('该投票未开始');
     }
     //选项数目
     $option_ids = explode(',', $option_id);
     $option_count = count(array_filter($option_ids));
     //单选
     if ($vote['option_type'] == 1 && $option_count != 1) {
         $this->errorOutput('只能选择一个选项');
     }
     //多选
     if ($vote['option_type'] == 2) {
         if ($option_count > $vote['max_option'] && $vote['max_option']) {
             $this->errorOutput('投票选项已超过' . $vote['max_option'] . '个');
         }
         if ($option_count < $vote['min_option']) {
             $this->errorOutput('投票选项不能少于' . $vote['min_option'] . '个');
         }
     }
     //验证码
     if ($this->settings['App_verifycode'] && $vote['is_verify_code']) {
         $is_dipartite = $vote['is_verify_dipartite'] ? $vote['is_verify_dipartite'] : 0;
         //验证码是否区分大小写
         $check_result = $this->mVerifyCode->check_verify_code($verifycode, $session_id, $is_dipartite);
         //验证验证码
         if ($check_result != 'SUCCESS') {
             $this->errorOutput($check_result);
         }
     }
     //用户登陆
     if ($vote['is_user_login'] && $user_id <= 0) {
         $this->errorOutput('会员未登录');
     }
     if (defined("RESERVED_IP_LIMIT") && RESERVED_IP_LIMIT) {
         if (is_reserverd_ip($ip)) {
             $this->errorOutput(RESERVED_IP_NOT_ALLOWED);
         }
     }
     //同一用户投票时间限制
     if ($vote['is_userid']) {
         $user_toff = $vote['userid_limit_time'] * 3600;
         $user_time = TIMENOW - $user_toff;
         $sql = "SELECT  count(vote_question_id) as total  FROM " . DB_PREFIX . "question_person ";
         $sql .= " WHERE vote_question_id = " . $id . " AND user_id = " . $user_id;
         if ($vote['userid_limit_time']) {
             $sql .= " AND create_time > " . $user_time;
         }
         $user_vote = $this->db->query_first($sql);
         if ($user_vote['total'] >= $vote['userid_limit_num']) {
             $error5 = '同一用户在' . $vote['userid_limit_time'] . '小时内最多投' . $vote['userid_limit_num'] . '票!';
             $error6 = '同一用户最多投' . $vote['userid_limit_num'] . '票!';
             $data['error'] = $vote['userid_limit_time'] ? $error5 : $error6;
             $this->errorOutput($data['error']);
         }
     }
     if (!$device_token && $vote['is_device'] && defined('NO_DEVICE_VOTE') && NO_DEVICE_VOTE) {
         $error = defined('NO_DEVICE_TIPS') && NO_DEVICE_TIPS ? NO_DEVICE_TIPS : '您的客户端版本太低,请先升级';
         $this->errorOutput($error);
     }
     if ($device_token && $vote['is_device']) {
         if ($this->settings['App_mobile']) {
             require_once ROOT_DIR . 'lib/class/curl.class.php';
             $this->curl = new curl($this->settings['App_mobile']['host'], $this->settings['App_mobile']['dir']);
             $this->curl->setReturnFormat('json');
             $this->curl->initPostData();
             $this->curl->addRequestData('device_token', $device_token);
             $this->curl->addRequestData('uuid', $uuid);
             $ret = $this->curl->request('mobile_device.php');
             if (!$ret[0]) {
                 $this->errorOutput(ERROR_DEVICE_TOKEN);
             }
         }
         $device_user_toff = $vote['device_limit_time'] * 3600;
         $device_user_time = TIMENOW - $device_user_toff;
         $sql = "SELECT count(vote_question_id) as total FROM " . DB_PREFIX . "question_person WHERE 1 ";
         $sql .= " AND  vote_question_id = " . $id . " AND device_token = '" . md5($device_token) . "'";
         if ($vote['device_limit_time']) {
             $sql .= " AND create_time > " . $device_user_time;
         }
         $device_vote = $this->db->query_first($sql);
         if ($device_vote['total'] >= $vote['device_limit_num']) {
             $error1 = '同一设备在' . $vote['device_limit_time'] . '小时内最多投' . $vote['device_limit_num'] . '票!';
             $error2 = '同一设备最多投' . $vote['device_limit_num'] . '票!';
             $data['error'] = $vote['device_limit_time'] ? $error1 : $error2;
             $this->errorOutput($data['error']);
         }
     }
     //ip投票时间限制
     if ($vote['is_ip'] && (!$device_token || !$vote['is_device'])) {
         $ip_toff = $vote['ip_limit_time'] * 3600;
         $ip_time = TIMENOW - $ip_toff;
         $sql = "SELECT count(vote_question_id) as iptotal FROM " . DB_PREFIX . "question_person WHERE 1 ";
         $sql .= " AND vote_question_id = " . $id . " AND ip = '" . $ip . "'";
         if ($vote['ip_limit_time']) {
             $sql .= " AND create_time > " . $ip_time;
         }
         $ip_question_preson = $this->db->query_first($sql);
         if ($ip_question_preson['iptotal'] >= $vote['ip_limit_num']) {
             $error3 = '同一IP在' . $vote['ip_limit_time'] . '小时内最多投' . $vote['ip_limit_num'] . '票!';
             $error4 = '同一IP多投' . $vote['ip_limit_num'] . '票!';
             $data['error'] = $vote['ip_limit_time'] ? $error3 : $error4;
             $this->errorOutput($data['error']);
         }
     }
     //记录数据
     foreach ($option_ids as $k => $_option_id) {
         //更新选项 投票数
         $sql = "UPDATE " . DB_PREFIX . "question_option SET single_total=(single_total+1) WHERE id = " . $_option_id;
         $this->db->query($sql);
         //记录选项 投票
         $question_record_data = array('question_option_id' => $_option_id, 'vote_question_id' => $id, 'ip' => $ip, 'num' => 1, 'start_time' => TIMENOW, 'appid' => $appid, 'appname' => $appname);
         $this->mVote->create_data('question_record', $question_record_data);
     }
     //更新主表 total 字段
     $sql = "UPDATE " . DB_PREFIX . "vote_question SET total = (total+" . $option_count . ") WHERE id = " . $id;
     $this->db->query($sql);
     //记录其他 投票
     if (isset($this->input['other_title']) && $other_title) {
         $question_option_data = array('vote_question_id' => $id, 'other_option' => $other_title, 'user_id' => $user_id, 'create_time' => TIMENOW);
         $ret_other_data = $this->mVote->create_data('question_other_option', $question_option_data, true);
         $other_option_id = $ret_other_data['id'];
         if ($other_option_id) {
             //记录选项 投票
             $question_record_data = array('question_option_id' => $other_option_id, 'vote_question_id' => $id, 'ip' => $ip, 'num' => 1, 'start_time' => TIMENOW, 'appid' => $appid, 'appname' => $appname);
             $this->mVote->create_data('question_record', $question_record_data);
             //更新主表 total 字段
             $sql = "UPDATE " . DB_PREFIX . "vote_question SET total = (total+1) WHERE id = " . $id;
             $this->db->query($sql);
         }
     }
     //记录参与人数 所投选项
     $question_person_info_data = array('vote_question_id' => $id, 'user_id' => $user_id, 'option_ids' => $option_id);
     $question_person_info = $this->mVote->create_data('question_person_info', $question_person_info_data, true);
     $pid = $question_person_info['id'];
     $user_name = $this->user['user_name'];
     //记录参与人数
     $question_person_data = array('vote_question_id' => $id, 'user_id' => $user_id, 'user_name' => $user_name, 'app_id' => $appid, 'app_name' => $appname, 'create_time' => TIMENOW, 'ip' => $ip, 'pid' => $pid, 'device_token' => md5($device_token), 'uuid' => $uuid, 'agent' => $_SERVER['HTTP_USER_AGENT'], 'referer' => $_SERVER['HTTP_REFERER']);
     $this->mVote->create_data('question_person', $question_person_data);
     //统计参与人数
     $sql = "SELECT vote_question_id FROM " . DB_PREFIX . "question_count WHERE vote_question_id=" . $id . " AND app_id = " . $appid;
     $question_count = $this->db->query_first($sql);
     if (empty($question_count)) {
         $question_count_data = array('vote_question_id' => $id, 'app_id' => $appid, 'app_name' => $appname, 'counts' => 1);
         $this->mVote->create_data('question_count', $question_count_data);
     } else {
         $sql = "UPDATE " . DB_PREFIX . "question_count SET counts=(counts+1) WHERE vote_question_id=" . $id . " AND app_id = " . $appid;
         $this->db->query($sql);
     }
     /***********************调用积分规则,给已审核评论增加积分START*****************/
     $data = $vote;
     if ($this->settings['App_members'] && $this->user['user_id'] && $this->input['iscreditsrule']) {
         $sql = "SELECT count(vote_question_id) as vote_num FROM " . DB_PREFIX . "question_person WHERE 1 ";
         $sql .= " AND vote_question_id = " . $id . " AND user_id = '" . $this->user['user_id'] . "'";
         $vote_num = $this->db->query_first($sql);
         if ($vote_num['vote_num'] < CREDIT_NUM + 1) {
             include ROOT_PATH . 'lib/class/members.class.php';
             $Members = new members();
             $Members->Setoperation(APP_UNIQUEID, MOD_UNIQUEID, 'vote_add');
             /***增加积分**/
             if (IS_CREDITS && $this->user['user_id']) {
                 $credit_rules = $Members->get_credit_rules($this->user['user_id'], APP_UNIQUEID, MOD_UNIQUEID, 0, $id);
             }
             /**积分文案处理**/
             $credit_copy = array();
             if ($credit_rules['updatecredit']) {
                 $credit_copy[] = $credit_rules;
             }
             $data['copywriting_credit'] = $Members->copywriting_credit($credit_copy);
         }
         /**积分文案处理结束**/
     }
     /***********************调用积分规则,给已审核评论增加积分END*****************/
     if (!trim($this->input['app_version'])) {
         $this->addItem('success');
     } else {
         $data['vote_status'] = 'success';
         $this->addItem($data);
     }
     $this->output();
 }
Example #13
0
 public function process()
 {
     $ids = trim($this->input['id']);
     $sql = 'SELECT id,feedback_id,user_id,credit FROM ' . DB_PREFIX . 'record_person WHERE id in( ' . $ids . ')';
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $feedback_id = $r['feedback_id'];
         if (!$r['credit'] && $r['user_id']) {
             $uncredit_user[] = $r['user_id'];
         }
         if ($r['credit'] && $r['user_id']) {
             $credit_user[] = $r['user_id'];
         }
     }
     if ($feedback_id) {
         $sql = 'SELECT user_id,org_id,is_credit,credit1,credit2,title,admin_user FROM ' . DB_PREFIX . 'feedback WHERE id =' . $feedback_id;
         $count = $this->db->query_first($sql);
     }
     if ($this->user['group_type'] > MAX_ADMIN_TYPE && $count['admin_user']) {
         $admin_user = array();
         $admin_user = explode(',', $count['admin_user']);
         if (!in_array($this->user['user_name'], $admin_user)) {
             $this->errorOutput("对不起,您没有此表单的权限");
         }
     } elseif ($this->user['group_type'] > MAX_ADMIN_TYPE && !$count['admin_user']) {
         $this->verify_content_prms(array('_action' => 'manage'));
         if (!$this->user['prms']['default_setting']['manage_other_data']) {
             if ($count['user_id'] != $this->user['user_id']) {
                 $this->errorOutput(NO_PRIVILEGE);
             }
         }
         if ($this->user['prms']['default_setting']['manage_other_data'] == 1 && $this->user['slave_org']) {
             if (!in_array($count['org_id'], explode(',', $this->user['slave_org']))) {
                 $this->errorOutput(NO_PRIVILEGE);
             }
         }
     }
     if (!$ids) {
         $this->output(NOID);
     }
     $pro = intval($this->input['process']);
     $sql = 'UPDATE ' . DB_PREFIX . 'record_person SET process = ' . $pro . ' WHERE id in(' . $ids . ')';
     $this->db->query($sql);
     $ret = array('id' => explode(',', $ids), 'process' => $pro);
     /******************会员报名通过审核后添加积分*******************/
     if ($feedback_id && $ret && $count['is_credit'] && AUDIT_ADD_CRIDET && $pro === 1 && $uncredit_user) {
         require_once ROOT_DIR . 'lib/class/members.class.php';
         $members = new members();
         if (is_array($uncredit_user)) {
             $uncredit_user = array_unique($uncredit_user);
             foreach ($uncredit_user as $k => $user_id) {
                 $re = $members->add_credit($user_id, array('credit1' => $count['credit1'], 'credit2' => $count['credit2']), $feedback_id, APP_UNIQUEID, MOD_UNIQUEID, 'audit', '参与:' . $count['title'], '反馈表单');
                 if ($re[0]['logid']) {
                     $addcredit_user[] = $user_id;
                 }
             }
         }
         if ($addcredit_user) {
             $addcredit_user = implode(',', $addcredit_user);
             $sql = 'UPDATE ' . DB_PREFIX . 'record_person SET credit = 1 WHERE feedback_id = ' . $feedback_id . ' and user_id in(' . $addcredit_user . ')';
             $this->db->query($sql);
         }
     }
     /******************会员报名通过审核后添加积分*******************/
     /******************会员报名打回后减积分*******************/
     if ($feedback_id && $ret && $count['is_credit'] && AUDIT_ADD_CRIDET && $pro !== 1 && $credit_user) {
         require_once ROOT_DIR . 'lib/class/members.class.php';
         $members = new members();
         if (is_array($credit_user)) {
             $credit_user = array_unique($credit_user);
             foreach ($credit_user as $k => $user_id) {
                 $re = $members->sub_credit($user_id, array('credit1' => $count['credit1'], 'credit2' => $count['credit2']), $feedback_id, APP_UNIQUEID, MOD_UNIQUEID, 'audit', '删除:' . $count['title'], '反馈表单');
                 if ($re[0]['logid']) {
                     $subcredit_user[] = $user_id;
                 }
             }
         }
         if ($subcredit_user) {
             $subcredit_user = implode(',', $subcredit_user);
             $sql = 'UPDATE ' . DB_PREFIX . 'record_person SET credit = 0 WHERE feedback_id = ' . $feedback_id . ' and user_id in(' . $subcredit_user . ')';
             $this->db->query($sql);
         }
     }
     /******************会员报名打回后减积分*******************/
     /****计算已通过处理人数和未通过处理人数******/
     $result[1] = $result[2] = 0;
     $sql = 'SELECT process,count(process) as count FROM ' . DB_PREFIX . 'record_person  WHERE feedback_id = ' . $feedback_id . ' GROUP BY process';
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $result[$r['process']] = $r['count'];
     }
     $sql = 'UPDATE ' . DB_PREFIX . 'feedback SET processed_count = ' . $result[1] . ', unprocessed_count = ' . $result[2];
     $sql .= " WHERE id = '" . $feedback_id . "'";
     $this->db->query($sql);
     /****计算已通过处理人数和未通过处理人数******/
     $this->addItem($ret);
     $this->output();
 }
Example #14
0
 public function fetch_message()
 {
     $id = intval($this->input['id']);
     if (!$this->user['user_id']) {
         $this->errorOutput(NO_ACCESS_TOKEN);
     }
     $sql = 'SELECT id,process,message_id FROM ' . DB_PREFIX . 'record_person WHERE feedback_id = ' . $id . ' and user_id = "' . $this->user['user_id'] . '"';
     $backinfo = $this->db->query_first($sql);
     if ($backinfo['id']) {
         if ($this->settings['App_im']) {
             $msg_id = $backinfo['message_id'];
             if ($msg_id) {
                 $this->curl = new curl($this->settings['App_im']['host'], $this->settings['App_im']['dir']);
                 $this->curl->setSubmitType('post');
                 $this->curl->setReturnFormat('json');
                 $this->curl->initPostData();
                 $this->curl->addRequestData('session_id', $msg_id);
                 $this->curl->addRequestData('sort_type', 'ASC');
                 $this->curl->addRequestData('a', 'session_detail');
                 $message = $this->curl->request('message.php');
                 $message = $message[0];
                 $msg = $message['messages'][$msg_id];
                 $userinfo = $message['users'];
                 if ($id) {
                     $sql = 'SELECT admin_reply_count FROM ' . DB_PREFIX . 'record_person WHERE feedback_id = ' . $id . ' AND user_id = ' . $this->user['user_id'];
                     $back = $this->db->query_first($sql);
                     $reply = $back['admin_reply_count'];
                     $sql = 'UPDATE ' . DB_PREFIX . 'record_person SET admin_reply_count = 0 WHERE feedback_id = ' . $id . ' AND user_id = ' . $this->user['user_id'];
                     $this->db->query($sql);
                     if ($message['session_info']['id'] && $reply) {
                         /*************会员查看过消息之后,管理员的回复数量加新消息数************/
                         if ($this->settings['App_members']) {
                             require_once ROOT_PATH . 'lib/class/members.class.php';
                             $members = new members();
                             $data = array('member_id' => $this->user['user_id'], 'mark' => 'apply', 'math' => 2, 'total' => $reply);
                             $ret = $members->updateMyData($data);
                         }
                         /*************会员查看过消息之后,管理员的回复数量加新消息数************/
                     }
                 }
                 if ($userinfo && is_array($userinfo)) {
                     foreach ($userinfo as $k => $v) {
                         $user[$v['uid']] = $v['utype'];
                     }
                 }
                 if ($msg && is_array($msg)) {
                     foreach ($msg as $k => $v) {
                         $msg[$k]['utype'] = $user[$v['send_uid']];
                     }
                 }
                 $retutn = array('msg' => $msg, 'users' => $userinfo);
             }
         }
     }
     $this->addItem($retutn);
     $this->output();
 }
Example #15
0
	<nav>
		<ul id="header_nav_right">
			<li class="header_nav_user header_nav_has_dropdown">
			<?php 
if ($loggedin_user != FALSE) {
    ?>

				<a href="<?php 
    echo url::site() . $loggedin_role;
    ?>
"><span class="header_nav_label"><?php 
    echo $loggedin_user->username;
    ?>
</span> <img src="<?php 
    echo members::gravatar($loggedin_user->email, 20);
    ?>
" width="20" /></a>

				<ul class="header_nav_dropdown" style="display:none;">

					<li><a href="<?php 
    echo url::site() . $loggedin_role;
    ?>
/profile"><?php 
    echo Kohana::lang('ui_main.manage_your_account');
    ?>
</a></li>

					<li><a href="<?php 
    echo url::site() . $loggedin_role;
Example #16
0
 *
 * PHP version 5
 * LICENSE: This source file is subject to LGPL license 
 * that is available through the world-wide-web at the following URI:
 * http://www.gnu.org/copyleft/lesser.html
 * @author     Ushahidi Team <*****@*****.**> 
 * @package    Ushahidi - http://source.ushahididev.com
 * @module     API Controller
 * @copyright  Ushahidi - http://www.ushahidi.com
 * @license    http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) 
 */
?>
			<div class="bg">
				<h2>
					<?php 
members::reports_subtabs("edit");
?>
				</h2>
				<?php 
print form::open(NULL, array('enctype' => 'multipart/form-data', 'id' => 'reportForm', 'name' => 'reportForm'));
?>
					<input type="hidden" name="save" id="save" value="">
					<input type="hidden" name="location_id" id="location_id" value="<?php 
print $form['location_id'];
?>
">
					<input type="hidden" name="incident_zoom" id="incident_zoom" value="<?php 
print $form['incident_zoom'];
?>
">
					<input type="hidden" name="country_name" id="country_name" value="<?php 
Example #17
0
 private function fetch_member_info()
 {
     /***从会员接口取会员相关信息和拓展信息****/
     if ($this->settings['App_members'] && $this->user['user_id']) {
         $members = new members();
         $info = $members->get_members(0, 'detail', $this->user['token']);
         $info = $info[0];
         if ($info['extension'] && is_array($info['extension'])) {
             foreach ($info['extension'] as $v) {
                 $extension[$v['field']] = $v['value'];
             }
         }
         if ($info) {
             $forms = $this->mode->get_forms($id);
             if ($forms && is_array($forms)) {
                 foreach ($forms as $k => $v) {
                     if ($v['fixed_id'] == 4 && $v['member_field_addr'] && is_array($v['member_field_addr'])) {
                         foreach ($v['member_field_addr'] as $ele => $elev) {
                             if ($extension[$elev]) {
                                 if ($ele == -1) {
                                     $address = $extension[$elev];
                                     $address_info = explode(',', $address);
                                     $address_info[0] ? $prov_name = $data['field']['form[' . $v['type'] . '_' . $v['id'] . '][8]'] = $address_info[0] : false;
                                     $address_info[1] ? $city_name = $data['field']['form[' . $v['type'] . '_' . $v['id'] . '][9]'] = $address_info[1] : false;
                                     $address_info[2] ? $area_name = $data['field']['form[' . $v['type'] . '_' . $v['id'] . '][10]'] = $address_info[2] : false;
                                     $address_info[3] ? $data['field']['form[' . $v['type'] . '_' . $v['id'] . '][11]'] = $address_info[3] : false;
                                 }
                                 if ($ele == 8) {
                                     $prov_name = $extension[$elev];
                                 }
                                 if ($ele == 9) {
                                     $city_name = $extension[$elev];
                                 }
                                 if ($ele == 10) {
                                     $area_name = $extension[$elev];
                                 }
                                 $data['field']['form[' . $v['type'] . '_' . $v['id'] . '][' . $ele . ']'] = $extension[$elev];
                             }
                         }
                         if ($prov_name) {
                             $sql = 'SELECT c.id as city_id,c.city FROM ' . DB_PREFIX . 'province p LEFT JOIN ' . DB_PREFIX . 'city c ON c.province_id = p.id WHERE p.name = "' . $prov_name . '"';
                             $q = $this->db->query($sql);
                             while ($r = $this->db->fetch_array($q)) {
                                 $data['address']['city'][$r['city_id']] = $r['city'];
                             }
                         }
                         if ($city_name) {
                             $sql = 'SELECT a.id as area_id,a.area FROM ' . DB_PREFIX . 'city c LEFT JOIN ' . DB_PREFIX . 'area a ON c.id = a.city_id  WHERE c.city = "' . $city_name . '"';
                             $q = $this->db->query($sql);
                             while ($r = $this->db->fetch_array($q)) {
                                 $data['address']['area'][$r['area_id']] = $r['area'];
                             }
                         }
                     }
                     if ($v['member_field'] == 'mobile' || $v['member_field'] == 'email') {
                         if ($info[$v['member_field']]) {
                             $data['field']['form[' . $v['type'] . '_' . $v['id'] . ']'] = $info[$v['member_field']];
                         }
                     } elseif ($v['member_field'] && $extension[$v['member_field']]) {
                         $data['field']['form[' . $v['type'] . '_' . $v['id'] . ']'] = $extension[$v['member_field']];
                     }
                 }
             }
         }
     }
     /***从会员接口取会员相关信息和拓展信息****/
     return $data;
 }
Example #18
0
        $this->addItem(true);
        $this->output();
    }
    /**
     * 设置相册属于哪个分类
     */
    public function setAlbumCate()
    {
        if (!isset($this->input['cate_id']) || !$this->input['cate_id']) {
            $this->errorOutput(NO_CATE_ID);
        }
        if (!isset($this->input['id']) || !$this->input['id']) {
            $this->errorOutput(NO_ID);
        }
        $id = $this->input['id'];
        $cond = " WHERE id={$id}";
        $params['cate_id'] = $this->input['cate_id'];
        include CUR_CONF_PATH . 'lib/Core.class.php';
        $obj = new Core();
        $datas = $obj->update('albums', $params, $cond);
        $this->addItem($datas);
        $this->output();
    }
    /**
	 * 获取会员信息
	 * @param Int|String $user_id
	 */
    private function getMemberInfo($user_id)
    {
        if ($this->input['latest']) {
            //新会员
            include_once ROOT_PATH . 'lib/class/members.class.php';
Example #19
0
 *
 * PHP version 5
 * LICENSE: This source file is subject to LGPL license
 * that is available through the world-wide-web at the following URI:
 * http://www.gnu.org/copyleft/lesser.html
 * @author     Ushahidi Team <*****@*****.**>
 * @package    Ushahidi - http://source.ushahididev.com
 * @module     API Controller
 * @copyright  Ushahidi - http://www.ushahidi.com
 * @license    http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
 */
?>
			<div class="bg">
				<h2>
					<?php 
members::reports_subtabs("view");
?>
				</h2>
				<!-- tabs -->
				<div class="tabs">
					<!-- tabset -->
					<ul class="tabset">
						<li><a href="?status=0" <?php 
if ($status != 'a' && $status != 'v') {
    echo "class=\"active\"";
}
?>
><?php 
echo Kohana::lang('ui_main.show_all');
?>
</a></li>
Example #20
0
 /**
  * 
  * @Description
  * @author Kin
  * @date 2013-6-6 下午03:50:51 
  * @see outerUpdateBase::create()
  */
 public function create()
 {
     //检测社区黑名单
     $this->check_black();
     if (!intval($this->input['sort_id'])) {
         $this->errorOutput(NO_SORT_ID);
     }
     //限制发帖时间
     if ($this->user['user_id']) {
         $condition = ' AND member_id=' . $this->user['user_id'] . '';
         $latest_info = $this->sh->getSeekhelplist($condition, ' ORDER BY order_id  DESC', 0, 1, $this->input['sort_id']);
         if ($latest_info[0]) {
             if ($latest_info[0]['create_time'] + LIMIT_POSTING_TIME >= TIMENOW) {
                 $this->errorOutput(POSTING_FAST);
             }
             if ($latest_info[0]['content'] == trim($this->input['content'])) {
                 $this->errorOutput(CONTENT_EXIST);
             }
         }
     }
     $data = array('title' => trim($this->input['title']), 'status' => 0, 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'baidu_longitude' => trim($this->input['baidu_longitude']), 'baidu_latitude' => trim($this->input['baidu_latitude']), 'GPS_longitude' => trim($this->input['GPS_longitude']), 'GPS_latitude' => trim($this->input['GPS_latitude']), 'location' => trim($this->input['location']), 'sort_id' => intval($this->input['sort_id']), 'section_id' => intval($this->input['section_id']), 'account_id' => intval($this->input['account_id']), 'org_id' => $this->user['org_id'], 'member_id' => $this->user['user_id'], 'tel' => trim($this->input['tel']), 'create_time' => TIMENOW, 'comment_latest_time' => TIMENOW, 'ip' => $this->user['ip']);
     $content = trim($this->input['content']);
     if (empty($content)) {
         $this->errorOutput(NO_CONTENT);
     }
     if ($data['section_id']) {
         $sectionInfo = $this->section->detail($data['section_id']);
         if (!$sectionInfo) {
             $this->errorOutput(NO_SECTION);
         }
     }
     //会员黑名单验证
     if ($data['member_id']) {
         include_once ROOT_PATH . 'lib/class/members.class.php';
         $obj = new members();
         $res = $obj->check_blacklist($data['member_id']);
         if ($res[$data['member_id']]['isblack']) {
             //$this->addItem_withkey('error', "您的评论被屏蔽,请联系管理员!");
             //$this->addItem_withkey('msg', "您的评论被屏蔽,请联系管理员!");
             //$this->output();
             $this->errorOutput(IS_BLACK_MEMBER);
         }
     }
     //分类异常处理
     $data['sort_id'] = $this->sh->sortException($data['sort_id']);
     if (defined('SEEKHELP_STATUS') && SEEKHELP_STATUS && !$_FILES['photos'] && !$_FILES['video']) {
         $data['status'] = 1;
     }
     if (defined('SEEKHELP_MATERIAL_STATUS') && SEEKHELP_MATERIAL_STATUS && ($_FILES['photos'] || $_FILES['video'])) {
         $data['status'] = 1;
     }
     if ($this->input['app_id']) {
         $app_id = $this->input['app_id'];
         $appconfig = $this->appconfig->detail($app_id);
         if ($appconfig['seekhelp_audit'] == 0) {
             $data['status'] = 1;
         } else {
             $data['status'] = 0;
         }
     }
     //屏蔽字验证
     if ($this->settings['App_banword'] && defined('IS_BANWORD') && IS_BANWORD) {
         require_once ROOT_PATH . 'lib/class/banword.class.php';
         $this->banword = new banword();
         $str = $data['title'] . $content;
         $banword = $this->banword->exists($str);
         if ($banword && is_array($banword)) {
             $banword_title = '';
             $banword_content = '';
             foreach ($banword as $key => $val) {
                 if (strstr($data['title'], $val['banname'])) {
                     $banword_title .= $val['banname'] . ',';
                 }
                 if (strstr($content, $val['banname'])) {
                     $banword_content .= $val['banname'] . ',';
                 }
             }
             $banword_title = $banword_title ? rtrim($banword_title, ',') : '';
             $banword_content = $banword_content ? rtrim($banword_content, ',') : '';
             if ($banword_title || $banword_content) {
                 $banwords = array('title' => $banword_title, 'content' => $banword_content);
                 $data['status'] = 0;
                 //含有屏蔽字直接未审
                 $data['banword'] = serialize($banwords);
             }
         }
     }
     //如果百度坐标存在的话,就转换为GPS坐标也存起来
     if ($data['baidu_longitude'] && $data['baidu_latitude'] && !$data['GPS_longitude'] && !$data['GPS_latitude']) {
         $gps = $this->sh->FromBaiduToGpsXY($data['baidu_longitude'], $data['baidu_latitude']);
         $data['GPS_longitude'] = $gps['GPS_x'];
         $data['GPS_latitude'] = $gps['GPS_y'];
     }
     //如果GPS坐标存在的话,就转换为百度坐标也存起来
     if (!$data['baidu_longitude'] && !$data['baidu_latitude'] && $data['GPS_longitude'] && $data['GPS_latitude']) {
         $baidu = $this->sh->FromGpsToBaiduXY($data['GPS_longitude'], $data['GPS_latitude']);
         $data['baidu_longitude'] = $baidu['x'];
         $data['baidu_latitude'] = $baidu['y'];
     }
     if (!$data['title']) {
         $data['title'] = hg_cutchars($content, 100);
     }
     if (!$data['title']) {
         $this->errorOutput('请输入内容');
     }
     //初始化的数据
     $is_img = 0;
     $is_video = 0;
     $is_reply = 0;
     //添加求助信息
     $seekhelpInfor = $this->sh->add_seekhelp($data);
     if (!$seekhelpInfor['id']) {
         $this->errorOutput('数据库插入失败');
     }
     $id = $seekhelpInfor['id'];
     //添加描述
     if ($content) {
         $contentInfor = $this->sh->add_content($content, $id);
         if (!$contentInfor) {
             $this->errorOutput('数据库插入失败');
         }
         $data['content'] = $contentInfor;
     }
     //图片上传
     if ($_FILES['photos']) {
         $photos = array();
         //检测图片服务器
         if (!$this->settings['App_material']) {
             $this->errorOutput('图片服务器未安装!');
         }
         //获取图片服务器上传配置
         // 			$PhotoConfig = $this->sh->getPhotoConfig();
         // 			if (!$PhotoConfig)
         // 			{
         // 				$this->errorOutput('获取允许上传的图片类型失败!');
         // 			}
         $count = count($_FILES['photos']['name']);
         for ($i = 0; $i < $count; $i++) {
             if ($_FILES['photos']['name'][$i]) {
                 if ($_FILES['photos']['error'][$i] > 0) {
                     $this->errorOutput('图片上传异常');
                 }
                 /*
                 if (!in_array($_FILES['photos']['type'][$i], $PhotoConfig['type']))
                 {
                 	$this->errorOutput('只允许上传'.$PhotoConfig['hit'].'格式的图片');
                 }
                 */
                 if ($_FILES['photos']['size'][$i] > 100000000) {
                     $this->errorOutput('只允许上传100M以下的图片!');
                 }
                 foreach ($_FILES['photos'] as $k => $v) {
                     $photo['Filedata'][$k] = $_FILES['photos'][$k][$i];
                 }
                 $photos[] = $photo;
             }
         }
         if (!empty($photos)) {
             //循环插入图片服务器
             foreach ($photos as $val) {
                 $PhotoInfor = $this->sh->uploadToPicServer($val, $id);
                 if (empty($PhotoInfor)) {
                     $this->errorOutput('图片服务器错误!');
                 }
                 $temp = array('cid' => $id, 'type' => $PhotoInfor['type'], 'original_id' => $PhotoInfor['id'], 'host' => $PhotoInfor['host'], 'dir' => $PhotoInfor['dir'], 'filepath' => $PhotoInfor['filepath'], 'filename' => $PhotoInfor['filename'], 'imgwidth' => $PhotoInfor['imgwidth'], 'imgheight' => $PhotoInfor['imgheight'], 'mark' => 'img');
                 //插入数据库
                 $ret_pic = $this->sh->upload_pic($temp);
                 if ($ret_pic) {
                     $data['pic'][] = $ret_pic;
                 } else {
                     $this->errorOutput('图片入库失败');
                 }
             }
             $is_img = 1;
         }
     }
     //视频上传
     if ($_FILES['video']) {
         $videos = array();
         //检测视频服务器
         if (!$this->settings['App_mediaserver']) {
             $this->errorOutput('视频服务器未安装!');
         }
         //获取视频服务器上传配置
         $videoConfig = $this->sh->getVideoConfig();
         if (!$videoConfig) {
             $this->errorOutput('获取允许上传的视频类型失败!');
         }
         $count = count($_FILES['video']['name']);
         for ($i = 0; $i < $count; $i++) {
             if ($_FILES['video']['name'][$i]) {
                 if ($_FILES['video']['error'][$i] > 0) {
                     $this->errorOutput('视频上传异常');
                 }
                 /*
                 $filetype = strtolower(strrchr($_FILES['video']['name'][$i], '.'));	
                 if (!in_array($filetype, $videoConfig['type']))
                 {
                 	$this->errorOutput('只允许上传'.$videoConfig['hit'].'格式的视频');
                 }
                 */
                 foreach ($_FILES['video'] as $k => $v) {
                     $video['videofile'][$k] = $_FILES['video'][$k][$i];
                 }
                 $videos[] = $video;
             }
         }
         if (!empty($videos)) {
             foreach ($videos as $videoInfor) {
                 //上传视频服务器
                 $videodata = $this->sh->uploadToVideoServer($videoInfor, $data['title'], '', 2);
                 if (!$videodata) {
                     $this->errorOutput('视频服务器错误!');
                 }
                 //视频入库
                 $arr = array('cid' => $id, 'type' => $videodata['type'], 'host' => $videodata['protocol'] . $videodata['host'], 'dir' => $videodata['dir'], 'original_id' => $videodata['id'], 'filename' => $videodata['file_name'], 'mark' => 'video');
                 $ret_vod = $this->sh->upload_vod($arr);
                 if ($ret_vod) {
                     $data['video'][] = $ret_vod;
                 } else {
                     $this->errorOutput('视频入库失败');
                 }
             }
             $is_video = 1;
         }
     }
     //更新主表回复,图片,视频纪录
     $status = array('is_reply' => 0, 'is_img' => $is_img, 'is_video' => $is_video);
     $ret_status = $this->sh->update_status($status, $id);
     if ($ret_status) {
         $data['is_reply'] = $ret_status['is_reply'];
         $data['is_img'] = $ret_status['is_img'];
         $data['is_video'] = $ret_status['is_video'];
     }
     if ($data['status']) {
         $this->SetTimeline($id);
         //更新会员统计
         $this->updateMemberCount($data['member_id'], 'create');
     }
     $data['id'] = $id;
     $this->addItem($data);
     $this->output();
 }
Example #21
0
?>
			</div>
			<div class="row">
				<h4>
					<a href="http://www.gravatar.com/" target="_blank" class="tooltip"
						title="<?php 
echo Kohana::lang("tooltips.change_picture");
?>
"><?php 
echo Kohana::lang('ui_main.change_picture');
?>
					</a>
				</h4>
				<a href="http://www.gravatar.com/" target="_blank"><img
					src="<?php 
echo members::gravatar($form['email']);
?>
" width="80"
					border="0" /> </a>
			</div>
			<div class="row">
				<h4>
					<a href="http://www.gravatar.com/" target="_blank" class="tooltip"
						title="<?php 
echo Kohana::lang("tooltips.profile_color");
?>
"><?php 
echo Kohana::lang('ui_main.profile_color');
?>
					</a>
				</h4>
Example #22
0
 /**
  *
  * 获取需要的条件
  */
 private function get_condition()
 {
     //搜索标签
     if ($this->input['searchtag_id']) {
         $searchtag = $this->searchtag_detail(intval($this->input['searchtag_id']));
         foreach ((array) $searchtag['tag_val'] as $k => $v) {
             if (in_array($k, array('_id'))) {
                 //防止左边栏分类搜索无效
                 continue;
             }
             $this->input[$k] = $v;
         }
     }
     //搜索标签
     if (isset($this->input['k']) && !empty($this->input['k']) || (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0')) {
         if (isset($this->input['k']) && !empty($this->input['k'])) {
             $key = trim($this->input['k']);
         } elseif (trim($this->input['key']) || trim(urldecode($this->input['key'])) == '0') {
             $key = trim($this->input['key']);
         }
         $binary = '';
         //不区分大小些
         if (defined('IS_BINARY') && !IS_BINARY) {
             $binary = 'binary ';
         }
         $condition .= ' AND ' . $binary . ' title like \'%' . $key . '%\'';
         $memberMySet = new memberMySet();
         $markInfo = $memberMySet->show($condition, 0, 0, 'mark', 'mark', '', 0);
         $this->memberMyData->setParams('mark', $markInfo, 'myd');
     } else {
         $this->input['mark'] && ($TParams = $this->memberMyData->setMark(trim($this->input['mark'])));
         if ($TParams == -3) {
             $this->errorOutput(PROHIBIT_CN);
         } elseif ($TParams == -4) {
             $this->errorOutput(MARK_CHARACTER_ILLEGAL);
         } elseif ($TParams == -5) {
             $this->errorOutput(MARK_ERROR);
         } else {
             if (trim($this->input['mark']) == $TParams) {
                 $this->memberMyData->setParams('mark', null, 'myd');
             }
         }
     }
     $this->memberMyData->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member_myset as mms ON myd.mark=mms.mark');
     if (isset($this->input['member_name']) && ($member_name = trimall($this->input['member_name']))) {
         $members = new members();
         $member_id = $members->get_member_id($member_name, false);
         $member_id && $this->memberMyData->setParams('member_id', $member_id, 'myd');
         !$member_id && $this->errorOutput(NO_MEMBER);
     }
     $this->memberMyData->setJoin(' LEFT JOIN ' . DB_PREFIX . 'member as m ON myd.member_id=m.member_id');
     if (isset($this->input['search']) && ($search = $this->input['search'])) {
         $this->memberMyData->setParamType('search', 'fuzzy', 1, 'myd');
         $this->memberMyData->setParams('search', $search, 'myd');
     }
     if ($this->input['start_time']) {
         $start_time = strtotime(trim(urldecode($this->input['start_time'])));
         $condition = " AND myd.create_time >= " . $start_time;
         $this->memberMyData->setSql()->where($condition);
     }
     if ($this->input['end_time']) {
         $end_time = strtotime(trim(urldecode($this->input['end_time'])));
         $condition = " AND myd.create_time <= " . $end_time;
         $this->memberMyData->setSql()->where($condition);
     }
     if (isset($this->input['date_search']) && !empty($this->input['date_search'])) {
         $today = strtotime(date('Y-m-d'));
         $tomorrow = strtotime(date('y-m-d', TIMENOW + 24 * 3600));
         switch (intval($this->input['date_search'])) {
             case 1:
                 //所有时间段
                 break;
             case 2:
                 //昨天的数据
                 $yesterday = strtotime(date('y-m-d', TIMENOW - 24 * 3600));
                 $condition = " AND myd.create_time > '" . $yesterday . "' AND myd.create_time < '" . $today . "'";
                 $this->memberMyData->setSql()->where($condition);
                 break;
             case 3:
                 //今天的数据
                 $condition = " AND myd.create_time > '" . $today . "' AND myd.create_time < '" . $tomorrow . "'";
                 $this->memberMyData->setSql()->where($condition);
                 break;
             case 4:
                 //最近3天
                 $last_threeday = strtotime(date('y-m-d', TIMENOW - 2 * 24 * 3600));
                 $condition = " AND myd.create_time > '" . $last_threeday . "' AND myd.create_time < '" . $tomorrow . "'";
                 $this->memberMyData->setSql()->where($condition);
                 break;
             case 5:
                 //最近7天
                 $last_sevenday = strtotime(date('y-m-d', TIMENOW - 6 * 24 * 3600));
                 $condition = " AND myd.create_time > '" . $last_sevenday . "' AND myd.create_time < '" . $tomorrow . "'";
                 $this->memberMyData->setSql()->where($condition);
                 break;
             default:
                 //所有时间段
                 break;
         }
     }
     $this->memberMyData->setAs('myd');
 }
Example #23
0
 *
 * PHP version 5
 * LICENSE: This source file is subject to LGPL license 
 * that is available through the world-wide-web at the following URI:
 * http://www.gnu.org/copyleft/lesser.html
 * @author     Ushahidi Team <*****@*****.**> 
 * @package    Ushahidi - http://source.ushahididev.com
 * @module     Private Messages View
 * @copyright  Ushahidi - http://www.ushahidi.com
 * @license    http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL) 
 */
?>
<div class="bg">
	<h2>
		<?php 
members::alerts_subtabs("view");
?>
	</h2>

	<!-- tabs -->
	<div class="tabs">
		<!-- tabset -->
		<ul class="tabset">
			<li><a href="<?php 
echo url::site() . "members/alerts/";
?>
" <?php 
if ($type == '0' or empty($type)) {
    echo "class=\"active\"";
}
?>
Example #24
0
 /**
  * 创建评论
  * cid 
  * @see outerUpdateBase::create()
  */
 public function create()
 {
     if ($this->input['app_id']) {
         //检查社区黑名单
         $blackInfo = $this->blacklist->check_blackByappId($this->input['app_id']);
         if ($blackInfo && $blackInfo['deadline'] == -1) {
             $this->errorOutput(SEEKHELP_IS_BLACK);
         }
     }
     $data = array('cid' => intval($this->input['cid']), 'member_id' => intval($this->user['user_id']), 'comment_type' => trim($this->input['comment_type']), 'comment_fid' => intval($this->input['comment_fid']), 'location' => trim($this->input['location']), 'status' => 0, 'content' => $this->input['content'], 'create_time' => TIMENOW, 'ip' => $this->user['ip']);
     //comment_type默认值 此处兼容老社区
     if (!$this->input['comment_type']) {
         $data['comment_type'] = 'main';
     }
     if (defined('SEEKHELP_COMMENT_STATUS') && SEEKHELP_COMMENT_STATUS) {
         $data['status'] = 1;
     }
     if ($this->input['app_id'] && $data['comment_type'] == 'main') {
         $app_id = $this->input['app_id'];
         $appconfig = $this->appconfig->detail($app_id);
         if ($appconfig['comment_audit'] == 0) {
             $data['status'] = 1;
         } else {
             $data['status'] = 0;
         }
     }
     if (!$data['cid'] || !$data['member_id'] || !$data['content']) {
         $this->errorOutput(NOID);
     }
     // 		if(!$data['comment_type'])
     // 		{
     // 			$this->errorOutput(NO_COMMENT_TYPE);
     // 		}
     //会员黑名单验证
     include_once ROOT_PATH . 'lib/class/members.class.php';
     $obj = new members();
     $res = $obj->check_blacklist($data['member_id']);
     if ($res[$data['member_id']]['isblack']) {
         //$this->addItem_withkey('error', "您的评论被屏蔽,请联系管理员!");
         //$this->addItem_withkey('msg', "您的评论被屏蔽,请联系管理员!");
         //$this->output();
         $this->errorOutput(IS_BLACK_MEMBER);
     }
     $sql = "SELECT * FROM " . DB_PREFIX . "seekhelp WHERE id = " . $data['cid'];
     $seekhelp = $this->db->query_first($sql);
     $sort_id = $seekhelp['sort_id'];
     $data['sort_id'] = $sort_id;
     //屏蔽字验证
     if ($this->settings['App_banword']) {
         require_once ROOT_PATH . 'lib/class/banword.class.php';
         $this->banword = new banword();
         $str = $data['content'];
         $banword = $this->banword->exists($str);
         if ($banword && is_array($banword)) {
             $banword_content = '';
             foreach ($banword as $key => $val) {
                 $banword_content .= $val['banname'] . ',';
             }
             $data['banword'] = $banword_content ? rtrim($banword_content, ',') : '';
             $data['status'] = 0;
         }
     }
     $data['content'] = urlencode($data['content']);
     $ret = $this->comment->create($data);
     if ($ret) {
         if ($data['status']) {
             if ($data['comment_type'] == 'vice') {
                 $sql = "SELECT * FROM " . DB_PREFIX . "comment WHERE id = " . $data['comment_fid'];
                 $comment = $this->db->query_first($sql);
                 $this->SetCommentNum($data['comment_type'], $ret);
                 $this->SetTimeline($ret['id'], $comment, 'comment');
                 $this->SetMemberInfo($comment);
             } else {
                 $this->SetCommentNum($data['comment_type'], $ret);
                 $this->SetTimeline($ret['id'], $seekhelp, 'seekhelp');
                 $this->SetMemberInfo($seekhelp);
             }
             //更新会员统计
             if ($data['comment_type'] == 'main') {
                 $this->updateMemberCount($data['member_id'], 'create');
             }
         }
     }
     if ($this->settings['App_members']) {
         $memberInfo = $this->members->get_newUserInfo_by_ids($data['member_id']);
     }
     $ret['member_avatar'] = $memberInfo[0]['avatar'];
     $ret['member_name'] = IS_HIDE_MOBILE ? hg_hide_mobile($memberInfo[0]['nick_name']) : $memberInfo[0]['nick_name'];
     $ret['content'] = seekhelp_clean_value(stripcslashes(urldecode($ret['content'])));
     $this->addItem($ret);
     $this->output();
 }
Example #25
0
<?php

include 'include.php';
include "menu_tree.php";
$ofid = $_REQUEST['ofid'];
$member = new members($_SESSION['userid']);
if ($_SERVER['REQUEST_METHOD'] == "POST") {
    $compt = $_POST['compt'];
    $opinion = $_POST['opinion'];
    $type = $member->ComplainType($compt);
    $opinion = "<li>" . $type . $opinion . "(" . date("Y-m-d H:i:s") . ")</li>";
    $time = time();
    $opinion = mysql_escape_string(stripslashes($opinion));
    $sql = "UPDATE order_form_1 SET opinion = CONCAT(opinion,'{$opinion}'),opinion_type = {$compt},opinion_if = 1,opinion_time = '{$time}'  WHERE ofid = {$ofid}";
    $db->query($sql);
    $smarty->assign("act", "success");
    /* 将操作写入日志表  */
    $sys->setOrderNum($ofid);
    $sys->writeLog("修改数据", $sql, $ofid);
} else {
    $smarty->assign("act", "complaint");
}
$smarty->display("Complaint.htm");
Example #26
0
 public function show_win_info_more()
 {
     $id = intval($this->input['id']);
     if (!$id) {
         $this->errorOutput('活动id不存在');
     }
     $pp = $this->input['page'] ? intval($this->input['page']) : 1;
     //如果没有传第几页,默认是第一页
     $count = $this->input['count'] ? intval($this->input['count']) : 12;
     $offset = intval(($pp - 1) * $count);
     $limit = ' LIMIT ' . $offset . ' , ' . $count;
     $orderby = '  ORDER BY red_bag DESC,create_time  ASC ';
     $sql = "SELECT * FROM " . DB_PREFIX . "win_info WHERE tv_interact_id = " . $id . $orderby . $limit;
     $q = $this->db->query($sql);
     $member_id = array();
     while ($r = $this->db->fetch_array($q)) {
         $r['create_time'] = date('Y-m-d H:i', $r['create_time']);
         $info[] = $r;
         $member_id[] = $r['member_id'];
     }
     if (!empty($member_id)) {
         include_once ROOT_DIR . 'lib/class/members.class.php';
         $obj = new members();
         $member_id = implode(',', $member_id);
         $member_info = array();
         $member_info_tmp = array();
         $member_info_tmp = $obj->get_member_info($member_id);
         if (!empty($member_info_tmp)) {
             $size = '82x62/';
             foreach ($member_info_tmp as $val) {
                 $member_info[$val['member_id']]['member_name'] = $val['member_name'];
                 if (!empty($val['avatar'])) {
                     $member_info[$val['member_id']]['avatar'] = hg_material_link($val['avatar']['host'], $val['avatar']['dir'], $val['avatar']['filepath'], $val['avatar']['filename'], $size);
                 } else {
                     $member_info[$val['member_id']]['avatar'] = array();
                 }
                 $member_info[$val['member_id']]['phone_num'] = $val['mobile'];
             }
         }
     }
     if (!empty($info)) {
         foreach ($info as $val) {
             foreach ($val as $k => $v) {
                 if ($k == 'member_id' && $member_info[$v]) {
                     $val['member_name'] = $member_info[$v]['member_name'];
                     $val['phone_num'] = $member_info[$v]['phone_num'];
                     $val['avatar'] = $member_info[$v]['avatar'];
                 }
             }
             $ret[] = $val;
         }
     }
     //分页信息
     $sql = 'SELECT COUNT(*) AS total FROM ' . DB_PREFIX . 'win_info WHERE 1 AND tv_interact_id = ' . $id;
     $re = $this->db->query_first($sql);
     $total_num = $re['total'];
     //总的记录数
     //总页数
     if (intval($total_num % $count) == 0) {
         $return['total_page'] = intval($total_num / $count);
     } else {
         $return['total_page'] = intval($total_num / $count) + 1;
     }
     $return['total_num'] = $total_num;
     //总的记录数
     $return['page_num'] = $count;
     //每页显示的个数
     $return['current_page'] = $pp;
     //当前页码
     $data['info'] = $ret;
     $data['page_info'] = $return;
     $this->addItem($data);
     $this->output();
 }
Example #27
0
			<h3><?php 
echo Kohana::lang('ui_admin.my_profile');
?>
</h3>
			<ul class="inf" style="margin-bottom:10px;">
				<li class="none-separator"><a href="<?php 
echo url::site();
?>
members/profile"><?php 
echo Kohana::lang('ui_main.edit');
?>
</a></li>
			</ul>
			<div class="member_profile">
				<div class="member_photo"><img src="<?php 
echo members::gravatar($user->email);
?>
" width="80" /></div>
				<div class="member_info">
					<div class="member_info_row"><span class="member_info_label"><?php 
echo Kohana::lang('ui_admin.name');
?>
:</span> <?php 
echo $user->name;
?>
</div>
					<div class="member_info_row"><span class="member_info_label"><?php 
echo Kohana::lang('ui_admin.openids');
?>
</span>:
						<ul>
Example #28
0
 public function add_message()
 {
     $content = trim($this->input['content']);
     if (!$content) {
         $this->errorOutput(NOCONTENT);
     }
     if (!get_magic_quotes_gpc()) {
         $content = addslashes($content);
     }
     //根据发布id查询信息
     $cmid = intval($this->input['cmid']);
     if (!$cmid) {
         //非发布库内容评论要传入应用标识和模块标识
         if (!$this->input['app_uniqueid'] || !$this->input['mod_uniqueid']) {
             $this->errorOutput(NOUNIQUEID);
         }
     }
     //评论设置
     $set = $this->comment_set();
     $contentid = intval($this->input['contentid']);
     if (!$contentid) {
         $this->errorOutput(NOCONTENTID);
     }
     $display = $set['display'];
     //是否审核显示
     $max_word = $set['max_word'];
     //评论最大字数
     $login = $set['is_login'];
     //是否登录评论
     $colation = $set['colation'];
     //是否过滤
     $is_open = $set['state'];
     //评论开启关闭
     $rate = $set['rate'];
     //评论频率限制
     $allow_reply = $set['allow_reply'];
     //回复设置
     $verify_mode = $set['verify_mode'];
     //验证码
     $is_credits = $set['is_credits'];
     //未审核获取积分
     $is_credits_extra = $set['is_credits_extra'];
     //审核获取积分
     $is_diy_credits = $set['is_diy_credits'];
     //自定义积分规则
     $same_user_same_record = $set['same_user_same_record'];
     //评论功能开启/关闭
     if (!$is_open) {
         $this->errorOutput(MESSAGECLOSED);
     }
     $fid = intval($this->input['fid']);
     if ($fid && !$allow_reply) {
         $this->errorOutput(REPLYCLOSED);
     }
     //登陆评论
     if ($login) {
         if ($this->user['user_id'] < 1) {
             $this->errorOutput(NOTLOGIN);
         }
     }
     if ($max_word) {
         //评论长度判断
         $len = '';
         $len = strlen($content);
         if ($len > $max_word * 3) {
             $this->errorOutput(MAXNUM);
         }
     }
     //审核显示
     $state = $display ? 0 : 1;
     if ($app_id = $this->input['app_id']) {
         $appconfig = $this->appconfig->detail($app_id);
         if ($appconfig['comment_audit'] == 0) {
             $state = 1;
         } else {
             $state = 0;
         }
     }
     //过滤敏感词
     if ($colation && $this->settings['App_banword']) {
         include_once ROOT_PATH . 'lib/class/banword.class.php';
         $this->banword = new banword();
         $banword = $this->banword->exists($content);
         if ($banword) {
             $colation_state = '';
             if ($colation == 1) {
                 $this->errorOutput(BANWORD);
             } elseif ($colation == 2) {
                 $colation_state = 3;
             } elseif ($colation == 3) {
                 $content = $this->banword->replace($content, '*');
                 $colation_state = 0;
                 //替换后状态为未审核
             }
             //如果存在敏感词,敏感词的设置高于普通设置
             if ($colation_state) {
                 $state = $colation_state;
             }
             //记录敏感词
             $banwords = array();
             foreach ($banword as $v) {
                 $banwords[] = $v['banname'];
             }
             $banwords = implode(',', $banwords);
         }
     }
     //验证码开启并且安装验证码
     if ($this->settings['App_verifycode'] && $verify_mode) {
         if (!$this->input['not_need_verifycode']) {
             include_once ROOT_PATH . 'lib/class/verifycode.class.php';
             $this->mVerifyCode = new verifycode();
             $verifycode = trim($this->input['verify_code']);
             $session_id = trim($this->input['session_id']);
             if (!$verifycode || !$session_id) {
                 $this->errorOutput(VERIFY);
             }
             $check_result = $this->mVerifyCode->check_verify_code($verifycode, $session_id);
             //验证验证码
             if ($check_result != 'SUCCESS') {
                 $data['error'] = $check_result;
                 $this->addItem($data);
                 $this->output();
             }
         }
     }
     //兼容user_name传递用户昵称
     if ($this->input['user_name'] && !$this->input['author']) {
         $this->input['author'] = $this->input['user_name'];
     }
     $data = array('title' => urldecode($this->input['title']), 'username' => $this->user['user_name'], 'author' => trim($this->input['author']), 'member_id' => $this->user['user_id'], 'content' => $content, 'pub_time' => TIMENOW, 'ip' => hg_getip(), 'state' => $state, 'contentid' => $contentid, 'content_title' => $this->input['content_title'], 'content_url' => $this->input['content_url'], 'cmid' => $cmid, 'app_uniqueid' => $this->input['app_uniqueid'], 'mod_uniqueid' => $this->input['mod_uniqueid'], 'site_id' => $this->input['site_id'], 'column_id' => $this->input['column_id'], 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'long' => $this->input['long'], 'lati' => $this->input['lati'], 'banword' => $banwords, 'fid' => $fid, 'member_type' => intval($this->input['member_type']), 'groupid' => intval($this->input['groupid']), 'baidu_longitude' => $this->input['baidu_longitude'], 'baidu_latitude' => $this->input['baidu_latitude'], 'address' => $this->input['address']);
     //获取ip的地域信息
     if (function_exists('hg_getIpInfo')) {
         $data['ip_info'] = hg_getIpInfo($data['ip']);
     }
     //入库
     $mes = new Message();
     $res = $mes->add_message($data, $rate);
     if (!$res) {
         $this->errorOutput(RATE);
     }
     $res['pub_time'] = date('Y-m-d H:i:s', $res['pub_time']);
     /***********************调用积分规则,给已审核评论增加积分START*****************/
     if ($this->input['iscreditsrule']) {
         include ROOT_PATH . 'lib/class/members.class.php';
         $Members = new members();
         if ($this->settings['App_members']) {
             if ($res['member_id'] && $same_user_same_record) {
                 $res_total = $mes->return_count(" AND contentid=" . $res['contentid'] . " AND cmid = " . $res['cmid'] . " AND app_uniqueid = '" . $res['app_uniqueid'] . "' AND mod_uniqueid = '" . $res['mod_uniqueid'] . "' AND member_id=" . $res['member_id'], $tableName);
             }
             if ($res_total['total'] - 1 < $same_user_same_record || empty($same_user_same_record)) {
                 $Members->Initoperation();
                 //初始化
                 $Members->Setoperation(APP_UNIQUEID);
                 /***未审核增加积分**/
                 if ($is_credits && $this->user['user_id']) {
                     $credit_rules = $Members->get_credit_rules($this->user['user_id'], $data['app_uniqueid'], $data['mod_uniqueid'], $data['column_id'], $data['contentid']);
                 }
                 /***审核增加积分**/
                 if ($is_credits_extra && $res['state'] == 1 && $this->user['user_id']) {
                     $Members->Initoperation();
                     //初始化
                     $Members->Setoperation(APP_UNIQUEID, '', '', 'extra');
                     $credit_rules_extra = $Members->get_credit_rules($this->user['user_id'], $data['app_uniqueid'], $data['mod_uniqueid'], $data['column_id'], $data['contentid']);
                     $field = 'is_credits=0';
                     //已经增加积分
                 } elseif (empty($is_credits_extra)) {
                     $field = 'is_credits=-1';
                     //禁止增加积分,因为未开启审核增加积分,所以即使审核也不增加
                 }
             } else {
                 $field = 'is_credits=-1';
                 //禁止增加积分,此会员此条记录评论超过限制次数
             }
         }
         /**积分文案处理**/
         $credit_copy = array();
         if ($credit_rules['updatecredit']) {
             $credit_copy[] = $credit_rules;
         }
         if ($credit_rules_extra['updatecredit']) {
             $credit_copy[] = $credit_rules_extra;
         }
         $res['copywriting_credit'] = $Members->copywriting_credit($credit_copy);
         /**积分文案处理结束**/
     } else {
         $field = 'is_credits=-1';
         //禁止增加积分,非新会员
     }
     /**更新获得积分字段**/
     if ($field) {
         $this->db->query("UPDATE " . DB_PREFIX . "{$res['tableame']} SET " . $field . " WHERE id=" . $res['id']);
     }
     /***********************调用积分规则,给已审核评论增加积分END*****************/
     //已审核状态
     if ($res['state'] == 1) {
         /***********************即时更新内容评论计数****************************/
         if ($this->settings['App_' . $data['app_uniqueid']]) {
             $path['host'] = $this->settings['App_' . $data['app_uniqueid']]['host'];
             $path['dir'] = $this->settings['App_' . $data['app_uniqueid']]['dir'] . 'admin/';
             if ($path) {
                 $host = $path['host'];
                 $dir = $path['dir'];
                 $filename = $data['app_uniqueid'];
                 if ($filename == 'livmedia') {
                     $filename = 'vod';
                 } else {
                     if ($filename == 'cheapbuy') {
                         $filename = 'product';
                     }
                 }
                 include_once ROOT_PATH . 'lib/class/curl.class.php';
                 $curl = new curl($host, $dir);
                 $curl->setSubmitType('post');
                 $curl->initPostData();
                 $curl->addRequestData('a', 'update_comment_count');
                 $curl->addRequestData('id', $data['contentid']);
                 $curl->addRequestData('type', 'audit');
                 $curl->request($filename . '_update.php');
             }
         }
         /***********************即时更新内容评论计数****************************/
         /***********************更新会员我的评论计数****************************/
         if ($this->settings['App_members']) {
             $path['host'] = $this->settings['App_members']['host'];
             $path['dir'] = $this->settings['App_members']['dir'];
             if ($path) {
                 include_once ROOT_PATH . 'lib/class/curl.class.php';
                 $curl = new curl($path['host'], $path['dir']);
                 $curl->setSubmitType('post');
                 $curl->initPostData();
                 $curl->addRequestData('a', 'create');
                 $curl->addRequestData('mark', 'mymessage');
                 $curl->addRequestData('totalsum', 1);
                 $curl->addRequestData('summath', 1);
                 $curl->addRequestData('access_token', $this->user['token']);
                 $curl->request('member_my_update.php');
             }
         }
         /***********************更新会员我的评论计数****************************/
     }
     //统计app下面的评论计数
     if ($data['appid']) {
         $sql = "SELECT appid FROM " . DB_PREFIX . "message_appinfo WHERE appid = " . $data['appid'];
         if ($this->db->query_first($sql)) {
             $sql = "UPDATE " . DB_PREFIX . "message_appinfo SET appname='" . $data['appname'] . "',comment_num = comment_num+1 WHERE appid=" . $data['appid'];
         } else {
             $sql = "INSERT INTO " . DB_PREFIX . "message_appinfo SET appid=" . $data['appid'] . ",appname='" . $data['appname'] . "',comment_num=comment_num+1";
         }
         $this->db->query($sql);
     }
     $res['copywriting'] = '评论成功';
     $this->addItem($res);
     $this->output();
 }
Example #29
0
     $controller->set_mode($mode);
     $html = $controller->process();
     break;
 case 'logout':
     $user->set_logout();
     redirect('');
     break;
 case 'profile':
     include 'controllers/edit.class.php';
     $controller = new edit();
     $controller->set_mode($mode);
     $html = $controller->process();
     break;
 case 'members':
     include 'controllers/members.class.php';
     $controller = new members();
     $controller->set_mode($mode);
     $html = $controller->process();
     break;
 case 'infos':
     include 'controllers/infos.class.php';
     $controller = new infos();
     $controller->set_mode($mode);
     $html = $controller->process();
     break;
 case 'members.online':
     include 'controllers/members.online.class.php';
     $controller = new members_online();
     $controller->set_mode($mode);
     $html = $controller->process();
     break;
Example #30
0
 * PHP version 5
 * LICENSE: This source file is subject to LGPL license
 * that is available through the world-wide-web at the following URI:
 * http://www.gnu.org/copyleft/lesser.html
 * @author     Ushahidi Team <*****@*****.**>
 * @package    Ushahidi - http://source.ushahididev.com
 * @module     Private Messages View
 * @copyright  Ushahidi - http://www.ushahidi.com
 * @license    http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
 */
?>
<div
	class="bg">
	<h2>
	<?php 
members::private_subtabs("view");
?>
	</h2>

	<!-- tabs -->
	<div class="tabs">
		<!-- tabset -->
		<ul class="tabset">
			<li><a
				href="<?php 
echo url::site() . "members/private/index/";
?>
?type=1"
				<?php 
if ($type == '1') {
    echo "class=\"active\"";