本文整理汇总了PHP中Params::existServerParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Params::existServerParam方法的具体用法?PHP Params::existServerParam怎么用?PHP Params::existServerParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Params
的用法示例。
在下文中一共展示了Params::existServerParam方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
if (Params::existServerParam('REQUEST_URI')) {
if (preg_match('|[\\?&]{1}http_referer=(.*)$|', urldecode(Params::getServerParam('REQUEST_URI', false, false)), $ref_match)) {
$this->http_referer = $ref_match[1];
$_SERVER['REQUEST_URI'] = preg_replace('|[\\?&]{1}http_referer=(.*)$|', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
}
$request_uri = preg_replace('@^' . REL_WEB_URL . '@', "", urldecode(Params::getServerParam('REQUEST_URI', false, false)));
$this->raw_request_uri = $request_uri;
$route_used = false;
foreach ($this->routes as $id => $route) {
// UNCOMMENT TO DEBUG
//echo 'Request URI: '.$request_uri." # Match : ".$route['regexp']." # URI to go : ".$route['url']." <br />";
if (preg_match('#^' . $route['regexp'] . '#', $request_uri, $m)) {
if (!preg_match_all('#\\{([^\\}]+)\\}#', $route['url'], $args)) {
$args[1] = array();
}
$l = count($m);
for ($p = 1; $p < $l; $p++) {
if (isset($args[1][$p - 1])) {
Params::setParam($args[1][$p - 1], $m[$p]);
} else {
Params::setParam('route_param_' . $p, $m[$p]);
}
}
Params::setParam('page', 'custom');
Params::setParam('route', $id);
$route_used = true;
$this->location = $route['location'];
$this->section = $route['section'];
$this->title = $route['title'];
break;
}
}
if (!$route_used) {
if (osc_rewrite_enabled()) {
$tmp_ar = explode("?", $request_uri);
$request_uri = $tmp_ar[0];
// if try to access directly to a php file
if (preg_match('#^(.+?)\\.php(.*)$#', $request_uri)) {
$file = explode("?", $request_uri);
if (!file_exists(ABS_PATH . $file[0])) {
Rewrite::newInstance()->set_location('error');
header('HTTP/1.1 404 Not Found');
osc_current_web_theme_path('404.php');
exit;
}
}
foreach ($this->rules as $match => $uri) {
// UNCOMMENT TO DEBUG
// echo 'Request URI: '.$request_uri." # Match : ".$match." # URI to go : ".$uri." <br />";
if (preg_match('#^' . $match . '#', $request_uri, $m)) {
$request_uri = preg_replace('#' . $match . '#', $uri, $request_uri);
break;
}
}
}
$this->extractParams($request_uri);
$this->request_uri = $request_uri;
if (Params::getParam('page') != '') {
$this->location = Params::getParam('page');
}
if (Params::getParam('action') != '') {
$this->section = Params::getParam('action');
}
}
}
}
示例2: getSize
public function getSize()
{
if (Params::existServerParam("CONTENT_LENGTH")) {
return (int) Params::getServerParam("CONTENT_LENGTH");
} else {
throw new Exception(__('Getting content length is not supported.'));
}
}
示例3: osc_get_http_referer
/**
*
*/
function osc_get_http_referer()
{
$ref = Rewrite::newInstance()->get_http_referer();
if ($ref != '') {
return $ref;
} else {
if (Session::newInstance()->_getReferer() != '') {
return Session::newInstance()->_getReferer();
} else {
if (Params::existServerParam('HTTP_REFERER')) {
if (filter_var(Params::getServerParam('HTTP_REFERER', false, false), FILTER_VALIDATE_URL)) {
return Params::getServerParam('HTTP_REFERER', false, false);
}
}
}
}
return '';
}
示例4: __construct
/**
* @param string $blogURL The URL of your blog.
* @param string $wordPressAPIKey WordPress API key.
*/
public function __construct($blogURL, $wordPressAPIKey)
{
$this->blogURL = $blogURL;
$this->wordPressAPIKey = $wordPressAPIKey;
// Set some default values
$this->apiPort = 80;
$this->akismetServer = 'rest.akismet.com';
$this->akismetVersion = '1.1';
// Start to populate the comment data
$this->comment['blog'] = $blogURL;
$this->comment['user_agent'] = Params::getServerParam('HTTP_USER_AGENT');
if (Params::existServerParam('HTTP_REFERER')) {
$this->comment['referrer'] = Params::getServerParam('HTTP_REFERER', false, false);
}
/*
* This is necessary if the server PHP5 is running on has been set up to run PHP4 and
* PHP5 concurently and is actually running through a separate proxy al a these instructions:
* http://www.schlitt.info/applications/blog/archives/83_How_to_run_PHP4_and_PHP_5_parallel.html
* and http://wiki.coggeshall.org/37.html
* Otherwise the user_ip appears as the IP address of the PHP4 server passing the requests to the
* PHP5 one...
*/
$this->comment['user_ip'] = Params::getServerParam('REMOTE_ADDR') != getenv('SERVER_ADDR') ? Params::getServerParam('REMOTE_ADDR') : getenv('HTTP_X_FORWARDED_FOR');
}
示例5: doModel
//.........这里部分代码省略.........
$item = Item::newInstance()->findByPrimaryKey($id);
if (count($item) <= 0) {
$this->redirectTo(osc_admin_base_url(true) . "?page=items");
}
$csrf_token = osc_csrf_token_url();
if ($item['b_active']) {
$actions[] = '<a class="btn float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=INACTIVE">' . __('Deactivate') . '</a>';
} else {
$actions[] = '<a class="btn btn-red float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=ACTIVE">' . __('Activate') . '</a>';
}
if ($item['b_enabled']) {
$actions[] = '<a class="btn float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=DISABLE">' . __('Block') . '</a>';
} else {
$actions[] = '<a class="btn btn-red float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=ENABLE">' . __('Unblock') . '</a>';
}
if ($item['b_premium']) {
$actions[] = '<a class="btn float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status_premium&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=0">' . __('Unmark as premium') . '</a>';
} else {
$actions[] = '<a class="btn float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status_premium&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=1">' . __('Mark as premium') . '</a>';
}
if ($item['b_spam']) {
$actions[] = '<a class="btn btn-red float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status_spam&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=0">' . __('Unmark as spam') . '</a>';
} else {
$actions[] = '<a class="btn float-left" href="' . osc_admin_base_url(true) . '?page=items&action=status_spam&id=' . $item['pk_i_id'] . '&' . $csrf_token . '&value=1">' . __('Mark as spam') . '</a>';
}
$this->_exportVariableToView("actions", $actions);
$form = count(Session::newInstance()->_getForm());
$keepForm = count(Session::newInstance()->_getKeepForm());
if ($form == 0 || $form == $keepForm) {
Session::newInstance()->_dropKeepForm();
}
// save referer if belongs to manage items
// redirect only if ManageItems or ReportedListngs
if (Params::existServerParam('HTTP_REFERER')) {
$referer = Params::getServerParam('HTTP_REFERER', false, false);
if (preg_match('/page=items/', $referer)) {
if (preg_match("/action=([\\p{L}|_|-]+)/u", $referer, $matches)) {
if ($matches[1] == 'items_reported') {
Session::newInstance()->_set('osc_admin_referer', $referer);
}
} else {
// no actions - Manage Listings
Session::newInstance()->_set('osc_admin_referer', $referer);
}
}
}
$this->_exportVariableToView("item", $item);
$this->_exportVariableToView("new_item", FALSE);
osc_run_hook("before_item_edit", $item);
$this->doView('items/frm.php');
break;
case 'item_edit_post':
osc_csrf_check();
$mItems = new ItemActions(true);
$mItems->prepareData(false);
// set all parameters into session
foreach ($mItems->data as $key => $value) {
Session::newInstance()->_setForm($key, $value);
}
$meta = Params::getParam('meta');
if (is_array($meta)) {
foreach ($meta as $key => $value) {
Session::newInstance()->_setForm('meta_' . $key, $value);
Session::newInstance()->_keepForm('meta_' . $key);
}
}