本文整理汇总了PHP中PVars::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PVars::get方法的具体用法?PHP PVars::get怎么用?PHP PVars::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PVars
的用法示例。
在下文中一共展示了PVars::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _languageFooterSelectorDropDown
function _languageFooterSelectorDropDown()
{
$words = new MOD_words();
$langsel = '';
$request_string = htmlspecialchars(implode('/', PVars::get()->request), ENT_QUOTES);
$langsel = '
<select id="language" name="language" class="combo" onchange="window.location.href=this.value; return false">';
$langsel .= _languageOptions($words) . '</select>';
return $langsel;
}
示例2: __construct
/**
* @param string $category optional value to set the page of the texts
* we're looking for (this needs an additional column in the
* words table)
*/
public function __construct($category = null)
{
$this->_lang = PVars::get()->lang;
$this->WordMemcache = new MOD_bw_memcache("words", "Sentence", "code");
if (!empty($category)) {
$this->_whereCategory = ' `category`=\'' . $category . '\'';
}
if (isset($_SESSION['IdLanguage'])) {
$this->_langWrite = $_SESSION['IdLanguage'];
} else {
$this->_langWrite = 0;
}
$db_vars = PVars::getObj('config_rdbms');
if (!$db_vars) {
throw new PException('DB config error!');
}
$dao = PDB::get($db_vars->dsn, $db_vars->user, $db_vars->password);
$this->_dao =& $dao;
$R = MOD_right::get();
if ($R->hasRight("Words", $this->_lang)) {
$this->_offerTranslationLink = true;
}
// read translation mode from $_SESSION['tr_mode']
if (array_key_exists("tr_mode", $_SESSION)) {
$this->_trMode = $_SESSION['tr_mode'];
} else {
if (array_key_exists("tr_mode", $_SESSION)) {
$this->_trMode = $_SESSION['tr_mode'];
} else {
if ($this->_offerTranslationLink) {
$this->_trMode = 'translate';
} else {
$this->_trMode = 'browse';
}
}
}
switch ($this->_trMode) {
case 'browse':
case 'proofread':
// not yet implemented
break;
case 'edit':
case 'translate':
if ($this->_offerTranslationLink) {
break;
}
default:
if ($this->_offerTranslationLink) {
$this->_trMode = 'translate';
} else {
$this->_trMode = 'browse';
}
}
}
示例3: __construct
public function __construct($file)
{
$this->_lang = PVars::get()->lang;
// $fallbackLangFile = TEXT_DIR.$this->_fallbackLang.'/'.$file;
// $langFile = TEXT_DIR.$this->_lang.'/'.$file;
//if (!file_exists($fallbackLangFile) || !is_readable($fallbackLangFile))
// throw new PException('Fallback language file not found!');
//if (!file_exists($langFile) || !is_readable($langFile))
// $langFile = $fallbackLangFile;
//$this->langFile = $langFile;
//$this->fallbackLangFile = $fallbackLangFile;
}
示例4: get
public static function get()
{
if (!isset(self::$_instance) || get_class(self::$_instance) != __CLASS__) {
if (isset($_SESSION) && is_array($_SESSION) && array_key_exists('PostHandler', $_SESSION) && !empty($_SESSION['PostHandler'])) {
self::$_instance = unserialize($_SESSION['PostHandler']);
unset($_SESSION['PostHandler']);
} else {
$c = __CLASS__;
self::$_instance = new $c();
}
}
if (self::$_instance->_postHandling) {
return false;
}
if (is_array($_POST) && count($_POST) > 0) {
self::$_instance->_postHandling = true;
self::$_instance->save();
$_SESSION['PostHandler'] = serialize(self::$_instance);
$req = $_SERVER['REQUEST_URI'];
if (!PVars::get()->cookiesAccepted) {
$req = parse_url($req);
$query = array();
if (isset($request['query'])) {
parse_str($request['query'], $query);
}
if (is_array($query) && !array_key_exists(session_name(), $query)) {
$query[session_name()] = session_id();
$queries = array();
foreach ($query as $k => $q) {
$queries[] = $k . '=' . $q;
}
$req['query'] = implode('&', $queries);
}
$req = PFunctions::glueParsedUrl($req);
}
session_write_close();
header('Location: ' . $req);
PPHP::PExit();
} else {
$_SESSION['PostHandler'] = serialize(self::$_instance);
self::$_instance->_postHandling = false;
}
return self::$_instance;
}
示例5: launch
/**
* central starting point.
* to be called in htdocs/index.php
*/
function launch()
{
$env_explore = $this->initializeGlobalState();
try {
// find an app and run it.
$this->chooseAndRunApplication($env_explore);
} catch (Exception $e) {
ExceptionLogger::logException($e);
$debug = true;
if (class_exists('PVars') && !($debug = PVars::get()->debug)) {
$debug = false;
}
if (class_exists('ExceptionPage') && $debug) {
$page = new ExceptionPage();
$page->exception = $e;
$page->render();
} elseif ($debug) {
echo '
<h2>A terrible ' . get_class($e) . ' was thrown</h2>
<p>RoxLauncher is feeling sorry.</p>
<pre>';
print_r($e);
echo '
</pre>';
} else {
echo <<<HTML
<html>
<head><title>BeWelcome</title></head>
<body style="width:100%; margin: 0; padding: 0; background: #f7f7f7 url(../images/bggrey.png) top left ">
<div style="background: #f37000; border-bottom: 1px solid white; height: 49px">
<div style="margin:0 auto; width:960px;">
<div style="margin:0 auto;"><img style="padding: 7px;" src="../images/logo_index_top.png" /></div>
</div>
</div>
<div style="margin:0 auto; width:960px;"><h1>Well,</h1>
<p>this is awkward. We couldn't serve your page.</p>
<p>You might have found a bug or our server is currently updating some really important stuff to keep it secure.</p>
<p>Please try again in a minute or two.</p></div></div>
</html>
HTML;
}
}
}
示例6: setBaseUri
protected function setBaseUri()
{
$env = PVars::get()->env;
$override_conds = isset($env["baseuri_override"]) && $env["baseuri_override"];
$http_ref_conds = isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'http://') !== false;
//sometimes we will be sending data via ssl even while the user
//is browsing on http. the http_referer conditions keep user from
//being automatically rerouted onto https
$https_conds = isset($_SERVER['HTTPS']) && isset($env["baseuri_https"]) && $env["baseuri_https"] && !$http_ref_conds;
$http_conds = isset($env["baseuri_http"]) && $env["baseuri_http"];
if ($override_conds) {
$env["baseuri"] = $env["baseuri_override"];
} elseif ($https_conds) {
$env["baseuri"] = $env["baseuri_https"];
} elseif ($http_conds) {
$env["baseuri"] = $env["baseuri_http"];
} else {
//TODO: error logging
}
PVars::register('env', $env);
}
示例7: foreach
<a style="display:inline" href="http://trac.bewelcome.org/">BW Rox</a> rev. <a href="http://github.com/BeWelcome/rox/commit/<?php
echo $versionInfo;
?>
"><?php
echo $versionInfo;
?>
</a>
(<span title="<?php
echo $deploymentDateTime;
?>
"><?php
echo $deploymentDate;
?>
</span>)</em></p>
<?php
// List of DB queries with execution time
if (PVars::get()->debug) {
$R = MOD_right::get();
if ($R->HasRight("Debug", "DB_QUERY")) {
?>
<p>
<a style="cursor:pointer;" onclick="$('query_list').toggle();">DB queries</a>
</p>
<div id='query_list' style="display:none;">
<?php
foreach ($query_list as $key => $query) {
echo $key + 1 . ": {$query}<br />\n";
}
}
}
示例8: basename
<div>
<!--
Build: <?php
echo PVars::get()->build;
?>
Templates: <?php
echo basename(TEMPLATE_DIR);
?>
-->
</div>
示例9: debugInfo
protected function debugInfo()
{
if (PVars::get()->debug) {
require TEMPLATE_DIR . 'shared/roxpage/debuginfo.php';
}
}
示例10: createProcess
/**
* Processing creation of a blog.
*
* This is a POST callback function.
*
* Sets following errors in POST vars:
* title - invalid(empty) title.
* text - invalid(empty) text.
* startdate - wrongly formatted start date.
* enddate - wrongly formatted end date.
* duration - empty enddate and invalid duration.
* category - category is not belonging to user.
* trip - trip is not belonging to user.
* inserror - error performing db insertion.
* tagerror - error while updating tags.
*/
public function createProcess($args, $action, $mem_redirect, $mem_resend)
{
if (!($member = $this->_model->getLoggedInMember())) {
return false;
}
$vars = $args->post;
$mem_redirect->post = $args->post;
if (isset($vars['txt'])) {
$vars['txt'] = $this->_cleanupText($vars['txt']);
}
if (!$this->_validateVars($vars)) {
return false;
}
if (!($userId = $member->id)) {
$vars['errors'] = array('inserror');
return false;
}
$flags = 0;
/* removed from use, referencing user app
if (isset($vars['flag-sticky']) && $User->hasRight('write_sticky@blog')) {
$flags = ($flags | Blog::FLAG_STICKY);
}
*/
if (!isset($vars['vis'])) {
$vars['vis'] = 'pub';
}
// Default (if none set: public)
switch ($vars['vis']) {
case 'pub':
break;
case 'prt':
$flags = $flags | Blog::FLAG_VIEW_PROTECTED;
break;
default:
$flags = $flags | Blog::FLAG_VIEW_PRIVATE;
break;
}
$trip = isset($vars['tr']) && strcmp($vars['tr'], '') != 0 ? (int) $vars['tr'] : false;
$blogId = $this->_model->createEntry($flags, $userId, $trip);
if (isset($vars['date']) && (strlen($vars['date']) <= 10 && strlen($vars['date']) > 8)) {
list($day, $month, $year) = preg_split('/[\\/.-]/', $vars['date']);
if (substr($month, 0, 1) == '0') {
$month = substr($month, 1, 2);
}
if (substr($day, 0, 1) == '0') {
$day = substr($day, 1, 2);
}
$start = mktime(0, 0, 0, (int) $month, (int) $day, (int) $year);
$start = date('YmdHis', $start);
} else {
$start = false;
}
// Check if the location already exists in our DB and add it if necessary
if ($vars['geonameid'] && $vars['latitude'] && $vars['longitude'] && $vars['geonamename'] && $vars['geonamecountrycode'] && $vars['admincode']) {
$geoname_ok = $this->_model->checkGeonamesCache($vars['geonameid']);
} else {
$geoname_ok = false;
}
$start = is_null($start) ? false : $start;
$geonameId = $geoname_ok ? $vars['geonameid'] : false;
try {
$this->_model->createData($blogId, $vars['t'], $vars['txt'], $start, $geonameId);
} catch (PException $e) {
if (PVars::get()->debug) {
throw $e;
} else {
error_log($e->__toString());
}
// rollback!
$this->_model->deleteEntry($blogId);
$vars['errors'] = array('inserror');
return false;
}
if ($trip) {
$this->_model->setTripPosition($trip, $blogId);
}
if (!$this->_model->updateTags($blogId, explode(',', $vars['tags']))) {
$vars['errors'] = array('tagerror');
return false;
}
// 'Touch' the corresponding trip!
if ($trip) {
$TripModel = new Trip();
$TripModel->touchTrip($trip);
//.........这里部分代码省略.........
示例11: query
public function query($query)
{
if (PVars::get()->debug) {
$start_time = microtime(true);
}
$q = @mysql_query($query, $this->_dao->cr);
if (!$q) {
$e = new PException('MySQL error!', 1000);
$e->addInfo('Statement: ' . $query);
$e->addInfo($this->_dao->getErrNo());
$e->addInfo($this->_dao->getErrMsg());
throw $e;
}
$this->result = $q;
$this->pos = 0;
$q = PVars::get()->queries + 1;
PVars::register('queries', $q);
if (PVars::get()->debug) {
$q = PVars::get()->query_history;
$query_time = sprintf("%.1f", (microtime(true) - $start_time) * 1000);
$q[] = "({$query_time} ms) {$query}";
PVars::register('query_history', $q);
}
return true;
}
示例12: index
/**
*/
public function index()
{
$vw = new ViewWrap($this->_view);
$P = PVars::getObj('page');
// First check if the feature is closed
if ($_SESSION["Param"]->FeatureSearchPageIsClosed != 'No') {
$P->content = $this->_view->showFeatureIsClosed();
return;
}
// end of test "if feature is closed"
if (PPostHandler::isHandling()) {
return;
}
$request = PRequest::get()->request;
if (!isset($request[1])) {
$request[1] = '';
}
// Route quicksearch
if ($request[0] == 'quicksearch') {
$error = false;
// static pages
switch ($request[1]) {
case '':
$searchtext = isset($_GET["vars"]) ? $_GET['vars'] : '';
// Because of old way to use the QuickSearch with a get
break;
default:
$searchtext = $request[1];
break;
}
$TReturn = $this->_model->quicksearch($searchtext);
if (count($TReturn->TMembers) == 1 and count($TReturn->TPlaces) == 0 and count($TReturn->TForumTags) == 0) {
$loc = "members/" . $TReturn->TMembers[0]->Username;
header('Location: ' . $loc);
PPHP::PExit();
} else {
if (count($TReturn->TMembers) == 0 and count($TReturn->TPlaces) == 1 and count($TReturn->TForumTags) == 0) {
$loc = $TReturn->TPlaces[0]->link;
header('Location: ' . $loc);
PPHP::PExit();
} else {
if (count($TReturn->TMembers) == 0 and count($TReturn->TPlaces) == 0 and count($TReturn->TForumTags) == 1) {
$loc = "forums/t" . $TReturn->TForumTags[0]->IdTag;
header('Location: ' . $loc);
PPHP::PExit();
}
}
}
$P->content .= $vw->quicksearch_results($TReturn);
return $P;
}
if ($request[0] != 'searchmembers') {
header('Location: searchmembers');
PPHP::PExit();
}
// fix a problem with Opera javascript, which sends a 'searchmembers/searchmembers/ajax' request
if ($request[1] === 'searchmembers') {
$request = array_slice($request, 1);
}
// default mapstyle:
$mapstyle = 'mapon';
$queries = '';
$varsOnLoad = '';
$varsGet = '';
if (isset($request[1])) {
switch ($request[1]) {
case 'mapoff':
$mapstyle = "mapoff";
$_SESSION['SearchMembersTList'] = array();
break;
case 'mapon':
$mapstyle = "mapon";
$_SESSION['SearchMembersTList'] = array();
break;
case 'queries':
if (PVars::get()->debug) {
$R = MOD_right::get();
if ($R->HasRight("Debug", "DB_QUERY")) {
$queries = true;
$mapstyle = "mapoff";
}
}
break;
default:
if (isset($_SESSION['SearchMapStyle']) and $_SESSION['SearchMapStyle']) {
$mapstyle = $_SESSION['SearchMapStyle'];
}
break;
}
}
// Store the MapStyle in session
$_SESSION['SearchMapStyle'] = $mapstyle;
// Check wether there are latest search results and variables from the session
if (!$queries && isset($_SESSION['SearchMembersTList'])) {
if ($_SESSION['SearchMembersTList'] && $_SESSION['SearchMembersVars']) {
$varsOnLoad = $_SESSION['SearchMembersVars'];
}
}
//.........这里部分代码省略.........
示例13: registerMail
/**
* Sends a confirmation e-mail
*
* @param string $userId
*/
public function registerMail($userId)
{
$User = $this->_model->getUser($userId);
if (!$User) {
return false;
}
$handle = $User->handle;
$email = $User->email;
$key = APP_User::getSetting($userId, 'regkey');
if (!$key) {
return false;
}
$key = $key->value;
$confirmUrl = PVars::getObj('env')->baseuri . 'user/confirm/' . $handle . '/' . $key;
$registerMailText = array();
require SCRIPT_BASE . 'text/' . PVars::get()->lang . '/apps/user/register.php';
$from = $registerMailText['from_name'] . ' <' . PVars::getObj('config_mailAddresses')->registration . '>';
$subject = $registerMailText['subject'];
$Mail = new MOD_mail_Multipart();
$logoCid = $Mail->addAttachment(HTDOCS_BASE . 'images/logo.png', 'image/png');
ob_start();
require 'templates/register_html.php';
$mailHTML = ob_get_contents();
ob_end_clean();
$mailText = '';
require 'templates/register_plain.php';
$Mail->addMessage($mailText);
$Mail->addMessage($mailHTML, 'text/html');
$Mail->buildMessage();
$Mailer = Mail::factory(PVars::getObj('config_smtp')->backend, PVars::get()->config_smtp);
if (is_a($Mailer, 'PEAR_Error')) {
$e = new PException($Mailer->getMessage());
$e->addMessage($Mailer->getDebugInfo());
throw $e;
}
$rcpts = $email;
$header = $Mail->header;
$header['From'] = $from;
$header['To'] = $email;
$header['Subject'] = $subject;
$header['Message-Id'] = '<reg' . $userId . '.' . sha1(uniqid(rand())) . '@myTravelbook>';
$r = @$Mailer->send($rcpts, $header, $Mail->message);
if (is_object($r) && is_a($r, 'PEAR_Error')) {
$e = new PException($r->getMessage());
$e->addInfo($r->getDebugInfo());
throw $e;
}
}
示例14: prepareForum
/**
* Fetch all required data for the view to display a forum
* this data are stored in $this->board
*/
public function prepareForum($showsticky = true)
{
if (!$this->geonameid && !$this->countrycode && !$this->continent && !$this->IdGroup) {
if ($this->TopMode == Forums::CV_TOPMODE_CATEGORY) {
$this->boardTopLevelCategories();
} elseif ($this->TopMode == Forums::CV_TOPMODE_LASTPOSTS) {
$this->boardTopLevelLastPosts($showsticky);
} elseif ($this->TopMode == Forums::CV_TOPMODE_LANDING) {
$this->boardTopLevelLanding($showsticky);
} elseif ($this->TopMode == Forums::CV_TOPMODE_FORUM) {
$this->boardTopLevelForum($showsticky);
} elseif ($this->TopMode == Forums::CV_TOPMODE_GROUPS) {
$this->boardTopLevelGroups($showsticky);
} else {
$this->boardTopLevelLanding($showsticky);
}
} else {
if ($this->continent && !$this->geonameid && !$this->countrycode) {
$this->boardContinent();
} else {
if ($this->IdGroup) {
$this->boardGroup($showsticky);
} else {
if (isset($this->admincode) && $this->admincode && $this->continent && $this->countrycode && !$this->geonameid) {
$this->boardadminCode();
} else {
if ($this->continent && $this->countrycode && !$this->geonameid) {
$this->boardCountry();
} else {
if ($this->continent && $this->countrycode && $this->geonameid && isset($this->admincode) && $this->admincode) {
$this->boardLocation();
} else {
if (PVars::get()->debug) {
throw new PException('Invalid Request');
} else {
PRequest::home();
}
}
}
}
}
}
}
}
示例15: translator_block
protected function translator_block()
{
if (MOD_right::get()->hasRight("Words", PVars::get()->lang)) {
?>
<div id="translator" class="float_right"><?php
$request_string = implode('/', PVars::get()->request);
$rox_tr = PVars::getObj("env")->baseuri . "rox/tr_mode";
$words = new MOD_words();
switch ($words->getTrMode()) {
case 'translate':
?>
<a href="<?php
echo $rox_tr;
?>
/browse/<?php
echo $request_string;
?>
">browse</a>
<strong>translate</strong>
<a href="<?php
echo $rox_tr;
?>
/edit/<?php
echo $request_string;
?>
">edit</a>
<?php
break;
case 'edit':
?>
<a href="<?php
echo $rox_tr;
?>
/browse/<?php
echo $request_string;
?>
">browse</a>
<a href="<?php
echo $rox_tr;
?>
/translate/<?php
echo $request_string;
?>
">translate</a>
<strong>edit</strong>
<?php
break;
default:
case 'browse':
?>
<strong>browse</strong>
<a href="<?php
echo $rox_tr;
?>
/translate/<?php
echo $request_string;
?>
">translate</a>
<a href="<?php
echo $rox_tr;
?>
/edit/<?php
echo $request_string;
?>
">edit</a>
<?php
break;
}
?>
</div><?php
}
}