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


PHP Server::get方法代码示例

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


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

示例1: menu_pages

 public function menu_pages()
 {
     $q = WebApp::get('q');
     $m = WebApp::get('m');
     if ($q === NULL) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No search term sent', B_T_FAIL, array('pages' => array()));
     }
     if ($m === NULL || $m === '') {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No module selected', B_T_FAIL, array('pages' => array()));
     }
     $pages = array();
     $q = '%' . $q . '%';
     $page_query = $this->mySQL_r->prepare("SELECT `ID`,`title` FROM `core_pages` WHERE `title` LIKE ? AND `module_id`=?");
     if (!$page_query) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'Query failed', B_T_FAIL, array('pages' => array()));
     }
     $page_query->bind_param('si', $q, $m);
     $page_query->execute();
     $page_query->store_result();
     $page_query->bind_result($id, $value);
     while ($page_query->fetch()) {
         $page['id'] = $id;
         $page['text'] = $value;
         if ($id >= pow(10, 6)) {
             $page['text'] = '* ' . $page['text'];
         }
         $pages[] = $page;
     }
     return new ActionResult($this, '/admin/core/menu_add', 0, 'Success', B_T_SUCCESS, array('pages' => $pages));
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:30,代码来源:ajax.php

示例2: ban

 function ban($reason, $length = -1, $ip = '')
 {
     if ($ip == '') {
         $ip = Server::get('Remote_Addr');
     }
     if ($length == -1) {
         $length = 36526;
     }
     if ($this->parent->user->is_loggedIn()) {
         $user_id = $this->parent->user->getUserID();
     } else {
         $user_id = -1;
     }
     $ban_query = $this->mySQL_w->prepare("INSERT INTO `core_ip` (`time`, `user_id`, `ip`, `length`, `reason`) VALUES (NOW(), ?, INET_ATON(?), ?, ?)\nON DUPLICATE KEY UPDATE\n\t`length`=(`length`+VALUES(`length`)),\n\t`reason`=CONCAT(`reason`, '. Ban extended by ', VALUES(`length`), ' days for reason ', VALUES(`reason`))\n");
     $ban_query->bind_param('isis', $user_id, $ip, $length, $reason);
     $ban_query->execute();
     $ban_query->store_result();
     if ($ban_query->affected_rows == 1) {
         $this->parent->logEvent($this::name_space, 'Blocked ' . $ip . ' for ' . $length . ' days because "' . $reason . '"');
         return true;
     } else {
         $this->parent->logEvent($this::name_space, 'Failed to block ' . $ip . ' for "' . $reason . '"');
         return false;
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:25,代码来源:class.ipban.php

示例3: _handleInput

 protected function _handleInput()
 {
     if ($this->autodetect) {
         $this->current = Project_Navigator::getNavPoint(Server::get('REQUEST_URL'));
     } elseif ($this->current !== null) {
         Project_Navigator::get($this->current);
     }
     // check if registered
 }
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:9,代码来源:navmenu_view.class.php

示例4: update

 public function update()
 {
     $this->parent->parent->debug($this::name_space . ': Updating session status...');
     $token = Cookie::get('ltkn');
     $ip = Server::get('remote_addr');
     $update_query = $this->mySQL_w->prepare("UPDATE `core_sessions` SET `IP`=INET_ATON(?), `lpr`=NOW() WHERE `token`=?");
     $update_query->bind_param('ss', $ip, $token);
     $update_query->execute();
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:9,代码来源:class.sessiontokeniser.php

示例5: del

 public static function del($opt, $path = '/', $domain = '')
 {
     if ($domain == '') {
         $domain = Server::get('Server_Name');
     }
     if ($domain == 'localhost') {
         $domain = NULL;
     }
     setcookie($opt, '', time() - 3600, $path, $domain);
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:10,代码来源:class.cookie.php

示例6: processAction

 function processAction()
 {
     $action = WebApp::get('cat3');
     if (is_callable(array($this, $action))) {
         $this->result = $this->{$action}();
         return true;
     } else {
         $this->result = new ActionResult($this, Server::get('Request_URI'), 0, 'Whoops, something went wrong with that action and we\'re trying to fix it. <br />Error: <code>Action not found: "' . Server::get('Request_URI') . '"</code>');
         return false;
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:11,代码来源:class.baseaction.php

示例7: checkHTTPS

 public function checkHTTPS($https)
 {
     $this->parent->debug($this::name_space . ': Checking HTTPS settings for page...');
     if ($this->parent->https !== true && $this->parent->config->config['core']['https']['a'] && $https) {
         $location = 'https://' . Server::get('HTTP_Host') . Server::get('Request_URI');
         $this->parent->debug($this::name_space . ': HTTPS turned on... follow link: ' . $location);
         if (!$this->parent->debug) {
             header('Location: ' . $location);
             exit;
         }
     } else {
         $this->parent->debug($this::name_space . ': HTTPS left as it is.');
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:14,代码来源:class.basectrl.php

示例8: getRelative

 public function getRelative($name, $path = null)
 {
     if ($path === null) {
         $path = dirname(Server::get('PHP_SELF'));
     }
     $base = $this->getRelativePath($path == '\\' ? '/' : $path, $this->_base);
     if ($base === null) {
         $base = $this->_base;
     }
     try {
         $result = $this->_locations->{$name};
         return $base . $result;
     } catch (No_Such_Variable_Exception $e) {
         throw new Navigator_No_Such_Location_Exception($name);
     }
 }
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:16,代码来源:navigator.class.php

示例9: loadConfig

 public function loadConfig()
 {
     $config = $this->_loadDefaultConfig();
     // Load Custom Config
     $this->parent->debug($this::name_space . ': Checking for config file');
     if (file_exists(__LIBDIR__ . '/config.inc.php')) {
         $this->parent->debug($this::name_space . ': Loading config file');
         include_once __LIBDIR__ . '/config.inc.php';
     } else {
         $this->parent->debug($this::name_space . ': Config file  not found!');
     }
     $this->config = $config;
     // Don't use CDN for integrity if on HTTPS
     if (Server::get('HTTPS') !== NULL && Server::get('HTTPS') !== 'off' || Server::get('SERVER_PORT') == 443) {
         $this->config['core']['cdn'] = '/';
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:17,代码来源:class.configmanager.php

示例10: secondary_groups

 public function secondary_groups()
 {
     $q = WebApp::get('q');
     if ($q === NULL) {
         return new ActionResult($this, Server::get('HTTP_Referer'), 0, 'No search term sent', B_T_FAIL, array('groups' => array()));
     }
     $groups = array();
     $q = '%' . $q . '%';
     $group_query = $this->mySQL_r->prepare("SELECT `GID`,`name` FROM `core_groups` WHERE `name` LIKE ? AND `type`='s'");
     $group_query->bind_param('s', $q);
     $group_query->execute();
     $group_query->store_result();
     $group_query->bind_result($id, $value);
     while ($group_query->fetch()) {
         $group['id'] = $id;
         $group['text'] = $value;
         $groups[] = $group;
     }
     return new ActionResult($this, '/admin/email', 0, 'Success', B_T_SUCCESS, array('groups' => $groups));
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:20,代码来源:ajax.php

示例11: setFile

 public function setFile()
 {
     include __LIBDIR__ . '/fileMIMEs.php';
     $this->MIMEs = $MIME_type;
     if (WebApp::get('cat1') == 'css' || WebApp::get('cat1') == 'js' || WebApp::get('cat1') == 'images') {
         $filename = strtolower(WebApp::get('cat2')) . '/' . WebApp::get('cat1') . '/' . WebApp::get('cat3');
         $i = 4;
         while (WebApp::get('cat' . $i) !== NULL) {
             $filename .= '/' . WebApp::get('cat' . $i);
             $i++;
         }
         $this->parent->addHeader('file', $filename);
         $file = __MODULE__ . '/' . $filename;
     } elseif (WebApp::get('cat1') == 'fonts') {
         $file = __EXECDIR__ . '/' . Server::get('REQUEST_URI');
     }
     if (file_exists($file)) {
         $this->file = $file;
     } else {
         $this->file = false;
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:22,代码来源:file.php

示例12: redirect

 public function redirect()
 {
     if (headers_sent()) {
         throw new Headers_Already_Sent_Exception();
     }
     $to = $this->target;
     if ($to[0] != '/') {
         $dirname = dirname(Server::get('REQUEST_URL'));
         if ($dirname == '/') {
             $to = "/{$to}";
         } else {
             $to = "{$dirname}/{$to}";
         }
     }
     if (array_key_exists($this->code, self::$codes)) {
         $ht = self::$codes[$this->code];
     } else {
         throw new Unknown_HTTP_Header_Code_Exception($this->code);
     }
     header(self::$codes[$this->code]);
     header("Location: {$this->schema}://{$this->host}{$to}");
     exit;
 }
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:23,代码来源:redirection.class.php

示例13: __construct

 function __construct($parent)
 {
     $this->parent = $parent;
     $this->mySQL_r = $parent->mySQL_r;
     $this->mySQL_w = $parent->mySQL_w;
     $this->parent->debug('***** ' . $this::name_space . ' *****');
     $this->parent->debug($this::name_space . ': Version ' . $this::version);
     $this->session = new SessionTokeniser($this);
     // Is a user logged in?
     if (Session::get($this::name_space, 'loggedIn') !== true) {
         $this->parent->debug($this::name_space . ': No user logged in, using anoymous');
         $this->_fetchDetails();
         return;
     }
     if ($this->session->check()) {
         $this->parent->debug($this::name_space . ': User logged in');
         $this->loggedIn = true;
         $this->username = Session::get($this::name_space, 'username');
         $this->userID = Session::get($this::name_space, 'userID');
         $this->session->update();
     } else {
         Session::del($this::name_space, 'loggedIn');
         Session::del($this::name_space, 'username');
         Session::del($this::name_space, 'userID');
     }
     // Create user data
     $this->_fetchDetails();
     if ($this->enabled == false) {
         $this->parent->debug($this::name_space . ': User disabled... logging out');
         $this->logout();
         header("Location: /user/login");
         exit;
     } elseif (Server::get('request_uri') != "/user/profile/password" && $this->changePwd == 1) {
         $this->parent->debug($this::name_space . ': User must change password');
         WebApp::forceRedirect('/user/profile/password');
     }
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:37,代码来源:class.usercontroller.php

示例14: resolveHRef

 protected function resolveHRef()
 {
     if ($this->page !== null) {
         if ($this->page == 'current') {
             $page = Server::get('REQUEST_URL');
             $qs = Server::get('REQUEST_QUERY_STRING');
             if ($qs !== '') {
                 $qs = "?{$qs}";
             }
         } else {
             $page = Project_Navigator::getPage($this->page, $this->nobase !== null);
             $qs = $this->qs === null ? '' : "?{$this->qs}";
         }
         $link = $page . $qs;
         $this->_a->href = $link;
         if ($this->popup !== null) {
             $onclick = $this->_a->onclick;
             if ($onclick === null) {
                 $onclick = '';
             }
             if ($onclick !== '' && substr($onclick, -1) != ';') {
                 $onclick .= ';';
             }
             if (substr($onclick, -13) == 'return false;') {
                 $onclick = substr($onclick, 0, -13);
             }
             $onclick .= "window.open('{$link}','_blank','{$this->popup}');return false";
             $this->_a->onclick = $onclick;
         }
         if ($this->content !== null) {
             $this->_a->clear();
             $this->_a->add($this->content, false);
         }
     } else {
         throw new Data_Insufficient_Exception('page');
     }
 }
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:37,代码来源:navpoint_view.class.php

示例15: logEvent

 function logEvent($ns, $event)
 {
     $this->parent->debug($this::name_space . ': Logging event to event log...');
     $userID = $this->parent->user->getUserID();
     $user_ip = Server::get('Remote_Addr');
     if ($user_ip === NULL) {
         $user_ip = '127.0.0.1';
     }
     $uri = Server::get('Request_URI');
     if ($uri === NULL) {
         $uri = '&lt;&lt;CLI&gt;&gt;';
     }
     $event_log = $this->mySQL_w->prepare("INSERT INTO `core_log` (`user_id`,`user_ip`,`uri`,`namespace`,`event`) VALUES(?,INET_ATON(?),?,?,?)");
     $event_log->bind_param('issss', $userID, $user_ip, $uri, $ns, $event);
     $event_log->execute();
     $event_log->store_result();
     if ($event_log->affected_rows == 1) {
         return true;
     } else {
         $this->parent->debug($this::name_space . ': ' . $this->mySQL_w->error);
         return false;
     }
     $event_log->free_result();
 }
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:24,代码来源:class.logger.php


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