本文整理汇总了PHP中Env::blank方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::blank方法的具体用法?PHP Env::blank怎么用?PHP Env::blank使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::blank方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler_admin_account
public function handler_admin_account($page, $hruid = null, $added = false)
{
$err = array();
$msg = array();
$add = false;
if ($added) {
$msg[] = "L'utilisateur a été ajouté avec succès";
}
if ($hruid === null) {
$user = new User();
$add = true;
} else {
$user = new UserFilter(new UFC_Hruid($hruid));
$user = $user->get(true);
if ($user !== false) {
$user->select(UserSelect::tol());
} else {
throw new Exception("Impossible de charger les données de l'utilisateur " . $hruid);
}
}
if (Env::has('add_room') && !$add) {
$r = Room::batchFrom(array(Env::t('rid')));
if ($r->count() == 0) {
$err[] = "La chambre entrée n'existe pas.";
} else {
$user->addRoom($r->pop());
}
}
if (Env::has('del_room') && !$add) {
$r = Room::batchFrom(array(Env::t('rid')));
if ($r->count() == 0) {
$err[] = "La chambre entrée n'existe pas.";
} else {
$user->removeRoom($r->pop());
}
}
if (Env::has('add_perm') && !$add && S::user()->isAdmin()) {
$user->addPerm(Env::t('perm'));
}
if (Env::has('del_perm') && !$add && S::user()->isAdmin()) {
$user->removePerm(Env::t('perm'));
}
if (Env::has('upd_study') && !$add) {
$user->updateStudy(Env::t('formation_id'), Env::t('forlife'), Env::t('year_in'), Env::t('year_out'), Env::t('promo'));
}
if (Env::has('add_study') && !$add) {
$user->addStudy(Env::t('formation_id'), Env::t('year_in'), Env::t('year_out'), Env::t('promo'), Env::t('forlife'));
}
if (Env::has('del_study') && !$add) {
$user->removeStudy(Env::t('formation_id'), Env::t('forlife'));
}
if (Env::has('add_group') && !$add) {
$g = Group::from(Env::t('name'))->select(GroupSelect::castes());
$g->caste(Rights::member())->addUser($user);
}
if (Env::has('del_group') && !$add) {
$g = Group::from(Env::t('name'))->select(GroupSelect::castes());
$g->caste(Rights::member())->removeUser($user);
}
if (Env::has('change_profile')) {
if ($add) {
if (Env::blank('hruid')) {
$hruid = Env::t('firstname') . '.' . Env::t('lastname');
$hruid = strtolower($hruid);
$already = new UserFilter(new UFC_Hruid($hruid));
$nbr = 1;
while ($already->getTotalCount() > 0) {
$nbr++;
$hruid = Env::t('firstname') . '.' . Env::t('lastname') . '.' . $nbr;
$hruid = strtolower($hruid);
$already = new UserFilter(new UFC_Hruid($hruid));
}
} else {
$hruid = Env::t('hruid');
$already = new UserFilter(new UFC_Hruid($hruid));
if ($already->getTotalCount() > 0) {
throw new Exception("Le hruid spécifié est déjà pris.");
}
}
$user->insert();
if (Env::blank('hruid')) {
$user->hruid($hruid);
}
$msg[] = "L'utilisateur a été ajouté.";
}
if (Env::has('image')) {
$group = Group::from('tol')->select(GroupSelect::castes());
$image = new ImageFilter(new PFC_And(new IFC_Id(Env::i('image')), new IFC_Temp()));
$image = $image->get(true);
if (!$image) {
throw new Exception("This image doesn't exist anymore");
}
$image->select(FrankizImageSelect::caste());
$image->label($user->fullName());
$image->caste($group->caste(Rights::everybody()));
$tv = new TolValidate($image, $user);
$v = new Validate(array('writer' => $user, 'group' => $group, 'item' => $tv, 'type' => 'tol'));
$v->insert();
$msg[] = 'La demande de changement de photo tol a été prise en compte.
Les tolmestres essaieront de te la valider au plus tôt.';
//.........这里部分代码省略.........
示例2: handler_webredir
function handler_webredir($page)
{
$page->changeTpl('platal/webredirect.tpl');
$page->setTitle('Redirection de page WEB');
if (Env::v('submit') == 'Valider' && !Env::blank('url')) {
if (Env::blank('url')) {
$page->trigError('URL invalide');
} else {
$url = Env::t('url');
XDB::execute('INSERT INTO carvas (uid, url)
VALUES ({?}, {?})
ON DUPLICATE KEY UPDATE url = VALUES(url)', S::i('uid'), $url);
S::logger()->log('carva_add', 'http://' . $url);
$page->trigSuccess("Redirection activée vers <a href='http://{$url}'>{$url}</a>");
}
} elseif (Env::v('submit') == 'Supprimer') {
XDB::execute('DELETE FROM carvas
WHERE uid = {?}', S::i('uid'));
Post::kill('url');
S::logger()->log('carva_del');
$page->trigSuccess('Redirection supprimée');
}
$url = XDB::fetchOneCell('SELECT url
FROM carvas
WHERE uid = {?}', S::i('uid'));
$page->assign('carva', $url);
# FIXME: this code is not multi-domain compatible. We should decide how
# carva will extend to users not in the main domain.
$best = XDB::fetchOneCell('SELECT email
FROM email_source_account
WHERE uid = {?} AND FIND_IN_SET(\'bestalias\', flags)', S::user()->id());
$page->assign('bestalias', $best);
}
示例3: blank
public function blank($key, $strict = false)
{
if ($this->fake_env) {
return $this->fake_env->blank($key, $strict);
} else {
return Env::blank($key, $strict);
}
}