public function render($data)
 {
     $api = new TS_API();
     $data["mid"] = $api->user_getLoggedInUser();
     $content = $this->renderFile("ShowComment", $data);
     return $content;
 }
 public function render($data)
 {
     $api = new TS_API();
     $mid = $api->user_getLoggedInUser();
     if (!$mid) {
         return false;
     }
     $site_opts = $api->option_get();
     $reasons = explode(",", $site_opts["report_reason"]);
     $data['reasons'] = $reasons;
     $data['isReport'] = $api->Report_check($data['appid'], $data['type'], $data['recordId'], $mid);
     $content = $this->renderFile("Report", $data);
     return $content;
 }
 public function render($data)
 {
     $uid = intval($_GET["uid"]);
     $api = new TS_API();
     $mid = $api->user_getLoggedInUser();
     $data["mid"] = $uid ? $uid : $mid;
     $map = "uid = 0 or uid = " . $mid;
     $data["groups"] = D("FriendGroup")->where($map)->order("id asc")->findAll();
     if ($_GET["uid"]) {
         $other = "/uid/" . $_GET["uid"];
     }
     $data["cur_url"] = isset($data['this_url']) ? $data['this_url'] : C("TS_URL") . "/index.php?s=/" . MODULE_NAME . "/" . ACTION_NAME . $other;
     $content = $this->renderFile("FriendGroup", $data);
     return $content;
 }
Пример #4
0
//ts_dump($api);
/* ===========================================================================================
 * ========================================= USER ============================================
 * ===========================================================================================
 */
/*-------------------------------------
= user_getInfo
-------------------------------------*/
$user_info = $api->user_getInfo("1,2", "name,email");
$user_info2 = $api->user_getInfo("1,2", "name,email", "json");
ts_dump($user_info);
ts_dump($user_info2);
/*-------------------------------------
= user_getLoggedInUser
-------------------------------------*/
$user_id = $api->user_getLoggedInUser();
ts_dump($user_id);
/*-------------------------------------
= user_getLoggedInUserLevel
-------------------------------------*/
$admin_level = $api->user_getLoggedInUserLevel();
ts_dump($admin_level);
/*-------------------------------------
= user_isAppAdded
-------------------------------------*/
$isAppAdded = $api->user_isAppAdded();
ts_dump($isAppAdded);
/*-------------------------------------
= user_getLinkName
-------------------------------------*/
$r = $api->user_getLinkName(1);
 public function upload($attach_type = 'attach_type', $path, $save_name, $options = array())
 {
     //检查文件名和目录是否为空
     if (empty($path)) {
         $path = C('UPLOAD_PATH') . '/' . date('Ymd') . '/';
     }
     //创建目录
     if (!checkDir($path)) {
         $return['status'] = false;
         $return['info'] = '目录创建失败: ' . $path;
         return $return;
     }
     import("ORG.Net.UploadFile");
     $upload = new UploadFile();
     //设置上传文件大小
     $upload->maxSize = empty($options['maxsize']) ? '2000000' : $options['maxsize'];
     //设置上传文件类型
     $upload->allowExts = empty($options['allowExts']) ? explode(',', strtolower('jpg,gif,png,jpeg,bmp')) : explode(',', $options['allowExts']);
     //存储规则
     $upload->saveRule = 'uniqid';
     //设置上传路径
     $upload->savePath = $path;
     //保存的名字
     $upload->saveName = $save_name;
     //是否缩略图
     $upload->thumb = empty($options['is_thumb']) ? false : $options['is_thumb'];
     $upload->thumbMaxWidth = empty($options['thumb_width']) ? '200' : $options['thumb_width'];
     $upload->thumbFile = empty($options['thumb_file']) ? 'thumb_' . $save_name : $options['thumb_file'];
     //存在是否覆盖
     $upload->uploadReplace = empty($options['is_replace']) ? true : $options['is_replace'];
     //执行上传操作
     if (!$upload->upload()) {
         //上传失败,返回错误
         $return['status'] = false;
         $return['info'] = $upload->getErrorMsg();
         return $return;
     } else {
         $upload_info = $upload->getUploadFileInfo();
         //保存信息到附件表
         $api = new TS_API();
         $uid = $api->user_getLoggedInUser();
         foreach ($upload_info as $u) {
             unset($map);
             $map['attach_type'] = $attach_type;
             $map['userId'] = $uid;
             $map['uploadTime'] = time();
             $map['name'] = $u['name'];
             $map['type'] = $u['type'];
             $map['size'] = $u['size'];
             $map['extension'] = $u['extension'];
             $map['hash'] = $u['hash'];
             $map['savepath'] = $u['savepath'];
             $map['savename'] = $u['savename'];
             //$map['savedomain']=	C('ATTACH_SAVE_DOMAIN');
             $result = $this->add($map);
             $map['id'] = $result;
             $infos[] = $map;
         }
         //输出信息
         $return['status'] = true;
         $return['info'] = $infos;
         //上传成功,返回信息
         return $return;
     }
 }
Пример #6
0
function check_relationship($uid, $mid = 0)
{
    $api = new TS_API();
    if (!$mid) {
        $mid = $api->user_getLoggedInUser();
    }
    if ($uid == $mid) {
        return 'self';
    } elseif ($api->friend_areFriends($uid, $mid)) {
        return 'friend';
    } else {
        return 'stranger';
    }
}