本文整理汇总了PHP中getRequestURI函数的典型用法代码示例。如果您正苦于以下问题:PHP getRequestURI函数的具体用法?PHP getRequestURI怎么用?PHP getRequestURI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRequestURI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load_request
static function load_request($allow)
{
$uri = getRequestURI();
$parts = explode('?', $uri);
$uri = $parts[0];
$path = ltrim(substr($uri, strlen(WEBPATH) + 1), '/');
if (empty($path)) {
return $allow;
} else {
$rest = strpos($path, '/');
if ($rest === false) {
if (strpos($path, '?') === 0) {
// only a parameter string
return $allow;
}
$l = $path;
} else {
$l = substr($path, 0, $rest);
}
}
$locale = validateLocale($l, 'seo_locale');
if ($locale) {
// set the language cookie and redirect to the "base" url
zp_setCookie('dynamic_locale', $locale);
$uri = pathurlencode(preg_replace('|/' . $l . '[/$]|', '/', $uri));
if (isset($parts[1])) {
$uri .= '?' . $parts[1];
}
header("HTTP/1.0 302 Found");
header("Status: 302 Found");
header('Location: ' . $uri);
exitZP();
}
return $allow;
}
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:35,代码来源:seo_locale.php
示例2: imageError
/**
* If in debug mode, prints the given error message and continues; otherwise redirects
* to the given error message image and exits; designed for a production gallery.
* @param $errormessage string the error message to print if $_GET['debug'] is set.
* @param $errorimg string the filename of the error image to display for production. Defaults
* to 'err-imagegeneral.png'. Images should be located in /zen/images .
*/
function imageError($status_text, $errormessage, $errorimg = 'err-imagegeneral.png')
{
global $newfilename, $album, $image;
$debug = isset($_GET['debug']);
if ($debug) {
echo '<strong>' . sprintf(gettext('Zenphoto Image Processing Error: %s'), $errormessage) . '</strong>' . '<br /><br />' . sprintf(gettext('Request URI: [ <code>%s</code> ]'), html_encode(getRequestURI())) . '<br />PHP_SELF: [ <code>' . html_encode($_SERVER['PHP_SELF']) . '</code> ]' . (empty($newfilename) ? '' : '<br />' . sprintf(gettext('Cache: [<code>%s</code>]'), '/' . CACHEFOLDER . '/' . html_encode(sanitize($newfilename, 3))) . ' ') . (empty($image) || empty($album) ? '' : ' <br />' . sprintf(gettext('Image: [<code>%s</code>]'), html_encode(sanitize($album . '/' . $image, 3))) . ' <br />');
} else {
if (DEBUG_IMAGE_ERR) {
trigger_error($errormessage, E_USER_NOTICE);
}
header("HTTP/1.0 {$status_text}");
header("Status: {$status_text}");
header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/images/' . $errorimg);
}
exitZP();
}
开发者ID:rb26,项目名称:zenphoto,代码行数:23,代码来源:functions-image.php
示例3: imageError
/**
* If in debug mode, prints the given error message and continues; otherwise redirects
* to the given error message image and exits; designed for a production gallery.
* @param $errormessage string the error message to print if $_GET['debug'] is set.
* @param $errorimg string the filename of the error image to display for production. Defaults
* to 'err-imagegeneral.png'. Images should be located in /zen/images .
*/
function imageError($status_text, $errormessage, $errorimg = 'err-imagegeneral.png')
{
global $newfilename, $album, $image;
$debug = isset($_GET['debug']);
$err = sprintf(gettext('Image Processing Error: %s'), $errormessage);
if ($debug) {
echo '<strong>' . $err . '</strong>';
} else {
if (DEBUG_IMAGE) {
$msg = $err . "\n\t\t" . sprintf(gettext('Request URI: [%s]'), getRequestURI()) . "\n\t\t" . 'PHP_SELF: [' . sanitize($_SERVER['PHP_SELF'], 3) . ']';
if ($newfilename) {
$msg .= "\n\t\t" . sprintf(gettext('Cache: [%s]'), '/' . CACHEFOLDER . '/' . sanitize($newfilename, 3));
}
if ($image || $album) {
$msg .= "\n\t\t" . sprintf(gettext('Image: [%s]'), sanitize($album . '/' . $image, 3));
}
debugLog($msg);
}
header("HTTP/1.0 {$status_text}");
header("Status: {$status_text}");
header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/images/' . $errorimg);
}
exitZP();
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:functions-image.php
示例4: printTabs
printTabs();
?>
<div id="content">
<h1><?php
echo gettext('Zenphoto License agreement');
?>
</h1>
<div id="container">
<p class="notebox">
<?php
printf(gettext('This license is in English because the <em>Free Software Foundation</em> does not approve translations as officially valid. Unofficial translations are available <a href="%s">here</a>.'), 'http://www.gnu.org/licenses/old-licenses/gpl-2.0-translations.html');
?>
</p>
<?php
if (!getOption('license_accepted')) {
$_SESSION['license_return'] = getRequestURI();
?>
<p class="buttons">
<a href="<?php
echo FULLWEBPATH . '/' . ZENFOLDER . '/license.php?licenseAccept&XSRFToken=' . getXSRFToken('ZenphotoLicense');
?>
" alt="<?php
echo gettext('You must accept this license to continue to use Zenphoto.');
?>
"><?php
echo gettext('I agree to these terms and conditions');
?>
</a>
</p>
<br class="clearall" />
<?php
开发者ID:rb26,项目名称:zenphoto,代码行数:31,代码来源:license.php
示例5: printLanguageSelector
/**
* prints a form for selecting a locale
* The POST handling is by getUserLocale() called in functions.php
*
*/
function printLanguageSelector($flags = NULL)
{
$languages = generateLanguageList();
if (isset($_REQUEST['locale'])) {
$locale = sanitize($_REQUEST['locale']);
if (getOption('locale') != $locale) {
?>
<div class="errorbox">
<h2>
<?php
printf(gettext('<em>%s</em> is not available.'), html_encode($locale));
?>
<?php
printf(gettext('The locale %s is not supported on your server.'), html_encode($locale));
?>
<br />
<?php
echo gettext('See the troubleshooting guide on zenphoto.org for details.');
?>
</h2>
</div>
<?php
}
}
if (is_null($flags)) {
$flags = getOption('dynamic_locale_visual');
}
if ($flags) {
asort($languages);
?>
<ul class="flags">
<?php
$currentValue = getOption('locale');
$request = parse_url(getRequestURI());
$separator = '?';
if (isset($request['query'])) {
$query = explode('&', $request['query']);
$uri['query'] = '';
foreach ($query as $key => $str) {
if (preg_match('/^locale\\s*=/', $str)) {
unset($query[$key]);
}
}
if (empty($query)) {
unset($request['query']);
} else {
$request['query'] = implode('&', $query);
$separator = '&';
}
}
$uri = $request['path'];
if (isset($request['query'])) {
$uri .= '?' . $request['query'];
}
foreach ($languages as $text => $lang) {
?>
<li<?php
if ($lang == $currentValue) {
echo ' class="currentLanguage"';
}
?>
>
<?php
if ($lang != $currentValue) {
switch (LOCALE_TYPE) {
case 2:
?>
<a href="<?php
echo dynamic_locale::fullHostPath($lang) . html_encode($uri);
?>
" >
<?php
break;
case 1:
?>
<a href="<?php
echo str_replace(WEBPATH, seo_locale::localePath(false, $lang), html_encode($uri));
?>
" >
<?php
break;
default:
?>
<a href="<?php
echo $uri . $separator;
?>
locale=<?php
echo $lang;
?>
" >
<?php
break;
}
}
$flag = getLanguageFlag($lang);
//.........这里部分代码省略.........
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:101,代码来源:dynamic-locale.php
示例6: printFeed
/**
* Prints the feed xml
*
*/
public function printFeed()
{
global $_zp_gallery;
$feeditems = $this->getitems();
if (is_array($feeditems)) {
header('Content-Type: application/xml');
?>
<external version="1.0" >
<?php
if ($this->key) {
$key = md5($this->key . serialize($_SERVER));
query('UPDATE ' . prefix('plugin_storage') . ' SET `data`=' . db_quote($key) . ' WHERE `type`="externalFeed" AND `data`=' . db_quote($this->key));
?>
<accesskey><?php
echo $key;
?>
</accesskey>
<?php
}
?>
<channel>
<link href="<?php
echo PROTOCOL;
?>
://<?php
echo $this->host;
echo html_encode(getRequestURI());
?>
" />
<language><?php
echo $this->locale_xml;
?>
</language>
<?php
foreach ($feeditems as $feeditem) {
switch ($this->feedtype) {
case 'gallery':
$item = $this->getItemGallery($feeditem);
break;
case 'news':
$item = $this->getItemNews($feeditem);
break;
case 'pages':
$item = $this->getitemPages($feeditem, getOption('externalFeed_truncate_length'));
break;
case 'comments':
$item = $this->getitemComments($feeditem);
break;
default:
$item = $feeditem;
break;
}
?>
<item>
<title><![CDATA[<?php
echo $item['title'];
?>
]]></title>
<link><?php
echo PROTOCOL . '://' . $_SERVER['HTTP_HOST'] . WEBPATH . '/' . html_encode(ltrim($item['link'], '/'));
?>
</link>
<description><![CDATA[<?php
echo $item['desc'];
?>
]]></description>
<?php
if (!empty($item['enclosure'])) {
echo $item['enclosure'] . "\n";
//prints xml as well
}
if (!empty($item['category'])) {
?>
<category><![CDATA[<?php
echo $item['category'];
?>
]]></category>
<?php
}
if (!empty($item['media_content'])) {
echo $item['media_content'] . "\n";
//prints xml as well
}
if (!empty($item['media_thumbnail'])) {
echo $item['media_thumbnail'] . "\n";
//prints xml as well
}
?>
<pubDate><?php
echo $item['pubdate'];
?>
</pubDate>
</item>
<?php
}
//.........这里部分代码省略.........
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:101,代码来源:externalFeed.php
示例7: getHTMLMetaData
/**
* Prints html meta data to be used in the <head> section of a page
*
*/
static function getHTMLMetaData()
{
global $_zp_gallery, $_zp_galley_page, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery_page, $_zp_current_category, $_zp_authority, $_zp_conf_vars, $_myFavorites, $htmlmetatags_need_cache, $_zp_page;
zp_register_filter('image_processor_uri', 'htmlmetatags::ipURI');
$host = sanitize("http://" . $_SERVER['HTTP_HOST']);
$url = $host . getRequestURI();
// Convert locale shorttag to allowed html meta format
$locale = str_replace("_", "-", getUserLocale());
$canonicalurl = '';
// generate page title, get date
$pagetitle = "";
// for gallery index setup below switch
$date = strftime(DATE_FORMAT);
// if we don't have a item date use current date
$desc = getBareGalleryDesc();
$thumb = '';
if (getOption('htmlmeta_sitelogo')) {
$thumb = getOption('htmlmeta_sitelogo');
}
if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
$ogimage_width = getOption('htmlmeta_ogimage_width');
$ogimage_height = getOption('htmlmeta_ogimage_height');
if (empty($ogimage_width)) {
$ogimage_width = 1280;
}
if (empty($ogimage_height)) {
$ogimage_height = 900;
}
}
$type = 'article';
switch ($_zp_gallery_page) {
case 'index.php':
$desc = getBareGalleryDesc();
//$canonicalurl = $host . getGalleryIndexURL();
$canonicalurl = $host . getPageNumURL($_zp_page);
$type = 'website';
break;
case 'album.php':
$pagetitle = getBareAlbumTitle() . " - ";
$date = getAlbumDate();
$desc = getBareAlbumDesc();
$canonicalurl = $host . getPageNumURL($_zp_page);
if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
$thumbimg = $_zp_current_album->getAlbumThumbImage();
getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
$thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL)));
}
break;
case 'image.php':
$pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - ";
$date = getImageDate();
$desc = getBareImageDesc();
$canonicalurl = $host . getImageURL();
if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
$thumb = $host . html_encode(pathurlencode(getCustomSizedImageMaxSpace($ogimage_width, $ogimage_height)));
}
break;
case 'news.php':
if (function_exists("is_NewsArticle")) {
if (is_NewsArticle()) {
$pagetitle = getBareNewsTitle() . " - ";
$date = getNewsDate();
$desc = trim(getBare(getNewsContent()));
$canonicalurl = $host . $_zp_current_zenpage_news->getLink();
} else {
if (is_NewsCategory()) {
$pagetitle = $_zp_current_category->getTitlelink() . " - ";
$date = strftime(DATE_FORMAT);
$desc = trim(getBare($_zp_current_category->getDesc()));
$canonicalurl = $host . $_zp_current_category->getLink();
$type = 'category';
} else {
$pagetitle = gettext('News') . " - ";
$desc = '';
$canonicalurl = $host . getNewsIndexURL();
$type = 'website';
}
}
if ($_zp_page != 1) {
$canonicalurl .= '/' . $_zp_page;
}
}
break;
case 'pages.php':
$pagetitle = getBarePageTitle() . " - ";
$date = getPageDate();
$desc = trim(getBare(getPageContent()));
$canonicalurl = $host . $_zp_current_zenpage_page->getLink();
break;
default:
// for all other possible static custom pages
$custompage = stripSuffix($_zp_gallery_page);
$standard = array('contact' => gettext('Contact'), 'register' => gettext('Register'), 'search' => gettext('Search'), 'archive' => gettext('Archive view'), 'password' => gettext('Password required'));
if (is_object($_myFavorites)) {
$standard['favorites'] = gettext('My favorites');
}
//.........这里部分代码省略.........
开发者ID:rb26,项目名称:zenphoto,代码行数:101,代码来源:html_meta_tags.php
示例8: getPageRedirect
/**
* Returns a redirection link for the password form
*
* @return string
*/
function getPageRedirect()
{
global $_zp_login_error, $_zp_password_form_printed, $_zp_current_search, $_zp_gallery_page, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news;
switch ($_zp_gallery_page) {
case 'index.php':
$action = '/index.php';
break;
case 'album.php':
$action = '/index.php?userlog=1&album=' . pathurlencode($_zp_current_album->name);
break;
case 'image.php':
$action = '/index.php?userlog=1&album=' . pathurlencode($_zp_current_album->name) . '&image=' . urlencode($_zp_current_image->filename);
break;
case 'pages.php':
$action = '/index.php?userlog=1&p=pages&title=' . urlencode(getPageTitlelink());
break;
case 'news.php':
$action = '/index.php?userlog=1&p=news';
if (!is_null($_zp_current_zenpage_news)) {
$action .= '&title=' . urlencode($_zp_current_zenpage_news->getTitlelink());
}
break;
case 'password.php':
$action = str_replace(SEO_WEBPATH, '', getRequestURI());
if ($action == '/' . _PAGE_ . '/password' || $action == '/index.php?p=password') {
$action = '/index.php';
}
break;
default:
if (in_context(ZP_SEARCH)) {
$action = '/index.php?userlog=1&p=search' . $_zp_current_search->getSearchParams();
} else {
$action = '/index.php?userlog=1&p=' . substr($_zp_gallery_page, 0, -4);
}
}
return SEO_WEBPATH . $action;
}
开发者ID:IliyanGochev,项目名称:zenphoto,代码行数:42,代码来源:template-functions.php
示例9: preg_replace
<?php
/**
* Form for registering users
*
* @package plugins
* @subpackage users
*/
Zenphoto_Authority::printPasswordFormJS();
$action = preg_replace('/\\?verify=(.*)/', '', getRequestURI());
?>
<div id="registration_form">
<form action="<?php
echo $action;
?>
" method="post" autocomplete="off">
<input type="hidden" name="register_user" value="yes" />
<p style="display:none;">
<label for="username"><?php
echo gettext("Username* (this will be your user username)");
?>
</label>
<input type="text" id="username" name="username" value="" size="<?php
echo TEXT_INPUT_SIZE;
?>
" />
</p>
<p>
<label for="adminuser">
<?php
if ($emailid = getOption('register_user_email_is_id')) {
开发者ID:rb26,项目名称:zenphoto,代码行数:31,代码来源:register_user_form.php
示例10: ad_removeButton
static function ad_removeButton($obj, $id, $v, $add, $instance, $multi)
{
global $_myFavorites;
$table = $obj->table;
if ($v) {
$tag = '_add';
} else {
$tag = '_remove';
}
if ($instance && $multi) {
$add .= '[' . $instance . ']';
}
?>
<form name="<?php
echo $table . $obj->getID();
?>
Favorites_<?php
echo $instance . $tag;
?>
" class = "<?php
echo $table;
?>
Favorites<?php
echo $tag;
?>
" action = "<?php
echo html_encode(getRequestURI());
?>
" method = "post" accept-charset = "UTF-8">
<input type = "hidden" name = "addToFavorites" value = "<?php
echo $v;
?>
" />
<input type = "hidden" name = "type" value = "<?php
echo html_encode($table);
?>
" />
<input type = "hidden" name = "id" value = "<?php
echo html_encode($id);
?>
" />
<input type = "submit" class = "button buttons" value = "<?php
echo $add;
?>
" title = "<?php
echo $add;
?>
"/>
<?php
if ($v) {
if ($multi) {
?>
<span class="tagSuggestContainer">
<input type="text" name="instance" class="favorite_instance" value="" />
</span>
<?php
}
} else {
?>
<input type="hidden" name="instance" value="<?php
echo $_myFavorites->instance;
?>
" />
<?php
}
?>
</form>
<?php
}
开发者ID:rb26,项目名称:zenphoto,代码行数:69,代码来源:favoritesClass.php
示例11: httpsRedirect
/**
*
* Checks if protocol not https and redirects if https required
*/
function httpsRedirect()
{
if (defined('SERVER_PROTOCOL') && SERVER_PROTOCOL == 'https_admin') {
// force https login
if (!isset($_SERVER["HTTPS"])) {
$redirect = "https://" . $_SERVER['HTTP_HOST'] . getRequestURI();
header("Location:{$redirect}");
exitZP();
}
}
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:15,代码来源:admin-functions.php
示例12: controlLink
/**
*
* places a selector so a user may change thems
* @param string $text link text
*/
static function controlLink($textIn = NULL)
{
global $_zp_gallery, $_themeSwitcherThemelist, $_zp_gallery_page;
if (self::active()) {
$themes = array();
foreach ($_zp_gallery->getThemes() as $theme => $details) {
if ($_themeSwitcherThemelist[$theme]) {
if (getPlugin($_zp_gallery_page, $theme)) {
$themes[$details['name']] = $theme;
}
}
}
$text = $textIn;
if (empty($text)) {
$text = gettext('Theme');
}
$reloc = pathurlencode(trim(preg_replace('~themeSwitcher=.*?&~', '', getRequestURI() . '&'), '?&'));
if (strpos($reloc, '?')) {
$reloc .= '&themeSwitcher=%t';
} else {
$reloc .= '?themeSwitcher=%t';
}
$theme = $_zp_gallery->getCurrentTheme();
$icon = zp_apply_filter('iconColor', getPlugin('themeSwitcher/menu.png', true, true));
?>
<div class="themeSwitcherMenuMain themeSwitcherMenu themeSwitcherControl">
<img src="<?php
echo $icon;
?>
" onclick="$('.themeSwitcherControl').toggle();" title="<?php
echo gettext('Switch themes');
?>
" />
</div>
<div class="themeSwitcherControlLink themeSwitcherControl" style="display:none;">
<div class="themeSwitcherMenu">
<img src="<?php
echo WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER;
?>
/themeSwitcher/menu.png" onclick="$('.themeSwitcherControl').toggle();" title="<?php
echo gettext('Close');
?>
" />
</div>
<?php
echo $text;
?>
<select name="themeSwitcher" id="themeSwitcher" onchange="switchTheme('<?php
echo html_encode($reloc);
?>
')" title="<?php
echo gettext("Themes will not show in this list if selecting them would result in a “not found” error.");
?>
">
<?php
generateListFromArray(array($theme), $themes, false, true);
?>
</select>
<?php
zp_apply_filter('themeSwitcher_Controllink', $theme);
?>
</div>
<?php
}
return $textIn;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:71,代码来源:themeSwitcher.php
示例13: rewriteHandler
/**
* "Rewrite" handling for zenphoto
*
* The basic rules are found in the zenphoto-rewrite.txt file. Additional rules can be provided by plugins. But
* for the plugin to load in time for the rules to be seen it must be either a CLASS_PLUGIN or a FEATURE_PLUGIN.
* Plugins add rules by inserting them into the $_zp_conf_vars['special_pages'] array. Each "rule" is an array
* of three elements: <var>define</var>, <var>rewrite</var>, and (optionally) <var>rule</rule>.
*
* Elemments which have a <var>define</var> and no <var>rule</rule> are processed by rewrite rules in the
* zenphoto-rewrite.txt file and the <var>define</var> is used internally to zenphoto to reference
* the rewrite text when building links.
*
* Elements with a <var>rule</rule> defined are processed after Search, Pages, and News rewrite rules and before
* Image and album rewrite rules. The tag %REWRITE% in the rule is replaced with the <var>rewrite</var> text
* before processing the rule. Thus <var>rewrite</var> is the token that should appear in the acutal URL.
*
* It makes no sense to have an element without either a <var>define</var> or a <var>rule</rule> as nothing will happen.
*
* At present all rules are presumed to to stop processing the rule set. Historically that is what all our rules have done, but I suppose
* we could change that. The "R" flag may be used to cause a <var>header</var> status to be sent. However, we do not redirect
* back to index.php, so the "R" flag is only useful if the target is a different script.
*
* @author Stephen Billard (sbillard)
*
* @package admin
*/
function rewriteHandler()
{
global $_zp_conf_vars, $_zp_rewritten;
$_zp_rewritten = false;
$definitions = array();
// query parameters should already be loaded into the $_GET and $_REQUEST arrays, so we discard them here
$request = explode('?', getRequestURI());
//rewrite base
$requesturi = ltrim(substr($request[0], strlen(WEBPATH)), '/');
list($definitions, $rules) = getRules();
//process the rules
foreach ($rules as $rule) {
if ($rule = trim($rule)) {
if ($rule[0] != '#') {
if (preg_match('~^rewriterule~i', $rule)) {
// it is a rewrite rule, see if it is applicable
$rule = strtr($rule, $definitions);
preg_match('~^rewriterule\\s+(.*?)\\s+(.*?)\\s*\\[(.*)\\]$~i', $rule, $matches);
if (array_key_exists(1, $matches)) {
if (preg_match('~' . $matches[1] . '~', $requesturi, $subs)) {
$params = array();
// setup the rule replacement values
foreach ($subs as $key => $sub) {
$params['$' . $key] = urlencode($sub);
// parse_str is going to decode the string!
}
// parse rewrite rule flags
$flags = array();
$banner = explode(',', strtoupper($matches[3]));
foreach ($banner as $flag) {
$flag = strtoupper(trim($flag));
$f = explode('=', $flag);
$flags[trim($f[0])] = isset($f[1]) ? trim($f[1]) : NULL;
}
if (!array_key_exists('QSA', $flags)) {
// QSA means merge the query parameters. Otherwise we clear them
$_REQUEST = array_diff($_REQUEST, $_GET);
$_GET = array();
}
preg_match('~(.*?)\\?(.*)~', $matches[2], $action);
if (empty($action)) {
$action[1] = $matches[2];
}
if (array_key_exists(2, $action)) {
// process the rules replacements
$query = strtr($action[2], $params);
parse_str($query, $gets);
$_GET = array_merge($_GET, $gets);
$_REQUEST = array_merge($_REQUEST, $gets);
}
// we will execute the index.php script in due course. But if the rule
// action takes us elsewhere we will have to re-direct to that script.
if (isset($action[1]) && $action[1] != 'index.php') {
$qs = http_build_query($_GET);
if ($qs) {
$qs = '?' . $qs;
}
if (array_key_exists('R', $flags)) {
header('Status: ' . $flags['R']);
}
header('Location: ' . WEBPATH . '/' . $action[1] . $qs);
exit;
}
$_zp_rewritten = true;
break;
}
} else {
zp_error(sprintf(gettext('Error processing rewrite rule: “%s”'), trim(preg_replace('~^rewriterule~i', '', $rule))), E_USER_WARNING);
}
} else {
if (preg_match('~define\\s+(.*?)\\s*\\=\\>\\s*(.*)$~i', $rule, $matches)) {
// store definitions
eval('$definitions[$matches[1]] = ' . $matches[2] . ';');
}
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:rewrite.php
示例14: print404status
function print404status()
{
global $_404_data;
list($album, $image, $galleryPage, $theme, $page) = $_404_data;
if (DEBUG_404) {
$list = explode('/', $album);
if (array_shift($list) != 'cache') {
$target = getRequestURI();
if (!in_array($target, array(WEBPATH . '/favicon.ico', WEBPATH . '/zp-data/tést.jpg'))) {
$output = "404 error details\n\t\t\tSERVER:\n";
foreach (array('REQUEST_URI', 'HTTP_REFERER', 'REMOTE_ADDR', 'REDIRECT_STATUS') as $key) {
if (is_null(@$_SERVER[$key])) {
$value = 'NULL';
} else {
$value = "'{$_SERVER[$key]}'";
}
$output .= "\t\t\t\t\t{$key}\t=>\t{$value}\n";
}
$output .= "\t\t\tREQUEST:\n";
$request = $_REQUEST;
$request['theme'] = $theme;
if (!empty($image)) {
$request['image'] = $image;
}
foreach ($request as $key => $value) {
$output .= "\t\t\t\t\t{$key}\t=>\t'{$value}'\n";
}
debugLog($output);
}
}
}
echo "\n<strong>" . gettext("Error:</strong> the requested object was not found.");
if ($album) {
echo '<br />' . sprintf(gettext('Album: %s'), html_encode($album));
if ($image) {
echo '<br />' . sprintf(gettext('Image: %s'), html_encode($image));
}
} else {
echo '<br />' . sprintf(gettext('Page: %s'), html_encode(substr(basename($galleryPage), 0, -4)));
}
if ($page > 1) {
echo '/' . $page;
}
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:44,代码来源:template-functions.php
示例15: printRegistrationForm
/**
* Parses the verification and registration if they have occurred
* places the user registration form
*
* @param string $thanks the message shown on successful registration
*/
function printRegistrationForm($thanks = NULL)
{
global $admin_e, $admin_n, $user, $_zp_authority, $_zp_captcha, $_zp_gallery, $_notify, $_link, $_message;
require_once SERVERPATH . '/' . ZENFOLDER . '/admin-functions.php';
$userobj = NULL;
// handle any postings
if (isset($_GET['verify'])) {
$currentadmins = $_zp_authority->getAdministrators();
$params = unserialize(pack("H*", trim(sanitize($_GET['verify']), '.')));
// expung the verify query string as it will cause us to come back here if login fails.
unset($_GET['verify']);
$_link = explode('?', getRequestURI());
$p = array();
if (isset($_link[1])) {
$p = explode('&', $_link[1]);
foreach ($p as $k => $v) {
if (strpos($v, 'verify=') === 0) {
unset($p[$k]);
}
}
unset($p['verify']);
}
$_SERVER['REQUEST_URI'] = $_link[0];
if (!empty($p)) {
$_SERVER['REQUEST_URI'] .= '?' . implode('&', $p);
}
$userobj = $_zp_authority->getAnAdmin(array('`user`=' => $params['user'], '`valid`=' => 1));
if ($userobj && $userobj->getEmail() == $params['email']) {
if (!$userobj->getRights()) {
$userobj->setCredentials(array('registered', 'user', 'email'));
$rights = getOption('register_user_user_rights');
$group = NULL;
if (!is_numeric($rights)) {
// a group or template
$admin = $_zp_authority->getAnAdmin(array('`user`=' => $rights, '`valid`=' => 0));
if ($admin) {
$userobj->setObjects($admin->getObjects());
if ($admin->getName() != 'template') {
$group = $rights;
}
$rights = $admin->getRights();
} else {
$rights = NO_RIGHTS;
}
}
$userobj->setRights($rights | NO_RIGHTS);
$userobj->setGroup($group);
zp_apply_filter('register_user_verified', $userobj);
if (getOption('register_user_notify')) {
$_notify = zp_mail(gettext('ZenPhoto20 Gallery registration'), sprintf(gettext('%1$s (%2$s) has registered for the zenphoto gallery providing an e-mail address of %3$s.'), $userobj->getName(), $userobj->getUser(), $userobj->getEmail()));
}
if (empty($_notify)) {
if (getOption('register_user_create_album')) {
$userobj->createPrimealbum();
}
$_notify = 'verified';
$_POST['user'] = $userobj->getUser();
}
$userobj->save();
} else {
$_notify = 'already_verified';
}
} else {
$_notify = 'not_verified';
// User ID no longer exists
}
}
if (isset($_GET['login'])) {
//presumably the user failed to login....
$_notify = 'loginfailed';
}
if (zp_loggedin()) {
if (isset($_GET['login'])) {
echo '<meta http-equiv="refresh" content="1; url=' . WEBPATH . '/">';
} else {
echo '<div class="errorbox fade-message">';
echo '<h2>' . gettext("you are already logged in.") . '</h2>';
echo '</div>';
}
return;
}
if (isset($_GET['login'])) {
//presumably the user failed to login....
$_notify = 'loginfailed';
}
if (!empty($_notify)) {
switch ($_notify) {
case 'verified':
if (is_null($thanks)) {
$thanks = gettext("Thank you for registering.");
}
?>
<div class="Messagebox fade-message">
<p><?php
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:register_user.php
示例16: fix_path_redirect
/**
* Checks to see if the current URL is a query string url when mod_rewrite is active.
* If so it will redirects to the rewritten URL with a 301 Moved Permanently.
*/
function fix_path_redirect()
{
if (MOD_REWRITE) {
$request_uri = getRequestURI(false);
$parts = parse_url($request_uri);
$redirectURL = NULL;
if (isset($parts['path'])) {
// don't know how this can happen, but if it does, don't redirect
if (isset($parts['query'])) {
parse_str($parts['query'], $query);
$redirectURL = zpRewriteURL($query);
} else {
$query = array();
}
if (isset($_GET['album'])) {
if (isset($_GET['image'])) {
//image URLs should not end in a slash
if (substr($parts['path'], -1, 1) == '/') {
$redirectURL = zpRewriteURL($_GET);
}
} else {
//album URLs should end in a slash for consistency
if (substr($parts['path'], -1, 1) != '/') {
$redirectURL = zpRewriteURL($_GET);
}
}
}
if (isset($_GET['p'])) {
switch ($_GET['p']) {
case 'news':
if (isset($_GET['title'])) {
//article URLs should not end in slash
if (substr($parts['path'], -1, 1) == '/') {
$redirectURL = zpRewriteURL($_GET);
}
} else {
//should be news/
if (substr($parts['path'], -1, 1) != '/') {
$redirectURL = zpRewriteURL($_GET);
}
}
break;
case 'search':
if (isset($_GET['date'])) {
if (substr($parts['path'], -1, 1) != '/') {
$redirectURL = zpRewriteURL($_GET);
}
}
break;
}
}
//page numbers do not have trailing slash
if (isset($_GET['page'])) {
if (substr($parts['path'], -1, 1) == '/') {
$redirectURL = zpRewriteURL($_GET);
}
}
if ($redirectURL) {
$parts2 = parse_url($redirectURL);
if (isset($parts2['query'])) {
parse_str($parts2['query'], $query2);
} else {
$query2 = array();
}
if ($query != $query2 || preg_replace('~^' . WEBPATH . '/~', '', $parts['path']) != preg_replace('~^' . WEBPATH . '/~', '', html_encode($parts['path']))) {
header("HTTP/1.0 301 Moved Permanently");
header("Status: 301 Moved Permanently");
header('Location: ' . FULLWEBPATH . '/' . preg_replace('~^' . WEBPATH . '/~', '', $redirectURL));
exitZP();
}
}
}
}
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:78,代码来源:functions-controller.php
示例17: printDownloadAlbumZipURL
|
请发表评论