本文整理汇总了PHP中Rights::friend方法的典型用法代码示例。如果您正苦于以下问题:PHP Rights::friend方法的具体用法?PHP Rights::friend怎么用?PHP Rights::friend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rights
的用法示例。
在下文中一共展示了Rights::friend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: commit
public function commit()
{
$mem = $this->group->caste(Rights::member());
$fri = $this->group->caste(Rights::friend());
if ($mem->userfilter()) {
return false;
}
$mem->addUser($this->user);
$fri->removeUser($this->user);
return true;
}
示例2: conv
} else {
$groups_member->add($g);
}
$u->comments($g, conv($g_datas['remarque']));
if ($g->id() == 1 && strlen(conv_name($u->nickname())) > 1) {
$u->addStudy(0, $datas['promo'], (int) $datas['promo'] + 4, $datas['promo'], conv_name($u->nickname()));
}
}
$temp = new Collection('Group');
$temp->safeMerge(array($groups_member, $groups_friend));
$temp->select(GroupSelect::castes());
foreach ($groups_member as $g) {
$g->caste(Rights::member())->addUser($u);
}
foreach ($groups_friend as $g) {
$g->caste(Rights::friend())->addUser($u);
}
$k++;
echo 'User ' . str_pad($k, 4, '0', STR_PAD_LEFT) . '/' . $users . ' : ' . str_pad($u->id(), 5, '0', STR_PAD_LEFT) . ' - ' . $datas['promo'] . ' - ' . str_pad($groups_member->count(), 2, '0', STR_PAD_LEFT) . " members - " . str_pad($groups_friend->count(), 2, '0', STR_PAD_LEFT) . " friends - " . substr(microtime(true) - $t, 0, 5) . ' ' . $u->login() . "\n";
}
echo "-----------------------------------------------\n";
XDB::execute('UPDATE account SET skin = "default"');
echo "default skin set \n";
XDB::execute('INSERT INTO users_minimodules
(SELECT uid, "birthday", "COL_LEFT", 0 FROM account WHERE uid > 0)');
XDB::execute('INSERT INTO users_minimodules
(SELECT uid, "days", "COL_LEFT", 1 FROM account WHERE uid > 0)');
XDB::execute('INSERT INTO users_minimodules
(SELECT uid, "ik", "COL_LEFT", 2 FROM account WHERE uid > 0)');
XDB::execute('INSERT INTO users_minimodules
(SELECT uid, "qdj", "COL_MIDDLE", 0 FROM account WHERE uid > 0)');
示例3: insert
public function insert($id = null, $type = 'all')
{
if ($id == null) {
$this->name = uniqid();
XDB::execute('INSERT INTO groups SET name = {?}', $this->name);
$this->id = XDB::insertId();
} else {
$this->name = 'g_' . $id;
XDB::execute('INSERT INTO groups SET gid = {?}, name= {?}', $id, $this->name);
$this->id = $id;
}
/*
* Create the castes
*/
if ($type == 'user') {
// A user group only needs an admin caste & a restricted caste.
$this->addCaste(Rights::admin());
$this->addCaste(Rights::restricted());
} else {
$admins = $this->addCaste(Rights::admin());
$members = $this->addCaste(Rights::member());
$logics = $this->addCaste(Rights::logic());
$friends = $this->addCaste(Rights::friend());
/*
* Create the 'restricted' caste
*/
$restricted = new UserFilter(new UFC_Caste(array($admins, $members, $logics)));
$this->addCaste(Rights::restricted())->userfilter($restricted);
/*
* Create the 'everybody' caste
* It's better not to refer to the restricted caste, as we don't know in what
* order the bubbling is going to happen
*/
$everybody = new UserFilter(new UFC_Caste(array($admins, $members, $logics, $friends)));
$this->addCaste(Rights::everybody())->userfilter($everybody);
}
}
示例4: handler_group_subscribe
function handler_group_subscribe($page, $group, $right = 'friend')
{
S::assert_xsrf_token();
$group = Group::fromId($group);
if (!$group) {
$page->assign('title', "Ce groupe n'existe pas");
$page->changeTpl('groups/no_group.tpl');
return;
} elseif ($right == 'friend') {
$group->select(GroupSelect::subscribe());
$group->caste(Rights::friend())->addUser(S::user());
S::user()->select(UserSelect::castes());
pl_redirect('groups/see/' . $group->name());
exit;
} elseif ($right == 'member') {
$group->select(GroupSelect::subscribe());
if ($group->caste(Rights::member())->userfilter()) {
throw new Exception('You can\'t apply to this group');
}
$iv = new MemberValidate(S::user(), $group);
$v = new Validate(array('writer' => S::user(), 'group' => $group, 'item' => $iv, 'type' => 'member'));
$v->insert();
$page->assign('title', "Demande de statut de membre");
$page->changeTpl('groups/member.tpl');
}
}