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


PHP Server::getCurrentRequest方法代码示例

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


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

示例1: post

 public static function post(\election\Resource\Student $student)
 {
     $request = \Server::getCurrentRequest();
     // Vote is for the current logged student only. We do not depend on the post.
     $election = Election::getCurrent();
     $election_id = $election['id'];
     $election_id_match = $request->getVar('electionId');
     if ($election_id_match != $election_id) {
         throw new \Exception('Election id does not match current election');
     }
     // need to start a transaction here
     $db = \Database::getDB();
     $db->begin(true);
     if ($request->isVar('single')) {
         $single_result = $request->getVar('single');
         self::saveSingleResult($election_id, $single_result, $student);
     }
     if ($request->isVar('multiple')) {
         $multiple_result = $request->getVar('multiple');
         self::saveMultipleResult($election_id, $multiple_result, $student);
     }
     if ($request->isVar('referendum')) {
         $referendum_result = $request->getVar('referendum');
         self::saveReferendumResult($election_id, $referendum_result, $student);
     }
     self::complete($election_id, $student->getBannerId());
     $db->commit();
     self::emailStudent($student, $election);
     $json['surveyLink'] = \PHPWS_Settings::get('election', 'surveyLink');
     $json['supportLink'] = \PHPWS_Settings::get('election', 'surveyLink');
     $json['success'] = true;
     return $json;
 }
开发者ID:AppStateESS,项目名称:election,代码行数:33,代码来源:Vote.php

示例2: put

 private function put()
 {
     //$postarray = json_decode(file_get_contents('php://input'), true);
     $req = \Server::getCurrentRequest();
     $postarray = json_decode($req->getRawData(), true);
     $faculty = new FacultyDB();
     $faculty->setId($postarray['id']);
     $faculty->setUsername($postarray['username']);
     $faculty->setFirstName($postarray['first_name']);
     $faculty->setLastName($postarray['last_name']);
     $faculty->setPhone($postarray['phone']);
     $faculty->setFax($postarray['fax']);
     $faculty->setStreetAddress1($postarray['street_address1']);
     $faculty->setStreetAddress2($postarray['street_address2']);
     $faculty->setCity($postarray['city']);
     $faculty->setState($postarray['state']);
     $faculty->setZip($postarray['zip']);
     // Save the faculty object
     try {
         DatabaseStorage::saveObject($faculty);
     } catch (\Exception $e) {
         header('HTTP/1.1 500 Internal Server Error');
         exit;
     }
     echo json_encode($faculty->extractVars());
     // Exit, since this is called by JSON
     exit;
 }
开发者ID:jlbooker,项目名称:InternshipInventory,代码行数:28,代码来源:RestFacultyById.php

示例3: __construct

 public final function __construct(\Request $request = null, Exception $previous = null)
 {
     if (is_null($request)) {
         $request = \Server::getCurrentRequest();
     }
     $response = $this->createResponse($request, $previous);
     $this->response = $response;
     parent::__construct($response->getPhrase(), $response->getCode(), $previous);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:9,代码来源:Exception.php

示例4: __construct

 public function __construct(\Request $request = null, \Exception $previous = null)
 {
     if (is_null($request)) {
         $request = \Server::getCurrentRequest();
     }
     parent::__construct(null, $this->getHttpResponseCode());
     $this->request = $request;
     $this->code = $this->getHttpResponseCode();
     $this->backtrace = debug_backtrace();
     $this->exception = $previous;
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:11,代码来源:ErrorResponse.php

示例5: execute

 public function execute(CommandContext $context)
 {
     $request = \Server::getCurrentRequest();
     $vars = $request->getVars();
     extract($vars['vars']);
     if (!isset($schedule_type)) {
         throw new \Exception('Unknown schedule type requested');
     }
     if ($cmd == 'add') {
         switch ($schedule_type) {
             case 'autoassign':
                 $this->addAutoAssignSchedule();
                 break;
             case 'reportrunner':
                 $this->addReportRunnerSchedule();
                 break;
             case 'withdrawn':
                 $this->addWithdrawnSchedule();
                 break;
             case 'nightly_cache':
                 $this->addNightlyCacheSchedule();
                 break;
             default:
                 throw new \Exception('Unknown schedule type requested');
         }
     } elseif ($cmd == 'remove') {
         switch ($schedule_type) {
             case 'autoassign':
                 $this->dropAutoAssignSchedule();
                 break;
             case 'reportrunner':
                 $this->dropReportRunnerSchedule();
                 break;
             case 'withdrawn':
                 $this->dropWithdrawnSchedule();
                 break;
             case 'nightly_cache':
                 $this->dropNightlyCacheSchedule();
                 break;
             default:
                 throw new \Exception('Unknown schedule type requested');
         }
     } else {
         throw new \Exception('Unknown schedule type requested');
     }
     PHPWS_Core::goBack();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:47,代码来源:SavePulseOptionCommand.php

示例6: handle

 public function handle()
 {
     $request = \Server::getCurrentRequest();
     try {
         switch ($request->getVar('ckop')) {
             case 'form':
                 $this->form();
                 break;
             case 'upload_file':
                 $this->uploadFile($request);
                 exit;
             case 'delete_file':
                 $this->deleteFile($request);
                 exit;
             case 'list_folder_files':
                 $this->printFolderFiles();
                 exit;
             case 'get_file':
                 $this->printFile($request);
                 exit;
             case 'file_form':
                 $this->fileForm($request);
                 exit;
             case 'save_folder':
                 $this->saveFolder($request);
                 exit;
             case 'list_folders':
                 $this->printFolderList($request);
                 exit;
             case 'save_file':
                 $this->saveFile($request);
                 exit;
             default:
                 throw new \Http\MethodNotAllowedException('Unknown request');
         }
         echo \Layout::wrap($this->getContent(), $this->getTitle(), true);
     } catch (\Exception $e) {
         echo $e->getMessage();
     }
     exit;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:41,代码来源:FC_Forms.php

示例7: printFolderFiles

 public function printFolderFiles()
 {
     $request = \Server::getCurrentRequest();
     $show_thumbnail = $request->isVar('thumbnail') && $request->getVar('thumbnail') == 1;
     $files = $this->getFolderFileList('images');
     foreach ($files as $k => $f) {
         $filepath = $f['file_directory'] . 'tn/' . $f['file_name'];
         if ($show_thumbnail) {
             $title =& $f['title'];
             $files[$k]['title'] = "<img src='{$filepath}' title='{$title}' /> {$title}";
         }
         $files[$k]['filepath'] = './' . $filepath;
     }
     $template = new \Template();
     $template->setModuleTemplate('filecabinet', 'FC_Forms/image_files.html');
     if (empty($files)) {
         return null;
     } else {
         $template->addVariables(array('files' => $files, 'empty' => null));
     }
     return $template->get();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:22,代码来源:FC_Images.php

示例8: ob_start

 * from being included in AJAX/JSON responses.
 */
ob_start();
/**
 * Include the defines used in Global library
 */
if (is_file('config/core/config.php')) {
    require_once 'config/core/config.php';
} else {
    $url = 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php', '', $_SERVER['PHP_SELF']) . 'setup/index.php';
    echo 'Configuration file not found. <a href="' . $url . '">Continue to setup</a>.';
    exit;
}
require_once PHPWS_SOURCE_DIR . 'inc/Bootstrap.php';
loadTimeZone();
$request = \Server::getCurrentRequest();
$controller = new PhpwebsiteController();
$controller->execute($request);
/**
 * "BG Mode" - Used to echo raw output from the session,
 * usually for AJAX requests contaning JSON.
 * @deprecated - Will be removed in the next *major* release (version 2.0.0).
 * @see ModuleController
 */
if (isset($_SESSION['BG'])) {
    ob_end_clean();
    // Stop output buffering and clear the buffer, without outputting anything
    echo $_SESSION['BG'];
    // Echo any json data from the session
    unset($_SESSION['BG']);
    // Clear the session'd data (for next request)
开发者ID:sysulsj,项目名称:phpwebsite,代码行数:31,代码来源:index.php

示例9: __construct

 public function __construct()
 {
     javascript('jquery');
     $request = \Server::getCurrentRequest();
     if ($request->isVar('sort_by') && $request->isVar('direction')) {
         $column = $request->getVar('sort_by');
         $direction = $request->getVar('direction');
         if (!empty($column)) {
             $this->setSortBy($column, $direction);
         }
     }
     if ($request->isVar('row_per_page')) {
         $this->setRowsPerPage((int) $request->getVar('row_per_page'));
     }
     if ($request->isVar('current_page')) {
         $this->setCurrentPage((int) $request->getVar('current_page'));
     }
     if ($request->isVar('search_phrase')) {
         $this->setSearchPhrase($request->getVar('search_phrase'));
     }
     if ($request->isVar('search_column')) {
         $this->setSearchColumn($request->getVar('search_column'));
     }
     $this->next_page_marker = "<i class='fa fa-forward'></i>";
     $this->prev_page_marker = "<i class='fa fa-backward'></i>";
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:26,代码来源:Pager.php

示例10: trackAuthentication

    /**
     * Trying to find out why Users changes authentication script. If cause
     * is found, this will be removed.
     */
    public static function trackAuthentication($message)
    {
        $url = \Server::getCurrentUrl(false, false);
        $request = \Server::getCurrentRequest();
        if ($request->isPost()) {
            $type = 'POST';
        } else {
            $type = 'GET';
        }
        $vars = $request->getVars();
        if (empty($vars)) {
            $variables = 'No variables';
        } else {
            foreach ($vars['vars'] as $k => $v) {
                if (is_array($v)) {
                    $v = serialize($v);
                }
                $varlist[] = "{$k}: {$v}";
            }
            $variables = implode("\n", $varlist);
        }
        $content = <<<EOF

MESSAGE: {$message}
REQUEST TYPE: {$type}
VARIABLES:
{$variables}
----
EOF;
        \PHPWS_Core::log($content, 'default_authorization.log');
    }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:35,代码来源:PHPWS_Core.php

示例11: getView

 public function getView($data, \Request $request = null)
 {
     if (is_null($request)) {
         $request = \Server::getCurrentRequest();
     }
     $iter = $request->getAccept()->getIterator();
     $view = null;
     foreach ($iter as $type) {
         if ($type->matches('application/json')) {
             $view = $this->getJsonView($data, $request);
             break;
         }
         if ($type->matches('application/xml')) {
             $view = $this->getXmlView($data, $request);
             break;
         }
         if ($type->matches('text/html')) {
             $view = $this->getHtmlView($data, $request);
             break;
         }
     }
     if (is_null($view)) {
         throw new NotAcceptableException($request);
     }
     return $view;
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:26,代码来源:Controller.php

示例12: checkUsername

 private function checkUsername()
 {
     $request = \Server::getCurrentRequest();
     if (!$request->isVar('username')) {
         throw new \Http\NotAcceptableException('No username submitted');
     }
     $username = filter_var($request->getVar('username'), FILTER_SANITIZE_ENCODED);
     $db = \Database::getDB();
     $t1 = $db->addTable('prop_contacts');
     $t1->addFieldConditional('username', $username);
     $result = $db->selectOneRow();
     echo json_encode(array('result' => (bool) $result));
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:13,代码来源:Contact_User.php

示例13: main

 public function main()
 {
     $request = \Server::getCurrentRequest();
     $title = $content = $message = NULL;
     PHPWS_Core::initModClass('menu', 'Menu_Item.php');
     if (!Current_User::allow('menu')) {
         Current_User::disallow(dgettext('menu', 'User attempted access to Menu administration.'));
         return;
     }
     if (isset($_REQUEST['command'])) {
         $command = $_REQUEST['command'];
     } else {
         $command = 'list';
     }
     // This is the AJAX switch. Byproduct of old module design :(
     switch ($command) {
         case 'adminlinks':
             $this->adminLinks($request);
             exit;
         case 'delete_link':
             $this->deleteLink($request);
             exit;
         case 'key_select':
             $this->keySelect();
             exit;
         case 'post_link':
             $this->postLink($request);
             exit;
         case 'move_link':
             $this->moveLink($request);
             exit;
         case 'move_menu':
             $this->moveMenu($request);
             exit;
         case 'menu_options':
             $this->menuOptions($request);
             exit;
         case 'move_under':
             $this->moveUnder($request);
             exit;
         case 'transfer_link':
             $this->transferLink($request);
             exit;
         case 'add_key_link':
             $this->addKeyLink($request);
             exit;
         case 'remove_key_link':
             $this->removeKeyLink($request);
             exit;
         case 'delete_menu':
             $this->deleteMenu($request);
             exit;
         case 'post_menu':
             $this->postMenu($request);
             \PHPWS_Core::goBack();
             exit;
         case 'pin_menu':
             $this->pinMenu($request);
             exit;
         case 'unpin_menu':
             $this->unpinMenu($request);
             exit;
         case 'change_display_type':
             $this->changeDisplayType($request);
             exit;
         case 'menu_data':
             $this->menuData($request);
             exit;
         case 'pin_all':
             $this->menuPinAll($request);
             exit;
         case 'clear_image':
             $this->clearImage($request);
             exit;
         case 'update_character_limit':
             $this->updateCharacterLimit($request);
             exit;
         case 'new_link_menu':
             $this->updateNewLink($request);
             exit;
         case 'link_icons':
             $this->updateLinkIcons($request);
             exit;
         case 'force_shortcut':
             $this->forceShortcut();
             exit;
     }
     // This is the display switch or the HTML view switch
     switch ($command) {
         case 'list':
             $title = 'Menus';
             $content = $this->menuList();
             break;
         case 'reset_menu':
             if (!\Current_User::isDeity() && !\Current_User::authorized('menu')) {
                 throw new \Http\MethodNotAllowedException();
             }
             $this->resetMenu();
             PHPWS_Core::goBack();
             exit;
//.........这里部分代码省略.........
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:Menu_Admin.php


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