From 5c2eed9a193e9341fbfee63d4a973898acdc5ee5 Mon Sep 17 00:00:00 2001 From: lisps Date: Thu, 21 Nov 2013 15:50:52 +0100 Subject: add parameter at($DATE_AT) and mind revisions --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index dd30b53ab..e5e4f78c8 100644 --- a/inc/common.php +++ b/inc/common.php @@ -161,7 +161,7 @@ function pageinfo() { if($REV) { //check if current revision was meant if($info['exists'] && (@filemtime($info['filepath']) == $REV)) { - $REV = ''; + //$REV = ''; //if we enter a rev we want to see that revision (inc media files) } elseif($RANGE) { //section editing does not work with old revisions! $REV = ''; -- cgit v1.2.3 From 4bde2196a1e3572cead3f4d4e4b6a5a752bd62b3 Mon Sep 17 00:00:00 2001 From: lisps Date: Fri, 22 Nov 2013 09:04:44 +0100 Subject: remove property rev from xhtml.php changed variable name $create_time to $modified_time --- inc/common.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index e5e4f78c8..7f7095a12 100644 --- a/inc/common.php +++ b/inc/common.php @@ -383,6 +383,7 @@ function idfilter($id, $ue = true) { function wl($id = '', $urlParameters = '', $absolute = false, $separator = '&') { global $conf; if(is_array($urlParameters)) { + if(isset($urlParameters['rev']) && !$urlParameters['rev']) unset($urlParameters['rev']); $urlParameters = buildURLparams($urlParameters, $separator); } else { $urlParameters = str_replace(',', $separator, $urlParameters); -- cgit v1.2.3 From 78b874e68a5f2a45f71a91efb168761c283e3a91 Mon Sep 17 00:00:00 2001 From: lisps Date: Fri, 22 Nov 2013 10:51:16 +0100 Subject: fix function name media_isexternal() remove empty rev from ml() rename getProperRevision() to getLastRevisionAt() make getLastRevisionAt() a method of ChangeLog --- inc/common.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 106bf7c15..5dcf58e39 100644 --- a/inc/common.php +++ b/inc/common.php @@ -484,6 +484,7 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) if(empty($more['w'])) unset($more['w']); if(empty($more['h'])) unset($more['h']); if(isset($more['id']) && $direct) unset($more['id']); + if(isset($more['rev']) && !$more['rev']) unset($more['rev']); $more = buildURLparams($more, $sep); } else { $matches = array(); -- cgit v1.2.3 From d81178045b12622c84f48c892ddda32c6aba5576 Mon Sep 17 00:00:00 2001 From: lisps Date: Fri, 22 Nov 2013 13:56:58 +0100 Subject: restore old version of pageinfo() --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 5dcf58e39..ce74717d0 100644 --- a/inc/common.php +++ b/inc/common.php @@ -161,7 +161,7 @@ function pageinfo() { if($REV) { //check if current revision was meant if($info['exists'] && (@filemtime($info['filepath']) == $REV)) { - //$REV = ''; //if we enter a rev we want to see that revision (inc media files) + $REV = ''; } elseif($RANGE) { //section editing does not work with old revisions! $REV = ''; -- cgit v1.2.3 From 2046a6546c8ed62b9a7b33305b6201458f2f8291 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 12 Mar 2014 15:38:28 +0000 Subject: Allow user info to be retrieved without groups Some parts of dokuwiki (e.g. recent changes, old revisions) can requests lots of user info (to provide editor names) without requiring any group information. This change also implements caching of user info by authmysql & authpgsql plugins to avoid repeated querying of the DB to retrieve the same user information. --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 9fbebde94..6851cdea3 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1467,7 +1467,7 @@ function editorinfo($username) { case 'username': case 'email': case 'email_link': - if($auth) $info = $auth->getUserData($username); + if($auth) $info = $auth->getUserData($username, DokuWiki_Auth_Plugin::IGNORE_GROUPS); break; default: return hsc($username); -- cgit v1.2.3 From 06e3e0c7b506a637df1ea27c6a8a439756e7139d Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 14 Mar 2014 17:58:53 +0000 Subject: use $requireGroups constants in auth classes; comments; code improvements --- inc/common.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 6851cdea3..9ed9e84d4 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1454,13 +1454,14 @@ function shorten($keep, $short, $max, $min = 9, $char = '…') { } /** - * Return the users realname or e-mail address for use + * Return the users real name or e-mail address for use * in page footer and recent changes pages * * @author Andy Webber */ function editorinfo($username) { global $conf; + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; switch($conf['showuseras']) { @@ -1473,7 +1474,7 @@ function editorinfo($username) { return hsc($username); } - if(isset($info) && $info) { + if(!empty($info)) { switch($conf['showuseras']) { case 'username': return hsc($info['name']); @@ -1485,9 +1486,9 @@ function editorinfo($username) { default: return hsc($username); } - } else { - return hsc($username); } + + return hsc($username); } /** -- cgit v1.2.3 From 7b62b42de1887c3627c727f0483aea41556742d4 Mon Sep 17 00:00:00 2001 From: lisps Date: Wed, 19 Mar 2014 10:32:55 +0100 Subject: add config date_at_format change translation message --- inc/common.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 0b15c284d..44cfe91ba 100644 --- a/inc/common.php +++ b/inc/common.php @@ -395,6 +395,7 @@ function wl($id = '', $urlParameters = '', $absolute = false, $separator = '& global $conf; if(is_array($urlParameters)) { if(isset($urlParameters['rev']) && !$urlParameters['rev']) unset($urlParameters['rev']); + if(isset($urlParameters['at']) && $conf['date_at_format']) $urlParameters['at'] = date($conf['date_at_format'],$urlParameters['at']); $urlParameters = buildURLparams($urlParameters, $separator); } else { $urlParameters = str_replace(',', $separator, $urlParameters); -- cgit v1.2.3 From 2dc9e90007f12ac996b0e74479137a9dc6243c3c Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 4 May 2014 19:20:11 +0100 Subject: KISS - remove class constants for REQUIRE_GROUPS & IGNORE_GROUPS and replace with boolean values --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 9ed9e84d4..9b3c59e6e 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1468,7 +1468,7 @@ function editorinfo($username) { case 'username': case 'email': case 'email_link': - if($auth) $info = $auth->getUserData($username, DokuWiki_Auth_Plugin::IGNORE_GROUPS); + if($auth) $info = $auth->getUserData($username, $requireGroups = false); break; default: return hsc($username); -- cgit v1.2.3 From 65833968962f86342542bf9d52f9cdcb7f595379 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 1 Sep 2014 17:50:24 +0200 Subject: fix userlink title when no authplugin is available or no user is found --- inc/common.php | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 8c9956018..503155c46 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1641,22 +1641,20 @@ function userlink($username = null, $textonly = false) { $evt = new Doku_Event('COMMON_USER_LINK', $data); if($evt->advise_before(true)) { if(empty($data['name'])) { - if($conf['showuseras'] == 'loginname') { - $data['name'] = $textonly ? $data['username'] : hsc($data['username']); - } else { - if($auth) $info = $auth->getUserData($username); - if(isset($info) && $info) { - switch($conf['showuseras']) { - case 'username': - case 'username_link': - $data['name'] = $textonly ? $info['name'] : hsc($info['name']); - break; - case 'email': - case 'email_link': - $data['name'] = obfuscate($info['mail']); - break; - } + if($auth) $info = $auth->getUserData($username); + if($conf['showuseras'] != 'loginname' && isset($info) && $info) { + switch($conf['showuseras']) { + case 'username': + case 'username_link': + $data['name'] = $textonly ? $info['name'] : hsc($info['name']); + break; + case 'email': + case 'email_link': + $data['name'] = obfuscate($info['mail']); + break; } + } else { + $data['name'] = $textonly ? $data['username'] : hsc($data['username']); } } -- cgit v1.2.3 From e0c26282a603881e8d2f839d94c28dbbfc57d71b Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 29 Sep 2014 03:34:17 +0200 Subject: scrutinizer documentations issues --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index e56285f62..95ea4e72d 100644 --- a/inc/common.php +++ b/inc/common.php @@ -968,7 +968,7 @@ function rawLocale($id, $ext = 'txt') { * @author Andreas Gohr * * @param string $id page id - * @param string $rev timestamp when a revision of wikitext is desired + * @param string|int $rev timestamp when a revision of wikitext is desired * @return string */ function rawWiki($id, $rev = '') { -- cgit v1.2.3 From 59bc3b48fdffb76ee65a4b630be3ffa1f6c20c80 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Mon, 29 Sep 2014 21:45:27 +0200 Subject: more scrutinizer issue improvements --- inc/common.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 95ea4e72d..91a068bb0 100644 --- a/inc/common.php +++ b/inc/common.php @@ -120,6 +120,7 @@ function basicinfo($id, $htmlClient=true){ global $INPUT; // set info about manager/admin status. + $info = array(); $info['isadmin'] = false; $info['ismanager'] = false; if($INPUT->server->has('REMOTE_USER')) { @@ -685,6 +686,7 @@ function checkwordblock($text = '') { } if(count($re) && preg_match('#('.join('|', $re).')#si', $text, $matches)) { // prepare event data + $data = array(); $data['matches'] = $matches; $data['userinfo']['ip'] = $INPUT->server->str('REMOTE_ADDR'); if($INPUT->server->str('REMOTE_USER')) { @@ -1119,6 +1121,7 @@ function rawWikiSlices($range, $id, $rev = '') { $from = !$from ? 0 : ($from - 1); $to = !$to ? strlen($text) : ($to - 1); + $slices = array(); $slices[0] = substr($text, 0, $from); $slices[1] = substr($text, $from, $to - $from); $slices[2] = substr($text, $to); -- cgit v1.2.3 From 42ea7f447f39fbc2f79eaaec31f8c10ede59c5d0 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 1 Oct 2014 11:30:27 +0200 Subject: Many PHPDocs, some unused and dyn declared vars many PHPDocs some unused variables some dynamically declared variables declared --- inc/common.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 91a068bb0..444e90198 100644 --- a/inc/common.php +++ b/inc/common.php @@ -49,7 +49,7 @@ function ptln($string, $indent = 0) { * * @author Andreas Gohr * - * @param $string string being stripped + * @param string $string being stripped * @return string */ function stripctl($string) { @@ -62,6 +62,7 @@ function stripctl($string) { * @author Andreas Gohr * @link http://en.wikipedia.org/wiki/Cross-site_request_forgery * @link http://christ1an.blogspot.com/2007/04/preventing-csrf-efficiently.html + * * @return string */ function getSecurityToken() { @@ -95,7 +96,7 @@ function checkSecurityToken($token = null) { * @author Andreas Gohr * * @param bool $print if true print the field, otherwise html of the field is returned - * @return void|string html of hidden form field + * @return string html of hidden form field */ function formSecurityToken($print = true) { $ret = '
'."\n"; @@ -336,7 +337,7 @@ function buildAttributes($params, $skipempty = false) { * * @author Andreas Gohr * - * @return array(pageid=>name, ... ) + * @return string[string] with the data: array(pageid=>name, ... ) */ function breadcrumbs() { // we prepare the breadcrumbs early for quick session closing @@ -1110,7 +1111,7 @@ function parsePageTemplate(&$data) { * @param string $range in form "from-to" * @param string $id page id * @param string $rev optional, the revision timestamp - * @return array with three slices + * @return string[] with three slices */ function rawWikiSlices($range, $id, $rev = '') { $text = io_readWikiPage(wikiFN($id, $rev), $id, $rev); @@ -1296,7 +1297,7 @@ function saveOldRevision($id) { * @param int|string $rev Old page revision * @param string $summary What changed * @param boolean $minor Is this a minor edit? - * @param array $replace Additional string substitutions, @KEY@ to be replaced by value + * @param string[] $replace Additional string substitutions, @KEY@ to be replaced by value * @return bool * * @author Andreas Gohr @@ -1376,8 +1377,8 @@ function getGoogleQuery() { /** * Return the human readable size of a file * - * @param int $size A file size - * @param int $dec A number of decimal places + * @param int $size A file size + * @param int $dec A number of decimal places * @return string human readable size * * @author Martin Benjamin @@ -1914,7 +1915,7 @@ function set_doku_pref($pref, $val) { /** * Strips source mapping declarations from given text #601 * - * @param &string $text reference to the CSS or JavaScript code to clean + * @param string &$text reference to the CSS or JavaScript code to clean */ function stripsourcemaps(&$text){ $text = preg_replace('/^(\/\/|\/\*)[@#]\s+sourceMappingURL=.*?(\*\/)?$/im', '\\1\\2', $text); -- cgit v1.2.3 From e3710957c6b7e12293805a15d0624be7c7054092 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 1 Oct 2014 17:05:40 +0200 Subject: more phpdocs and minor check --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 444e90198..7932fc9f0 100644 --- a/inc/common.php +++ b/inc/common.php @@ -337,7 +337,7 @@ function buildAttributes($params, $skipempty = false) { * * @author Andreas Gohr * - * @return string[string] with the data: array(pageid=>name, ... ) + * @return string[] with the data: array(pageid=>name, ... ) */ function breadcrumbs() { // we prepare the breadcrumbs early for quick session closing -- cgit v1.2.3 From 7e8500eea1e53b1de0e0f70400664afa442cd08d Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Thu, 2 Oct 2014 14:55:24 +0200 Subject: PHPDocs and some improvements --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 7932fc9f0..d628ab6b2 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1461,7 +1461,7 @@ function dformat($dt = null, $format = '') { * @author * @link http://www.php.net/manual/en/function.date.php#54072 * - * @param int $int_date: current date in UNIX timestamp + * @param int $int_date current date in UNIX timestamp * @return string */ function date_iso8601($int_date) { -- cgit v1.2.3 From 81781cb6b4211de42700790b0f4968f39feababd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 17 Dec 2014 13:14:29 +0100 Subject: never exit during test runs --- inc/common.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index b5fdd1ea5..2c9359a0c 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1828,6 +1828,8 @@ function send_redirect($url) { } else { header('Location: '.$url); } + + if(defined('DOKU_UNITTEST')) return; // no exits during unit tests exit; } -- cgit v1.2.3