function show_message($code, $data = array()) { if (IN_JISHIGOU_MOBILE_AJAX === true) { if ($code == 410) { Mobile::error("No Login", 410); } } else { include template('message'); } exit; }
function searchUser() { Mobile::logic('member'); $MemberLogic = new MemberLogic(); $q = trim($this->Get['q']); if (empty($q)) { Mobile::error("No Data", 400); } $param = array('limit' => Mobile::config("perpage_member"), 'nickname' => $q, 'max_id' => $this->Get['max_id']); $ret = $MemberLogic->getMemberList($param); if (is_array($ret)) { Mobile::output($ret); } else { Mobile::error("No Data", $ret); } }
function delBlacklist() { $uid = intval($this->Get['uid']); $ret = $this->FriendLogic->delBlacklist($uid); if ($ret == 200) { Mobile::success("Success"); } else { Mobile::error("Has a Error", $ret); } }
function favorite() { $uid = MEMBER_ID; $tid = (int) $this->Post['tid']; $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table("topic") . " WHERE tid='{$tid}'"); if (!$count) { Mobile::error("No Topic", 501); } $op = trim($this->Post['op']); if (in_array($op, array("add", "delete"))) { jlogic('topic_favorite')->act($uid, $tid, $op); Mobile::success("Do Success"); } else { if ($op == "check") { $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('topic_favorite') . " WHERE tid='{$tid}' AND uid='" . MEMBER_ID . "'"); if ($count > 0) { Mobile::success("Favorite", 550); } else { Mobile::success("Not Favorite", 551); } } else { Mobile::error("Not Allowed", 402); } } }
function send() { $to_user = jfilter($this->Post['to_user'], 'txt'); $member = DB::fetch_first("SELECT `nickname` FROM " . DB::table("members") . " WHERE `nickname`='{$to_user}'"); if (empty($member)) { Mobile::error("No User", 300); } $this->Post['message'] = jpost('message', 'txt'); $to_user = $member['nickname']; $data = array('to_user' => $to_user, 'message' => trim($this->Post['message'])); $ret = $this->MyPmLogic->pmSend($data); if ($ret == 0) { Mobile::success("Success"); } else { if ($ret == 1) { Mobile::error("Content not emtpy", 420); } else { if ($ret == 2) { Mobile::error("Content not emtpy", 321); } else { if (ret == 3) { Mobile::error("Content not emtpy", 321); } } } } Mobile::error("Unkonw error", 250); }
function contentsMain() { //テンプレートファイル読み込み if (!($tempHTML = @file_get_contents($this->filename))) { //テンプレートの内容を取得 Mobile::error("fileNotFound"); } return $tempHTML; }
function clearReminded() { $ops = array('at', 'comment', 'pm'); $op = $this->Get['op']; if (!in_array($op, $ops)) { Mobile::error("Error op", 402); } $f = ""; switch ($op) { case 'at': $f = 'at_new'; break; case 'comment': $f = 'comment_new'; break; case 'pm': $f = 'newpm'; break; } if (!empty($f)) { $uid = MEMBER_ID; DB::query("update `" . TABLE_PREFIX . "members` set `{$f}`='0' where `uid`='{$uid}'"); Mobile::success(); } Mobile::error("Error op", 402); }
function _uploadImage() { $field = 'author'; $type = trim(strtolower(end(explode(".", $_FILES[$field]['name'])))); if ($type != 'gif' && $type != 'jpg' && $type != 'png') { Mobile::error('Illegal Strings', 350); } $image_name = substr(md5($_FILES[$field]['name']), -10) . ".{$type}"; $sub_path = './cache/temp_images/' . $image_name[0] . '/'; $image_path = RELATIVE_ROOT_PATH . $sub_path; $image_path_abs = ROOT_PATH . $sub_path; $image_file = $image_path . $image_name; $image_file_abs = $image_path_abs . $image_name; if (!is_dir($image_path_abs)) { jio()->MakeDir($image_path_abs); } jupload()->init($image_path_abs, $field, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file_abs); } if (!$result) { jio()->RemoveDir($image_path_abs); Mobile::error('Illegal Strings', 352); } list($w, $h) = getimagesize($image_file_abs); if ($w > 601) { $tow = 599; $toh = round($tow * ($h / $w)); $result = makethumb($image_file_abs, $image_file_abs, $tow, $toh); if (!$result) { jio()->RemoveDir($image_path_abs); Mobile::error('Illegal Strings', 351); } } $up_image_path = addslashes($image_file_abs); $src_file = $image_file_abs; $image_path = RELATIVE_ROOT_PATH . 'images/face/' . face_path(MEMBER_ID); $image_path_abs = ROOT_PATH . './images/face/' . face_path(MEMBER_ID); if (!is_dir($image_path_abs)) { jio()->MakeDir($image_path_abs); } $image_file = $dst_file = $image_path . MEMBER_ID . '_b.jpg'; $image_file_abs = $dst_file_abs = $image_path_abs . MEMBER_ID . '_b.jpg'; $make_result = image_thumb($src_file, $dst_file_abs, 128, 128, 2); $image_file_small = $dst_file = $image_path . MEMBER_ID . '_s.jpg'; $image_file_small_abs = $dst_file_abs = $image_path_abs . MEMBER_ID . '_s.jpg'; $make_result = image_thumb($src_file, $dst_file_abs, 50, 50, 2); $face_url = ''; if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $face_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file_abs, '', $ftp_key); if ($ftp_result > 0) { ftpcmd('upload', $image_file_small_abs, '', $ftp_key); jio()->DeleteFile($image_file_abs); jio()->DeleteFile($image_file_small_abs); } } $sql = "update `" . TABLE_PREFIX . "members` set `face_url`='{$face_url}', `face`='{$dst_file}' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); jio()->DeleteFile($src_file); if ($this->Config['extcredits_enable'] && MEMBER_ID > 0) { update_credits_by_action('face', MEMBER_ID); } Mobile::success("Success"); }