Example #1
0
 public function index()
 {
     $smarty = get_smarty();
     $this->_header($smarty);
     $username = User::getLoginUsername();
     $smarty->assign('username', $username);
     //我的朋友
     $my_friend_url = url("myweb", "friend::myfriend");
     $smarty->assign("my_friend_url", $my_friend_url);
     //登录链接
     $login_url = url("myweb", "login::index");
     $smarty->assign("login_url", $login_url);
     //信息提醒
     $msg_url = url("myweb", "friend::msg");
     $smarty->assign("msg_url", $msg_url);
     $uid = User::getLoginUid();
     if ($uid == '1' || $uid == '2') {
         $is_love = 'yes';
         $love_url = url("myweb", "home::index", 1);
     } elseif ($uid == '3' || $uid == '4') {
         $is_love = 'yes';
         $love_url = url("myweb", "home::index", 2);
     } else {
         $is_love = 'no';
         $love_url = url("myweb", "home::index");
     }
     $smarty->assign("is_love", $is_love);
     $smarty->assign("love_url", $love_url);
     $smarty->display('myweb/usercenter/index.html');
 }
Example #2
0
 public function __construct()
 {
     if (User::getLoginUid()) {
         $url = url("myweb", "home::index");
         header("Location:{$url}");
         throw new Exception('exit');
     }
 }
Example #3
0
 public function index($love = 0)
 {
     $smarty = get_smarty();
     $this->_header($smarty);
     //用户名
     $username = User::getLoginUsername();
     $smarty->assign('username', $username);
     //是否登录
     if (User::getLoginUid()) {
         $smarty->assign("is_login", "yes");
     } else {
         $smarty->assign("is_login", "no");
     }
     if ($love == 1) {
         //h
         $smarty->display("myweb/love/index.html");
     } elseif ($love == 2) {
         //w
         $smarty->display("myweb/love/love.html");
     } else {
         //index
         $smarty->display("myweb/home/index.html");
     }
 }
Example #4
0
 public function p()
 {
     //获取列表  php
     $uid = User::getLoginUid();
     $list = UploadDir::getUploadDir($uid);
 }
Example #5
0
 public function write()
 {
     $title = isset($_POST['title']) && !empty($_POST['title']) ? htmlspecialchars(trim($_POST['title'])) : '';
     $content = isset($_POST['content']) && !empty($_POST['content']) ? htmlspecialchars(trim($_POST['content'])) : '';
     $type_id = isset($_POST['type_id']) && !empty($_POST['type_id']) ? htmlspecialchars($_POST['type_id']) : 0;
     if (!$title || !$content) {
         echo '<script>alert("请输入标题或内容"); history.go(-1);</script>';
         throw new Exception('exit');
     }
     $uid = User::getLoginUid();
     $results_insert_journal = JournalM::addJournal($type_id, $title, $content, $uid);
     if ($results_insert_journal) {
         $url = url("myweb", "journal::index", $type_id);
         header("Location:{$url}");
         throw new Exception('exit');
     } else {
         echo '<script>alert("提交失败"); history.go(-1);</script>';
         throw new Exception('exit');
     }
 }
Example #6
0
 protected function getaddrdata()
 {
     $msg = array();
     //名字
     $data['consignee'] = empty($_POST['consignee']) ? '' : htmlspecialchars(trim($_POST['consignee']));
     if (!$data['consignee']) {
         // $msg = '请输入姓名!\r\n';
         $msg['error'] = '-1';
         $msg['msg'] = '请输入姓名!';
         echo json_encode($msg);
         throw new Exception('exit');
     }
     //手机
     $data['mobile'] = empty($_POST['mobile']) ? 0 : htmlspecialchars(trim($_POST['mobile']));
     if ($data['mobile']) {
         $exp = "/^1\\d{10}\$/";
         if (!preg_match($exp, $data['mobile'])) {
             // $msg .= '输入的手机格式错误!\r\n';
             $msg['error'] = '-2';
             $msg['msg'] = '输入的手机格式错误!';
             echo json_encode($msg);
             throw new Exception('exit');
         }
     } else {
         // $msg .= '请输入手机号码!\r\n';
         $msg['error'] = '-3';
         $msg['msg'] = '请输入手机号码!';
         echo json_encode($msg);
         throw new Exception('exit');
     }
     //电话
     $tel_area = empty($_POST['tel_area']) ? '' : htmlspecialchars(trim($_POST['tel_area']));
     $data['tel'] = empty($_POST['tel']) ? '' : htmlspecialchars(trim($_POST['tel']));
     if ($data['tel']) {
         //填写了区号
         if ($tel_area) {
             $data['tel'] = $tel_area . $data['tel'];
         }
         $exp = '/^(0?(([1-9]\\d)|([3-9]\\d{2}))-?)?\\d{7,8}$/';
         if (!preg_match($exp, $data['tel'])) {
             // $msg .= '输入的固定电话错误!\r\n';
             $msg['error'] = '-4';
             $msg['msg'] = '输入的固定电话错误!';
             echo json_encode($msg);
             throw new Exception('exit');
         }
     }
     //省份
     $data['province'] = empty($_POST['province']) ? 0 : htmlspecialchars(trim($_POST['province']));
     if (!$data['province']) {
         // $msg .= '省不能为空!\r\n';
         // $msg['error'] = '-5';
         // $msg['msg'] = '省不能为空!';
         // echo json_encode( $msg );
         // throw new Exception('exit');
     }
     // Assert::num_gt_zero($data['province'], '省份不能为空');
     //城市
     $data['city'] = empty($_POST['city']) ? 0 : htmlspecialchars(trim($_POST['city']));
     if (!$data['city']) {
         // $msg .= '市不能为空!\r\n';
         // $msg['error'] = '-6';
         // $msg['msg'] = '市不能为空!';
         // echo json_encode( $msg );
         // throw new Exception('exit');
     }
     // Assert::num_gt_zero($data['city'], '城市不能为空');
     //地区
     $data['district'] = empty($_POST['district']) ? 0 : htmlspecialchars(trim($_POST['district']));
     // if( !$data['district'] ){
     // 	// $msg .= '区不能为空!\r\n';
     // 	$msg['error'] = '-7';
     // 	$msg['msg'] = '区不能为空!';
     // 	echo json_encode( $msg );
     // 	throw new Exception('exit');
     // }
     // Assert::num_gt_zero($data['district'], '区县不能为空');
     //详细地址
     $data['address'] = empty($_POST['address']) ? '' : htmlspecialchars(trim($_POST['address']));
     if (!$data['address']) {
         // $msg .= '请输入详细地址!\r\n';
         $msg['error'] = '-8';
         $msg['msg'] = '请输入详细地址!';
         echo json_encode($msg);
         throw new Exception('exit');
     }
     //是否默认地址
     $data['is_default'] = isset($_POST['is_default']) && !empty($_POST['is_default']) ? "yes" : 'no';
     //用户id
     $data['uid'] = User::getLoginUid();
     //如果有跳转地址,用户下单的时候添加地址,默认设置为默认地址
     $addr_jump_url = LuS::get('addr_jump_url');
     if (isset($addr_jump_url) && !empty($addr_jump_url)) {
         UserAddress::setDefaultAddressToNull($data['uid']);
         //去掉默认地址
         $data['is_default'] = 'yes';
         //设置当前为默认地址
     }
     if ($msg) {
         // echo "$msg";
         $msg['error'] = '-9';
         $msg['msg'] = $msg;
         echo json_encode($msg);
         throw new Exception('exit');
     }
     return $data;
 }
Example #7
0
 public function search()
 {
     $friendname = isset($_POST['friendname']) ? htmlspecialchars(trim($_POST['friendname'])) : '';
     $uid = User::getLoginUid();
     if (!$friendname || !$uid) {
         echo "0";
         throw new Exception('exit');
     }
     //利用xs来搜索
     $xs = XSD::getXS();
     $search = $xs->search;
     $user_info = $xs->setLimit(10)->search(trim($friendname));
     if ($user_info) {
         $return_info = '<ul class="list addf"><li>';
         foreach ($user_info as $key => $value) {
             $url = url("myweb", "friend::ajaxaddfriend", $value['id']);
             $return_info .= '<a href="' . $url . '" class="addfriendact">' . $value['username'] . '</a>';
         }
         $msg['err'] = '1';
         $msg['msg'] = $return_info . "</li></ul>";
     } else {
         $msg['err'] = '0';
         $msg['msg'] = '<ul class="list addf"><li><a>没有符合条件的好友</a></li></ul>';
     }
     echo json_encode($msg);
     throw new Exception('exit');
 }
Example #8
0
 public function covers($dir_id = 0)
 {
     $id = isset($_POST['id']) ? htmlspecialchars((int) $_POST['id']) : 0;
     if ($id == 0 || $dir_id == 0) {
         echo '0';
         throw new Exception('exit');
     }
     $uid = User::getLoginUid();
     UploadFile::setTitlePhoto($dir_id, $id, $uid);
     $url = url("myweb", "photo::index");
     echo $url;
     throw new Exception('exit');
 }