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


PHP Members::edit方法代码示例

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


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

示例1: activate

 public function activate($id = '')
 {
     /***********************************
     		Activate pending members
     		************************************/
     $this->f3->scrub($_POST);
     $members = new Members($this->db);
     $this->f3->set('member', $members->read(array('id=?', $id), [])[0]);
     $this->f3->set('SESSION.flash', array());
     if ($this->f3->get('member')->status != 'Active') {
         $this->f3->set('POST.status', 'Active');
         $members->edit($this->f3->get('member')->id);
         $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Member ' . $this->f3->get('member')->name . ' approved!'));
     }
     $this->f3->reroute('/mytcg/members');
     echo Template::instance()->render('app/templates/admin.htm');
 }
开发者ID:Renako,项目名称:mytcg-f3,代码行数:17,代码来源:MyMembersController.php

示例2: master

 private function master()
 {
     /***********************************
     		Process Deck Mastery Form! 
     		************************************/
     $this->f3->scrub($_POST);
     $members = new Members($this->db);
     $cards = new Cards($this->db);
     $this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]);
     $this->f3->set('SESSION.flash', array());
     // validate form
     if ($cards->count(array('id=?', $this->f3->get('POST.mastered'))) == 0) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid mastered deck.'));
     }
     if ($cards->count(array('id=?', $this->f3->get('POST.collecting'))) == 0) {
         $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid collecting deck.'));
     }
     $i = 0;
     foreach ($this->f3->get('POST.choiceDeck') as $deck) {
         $num = $i + 1;
         if ($cards->count(array('id=?', $deck)) == 0) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Choice card #' . $num . ' is invalid.'));
         }
         if ($cards->read(array('id=?', $deck), [])[0]['count'] < intval($this->f3->get('POST.choiceNum[' . $i . ']'))) {
             $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Choice card #' . $num . ' is not a valid number.'));
         }
         $i++;
     }
     // if there are no errors, process the form
     if (count($this->f3->get('SESSION.flash')) === 0) {
         $this->f3->set('masteredID', $this->f3->get('POST.mastered'));
         $this->f3->set('POST.mastered', $cards->getById($this->f3->get('POST.mastered'))->filename);
         $this->f3->set('collectingID', $this->f3->get('POST.collecting'));
         $this->f3->set('POST.collecting', $cards->getById($this->f3->get('POST.collecting'))->filename);
         $mailer = new Mailer();
         $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': ' . $this->f3->get('member')->name . ' Mastered ' . $this->f3->get('POST.mastered') . '!')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('member')->email))->setBody(Template::instance()->render('app/templates/emails/mastery-notif.htm'), 'text/html');
         if ($mailer->send($message) && $members->edit($this->f3->get('SESSION.userID'), array('collecting'))) {
             $this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]);
             $this->f3->set('rewardType', 'Deck Mastery');
             // Generate rewards!
             $this->f3->set('rewards', array());
             // choice cards
             for ($i = 0; $i < $this->f3->get('num_maschoice'); $i++) {
                 $this->f3->push('rewards', $cards->read(array('id=?', $this->f3->get('POST.choiceDeck[' . $i . ']')), [])[0]->filename . str_pad($this->f3->get('POST.choiceNum[' . $i . ']'), 2, "0", STR_PAD_LEFT));
             }
             // random regular cards
             for ($i = 0; $i < $this->f3->get('num_masreg'); $i++) {
                 $this->f3->push('rewards', $cards->random(array('worth=?', 1)));
             }
             // random special cards
             for ($i = 0; $i < $this->f3->get('num_masspc'); $i++) {
                 $this->f3->push('rewards', $cards->random(array('worth=?', 2)));
             }
             $log = '[' . date("D, d M Y H:i:s") . '] <strong>Deck Mastery (' . $this->f3->get('POST.mastered') . ')</strong>: ' . implode(', ', $this->f3->get('rewards'));
             $logger = new Logger();
             $logger->push($this->f3->get('SESSION.userID'), $log);
             $mailer = new Mailer();
             $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Mastered ' . $this->f3->get('POST.mastered'))->setFrom(array($this->f3->get('noreplyemail') => $this->f3->get('tcgname')))->setTo(array($this->f3->get('member')->email))->setReplyTo(array($this->f3->get('tcgemail')))->setBody(Template::instance()->render('app/templates/emails/mastery.htm'), 'text/html');
             $result = $mailer->send($message);
         } else {
             $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!'));
         }
     }
 }
开发者ID:Renako,项目名称:mytcg-f3,代码行数:64,代码来源:FormsController.php

示例3: settings

 public function settings()
 {
     if ($this->f3->exists('SESSION.userID')) {
         $cards = new Cards($this->db);
         $members = new Members($this->db);
         $this->f3->set('status', array('Active', 'Hiatus'));
         $this->f3->set('decks', $cards->allAlpha());
         $this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]);
         if ($this->f3->exists('POST.update')) {
             $audit = \Audit::instance();
             $this->f3->scrub($_POST);
             $this->f3->set('SESSION.flash', array());
             // validate form
             if (!$audit->email($this->f3->get('POST.email'), FALSE)) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid email address.'));
             }
             if ($this->f3->get('POST.email') != $this->f3->get('member')->email && $members->count(array('email=?', $this->f3->get('POST.email'))) != 0) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Your email address is already in use by another player.'));
             }
             if (!$audit->url($this->f3->get('POST.url'))) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid trade post URL.'));
             }
             if ($this->f3->get('POST.password') !== '' && !preg_match("/^.{6,}\$/", $this->f3->get('POST.password'))) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Your password must contain at least 6 characters.'));
             }
             if ($this->f3->get('POST.password') !== '' && $this->f3->get('POST.password') !== $this->f3->get('POST.password2')) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Your passwords don\'t match!'));
             }
             if ($this->f3->get('member')->status !== 'Pending' && !in_array($this->f3->get('POST.status'), $this->f3->get('status'))) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid status.'));
             }
             if ($cards->count(array('id=?', $this->f3->get('POST.collecting'))) == 0) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Invalid collecting deck.'));
             }
             if (!preg_match("/^.{0,875}\$/", $this->f3->get('POST.biography')) || !preg_match("/^.{0,875}\$/", $this->f3->get('POST.wishlist'))) {
                 $this->f3->push('SESSION.flash', array('type' => 'warning', 'msg' => 'Please limit your Profile details to 875 characters.'));
             }
             // process form if there are no errors
             if (count($this->f3->get('SESSION.flash')) === 0) {
                 if ($this->f3->get('member')->status == 'Pending') {
                     // If they're pending, don't let them change their status!
                     $this->f3->set('POST.status', 'Pending');
                 }
                 if ($this->f3->exists('POST.password') && $this->f3->get('POST.password') != '') {
                     // if password was changed, hash it
                     $this->f3->set('POST.password', password_hash($this->f3->get('POST.password'), PASSWORD_DEFAULT));
                 } else {
                     $this->f3->clear('POST.password');
                 }
                 $this->f3->set('collectingID', $this->f3->get('POST.collecting'));
                 $this->f3->set('POST.collecting', $cards->getById($this->f3->get('POST.collecting'))->filename);
                 // update settings in db
                 if ($members->edit($this->f3->get('SESSION.userID'), array('email', 'url', 'status', 'password', 'level', 'collecting', 'wishlist', 'biography'))) {
                     $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your settings have been updated!'));
                     $this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]);
                 } else {
                     $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!'));
                 }
             }
         }
         $this->f3->set('content', 'app/views/settings.htm');
         echo Template::instance()->render('app/templates/default.htm');
     } else {
         $this->f3->reroute('/members/login');
     }
 }
开发者ID:Renako,项目名称:mytcg-f3,代码行数:66,代码来源:MembersController.php


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