本文整理汇总了PHP中Env::b方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::b方法的具体用法?PHP Env::b怎么用?PHP Env::b使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::b方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler_members
function handler_members($page, $liste = null)
{
if (is_null($liste)) {
return PL_NOT_FOUND;
}
$mlist = $this->prepare_list($liste);
$this->is_group_admin($page);
$page->changeTpl('lists/members.tpl');
if (Get::has('del')) {
S::assert_xsrf_token();
$mlist->unsubscribe();
pl_redirect('lists/members/' . $liste);
}
if (Get::has('add')) {
S::assert_xsrf_token();
$mlist->subscribe();
pl_redirect('lists/members/' . $liste);
}
$members = $mlist->getMembers();
$tri_promo = !Env::b('alpha');
if (list($det, $mem, $own) = $members) {
$membres = list_sort_members($mem, $tri_promo);
$moderos = list_sort_owners($own, $tri_promo);
$page->assign_by_ref('details', $det);
$page->assign_by_ref('members', $membres);
$page->assign_by_ref('owners', $moderos);
$page->assign('nb_m', count($mem));
} else {
$page->kill("La liste n'existe pas ou tu n'as pas le droit d'en voir les détails.");
}
}
示例2: handler_notifs
public function handler_notifs($page, $action = null, $arg = null)
{
$page->changeTpl('carnet/notifs.tpl');
if ($action) {
S::assert_xsrf_token();
switch ($action) {
case 'add_promo':
$this->addPromo($page, $arg);
break;
case 'del_promo':
$this->delPromo($page, $arg);
break;
case 'add_group':
$this->addGroup($page, $arg);
break;
case 'del_group':
$this->delGroup($page, $arg);
break;
case 'del_nonins':
$user = User::get($arg);
if ($user) {
$this->delNonRegistered($page, $user);
}
break;
case 'add_nonins':
$user = User::get($arg);
if ($user) {
$this->addNonRegistered($page, $user);
}
break;
}
}
if (Env::has('subs')) {
S::assert_xsrf_token();
$flags = new PlFlagSet();
foreach (Env::v('sub') as $key => $value) {
$flags->addFlag($key, $value);
}
XDB::execute('UPDATE watch
SET actions = {?}
WHERE uid = {?}', $flags, S::i('uid'));
S::user()->invalidWatchCache();
Platal::session()->updateNbNotifs();
}
if (Env::has('flags_contacts')) {
S::assert_xsrf_token();
XDB::execute('UPDATE watch
SET ' . XDB::changeFlag('flags', 'contacts', Env::b('contacts')) . '
WHERE uid = {?}', S::i('uid'));
S::user()->invalidWatchCache();
Platal::session()->updateNbNotifs();
}
if (Env::has('flags_mail')) {
S::assert_xsrf_token();
XDB::execute('UPDATE watch
SET ' . XDB::changeFlag('flags', 'mail', Env::b('mail')) . '
WHERE uid = {?}', S::i('uid'));
S::user()->invalidWatchCache();
Platal::session()->updateNbNotifs();
}
$user = S::user();
$nonins = new UserFilter(new UFC_WatchRegistration($user));
$promo = XDB::fetchColumn('SELECT promo
FROM watch_promo
WHERE uid = {?}
ORDER BY promo', S::i('uid'));
$page->assign('promo_count', count($promo));
$ranges = array();
$range_start = null;
$range_end = null;
foreach ($promo as $p) {
if (is_null($range_start)) {
$range_start = $range_end = $p;
} else {
if ($p != $range_end + 1) {
$ranges[] = array($range_start, $range_end);
$range_start = $range_end = $p;
} else {
$range_end = $p;
}
}
}
$ranges[] = array($range_start, $range_end);
$page->assign('promo_ranges', $ranges);
$page->assign('nonins', $nonins->getUsers());
$groups = XDB::fetchColumn('SELECT g.nom
FROM watch_group AS w
INNER JOIN groups AS g ON (g.id = w.groupid)
WHERE w.uid = {?}
ORDER BY g.nom', S::i('uid'));
$page->assign('groups', $groups);
$page->assign('groups_count', count($groups));
list($flags, $actions) = XDB::fetchOneRow('SELECT flags, actions
FROM watch
WHERE uid = {?}', S::i('uid'));
$flags = new PlFlagSet($flags);
$actions = new PlFlagSet($actions);
$page->assign('flags', $flags);
$page->assign('actions', $actions);
}
示例3: b
public function b($key, $def = false)
{
if ($this->fake_env) {
return $this->fake_env->b($key, $def);
} else {
return Env::b($this->envprefix . $key, $def);
}
}