diff options
Diffstat (limited to 'inc')
73 files changed, 995 insertions, 435 deletions
diff --git a/inc/EmailAddressValidator.php b/inc/EmailAddressValidator.php index bb4ef0ca9..fd6f3275b 100644 --- a/inc/EmailAddressValidator.php +++ b/inc/EmailAddressValidator.php @@ -15,8 +15,8 @@ class EmailAddressValidator { /** * Check email address validity - * @param strEmailAddress Email address to be checked - * @return True if email is valid, false if not + * @param string $strEmailAddress Email address to be checked + * @return bool True if email is valid, false if not */ public function check_email_address($strEmailAddress) { @@ -82,8 +82,8 @@ class EmailAddressValidator { /** * Checks email section before "@" symbol for validity - * @param strLocalPortion Text to be checked - * @return True if local portion is valid, false if not + * @param string $strLocalPortion Text to be checked + * @return bool True if local portion is valid, false if not */ protected function check_local_portion($strLocalPortion) { // Local portion can only be from 1 to 64 characters, inclusive. @@ -113,8 +113,8 @@ class EmailAddressValidator { /** * Checks email section after "@" symbol for validity - * @param strDomainPortion Text to be checked - * @return True if domain portion is valid, false if not + * @param string $strDomainPortion Text to be checked + * @return bool True if domain portion is valid, false if not */ protected function check_domain_portion($strDomainPortion) { // Total domain can only be from 1 to 255 characters, inclusive @@ -172,10 +172,10 @@ class EmailAddressValidator { /** * Check given text length is between defined bounds - * @param strText Text to be checked - * @param intMinimum Minimum acceptable length - * @param intMaximum Maximum acceptable length - * @return True if string is within bounds (inclusive), false if not + * @param string $strText Text to be checked + * @param int $intMinimum Minimum acceptable length + * @param int $intMaximum Maximum acceptable length + * @return bool True if string is within bounds (inclusive), false if not */ protected function check_text_length($strText, $intMinimum, $intMaximum) { // Minimum and maximum are both inclusive diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index de3a16830..53f3c9a78 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -552,7 +552,7 @@ class HTTPClient { $request = "CONNECT {$requestinfo['host']}:{$requestinfo['port']} HTTP/1.0".HTTP_NL; $request .= "Host: {$requestinfo['host']}".HTTP_NL; if($this->proxy_user) { - 'Proxy-Authorization Basic '.base64_encode($this->proxy_user.':'.$this->proxy_pass).HTTP_NL; + $request .= 'Proxy-Authorization Basic '.base64_encode($this->proxy_user.':'.$this->proxy_pass).HTTP_NL; } $request .= HTTP_NL; diff --git a/inc/Input.class.php b/inc/Input.class.php index 7434d2b2c..de8bf5b97 100644 --- a/inc/Input.class.php +++ b/inc/Input.class.php @@ -15,6 +15,8 @@ class Input { public $post; /** @var GetInput Access $_GET parameters */ public $get; + /** @var ServerInput Access $_SERVER parameters */ + public $server; protected $access; @@ -25,6 +27,7 @@ class Input { $this->access = &$_REQUEST; $this->post = new PostInput(); $this->get = new GetInput(); + $this->server = new ServerInput(); } /** @@ -260,3 +263,18 @@ class GetInput extends Input { $_REQUEST[$name] = $value; } } + +/** + * Internal class used for $_SERVER access in Input class + */ +class ServerInput extends Input { + protected $access; + + /** + * Initialize the $access array, remove subclass members + */ + function __construct() { + $this->access = &$_SERVER; + } + +} diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index cb1772736..a35ec3ed0 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -2929,7 +2929,8 @@ class JpegMeta { $length = strlen($data) - $pos; } - return substr($data, $pos, $length); + $rv = substr($data, $pos, $length); + return $rv; } /*************************************************************/ diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php index 2ac2c1d60..e90b45f99 100644 --- a/inc/Mailer.class.php +++ b/inc/Mailer.class.php @@ -39,6 +39,8 @@ class Mailer { */ public function __construct() { global $conf; + /* @var Input $INPUT */ + global $INPUT; $server = parse_url(DOKU_URL, PHP_URL_HOST); if(strpos($server,'.') === false) $server = $server.'.localhost'; @@ -53,7 +55,7 @@ class Mailer { // add some default headers for mailfiltering FS#2247 $this->setHeader('X-Mailer', 'DokuWiki'); - $this->setHeader('X-DokuWiki-User', $_SERVER['REMOTE_USER']); + $this->setHeader('X-DokuWiki-User', $INPUT->server->str('REMOTE_USER')); $this->setHeader('X-DokuWiki-Title', $conf['title']); $this->setHeader('X-DokuWiki-Server', $server); $this->setHeader('X-Auto-Response-Suppress', 'OOF'); @@ -181,6 +183,9 @@ class Mailer { public function setBody($text, $textrep = null, $htmlrep = null, $html = null, $wrap = true) { global $INFO; global $conf; + /* @var Input $INPUT */ + global $INPUT; + $htmlrep = (array)$htmlrep; $textrep = (array)$textrep; @@ -218,24 +223,24 @@ class Mailer { $cip = gethostsbyaddrs($ip); $trep = array( 'DATE' => dformat(), - 'BROWSER' => $_SERVER['HTTP_USER_AGENT'], + 'BROWSER' => $INPUT->server->str('HTTP_USER_AGENT'), 'IPADDRESS' => $ip, 'HOSTNAME' => $cip, 'TITLE' => $conf['title'], 'DOKUWIKIURL' => DOKU_URL, - 'USER' => $_SERVER['REMOTE_USER'], + 'USER' => $INPUT->server->str('REMOTE_USER'), 'NAME' => $INFO['userinfo']['name'], 'MAIL' => $INFO['userinfo']['mail'], ); $trep = array_merge($trep, (array)$textrep); $hrep = array( 'DATE' => '<i>'.hsc(dformat()).'</i>', - 'BROWSER' => hsc($_SERVER['HTTP_USER_AGENT']), + 'BROWSER' => hsc($INPUT->server->str('HTTP_USER_AGENT')), 'IPADDRESS' => '<code>'.hsc($ip).'</code>', 'HOSTNAME' => '<code>'.hsc($cip).'</code>', 'TITLE' => hsc($conf['title']), 'DOKUWIKIURL' => '<a href="'.DOKU_URL.'">'.DOKU_URL.'</a>', - 'USER' => hsc($_SERVER['REMOTE_USER']), + 'USER' => hsc($INPUT->server->str('REMOTE_USER')), 'NAME' => hsc($INFO['userinfo']['name']), 'MAIL' => '<a href="mailto:"'.hsc($INFO['userinfo']['mail']).'">'. hsc($INFO['userinfo']['mail']).'</a>', @@ -277,7 +282,7 @@ class Mailer { /** * Add the To: recipients * - * @see setAddress + * @see cleanAddress * @param string|array $address Multiple adresses separated by commas or as array */ public function to($address) { @@ -287,7 +292,7 @@ class Mailer { /** * Add the Cc: recipients * - * @see setAddress + * @see cleanAddress * @param string|array $address Multiple adresses separated by commas or as array */ public function cc($address) { @@ -297,7 +302,7 @@ class Mailer { /** * Add the Bcc: recipients * - * @see setAddress + * @see cleanAddress * @param string|array $address Multiple adresses separated by commas or as array */ public function bcc($address) { @@ -310,7 +315,7 @@ class Mailer { * This is set to $conf['mailfrom'] when not specified so you shouldn't need * to call this function * - * @see setAddress + * @see cleanAddress * @param string $address from address */ public function from($address) { @@ -333,9 +338,9 @@ class Mailer { * for headers. Addresses may not contain Non-ASCII data! * * Example: - * setAddress("föö <foo@bar.com>, me@somewhere.com","TBcc"); + * cc("föö <foo@bar.com>, me@somewhere.com","TBcc"); * - * @param string|array $address Multiple adresses separated by commas or as array + * @param string|array $addresses Multiple adresses separated by commas or as array * @return bool|string the prepared header (can contain multiple lines) */ public function cleanAddress($addresses) { @@ -522,7 +527,7 @@ class Mailer { // clean up addresses if(empty($this->headers['From'])) $this->from($conf['mailfrom']); - $addrs = array('To', 'From', 'Cc', 'Bcc'); + $addrs = array('To', 'From', 'Cc', 'Bcc', 'Reply-To', 'Sender'); foreach($addrs as $addr) { if(isset($this->headers[$addr])) { $this->headers[$addr] = $this->cleanAddress($this->headers[$addr]); diff --git a/inc/actions.php b/inc/actions.php index 50cbe369f..ef09a0dc7 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -20,6 +20,7 @@ function act_dispatch(){ global $ID; global $INFO; global $QUERY; + /* @var Input $INPUT */ global $INPUT; global $lang; global $conf; @@ -94,7 +95,7 @@ function act_dispatch(){ // user profile changes if (in_array($ACT, array('profile','profile_delete'))) { - if(!$_SERVER['REMOTE_USER']) { + if(!$INPUT->server->str('REMOTE_USER')) { $ACT = 'login'; } else { switch ($ACT) { @@ -190,7 +191,7 @@ function act_dispatch(){ unset($evt); // when action 'show', the intial not 'show' and POST, do a redirect - if($ACT == 'show' && $preact != 'show' && strtolower($_SERVER['REQUEST_METHOD']) == 'post'){ + if($ACT == 'show' && $preact != 'show' && strtolower($INPUT->server->str('REQUEST_METHOD')) == 'post'){ act_redirect($ID,$preact); } @@ -414,6 +415,8 @@ function act_revert($act){ global $ID; global $REV; global $lang; + /* @var Input $INPUT */ + global $INPUT; // FIXME $INFO['writable'] currently refers to the attic version // global $INFO; // if (!$INFO['writable']) { @@ -445,7 +448,7 @@ function act_revert($act){ session_write_close(); // when done, show current page - $_SERVER['REQUEST_METHOD'] = 'post'; //should force a redirect + $INPUT->server->set('REQUEST_METHOD','post'); //should force a redirect $REV = ''; return 'show'; } @@ -493,17 +496,20 @@ function act_redirect_execute($opts){ function act_auth($act){ global $ID; global $INFO; + /* @var Input $INPUT */ + global $INPUT; //already logged in? - if(isset($_SERVER['REMOTE_USER']) && $act=='login'){ + if($INPUT->server->has('REMOTE_USER') && $act=='login'){ return 'show'; } //handle logout if($act=='logout'){ $lockedby = checklock($ID); //page still locked? - if($lockedby == $_SERVER['REMOTE_USER']) + if($lockedby == $INPUT->server->str('REMOTE_USER')){ unlock($ID); //try to unlock + } // do the logout stuff auth_logoff(); @@ -697,7 +703,7 @@ function act_sitemap($act) { // Send file //use x-sendfile header to pass the delivery to compatible webservers - if (http_sendfile($sitemap)) exit; + http_sendfile($sitemap); readfile($sitemap); exit; @@ -719,10 +725,11 @@ function act_subscription($act){ global $lang; global $INFO; global $ID; + /* @var Input $INPUT */ global $INPUT; // subcriptions work for logged in users only - if(!$_SERVER['REMOTE_USER']) return 'show'; + if(!$INPUT->server->str('REMOTE_USER')) return 'show'; // get and preprocess data. $params = array(); @@ -733,7 +740,7 @@ function act_subscription($act){ } // any action given? if not just return and show the subscription page - if(!$params['action'] || !checkSecurityToken()) return $act; + if(empty($params['action']) || !checkSecurityToken()) return $act; // Handle POST data, may throw exception. trigger_event('ACTION_HANDLE_SUBSCRIBE', $params, 'subscription_handle_post'); @@ -745,9 +752,9 @@ function act_subscription($act){ // Perform action. $sub = new Subscription(); if($action == 'unsubscribe'){ - $ok = $sub->remove($target, $_SERVER['REMOTE_USER'], $style); + $ok = $sub->remove($target, $INPUT->server->str('REMOTE_USER'), $style); }else{ - $ok = $sub->add($target, $_SERVER['REMOTE_USER'], $style); + $ok = $sub->add($target, $INPUT->server->str('REMOTE_USER'), $style); } if($ok) { @@ -776,6 +783,8 @@ function act_subscription($act){ function subscription_handle_post(&$params) { global $INFO; global $lang; + /* @var Input $INPUT */ + global $INPUT; // Get and validate parameters. if (!isset($params['target'])) { @@ -806,7 +815,7 @@ function subscription_handle_post(&$params) { } if ($is === false) { throw new Exception(sprintf($lang['subscr_not_subscribed'], - $_SERVER['REMOTE_USER'], + $INPUT->server->str('REMOTE_USER'), prettyprint_id($target))); } // subscription_set deletes a subscription if style = null. diff --git a/inc/auth.php b/inc/auth.php index 6000ea6d7..2bdc3eb00 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -131,6 +131,8 @@ function auth_setup() { function auth_loadACL() { global $config_cascade; global $USERINFO; + /* @var Input $INPUT */ + global $INPUT; if(!is_readable($config_cascade['acl']['default'])) return array(); @@ -145,10 +147,10 @@ function auth_loadACL() { // substitute user wildcard first (its 1:1) if(strstr($line, '%USER%')){ // if user is not logged in, this ACL line is meaningless - skip it - if (!isset($_SERVER['REMOTE_USER'])) continue; + if (!$INPUT->server->has('REMOTE_USER')) continue; - $id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id); - $rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest); + $id = str_replace('%USER%',cleanID($INPUT->server->str('REMOTE_USER')),$id); + $rest = str_replace('%USER%',auth_nameencode($INPUT->server->str('REMOTE_USER')),$rest); } // substitute group wildcard (its 1:m) @@ -217,6 +219,8 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { global $lang; /* @var DokuWiki_Auth_Plugin $auth */ global $auth; + /* @var Input $INPUT */ + global $INPUT; $sticky ? $sticky = true : $sticky = false; //sanity check @@ -226,7 +230,7 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { //usual login if($auth->checkPass($user, $pass)) { // make logininfo globally available - $_SERVER['REMOTE_USER'] = $user; + $INPUT->server->set('REMOTE_USER', $user); $secret = auth_cookiesalt(!$sticky, true); //bind non-sticky to session auth_setCookie($user, auth_encrypt($pass, $secret), $sticky); return true; @@ -253,7 +257,7 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { ) { // he has session, cookie and browser right - let him in - $_SERVER['REMOTE_USER'] = $user; + $INPUT->server->set('REMOTE_USER', $user); $USERINFO = $session['info']; //FIXME move all references to session return true; } @@ -288,7 +292,10 @@ function auth_validateToken($token) { } // still here? trust the session data global $USERINFO; - $_SERVER['REMOTE_USER'] = $_SESSION[DOKU_COOKIE]['auth']['user']; + /* @var Input $INPUT */ + global $INPUT; + + $INPUT->server->set('REMOTE_USER',$_SESSION[DOKU_COOKIE]['auth']['user']); $USERINFO = $_SESSION[DOKU_COOKIE]['auth']['info']; return true; } @@ -321,11 +328,14 @@ function auth_createToken() { * @return string a MD5 sum of various browser headers */ function auth_browseruid() { + /* @var Input $INPUT */ + global $INPUT; + $ip = clientIP(true); $uid = ''; - $uid .= $_SERVER['HTTP_USER_AGENT']; - $uid .= $_SERVER['HTTP_ACCEPT_ENCODING']; - $uid .= $_SERVER['HTTP_ACCEPT_CHARSET']; + $uid .= $INPUT->server->str('HTTP_USER_AGENT'); + $uid .= $INPUT->server->str('HTTP_ACCEPT_ENCODING'); + $uid .= $INPUT->server->str('HTTP_ACCEPT_CHARSET'); $uid .= substr($ip, 0, strpos($ip, '.')); $uid = strtolower($uid); return md5($uid); @@ -511,6 +521,8 @@ function auth_logoff($keepbc = false) { global $USERINFO; /* @var DokuWiki_Auth_Plugin $auth */ global $auth; + /* @var Input $INPUT */ + global $INPUT; // make sure the session is writable (it usually is) @session_start(); @@ -523,16 +535,11 @@ function auth_logoff($keepbc = false) { unset($_SESSION[DOKU_COOKIE]['auth']['info']); if(!$keepbc && isset($_SESSION[DOKU_COOKIE]['bc'])) unset($_SESSION[DOKU_COOKIE]['bc']); - if(isset($_SERVER['REMOTE_USER'])) - unset($_SERVER['REMOTE_USER']); + $INPUT->server->remove('REMOTE_USER'); $USERINFO = null; //FIXME $cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir']; - if(version_compare(PHP_VERSION, '5.2.0', '>')) { - setcookie(DOKU_COOKIE, '', time() - 600000, $cookieDir, '', ($conf['securecookie'] && is_ssl()), true); - } else { - setcookie(DOKU_COOKIE, '', time() - 600000, $cookieDir, '', ($conf['securecookie'] && is_ssl())); - } + setcookie(DOKU_COOKIE, '', time() - 600000, $cookieDir, '', ($conf['securecookie'] && is_ssl()), true); if($auth) $auth->logOff(); } @@ -557,13 +564,16 @@ function auth_ismanager($user = null, $groups = null, $adminonly = false) { global $USERINFO; /* @var DokuWiki_Auth_Plugin $auth */ global $auth; + /* @var Input $INPUT */ + global $INPUT; + if(!$auth) return false; if(is_null($user)) { - if(!isset($_SERVER['REMOTE_USER'])) { + if(!$INPUT->server->has('REMOTE_USER')) { return false; } else { - $user = $_SERVER['REMOTE_USER']; + $user = $INPUT->server->str('REMOTE_USER'); } } if(is_null($groups)) { @@ -655,9 +665,11 @@ function auth_isMember($memberlist, $user, array $groups) { function auth_quickaclcheck($id) { global $conf; global $USERINFO; + /* @var Input $INPUT */ + global $INPUT; # if no ACL is used always return upload rights if(!$conf['useacl']) return AUTH_UPLOAD; - return auth_aclcheck($id, $_SERVER['REMOTE_USER'], $USERINFO['grps']); + return auth_aclcheck($id, $INPUT->server->str('REMOTE_USER'), $USERINFO['grps']); } /** @@ -845,6 +857,12 @@ function auth_nameencode($name, $skip_group = false) { return $cache[$name][$skip_group]; } +/** + * callback encodes the matches + * + * @param array $matches first complete match, next matching subpatterms + * @return string + */ function auth_nameencode_callback($matches) { return '%'.dechex(ord(substr($matches[1],-1))); } @@ -1056,18 +1074,18 @@ function updateprofile() { } if($conf['profileconfirm']) { - if(!$auth->checkPass($_SERVER['REMOTE_USER'], $INPUT->post->str('oldpass'))) { + if(!$auth->checkPass($INPUT->server->str('REMOTE_USER'), $INPUT->post->str('oldpass'))) { msg($lang['badpassconfirm'], -1); return false; } } - if($result = $auth->triggerUserMod('modify', array($_SERVER['REMOTE_USER'], $changes))) { + if($result = $auth->triggerUserMod('modify', array($INPUT->server->str('REMOTE_USER'), $changes))) { // update cookie and session with the changed data if($changes['pass']) { list( /*user*/, $sticky, /*pass*/) = auth_getCookie(); $pass = auth_encrypt($changes['pass'], auth_cookiesalt(!$sticky, true)); - auth_setCookie($_SERVER['REMOTE_USER'], $pass, (bool) $sticky); + auth_setCookie($INPUT->server->str('REMOTE_USER'), $pass, (bool) $sticky); } return true; } @@ -1075,6 +1093,11 @@ function updateprofile() { return false; } +/** + * Delete the current logged-in user + * + * @return bool true on success, false on any error + */ function auth_deleteprofile(){ global $conf; global $lang; @@ -1098,13 +1121,13 @@ function auth_deleteprofile(){ } if($conf['profileconfirm']) { - if(!$auth->checkPass($_SERVER['REMOTE_USER'], $INPUT->post->str('oldpass'))) { + if(!$auth->checkPass($INPUT->server->str('REMOTE_USER'), $INPUT->post->str('oldpass'))) { msg($lang['badpassconfirm'], -1); return false; } } - $deleted[] = $_SERVER['REMOTE_USER']; + $deleted[] = $INPUT->server->str('REMOTE_USER'); if($auth->triggerUserMod('delete', array($deleted))) { // force and immediate logout including removing the sticky cookie auth_logoff(); @@ -1308,11 +1331,8 @@ function auth_setCookie($user, $pass, $sticky) { $cookie = base64_encode($user).'|'.((int) $sticky).'|'.base64_encode($pass); $cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir']; $time = $sticky ? (time() + 60 * 60 * 24 * 365) : 0; //one year - if(version_compare(PHP_VERSION, '5.2.0', '>')) { - setcookie(DOKU_COOKIE, $cookie, $time, $cookieDir, '', ($conf['securecookie'] && is_ssl()), true); - } else { - setcookie(DOKU_COOKIE, $cookie, $time, $cookieDir, '', ($conf['securecookie'] && is_ssl())); - } + setcookie(DOKU_COOKIE, $cookie, $time, $cookieDir, '', ($conf['securecookie'] && is_ssl()), true); + // set session $_SESSION[DOKU_COOKIE]['auth']['user'] = $user; $_SESSION[DOKU_COOKIE]['auth']['pass'] = sha1($pass); diff --git a/inc/cache.php b/inc/cache.php index 5eac94934..56c5b65f2 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -8,16 +8,24 @@ if(!defined('DOKU_INC')) die('meh.'); +/** + * Generic handling of caching + */ class cache { - var $key = ''; // primary identifier for this item - var $ext = ''; // file ext for cache data, secondary identifier for this item - var $cache = ''; // cache file name - var $depends = array(); // array containing cache dependency information, + public $key = ''; // primary identifier for this item + public $ext = ''; // file ext for cache data, secondary identifier for this item + public $cache = ''; // cache file name + public $depends = array(); // array containing cache dependency information, // used by _useCache to determine cache validity var $_event = ''; // event to be triggered during useCache + var $_time; - function cache($key,$ext) { + /** + * @param string $key primary identifier + * @param string $ext file extension + */ + public function cache($key,$ext) { $this->key = $key; $this->ext = $ext; $this->cache = getCacheName($key,$ext); @@ -36,7 +44,7 @@ class cache { * * @return bool true if cache can be used, false otherwise */ - function useCache($depends=array()) { + public function useCache($depends=array()) { $this->depends = $depends; $this->_addDependencies(); @@ -55,11 +63,13 @@ class cache { * age - expire cache if older than age (seconds) * files - expire cache if any file in this array was updated more recently than the cache * + * Note that this function needs to be public as it is used as callback for the event handler + * * can be overridden * * @return bool see useCache() */ - function _useCache() { + public function _useCache() { if (!empty($this->depends['purge'])) return false; // purge requested? if (!($this->_time = @filemtime($this->cache))) return false; // cache exists? @@ -83,7 +93,7 @@ class cache { * it should not remove any existing dependencies and * it should only overwrite a dependency when the new value is more stringent than the old */ - function _addDependencies() { + protected function _addDependencies() { global $INPUT; if ($INPUT->has('purge')) $this->depends['purge'] = true; // purge requested } @@ -94,7 +104,7 @@ class cache { * @param bool $clean true to clean line endings, false to leave line endings alone * @return string cache contents */ - function retrieveCache($clean=true) { + public function retrieveCache($clean=true) { return io_readFile($this->cache, $clean); } @@ -104,14 +114,14 @@ class cache { * @param string $data the data to be cached * @return bool true on success, false otherwise */ - function storeCache($data) { + public function storeCache($data) { return io_savefile($this->cache, $data); } /** * remove any cached data associated with this cache instance */ - function removeCache() { + public function removeCache() { @unlink($this->cache); } @@ -122,7 +132,7 @@ class cache { * @param bool $success result of this cache use attempt * @return bool pass-thru $success value */ - function _stats($success) { + protected function _stats($success) { global $conf; static $stats = null; static $file; @@ -157,14 +167,23 @@ class cache { } } +/** + * Parser caching + */ class cache_parser extends cache { - var $file = ''; // source file for cache - var $mode = ''; // input mode (represents the processing the input file will undergo) + public $file = ''; // source file for cache + public $mode = ''; // input mode (represents the processing the input file will undergo) var $_event = 'PARSER_CACHE_USE'; - function cache_parser($id, $file, $mode) { + /** + * + * @param string $id page id + * @param string $file source file for cache + * @param string $mode input mode + */ + public function cache_parser($id, $file, $mode) { if ($id) $this->page = $id; $this->file = $file; $this->mode = $mode; @@ -172,24 +191,29 @@ class cache_parser extends cache { parent::cache($file.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'],'.'.$mode); } - function _useCache() { + /** + * method contains cache use decision logic + * + * @return bool see useCache() + */ + public function _useCache() { if (!@file_exists($this->file)) return false; // source exists? return parent::_useCache(); } - function _addDependencies() { - global $conf, $config_cascade; + protected function _addDependencies() { + global $conf; $this->depends['age'] = isset($this->depends['age']) ? min($this->depends['age'],$conf['cachetime']) : $conf['cachetime']; // parser cache file dependencies ... - $files = array($this->file, // ... source + $files = array($this->file, // ... source DOKU_INC.'inc/parser/parser.php', // ... parser DOKU_INC.'inc/parser/handler.php', // ... handler ); - $files = array_merge($files, getConfigFiles('main')); // ... wiki settings + $files = array_merge($files, getConfigFiles('main')); // ... wiki settings $this->depends['files'] = !empty($this->depends['files']) ? array_merge($files, $this->depends['files']) : $files; parent::_addDependencies(); @@ -197,8 +221,17 @@ class cache_parser extends cache { } +/** + * Caching of data of renderer + */ class cache_renderer extends cache_parser { - function _useCache() { + + /** + * method contains cache use decision logic + * + * @return bool see useCache() + */ + public function _useCache() { global $conf; if (!parent::_useCache()) return false; @@ -231,7 +264,7 @@ class cache_renderer extends cache_parser { return true; } - function _addDependencies() { + protected function _addDependencies() { // renderer cache file dependencies ... $files = array( @@ -253,18 +286,37 @@ class cache_renderer extends cache_parser { } } +/** + * Caching of parser instructions + */ class cache_instructions extends cache_parser { - function cache_instructions($id, $file) { + /** + * @param string $id page id + * @param string $file source file for cache + */ + public function cache_instructions($id, $file) { parent::cache_parser($id, $file, 'i'); } - function retrieveCache($clean=true) { + /** + * retrieve the cached data + * + * @param bool $clean true to clean line endings, false to leave line endings alone + * @return string cache contents + */ + public function retrieveCache($clean=true) { $contents = io_readFile($this->cache, false); return !empty($contents) ? unserialize($contents) : array(); } - function storeCache($instructions) { + /** + * cache $instructions + * + * @param string $instructions the instruction to be cached + * @return bool true on success, false otherwise + */ + public function storeCache($instructions) { return io_savefile($this->cache,serialize($instructions)); } } diff --git a/inc/changelog.php b/inc/changelog.php index 6ff1e0eca..cd46b1ec0 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -52,6 +52,8 @@ function parseChangelogLine($line) { */ function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extra='', $flags=null){ global $conf, $INFO; + /** @var Input $INPUT */ + global $INPUT; // check for special flags as keys if (!is_array($flags)) { $flags = array(); } @@ -65,7 +67,7 @@ function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extr if(!$date) $date = time(); //use current time if none supplied $remote = (!$flagExternalEdit)?clientIP(true):'127.0.0.1'; - $user = (!$flagExternalEdit)?$_SERVER['REMOTE_USER']:''; + $user = (!$flagExternalEdit)?$INPUT->server->str('REMOTE_USER'):''; $strip = array("\t", "\n"); $logline = array( @@ -117,12 +119,14 @@ function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extr */ function addMediaLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extra='', $flags=null){ global $conf; + /** @var Input $INPUT */ + global $INPUT; $id = cleanid($id); if(!$date) $date = time(); //use current time if none supplied $remote = clientIP(true); - $user = $_SERVER['REMOTE_USER']; + $user = $INPUT->server->str('REMOTE_USER'); $strip = array("\t", "\n"); $logline = array( diff --git a/inc/cliopts.php b/inc/cliopts.php index 9cea686a2..3eac72e5b 100644 --- a/inc/cliopts.php +++ b/inc/cliopts.php @@ -74,9 +74,9 @@ class Doku_Cli_Opts { /** * <?php ?> * @see http://www.sitepoint.com/article/php-command-line-1/3 - * @param string executing file name - this MUST be passed the __FILE__ constant - * @param string short options - * @param array (optional) long options + * @param string $bin_file executing file name - this MUST be passed the __FILE__ constant + * @param string $short_options short options + * @param array $long_options (optional) long options * @return Doku_Cli_Opts_Container or Doku_Cli_Opts_Error */ function & getOptions($bin_file, $short_options, $long_options = null) { @@ -233,12 +233,12 @@ class Doku_Cli_Opts { * Parse short option * * @param string $arg Argument - * @param string[] $short_options Available short options + * @param string $short_options Available short options * @param string[][] &$opts * @param string[] &$args * * @access private - * @return void + * @return void|Doku_Cli_Opts_Error */ function _parseShortOption($arg, $short_options, &$opts, &$args) { $len = strlen($arg); @@ -324,7 +324,7 @@ class Doku_Cli_Opts { * @param string[] &$args * * @access private - * @return void|PEAR_Error + * @return void|Doku_Cli_Opts_Error */ function _parseLongOption($arg, $long_options, &$opts, &$args) { @list($opt, $opt_arg) = explode('=', $arg, 2); @@ -402,7 +402,7 @@ class Doku_Cli_Opts { * Will take care on register_globals and register_argc_argv ini directives * * @access public - * @return mixed the $argv PHP array or PEAR error if not registered + * @return array|Doku_Cli_Opts_Error the $argv PHP array or PEAR error if not registered */ function readPHPArgv() { global $argv; @@ -421,10 +421,19 @@ class Doku_Cli_Opts { return $argv; } + /** + * @param $code + * @param $msg + * @return Doku_Cli_Opts_Error + */ function raiseError($code, $msg) { return new Doku_Cli_Opts_Error($code, $msg); } + /** + * @param $obj + * @return bool + */ function isError($obj) { return is_a($obj, 'Doku_Cli_Opts_Error'); } diff --git a/inc/common.php b/inc/common.php index 32771285b..9fbebde94 100644 --- a/inc/common.php +++ b/inc/common.php @@ -56,15 +56,18 @@ function stripctl($string) { * @return string */ function getSecurityToken() { - return PassHash::hmac('md5', session_id().$_SERVER['REMOTE_USER'], auth_cookiesalt()); + /** @var Input $INPUT */ + global $INPUT; + return PassHash::hmac('md5', session_id().$INPUT->server->str('REMOTE_USER'), auth_cookiesalt()); } /** * Check the secret CSRF token */ function checkSecurityToken($token = null) { + /** @var Input $INPUT */ global $INPUT; - if(empty($_SERVER['REMOTE_USER'])) return true; // no logged in user, no need for a check + if(!$INPUT->server->str('REMOTE_USER')) return true; // no logged in user, no need for a check if(is_null($token)) $token = $INPUT->str('sectok'); if(getSecurityToken() != $token) { @@ -93,14 +96,16 @@ function formSecurityToken($print = true) { */ function basicinfo($id, $htmlClient=true){ global $USERINFO; + /* @var Input $INPUT */ + global $INPUT; // set info about manager/admin status. $info['isadmin'] = false; $info['ismanager'] = false; - if(isset($_SERVER['REMOTE_USER'])) { + if($INPUT->server->has('REMOTE_USER')) { $info['userinfo'] = $USERINFO; $info['perm'] = auth_quickaclcheck($id); - $info['client'] = $_SERVER['REMOTE_USER']; + $info['client'] = $INPUT->server->str('REMOTE_USER'); if($info['perm'] == AUTH_ADMIN) { $info['isadmin'] = true; @@ -111,7 +116,7 @@ function basicinfo($id, $htmlClient=true){ // if some outside auth were used only REMOTE_USER is set if(!$info['userinfo']['name']) { - $info['userinfo']['name'] = $_SERVER['REMOTE_USER']; + $info['userinfo']['name'] = $INPUT->server->str('REMOTE_USER'); } } else { @@ -140,6 +145,8 @@ function pageinfo() { global $REV; global $RANGE; global $lang; + /* @var Input $INPUT */ + global $INPUT; $info = basicinfo($ID); @@ -148,19 +155,20 @@ function pageinfo() { $info['id'] = $ID; $info['rev'] = $REV; - if(isset($_SERVER['REMOTE_USER'])) { + if($INPUT->server->has('REMOTE_USER')) { $sub = new Subscription(); $info['subscribed'] = $sub->user_subscription(); } else { $info['subscribed'] = false; } - $info['locked'] = checklock($ID); - $info['filepath'] = fullpath(wikiFN($ID)); - $info['exists'] = @file_exists($info['filepath']); + $info['locked'] = checklock($ID); + $info['filepath'] = fullpath(wikiFN($ID)); + $info['exists'] = @file_exists($info['filepath']); + $info['currentrev'] = @filemtime($info['filepath']); if($REV) { //check if current revision was meant - if($info['exists'] && (@filemtime($info['filepath']) == $REV)) { + if($info['exists'] && ($info['currentrev'] == $REV)) { $REV = ''; } elseif($RANGE) { //section editing does not work with old revisions! @@ -190,7 +198,7 @@ function pageinfo() { if($REV) { $revinfo = getRevisionInfo($ID, $REV, 1024); } else { - if(is_array($info['meta']['last_change'])) { + if(!empty($info['meta']['last_change']) && is_array($info['meta']['last_change'])) { $revinfo = $info['meta']['last_change']; } else { $revinfo = getRevisionInfo($ID, $info['lastmod'], 1024); @@ -355,11 +363,14 @@ function breadcrumbs() { */ function idfilter($id, $ue = true) { global $conf; + /* @var Input $INPUT */ + global $INPUT; + if($conf['useslash'] && $conf['userewrite']) { $id = strtr($id, ':', '/'); } elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && $conf['userewrite'] && - strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') === false + strpos($INPUT->server->str('SERVER_SOFTWARE'), 'Microsoft-IIS') === false ) { $id = strtr($id, ':', ';'); } @@ -587,6 +598,8 @@ function checkwordblock($text = '') { global $SUM; global $conf; global $INFO; + /* @var Input $INPUT */ + global $INPUT; if(!$conf['usewordblock']) return false; @@ -619,9 +632,9 @@ function checkwordblock($text = '') { if(count($re) && preg_match('#('.join('|', $re).')#si', $text, $matches)) { // prepare event data $data['matches'] = $matches; - $data['userinfo']['ip'] = $_SERVER['REMOTE_ADDR']; - if($_SERVER['REMOTE_USER']) { - $data['userinfo']['user'] = $_SERVER['REMOTE_USER']; + $data['userinfo']['ip'] = $INPUT->server->str('REMOTE_ADDR'); + if($INPUT->server->str('REMOTE_USER')) { + $data['userinfo']['user'] = $INPUT->server->str('REMOTE_USER'); $data['userinfo']['name'] = $INFO['userinfo']['name']; $data['userinfo']['mail'] = $INFO['userinfo']['mail']; } @@ -647,12 +660,17 @@ function checkwordblock($text = '') { * @return string */ function clientIP($single = false) { + /* @var Input $INPUT */ + global $INPUT; + $ip = array(); - $ip[] = $_SERVER['REMOTE_ADDR']; - if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) - $ip = array_merge($ip, explode(',', str_replace(' ', '', $_SERVER['HTTP_X_FORWARDED_FOR']))); - if(!empty($_SERVER['HTTP_X_REAL_IP'])) - $ip = array_merge($ip, explode(',', str_replace(' ', '', $_SERVER['HTTP_X_REAL_IP']))); + $ip[] = $INPUT->server->str('REMOTE_ADDR'); + if($INPUT->server->str('HTTP_X_FORWARDED_FOR')) { + $ip = array_merge($ip, explode(',', str_replace(' ', '', $INPUT->server->str('HTTP_X_FORWARDED_FOR')))); + } + if($INPUT->server->str('HTTP_X_REAL_IP')) { + $ip = array_merge($ip, explode(',', str_replace(' ', '', $INPUT->server->str('HTTP_X_REAL_IP')))); + } // some IPv4/v6 regexps borrowed from Feyd // see: http://forums.devnetwork.net/viewtopic.php?f=38&t=53479 @@ -711,16 +729,18 @@ function clientIP($single = false) { * @link http://www.brainhandles.com/2007/10/15/detecting-mobile-browsers/#code */ function clientismobile() { + /* @var Input $INPUT */ + global $INPUT; - if(isset($_SERVER['HTTP_X_WAP_PROFILE'])) return true; + if($INPUT->server->has('HTTP_X_WAP_PROFILE')) return true; - if(preg_match('/wap\.|\.wap/i', $_SERVER['HTTP_ACCEPT'])) return true; + if(preg_match('/wap\.|\.wap/i', $INPUT->server->str('HTTP_ACCEPT'))) return true; - if(!isset($_SERVER['HTTP_USER_AGENT'])) return false; + if(!$INPUT->server->has('HTTP_USER_AGENT')) return false; $uamatches = 'midp|j2me|avantg|docomo|novarra|palmos|palmsource|240x320|opwv|chtml|pda|windows ce|mmp\/|blackberry|mib\/|symbian|wireless|nokia|hand|mobi|phone|cdm|up\.b|audio|SIE\-|SEC\-|samsung|HTC|mot\-|mitsu|sagem|sony|alcatel|lg|erics|vx|NEC|philips|mmm|xx|panasonic|sharp|wap|sch|rover|pocket|benq|java|pt|pg|vox|amoi|bird|compal|kg|voda|sany|kdd|dbt|sendo|sgh|gradi|jb|\d\d\di|moto'; - if(preg_match("/$uamatches/i", $_SERVER['HTTP_USER_AGENT'])) return true; + if(preg_match("/$uamatches/i", $INPUT->server->str('HTTP_USER_AGENT'))) return true; return false; } @@ -760,6 +780,9 @@ function gethostsbyaddrs($ips) { */ function checklock($id) { global $conf; + /* @var Input $INPUT */ + global $INPUT; + $lock = wikiLockFN($id); //no lockfile @@ -772,8 +795,8 @@ function checklock($id) { } //my own lock - list($ip, $session) = explode("\n", io_readFile($lock)); - if($ip == $_SERVER['REMOTE_USER'] || $ip == clientIP() || $session == session_id()) { + @list($ip, $session) = explode("\n", io_readFile($lock)); + if($ip == $INPUT->server->str('REMOTE_USER') || $ip == clientIP() || $session == session_id()) { return false; } @@ -787,14 +810,16 @@ function checklock($id) { */ function lock($id) { global $conf; + /* @var Input $INPUT */ + global $INPUT; if($conf['locktime'] == 0) { return; } $lock = wikiLockFN($id); - if($_SERVER['REMOTE_USER']) { - io_saveFile($lock, $_SERVER['REMOTE_USER']); + if($INPUT->server->str('REMOTE_USER')) { + io_saveFile($lock, $INPUT->server->str('REMOTE_USER')); } else { io_saveFile($lock, clientIP()."\n".session_id()); } @@ -808,10 +833,13 @@ function lock($id) { * @return bool true if a lock was removed */ function unlock($id) { + /* @var Input $INPUT */ + global $INPUT; + $lock = wikiLockFN($id); if(@file_exists($lock)) { - list($ip, $session) = explode("\n", io_readFile($lock)); - if($ip == $_SERVER['REMOTE_USER'] || $ip == clientIP() || $session == session_id()) { + @list($ip, $session) = explode("\n", io_readFile($lock)); + if($ip == $INPUT->server->str('REMOTE_USER') || $ip == clientIP() || $session == session_id()) { @unlink($lock); return true; } @@ -937,6 +965,8 @@ function parsePageTemplate(&$data) { global $USERINFO; global $conf; + /* @var Input $INPUT */ + global $INPUT; // replace placeholders $file = noNS($id); @@ -968,7 +998,7 @@ function parsePageTemplate(&$data) { utf8_ucfirst($page), utf8_ucwords($page), utf8_strtoupper($page), - $_SERVER['REMOTE_USER'], + $INPUT->server->str('REMOTE_USER'), $USERINFO['name'], $USERINFO['mail'], $conf['dformat'], @@ -1049,6 +1079,9 @@ function saveWikiText($id, $text, $summary, $minor = false) { global $conf; global $lang; global $REV; + /* @var Input $INPUT */ + global $INPUT; + // ignore if no changes were made if($text == rawWiki($id, '')) { return; @@ -1111,7 +1144,7 @@ function saveWikiText($id, $text, $summary, $minor = false) { $type = DOKU_CHANGE_TYPE_CREATE; } else if($wasRemoved) { $type = DOKU_CHANGE_TYPE_DELETE; - } else if($minor && $conf['useacl'] && $_SERVER['REMOTE_USER']) { + } else if($minor && $conf['useacl'] && $INPUT->server->str('REMOTE_USER')) { $type = DOKU_CHANGE_TYPE_MINOR_EDIT; } //minor edits only for logged in users @@ -1140,7 +1173,6 @@ function saveWikiText($id, $text, $summary, $minor = false) { * @author Andreas Gohr <andi@splitbrain.org> */ function saveOldRevision($id) { - global $conf; $oldf = wikiFN($id); if(!@file_exists($oldf)) return ''; $date = filemtime($oldf); @@ -1164,6 +1196,8 @@ function saveOldRevision($id) { */ function notify($id, $who, $rev = '', $summary = '', $minor = false, $replace = array()) { global $conf; + /* @var Input $INPUT */ + global $INPUT; // decide if there is something to do, eg. whom to mail if($who == 'admin') { @@ -1172,7 +1206,7 @@ function notify($id, $who, $rev = '', $summary = '', $minor = false, $replace = $to = $conf['notify']; } elseif($who == 'subscribers') { if(!actionOK('subscribe')) return false; //subscribers enabled? - if($conf['useacl'] && $_SERVER['REMOTE_USER'] && $minor) return false; //skip minors + if($conf['useacl'] && $INPUT->server->str('REMOTE_USER') && $minor) return false; //skip minors $data = array('id' => $id, 'addresslist' => '', 'self' => false); trigger_event( 'COMMON_NOTIFY_ADDRESSLIST', $data, @@ -1197,10 +1231,13 @@ function notify($id, $who, $rev = '', $summary = '', $minor = false, $replace = * @author Todd Augsburger <todd@rollerorgans.com> */ function getGoogleQuery() { - if(!isset($_SERVER['HTTP_REFERER'])) { + /* @var Input $INPUT */ + global $INPUT; + + if(!$INPUT->server->has('HTTP_REFERER')) { return ''; } - $url = parse_url($_SERVER['HTTP_REFERER']); + $url = parse_url($INPUT->server->str('HTTP_REFERER')); // only handle common SEs if(!preg_match('/(google|bing|yahoo|ask|duckduckgo|babylon|aol|yandex)/',$url['host'])) return ''; @@ -1230,8 +1267,9 @@ 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 <b.martin@cybernet.ch> * @author Aidan Lister <aidan@php.net> * @version 1.0.0 @@ -1362,12 +1400,16 @@ function php_to_byte($v) { $l = substr($v, -1); $ret = substr($v, 0, -1); switch(strtoupper($l)) { + /** @noinspection PhpMissingBreakStatementInspection */ case 'P': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'T': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'G': $ret *= 1024; + /** @noinspection PhpMissingBreakStatementInspection */ case 'M': $ret *= 1024; case 'K': @@ -1518,6 +1560,9 @@ function is_mem_available($mem, $bytes = 1048576) { * @author Andreas Gohr <andi@splitbrain.org> */ function send_redirect($url) { + /* @var Input $INPUT */ + global $INPUT; + //are there any undisplayed messages? keep them in session for display global $MSG; if(isset($MSG) && count($MSG) && !defined('NOSESSION')) { @@ -1531,7 +1576,7 @@ function send_redirect($url) { // work around IE bug // http://www.ianhoar.com/2008/11/16/internet-explorer-6-and-redirected-anchor-links/ - list($url, $hash) = explode('#', $url); + @list($url, $hash) = explode('#', $url); if($hash) { if(strpos($url, '?')) { $url = $url.'&#'.$hash; @@ -1541,9 +1586,9 @@ function send_redirect($url) { } // check if running on IIS < 6 with CGI-PHP - if(isset($_SERVER['SERVER_SOFTWARE']) && isset($_SERVER['GATEWAY_INTERFACE']) && - (strpos($_SERVER['GATEWAY_INTERFACE'], 'CGI') !== false) && - (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($_SERVER['SERVER_SOFTWARE']), $matches)) && + if($INPUT->server->has('SERVER_SOFTWARE') && $INPUT->server->has('GATEWAY_INTERFACE') && + (strpos($INPUT->server->str('GATEWAY_INTERFACE'), 'CGI') !== false) && + (preg_match('|^Microsoft-IIS/(\d)\.\d$|', trim($INPUT->server->str('SERVER_SOFTWARE')), $matches)) && $matches[1] < 6 ) { header('Refresh: 0;url='.$url); diff --git a/inc/confutils.php b/inc/confutils.php index 0ac003b72..31371d41f 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -237,13 +237,14 @@ function getConfigFiles($type) { * check if the given action was disabled in config * * @author Andreas Gohr <andi@splitbrain.org> + * @param string $action * @returns boolean true if enabled, false if disabled */ function actionOK($action){ static $disabled = null; if(is_null($disabled) || defined('SIMPLE_TEST')){ global $conf; - /** @var auth_basic $auth */ + /** @var DokuWiki_Auth_Plugin $auth */ global $auth; // prepare disabled actions array and handle legacy options diff --git a/inc/events.php b/inc/events.php index f7b1a7a16..318a7617e 100644 --- a/inc/events.php +++ b/inc/events.php @@ -8,15 +8,18 @@ if(!defined('DOKU_INC')) die('meh.'); +/** + * The event + */ class Doku_Event { // public properties - var $name = ''; // READONLY event name, objects must register against this name to see the event - var $data = null; // READWRITE data relevant to the event, no standardised format (YET!) - var $result = null; // READWRITE the results of the event action, only relevant in "_AFTER" advise + public $name = ''; // READONLY event name, objects must register against this name to see the event + public $data = null; // READWRITE data relevant to the event, no standardised format (YET!) + public $result = null; // READWRITE the results of the event action, only relevant in "_AFTER" advise // event handlers may modify this if they are preventing the default action // to provide the after event handlers with event results - var $canPreventDefault = true; // READONLY if true, event handlers can prevent the events default action + public $canPreventDefault = true; // READONLY if true, event handlers can prevent the events default action // private properties, event handlers can effect these through the provided methods var $_default = true; // whether or not to carry out the default action associated with the event @@ -33,6 +36,13 @@ class Doku_Event { } /** + * @return string + */ + function __toString() { + return $this->name; + } + + /** * advise functions * * advise all registered handlers of this event @@ -47,7 +57,8 @@ class Doku_Event { * $evt->advise_after(); * unset($evt); * - * @return results of processing the event, usually $this->_default + * @param bool $enablePreventDefault + * @return bool results of processing the event, usually $this->_default */ function advise_before($enablePreventDefault=true) { global $EVENT_HANDLER; @@ -73,14 +84,21 @@ class Doku_Event { * $this->_default, all of which may have been modified by the event handlers. * - advise all registered (<event>_AFTER) handlers that the event has taken place * - * @return $event->results + * @param null|callable $action + * @param bool $enablePrevent + * @return mixed $event->results * the value set by any <event>_before or <event> handlers if the default action is prevented * or the results of the default action (as modified by <event>_after handlers) * or NULL no action took place and no handler modified the value */ function trigger($action=null, $enablePrevent=true) { - if (!is_callable($action)) $enablePrevent = false; + if (!is_callable($action)) { + $enablePrevent = false; + if (!is_null($action)) { + trigger_error('The default action of '.$this.' is not null but also not callable. Maybe the method is not public?', E_USER_WARNING); + } + } if ($this->advise_before($enablePrevent) && is_callable($action)) { if (is_array($action)) { @@ -112,12 +130,15 @@ class Doku_Event { function preventDefault() { $this->_default = false; } } +/** + * Controls the registration and execution of all events, + */ class Doku_Event_Handler { // public properties: none // private properties - var $_hooks = array(); // array of events and their registered handlers + protected $_hooks = array(); // array of events and their registered handlers /** * event_handler @@ -128,6 +149,7 @@ class Doku_Event_Handler { function Doku_Event_Handler() { // load action plugins + /** @var DokuWiki_Action_Plugin $plugin */ $plugin = null; $pluginlist = plugin_list('action'); @@ -143,34 +165,47 @@ class Doku_Event_Handler { * * register a hook for an event * - * @param $event (string) name used by the event, (incl '_before' or '_after' for triggers) - * @param $obj (obj) object in whose scope method is to be executed, + * @param $event string name used by the event, (incl '_before' or '_after' for triggers) + * @param $advise string + * @param $obj object object in whose scope method is to be executed, * if NULL, method is assumed to be a globally available function - * @param $method (function) event handler function - * @param $param (mixed) data passed to the event handler + * @param $method string event handler function + * @param $param mixed data passed to the event handler + * @param $seq int sequence number for ordering hook execution (ascending) */ - function register_hook($event, $advise, $obj, $method, $param=null) { - $this->_hooks[$event.'_'.$advise][] = array($obj, $method, $param); + function register_hook($event, $advise, $obj, $method, $param=null, $seq=0) { + $seq = (int)$seq; + $doSort = !isset($this->_hooks[$event.'_'.$advise][$seq]); + $this->_hooks[$event.'_'.$advise][$seq][] = array($obj, $method, $param); + + if ($doSort) { + ksort($this->_hooks[$event.'_'.$advise]); + } } - function process_event(&$event,$advise='') { + /** + * process the before/after event + * + * @param Doku_Event $event + * @param string $advise BEFORE or AFTER + */ + function process_event($event,$advise='') { $evt_name = $event->name . ($advise ? '_'.$advise : '_BEFORE'); if (!empty($this->_hooks[$evt_name])) { - foreach ($this->_hooks[$evt_name] as $hook) { - // list($obj, $method, $param) = $hook; - $obj =& $hook[0]; - $method = $hook[1]; - $param = $hook[2]; - - if (is_null($obj)) { - $method($event, $param); - } else { - $obj->$method($event, $param); - } + foreach ($this->_hooks[$evt_name] as $sequenced_hooks) { + foreach ($sequenced_hooks as $hook) { + list($obj, $method, $param) = $hook; - if (!$event->_continue) break; + if (is_null($obj)) { + $method($event, $param); + } else { + $obj->$method($event, $param); + } + + if (!$event->_continue) return; + } } } } @@ -181,12 +216,12 @@ class Doku_Event_Handler { * * function wrapper to process (create, trigger and destroy) an event * - * @param $name (string) name for the event - * @param $data (mixed) event data - * @param $action (callback) (optional, default=NULL) default action, a php callback function - * @param $canPreventDefault (bool) (optional, default=true) can hooks prevent the default action + * @param $name string name for the event + * @param $data mixed event data + * @param $action callback (optional, default=NULL) default action, a php callback function + * @param $canPreventDefault bool (optional, default=true) can hooks prevent the default action * - * @return (mixed) the event results value after all event processing is complete + * @return mixed the event results value after all event processing is complete * by default this is the return value of the default action however * it can be set or modified by event handler hooks */ diff --git a/inc/feedcreator.class.php b/inc/feedcreator.class.php index 670a1bc29..b90da5724 100644 --- a/inc/feedcreator.class.php +++ b/inc/feedcreator.class.php @@ -185,6 +185,8 @@ class HtmlDescribable { */ var $descriptionTruncSize; + var $description; + /** * Returns a formatted description field, depending on descriptionHtmlSyndicated and * $descriptionTruncSize properties @@ -222,7 +224,7 @@ class FeedHtmlField { /** * Creates a new instance of FeedHtmlField. - * @param $string: if given, sets the rawFieldContent property + * @param string $parFieldContent: if given, sets the rawFieldContent property */ function FeedHtmlField($parFieldContent) { if ($parFieldContent) { @@ -267,8 +269,14 @@ class FeedHtmlField { * @author Kai Blankenhorn <kaib@bitfolge.de> */ class UniversalFeedCreator extends FeedCreator { + /** @var FeedCreator */ var $_feed; + /** + * Sets format + * + * @param string $format + */ function _setFormat($format) { switch (strtoupper($format)) { @@ -344,7 +352,7 @@ class UniversalFeedCreator extends FeedCreator { * Creates a syndication feed based on the items previously added. * * @see FeedCreator::addItem() - * @param string format format the feed should comply to. Valid values are: + * @param string $format format the feed should comply to. Valid values are: * "PIE0.1", "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3", "HTML", "JS" * @return string the contents of the feed. */ @@ -358,10 +366,10 @@ class UniversalFeedCreator extends FeedCreator { * header may be sent to redirect the use to the newly created file. * @since 1.4 * - * @param string format format the feed should comply to. Valid values are: + * @param string $format format the feed should comply to. Valid values are: * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM", "ATOM0.3", "HTML", "JS" - * @param string filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param boolean displayContents optional send the content of the file or not. If true, the file will be sent in the body of the response. + * @param string $filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). + * @param boolean $displayContents optional send the content of the file or not. If true, the file will be sent in the body of the response. */ function saveFeed($format="RSS0.91", $filename="", $displayContents=true) { $this->_setFormat($format); @@ -376,10 +384,10 @@ class UniversalFeedCreator extends FeedCreator { * before anything else, especially before you do the time consuming task to build the feed * (web fetching, for example). * - * @param string format format the feed should comply to. Valid values are: + * @param string $format format the feed should comply to. Valid values are: * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3". - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) + * @param string $filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). + * @param int $timeout optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) */ function useCached($format="RSS0.91", $filename="", $timeout=3600) { $this->_setFormat($format); @@ -390,7 +398,7 @@ class UniversalFeedCreator extends FeedCreator { /** * Outputs feed to the browser - needed for on-the-fly feed generation (like it is done in WordPress, etc.) * - * @param format string format the feed should comply to. Valid values are: + * @param $format string format the feed should comply to. Valid values are: * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3". */ function outputFeed($format='RSS0.91') { @@ -422,7 +430,13 @@ class FeedCreator extends HtmlDescribable { /** * Optional attributes of a feed. */ - var $syndicationURL, $image, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays; + var $syndicationURL, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays; + /** + * Optional attribute of a feed + * + * @var FeedImage + */ + var $image = null; /** * The url of the external xsl stylesheet used to format the naked rss feed. @@ -430,13 +444,18 @@ class FeedCreator extends HtmlDescribable { */ var $xslStyleSheet = ""; + /** + * Style sheet for rss feed + */ + var $cssStyleSheet = ""; + /** * @access private + * @var FeedItem[] */ var $items = Array(); - /** * This feed's MIME content type. * @since 1.4 @@ -466,7 +485,7 @@ class FeedCreator extends HtmlDescribable { /** * Adds an FeedItem to the feed. * - * @param object FeedItem $item The FeedItem to add to the feed. + * @param FeedItem $item The FeedItem to add to the feed. * @access public */ function addItem($item) { @@ -482,8 +501,8 @@ class FeedCreator extends HtmlDescribable { * If the string is already shorter than $length, it is returned unchanged. * * @static - * @param string string A string to be truncated. - * @param int length the maximum length the string should be truncated to + * @param string $string A string to be truncated. + * @param int $length the maximum length the string should be truncated to * @return string the truncated string */ function iTrunc($string, $length) { @@ -527,8 +546,8 @@ class FeedCreator extends HtmlDescribable { /** * Creates a string containing all additional elements specified in * $additionalElements. - * @param elements array an associative array containing key => value pairs - * @param indentString string a string that will be inserted before every generated line + * @param $elements array an associative array containing key => value pairs + * @param $indentString string a string that will be inserted before every generated line * @return string the XML tags corresponding to $additionalElements */ function _createAdditionalElements($elements, $indentString="") { @@ -541,6 +560,9 @@ class FeedCreator extends HtmlDescribable { return $ae; } + /** + * Create elements for stylesheets + */ function _createStylesheetReferences() { $xml = ""; if ($this->cssStyleSheet) $xml .= "<?xml-stylesheet href=\"".$this->cssStyleSheet."\" type=\"text/css\"?>\n"; @@ -610,8 +632,8 @@ class FeedCreator extends HtmlDescribable { * before anything else, especially before you do the time consuming task to build the feed * (web fetching, for example). * @since 1.4 - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) + * @param $filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). + * @param $timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) */ function useCached($filename="", $timeout=3600) { $this->_timeout = $timeout; @@ -629,8 +651,8 @@ class FeedCreator extends HtmlDescribable { * header may be sent to redirect the user to the newly created file. * @since 1.4 * - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param redirect boolean optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file. + * @param $filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). + * @param $displayContents boolean optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file. */ function saveFeed($filename="", $displayContents=true) { if ($filename=="") { @@ -667,6 +689,7 @@ class FeedCreator extends HtmlDescribable { * Usually, you won't need to use this. */ class FeedDate { + /** @var int */ var $unix; /** @@ -726,7 +749,7 @@ class FeedDate { /** * Gets the date stored in this FeedDate as an RFC 822 date. * - * @return a date in RFC 822 format + * @return string a date in RFC 822 format */ function rfc822() { //return gmdate("r",$this->unix); @@ -738,7 +761,7 @@ class FeedDate { /** * Gets the date stored in this FeedDate as an ISO 8601 date. * - * @return a date in ISO 8601 (RFC 3339) format + * @return string a date in ISO 8601 (RFC 3339) format */ function iso8601() { $date = gmdate("Y-m-d\TH:i:sO",$this->unix); @@ -751,7 +774,7 @@ class FeedDate { /** * Gets the date stored in this FeedDate as unix time stamp. * - * @return a date as a unix time stamp + * @return int a date as a unix time stamp */ function unix() { return $this->unix; @@ -777,7 +800,7 @@ class RSSCreator10 extends FeedCreator { $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; $feed.= $this->_createGeneratorComment(); if ($this->cssStyleSheet=="") { - $cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css"; + $this->cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css"; } $feed.= $this->_createStylesheetReferences(); $feed.= "<rdf:RDF\n"; @@ -1032,12 +1055,16 @@ class PIECreator01 extends FeedCreator { $this->encoding = "utf-8"; } + /** + * Build content + * @return string + */ function createFeed() { $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; $feed.= $this->_createStylesheetReferences(); $feed.= "<feed version=\"0.1\" xmlns=\"http://example.com/newformat#\">\n"; $feed.= " <title>".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."</title>\n"; - $this->truncSize = 500; + $this->descriptionTruncSize = 500; $feed.= " <subtitle>".$this->getDescription()."</subtitle>\n"; $feed.= " <link>".$this->link."</link>\n"; $icnt = count($this->items); @@ -1091,6 +1118,10 @@ class AtomCreator10 extends FeedCreator { $this->encoding = "utf-8"; } + /** + * Build content + * @return string + */ function createFeed() { $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; $feed.= $this->_createGeneratorComment(); @@ -1174,6 +1205,10 @@ class AtomCreator03 extends FeedCreator { $this->encoding = "utf-8"; } + /** + * Build content + * @return string + */ function createFeed() { $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; $feed.= $this->_createGeneratorComment(); @@ -1281,6 +1316,7 @@ class MBOXCreator extends FeedCreator { */ function createFeed() { $icnt = count($this->items); + $feed = ""; for ($i=0; $i<$icnt; $i++) { if ($this->items[$i]->author!="") { $from = $this->items[$i]->author; @@ -1331,6 +1367,10 @@ class OPMLCreator extends FeedCreator { $this->encoding = "utf-8"; } + /** + * Build content + * @return string + */ function createFeed() { $feed = "<?xml version=\"1.0\" encoding=\"".$this->encoding."\"?>\n"; $feed.= $this->_createGeneratorComment(); @@ -1441,6 +1481,7 @@ class HTMLCreator extends FeedCreator { } //set an openInNewWindow_token_to be inserted or not + $targetInsert = ""; if ($this->openInNewWindow) { $targetInsert = " target='_blank'"; } @@ -1568,6 +1609,14 @@ class JSCreator extends HTMLCreator { * @author Andreas Gohr <andi@splitbrain.org> */ class DokuWikiFeedCreator extends UniversalFeedCreator{ + + /** + * Build content + * + * @param string $format + * @param string $encoding + * @return string + */ function createFeed($format = "RSS0.91",$encoding='iso-8859-15') { $this->_setFormat($format); $this->_feed->encoding = $encoding; diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index 3eacaa2fe..c61c54503 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -77,7 +77,7 @@ function sendFile($file, $mime, $dl, $cache, $public = false, $orig = null) { } //use x-sendfile header to pass the delivery to compatible webservers - if(http_sendfile($file)) exit; + http_sendfile($file); // send file contents $fp = @fopen($file, "rb"); diff --git a/inc/form.php b/inc/form.php index 312c42b60..610f50200 100644 --- a/inc/form.php +++ b/inc/form.php @@ -47,15 +47,11 @@ class Doku_Form { * with up to four parameters is deprecated, instead the first parameter * should be an array with parameters. * - * @param mixed $params Parameters for the HTML form element; Using the - * deprecated calling convention this is the ID - * attribute of the form - * @param string $action (optional, deprecated) submit URL, defaults to - * current page - * @param string $method (optional, deprecated) 'POST' or 'GET', default - * is POST - * @param string $enctype (optional, deprecated) Encoding type of the - * data + * @param mixed $params Parameters for the HTML form element; Using the deprecated + * calling convention this is the ID attribute of the form + * @param bool|string $action (optional, deprecated) submit URL, defaults to current page + * @param bool|string $method (optional, deprecated) 'POST' or 'GET', default is POST + * @param bool|string $enctype (optional, deprecated) Encoding type of the data * @author Tom N Harris <tnharris@whoopdedo.org> */ function Doku_Form($params, $action=false, $method=false, $enctype=false) { @@ -230,7 +226,7 @@ class Doku_Form { * first (underflow) or last (overflow) element. * * @param int $pos 0-based index - * @return arrayreference pseudo-element + * @return array reference pseudo-element * @author Tom N Harris <tnharris@whoopdedo.org> */ function &getElementAt($pos) { diff --git a/inc/fulltext.php b/inc/fulltext.php index 87b5a7370..dd918f214 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -72,8 +72,20 @@ function _ft_pageSearch(&$data) { $pages = end($stack); $pages_matched = array(); foreach(array_keys($pages) as $id){ - $text = utf8_strtolower(rawWiki($id)); - if (strpos($text, $phrase) !== false) { + $evdata = array( + 'id' => $id, + 'phrase' => $phrase, + 'text' => rawWiki($id) + ); + $evt = new Doku_Event('FULLTEXT_PHRASE_MATCH',$evdata); + if ($evt->advise_before() && $evt->result !== true) { + $text = utf8_strtolower($evdata['text']); + if (strpos($text, $phrase) !== false) { + $evt->result = true; + } + } + $evt->advise_after(); + if ($evt->result === true) { $pages_matched[$id] = 0; // phrase: always 0 hit } } diff --git a/inc/html.php b/inc/html.php index 0434f3b45..41f26e5cd 100644 --- a/inc/html.php +++ b/inc/html.php @@ -691,7 +691,7 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeOpenTag('div', array('class' => 'li'))); - if ($recent['media']) { + if (!empty($recent['media'])) { $form->addElement(media_printicon($recent['id'])); } else { $icon = DOKU_BASE.'lib/images/fileicons/file.png'; @@ -705,7 +705,7 @@ function html_recent($first=0, $show_changes='both'){ $diff = false; $href = ''; - if ($recent['media']) { + if (!empty($recent['media'])) { $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id']))); if ($diff) { $href = media_managerURL(array('tab_details' => 'history', @@ -715,7 +715,7 @@ function html_recent($first=0, $show_changes='both'){ $href = wl($recent['id'],"do=diff", false, '&'); } - if ($recent['media'] && !$diff) { + if (!empty($recent['media']) && !$diff) { $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />'); } else { $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => $href))); @@ -729,7 +729,7 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeCloseTag('a')); } - if ($recent['media']) { + if (!empty($recent['media'])) { $href = media_managerURL(array('tab_details' => 'history', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); } else { @@ -745,7 +745,7 @@ function html_recent($first=0, $show_changes='both'){ ))); $form->addElement(form_makeCloseTag('a')); - if ($recent['media']) { + if (!empty($recent['media'])) { $href = media_managerURL(array('tab_details' => 'view', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); $class = (file_exists(mediaFN($recent['id']))) ? 'wikilink1' : $class = 'wikilink2'; $form->addElement(form_makeOpenTag('a', array('class' => $class, 'href' => $href))); @@ -1189,7 +1189,7 @@ function html_diff($text='',$intro=true,$type=null){ $diffurl = wl($ID, array( 'do' => 'diff', 'rev2[0]' => $l_rev, - 'rev2[1]' => $r_rev ? $r_rev : $INFO['lastmod'], // link to exactly this view FS#2835 + 'rev2[1]' => $r_rev ? $r_rev : $INFO['currentrev'], // link to exactly this view FS#2835 'difftype' => $type, )); ptln('<p><a class="wikilink1" href="'.$diffurl.'">'.$lang['difflink'].'</a></p>'); diff --git a/inc/httputils.php b/inc/httputils.php index ca60ed509..efeb2a56c 100644 --- a/inc/httputils.php +++ b/inc/httputils.php @@ -64,12 +64,13 @@ function http_conditionalRequest($timestamp){ * Let the webserver send the given file via x-sendfile method * * @author Chris Smith <chris@jalakai.co.uk> - * @returns void or exits with previously header() commands executed + * @param string $file absolute path of file to send + * @returns void or exits with previous header() commands executed */ function http_sendfile($file) { global $conf; - //use x-sendfile header to pass the delivery to compatible webservers + //use x-sendfile header to pass the delivery to compatible web servers if($conf['xsendfile'] == 1){ header("X-LIGHTTPD-send-file: $file"); ob_end_clean(); @@ -79,12 +80,12 @@ function http_sendfile($file) { ob_end_clean(); exit; }elseif($conf['xsendfile'] == 3){ + // FS#2388 nginx just needs the relative path. + $file = DOKU_REL.substr($file, strlen(fullpath(DOKU_INC)) + 1); header("X-Accel-Redirect: $file"); ob_end_clean(); exit; } - - return false; } /** @@ -92,7 +93,7 @@ function http_sendfile($file) { * * This function exits the running script * - * @param ressource $fh - file handle for an already open file + * @param resource $fh - file handle for an already open file * @param int $size - size of the whole file * @param int $mime - MIME type of the file * @@ -204,7 +205,7 @@ function http_gzip_valid($uncompressed_file) { * * This function handles output of cacheable resource files. It ses the needed * HTTP headers. If a useable cache is present, it is passed to the web server - * and the scrpt is terminated. + * and the script is terminated. */ function http_cached($cache, $cache_ok) { global $conf; @@ -223,7 +224,8 @@ function http_cached($cache, $cache_ok) { header('Content-Encoding: gzip'); readfile($cache.".gz"); } else { - if (!http_sendfile($cache)) readfile($cache); + http_sendfile($cache); + readfile($cache); } exit; } diff --git a/inc/indexer.php b/inc/indexer.php index 07f29b542..a167db47f 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -270,8 +270,9 @@ class Doku_Indexer { // Special handling for titles so the index file is simpler if (array_key_exists('title', $key)) { $value = $key['title']; - if (is_array($value)) + if (is_array($value)) { $value = $value[0]; + } $this->saveIndexKey('title', '', $pid, $value); unset($key['title']); } @@ -299,20 +300,24 @@ class Doku_Indexer { if ($val !== "") { $id = array_search($val, $metawords, true); if ($id === false) { + // didn't find $val, so we'll add it to the end of metawords and create a placeholder in metaidx $id = count($metawords); $metawords[$id] = $val; + $metaidx[$id] = ''; $addwords = true; } // test if value is already in the index - if (isset($val_idx[$id]) && $val_idx[$id] <= 0) + if (isset($val_idx[$id]) && $val_idx[$id] <= 0){ $val_idx[$id] = 0; - else // else add it + } else { // else add it $val_idx[$id] = 1; + } } } - if ($addwords) + if ($addwords) { $this->saveIndex($metaname.'_w', '', $metawords); + } $vals_changed = false; foreach ($val_idx as $id => $action) { if ($action == -1) { @@ -1214,14 +1219,16 @@ class Doku_Indexer { */ protected function updateTuple($line, $id, $count) { $newLine = $line; - if ($newLine !== '') + if ($newLine !== ''){ $newLine = preg_replace('/(^|:)'.preg_quote($id,'/').'\*\d*/', '', $newLine); + } $newLine = trim($newLine, ':'); if ($count) { - if (strlen($newLine) > 0) + if (strlen($newLine) > 0) { return "$id*$count:".$newLine; - else + } else { return "$id*$count".$newLine; + } } return $newLine; } diff --git a/inc/infoutils.php b/inc/infoutils.php index 3636d86a1..0992040d9 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -102,6 +102,8 @@ function getVersion(){ function check(){ global $conf; global $INFO; + /* @var Input $INPUT */ + global $INPUT; if ($INFO['isadmin'] || $INFO['ismanager']){ msg('DokuWiki version: '.getVersion(),1); @@ -204,7 +206,7 @@ function check(){ } if($INFO['userinfo']['name']){ - msg('You are currently logged in as '.$_SERVER['REMOTE_USER'].' ('.$INFO['userinfo']['name'].')',0); + msg('You are currently logged in as '.$INPUT->server->str('REMOTE_USER').' ('.$INFO['userinfo']['name'].')',0); msg('You are part of the groups '.join($INFO['userinfo']['grps'],', '),0); }else{ msg('You are currently not logged in',0); @@ -361,6 +363,9 @@ function dbg($msg,$hidden=false){ */ function dbglog($msg,$header=''){ global $conf; + /* @var Input $INPUT */ + global $INPUT; + // The debug log isn't automatically cleaned thus only write it when // debugging has been enabled by the user. if($conf['allowdebug'] !== 1) return; @@ -373,7 +378,7 @@ function dbglog($msg,$header=''){ $file = $conf['cachedir'].'/debug.log'; $fh = fopen($file,'a'); if($fh){ - fwrite($fh,date('H:i:s ').$_SERVER['REMOTE_ADDR'].': '.$msg."\n"); + fwrite($fh,date('H:i:s ').$INPUT->server->str('REMOTE_ADDR').': '.$msg."\n"); fclose($fh); } } diff --git a/inc/init.php b/inc/init.php index a937b934d..4ff239787 100644 --- a/inc/init.php +++ b/inc/init.php @@ -140,18 +140,21 @@ if ($conf['gzip_output'] && } // init session -if (!headers_sent() && !defined('NOSESSION')){ - session_name("DokuWiki"); - $cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir']; - if (version_compare(PHP_VERSION, '5.2.0', '>')) { - session_set_cookie_params(0,$cookieDir,'',($conf['securecookie'] && is_ssl()),true); - }else{ - session_set_cookie_params(0,$cookieDir,'',($conf['securecookie'] && is_ssl())); +if(!headers_sent() && !defined('NOSESSION')) { + if(!defined('DOKU_SESSION_NAME')) define ('DOKU_SESSION_NAME', "DokuWiki"); + if(!defined('DOKU_SESSION_LIFETIME')) define ('DOKU_SESSION_LIFETIME', 0); + if(!defined('DOKU_SESSION_PATH')) { + $cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir']; + define ('DOKU_SESSION_PATH', $cookieDir); } + if(!defined('DOKU_SESSION_DOMAIN')) define ('DOKU_SESSION_DOMAIN', ''); + + session_name(DOKU_SESSION_NAME); + session_set_cookie_params(DOKU_SESSION_LIFETIME, DOKU_SESSION_PATH, DOKU_SESSION_DOMAIN, ($conf['securecookie'] && is_ssl()), true); session_start(); // load left over messages - if(isset($_SESSION[DOKU_COOKIE]['msg'])){ + if(isset($_SESSION[DOKU_COOKIE]['msg'])) { $MSG = $_SESSION[DOKU_COOKIE]['msg']; unset($_SESSION[DOKU_COOKIE]['msg']); } @@ -173,7 +176,7 @@ if(function_exists('set_magic_quotes_runtime')) @set_magic_quotes_runtime(0); $_REQUEST = array_merge($_GET,$_POST); // we don't want a purge URL to be digged -if(isset($_REQUEST['purge']) && $_SERVER['HTTP_REFERER']) unset($_REQUEST['purge']); +if(isset($_REQUEST['purge']) && !empty($_SERVER['HTTP_REFERER'])) unset($_REQUEST['purge']); // disable gzip if not available if($conf['compression'] == 'bz2' && !function_exists('bzopen')){ @@ -183,11 +186,6 @@ if($conf['compression'] == 'gz' && !function_exists('gzopen')){ $conf['compression'] = 0; } -// fix dateformat for upgraders -if(strpos($conf['dformat'],'%') === false){ - $conf['dformat'] = '%Y/%m/%d %H:%M'; -} - // precalculate file creation modes init_creationmodes(); @@ -404,6 +402,10 @@ function remove_magic_quotes(&$array) { * Returns the full absolute URL to the directory where * DokuWiki is installed in (includes a trailing slash) * + * !! Can not access $_SERVER values through $INPUT + * !! here as this function is called before $INPUT is + * !! initialized. + * * @author Andreas Gohr <andi@splitbrain.org> */ function getBaseURL($abs=null){ @@ -443,12 +445,12 @@ function getBaseURL($abs=null){ //split hostheader into host and port if(isset($_SERVER['HTTP_HOST'])){ $parsed_host = parse_url('http://'.$_SERVER['HTTP_HOST']); - $host = $parsed_host['host']; - $port = $parsed_host['port']; + $host = isset($parsed_host['host']) ? $parsed_host['host'] : null; + $port = isset($parsed_host['port']) ? $parsed_host['port'] : null; }elseif(isset($_SERVER['SERVER_NAME'])){ $parsed_host = parse_url('http://'.$_SERVER['SERVER_NAME']); - $host = $parsed_host['host']; - $port = $parsed_host['port']; + $host = isset($parsed_host['host']) ? $parsed_host['host'] : null; + $port = isset($parsed_host['port']) ? $parsed_host['port'] : null; }else{ $host = php_uname('n'); $port = ''; diff --git a/inc/io.php b/inc/io.php index c5225a2e0..27a34b045 100644 --- a/inc/io.php +++ b/inc/io.php @@ -367,8 +367,6 @@ function io_createNamespace($id, $ns_type='pages') { * @author Andreas Gohr <andi@splitbrain.org> */ function io_makeFileDir($file){ - global $conf; - $dir = dirname($file); if(!@is_dir($dir)){ io_mkdir_p($dir) || msg("Creating directory $dir failed",-1); diff --git a/inc/lang/bn/lang.php b/inc/lang/bn/lang.php index 94a3fbb12..230f3ef80 100644 --- a/inc/lang/bn/lang.php +++ b/inc/lang/bn/lang.php @@ -5,6 +5,7 @@ * * @author Foysol <ragebot1125@gmail.com> * @author ninetailz <ninetailz1125@gmail.com> + * @author Khan M. B. Asad <muhammad2017@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'itr'; @@ -127,3 +128,33 @@ $lang['js']['medialeft'] = 'বাম দিকে ইমেজ সার $lang['js']['mediaright'] = 'ডান দিকে ইমেজ সারিবদ্ধ কর'; $lang['js']['mediacenter'] = 'মাঝখানে ইমেজ সারিবদ্ধ কর'; $lang['js']['medianoalign'] = 'কোনো সারিবদ্ধ করা প্রয়োজন নেই'; +$lang['js']['nosmblinks'] = 'উইন্ডোস শেয়ার এর সাথে সংযোগ সাধন কেবল মাইক্রোসফ্ট ইন্টারনেট এক্সপ্লোরারেই সম্ভব।\nতবে আপনি লিংকটি কপি পেস্ট করতেই পারেন।'; +$lang['js']['linkwiz'] = 'লিংক উইজার্ড'; +$lang['js']['linkto'] = 'সংযোগের লক্ষ্য:'; +$lang['js']['del_confirm'] = 'নির্বাচিত আইটেম(গুলো) আসলেই মুছে ফেলতে চান?'; +$lang['js']['restore_confirm'] = 'এই সংস্করণ সত্যিই পূর্বাবস্থায় ফিরিয়ে আনতে চান?'; +$lang['js']['media_diff'] = 'পার্থক্যগুলো দেখুন:'; +$lang['js']['media_diff_both'] = 'পাশাপাশি'; +$lang['js']['media_diff_opacity'] = 'শাইন-থ্রু'; +$lang['js']['media_diff_portions'] = 'ঝেঁটিয়ে বিদায়'; +$lang['js']['media_select'] = 'ফাইল নির্বাচন...'; +$lang['js']['media_upload_btn'] = 'আপলোড'; +$lang['js']['media_done_btn'] = 'সাধিত'; +$lang['js']['media_drop'] = 'আপলোডের জন্য এখানে ফাইল ফেলুন'; +$lang['js']['media_cancel'] = 'অপসারণ'; +$lang['js']['media_overwrt'] = 'বর্তমান ফাইল ওভাররাইট করুন'; +$lang['rssfailed'] = 'ফিডটি জোগাড় করতে গিয়ে একটি ত্রুটি ঘটেছে:'; +$lang['nothingfound'] = 'কিছু পাওয়া যায়নি।'; +$lang['mediaselect'] = 'মিডিয়া ফাইল'; +$lang['fileupload'] = 'মিডিয়া ফাইল আপলোড'; +$lang['uploadsucc'] = 'আপলোড সফল'; +$lang['uploadfail'] = 'আপলোড ব্যর্থ। অনুমতি জনিত ত্রুটি কী?'; +$lang['uploadwrong'] = 'আপলোড প্রত্যাখ্যাত। এই ফাইল এক্সটেনশন অননুমোদিত।'; +$lang['uploadexist'] = 'ফাইল ইতিমধ্যেই বিরাজমান। কিছু করা হয়নি।'; +$lang['uploadbadcontent'] = 'আপলোডকৃত সামগ্রী %s ফাইল এক্সটেনশন এর সাথে মিলেনি।'; +$lang['uploadspam'] = 'স্প্যাম ব্ল্যাকলিস্ট আপলোড আটকে দিয়েছে।'; +$lang['uploadxss'] = 'সামগ্রীটি ক্ষতিকর ভেবে আপলোড আটকে দেয়া হয়েছে।'; +$lang['uploadsize'] = 'আপলোডকৃত ফাইলটি বেশি বড়ো। (সর্বোচ্চ %s)'; +$lang['deletesucc'] = '"%s" ফাইলটি মুছে ফেলা হয়েছে।'; +$lang['deletefail'] = '"%s" ডিলিট করা যায়নি - অনুমতি আছে কি না দেখুন।'; +$lang['mediainuse'] = '"%s" ফাইলটি মোছা হয়নি - এটি এখনো ব্যবহৃত হচ্ছে।'; diff --git a/inc/lang/de/lang.php b/inc/lang/de/lang.php index 9df1035f7..1840f2a6c 100644 --- a/inc/lang/de/lang.php +++ b/inc/lang/de/lang.php @@ -23,6 +23,7 @@ * @author Pierre Corell <info@joomla-praxis.de> * @author Mateng Schimmerlos <mateng@firemail.de> * @author Benedikt Fey <spam@lifeisgoooood.de> + * @author Joerg <scooter22@gmx.de> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -345,3 +346,4 @@ $lang['media_restore'] = 'Diese Version wiederherstellen'; $lang['currentns'] = 'Aktueller Namensraum'; $lang['searchresult'] = 'Suchergebnisse'; $lang['plainhtml'] = 'HTML Klartext'; +$lang['wikimarkup'] = 'Wiki Markup'; diff --git a/inc/lang/eo/admin.txt b/inc/lang/eo/admin.txt index 4b0cf7909..4b3cf0c2a 100644 --- a/inc/lang/eo/admin.txt +++ b/inc/lang/eo/admin.txt @@ -1,3 +1,3 @@ ====== Administrado ====== -Sube vi povas trovi liston de administraj taskoj disponeblaj en DokuWiki. +Sube vi trovas liston de administraj taskoj haveblaj en DokuWiki. diff --git a/inc/lang/eo/adminplugins.txt b/inc/lang/eo/adminplugins.txt index 769a8c538..bb7e7829b 100644 --- a/inc/lang/eo/adminplugins.txt +++ b/inc/lang/eo/adminplugins.txt @@ -1 +1 @@ -===== Eksteraj kromaĵoj =====
\ No newline at end of file +===== Aldonaj kromaĵoj =====
\ No newline at end of file diff --git a/inc/lang/eo/diff.txt b/inc/lang/eo/diff.txt index 5829a7db1..3c9db61c8 100644 --- a/inc/lang/eo/diff.txt +++ b/inc/lang/eo/diff.txt @@ -1,4 +1,4 @@ ====== Diferencoj ====== -Ĉi tie vi povas vidi diferencojn inter la aktuala versio kaj la elektita revizio de la paĝo. +Tio montras diferencojn inter du versioj de la paĝo. diff --git a/inc/lang/eo/draft.txt b/inc/lang/eo/draft.txt index 32ddc83f6..57526f3b5 100644 --- a/inc/lang/eo/draft.txt +++ b/inc/lang/eo/draft.txt @@ -1,5 +1,5 @@ ====== Skiza dosiero troviĝis ====== -Via lasta sekcio de redakto en tiu ĉi paĝo ne korekte kompletiĝis. DokuWiki aŭtomate konservis skizon dum vi laboris, kiun vi nun povas uzi por daŭrigi vian redaktadon. Sube vi povas vidi la datumaron, kiu konserviĝis el via lasta sekcio. +Via lasta redaktosesio en tiu ĉi paĝo ne ĝuste kompletiĝis. DokuWiki aŭtomate konservis skizon dum vi laboris, kiun vi nun povas uzi por daŭrigi vian redaktadon. Sube vi povas vidi la datumaron, kiu konserviĝis el via lasta sesio. Bonvolu decidi ĉu vi volas //restarigi// vian perditan redakton, //forigi// la aŭtomate konservitan skizon aŭ //rezigni// pri la redakta procezo. diff --git a/inc/lang/eo/edit.txt b/inc/lang/eo/edit.txt index 29b3382c5..ccc8a613d 100644 --- a/inc/lang/eo/edit.txt +++ b/inc/lang/eo/edit.txt @@ -1 +1 @@ -Redaktu paĝon kaj poste premu butonon titolitan '"Konservi'". Bonvolu tralegi la [[wiki:syntax|vikian sintakson]] por kompreni kiel vi povas krei paĝojn. Bonvolu redakti nur se vi planas **plibonigi** la enhavon de la paĝo. Se vi volas nur testi ion, bonvolu uzi specialan paĝon: [[wiki:playground|ludejo]]. +Redaktu paĝon kaj poste premu butonon titolitan '"Konservi'". Bonvolu tralegi la [[wiki:syntax|vikian sintakson]] pri la formatigo. Bonvolu redakti **nur**, se vi povas **plibonigi** la enhavon de la paĝo. Se vi volas nur testi ion, bonvolu uzi specialan paĝon: [[playground:playground|sablokesto]]. diff --git a/inc/lang/eo/editrev.txt b/inc/lang/eo/editrev.txt index 1640baa91..2e1406b0f 100644 --- a/inc/lang/eo/editrev.txt +++ b/inc/lang/eo/editrev.txt @@ -1,2 +1,2 @@ -**Vi laboras kun malnova revizio de la dokumento!** Se vi konservos ĝin, kreiĝos nova kuranta versio kun la sama enhavo. +**Vi laboras kun malnova revizio de la dokumento!** Se vi konservos ĝin, kreiĝos nova kuranta versio kun tiu enhavo. ---- diff --git a/inc/lang/eo/lang.php b/inc/lang/eo/lang.php index a543b2571..97231bdce 100644 --- a/inc/lang/eo/lang.php +++ b/inc/lang/eo/lang.php @@ -37,13 +37,13 @@ $lang['btn_secedit'] = 'Redakti'; $lang['btn_login'] = 'Ensaluti'; $lang['btn_logout'] = 'Elsaluti'; $lang['btn_admin'] = 'Administri'; -$lang['btn_update'] = 'Ĝisdatigi'; +$lang['btn_update'] = 'Aktualigi'; $lang['btn_delete'] = 'Forigi'; $lang['btn_back'] = 'Retroiri'; $lang['btn_backlink'] = 'Retroligoj'; $lang['btn_backtomedia'] = 'Retroiri al elekto de dosiero'; $lang['btn_subscribe'] = 'Aliĝi al paĝaj modifoj'; -$lang['btn_profile'] = 'Ĝisdatigi profilon'; +$lang['btn_profile'] = 'Aktualigi profilon'; $lang['btn_reset'] = 'Rekomenci'; $lang['btn_resendpwd'] = 'Sendi novan pasvorton'; $lang['btn_draft'] = 'Redakti skizon'; @@ -53,7 +53,7 @@ $lang['btn_revert'] = 'Restarigi'; $lang['btn_register'] = 'Registriĝi'; $lang['btn_apply'] = 'Apliki'; $lang['btn_media'] = 'Medio-administrilo'; -$lang['btn_deleteuser'] = 'Forigi mian aliĝon'; +$lang['btn_deleteuser'] = 'Forigi mian konton'; $lang['loggedinas'] = 'Ensalutinta kiel'; $lang['user'] = 'Uzant-nomo'; $lang['pass'] = 'Pasvorto'; @@ -81,7 +81,7 @@ $lang['reghere'] = 'Se vi ne havas konton, vi povas akiri ĝin'; $lang['profna'] = 'Tiu ĉi vikio ne ebligas modifon en la profiloj.'; $lang['profnochange'] = 'Neniu ŝanĝo, nenio farinda.'; $lang['profnoempty'] = 'Malplena nomo aŭ retadreso ne estas permesata.'; -$lang['profchanged'] = 'La profilo de la uzanto sukcese ĝisdatiĝis.'; +$lang['profchanged'] = 'La profilo de la uzanto sukcese aktualiĝis.'; $lang['profnodelete'] = 'Tiu ĉi vikio ne subtenas forigo de uzantoj'; $lang['profdeleteuser'] = 'Forigi aliĝon'; $lang['profdeleted'] = 'Via uzant-aliĝo estis forigata de tiu ĉi vikio'; @@ -104,7 +104,7 @@ $lang['txt_filename'] = 'Alŝuti kiel (laŭvole)'; $lang['txt_overwrt'] = 'Anstataŭigi ekzistantan dosieron'; $lang['maxuploadsize'] = 'Alŝuto maks. %s po dosiero.'; $lang['lockedby'] = 'Nune ŝlosita de'; -$lang['lockexpire'] = 'Ŝlosado ĉesos en'; +$lang['lockexpire'] = 'Ŝlosado ĉesos je'; $lang['js']['willexpire'] = 'Vi povos redakti ĉi tiun paĝon post unu minuto.\nSe vi volas nuligi tempokontrolon de la ŝlosado, premu la butonon "Antaŭrigardi".'; $lang['js']['notsavedyet'] = 'Ne konservitaj modifoj perdiĝos. Ĉu vi certe volas daŭrigi la procezon?'; @@ -293,6 +293,7 @@ $lang['i_policy'] = 'Komenca ACL-a agordo'; $lang['i_pol0'] = 'Malferma Vikio (legi, skribi, alŝuti povas ĉiuj)'; $lang['i_pol1'] = 'Publika Vikio (legi povas ĉiuj, skribi kaj alŝuti povas registritaj uzantoj)'; $lang['i_pol2'] = 'Ferma Vikio (legi, skribi, alŝuti nur povas registritaj uzantoj)'; +$lang['i_allowreg'] = 'Permesi al uzantoj registri sin mem'; $lang['i_retry'] = 'Reprovi'; $lang['i_license'] = 'Bonvolu elekti la permesilon, sub kiun vi volas meti vian enhavon:'; $lang['i_license_none'] = 'Ne montri licencinformojn'; diff --git a/inc/lang/es/lang.php b/inc/lang/es/lang.php index 216093f6c..b9f81dd82 100644 --- a/inc/lang/es/lang.php +++ b/inc/lang/es/lang.php @@ -31,6 +31,7 @@ * @author r0sk <r0sk10@gmail.com> * @author monica <may.dorado@gmail.com> * @author Antonio Bueno <atnbueno@gmail.com> + * @author Juan De La Cruz <juann.dlc@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; diff --git a/inc/lang/et/adminplugins.txt b/inc/lang/et/adminplugins.txt new file mode 100644 index 000000000..ee3ffb0a7 --- /dev/null +++ b/inc/lang/et/adminplugins.txt @@ -0,0 +1 @@ +===== Täiendavad laiendused =====
\ No newline at end of file diff --git a/inc/lang/et/lang.php b/inc/lang/et/lang.php index cc736db4d..6018a7608 100644 --- a/inc/lang/et/lang.php +++ b/inc/lang/et/lang.php @@ -1,13 +1,15 @@ <?php + /** - * Estonian language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Oliver S6ro <seem.iges@mail.ee> * @author Aari Juhanson <aari@vmg.vil.ee> * @author Kaiko Kaur <kaiko@kultuur.edu.ee> * @author kristian.kankainen@kuu.la * @author Rivo Zängov <eraser@eraser.ee> + * @author Janar Leas <janarleas@gmail.com> + * @author Janar Leas <janar.leas@eesti.ee> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -43,11 +45,15 @@ $lang['btn_backtomedia'] = 'Tagasi faili valikusse'; $lang['btn_subscribe'] = 'Jälgi seda lehte (teated meilile)'; $lang['btn_profile'] = 'Minu info'; $lang['btn_reset'] = 'Taasta'; +$lang['btn_resendpwd'] = 'Sea uus salasõna'; $lang['btn_draft'] = 'Toimeta mustandit'; $lang['btn_recover'] = 'Taata mustand'; $lang['btn_draftdel'] = 'Kustuta mustand'; $lang['btn_revert'] = 'Taasta'; $lang['btn_register'] = 'Registreeri uus kasutaja'; +$lang['btn_apply'] = 'Kinnita'; +$lang['btn_media'] = 'Meedia haldur'; +$lang['btn_deleteuser'] = 'Eemalda minu konto'; $lang['loggedinas'] = 'Logis sisse kui'; $lang['user'] = 'Kasutaja'; $lang['pass'] = 'Parool'; @@ -59,8 +65,10 @@ $lang['fullname'] = 'Täielik nimi'; $lang['email'] = 'E-post'; $lang['profile'] = 'Kasutaja info'; $lang['badlogin'] = 'Oops, Sinu kasutajanimi või parool oli vale.'; +$lang['badpassconfirm'] = 'Väär salasõna'; $lang['minoredit'] = 'Ebaolulised muudatused'; $lang['draftdate'] = 'Mustand automaatselt salvestatud'; +$lang['nosecedit'] = 'Leht on vahepeal muutunud, jaotiste teave osutus aegunuks sestap laeti tervelehekülg.'; $lang['regmissing'] = 'Kõik väljad tuleb ära täita.'; $lang['reguexists'] = 'Tegelikult on sellise nimega kasutaja juba olemas.'; $lang['regsuccess'] = 'Kasutaja sai tehtud. Parool saadeti Sulle e-posti aadressil.'; @@ -76,21 +84,30 @@ $lang['profna'] = 'Viki ei toeta profiili muudatusi'; $lang['profnochange'] = 'Muutused puuduvad.'; $lang['profnoempty'] = 'Tühi nimi ega meiliaadress pole lubatud.'; $lang['profchanged'] = 'Kasutaja info edukalt muudetud'; +$lang['profnodelete'] = 'See wiki ei toeta kasutajate kustutamist'; +$lang['profdeleteuser'] = 'Kustuta konto'; +$lang['profdeleted'] = 'Sinu kasutajakonto on sellest wikist kustutatud'; +$lang['profconfdelete'] = 'Soovin sellest wikist oma konnto eemaldada. <br/> See tegevus on taastamatu.'; +$lang['profconfdeletemissing'] = 'Kinnituse valikkast märkimata.'; $lang['pwdforget'] = 'Unustasid parooli? Tee uus'; $lang['resendna'] = 'See wiki ei toeta parooli taassaatmist.'; +$lang['resendpwd'] = 'Sea uus salasõna'; $lang['resendpwdmissing'] = 'Khmm... Sa pead täitma kõik väljad.'; $lang['resendpwdnouser'] = 'Aga sellist kasutajat ei ole.'; $lang['resendpwdbadauth'] = 'See autentimiskood ei ole õige. Kontrolli, et kopeerisid terve lingi.'; $lang['resendpwdconfirm'] = 'Kinnituslink saadeti meilile.'; $lang['resendpwdsuccess'] = 'Uus parool saadeti Sinu meilile.'; +$lang['license'] = 'Kus pole öeldud teisiti, kehtib selle wiki sisule järgmine leping:'; +$lang['licenseok'] = 'Teadmiseks: Toimetades seda lehte, nõustud avaldama oma sisu järgmise lepingu alusel:'; $lang['searchmedia'] = 'Otsi failinime:'; $lang['searchmedia_in'] = 'Otsi %s'; $lang['txt_upload'] = 'Vali fail, mida üles laadida'; $lang['txt_filename'] = 'Siseta oma Wikinimi (soovituslik)'; $lang['txt_overwrt'] = 'Kirjutan olemasoleva faili üle'; +$lang['maxuploadsize'] = 'Üleslaadimiseks lubatu enim %s faili kohta.'; $lang['lockedby'] = 'Praegu on selle lukustanud'; $lang['lockexpire'] = 'Lukustus aegub'; -$lang['js']['willexpire'] = 'Teie lukustus selle lehe toimetamisele aegub umbes minuti pärast.\nIgasugu probleemide vältimiseks kasuta eelvaate nuppu, et lukustusarvesti taas tööle panna.'; +$lang['js']['willexpire'] = 'Teie lukustus selle lehe toimetamisele aegub umbes minuti pärast.\nIgasugu probleemide vältimiseks kasuta eelvaate nuppu, et lukustusarvesti taas tööle panna.'; $lang['js']['notsavedyet'] = 'Sul on seal salvestamata muudatusi, mis kohe kõige kaduva teed lähevad. Kas Sa ikka tahad edasi liikuda?'; $lang['js']['searchmedia'] = 'Otsi faile'; @@ -122,6 +139,17 @@ Siiski võid kopeerida ja asetada lingi.'; $lang['js']['linkwiz'] = 'Lingi nõustaja'; $lang['js']['linkto'] = 'Lingi:'; $lang['js']['del_confirm'] = 'Kas kustutame selle kirje?'; +$lang['js']['restore_confirm'] = 'Tõesti taastad selle järgu?'; +$lang['js']['media_diff'] = 'Vaatle erisusi:'; +$lang['js']['media_diff_both'] = 'Kõrvuti'; +$lang['js']['media_diff_opacity'] = 'Kuma läbi'; +$lang['js']['media_diff_portions'] = 'Puhasta'; +$lang['js']['media_select'] = 'Vali failid…'; +$lang['js']['media_upload_btn'] = 'Lae üles'; +$lang['js']['media_done_btn'] = 'Valmis'; +$lang['js']['media_drop'] = 'Üleslaadimiseks viska failid siia'; +$lang['js']['media_cancel'] = 'eemalda'; +$lang['js']['media_overwrt'] = 'Asenda olemasolevad failid'; $lang['rssfailed'] = 'Sinu soovitud info ammutamisel tekkis viga: '; $lang['nothingfound'] = 'Oops, aga mitte muhvigi ei leitud.'; $lang['mediaselect'] = 'Hunnik faile'; @@ -131,6 +159,8 @@ $lang['uploadfail'] = 'Üleslaadimine läks nässu. Äkki pole Sa sel $lang['uploadwrong'] = 'Ei saa Sa midagi üles laadida. Oops, aga seda tüüpi faili sul lihtsalt ei lubata üles laadida'; $lang['uploadexist'] = 'Fail on juba olemas. Midagi ei muudetud.'; $lang['uploadbadcontent'] = 'Üles laaditu ei sobinud %s faililaiendiga.'; +$lang['uploadspam'] = 'Üleslaadimine tõrjuti rämpssisu vältija poolt.'; +$lang['uploadxss'] = 'Üleslaadimine tõrjuti kahtlase sisu võimaluse tõttu'; $lang['uploadsize'] = 'Üles laaditud fail on liiga suur (maksimaalne suurus on %s).'; $lang['deletesucc'] = 'Fail nimega "%s" sai kustutatud.'; $lang['deletefail'] = 'Faili nimega "%s" ei kustutatud (kontrolli õigusi).'; @@ -155,6 +185,7 @@ $lang['diff'] = 'Näita erinevusi hetkel kehtiva versiooniga'; $lang['diff2'] = 'Näita valitud versioonide erinevusi'; $lang['difflink'] = 'Lõlita võrdlemise vaatele'; $lang['diff_type'] = 'Vaata erinevusi:'; +$lang['diff_inline'] = 'Jooksvalt'; $lang['diff_side'] = 'Kõrvuti'; $lang['line'] = 'Rida'; $lang['breadcrumb'] = 'Käidud rada'; @@ -166,9 +197,22 @@ $lang['created'] = 'tekitatud'; $lang['restored'] = 'vana versioon taastatud (%s)'; $lang['external_edit'] = 'väline muutmine'; $lang['summary'] = 'kokkuvõte muudatustest'; +$lang['noflash'] = 'Sele sisu vaatamisesks on vajalik <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Laiendus</a>.'; +$lang['tools'] = 'Tööriistad'; +$lang['user_tools'] = 'Kasutaja tarvikud'; +$lang['site_tools'] = 'Lehe tööriistad'; +$lang['page_tools'] = 'Lehekülje tarvikud'; +$lang['skip_to_content'] = 'mine sisule'; +$lang['sidebar'] = 'Külgriba'; $lang['mail_newpage'] = 'leht lisatud:'; $lang['mail_changed'] = 'leht muudetud'; +$lang['mail_subscribe_list'] = 'muutunud lehed nimeruumis:'; $lang['mail_new_user'] = 'Uus kasutaja:'; +$lang['mail_upload'] = 'üles laetud fail:'; +$lang['changes_type'] = 'Näita mmutuseid'; +$lang['pages_changes'] = 'Leheküljed'; +$lang['media_changes'] = 'Meedia failid'; +$lang['both_changes'] = 'Mõlemid, leheküljed ja meedia failid'; $lang['qb_bold'] = 'Rasvane kiri'; $lang['qb_italic'] = 'Kaldkiri'; $lang['qb_underl'] = 'Alajoonega kiri'; @@ -193,6 +237,7 @@ $lang['qb_media'] = 'Lisa pilte ja muid faile'; $lang['qb_sig'] = 'Lisa allkiri!'; $lang['qb_smileys'] = 'Emotikonid'; $lang['qb_chars'] = 'Erisümbolid'; +$lang['upperns'] = 'mine ülemisse nimeruumi'; $lang['admin_register'] = 'Lisa kasutaja'; $lang['metaedit'] = 'Muuda lisainfot'; $lang['metasaveerr'] = 'Lisainfo salvestamine läks untsu.'; @@ -208,7 +253,26 @@ $lang['img_copyr'] = 'Autoriõigused'; $lang['img_format'] = 'Formaat'; $lang['img_camera'] = 'Kaamera'; $lang['img_keywords'] = 'Võtmesõnad'; +$lang['img_width'] = 'Laius'; +$lang['img_height'] = 'Kõrgus'; +$lang['img_manager'] = 'Näita meediahalduris'; +$lang['subscr_subscribe_success'] = '%s lisati %s tellijaks'; +$lang['subscr_subscribe_error'] = 'Viga %s lisamisel %s tellijaks'; +$lang['subscr_subscribe_noaddress'] = 'Sinu kasutajaga pole seotud ühtegi aadressi, seega ei saa sind tellijaks lisada'; +$lang['subscr_unsubscribe_success'] = '%s eemaldati %s tellijatest'; +$lang['subscr_unsubscribe_error'] = 'Viga %s eemaldamisel %s tellijatest'; +$lang['subscr_already_subscribed'] = '%s on juba %s tellija'; +$lang['subscr_not_subscribed'] = '%s pole %s tellija'; +$lang['subscr_m_not_subscribed'] = 'Sina pole hetkel selle lehekülje ega nimeruumi tellija.'; +$lang['subscr_m_new_header'] = 'Lisa tellimus'; +$lang['subscr_m_current_header'] = 'Hetkel tellitud'; +$lang['subscr_m_unsubscribe'] = 'Eemalda tellimus'; +$lang['subscr_m_subscribe'] = 'Telli'; +$lang['subscr_style_every'] = 'igast toimetamisest teavitab ekiri'; +$lang['subscr_style_digest'] = 'kokkuvõte ekirjaga toimetamistest igal leheküljel (iga %.2f päeva järel)'; +$lang['subscr_style_list'] = 'Peale viimast ekirja (iga %.2f päeva järel) toimetaud lehekülgede loend.'; $lang['authtempfail'] = 'Kasutajate autentimine on ajutiselt rivist väljas. Kui see olukord mõne aja jooksul ei parane, siis teavita sellest serveri haldajat.'; +$lang['authpwdexpire'] = 'Sinu salasõna aegub %päeva pärast, võiksid seda peatselt muuta.'; $lang['i_chooselang'] = 'Vali keel'; $lang['i_installer'] = 'DokuWiki paigaldaja'; $lang['i_wikiname'] = 'Wiki nimi'; @@ -218,9 +282,11 @@ $lang['i_problems'] = 'Paigaldaja leidis mõned vead, mis on allpool $lang['i_modified'] = 'Õnnetuste vältimiseks läheb see skript käima ainult värskelt paigaldatud ja muutmata Dokuwiki peal. Sa peaksid ilmselt kogu koodi uuesti lahti pakkima. Vaata ka <a href="http://dokuwiki.org/install">Dokuwiki installeerimis juhendit</a>'; $lang['i_funcna'] = 'PHP funktsiooni <code>%s</code> ei ole olemas.võibolla sinu serveri hooldaja on selle mingil põhjusel keelanud?'; +$lang['i_phpver'] = 'Sinu PHP versioon <code>%s</code> on vanem nõutavast <code>%s</code>. Pead oma paigaldatud PHP-d uuendama.'; $lang['i_permfail'] = 'Dokuwiki ei saa kirjutada faili <code>%s</code>. Kontrolli serveris failide õigused üle.'; $lang['i_confexists'] = '<code>%s</code> on juba olemas'; $lang['i_writeerr'] = 'Faili <code>%s</code> ei lubata tekitada. Kontrolli kataloogi ja faili õigusi.'; +$lang['i_badhash'] = 'Tundmatu või muutunud dokuwiki.php (hash=<code>%s</code>)'; $lang['i_badval'] = '<code>%s</code> - lubamatu või tühi väärtus'; $lang['i_success'] = 'Seadistamine on õnnelikult lõpule viidud. Sa võid nüüd kustutada faili install.php. Alusta oma <a href="doku.php?id=wiki:welcome">uue DokuWiki</a> täitmist.'; $lang['i_failure'] = 'Konfiguratsiooni faili kirjutamisel esines vigu. Võimalik, et pead need käsitsi parandama enne <a href="doku.php?id=wiki:welcome">uue DokuWiki</a> täitma asumist.'; @@ -228,4 +294,45 @@ $lang['i_policy'] = 'Wiki õiguste algne poliitika'; $lang['i_pol0'] = 'Avatud (lugemine, kirjutamine ja üleslaadimine kõigile lubatud)'; $lang['i_pol1'] = 'Avalikuks lugemiseks (lugeda saavad kõik, kirjutada ja üles laadida vaid registreeritud kasutajad)'; $lang['i_pol2'] = 'Suletud (kõik õigused, kaasaarvatud lugemine on lubatud vaid registreeritud kasutajatele)'; +$lang['i_allowreg'] = 'Luba kasutajail endid ise arvele võtta'; $lang['i_retry'] = 'Proovi uuesti'; +$lang['i_license'] = 'Vali leping, mille alusel wiki sisu avaldatakse:'; +$lang['i_license_none'] = 'Ära näita mingit lepingu teavet'; +$lang['i_pop_field'] = 'Aitake meil täiendada DokuWiki kasutuskogemsut:'; +$lang['i_pop_label'] = 'Kord kuus, saada DokuWiki arendajatele anonüümseid kasutus andmeid.'; +$lang['recent_global'] = 'Uurid hetkel nimeruumi <b>%s</b> muudatusi. Võid uurida ka <a href="%s">kogu selle wiki</a> muudatusi.'; +$lang['years'] = '%d aasta eest'; +$lang['months'] = '%d kuu eest'; +$lang['weeks'] = '%d nädala eest'; +$lang['days'] = '%d päeva eest'; +$lang['hours'] = '%d tunni eest'; +$lang['minutes'] = '%d minuti eest'; +$lang['seconds'] = '%d sekundi eest'; +$lang['wordblock'] = 'Sinu toimetus jäeti muutmata tõrjutud teksti tõttu (rämpspost?).'; +$lang['media_uploadtab'] = 'Lae-↑ '; +$lang['media_searchtab'] = 'Otsi'; +$lang['media_file'] = 'Fail'; +$lang['media_viewtab'] = 'Vaata'; +$lang['media_edittab'] = 'Toimeta'; +$lang['media_historytab'] = 'Ajalugu'; +$lang['media_list_thumbs'] = 'Pisipildid'; +$lang['media_list_rows'] = 'Ridu'; +$lang['media_sort_name'] = 'Nimi'; +$lang['media_sort_date'] = 'Kuupäev'; +$lang['media_namespaces'] = 'Vali nimeruum'; +$lang['media_files'] = 'Failid %s-is'; +$lang['media_upload'] = 'Lae %s-ssi'; +$lang['media_search'] = 'Leia %s-st'; +$lang['media_view'] = '%s'; +$lang['media_viewold'] = '%s asub %s-s'; +$lang['media_edit'] = 'Muuda %s-i'; +$lang['media_history'] = '%s ajalugu'; +$lang['media_meta_edited'] = 'toimetati päiseteavet'; +$lang['media_perm_read'] = 'Sul pole piisavaid õigusi failide vaatamiseks'; +$lang['media_perm_upload'] = 'Sul pole piisavaid õigusi failide üleslaadimiseks'; +$lang['media_update'] = 'Lea üles uus järk'; +$lang['media_restore'] = 'Ennista sellele järgule'; +$lang['currentns'] = 'Hetkel nimeruumis'; +$lang['searchresult'] = 'Otsingu tulemus'; +$lang['plainhtml'] = 'Liht-HTML'; +$lang['wikimarkup'] = 'Wiki märgistus'; diff --git a/inc/lang/et/resetpwd.txt b/inc/lang/et/resetpwd.txt new file mode 100644 index 000000000..3a802986f --- /dev/null +++ b/inc/lang/et/resetpwd.txt @@ -0,0 +1,3 @@ +====== Sea uus salasõna ====== + +Sisesta oma selle wiki kasutajale uus salasõna
\ No newline at end of file diff --git a/inc/lang/et/subscr_digest.txt b/inc/lang/et/subscr_digest.txt new file mode 100644 index 000000000..7446fd9f4 --- /dev/null +++ b/inc/lang/et/subscr_digest.txt @@ -0,0 +1,21 @@ +Tere! + +Wiki-s @TITLE@ toimetati lehekülge @PAGE@. + +Muudatustest lähemalt: + +-------------------------------------------------------- +@DIFF@ +-------------------------------------------------------- + +Endine: @OLDPAGE@ +Uus: @NEWPAGE@ + +Lehekülje teavituste katkestamiseks, sisene wiki-sse aadressil @DOKUWIKIURL@ +ja mine: +@SUBSCRIBE@ +ning loobu lehekülje ja/või nimeruumi muudatuste teavitustest. + +-- +Selle e-kirja lõi DokuWiki aadressilt +@DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/et/subscr_form.txt b/inc/lang/et/subscr_form.txt new file mode 100644 index 000000000..45d911f72 --- /dev/null +++ b/inc/lang/et/subscr_form.txt @@ -0,0 +1,3 @@ +====== Tellimuste haldus ====== + +See lehekülg lubab sul hallata oma tellimusi antud leheküljele ja nimeruumi.
\ No newline at end of file diff --git a/inc/lang/et/subscr_list.txt b/inc/lang/et/subscr_list.txt new file mode 100644 index 000000000..0629651b7 --- /dev/null +++ b/inc/lang/et/subscr_list.txt @@ -0,0 +1,19 @@ +Tere! + +Wiki-s @TITLE@ toimetati nimeruumi @PAGE@. +Muudatustest lähemalt: + +-------------------------------------------------------- +@DIFF@ +-------------------------------------------------------- +Endine: @OLDPAGE@ +Uus: @NEWPAGE@ + +Lehekülje teavituste katkestamiseks, sisene wiki-sse aadressil @DOKUWIKIURL@ +ja mine: +@SUBSCRIBE@ +ning loobu lehekülje ja/või nimeruumi muudatuste teavitustest. + +-- +Selle e-kirja lõi DokuWiki aadressilt +@DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/et/subscr_single.txt b/inc/lang/et/subscr_single.txt new file mode 100644 index 000000000..149c95ad1 --- /dev/null +++ b/inc/lang/et/subscr_single.txt @@ -0,0 +1,23 @@ +Tere! + +Wikis @TITLE@ toimetati lehekülge @PAGE@. +Muudatustest lähemalt: + +-------------------------------------------------------- +@DIFF@ +-------------------------------------------------------- + +Kuupäev : @DATE@ +Kasutaja : @USER@ +Kokkuvõte: @SUMMARY@ +Endine: @OLDPAGE@ +Uus: @NEWPAGE@ + +Lehekülje teavituste katkestamiseks, sisene wiki-sse aadressil @DOKUWIKIURL@ +ja mine: +@SUBSCRIBE@ +ning loobu lehekülje ja/või nimeruumi muudatuste teavitustest. + +-- +Selle e-kirja lõi DokuWiki aadressilt +@DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/et/uploadmail.txt b/inc/lang/et/uploadmail.txt new file mode 100644 index 000000000..2d3a6aa7e --- /dev/null +++ b/inc/lang/et/uploadmail.txt @@ -0,0 +1,16 @@ +Sinu DokuWiki-sse lisati fail. +Lähemalt: + + Fail : @MEDIA@ + Endine : @OLD@ + Kuupäev : @DATE@ + Veebilehitseja : @BROWSER@ + IP-aadress : @IPADDRESS@ + Hostinimi : @HOSTNAME@ + Suurus : @SIZE@ + MIME liik : @MIME@ + Kasutaja : @ USER@ + +-- +Selle e-kirja lõi DokuWiki aadressilt +@DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/fr/denied.txt b/inc/lang/fr/denied.txt index 20d4d6755..56c59a7c2 100644 --- a/inc/lang/fr/denied.txt +++ b/inc/lang/fr/denied.txt @@ -1,3 +1,3 @@ ====== Autorisation refusée ====== -Désolé, vous n'avez pas les droits pour continuer. Peut-être avez-vous oublié de vous identifier ? +Désolé, vous n'avez pas suffisement d'autorisations pour poursuivre votre demande. Peut-être avez-vous oublié de vous identifier ? diff --git a/inc/lang/fr/lang.php b/inc/lang/fr/lang.php index 49f617323..32e3055f7 100644 --- a/inc/lang/fr/lang.php +++ b/inc/lang/fr/lang.php @@ -29,6 +29,7 @@ * @author Bruno Veilleux <bruno.vey@gmail.com> * @author Emmanuel <seedfloyd@gmail.com> * @author Jérôme Brandt <jeromebrandt@gmail.com> + * @author Wild <wild.dagger@free.fr> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -51,10 +52,10 @@ $lang['btn_revs'] = 'Anciennes révisions'; $lang['btn_recent'] = 'Derniers changements'; $lang['btn_upload'] = 'Envoyer'; $lang['btn_cancel'] = 'Annuler'; -$lang['btn_index'] = 'Index'; +$lang['btn_index'] = 'Plan du site'; $lang['btn_secedit'] = 'Modifier'; -$lang['btn_login'] = 'Connexion'; -$lang['btn_logout'] = 'Déconnexion'; +$lang['btn_login'] = 'S\'identifier'; +$lang['btn_logout'] = 'Se déconnecter'; $lang['btn_admin'] = 'Administrer'; $lang['btn_update'] = 'Mettre à jour'; $lang['btn_delete'] = 'Effacer'; @@ -69,7 +70,7 @@ $lang['btn_draft'] = 'Modifier le brouillon'; $lang['btn_recover'] = 'Récupérer le brouillon'; $lang['btn_draftdel'] = 'Effacer le brouillon'; $lang['btn_revert'] = 'Restaurer'; -$lang['btn_register'] = 'S\'enregistrer'; +$lang['btn_register'] = 'Créer un compte'; $lang['btn_apply'] = 'Appliquer'; $lang['btn_media'] = 'Gestionnaire de médias'; $lang['btn_deleteuser'] = 'Supprimer mon compte'; diff --git a/inc/lang/hu/lang.php b/inc/lang/hu/lang.php index 5113e1cc8..a0aef9447 100644 --- a/inc/lang/hu/lang.php +++ b/inc/lang/hu/lang.php @@ -337,4 +337,4 @@ $lang['media_restore'] = 'Ezen verzió visszaállítása'; $lang['currentns'] = 'Aktuális névtér'; $lang['searchresult'] = 'Keresés eredménye'; $lang['plainhtml'] = 'Sima HTML'; -$lang['wikimarkup'] = 'Wiki-jelölő nyelv'; +$lang['wikimarkup'] = 'Wiki-jelölőnyelv'; diff --git a/inc/lang/nl/lang.php b/inc/lang/nl/lang.php index e5e3e3c76..e22aa9fff 100644 --- a/inc/lang/nl/lang.php +++ b/inc/lang/nl/lang.php @@ -22,6 +22,7 @@ * @author Klap-in <klapinklapin@gmail.com> * @author Remon <no@email.local> * @author gicalle <gicalle@hotmail.com> + * @author Rene <wllywlnt@yahoo.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; diff --git a/inc/lang/ru/admin.txt b/inc/lang/ru/admin.txt index e00daa447..cd609a347 100644 --- a/inc/lang/ru/admin.txt +++ b/inc/lang/ru/admin.txt @@ -1,4 +1,4 @@ ====== Управление ====== -Ниже вы сможете найти список административных операций, доступных в «ДокуВики». +Ниже вы сможете найти список административных операций, доступных в «Докувики». diff --git a/inc/lang/ru/lang.php b/inc/lang/ru/lang.php index 208d647a8..bf8fa34c8 100644 --- a/inc/lang/ru/lang.php +++ b/inc/lang/ru/lang.php @@ -24,6 +24,7 @@ * @author Pavel <ivanovtsk@mail.ru> * @author Artur <ncuxxx@gmail.com> * @author Erli Moen <evseev.jr@gmail.com> + * @author Aleksandr Selivanov <alexgearbox@yandex.ru> */ $lang['encoding'] = ' utf-8'; $lang['direction'] = 'ltr'; @@ -90,7 +91,7 @@ $lang['regsuccess2'] = 'Пользователь создан.'; $lang['regmailfail'] = 'Похоже есть проблема с отправкой пароля по почте. Пожалуйста, сообщите об этом администратору.'; $lang['regbadmail'] = 'Данный вами адрес электронной почты выглядит неправильным. Если вы считаете это ошибкой, сообщите администратору.'; $lang['regbadpass'] = 'Два введённых пароля не идентичны. Пожалуйста, попробуйте ещё раз.'; -$lang['regpwmail'] = 'Ваш пароль для системы «ДокуВики»'; +$lang['regpwmail'] = 'Ваш пароль для системы «Докувики»'; $lang['reghere'] = 'У вас ещё нет аккаунта? Зарегистрируйтесь'; $lang['profna'] = 'Данная вики не поддерживает изменение профиля'; $lang['profnochange'] = 'Изменений не было внесено, профиль не обновлён.'; @@ -145,7 +146,7 @@ $lang['js']['medialeft'] = 'Выровнять изображение по $lang['js']['mediaright'] = 'Выровнять изображение по правому краю.'; $lang['js']['mediacenter'] = 'Выровнять изображение по центру.'; $lang['js']['medianoalign'] = 'Не выравнивать.'; -$lang['js']['nosmblinks'] = 'Ссылка на сетевые каталоги Windows работает только из Интернет Эксплорера. Но вы можете скопировать ссылку.'; +$lang['js']['nosmblinks'] = 'Ссылка на сетевые каталоги Windows работает только из MS Internet Explorer, но вы можете скопировать ссылку.'; $lang['js']['linkwiz'] = 'Мастер ссылок'; $lang['js']['linkto'] = 'Ссылка на:'; $lang['js']['del_confirm'] = 'Вы на самом деле желаете удалить выбранное?'; @@ -286,34 +287,34 @@ $lang['subscr_style_list'] = 'список изменённых страни $lang['authtempfail'] = 'Аутентификация пользователей временно недоступна. Если проблема продолжается какое-то время, пожалуйста, сообщите об этом своему администратору вики.'; $lang['authpwdexpire'] = 'Действие вашего пароля истекает через %d дней. Вы должны изменить его как можно скорее'; $lang['i_chooselang'] = 'Выберите свой язык/Choose your language'; -$lang['i_installer'] = 'Установка «ДокуВики»'; +$lang['i_installer'] = 'Установка «Докувики»'; $lang['i_wikiname'] = 'Название вики'; $lang['i_enableacl'] = 'Разрешить ограничение прав доступа (рекомендуется)'; $lang['i_superuser'] = 'Суперпользователь'; $lang['i_problems'] = 'Программа установки столкнулась с проблемами, перечисленными ниже. Чтобы продолжить, вам необходимо их устранить. '; -$lang['i_modified'] = 'Из соображений безопасности эта программа запускается только на новой, неизменённой установке «ДокуВики». +$lang['i_modified'] = 'Из соображений безопасности эта программа запускается только на новой, неизменённой установке «Докувики». Вам нужно либо заново распаковать скачанный пакет установки, либо обратиться к полной - <a href="http://www.dokuwiki.org/install">инструкции по установке «ДокуВики»</a>'; + <a href="http://www.dokuwiki.org/install">инструкции по установке «Докувики»</a>'; $lang['i_funcna'] = 'Функция PHP <code>%s</code> недоступна. Может быть, она по какой-то причине заблокирована вашим хостером?'; $lang['i_phpver'] = 'Ваша версия PHP (<code>%s</code>) ниже требуемой (<code>%s</code>). Вам необходимо обновить установленную версию PHP.'; -$lang['i_permfail'] = '<code>%s</code> недоступна для записи «ДокуВики». Вам необходимо исправить системные права доступа для этой директории!'; +$lang['i_permfail'] = '<code>%s</code> недоступна для записи «Докувики». Вам необходимо исправить системные права доступа для этой директории!'; $lang['i_confexists'] = '<code>%s</code> уже существует'; -$lang['i_writeerr'] = 'Не удалось создать <code>%s</code>. Вам необходимо проверить системные права доступа к файлу/директориям и создать файл вручную. '; +$lang['i_writeerr'] = 'Не удалось создать <code>%s</code>. Вам необходимо проверить системные права доступа к файлу и директориям, и создать файл вручную. '; $lang['i_badhash'] = 'dokuwiki.php не распознан или изменён (хэш=<code>%s</code>)'; $lang['i_badval'] = '<code>%s</code> — недопустимое или пустое значение'; $lang['i_success'] = 'Конфигурация прошла успешно. Теперь вы можете удалить файл install.php. Переходите к - <a href="doku.php?id=wiki:welcome">своей новой «ДокуВики»</a>.'; -$lang['i_failure'] = 'При записи в файлы конфигурации были обнаружены ошибки. Возможно, вам придётся исправить их вручную, прежде чем вы сможете использовать <a href="doku.php?id=wiki:welcome">свою новую «ДокуВики»</a>.'; + <a href="doku.php?id=wiki:welcome">своей новой «Докувики»</a>.'; +$lang['i_failure'] = 'При записи в файлы конфигурации были обнаружены ошибки. Возможно, вам придётся исправить их вручную, прежде чем вы сможете использовать <a href="doku.php?id=wiki:welcome">свою новую «Докувики»</a>.'; $lang['i_policy'] = 'Исходная политика прав доступа'; $lang['i_pol0'] = 'Открытая вики (чтение, запись, закачка файлов для всех)'; $lang['i_pol1'] = 'Общедоступная вики (чтение для всех, запись и загрузка файлов для зарегистрированных пользователей)'; $lang['i_pol2'] = 'Закрытая вики (чтение, запись и загрузка файлов только для зарегистрированных пользователей)'; -$lang['i_allowreg'] = 'Позволить пользователям самостоятельно регестрироваться'; +$lang['i_allowreg'] = 'Разрешить пользователям самостоятельно регистрироваться'; $lang['i_retry'] = 'Повторить попытку'; -$lang['i_license'] = 'Пожалуйста, выберите тип лицензии для своей вики:'; -$lang['i_license_none'] = 'Не отображать информацию о лицензионных операциях'; -$lang['i_pop_field'] = 'Пожалуйста, помогите нам улучшить «ДокуВики»:'; -$lang['i_pop_label'] = 'Отправлять раз в месяц анонимную пользовательскую информацию разработчикам «ДокуВики»'; +$lang['i_license'] = 'Пожалуйста, выберите тип лицензии для своей вики'; +$lang['i_license_none'] = 'Не отображать информацию о лицензии'; +$lang['i_pop_field'] = 'Пожалуйста, помогите нам улучшить «Докувики»:'; +$lang['i_pop_label'] = 'Отправлять раз в месяц анонимную пользовательскую информацию разработчикам «Докувики»'; $lang['recent_global'] = 'Вы просматриваете изменения в пространстве имён <b>%s</b>. Вы можете также <a href="%s">просмотреть недавние изменения во всей вики</a>.'; $lang['years'] = '%d лет назад'; $lang['months'] = '%d месяц(ев) назад'; @@ -347,6 +348,7 @@ $lang['media_perm_read'] = 'Извините, у вас недостато $lang['media_perm_upload'] = 'Извините, у вас недостаточно прав для загрузки файлов.'; $lang['media_update'] = 'Загрузить новую версию'; $lang['media_restore'] = 'Восстановить эту версию'; -$lang['currentns'] = 'Текущее пространство имен'; +$lang['currentns'] = 'Текущее пространство имён'; $lang['searchresult'] = 'Результаты поиска'; -$lang['plainhtml'] = 'Чистый HTML'; +$lang['plainhtml'] = 'Простой HTML'; +$lang['wikimarkup'] = 'вики-разметка'; diff --git a/inc/lang/ru/mailtext.txt b/inc/lang/ru/mailtext.txt index 2b3f76bbd..953daddf2 100644 --- a/inc/lang/ru/mailtext.txt +++ b/inc/lang/ru/mailtext.txt @@ -13,5 +13,5 @@ IP-адрес: @IPADDRESS@ -- -Это письмо было сгенерировано «ДокуВики» по адресу +Это письмо было сгенерировано «Докувики» по адресу @DOKUWIKIURL@ diff --git a/inc/lang/ru/norev.txt b/inc/lang/ru/norev.txt index 388d6149d..c088d0d5a 100644 --- a/inc/lang/ru/norev.txt +++ b/inc/lang/ru/norev.txt @@ -1,4 +1,3 @@ ====== Такой версии не существует ====== Указанная версия страницы не существует. Нажмите на кнопку «История страницы», чтобы получить список доступных предыдущих версий этого документа. - diff --git a/inc/lang/ru/password.txt b/inc/lang/ru/password.txt index eb100f334..fabdf2b68 100644 --- a/inc/lang/ru/password.txt +++ b/inc/lang/ru/password.txt @@ -6,5 +6,5 @@ Пароль: @PASSWORD@ -- -Это письмо было сгенерировано «ДокуВики» по адресу +Это письмо было сгенерировано «Докувики» по адресу @DOKUWIKIURL@ diff --git a/inc/lang/ru/pwconfirm.txt b/inc/lang/ru/pwconfirm.txt index 9c27af752..954c75dfe 100644 --- a/inc/lang/ru/pwconfirm.txt +++ b/inc/lang/ru/pwconfirm.txt @@ -9,5 +9,5 @@ @CONFIRM@ -- -Это сообщение было сгенерировано «ДокуВики» по адресу +Это сообщение было сгенерировано «Докувики» по адресу @DOKUWIKIURL@ diff --git a/inc/lang/ru/registermail.txt b/inc/lang/ru/registermail.txt index fc862b034..86ef11e8c 100644 --- a/inc/lang/ru/registermail.txt +++ b/inc/lang/ru/registermail.txt @@ -10,5 +10,5 @@ Хост: @HOSTNAME@ -- -Это сообщение было сгенерировано «ДокуВики» по адресу +Это сообщение было сгенерировано «Докувики» по адресу @DOKUWIKIURL@ diff --git a/inc/lang/ru/subscr_digest.txt b/inc/lang/ru/subscr_digest.txt index 41774a4e9..ac0fc0528 100644 --- a/inc/lang/ru/subscr_digest.txt +++ b/inc/lang/ru/subscr_digest.txt @@ -15,6 +15,6 @@ @SUBSCRIBE@ и отмените подписку на страницу и/или пространство имен. --- -Это письмо создано «ДокуВики» с сайта +-- +Это письмо создано «Докувики» с сайта @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/ru/subscr_list.txt b/inc/lang/ru/subscr_list.txt index 41e1323bc..984a25eb0 100644 --- a/inc/lang/ru/subscr_list.txt +++ b/inc/lang/ru/subscr_list.txt @@ -12,6 +12,6 @@ @SUBSCRIBE@ и отмените подписку на страницу и/или пространство имён. --- -Это письмо создано «ДокуВики» с сайта +-- +Это письмо создано «Докувики» с сайта @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/ru/subscr_single.txt b/inc/lang/ru/subscr_single.txt index 911a48e96..679ca6fff 100644 --- a/inc/lang/ru/subscr_single.txt +++ b/inc/lang/ru/subscr_single.txt @@ -19,6 +19,6 @@ @SUBSCRIBE@ и отмените подписку на страницу и/или пространство имён. --- -Это письмо создано «ДокуВики» с сайта +-- +Это письмо создано «Докувики» с сайта @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/ru/uploadmail.txt b/inc/lang/ru/uploadmail.txt index f696f2c44..84103b45a 100644 --- a/inc/lang/ru/uploadmail.txt +++ b/inc/lang/ru/uploadmail.txt @@ -11,5 +11,5 @@ Пользователь: @USER@ -- -Это письмо было сгенерировано «ДокуВики» по адресу +Это письмо было сгенерировано «Докувики» по адресу @DOKUWIKIURL@ diff --git a/inc/lang/zh/lang.php b/inc/lang/zh/lang.php index 004997d6e..8777c65a5 100644 --- a/inc/lang/zh/lang.php +++ b/inc/lang/zh/lang.php @@ -20,6 +20,8 @@ * @author Yangyu Huang <yangyu.huang@gmail.com> * @author anjianshi <anjianshi@gmail.com> * @author oott123 <ip.192.168.1.1@qq.com> + * @author Cupen <Cupenoruler@foxmail.com> + * @author xiqingongzi <Xiqingongzi@Gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; diff --git a/inc/load.php b/inc/load.php index 497dd6921..f1deffe19 100644 --- a/inc/load.php +++ b/inc/load.php @@ -96,6 +96,12 @@ function load_autoload($name){ 'DokuWiki_Remote_Plugin' => DOKU_PLUGIN.'remote.php', 'DokuWiki_Auth_Plugin' => DOKU_PLUGIN.'auth.php', + 'Doku_Renderer' => DOKU_INC.'inc/parser/renderer.php', + 'Doku_Renderer_xhtml' => DOKU_INC.'inc/parser/xhtml.php', + 'Doku_Renderer_code' => DOKU_INC.'inc/parser/code.php', + 'Doku_Renderer_xhtmlsummary' => DOKU_INC.'inc/parser/xhtmlsummary.php', + 'Doku_Renderer_metadata' => DOKU_INC.'inc/parser/metadata.php', + ); if(isset($classes[$name])){ diff --git a/inc/mail.php b/inc/mail.php index 0b60c0a5b..9994ac63e 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -40,6 +40,8 @@ if (!defined('PREG_PATTERN_VALID_EMAIL')) define('PREG_PATTERN_VALID_EMAIL', '[' function mail_setup(){ global $conf; global $USERINFO; + /** @var Input $INPUT */ + global $INPUT; // auto constructed address $host = @parse_url(DOKU_URL,PHP_URL_HOST); @@ -53,11 +55,8 @@ function mail_setup(){ $replace['@MAIL@'] = $noreply; } - if(!empty($_SERVER['REMOTE_USER'])){ - $replace['@USER@'] = $_SERVER['REMOTE_USER']; - }else{ - $replace['@USER@'] = 'noreply'; - } + // use 'noreply' if no user + $replace['@USER@'] = $INPUT->server->str('REMOTE_USER', 'noreply', true); if(!empty($USERINFO['name'])){ $replace['@NAME@'] = $USERINFO['name']; diff --git a/inc/media.php b/inc/media.php index 803587c64..894333b11 100644 --- a/inc/media.php +++ b/inc/media.php @@ -284,7 +284,7 @@ function media_upload_xhr($ns,$auth){ 'copy' ); unlink($path); - if ($tmp) dir_delete($tmp); + if ($tmp) io_rmdir($tmp, true); if (is_array($res)) { msg($res[0], $res[1]); return false; @@ -728,10 +728,23 @@ function _media_get_sort_type() { return _media_get_display_param('sort', array('default' => 'name', 'date')); } +/** + * Returns type of listing for the list of files in media manager + * + * @author Kate Arzamastseva <pshns@ukr.net> + * @return string - list type + */ function _media_get_list_type() { return _media_get_display_param('list', array('default' => 'thumbs', 'rows')); } +/** + * Get display parameters + * + * @param string $param name of parameter + * @param array $values allowed values, where default value has index key 'default' + * @return string the parameter value + */ function _media_get_display_param($param, $values) { global $INPUT; if (in_array($INPUT->str($param), $values)) { @@ -859,6 +872,10 @@ function media_tab_history($image, $ns, $auth=null) { /** * Prints mediafile details * + * @param string $image media id + * @param $auth + * @param int|bool $rev + * @param JpegMeta|bool $meta * @author Kate Arzamastseva <pshns@ukr.net> */ function media_preview($image, $auth, $rev=false, $meta=false) { @@ -1001,7 +1018,7 @@ function media_file_tags($meta) { foreach($fields as $key => $tag){ $t = array(); if (!empty($tag[0])) $t = array($tag[0]); - if(is_array($tag[3])) $t = array_merge($t,$tag[3]); + if(isset($tag[3]) && is_array($tag[3])) $t = array_merge($t,$tag[3]); $value = media_getTag($t, $meta); $tags[] = array('tag' => $tag, 'value' => $value); } @@ -1039,7 +1056,6 @@ function media_details($image, $auth, $rev=false, $meta=false) { * @author Kate Arzamastseva <pshns@ukr.net> */ function media_diff($image, $ns, $auth, $fromajax = false) { - global $lang; global $conf; global $INPUT; @@ -1098,9 +1114,15 @@ function media_diff($image, $ns, $auth, $fromajax = false) { } +/** + * Callback for media file diff + * + * @param $data + * @return bool|void + */ function _media_file_diff($data) { if(is_array($data) && count($data)===6) { - return media_file_diff($data[0], $data[1], $data[2], $data[3], $data[4], $data[5]); + media_file_diff($data[0], $data[1], $data[2], $data[3], $data[4], $data[5]); } else { return false; } @@ -1559,7 +1581,7 @@ function media_printimgdetail($item, $fullscreen=false){ * @param string $amp - separator * @param bool $abs * @param bool $params_array - * @return string - link + * @return string|array - link */ function media_managerURL($params=false, $amp='&', $abs=false, $params_array=false) { global $ID; @@ -1757,7 +1779,7 @@ function media_nstree_item($item){ global $INPUT; $pos = strrpos($item['id'], ':'); $label = substr($item['id'], $pos > 0 ? $pos + 1 : 0); - if(!$item['label']) $item['label'] = $label; + if(empty($item['label'])) $item['label'] = $label; $ret = ''; if (!($INPUT->str('do') == 'media')) @@ -1819,7 +1841,7 @@ function media_resize_image($file, $ext, $w, $h=0){ if( $mtime > filemtime($file) || media_resize_imageIM($ext,$file,$info[0],$info[1],$local,$w,$h) || media_resize_imageGD($ext,$file,$info[0],$info[1],$local,$w,$h) ){ - if($conf['fperm']) @chmod($local, $conf['fperm']); + if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); return $local; } //still here? resizing failed @@ -1880,7 +1902,7 @@ function media_crop_image($file, $ext, $w, $h=0){ if( $mtime > @filemtime($file) || media_crop_imageIM($ext,$file,$info[0],$info[1],$local,$cw,$ch,$cx,$cy) || media_resize_imageGD($ext,$file,$cw,$ch,$local,$cw,$ch,$cx,$cy) ){ - if($conf['fperm']) @chmod($local, $conf['fperm']); + if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']); return media_resize_image($local,$ext, $w, $h); } @@ -2164,7 +2186,7 @@ function media_alternativefiles($src, $exts){ /** * Check if video/audio is supported to be embedded. * - * @param string $src - mimetype of media file + * @param string $mime - mimetype of media file * @param string $type - type of media files to check ('video', 'audio', or none) * @return boolean * diff --git a/inc/pageutils.php b/inc/pageutils.php index c8d3cf4bb..8474c5697 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -19,6 +19,7 @@ * @author Andreas Gohr <andi@splitbrain.org> */ function getID($param='id',$clean=true){ + /** @var Input $INPUT */ global $INPUT; global $conf; global $ACT; @@ -27,7 +28,7 @@ function getID($param='id',$clean=true){ //construct page id from request URI if(empty($id) && $conf['userewrite'] == 2){ - $request = $_SERVER['REQUEST_URI']; + $request = $INPUT->server->str('REQUEST_URI'); $script = ''; //get the script URL @@ -36,15 +37,15 @@ function getID($param='id',$clean=true){ if($param != 'id') { $relpath = 'lib/exe/'; } - $script = $conf['basedir'].$relpath.utf8_basename($_SERVER['SCRIPT_FILENAME']); - - }elseif($_SERVER['PATH_INFO']){ - $request = $_SERVER['PATH_INFO']; - }elseif($_SERVER['SCRIPT_NAME']){ - $script = $_SERVER['SCRIPT_NAME']; - }elseif($_SERVER['DOCUMENT_ROOT'] && $_SERVER['SCRIPT_FILENAME']){ - $script = preg_replace ('/^'.preg_quote($_SERVER['DOCUMENT_ROOT'],'/').'/','', - $_SERVER['SCRIPT_FILENAME']); + $script = $conf['basedir'].$relpath.utf8_basename($INPUT->server->str('SCRIPT_FILENAME')); + + }elseif($INPUT->server->str('PATH_INFO')){ + $request = $INPUT->server->str('PATH_INFO'); + }elseif($INPUT->server->str('SCRIPT_NAME')){ + $script = $INPUT->server->str('SCRIPT_NAME'); + }elseif($INPUT->server->str('DOCUMENT_ROOT') && $INPUT->server->str('SCRIPT_FILENAME')){ + $script = preg_replace ('/^'.preg_quote($INPUT->server->str('DOCUMENT_ROOT'),'/').'/','', + $INPUT->server->str('SCRIPT_FILENAME')); $script = '/'.$script; } @@ -94,6 +95,7 @@ function getID($param='id',$clean=true){ * @author Andreas Gohr <andi@splitbrain.org> * @param string $raw_id The pageid to clean * @param boolean $ascii Force ASCII + * @return string cleaned id */ function cleanID($raw_id,$ascii=false){ global $conf; @@ -244,6 +246,7 @@ function page_exists($id,$rev='',$clean=true) { * @param $rev string page revision, empty string for current * @param $clean bool flag indicating that $raw_id should be cleaned. Only set to false * when $id is guaranteed to have been cleaned already. + * @return string full path * * @author Andreas Gohr <andi@splitbrain.org> */ @@ -361,6 +364,7 @@ function mediaFN($id, $rev=''){ * * @param string $id The id of the local file * @param string $ext The file extension (usually txt) + * @return string full filepath to localized file * @author Andreas Gohr <andi@splitbrain.org> */ function localeFN($id,$ext='txt'){ @@ -543,6 +547,11 @@ function isHiddenPage($id){ return $data['hidden']; } +/** + * callback checks if page is hidden + * + * @param array $data event data see isHiddenPage() + */ function _isHiddenPage(&$data) { global $conf; global $ACT; diff --git a/inc/parser/code.php b/inc/parser/code.php index 0b8e3ee02..d77ffd1aa 100644 --- a/inc/parser/code.php +++ b/inc/parser/code.php @@ -5,7 +5,6 @@ * @author Andreas Gohr <andi@splitbrain.org> */ if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/parser/renderer.php'; class Doku_Renderer_code extends Doku_Renderer { var $_codeblock=0; diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 8ba159d62..82a268fd6 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -16,8 +16,6 @@ if ( !defined('DOKU_TAB') ) { define ('DOKU_TAB',"\t"); } -require_once DOKU_INC . 'inc/parser/renderer.php'; - /** * The Renderer */ @@ -301,7 +299,7 @@ class Doku_Renderer_metadata extends Doku_Renderer { // first resolve and clean up the $id resolve_pageid(getNS($ID), $id, $exists); - list($page, $hash) = explode('#', $id, 2); + @list($page, $hash) = explode('#', $id, 2); // set metadata $this->meta['relation']['references'][$page] = $exists; diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index e3401fd48..e748c36d8 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -6,8 +6,6 @@ * @author Andreas Gohr <andi@splitbrain.org> */ if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/plugin.php'; -require_once DOKU_INC . 'inc/pluginutils.php'; /** * An empty renderer, produces no output @@ -276,8 +274,8 @@ class Doku_Renderer extends DokuWiki_Plugin { function _simpleTitle($name){ global $conf; - //if there is a hash we use the ancor name only - list($name,$hash) = explode('#',$name,2); + //if there is a hash we use the anchor name only + @list($name,$hash) = explode('#',$name,2); if($hash) return $hash; if($conf['useslash']){ @@ -303,7 +301,7 @@ class Doku_Renderer extends DokuWiki_Plugin { } //split into hash and url part - list($reference,$hash) = explode('#',$reference,2); + @list($reference,$hash) = explode('#',$reference,2); //replace placeholder if(preg_match('#\{(URL|NAME|SCHEME|HOST|PORT|PATH|QUERY)\}#',$url)){ diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 80701cd2e..4966f103a 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -17,9 +17,6 @@ if ( !defined('DOKU_TAB') ) { define ('DOKU_TAB',"\t"); } -require_once DOKU_INC . 'inc/parser/renderer.php'; -require_once DOKU_INC . 'inc/html.php'; - /** * The Renderer */ @@ -562,6 +559,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * $search,$returnonly & $linktype are not for the renderer but are used * elsewhere - no need to implement them in other renderers * + * @param string $id pageid + * @param string|null $name link name + * @param string|null $search adds search url param + * @param bool $returnonly whether to return html or write to doc attribute + * @param string $linktype type to set use of headings + * @return void|string writes to doc attribute or returns html depends on $returnonly * @author Andreas Gohr <andi@splitbrain.org> */ function internallink($id, $name = null, $search=null,$returnonly=false,$linktype='content') { @@ -603,7 +606,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } //keep hash anchor - list($id,$hash) = explode('#',$id,2); + @list($id,$hash) = explode('#',$id,2); if(!empty($hash)) $hash = $this->_headerToLink($hash); //prepare for formating @@ -1096,48 +1099,30 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $ret .= ' />'; - }elseif(media_supportedav($mime, 'video')){ + }elseif(media_supportedav($mime, 'video') || media_supportedav($mime, 'audio')){ // first get the $title - if (!is_null($title)) { - $title = $this->_xmlEntities($title); - } - if (!$title) { - // just show the sourcename - $title = $this->_xmlEntities(utf8_basename(noNS($src))); - } + $title = !is_null($title) ? $this->_xmlEntities($title) : false; if (!$render) { - // if the video is not supposed to be rendered - // return the title of the video - return $title; + // if the file is not supposed to be rendered + // return the title of the file (just the sourcename if there is no title) + return $title ? $title : $this->_xmlEntities(utf8_basename(noNS($src))); } $att = array(); $att['class'] = "media$align"; - - //add video(s) - $ret .= $this->_video($src, $width, $height, $att); - - }elseif(media_supportedav($mime, 'audio')){ - // first get the $title - if (!is_null($title)) { - $title = $this->_xmlEntities($title); + if ($title) { + $att['title'] = $title; } - if (!$title) { - // just show the sourcename - $title = $this->_xmlEntities(utf8_basename(noNS($src))); + + if (media_supportedav($mime, 'video')) { + //add video + $ret .= $this->_video($src, $width, $height, $att); } - if (!$render) { - // if the video is not supposed to be rendered - // return the title of the video - return $title; + if (media_supportedav($mime, 'audio')) { + //add audio + $ret .= $this->_audio($src, $att); } - $att = array(); - $att['class'] = "media$align"; - - //add audio - $ret .= $this->_audio($src, $att); - }elseif($mime == 'application/x-shockwave-flash'){ if (!$render) { // if the flash is not supposed to be rendered @@ -1282,7 +1267,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @return string */ function _video($src,$width,$height,$atts=null){ - // prepare width and height if(is_null($atts)) $atts = array(); $atts['width'] = (int) $width; @@ -1309,7 +1293,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // output source for each alternative video format foreach($alternatives as $mime => $file) { $url = ml($file,array('cache'=>$cache),true,'&'); - $title = $this->_xmlEntities(utf8_basename(noNS($file))); + $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file))); $out .= '<source src="'.hsc($url).'" type="'.$mime.'" />'.NL; // alternative content (just a link to the file) @@ -1345,7 +1329,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // output source for each alternative audio format foreach($alternatives as $mime => $file) { $url = ml($file,array('cache'=>$cache),true,'&'); - $title = $this->_xmlEntities(utf8_basename(noNS($file))); + $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file))); $out .= '<source src="'.hsc($url).'" type="'.$mime.'" />'.NL; // alternative content (just a link to the file) diff --git a/inc/parser/xhtmlsummary.php b/inc/parser/xhtmlsummary.php index 95f86cbef..867b71f6a 100644 --- a/inc/parser/xhtmlsummary.php +++ b/inc/parser/xhtmlsummary.php @@ -1,6 +1,5 @@ <?php if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/parser/xhtml.php'; /** * The summary XHTML form selects either up to the first two paragraphs diff --git a/inc/parserutils.php b/inc/parserutils.php index 4df273f11..06bd6dbb8 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -430,8 +430,9 @@ function p_render_metadata($id, $orig){ global $ID, $METADATA_RENDERERS; // avoid recursive rendering processes for the same id - if (isset($METADATA_RENDERERS[$id])) + if (isset($METADATA_RENDERERS[$id])) { return $orig; + } // store the original metadata in the global $METADATA_RENDERERS so p_set_metadata can use it $METADATA_RENDERERS[$id] =& $orig; @@ -444,8 +445,6 @@ function p_render_metadata($id, $orig){ $evt = new Doku_Event('PARSER_METADATA_RENDER', $orig); if ($evt->advise_before()) { - require_once DOKU_INC."inc/parser/metadata.php"; - // get instructions $instructions = p_cached_instructions(wikiFN($id),false,$id); if(is_null($instructions)){ @@ -588,7 +587,7 @@ function p_sort_modes($a, $b){ function p_render($mode,$instructions,&$info){ if(is_null($instructions)) return ''; - $Renderer =& p_get_renderer($mode); + $Renderer = p_get_renderer($mode); if (is_null($Renderer)) return null; $Renderer->reset(); @@ -616,43 +615,54 @@ function p_render($mode,$instructions,&$info){ } /** + * Figure out the correct renderer class to use for $mode, + * instantiate and return it + * * @param $mode string Mode of the renderer to get * @return null|Doku_Renderer The renderer + * + * @author Christopher Smith <chris@jalakai.co.uk> */ -function & p_get_renderer($mode) { +function p_get_renderer($mode) { /** @var Doku_Plugin_Controller $plugin_controller */ global $conf, $plugin_controller; $rname = !empty($conf['renderer_'.$mode]) ? $conf['renderer_'.$mode] : $mode; $rclass = "Doku_Renderer_$rname"; + // if requested earlier or a bundled renderer if( class_exists($rclass) ) { $Renderer = new $rclass(); return $Renderer; } - // try default renderer first: - $file = DOKU_INC."inc/parser/$rname.php"; - if(@file_exists($file)){ - require_once $file; + // not bundled, see if its an enabled plugin for rendering $mode + $Renderer = $plugin_controller->load('renderer',$rname); + if ($Renderer && is_a($Renderer, 'Doku_Renderer') && ($mode == $Renderer->getFormat())) { + return $Renderer; + } - if ( !class_exists($rclass) ) { - trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); - msg("Renderer '$rname' for $mode not valid",-1); - return null; + // there is a configuration error! + // not bundled, not a valid enabled plugin, use $mode to try to fallback to a bundled renderer + $rclass = "Doku_Renderer_$mode"; + if ( class_exists($rclass) ) { + // viewers should see renderered output, so restrict the warning to admins only + $msg = "No renderer '$rname' found for mode '$mode', check your plugins"; + if ($mode == 'xhtml') { + $msg .= " and the 'renderer_xhtml' config setting"; } - $Renderer = new $rclass(); - }else{ - // Maybe a plugin/component is available? - $Renderer = $plugin_controller->load('renderer',$rname); + $msg .= ".<br/>Attempting to fallback to the bundled renderer."; + msg($msg,-1,'','',MSG_ADMINS_ONLY); - if(!isset($Renderer) || is_null($Renderer)){ - msg("No renderer '$rname' found for mode '$mode'",-1); - return null; - } + $Renderer = new $rclass; + $Renderer->nocache(); // fallback only (and may include admin alerts), don't cache + return $Renderer; } - return $Renderer; + // fallback failed, alert the world + trigger_error("Unable to resolve render class $rclass",E_USER_WARNING); + msg("No renderer '$rname' found for mode '$mode'",-1); + return null; } /** diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 894bbefb6..911c4e5c0 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -37,7 +37,7 @@ function plugin_list($type='',$all=false) { * @param $name string name of the plugin to load * @param $new bool true to return a new instance of the plugin, false to use an already loaded instance * @param $disabled bool true to load even disabled plugins - * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|null the plugin object or null on failure + * @return DokuWiki_Plugin|null the plugin object or null on failure */ function plugin_load($type,$name,$new=false,$disabled=false) { /** @var $plugin_controller Doku_Plugin_Controller */ diff --git a/inc/remote.php b/inc/remote.php index 2ef28afd2..e27aa74f8 100644 --- a/inc/remote.php +++ b/inc/remote.php @@ -169,6 +169,9 @@ class RemoteAPI { public function hasAccess() { global $conf; global $USERINFO; + /** @var Input $INPUT */ + global $INPUT; + if (!$conf['remote']) { return false; } @@ -179,7 +182,7 @@ class RemoteAPI { return true; } - return auth_isMember($conf['remoteuser'], $_SERVER['REMOTE_USER'], (array) $USERINFO['grps']); + return auth_isMember($conf['remoteuser'], $INPUT->server->str('REMOTE_USER'), (array) $USERINFO['grps']); } /** diff --git a/inc/search.php b/inc/search.php index c2d31b959..be4710237 100644 --- a/inc/search.php +++ b/inc/search.php @@ -141,7 +141,7 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){ //we do nothing with directories if($type == 'd') { - if(!$opts['depth']) return true; // recurse forever + if(empty($opts['depth'])) return true; // recurse forever $depth = substr_count($file,'/'); if($depth >= $opts['depth']) return false; // depth reached return true; @@ -157,12 +157,12 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){ //check ACL for namespace (we have no ACL for mediafiles) $info['perm'] = auth_quickaclcheck(getNS($info['id']).':*'); - if(!$opts['skipacl'] && $info['perm'] < AUTH_READ){ + if(empty($opts['skipacl']) && $info['perm'] < AUTH_READ){ return false; } //check pattern filter - if($opts['pattern'] && !@preg_match($opts['pattern'], $info['id'])){ + if(!empty($opts['pattern']) && !@preg_match($opts['pattern'], $info['id'])){ return false; } @@ -176,7 +176,7 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){ }else{ $info['isimg'] = false; } - if($opts['hash']){ + if(!empty($opts['hash'])){ $info['hash'] = md5(io_readFile(mediaFN($info['id']),false)); } @@ -351,17 +351,18 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ $return = true; // get ID and check if it is a valid one - $item['id'] = pathID($file,($type == 'd' || $opts['keeptxt'])); + $item['id'] = pathID($file,($type == 'd' || !empty($opts['keeptxt']))); if($item['id'] != cleanID($item['id'])){ - if($opts['showmsg']) + if(!empty($opts['showmsg'])){ msg(hsc($item['id']).' is not a valid file name for DokuWiki - skipped',-1); + } return false; // skip non-valid files } $item['ns'] = getNS($item['id']); if($type == 'd') { // decide if to recursion into this directory is wanted - if(!$opts['depth']){ + if(empty($opts['depth'])){ $return = true; // recurse forever }else{ $depth = substr_count($file,'/'); @@ -371,8 +372,12 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ $return = true; } } - if($return && !preg_match('/'.$opts['recmatch'].'/',$file)){ - $return = false; // doesn't match + + if ($return) { + $match = empty($opts['recmatch']) || preg_match('/'.$opts['recmatch'].'/',$file); + if (!$match) { + return false; // doesn't match + } } } @@ -407,7 +412,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ $item['level'] = $lvl; $item['open'] = $return; - if($opts['meta']){ + if(!empty($opts['meta'])){ $item['file'] = utf8_basename($file); $item['size'] = filesize($base.'/'.$file); $item['mtime'] = filemtime($base.'/'.$file); @@ -417,8 +422,8 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ } if($type == 'f'){ - if($opts['hash']) $item['hash'] = md5(io_readFile($base.'/'.$file,false)); - if($opts['firsthead']) $item['title'] = p_get_first_heading($item['id'],METADATA_DONT_RENDER); + if(!empty($opts['hash'])) $item['hash'] = md5(io_readFile($base.'/'.$file,false)); + if(!empty($opts['firsthead'])) $item['title'] = p_get_first_heading($item['id'],METADATA_DONT_RENDER); } // finally add the item diff --git a/inc/subscription.php b/inc/subscription.php index ddf2f39e6..adf1b821c 100644 --- a/inc/subscription.php +++ b/inc/subscription.php @@ -256,8 +256,10 @@ class Subscription { if(!$this->isenabled()) return false; global $ID; + /** @var Input $INPUT */ + global $INPUT; if(!$id) $id = $ID; - if(!$user) $user = $_SERVER['REMOTE_USER']; + if(!$user) $user = $INPUT->server->str('REMOTE_USER'); $subs = $this->subscribers($id, $user); if(!count($subs)) return false; @@ -288,17 +290,19 @@ class Subscription { public function send_bulk($page) { if(!$this->isenabled()) return 0; - /** @var auth_basic $auth */ + /** @var DokuWiki_Auth_Plugin $auth */ global $auth; global $conf; global $USERINFO; + /** @var Input $INPUT */ + global $INPUT; $count = 0; $subscriptions = $this->subscribers($page, null, array('digest', 'list')); // remember current user info $olduinfo = $USERINFO; - $olduser = $_SERVER['REMOTE_USER']; + $olduser = $INPUT->server->str('REMOTE_USER'); foreach($subscriptions as $target => $users) { if(!$this->lock($target)) continue; @@ -315,7 +319,7 @@ class Subscription { // Work as the user to make sure ACLs apply correctly $USERINFO = $auth->getUserData($user); - $_SERVER['REMOTE_USER'] = $user; + $INPUT->server->set('REMOTE_USER',$user); if($USERINFO === false) continue; if(!$USERINFO['mail']) continue; @@ -334,7 +338,7 @@ class Subscription { foreach($changes as $rev) { $n = 0; while(!is_null($rev) && $rev['date'] >= $lastupdate && - ($_SERVER['REMOTE_USER'] === $rev['user'] || + ($INPUT->server->str('REMOTE_USER') === $rev['user'] || $rev['type'] === DOKU_CHANGE_TYPE_MINOR_EDIT)) { $rev = getRevisions($rev['id'], $n++, 1); $rev = (count($rev) > 0) ? $rev[0] : null; @@ -369,7 +373,7 @@ class Subscription { // restore current user info $USERINFO = $olduinfo; - $_SERVER['REMOTE_USER'] = $olduser; + $INPUT->server->set('REMOTE_USER',$olduser); return $count; } @@ -651,9 +655,11 @@ class Subscription { public function notifyaddresses(&$data) { if(!$this->isenabled()) return; - /** @var auth_basic $auth */ + /** @var DokuWiki_Auth_Plugin $auth */ global $auth; global $conf; + /** @var Input $INPUT */ + global $INPUT; $id = $data['id']; $self = $data['self']; @@ -667,7 +673,7 @@ class Subscription { $userinfo = $auth->getUserData($user); if($userinfo === false) continue; if(!$userinfo['mail']) continue; - if(!$self && $user == $_SERVER['REMOTE_USER']) continue; //skip our own changes + if(!$self && $user == $INPUT->server->str('REMOTE_USER')) continue; //skip our own changes $level = auth_aclcheck($id, $user, $userinfo['grps']); if($level >= AUTH_READ) { diff --git a/inc/template.php b/inc/template.php index 0a6a9e4aa..88964fada 100644 --- a/inc/template.php +++ b/inc/template.php @@ -210,7 +210,7 @@ function tpl_toc($return = false) { } else { $tocok = true; } - $toc = $meta['description']['tableofcontents']; + $toc = isset($meta['description']['tableofcontents']) ? $meta['description']['tableofcontents'] : null; if(!$tocok || !is_array($toc) || !$conf['tocminheads'] || count($toc) < $conf['tocminheads']) { $toc = array(); } @@ -291,6 +291,8 @@ function tpl_metaheaders($alt = true) { global $lang; global $conf; global $updateVersion; + /** @var Input $INPUT */ + global $INPUT; // prepare the head array $head = array(); @@ -401,7 +403,7 @@ function tpl_metaheaders($alt = true) { // make $INFO and other vars available to JavaScripts $json = new JSON(); $script = "var NS='".$INFO['namespace']."';"; - if($conf['useacl'] && !empty($_SERVER['REMOTE_USER'])) { + if($conf['useacl'] && $INPUT->server->str('REMOTE_USER')) { $script .= "var SIG='".toolbar_signature()."';"; } $script .= 'var JSINFO = '.$json->encode($JSINFO).';'; @@ -603,6 +605,8 @@ function tpl_get_action($type) { global $REV; global $ACT; global $conf; + /** @var Input $INPUT */ + global $INPUT; // check disabled actions and fix the badly named ones if($type == 'history') $type = 'revisions'; @@ -637,7 +641,7 @@ function tpl_get_action($type) { $accesskey = 'v'; } } else { - $params = array(); + $params = array('do' => ''); $type = 'show'; $accesskey = 'v'; } @@ -658,7 +662,7 @@ function tpl_get_action($type) { break; case 'top': $accesskey = 't'; - $params = array(); + $params = array('do' => ''); $id = '#dokuwiki__top'; break; case 'back': @@ -667,12 +671,12 @@ function tpl_get_action($type) { return false; } $id = $parent; - $params = array(); + $params = array('do' => ''); $accesskey = 'b'; break; case 'login': $params['sectok'] = getSecurityToken(); - if(isset($_SERVER['REMOTE_USER'])) { + if($INPUT->server->has('REMOTE_USER')) { if(!actionOK('logout')) { return false; } @@ -681,12 +685,12 @@ function tpl_get_action($type) { } break; case 'register': - if(!empty($_SERVER['REMOTE_USER'])) { + if($INPUT->server->str('REMOTE_USER')) { return false; } break; case 'resendpwd': - if(!empty($_SERVER['REMOTE_USER'])) { + if($INPUT->server->str('REMOTE_USER')) { return false; } break; @@ -703,14 +707,14 @@ function tpl_get_action($type) { $params['sectok'] = getSecurityToken(); break; case 'subscribe': - if(!$_SERVER['REMOTE_USER']) { + if(!$INPUT->server->str('REMOTE_USER')) { return false; } break; case 'backlink': break; case 'profile': - if(!isset($_SERVER['REMOTE_USER'])) { + if(!$INPUT->server->has('REMOTE_USER')) { return false; } break; @@ -886,8 +890,11 @@ function tpl_youarehere($sep = ' » ') { function tpl_userinfo() { global $lang; global $INFO; - if(isset($_SERVER['REMOTE_USER'])) { - print $lang['loggedinas'].': <bdi>'.hsc($INFO['userinfo']['name']).'</bdi> (<bdi>'.hsc($_SERVER['REMOTE_USER']).'</bdi>)'; + /** @var Input $INPUT */ + global $INPUT; + + if($INPUT->server->str('REMOTE_USER')) { + print $lang['loggedinas'].': <bdi>'.hsc($INFO['userinfo']['name']).'</bdi> (<bdi>'.hsc($INPUT->server->str('REMOTE_USER')).'</bdi>)'; return true; } return false; @@ -1030,6 +1037,7 @@ function tpl_img_getTag($tags, $alt = '', $src = null) { */ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) { global $IMG; + /** @var Input $INPUT */ global $INPUT; $w = tpl_img_getTag('File.Width'); $h = tpl_img_getTag('File.Height'); @@ -1242,6 +1250,7 @@ function tpl_mediaContent($fromajax = false, $sort='natural') { global $INUSE; global $NS; global $JUMPTO; + /** @var Input $INPUT */ global $INPUT; $do = $INPUT->extract('do')->str('do'); @@ -1291,6 +1300,7 @@ function tpl_mediaFileList() { global $NS; global $JUMPTO; global $lang; + /** @var Input $INPUT */ global $INPUT; $opened_tab = $INPUT->str('tab_files'); @@ -1331,7 +1341,9 @@ function tpl_mediaFileList() { * @author Kate Arzamastseva <pshns@ukr.net> */ function tpl_mediaFileDetails($image, $rev) { - global $AUTH, $NS, $conf, $DEL, $lang, $INPUT; + global $AUTH, $NS, $conf, $DEL, $lang; + /** @var Input $INPUT */ + global $INPUT; $removed = (!file_exists(mediaFN($image)) && file_exists(mediaMetaFN($image, '.changes')) && $conf['mediarevisions']); if(!$image || (!file_exists(mediaFN($image)) && !$removed) || $DEL) return; @@ -1409,12 +1421,14 @@ function tpl_actiondropdown($empty = '', $button = '>') { global $ID; global $REV; global $lang; + /** @var Input $INPUT */ + global $INPUT; echo '<form action="'.script().'" method="get" accept-charset="utf-8">'; echo '<div class="no">'; echo '<input type="hidden" name="id" value="'.$ID.'" />'; if($REV) echo '<input type="hidden" name="rev" value="'.$REV.'" />'; - if (!empty($_SERVER['REMOTE_USER'])) { + if ($INPUT->server->str('REMOTE_USER')) { echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'; } @@ -1780,11 +1794,14 @@ function tpl_media() { */ function tpl_classes() { global $ACT, $conf, $ID, $INFO; + /** @var Input $INPUT */ + global $INPUT; + $classes = array( 'dokuwiki', 'mode_'.$ACT, 'tpl_'.$conf['template'], - !empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '', + $INPUT->server->bool('REMOTE_USER') ? 'loggedIn' : '', $INFO['exists'] ? '' : 'notFound', ($ID == $conf['start']) ? 'home' : '', ); diff --git a/inc/toolbar.php b/inc/toolbar.php index d8d2f209b..7cc29e866 100644 --- a/inc/toolbar.php +++ b/inc/toolbar.php @@ -241,10 +241,12 @@ function toolbar_JSdefines($varname){ function toolbar_signature(){ global $conf; global $INFO; + /** @var Input $INPUT */ + global $INPUT; $sig = $conf['signature']; $sig = dformat(null,$sig); - $sig = str_replace('@USER@',$_SERVER['REMOTE_USER'],$sig); + $sig = str_replace('@USER@',$INPUT->server->str('REMOTE_USER'),$sig); $sig = str_replace('@NAME@',$INFO['userinfo']['name'],$sig); $sig = str_replace('@MAIL@',$INFO['userinfo']['mail'],$sig); $sig = str_replace('@DATE@',dformat(),$sig); |