public function getAll()
 {
     $typeId = intval($_GET['typeId']);
     empty($typeId) && ($typeId = 2);
     $db_prefix = C('DB_PREFIX');
     if ($typeId == 2) {
         $follow = M('')->field('follow.fid AS fuid,user.uname AS funame')->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid")->where("follow.uid={$this->mid}")->order('follow.follow_id DESC')->findPage(15);
     } else {
         if ($typeId == 3) {
             $follow = M('')->field('follow.uid AS fuid,user.uname AS funame')->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.uid=user.uid")->where("follow.fid={$this->mid}")->order('follow.follow_id DESC')->findPage(15);
         } else {
             //目前没有好的方案高效的显示互粉的列表人.
             //默认显示互粉
             // $follow = M('')->field('follow.fid AS fuid,user.uname AS funame')
             // 			   ->table("{$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid")
             // 			   ->where("follow.uid={$this->mid} AND follow.fid IN (SELECT uid FROM {$db_prefix}user_follow WHERE fid={$this->mid})")
             // 			   ->order('follow.follow_id DESC')
             // 			   ->findPage(15);
             //$follow = M('User')->field('uid AS fuid,uname AS funame')->where("uid IN (SELECT uid FROM {$db_prefix}user_follow WHERE fid={$this->mid}) AND uid IN (SELECT fid FROM {$db_prefix}user_follow WHERE uid={$this->mid})")->findPage(15);
             //$follow = M('')->query("SELECT follow.fid AS fuid,user.uname AS funame FROM {$db_prefix}user_follow AS follow LEFT JOIN {$db_prefix}user AS user ON follow.fid=user.uid WHERE follow.uid={$this->mid} AND follow.type={$typeId}");
         }
     }
     foreach ($follow['data'] as $k => $v) {
         $out[$k]['fUid'] = $v['fuid'];
         $out[$k]['friendUserName'] = getShort($v['funame'], '3', '…');
         $out[$k]['friendHeadPic'] = getUserFace($v['fuid']);
     }
     exit(json_encode($out));
 }
Esempio n. 2
0
/**
 * getEventShort 
 * 去除标签,截取blog的长度
 * @param mixed $content 
 * @param mixed $length 
 * @access public
 * @return void
 */
function getEventShort($content, $length = 40)
{
    $content = stripslashes($content);
    $content = strip_tags($content);
    $content = getShort($content, $length);
    return $content;
}
Esempio n. 3
0
/**
 * getPosterShort 
 * 去除标签,截取blog的长度
 * @param mixed $content 
 * @param mixed $length 
 * @access public
 * @return void
 */
function getPosterShort($content, $length = 60)
{
    $content = stripslashes($content);
    $content = strip_tags($content);
    $content = getShort($content, $length);
    return $content;
}
Esempio n. 4
0
 public function __construct($hex)
 {
     $this->flightGroupCount = getShort($hex, self::HEADER_FG);
     $this->messageCount = getShort($hex, self::HEADER_MSG);
     $this->briefingOfficers = getByte($hex, self::HEADER_BRIEF);
     $this->capturedOnEject = getBool($hex, self::HEADER_CAPTURED);
 }
 /**
  * 发帖同步到分享
  * @param integer post_id 帖子ID
  * @param string title 帖子标题
  * @param string content 帖子内容
  * @param integer uid 发布者uid
  * @return integer feed_id 分享ID
  */
 public function syncToFeed($post_id, $title, $content, $uid)
 {
     $d['content'] = '';
     $d['body'] = '【' . $title . '】' . getShort($content, 100) . ' ';
     $feed = model('Feed')->put($uid, 'weiba', 'weiba_post', $d, $post_id, 'weiba_post');
     return $feed['feed_id'];
 }
Esempio n. 6
0
function getShortSp($str, $num)
{
    if (utf8_strlen($str) > $num) {
        $tag = '...';
    }
    $str = getShort($str, $num) . $tag;
    return $str;
}
 public function syncToFeed($info_id, $title, $content, $uid)
 {
     $d['content'] = '';
     $d['body'] = getShort($content, 100) . '【' . $title . '】' . ' ' . U('cat/Index/info', array('info_id' => $info_id));
     $feed = M('Feed')->syncToFeed($d['body'], $uid, '0');
     // $feed = model('Feed')->put($uid, 'weiba', 'weiba_post', $d, $post_id, 'weiba_post');
     return $feed['feed_id'];
 }
Esempio n. 8
0
function IsHotList()
{
    //读取推荐列表
    $votes = M('vote')->where(' isHot="1" ')->order('rTime DESC')->limit(20)->findAll();
    foreach ($votes as &$value) {
        $value['username'] = getUserName($value['uid']);
        $value['title'] = getShort($value['title'], 12 - strlen($value['username']) / 2);
    }
    return $votes;
}
 protected function renderFile($data)
 {
     $out = '<select name="' . $data['form_name'] . '" id="' . $data['form_id'] . '">';
     foreach ($data['data'] as $vo) {
         if ($vo['id'] == intval($data['selected'])) {
             $out .= '<option value="' . $vo['id'] . '" selected="selected">' . getShort($vo['name'], 13) . '</option>';
         } else {
             $out .= '<option value="' . $vo['id'] . '">' . getShort($vo['name'], 13) . '</option>';
         }
     }
     $out .= '</select>';
     return $out;
 }
Esempio n. 10
0
 function __construct($hex)
 {
     $this->time = getShort($hex, 0);
     $type = getShort($hex, 2);
     if (isset($this->EventTypes[$type])) {
         $this->type = $this->EventTypes[$type];
     } else {
         $this->type = array('Name' => 'Unknown' . $type, 'Variables' => array());
     }
     for ($i = 0; $i < count($this->type['Variables']); $i++) {
         $this->variables[] = getShort($hex, 2 + $i * 2);
     }
     $this->length = count($this->variables) * 2 + 4;
     //a short for each variable plus time and type;
 }
 /**
  * 选择好友Widget
  * 
  * $data的参数:
  * array(
  * 	'name'(可选)	=> '表单的name', // 默认为"fri_ids"
  * )
  * 
  * @see Widget::render()
  */
 public function render($data)
 {
     $follow_group_status = D('FollowGroup', 'weibo')->getGroupStatus($data['uid'], $data['fid']);
     foreach ($follow_group_status as $k => $v) {
         $v['title'] = (strlen($v['title']) + mb_strlen($v['title'], 'UTF8')) / 2 > 6 ? getShort($v['title'], 3) . '...' : $v['title'];
         $data['status'] .= $v['title'] . ',';
         if (!empty($follow_group_status[$k + 1]) && (strlen($data['status']) + mb_strlen($data['status'], 'UTF8')) / 2 >= 13) {
             $data['status'] .= '···,';
             break;
         }
     }
     $data['status'] = substr($data['status'], 0, -1);
     $content = $this->renderFile(ADDON_PATH . '/widgets/FollowGroup.html', $data);
     return $content;
 }
Esempio n. 12
0
 /**
  * 添加微博进入频道
  * @return json 操作后的相关信息数据
  */
 public function doAddChannel()
 {
     // 微博ID
     $feedId = intval($_POST['feedId']);
     // 判断资源是否删除
     $fmap['feed_id'] = $feedId;
     $fmap['is_del'] = 0;
     $isExist = model('Feed')->where($fmap)->count();
     if ($isExist == 0) {
         $return['status'] = 0;
         $return['info'] = '内容已被删除,推荐失败';
         exit(json_encode($return));
     }
     // 频道ID数组
     $channelIds = t($_POST['data']);
     $channelIds = explode(',', $channelIds);
     $channelIds = array_filter($channelIds);
     $channelIds = array_unique($channelIds);
     if (empty($feedId)) {
         $res['status'] = 0;
         $res['info'] = '推荐失败';
         exit(json_encode($res));
     }
     // 添加微博进入频道
     $result = D('Channel', 'channel')->setChannel($feedId, $channelIds);
     if ($result) {
         if (!empty($channelIds)) {
             $config['feed_content'] = getShort(D('feed_data')->where('feed_id=' . $feedId)->getField('feed_content'), 10);
             $map['channel_category_id'] = array('in', $channelIds);
             $config['channel_name'] = implode(',', getSubByKey(D('channel_category')->where($map)->field('title')->findAll(), 'title'));
             $uid = D('feed')->where('feed_id=' . $feedId)->getField('uid');
             $config['feed_url'] = '<a target="_blank" href="' . U('channel/Index/index', array('cid' => $channelIds[0])) . '">点此查看</a>';
             model('Notify')->sendNotify($uid, 'channel_add_feed', $config);
             //添加积分
             model('Credit')->setUserCredit($uid, 'recommend_to_channel');
         }
         if (empty($channelIds)) {
             //添加积分
             model('Credit')->setUserCredit($uid, 'unrecommend_to_channel');
         }
         $res['status'] = 1;
         $res['info'] = '推荐成功';
     } else {
         $res['status'] = 0;
         $res['info'] = '推荐失败';
     }
     exit(json_encode($res));
 }
 public function setFollowGroup()
 {
     $gid = intval($_REQUEST['gid']);
     $fid = intval($_REQUEST['fid']);
     $followGroupDao = D('FollowGroup');
     $followGroupDao->setGroupStatus($this->mid, $fid, $gid);
     $follow_group_status = $followGroupDao->getGroupStatus($this->mid, $fid);
     foreach ($follow_group_status as $k => $v) {
         $v['title'] = (strlen($v['title']) + mb_strlen($v['title'], 'UTF8')) / 2 > 6 ? getShort($v['title'], 3) . '...' : $v['title'];
         $_follow_group_status .= $v['title'] . ',';
         if (!empty($follow_group_status[$k + 1]) && (strlen($_follow_group_status) + mb_strlen($_follow_group_status, 'UTF8')) / 2 >= 13) {
             $_follow_group_status .= '···,';
             break;
         }
     }
     $_follow_group_status = substr($_follow_group_status, 0, -1);
     exit($_follow_group_status);
 }
Esempio n. 14
0
 /**
  * 为新用户创建默认数据
  * @param integer $uid 用户UID
  * @return void
  */
 public function createNewData($uid = 0)
 {
     // 创建默认相册
     if (intval($uid) <= 0) {
         $uid = $GLOBALS['ts']['mid'];
     }
     $count = $this->where("userId='{$uid}' AND isDel=0")->count();
     if ($count == 0) {
         $name = getShort(getUserName($uid), 5) . '的相册';
         // 默认的相册名
         $album['cTime'] = time();
         $album['mTime'] = time();
         $album['userId'] = $uid;
         $album['name'] = $name;
         $album['privacy'] = 1;
         $this->add($album);
     }
 }
Esempio n. 15
0
 /**
  * 首页右侧数据查询
  */
 private function _indexRight()
 {
     $list = D('Category')->order('pid')->findAll();
     $catelist = array();
     foreach ($list as $v) {
         if ($v['pid'] && $catelist[$v['pid']]) {
             $catelist[$v['pid']]['child'][] = $v;
         } else {
             $catelist[$v['id']] = $v;
         }
     }
     $hotlist = D('Group', 'group')->getHotList();
     foreach ($hotlist as &$hv) {
         $hv['short_name'] = getShort($hv['name'], 10);
         $hv['logo'] = logo_path_to_url($hv['logo']);
     }
     $this->assign('hotlist', $hotlist);
     $this->assign('catelist', $catelist);
 }
Esempio n. 16
0
 public function commentVote()
 {
     $this->data['with_new_weibo'] = intval($this->data['with_new_weibo']);
     //$this->data['type']					= t($this->data['type']);
     $this->data['type'] = 'vote';
     $this->data['appid'] = intval($this->data['appid']);
     $this->data['comment'] = $this->data['comment'];
     $this->data['to_id'] = intval($this->data['to_id']);
     $this->data['author_uid'] = intval($this->data['author_uid']);
     $this->data['title'] = t(html_entity_decode($this->data['title'], ENT_QUOTES, 'UTF-8'));
     $this->data['url'] = urldecode($this->data['url']);
     $this->data['table'] = t($this->data['table']);
     $this->data['id_field'] = t($this->data['id_field']);
     $this->data['comment_count_field'] = t($this->data['comment_count_field']);
     $app_alias = getAppAlias($this->data['type']);
     // 被回复内容
     $former_comment = array();
     if ($this->data['to_id'] > 0) {
         $former_comment = M('comment')->where("`id`='{$this->data['to_id']}'")->find();
     }
     // 插入新数据
     $map['type'] = $this->data['type'];
     // 应用名
     $map['appid'] = $this->data['appid'];
     $map['appuid'] = $this->data['author_uid'];
     $map['uid'] = $this->mid;
     $map['comment'] = t(getShort($this->data['comment'], $GLOBALS['ts']['site']['length']));
     $map['cTime'] = time();
     $map['toId'] = $this->data['to_id'];
     $map['status'] = 0;
     // 0: 未读 1:已读
     $map['quietly'] = 0;
     $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $this->data['author_uid'];
     $map['data'] = serialize(array('title' => $this->data['title'], 'url' => $this->data['url'], 'table' => $this->data['table'], 'id_field' => $this->data['id_field'], 'comment_count_field' => $this->data['comment_count_field']));
     if (empty($map['type']) && empty($map['appid']) && empty($map['appuid']) && empty($map['comment'])) {
         return 0;
     }
     $res = M('comment')->add($map);
     return $res;
 }
Esempio n. 17
0
 /**
  * 渲染关注用户分组调整模板
  * @example
  * $data['uid'] integer 用户ID
  * $data['fid'] integer 关注用户ID
  * $data['follow_group_status'] array 指定关注用户的分组信息
  * @data['tpl'] string 模板字段
  * @param array $data 配置的相关信息
  * @return string 渲染后的模板数据
  */
 public function render($data)
 {
     // 选择模板
     $template = empty($data['tpl']) ? 'FollowGroup' : t($data['tpl']);
     // 关注用户分类信息
     $followGroupStatus = $data['follow_group_status'];
     // 组装数据
     foreach ($followGroupStatus as $key => $value) {
         $value['gid'] != 0 && ($value['title'] = (strlen($value['title']) + mb_strlen($value['title'], 'UTF8')) / 2 > 4 ? getShort($value['title'], 2) : $value['title']);
         $data['status'] .= $value['title'] . ',';
         if (!empty($followGroupStatus[$key + 1]) && (strlen($data['status']) + mb_strlen($data['status'], 'UTF8')) / 2 >= 6) {
             $data['status'] .= '...,';
             break;
         }
     }
     $data['status'] = substr($data['status'], 0, -1);
     $title = getSubByKey($followGroupStatus, 'title');
     // 用于存储原始数据
     $data['title'] = implode(',', $title);
     $content = $this->renderFile(dirname(__FILE__) . '/' . $template . '.html', $data);
     return $content;
 }
 function report_list()
 {
     $dao = D("Report");
     $data = $dao->order("cTime desc")->findPage(10);
     //dump($data["data"]);
     echo "<table>";
     echo "<tr>";
     echo "<td>举报人</td>";
     echo "<td>链接</td>";
     echo "<td>原因</td>";
     echo "<td>举报时间</td>";
     echo "</tr>";
     foreach ($data["data"] as $key => $v) {
         echo "<tr>";
         echo "<td>" . getUserName($v["uid"]) . "</td>";
         echo "<td><a href='" . $v["url"] . "'>" . getShort($v["info"], 30) . "</a></td>";
         echo "<td>" . $v["reason"] . "</td>";
         echo "<td>" . friendlyDate($v["cTime"]) . "</td>";
         echo "</tr>";
     }
     echo "</table>";
 }
Esempio n. 19
0
 public function __construct($byteString)
 {
     $this->platformID = getShort($byteString, self::HEADER_START);
     $this->flightGroupCount = getShort($byteString, self::HEADER_FG);
     $this->messageCount = getShort($byteString, self::HEADER_MSG);
     for ($i = 0; $i < self::IFF_COUNT; $i++) {
         $this->IFFNames[] = getString($byteString, self::HEADER_IFF + $i * self::IFF_LENGTH, self::IFF_LENGTH);
     }
     for ($r = 0; $r < self::REGION_COUNT; $r++) {
         $this->regionNames[] = getString($byteString, self::HEADER_REGION + $r * self::REGION_LENGTH, self::REGION_LENGTH);
     }
     for ($c = 0; $c < self::CARGO_COUNT; $c++) {
         $this->globalCargos[] = new GlobalCargo(substr($byteString, self::HEADER_CARGO + $c * GlobalCargo::LENGTH, GlobalCargo::LENGTH));
     }
     for ($g = 0; $g < self::GG_COUNT; $g++) {
         $this->globalGroupNames[] = getString($byteString, self::HEADER_GG + $g * self::GG_LENGTH, self::GG_LENGTH);
     }
     $this->hangar = getByte($byteString, self::HEADER_HANGAR);
     $this->timeLimitMinutes = getByte($byteString, self::HEADER_TIME);
     $this->endMissionWhenComplete = getBool($byteString, self::HEADER_END);
     $this->briefingOfficer = getByte($byteString, self::HEADER_OFFICER);
     $this->briefingLogo = getByte($byteString, self::HEADER_LOGO);
     $this->hex = \Hex::hexToStr($byteString);
 }
Esempio n. 20
0
 public function commentBlog()
 {
     $map['type'] = $this->data['type'];
     // 应用名
     $map['type'] = 'blog';
     $map['appid'] = $this->data['appid'];
     //知识id
     $map['appuid'] = $this->data['author_uid'];
     //作者uid
     $map['uid'] = $this->mid;
     $map['comment'] = t(getShort($this->data['comment'], $GLOBALS['ts']['site']['length']));
     $map['cTime'] = time();
     //$map['toId']	= $this->data['to_id'];//废弃
     $map['status'] = 0;
     // 0: 未读 1:已读
     $map['quietly'] = 0;
     $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $this->data['author_uid'];
     $map['data'] = serialize(array('title' => $this->data['title'], 'url' => $this->data['url'], 'table' => $this->data['table'], 'id_field' => $this->data['id_field'], 'comment_count_field' => $this->data['comment_count_field']));
     if (empty($map['type']) || empty($map['comment']) || empty($map['appid']) || empty($map['appuid'])) {
         return 0;
     }
     $res = M('comment')->add($map);
     return $res;
 }
Esempio n. 21
0
 function addTopic()
 {
     $this->need_login();
     if (IS_POST) {
         $title = getShort($_POST['title'], 30);
         if (empty($title)) {
             $this->ajaxReturn(false, '标题不能为空', false);
         }
         $this->__checkContent($_POST['content'], 10, 5000);
         $topic['gid'] = $this->gid;
         $topic['uid'] = $this->mid;
         $topic['name'] = getUserName($this->mid);
         $topic['title'] = h(t($title));
         $topic['cid'] = intval($_POST['cid']);
         $topic['addtime'] = time();
         $topic['replytime'] = time();
         $topic['image_ids'] = implode(',', array_filter(explode('|', $_POST['image_ids'])));
         $tid = D('Topic', 'group')->add($topic);
         if ($tid) {
             $post['gid'] = $this->gid;
             $post['uid'] = $this->mid;
             $post['tid'] = $tid;
             $post['content'] = h($_POST['content']);
             $post['istopic'] = 1;
             $post['ctime'] = time();
             $post['ip'] = get_client_ip();
             $post['image_ids'] = $topic['image_ids'];
             $post_id = $this->post->add($post);
             D('GroupFeed', 'group')->syncToFeed('我发布了一个微吧帖子“' . t($_POST['title']) . '”,详情请点击' . U('group/Topic/topic', array('tid' => $tid, 'gid' => $this->gid)), $this->mid, 0, 0, $this->gid);
             $res['tid'] = $tid;
             $res['gid'] = $this->gid;
             return $this->ajaxReturn($res, '发布成功', 1);
         } else {
             $this->ajaxReturn(false, '发帖失败', false);
         }
     } else {
         $category_list = $this->topic->categoryList($this->gid);
         $this->assign('category_list', $category_list);
         $this->display();
     }
 }
Esempio n. 22
0
 public function update($text, $opt)
 {
     require_once 'renren/HttpRequestService.class.php';
     require_once 'renren/RenrenRestApiService.class.php';
     $refresh_uri = 'https://graph.renren.com/oauth/token?grant_type=refresh_token&refresh_token=' . $opt["oauth_token_secret"] . '&client_id=' . RENREN_KEY . '&client_secret=' . RENREN_SECRET;
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $refresh_uri);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $result = curl_exec($ch);
     $res = json_decode($result);
     $access_token = $res->access_token;
     $refresh_token = $res->refresh_token;
     $config = new stdClass();
     $config->APIURL = 'http://api.renren.com/restserver.do';
     $config->APIKey = RENREN_KEY;
     $config->SecretKey = RENREN_SECRET;
     $config->APIVersion = '1.0';
     $config->decodeFormat = 'json';
     $GLOBALS['config'] =& $config;
     $rrObj = new RenrenRestApiService();
     $params = array('name' => getShort($opt["feed_content"], 30), 'description' => $opt["feed_content"], 'url' => $opt["feed_url"], 'image' => $opt["pic_url"], 'action_name' => $GLOBALS['ts']['site']['site_name'], 'action_link' => $opt["feed_url"], 'message' => '分享', 'access_token' => $access_token);
     $res = $rrObj->rr_post_curl('feed.publishFeed', $params);
     return true;
 }
                            <a href="#" class="dropdown-toggle login-nav" data-toggle="dropdown" style="">
                                <?php 
    if (!empty($myinfo[headimgurl])) {
        ?>
<img class="admin_head url" src="<?php 
        echo $myinfo["headimgurl"];
        ?>
"/>
                                <?php 
    } else {
        ?>
                                    <img class="admin_head default" src="/Public/Home/images/default.png"/><?php 
    }
    ?>
                                <?php 
    echo getShort($myinfo["nickname"], 4);
    ?>
<b class="pl_5 fa fa-sort-down"></b>
                            </a>
                            <ul class="dropdown-menu" style="display:none">
                               <?php 
    if ($mid == C('USER_ADMINISTRATOR')) {
        ?>
<li><a href="<?php 
        echo U('Admin/Index/Index');
        ?>
" target="_blank">后台管理</a></li><?php 
    }
    ?>
                            	<li><a href="<?php 
    echo U('Home/Public/lists');
 /**
  * 注册流程 - 第四步骤
  */
 public function getNRelatedUser()
 {
     $type = intval($_POST['type']);
     if ($type == '5') {
         //按推荐用户
         $sql = "SELECT uid FROM `ts_user_verified` WHERE usergroup_id=5 AND verified=1 order by rand() limit 8";
         $list = M()->query($sql);
         $uids = getSubByKey($list, 'uid');
         $userInfos = model('User')->getUserInfoByUids($uids);
         foreach ($list as $v) {
             $key = $v['uid'];
             $arr[$key]['userInfo'] = $userInfos[$key];
         }
     } else {
         $arr = model('RelatedUser')->getRelatedUserByType($type, 18);
     }
     $html = '';
     $i = 18 * $type;
     foreach ($arr as $vo) {
         $html .= '<li>';
         $html .= '<div class="person-pic"><img src="' . $vo['userInfo']['avatar_middle'] . '" height="80px" width="80px"/></div>';
         $html .= '<h class="person-nickname">' . getShort($vo['userInfo']['uname'], 5) . '</h>';
         $html .= '<div class="checkbox-area">';
         $html .= '<input type="checkbox" name="fids[]" value="' . $vo['userInfo']['uid'] . '" class="checkbox" id="check-box-' . $i . '"/>';
         $html .= '<label for="check-box-' . $i . '"></label>';
         $html .= '</div>';
         $html .= '</li>';
         $i++;
     }
     echo $html;
 }
Esempio n. 25
0
 /**
  * getHotList
  * 推荐列表
  * @param mixed $map
  * @param mixed $act
  */
 public function getHotList()
 {
     $opts_ids = self::factoryModel('opts')->field('id')->where('isHot=1')->limit(5)->findAll();
     foreach ($opts_ids as &$v) {
         $v = $v['id'];
     }
     $event_map['optsId'] = array('in', $opts_ids);
     $event_ids = $this->where($event_map)->findAll();
     $typeDao = self::factoryModel('type');
     foreach ($event_ids as &$v) {
         $v['type'] = $typeDao->getTypeName($v['type']);
         $v['address'] = getShort($v['address'], 6);
         $v['coverId'] = getCover($v['coverId'], 100, 100);
     }
     return $event_ids;
 }
Esempio n. 26
0
 /**
  * 私信管理列表
  * @param integer $isRec [description]
  * @return void
  */
 public function message($isRec = 0)
 {
     // 搜索区别
     $_POST['rec'] = $isRec = isset($_REQUEST['rec']) ? t($_REQUEST['rec']) : $isRec;
     // 列表字段配置
     $this->pageKeyList = array('message_id', 'fuid', 'from_uid', 'mix_man', 'content', 'mtime', 'DOACTION');
     // 搜索字段配置
     $this->searchKey = array('from_uid', 'mix_man', 'content');
     // Tab标签配置
     $this->pageTab[] = array('title' => L('PUBLIC_PRIVATE_MESSAGE_MANAGEMENT'), 'tabHash' => 'list', 'url' => U('admin/Content/message'));
     $this->pageTab[] = array('title' => L('PUBLIC_RECYCLE_BIN'), 'tabHash' => 'rec', 'url' => U('admin/Content/messageRec'));
     // 批量操作按钮配置
     $this->pageButton[] = array('title' => L('PUBLIC_MASSAGE_SEARCH'), 'onclick' => "admin.fold('search_form')");
     if ($isRec == 0) {
         $this->pageButton[] = array('title' => L('PUBLIC_MASSAGE_DEL'), 'onclick' => "admin.ContentEdit('','delMessage','" . L('PUBLIC_STREAM_DELETE') . "','" . L('PUBLIC_PRIVATE_MESSAGE') . "');");
     } else {
         $this->pageButton[] = array('title' => L('PUBLIC_REMOVE_COMPLETELY'), 'onclick' => "admin.ContentEdit('','deleteMessage','" . L('PUBLIC_REMOVE_COMPLETELY') . "','" . L('PUBLIC_PRIVATE_MESSAGE') . "')");
     }
     $isRec == 1 && ($_REQUEST['tabHash'] = 'rec');
     $this->assign('pageTitle', $isRec ? L('PUBLIC_RECYCLE_BIN') : L('PUBLIC_PRIVATE_MESSAGE_MANAGEMENT'));
     // 未删除的
     $map['a.is_del'] = $isRec == 1 ? 1 : 0;
     !empty($_POST['from_uid']) && ($map['a.from_uid'] = intval($_POST['from_uid']));
     !empty($_POST['mix_man']) && ($map['c.member_uid'] = intval($_POST['mix_man']));
     !empty($_POST['content']) && ($map['a.content'] = array('like', '%' . t($_POST['content']) . '%'));
     $map['b.type'] = array('neq', 3);
     // 获取列表信息
     $listData = model('Message')->getDetailList($map);
     // 整理列表数据
     foreach ($listData['data'] as &$v) {
         $uids = explode('_', $v['min_max']);
         $map = array();
         $map['uid'] = array('in', $uids);
         $uname = model('User')->where($map)->getHashList('uid', 'uname');
         $v['mix_man'] = implode(',', $uname);
         if ($v['fuid'] == '1') {
             $v['fuid'] = L('PUBLIC_SYSTEM');
         } else {
             $v['fuid'] = $uname[$v['fuid']];
         }
         if ($v['from_uid'] == '1') {
             $v['from_uid'] = L('PUBLIC_SYSTEM');
         } else {
             $v['from_uid'] = $uname[$v['from_uid']];
         }
         $v['content'] = '<div style="width:500px">' . getShort($v['content'], 120, '...') . '</div>';
         // 截取120字
         $v['mtime'] = date('Y-m-d H:i:s', $v['mtime']);
         $v['DOACTION'] = $isRec == 0 ? "<a href='javascript:void(0)' onclick='admin.ContentEdit({$v['message_id']},\"delMessage\",\"" . L('PUBLIC_STREAM_DELETE') . "\",\"" . L('PUBLIC_PRIVATE_MESSAGE') . "\");'>" . L('PUBLIC_STREAM_DELETE') . "</a>" : "<a href='javascript:void(0)' onclick='admin.ContentEdit({$v['message_id']},\"MessageRecover\",\"" . L('PUBLIC_RECOVER') . "\",\"" . L('PUBLIC_PRIVATE_MESSAGE') . "\")'>" . L('PUBLIC_RECOVER') . "</a>";
     }
     // 设置操作主键
     $this->_listpk = 'message_id';
     $this->displayList($listData);
 }
Esempio n. 27
0
 /**
  * 设置指定用户的分组
  * @param int    $gid    分组ID
  * @param int    $fid    用户ID
  * @param string $action 操作状态类型,空、add、delete
  */
 private function _setFollowGroup($gid, $fid, $add)
 {
     $followGroupDao = D('FollowGroup');
     $followGroupDao->setGroupStatus($this->mid, $fid, $gid, $add);
     $follow_group_status = $followGroupDao->getGroupStatus($this->mid, $fid);
     foreach ($follow_group_status as $k => $v) {
         $v['gid'] != 0 && ($v['title'] = (strlen($v['title']) + mb_strlen($v['title'], 'UTF8')) / 2 > 4 ? getShort($v['title'], 2) : $v['title']);
         $_follow_group_status .= $v['title'] . ',';
         if (!empty($follow_group_status[$k + 1]) && (strlen($_follow_group_status) + mb_strlen($_follow_group_status, 'UTF8')) / 2 >= 6) {
             $_follow_group_status .= '...,';
             break;
         }
     }
     $_follow_group_status = substr($_follow_group_status, 0, -1);
     S('weibo_followlist_' . $this->mid, null);
     $result['title'] = $_follow_group_status;
     $title = getSubByKey($follow_group_status, 'title');
     // 用于存储原始数据
     $result['oldTitle'] = implode(',', $title);
     return $result;
 }
Esempio n. 28
0
 public function ajax_after_publish_weibo()
 {
     set_time_limit(0);
     ignore_user_abort(1);
     $feedid = intval($_POST['feed_id']);
     if (!$feedid) {
         return;
     }
     $feeddata = D('FeedData')->where('feed_id=' . $feedid)->getField('feed_data');
     $data = unserialize($feeddata);
     $id = $feedid;
     //如果传递了一次性同步参数?以参数为主:否则以帐号绑定同步设置为主
     $sync = $_POST['sync'];
     $content = $data['content'];
     if ($data['type'] == 'postimage') {
         $attach_id = intval($data['attach_id'][0]);
         $attach = model('Attach')->where('attach_id=' . $attach_id)->find();
         $cloud = model('CloudImage');
         if ($cloud->isOpen()) {
             $is_cloud = ture;
             $pic = $cloud->getImageUrl($attach['save_path'] . $attach['save_name']);
             $pic_url = $pic;
             if (!file_exists($pic)) {
                 $tmp_path = UPLOAD_PATH . '/weibo_tmp/';
                 @mkdir($tmp_path, 0777, true);
                 $tmp_file = uniqid() . '.jpg';
                 @file_put_contents($tmp_path . $tmp_file, file_get_contents($pic));
                 $pic = $tmp_path . $tmp_file;
             }
         } else {
             $pic = UPLOAD_PATH . '/' . $attach['save_path'] . $attach['save_name'];
             $pic_url = UPLOAD_URL . '/' . $attach['save_path'] . $attach['save_name'];
         }
     }
     $feed_url = U('public/Profile/feed', array('feed_id' => $id, 'uid' => $data['uid']));
     //if(!empty($sync)){
     $result = array();
     // foreach($sync as $key=>$v){
     //     $sync[$key] = "'{$v}'";
     // }
     //
     $opt = M('login')->where('uid=' . intval($data['uid']) . ' and is_sync=1')->findAll();
     // Url格式化问题
     $formatContent = model('Feed')->formatFeedContent($content, 128);
     $content = $formatContent['body'];
     //content需要截取成128字
     $content = getShort($content, 128, '..');
     $content = str_ireplace('[SITE_URL]', SITE_URL, $content);
     foreach ($opt as $v) {
         if ($v['type'] == 'location') {
             continue;
         }
         $this->_loadTypeLogin($v['type']);
         $v['pic'] = $pic;
         $v['pic_url'] = $pic_url;
         $v['feed_url'] = $feed_url;
         $v['feed_content'] = $content;
         $platform = new $v['type']();
         switch ($data['type']) {
             case 'post':
                 $syncData = $platform->update($content . ' ' . $feed_url, $v);
                 break;
             case 'postimage':
                 $syncData = $platform->upload($content . ' ' . $feed_url, $v, $pic);
                 //if($is_cloud)
                 //    @unlink($tmp_path.$tmp_file);
                 break;
             default:
                 $syncData = $platform->update($content . ' ' . $feed_url, $v);
                 return;
         }
         //记录发的新分享到数据库
         if (empty($result)) {
             $result = $platform->saveData($syncData);
         } else {
             $result = array_merge($result, $platform->saveData($syncData));
         }
     }
     // if(!empty($result)){
     //     $dao = M('login_weibo');
     //     $result['weiboId'] = $id;
     //     $dao->add($result);
     // }
     //}
 }
 function follow()
 {
     $data['type'] = $_GET['type'] == 'follower' ? 'follower' : 'following';
     if ($data['type'] == 'following') {
         //关注分组列表
         $data['gid'] = is_numeric($_GET['gid']) ? $_GET['gid'] : 'all';
         $group_list = D('FollowGroup', 'weibo')->getGroupList($this->uid);
         //调整分组列表
         if (!empty($group_list)) {
             $group_count = count($group_list);
             for ($i = 0; $i < $group_count; $i++) {
                 if ($group_list[$i]['follow_group_id'] != $data['gid']) {
                     $group_list[$i]['title'] = (strlen($group_list[$i]['title']) + mb_strlen($group_list[$i]['title'], 'UTF8')) / 2 > 8 ? getShort($group_list[$i]['title'], 3) . '...' : $group_list[$i]['title'];
                 }
                 if ($i < 2) {
                     $data['group_list_1'][] = $group_list[$i];
                 } else {
                     if ($group_list[$i]['follow_group_id'] == $data['gid']) {
                         $data['group_list_1'][2] = $group_list[$i];
                         continue;
                     }
                     $data['group_list_2'][] = $group_list[$i];
                 }
             }
             if (empty($data['group_list_1'][2]) && !empty($data['group_list_2'][0])) {
                 $data['group_list_1'][2] = $data['group_list_2'][0];
                 unset($data['group_list_2'][0]);
             }
         }
     }
     // 关注的人列表
     $data['list'] = D('Follow', 'weibo')->getList($this->uid, $data['type'], 0, $data['gid']);
     $this->assign($data);
     $this->setTitle(getUserName($this->uid) . 'của ' . ($data['type'] == 'follower' ? '粉丝' : '关注'));
     $this->display();
 }
Esempio n. 30
0
 /**
  * 添加新的私信列表
  * @param array $data 私信列表相关数据
  * @param integer $from_uid 发布人ID
  * @return mix 添加失败返回false,成功返回新的私信列表ID
  */
 private function _addMessageList($data, $from_uid)
 {
     if (!$data['content'] || !is_array($data['member']) || !$from_uid) {
         return false;
     }
     $list['from_uid'] = $from_uid;
     $list['title'] = $data['title'] ? t($data['title']) : t(getShort($data['content'], 20));
     $list['member_num'] = count($data['member']);
     $list['type'] = is_numeric($data['type']) ? $data['type'] : (2 == $list['member_num'] ? 1 : 2);
     $list['min_max'] = $this->_getUidMinMax($data['member']);
     $list['mtime'] = $data['mtime'];
     $list['last_message'] = serialize(array('from_uid' => $from_uid, 'content' => h($data['content'])));
     $list_map['type'] = $list['type'];
     $list_map['min_max'] = $list['min_max'];
     if (1 == $list['type'] && ($list_id = D('message_list')->getField('list_id', $list_map))) {
         $list_map['list_id'] = $list_id;
         $_list['member_num'] = $list['member_num'];
         $_list['last_message'] = $list['last_message'];
         false === D('message_list')->where($list_map)->data($_list)->save() && ($list_id = false);
     } else {
         $list_id = D('message_list')->data($list)->add();
     }
     return $list_id;
 }