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


PHP Captcha::get方法代码示例

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


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

示例1: execute

 public function execute(CommandContext $context)
 {
     $id = $context->get('roommateId');
     if (is_null($id)) {
         throw new InvalidArgumentException('Must set roommateId');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
     $roommate = new HMS_Roommate($id);
     if ($roommate->id = 0) {
         throw new InvalidArgumentException('Invalid roommateId ' . $id);
     }
     $username = UserStatus::getUsername();
     if ($username != $roommate->requestor && $username != $roommate->requestee) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException("{$username} tried to break roommate pairing {$roommate->id}");
     }
     PHPWS_Core::initCoreClass('Captcha.php');
     // get other roommate
     $other = StudentFactory::getStudentByUsername($roommate->get_other_guy($username), $roommate->term);
     $form = new PHPWS_Form();
     $cmd = CommandFactory::getCommand('RoommateBreak');
     $cmd->setRoommateId($id);
     $cmd->initForm($form);
     $form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
     $form->addTplTag('NAME', $other->getFullName());
     $form->addSubmit('Confirm');
     $form->addCssClass('submit', 'btn btn-danger');
     $context->setContent(PHPWS_Template::process($form->getTemplate(), 'hms', 'student/roommate_break_confirm.tpl'));
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:ShowRoommateBreakCommand.php

示例2: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     # Get the roommate request record from the database
     $bed = new HMS_Bed($this->request['bed_id']);
     $room = $bed->get_parent();
     $tpl = array();
     $requestor = StudentFactory::getStudentByUsername($this->request['requestor'], $this->term);
     $tpl['REQUESTOR'] = $requestor->getName();
     $tpl['HALL_ROOM'] = $bed->where_am_i();
     # List all the students which will be assigned and their beds
     $beds = $room->get_beds();
     foreach ($beds as $bed) {
         $bed_row = array();
         # Check for an assignment
         $bed->loadAssignment();
         # Check for a reservation
         $reservation = $bed->get_lottery_reservation_info();
         $bed_row['BEDROOM_LETTER'] = $bed->bedroom_label;
         if ($bed->_curr_assignment != NULL) {
             # Bed is assigned
             $roommate = StudentFactory::getStudentByUsername($bed->_curr_assignment->asu_username, $this->term);
             $bed_row['TEXT'] = $roommate->getName();
         } else {
             if ($reservation != NULL) {
                 # Bed is reserved
                 $roommate = StudentFactory::getStudentByUsername($reservation['asu_username'], $this->term);
                 $bed_row['TEXT'] = $roommate->getName() . ' (reserved)';
             } else {
                 $bed_row['TEXT'] = 'Empty';
             }
         }
         $tpl['beds'][] = $bed_row;
     }
     $tpl['MEAL_PLAN'] = HMS_Util::formatMealOption($this->mealPlan);
     PHPWS_Core::initCoreClass('Captcha.php');
     $tpl['CAPTCHA'] = Captcha::get();
     $submitCmd = CommandFactory::getCommand('LotteryConfirmRoommateRequest');
     $submitCmd->setRequestId($this->request['id']);
     $submitCmd->setMealPlan($this->mealPlan);
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     $form->addSubmit('confirm', 'Confirm Roommate');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Lottery Confirm Roommate");
     return PHPWS_Template::process($tpl, 'hms', 'student/lottery_confirm_roommate_request.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:51,代码来源:LotteryConfirmRoommateRequestView.php

示例3: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initCoreClass('Captcha.php');
     $requestor = StudentFactory::getStudentByUsername($this->request['requestor'], $this->term);
     $tpl = array();
     $tpl['REQUESTOR'] = $requestor->getName();
     $tpl['CAPTCHA'] = Captcha::get();
     $submitCmd = CommandFactory::getCommand('LotteryDenyRoommateRequest');
     $submitCmd->setRequestId($this->request['id']);
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     $form->addSubmit('deny', 'Deny Roommate Request');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     $this->setTitle('Deny Roommate Request');
     return PHPWS_Template::process($tpl, 'hms', 'student/lottery_deny_roommate_request.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:18,代码来源:LotteryDenyRoommateRequestView.php

示例4: show

 public function show()
 {
     $approveCmd = CommandFactory::getCommand('RoomChangeStudentApprove');
     $approveCmd->setParticipantId($this->thisParticipant->getId());
     $approveCmd->setRequestId($this->request->getId());
     $declineCmd = CommandFactory::getCommand('RoomChangeStudentDecline');
     $declineCmd->setParticipantId($this->thisParticipant->getId());
     $declineCmd->setRequestId($this->request->getId());
     $form = new PHPWS_Form('roomchange_student_approve');
     $form->addHidden('foo', 'bar');
     $tpl = $form->getTemplate();
     $tpl['APPROVE_URI'] = $approveCmd->getURI();
     $tpl['DECLINE_URI'] = $declineCmd->getURI();
     $requestor = StudentFactory::getStudentByUsername($this->request->getState()->getCommittedBy(), $this->term);
     $tpl['REQUESTOR'] = $requestor->getName();
     // Build the table showing who is moving from/to which beds
     $participantRows = array();
     foreach ($this->participants as $p) {
         $row = array();
         $student = StudentFactory::getStudentByBannerId($p->getBannerId(), $this->term);
         $row['NAME'] = $student->getName();
         // If this participant is the person logged in, bold their name
         if ($student->getBannerId() == $this->thisParticipant->getBannerId()) {
             $row['STRONG_STYLE'] = 'success';
         } else {
             $row['STRONG_STYLE'] = '';
         }
         $fromBed = new HMS_Bed($p->getFromBed());
         $toBed = new HMS_Bed($p->getToBed());
         $row['FROM_BED'] = $fromBed->where_am_i();
         $row['TO_BED'] = $toBed->where_am_i();
         $participantRows[] = $row;
     }
     $tpl['PARTICIPANTS'] = $participantRows;
     PHPWS_Core::initCoreClass('Captcha.php');
     $tpl['CAPTCHA'] = Captcha::get();
     return PHPWS_Template::process($tpl, 'hms', 'student/roomChangeRequestStudentApprove.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:38,代码来源:RoomChangeRequestStudentApprovalView.php

示例5: view

 /**
  * Constructs a view of this form and returns it in a string.
  *
  * This function will construct a view of this form whether in edit mode
  * or submission mode and return it in a string for display.
  *
  * @param  boolean $edit Whether the view is in edit mode or not.
  * @return mixed   A templated string on success, or a FALSE on failure.
  * @access public
  */
 function view($edit = FALSE, $error = null)
 {
     if ($this->isHidden() && !$edit || !$this->isSaved() && !Current_User::allow('phatform', 'edit_forms')) {
         return dgettext('phatform', 'This form is not available for viewing at this time.');
     }
     $GLOBALS['CNT_phatform']['title'] = $this->getLabel();
     /* Do some basic checks if we're not in edit mode */
     if (!$edit) {
         /* If this form is not anonymous and the user is not logged in, print message and bail */
         if (($this->_editData || !$this->_anonymous) && !Current_User::isLogged()) {
             return dgettext('phatform', 'You must be logged in to view this form!');
         }
         /* If this form is not multi submit and the user has filled out this for before,
            print message and bail */
         if (!$this->_editData && !$this->_multiSubmit && $this->hasSubmission()) {
             return dgettext('phatform', 'You have already filled out this form!');
         }
         if (!Current_User::isDeity() && Current_User::allow('phatform', 'user_forms_only')) {
             if (Current_User::getUsername() != $this->getOwner()) {
                 return dgettext('phatform', 'You only have permission to edit your own forms!');
             }
         }
     }
     /* Assume the PHAT position :) */
     if (!isset($this->_position)) {
         $this->_position = 0;
     }
     /* Setup limit for loop */
     if ($this->_position + $this->_pageLimit > sizeof($this->_elements)) {
         $limit = $this->_position + (sizeof($this->_elements) - $this->_position);
     } else {
         $limit = $this->_position + $this->_pageLimit;
     }
     /* Begin view template array */
     if ($this->currentPage() == 1) {
         $viewTags['BLURB0'] = PHPWS_Text::parseOutput($this->_blurb0, ENCODE_PARSED_TEXT, false, true);
         if (!$this->_saved) {
             $viewTags['WARNING'] = dgettext('phatform', 'The form must be saved before it is available to the public.');
         }
     }
     $formTags = array();
     /* If this form has elements, loop and add them to the form template array */
     if (is_array($this->_elements) && sizeof($this->_elements) > 0) {
         for ($i = $this->_position; $i < $limit; $i++) {
             $sectionTags = array();
             $elementInfo = explode(':', $this->_elements[$i]);
             $this->element = new $elementInfo[0]($elementInfo[1]);
             /* If user can edit data, populate for element with it */
             if (!$edit && $this->_editData && is_array($this->_userData)) {
                 if (isset($this->_userData[$this->element->getLabel()]) && $this->isSerialized($this->_userData[$this->element->getLabel()])) {
                     $value = unserialize(stripslashes($this->_userData[$this->element->getLabel()]));
                     $this->element->setValue($value);
                 } else {
                     $this->element->setValue($this->_userData[$this->element->getLabel()]);
                 }
             }
             /* Setup color for alternating rows in the section template */
             if (isset($flag) && $flag) {
                 $flag = FALSE;
             } else {
                 $sectionTags['BGCOLOR'] = ' class="bgcolor1" ';
                 $flag = TRUE;
             }
             /* Get view of the current element */
             $sectionTags['ELEMENT'] = $this->element->view();
             if ($this->_showElementNumbers) {
                 $sectionTags['ELEMENT'] = $i + 1 . '. ' . $sectionTags['ELEMENT'];
             }
             /* If in edit mode, show the element editor for the current element */
             if ($edit) {
                 $sectionTags['ELEMENT_NAME'] = PHPWS_Text::parseOutput($this->element->getLabel(), ENCODE_PARSED_TEXT, false, true);
                 $sectionTags['ELEMENT_EDITOR'] = $this->_elementEditor($i);
             }
             if (!isset($formTags['ELEMENTS'])) {
                 $formTags['ELEMENTS'] = PHPWS_Template::processTemplate($sectionTags, 'phatform', 'form/section.tpl');
             } else {
                 $formTags['ELEMENTS'] .= PHPWS_Template::processTemplate($sectionTags, 'phatform', 'form/section.tpl');
             }
         }
         /* If we are on last page...show the submit button */
         if (!$edit) {
             if ($this->currentPage() == $this->numPages()) {
                 if ($this->_editData && $this->currentPage() > 1) {
                     $formTags['BACK_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Back'), 'PHAT_Back');
                 }
                 if (PHATFORM_CAPTCHA && $this->_anonymous && !Current_User::isLogged()) {
                     PHPWS_Core::initCoreClass('Captcha.php');
                     $formTags['CAPTCHA'] = Captcha::get();
                 }
                 $formTags['SUBMIT_BUTTON'] = PHPWS_Form::formSubmit(dgettext('phatform', 'Finish'), 'PHAT_Submit');
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Form.php

示例6: forgotForm

 public static function forgotForm()
 {
     PHPWS_Core::initCoreClass('Captcha.php');
     $form = new PHPWS_Form('forgot-password');
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'user');
     $form->addHidden('command', 'post_forgot');
     $form->addText('fg_username');
     $form->setLabel('fg_username', dgettext('users', 'Enter your user name.'));
     $form->addText('fg_email');
     $form->setSize('fg_email', 40);
     $form->setLabel('fg_email', dgettext('users', 'Forgotten your user name? Enter your email address instead.'));
     if (ALLOW_CAPTCHA) {
         $form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
     }
     $form->addSubmit(dgettext('users', 'Send reminder'));
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'users', 'forms/forgot.tpl');
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:19,代码来源:User_Form.php

示例7: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     $tpl = array();
     $submitCmd = CommandFactory::getCommand('LotteryConfirm');
     $submitCmd->setRoomId($this->roomId);
     $submitCmd->setMealPlan($this->mealPlan);
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     # Add the beds and user names back to the form so they end up in the request in a pretty way
     foreach ($this->roommates as $key => $value) {
         if (isset($value) && $value != '') {
             $form->addHidden("roommates[{$key}]", $value);
         }
     }
     # List the student's room
     PHPWS_Core::initModClass('hms', 'HMS_Room.php');
     $room = new HMS_Room($this->roomId);
     $tpl['ROOM'] = $room->where_am_i();
     # List all the students which will be assigned and their beds
     $beds = $room->get_beds();
     foreach ($beds as $bed) {
         $bed_row = array();
         # Check for an assignment
         $bed->loadAssignment();
         # Check for a reservation
         $reservation = $bed->get_lottery_reservation_info();
         $bedLabel = $room->getRoomNumber();
         if ($room->get_number_of_beds() == 4) {
             $bedLabel = $bedLabel . $bed->getBedroomLabel();
         }
         $bedLabel = $bedLabel . $bed->getLetter();
         $bed_row['BED_LABEL'] = $bedLabel;
         $roommate = null;
         if ($bed->_curr_assignment != NULL) {
             # Bed is assigned
             $roommate = StudentFactory::getStudentByUsername($bed->_curr_assignment->asu_username, $this->term);
             $bed_row['TEXT'] = $roommate->getName();
         } else {
             if ($reservation != NULL) {
                 # Bed is reserved
                 $roommate = StudentFactory::getStudentByUsername($reservation['asu_username'], $this->term);
                 $bed_row['TEXT'] = $roommate->getName() . ' (reserved)';
             } else {
                 # Get the new roommate name out of the request
                 if (!isset($this->roommates[$bed->id]) || $this->roommates[$bed->id] == '') {
                     $bed_row['TEXT'] = 'Empty';
                 } else {
                     $roommate = StudentFactory::getStudentByUsername($this->roommates[$bed->id], $this->term);
                     $bed_row['TEXT'] = $roommate->getName() . ' ' . $this->roommates[$bed->id];
                 }
             }
         }
         $tpl['beds'][] = $bed_row;
     }
     # Show the meal plan
     $tpl['MEAL_PLAN'] = HMS_Util::formatMealOption($this->mealPlan);
     $form->addHidden('meal_plan', $this->mealPlan);
     PHPWS_Core::initCoreClass('Captcha.php');
     $form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
     $form->addSubmit('submit_form', 'Confirm room & roommates');
     $form->mergeTemplate($tpl);
     Layout::addPageTitle("Confirm Re-Application");
     return PHPWS_Template::process($form->getTemplate(), 'hms', 'student/lottery_confirm.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:66,代码来源:LotteryConfirmView.php


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