本文整理汇总了PHP中Env::v方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::v方法的具体用法?PHP Env::v怎么用?PHP Env::v使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::v方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_editor
protected function handle_editor()
{
$this->art->body = Env::v('nl_body');
$this->art->title = Env::v('nl_title');
$this->art->append = Env::v('nl_append');
return true;
}
示例2: prepareform
function prepareform($pay, $user)
{
// Documentation:
// https://www.paypal.com/developer
// Warning: the automatic return only works if we force the
// users to create a paypal account. We do not use it; thus
// the user must come back on the site.
global $globals, $platal;
$this->urlform = 'https://' . $globals->money->paypal_site . '/cgi-bin/webscr';
$roboturl = str_replace("https://", "http://", $globals->baseurl) . '/' . $platal->ns . "payment/paypal_return/" . $user->id() . "?comment=" . urlencode(Env::v('comment')) . '&display=' . Post::i('display');
$this->infos = array('commercant' => array('business' => $globals->money->paypal_compte, 'rm' => 2, 'return' => $roboturl, 'cn' => 'Commentaires', 'no_shipping' => 1, 'cbt' => empty($GLOBALS['IS_XNET_SITE']) ? 'Revenir sur polytechnique.org.' : 'Revenir sur polytechnique.net.'));
$info_client = array('first_name' => $user->firstName(), 'last_name' => $user->lastName(), 'email' => $user->bestEmail());
if ($user->hasProfile()) {
$res = XDB::query("SELECT pa.text, GROUP_CONCAT(pace2.short_name) AS city,\n GROUP_CONCAT(pace3.short_name) AS zip, GROUP_CONCAT(pace1.short_name) AS country,\n IF(pp1.display_tel != '', pp1.display_tel, pp2.display_tel) AS night_phone_b\n FROM profile_addresses AS pa\n LEFT JOIN profile_phones AS pp1 ON (pp1.pid = pa.pid AND pp1.link_type = 'address' AND pp1.link_id = pa.id)\n LEFT JOIN profile_phones AS pp2 ON (pp2.pid = pa.pid AND pp2.link_type = 'user' AND pp2.link_id = 0)\n LEFT JOIN profile_addresses_components AS pc ON (pa.pid = pc.pid AND pa.jobid = pc.jobid AND pa.groupid = pc.groupid\n AND pa.type = pc.type AND pa.id = pc.id)\n LEFT JOIN profile_addresses_components_enum AS pace1 ON (FIND_IN_SET('country', pace1.types) AND pace1.id = pc.component_id)\n LEFT JOIN profile_addresses_components_enum AS pace2 ON (FIND_IN_SET('locality', pace2.types) AND pace2.id = pc.component_id)\n LEFT JOIN profile_addresses_components_enum AS pace3 ON (FIND_IN_SET('postal_code', pace3.types) AND pace3.id = pc.component_id)\n WHERE pa.pid = {?} AND FIND_IN_SET('current', pa.flags)\n GROUP BY pa.pid, pa.jobid, pa.groupid, pa.id, pa.type\n LIMIT 1", $user->profile()->id());
if (is_array($res)) {
$this->infos['client'] = array_map('replace_accent', array_merge($info_client, $res->fetchOneAssoc()));
list($this->infos['client']['address1'], $this->infos['client']['address2']) = explode("\n", Geocoder::getFirstLines($this->infos['client']['text'], $this->infos['client']['zip'], 2));
unset($this->infos['client']['text']);
} else {
$this->infos['client'] = array_map('replace_accent', $info_client);
}
} else {
$this->infos['client'] = array_map('replace_accent', $info_client);
}
// We build the transaction's reference
$prefix = rand_url_id();
$fullref = substr("{$prefix}-xorg-{$pay->id}", -15);
$this->infos['commande'] = array('item_name' => replace_accent($pay->text), 'amount' => $this->val_number, 'currency_code' => 'EUR', 'custom' => $fullref);
$this->infos['divers'] = array('cmd' => '_xclick');
}
示例3: 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);
}
示例4: handler_ajax_get
function handler_ajax_get($page)
{
$json = json_decode(Env::v('json'));
$wiki = new Wiki($json->wid);
$versions = isset($json->versions) ? $json->versions : array('last');
try {
$wiki->select(array(Wiki::SELECT_VERSION => array('versions' => $versions, 'options' => UserSelect::base())));
$page->jsonAssign('wiki', $wiki->export());
} catch (Exception $e) {
$page->jsonAssign('error', $e->getMessage());
}
return PL_JSON;
}
示例5: sendmailfinal
public function sendmailfinal($isok)
{
$mail = new FrankizMailer('validate/mail.valid.mail.tpl');
$mail->assign('comm', Env::v('ans', ''));
$mail->assign('targetGroup', $this->formation);
if ($isok) {
$mail->Subject = '[Frankiz] Ton mail a été accepté';
} else {
$mail->Subject = '[Frankiz] Ton mail a été refusé';
$mail->assign('text', $this->body);
}
$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);
}
示例6: 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);
}
示例7: handle_editor
protected function handle_editor()
{
$this->titre = Env::v('titre');
$this->texte = Env::v('texte');
$this->pmin = Env::i('promo_min');
$this->pmax = Env::i('promo_max');
$this->expiration = Env::v('expiration');
if (@$_FILES['image']['tmp_name']) {
$upload = PlUpload::get($_FILES['image'], S::user()->login(), 'event');
if (!$upload) {
$this->trigError("Impossible de télécharger le fichier");
} elseif (!$upload->isType('image')) {
$page->trigError('Le fichier n\'est pas une image valide au format JPEG, GIF ou PNG');
$upload->rm();
} elseif (!$upload->resizeImage(200, 300, 100, 100, 32284)) {
$page->trigError('Impossible de retraiter l\'image');
} else {
$this->readImage($upload);
}
}
return true;
}
示例8: prepareform
function prepareform($pay, $user)
{
global $globals, $platal;
$log = S::v('log');
// Transaction's reference computation.
$prefix = rand_url_id();
$fullref = substr("{$prefix}-{$pay->id}", -12);
// FIXME : check for duplicates
$ts = time();
$trans_date = gmdate("YmdHis", $ts);
$trans_id = gmdate("His", $ts);
// FIXME : check for duplicates
// Form's content.
$this->urlform = "https://systempay.cyberpluspaiement.com/vads-payment/";
$this->infos['commercant'] = array('vads_site_id' => $globals->money->cyperplus_account, 'vads_return_mode' => 'NONE', 'vads_url_return' => $pay->url ? $pay->url : $globals->baseurl . '/' . $platal->ns);
$this->infos['client'] = array('vads_cust_email' => $user->bestEmail(), 'vads_cust_id' => $user->id(), 'vads_cust_name' => substr(self::replaceNonAlpha(replace_accent($user->shortName())), 0, 127));
$this->infos['commande'] = array('vads_amount' => $this->val, 'vads_currency' => '978', 'vads_payment_config' => 'SINGLE', 'vads_trans_date' => $trans_date, 'vads_trans_id' => $trans_id, 'vads_order_id' => $fullref, 'vads_order_info' => substr(self::replaceNonAlpha(replace_accent(Env::v('comment'))), 0, 255), 'vads_order_info2' => Post::i('display'));
$this->infos['divers'] = array('vads_version' => 'V2', 'vads_ctx_mode' => $globals->money->cyperplus_prod, 'vads_page_action' => 'PAYMENT', 'vads_action_mode' => 'INTERACTIVE');
// Entry key computation.
$all_params = array_merge($this->infos['commercant'], $this->infos['client'], $this->infos['commande'], $this->infos['divers']);
ksort($all_params);
$this->infos['divers']['signature'] = sha1(join('+', $all_params) . '+' . $globals->money->cyperplus_key);
}
示例9: ajaxGetBranch
/**
* Display a JSon page containing the sub-branches of a branch in the job terms tree.
* @param $page the Platal page
* @param $filter filter helps to display only jobterms that are contained in jobs or in mentors
*
* @param Env::i('jtid') job term id of the parent branch, if none trunk will be used
* @param Env::v('attrfunc') the name of a javascript function that will be called when a branch
* is chosen
* @param Env::v('treeid') tree id that will be given as first argument of attrfunc function
* the second argument will be the chosen job term id and the third one the chosen job's full name.
* @param Env::v('text_filter') a string (usually ending by %) that will be used to filter
* subbranches, keeping only the one containing this text in its title or in the title of one of
* its subbranches.
*/
public static function ajaxGetBranch($page, $filter = self::ALL)
{
pl_content_headers('application/json');
$page->changeTpl('include/jobterms.branch.tpl', NO_SKIN);
$subTerms = self::getSubTerms(Env::v('jtid'), $filter, Env::v('text_filter'));
$page->assign('subTerms', $subTerms);
switch ($filter) {
case self::ONLY_JOBS:
$page->assign('filter', 'camarade');
break;
case self::ONLY_MENTORS:
$page->assign('filter', 'mentor');
break;
}
$page->assign('jtid', Env::v('jtid'));
$page->assign('text_filter', Env::v('text_filter'));
$page->assign('attrfunc', Env::v('attrfunc'));
$page->assign('treeid', Env::v('treeid'));
}
示例10: upload_image
private function upload_image(PlPage $page, PlUpload $upload)
{
if (@(!$_FILES['image']['tmp_name']) && !Env::v('image_url')) {
return true;
}
if (!$upload->upload($_FILES['image']) && !$upload->download(Env::v('image_url'))) {
$page->trigError('Impossible de télécharger l\'image');
return false;
} elseif (!$upload->isType('image')) {
$page->trigError('Le fichier n\'est pas une image valide au format JPEG, GIF ou PNG.');
$upload->rm();
return false;
} elseif (!$upload->resizeImage(80, 100, 100, 100, 32284)) {
$page->trigError('Impossible de retraiter l\'image');
return false;
}
return true;
}
示例11: sendmail
protected function sendmail($isok)
{
// Only sends email if the profile's owner exists and is registered.
if ($this->ownerIsRegistered) {
global $globals;
$mailer = new PlMailer();
$mailer->setSubject($this->_mail_subj());
$mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
$mailer->addTo("\"{$this->profile->fullName()}\" <{$this->profileOwner->bestEmail()}>");
$mailer->addCc("validation+{$this->type}@{$globals->mail->domain}");
$body = ($this->profile->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n") . $this->_mail_body($isok) . (Env::has('comm') ? "\n\n" . Env::v('comm') : '') . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n" . $this->_mail_ps($isok);
$mailer->setTxtBody(wordwrap($body));
$mailer->send();
}
}
示例12: 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;
}
示例13: 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.");
}
//.........这里部分代码省略.........
示例14: sendmailfinal
public function sendmailfinal($isok)
{
if ($this->writer->bestEmail() === null) {
$this->writer->select(UserSelect::base());
}
$mail = new FrankizMailer('validate/mail.valid.activity.tpl');
$mail->assign('isok', $isok);
$mail->assign('valid_origin', $this->valid_origin);
$mail->assign('comm', Env::v('ans', ''));
$mail->assign('targetGroup', $this->target->group());
$mail->assign('origin', $this->origin);
if ($isok && !$this->valid_origin) {
$mail->Subject = '[Frankiz] Ton activité a été validée';
} elseif ($isok) {
$mail->Subject = '[Frankiz] Le groupe d\'origine de ton activité a été validé';
} else {
$mail->Subject = '[Frankiz] Ton activité 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);
}
示例15: handler_mail
function handler_mail($page)
{
$subject = Env::t('subject', '');
$body = Env::t('mail_body', '');
$no_wiki = Env::has('no_wiki');
// Retrieve the years on_platal of each formation
$formations = Formation::selectAll(FormationSelect::on_platal());
if (Env::has('send')) {
try {
$required_fields = array('subject' => 'Il faut donner un sujet à ton mail', 'mail_body' => 'Tu ne veux pas envoyer de mail vide à tous. Si ?');
foreach ($required_fields as $field => $msg) {
if (Env::v($field, '') == '') {
throw new Exception($msg);
}
}
if (Env::t('origin_mail_proposal') == 'false') {
$origin = false;
} else {
$origin = new Group(Env::i('origin_mail_proposal'));
}
if ($origin !== false && !S::user()->hasRights($origin, Rights::admin())) {
throw new Exception("Invalid credentials for origin Group");
}
if (Env::t('type_mail_proposal') == 'group') {
// Mail to a group
list($temp, $target_group) = self::target_picker_to_caste_group('mail');
$target = new Collection('Caste');
$target->add($temp);
$target_group->select(GroupSelect::validate());
$nv = new MailValidate(array('writer' => S::user(), 'type_mail' => Env::t('type_mail_proposal'), 'origin' => $origin, 'targets' => $target, 'subject' => $subject, 'body' => $body, 'nowiki' => $no_wiki, 'formation' => $target_group));
$el = new Validate(array('item' => $nv, 'group' => $target_group, 'writer' => S::user(), 'type' => 'mail'));
$el->insert();
} elseif (Env::t('type_mail_proposal') == 'promo') {
// Target group is a Collection of formation groups, which validate requests
$target_group = new Collection('Group');
// Group promos by formation
$promos = unflatten(Env::v('promos'));
$promosByFormation = array();
foreach ($promos as $formation_promo) {
$formation_promo = trim($formation_promo);
if (!$formation_promo) {
continue;
}
if (!preg_match('/^([0-9]+)_([0-9]+)$/', $formation_promo, $matches)) {
throw new Exception("Oops, mauvais format de destinataire.");
}
$formid = (int) $matches[1];
$promo = (int) $matches[2];
if (isset($promosByFormation[$formid])) {
$promosByFormation[$formid][] = $promo;
} else {
$promosByFormation[$formid] = array($promo);
}
}
if (empty($promosByFormation)) {
throw new Exception("Il faut indiquer au moins un destinataire.");
}
foreach ($promosByFormation as $formid => $promos) {
// Now, $promos are the list of promos of formation $formid
$form = $formations->get($formid);
// Study group are the people the mail is sent to, array of CasteFilterCondition
$cfc_study_groups = array();
foreach ($promos as $promo) {
if (!$form->hasPlatalYear($promo)) {
throw new Exception("Mauvaise promo " . $promo . " pour " . $form->label() . ".");
}
$cfc_study_groups[] = new CFC_Group($form->getGroupForPromo($promo), Rights::restricted());
}
$target = new CasteFilter(new PFC_Or($cfc_study_groups));
$target = $target->get();
$target->select(CasteSelect::validate());
// $target_group is the group which validates this email
$target_group = $form->getGroup();
$target_group->select(GroupSelect::validate());
$nv = new MailValidate(array('writer' => S::user(), 'type_mail' => Env::t('type_mail_proposal'), 'origin' => $origin, 'targets' => $target, 'subject' => $subject, 'body' => $body, 'nowiki' => $no_wiki, 'formation' => $target_group));
$el = new Validate(array('item' => $nv, 'group' => $target_group, 'writer' => S::user(), 'type' => 'mail'));
$el->insert();
}
}
$page->assign('envoye', true);
} catch (Exception $e) {
$page->trigError($e->getMessage());
}
}
$page->assign('subject', $subject);
$page->assign('body', $body);
$page->assign('nowiki', $no_wiki);
$page->assign('formations', $formations);
$page->assign('title', 'Envoi des mails');
$page->addCssLink('validate.css');
$page->changeTpl('validate/prop.mail.tpl');
}