コード例 #1
0
ファイル: message.php プロジェクト: qiuai/qieyou
 public function is_del_feedback()
 {
     $feed_id = input_int($this->input->post('feed_id'), 1, FALSE, 0);
     $rs = $this->model->is_del_feedback($feed_id);
     if (!$rs) {
         response_code('-1');
     }
     response_code('1');
 }
コード例 #2
0
function final_response($code, $message)
{
    if (is_array($message) || is_object($message)) {
        header('Content-Type: application/json');
        $message = json_encode($message);
    } else {
        header('Content-Type: text/plain');
    }
    response_code($code);
    echo trim($message) . "\n";
    exit;
}
コード例 #3
0
ファイル: finance.php プロジェクト: qiuai/qieyou
 public function tranflow()
 {
     $inn_id = $this->get_inn_id(TRUE);
     $inn = $this->finance_model->get_user_inn_by_inn_id($inn_id, FALSE);
     if (!$inn) {
         response_code('1006');
     }
     $last_id = input_int($this->input->get('lastid'), 0, FALSE, 0);
     $limit = input_int($this->input->get('limit'), 1, 50, 20);
     $res = array();
     $data = $this->finance_model->get_account_records_by_inn_id($inn_id, $last_id, $limit);
     if ($data) {
         $month = $data[0]['create_time'];
         $first_month = date('Ym', $month);
         $month_start = strtotime($first_month . '01');
         $month_end = strtotime('+1 month', $month_start) - 1;
         $res['title'][0]['month_start'] = $month_start;
         $res['title'][0]['month_end'] = $month_end;
         $i = 0;
         foreach ($data as $key => $row) {
             if ($row['create_time'] >= $month_start) {
                 $res['title'][$i]['lastid'] = $row['record_id'];
             } else {
                 $month_start = date('Ym', $row['create_time']);
                 $month_start = strtotime($month_start . '01');
                 $month_end = strtotime('+1 month', $month_start) - 1;
                 $i++;
                 $res['title'][$i]['month_start'] = $month_start;
                 $res['title'][$i]['month_end'] = $month_end;
                 $res['title'][$i]['lastid'] = $row['record_id'];
             }
             $res['list'][] = $row;
         }
         foreach ($res['title'] as $key => $row) {
             $rs = $this->finance_model->get_mouth_transflow($inn_id, $row['month_start'], $row['month_end']);
             $res['title'][$key]['cashin'] = $rs['cashin'];
             $res['title'][$key]['cashout'] = $rs['cashout'];
         }
     } else {
         $res = array('title' => array(array('month' => strtotime(date('Ym') . '01'), 'month_end' => $_SERVER['REQUEST_TIME'], 'cashin' => '0', 'cashout' => '0', 'lastid' => '0')), 'list' => array());
     }
     response_json('1', $res);
 }
コード例 #4
0
ファイル: product.php プロジェクト: qiuai/qieyou
 private function check_product_value($type)
 {
     $data = array();
     $price = input_empty($this->input->post('price'), FALSE, '2001');
     $price = sprintf("%.2f", $price);
     if ($price < 0) {
         response_code('2001');
     }
     $old_price = input_empty($this->input->post('old_price'), 0);
     $old_price = sprintf("%.2f", $old_price);
     if ($old_price == 0) {
         $old_price = $price;
     } else {
         if ($old_price < $price) {
             response_code('2002');
         }
     }
     $data['category'] = input_int($this->input->post('category'), 1, FALSE, FALSE, '2003');
     $data['category_id'] = input_int($this->input->post('category_id'), 1, FALSE, FALSE, '2004');
     $data['tuan_end_time'] = $this->input->post('tuan_end_time') ? strtotime($this->input->post('tuan_end_time')) : '';
     $data['tuan_end_time'] = input_int($data['tuan_end_time'], $_SERVER['REQUEST_TIME'], $_SERVER['REQUEST_TIME'] + 31536000, $_SERVER['REQUEST_TIME'] + 31536000);
     //有效期1年以内 过期下架
     if ($type == 'tuan') {
         $profit = input_empty($this->input->post('profit'), FALSE, '2005');
         $profit = sprintf("%.2f", $profit);
         if ($profit < 0) {
             response_code('2005');
         }
         $purchase_price = input_empty($this->input->post('purchase_price'), FALSE, '2006');
         $purchase_price = sprintf("%.2f", $purchase_price);
         if ($purchase_price < 0) {
             response_code('2006');
         }
         $agent = $price - $profit - $purchase_price;
         if ($agent < 0) {
             response_code('2007');
         }
         $agent = sprintf("%.2f", $agent);
         $facility = $this->input->post('receipt') ? 'receipt' : '';
         $data['agent'] = $agent;
         $data['purchase_price'] = $purchase_price;
         $data['facility'] = $facility;
     }
     $data['is_express'] = $this->input->post('is_express') ? '1' : '0';
     $data['product_name'] = input_empty($this->input->post('product_name', TRUE), FALSE, '2008');
     $data['price'] = $price;
     $data['old_price'] = $old_price;
     $data['quantity'] = input_int($this->input->post('quantity'), 0, FALSE, FALSE, '2009');
     $data['note'] = $this->input->post('note', TRUE);
     $data['booking_info'] = $this->input->post('booking_info', TRUE);
     $data['thumb'] = input_empty($this->input->post('thumb'), '');
     $data['product_images'] = input_empty($this->input->post('images', TRUE), FALSE, '2010');
     $data['detail_images'] = input_empty($this->input->post('detail_images'), array());
     $gallery = array();
     foreach ($data['product_images'] as $key => $row) {
         $info = explode('.', strrev($row));
         $gallery[] = strrev($info[1]) . 'm.' . strrev($info[0]);
         if ($key == 0) {
             $data['thumb'] = strrev($info[1]) . 's.' . strrev($info[0]);
         }
     }
     if (empty($data['thumb'])) {
         response_code('2011');
     }
     $data['product_images'] = implode(',', $data['product_images']);
     $data['gallery'] = implode(',', $gallery);
     $data['detail_images'] = implode(',', $data['detail_images']);
     $data['content'] = input_empty($this->input->post('content'), '');
     return $data;
 }
コード例 #5
0
    if (is_dir($file) || empty($file)) {
        continue;
    }
    $assetKey = calc_asset_key($file);
    //Get the extension
    $extension = pathinfo($assetKey, PATHINFO_EXTENSION);
    if (is_binary($file)) {
        $filecontents = base64_encode(file_get_contents($file));
        $reqData = sprintf($xmlDataTempImage, $filecontents, $assetKey);
    } else {
        $filecontents = htmlspecialchars(file_get_contents($file), ENT_QUOTES, 'UTF-8');
        $reqData = sprintf($xmlDataTemp, $filecontents, $assetKey);
    }
    //Dump the xml into a tmp file
    $xmlFile = tempnam('/tmp', 'foo') . '.xml';
    file_put_contents($xmlFile, $reqData);
    echo "Sending asset: {$assetKey}...<br>";
    $response = send_asset($api_key, $password, $store, $xmlFile);
    if ('200' == response_code($response)) {
        echo "Uploaded: {$assetKey}<br>";
    } else {
        // Not ideal, but it works. Problem (though not much of one ):
        // response on a fail will return the full curl page: ie, shopify 404 full html, + error code at the bottom
        // Will robustify if it becomes an issue.
        echo "*Error: Could not upload {$assetKey} to {$config->current}.";
        output_error($response, array('line_break' => '<br>'));
    }
    //And clean up
    unlink($xmlFile);
}
echo 'Done.';
コード例 #6
0
ファイル: MY_Controller.php プロジェクト: qiuai/qieyou
 /**
  * 获取当前用户id
  */
 public function get_user_id($exit = FALSE)
 {
     $user_id = $this->web_user->get_user_id();
     if ($user_id) {
         return $user_id;
     } else {
         if ($exit) {
             if (is_ajax() || is_post()) {
                 response_code('1001');
             } else {
                 header("Location: " . base_url() . 'login?url=' . base_url() . trim($_SERVER['REQUEST_URI'], '/') . "");
                 exit;
             }
         }
     }
     return NULL;
 }
コード例 #7
0
ファイル: special.php プロジェクト: qiuai/qieyou
 /**
  * 收藏店铺
  **/
 public function innlike()
 {
     $user_id = $this->get_user_id(TRUE);
     $inn_id = input_int($this->input->get('sid'), 1, FALSE, FALSE, '4001');
     $act = input_string($this->input->get('act'), array('like', 'unlike'), FALSE, '4001');
     $inn = $this->model->get_inn_info_by_ids($inn_id);
     if (!$inn) {
         response_code('2010');
     }
     if ($act == 'like') {
         $is_like = $this->model->check_inn_fav($inn_id, $user_id);
         if ($is_like) {
             response_code('2012');
         }
     } else {
         $is_like = $this->model->check_inn_fav($inn_id, $user_id);
         if (!$is_like) {
             response_code('2011');
         }
     }
     $inn_info = array('dest_id' => $inn[$inn_id]['dest_id'], 'local_id' => $inn[$inn_id]['local_id']);
     if ($this->model->inn_fav($act, $inn_id, $user_id, $inn_info)) {
         response_code('1');
     }
     response_code('-1');
 }
コード例 #8
0
ファイル: inns.php プロジェクト: qiuai/qieyou
 private function check_inn_info()
 {
     $innInfo = array();
     $innInfo['inn_name'] = check_empty(trimall(strip_tags($this->input->post('inn_name', TRUE))), FALSE, '1010');
     $innInfo['dest_id'] = input_int($this->input->post('dest_id'), 1, FALSE, FALSE, '1011');
     $innInfo['local_id'] = input_int($this->input->post('local_id'), 1, FALSE, FALSE, '1012');
     $profit = check_empty($this->input->post('profit'), FALSE, '1013');
     $innInfo['profit'] = sprintf("%.2f", $profit);
     if ($innInfo['profit'] < 0 || $innInfo['profit'] > 100) {
         response_code('1013');
     }
     $innInfo['inner_contacts'] = check_empty(trimall(strip_tags($this->input->post('inner_contacts'))), FALSE, '1014');
     $innInfo['inner_moblie_number'] = input_mobilenum($this->input->post('inner_moblie_number'), '1015');
     //默认为用户账号(手机号)
     $bdlon = number_format(check_empty($this->input->post('bdlon'), FALSE, '1016'), 7, '.', "");
     $bdlat = number_format(check_empty($this->input->post('bdlat'), FALSE, '1016'), 7, '.', "");
     $gps = BD09LLtoWGS84($bdlon, $bdlat);
     $innInfo['lon'] = $gps[0];
     $innInfo['lat'] = $gps[1];
     $innInfo['bdgps'] = $bdlon . ',' . $bdlat;
     /*	$innInfo['bank_info'] = check_empty(trimall(strip_tags($this->input->post('bank_info'))),FALSE,'1017');
     		$innInfo['bank_account_no'] = input_num(trimall($this->input->post('bank_account_no')),FALSE,FALSE,FALSE,'1018');
     		$innInfo['bank_account_no'] = check_luhn($innInfo['bank_account_no'],'1018');
     		$innInfo['bank_account_name'] = check_empty(trimall(strip_tags($this->input->post('bank_account_name'))),FALSE,'1019');
     	*/
     $innInfo['bank_info'] = $this->input->post('bank_info', TRUE);
     $innInfo['bank_account_no'] = $this->input->post('bank_account_no', TRUE);
     $innInfo['bank_account_name'] = $this->input->post('bank_account_name', TRUE);
     $innInfo['inner_telephone'] = check_empty(trimall(strip_tags($this->input->post('inner_telephone'))), '');
     $innInfo['inn_address'] = check_empty(trimall(strip_tags($this->input->post('inn_address'))), FALSE, '1020');
     return $innInfo;
 }
コード例 #9
0
ファイル: sysconfig.php プロジェクト: qiuai/qieyou
 public function is_del_group()
 {
     $group_id = input_int($this->input->post('group_id'), 1, FALSE, 0);
     $rs = $this->model->is_del_group($group_id);
     if (!$rs) {
         response_code('-1');
     }
     response_code('1');
 }
コード例 #10
0
ファイル: item.php プロジェクト: qiuai/qieyou
 /**
  * 收藏商品
  **/
 public function itemlike()
 {
     $user_id = $this->get_user_id(TRUE);
     $product_id = input_int($this->input->get('item_id'), 1, FALSE, FALSE, '2001');
     $act = input_string($this->input->get('act'), array('like', 'unlike'), FALSE, '4001');
     $product = $this->model->get_product_by_product_id($product_id);
     if (!$product) {
         response_code('2001');
     }
     if ($act == 'like') {
         $is_like = $this->model->check_product_fav($product_id, $user_id);
         if ($is_like) {
             response_code('2014');
         }
     } else {
         $is_like = $this->model->check_product_fav($product_id, $user_id);
         if (!$is_like) {
             response_code('2013');
         }
     }
     if ($this->model->product_fav($act, $product, $user_id)) {
         response_code('1');
     }
     response_code('-1');
 }
コード例 #11
0
ファイル: functions_helper.php プロジェクト: qiuai/qieyou
function input_identity_number($idcard, $msg)
{
    $id_cardlen = strlen($idcard);
    if ($id_cardlen == 15) {
        // 如果身份证顺序码是996 997 998 999,这些是为百岁以上老人的特殊编码
        if (array_search(substr($idcard, 12, 3), array('996', '997', '998', '999')) !== false) {
            $idcard = substr($idcard, 0, 6) . '18' . substr($idcard, 6, 9);
        } else {
            $idcard = substr($idcard, 0, 6) . '19' . substr($idcard, 6, 9);
        }
        $idcard = $idcard . idcard_verify_number($idcard);
        return $idcard;
    }
    if ($id_cardlen == 18) {
        $idcard_base = substr($idcard, 0, 17);
        if (idcard_verify_number($idcard_base) == strtoupper(substr($idcard, 17, 1))) {
            return $idcard;
        }
    }
    response_code($msg);
}
コード例 #12
0
    define('LOKI_JS_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'js');
}
function response_code($code, $description = '')
{
    $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
    header($protocol . ' ' . (string) $code . ' ' . $description);
}
$finder = new Loki2ScriptFinder(LOKI_2_PATH . 'js');
if (!$finder->files) {
    response_code(500, 'Internal Server Error');
    header('Content-Type: text/plain');
    echo 'Failed to open the Loki directory ' . LOKI_2_PATH . 'js';
    exit;
}
$latest_modified = $finder->latest_modified_time;
header('Last-Modified: ' . gmstrftime('%a %d %b %Y %H:%M:%S GMT', $latest_modified));
header('Language: en-us');
header('Cache-Control: public');
header('Cache-Control: must-revalidate', false);
header('Content-Type: application/javascript; charset=utf-8');
if ($max_age === null && $latest_modified <= $ims || $latest_modified + $max_age > time()) {
    response_code(304, 'Not Modified');
    exit;
}
echo "// Loki WYSIWIG Editor 2.0\n";
echo '// Compiled ', strftime('%Y-%m-%d %H:%M:%S UTC%z'), "\n\n";
foreach ($finder->files as $file) {
    $path = path_join(LOKI_2_PATH . 'js', $file);
    echo "\n// file {$file} \n\n";
    readfile($path);
}
コード例 #13
0
/**
 * Remove an Asset from Shopify
 *
 * @param string $api_key
 * @param string $password 
 * @param string $store
 * @param string $key Key of asset we are downloading
 * @return object Asset / false on failure
 **/
function remove_asset($api_key, $password, $store, $key)
{
    //Request Asset URL Template
    // %1: API KEY, %2: PASSWORD, %3: STORE, %4: ASSET NAME
    $requestUrl = sprintf('https://%1$s:%2$s@%3$s/admin/assets.json?asset[key]=%4$s', $api_key, $password, $store, $key);
    $response = `curl -w'%{http_code}' -X DELETE -s -g '{$requestUrl}'`;
    if (response_code($response) == 200) {
        return true;
    }
    return false;
}
コード例 #14
0
ファイル: login.php プロジェクト: qiuai/qieyou
 public function changePwd()
 {
     $userId = $this->get_user_id(TRUE);
     $oldpassword = check_empty($this->input->post('password'), FALSE, '1004');
     //仅验证是否填写
     $new_password = check_empty($this->input->post('newPassword'), FALSE, '5004');
     $repassword = check_empty($this->input->post('confirm'), FALSE, '5004');
     if ($new_password != $repassword) {
         response_code('5005');
     }
     $passlen = strlen($new_password);
     if ($passlen < 6 || $passlen > 16) {
         response_code('5004');
     }
     $user = $this->model->get_user_auth_by_name($userId, TRUE);
     if (!$user) {
         response_code('4005');
     }
     if (md5(md5($oldpassword) . $user['salt']) != $user['user_pass']) {
         response_code('5006');
     }
     if ($oldpassword != $new_password) {
         $user['user_id'] = $userId;
         $user['salt'] = getRandChar(4);
         $user['user_pass'] = md5(md5($new_password) . $user['salt']);
         if (!$this->model->update_user_password($user)) {
             response_code('4000');
         }
     }
     response_code('1');
 }
コード例 #15
0
ファイル: order.php プロジェクト: qiuai/qieyou
 /**
  * 订单支付
  **/
 public function pay()
 {
     $user_id = $this->get_user_id(TRUE);
     $order_num = input_num($this->input->get('order'), 10000, FALSE, FALSE, '3001');
     $order = $this->model->get_order_detail_by_order_num($order_num, $user_id);
     if (!$order) {
         response_code('3001');
     }
     if ($order['state'] !== 'A' || $order['create_time'] < TIME_NOW - 7200) {
         response_code('3004');
     }
     header("Location: http://www.totour.com/trans/payCenter?from=Wap_C_Phone&oid=" . $order_num . "");
     exit;
 }
コード例 #16
0
ファイル: forums.php プロジェクト: qiuai/qieyou
 public function re_group()
 {
     $group_id = $this->input->post('group_id');
     $groups = $this->model->get_group($group_id);
     if (!$groups) {
         response_code('1034');
     }
     exit;
 }
コード例 #17
0
ファイル: order.php プロジェクト: qiuai/qieyou
 /**
  * 订单退订入口
  * ajax POST
  */
 public function cancel()
 {
     $order_num = input_num($this->input->post('order_num'), 10000);
     $comment = check_empty($this->input->post('comment', TRUE), FALSE, '备注不能为空!');
     if (!$this->check_order_manage_auth_in_controller()) {
         response_code('-1', '权限验证失败!');
     }
     $order = $this->check_order_exist_post($order_num);
     if (!in_array($order['state'], array('P', 'U'))) {
         response_code('-2', '当前订单不能退订');
     }
     $done = array('user_id' => $this->get_user_id(), 'comment' => $comment);
     $rs = $this->model->order_cancel($order, $done);
     response_code($rs ? '1' : '4000');
 }
コード例 #18
0
ファイル: user.php プロジェクト: qiuai/qieyou
 /**
  * 删除我的帖子  我的回帖   type:forum 话题 post 回帖
  **/
 public function delMyForum()
 {
     $user_id = $this->get_user_id(TRUE);
     $type = input_string($this->input->post('type'), array('forum', 'post'), FALSE, '4001');
     $type_id = input_int($this->input->post('typeid'), 1, FALSE, FALSE, '4001');
     switch ($type) {
         case 'forum':
             $forum = $this->model->get_user_forum_by_id($type_id);
             if (!$forum || $forum['is_delete']) {
                 response_code('6004');
             }
             if ($forum['create_user'] != $user_id) {
                 response_code('6005');
             }
             $rs = $this->model->delete_forum_by_id($forum);
             break;
         case 'post':
             $post = $this->model->get_user_post_by_id($type_id);
             if (!$post || $post['is_delete']) {
                 response_code('6025');
             }
             if ($post['create_user'] != $user_id) {
                 response_code('6005');
             }
             $rs = $this->model->delete_post_by_id($post);
             break;
     }
     if ($rs) {
         response_code('1');
     }
     response_code('4000');
 }
コード例 #19
0
ファイル: finance.php プロジェクト: qiuai/qieyou
 /**
  * 处理退款申请
  * ajax POST
  */
 public function orderRefund()
 {
     $this->check_finance_auth_in_controller();
     $action = input_string($this->input->post('action'), array('rejected', 'settled'), 'rejected');
     $sanction = $this->input->post('sanction', TRUE);
     $refund_id = input_int($this->input->post('refund_id'), 1, FALSE, FALSE, '请求错误!');
     switch ($action) {
         case 'rejected':
             //关闭入口
             show_404();
         case 'settled':
             $refund = $this->model->get_order_refund_by_id($refund_id);
             break;
     }
     if (!$refund || $refund['state'] != 'applying') {
         response_msg("请求错误!");
     }
     $done = array('user_id' => $this->get_user_id(), 'sanction' => $sanction);
     $rs = $this->model->settled_order_refund($refund, $done);
     response_code($rs ? '1' : '-1');
 }
コード例 #20
0
ファイル: MY_Controller.php プロジェクト: qiuai/qieyou
 /**
  * 获取当前用户id
  */
 public function get_user_id($exit = FALSE)
 {
     if (empty($this->token['user_id'])) {
         if ($this->check_token()) {
             return $this->token['user_id'];
         }
         if ($exit) {
             response_code('4004');
         } else {
             return FALSE;
         }
     }
     return $this->token['user_id'];
 }
コード例 #21
0
ファイル: coupon.php プロジェクト: qiuai/qieyou
 public function is_del()
 {
     $quan_id = input_int($this->input->post('quan_id'), 1, FALSE, 0);
     $rs = $this->model->del_coupon($quan_id);
     if (!$rs) {
         response_code('-1');
     }
     response_code('1');
 }
コード例 #22
0
ファイル: order.php プロジェクト: qiuai/qieyou
 /**
  * 商品评价提交
  * 
  **/
 public function commentPost()
 {
     $user_id = $this->get_user_id(TRUE);
     $order_num = input_num($this->input->post('order'), 10000, FALSE, FALSE, '3001');
     $data['points'] = input_int($this->input->post('stars'), 1, 5, FALSE, '3011');
     $data['note'] = $this->input->post('note');
     $data['picture'] = rtrim($this->input->post('images'), ',');
     if (!$data['picture'] && !$data['note']) {
         response_code('3012');
     }
     $data['has_pic'] = $data['picture'] ? 1 : 0;
     $order = $this->model->get_order_detail_by_order_num($order_num, $user_id);
     if (!$order) {
         response_code('3001');
     }
     if ($order['commented']) {
         response_code('3013');
     }
     $data['user_id'] = $order['user_id'];
     $data['product_id'] = $order['product_id'];
     $rs = $this->model->add_product_comment($order_num, $data);
     if ($rs) {
         response_code('1');
     }
     response_code('4000');
 }
コード例 #23
0
ファイル: forum.php プロジェクト: qiuai/qieyou
 private function check_forum_post($type)
 {
     $forum = array();
     $forum['city'] = check_empty(trimall(strip_tags($this->input->post('city'))), '');
     $forum['lat'] = checkLocationPoint($this->input->post('lat'), 'lat', '');
     //坐标可不传
     $forum['lon'] = checkLocationPoint($this->input->post('lon'), 'lon', '');
     if (empty($forum['lat']) || empty($forum['lon'])) {
         $forum = array();
     }
     $forum['forum_name'] = check_empty(trimall(strip_tags($this->input->post('title'))), '', '6014');
     $forum['type'] = $type;
     $tags = check_empty(trimall(strip_tags($this->input->post('tags'))), '');
     if ($tags) {
         $detail['tags'] = array();
         $tags = explode(',', $tags);
         foreach ($tags as $key => $row) {
             if (!$row) {
                 continue;
             }
             if (mb_strlen($row) > 6) {
                 response_json('6033', '标签:"' . $row . '" 字数过长');
             }
             $detail['tags'][] = $row;
         }
         if (count($detail['tags']) > 3) {
             response_code('6032');
         }
         $detail['tags'] = implode(',', $detail['tags']);
     } else {
         $detail['tags'] = '';
     }
     $detail['note'] = check_empty(strip_tags($this->input->post('note')), '');
     $detail['pictures'] = trimall(strip_tags($this->input->post('images', TRUE)));
     if ($type == 'jianren') {
         $detail['line'] = check_empty(trimall(strip_tags($this->input->post('line', TRUE))), FALSE, '6016');
         if (empty($forum['forum_name'])) {
             $forum['forum_name'] = $detail['line'];
         }
         $start_time = check_empty($this->input->post('start_time'), FALSE, '6017');
         if (substr_count($start_time, '-') != 2) {
             response_code('6024');
         }
         list($year, $month, $day) = explode('-', $start_time);
         if (!$year || !$month || !$day || !checkdate($month, $day, $year)) {
             response_code('6024');
         }
         $start_time = strtotime($start_time);
         if (!$start_time || $start_time < TIME_NOW - 86500 || $start_time > TIME_NOW + 31536000) {
             response_code('6024');
         }
         $detail['start_time'] = $start_time;
         $detail['day'] = input_int($this->input->post('day'), 0, 250, FAlSE, '6015');
     } else {
         $detail['pictures'] = check_empty($detail['pictures'], FALSE, '6013');
     }
     if (empty($forum['forum_name'])) {
         response_code('6014');
     }
     return array('forum' => $forum, 'detail' => $detail);
 }
コード例 #24
0
ファイル: functions_helper.php プロジェクト: qiuai/qieyou
function checkLocationPoint($val, $type = 'lat', $default = FALSE)
{
    if (empty($val) && $val !== '0') {
        if ($default !== FALSE) {
            return $default;
        }
        response_code($type == 'lat' ? '4007' : '4008');
    }
    if (!is_float($val) && !is_numeric($val)) {
        if ($default !== FALSE) {
            return $default;
        }
        response_code($type == 'lat' ? '4007' : '4008');
    }
    $val = (double) $val;
    if ($type == 'lat') {
        if (abs($val) > 90) {
            if ($default !== FALSE) {
                return $default;
            }
            response_code('4007');
        }
    } else {
        if (abs($val) > 180) {
            if ($default !== FALSE) {
                return $default;
            }
            response_code('4008');
        }
    }
    return number_format($val, 7, '.', '');
}
コード例 #25
0
ファイル: home.php プロジェクト: qiuai/qieyou
 private function check_user_info_value()
 {
     $nickname = $this->input->post('nickname', TRUE);
     $headimg = $this->input->post('headimg', TRUE);
     $signature = $this->input->post('signature', TRUE);
     $birthday = $this->input->post('birthday', TRUE);
     $sex = $this->input->post('sex', TRUE);
     $user = array();
     if ($nickname) {
         $user['nick_name'] = check_empty(trimall(strip_tags($nickname)), FALSE, '1023');
     }
     if ($headimg) {
         $user['headimg'] = check_empty(trimall(strip_tags($headimg)), FALSE, '1024');
     }
     if ($signature) {
         $user['signature'] = check_empty(trimall(strip_tags($signature)), FALSE, '1025');
     }
     if ($birthday) {
         $birthday = check_birthday($birthday);
         if (!$birthday) {
             response_code('1022');
         }
         $user['birthday'] = $birthday;
     }
     if ($sex) {
         $user['sex'] = input_string($sex, array('F', 'M'), FALSE, '1021');
     }
     return $user;
 }
コード例 #26
0
ファイル: home.php プロジェクト: qiuai/qieyou
 private function check_user_data($class)
 {
     if ($class == 'address') {
         $address = array();
         $address['real_name'] = check_empty(trimall(strip_tags($this->input->post('real_name'))), FALSE, '1014');
         $address['mobile'] = input_mobilenum($this->input->post('mobile'), '5001');
         $address['location_id'] = input_int($this->input->post('local_id'), 100000, 1000000, FALSE, '1015');
         $address['address'] = check_empty(trimall(strip_tags($this->input->post('address'))), FALSE, '1016');
         $local = check_empty($this->model->get_local_info($address['location_id']), FALSE, '1015');
         $address['location'] = $local['sheng']['name'] . $local['shi']['name'] . $local['city']['name'];
         return $address;
     } else {
         if ($class == 'identify') {
             $identify = array();
             $identify['real_name'] = check_empty(trimall(strip_tags($this->input->post('real_name'))), FALSE, '1014');
             $identify['idcard'] = input_identity_number($this->input->post('idcard'), '1019');
             return $identify;
         } else {
             response_code('4001');
         }
     }
 }
コード例 #27
0
ファイル: group.php プロジェクト: qiuai/qieyou
 private function check_user_group_auth($user_id, $group_id)
 {
     $group = $this->model->get_group_info_by_id($group_id, TRUE);
     //这里需要直连DB
     if (!$group) {
         response_code('6002');
     }
     $group = $group[$group_id];
     $admins = explode(',', $group['admins']);
     if (!in_array($user_id, $admins)) {
         response_code('6005');
     }
     return $group;
 }
コード例 #28
0
ファイル: login.php プロジェクト: qiuai/qieyou
 /**
  * 注册用户
  **/
 public function userregpost()
 {
     $username = checkUserName($this->input->post('username'), '1002');
     $identifycode = check_empty($this->input->post('identifycode'), FALSE, '5002');
     $password = check_empty($this->input->post('password'), FALSE, '1003');
     $passlen = strlen($password);
     if ($passlen < 6 || $passlen > 16) {
         response_code('1003');
     }
     /*	$user_mobile = $this->get_current_data('check_mobile');
     		if($user_mobile != $username)
     		{
     			response_code('5002');
     		}*/
     $user_mobile = $username;
     $mobile_cache = $this->model->check_mobile_send($user_mobile);
     //缓存取数据
     if (!$mobile_cache) {
         response_code('5012');
     }
     if ($identifycode != $mobile_cache['mobile_identify']) {
         response_code('5002');
     }
     $user = array('password' => $password, 'mobile' => $user_mobile);
     $user['salt'] = getRandChar(4);
     $user_id = $this->model->reg_user($user);
     if ($user_id) {
         $this->model->delete_mobile_identify($user_mobile);
         /*$session = array(
         			'user_id' => $user_id,
         			'user_name' => $user_mobile,
         			'nick_name' => '手机用户',
         		);
         		$this->set_current_data($session);*/
         //帮助用户登录
         $user['user_id'] = $user_id;
         $token = $this->create_token($user);
         response_json('1', array('token' => $token));
     }
     response_code('4000');
 }