function checkFollow() { $uid = intval($this->Get['uid']); $ret = $this->FriendLogic->checkFollow($uid); Mobile::success("Success", $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 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 deleteMsg() { $pmid = intval($this->Post['pmid']); $this->MyPmLogic->delMsg($pmid); Mobile::success("Success"); }
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"); }