summaryrefslogtreecommitdiff
path: root/inc/common.php
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2009-11-04 11:01:15 +0100
committerAdrian Lang <lang@cosmocode.de>2009-11-04 11:01:15 +0100
commitc66972f2cb89e65a8bbf8e39d42e8e479f7eb8dc (patch)
tree3d20030c333e987b42ff101ec339f2120f9f5883 /inc/common.php
parent1378fb56f6873b93fe002e8aed001e92857b5b5c (diff)
downloadrpg-c66972f2cb89e65a8bbf8e39d42e8e479f7eb8dc.tar.gz
rpg-c66972f2cb89e65a8bbf8e39d42e8e479f7eb8dc.tar.bz2
Emit less E_NOTICEs and E_STRICTs
Changes of behaviour are: * Allow the user name, title & description \e2\80\9c0\e2\80\9d * Default to Port 443 if using HTTPS * Set $INFO['isadmin'] and $INFO['ismanager'] to \e2\80\9cfalse\e2\80\9d even if no user is logged in * Do not pass empty fragment field in the event data for event ACTION_SHOW_REDIRECT * Handle chunked encoding in HTTPClient darcs-hash:20091104100115-e4919-5cf6397d4a457e3f98a8ca49fbdab03f2147721d.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/inc/common.php b/inc/common.php
index a15cb5c62..40af3c9db 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -111,16 +111,16 @@ function pageinfo(){
$info['id'] = $ID;
$info['rev'] = $REV;
- if($_SERVER['REMOTE_USER']){
+ // set info about manager/admin status.
+ $info['isadmin'] = false;
+ $info['ismanager'] = false;
+ if(isset($_SERVER['REMOTE_USER'])){
$info['userinfo'] = $USERINFO;
$info['perm'] = auth_quickaclcheck($ID);
$info['subscribed'] = is_subscribed($ID,$_SERVER['REMOTE_USER'],false);
$info['subscribedns'] = is_subscribed($ID,$_SERVER['REMOTE_USER'],true);
$info['client'] = $_SERVER['REMOTE_USER'];
- // set info about manager/admin status
- $info['isadmin'] = false;
- $info['ismanager'] = false;
if($info['perm'] == AUTH_ADMIN){
$info['isadmin'] = true;
$info['ismanager'] = true;
@@ -275,12 +275,9 @@ function breadcrumbs(){
global $ID;
global $ACT;
global $conf;
- $crumbs = $_SESSION[DOKU_COOKIE]['bc'];
//first visit?
- if (!is_array($crumbs)){
- $crumbs = array();
- }
+ $crumbs = isset($_SESSION[DOKU_COOKIE]['bc']) ? $_SESSION[DOKU_COOKIE]['bc'] : array();
//we only save on show and existing wiki documents
$file = wikiFN($ID);
if($ACT != 'show' || !@file_exists($file)){
@@ -1130,11 +1127,14 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){
* @author Todd Augsburger <todd@rollerorgans.com>
*/
function getGoogleQuery(){
+ if (!isset($_SERVER['HTTP_REFERER'])) {
+ return '';
+ }
$url = parse_url($_SERVER['HTTP_REFERER']);
- if(!$url) return '';
$query = array();
parse_str($url['query'],$query);
+ $q = '';
if(isset($query['q']))
$q = $query['q']; // google, live/msn, aol, ask, altavista, alltheweb, gigablast
elseif(isset($query['p']))
@@ -1144,7 +1144,7 @@ function getGoogleQuery(){
elseif(preg_match("#a9\.com#i",$url['host'])) // a9
$q = urldecode(ltrim($url['path'],'/'));
- if(!$q) return '';
+ if($q === '') return '';
$q = preg_split('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$q,-1,PREG_SPLIT_NO_EMPTY);
return $q;
}
@@ -1403,7 +1403,7 @@ function preg_quote_cb($string){
/**
* Shorten a given string by removing data from the middle
*
- * You can give the string in two parts, teh first part $keep
+ * You can give the string in two parts, the first part $keep
* will never be shortened. The second part $short will be cut
* in the middle to shorten but only if at least $min chars are
* left to display it. Otherwise it will be left off.