当前位置: 首页>>代码示例>>PHP>>正文


PHP Env::i方法代码示例

本文整理汇总了PHP中Env::i方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::i方法的具体用法?PHP Env::i怎么用?PHP Env::i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Env的用法示例。


在下文中一共展示了Env::i方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
 }
开发者ID:netixx,项目名称:frankiz,代码行数:49,代码来源:images.php

示例2: 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;
 }
开发者ID:netixx,项目名称:frankiz,代码行数:19,代码来源:newsvalidate.php

示例3: handler_links_admin

 function handler_links_admin($page)
 {
     if (!S::user()->perms()->hasFlag('admin')) {
         return PL_FORBIDDEN;
     }
     $collec = Link::all();
     $collec->select(LinkSelect::all());
     $results = $collec->split('ns');
     if (Env::has('modify')) {
         $id = Env::i('id');
         $link = $collec->get($id);
         if ($link !== false) {
             if (Env::has('image')) {
                 try {
                     $group = Group::from('partnership');
                     $group->select();
                     $image = new FrankizImage();
                     $image->insert();
                     $image->label($link->label());
                     $image->caste($group->caste('everybody'));
                     $image->image(FrankizUpload::v('image'));
                     $link->image($image);
                 } catch (Exception $e) {
                     $page->assign('err', $e->getMessage());
                 }
             }
             $link->label(Env::t('label'));
             $link->link(Env::t('link'));
             $link->description(Env::t('description'));
             $link->comment(Env::t('comment'));
         } else {
             $err = 'Le lien modifié n\'existe plus.';
             $page->assign('err', $err);
         }
     }
     $page->addCssLink('links.css');
     $page->assign('links', $results);
     $page->assign('title', 'Administrer les liens');
     $page->changeTpl('links/admin_links.tpl');
 }
开发者ID:netixx,项目名称:frankiz,代码行数:40,代码来源:links.php

示例4: 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;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:22,代码来源:evts.inc.php

示例5: handler_admin

 function handler_admin($page, $nid = false)
 {
     $news = News::fromId($nid);
     if ($news !== false) {
         $news->select(NewsSelect::news());
         if (S::user()->hasRights($news->target()->group(), Rights::admin()) || S::user()->isWeb()) {
             if (Env::has('modify') || Env::has('delete')) {
                 S::assert_xsrf_token();
             }
             if (Env::has('modify')) {
                 $news->title(Env::t('title'));
                 $news->content(Env::t('news_content'));
                 $news->begin(new FrankizDateTime(Env::t('begin')));
                 $news->end(new FrankizDateTime(Env::t('end')));
                 if (Env::has('reappear')) {
                     $news->removeReadFlags();
                 }
                 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($news->title());
                     $image->caste($news->target());
                     $news->image($image);
                 }
                 $page->assign('msg', "L'annonce a été modifiée.");
             }
             if (Env::has('delete')) {
                 $news->delete();
                 $page->assign('delete', true);
             }
         }
     }
     $page->assign('news', $news);
     $page->assign('isEdition', true);
     $page->assign('title', "Modifier l'annonce");
     $page->addCssLink('validate.css');
     $page->changeTpl('news/admin.tpl');
 }
开发者ID:netixx,项目名称:frankiz,代码行数:42,代码来源:news.php

示例6: 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');
     }
 }
开发者ID:netixx,项目名称:frankiz,代码行数:53,代码来源:groups.php

示例7: apiAuth

 /**
  * The authentication schema is based on three query parameters:
  *   ?user=<hruid>&timestamp=<timestamp>&sig=<sig>
  * where:
  *   - hruid is the hruid of the querying user
  *   - timestamp is the current UNIX timestamp, which has to be within a
  *     given distance of the server-side UNIX timestamp
  *   - sig is the HMAC of "<method>#<resource>#<payload>#<timestamp>" using
  *     a known secret of the user as the key.
  *
  * At the moment, the shared secret of the user is the sha1 hash of its
  * password. This is temporary, though, until better support for tokens is
  * implemented in plat/al.
  * TODO(vzanotti): Switch to dedicated secrets for authentication.
  */
 public function apiAuth($method, $resource, $payload)
 {
     // Verify that the timestamp is within acceptable bounds.
     $timestamp = Env::i('timestamp', 0);
     if (abs($timestamp - time()) > Platal::globals()->api->timestamp_tolerance) {
         return null;
     }
     // Retrieve the user corresponding to the forlife. Note that at the
     // moment, other aliases are also accepted.
     $user = User::getSilent(Env::s('user', ''));
     if (is_null($user) || !$user->isActive()) {
         return null;
     }
     // Determine the list of tokens associated with the user. At the moment,
     // this is just the sha1 of the password.
     $tokens = array($user->password());
     // For each token, try to validate the signature.
     $message = implode('#', array($method, $resource, $payload, $timestamp));
     $signature = Env::s('sig');
     foreach ($tokens as $token) {
         $expected_signature = hash_hmac(Platal::globals()->api->hmac_algo, $message, $token);
         if ($signature == $expected_signature) {
             return $user;
         }
     }
     return null;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:42,代码来源:xorgsession.php

示例8: handler_skin

 function handler_skin($page)
 {
     global $globals;
     $page->changeTpl('platal/skins.tpl');
     $page->setTitle('Skins');
     if (Env::has('newskin')) {
         // formulaire soumis, traitons les données envoyées
         XDB::execute('UPDATE  accounts
                          SET  skin = {?}
                        WHERE  uid = {?}', Env::i('newskin'), S::i('uid'));
         S::kill('skin');
         Platal::session()->setSkin();
     }
     $res = XDB::query('SELECT  id
                          FROM  skins
                         WHERE  skin_tpl = {?}', S::v('skin'));
     $page->assign('skin_id', $res->fetchOneCell());
     $sql = 'SELECT  s.*, auteur, COUNT(*) AS nb
               FROM  skins AS s
          LEFT JOIN  accounts AS a ON (a.skin = s.id)
              WHERE  skin_tpl != \'\' AND ext != \'\'
           GROUP BY  id ORDER BY s.date DESC';
     $page->assign('skins', XDB::iterator($sql));
 }
开发者ID:Ekleog,项目名称:platal,代码行数:24,代码来源:platal.php

示例9: 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.';
//.........这里部分代码省略.........
开发者ID:netixx,项目名称:frankiz,代码行数:101,代码来源:profile.php

示例10: 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');
 }
开发者ID:netixx,项目名称:frankiz,代码行数:92,代码来源:proposal.php

示例11: handler_cyber2_return

 function handler_cyber2_return($page, $uid = null)
 {
     global $globals, $platal;
     /* on vérifie la signature */
     $vads_params = array();
     foreach ($_REQUEST as $key => $value) {
         if (substr($key, 0, 5) == 'vads_') {
             $vads_params[$key] = $value;
         }
     }
     ksort($vads_params);
     $signature = sha1(join('+', $vads_params) . '+' . $globals->money->cyperplus_key);
     //if($signature != Env::v('signature')) {
     //    cb_erreur("signature invalide");
     //}
     /* on extrait les informations sur l'utilisateur */
     $user = User::get(Env::i('vads_cust_id'));
     if (!$user) {
         cb_erreur("uid invalide");
     }
     /* on extrait la reference de la commande */
     if (!preg_match('/-([0-9]+)$/', Env::v('vads_order_id'), $matches)) {
         cb_erreur("référence de commande invalide");
     }
     $ref = $matches[1];
     $res = XDB::query('SELECT  mail, text, confirmation
                          FROM  payments
                         WHERE  id={?}', $ref);
     if ($res->numRows() != 1) {
         cb_erreur("référence de commande inconnue");
     }
     list($conf_mail, $conf_title, $conf_text) = $res->fetchOneRow();
     /* on extrait le montant */
     if (Env::v('vads_currency') != '978') {
         cb_erreur("monnaie autre que l'euro");
     }
     $montant = (double) Env::i('vads_amount') / 100;
     /* on extrait le code de retour */
     if (Env::v('vads_result') != '00') {
         cb_erreur('erreur lors du paiement : ?? (' . Env::v('vads_result') . ')', $conf_title);
     }
     /* on fait l'insertion en base de donnees */
     XDB::execute('INSERT INTO  payment_transactions (id, method_id, uid, ref, fullref, ts_confirmed, amount, pkey, comment, status, display)
                        VALUES  ({?}, 2, {?}, {?}, {?}, NOW(), {?}, {?}, {?}, "confirmed", {?})', Env::v('vads_trans_date'), $user->id(), $ref, Env::v('vads_order_id'), $montant, '', Env::v('vads_order_info'), Env::i('vads_order_info2'));
     echo "Payment stored.\n";
     // We check if it is an Xnet payment and then update the related ML.
     $res = XDB::query('SELECT  eid, asso_id
                          FROM  group_events
                         WHERE  paiement_id = {?}', $ref);
     if ($res->numRows() == 1) {
         list($eid, $asso_id) = $res->fetchOneRow();
         require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
         $evt = get_event_detail($eid, false, $asso_id);
         subscribe_lists_event($user->id(), $evt['short_name'], 1, $montant, true);
     }
     /* on genere le mail de confirmation */
     $conf_text = str_replace(array('<prenom>', '<nom>', '<promo>', '<montant>', '<salutation>', '<cher>', '<comment>'), array($user->firstName(), $user->lastName(), $user->promo(), $montant, $user->isFemale() ? 'Chère' : 'Cher', $user->isFemale() ? 'Chère' : 'Cher', Env::v('vads_order_info')), $conf_text);
     global $globals;
     $mymail = new PlMailer();
     $mymail->setFrom($conf_mail);
     $mymail->addCc($conf_mail);
     $mymail->setSubject($conf_title);
     $mymail->setWikiBody($conf_text);
     $mymail->sendTo($user);
     /* on envoie les details de la transaction à telepaiement@ */
     $mymail = new PlMailer();
     $mymail->setFrom("webmaster@" . $globals->mail->domain);
     $mymail->addTo($globals->money->email);
     $mymail->setSubject($conf_title);
     $msg = 'utilisateur : ' . $user->login() . ' (' . $user->id() . ')' . "\n" . 'mail : ' . $user->forlifeEmail() . "\n\n" . "paiement : {$conf_title} ({$conf_mail})\n" . "reference : " . Env::v('vads_order_id') . "\n" . "montant : {$montant}\n\n" . "dump de REQUEST:\n" . var_export($_REQUEST, true);
     $mymail->setTxtBody($msg);
     $mymail->send();
     echo "Notifications sent.\n";
     exit;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:75,代码来源:payment.php

示例12: handle_editor

 protected function handle_editor()
 {
     $this->titre = Env::v('pay_titre');
     $this->site = Env::v('pay_site');
     $this->montant = Env::t('pay_montant');
     $this->montant_min = Env::i('pay_montant_min');
     $this->montant_max = Env::i('pay_montant_max');
     $this->msg_reponse = Env::v('pay_msg_reponse');
     $this->public = Env::v('pay_public') == 'yes';
     $this->rib_id = Env::v('pay_rib_id');
     if ($this->rib_id) {
         $res = XDB::query("SELECT owner FROM payment_bankaccounts WHERE id = {?}", $this->rib_id);
         $this->rib_nom = $res->fetchOneCell();
     } else {
         $this->rib_nom = null;
     }
     return true;
 }
开发者ID:Ekleog,项目名称:platal,代码行数:18,代码来源:paiements.inc.php

示例13: handler_admin

 function handler_admin($page, $eid = null, $item_id = null)
 {
     global $globals;
     $this->load('xnetevents.inc.php');
     $evt = get_event_detail($eid, $item_id);
     if (!$evt) {
         return PL_NOT_FOUND;
     }
     $page->changeTpl('xnetevents/admin.tpl');
     if (!$evt['show_participants'] && !may_update()) {
         return PL_FORBIDDEN;
     }
     if (may_update() && Post::v('adm')) {
         S::assert_xsrf_token();
         $member = User::getSilent(Post::v('mail'));
         if (!$member) {
             $page->trigError("Membre introuvable");
         }
         // change the price paid by a participant
         if (Env::v('adm') == 'prix' && $member) {
             $amount = strtr(Env::v('montant'), ',', '.');
             XDB::execute("UPDATE group_event_participants\n                                 SET paid = paid + {?}\n                               WHERE uid = {?} AND eid = {?} AND nb > 0\n                            ORDER BY item_id ASC\n                               LIMIT 1", $amount, $member->uid, $evt['eid']);
             subscribe_lists_event($member->uid, $evt['short_name'], 1, $amount);
         }
         // change the number of personns coming with a participant
         if (Env::v('adm') == 'nbs' && $member) {
             $res = XDB::query("SELECT SUM(paid)\n                                     FROM group_event_participants\n                                    WHERE uid = {?} AND eid = {?}", $member->uid, $evt['eid']);
             $paid = $res->fetchOneCell();
             // Ensure we have an integer
             if ($paid == null) {
                 $paid = 0;
             }
             $nbs = Post::v('nb', array());
             $paid_inserted = false;
             foreach ($nbs as $id => $nb) {
                 $nb = max(intval($nb), 0);
                 if (!$paid_inserted && $nb > 0) {
                     $item_paid = $paid;
                     $paid_inserted = true;
                 } else {
                     $item_paid = 0;
                 }
                 XDB::execute('INSERT INTO  group_event_participants (eid, uid, item_id, nb, flags, paid)
                                    VALUES  ({?}, {?}, {?}, {?}, {?}, {?})
                   ON DUPLICATE KEY UPDATE  nb = VALUES(nb), flags = VALUES(flags), paid = VALUES(paid)', $evt['eid'], $member->uid, $id, $nb, '', $item_paid);
             }
             $res = XDB::query('SELECT  COUNT(uid) AS cnt, SUM(nb) AS nb
                                  FROM  group_event_participants
                                 WHERE  uid = {?} AND eid = {?}
                              GROUP BY  uid', $member->uid, $evt['eid']);
             $u = $res->fetchOneAssoc();
             if ($paid == 0 && Post::v('cancel')) {
                 XDB::execute("DELETE FROM group_event_participants\n                                        WHERE uid = {?} AND eid = {?}", $member->uid, $evt['eid']);
                 $u = 0;
                 subscribe_lists_event($member->uid, $evt['short_name'], -1, $paid);
             } else {
                 $u = $u['cnt'] ? $u['nb'] : null;
                 subscribe_lists_event($member->uid, $evt['short_name'], $u > 0 ? 1 : 0, $paid);
             }
         }
         $evt = get_event_detail($eid, $item_id);
     }
     $page->assign_by_ref('evt', $evt);
     $page->assign('tout', is_null($item_id));
     if (count($evt['moments'])) {
         $page->assign('moments', $evt['moments']);
     }
     if ($evt['paiement_id']) {
         $infos = User::getBulkUsersWithUIDs(XDB::fetchAllAssoc('SELECT  t.uid, t.amount
                                               FROM  payment_transactions AS t
                                          LEFT JOIN  group_event_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
                                              WHERE  t.status = "confirmed" AND t.ref = {?} AND ep.uid IS NULL', $evt['eid'], $evt['paiement_id']), 'uid', 'user');
         $page->assign('oublis', count($infos));
         $page->assign('oubliinscription', $infos);
     }
     $absents = User::getBulkUsersFromDB('SELECT  p.uid
                                            FROM  group_event_participants AS p
                                       LEFT JOIN  group_event_participants AS p2 ON (p2.uid = p.uid
                                                                                            AND p2.eid = p.eid
                                                                                            AND p2.nb != 0)
                                           WHERE  p.eid = {?} AND p2.eid IS NULL
                                        GROUP BY  p.uid', $evt['eid']);
     $ofs = Env::i('offset');
     $part = get_event_participants($evt, $item_id, UserFilter::sortByName(), NB_PER_PAGE, $ofs * NB_PER_PAGE);
     $nbp = ceil($evt['user_count'] / NB_PER_PAGE);
     if ($nbp > 1) {
         $links = array();
         if ($ofs) {
             $links['précédent'] = $ofs - 1;
         }
         for ($i = 1; $i <= $nbp; $i++) {
             $links[(string) $i] = $i - 1;
         }
         if ($ofs < $nbp - 1) {
             $links['suivant'] = $ofs + 1;
         }
         $page->assign('links', $links);
     }
     $page->assign('absents', $absents);
     $page->assign('participants', $part);
//.........这里部分代码省略.........
开发者ID:Ekleog,项目名称:platal,代码行数:101,代码来源:xnetevents.php

示例14: i

 public function i($key, $def = 0)
 {
     if ($this->fake_env) {
         return $this->fake_env->i($key, $def);
     } else {
         return Env::i($this->envprefix . $key, $def);
     }
 }
开发者ID:Ekleog,项目名称:platal,代码行数:8,代码来源:ufbuilder.inc.php

示例15: handler_modify_regular

 function handler_modify_regular($page, $aid = false)
 {
     $activities = new ActivityFilter(new PFC_And(new AFC_TargetGroup(S::user()->castes(Rights::admin())->groups()), new AFC_Regular(true)));
     $c = $activities->get();
     $c->select(ActivitySelect::base());
     $aid = Env::i('aid', $aid);
     if ($aid) {
         $a = $c->get($aid);
         if ($a === false) {
             throw new Exception("Invalid credentials");
         }
         if (Env::has('modify')) {
             S::assert_xsrf_token();
             if (preg_match('`^\\d{2}:\\d{2}$`', Env::t('begin')) && strtotime(Env::t('begin')) !== false && preg_match('`^\\d{2}:\\d{2}$`', Env::t('end')) && strtotime(Env::t('end')) !== false) {
                 $a->title(Env::t('title', $a->title()));
                 $a->description(Env::t('activity_description', $a->description()));
                 $a->days(implode(',', Env::v('days', $a->days())));
                 $a->default_begin(Env::t('begin') . ':00');
                 $a->default_end(Env::t('end') . ':00');
                 $page->assign('msg', 'L\'activité a été modifiée.');
             } else {
                 $page->assign('msg', 'Les dates données sont incorrectes.');
             }
         }
         $page->assign('aid', $aid);
         $page->assign('activity', $a);
     }
     $page->assign('activities', $c);
     $page->assign('title', 'Modifier une activité régulière');
     $page->changeTpl('activity/modify_regular.tpl');
 }
开发者ID:netixx,项目名称:frankiz,代码行数:31,代码来源:activity.php


注:本文中的Env::i方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。