Exemplo n.º 1
0
 /**
  * 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');
     }
 }
Exemplo n.º 2
0
function daggerSignalHandler($signal)
{
    defined('QUEUE_CTL') && QueueTaskCtl::end(1, 'signal catched');
    switch ($signal) {
        case SIGTERM:
            Message::showError('Caught SIGTERM');
            exit;
        case SIGINT:
            Message::showError('Caught SIGINT');
            exit;
    }
}
 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('设置失败');
 }
Exemplo n.º 4
0
 public function set()
 {
     $v = 1;
     $OnlineDebugKeyDB = new OnlineDebugKeyModelDB();
     $row = $OnlineDebugKeyDB->getRow("SELECT * FROM `" . $OnlineDebugKeyDB->getTableName() . "` WHERE `valid`=1 AND `rand_key`=?", array($_GET['rand_key']));
     if (!empty($row['rand_key'])) {
         $expire = intval($row['expire']);
         if ($expire != 0) {
             $expire = time() + $expire;
         }
         setcookie('dagger_online_debug', $v, $expire, '/', '.sina.com.cn', false, true);
         $OnlineDebugKeyDB->update(array('valid' => 0), array('rand_key' => $row['rand_key']));
         if (!empty($row['redirect'])) {
             header("Location: {$row['redirect']}");
         }
     } else {
         Message::showError('无效的请求');
     }
     exit;
 }
Exemplo n.º 5
0
 public function view()
 {
     $interArray = array();
     $interArray['id'] = intval($_GET['id']);
     $interArray['type'] = $_GET['type'];
     $key = $_GET['key'];
     if ($interArray['id'] == "" or $interArray['type'] == "" or $key == "") {
         Message::showError('操作错误,请检查您的url!');
     } else {
         if ($key != md5(date('Y-m-d'))) {
             Message::showError('密码错误,禁止访问');
             return 0;
         }
         //判断传入的数值是否合法
         if (!is_numeric($interArray['id'])) {
             Message::showError('id错误,不是数字', $interArray['id']);
             return 0;
         }
         if ($interArray['type'] == '') {
             Message::showError('type类型不能为空', $interArray['type']);
             return 0;
         }
         $errUserDB = new ErrUserModelDB();
         $sqlUser = "******" . $errUserDB->getTableName() . " where id=" . $interArray['id'];
         $errUserData = $errUserDB->getRow($sqlUser);
         //选出错误日志信息errmsg
         $errMsgDB = new ErrmsgModelDB();
         $sqlMsg = "select * from " . $errMsgDB->getTableName() . " where pid= " . $interArray['id'] . " and type= " . $interArray['type'] . " order by dateline DESC";
         $errMsgData = $errMsgDB->getData($sqlMsg, $whereArr, 10);
         $pageStr = $errMsgDB->getPageStr();
         //获取导航栏
         $pageJump = $errMsgDB->getPageJump();
         $this->setView('pageStr', $pageStr);
         $this->setView('pageJump', $pageJump);
         $this->setView('id', $interArray['id']);
         $this->setView('type', $interArray['type']);
         $this->setView('errUser', $errUserData);
         $this->setView('errMsgData', $errMsgData);
         $this->display("wap.html");
     }
 }
 public function detail()
 {
     $sid = intval($_GET['sub_mid']);
     if (md5(md5(md5(implode('|', array($sid, '!mrala', date('Y-m-d')))))) !== $_GET['sign']) {
         Message::showError('sign fail');
     } else {
         $submoduleDB = new SubmoduleModelDB();
         $submodule = $submoduleDB->getRow('SELECT mid, code, name FROM `' . $submoduleDB->getTableName() . '` WHERE id=?', array(intval($sid)));
         $moduleDB = new ModuleModelDB();
         $module = $moduleDB->getRow('SELECT sys_mid, pid FROM `' . $moduleDB->getTableName() . '` WHERE id=?', array(intval($submodule['mid'])));
         $sysmoduleDB = new SysmoduleModelDB();
         $sysmodule = $sysmoduleDB->getRow('SELECT `name` FROM `' . $sysmoduleDB->getTableName() . '` WHERE id=?', array(intval($module['sys_mid'])));
         $projectDB = new ProjectModelDB();
         $project = $projectDB->getRow('SELECT `name` FROM `' . $projectDB->getTableName() . '` WHERE id=?', array(intval($module['pid'])));
         $this->setView('project', $project);
         $this->setView('sysmodule', $sysmodule);
         $this->setView('submodule', $submodule);
         $this->setView('sub_mid', $sid);
         $this->display('mobile/details.html');
     }
 }
 public function view()
 {
     $key = isset($_GET['key']) ? $_GET['key'] : '';
     $pageId = isset($_GET['page']) ? max(intval($_GET['page']), 1) : 1;
     if (empty($key)) {
         Message::showError('项目key不能为空');
     }
     $limit = 50;
     $host = '172.16.53.68';
     $port = 6381;
     $rd = new Redis();
     $rd->connect($host, $port);
     $count = $rd->lsize($key);
     $data = $rd->lRange($key, $limit * ($pageId - 1), $limit * $pageId);
     $data = array_map('unserialize', $data);
     Common::debug($data);
     // $data = unserialize($data);
     // Common::debug($data);exit;
     $pageModel = new Page($count, $limit);
     $this->setView('data', $data);
     $this->setView('pageStr', $pageModel->getPageStr());
     $this->display('XhprofLog.html');
 }
 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()));
 }
Exemplo n.º 9
0
 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');
 }
Exemplo n.º 10
0
 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()));
 }
Exemplo n.º 11
0
 /**
  * updload image files
  */
 private function uploadImageFile($key, $fileName)
 {
     if (($_FILES['image']["type"][$key] == "image/jpeg" || $_FILES["image"]["type"][$key] == "image/pjpeg") && $_FILES["image"]["size"][$key] < 2 * 1024 * 1024 * 1204) {
         if (is_array($_FILES["image"]["error"]) && $_FILES["image"]["error"][$key] > 0) {
             Message::showError("Return Code: " . $_FILES["image"]["error"][$key]);
         } else {
             if (!is_array($_FILES["image"]["error"]) && $_FILES["image"]["error"] > 0) {
                 Message::showError("Return Code: " . $_FILES["image"]["error"]);
             } else {
                 $i = 0;
                 while (1) {
                     $i++;
                     Common::debug(DAGGER_PATH_ROOT . "images/" . $fileName . '.jpg');
                     if (file_exists(DAGGER_PATH_ROOT . "images/" . $fileName . '.jpg')) {
                         Common::debug(DAGGER_PATH_ROOT . "images/" . $fileName . '.jpg' . " already exists. ");
                         $fileName = $fileName . '_' . $i;
                     } else {
                         $fileName .= '.jpg';
                         move_uploaded_file($_FILES["image"]["tmp_name"][$key], DAGGER_PATH_ROOT . "images/" . $fileName);
                         break;
                     }
                 }
             }
         }
         return $fileName;
     } else {
         Message::showError("Invalid file");
     }
 }
Exemplo n.º 12
0
 /**
  *
  *@description: android获取client_id 是第三方推送过来的信息, 不能保证 登陆前一定能获取到..  不阻塞用户登陆, 只有获取到之后再进行更新
  */
 public function updateClientId()
 {
     Switcher::close('masterDbPostOnly');
     $username = $_POST['username'];
     $clientId = $_POST['client_id'];
     $userDB = new AlarmUserModelDB();
     if (!empty($username) && !empty($clientId)) {
         $sql = "SELECT `id` FROM `" . $userDB->getTableName() . "` WHERE `username` = ?";
         $userId = $userDB->getFirst($sql, array($username));
         if (!empty($userId)) {
             $updateArr = array();
             $updateArr['client_id'] = $clientId;
             $userDB->update($updateArr, array('id' => $userId));
             Message::showSucc('succ');
         } else {
             Message::showError('no such user');
         }
     } else {
         Message::showError('username or clientid is empty');
     }
 }