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


PHP Request::isPost方法代码示例

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


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

示例1: testIsGetPostCli

 /**
  * The method of the request was set to get in the constructor
  *
  * @depends	testConstructorNoParams
  * @return	null
  */
 public function testIsGetPostCli()
 {
     $this->assertTrue($this->input->isGet());
     $this->assertFalse($this->input->isPost());
     $this->assertFalse($this->input->isCli());
     $this->assertEquals('get', $this->input->getMethod());
     $input = new AppInput('post');
     $this->assertTrue($input->isPost());
     $this->assertFalse($input->isGet());
     $this->assertFalse($input->isCli());
     $this->assertEquals('post', $input->getMethod());
     $input = new AppInput('cli');
     $this->assertTrue($input->isCli());
     $this->assertFalse($input->isGet());
     $this->assertFalse($input->isPost());
     $this->assertEquals('cli', $input->getMethod());
     /* prove not case sensitive */
     $input = new AppInput('GET');
     $this->assertTrue($input->isGet());
     $this->assertFalse($input->isPost());
     $this->assertFalse($input->isCli());
     $this->assertEquals('get', $input->getMethod());
     $input = new AppInput('POST');
     $this->assertTrue($input->isPost());
     $this->assertFalse($input->isGet());
     $this->assertFalse($input->isCli());
     $this->assertEquals('post', $input->getMethod());
     $input = new AppInput('CLI');
     $this->assertTrue($input->isCli());
     $this->assertFalse($input->isGet());
     $this->assertFalse($input->isPost());
     $this->assertEquals('cli', $input->getMethod());
 }
开发者ID:kevinlondon,项目名称:appfuel,代码行数:39,代码来源:AppInputTest.php

示例2: testPost

 public function testPost()
 {
     $req = new Request();
     $_POST['test'] = 1;
     $this->assertEquals($_POST['test'], $req->test);
     $this->assertTrue(isset($req->test));
     $this->assertFalse($req->isPost());
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $this->assertTrue($req->isPost());
     $this->assertEquals($_SERVER['REQUEST_METHOD'], $req->server('REQUEST_METHOD'));
 }
开发者ID:yagrysha,项目名称:mvc,代码行数:11,代码来源:RequestTest.php

示例3: instance

 public static function instance($className, $args = array())
 {
     global $root;
     settype($className, 'string');
     settype($args, 'array');
     $fileName = str_replace('_', DIRECTORY_SEPARATOR, $className);
     if (!is_readable("{$root}/bin/{$fileName}.php")) {
         return false;
     }
     include_once "{$root}/bin/{$fileName}.php";
     if (!class_exists($className, false)) {
         return false;
     }
     $reflection = new ReflectionClass($className);
     if ($reflection->getParentClass()->getName() != 'WebBase') {
         return false;
     }
     if (null === self::$match) {
         self::$match = $className;
     }
     $controller = call_user_func(array(&$reflection, 'newInstance'), $args);
     if ($controller->type && !empty($controller->type) && Response::canSendHeaders()) {
         Response::setHeader('Content-Type', $controller->type, true);
     }
     if (Request::isPost() && method_exists($controller, 'submit')) {
         $controller->submit();
     }
     if (Response::canSendHeaders()) {
         Response::sendResponse();
     }
     if (method_exists($controller, 'dispatch')) {
         $controller->dispatch();
     }
     return true;
 }
开发者ID:joksnet,项目名称:php-old,代码行数:35,代码来源:Web.php

示例4: trigger_automaticupdate_action

 public function trigger_automaticupdate_action($class)
 {
     $output = array();
     if (Request::isPost()) {
         $plugin = PluginManager::getInstance()->getPluginInfo($class);
         $low_cost_secret = md5($GLOBALS['STUDIP_INSTALLATION_ID'] . $plugin['id']);
         if ($plugin['automatic_update_url'] && $low_cost_secret === \Request::option("s")) {
             if ($plugin['automatic_update_secret'] && !$this->verify_secret($plugin['automatic_update_secret'])) {
                 $output['error'] = "Incorrect payload.";
             } else {
                 //everything fine, we can download and install the plugin
                 $update_url = $plugin['automatic_update_url'];
                 require_once 'app/models/plugin_administration.php';
                 $plugin_admin = new PluginAdministration();
                 try {
                     $plugin_admin->installPluginFromURL($update_url);
                 } catch (Exception $e) {
                     $output['exception'] = $e->getMessage();
                 }
             }
         } else {
             $output['error'] = "Wrong URL.";
         }
         if (!count($output)) {
             $output['message'] = "ok";
         }
     } else {
         $output['error'] = "Only POST requests allowed.";
     }
     $this->render_json($output);
 }
开发者ID:ratbird,项目名称:hope,代码行数:31,代码来源:plugins.php

示例5: display

 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.register.display');
     if (!User::get()->is_guest) {
         return Router::redirect(Router::pathFor('home'));
     }
     // Antispam feature
     $lang_antispam_questions = (require ForumEnv::get('FEATHER_ROOT') . 'featherbb/lang/' . User::get()->language . '/antispam.php');
     $index_questions = rand(0, count($lang_antispam_questions) - 1);
     // Display an error message if new registrations are disabled
     // If $_REQUEST['username'] or $_REQUEST['password'] are filled, we are facing a bot
     if (ForumSettings::get('o_regs_allow') == '0' || Input::post('username') || Input::post('password')) {
         throw new Error(__('No new regs'), 403);
     }
     $user['timezone'] = isset($user['timezone']) ? $user['timezone'] : ForumSettings::get('o_default_timezone');
     $user['dst'] = isset($user['dst']) ? $user['dst'] : ForumSettings::get('o_default_dst');
     $user['email_setting'] = isset($user['email_setting']) ? $user['email_setting'] : ForumSettings::get('o_default_email_setting');
     $user['errors'] = '';
     if (Request::isPost()) {
         $user = $this->model->check_for_errors();
         // Did everything go according to plan? Insert the user
         if (empty($user['errors'])) {
             return $this->model->insert_user($user);
         }
     }
     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Register')), 'focus_element' => array('register', 'req_user'), 'required_fields' => array('req_user' => __('Username'), 'req_password1' => __('Password'), 'req_password2' => __('Confirm pass'), 'req_email1' => __('Email'), 'req_email2' => __('Email') . ' 2', 'captcha' => __('Robot title')), 'active_page' => 'register', 'is_indexed' => true, 'errors' => $user['errors'], 'index_questions' => $index_questions, 'languages' => \FeatherBB\Core\Lister::getLangs(), 'question' => array_keys($lang_antispam_questions), 'qencoded' => md5(array_keys($lang_antispam_questions)[$index_questions])))->addTemplate('register/form.php')->display();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:27,代码来源:Register.php

示例6: edit_action

 /**
  * This method edits existing holidays or creates new holidays
  *
  * @param mixed $id Id of the holiday or null to create one
  */
 public function edit_action($id = null)
 {
     $this->holiday = new SemesterHoliday($id);
     PageLayout::setTitle($this->holiday->isNew() ? _('Ferien anlegen') : _('Ferien bearbeiten'));
     if (Request::isPost()) {
         CSRFProtection::verifyUnsafeRequest();
         $this->holiday->name = Request::get('name');
         $this->holiday->description = Request::get('description');
         $this->holiday->beginn = $this->getTimeStamp('beginn');
         $this->holiday->ende = $this->getTimeStamp('ende', '23:59:59');
         $errors = array();
         if (!$this->holiday->name) {
             $errors[] = _('Bitte geben Sie einen Namen ein.');
         }
         if (!$this->holiday->beginn) {
             $errors[] = _('Bitte geben Sie einen Ferienbeginn ein.');
         }
         if (!$this->holiday->ende) {
             $errors[] = _('Bitte geben Sie ein Ferienende ein.');
         }
         if ($this->holiday->beginn > $this->holiday->ende) {
             $errors[] = _('Das Ferienende liegt vor dem Beginn.');
         }
         if (!empty($errors)) {
             PageLayout::postMessage(MessageBox::error(_('Ihre eingegebenen Daten sind ungültig.'), $errors));
         } elseif ($this->holiday->isDirty() && !$this->holiday->store()) {
             PageLayout::postMessage(MessageBox::error(_('Die Ferien konnten nicht gespeichert werden.')));
         } else {
             PageLayout::postMessage(MessageBox::success(_('Die Ferien wurden erfolgreich gespeichert.')));
             $this->relocate('admin/holidays');
         }
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:38,代码来源:holidays.php

示例7: edit_action

 /**
  * This method edits an existing semester or creates a new semester.
  *
  * @param mixed $id Id of the semester or null to create a semester.
  */
 public function edit_action($id = null)
 {
     $this->semester = new Semester($id);
     PageLayout::setTitle($this->semester->isNew() ? _('Semester anlegen') : _('Semester bearbeiten'));
     if (Request::isPost()) {
         CSRFProtection::verifyUnsafeRequest();
         // Extract values
         $this->semester->name = Request::get('name');
         $this->semester->description = Request::get('description');
         $this->semester->semester_token = Request::get('token');
         $this->semester->beginn = $this->getTimeStamp('beginn');
         $this->semester->ende = $this->getTimeStamp('ende', '23:59:59');
         $this->semester->vorles_beginn = $this->getTimeStamp('vorles_beginn');
         $this->semester->vorles_ende = $this->getTimeStamp('vorles_ende', '23:59:59');
         // Validate
         $errors = $this->validateSemester($this->semester);
         // If valid, try to store the semester
         if (empty($errors) && $this->semester->isDirty() && !$this->semester->store()) {
             $errors[] = _('Fehler bei der Speicherung Ihrer Daten. Bitte überprüfen Sie Ihre Angaben.');
         }
         // Output potential errors or show success message and relocate
         if (count($errors) === 1) {
             $error = reset($errors);
             PageLayout::postMessage(MessageBox::error($error));
         } elseif (!empty($errors)) {
             $message = _('Ihre eingegebenen Daten sind ungültig.');
             PageLayout::postMessage(MessageBox::error($message, $errors));
         } else {
             $message = _('Das Semester wurde erfolgreich gespeichert.');
             PageLayout::postMessage(MessageBox::success($message));
             $this->relocate('admin/semester');
         }
         $this->errors = $errors;
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:40,代码来源:semester.php

示例8: before_filter

 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     // Lock context to user id
     $this->owner = $GLOBALS['user'];
     $this->context_id = $this->owner->id;
     $this->full_access = true;
     if (Config::get()->PERSONALDOCUMENT_OPEN_ACCESS) {
         $username = Request::username('username', $GLOBALS['user']->username);
         $user = User::findByUsername($username);
         if ($user && $user->id !== $GLOBALS['user']->id) {
             $this->owner = $user;
             $this->context_id = $user->id;
             $this->full_access = Config::get()->PERSONALDOCUMENT_OPEN_ACCESS_ROOT_PRIVILEDGED && $GLOBALS['user']->perms === 'root';
             URLHelper::bindLinkParam('username', $username);
         }
     }
     $this->limit = $GLOBALS['user']->cfg->PERSONAL_FILES_ENTRIES_PER_PAGE ?: Config::get()->ENTRIES_PER_PAGE;
     $this->userConfig = DocUsergroupConfig::getUserConfig($GLOBALS['user']->id);
     if ($this->userConfig['area_close'] == 1) {
         $this->redirect('document/closed/index');
     }
     if (Request::isPost()) {
         CSRFProtection::verifySecurityToken();
     }
     if (($ticket = Request::get('studip-ticket')) && !check_ticket($ticket)) {
         $message = _('Bei der Verarbeitung Ihrer Anfrage ist ein Fehler aufgetreten.') . "\n" . _('Bitte versuchen Sie es erneut.');
         PageLayout::postMessage(MessageBox::error($message));
         $this->redirect('document/files/index');
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:31,代码来源:document_controller.php

示例9: profile_main

function profile_main()
{
    global $template;
    // open template
    $template->setFile('profile.tmpl');
    // connect to login db
    if (!($db_login = DbConnect(Config::DB_LOGIN_HOST, Config::DB_LOGIN_USER, Config::DB_LOGIN_PWD, Config::DB_LOGIN_NAME))) {
        $template->throwError('Datenbankverbindungsfehler. Bitte wende dich an einen Administrator.');
        return;
    }
    $action = Request::getVar('action', '');
    switch ($action) {
        /****************************************************************************************************
        *
        * Profil aktualisieren
        *
        ****************************************************************************************************/
        case 'change':
            // proccess form data
            $message = profile_update($db_login);
            // update player's data
            page_refreshUserData();
            break;
            /****************************************************************************************************
            *
            * Account "löschen"
            *
            ****************************************************************************************************/
        /****************************************************************************************************
        *
        * Account "löschen"
        *
        ****************************************************************************************************/
        case 'delete':
            if (Request::isPost('postConfirm')) {
                if (profile_processDeleteAccount($db_login, $_SESSION['player']->playerID)) {
                    session_destroy();
                    die(json_encode(array('mode' => 'finish', 'title' => 'Account gelöscht', 'msg' => _('Ihr Account wurde zur Löschung vorgemerkt. Sie sind jetzt ausgeloggt und können das Fenster schließen.'))));
                } else {
                    $message = array('type' => 'error', 'message' => _('Das löschen Ihres Accounts ist fehlgeschlagen. Bitte wenden Sie sich an das Support Team.'));
                }
            } else {
                $template->addVars(array('cancelOrder_box' => true, 'confirm_action' => 'delete', 'confirm_id' => $_SESSION['player']->playerID, 'confirm_mode' => USER_PROFILE, 'confirm_msg' => _('Möchtest du deinen Account wirklich löschen?')));
            }
            break;
    }
    // get login data
    $playerData = profile_getPlayerData($db_login);
    if (!$playerData) {
        $template->throwError('Datenbankfehler. Bitte wende dich an einen Administrator');
        return;
    }
    /****************************************************************************************************
    *
    * Übergeben ans Template
    *
    ****************************************************************************************************/
    $template->addVars(array('status_msg' => isset($message) && !empty($message) ? $message : '', 'player' => $playerData['game'], 'language' => LanguageNames::getLanguageNames(), 'template' => Config::$template_paths));
}
开发者ID:microlefes,项目名称:Game,代码行数:59,代码来源:profile.html.php

示例10: display

 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.options.display');
     if (Request::isPost()) {
         return $this->model->update_options();
     }
     AdminUtils::generateAdminMenu('options');
     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Options')), 'active_page' => 'admin', 'admin_console' => true, 'languages' => $this->model->get_langs(), 'styles' => $this->model->get_styles(), 'times' => $this->model->get_times()))->addTemplate('admin/options.php')->display();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:9,代码来源:Options.php

示例11: index

 public function index()
 {
     if (Request::isPost()) {
         var_dump(Input::get());
     }
     App::collection('items')->create(array('name' => "Item " . rand()));
     $items = App::collection('items');
     return $this->view('index', array('item' => $items->first(), 'items' => $items->paginate()));
 }
开发者ID:endel,项目名称:hook-framework,代码行数:9,代码来源:HomeController.php

示例12: display

 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.permissions.display');
     // Update permissions
     if (Request::isPost()) {
         return $this->model->update_permissions();
     }
     AdminUtils::generateAdminMenu('permissions');
     return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Permissions')), 'active_page' => 'admin', 'admin_console' => true))->addTemplate('admin/permissions.php')->display();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:10,代码来源:Permissions.php

示例13: listAction

 public function listAction()
 {
     if (Request::isAjax() && Request::isPost()) {
         $user = UsersPDO::get(AuthModel::getUserName());
         $receiverId = $_POST['receiverId'];
         $model = new ChatModel($user['Id']);
         $result = $model->getChat($receiverId);
         $this->renderJSON($result);
     }
 }
开发者ID:GutsVadim,项目名称:phpMvc,代码行数:10,代码来源:MessagesController.php

示例14: display

 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.groups.display');
     $groups = $this->model->fetch_groups();
     // Set default group
     if (Request::isPost()) {
         return $this->model->set_default_group($groups);
     }
     AdminUtils::generateAdminMenu('groups');
     View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('User groups')), 'active_page' => 'admin', 'admin_console' => true, 'groups' => $groups, 'cur_index' => 5))->addTemplate('admin/groups/admin_groups.php')->display();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:11,代码来源:Groups.php

示例15: display

 public function display($req, $res, $args)
 {
     Container::get('hooks')->fire('controller.admin.reports.display');
     // Zap a report
     if (Request::isPost()) {
         $zap_id = intval(key(Input::post('zap_id')));
         $this->model->zap_report($zap_id);
         return Router::redirect(Router::pathFor('adminReports'), __('Report zapped redirect'));
     }
     AdminUtils::generateAdminMenu('reports');
     return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Reports')), 'active_page' => 'admin', 'admin_console' => true, 'report_data' => $this->model->get_reports(), 'report_zapped_data' => $this->model->get_zapped_reports()))->addTemplate('admin/reports.php')->display();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:12,代码来源:Reports.php


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