本文整理汇总了PHP中pb_getenv函数的典型用法代码示例。如果您正苦于以下问题:PHP pb_getenv函数的具体用法?PHP pb_getenv怎么用?PHP pb_getenv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pb_getenv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ip
function ip($minIpAddress, $maxIpAddress)
{
global $_SERVER;
$onlineip = empty($_SERVER['REMOTE_ADDR']) ? pb_getenv('REMOTE_ADDR') : $_SERVER['REMOTE_ADDR'];
$longip = ip2long($onlineip);
if ($this->range($longip, $minIpAddress, $maxIpAddress)) {
die("IP FOBIDDEN!");
}
}
示例2: showError
function showError($msg, $type = null)
{
global $charset;
$host = pb_getenv('HTTP_HOST');
$title = $type == 'db' ? 'Database' : 'System';
echo <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
\t<title>{$host} - {$title} Error</title>
\t<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
\t<meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" />
\t<style type="text/css">
\t<!--
\tbody { background-color: white; color: black; }
\t#container { width: 650px; }
\t#message { width: 650px; color: black; background-color: #FFFFCC; }
\t#bodytitle { font: 13pt/15pt verdana, arial, sans-serif; height: 35px; vertical-align: top; }
\t.bodytext { font: 8pt/11pt verdana, arial, sans-serif; }
\t.help { font: 12px verdana, arial, sans-serif; color: red;}
\t.red {color: red;}
\ta:link { font: 8pt/11pt verdana, arial, sans-serif; color: red; }
\ta:visited { font: 8pt/11pt verdana, arial, sans-serif; color: #4e4e4e; }
\t-->
\t</style>
</head>
<body>
<table cellpadding="1" cellspacing="5" id="container">
<tr>
\t<td id="bodytitle" width="100%">{$host} {$title} Error </td>
</tr>
EOT;
if ($type == 'db') {
$helplink = "http://support.phpb2b.com/";
echo <<<EOT
<tr>
\t<td class="bodytext">The database has encountered a problem. <a href="{$helplink}" target="_blank"><span class="red">Need Help?</span></a></td>
</tr>
EOT;
} else {
echo <<<EOT
<tr>
\t<td class="bodytext">Your request has encountered a problem. </td>
</tr>
EOT;
}
echo <<<EOT
<tr><td><hr size="1"/></td></tr>
<tr><td class="bodytext">Error messages: </td></tr>
<tr>
\t<td class="bodytext" id="message">
\t\t<ul> {$msg}</ul>
\t</td>
</tr>
EOT;
exit;
}
示例3: smarty_function_get_cache
/**
* [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
* The contents of this file are subject to the License; you may not use this file except in compliance with the License.
*
* @version $Revision: 2090 $
*/
function smarty_function_get_cache($params, &$smarty)
{
$op = null;
extract($params);
if (isset($name)) {
switch ($name) {
case "language":
global $_PB_CACHE;
$languages = unserialize($_PB_CACHE['setting']['languages']);
if (!empty($languages)) {
foreach ($languages as $lang_key => $lang_val) {
$tmp = "<a href='" . URL . 'redirect.php?url=' . pb_getenv("PHP_SELF") . "&app_lang=" . $lang_key . "'>";
if (!empty($lang_val['img'])) {
$tmp .= "<img src='" . $lang_val['img'] . "' alt='" . $lang_val['title'] . "' />";
} else {
$tmp .= $lang_val['title'];
}
$tmp .= "</a>";
if ($title_li == "list") {
$op .= "<li>" . $tmp . "</li>";
} else {
$op .= $tmp;
}
}
}
break;
case "nav":
require CACHE_LANG_PATH . "cache_nav.php";
$navs = $_PB_CACHE['nav']['navs'];
foreach ($navs as $nav) {
$op .= '<li id="mn_' . $nav['id'] . '" class="nav_item nav-item-' . $nav['id'] . '';
$file_name = pb_getenv('REQUEST_URI');
if (strpos($file_name, $nav['url']) !== false && $nav['url'] != 'index.php') {
$op .= ' current_nav_item';
}
$op .= '">' . $nav['link'] . '</li>';
}
break;
default:
if (is_file(CACHE_LANG_PATH . "cache_" . $name . ".php")) {
require CACHE_LANG_PATH . "cache_" . $name . ".php";
}
if (empty($var)) {
$var = "item";
}
$smarty->assign($var, $_PB_CACHE);
unset($_PB_CACHE);
break;
}
}
return $op;
}
示例4: write
function write($sid, $sess_data)
{
$sess_data = pb_addslashes($sess_data);
$expiry = $this->time + $this->lifetime;
$sql = "SELECT * FROM {$this->sess_table} WHERE sesskey='{$sid}'";
$result = $this->db->GetRow($sql);
if (!empty($result)) {
$sql = "UPDATE {$this->sess_table} SET data='{$sess_data}',expiry='{$expiry}',modified='{$this->time}' WHERE sesskey='{$sid}'";
$this->db->Execute($sql);
} else {
$this->db->Execute("INSERT INTO {$this->sess_table} (sesskey,data,expiry,expireref,created,modified) VALUES('{$sid}', '{$sess_data}', '{$expiry}', '" . pb_getenv('PHP_SELF') . "', '{$this->time}', '{$this->time}')");
}
return true;
}
示例5: lwrite
function lwrite($message = null)
{
if (empty($message)) {
return;
}
if (empty($this->log_file)) {
$this->log_file = DATA_PATH . 'logs/log';
}
if (!$this->fp) {
$this->lopen();
}
$script_name = basename($_SERVER['PHP_SELF']);
$script_name = substr($script_name, 0, -4);
$time = date('H:i:s');
fwrite($this->fp, "[{$time}] [{$script_name}] [" . pb_getenv("REMOTE_ADDR") . "] {$message}\r\n");
fclose($this->fp);
}
示例6: lwrite
function lwrite($message = null, $pre = 'info')
{
if (empty($message)) {
return;
}
if (empty($this->log_file)) {
$this->log_file = DATA_PATH . 'logs/';
}
if (!is_dir($this->log_file)) {
pb_create_folder($this->log_file);
}
$this->log_file = $this->log_file . $pre;
if (!$this->fp) {
$this->lopen();
}
$script_name = $_SERVER['PHP_SELF'];
// $script_name = basename($_SERVER['PHP_SELF']);
// $script_name = substr($script_name, 0, -4);
$time = date('c');
fwrite($this->fp, "{$time} - " . pb_getenv("REMOTE_ADDR") . " {$script_name} {$message}\r\n");
fclose($this->fp);
}
示例7: breadcrumb
/**
* Breadcrumb
* @since Version 2.0.0
* @access private
*/
function breadcrumb()
{
// Creates an array of Directory Structure
$this->scriptArray = explode("/", pb_getenv('PHP_SELF'));
// Pops the filename off the end and throws it into it's own variable
$this->fileName = array_pop($this->scriptArray);
// Is this a personal site?
if (substr($_SERVER['PHP_SELF'], 1, 1) == '~') {
$tmp = explode('/', pb_getenv('PHP_SELF'));
$this->personalSite = $tmp[1];
$this->document_root = str_replace(str_replace('/' . $this->personalSite, '', pb_getenv("SCRIPT_NAME")), '', $_SERVER['PATH_TRANSLATED']);
} else {
$this->document_root = str_replace(pb_getenv("SCRIPT_NAME"), '', $_SERVER['PATH_TRANSLATED']);
}
#echo $this->document_root.'<Br />';
#echo $_SERVER["SCRIPT_NAME"].'<Br />';
#echo $_SERVER["PATH_TRANSLATED"].'<Br />';
}
示例8: __construct
function __construct()
{
$this->_url = pb_getenv('PHP_SELF');
}
示例9: smarty_function_pager
//.........这里部分代码省略.........
}
// END INIT
// remove these vars from the request_uri - only for beauty
$removeVars = array($posvar, '_rc');
// START remove the unwanted variables from the query string
parse_str($_SERVER['QUERY_STRING'], $urlVars);
// add cache total count
$urlVars['total_count'] = $rowcount;
// add the forward vars
if (!is_array($forwardvars)) {
$forwardvars = preg_split('/[,;\\s]/', $forwardvars, -1, PREG_SPLIT_NO_EMPTY);
}
$urlVars = array_merge($urlVars, $forwardvars);
foreach ($urlVars as $key => $value) {
if (in_array($key, $removeVars)) {
unset($urlVars[$key]);
}
}
// END remove the unwanted variables from the query string
// START build up the link
$tmp = '';
foreach ($urlVars as $key => $value) {
if (is_array($value)) {
foreach ($value as $val) {
$tmp .= '&' . $key . '[]=' . urlencode($val);
}
} elseif (!empty($value)) {
$tmp .= '&' . $key . '=' . urlencode($value);
} else {
$tmp .= '&' . $key;
}
}
if (!empty($tmp)) {
$url = pb_getenv('PHP_SELF') . '?' . substr($tmp, 1);
$link = '&';
} else {
$url = pb_getenv('PHP_SELF');
$link = '?';
}
// END build up the link
// if there is no position (or 0) prepare the link for the second page
if ((empty($pos) or $pos < 1) and $rowcount > $limit) {
if (!empty($firstpos)) {
$short['first'] .= $url . $link . $posvar . '=' . $firstpos;
} elseif ($pos == -1) {
$short['first'] .= $url . $link . $posvar . '=' . (1 + $shift);
} else {
$short['first'] = $url . $link . $posvar . '=' . ($limit + $shift);
}
}
// START create data to print
if ($rowcount > $limit) {
for ($i = 1; $i < $rowcount + 1; $i += $limit) {
$pages[$i] = $url . $link . $posvar . '=' . ($i - 1 + $shift);
}
// previous - next stepping
if ($pos >= $limit) {
$short['prev'] = $url . $link . $posvar . '=' . ($pos - $limit + $shift);
}
if ($pos < $rowcount - $limit) {
$short['next'] = $url . $link . $posvar . '=' . ($pos + $limit + $shift);
}
}
// END preparing the arrays to print
if ($pos >= $limit) {
$cache['prev'] = '<a href="' . $short['prev'] . '">' . $txt_prev . '</a>';
示例10: uses
require "../configs/config.inc.php";
require "../libraries/common.inc.php";
require "session_cp.inc.php";
require LIB_PATH . "cache.class.php";
require CLASS_PATH . "string.class.php";
//require(CACHE_LANG_PATH.'lang_emails.php');
uses("setting", "typeoption", "attachment");
$cache = new Caches();
$attachment_controller = new Attachment();
$typeoption = new Typeoption();
$string = new Strings();
$setting = new Settings();
setvar("AskAction", $typeoption->get_cache_type("common_option"));
$tpl_file = "setting.basic";
$item = $setting->getValues();
if (preg_match("/iis/", strtolower(pb_getenv("SERVER_SOFTWARE")))) {
$is_iis = true;
}
if (isset($_POST['do'])) {
$do = trim($_POST['do']);
switch ($do) {
case "testemail":
require LIB_PATH . 'sendmail.inc.php';
if (!empty($_POST['data']['setting']['testemail'])) {
$sended = pb_sendmail(array($_POST['data']['setting']['testemail'], $_POST['data']['setting']['testemail']), L("dear_user", "tpl"), null, L("a_test_email_delete", "tpl", $G['setting']['site_name']));
if (!$sended) {
flash("email_sended_false");
} else {
flash("email_sended_success");
}
} else {
示例11: getDateLink
function getDateLink($day, $month, $year)
{
$s = pb_getenv('SCRIPT_NAME');
$t = am($_GET, array('day' => $day, 'month' => $month, 'year' => $year));
return "{$s}?" . http_build_query($t);
}
示例12: array
$sections = array('install', 'javascript');
//da($smarty);
$smarty->configLoad('default.conf', $sections);
$arrTemplate = $smarty->getConfigVars();
extract($arrTemplate);
//:~
$db = new DB_Sql();
$file_cls = new Files();
$pb_protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') {
$pb_protocol = 'https';
}
$PHP_SELF = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : preg_replace("/(.*)\\.php(.*)/i", "\\1.php", $_SERVER['PHP_SELF']);
$BASESCRIPT = basename($PHP_SELF);
list($BASEFILENAME) = explode('.', $BASESCRIPT);
$install_url = htmlspecialchars($pb_protocol . "://" . pb_getenv('HTTP_HOST') . preg_replace("/\\/+(api|wap)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/');
$siteUrl = substr($install_url, 0, -(strlen($BASEFILENAME) + 1));
$time_stamp = TIME;
if ($_REQUEST) {
if (!MAGIC_QUOTES_GPC) {
$_REQUEST = pb_addslashes($_REQUEST);
if ($_COOKIE) {
$_COOKIE = pb_addslashes($_COOKIE);
}
}
extract($_REQUEST, EXTR_SKIP);
}
if (!isset($_GET['step'])) {
$step = '1';
} else {
$step = intval($_GET['step']);
示例13: Pages
function Pages()
{
$this->_url = pb_getenv('PHP_SELF');
}
示例14: pb_submit_check
function pb_submit_check($var)
{
$referer = pb_getenv('HTTP_REFERER');
// if (is_file(DATA_PATH.'antispam'.DS.'index.php')) {
// require(DATA_PATH.'antispam'.DS.'index.php');
// }
if (!empty($_POST[$var]) && $_SERVER['REQUEST_METHOD'] == 'POST') {
if ((empty($referer) || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $referer) == preg_replace("/([^\\:]+).*/", "\\1", pb_getenv('HTTP_HOST'))) && $_POST['formhash'] == formhash()) {
return true;
}
}
header_sent(L("invalid_submit"));
exit;
}
示例15: L
if (function_exists("ImageCreateFromWBMP")) {
$return[] = L('gd_picture_ok', 'tpl', 'WBMP');
}
return $return;
}
}
$gd_s = checkGDSupport();
$system_info["GDSupports"] = $gd_ss = !$gd_s ? L('without_this_ext', 'tpl') : implode(",", $gd_s);
$rows = $pdb->Execute("SHOW TABLE STATUS");
$dbssize = 0;
foreach ($rows as $row) {
$dbssize += $row['Data_length'] + $row['Index_length'];
}
$system_info["PBVersion"] = strtoupper(PHPB2B_VERSION . " ({$charset})");
$system_info["DatabaseSize"] = size_info($dbssize);
$system_info["software"] = pb_getenv('SERVER_SOFTWARE');
$system_info["operatingsystem"] = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? "Windows" : "Linux";
setvar("item", $system_info);
//check version
$support_url = "http://www.phpb2b.com/checkversion.php?version=" . rawurlencode(PHPB2B_VERSION) . "&lang=" . $app_lang . "&release=" . PHPB2B_RELEASE . "&charset={$charset}&dbcharset={$dbcharset}";
if (version_compare(PHP_VERSION, '5.0.0') >= 0) {
$opts = array('http' => array('method' => "GET", 'timeout' => 60));
$context = stream_context_create($opts);
$file_contents = file_get_contents($support_url, false, $context);
} else {
$file_contents = file_get_contents($support_url, false);
}
$has_newversion = false;
if (empty($file_contents) || !$file_contents) {
} else {
//get update alert set