<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: Search.php 29325 2012-04-01 09:17:16Z zhouxiaobo $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
Cloud::loadFile('Service_SearchHelper');
class Cloud_Service_Server_Search extends Cloud_Service_Server_Restful {
protected static $_instance;
public static function getInstance() {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
public function onSearchGetUserGroupPermissions($userGroupIds) {
if (!$userGroupIds) {
return array();
}
$result = Cloud_Service_SearchHelper::getUserGroupPermissions($userGroupIds);
return $result;
}
public function onSearchGetUpdatedPosts($num, $lastPostIds = array()) {
if ($lastPostIds) {
C::t('forum_postlog')->delete_by_pid($lastPostIds);
}
$result = array();
$totalNum = C::t('forum_postlog')->count();
if (!$totalNum) {
return $result;
}
$result['totalNum'] = $totalNum;
$pIds = $deletePosts = $updatePostIds = array();
$unDeletePosts = array();
$posts = array();
foreach(C::t('forum_postlog')->fetch_all_order_by_dateline($num) as $post) {
$pIds[] = $post['pid'];
if ($post['action'] == 'delete') {
$deletePosts[$post['pid']] = array(
'pId' => $post['pid'],
'action' => $post['action'],
'updated' => dgmdate($post['dateline'], 'Y-m-d H:i:s', 8),
);
} else {
$unDeletePosts[$post['pid']] = array(
'pId' => $post['pid'],
'action' => $post['action'],
'updated' => dgmdate($post['dateline'], 'Y-m-d H:i:s', 8),
);
}
}
if($pIds) {
if($unDeletePosts) {
$gfIds = array(); // groupForumIds
$posts = $this->_getPosts(array_keys($unDeletePosts));
foreach($unDeletePosts as $pId => $updatePost) {
if($posts[$pId]) {
$unDeletePosts[$pId] = array_merge($updatePost, $posts[$pId]);
} else {
$unDeletePosts[$pId]['pId'] = 0;
}
if($posts[$pId]['isGroup']) {
$gfIds[$posts[$pId]['fId']] = $posts[$pId]['fId'];
}
}
}
}
$result['data'] = $deletePosts + $unDeletePosts;
$result['ids']['post'] = $pIds;
return $result;
}
public function onSearchRemovePostLogs($pIds) {
if (!$pIds) {
return false;
}
C::t('forum_postlog')->delete_by_pid($pIds);
return true;
}
protected function _preGetPosts($tableid, $pIds) {
$result = array();
foreach(C::t('forum_post')->fetch_all_by_pid($tableid, $pIds) as $post) {
$result[$post['pid']] = Cloud_Service_SearchHelper::convertPost($post);
}
return $result;
}
protected function _getPosts($pIds) {
$posts = array();
foreach(Cloud_Service_SearchHelper::getTables('post') as $tableid) {
$_posts = $this->_preGetPosts($tableid, $pIds);
if ($_posts) {
if (!$posts) {
$posts = $_posts;
} else {
$posts = $posts + $_posts;
}
if (count($posts) == count($pIds)) {
break;
}
}
}
if ($posts) {
foreach($posts as $pId => $post) {
$tIds[$post['pId']] = $post['tId'];
}
if ($tIds) {
$gfIds = $vtIds = $stIds = array(); // poll
$threads = Cloud_Service_SearchHelper::getThreads($tIds);
foreach($posts as $pId => $post) {
$tId = $tIds[$pId];
$posts[$pId]['isGroup'] = $threads[$tId]['isGroup'];
if ($threads[$tId]['isGroup']) {
$gfIds[$threads[$tId]['fId']] = $threads[$tId]['fId'];
}
if ($post['isThread']) {
$stIds[$pId] = $tId;
$posts[$pId]['threadInfo'] = $threads[$tId];
}
if ($threads[$tId]['specialType'] == 'poll') {
$vtIds[$pId] = $tId;
}
}
if($stIds) {
$sorts = Cloud_Service_SearchHelper::getThreadSort($stIds);
foreach($stIds as $pId => $tId) {
$posts[$pId]['category'] = $sorts[$tId];
}
}
if ($vtIds) {
$polls = Cloud_Service_SearchHelper::getPollInfo($vtIds);
foreach($vtIds as $pId => $tId) {
$posts[$pId]['threadInfo']['pollInfo'] = $polls[$tId];
}
}
$guestPerm = Cloud_Service_SearchHelper::getGuestPerm($gfIds);
foreach($posts as $pId => $post) {
if (in_array($post['fId'], $guestPerm['allowForumIds'])) {
$posts[$pId]['isPublic'] = true;
} else {
$posts[$pId]['isPublic'] = false;
}
if ($post['isThread']) {
$posts[$pId]['threadInfo']['isPublic'] = $posts[$pId]['isPublic'];
}
}
}
}
return $posts;
}
public function onSearchGetPosts($pIds) {
$authors = array();
$posts = $this->_getPosts($pIds);
if ($posts) {
foreach($posts as $post) {
$authors[$post['authorId']][] = $post['pId'];
}
$authorids = array_keys($authors);
if ($authorids) {
$banuids= $uids = array();
foreach(C::t('common_member')->fetch_all($authorids) as $uid => $author) {
$uids[$uid] = $uid;
if ($author['groupid'] == 4 || $author['groupid'] == 5) {
$banuids[] = $author['uid'];
}
}
$deluids = array_diff($authorids, $uids);
foreach($deluids as $deluid) {
if (!$deluid) {
continue;
}
foreach($authors[$deluid] as $pid) {
$posts[$pid]['authorStatus'] = 'delete';
}
}
foreach($banuids as $banuid) {
foreach($authors[$banuid] as $pid) {
$posts[$pid]['authorStatus'] = 'ban';
}
}
}
}
return $posts;
}
protected function _getNewPosts($tableid, $num, $fromPostId = 0) {
$result = array();
if (dintval($num)) {
foreach(C::t('forum_post')->fetch_all_new_post_by_pid($fromPostId, '', $num, $tableid) as $post) {
$result['maxPid'] = $post['pid'];
$result['data'][$post['pid']] = Cloud_Service_SearchHelper::convertPost($post);
}
}
return $result;
}
public function onSearchGetNewPosts($num, $fromPostId = 0) {
$res = $data = array();
$maxPid = 0;
foreach(Cloud_Service_SearchHelper::getTables('post') as $tableid) {
$_posts = $this->_getNewPosts($tableid, $num, $fromPostId);
if ($_posts['data']) {
if (!$data) {
$data = $_posts['data'];
} else {
$data = $data + $_posts['data'];
}
}
if ($maxPid < $_posts['maxPid']) {
$maxPid = $_posts['maxPid'];
}
}
$_postNum = 0;
if ($maxPid) {
for($j = $fromPostId + 1; $j <= $maxPid; $j++) {
if (array_key_exists($j, $data)) {
$_postNum++;
$res['data'][$j] = $data[$j];
$res['maxPid'] = $j;
if ($_postNum == $num) {
break;
}
}
}
if (!$res['maxPid']) {
$res['maxPid'] = $maxPid;
}
}
if ($res['data']) {
$tIds = $autors = array();
foreach($res['data'] as $pId => $post) {
$authors[$post['authorId']][] = $post['pId'];
$tIds[$pId] = $post['tId'];
}
if ($tIds) {
$threads = Cloud_Service_SearchHelper::getThreads($tIds);
$stIds = array();
foreach ($tIds as $pId => $tId) {
$res['data'][$pId]['isGroup'] = $threads[$tId]['isGroup'];
if ($res['data'][$pId]['isThread']) {
$stIds[$pId] = $tId;
$res['data'][$pId]['threadInfo'] = $threads[$tId];
}
}
if($stIds) {
$sorts = Cloud_Service_SearchHelper::getThreadSort($stIds);
foreach($stIds as $pId => $tId) {
$res['data'][$pId]['category'] = $sorts[$tId];
}
}
}
$authorids = array_keys($authors);
if ($authorids) {
$banuids= $uids = array();
foreach(C::t('common_member')->fetch_all($authorids) as $uid => $author) {
$uids[$uid] = $uid;
if ($author['groupid'] == 4 || $author['groupid'] == 5) {
$banuids[] = $author['uid'];
}
}
$deluids = array_diff($authorids, $uids);
foreach($deluids as $deluid) {
if (!$deluid) {
continue;
}
foreach($authors[$deluid] as $pid) {
没有合适的资源?快使用搜索试试~ 我知道了~
基于PHP的橙创家校通学校管理系统.zip
共186个文件
php:174个
htm:10个
png:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 153 浏览量
2023-07-24
22:13:27
上传
评论
收藏 1.04MB ZIP 举报
温馨提示
基于PHP的橙创家校通学校管理系统.zip
资源推荐
资源详情
资源评论
收起资源包目录
基于PHP的橙创家校通学校管理系统.zip (186个子文件)
CoralWry.dat 1.45MB
channel.htm 672B
channel.htm 475B
cloud_channel.htm 443B
getmaillist.htm 433B
index.htm 1B
index.htm 1B
index.htm 1B
index.htm 1B
index.htm 1B
index.htm 1B
Search.php 30KB
Security.php 26KB
SearchHelper.php 23KB
dbbak.php 23KB
Connect.php 19KB
api_tenpay.php 18KB
Restful.php 18KB
system.member_add.tpl.php 14KB
school.member_add.tpl.php 14KB
system.member_edit.tpl.php 13KB
school.eidt_schedule.tpl.php 13KB
school.member_edit.tpl.php 12KB
uc.php 12KB
api_alipay.php 10KB
group_topic.tpl.php 10KB
ConnectOAuth.php 10KB
js.php 10KB
system.member.tpl.php 9KB
school.member.tpl.php 9KB
school.class_affairs.tpl.php 9KB
group.tpl.php 9KB
school.setinfo_edit.tpl.php 9KB
system.setinfo_edit.tpl.php 9KB
parent.class_affairs.tpl.php 9KB
login.index.tpl.php 8KB
public.header.tpl.php 8KB
system.setinfo_replymsg.tpl.php 7KB
Restful.php 7KB
public.dgbranch.tpl.php 7KB
system.add_menu.tpl.php 7KB
Doctor.php 7KB
system.show_member.tpl.php 6KB
school.affairs_addexamtype.tpl.php 6KB
school.files_content.tpl.php 6KB
school.index.tpl.php 6KB
Disk.php 6KB
system.files_content.tpl.php 6KB
system.changeinfo.tpl.php 6KB
system.help_add.tpl.php 6KB
edit_topic.tpl.php 6KB
Security.php 6KB
system.setinfo.tpl.php 6KB
school.member_show.tpl.php 6KB
system.member_show.tpl.php 6KB
school.setinfo.tpl.php 6KB
add_topic.tpl.php 6KB
school.work_add.tpl.php 6KB
google.php 6KB
school.affairs_addann.tpl.php 6KB
school.class_affairs_addann.tpl.php 6KB
help.index.tpl.php 6KB
system.ann_add.tpl.php 5KB
My.php 5KB
system.setinfo_sendsms.tpl.php 5KB
school.member_import_show.tpl.php 5KB
system.member_import_show.tpl.php 5KB
UserApplication.php 5KB
OAuth.php 5KB
school.exam_result.tpl.php 5KB
App.php 5KB
school.setinfo_sendsms.tpl.php 5KB
Util.php 5KB
school.setinfo_logpay.tpl.php 5KB
help.list.tpl.php 5KB
system.index.tpl.php 5KB
system.setinfo_sendmsg.tpl.php 5KB
school.setinfo_sendmsg.tpl.php 5KB
parent.index.tpl.php 5KB
Union.php 5KB
school.import_result.tpl.php 5KB
school.affairs_subject.tpl.php 5KB
school.eidt_result.tpl.php 5KB
Storage.php 5KB
system.setmenu.tpl.php 5KB
help.content.tpl.php 4KB
school.exam.tpl.php 4KB
Cloud.php 4KB
access.php 4KB
school.setinfo_message.tpl.php 4KB
system.setinfo_message.tpl.php 4KB
notify_trade.php 4KB
Cloud.php 4KB
system.usergroup_edit.tpl.php 4KB
system.member_import.tpl.php 4KB
system.usergroup_add.tpl.php 4KB
system.setsms.tpl.php 4KB
school.member_import.tpl.php 4KB
login.forgetpwdbyM.tpl.php 4KB
Site.php 4KB
共 186 条
- 1
- 2
资源评论
助力毕业
- 粉丝: 2177
- 资源: 5131
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 驱动代码驱动代码驱动代码驱动代码
- SVID_20240523_141155_1.mp4
- Code for the complete guide to tkinter tutorial
- 关于百货中心供应链管理系统.zip
- SimpleFolderIcon-master 修改Unity的Project下的文件夹图标
- A python Tkinter widget to display tile based maps
- A pure Python library for adding tables to a Tkinter application
- Vector资源文件.zip
- MobaXterm-Installer
- MicroMsg.xlsx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功