public function message() { if (empty($_REQUEST['format'])) { $_REQUEST['format'] = 'json'; } $arr = array(array('name' => '张三', 'age' => 18), array('name' => '李四', 'age' => 22)); Message::showSucc('获取数据成功', $arr); }
/** * get list comment * http://www.missy-blue.com/comment/get_list/?format=json */ public function getList() { $commentModelDb = new CommentModelDB(); $result = $commentModelDb->getList(5); if (!empty($result)) { Message::showSucc('add comment success', $result); } else { Message::showError('add comment failed'); } }
public function setOnlineDebugUrl() { $OnlineDebugKeyDB = new OnlineDebugKeyModelDB(); $insertArr = array(); $insertArr['rand_key'] = md5(mt_rand(1, 10000) + time()); $insertArr['redirect'] = $_POST['redirect']; //$insertArr['expire'] = $_POST['expire']; $insertArr['expire'] = time() + 86400; $insertArr['valid'] = 1; $rs = $OnlineDebugKeyDB->insert($insertArr); $rs ? Message::showSucc('设置成功', $insertArr['rand_key']) : Message::showError('设置失败'); }
public function waterfall() { $sid = intval($_GET['sub_mid']); $pageId = max(intval($_GET['page']), 1); $limit = 10; $start = ($pageId - 1) * $limit; $stop = $start + $limit; $submoduleDB = new SubmoduleModelDB(); $submodule = $submoduleDB->getRow('SELECT mid, code FROM `' . $submoduleDB->getTableName() . '` WHERE id=?', array(intval($sid))); $details = MyRedis::getSubmoduleDetail($submodule, $start, $stop); Common::debug($details); foreach ($details['messages'] as $key => $value) { if ($tmp = unserialize($value)) { $value = array_map('urldecode', array_map('htmlspecialchars', $tmp)); // $detail = date('[Y-m-d H:i:s] ', $time)."{$submodule['name']} 错误号:{$submodule['code']} 详细:{$message}, 邮件:第{$mailMsgCount}次,短信:第{$smsMsgCount}次,来自{$client_ip}/{$onlineip},xhprofId[{$xhprofId}]"; $details['messages'][$key] = date('[Y-m-d H:i:s] ', $value['time']) . "{$value['name']} 错误号:{$value['code']},脚本:{$value['script']},详细:{$value['message']},来自{$value['clientIp']}/{$value['serverIp']}"; } else { $details['messages'][$key] = htmlspecialchars($value); } } Message::showSucc('详细信息', $details['messages']); }
public function logicResume() { $tmpLogDB = new TmpLogModelDB(); $updateArr = array('' => 0); $whereArr = array(); $whereArr['id'] = $_GET['id']; $rs = $tmpLogDB->update($updateArr, $whereArr); Log::write($this->adminUserName, $this->ip, $_GET['id'], self::$state . "__" . self::$action, $rs); $rs ? Message::showSucc('恢复成功') : Message::showError('恢复失败:' . implode(" ", $tmpLogDB->getErrorInfo())); }
public function resetPasswordManually() { if ($this->user['role'] == 'member') { if ($this->isPost()) { $old_password = trim($_POST['old_password']); $uid = $this->user['uid']; $userModelDB = new UserModelDB(); $userInfo = $userModelDB->getUserByUid($uid); if (empty($old_password)) { Message::showError('您输入的旧密码不能为空'); } if (!preg_match('/[0-9a-zA-Z_\\.\\@\\#\\$\\%]{6,18}/', $old_password)) { $this->putErrorMsg('/[0-9a-zA-Z_\\.\\@\\#\\$\\%]{6,18}/'); Message::showError('你输入的密码不符合正则'); } if (sha1($old_password) != $userInfo['password']) { Message::showError('您的旧密码输入有误'); } $password = trim($_POST['password']); $password_repeat = trim($_POST['password_repeat']); if (empty($password) || empty($password_repeat)) { Message::showError('新输入的密码不能为空'); } if (!preg_match('/[0-9a-zA-Z_\\.\\@\\#\\$\\%]{6,18}/', $password)) { $this->putErrorMsg('/[0-9a-zA-Z_\\.\\@\\#\\$\\%]{6,18}/'); Message::showError('你输入的密码不符合正则'); } if ($password_repeat != $password) { Message::showError('两次输入的密码不一致'); } //save db $success = $userModelDB->updatePassword($uid, sha1($password_repeat)); if (!$success) { Message::showError('failed'); } Message::showSucc('Modify password success!'); } } else { Message::showError('请登陆'); } $this->display('reset_password_manually.html'); }
public function debug() { session_start(); //print_r(json_decode($_GET['online_debug'], true)); $onlineDebugDB = new OnlineDebugModelDB(); $insertArr = array(); $insertArr['pid'] = $_POST['pid']; $insertArr['domain'] = $_POST['domain']; $insertArr['request'] = $_POST['request']; $insertArr['response'] = $_POST['response']; $insertArr['html'] = $_POST['html']; $insertArr['debug_msg'] = $_POST['debug_msg']; $insertArr['client_ip'] = $_POST['client_ip']; $insertArr['server_ip'] = $_SERVER['REMOTE_ADDR']; $insertArr['datetime'] = time(); $rs = $onlineDebugDB->insert($insertArr); $rs ? Message::showSucc('添加成功') : Message::showError('添加失败:' . implode(" ", $onlineDebugDB->getErrorInfo())); }
public function getGrapheDetail() { $ids = explode(',', $_GET['ids']); $submoduleDB = new SubmoduleModelDB(); $name = $submoduleDB->getData('SELECT id, name FROM `' . $submoduleDB->getTableName() . '` WHERE id IN ?', array($ids)); Message::showSucc('模块名', $name); }
public function version() { Message::showSucc('有新功能哦!', '0.9'); }