本文整理汇总了PHP中getServer函数的典型用法代码示例。如果您正苦于以下问题:PHP getServer函数的具体用法?PHP getServer怎么用?PHP getServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getServer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createAuthorGuest
public function createAuthorGuest($nick, $email, $ip)
{
$objects = umiObjectsCollection::getInstance();
$objectTypes = umiObjectTypesCollection::getInstance();
$nick = trim($nick);
$email = trim($email);
if (!$nick) {
$nick = getLabel('author-anonymous');
}
if (!$email) {
$email = getServer('REMOTE_ADDR');
}
$sel = new selector('objects');
$sel->types('object-type')->name('users', 'author');
$sel->where('email')->equals($email);
$sel->where('nickname')->equals($nick);
$sel->where('ip')->equals($ip);
$sel->limit(0, 1);
if ($sel->first) {
return $sel->first->id;
} else {
$user_name = $nick . " ({$email})";
$object_type_id = $objectTypes->getBaseType("users", "author");
$author_id = $objects->addObject($user_name, $object_type_id);
$author = $objects->getObject($author_id);
$author->name = $user_name;
$author->is_registrated = false;
$author->nickname = $nick;
$author->email = $email;
$author->ip = $ip;
$author->commit();
return $author_id;
}
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:34,代码来源:__author.php
示例2: generateDlLog
/**
* Generates an entry in the logbook an increases the hits-counter
*
* @param \class_module_mediamanager_file $objFile
*/
public static function generateDlLog(class_module_mediamanager_file $objFile)
{
$objDB = class_carrier::getInstance()->getObjDB();
$strQuery = "INSERT INTO " . _dbprefix_ . "mediamanager_dllog\n\t (downloads_log_id, downloads_log_date, downloads_log_file, downloads_log_user, downloads_log_ip) VALUES\n\t (?, ?, ?, ?, ?)";
$objDB->_pQuery($strQuery, array(generateSystemid(), (int) time(), basename($objFile->getStrFilename()), class_carrier::getInstance()->getObjSession()->getUsername(), getServer("REMOTE_ADDR")));
$objFile->increaseHits();
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:12,代码来源:class_module_mediamanager_logbook.php
示例3: selectCurrency
public function selectCurrency()
{
$currencyCode = getRequest('currency-codename');
$selectedCurrency = $this->getCurrency($currencyCode);
if ($currencyCode && $selectedCurrency) {
$defaultCurrency = $this->getDefaultCurrency();
if (permissionsCollection::getInstance()->isAuth()) {
$customer = customer::get();
if ($customer->preffered_currency != $selectedCurrency->id) {
if ($selectedCurrency->id == $defaultCurrency->id) {
$customer->preffered_currency = null;
} else {
$customer->preffered_currency = $selectedCurrency->id;
}
$customer->commit();
}
} else {
setcookie('customer_currency', $selectedCurrency->id, time() + customer::$defaultExpiration, '/');
}
}
if ($redirectUri = getRequest('redirect-uri')) {
$this->redirect($redirectUri);
} else {
$this->redirect(getServer('HTTP_REFERER'));
}
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:26,代码来源:__currency.php
示例4: writeToHistoryArray
private function writeToHistoryArray($strSessionKey)
{
$strQueryString = getServer("QUERY_STRING");
//Clean querystring of empty actions
if (uniSubstr($strQueryString, -8) == "&action=") {
$strQueryString = substr_replace($strQueryString, "", -8);
}
//Just do s.th., if not in the rights-mgmt
if (uniStrpos($strQueryString, "module=right") !== false) {
return;
}
$arrHistory = $this->objSession->getSession($strSessionKey);
//And insert just, if different to last entry
if ($strQueryString == $this->getHistoryEntry(0, $strSessionKey)) {
return;
}
//If we reach up here, we can enter the current query
if ($arrHistory !== false) {
array_unshift($arrHistory, $strQueryString);
while (count($arrHistory) > 10) {
array_pop($arrHistory);
}
} else {
$arrHistory = array($strQueryString);
}
//saving the new array to session
$this->objSession->setSession($strSessionKey, $arrHistory);
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:28,代码来源:class_history.php
示例5: actionLogin
/**
* Creates a small login-field
*
* @return string
*/
protected function actionLogin()
{
if ($this->objSession->isLoggedin() && $this->objSession->isAdmin()) {
$this->loadPostLoginSite();
return;
}
//Save the requested URL
if ($this->getParam("loginerror") == "") {
//Store some of the last requests' data
$this->objSession->setSession(self::SESSION_REFERER, getServer("QUERY_STRING"));
$this->objSession->setSession(self::SESSION_PARAMS, getArrayPost());
}
//Loading a small login-form
$strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "login_form");
$arrTemplate = array();
$strForm = "";
$strForm .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "adminLogin"));
$strForm .= $this->objToolkit->formInputText("name", $this->getLang("login_loginUser", "user"), "", "input-large");
$strForm .= $this->objToolkit->formInputPassword("passwort", $this->getLang("login_loginPass", "user"), "", "input-large");
$strForm .= $this->objToolkit->formInputSubmit($this->getLang("login_loginButton", "user"));
$strForm .= $this->objToolkit->formClose();
$arrTemplate["form"] = $strForm;
$arrTemplate["loginTitle"] = $this->getLang("login_loginTitle", "user");
$arrTemplate["loginJsInfo"] = $this->getLang("login_loginJsInfo", "user");
$arrTemplate["loginCookiesInfo"] = $this->getLang("login_loginCookiesInfo", "user");
//An error occurred?
if ($this->getParam("loginerror") == 1) {
$arrTemplate["error"] = $this->getLang("login_loginError", "user");
}
$strReturn = $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID);
return $strReturn;
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:37,代码来源:class_module_login_admin.php
示例6: doAuth
function doAuth($info, $trusted = null, $fail_cancels = false)
{
if (!$info) {
// There is no authentication information, so bail
return authCancel(null);
}
$req_url = $info->identity;
$user = getLoggedInUser();
setRequestInfo($info);
if ($req_url != $user) {
return login_render(array(), $req_url, $req_url);
}
$sites = getSessionSites();
$trust_root = $info->trust_root;
$fail_cancels = $fail_cancels || isset($sites[$trust_root]);
$trusted = isset($trusted) ? $trusted : isTrusted($req_url, $trust_root);
if ($trusted) {
setRequestInfo();
$server =& getServer();
$response =& $info->answer(true);
$webresponse =& $server->encodeResponse($response);
$new_headers = array();
foreach ($webresponse->headers as $k => $v) {
$new_headers[] = $k . ": " . $v;
}
return array($new_headers, $webresponse->body);
} elseif ($fail_cancels) {
return authCancel($info);
} else {
return trust_render($info);
}
}
开发者ID:honchoman,项目名称:singpolyma,代码行数:32,代码来源:common.php
示例7: actionDownload
/**
* Sends the requested file to the browser
* @return string
*/
public function actionDownload()
{
//Load filedetails
if (validateSystemid($this->getSystemid())) {
/** @var $objFile class_module_mediamanager_file */
$objFile = class_objectfactory::getInstance()->getObject($this->getSystemid());
//Succeeded?
if ($objFile instanceof class_module_mediamanager_file && $objFile->getIntRecordStatus() == "1" && $objFile->getIntType() == class_module_mediamanager_file::$INT_TYPE_FILE) {
//Check rights
if ($objFile->rightRight2()) {
//Log the download
class_module_mediamanager_logbook::generateDlLog($objFile);
//Send the data to the browser
$strBrowser = getServer("HTTP_USER_AGENT");
//Check the current browsertype
if (uniStrpos($strBrowser, "IE") !== false) {
//Internet Explorer
class_response_object::getInstance()->addHeader("Content-type: application/x-ms-download");
class_response_object::getInstance()->addHeader("Content-type: x-type/subtype\n");
class_response_object::getInstance()->addHeader("Content-type: application/force-download");
class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . preg_replace('/\\./', '%2e', saveUrlEncode(trim(basename($objFile->getStrFilename()))), substr_count(basename($objFile->getStrFilename()), '.') - 1));
} else {
//Good: another browser vendor
class_response_object::getInstance()->addHeader("Content-Type: application/octet-stream");
class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . saveUrlEncode(trim(basename($objFile->getStrFilename()))));
}
//Common headers
class_response_object::getInstance()->addHeader("Expires: Mon, 01 Jan 1995 00:00:00 GMT");
class_response_object::getInstance()->addHeader("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
class_response_object::getInstance()->addHeader("Pragma: no-cache");
class_response_object::getInstance()->addHeader("Content-description: JustThum-Generated Data\n");
class_response_object::getInstance()->addHeader("Content-Length: " . filesize(_realpath_ . $objFile->getStrFilename()));
//End Session
$this->objSession->sessionClose();
class_response_object::getInstance()->sendHeaders();
//Loop the file
$ptrFile = @fopen(_realpath_ . $objFile->getStrFilename(), 'rb');
fpassthru($ptrFile);
@fclose($ptrFile);
ob_flush();
flush();
return "";
} else {
class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_FORBIDDEN);
}
} else {
class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND);
}
} else {
class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND);
}
//if we reach up here, something gone wrong :/
class_response_object::getInstance()->setStrRedirectUrl(str_replace(array("_indexpath_", "&"), array(_indexpath_, "&"), class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_"))));
class_response_object::getInstance()->sendHeaders();
class_response_object::getInstance()->sendContent();
return "";
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:61,代码来源:download.php
示例8: __construct
public function __construct()
{
$v793914c9c583d9d86d0f4ed8c521b0c1 = defined("SERVER_ID") ? SERVER_ID : getServer('SERVER_ADDR');
if (defined("MEMCACHE_COMPRESSED")) {
$this->compress = MEMCACHE_COMPRESSED;
}
$this->mode = md5($v793914c9c583d9d86d0f4ed8c521b0c1) . "_";
$this->enabled = $this->connect();
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:9,代码来源:memcache.php
示例9: action_default
/**
* Handle a standard OpenID server request
*/
function action_default()
{
header('X-XRDS-Location: ' . buildURL('idpXrds'));
$server =& getServer();
$method = $_SERVER['REQUEST_METHOD'];
$request = null;
if ($method == 'GET') {
$request = $_GET;
} else {
$request = $_POST;
}
$request = $server->decodeRequest();
if (!$request) {
return about_render();
}
setRequestInfo($request);
if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) {
if ($request->idSelect()) {
// Perform IDP-driven identifier selection
if ($request->mode == 'checkid_immediate') {
$response =& $request->answer(false);
} else {
return trust_render($request);
}
} else {
if (!$request->identity && !$request->idSelect()) {
// No identifier used or desired; display a page saying
// so.
return noIdentifier_render();
} else {
if ($request->immediate) {
$response =& $request->answer(false, buildURL());
} else {
/*
if (!getLoggedInUser()) {
return login_render();
}
*/
return trust_render($request);
}
}
}
} else {
$response =& $server->handleRequest($request);
}
$webresponse =& $server->encodeResponse($response);
if ($webresponse->code != AUTH_OPENID_HTTP_OK) {
header(sprintf("HTTP/1.1 %d ", $webresponse->code), true, $webresponse->code);
}
foreach ($webresponse->headers as $k => $v) {
header("{$k}: {$v}");
}
header(header_connection_close);
print $webresponse->body;
exit(0);
}
开发者ID:akbarhossain,项目名称:openid4me,代码行数:59,代码来源:actions.php
示例10: setCookie
/**
* Sends a cookie to the browser
*
* @param string $strName
* @param string $strValue
* @param int $intTime
*
* @return bool
*/
public function setCookie($strName, $strValue, $intTime = 0)
{
//cookie is 30 days valid
if ($intTime == 0) {
$intTime = time() + 60 * 60 * 24 * 30;
}
$strPath = preg_replace('#http(s?)://' . getServer("HTTP_HOST") . '#i', '', _webpath_);
if ($strPath == "" || $strPath[0] != "/") {
$strPath = "/" . $strPath;
}
return setcookie($strName, $strValue, $intTime, $strPath);
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:21,代码来源:class_cookie.php
示例11: pushJsDomain
function pushJsDomain($vad5f82e879a9c5d6b5b442eb37e50551)
{
static $vcd69b4957f06cd818d7bf3d61980e291 = array();
if (getServer('HTTP_HOST') == $vad5f82e879a9c5d6b5b442eb37e50551) {
return false;
}
if (in_array($vad5f82e879a9c5d6b5b442eb37e50551, $vcd69b4957f06cd818d7bf3d61980e291)) {
return false;
} else {
$vcd69b4957f06cd818d7bf3d61980e291[] = $vad5f82e879a9c5d6b5b442eb37e50551;
echo "domainsList[domainsList.length] = \"", $vad5f82e879a9c5d6b5b442eb37e50551, "\";\n";
return true;
}
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:14,代码来源:cross-domain.php
示例12: action_default
/**
* Handle a standard OpenID server request
*/
function action_default()
{
global $store;
$server =& getServer();
$method = $_SERVER['REQUEST_METHOD'];
/*$request = null;
if ($method == 'GET') {
$request = $_GET;
} else {
$request = $_POST;
} */
$request = $server->decodeRequest();
if (!$request) {
return "";
//about_render();
}
setRequestInfo($request);
if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) {
$identity = getLoggedInUser();
if (isTrusted($identity, $request->trust_root, $request->return_to)) {
if ($request->message->isOpenID1()) {
$response =& $request->answer(true);
} else {
$response =& $request->answer(true, false, getServerURL(), $identity);
}
} else {
if ($request->immediate) {
$response =& $request->answer(false, getServerURL());
} else {
if (!getLoggedInUser()) {
$_SESSION['last_forward_from'] = current_page_url() . '?' . http_build_query(Auth_OpenID::getQuery());
system_message(elgg_echo('openid_server:not_logged_in'));
forward('login');
}
return trust_render($request);
}
}
addSregFields(&$response);
} else {
$response =& $server->handleRequest($request);
}
$webresponse =& $server->encodeResponse($response);
foreach ($webresponse->headers as $k => $v) {
header("{$k}: {$v}");
}
header(header_connection_close);
print $webresponse->body;
exit(0);
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:52,代码来源:actions.php
示例13: handleEvent
/**
* This generic method is called in case of dispatched events.
* The first param is the name of the event, the second argument is an array of
* event-specific arguments.
* Make sure to return a matching boolean value, indicating if the event-process was successful or not. The event source may
* depend on a valid return value.
*
* @param string $strEventIdentifier
* @param array $arrArguments
*
* @return bool
*/
public function handleEvent($strEventIdentifier, array $arrArguments)
{
/** @var class_request_entrypoint_enum $objEntrypoint */
$objEntrypoint = $arrArguments[0];
if ($objEntrypoint->equals(class_request_entrypoint_enum::INDEX()) && class_carrier::getInstance()->getParam("admin") == "") {
//process stats request
$objStats = class_module_system_module::getModuleByName("stats");
if ($objStats != null) {
//Collect Data
$objLanguage = new class_module_languages_language();
$objStats = new class_module_stats_worker();
$objStats->createStatsEntry(getServer("REMOTE_ADDR"), time(), class_carrier::getInstance()->getParam("page"), rtrim(getServer("HTTP_REFERER"), "/"), getServer("HTTP_USER_AGENT"), $objLanguage->getPortalLanguage());
}
}
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:27,代码来源:class_module_stats_processinglistener.php
示例14: generateLog
/**
* Generates a login-log-entry
*
* @param int $intStatus
* @param string $strOtherUsername
*
* @return bool
* @static
*/
public static function generateLog($intStatus = 1, $strOtherUsername = "")
{
$arrParams = array();
$strQuery = "INSERT INTO " . _dbprefix_ . "user_log\n\t\t\t\t\t\t(user_log_id, user_log_userid, user_log_date, user_log_status, user_log_ip, user_log_sessid) VALUES\n\t\t\t\t\t\t(?, ?, ?, ?, ?, ?)";
$arrParams[] = generateSystemid();
if ($strOtherUsername == "") {
$arrParams[] = class_carrier::getInstance()->getObjSession()->getUserID() == "" ? "0" : class_carrier::getInstance()->getObjSession()->getUserID();
} else {
$arrParams[] = $strOtherUsername;
}
$arrParams[] = class_date::getCurrentTimestamp();
$arrParams[] = (int) $intStatus;
$arrParams[] = getServer("REMOTE_ADDR");
$arrParams[] = class_carrier::getInstance()->getObjSession()->getInternalSessionId();
return class_carrier::getInstance()->getObjDB()->_pQuery($strQuery, $arrParams);
}
开发者ID:jinshana,项目名称:kajonacms,代码行数:25,代码来源:class_module_user_log.php
示例15: action_authorize
function action_authorize()
{
$server =& getServer();
$info = getRequestInfo();
if (!$info) {
$info = $server->decodeRequest();
}
// Throw away the info, we no longer need it.
setRequestInfo();
$trusted = isset($_POST['save']);
if ($trusted) {
return send_geni_user($server, $info);
} else {
return send_cancel($info);
}
}
开发者ID:ahelsing,项目名称:geni-portal,代码行数:16,代码来源:server.php
示例16: getHttpHost
function getHttpHost()
{
$host = getServer('HTTP_HOST');
if (!empty($host)) {
return $host;
}
$scheme = getScheme();
$name = getServer('SERVER_NAME');
$port = getServer('SERVER_PORT');
if (null === $name) {
return '';
} elseif ($scheme == 'http' && $port == 80 || $scheme == 'https' && $port == 443) {
return $name;
} else {
return $name . ':' . $port;
}
}
开发者ID:wangshipeng,项目名称:Php-Online,代码行数:17,代码来源:utilities.php
示例17: translateToDTD
protected function translateToDTD($phrases)
{
$dtd = "<!ENTITY quote '"'>\n";
$dtd .= "<!ENTITY nbsp ' '>\n";
$dtd .= "<!ENTITY middot '·'>\n";
$dtd .= "<!ENTITY reg '®'>\n";
$dtd .= "<!ENTITY copy '©'>\n";
$dtd .= "<!ENTITY raquo '»'>\n";
$dtd .= "<!ENTITY laquo '«'>\n";
$request_uri = getServer('REQUEST_URI');
$request_uri = htmlspecialchars($request_uri);
foreach ($phrases as $ref => $phrase) {
$phrase = $this->protectEntityValue($phrase);
$dtd .= "<!ENTITY {$ref} \"{$phrase}\">\n";
}
return $dtd;
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:17,代码来源:ulangStream.php
示例18: action_default
/**
* Handle a standard OpenID server request
*/
function action_default()
{
$server =& getServer();
$method = $_SERVER['REQUEST_METHOD'];
$request = null;
if ($method == 'GET') {
$request = $_GET;
} else {
$request = $_POST;
}
$request = Auth_OpenID::fixArgs($request);
$request = $server->decodeRequest($request);
if (!$request) {
return about_render();
}
setRequestInfo($request);
if (in_array($request->mode, array('checkid_immediate', 'checkid_setup'))) {
if (isTrusted($request->identity, $request->trust_root)) {
$response =& $request->answer(true);
$sreg = getSreg($request->identity);
if (is_array($sreg)) {
foreach ($sreg as $k => $v) {
$response->addField('sreg', $k, $v);
}
}
} else {
if ($request->immediate) {
$response =& $request->answer(false, getServerURL());
} else {
if (!getLoggedInUser()) {
return login_render();
}
return trust_render($request);
}
}
} else {
$response =& $server->handleRequest($request);
}
$webresponse =& $server->encodeResponse($response);
foreach ($webresponse->headers as $k => $v) {
header("{$k}: {$v}");
}
header(header_connection_close);
print $webresponse->body;
exit(0);
}
开发者ID:honchoman,项目名称:singpolyma,代码行数:49,代码来源:actions.php
示例19: doAuth
function doAuth($info, $trusted = null, $fail_cancels = false, $idpSelect = null)
{
if (!$info) {
// There is no authentication information, so bail
return authCancel(null);
}
if ($info->idSelect()) {
if ($idpSelect) {
$req_url = idURL($idpSelect);
} else {
$trusted = false;
}
} else {
$req_url = $info->identity;
}
$user = getLoggedInUser();
setRequestInfo($info);
if (!$info->idSelect() && $req_url != idURL($user)) {
return login_render(array(), $req_url, $req_url);
}
$trust_root = $info->trust_root;
if ($trusted) {
setRequestInfo();
$server =& getServer();
$response =& $info->answer(true, null, $req_url);
// Answer with some sample Simple Registration data.
$sreg_data = array('fullname' => 'Example User', 'nickname' => 'example', 'dob' => '1970-01-01', 'email' => '[email protected]', 'gender' => 'F', 'postcode' => '12345', 'country' => 'ES', 'language' => 'eu', 'timezone' => 'America/New_York');
// Add the simple registration response values to the OpenID
// response message.
$sreg_request = Auth_OpenID_SRegRequest::fromOpenIDRequest($info);
$sreg_response = Auth_OpenID_SRegResponse::extractResponse($sreg_request, $sreg_data);
$sreg_response->toMessage($response->fields);
// Generate a response to send to the user agent.
$webresponse =& $server->encodeResponse($response);
$new_headers = array();
foreach ($webresponse->headers as $k => $v) {
$new_headers[] = $k . ": " . $v;
}
return array($new_headers, $webresponse->body);
} elseif ($fail_cancels) {
return authCancel($info);
} else {
return trust_render($info);
}
}
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:45,代码来源:common.php
示例20: checkLogged
public function checkLogged($template = "default")
{
if (!$template) {
$template = "default";
}
if (!$this->is_auth()) {
list($template_reg_form) = def_module::loadTemplates("users/" . $template, "login_registration_form");
$from_page = getRequest('from_page');
if (!$from_page) {
$from_page = getServer('REQUEST_URI');
}
$block_arr = array();
$block_arr['from_page'] = def_module::protectStringVariable($from_page);
return def_module::parseTemplate($template_reg_form, $block_arr, false);
} else {
return;
}
}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:18,代码来源:__custom.php
注:本文中的getServer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论