/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $user = Sp_Account_User::current(); $nowtime = time(); // 当前页数 $nowPage = $request->page; empty($nowPage) && ($nowPage = 1); $limitRow = ($nowPage - 1) * self::PAGE_SIZE; // 分页数据 $array = Sp_Active_Active::getListByUser($user->id, "a.isdel = 0 and a.activit_end < {$nowtime}", $limitRow, self::PAGE_SIZE); // 分页 $pageString = Sp_Active_Active::getPageString($user->id, $nowPage, self::PAGE_SIZE, "isdel = 0 and activit_end < {$nowtime}"); $data = array(); if (is_array($array)) { $data['status'] = '0'; $data['data'] = $array; $data['msg'] = ''; $data['nowtime'] = $nowtime; $data['pageString'] = $pageString; } else { $data['status'] = '-1'; $data['data'] = array(); $data['msg'] = ''; } return $data; } }
public function execute($request) { if ($request->format == 'json') { $user = Sp_Account_User::current(); $userid = $user->id; $row = Sp_Account_User::getUser($userid); $old = $request->old; $password = $request->password; $confirming = $request->confirming; $patternPasswd = Sp_Dictionary::getOtherOption('patternPasswd'); if (false == preg_match($patternPasswd, $old)) { return array('status' => '-122', 'msg' => '密码格式不正确'); } if (false == preg_match($patternPasswd, $confirming)) { return array('status' => '-122', 'msg' => '密码格式不正确'); } if (false == preg_match($patternPasswd, $password)) { return array('status' => '-122', 'msg' => '密码格式不正确'); } // 旧密码 if (!$this->checkOldPassword($old, $row)) { return array('status' => '-1', 'msg' => '旧密码不正确'); } if ($password != $confirming) { return array('status' => '-2', 'msg' => '两次密码不一致'); } $newpwd = Sp_Account_User::encrypt($password, $row['kid']); Sp_Account_Info::updatePassword($userid, $newpwd); return array('status' => '0', 'msg' => '密码修改成功'); } }
public function execute($request) { if ($request->format == 'json') { $data = array(); $email = $request->email; $mobile = $request->mobile; $patternEmail = Sp_Dictionary::getOtherOption('patternEmail'); $patternMobile = Sp_Dictionary::getOtherOption('patternMobile'); if (false == preg_match($patternEmail, $email)) { return array('status' => '-120', 'msg' => '邮件格式不正确'); } else { if (false == preg_match($patternMobile, $mobile)) { return array('status' => '-121', 'msg' => '电话格式不正确'); } } $user = Sp_Account_User::current(); $data['name'] = $request->name; $data['gender'] = $request->gender; $data['mobile'] = $mobile; $data['email'] = $email; $data['province'] = $request->province; $data['city'] = $request->city; $data['area'] = $request->area; $data['face'] = $request->face; $ret = Sp_Account_Info::updateUser($user->id, $data); return array('status' => '0', 'msg' => '成功'); } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $user = Sp_Account_User::current(); $aid = $request->id; if (!is_numeric($aid)) { $data = array(); $data['status'] = '-1'; $data['msg'] = '提交数据有误'; return $data; } // 当前页数 $nowPage = $request->page; empty($nowPage) && ($nowPage = 1); $limitRow = ($nowPage - 1) * self::PAGE_SIZE; // 分页数据 $array = Sp_Letter_Letter::getListByUser($user->id, $aid, $limitRow, self::PAGE_SIZE); $total = Sp_Letter_Letter::getTotalByUser($user->id, $aid); if (is_array($array) && count($array)) { $cry = new Util_Crypt3Des(); foreach ($array as $key => $value) { $id = $cry->encrypt($value['id']); $id = base64_encode($id); $array[$key]['sid'] = $id; } } // 分页 $pager = new Util_Pager($total, $nowPage, self::PAGE_SIZE); $pageString = $pager->renderNav(true); $data = array(); if (is_array($array)) { $data['status'] = '0'; $data['data'] = $array; $data['msg'] = ''; $data['pageString'] = $pageString; $data['nowtime'] = time(); } else { $data['status'] = '-1'; $data['data'] = array(); $data['msg'] = ''; } return $data; } else { $aid = $request->id; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $view = new Sp_View(); $view->assign('active', $active); $view->assign('select', 'letter'); $view->display("letter/index.html"); } }
public function __construct() { $user = Sp_Account_User::current(); if ($user->isLogin() === FALSE) { //未登录跳转 header("Location: " . SP_URL_HOME); exit; } }
public function __construct($config) { $user = Sp_Account_User::current(); $where = array('id' => @$_REQUEST['activeId'], 'user_id' => $user->id ? $user->id : $config); if ($where['id']) { $result = Da_Wrapper::select()->table("sp.huitong.ht_active")->columns('id')->where($where)->getOne(); if (false == $result) { exit("参数错误"); } } }
public function execute($request) { global $priv; $user = Sp_Account_User::current(); $user = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area')); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $view = new Sp_View(); $view->assign('user', $user); $view->assign('action', $priv); $view->assign('uploadInfo', $uploadInfo); $view->display("account/password.html"); }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; if (!is_numeric($id)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $rs = Sp_Letter_Letter::delByPrimarykey($id, $user->id); return array('status' => '0', 'msg' => '删除成功'); } }
public function execute($request) { $user = Sp_Account_User::current(); if ($user->isLogin() === FALSE) { //未登录跳转 echo 'document.write(\'<div class="menu"><a href="javascript:void(0);" ms-click="showlogin" class="ht-btn-blue">登录</a><a href="javascript:void(0);" ms-click="showreg" class="ht-btn-gray">注册</a></div>\')'; } else { $userInfo = Sp_Account_User::getUser($user->id, array('face')); $pic = empty($userInfo['face']) ? SP_URL_IMG . 'dzx.jpg' : SP_URL_UPLOAD . $userInfo['face']; $html = '<div class="ht-user">' . '<a href="javascript:void(0);" class="ht-user-navlink show">' . '<img src="' . $pic . '" /></a>' . '<div class="ht-user-dropdown">' . '<a href="/active/index.html" class="line">' . '<i class="ht-topNav-icon01"></i>' . '<span>我的活动</span></a>' . '<a href="/account/index.html" >' . '<i class="ht-topNav-icon02"></i><span>我的信息</span></a>' . '<a href="/account/password.html" class="line">' . '<i class="ht-topNav-icon03"></i>' . '<span>修改密码</span></a>' . '<a href="/user/signout.html" >' . '<i class="ht-topNav-icon05"></i>' . '<span>退出</span></a></div></div>'; echo 'document.write(\'' . $html . '\')'; } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $aid = $request->aid; if (!is_numeric($id) || !is_numeric($aid)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (is_array($active) && count($active) > 1) { $at = Sp_Account_Attendee::getAttendeeById($id); if ($at['activeId'] == $aid && $at['status'] == 0 && ($at['checkStatus'] == 0 || $at['checkStatus'] == 1)) { $row = Sp_Sendmsg::getSmsByPhone($at['phone'], 'attendee'); if (is_array($row) && count($row) < 3) { $nowDate = date("Y-m-d", time()); $msgDate = date("Y-m-d", $row['crttime']); if ($nowDate == $msgDate) { return array('status' => '-126', 'msg' => '该电子票已在当天发送过,不能重复发送。', 'data' => $shortArr); } } $code = $this->getSignIdCode($at); if (false == $code) { return array('status' => '-1', 'msg' => '生成电子票失败'); } $url = SP_URL_HOME . "attendee/code/" . $code . ".html"; $shortArr = Util_ShortUrl::shortSina($url); if ($shortArr === FALSE) { return array('status' => '-1', 'msg' => '生成电子票失败'); } else { $content = $at['name'] . "你好:你已报名成功" . $active['title'] . ",会议时间:" . date("Y-m-d H:i", $active['activit_start']) . " ~ " . date("Y-m-d H:i", $active['activit_start']) . ",会议地点:" . $active['address'] . "。您的电子票为" . $shortArr['url_short'] . ",签到码为" . $code . ",请保留此短信至会议结束。"; $sms = array(); $sms['username'] = $at['phone']; $sms['content'] = $content; $sms['type'] = 'attendee'; $sms['user_id'] = $user->id; Sp_Sendmsg::send($sms); if ($at['checkStatus'] == 0) { Sp_Account_Attendee::success($id); } return array('status' => '0', 'msg' => '发送成功'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } }
/** * function description * * @param * @return void */ public function execute($request) { /*$total = 90; $page = 8; $size = 10; $pager = new Util_Pager($total, $page, $size, "?page=%d&activeId=19"); $offset = $pager->getOffset(); $pager->setTotal($total); echo $pager->renderNav();*/ $model = new Sp_Account_Attendee(); $activeId = $request->activeId; $header = $model->GetTableHeaderByActiveId($activeId); if (false == $header) { $showHeader = $this->headers; } else { $showHeader = $this->getShowHeader($header); $showHeader = $model->getColumnFormArr($showHeader, 'title', 'field'); } $columns = array_keys($showHeader); array_push($columns, 'id'); $columns[] = 'status'; $columns[] = 'checkStatus'; $dataProvide = $model->AttendeeList($activeId, $columns); if ($request->format == 'json') { $arrary = array(); return $array; } else { /*$user = Sp_Account_User::current(); $user = Sp_Account_User::load($user->id);*/ $aid = $request->activeId; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $view = new Sp_View(); $view->assign('active', $active); $view->assign('data', $dataProvide[1]); $view->assign('page', $dataProvide[0]); $view->assign('header', $showHeader); $view->assign('headerSet', json_encode($header)); $view->assign('activeId', $activeId); $view->assign('uploadInfo', $uploadInfo); $view->display("attendee/index.html"); } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $t = $request->type; if ('music' == $t) { $up = new Util_Upload(array('savepath' => UPLOAD_ROOT . 'music', 'subdirpattern' => 'Y/m/d', 'israndname' => true, 'allowtype' => array('wav', 'mp3'), 'maxsize' => 5120000)); $up->uploadFile('file'); // input's name property $msg = $up->getErrorMsg(); if (empty($msg)) { $filename = $up->getUploadFileName(); $filename = str_replace(UPLOAD_ROOT, "", $filename); $name = $_FILES['file']['name']; $user = Sp_Account_User::current(); $material = array(); $material['user_id'] = $user->id; $material['type'] = 2; $material['name'] = $name; $material['url'] = $filename; Sp_Letter_Material::add($material); return array('status' => '0', 'msg' => '上传成功', 'data' => $filename); } else { return array('status' => '-1', 'msg' => $msg); } } else { if ('image' == $t) { $up = new Util_Upyun(array('save_path' => UPLOAD_ROOT . 'image/', 'save_url' => 'huitong/')); $msg = $up->uploadFile('file'); if ($msg['status'] == 0) { $name = $_FILES['file']['name']; $user = Sp_Account_User::current(); $material = array(); $material['user_id'] = $user->id; $material['type'] = 1; $material['name'] = $name; $material['url'] = $msg['data']; Sp_Letter_Material::add($material); } return $msg; } else { return array('status' => '-2', 'msg' => '未上传'); } } } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { return array(); } else { $id = $request->id; if (empty($id) || !is_numeric($id)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($id, $user->id); if (empty($active)) { $this->show404(); } $view = new Sp_View(); $view->assign("active", $active); $view->display("active/createsuccess.html"); } }
public function execute($request) { global $priv; $user = Sp_Account_User::current(); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $province = Sp_City_City::getProvince(); $view = new Sp_View(); $userInfo = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status')); $auth = array('mobile_status' => $userInfo['mobile_status'], 'email_status' => $userInfo['email_status']); $view->assign('province', $province); $view->assign('action', $priv); $view->assign('auth', $auth); if (!empty($userInfo['province'])) { $city = Sp_City_City::getChlidById($userInfo['province']); $view->assign('city', $city); } if (!empty($userInfo['city'])) { $arrea = Sp_City_City::getChlidById($userInfo['city']); $view->assign('arrea', $arrea); } $view->assign('uploadInfo', $uploadInfo); $view->display("account/index.html"); }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $aid = $request->aid; if (!is_numeric($id) || !is_numeric($aid)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (is_array($active) && count($active) > 1) { $at = Sp_Account_Attendee::getAttendeeById($id); if ($at['activeId'] == $aid && $at['checkStatus'] == 0) { $rs = Sp_Account_Attendee::refuse($id); return array('status' => '0', 'msg' => '拒绝成功'); } else { return array('status' => '-1', 'msg' => '数据有误'); } } else { return array('status' => '-1', 'msg' => '数据有误'); } } }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $active_id = $request->active_id; $title = $request->title; $discrib = $request->discrib; if (!is_numeric($active_id) || empty($title)) { return array('status' => '-1', 'msg' => '参数错误'); } $user = Sp_Account_User::current(); $letter = array(); $letter['user_id'] = $user->id; $letter['title'] = $title; $letter['discrib'] = $discrib; $letter['active_id'] = $active_id; $lastid = Sp_Letter_Letter::add($letter); if (is_numeric($lastid) && $lastid > 0) { return array('status' => '0', 'msg' => '添加成功', 'data' => $lastid); } else { return array('status' => '-1', 'msg' => '添加失败'); } } }
public function execute($request) { $user = Sp_Account_User::current(); $user->signout(); header("Location: /"); }
/** * function description * * @param * @return void */ public function execute($request) { if ($request->format == 'json') { $id = $request->id; $activit_end = $request->activit_end; //活动结束时间 $activit_start = $request->activit_start; //活动开始时间 $address = $request->address; //详细地址 $arrea = $request->arrea; //区域 $city = $request->city; //城市 $enroll_end = $request->enroll_end; $enroll_start = $request->enroll_start; $is_audit = $request->is_audit; $is_enroll = $request->is_enroll; //是否需要审核 $province = $request->province; //省份 $title = $request->title; //标题 $thumbnail = $request->thumbnail; $enroll_num = $request->enroll_num; if (!is_numeric($id) || empty($title) || empty($activit_end) || empty($activit_end) || empty($address) || empty($province) || empty($city)) { return array('status' => '-5', 'msg' => '参数错误'); } if (!empty($is_enroll) && (empty($is_audit) || empty($enroll_start) || empty($enroll_end))) { return array('status' => '-5', 'msg' => '完善活动时间选项'); } if (strtotime($activit_end) < strtotime($activit_start)) { return array('status' => '-5', 'msg' => '举办结束日期不能小于开始日期'); } $user = Sp_Account_User::current(); $active = array(); $active['activit_end'] = strtotime($activit_end); $active['activit_start'] = strtotime($activit_start); $active['address'] = $address; $active['arrea'] = empty($arrea) ? 0 : $arrea; $active['city'] = $city; $active['province'] = $province; $active['title'] = $title; $active['user_id'] = $user->id; $active['thumbnail'] = $thumbnail; if (!empty($is_audit)) { if (strtotime($enroll_end) < strtotime($enroll_start)) { return array('status' => '-5', 'msg' => '报名结束日期不能小于开始日期'); } if (!is_numeric($enroll_num)) { return array('status' => '-5', 'msg' => '人数不能为空'); } $active['is_audit'] = 1; $active['is_enroll'] = 1; $active['enroll_start'] = strtotime($enroll_start); $active['enroll_end'] = strtotime($enroll_end); $active['enroll_num'] = $enroll_num; } else { $active['is_audit'] = 0; $active['is_enroll'] = 0; $active['enroll_start'] = 0; $active['enroll_end'] = 0; $active['enroll_num'] = 0; } $user = Sp_Account_User::current(); $ret = Sp_Active_Active::updateById($id, $active, $user->id); return array('status' => '0', 'msg' => '修改成功'); // if($ret){ // // }else{ // return array('status'=>'-1','msg'=>'修改失败'); // } } else { $aid = $request->id; if (!is_numeric($aid)) { $this->show404(); } $user = Sp_Account_User::current(); $active = Sp_Active_Active::getActiveById($aid, $user->id); if (empty($active)) { $this->show404(); } $province = Sp_City_City::getProvince(); $city = Sp_City_City::getChlidById($active['province']); $arrea = Sp_City_City::getChlidById($active['city']); $view = new Sp_View(); $uploadInfo = Util_FileUpload::getUpfileKey('huitong'); $view->assign('province', $province); $view->assign('city', $city); $view->assign('arrea', $arrea); $view->assign('uploadInfo', $uploadInfo); $view->assign('option', 'edit'); $view->assign('active', $active); $view->display("active/create.html"); } }
/** * 继承Smarty并设置项目的属性 */ function __construct($charset = 'UTF-8', $cur_skin = 'default') { //Class Constructor. These automatically get set with each new instance. method_exists('Smarty', 'Smarty') && $this->Smarty() || parent::__construct(); if (isset($cur_skin) && !empty($cur_skin)) { $this->_cur_skin = $cur_skin; } else { if (defined('VIEW_SKIN_CURRENT')) { $this->_cur_skin = VIEW_SKIN_CURRENT; } else { $this->_cur_skin = $this->_dft_skin; } } if (defined('VIEW_SKINS_ROOT')) { $this->_parent_dir = VIEW_SKINS_ROOT; } else { die("please set template skin dir first! "); } $this->template_dir = VIEW_SKINS_ROOT . $this->_cur_skin . '/'; //echo $this->template_dir; //$this->use_sub_dirs = true; $this->compile_id = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'local') . '_' . $this->_cur_skin; $this->compile_dir = VIEW_COMPILE_DIR; $this->config_dir = VIEW_CONFIG_DIR; $this->plugins_dir = array(LIB_ROOT . 'function/smarty/plugins', SMARTY_DIR . '/plugins'); // Smarty 的模板缓存,奇怪的设计,慎用 //$this->cache_dir = VIEW_CACHE_DIR; //$this->cache_lifetime = defined('VIEW_CACHE_LIFETIME') ? VIEW_CACHE_LIFETIME : 1440; //$this->clear_all_cache(); //$this->caching = defined('VIEW_CACHE_ENABLE') ? VIEW_CACHE_ENABLE : true; //$this->security = true; $this->use_sub_dirs = TRUE; //开启缓存目录分级 $this->left_delimiter = '{%'; $this->right_delimiter = '%}'; $this->_charset = $charset; new Sp_View_Helper($this); $this->assign_by_ref('head_title', $this->_head_title); $this->assign_by_ref('head_keywords', $this->_head_keywords); $this->assign_by_ref('head_description', $this->_head_description); $this->assign_by_ref('head_links', $this->_head_links); $this->assign_by_ref('head_styles', $this->_head_styles); $this->assign_by_ref('head_scripts', $this->_head_scripts); $this->assign_by_ref('foot_scripts', $this->_foot_scripts); $this->assign_by_ref('charset', $this->_charset); defined('SP_URL_API') && $this->assign('SP_URL_API', SP_URL_API); //API kong 增加 defined('SP_URL_HOME') && $this->assign('SP_URL_HOME', SP_URL_HOME); defined('SP_URL_CSS') && $this->assign('SP_URL_CSS', SP_URL_CSS); defined('SP_URL_IMG') && $this->assign('SP_URL_IMG', SP_URL_IMG); defined('SP_URL_JS') && $this->assign('SP_URL_JS', SP_URL_JS); defined('SP_URL_STO') && $this->assign('SP_URL_STO', SP_URL_STO); defined('SP_URL_CS') && $this->assign('SP_URL_CS', SP_URL_CS); defined('SP_URL_UPLOAD') && $this->assign('SP_URL_UPLOAD', SP_URL_UPLOAD); defined('SP_URL_FILE') && $this->assign('SP_URL_FILE', SP_URL_FILE); defined('SP_DOMAIN_SUFFIX') && $this->assign('SP_DOMAIN_SUFFIX', SP_DOMAIN_SUFFIX); defined('DATA_TYPE') && $this->assign('DATA_TYPE', DATA_TYPE); $this->assign('COOKIE_DOMAIN', Request::genCookieDomain()); // current request $this->_request = Request::current(); $this->assign_by_ref('_request', $this->_request); is_null($this->_parent_dir) && ($this->_parent_dir = CONF_ROOT . 'templates/'); if (is_dir($this->_parent_dir)) { $this->assign('parent_dir', $this->_parent_dir); } else { $this->assign('parent_dir', ''); } $user = Sp_Account_User::current(); if ($user->isLogin()) { $user = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status')); $this->assign('user', $user); } $this->assign('SP_COMPANY', SP_COMPANY); //公司名称 $this->assign('SP_INVEST_COMPANY', SP_INVEST_COMPANY); //网站名称 $this->default_template_handler_func = array($this, 'make_template'); }