本文整理汇总了PHP中Perms::bulk方法的典型用法代码示例。如果您正苦于以下问题:PHP Perms::bulk方法的具体用法?PHP Perms::bulk怎么用?PHP Perms::bulk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Perms
的用法示例。
在下文中一共展示了Perms::bulk方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wikiplugin_memberlist
function wikiplugin_memberlist($data, $params)
{
global $prefs;
static $execution = 0;
$key = 'memberlist-execution-' . ++$execution;
if (!isset($params['groups'])) {
return "^Missing group list^";
}
$groups = $params['groups'];
Perms::bulk(array('type' => 'group'), 'object', $groups);
$validGroups = wikiplugin_memberlist_get_group_details($groups);
if (isset($_POST[$key])) {
if (isset($_POST['join'])) {
wikiplugin_memberlist_join($validGroups, $_POST['join']);
}
if (isset($_POST['leave'])) {
wikiplugin_memberlist_leave($validGroups, $_POST['leave']);
}
if (isset($_POST['remove'])) {
wikiplugin_memberlist_remove($validGroups, $_POST['remove']);
}
if (isset($_POST['add'])) {
wikiplugin_memberlist_add($validGroups, $_POST['add']);
}
header('Location: ' . $_SERVER['REQUEST_URI']);
exit;
}
if (isset($_REQUEST['transition'], $_REQUEST['member'])) {
if ($prefs['feature_group_transition'] == 'y') {
require_once 'lib/transitionlib.php';
$transitionlib = new TransitionLib('group');
$transitionlib->triggerTransition($_REQUEST['transition'], $_REQUEST['member']);
$url = $_SERVER['REQUEST_URI'];
$url = str_replace('transition=', 'x=', $url);
$url = str_replace('member=', 'x=', $url);
header('Location: ' . $url);
exit;
}
}
$canApply = false;
foreach ($validGroups as $group) {
if ($group['can_add'] || $group['can_remove'] || $group['can_join'] || $group['can_leave']) {
$canApply = true;
break;
}
}
global $smarty;
$smarty->assign('execution_key', $key);
$smarty->assign('can_apply', $canApply);
$smarty->assign('memberlist_groups', $validGroups);
return '~np~' . $smarty->fetch('wiki-plugins/wikiplugin_memberlist.tpl') . '~/np~';
}
示例2: prepare
private function prepare()
{
if ($this->prepared) {
return;
}
$categories = $this->managed;
Perms::bulk(array('type' => 'category'), 'object', $categories);
if (count($this->managed)) {
$base = array_diff($this->current, $this->managed);
$managed = array_intersect($this->new, $this->managed);
$this->new = array_merge($base, $managed);
}
if (count($this->unmanaged)) {
$base = array_intersect($this->current, $this->unmanaged);
$managed = array_diff($this->new, $this->unmanaged);
$this->new = array_merge($base, $managed);
}
$this->applyConstraints();
$this->prepared = true;
}
示例3: isset
if ($prefs['allowmsg_is_optional'] == 'y') {
if ($tikilib->get_user_preference($user, 'allowMsgs', 'y') != 'y') {
$send_msg = false;
}
}
$smarty->assign('send_msg', $send_msg);
} else {
$smarty->assign('send_msg', false);
}
$smarty->assign('messageto', isset($_REQUEST['messageto']) ? $_REQUEST['messageto'] : '');
if (isset($prefs['feature_forums']) and $prefs['feature_forums'] == 'y') {
$commentslib = TikiLib::lib('comments');
// not done in commentslib
$sort_mode = $prefs['forums_ordering'];
$channels = $commentslib->list_forums(0, -1, $sort_mode, '');
Perms::bulk(array('type' => 'forum'), 'object', $channels['data'], 'forumId');
$forums = array();
$temp_max = count($channels['data']);
for ($i = 0; $i < $temp_max; $i++) {
$forumperms = Perms::get(array('type' => 'forum', 'object' => $channels['data'][$i]['forumId']));
if ($forumperms->forum_post and $forumperms->forum_post_topic or $forumperms->admin_forum) {
$forums[] = $channels['data'][$i];
}
}
$smarty->assign('forumId', isset($_REQUEST['forumId']) ? $_REQUEST['forumId'] : 0);
} else {
$forums = array();
}
$smarty->assign('forums', $forums);
$report = 'n';
} else {
示例4: explode
}
if ($prefs['feature_trackers'] != 'y') {
die;
}
$arrayTrackerId = explode(',', $_GET["trackerIdList"]);
$arrayMandatory = explode(',', $_GET["mandatory"]);
if (isset($_GET['selected'])) {
$arraySelected = explode(',', utf8_encode(rawurldecode($_GET["selected"])));
}
$arrayFieldlist = explode(',', $_GET["fieldlist"]);
$arrayFilterfield = explode(',', $_GET["filterfield"]);
$arrayStatus = explode(',', $_GET["status"]);
$arrayItem = explode(',', $_GET['item']);
header('Cache-Control: no-cache');
header('content-type: application/x-javascript');
Perms::bulk(array('type' => 'tracker'), 'object', $arrayTrackerId);
$json_return = array();
for ($index = 0, $count_arrayTrackerId = count($arrayTrackerId); $index < $count_arrayTrackerId; $index++) {
$arrayFieldlistMultiple = explode('|', $arrayFieldlist[$index]);
$tikilib->get_perm_object($arrayTrackerId[$index], 'tracker');
$filtervalue = utf8_encode(rawurldecode($_GET["filtervalue"]));
if (!empty($_GET['item'])) {
// we want the value of field filterfield for item
$filtervalue = $trklib->get_item_value($arrayTrackerId[$index], $arrayItem[$index], $arrayFilterfield[$index]);
if (!$filtervalue) {
$otherField = $trklib->get_tracker_field($arrayFilterfield[$index]);
if ($otherField['type'] == 'r') {
// filterFieldIdThere is itemlink, so get the filtervalue from what that links to
$filtervalue = $trklib->get_item_value($otherField['options_array'][0], $arrayItem[$index], $otherField['options_array'][1]);
} else {
if ($otherField['type'] == 'u') {
示例5: check_ticket
if (isset($_REQUEST['rej']) && isset($_REQUEST['msg'])) {
check_ticket('forum-queue');
foreach (array_keys($_REQUEST['msg']) as $msg) {
$commentslib->remove_queued($msg);
}
}
if (isset($_REQUEST['app']) && isset($_REQUEST['msg'])) {
check_ticket('forum-queue');
foreach (array_keys($_REQUEST['msg']) as $msg) {
$commentslib->approve_queued($msg);
}
}
// Quickjumpt to other forums
if ($tiki_p_admin_forum == 'y' || $prefs['feature_forum_quickjump'] == 'y') {
$all_forums = $commentslib->list_forums(0, -1, 'name_asc', '');
Perms::bulk(array('type' => 'forum'), 'object', $all_forums['data'], 'forumId');
$temp_max = count($all_forums["data"]);
for ($i = 0; $i < $temp_max; $i++) {
$forumperms = Perms::get(array('type' => 'forum', 'object' => $all_forums['data'][$i]['forumId']));
$all_forums["data"][$i]["can_read"] = $forumperms->forum_read ? 'y' : 'n';
}
$smarty->assign('all_forums', $all_forums['data']);
}
// Number of queued messages
if ($tiki_p_admin_forum == 'y') {
$smarty->assign('queued', $commentslib->get_num_queued('forum' . $_REQUEST['forumId']));
}
// Items will contain messages
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = 'timestamp_asc';
} else {
示例6: count
// use the maxRecords php variable to set the limit
// if sortMode is not set then use lastModif_desc
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find', $find);
// Get a list of last changes to the Wiki database
$listpages = $bloglib->list_blogs($offset, $maxRecords, $sort_mode, $find);
Perms::bulk(array('type' => 'blog'), 'object', $listpages['data'], 'blogId');
$temp_max = count($listpages["data"]);
for ($i = 0; $i < $temp_max; $i++) {
$blogperms = Perms::get(array('type' => 'blog', 'object' => $listpages['data'][$i]['blogId']));
$listpages["data"][$i]["individual_tiki_p_read_blog"] = $blogperms->read_blog ? 'y' : 'n';
$listpages["data"][$i]["individual_tiki_p_blog_post"] = $blogperms->blog_post ? 'y' : 'n';
$listpages["data"][$i]["individual_tiki_p_create_blogs"] = $blogperms->create_blogs ? 'y' : 'n';
}
$smarty->assign_by_ref('listpages', $listpages["data"]);
$smarty->assign_by_ref('cant', $listpages["cant"]);
include_once 'tiki-section_options.php';
ask_ticket('list-blogs');
// Display the template
$smarty->assign('mid', 'tiki-list_blogs.tpl');
$smarty->display("tiki.tpl");
示例7: getCategories
//.........这里部分代码省略.........
$category["categpath"] = implode("::", $path);
$category["relativePathString"] = $category["categpath"];
}
// Sort in preorder. Siblings are sorted by name.
if ($prefs['category_sort_ascii'] == 'y') {
uksort($roots, array("CategLib", "cmpcatname"));
} else {
ksort($roots, SORT_LOCALE_STRING);
}
$sortedCategoryIdentifiers = array();
foreach ($roots as $root) {
$sortedCategoryIdentifiers = array_merge($sortedCategoryIdentifiers, $this->getSortedSubTreeNodes($root, $categories));
}
$ret = array();
foreach ($sortedCategoryIdentifiers as $categoryIdentifier) {
$ret[$categories[$categoryIdentifier]['categId']] = $categories[$categoryIdentifier];
}
unset($categories);
$cachelib->cacheItem($cacheKey, serialize($ret), 'allcategs');
$cachelib->cacheItem('roots', serialize($roots), 'allcategs');
// Used in get_category_descendants()
}
$type = is_null($filter) ? 'all' : (isset($filter['type']) ? $filter['type'] : 'self');
if ($type != 'all') {
$kept = array();
if ($type != 'roots') {
if (!isset($filter['identifier'])) {
throw new Exception("Missing base category");
}
if (!empty($ret) && isset($ret[$filter['identifier']])) {
$filterBaseCategory = $ret[$filter['identifier']];
} else {
$filterBaseCategory = null;
}
}
switch ($type) {
case 'children':
$kept = $filterBaseCategory['children'];
break;
case 'descendants':
$kept = $filterBaseCategory['descendants'];
break;
case 'roots':
$kept = $cachelib->getSerialized('roots', 'allcategs');
break;
default:
$ret = array($filter['identifier'] => $filterBaseCategory);
// Avoid array functions for optimization
}
if ($type != 'self') {
$ret = array_intersect_key($ret, array_flip($kept));
if ($type != 'roots') {
// Set relativePathString by stripping the length of the common ancestor plus 2 characters for the pathname separator ("::").
$strippedLength = strlen($filterBaseCategory['categpath']) + 2;
foreach ($ret as &$category) {
$category['relativePathString'] = substr($category['categpath'], $strippedLength);
}
}
}
}
if ($considerCategoryFilter) {
if ($jail = $this->get_jail()) {
$area = array();
if ($prefs['feature_areas'] === 'y') {
$areaslib = TikiLib::lib('areas');
$area = $areaslib->getAreaByPerspId($_SESSION['current_perspective']);
}
$roots = array_filter((array) $prefs['category_jail_root']);
// Skip 0 and other forms of empty
$ret = array_filter($ret, function ($category) use($jail, $roots, $area) {
if (in_array($category['categId'], $jail)) {
return true;
}
if ($area && !$area['share_common']) {
return false;
}
if ($category['rootId'] && !in_array($category['rootId'], $roots)) {
return true;
} elseif (!$category['rootId'] && !in_array($category['categId'], $roots)) {
return true;
}
return false;
});
}
}
if ($considerPermissions) {
$categoryIdentifiers = array_keys($ret);
if (is_null($categoryIdentifiers)) {
$categoryIdentifiers = array();
}
Perms::bulk(array('type' => 'category'), 'object', $categoryIdentifiers);
foreach ($categoryIdentifiers as $categoryIdentifier) {
$permissions = Perms::get(array('type' => 'category', 'object' => $categoryIdentifier));
if (!$permissions->view_category) {
unset($ret[$categoryIdentifier]);
}
}
}
return $ret;
}
示例8: count
}
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find', $find);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$channels = $quizlib->list_quizzes($offset, $maxRecords, $sort_mode, $find);
Perms::bulk(array('type' => 'quiz'), 'object', $channels['data'], 'quizId');
$temp_max = count($channels["data"]);
for ($i = 0; $i < $temp_max; $i++) {
$quizperms = Perms::get(array('type' => 'quiz', 'object' => $channels['data'][$i]['quizId']));
$channels["data"][$i]["individual_tiki_p_take_quiz"] = $quizperms->take_quiz ? 'y' : 'n';
$channels["data"][$i]["individual_tiki_p_view_quiz_stats"] = $quizperms->view_quiz_stats ? 'y' : 'n';
$channels["data"][$i]["individual_tiki_p_view_user_stats"] = $quizperms->view_user_stats ? 'y' : 'n';
$channels["data"][$i]["individual_tiki_p_admin_quizzes"] = $quizperms->admin_quizzes ? 'y' : 'n';
}
$smarty->assign_by_ref('cant_pages', $channels["cant"]);
$smarty->assign_by_ref('channels', $channels["data"]);
include_once 'tiki-section_options.php';
ask_ticket('list-quizzes');
// Display the template
$smarty->assign('mid', 'tiki-list_quizzes.tpl');
$smarty->display("tiki.tpl");
示例9: count
$sort_mode = $_REQUEST['sort_mode'];
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
if (!isset($_REQUEST['offset'])) {
$offset = 0;
} else {
$offset = $_REQUEST['offset'];
}
$smarty->assign_by_ref('offset', $offset);
// Get the list of libraries available for this user (or public galleries)
global $imagegallib;
if (!is_object($imagegallib)) {
require_once 'lib/imagegals/imagegallib.php';
}
$galleries = $imagegallib->list_galleries($offset, $maxRecords, $sort_mode, 'admin', $find);
Perms::bulk(array('type' => 'image gallery'), 'object', $galleries, 'galleryId');
$smarty->assign('filter', '');
if (!empty($_REQUEST['filter'])) {
$smarty->assign('filter', $_REQUEST['filter']);
}
$temp_max = count($galleries['data']);
for ($i = 0; $i < $temp_max; $i++) {
$galperms = Perms::get(array('type' => 'image gallery', 'object' => $galleries['data'][$i]['galleryId']));
// check if top gallery (has no parents)
$info = $imagegallib->get_gallery_info($galleries['data'][$i]['galleryId']);
if ($info['parentgallery'] == -1) {
$galleries['data'][$i]['topgal'] = 'y';
} else {
$galleries['data'][$i]['topgal'] = 'n';
}
// check if has subgalleries (parent of any children)
示例10: count
}
if (!isset($_REQUEST["offset"])) {
$offset = 0;
} else {
$offset = $_REQUEST["offset"];
}
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
$smarty->assign('find', $find);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$channels = $srvlib->list_surveys($offset, $maxRecords, $sort_mode, $find);
Perms::bulk(array('type' => 'survey'), 'object', $channels['data'], 'surveyId');
$temp_max = count($channels["data"]);
for ($i = 0; $i < $temp_max; $i++) {
$survperms = Perms::get(array('type' => 'survey', 'object' => $channels['data'][$i]['surveyId']));
$channels["data"][$i]["individual_tiki_p_take_survey"] = $survperms->take_survey ? 'y' : 'n';
$channels["data"][$i]["individual_tiki_p_view_survey_stats"] = $survperms->view_survey_stats ? 'y' : 'n';
$channels["data"][$i]["individual_tiki_p_admin_surveys"] = $survperms->admin_surveys ? 'y' : 'n';
if ($tikilib->user_has_voted($user, 'survey' . $channels["data"][$i]["surveyId"])) {
$channels["data"][$i]["taken_survey"] = 'y';
} else {
$channels["data"][$i]["taken_survey"] = 'n';
}
}
$smarty->assign_by_ref('cant_pages', $channels["cant"]);
$smarty->assign_by_ref('channels', $channels["data"]);
include_once 'tiki-section_options.php';
示例11: check_ticket
}
$smarty->assign('all_langs', $all_langs);
$access->check_feature(array('feature_wiki', 'feature_listPages'));
$access->check_permission('tiki_p_view');
/* mass-remove:
the checkboxes are sent as the array $_REQUEST["checked[]"], values are the wiki-PageNames,
e.g. $_REQUEST["checked"][3]="HomePage"
$_REQUEST["submit_mult"] holds the value of the "with selected do..."-option list
we look if any page's checkbox is on and if remove_pages is selected.
then we check permission to delete pages.
if so, we call histlib's method remove_all_versions for all the checked pages.
*/
if (!empty($_REQUEST['submit_mult']) && isset($_REQUEST['checked'])) {
$action = $_REQUEST['submit_mult'];
check_ticket('list-pages');
Perms::bulk(array('type' => 'wiki page'), 'object', $_REQUEST['checked']);
switch ($action) {
case 'remove_pages':
// Now check permissions to remove the selected pages
$access->check_permission('tiki_p_remove');
$access->check_authenticity(tr('Are you sure you want to remove the %0 selected pages?', count($_REQUEST['checked'])));
foreach ($_REQUEST['checked'] as $check) {
$tikilib->remove_all_versions($check);
}
break;
case 'print_pages':
$access->check_feature('feature_wiki_multiprint');
foreach ($_REQUEST['checked'] as $check) {
$access->check_page_exists($check);
// Now check permissions to access this page
$perms = Perms::get(array('type' => 'wiki page', 'object' => $check));
示例12: testBulkLoading
function testBulkLoading()
{
$mockObject = $this->getMock('Perms_ResolverFactory');
$mockCategory = $this->getMock('Perms_ResolverFactory');
$mockGlobal = $this->getMock('Perms_ResolverFactory');
$perms = new Perms();
$perms->setResolverFactories(array($mockObject, $mockCategory, $mockGlobal));
Perms::set($perms);
$mockObject->expects($this->once())->method('bulk')->with($this->equalTo(array('type' => 'wiki page')), $this->equalTo('object'), $this->equalTo(array('A', 'B', 'C', 'D', 'E')))->will($this->returnValue(array('A', 'C', 'E')));
$mockCategory->expects($this->once())->method('bulk')->with($this->equalTo(array('type' => 'wiki page')), $this->equalTo('object'), $this->equalTo(array('A', 'C', 'E')))->will($this->returnValue(array('C')));
$mockGlobal->expects($this->once())->method('bulk')->with($this->equalTo(array('type' => 'wiki page')), $this->equalTo('object'), $this->equalTo(array('C')))->will($this->returnArgument(0));
$data = array(array('pageId' => 1, 'pageName' => 'A', 'content' => 'Hello World'), array('pageId' => 2, 'pageName' => 'B', 'content' => 'Hello World'), array('pageId' => 3, 'pageName' => 'C', 'content' => 'Hello World'), array('pageId' => 4, 'pageName' => 'D', 'content' => 'Hello World'), array('pageId' => 5, 'pageName' => 'E', 'content' => 'Hello World'));
Perms::bulk(array('type' => 'wiki page'), 'object', $data, 'pageName');
}
示例13: wikiplugin_memberlist
function wikiplugin_memberlist($data, $params)
{
global $prefs, $userlib, $user;
static $execution = 0;
$exec_key = 'memberlist-execution-' . ++$execution;
if (!isset($params['groups'])) {
return "^Missing group list^";
}
$groups = $params['groups'];
$defaults = array();
$plugininfo = wikiplugin_memberlist_info();
foreach ($plugininfo['params'] as $key => $param) {
$defaults["{$key}"] = $param['default'];
}
$params = array_merge($defaults, $params);
if ($prefs['feature_user_watches'] == 'y') {
if (!empty($user)) {
$tikilib = TikiLib::lib('tiki');
if (isset($_REQUEST['watch'])) {
$tikilib->add_user_watch($user, 'user_joins_group', $_REQUEST['watch'], 'group');
} else {
if (isset($_REQUEST['unwatch'])) {
$tikilib->remove_user_watch($user, 'user_joins_group', $_REQUEST['unwatch'], 'group');
}
}
}
}
if (count($groups) === 1 && $groups[0] === '*') {
// all available
$groups = $userlib->list_all_groups();
}
if (!empty($params['membersOnly'])) {
if ($params['membersOnly'] === '%user%') {
$params['membersOnly'] = $GLOBALS['user'];
}
$usergroups = $userlib->get_user_groups($params['membersOnly']);
$in_group = array();
foreach ($groups as $group) {
if (in_array($group, $usergroups) && $group != 'Anonymous') {
$in_group[] = $group;
}
}
$groups = $in_group;
unset($in_group);
}
if (!empty($params['including'])) {
$includinggroups = $userlib->get_including_groups($params['including']);
$in_group = array();
foreach ($groups as $group) {
if (in_array($group, $includinggroups)) {
$in_group[] = $group;
}
}
$groups = $in_group;
unset($in_group);
}
Perms::bulk(array('type' => 'group'), 'object', $groups);
if ($params['readOnly'] == 'y') {
$readOnly = true;
} else {
$readOnly = false;
}
$validGroups = wikiplugin_memberlist_get_group_details($groups, $params['max'], $params['sort_mode'], $readOnly);
if (isset($_POST[$exec_key])) {
if (isset($_POST['join'])) {
wikiplugin_memberlist_join($validGroups, $_POST['join']);
}
if (isset($_POST['leave'])) {
wikiplugin_memberlist_leave($validGroups, $_POST['leave']);
}
if (isset($_POST['remove'])) {
wikiplugin_memberlist_remove($validGroups, $_POST['remove']);
}
if (isset($_POST['add'])) {
wikiplugin_memberlist_add($validGroups, $_POST['add']);
}
if (isset($_POST['defgroup'])) {
wikiplugin_memberlist_add($validGroups, $_POST['defgroup'], true);
}
header('Location: ' . $_SERVER['REQUEST_URI']);
exit;
}
if (isset($_REQUEST['transition'], $_REQUEST['member'])) {
if ($prefs['feature_group_transition'] == 'y') {
require_once 'lib/transitionlib.php';
$transitionlib = new TransitionLib('group');
$transitionlib->triggerTransition($_REQUEST['transition'], $_REQUEST['member']);
$url = $_SERVER['REQUEST_URI'];
$url = str_replace('transition=', 'x=', $url);
$url = str_replace('member=', 'x=', $url);
header('Location: ' . $url);
exit;
}
}
$canApply = false;
foreach ($validGroups as $group) {
if ($group['can_add'] || $group['can_remove'] || $group['can_join'] || $group['can_leave']) {
$canApply = true;
break;
}
//.........这里部分代码省略.........
示例14: wikiplugin_memberlist
function wikiplugin_memberlist($data, $params)
{
global $prefs, $user, $page;
$mail = false;
$tikilib = TikiLib::lib('tiki');
$userlib = TikiLib::lib('user');
$smarty = TikiLib::lib('smarty');
static $execution = 0;
$exec_key = 'memberlist-execution-' . ++$execution;
if (!isset($params['groups'])) {
return "^Missing group list^";
}
$groups = $params['groups'];
$defaults = array();
$plugininfo = wikiplugin_memberlist_info();
foreach ($plugininfo['params'] as $key => $param) {
$defaults["{$key}"] = $param['default'];
}
$params = array_merge($defaults, $params);
if ($prefs['feature_user_watches'] == 'y') {
if (!empty($user)) {
if (isset($_REQUEST['watch'])) {
$tikilib->add_user_watch($user, 'user_joins_group', $_REQUEST['watch'], 'group');
} else {
if (isset($_REQUEST['unwatch'])) {
$tikilib->remove_user_watch($user, 'user_joins_group', $_REQUEST['unwatch'], 'group');
}
}
}
}
if (count($groups) === 1 && $groups[0] === '*') {
// all available
$groups = $userlib->list_all_groups();
}
if (!empty($params['membersOnly'])) {
if ($params['membersOnly'] === '%user%') {
$params['membersOnly'] = $GLOBALS['user'];
}
$usergroups = $userlib->get_user_groups($params['membersOnly']);
$in_group = array();
foreach ($groups as $group) {
if (in_array($group, $usergroups) && $group != 'Anonymous') {
$in_group[] = $group;
}
}
$groups = $in_group;
unset($in_group);
}
if (!empty($params['including'])) {
$includinggroups = $userlib->get_including_groups($params['including']);
$in_group = array();
foreach ($groups as $group) {
if (in_array($group, $includinggroups)) {
$in_group[] = $group;
}
}
$groups = $in_group;
unset($in_group);
}
if ($params['addon_groups_approval_buttons'] == 'y') {
$pageInfo = $tikilib->get_page_info($page);
$pageLang = $pageInfo['lang'];
$api = new TikiAddons_Api_Group();
$group_base = $api->getOrganicGroupBaseName($params['groups'][0]);
$smarty->assign('mail_group', $group_base);
$itemId = $api->getItemIdFromToken($params['groups'][0]);
$smarty->assign('mail_organicgroup_id', $itemId);
$userid = "user" . $userlib->get_user_id($user);
$smarty->assign('mail_userid', $userid);
$smarty->assign('mail_url', $api->getGroupHomePage($params['groups'][0]) . '?itemId=' . $itemId);
$foo = parse_url($_SERVER["REQUEST_URI"]);
$machine = $tikilib->httpPrefix(true) . dirname($foo["path"]);
if (substr($machine, -1) == '/') {
$machine = substr($machine, 0, -1);
}
$smarty->assign('mail_machine', $machine);
$file_wel = $smarty->fetchLang($pageLang, "mail/admin_approval_user_joins_group_notification.tpl");
$file_rej = $smarty->fetchLang($pageLang, "mail/admin_rejection_user_group_notification.tpl");
$smarty->assign('welcome_content', $file_wel);
$smarty->assign('reject_content', $file_rej);
$smarty->assign('Need_app', $exec_key);
} else {
$smarty->assign('Need_app', '');
}
Perms::bulk(array('type' => 'group'), 'object', $groups);
if ($params['readOnly'] == 'y') {
$readOnly = true;
} else {
$readOnly = false;
}
$validGroups = wikiplugin_memberlist_get_group_details($groups, $params['max'], $params['sort_mode'], $readOnly);
if (isset($_POST[$exec_key])) {
if (isset($_POST['join'])) {
wikiplugin_memberlist_join($validGroups, $_POST['join']);
}
if (isset($_POST['leave'])) {
wikiplugin_memberlist_leave($validGroups, $_POST['leave']);
}
if (isset($_POST['remove'])) {
if (isset($params['email_to_removed_user']) && $params['email_to_removed_user'] == 'y' || isset($_POST['text_area'])) {
//.........这里部分代码省略.........