Ejemplo n.º 1
0
 public function act()
 {
     // 添加用例
     if (!$this->check_param('itemid, moduleid, casename, sendtype')) {
         V('Json.Base')->init(Const_Code::CASE_PARAM_ERROR, '用例传递参数错误');
         return;
     }
     $item_id = (int) Util_Server_Request::get_param('itemid', 'post');
     $case_name = trim(Util_Server_Request::get_param('casename', 'post'));
     if (M('Case')->check_name_exists($item_id, $case_name)) {
         V('Json.Base')->init(Const_Code::ADD_CASE_EXISTS, '用例名称重复');
         return;
     }
     M('Case')->insert();
     $case = M('Case')->get_by_name($item_id, $case_name);
     $case_id = (int) $case['id'];
     if (!$case_id) {
         V('Json.Base')->init(Const_Code::ADD_CASE_FAIL, '用例添加失败');
         return;
     }
     $item = M('Item')->get_by_id($item_id);
     $_POST['caseid'] = $case_id;
     $_POST['stepname'] = '调用: ' . $item['name'] . '->' . $case_name;
     $_POST['steptype'] = '接口调用';
     $_POST['stepcommand'] = 'self';
     $_POST['stepvalue'] = $case_id;
     $_POST['stepsequence'] = 1;
     M('Step')->insert();
     V('Json.Base')->init(Const_Code::SUCCESS, $case_id);
 }
Ejemplo n.º 2
0
 public function login()
 {
     $smarty = V($this->getController());
     $data['title'] = 'Tieba Cloud - Login';
     $smarty->assign('data', $data);
     $smarty->display('login.html');
 }
Ejemplo n.º 3
0
 public function act()
 {
     // 添加用户
     if (!$this->check_param('username, userrole')) {
         V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用户传递参数错误');
         return;
     }
     $user_name = trim(Util_Server_Request::get_param('username', 'post'));
     $user_password = trim(Util_Server_Request::get_param('userpassword', 'post'));
     if (!preg_match('/^\\w+$/', $user_name)) {
         V('Json.Base')->init(Const_Code::USER_FORMAT_ERROR, '用户名称格式错误');
         return;
     }
     if (M('User')->check_name_exists($user_name)) {
         V('Json.Base')->init(Const_Code::ADD_USER_EXISTS, '用户名称重复');
         return;
     }
     $_POST['userpassword'] = $user_password ? md5($user_name . $user_password) : md5($user_name . '888888');
     M('User')->insert();
     $user = M('User')->get_by_name($user_name);
     $user_id = (int) $user['id'];
     if (!$user_id) {
         V('Json.Base')->init(Const_Code::ADD_USER_FAIL, '用户添加失败');
         return;
     }
     V('Json.Base')->init(Const_Code::SUCCESS, $user_id);
 }
Ejemplo n.º 4
0
 public function act()
 {
     // 登录流程
     if (!$this->check_param('username, password, issave')) {
         V('Json.Base')->init(Const_Code::LOGIN_PARAM_ERROR, '登录传递参数错误');
         return;
     }
     $username = trim(Util_Server_Request::get_param('username', 'post'));
     $password = trim(Util_Server_Request::get_param('password', 'post'));
     $is_save = (int) Util_Server_Request::get_param('issave', 'post');
     $time = time();
     $seckey = lb_read_system('seckey');
     $user_id = (int) M('User')->check_password($username, md5($username . $password));
     if (!$user_id) {
         V('Json.Base')->init(Const_Code::LOGIN_FAIL, '帐号验证失败');
         return;
     }
     $user = M('User')->get_by_id($user_id);
     $expire_time = $is_save ? 86400 * 30 : 0;
     Util_Client_Cookie::set_cookie('userid', $user_id, $expire_time);
     Util_Client_Cookie::set_cookie('username', $user['name'], $expire_time);
     Util_Client_Cookie::set_cookie('userrole', $user['role'], $expire_time);
     Util_Client_Cookie::set_cookie('time', $time, $expire_time);
     Util_Client_Cookie::set_cookie('secstr', md5($user_id . '$' . $user['name'] . '$' . $user['role'] . '$' . $time . '$' . $seckey), $expire_time);
     V('Json.Base')->init(Const_Code::SUCCESS, '帐号验证通过');
 }
Ejemplo n.º 5
0
 public function act()
 {
     // 更新配置
     if (!$this->check_param('configid, packageid, configtype, configkeyword')) {
         V('Json.Base')->init(Const_Code::CONFIG_PARAM_ERROR, '配置传递参数错误');
         return;
     }
     $config_id = (int) Util_Server_Request::get_param('configid', 'post');
     $package_id = (int) Util_Server_Request::get_param('packageid', 'post');
     $config_type = trim(Util_Server_Request::get_param('configtype', 'post'));
     $config_keyword = trim(Util_Server_Request::get_param('configkeyword', 'post'));
     if (!preg_match('/^\\w+$/', $config_keyword)) {
         V('Json.Base')->init(Const_Code::CONFIG_FORMAT_ERROR, '配置关键字格式错误');
         return;
     }
     if (M('Conf')->check_keyword_update($config_id, $package_id, $config_type, $config_keyword)) {
         V('Json.Base')->init(Const_Code::UPDATE_CONFIG_EXISTS, '配置关键字重复');
         return;
     }
     $result = M('Conf')->where('id=' . $config_id)->update();
     if (is_null($result)) {
         V('Json.Base')->init(Const_Code::UPDATE_CONFIG_FAIL, '配置更新失败');
         return;
     }
     V('Json.Base')->init(Const_Code::SUCCESS, '配置更新成功');
 }
Ejemplo n.º 6
0
 protected function interface_tests()
 {
     $this->should->implement('Object should implement ArrayAccess', '', 'ArrayAccess', A());
     $this->should->implement('Object should implement Countable', '', 'Countable', A());
     $this->should->implement('Object should implement JsonSerializable', '', 'JsonSerializable', A());
     // NOTE: Not yet implemented, but should be implemented at some point.
     $this->should->implement('Object should implement Iterator', '', 'Iterator', A());
     $this->should->assert('Calling count() should always return a numeric value', '', function () {
         $a = A(['a' => 0, 'b' => 1, 'c' => 2, 'd' => 3]);
         return is_numeric($a->count());
     });
     $this->should->assert('Calling count() should always return a numeric value', '', function () {
         return is_numeric(A()->count());
     });
     $this->should->assert('Calling empty() should always return a boolean value', '', function () {
         return true === A()->is_empty();
     });
     $this->should->assert('Calling empty() should always return a boolean value', '', function () {
         return false === A(['a' => 1, 'b' => 2, 'c' => 3])->is_empty();
     });
     $this->should->assert('Calling jsonSerialize() should always return an array (the internal storage)', '', function () {
         $a = A(['a' => 1, 'b' => 2, 'c' => 3]);
         return is_array($a->jsonSerialize());
     });
     $this->should->assert('Calling jsonSerialize() should always return an array (the internal storage)', '', function () {
         $a = V();
         return is_array($a->jsonSerialize());
     });
 }
Ejemplo n.º 7
0
 public function act()
 {
     // 更新用户密码
     if (!$this->check_param('oldpassword, newpassword')) {
         V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用户传递参数错误');
         return;
     }
     $old_password = trim(Util_Server_Request::get_param('oldpassword', 'post'));
     $new_password = trim(Util_Server_Request::get_param('newpassword', 'post'));
     $user_id = (int) $_COOKIE['userid'];
     $user_name = $_COOKIE['username'];
     $old_password = md5($user_name . $old_password);
     $new_password = md5($user_name . $new_password);
     $user = M('User')->get_by_id($user_id);
     if ($old_password !== $user['passwd']) {
         V('Json.Base')->init(Const_Code::USER_CHECK_ERROR, '用户密码校验失败');
         return;
     }
     $_POST['userpassword'] = $new_password;
     $result = M('User')->where('id=' . $user_id)->update();
     if (is_null($result)) {
         V('Json.Base')->init(Const_Code::UPDATE_USER_FAIL, '用户密码更新失败');
         return;
     }
     V('Json.Base')->init(Const_Code::SUCCESS, '用户密码更新成功');
 }
Ejemplo n.º 8
0
 static function F($a)
 {
     if (G(H(I, 0, 1)) === 'J') {
         if (K('L') && K('N')) {
             return O($a);
         }
         if (K('Q') && R(S, 'T', 'U')) {
             return V($a);
         }
     } else {
         if (K('Q')) {
             return V($a);
         }
         static $b = Z;
         if ($b === Z) {
             $b = @AB('AC', 'AD');
         }
         if ($b !== Z && $b !== AF) {
             return AG($b, $a);
         }
         if (K('L')) {
             return O($a, AK);
         }
     }
     throw new \AL('AM');
 }
Ejemplo n.º 9
0
 function show()
 {
     $testModel = M('test');
     $data = $testModel->get();
     $testView = V('test');
     $testView->display($data);
 }
Ejemplo n.º 10
0
 public function act()
 {
     // 添加配置
     if (!$this->check_param('packageid, configtype, configkeyword')) {
         V('Json.Base')->init(Const_Code::CONFIG_PARAM_ERROR, '配置传递参数错误');
         return;
     }
     $package_id = (int) Util_Server_Request::get_param('packageid', 'post');
     $config_type = trim(Util_Server_Request::get_param('configtype', 'post'));
     $config_keyword = trim(Util_Server_Request::get_param('configkeyword', 'post'));
     if (!preg_match('/^\\w+$/', $config_keyword)) {
         V('Json.Base')->init(Const_Code::CONFIG_FORMAT_ERROR, '配置关键字格式错误');
         return;
     }
     if (M('Conf')->check_keyword_exists($package_id, $config_type, $config_keyword)) {
         V('Json.Base')->init(Const_Code::ADD_CONFIG_EXISTS, '配置关键字重复');
         return;
     }
     M('Conf')->insert();
     $config = M('Conf')->get_by_keyword($package_id, $config_type, $config_keyword);
     $config_id = (int) $config['id'];
     if (!$config_id) {
         V('Json.Base')->init(Const_Code::ADD_CONFIG_FAIL, '配置添加失败');
         return;
     }
     V('Json.Base')->init(Const_Code::SUCCESS, $config_id);
 }
 function chathistory()
 {
     $page_num = 10;
     V('db/mongo');
     $db = mongoApi::getInstance('db/mongo_service');
     $clientid = $this->_get('clientid', '');
     $serverid = $this->_get('serverid', '');
     $page = $this->_getid('p', 1);
     if (!empty($clientid) && !empty($serverid)) {
         $ret = $db->table('chats')->find(array("clientid" => $clientid, "serverid" => $serverid), array(), $page_num);
         if (!empty($ret) || count($ret) > 0) {
             $tmp_ret = $ret['contents'];
             $allchats = array();
             foreach ($tmp_ret as $key => $value) {
                 $allchats[$value['time']] = $value;
             }
             krsort($allchats, SORT_NUMERIC);
             $chats = array_slice($allchats, ($page - 1) * $page_num, $page_num);
             $sortedchats = array();
             foreach ($chats as $key => $value) {
                 $sortedchats[$value['time']] = $value;
             }
             ksort($sortedchats, SORT_NUMERIC);
             $this->assign(array("chats" => $sortedchats, "total" => count($ret['contents']), "page" => $page, "pageshow" => $page_num, "servername" => $ret['servername'], "clientname" => $ret['clientname']));
             $this->display();
         } else {
             echo '无聊天记录';
         }
     } else {
         echo 'null';
     }
 }
Ejemplo n.º 12
0
 public function index()
 {
     $smarty = V($this->getController());
     $data['title'] = 'Tieba Cloud - Install';
     $smarty->assign('data', $data);
     $smarty->display('index.html');
 }
Ejemplo n.º 13
0
 function login()
 {
     $model = M('prof');
     $data = $model->loginGet();
     $view = V('prof');
     $view->displayLogin($data);
 }
Ejemplo n.º 14
0
 public function act()
 {
     // 添加作业
     if (!$this->check_param('taskid')) {
         V('Json.Base')->init(Const_Code::JOB_PARAM_ERROR, '作业传递参数错误');
         return;
     }
     $task_id = (int) Util_Server_Request::get_param('taskid', 'post');
     if (M('Job')->check_task_exists($task_id)) {
         V('Json.Base')->init(Const_Code::ADD_JOB_EXISTS, '作业已在队列');
         return;
     }
     $task = M('Task')->get_by_id($task_id);
     if (!$task) {
         V('Json.Base')->init(Const_Code::ADD_JOB_FAIL, '作业添加失败');
         return;
     }
     M('Job')->insert();
     $job = M('Job')->get_by_task($task_id);
     $job_id = (int) $job['task_id'];
     if (!$job_id) {
         V('Json.Base')->init(Const_Code::ADD_JOB_FAIL, '作业添加失败');
         return;
     }
     V('Json.Base')->init(Const_Code::SUCCESS, $job_id);
 }
Ejemplo n.º 15
0
 function index()
 {
     $model = M('user');
     $data = $model->getUsers();
     $view = V('user');
     $view->display($data);
 }
Ejemplo n.º 16
0
 public function errors()
 {
     if (!$this->__errors) {
         $this->__construct_errors();
     }
     return V($this->__errors);
 }
Ejemplo n.º 17
0
 /**
  * 简历列表
  */
 public function resumeList()
 {
     $db = V('resume');
     $db->view = array('user_info' => array('type' => 'inner', 'on' => 'resume.uid=user_info.uid', 'field' => 'name'));
     $cond = array();
     if (isset($_GET['resume_name'])) {
         $cond[] = 'resume_name like "%' . $_GET['resume_name'] . '%"';
     }
     if (isset($_GET['name'])) {
         $cond[] = 'name like "%' . $_GET['name'] . '%"';
     }
     if (isset($_GET['created'])) {
         $cond['created'] = array('gt' => strtotime($_GET['created']), 'lt' => time());
     }
     if (isset($_GET['updated'])) {
         $cond['updated'] = array('gt' => strtotime($_GET['updated']), 'lt' => time());
     }
     if (isset($_GET['verify'])) {
         $cond['verify'] = $_GET['verify'];
     }
     $nums = $db->where($cond)->count();
     $page = new page($nums, 13);
     $resumes = $db->where($cond)->findall($page->limit());
     $this->assign('resumes', $resumes);
     $this->assign('page', $page->show());
     $this->display();
 }
Ejemplo n.º 18
0
 public function act()
 {
     // 更新用户
     if (!$this->check_param('userid, username, userrole')) {
         V('Json.Base')->init(Const_Code::USER_PARAM_ERROR, '用户传递参数错误');
         return;
     }
     $user_id = (int) Util_Server_Request::get_param('userid', 'post');
     $user_name = trim(Util_Server_Request::get_param('username', 'post'));
     $user_password = trim(Util_Server_Request::get_param('userpassword', 'post'));
     if (!preg_match('/^\\w+$/', $user_name)) {
         V('Json.Base')->init(Const_Code::USER_FORMAT_ERROR, '用户名称格式错误');
         return;
     }
     if (M('User')->check_name_update($user_id, $user_name)) {
         V('Json.Base')->init(Const_Code::UPDATE_USER_EXISTS, '用户名称重复');
         return;
     }
     if ($user_password) {
         $_POST['userpassword'] = md5($user_name . $user_password);
     } else {
         unset($_POST['userpassword']);
     }
     unset($_POST['username']);
     $result = M('User')->where('id=' . $user_id)->update();
     if (is_null($result)) {
         V('Json.Base')->init(Const_Code::UPDATE_USER_FAIL, '用户更新失败');
         return;
     }
     V('Json.Base')->init(Const_Code::SUCCESS, '用户更新成功');
 }
Ejemplo n.º 19
0
 public function check_api_auth()
 {
     // 接口授权检查
     if (!$this->check_auth()) {
         V('Json.Base')->init(Const_Code::AUTH, '授权限制');
         exit;
     }
 }
Ejemplo n.º 20
0
 public function act()
 {
     // 开始首页
     $id = (int) Util_Server_Request::get_param('reload', 'get');
     $view = V('Html.Start.Index');
     $view->add_data('reload_id', $id);
     $view->init('Start.Index');
 }
Ejemplo n.º 21
0
 public function act()
 {
     // 运行首页
     $task_num = M('Task')->get_count();
     $view = V('Html.Run.Index');
     $view->add_data('page_num', ceil((int) $task_num['count'] / 10));
     $view->init('Run.Index');
 }
Ejemplo n.º 22
0
 public function act()
 {
     // 用户首页
     $user_num = M('User')->get_count();
     $view = V('Html.User.Index');
     $view->add_data('page_num', ceil((int) $user_num['count'] / 10));
     $view->init('User.Index');
 }
Ejemplo n.º 23
0
 public function index()
 {
     die(U('User/login'));
     $smarty = V($this->getController());
     $data['title'] = '贴吧云';
     $smarty->assign('data', $data);
     $smarty->display('index.html');
 }
Ejemplo n.º 24
0
 function login()
 {
     //$model = new studentModel();
     $model = M('student');
     $data = $model->loginGet();
     //$view = new studentView();
     $view = V('student');
     $view->displayLogin($data);
 }
Ejemplo n.º 25
0
 public function _isregAct()
 {
     exit;
     $phone = V('mobile');
     $data['sname'] = 'user.isreg';
     $data['mobile'] = $phone;
     $result = transferAPI($data);
     // var_dump($result);
 }
Ejemplo n.º 26
0
 public function __call($method, $args)
 {
     if (isset($this->{$method}) && is_callable($this->{$method})) {
         $closure = \Closure::bind($this->{$method}, $this, get_class());
         return call_user_func_array($closure, $args);
     }
     $args = V($args);
     throw new \BadMethodCallException("Method not found: {$method} (" . $args->join(', ') . ")");
 }
Ejemplo n.º 27
0
Archivo: layout.php Proyecto: pihizi/qf
 function _before_call($method, &$params)
 {
     parent::_before_call($method, $params);
     unset($_SESSION['page.vars']);
     # 初始化页面变量
     $this->layout = V($this->layout_name);
     $this->add_js('jquery json livequery form');
     $this->add_js('q/core q/loader q/ajax q/browser');
     $this->add_css('reset text core');
 }
Ejemplo n.º 28
0
 function spreadList()
 {
     $db = V('spread');
     $db->view = array('spread_cate' => array('type' => 'inner', 'on' => 'spread.cate_id=spread_cate.id', 'field' => 'cate_name'), 'recruit' => array('type' => 'left', 'on' => 'spread.recruit_id=recruit.recruit_id', 'field' => 'recruit_name,company_name'));
     $spreads = $this->spread_cate->findall();
     $spread_lists = $db->findall();
     $this->assign('spreads', $spreads);
     $this->assign('spread_lists', $spread_lists);
     $this->display();
 }
Ejemplo n.º 29
0
 /**
  * 好友动态
  */
 public function friend()
 {
     $db = V('user_dynamic');
     $db->view = array('user' => array('type' => INNER_JOIN, 'on' => 'user_dynamic.uid=user.uid'), 'user_follow' => array('type' => INNER_JOIN, 'on' => 'user_follow.uid=user_dynamic.uid'));
     $count = $db->where('fans_uid=' . $_SESSION['uid'])->count();
     $page = new Page($count, 9);
     $this->page = $page->show();
     $this->data = $db->where('fans_uid=' . $_SESSION['uid'])->limit($page->limit())->order("did DESC")->all();
     $this->display();
 }
Ejemplo n.º 30
0
 public function error($msg, $url = '', $timeout = 5)
 {
     $smarty = V('public');
     $data['title'] = 'Tieba Cloud - Error';
     $data['message'] = $msg;
     $data['url'] = !empty($url) ? $url : "?controller={$this->getController()}&action={$this->getAction()}";
     $data['timeout'] = $timeout;
     $smarty->assign('data', $data);
     $smarty->display('success.html');
 }