/** * 添加分享 * @param integer $uid 操作用户ID * @param string $app 分享应用类型,默认为public * @param string $type 分享类型, * @param array $data 分享相关数据 * @param integer $app_id 应用资源ID,默认为0 * @param string $app_table 应用资源表名,默认为feed * @param array $extUid 额外用户ID,默认为null * @param array $lessUids 去除的用户ID,默认为null * @param boolean $isAtMe 是否为进行发送,默认为true * @return mix 添加失败返回false,成功返回新的分享ID */ public function put($uid, $app = 'group', $type = '', $data = array(), $app_id = 0, $app_table = 'group_feed', $extUid = null, $lessUids = null, $isAtMe = true, $is_repost = 0) { // 判断数据的正确性 if (!$uid || $type == '') { return false; } if (strpos($type, 'postvideo') !== false) { $type = 'postvideo'; } //分享类型合法性验证 - 临时解决方案 if (!in_array($type, array('post', 'repost', 'postvideo', 'postfile', 'postimage'))) { $type = 'post'; } // //应用类型验证 用于分享框 - 临时解决方案 // if ( !in_array( $app , array('public','weiba','tipoff') ) ){ // $app = 'public'; // $type = 'post'; // $app_table = 'feed'; // } $app_table = strtolower($app_table); // 添加feed表记录 $data['gid'] = $data['gid']; $data['uid'] = $uid; $data['app'] = $app; $data['type'] = $type; $data['app_row_id'] = $app_id; $data['app_row_table'] = $app_table; $data['publish_time'] = time(); $data['from'] = isset($data['from']) ? intval($data['from']) : getVisitorClient(); $data['is_del'] = $data['comment_count'] = $data['repost_count'] = 0; $data['is_repost'] = $is_repost; //判断是否先审后发 // $weiboSet = model('Xdata')->get('admin_Config:feed'); // $weibo_premission = $weiboSet['weibo_premission']; // if(in_array('audit',$weibo_premission) || CheckPermission('core_normal','feed_audit')){ // $data['is_audit'] = 0; // }else{ $data['is_audit'] = 1; // } // 分享内容处理 if (Addons::requireHooks('weibo_publish_content')) { Addons::hook("weibo_publish_content", array(&$data)); } else { // 拼装数据,如果是评论再转发、回复评论等情况,需要额外叠加对话数据 $data['body'] = str_replace(SITE_URL, '[SITE_URL]', preg_html($data['body'])); // 获取用户发送的内容,仅仅以//进行分割 $scream = explode('//', $data['body']); // 截取内容信息为分享内容字数 - 重点 $feedConf = model('Xdata')->get('admin_Config:feed'); $feedNums = $feedConf['weibo_nums']; $body = array(); foreach ($scream as $value) { $tbody[] = $value; $bodyStr = implode('//', $tbody); if (get_str_length($bodyStr) > $feedNums) { break; } $body[] = $value; unset($bodyStr); } $data['body'] = implode('//', $body); // 获取用户发布内容 $data['content'] = trim($scream[0]); } //分享到分享的应用资源,加入原资源链接 $data['body'] .= $data['source_url']; $data['content'] .= $data['source_url']; // 分享类型插件钩子 // if($type){ // $addonsData = array(); // Addons::hook("weibo_type",array("typeId"=>$type,"typeData"=>$type_data,"result"=>&$addonsData)); // $data = array_merge($data,$addonsData); // } if ($type == 'postvideo') { $typedata = model('Video')->_weiboTypePublish($_POST['videourl']); if ($typedata && $typedata['flashvar'] && $typedata['flashimg']) { $data = array_merge($data, $typedata); } else { $data['type'] = 'post'; } } // 添加分享信息 $feed_id = $this->data($data)->add(); if (!$feed_id) { return false; } // if(!$data['is_audit']){ // $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll(); // foreach($touid as $k=>$v){ // model('Notify')->sendNotify($v['uid'], 'feed_audit'); // } // } // 添加关联数据 $feed_data = D('group_feed_data')->data(array('feed_id' => $feed_id, 'feed_data' => serialize($data), 'client_ip' => get_client_ip(), 'feed_content' => $data['body']))->add(); // 添加分享成功后 if ($feed_id && $feed_data) { //分享发布成功后的钩子 // Addons::hook("weibo_publish_after",array('weibo_id'=>$feed_id,'post'=>$data)); // 发送通知消息 - 重点 - 需要简化把上节点的信息去掉. if ($data['is_repost'] == 1) { // 转发分享 $isAtMe && ($content = $data['content']); // 内容用户 $extUid[] = $data['sourceInfo']['transpond_data']['uid']; // 资源作者用户 if ($isAtMe && !empty($data['curid'])) { // 上节点用户 $appRowData = $this->get($data['curid']); $extUid[] = $appRowData['uid']; } } else { // 其他分享 $content = $data['content']; } // 发送@消息 D('GroupAtme')->setAppName('group')->setAppTable('group_feed')->addAtme($content, $feed_id, $extUid, $lessUids, $data['gid']); $data['client_ip'] = get_client_ip(); $data['feed_id'] = $feed_id; $data['feed_data'] = serialize($data); // 主动创建渲染后的缓存 $return = $this->setFeedCache($data); $return['user_info'] = model('User')->getUserInfo($uid); $return['GroupData'] = model('UserGroupLink')->getUserGroupData($uid); //获取用户组信息 $return['feed_id'] = $feed_id; $return['app_row_id'] = $data['app_row_id']; $return['is_audit'] = $data['is_audit']; // 统计数修改 // model('UserData')->setUid($uid)->updateKey('feed_count', 1); // if($app =='public'){ //TODO 分享验证条件 // model('UserData')->setUid($uid)->updateKey('weibo_count', 1); // } if (!$return) { $this->error = L('PUBLIC_CACHE_FAIL'); // Feed缓存写入失败 } return $return; } else { $this->error = L('PUBLIC_ADMIN_OPRETING_ERROR'); // 操作失败 return false; } }
/** * 添加微博 * @param integer $uid 操作用户ID * @param string $app 微博应用类型,默认为public * @param string $type 微博类型, * @param array $data 微博相关数据 * @param integer $app_id 应用资源ID,默认为0 * @param string $app_table 应用资源表名,默认为feed * @param array $extUid 额外用户ID,默认为null * @param array $lessUids 去除的用户ID,默认为null * @param boolean $isAtMe 是否为进行发送,默认为true * @return mix 添加失败返回false,成功返回新的微博ID */ public function put($uid, $app = 'public', $type = '', $data = array(), $app_id = 0, $app_table = 'feed', $extUid = null, $lessUids = null, $isAtMe = true, $is_repost = 0) { if (isSubmitLocked()) { $this->error = '发布内容过于频繁,请稍后再试'; return false; } // 判断数据的正确性 if (!$uid || $type == '') { $this->error = L('PUBLIC_ADMIN_OPRETING_ERROR'); return false; } if (strpos($type, 'postvideo') !== false) { $type = 'postvideo'; } //微博类型合法性验证 - 临时解决方案 if (!in_array($type, array('post', 'repost', 'postvideo', 'postfile', 'postimage', 'weiba_post', 'weiba_repost'))) { $type = 'post'; } //应用类型验证 用于分享框 - 临时解决方案 if (!in_array($app, array('w3g', 'public', 'weiba', 'tipoff'))) { $app = 'public'; $type = 'post'; $app_table = 'feed'; } $app_table = strtolower($app_table); // 添加feed表记录 $data['uid'] = $uid; $data['app'] = $app; $data['type'] = $type; $data['app_row_id'] = $app_id; $data['app_row_table'] = $app_table; $data['publish_time'] = time(); $data['from'] = isset($data['from']) ? intval($data['from']) : getVisitorClient(); $data['is_del'] = $data['comment_count'] = $data['repost_count'] = 0; $data['is_repost'] = $is_repost; //判断是否先审后发 $weiboSet = model('Xdata')->get('admin_Config:feed'); $weibo_premission = $weiboSet['weibo_premission']; if (in_array('audit', $weibo_premission) || CheckPermission('core_normal', 'feed_audit')) { $data['is_audit'] = 0; } else { $data['is_audit'] = 1; } // 微博内容处理 if (Addons::requireHooks('weibo_publish_content')) { Addons::hook("weibo_publish_content", array(&$data)); } else { $content = $this->formatFeedContent($data['body']); $data['body'] = $content['body']; $data['content'] = $content['content']; } //分享到微博的应用资源,加入原资源链接 $data['body'] .= $data['source_url']; $data['content'] .= $data['source_url']; // 微博类型插件钩子 // if($type){ // $addonsData = array(); // Addons::hook("weibo_type",array("typeId"=>$type,"typeData"=>$type_data,"result"=>&$addonsData)); // $data = array_merge($data,$addonsData); // } if ($type == 'postvideo') { $typedata = model('Video')->_weiboTypePublish($_POST['videourl']); if ($typedata && $typedata['flashvar'] && $typedata['flashimg']) { $data = array_merge($data, $typedata); } else { $data['type'] = 'post'; } } // 添加微博信息 $feed_id = $this->data($data)->add(); if (!$feed_id) { return false; } if (!$data['is_audit']) { $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll(); foreach ($touid as $k => $v) { model('Notify')->sendNotify($v['uid'], 'feed_audit'); } } // 目前处理方案格式化数据 $data['content'] = str_replace(chr(31), '', $data['content']); $data['body'] = str_replace(chr(31), '', $data['body']); // 添加关联数据 $feed_data = D('FeedData')->data(array('feed_id' => $feed_id, 'feed_data' => serialize($data), 'client_ip' => get_client_ip(), 'feed_content' => $data['body']))->add(); // 添加微博成功后 if ($feed_id && $feed_data) { //锁定发布 lockSubmit(); //微博发布成功后的钩子 //Addons::hook("weibo_publish_after",array('weibo_id'=>$feed_id,'post'=>$data)); // 发送通知消息 - 重点 - 需要简化把上节点的信息去掉. if ($data['is_repost'] == 1) { // 转发微博 $isAtMe && ($content = $data['content']); // 内容用户 $extUid[] = $data['sourceInfo']['transpond_data']['uid']; // 资源作者用户 if ($isAtMe && !empty($data['curid'])) { // 上节点用户 $appRowData = $this->get($data['curid']); $extUid[] = $appRowData['uid']; } } else { // 其他微博 $content = $data['content']; //更新最近@的人 model('Atme')->updateRecentAt($content); // 内容用户 } // 发送@消息 model('Atme')->setAppName('Public')->setAppTable('feed')->addAtme($content, $feed_id, $extUid, $lessUids); $data['client_ip'] = get_client_ip(); $data['feed_id'] = $feed_id; $data['feed_data'] = serialize($data); // 主动创建渲染后的缓存 $return = $this->setFeedCache($data); $return['user_info'] = model('User')->getUserInfo($uid); $return['GroupData'] = model('UserGroupLink')->getUserGroupData($uid); //获取用户组信息 $return['feed_id'] = $feed_id; $return['app_row_id'] = $data['app_row_id']; $return['is_audit'] = $data['is_audit']; // 统计数修改 model('UserData')->setUid($uid)->updateKey('feed_count', 1); // if($app =='public'){ //TODO 微博验证条件 model('UserData')->setUid($uid)->updateKey('weibo_count', 1); // } if (!$return) { $this->error = L('PUBLIC_CACHE_FAIL'); // Feed缓存写入失败 } return $return; } else { $this->error = L('PUBLIC_ADMIN_OPRETING_ERROR'); // 操作失败 return false; } }
/** * 添加分享 * @param integer $uid 操作用户ID * @param string $app 分享应用类型,默认为public * @param string $type 分享类型, * @param array $data 分享相关数据 * @param integer $app_id 应用资源ID,默认为0 * @param string $app_table 应用资源表名,默认为feed * @param array $extUid 额外用户ID,默认为null * @param array $lessUids 去除的用户ID,默认为null * @param boolean $isAtMe 是否为进行发送,默认为true * @return mix 添加失败返回false,成功返回新的分享ID */ public function put($uid, $app = 'public', $type = '', $data = array(), $app_id = 0, $app_table = 'feed', $extUid = null, $lessUids = null, $isAtMe = true, $is_repost = 0) { if (isSubmitLocked()) { $this->error = '发布内容过于频繁,请稍后再试'; return false; } // 判断数据的正确性 if (!$uid || $type == '') { $this->error = L('PUBLIC_ADMIN_OPRETING_ERROR'); return false; } if (strpos($type, 'postvideo') !== false) { $type = 'postvideo'; } //分享类型合法性验证 - 临时解决方案 $checkType = array('post', 'repost', 'postvideo', 'postfile', 'postimage', 'weiba_post', 'weiba_repost', 'long_post', 'photo_post', 'photo_repost', 'vote_post', 'vote_repost', 'event_post', 'event_repost', 'blog_post', 'blog_repost', 'poster_post', 'poster_repost'); if (!in_array($type, $checkType)) { $type = 'post'; } //应用类型验证 用于分享框 - 临时解决方案 $checkApp = array('w3g', 'public', 'weiba', 'tipoff', 'photo', 'vote', 'event', 'blog', 'poster'); if (!in_array($app, $checkApp)) { $app = 'public'; $type = 'post'; $app_table = 'feed'; } $app_table = strtolower($app_table); // 添加feed表记录 $data['uid'] = $uid; $data['app'] = $app; $data['type'] = $type; $data['app_row_id'] = $app_id; $data['app_row_table'] = $app_table; $data['publish_time'] = time(); $data['from'] = isset($data['from']) ? intval($data['from']) : getVisitorClient(); $data['is_del'] = $data['comment_count'] = $data['repost_count'] = 0; $data['is_repost'] = $is_repost; //判断是否先审后发 $filterStatus = filter_words($data['body']); $weiboSet = model('Xdata')->get('admin_Config:feed'); $weibo_premission = $weiboSet['weibo_premission']; if (in_array('audit', $weibo_premission) || CheckPermission('core_normal', 'feed_audit') || $filterStatus['type'] == 2) { $data['is_audit'] = 0; } else { $data['is_audit'] = 1; } // 分享内容处理 if (Addons::requireHooks('weibo_publish_content')) { Addons::hook("weibo_publish_content", array(&$data)); } else { // 截取内容信息为分享内容字数 - 长分享 //$feedConf = model('Xdata')->get('admin_Config:feed'); //$feedNums = $feedConf['weibo_nums']; //if(Addons::requireHooks('show_longtext_button')){ // $feedNums = 20000; // $data['body'] = str_replace(SITE_URL, '[SITE_URL]', $data['body']); //}else{ // $data['body'] = str_replace(SITE_URL, '[SITE_URL]', preg_html($data['body'])); //} $content = $this->formatFeedContent($data['body']); $data['body'] = $content['body']; $data['content'] = $content['content']; } //分享到分享的应用资源,加入原资源链接 $data['body'] .= $data['source_url']; $data['content'] .= $data['source_url']; // 分享类型插件钩子 // if($type){ // $addonsData = array(); // Addons::hook("weibo_type",array("typeId"=>$type,"typeData"=>$type_data,"result"=>&$addonsData)); // $data = array_merge($data,$addonsData); // } if ($type == 'postvideo') { if ($_POST['video_id']) { $video_info = D('video')->where('video_id=' . $data['video_id'])->find(); $data['transfer_id'] = $video_info['transfer_id']; $data['video_path'] = $video_info['video_path']; $data['video_mobile_path'] = $video_info['video_mobile_path']; $data['video_part_path'] = $video_info['video_part_path']; $data['image_path'] = $video_info['image_path']; $data['image_width'] = $video_info['image_width']; $data['image_height'] = $video_info['image_height']; } else { $typedata = model('Video')->_weiboTypePublish($_POST['videourl']); if ($typedata && $typedata['flashvar'] && $typedata['flashimg']) { $data = array_merge($data, $typedata); } else { $data['type'] = 'post'; } } } // 添加分享信息 $feed_id = $this->data($data)->add(); if (!$feed_id) { return false; } if ($data['video_id']) { D('video')->where('video_id=' . $data['video_id'])->setField('feed_id', $feed_id); //如果有的话 if (D('video_transfer')->where('video_id=' . $data['video_id'])->count()) { D('video_transfer')->where('video_id=' . $data['video_id'])->setField('feed_id', $feed_id); } } if (!$data['is_audit']) { $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll(); foreach ($touid as $k => $v) { model('Notify')->sendNotify($v['uid'], 'feed_audit'); } } // 目前处理方案格式化数据 $data['content'] = str_replace(chr(31), '', $data['content']); $data['body'] = str_replace(chr(31), '', $data['body']); // 添加关联数据 $feed_data = D('FeedData')->data(array('feed_id' => $feed_id, 'feed_data' => serialize($data), 'client_ip' => get_client_ip(), 'client_port' => get_client_port(), 'feed_content' => $data['body']))->add(); // 添加分享成功后 if ($feed_id && $feed_data) { //锁定发布 lockSubmit(); //分享发布成功后的钩子 //Addons::hook("weibo_publish_after",array('weibo_id'=>$feed_id,'post'=>$data)); // 发送通知消息 - 重点 - 需要简化把上节点的信息去掉. if ($data['is_repost'] == 1) { // 转发分享 $isAtMe && ($content = $data['content']); // 内容用户 $extUid[] = $data['sourceInfo']['transpond_data']['uid']; // 资源作者用户 if ($isAtMe && !empty($data['curid'])) { // 上节点用户 $appRowData = $this->get($data['curid']); $extUid[] = $appRowData['uid']; } } else { // 其他分享 $content = $data['content']; //更新最近@的人 model('Atme')->updateRecentAt($content); // 内容用户 } // 发送@消息 model('Atme')->setAppName('Public')->setAppTable('feed')->addAtme($content, $feed_id, $extUid, $lessUids); $data['client_ip'] = get_client_ip(); $data['feed_id'] = $feed_id; $data['feed_data'] = serialize($data); // 主动创建渲染后的缓存 $return = $this->setFeedCache($data); $return['user_info'] = model('User')->getUserInfo($uid); $return['GroupData'] = model('UserGroupLink')->getUserGroupData($uid); //获取用户组信息 $return['feed_id'] = $feed_id; $return['app_row_id'] = $data['app_row_id']; $return['is_audit'] = $data['is_audit']; // 统计数修改 model('UserData')->setUid($uid)->updateKey('feed_count', 1); // if($app =='public'){ //TODO 分享验证条件 model('UserData')->setUid($uid)->updateKey('weibo_count', 1); // } //更新附件信息 $attach_info['app_name'] = 'public'; $attach_info['table'] = 'feed'; $attach_info['row_id'] = $feed_id; $attach_map['attach_id'] = array('IN', $data['attach_id']); model('Attach')->where($attach_map)->save($attach_info); if (!$return) { $this->error = L('PUBLIC_CACHE_FAIL'); // Feed缓存写入失败 } return $return; } else { $this->error = L('PUBLIC_ADMIN_OPRETING_ERROR'); // 操作失败 return false; } }
public function getOneLocation($id, $value, $show_transpond = true) { if (!$value) { $value = $this->getWeiboDetail($id); } if (!$value) { return false; } $result = $value; $result['is_favorited'] = isset($value['is_favorited']) ? intval($value['is_favorited']) : D('Favorite', 'weibo')->isFavorited($value['weibo_id'], $value['uid']); Addons::requireHooks("weibo_show_detail", array(&$result)); if ($show_transpond && $result['transpond_id']) { $result['expend'] = $this->getOne($result['transpond_id']); } else { if (!$result['expend']) { $result['expend'] = $this->__parseTemplate($value); } } return $result; }
<div class="input-outer"> <span class="ui-user"></span> <input type="text" name="login_email" class="text" onfocus=" if(this.value=='输入邮箱或用户名登录') this.value=''" onblur="if(this.value=='') this.value='输入邮箱或用户名登录'" value="输入邮箱或用户名登录"/> </div> <div class="input-outer"> <span class="ui-loginPwd"></span><label class="l-login login_password" style="color:#888;">输入密码</label> <input type="password" name="login_password" class="text" style=" position:absolute; z-index:100;" onfocus="$('.login_password').hide()" onblur="if(this.value=='') $('.login_password').show()" value=""/> </div> <div class="mb20"><a class="act-but submit" href="javascript:;" onclick="$('#ajax_login_form').submit();" >登录</a></div> <div class="clearfix mb20"> <a class="login-rm" event-node="login_remember" href="javascript:;"> <span class="check-ok"> <input type="hidden" name="login_remember" value="0" id="check-box" class="checkbox"/> <!-- JS选择记住密码时要JS将login_remember值变为1 --></span>记住用户名</a> <a href="<?php echo U('public/Passport/findPassword'); ?> " class="login-fgetpwd">忘记密码?</a></div> <?php if (Addons::requireHooks('login_input_footer') && Addons::hook('login_input_footer')) { ?> <div class="login-ft"> <div class="login-ft-head">使用第三方账号登录</div> <?php echo Addons::hook('login_input_footer'); ?> </div> <?php } ?> <div class="hasno-account"> <p>还没有帐号?</p> <div class="other-but"> <a onclick="javascript:window.open('<?php echo U('public/Register'); ?>