本文整理汇总了PHP中Env::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::has方法的具体用法?PHP Env::has怎么用?PHP Env::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handler_admin_nl_sync
public function handler_admin_nl_sync($page)
{
global $globals;
$nl = $this->getNl();
if (!$nl) {
return PL_FORBIDDEN;
}
if (Env::has('add_users')) {
S::assert_xsrf_token();
$nl->bulkSubscribe(array_keys(Env::v('add_users')));
$page->trigSuccess('Ajouts réalisés avec succès.');
}
// TODO(x2006barrois): remove raw SQL query.
$uids = XDB::fetchColumn('SELECT DISTINCT(g.uid)
FROM group_members AS g
WHERE g.asso_id = {?} AND NOT EXISTS (SELECT ni.*
FROM newsletter_ins AS ni
INNER JOIN newsletters AS n ON (ni.nlid = n.id)
WHERE g.uid = ni.uid AND n.group_id = g.asso_id)', $globals->asso('id'));
$users = User::getBulkUsersWithUIDs($uids);
usort($users, 'User::compareDirectoryName');
$page->setTitle('Synchronisation de la newsletter');
$page->changeTpl('newsletter/sync.tpl');
$page->assign('users', $users);
}
示例2: handler_upload
function handler_upload($page)
{
$page->assign('exception', false);
$page->assign('image', false);
if (FrankizUpload::has('file')) {
$g = Group::from('temp')->select(GroupSelect::castes());
$temp = $g->caste(Rights::everybody());
try {
$upload = FrankizUpload::v('file');
$secret = uniqid();
$i = new FrankizImage();
$i->insert();
$i->caste($temp);
$i->label($secret);
$i->image($upload);
$page->assign('image', $i);
$page->assign('secret', $secret);
} catch (Exception $e) {
try {
if ($i) {
$i->delete();
}
} catch (Exception $eb) {
$page->assign('exception', $eb);
}
$page->assign('exception', $e);
if ($e instanceof ImageSizeException) {
$page->assign('pixels', true);
} else {
if ($e instanceof UploadSizeException) {
$page->assign('bytes', true);
} else {
if ($e instanceof ImageFormatException) {
$page->assign('format', true);
}
}
}
}
}
if (Env::has('delete')) {
$image = new FrankizImage(Env::i('iid'));
$image->select(FrankizImageSelect::base());
if ($image->label() == Env::s('secret')) {
$image->delete();
}
}
$page->addCssLink('upload.css');
$page->changeTpl('images/upload.tpl', SIMPLE);
}
示例3: handle_editor
public function handle_editor()
{
$this->title = Env::t('title', '');
$this->content = Env::t('news_content', '');
$this->begin = new FrankizDateTime(Env::t('begin'));
$this->end = new FrankizDateTime(Env::t('end'));
if (Env::has('image')) {
$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($this->title);
$image->caste($this->target);
$this->image($image);
}
return true;
}
示例4: sendmailfinal
public function sendmailfinal($isok)
{
if (is_null($this->user->bestEmail())) {
$this->user->select(UserSelect::base());
}
$mail = new FrankizMailer('validate/mail.valid.tol.tpl');
if (Env::has("ans")) {
$mail->assign('comm', Env::v('ans'));
}
$mail->assign('isOk', $isok);
if ($isok) {
$mail->Subject = '[Frankiz] Ta photo tol a été validée';
} else {
$mail->Subject = '[Frankiz] Ta photo tol a été refusée';
}
$mail->SetFrom($this->_mail_from_addr(), $this->_mail_from_disp());
$mail->AddAddress($this->user->bestEmail(), $this->user->displayName());
$mail->AddCC($this->_mail_from_addr(), $this->_mail_from_disp());
$mail->Send(false);
}
示例5: handler_ig_search
function handler_ig_search($page)
{
if (Env::has('quick') && Env::s('quick') != '') {
global $globals;
require_once 'userset.inc.php';
$view = new QuickSearchSet();
$view->addMod('gadget', 'Gadget', true);
$view->apply(null, $page);
$nb_tot = $view->count();
$page->assign('result_count', $nb_tot);
if (!S::logged() && $nb_tot > $globals->search->public_max) {
$page->assign('error', 'Votre recherche a généré trop de résultats pour un affichage public.');
} elseif ($nb_tot > $globals->search->private_max) {
$page->assign('error', 'Recherche trop générale.');
} elseif (empty($nb_tot)) {
$page->assign('error', 'Il n\'existe personne correspondant à ces critères dans la base !');
} else {
$page->assign('error', false);
}
}
require_once 'gadgets/gadgets.inc.php';
init_igoogle_html('gadgets/ig-search.tpl', AUTH_PUBLIC);
}
示例6: handle_editor
protected function handle_editor()
{
global $globals;
if (Env::has('listname')) {
$this->liste = Post::t('listname');
}
if (Env::has('domainname')) {
$this->domain = Post::t('domainname');
}
if (Env::has('assotype')) {
$this->asso = Post::t('assotype');
}
if (!$this->asso) {
$this->domain = $globals->mail->domain;
}
foreach ($this->owners as $key => &$email) {
$email = Post::t('owners_' . $key);
}
foreach ($this->members as $key => &$email) {
$email = Post::t('members_' . $key);
}
return true;
}
示例7: init_igoogle_html
function init_igoogle_html($template, $auth = AUTH_PUBLIC)
{
$page =& Platal::page();
$page->changeTpl('gadgets/ig-skin.tpl', NO_SKIN);
$page->register_modifier('escape_html', 'escape_html');
$page->default_modifiers = array('@escape_html');
header('Accept-Charset: utf-8');
// Adds external JavaScript libraries provided by iGoogle to the page.
if (Env::has('libs')) {
$libs = preg_split('/,/', Env::s('libs'), -1, PREG_SPLIT_NO_EMPTY);
foreach ($libs as $lib) {
if (preg_match('@^[a-z0-9/._-]+$@i', $lib) && !preg_match('@([.][.])|([.]/)|(//)@', $lib)) {
$page->append('gadget_js', 'https://www.google.com/ig/f/' . $lib);
}
}
}
// Redirects the user to the login pagin if required.
if ($auth > S::v('auth', AUTH_PUBLIC)) {
$page->assign('gadget_tpl', 'gadgets/ig-login.tpl');
return false;
}
$page->assign('gadget_tpl', $template);
return true;
}
示例8: handler_debug
function handler_debug($page)
{
global $globals;
if (Env::has("reload")) {
S::user()->select(UserSelect::login());
}
if ($globals->debug & DEBUG_BT) {
$sessions = array();
foreach ($_SESSION as $key => $val) {
ob_start();
var_dump($val);
$str = ob_get_clean();
$str = str_replace("\n", '', $str);
$str = str_replace('{', '</span><ul><li><span>', $str);
$str = str_replace('[', '</span></li><li><span>[', $str);
$str = str_replace('}', '</li></span></ul>', $str);
$str = preg_replace('/<span> *<\\/span>/i', '', $str);
$str = preg_replace('/<li> *<\\/li>/i', '', $str);
$sessions[$key] = $str;
}
$page->assign('session', $sessions);
}
$page->assign('title', 'Debug');
$page->changeTpl('admin/debug.tpl');
}
示例9: handle_form
/**
* to validate a form
*/
public function handle_form()
{
if (is_null($this->item)) {
return false;
}
// edit informations
if (Env::has('edit')) {
if ($this->item->handle_editor()) {
$this->update();
Platal::page()->assign('msg', 'Requête mise à jour');
return true;
}
return false;
}
// add a comment
if (Env::has('add_comm')) {
if (!strlen(Env::t('comm'))) {
return false;
}
$this->item->add_comment(S::user()->displayName(), Env::v('comm'));
$this->item->sendmailcomment($this->writer);
$this->update();
Platal::page()->assign('msg', 'Commentaire ajouté');
return true;
}
if (Env::has('accept')) {
if ($this->commit()) {
Platal::page()->assign('msg', 'Email de validation envoyé');
return true;
} else {
Platal::page()->assign('msg', 'Erreur lors de la validation');
return false;
}
}
if (Env::has('delete')) {
if (!Env::v('ans')) {
Platal::page()->assign('msg', 'Pas de motivation pour le refus !!!');
return false;
} else {
if ($this->item->delete()) {
$this->item->sendmailfinal(false);
$this->clean();
Platal::page()->assign('msg', 'Email de refus envoyé');
return true;
} else {
Platal::page()->assign('msg', 'Erreur lors de la suppression des données');
return false;
}
}
}
return false;
}
示例10: handler_admin
function handler_admin($page, $liste = null)
{
global $globals;
if (is_null($liste)) {
return PL_NOT_FOUND;
}
$mlist = $this->prepare_list($liste);
$this->is_group_admin($page);
if (!$this->is_group_admin($page)) {
$this->verify_list_owner($page, $mlist);
}
$page->changeTpl('lists/admin.tpl');
if (Env::has('send_mark')) {
S::assert_xsrf_token();
$actions = Env::v('mk_action');
$uids = Env::v('mk_uid');
$mails = Env::v('mk_email');
foreach ($actions as $key => $action) {
switch ($action) {
case 'none':
break;
case 'marketu':
case 'markets':
require_once 'emails.inc.php';
$user = User::get($uids[$key]);
$mail = valide_email($mails[$key]);
if (isvalid_email_redirection($mail, $user)) {
$from = $action == 'marketu' ? 'user' : 'staff';
$market = Marketing::get($uids[$key], $mail);
if (!$market) {
$market = new Marketing($uids[$key], $mail, 'list', $mlist->address, $from, S::v('uid'));
$market->add();
break;
}
}
default:
XDB::execute('INSERT IGNORE INTO register_subs (uid, type, sub, domain)
VALUES ({?}, \'list\', {?}, {?})', $uids[$key], $mlist->mbox, $mlist->domain);
}
}
}
if (Env::has('add_member') || isset($_FILES['add_member_file']) && $_FILES['add_member_file']['tmp_name']) {
S::assert_xsrf_token();
if (isset($_FILES['add_member_file']) && $_FILES['add_member_file']['tmp_name']) {
$upload =& PlUpload::get($_FILES['add_member_file'], S::user()->login(), 'list.addmember', true);
if (!$upload) {
$page->trigError("Une erreur s'est produite lors du téléchargement du fichier.");
} else {
$logins = $upload->getContents();
}
} else {
$logins = Env::v('add_member');
}
$logins = preg_split("/[; ,\r\n\\|]+/", $logins);
$members = User::getBulkForlifeEmailsFromEmail($logins);
$unfound = array_diff_key($logins, $members);
// Make sure we send a list (array_values) of unique (array_unique)
// emails.
$members = array_values(array_unique($members));
$arr = $mlist->subscribeBulk($members);
$successes = array();
if (is_array($arr)) {
foreach ($arr as $addr) {
$successes[] = $addr[1];
$page->trigSuccess("{$addr[0]} inscrit.");
}
}
$already = array_diff($members, $successes);
if (is_array($already)) {
foreach ($already as $item) {
$page->trigWarning($item . ' est déjà inscrit.');
}
}
if (is_array($unfound)) {
foreach ($unfound as $item) {
if (trim($item) != '') {
$page->trigError($item . " ne correspond pas à un compte existant et n'est pas une adresse email.");
}
}
}
}
if (Env::has('del_member')) {
S::assert_xsrf_token();
if (strpos(Env::v('del_member'), '@') === false) {
if ($del_member = User::getSilent(Env::t('del_member'))) {
$mlist->unsubscribeBulk(array($del_member->forlifeEmail()));
}
} else {
$mlist->unsubscribeBulk(array(Env::v('del_member')));
}
pl_redirect('lists/admin/' . $liste);
}
if (Env::has('add_owner')) {
S::assert_xsrf_token();
$owners = User::getBulkForlifeEmailsFromEmail(Env::v('add_owner'));
if ($owners) {
foreach ($owners as $forlife_email) {
if ($mlist->addOwner($forlife_email)) {
$page->trigSuccess($login . " ajouté aux modérateurs.");
}
//.........这里部分代码省略.........
示例11: sendmailcomment
public function sendmailcomment($user)
{
$mail = new FrankizMailer('validate/mail.comment.tpl');
$mail->assign('admin', S::user());
$mail->assign('type', $this->type);
$mail->assign('user', $user->displayName());
if (Env::has('comm')) {
$mail->assign('comm', Env::v('comm'));
}
$mail->Subject = "Commentaires de validation de type \"{$this->label()}\"";
$mail->SetFrom($this->_mail_from_addr(), $this->_mail_from_disp());
$mail->AddAddress($this->_mail_from_addr(), $this->_mail_from_disp());
$mail->Send(false);
}
示例12: sendmailfinal
public function sendmailfinal($isok)
{
if (is_null($this->writer->bestEmail())) {
$this->writer->select(User::SELECT_BASE);
}
$mail = new FrankizMailer('validate/mail.valid.licenses.tpl');
$mail->assign('isok', $isok);
$mail->assign('software_name', $this->softwareName());
if (Env::has("ans")) {
$mail->assign('comm', Env::v('ans'));
}
if ($isok) {
$mail->Subject = '[Frankiz] Ta demance de licence a été acceptée';
} else {
$mail->Subject = '[Frankiz] Ta demance de licence a été refusée';
}
$mail->SetFrom($this->_mail_from_addr(), $this->_mail_from_disp());
$mail->AddAddress($this->writer->bestEmail(), $this->writer->displayName());
$mail->AddCC($this->_mail_from_addr(), $this->_mail_from_disp());
$mail->Send(false);
}
示例13: handler_group_admin
function handler_group_admin($page, $group = null)
{
$group = Group::fromId($group);
if ($group && (S::user()->hasRights($group, Rights::admin()) || S::user()->isWeb())) {
$group->select(GroupSelect::see());
$page->assign('group', $group);
if (Env::has('name') && Env::t('name') != '' && S::user()->isAdmin()) {
S::logger()->log("groups/admin", array("gid" => $group->id(), "old_name" => $group->name(), "new_name" => Env::t('name')));
$group->name(Env::t('name'));
}
if (Env::has('update') && S::user()->isAdmin()) {
$group->external(Env::has('external'));
$group->leavable(Env::has('leavable'));
$group->visible(Env::has('visible'));
}
if (Env::has('label')) {
$group->label(Env::t('label'));
}
if (Env::has('update')) {
$group->description(Env::t('description'));
$group->web(Env::t('web'));
$group->wikix(Env::t('wikix'));
$group->mail(Env::t('mail'));
}
if (Env::has('image')) {
$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($group->label());
$image->caste($group->caste(Rights::everybody()));
$group->image($image);
}
if (S::user()->isWeb()) {
$nss = XDB::fetchColumn('SELECT ns FROM groups GROUP BY ns');
$page->assign('nss', $nss);
if (Env::has('ns')) {
S::logger()->log("groups/admin", array("gid" => $group->id(), "old_ns" => $group->ns(), "new_ns" => Env::t('ns')));
$group->ns(Env::t('ns'));
}
}
$promos = S::user()->castes()->groups()->filter('ns', Group::NS_PROMO);
$page->assign('promos', $promos);
$page->assign('title', 'Administration de "' . $group->label() . '"');
$page->addCssLink('groups.css');
$page->changeTpl('groups/admin.tpl');
} else {
$page->assign('title', "Ce groupe n'existe pas ou vous n'en êtes pas administrateur");
$page->changeTpl('groups/no_group.tpl');
}
}
示例14: handler_admin_announce
function handler_admin_announce($page)
{
global $globals;
$page->changeTpl('xnetgrp/announce-admin.tpl');
if (Env::has('del')) {
S::assert_xsrf_token();
XDB::execute('DELETE FROM group_announces
WHERE id = {?} AND asso_id = {?}', Env::i('del'), $globals->asso('id'));
}
$res = XDB::iterator('SELECT id, titre, expiration, expiration < CURRENT_DATE() AS perime
FROM group_announces
WHERE asso_id = {?}
ORDER BY expiration DESC', $globals->asso('id'));
$page->assign('articles', $res);
}
示例15: handler_feed
function handler_feed($page)
{
if (Env::has('act_rss')) {
$hash_rss = rand_url_id(16);
S::user()->hash_rss($hash_rss);
$page->assign('success', true);
}
if (Env::has('des_rss')) {
S::user()->hash_rss('');
$page->assign('desactivated', true);
}
$page->assign('user', S::user());
$page->assign('title', 'Flux');
$page->addCssLink('profile.css');
$page->changeTpl('profile/feed.tpl');
}