diff options
Diffstat (limited to 'inc')
180 files changed, 14330 insertions, 1941 deletions
diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 07df7a4be..3c955cf88 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -826,7 +826,7 @@ class DiffFormatter { * @param $str string Text string to escape * @return string The escaped string. */ - function _escape($str){ + function _escape($str){ return $str; } } diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 0d7b80cf8..96954fb47 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -463,6 +463,8 @@ class HTTPClient { } $r_body = $this->_readData($socket, $length, 'response (content-length limited)', true); + }elseif( !isset($this->resp_headers['transfer-encoding']) && $this->max_bodysize && !$this->keep_alive){ + $r_body = $this->_readData($socket, $this->max_bodysize, 'response (content-length limited)', true); }else{ // read entire socket $r_size = 0; @@ -551,7 +553,7 @@ class HTTPClient { }while($r_line != "\r\n" && $r_line != "\n"); $this->_debug('SSL Tunnel Response',$r_headers); - if(preg_match('/^HTTP\/1\.0 200/i',$r_headers)){ + if(preg_match('/^HTTP\/1\.[01] 200/i',$r_headers)){ if (stream_socket_enable_crypto($socket, true, STREAM_CRYPTO_METHOD_SSLv3_CLIENT)) { $requesturl = $requestinfo['path']; return true; @@ -806,12 +808,7 @@ class HTTPClient { * @author Andreas Gohr <andi@splitbrain.org> */ function _postEncode($data){ - $url = ''; - foreach($data as $key => $val){ - if($url) $url .= '&'; - $url .= urlencode($key).'='.urlencode($val); - } - return $url; + return http_build_query($data,'','&'); } /** diff --git a/inc/Input.class.php b/inc/Input.class.php index 35aecdb45..7434d2b2c 100644 --- a/inc/Input.class.php +++ b/inc/Input.class.php @@ -238,7 +238,6 @@ class PostInput extends Input { /** * Internal class used for $_GET access in Input class - */ class GetInput extends Input { protected $access; diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index ba6a2b5bb..cb1772736 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -161,7 +161,7 @@ class JpegMeta { if($info != false) break; } - if($info === false) $info = $alt; + if($info === false) $info = ''; if(is_array($info)){ if(isset($info['val'])){ $info = $info['val']; @@ -874,7 +874,7 @@ class JpegMeta { /*************************************************************/ /*************************************************************/ - function _dispose() { + function _dispose($fileName = "") { $this->_fileName = $fileName; $this->_fp = null; @@ -975,7 +975,7 @@ class JpegMeta { if ($capture) { if ($length) - $this->_markers[$count]['data'] =& fread($this->_fp, $length); + $this->_markers[$count]['data'] = fread($this->_fp, $length); else $this->_markers[$count]['data'] = ""; } @@ -1452,7 +1452,7 @@ class JpegMeta { if ($this->_markers[$i]['marker'] == 0xE1) { $signature = $this->_getFixedString($this->_markers[$i]['data'], 0, 29); if ($signature == "http://ns.adobe.com/xap/1.0/\0") { - $data =& substr($this->_markers[$i]['data'], 29); + $data = substr($this->_markers[$i]['data'], 29); break; } } @@ -2183,7 +2183,8 @@ class JpegMeta { } while ($j < $count) { - $this->_putString($value, $j * 4, "\0\0\0\0"); + $v = "\0\0\0\0"; + $this->_putString($value, $j * 4, $v); $j++; } break; @@ -2206,7 +2207,8 @@ class JpegMeta { } while ($j < $count) { - $this->_putString($value, $j * 8, "\0\0\0\0\0\0\0\0"); + $v = "\0\0\0\0\0\0\0\0"; + $this->_putString($value, $j * 8, $v); $j++; } break; @@ -2335,7 +2337,7 @@ class JpegMeta { function _readIPTC(&$data, $pos = 0) { $totalLength = strlen($data); - $IPTCTags =& $this->_iptcTagNames(); + $IPTCTags = $this->_iptcTagNames(); while ($pos < ($totalLength - 5)) { $signature = $this->_getShort($data, $pos); diff --git a/inc/Mailer.class.php b/inc/Mailer.class.php index cb5f22f54..186bd531a 100644 --- a/inc/Mailer.class.php +++ b/inc/Mailer.class.php @@ -41,9 +41,10 @@ class Mailer { global $conf; $server = parse_url(DOKU_URL, PHP_URL_HOST); + if(strpos($server,'.') === false) $server = $server.'.localhost'; - $this->partid = md5(uniqid(rand(), true)).'@'.$server; - $this->boundary = '----------'.md5(uniqid(rand(), true)); + $this->partid = substr(md5(uniqid(rand(), true)),0, 8).'@'.$server; + $this->boundary = '__________'.md5(uniqid(rand(), true)); $listid = join('.', array_reverse(explode('/', DOKU_BASE))).$server; $listid = strtolower(trim($listid, '.')); @@ -57,6 +58,7 @@ class Mailer { $this->setHeader('X-DokuWiki-Server', $server); $this->setHeader('X-Auto-Response-Suppress', 'OOF'); $this->setHeader('List-Id', $conf['title'].' <'.$listid.'>'); + $this->setHeader('Date', date('r'), false); } /** @@ -137,7 +139,13 @@ class Mailer { } // empty value deletes - $value = trim($value); + if(is_array($value)){ + $value = array_map('trim', $value); + $value = array_filter($value); + if(!$value) $value = ''; + }else{ + $value = trim($value); + } if($value === '') { if(isset($this->headers[$header])) unset($this->headers[$header]); } else { @@ -270,7 +278,7 @@ class Mailer { * Add the To: recipients * * @see setAddress - * @param string $address Multiple adresses separated by commas + * @param string|array $address Multiple adresses separated by commas or as array */ public function to($address) { $this->setHeader('To', $address, false); @@ -280,7 +288,7 @@ class Mailer { * Add the Cc: recipients * * @see setAddress - * @param string $address Multiple adresses separated by commas + * @param string|array $address Multiple adresses separated by commas or as array */ public function cc($address) { $this->setHeader('Cc', $address, false); @@ -290,7 +298,7 @@ class Mailer { * Add the Bcc: recipients * * @see setAddress - * @param string $address Multiple adresses separated by commas + * @param string|array $address Multiple adresses separated by commas or as array */ public function bcc($address) { $this->setHeader('Bcc', $address, false); @@ -327,18 +335,20 @@ class Mailer { * Example: * setAddress("föö <foo@bar.com>, me@somewhere.com","TBcc"); * - * @param string $address Multiple adresses separated by commas + * @param string|array $address Multiple adresses separated by commas or as array * @return bool|string the prepared header (can contain multiple lines) */ - public function cleanAddress($address) { + public function cleanAddress($addresses) { // No named recipients for To: in Windows (see FS#652) $names = (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') ? false : true; - $address = preg_replace('/[\r\n\0]+/', ' ', $address); // remove attack vectors - $headers = ''; - $parts = explode(',', $address); - foreach($parts as $part) { + if(!is_array($addresses)){ + $addresses = explode(',', $addresses); + } + + foreach($addresses as $part) { + $part = preg_replace('/[\r\n\0]+/', ' ', $part); // remove attack vectors $part = trim($part); // parse address @@ -378,7 +388,7 @@ class Mailer { $text = utf8_strip($text); } - if(!utf8_isASCII($text)) { + if(strpos($text, ',') !== false || !utf8_isASCII($text)) { $text = '=?UTF-8?B?'.base64_encode($text).'?='; } } else { @@ -392,6 +402,7 @@ class Mailer { $headers .= $text.' '.$addr; } + $headers = trim($headers); if(empty($headers)) return false; return $headers; @@ -408,6 +419,8 @@ class Mailer { $part = 1; // embedded attachments foreach($this->attach as $media) { + $media['name'] = str_replace(':', '_', cleanID($media['name'], true)); + // create content id $cid = 'part'.$part.'.'.$this->partid; @@ -417,13 +430,13 @@ class Mailer { } $mime .= '--'.$this->boundary.MAILHEADER_EOL; - $mime .= 'Content-Type: '.$media['mime'].';'.MAILHEADER_EOL; - $mime .= 'Content-Transfer-Encoding: base64'.MAILHEADER_EOL; - $mime .= "Content-ID: <$cid>".MAILHEADER_EOL; + $mime .= $this->wrappedHeaderLine('Content-Type', $media['mime'].'; id="'.$cid.'"'); + $mime .= $this->wrappedHeaderLine('Content-Transfer-Encoding', 'base64'); + $mime .= $this->wrappedHeaderLine('Content-ID',"<$cid>"); if($media['embed']) { - $mime .= 'Content-Disposition: inline; filename="'.$media['name'].'"'.MAILHEADER_EOL; + $mime .= $this->wrappedHeaderLine('Content-Disposition', 'inline; filename='.$media['name']); } else { - $mime .= 'Content-Disposition: attachment; filename="'.$media['name'].'"'.MAILHEADER_EOL; + $mime .= $this->wrappedHeaderLine('Content-Disposition', 'attachment; filename='.$media['name']); } $mime .= MAILHEADER_EOL; //end of headers $mime .= chunk_split(base64_encode($media['data']), 74, MAILHEADER_EOL); @@ -460,7 +473,7 @@ class Mailer { if(!$this->html && !count($this->attach)) { // we can send a simple single part message $this->headers['Content-Type'] = 'text/plain; charset=UTF-8'; $this->headers['Content-Transfer-Encoding'] = 'base64'; - $body .= chunk_split(base64_encode($this->text), 74, MAILHEADER_EOL); + $body .= chunk_split(base64_encode($this->text), 72, MAILHEADER_EOL); } else { // multi part it is $body .= "This is a multi-part message in MIME format.".MAILHEADER_EOL; @@ -475,10 +488,11 @@ class Mailer { $body .= 'Content-Type: text/plain; charset=UTF-8'.MAILHEADER_EOL; $body .= 'Content-Transfer-Encoding: base64'.MAILHEADER_EOL; $body .= MAILHEADER_EOL; - $body .= chunk_split(base64_encode($this->text), 74, MAILHEADER_EOL); + $body .= chunk_split(base64_encode($this->text), 72, MAILHEADER_EOL); $body .= '--'.$this->boundary.'XX'.MAILHEADER_EOL; $body .= 'Content-Type: multipart/related;'.MAILHEADER_EOL. - ' boundary="'.$this->boundary.'"'.MAILHEADER_EOL; + ' boundary="'.$this->boundary.'";'.MAILHEADER_EOL. + ' type="text/html"'.MAILHEADER_EOL; $body .= MAILHEADER_EOL; } @@ -486,7 +500,7 @@ class Mailer { $body .= 'Content-Type: text/html; charset=UTF-8'.MAILHEADER_EOL; $body .= 'Content-Transfer-Encoding: base64'.MAILHEADER_EOL; $body .= MAILHEADER_EOL; - $body .= chunk_split(base64_encode($this->html), 74, MAILHEADER_EOL); + $body .= chunk_split(base64_encode($this->html), 72, MAILHEADER_EOL); $body .= MAILHEADER_EOL; $body .= $attachments; $body .= '--'.$this->boundary.'--'.MAILHEADER_EOL; @@ -541,10 +555,17 @@ class Mailer { } } - // wrap headers - foreach($this->headers as $key => $val) { - $this->headers[$key] = wordwrap($val, 78, MAILHEADER_EOL.' '); - } + } + + /** + * Returns a complete, EOL terminated header line, wraps it if necessary + * + * @param $key + * @param $val + * @return string + */ + protected function wrappedHeaderLine($key, $val){ + return wordwrap("$key: $val", 78, MAILHEADER_EOL.' ').MAILHEADER_EOL; } /** @@ -556,7 +577,7 @@ class Mailer { $headers = ''; foreach($this->headers as $key => $val) { if ($val === '') continue; - $headers .= "$key: $val".MAILHEADER_EOL; + $headers .= $this->wrappedHeaderLine($key, $val); } return $headers; } diff --git a/inc/PassHash.class.php b/inc/PassHash.class.php index 61bd74939..db6a3a77c 100644 --- a/inc/PassHash.class.php +++ b/inc/PassHash.class.php @@ -98,7 +98,7 @@ class PassHash { $salt = ''; $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; for($i = 0; $i < $len; $i++) { - $salt .= $chars[mt_rand(0, 61)]; + $salt .= $chars[$this->random(0, 61)]; } return $salt; } @@ -541,4 +541,20 @@ class PassHash { return ($raw_output) ? pack($pack, $output) : $output; } + + /** + * Use DokuWiki's secure random generator if available + * + * @param $min + * @param $max + * + * @return int + */ + protected function random($min, $max){ + if(function_exists('auth_random')){ + return auth_random($min, $max); + }else{ + return mt_rand($min, $max); + } + } } diff --git a/inc/RemoteAPICore.php b/inc/RemoteAPICore.php index 4c940b39e..2eb8ea403 100644 --- a/inc/RemoteAPICore.php +++ b/inc/RemoteAPICore.php @@ -88,12 +88,12 @@ class RemoteAPICore { ), 'wiki.getPageInfo' => array( 'args' => array('string'), 'return' => 'array', - 'doc' => 'Returns a struct with infos about the page.', + 'doc' => 'Returns a struct with info about the page.', 'name' => 'pageInfo' ), 'wiki.getPageInfoVersion' => array( 'args' => array('string', 'int'), 'return' => 'array', - 'doc' => 'Returns a struct with infos about the page.', + 'doc' => 'Returns a struct with info about the page.', 'name' => 'pageInfo' ), 'wiki.getPageVersions' => array( 'args' => array('string', 'int'), @@ -136,7 +136,7 @@ class RemoteAPICore { ), 'wiki.getAttachmentInfo' => array( 'args' => array('string'), 'return' => 'array', - 'doc' => 'Returns a struct with infos about the attachment.' + 'doc' => 'Returns a struct with info about the attachment.' ), 'dokuwiki.getXMLRPCAPIVersion' => array( 'args' => array(), 'name' => 'getAPIVersion', @@ -333,7 +333,6 @@ class RemoteAPICore { if (!is_array($options)) $options = array(); $options['skipacl'] = 0; // no ACL skipping for XMLRPC - if(auth_quickaclcheck($ns.':*') >= AUTH_READ) { $dir = utf8_encodeFN(str_replace(':', '/', $ns)); @@ -506,8 +505,8 @@ class RemoteAPICore { } /** - * Returns the permissions of a given wiki page - */ + * Returns the permissions of a given wiki page + */ function aclCheck($id) { $id = $this->resolvePageId($id); return auth_quickaclcheck($id); @@ -772,7 +771,7 @@ class RemoteAPICore { $id = cleanID($id); if(empty($id)) { global $conf; - $id = cleanID($conf['start']); + $id = cleanID($conf['start']); } return $id; } diff --git a/inc/SimplePie.php b/inc/SimplePie.php index fd69b4b09..8a9060509 100644 --- a/inc/SimplePie.php +++ b/inc/SimplePie.php @@ -16579,7 +16579,11 @@ class SimplePie_Sanitize if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML)) { - + if (!class_exists('DOMDocument')) + { + $this->registry->call('Misc', 'error', array('DOMDocument not found, unable to use sanitizer', E_USER_WARNING, __FILE__, __LINE__)); + return ''; + } $document = new DOMDocument(); $document->encoding = 'UTF-8'; $data = $this->preprocess($data, $type); diff --git a/inc/Tar.class.php b/inc/Tar.class.php index d1a38ea0e..bc87d7d29 100644 --- a/inc/Tar.class.php +++ b/inc/Tar.class.php @@ -568,29 +568,23 @@ class Tar { } /** - * Cleans up a path and removes relative parts + * Cleans up a path and removes relative parts, also strips leading slashes * * @param string $p_dir * @return string */ - protected function cleanPath($p_dir) { - $r = ''; - if($p_dir) { - $subf = explode("/", $p_dir); - - for($i = count($subf) - 1; $i >= 0; $i--) { - if($subf[$i] == ".") { - # do nothing - } elseif($subf[$i] == "..") { - $i--; - } elseif(!$subf[$i] && $i != count($subf) - 1 && $i) { - # do nothing - } else { - $r = $subf[$i].($i != (count($subf) - 1) ? "/".$r : ""); - } + public function cleanPath($path) { + $path=explode('/', $path); + $newpath=array(); + foreach($path as $p) { + if ($p === '' || $p === '.') continue; + if ($p==='..') { + array_pop($newpath); + continue; } + array_push($newpath, $p); } - return $r; + return trim(implode('/', $newpath), '/'); } /** diff --git a/inc/actions.php b/inc/actions.php index da3414eb2..50cbe369f 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -53,7 +53,7 @@ function act_dispatch(){ } } - //display some infos + //display some info if($ACT == 'check'){ check(); $ACT = 'show'; @@ -92,14 +92,26 @@ function act_dispatch(){ $ACT = 'login'; } - //update user profile - if ($ACT == 'profile') { + // user profile changes + if (in_array($ACT, array('profile','profile_delete'))) { if(!$_SERVER['REMOTE_USER']) { $ACT = 'login'; } else { - if(updateprofile()) { - msg($lang['profchanged'],1); - $ACT = 'show'; + switch ($ACT) { + case 'profile' : + if(updateprofile()) { + msg($lang['profchanged'],1); + $ACT = 'show'; + } + break; + case 'profile_delete' : + if(auth_deleteprofile()){ + msg($lang['profdeleted'],1); + $ACT = 'show'; + } else { + $ACT = 'profile'; + } + break; } } } @@ -152,7 +164,8 @@ function act_dispatch(){ $pluginlist = plugin_list('admin'); if (in_array($page, $pluginlist)) { // attempt to load the plugin - if ($plugin =& plugin_load('admin',$page) !== null){ + + if (($plugin = plugin_load('admin',$page)) !== null){ /** @var DokuWiki_Admin_Plugin $plugin */ if($plugin->forAdminOnly() && !$INFO['isadmin']){ // a manager tried to load a plugin that's for admins only @@ -247,7 +260,7 @@ function act_validate($act) { //disable all acl related commands if ACL is disabled if(!$conf['useacl'] && in_array($act,array('login','logout','register','admin', 'subscribe','unsubscribe','profile','revert', - 'resendpwd'))){ + 'resendpwd','profile_delete'))){ msg('Command unavailable: '.htmlspecialchars($act),-1); return 'show'; } @@ -258,7 +271,7 @@ function act_validate($act) { if(!in_array($act,array('login','logout','register','save','cancel','edit','draft', 'preview','search','show','check','index','revisions', 'diff','recent','backlink','admin','subscribe','revert', - 'unsubscribe','profile','resendpwd','recover', + 'unsubscribe','profile','profile_delete','resendpwd','recover', 'draftdel','sitemap','media')) && substr($act,0,7) != 'export_' ) { msg('Command unknown: '.htmlspecialchars($act),-1); return 'show'; @@ -287,7 +300,7 @@ function act_permcheck($act){ }else{ $permneed = AUTH_CREATE; } - }elseif(in_array($act,array('login','search','recent','profile','index', 'sitemap'))){ + }elseif(in_array($act,array('login','search','recent','profile','profile_delete','index', 'sitemap'))){ $permneed = AUTH_NONE; }elseif($act == 'revert'){ $permneed = AUTH_ADMIN; diff --git a/inc/auth.php b/inc/auth.php index 47b29eff7..b793f5d12 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -40,7 +40,7 @@ function auth_setup() { global $INPUT; global $AUTH_ACL; global $lang; - global $config_cascade; + /* @var Doku_Plugin_Controller $plugin_controller */ global $plugin_controller; $AUTH_ACL = array(); @@ -48,15 +48,15 @@ function auth_setup() { // try to load auth backend from plugins foreach ($plugin_controller->getList('auth') as $plugin) { - if ($conf['authtype'] === $plugin) { - $auth = $plugin_controller->load('auth', $plugin); - break; - } elseif ('auth' . $conf['authtype'] === $plugin) { - // matches old auth backends (pre-Weatherwax) - $auth = $plugin_controller->load('auth', $plugin); - msg('Your authtype setting is deprecated. You must set $conf[\'authtype\'] = "auth' . $conf['authtype'] . '"' - . ' in your configuration (see <a href="https://www.dokuwiki.org/auth">Authentication Backends</a>)',-1,'','',MSG_ADMINS_ONLY); - } + if ($conf['authtype'] === $plugin) { + $auth = $plugin_controller->load('auth', $plugin); + break; + } elseif ('auth' . $conf['authtype'] === $plugin) { + // matches old auth backends (pre-Weatherwax) + $auth = $plugin_controller->load('auth', $plugin); + msg('Your authtype setting is deprecated. You must set $conf[\'authtype\'] = "auth' . $conf['authtype'] . '"' + . ' in your configuration (see <a href="https://www.dokuwiki.org/auth">Authentication Backends</a>)',-1,'','',MSG_ADMINS_ONLY); + } } if(!isset($auth) || !$auth){ @@ -65,10 +65,10 @@ function auth_setup() { } if ($auth->success == false) { - // degrade to unauthenticated user - unset($auth); - auth_logoff(); - msg($lang['authtempfail'], -1); + // degrade to unauthenticated user + unset($auth); + auth_logoff(); + msg($lang['authtempfail'], -1); return false; } @@ -136,22 +136,30 @@ function auth_loadACL() { $acl = file($config_cascade['acl']['default']); - //support user wildcard $out = array(); foreach($acl as $line) { $line = trim($line); - if($line{0} == '#') continue; - list($id,$rest) = preg_split('/\s+/',$line,2); + if(empty($line) || ($line{0} == '#')) continue; // skip blank lines & comments + list($id,$rest) = preg_split('/[ \t]+/',$line,2); + + // 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; + + $id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id); + $rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest); + } + // substitute group wildcard (its 1:m) if(strstr($line, '%GROUP%')){ + // if user is not logged in, grps is empty, no output will be added (i.e. skipped) foreach((array) $USERINFO['grps'] as $grp){ $nid = str_replace('%GROUP%',cleanID($grp),$id); $nrest = str_replace('%GROUP%','@'.auth_nameencode($grp),$rest); $out[] = "$nid\t$nrest"; } } else { - $id = str_replace('%USER%',cleanID($_SERVER['REMOTE_USER']),$id); - $rest = str_replace('%USER%',auth_nameencode($_SERVER['REMOTE_USER']),$rest); $out[] = "$id\t$rest"; } } @@ -207,7 +215,7 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { global $USERINFO; global $conf; global $lang; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; $sticky ? $sticky = true : $sticky = false; //sanity check @@ -219,8 +227,8 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { if($auth->checkPass($user, $pass)) { // make logininfo globally available $_SERVER['REMOTE_USER'] = $user; - $secret = auth_cookiesalt(!$sticky); //bind non-sticky to session - auth_setCookie($user, PMA_blowfish_encrypt($pass, $secret), $sticky); + $secret = auth_cookiesalt(!$sticky, true); //bind non-sticky to session + auth_setCookie($user, auth_encrypt($pass, $secret), $sticky); return true; } else { //invalid credentials - log off @@ -250,8 +258,8 @@ function auth_login($user, $pass, $sticky = false, $silent = false) { return true; } // no we don't trust it yet - recheck pass but silent - $secret = auth_cookiesalt(!$sticky); //bind non-sticky to session - $pass = PMA_blowfish_decrypt($pass, $secret); + $secret = auth_cookiesalt(!$sticky, true); //bind non-sticky to session + $pass = auth_decrypt($pass, $secret); return auth_login($user, $pass, $sticky, true); } } @@ -294,7 +302,7 @@ function auth_validateToken($token) { * @return string The auth token */ function auth_createToken() { - $token = md5(mt_rand()); + $token = md5(auth_randombytes(16)); @session_start(); // reopen the session if needed $_SESSION[DOKU_COOKIE]['auth']['token'] = $token; session_write_close(); @@ -333,14 +341,18 @@ function auth_browseruid() { * * @author Andreas Gohr <andi@splitbrain.org> * @param bool $addsession if true, the sessionid is added to the salt + * @param bool $secure if security is more important than keeping the old value * @return string */ -function auth_cookiesalt($addsession = false) { +function auth_cookiesalt($addsession = false, $secure = false) { global $conf; $file = $conf['metadir'].'/_htcookiesalt'; + if ($secure || !file_exists($file)) { + $file = $conf['metadir'].'/_htcookiesalt2'; + } $salt = io_readFile($file); if(empty($salt)) { - $salt = uniqid(rand(), true); + $salt = bin2hex(auth_randombytes(64)); io_saveFile($file, $salt); } if($addsession) { @@ -350,6 +362,142 @@ function auth_cookiesalt($addsession = false) { } /** + * Return truly (pseudo) random bytes if available, otherwise fall back to mt_rand + * + * @author Mark Seecof + * @author Michael Hamann <michael@content-space.de> + * @link http://www.php.net/manual/de/function.mt-rand.php#83655 + * @param int $length number of bytes to get + * @return string binary random strings + */ +function auth_randombytes($length) { + $strong = false; + $rbytes = false; + + if (function_exists('openssl_random_pseudo_bytes') + && (version_compare(PHP_VERSION, '5.3.4') >= 0 + || strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') + ) { + $rbytes = openssl_random_pseudo_bytes($length, $strong); + } + + if (!$strong && function_exists('mcrypt_create_iv') + && (version_compare(PHP_VERSION, '5.3.7') >= 0 + || strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') + ) { + $rbytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); + if ($rbytes !== false && strlen($rbytes) === $length) { + $strong = true; + } + } + + // If no strong randoms available, try OS the specific ways + if(!$strong) { + // Unix/Linux platform + $fp = @fopen('/dev/urandom', 'rb'); + if($fp !== false) { + $rbytes = fread($fp, $length); + fclose($fp); + } + + // MS-Windows platform + if(class_exists('COM')) { + // http://msdn.microsoft.com/en-us/library/aa388176(VS.85).aspx + try { + $CAPI_Util = new COM('CAPICOM.Utilities.1'); + $rbytes = $CAPI_Util->GetRandom($length, 0); + + // if we ask for binary data PHP munges it, so we + // request base64 return value. + if($rbytes) $rbytes = base64_decode($rbytes); + } catch(Exception $ex) { + // fail + } + } + } + if(strlen($rbytes) < $length) $rbytes = false; + + // still no random bytes available - fall back to mt_rand() + if($rbytes === false) { + $rbytes = ''; + for ($i = 0; $i < $length; ++$i) { + $rbytes .= chr(mt_rand(0, 255)); + } + } + + return $rbytes; +} + +/** + * Random number generator using the best available source + * + * @author Michael Samuel + * @author Michael Hamann <michael@content-space.de> + * @param int $min + * @param int $max + * @return int + */ +function auth_random($min, $max) { + $abs_max = $max - $min; + + $nbits = 0; + for ($n = $abs_max; $n > 0; $n >>= 1) { + ++$nbits; + } + + $mask = (1 << $nbits) - 1; + do { + $bytes = auth_randombytes(PHP_INT_SIZE); + $integers = unpack('Inum', $bytes); + $integer = $integers["num"] & $mask; + } while ($integer > $abs_max); + + return $min + $integer; +} + +/** + * Encrypt data using the given secret using AES + * + * The mode is CBC with a random initialization vector, the key is derived + * using pbkdf2. + * + * @param string $data The data that shall be encrypted + * @param string $secret The secret/password that shall be used + * @return string The ciphertext + */ +function auth_encrypt($data, $secret) { + $iv = auth_randombytes(16); + $cipher = new Crypt_AES(); + $cipher->setPassword($secret); + + /* + this uses the encrypted IV as IV as suggested in + http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, Appendix C + for unique but necessarily random IVs. The resulting ciphertext is + compatible to ciphertext that was created using a "normal" IV. + */ + return $cipher->encrypt($iv.$data); +} + +/** + * Decrypt the given AES ciphertext + * + * The mode is CBC, the key is derived using pbkdf2 + * + * @param string $ciphertext The encrypted data + * @param string $secret The secret/password that shall be used + * @return string The decrypted data + */ +function auth_decrypt($ciphertext, $secret) { + $iv = substr($ciphertext, 0, 16); + $cipher = new Crypt_AES(); + $cipher->setPassword($secret); + $cipher->setIV($iv); + + return $cipher->decrypt(substr($ciphertext, 16)); +} + +/** * Log out the current user * * This clears all authentication data and thus log the user @@ -361,7 +509,7 @@ function auth_cookiesalt($addsession = false) { function auth_logoff($keepbc = false) { global $conf; global $USERINFO; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; // make sure the session is writable (it usually is) @@ -407,7 +555,7 @@ function auth_logoff($keepbc = false) { function auth_ismanager($user = null, $groups = null, $adminonly = false) { global $conf; global $USERINFO; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; if(!$auth) return false; @@ -460,7 +608,7 @@ function auth_isadmin($user = null, $groups = null) { * @return bool true for membership acknowledged */ function auth_isMember($memberlist, $user, array $groups) { - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; if(!$auth) return false; @@ -526,7 +674,7 @@ function auth_quickaclcheck($id) { function auth_aclcheck($id, $user, $groups) { global $conf; global $AUTH_ACL; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; // if no ACL is used always return upload rights @@ -568,11 +716,11 @@ function auth_aclcheck($id, $user, $groups) { } //check exact match first - $matches = preg_grep('/^'.preg_quote($id, '/').'\s+(\S+)\s+/u', $AUTH_ACL); + $matches = preg_grep('/^'.preg_quote($id, '/').'[ \t]+([^ \t]+)[ \t]+/', $AUTH_ACL); if(count($matches)) { foreach($matches as $match) { $match = preg_replace('/#.*$/', '', $match); //ignore comments - $acl = preg_split('/\s+/', $match); + $acl = preg_split('/[ \t]+/', $match); if(!$auth->isCaseSensitive() && $acl[1] !== '@ALL') { $acl[1] = utf8_strtolower($acl[1]); } @@ -598,11 +746,11 @@ function auth_aclcheck($id, $user, $groups) { } do { - $matches = preg_grep('/^'.preg_quote($path, '/').'\s+(\S+)\s+/u', $AUTH_ACL); + $matches = preg_grep('/^'.preg_quote($path, '/').'[ \t]+([^ \t]+)[ \t]+/', $AUTH_ACL); if(count($matches)) { foreach($matches as $match) { $match = preg_replace('/#.*$/', '', $match); //ignore comments - $acl = preg_split('/\s+/', $match); + $acl = preg_split('/[ \t]+/', $match); if(!$auth->isCaseSensitive() && $acl[1] !== '@ALL') { $acl[1] = utf8_strtolower($acl[1]); } @@ -660,14 +808,14 @@ function auth_nameencode($name, $skip_group = false) { if(!isset($cache[$name][$skip_group])) { if($skip_group && $name{0} == '@') { - $cache[$name][$skip_group] = '@'.preg_replace( - '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e', - "'%'.dechex(ord(substr('\\1',-1)))", substr($name, 1) + $cache[$name][$skip_group] = '@'.preg_replace_callback( + '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/', + 'auth_nameencode_callback', substr($name, 1) ); } else { - $cache[$name][$skip_group] = preg_replace( - '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e', - "'%'.dechex(ord(substr('\\1',-1)))", $name + $cache[$name][$skip_group] = preg_replace_callback( + '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/', + 'auth_nameencode_callback', $name ); } } @@ -675,6 +823,10 @@ function auth_nameencode($name, $skip_group = false) { return $cache[$name][$skip_group]; } +function auth_nameencode_callback($matches) { + return '%'.dechex(ord(substr($matches[1],-1))); +} + /** * Create a pronouncable password * @@ -703,12 +855,12 @@ function auth_pwgen($foruser = '') { //use thre syllables... for($i = 0; $i < 3; $i++) { - $data['password'] .= $c[mt_rand(0, strlen($c) - 1)]; - $data['password'] .= $v[mt_rand(0, strlen($v) - 1)]; - $data['password'] .= $a[mt_rand(0, strlen($a) - 1)]; + $data['password'] .= $c[auth_random(0, strlen($c) - 1)]; + $data['password'] .= $v[auth_random(0, strlen($v) - 1)]; + $data['password'] .= $a[auth_random(0, strlen($a) - 1)]; } //... and add a nice number and special - $data['password'] .= mt_rand(10, 99).$s[mt_rand(0, strlen($s) - 1)]; + $data['password'] .= auth_random(10, 99).$s[auth_random(0, strlen($s) - 1)]; } $evt->advise_after(); @@ -725,7 +877,7 @@ function auth_pwgen($foruser = '') { */ function auth_sendPassword($user, $password) { global $lang; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; if(!$auth) return false; @@ -759,7 +911,7 @@ function auth_sendPassword($user, $password) { function register() { global $lang; global $conf; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; global $INPUT; @@ -828,7 +980,7 @@ function register() { function updateprofile() { global $conf; global $lang; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; /* @var Input $INPUT */ global $INPUT; @@ -883,7 +1035,7 @@ function updateprofile() { if($conf['profileconfirm']) { if(!$auth->checkPass($_SERVER['REMOTE_USER'], $INPUT->post->str('oldpass'))) { - msg($lang['badlogin'], -1); + msg($lang['badpassconfirm'], -1); return false; } } @@ -892,7 +1044,7 @@ function updateprofile() { // update cookie and session with the changed data if($changes['pass']) { list( /*user*/, $sticky, /*pass*/) = auth_getCookie(); - $pass = PMA_blowfish_encrypt($changes['pass'], auth_cookiesalt(!$sticky)); + $pass = auth_encrypt($changes['pass'], auth_cookiesalt(!$sticky, true)); auth_setCookie($_SERVER['REMOTE_USER'], $pass, (bool) $sticky); } return true; @@ -901,6 +1053,45 @@ function updateprofile() { return false; } +function auth_deleteprofile(){ + global $conf; + global $lang; + /* @var DokuWiki_Auth_Plugin $auth */ + global $auth; + /* @var Input $INPUT */ + global $INPUT; + + if(!$INPUT->post->bool('delete')) return false; + if(!checkSecurityToken()) return false; + + // action prevented or auth module disallows + if(!actionOK('profile_delete') || !$auth->canDo('delUser')) { + msg($lang['profnodelete'], -1); + return false; + } + + if(!$INPUT->post->bool('confirm_delete')){ + msg($lang['profconfdeletemissing'], -1); + return false; + } + + if($conf['profileconfirm']) { + if(!$auth->checkPass($_SERVER['REMOTE_USER'], $INPUT->post->str('oldpass'))) { + msg($lang['badpassconfirm'], -1); + return false; + } + } + + $deleted[] = $_SERVER['REMOTE_USER']; + if($auth->triggerUserMod('delete', array($deleted))) { + // force and immediate logout including removing the sticky cookie + auth_logoff(); + return true; + } + + return false; +} + /** * Send a new password * @@ -918,7 +1109,7 @@ function updateprofile() { function act_resendpwd() { global $lang; global $conf; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; /* @var Input $INPUT */ global $INPUT; @@ -1007,7 +1198,7 @@ function act_resendpwd() { } // generate auth token - $token = md5(uniqid(mt_rand(), true)); // random secret + $token = md5(auth_randombytes(16)); // random secret $tfile = $conf['cachedir'].'/'.$token{0}.'/'.$token.'.pwauth'; $url = wl('', array('do'=> 'resendpwd', 'pwauth'=> $token), true, '&'); @@ -1084,7 +1275,7 @@ function auth_verifyPassword($clear, $crypt) { */ function auth_setCookie($user, $pass, $sticky) { global $conf; - /* @var auth_basic $auth */ + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; global $USERINFO; diff --git a/inc/changelog.php b/inc/changelog.php index fc9dc9fd1..f7b07ae57 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -414,6 +414,8 @@ function getRevisions($id, $first, $num, $chunk_size=8192, $media=false) { $file = metaFN($id, '.changes'); } $num = max($num, 0); + if ($num == 0) { return $revs; } + $chunk_size = max($chunk_size, 0); if ($first<0) { $first = 0; diff --git a/inc/common.php b/inc/common.php index 1b4d9e8e4..32771285b 100644 --- a/inc/common.php +++ b/inc/common.php @@ -64,7 +64,7 @@ function getSecurityToken() { */ function checkSecurityToken($token = null) { global $INPUT; - if(!$_SERVER['REMOTE_USER']) return true; // no logged in user, no need for a check + if(empty($_SERVER['REMOTE_USER'])) return true; // no logged in user, no need for a check if(is_null($token)) $token = $INPUT->str('sectok'); if(getSecurityToken() != $token) { @@ -148,7 +148,7 @@ function pageinfo() { $info['id'] = $ID; $info['rev'] = $REV; - if(isset($_SERVER['REMOTE_USER'])) {
+ if(isset($_SERVER['REMOTE_USER'])) { $sub = new Subscription(); $info['subscribed'] = $sub->user_subscription(); } else { @@ -474,23 +474,24 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) if(is_array($more)) { // add token for resized images - if($more['w'] || $more['h']){ + if(!empty($more['w']) || !empty($more['h']) || $isexternalimage){ $more['tok'] = media_get_token($id,$more['w'],$more['h']); } // strip defaults for shorter URLs if(isset($more['cache']) && $more['cache'] == 'cache') unset($more['cache']); - if(!$more['w']) unset($more['w']); - if(!$more['h']) unset($more['h']); + if(empty($more['w'])) unset($more['w']); + if(empty($more['h'])) unset($more['h']); if(isset($more['id']) && $direct) unset($more['id']); $more = buildURLparams($more, $sep); } else { $matches = array(); - if (preg_match_all('/\b(w|h)=(\d*)\b/',$more,$matches,PREG_SET_ORDER)){ + if (preg_match_all('/\b(w|h)=(\d*)\b/',$more,$matches,PREG_SET_ORDER) || $isexternalimage){ $resize = array('w'=>0, 'h'=>0); foreach ($matches as $match){ $resize[$match[1]] = $match[2]; } - $more .= $sep.'tok='.media_get_token($id,$resize['w'],$resize['h']); + $more .= $more === '' ? '' : $sep; + $more .= 'tok='.media_get_token($id,$resize['w'],$resize['h']); } $more = str_replace('cache=cache', '', $more); //skip default $more = str_replace(',,', ',', $more); @@ -506,14 +507,8 @@ function ml($id = '', $more = '', $direct = true, $sep = '&', $abs = false) // external URLs are always direct without rewriting if($isexternalimage) { $xlink .= 'lib/exe/fetch.php'; - // add hash: - $xlink .= '?hash='.substr(PassHash::hmac('md5', $id, auth_cookiesalt()), 0, 6); - if($more) { - $xlink .= $sep.$more; - $xlink .= $sep.'media='.rawurlencode($id); - } else { - $xlink .= $sep.'media='.rawurlencode($id); - } + $xlink .= '?'.$more; + $xlink .= $sep.'media='.rawurlencode($id); return $xlink; } @@ -1130,7 +1125,7 @@ function saveWikiText($id, $text, $summary, $minor = false) { // if useheading is enabled, purge the cache of all linking pages if(useHeading('content')) { - $pages = ft_backlinks($id); + $pages = ft_backlinks($id, true); foreach($pages as $page) { $cache = new cache_renderer($page, wikiFN($page), 'xhtml'); $cache->removeCache(); @@ -1630,7 +1625,8 @@ function set_doku_pref($pref, $val) { } if (!empty($cookieVal)) { - setcookie('DOKU_PREFS', $cookieVal, time()+365*24*3600, DOKU_BASE, '', ($conf['securecookie'] && is_ssl())); + $cookieDir = empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir']; + setcookie('DOKU_PREFS', $cookieVal, time()+365*24*3600, $cookieDir, '', ($conf['securecookie'] && is_ssl())); } } diff --git a/inc/compatibility.php b/inc/compatibility.php new file mode 100644 index 000000000..ae780e5ac --- /dev/null +++ b/inc/compatibility.php @@ -0,0 +1,36 @@ +<?php +/** + * compatibility functions + * + * This file contains a few functions that might be missing from the PHP build + */ + +if(!function_exists('ctype_space')) { + /** + * Check for whitespace character(s) + * + * @see ctype_space + * @param string $text + * @return bool + */ + function ctype_space($text) { + if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars + if(trim($text) === '') return true; + return false; + } +} + +if(!function_exists('ctype_digit')) { + /** + * Check for numeric character(s) + * + * @see ctype_digit + * @param string $text + * @return bool + */ + function ctype_digit($text) { + if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars + if(preg_match('/^\d+$/', $text)) return true; + return false; + } +}
\ No newline at end of file diff --git a/inc/config_cascade.php b/inc/config_cascade.php index e1ab0eead..2c4f1612b 100644 --- a/inc/config_cascade.php +++ b/inc/config_cascade.php @@ -50,9 +50,6 @@ $config_cascade = array_merge( ), 'userstyle' => array( 'screen' => DOKU_CONF.'userstyle.css', - // @deprecated 2012-04-09: rtl will cease to be a mode of its own, - // please use "[dir=rtl]" in any css file in all, screen or print mode instead - 'rtl' => DOKU_CONF.'userrtl.css', 'print' => DOKU_CONF.'userprint.css', 'feed' => DOKU_CONF.'userfeed.css', 'all' => DOKU_CONF.'userall.css', diff --git a/inc/confutils.php b/inc/confutils.php index 404cc6050..0ac003b72 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -241,7 +241,7 @@ function getConfigFiles($type) { */ function actionOK($action){ static $disabled = null; - if(is_null($disabled)){ + if(is_null($disabled) || defined('SIMPLE_TEST')){ global $conf; /** @var auth_basic $auth */ global $auth; @@ -261,6 +261,9 @@ function actionOK($action){ if (is_null($auth) || !$auth->canDo('Profile')) { $disabled[] = 'profile'; } + if (is_null($auth) || !$auth->canDo('delUser')) { + $disabled[] = 'profile_delete'; + } if (is_null($auth)) { $disabled[] = 'login'; } diff --git a/inc/farm.php b/inc/farm.php index 54fff3ec6..cee61816c 100644 --- a/inc/farm.php +++ b/inc/farm.php @@ -20,7 +20,7 @@ * @author virtual host part of farm_confpath() based on conf_path() from Drupal.org's /includes/bootstrap.inc * (see https://github.com/drupal/drupal/blob/7.x/includes/bootstrap.inc#L537) * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) -*/ + */ // DOKU_FARMDIR needs to be set in preload.php, here the fallback is the same as DOKU_INC would be (if it was set already) if(!defined('DOKU_FARMDIR')) define('DOKU_FARMDIR', fullpath(dirname(__FILE__).'/../').'/'); @@ -135,9 +135,7 @@ $config_cascade = array( ), ), 'userstyle' => array( - 'default' => DOKU_CONF.'userstyle.css', // 'default' was renamed to 'screen' on 2011-02-26, so will be deprecated in the next version 'screen' => DOKU_CONF.'userstyle.css', - 'rtl' => DOKU_CONF.'userrtl.css', // deprecated since version after 2012-04-09 'print' => DOKU_CONF.'userprint.css', 'feed' => DOKU_CONF.'userfeed.css', 'all' => DOKU_CONF.'userall.css', diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index 53ade3555..207ad9e5f 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -101,8 +101,8 @@ function checkFileStatus(&$media, &$file, $rev = '', $width=0, $height=0) { //media to local file if(media_isexternal($media)) { - //check hash - if(substr(PassHash::hmac('md5', $media, auth_cookiesalt()), 0, 6) !== $INPUT->str('hash')) { + //check token for external image and additional for resized and cached images + if(media_get_token($media, $width, $height) !== $INPUT->str('tok')) { return array(412, 'Precondition Failed'); } //handle external images diff --git a/inc/fulltext.php b/inc/fulltext.php index 2f073acea..bd8e6b866 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -125,17 +125,21 @@ function _ft_pageSearch(&$data) { * Returns the backlinks for a given page * * Uses the metadata index. + * + * @param string $id The id for which links shall be returned + * @param bool $ignore_perms Ignore the fact that pages are hidden or read-protected + * @return array The pages that contain links to the given page */ -function ft_backlinks($id){ - $result = array(); - +function ft_backlinks($id, $ignore_perms = false){ $result = idx_get_indexer()->lookupKey('relation_references', $id); if(!count($result)) return $result; // check ACL permissions foreach(array_keys($result) as $idx){ - if(isHiddenPage($result[$idx]) || auth_quickaclcheck($result[$idx]) < AUTH_READ || !page_exists($result[$idx], '', false)){ + if(($ignore_perms !== true && ( + isHiddenPage($result[$idx]) || auth_quickaclcheck($result[$idx]) < AUTH_READ + )) || !page_exists($result[$idx], '', false)){ unset($result[$idx]); } } @@ -147,42 +151,28 @@ function ft_backlinks($id){ /** * Returns the pages that use a given media file * - * Does a quick lookup with the fulltext index, then - * evaluates the instructions of the found pages + * Uses the relation media metadata property and the metadata index. * - * Aborts after $max found results + * Note that before 2013-07-31 the second parameter was the maximum number of results and + * permissions were ignored. That's why the parameter is now checked to be explicitely set + * to true (with type bool) in order to be compatible with older uses of the function. + * + * @param string $id The media id to look for + * @param bool $ignore_perms Ignore hidden pages and acls (optional, default: false) + * @return array A list of pages that use the given media file */ -function ft_mediause($id,$max){ - if(!$max) $max = 1; // need to find at least one +function ft_mediause($id, $ignore_perms = false){ + $result = idx_get_indexer()->lookupKey('relation_media', $id); - $result = array(); + if(!count($result)) return $result; - // quick lookup of the mediafile - // FIXME use metadata key lookup - $media = noNS($id); - $matches = idx_lookup(idx_tokenizer($media)); - $docs = array_keys(ft_resultCombine(array_values($matches))); - if(!count($docs)) return $result; - - // go through all found pages - $found = 0; - $pcre = preg_quote($media,'/'); - foreach($docs as $doc){ - $ns = getNS($doc); - preg_match_all('/\{\{([^|}]*'.$pcre.'[^|}]*)(|[^}]+)?\}\}/i',rawWiki($doc),$matches); - foreach($matches[1] as $img){ - $img = trim($img); - if(media_isexternal($img)) continue; // skip external images - list($img) = explode('?',$img); // remove any parameters - resolve_mediaid($ns,$img,$exists); // resolve the possibly relative img - - if($img == $id){ // we have a match - $result[] = $doc; - $found++; - break; - } + // check ACL permissions + foreach(array_keys($result) as $idx){ + if(($ignore_perms !== true && ( + isHiddenPage($result[$idx]) || auth_quickaclcheck($result[$idx]) < AUTH_READ + )) || !page_exists($result[$idx], '', false)){ + unset($result[$idx]); } - if($found >= $max) break; } sort($result); @@ -405,7 +395,6 @@ function ft_snippet_re_preprocess($term) { $BR = '\b'; } - if(substr($term,0,2) == '\\*'){ $term = substr($term,2); }else{ diff --git a/inc/html.php b/inc/html.php index f39120b83..91d8c1833 100644 --- a/inc/html.php +++ b/inc/html.php @@ -28,20 +28,6 @@ function html_wikilink($id,$name=null,$search=''){ } /** - * Helps building long attribute lists - * - * @deprecated Use buildAttributes instead - * @author Andreas Gohr <andi@splitbrain.org> - */ -function html_attbuild($attributes){ - $ret = ''; - foreach ( $attributes as $key => $value ) { - $ret .= $key.'="'.formText($value).'" '; - } - return trim($ret); -} - -/** * The loginform * * @author Andreas Gohr <andi@splitbrain.org> @@ -428,7 +414,7 @@ function html_revisions($first=0, $media_id = false){ global $conf; global $lang; $id = $ID; - /* we need to get one additionally log entry to be able to + /* we need to get one additional log entry to be able to * decide if this is the last page or is there another one. * see html_recent() */ @@ -575,18 +561,18 @@ function html_revisions($first=0, $media_id = false){ if ($info['sum']) { $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); if (!$media_id) $form->addElement(' – '); - $form->addElement(htmlspecialchars($info['sum'])); + $form->addElement('<bdi>'.htmlspecialchars($info['sum']).'</bdi>'); $form->addElement(form_makeCloseTag('span')); } $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); if($info['user']){ - $form->addElement(editorinfo($info['user'])); + $form->addElement('<bdi>'.editorinfo($info['user']).'</bdi>'); if(auth_ismanager()){ - $form->addElement(' ('.$info['ip'].')'); + $form->addElement(' <bdo dir="ltr">('.$info['ip'].')</bdo>'); } }else{ - $form->addElement($info['ip']); + $form->addElement('<bdo dir="ltr">'.$info['ip'].'</bdo>'); } $form->addElement(form_makeCloseTag('span')); @@ -774,12 +760,12 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); if($recent['user']){ - $form->addElement(editorinfo($recent['user'])); + $form->addElement('<bdi>'.editorinfo($recent['user']).'</bdi>'); if(auth_ismanager()){ - $form->addElement(' ('.$recent['ip'].')'); + $form->addElement(' <bdo dir="ltr">('.$recent['ip'].')</bdo>'); } }else{ - $form->addElement($recent['ip']); + $form->addElement('<bdo dir="ltr">'.$recent['ip'].'</bdo>'); } $form->addElement(form_makeCloseTag('span')); @@ -854,12 +840,17 @@ function html_index($ns){ * @author Andreas Gohr <andi@splitbrain.org> */ function html_list_index($item){ - global $ID; + global $ID, $conf; + + // prevent searchbots needlessly following links + $nofollow = ($ID != $conf['start'] || $conf['sitemap']) ? ' rel="nofollow"' : ''; + $ret = ''; $base = ':'.$item['id']; $base = substr($base,strrpos($base,':')+1); if($item['type']=='d'){ - $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" title="' . $item['id'] . '" class="idx_dir"><strong>'; + // FS#2766, no need for search bots to follow namespace links in the index + $ret .= '<a href="'.wl($ID,'idx='.rawurlencode($item['id'])).'" title="' . $item['id'] . '" class="idx_dir"' . $nofollow . '><strong>'; $ret .= $base; $ret .= '</strong></a>'; }else{ @@ -1022,52 +1013,52 @@ function html_diff_head($l_rev, $r_rev, $id = null, $media = false, $inline = fa }else{ $l_info = getRevisionInfo($id,$l_rev,true, $media); if($l_info['user']){ - $l_user = editorinfo($l_info['user']); - if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')'; + $l_user = '<bdi>'.editorinfo($l_info['user']).'</bdi>'; + if(auth_ismanager()) $l_user .= ' <bdo dir="ltr">('.$l_info['ip'].')</bdo>'; } else { - $l_user = $l_info['ip']; + $l_user = '<bdo dir="ltr">'.$l_info['ip'].'</bdo>'; } $l_user = '<span class="user">'.$l_user.'</span>'; - $l_sum = ($l_info['sum']) ? '<span class="sum">'.hsc($l_info['sum']).'</span>' : ''; + $l_sum = ($l_info['sum']) ? '<span class="sum"><bdi>'.hsc($l_info['sum']).'</bdi></span>' : ''; if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"'; $l_head_title = ($media) ? dformat($l_rev) : $id.' ['.dformat($l_rev).']'; - $l_head = '<a class="wikilink1" href="'.$ml_or_wl($id,"rev=$l_rev").'">'. - $l_head_title.'</a>'. + $l_head = '<bdi><a class="wikilink1" href="'.$ml_or_wl($id,"rev=$l_rev").'">'. + $l_head_title.'</a></bdi>'. $head_separator.$l_user.' '.$l_sum; } if($r_rev){ $r_info = getRevisionInfo($id,$r_rev,true, $media); if($r_info['user']){ - $r_user = editorinfo($r_info['user']); - if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')'; + $r_user = '<bdi>'.editorinfo($r_info['user']).'</bdi>'; + if(auth_ismanager()) $r_user .= ' <bdo dir="ltr">('.$r_info['ip'].')</bdo>'; } else { - $r_user = $r_info['ip']; + $r_user = '<bdo dir="ltr">'.$r_info['ip'].'</bdo>'; } $r_user = '<span class="user">'.$r_user.'</span>'; - $r_sum = ($r_info['sum']) ? '<span class="sum">'.hsc($r_info['sum']).'</span>' : ''; + $r_sum = ($r_info['sum']) ? '<span class="sum"><bdi>'.hsc($r_info['sum']).'</bdi></span>' : ''; if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; $r_head_title = ($media) ? dformat($r_rev) : $id.' ['.dformat($r_rev).']'; - $r_head = '<a class="wikilink1" href="'.$ml_or_wl($id,"rev=$r_rev").'">'. - $r_head_title.'</a>'. + $r_head = '<bdi><a class="wikilink1" href="'.$ml_or_wl($id,"rev=$r_rev").'">'. + $r_head_title.'</a></bdi>'. $head_separator.$r_user.' '.$r_sum; }elseif($_rev = @filemtime($media_or_wikiFN($id))){ $_info = getRevisionInfo($id,$_rev,true, $media); if($_info['user']){ - $_user = editorinfo($_info['user']); - if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')'; + $_user = '<bdi>'.editorinfo($_info['user']).'</bdi>'; + if(auth_ismanager()) $_user .= ' <bdo dir="ltr">('.$_info['ip'].')</bdo>'; } else { - $_user = $_info['ip']; + $_user = '<bdo dir="ltr">'.$_info['ip'].'</bdo>'; } $_user = '<span class="user">'.$_user.'</span>'; - $_sum = ($_info['sum']) ? '<span class="sum">'.hsc($_info['sum']).'</span>' : ''; + $_sum = ($_info['sum']) ? '<span class="sum"><bdi>'.hsc($_info['sum']).'</span></bdi>' : ''; if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; $r_head_title = ($media) ? dformat($_rev) : $id.' ['.dformat($_rev).']'; - $r_head = '<a class="wikilink1" href="'.$ml_or_wl($id).'">'. - $r_head_title.'</a> '. + $r_head = '<bdi><a class="wikilink1" href="'.$ml_or_wl($id).'">'. + $r_head_title.'</a></bdi> '. '('.$lang['current'].')'. $head_separator.$_user.' '.$_sum; }else{ @@ -1280,20 +1271,20 @@ function html_diff($text='',$intro=true,$type=null){ } function html_insert_softbreaks($diffhtml) { - // search the diff html string for both: - // - html tags, so these can be ignored - // - long strings of characters without breaking characters - return preg_replace_callback('/<[^>]*>|[^<> ]{12,}/','html_softbreak_callback',$diffhtml); + // search the diff html string for both: + // - html tags, so these can be ignored + // - long strings of characters without breaking characters + return preg_replace_callback('/<[^>]*>|[^<> ]{12,}/','html_softbreak_callback',$diffhtml); } function html_softbreak_callback($match){ - // if match is an html tag, return it intact - if ($match[0]{0} == '<') return $match[0]; + // if match is an html tag, return it intact + if ($match[0]{0} == '<') return $match[0]; - // its a long string without a breaking character, - // make certain characters into breaking characters by inserting a - // breaking character (zero length space, U+200B / #8203) in front them. - $regex = <<< REGEX + // its a long string without a breaking character, + // make certain characters into breaking characters by inserting a + // breaking character (zero length space, U+200B / #8203) in front them. + $regex = <<< REGEX (?(?= # start a conditional expression with a positive look ahead ... &\#?\\w{1,6};) # ... for html entities - we don't want to split them (ok to catch some invalid combinations) &\#?\\w{1,6}; # yes pattern - a quicker match for the html entity, since we know we have one @@ -1302,7 +1293,7 @@ function html_softbreak_callback($match){ )+ # end conditional expression REGEX; - return preg_replace('<'.$regex.'>xu','\0​',$match[0]); + return preg_replace('<'.$regex.'>xu','\0​',$match[0]); } /** @@ -1363,19 +1354,22 @@ function html_register(){ global $conf; global $INPUT; + $base_attrs = array('size'=>50,'required'=>'required'); + $email_attrs = $base_attrs + array('type'=>'email','class'=>'edit'); + print p_locale_xhtml('register'); print '<div class="centeralign">'.NL; $form = new Doku_Form(array('id' => 'dw__register')); $form->startFieldset($lang['btn_register']); $form->addHidden('do', 'register'); $form->addHidden('save', '1'); - $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makeTextField('login', $INPUT->post->str('login'), $lang['user'], '', 'block', $base_attrs)); if (!$conf['autopasswd']) { - $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50'))); - $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', $base_attrs)); + $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', $base_attrs)); } - $form->addElement(form_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', array('size'=>'50'))); - $form->addElement(form_makeTextField('email', $INPUT->post->str('email'), $lang['email'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makeTextField('fullname', $INPUT->post->str('fullname'), $lang['fullname'], '', 'block', $base_attrs)); + $form->addElement(form_makeField('email','email', $INPUT->post->str('email'), $lang['email'], '', 'block', $email_attrs)); $form->addElement(form_makeButton('submit', '', $lang['btn_register'])); $form->endFieldset(); html_form('register', $form); @@ -1398,10 +1392,10 @@ function html_updateprofile(){ global $auth; print p_locale_xhtml('updateprofile'); + print '<div class="centeralign">'.NL; $fullname = $INPUT->post->str('fullname', $INFO['userinfo']['name'], true); $email = $INPUT->post->str('email', $INFO['userinfo']['mail'], true); - print '<div class="centeralign">'.NL; $form = new Doku_Form(array('id' => 'dw__register')); $form->startFieldset($lang['profile']); $form->addHidden('do', 'profile'); @@ -1410,9 +1404,9 @@ function html_updateprofile(){ $attr = array('size'=>'50'); if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled'; $form->addElement(form_makeTextField('fullname', $fullname, $lang['fullname'], '', 'block', $attr)); - $attr = array('size'=>'50'); + $attr = array('size'=>'50', 'class'=>'edit'); if (!$auth->canDo('modMail')) $attr['disabled'] = 'disabled'; - $form->addElement(form_makeTextField('email', $email, $lang['email'], '', 'block', $attr)); + $form->addElement(form_makeField('email','email', $email, $lang['email'], '', 'block', $attr)); $form->addElement(form_makeTag('br')); if ($auth->canDo('modPass')) { $form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size'=>'50'))); @@ -1420,12 +1414,30 @@ function html_updateprofile(){ } if ($conf['profileconfirm']) { $form->addElement(form_makeTag('br')); - $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50'))); + $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50', 'required' => 'required'))); } $form->addElement(form_makeButton('submit', '', $lang['btn_save'])); $form->addElement(form_makeButton('reset', '', $lang['btn_reset'])); + $form->endFieldset(); html_form('updateprofile', $form); + + if ($auth->canDo('delUser') && actionOK('profile_delete')) { + $form_profiledelete = new Doku_Form(array('id' => 'dw__profiledelete')); + $form_profiledelete->startFieldset($lang['profdeleteuser']); + $form_profiledelete->addHidden('do', 'profile_delete'); + $form_profiledelete->addHidden('delete', '1'); + $form_profiledelete->addElement(form_makeCheckboxField('confirm_delete', '1', $lang['profconfdelete'],'dw__confirmdelete','', array('required' => 'required'))); + if ($conf['profileconfirm']) { + $form_profiledelete->addElement(form_makeTag('br')); + $form_profiledelete->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50', 'required' => 'required'))); + } + $form_profiledelete->addElement(form_makeButton('submit', '', $lang['btn_deleteuser'])); + $form_profiledelete->endFieldset(); + + html_form('profiledelete', $form_profiledelete); + } + print '</div>'.NL; } @@ -1533,7 +1545,7 @@ function html_edit(){ echo 'textChanged = ' . ($mod ? 'true' : 'false'); echo '/*!]]>*/</script>' . NL; } ?> - <div class="editBox"> + <div class="editBox" role="application"> <div class="toolbar group"> <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.dformat();?></div> @@ -1648,7 +1660,9 @@ function html_debug(){ if($auth){ print '<b>Auth backend capabilities:</b><pre>'; - print_r($auth->cando); + foreach ($auth->getCapabilities() as $cando){ + print ' '.str_pad($cando,16) . ' => ' . (int)$auth->canDo($cando) . NL; + } print '</pre>'; } @@ -1678,7 +1692,7 @@ function html_admin(){ global $ID; global $INFO; global $conf; - /** @var auth_basic $auth */ + /** @var DokuWiki_Auth_Plugin $auth */ global $auth; // build menu of admin functions from the plugins that handle them @@ -1686,7 +1700,7 @@ function html_admin(){ $menu = array(); foreach ($pluginlist as $p) { /** @var DokuWiki_Admin_Plugin $obj */ - if($obj =& plugin_load('admin',$p) === null) continue; + if(($obj = plugin_load('admin',$p)) === null) continue; // check permissions if($obj->forAdminOnly() && !$INFO['isadmin']) continue; diff --git a/inc/indexer.php b/inc/indexer.php index 2f3ab25dc..658fb966b 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -10,7 +10,7 @@ if(!defined('DOKU_INC')) die('meh.'); // Version tag used to force rebuild on upgrade -define('INDEXER_VERSION', 5); +define('INDEXER_VERSION', 7); // set the minimum token length to use in the index (note, this doesn't apply to numeric tokens) if (!defined('IDX_MINWORDLENGTH')) define('IDX_MINWORDLENGTH',2); @@ -215,7 +215,7 @@ class Doku_Indexer { foreach (array_keys($words) as $wlen) { $word_idx = $this->getIndex('w', $wlen); foreach ($words[$wlen] as $word => $freq) { - $wid = array_search($word, $word_idx); + $wid = array_search($word, $word_idx, true); if ($wid === false) { $wid = count($word_idx); $word_idx[] = $word; @@ -296,7 +296,7 @@ class Doku_Indexer { foreach ($values as $val) { $val = (string)$val; if ($val !== "") { - $id = array_search($val, $metawords); + $id = array_search($val, $metawords, true); if ($id === false) { $id = count($metawords); $metawords[$id] = $val; @@ -352,13 +352,13 @@ class Doku_Indexer { $pages = $this->getPages(); - $id = array_search($oldpage, $pages); + $id = array_search($oldpage, $pages, true); if ($id === false) { $this->unlock(); return 'page is not in index'; } - $new_id = array_search($newpage, $pages); + $new_id = array_search($newpage, $pages, true); if ($new_id !== false) { // make sure the page is not in the index anymore if ($this->deletePageNoLock($newpage) !== true) { @@ -397,9 +397,9 @@ class Doku_Indexer { // change the relation references index $metavalues = $this->getIndex($key, '_w'); - $oldid = array_search($oldvalue, $metavalues); + $oldid = array_search($oldvalue, $metavalues, true); if ($oldid !== false) { - $newid = array_search($newvalue, $metavalues); + $newid = array_search($newvalue, $metavalues, true); if ($newid !== false) { // free memory unset ($metavalues); @@ -600,7 +600,7 @@ class Doku_Indexer { foreach ($wordlist as $i => $word) { if ((!is_numeric($word) && strlen($word) < IDX_MINWORDLENGTH) - || array_search($word, $stopwords) !== false) + || array_search($word, $stopwords, true) !== false) unset($wordlist[$i]); } return array_values($wordlist); @@ -771,7 +771,7 @@ class Doku_Indexer { foreach(array_keys(preg_grep('/'.$re.'/', $words)) as $i) $value_ids[$i][] = $val; } else { - if (($i = array_search($val, $words)) !== false) + if (($i = array_search($val, $words, true)) !== false) $value_ids[$i][] = $val; } } @@ -874,7 +874,7 @@ class Doku_Indexer { // handle exact search if (isset($tokenlength[$ixlen])) { foreach ($tokenlength[$ixlen] as $xword) { - $wid = array_search($xword, $word_idx); + $wid = array_search($xword, $word_idx, true); if ($wid !== false) { $wids[$ixlen][] = $wid; foreach ($tokens[$xword] as $w) @@ -1017,8 +1017,9 @@ class Doku_Indexer { return false; } } - if ($conf['dperm']) + if (!empty($conf['dperm'])) { chmod($lock, $conf['dperm']); + } return $status; } @@ -1152,7 +1153,7 @@ class Doku_Indexer { */ protected function addIndexKey($idx, $suffix, $value) { $index = $this->getIndex($idx, $suffix); - $id = array_search($value, $index); + $id = array_search($value, $index, true); if ($id === false) { $id = count($index); $index[$id] = $value; @@ -1365,6 +1366,12 @@ function idx_addPage($page, $verbose=false, $force=false) { $metadata['relation_references'] = array_keys($references); else $metadata['relation_references'] = array(); + + if (($media = p_get_metadata($page, 'relation media', METADATA_RENDER_UNLIMITED)) !== null) + $metadata['relation_media'] = array_keys($media); + else + $metadata['relation_media'] = array(); + $data = compact('page', 'body', 'metadata', 'pid'); $evt = new Doku_Event('INDEXER_PAGE_ADD', $data); if ($evt->advise_before()) $data['body'] = $data['body'] . " " . rawWiki($page); diff --git a/inc/infoutils.php b/inc/infoutils.php index 71e642995..7358955a0 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -26,13 +26,13 @@ function checkUpdateMessages(){ // check if new messages needs to be fetched if($lm < time()-(60*60*24) || $lm < @filemtime(DOKU_INC.DOKU_SCRIPT)){ @touch($cf); - dbglog("checkUpdatesMessages(): downloading messages.txt"); + dbglog("checkUpdateMessages(): downloading messages.txt"); $http = new DokuHTTPClient(); $http->timeout = 12; $data = $http->get(DOKU_MESSAGEURL.$updateVersion); io_saveFile($cf,$data); }else{ - dbglog("checkUpdatesMessages(): messages.txt up to date"); + dbglog("checkUpdateMessages(): messages.txt up to date"); $data = io_readFile($cf); } @@ -193,7 +193,6 @@ function check(){ msg('Valid locale '.hsc($loc).' found.', 1); } - if($conf['allowdebug']){ msg('Debugging support is enabled. If you don\'t need it you should set $conf[\'allowdebug\'] = 0',-1); }else{ diff --git a/inc/init.php b/inc/init.php index 30eb1b251..a937b934d 100644 --- a/inc/init.php +++ b/inc/init.php @@ -267,10 +267,10 @@ function init_lang($langCode) { $lang = array(); //load the language files - require_once(DOKU_INC.'inc/lang/en/lang.php'); + require(DOKU_INC.'inc/lang/en/lang.php'); if ($langCode && $langCode != 'en') { if (file_exists(DOKU_INC."inc/lang/$langCode/lang.php")) { - require_once(DOKU_INC."inc/lang/$langCode/lang.php"); + require(DOKU_INC."inc/lang/$langCode/lang.php"); } } } @@ -288,7 +288,7 @@ function init_files(){ $fh = @fopen($file,'a'); if($fh){ fclose($fh); - if($conf['fperm']) chmod($file, $conf['fperm']); + if(!empty($conf['fperm'])) chmod($file, $conf['fperm']); }else{ nice_die("$file is not writable. Check your permissions settings!"); } diff --git a/inc/io.php b/inc/io.php index 4bd7c3364..eff0279ac 100644 --- a/inc/io.php +++ b/inc/io.php @@ -393,7 +393,7 @@ function io_mkdir_p($target){ return io_mkdir_ftp($dir); }else{ $ret = @mkdir($target,$conf['dmode']); // crawl back up & create dir tree - if($ret && $conf['dperm']) chmod($target, $conf['dperm']); + if($ret && !empty($conf['dperm'])) chmod($target, $conf['dperm']); return $ret; } } diff --git a/inc/lang/af/lang.php b/inc/lang/af/lang.php index ab8e5177b..826fda6e8 100644 --- a/inc/lang/af/lang.php +++ b/inc/lang/af/lang.php @@ -24,7 +24,6 @@ $lang['btn_logout'] = 'Teken uit'; $lang['btn_back'] = 'Terug'; $lang['btn_backlink'] = 'Wat skakel hierheen'; $lang['btn_subscribe'] = 'Hou bladsy dop'; -$lang['btn_unsubscribe'] = 'Verwyder van bladsy dophoulys'; $lang['btn_register'] = 'Skep gerus \'n rekening'; $lang['loggedinas'] = 'Ingeteken as'; $lang['user'] = 'Gebruikernaam'; diff --git a/inc/lang/ar/lang.php b/inc/lang/ar/lang.php index 5b72e0a51..fdb407da0 100644 --- a/inc/lang/ar/lang.php +++ b/inc/lang/ar/lang.php @@ -1,12 +1,13 @@ <?php + /** - * Arabic language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Mostafa Hussein <mostafa@gmail.com> * @author Yaman Hokan <always.smile.yh@hotmail.com> * @author Usama Akkad <uahello@gmail.com> * @author uahello@gmail.com + * @author Ahmad Abd-Elghany <tolpa1@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'rtl'; @@ -50,6 +51,7 @@ $lang['btn_revert'] = 'استعد'; $lang['btn_register'] = 'سجّل'; $lang['btn_apply'] = 'طبق'; $lang['btn_media'] = 'مدير الوسائط'; +$lang['btn_deleteuser'] = 'احذف حسابي الخاص'; $lang['loggedinas'] = 'داخل باسم'; $lang['user'] = 'اسم المستخدم'; $lang['pass'] = 'كلمة السر'; @@ -61,6 +63,7 @@ $lang['fullname'] = 'الاسم الحقيقي'; $lang['email'] = 'البريد الإلكتروني'; $lang['profile'] = 'الملف الشخصي'; $lang['badlogin'] = 'عذرا، اسم المشترك أو كلمة السر غير صحيحة'; +$lang['badpassconfirm'] = 'عذراً,كلمة السر غير صحيحة'; $lang['minoredit'] = 'تعديلات طفيفة'; $lang['draftdate'] = 'حفظ المسودات آليا مفعّل'; $lang['nosecedit'] = 'غُيرت الصفحة في هذه الأثناء، معلومات الجزء اصبحت قديمة. حُمُلت كل الصفحة بدلا.'; @@ -77,6 +80,11 @@ $lang['profna'] = 'هذه الويكي لا تدعم تعديل $lang['profnochange'] = 'لا تغييرات، لا شيء ليُعمل.'; $lang['profnoempty'] = 'غير مسموح باسم مستخدم أو بريد فارغ.'; $lang['profchanged'] = 'حُدث الملف الشخصي للمستخدم بنجاح.'; +$lang['profnodelete'] = 'هذه الموسوعه لا ندعم حذف الأشخاص'; +$lang['profdeleteuser'] = 'احذف حساب'; +$lang['profdeleted'] = 'حسابك الخاص تم حذفه من هذه الموسوعة'; +$lang['profconfdelete'] = 'أنا أرغب في حذف حسابي من هذه الموسوعة.<br/> +هذا الحدث غير ممكن.'; $lang['pwdforget'] = 'أنسيت كلمة السر؟ احصل على واحدة جديدة'; $lang['resendna'] = 'هذه الويكي لا تدعم إعادة إرسال كلمة المرور.'; $lang['resendpwd'] = 'اضبط كلمة سر جديدة لـ'; @@ -258,7 +266,6 @@ $lang['subscr_m_unsubscribe'] = 'ألغ الاشتراك'; $lang['subscr_m_subscribe'] = 'اشترك'; $lang['subscr_m_receive'] = 'استقبال'; $lang['subscr_style_every'] = 'بريدا على كل تغيير'; -$lang['authmodfailed'] = 'إعدادات تصريح فاسدة، يرجى مراسلة المدير.'; $lang['authtempfail'] = 'تصريح المشترك غير متوفر مؤقتاً، إن استمرت هذه الحالة يرجى مراسلة المدير'; $lang['authpwdexpire'] = 'ستنتهي صلاحية كلمة السر في %d . عليك بتغييرها سريعا.'; $lang['i_chooselang'] = 'اختر لغتك'; diff --git a/inc/lang/az/lang.php b/inc/lang/az/lang.php index 5084d9f60..df54b4f10 100644 --- a/inc/lang/az/lang.php +++ b/inc/lang/az/lang.php @@ -37,7 +37,6 @@ $lang['btn_back'] = 'Geri'; $lang['btn_backlink'] = 'Bura olan link-lər'; $lang['btn_backtomedia'] = 'media-fayl seçiminə qayıt'; $lang['btn_subscribe'] = 'Abunə ol (bütün dəyişiklər)'; -$lang['btn_unsubscribe'] = 'Abunəlikdən çıx (bütün dəyişiklər)'; $lang['btn_profile'] = 'Profil'; $lang['btn_reset'] = 'Boşalt'; $lang['btn_draft'] = 'Qaralamada düzəliş etmək'; @@ -89,7 +88,6 @@ $lang['txt_overwrt'] = 'Mövcud olan faylın üstündən yaz'; $lang['lockedby'] = 'В данный момент заблокирован Bu an blokdadır'; $lang['lockexpire'] = 'Blok bitir:'; $lang['js']['willexpire'] = 'Sizin bu səhifədə dəyişik etmək üçün blokunuz bir dəqiqə ərzində bitəcək.\nMünaqişələrdən yayınmaq və blokun taymerini sıfırlamaq üçün, baxış düyməsini sıxın.'; -$lang['notsavedyet'] = 'Yaddaşa yazılmamış dəyişiklər itəcəklər.\nSiz davam etmək istəyirsiz?'; $lang['rssfailed'] = 'Aşağıda göstərilmiş xəbər lentini əldə edən zaman xəta baş verdi: '; $lang['nothingfound'] = 'Heçnə tapılmadı.'; $lang['mediaselect'] = 'Mediya-faylın seçilməsi'; @@ -185,12 +183,6 @@ $lang['img_copyr'] = 'Müəllif hüquqları'; $lang['img_format'] = 'Format'; $lang['img_camera'] = 'Model'; $lang['img_keywords'] = 'Açar sözlər'; -$lang['subscribe_success'] = '%s adlı istifadəçi %s səhifənin paylanma siyahısına əlavə olundu'; -$lang['subscribe_error'] = '%s adlı istifadəçini %s səhifənin paylanma siyahısına əlavə etmə zamanı səhv baş verdi'; -$lang['subscribe_noaddress'] = 'Sizin profilinizdə e-mail göstərilməyib.Ona görə siz paylnma siyahılarına əlavə edilə bilməzsiniz.'; -$lang['unsubscribe_success'] = '%s adlı istifadəçi %s səhifənin paylanma siyahısından silinmişdir'; -$lang['unsubscribe_error'] = '%s adlı istifadəçini %s səhifənin paylanma siyahısından silən zaman xəta baş verdi.'; -$lang['authmodfailed'] = 'İstifadəçinin autentifikasiyasının konfiqurasiyası səhfdir. Xaiş olunur ki wiki-nin administratoru ilə əlaqə saxlayasınız.'; $lang['authtempfail'] = 'İstifadəçilərin autentifikasiyası müvəqqəti dayandırılıb. Əgər bu problem uzun müddət davam edir sə, administrator ilə əlaqə saxlayın.'; $lang['i_chooselang'] = 'Dili seçin/Language'; $lang['i_installer'] = 'DokuWiki quraşdırılır'; diff --git a/inc/lang/bg/lang.php b/inc/lang/bg/lang.php index f356955cb..e909980db 100644 --- a/inc/lang/bg/lang.php +++ b/inc/lang/bg/lang.php @@ -279,7 +279,6 @@ $lang['subscr_style_digest'] = 'на ел. писмо с обобщение н $lang['subscr_style_list'] = 'на списък с променените страници от последното ел. писмо (всеки %.2f дни)'; /* auth.class language support */ -$lang['authmodfailed'] = 'Лоша настройки за удостоверяване. Моля, уведомете администратора на Wiki страницата.'; $lang['authtempfail'] = 'Удостоверяването на потребители не е възможно за момента. Ако продължи дълго, моля уведомете администратора на Wiki страницата.'; $lang['authpwdexpire'] = 'Срока на паролата ви ще изтече след %d дни. Препорачително е да я смените по-скоро.'; diff --git a/inc/lang/ca-valencia/lang.php b/inc/lang/ca-valencia/lang.php index b7f322796..9ab423783 100644 --- a/inc/lang/ca-valencia/lang.php +++ b/inc/lang/ca-valencia/lang.php @@ -38,7 +38,6 @@ $lang['btn_back'] = 'Arrere'; $lang['btn_backlink'] = 'Vínculs remitents'; $lang['btn_backtomedia'] = 'Tornar a la selecció d\'archius de mijos'; $lang['btn_subscribe'] = 'Subscriure\'s a la pàgina'; -$lang['btn_unsubscribe'] = 'Desubscriure\'s de la pàgina'; $lang['btn_profile'] = 'Actualisar perfil'; $lang['btn_reset'] = 'Reiniciar'; $lang['btn_draft'] = 'Editar borrador'; @@ -186,12 +185,6 @@ $lang['img_copyr'] = 'Copyright'; $lang['img_format'] = 'Format'; $lang['img_camera'] = 'Càmara'; $lang['img_keywords'] = 'Paraules clau'; -$lang['subscribe_success'] = '%s afegit a la llista de subscripció per a %s'; -$lang['subscribe_error'] = 'Erro afegint a %s a la llista de subscripció per a %s'; -$lang['subscribe_noaddress'] = 'No hi ha cap direcció associada a la sessió, no es pot subscriure'; -$lang['unsubscribe_success'] = '%s borrat de la llista de subscripció per a %s'; -$lang['unsubscribe_error'] = 'Erro borrant a %s de la llista de subscripció per a %s'; -$lang['authmodfailed'] = 'Mala configuració de l\'autenticació d\'usuari. Per favor, informe a l\'administrador del Wiki.'; $lang['authtempfail'] = 'L\'autenticació d\'usuaris està desactivada temporalment. Si la situació persistix, per favor, informe a l\'administrador del Wiki.'; $lang['i_chooselang'] = 'Trie l\'idioma'; $lang['i_installer'] = 'Instalador de DokuWiki'; @@ -222,7 +215,7 @@ $lang['i_retry'] = 'Reintentar'; $lang['recent_global'] = 'Està veent els canvis dins de l\'espai de noms <b>%s</b>. També pot <a href="%s">vore els canvis recents en el wiki sancer</a>.'; $lang['years'] = 'fa %d anys'; $lang['months'] = 'fa %d mesos'; -$lang['weeks'] = 'fa %s semanes'; +$lang['weeks'] = 'fa %d semanes'; $lang['days'] = 'fa %d dies'; $lang['hours'] = 'fa %d hores'; $lang['minutes'] = 'fa %d minuts'; diff --git a/inc/lang/ca/lang.php b/inc/lang/ca/lang.php index a429dc06a..fd19c6834 100644 --- a/inc/lang/ca/lang.php +++ b/inc/lang/ca/lang.php @@ -257,7 +257,6 @@ $lang['subscr_m_receive'] = 'Rebre'; $lang['subscr_style_every'] = 'Envia\'m un correu electrònic per a cada canvi'; $lang['subscr_style_digest'] = 'Envia\'m un correu electrònic amb un resum dels canvis per a cada pàgina (cada %.2f dies)'; $lang['subscr_style_list'] = 'llistat de pàgines canviades des de l\'últim correu electrònic (cada %.2f dies)'; -$lang['authmodfailed'] = 'La configuració de l\'autenticació d\'usuaris és errònia. Informeu els administradors del wiki.'; $lang['authtempfail'] = 'L\'autenticació d\'usuaris no està disponible temporalment. Si aquesta situació persisteix, si us plau informeu els administradors del wiki.'; $lang['authpwdexpire'] = 'La vostra contrasenya caducarà en %d dies, l\'hauríeu de canviar aviat.'; $lang['i_chooselang'] = 'Trieu l\'idioma'; diff --git a/inc/lang/cs/lang.php b/inc/lang/cs/lang.php index c01b72a1b..56ffd91de 100644 --- a/inc/lang/cs/lang.php +++ b/inc/lang/cs/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Czech language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Bohumir Zamecnik <bohumir@zamecnik.org> * @author Tomas Valenta <t.valenta@sh.cvut.cz> * @author Tomas Valenta <tomas@valenta.cz> @@ -14,6 +14,8 @@ * @author Bohumir Zamecnik <bohumir.zamecnik@gmail.com> * @author Jakub A. Těšínský (j@kub.cz) * @author mkucera66@seznam.cz + * @author Zbyněk Křivka <krivka@fit.vutbr.cz> + * @author Gerrit Uitslag <klapinklapin@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -57,6 +59,7 @@ $lang['btn_revert'] = 'Vrátit zpět'; $lang['btn_register'] = 'Registrovat'; $lang['btn_apply'] = 'Použít'; $lang['btn_media'] = 'Správa médií'; +$lang['btn_deleteuser'] = 'Odstranit můj účet'; $lang['loggedinas'] = 'Přihlášen(a) jako'; $lang['user'] = 'Uživatelské jméno'; $lang['pass'] = 'Heslo'; @@ -68,6 +71,7 @@ $lang['fullname'] = 'Celé jméno'; $lang['email'] = 'E-mail'; $lang['profile'] = 'Uživatelský profil'; $lang['badlogin'] = 'Zadané uživatelské jméno a heslo není správně.'; +$lang['badpassconfirm'] = 'Bohužel špatné heslo'; $lang['minoredit'] = 'Drobné změny'; $lang['draftdate'] = 'Koncept automaticky uložen v'; $lang['nosecedit'] = 'Stránka byla v mezičase změněna. Informace o sekci již nebylo platné, byla načtena celá stránka.'; @@ -84,6 +88,11 @@ $lang['profna'] = 'Tato wiki neumožňuje změnu profilu'; $lang['profnochange'] = 'Žádné změny nebyly provedeny.'; $lang['profnoempty'] = 'Nelze zadat prázdné jméno nebo mailová adresa.'; $lang['profchanged'] = 'Uživatelský profil změněn.'; +$lang['profnodelete'] = 'Tato wiki nepodporuje mazání uživatelů'; +$lang['profdeleteuser'] = 'Smazat účet'; +$lang['profdeleted'] = 'Váš uživatelský účet byl z této wiki smazán'; +$lang['profconfdelete'] = 'Chci smazat můj účet z této wiki. <br/> Tato akce je nevratná.'; +$lang['profconfdeletemissing'] = 'Potvrzovací tlačítko nezaškrtnuto'; $lang['pwdforget'] = 'Zapomněli jste heslo? Nechte si zaslat nové'; $lang['resendna'] = 'Tato wiki neumožňuje zasílání nových hesel.'; $lang['resendpwd'] = 'Nastavit nové heslo pro'; @@ -153,7 +162,7 @@ $lang['uploadsucc'] = 'Přenos proběhl v pořádku'; $lang['uploadfail'] = 'Chyba při načítání. Možná kvůli špatně nastaveným právům?'; $lang['uploadwrong'] = 'Načtení souboru s takovouto příponou není dovoleno.'; $lang['uploadexist'] = 'Soubor už existuje, necháme ho být.'; -$lang['uploadbadcontent'] = 'Obsah načteného dokumentu %s neodpovídá jeho příponě.'; +$lang['uploadbadcontent'] = 'Nahraný obsah neodpovídá jeho příponě souboru %s.'; $lang['uploadspam'] = 'Načtený dokument byl odmítnut, je na spamovém blacklistu.'; $lang['uploadxss'] = 'Načtený dokument byl odmítnut. Zdá se, že obsahuje škodlivé věci.'; $lang['uploadsize'] = 'Nahraný soubor byl příliš velký (max. %s)'; @@ -204,7 +213,7 @@ $lang['mail_newpage'] = 'nová stránka:'; $lang['mail_changed'] = 'změna stránky:'; $lang['mail_subscribe_list'] = 'stránky změněné ve jmenném prostoru:'; $lang['mail_new_user'] = 'nový uživatel:'; -$lang['mail_upload'] = 'načtený dokument:'; +$lang['mail_upload'] = 'nahraný soubor:'; $lang['changes_type'] = 'Prohlednou změny '; $lang['pages_changes'] = 'stránek'; $lang['media_changes'] = 'souborů médií'; @@ -268,7 +277,6 @@ $lang['subscr_m_receive'] = 'Přejete si dostávat'; $lang['subscr_style_every'] = 'email pro každou změnu'; $lang['subscr_style_digest'] = 'souhrnný email změn pro každou stránku (každé %.2f dny/dní)'; $lang['subscr_style_list'] = 'seznam změněných stránek od posledního emailu (každé %.2f dny/dní)'; -$lang['authmodfailed'] = 'Autentizace uživatelů je špatně nastavena. Informujte prosím správce této wiki.'; $lang['authtempfail'] = 'Autentizace uživatelů je dočasně nedostupná. Pokud tento problém přetrvává, informujte prosím správce této wiki.'; $lang['authpwdexpire'] = 'Platnost vašeho hesla vyprší za %d dní, měli byste ho změnit co nejdříve.'; $lang['i_chooselang'] = 'Vyberte si jazyk'; @@ -293,6 +301,9 @@ $lang['i_pol1'] = 'Veřejná wiki (čtení pro všechny, zápis a $lang['i_pol2'] = 'Uzavřená wiki (čtení, zápis a upload pouze pro registrované uživatele)'; $lang['i_retry'] = 'Zkusit znovu'; $lang['i_license'] = 'Vyberte prosím licenci obsahu:'; +$lang['i_license_none'] = 'Nezobrazovat žádné licenční informace'; +$lang['i_pop_field'] = 'Prosím, pomozte nám vylepšit DokuWiki:'; +$lang['i_pop_label'] = 'Jednou měsíčně zaslat anonymní data o využívání DokuWiki jejím vývojářům'; $lang['recent_global'] = 'Právě si prohlížíte změny ve jmenném prostoru <b>%s</b>. Také si můžete <a href="%s">zobrazit změny v celé wiki</a>.'; $lang['years'] = 'před %d roky'; $lang['months'] = 'před %d měsíci'; diff --git a/inc/lang/cs/registermail.txt b/inc/lang/cs/registermail.txt index 7f5e4feb1..201e7b779 100644 --- a/inc/lang/cs/registermail.txt +++ b/inc/lang/cs/registermail.txt @@ -7,7 +7,7 @@ E-mail : @NEWEMAIL@ Datum : @DATE@ Prohlížeč : @BROWSER@ IP adresa : @IPADDRESS@ -Hostitel : @HOSTNAME +Hostitel : @HOSTNAME@ -- Tento email byl automaticky vygenerován systémem DokuWiki diff --git a/inc/lang/da/lang.php b/inc/lang/da/lang.php index 022de8127..eb50bb240 100644 --- a/inc/lang/da/lang.php +++ b/inc/lang/da/lang.php @@ -1,8 +1,8 @@ <?php + /** - * danish language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author koeppe <koeppe@kazur.dk> * @author Jon Bendtsen <bendtsen@diku.dk> * @author Lars Næsbye Christensen <larsnaesbye@stud.ku.dk> @@ -14,6 +14,9 @@ * @author rasmus@kinnerup.com * @author Michael Pedersen subben@gmail.com * @author Mikael Lyngvig <mikael@lyngvig.org> + * @author Soren Birk <soer9648@hotmail.com> + * @author Jens Hyllegaard <jens.hyllegaard@gmail.com> + * @author soer9648 <soer9648@eucl.dk> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -57,6 +60,7 @@ $lang['btn_revert'] = 'Reetablér'; $lang['btn_register'] = 'Registrér'; $lang['btn_apply'] = 'Anvend'; $lang['btn_media'] = 'Media Manager'; +$lang['btn_deleteuser'] = 'Fjern Min Konto'; $lang['loggedinas'] = 'Logget ind som'; $lang['user'] = 'Brugernavn'; $lang['pass'] = 'Adgangskode'; @@ -68,6 +72,7 @@ $lang['fullname'] = 'Fulde navn'; $lang['email'] = 'E-mail'; $lang['profile'] = 'Brugerprofil'; $lang['badlogin'] = 'Brugernavn eller adgangskode var forkert.'; +$lang['badpassconfirm'] = 'Kodeordet var desværre forkert'; $lang['minoredit'] = 'Mindre ændringer'; $lang['draftdate'] = 'Kladde automatisk gemt d.'; $lang['nosecedit'] = 'Siden blev ændret i mellemtiden, sektions information var for gammel, hentede hele siden i stedet.'; @@ -84,6 +89,10 @@ $lang['profna'] = 'Denne wiki understøtter ikke ændring af prof $lang['profnochange'] = 'Ingen ændringer, intet modificeret.'; $lang['profnoempty'] = 'Tomt navn eller e-mail adresse er ikke tilladt.'; $lang['profchanged'] = 'Brugerprofil opdateret korrekt.'; +$lang['profnodelete'] = 'Denne wiki supporterer ikke sletning af brugere'; +$lang['profdeleteuser'] = 'Slet Konto'; +$lang['profdeleted'] = 'Din brugerkonto er blevet slettet fra denne wiki'; +$lang['profconfdelete'] = 'Jeg ønsker at slette min konto fra denne wiki. <br/> Denne handling kan ikke fortrydes.'; $lang['pwdforget'] = 'Har du glemt dit adgangskode? Få et nyt'; $lang['resendna'] = 'Denne wiki understøtter ikke udsendelse af nyt adgangskode.'; $lang['resendpwd'] = 'Vælg ny adgangskode for'; @@ -198,6 +207,7 @@ $lang['user_tools'] = 'Brugerværktøjer'; $lang['site_tools'] = 'Webstedsværktøjer'; $lang['page_tools'] = 'Sideværktøjer'; $lang['skip_to_content'] = 'hop til indhold'; +$lang['sidebar'] = 'Sidebjælke'; $lang['mail_newpage'] = 'dokument tilføjet:'; $lang['mail_changed'] = 'dokument ændret:'; $lang['mail_subscribe_list'] = 'sider ændret i navnerum'; @@ -266,7 +276,6 @@ $lang['subscr_m_receive'] = 'Modtag'; $lang['subscr_style_every'] = 'email på hver ændring'; $lang['subscr_style_digest'] = 'opsummeringsmail med ændringer for hver side (hver %.2f dage)'; $lang['subscr_style_list'] = 'list af ændrede sider siden sidste email (hver %.2f dage)'; -$lang['authmodfailed'] = 'Fejl i brugervalideringens konfiguration. Kontakt venligst wikiens administrator.'; $lang['authtempfail'] = 'Brugervalidering er midlertidigt ude af drift. Hvis dette er vedvarende, kontakt venligst wikiens administrator.'; $lang['authpwdexpire'] = 'Din adgangskode vil udløbe om %d dage, du bør ændre det snart.'; $lang['i_chooselang'] = 'Vælg dit sprog'; @@ -293,6 +302,8 @@ $lang['i_pol1'] = 'Offentlig Wiki (alle kan læse, kun registrere $lang['i_pol2'] = 'Lukket Wiki (kun for registerede brugere kan læse, skrive og overføre)'; $lang['i_retry'] = 'Forsøg igen'; $lang['i_license'] = 'Vælg venligst licensen du vil tilføje dit indhold under:'; +$lang['i_license_none'] = 'Vis ikke licensinformationer'; +$lang['i_pop_field'] = 'Hjælp os venligst med at forbedre oplevelsen af DokuWiki:'; $lang['recent_global'] = 'Du ser lige nu ændringerne i <b>%s</b> navnerummet. Du kan også <a href="%s">se de sidste ændringer for hele wiki siden </a>'; $lang['years'] = '%d år siden'; $lang['months'] = '%d måned siden'; diff --git a/inc/lang/de-informal/install.html b/inc/lang/de-informal/install.html index f0473772c..19fae8065 100644 --- a/inc/lang/de-informal/install.html +++ b/inc/lang/de-informal/install.html @@ -15,11 +15,11 @@ hostest, über FTP oder ein entsprechendes Werkzeug (z.B. cPanel) durchführen.< (<abbr title="access control list">ACL</abbr>) von DokuWiki, welcher eine Administratoranmeldung und damit Zugang zum Administrationsmenü ermöglicht. Dort kannst du dann weitere Tätigkeiten wie das Installieren von Plugins, dass -Verwalten von Nutzern und das Ändern von Konfigurationseinstellungen durchführen. -Das Nutzen der Zugangskontrolle ist nicht zwingend erforderlich, es erleichtert aber +Verwalten von Benutzern und das Ändern von Konfigurationseinstellungen durchführen. +Das Benutzen der Zugangskontrolle ist nicht zwingend erforderlich, es erleichtert aber die Administration von DokuWiki.</p> -<p>Erfahrene Anwender oder Nutzer mit speziellen Konfigurationsbedürfnissen sollten +<p>Erfahrene Anwender oder Benutzer mit speziellen Konfigurationsbedürfnissen sollten die folgenden Links nutzen, um sich über <a href="http://dokuwiki.org/install">Installation</a> und <a href="http://dokuwiki.org/config">Konfiguration</a> zu diff --git a/inc/lang/de-informal/lang.php b/inc/lang/de-informal/lang.php index 9a6e6f72c..02ff85fad 100644 --- a/inc/lang/de-informal/lang.php +++ b/inc/lang/de-informal/lang.php @@ -1,8 +1,8 @@ <?php + /** - * german informal language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Andreas Gohr <andi@splitbrain.org> * @author Christof <gagi@fin.de> * @author Anika Henke <anika@selfthinker.org> @@ -64,6 +64,7 @@ $lang['btn_revert'] = 'Wiederherstellen'; $lang['btn_register'] = 'Registrieren'; $lang['btn_apply'] = 'Übernehmen'; $lang['btn_media'] = 'Medien-Manager'; +$lang['btn_deleteuser'] = 'Benutzerprofil löschen'; $lang['loggedinas'] = 'Angemeldet als'; $lang['user'] = 'Benutzername'; $lang['pass'] = 'Passwort'; @@ -74,14 +75,15 @@ $lang['remember'] = 'Angemeldet bleiben'; $lang['fullname'] = 'Voller Name'; $lang['email'] = 'E-Mail'; $lang['profile'] = 'Benutzerprofil'; -$lang['badlogin'] = 'Nutzername oder Passwort sind falsch.'; +$lang['badlogin'] = 'Benutzername oder Passwort sind falsch.'; +$lang['badpassconfirm'] = 'Das Passwort war falsch.'; $lang['minoredit'] = 'Kleine Änderung'; $lang['draftdate'] = 'Entwurf gespeichert am'; $lang['nosecedit'] = 'Diese Seite wurde in der Zwischenzeit geändert, da das Sektionsinfo veraltet ist. Die ganze Seite wird stattdessen geladen.'; $lang['regmissing'] = 'Alle Felder müssen ausgefüllt werden'; -$lang['reguexists'] = 'Der Nutzername existiert leider schon.'; -$lang['regsuccess'] = 'Der neue Nutzer wurde angelegt und das Passwort per E-Mail versandt.'; -$lang['regsuccess2'] = 'Der neue Nutzer wurde angelegt.'; +$lang['reguexists'] = 'Der Benutzername existiert leider schon.'; +$lang['regsuccess'] = 'Der neue Benutzer wurde angelegt und das Passwort per E-Mail versandt.'; +$lang['regsuccess2'] = 'Der neue Benutzer wurde angelegt.'; $lang['regmailfail'] = 'Offenbar ist ein Fehler beim Versenden der Passwortmail aufgetreten. Bitte wende dich an den Wiki-Admin.'; $lang['regbadmail'] = 'Die angegebene Mail-Adresse scheint ungültig zu sein. Falls dies ein Fehler ist, wende dich bitte an den Wiki-Admin.'; $lang['regbadpass'] = 'Die beiden eingegeben Passwörter stimmen nicht überein. Bitte versuche es noch einmal.'; @@ -91,6 +93,11 @@ $lang['profna'] = 'Änderung des Benutzerprofils in diesem Wiki n $lang['profnochange'] = 'Keine Änderungen, nichts zu tun.'; $lang['profnoempty'] = 'Es muss ein Name oder eine E-Mail Adresse angegeben werden.'; $lang['profchanged'] = 'Benutzerprofil erfolgreich geändert.'; +$lang['profnodelete'] = 'Dieses Wiki unterstützt nicht das Löschen von Benutzern.'; +$lang['profdeleteuser'] = 'Benutzerprofil löschen'; +$lang['profdeleted'] = 'Dein Benutzerprofil wurde im Wiki gelöscht.'; +$lang['profconfdelete'] = 'Ich möchte mein Benutzerprofil löschen.<br/> Diese Aktion ist nicht umkehrbar.'; +$lang['profconfdeletemissing'] = 'Bestätigungs-Checkbox wurde nicht angehakt.'; $lang['pwdforget'] = 'Passwort vergessen? Fordere ein neues an'; $lang['resendna'] = 'Passwörter versenden ist in diesem Wiki nicht möglich.'; $lang['resendpwd'] = 'Neues Passwort setzen für'; @@ -147,7 +154,7 @@ $lang['js']['media_diff_portions'] = 'Übergang'; $lang['js']['media_select'] = 'Dateien auswählen…'; $lang['js']['media_upload_btn'] = 'Hochladen'; $lang['js']['media_done_btn'] = 'Fertig'; -$lang['js']['media_drop'] = 'Dateien hier draufziehen um sie hochzuladen'; +$lang['js']['media_drop'] = 'Dateien hier hinziehen um sie hochzuladen'; $lang['js']['media_cancel'] = 'Entfernen'; $lang['js']['media_overwrt'] = 'Existierende Dateien überschreiben'; $lang['rssfailed'] = 'Es ist ein Fehler beim Laden des Feeds aufgetreten: '; @@ -273,7 +280,6 @@ $lang['subscr_m_receive'] = 'Erhalten'; $lang['subscr_style_every'] = 'E-Mail bei jeder Änderung'; $lang['subscr_style_digest'] = 'E-Mail mit zusammengefasster Übersicht der Seitenänderungen (alle %.2f Tage)'; $lang['subscr_style_list'] = 'Auflistung aller geänderten Seiten seit der letzten E-Mail (alle %.2f Tage)'; -$lang['authmodfailed'] = 'Benutzerüberprüfung nicht möglich. Bitte wende dich an den Admin.'; $lang['authtempfail'] = 'Benutzerüberprüfung momentan nicht möglich. Falls das Problem andauert, wende dich an den Admin.'; $lang['authpwdexpire'] = 'Dein Passwort läuft in %d Tag(en) ab. Du solltest es es frühzeitig ändern.'; $lang['i_chooselang'] = 'Wähle deine Sprache'; @@ -293,9 +299,9 @@ $lang['i_badval'] = '<code>%s</code> - unerlaubter oder leerer Wert $lang['i_success'] = 'Die Konfiguration wurde erfolgreich abgeschlossen. Du kannst jetzt die install.php löschen. Dein <a href="doku.php?id=wiki:welcome">neues DokuWiki</a> ist jetzt für dich bereit.'; $lang['i_failure'] = 'Es sind Fehler beim Schreiben der Konfigurationsdateien aufgetreten. Du musst diese von Hand beheben, bevor du dein <a href="doku.php?id=wiki:welcome">neues DokuWiki</a> nutzen kannst.'; $lang['i_policy'] = 'Anfangseinstellungen der Zugangskontrolle (ACL)'; -$lang['i_pol0'] = 'Offenes Wiki (lesen, schreiben und hochladen für alle Nutzer)'; -$lang['i_pol1'] = 'Öffentliches Wiki (Lesen für alle, Schreiben und Hochladen nur für registrierte Nutzer)'; -$lang['i_pol2'] = 'Geschlossenes Wiki (Lesen, Schreiben und Hochladen nur für registrierte Nutzer)'; +$lang['i_pol0'] = 'Offenes Wiki (lesen, schreiben und hochladen für alle Benutzer)'; +$lang['i_pol1'] = 'Öffentliches Wiki (Lesen für alle, Schreiben und Hochladen nur für registrierte Benutzer)'; +$lang['i_pol2'] = 'Geschlossenes Wiki (Lesen, Schreiben und Hochladen nur für registrierte Benutzer)'; $lang['i_retry'] = 'Wiederholen'; $lang['i_license'] = 'Bitte wähle die Lizenz aus unter der die Wiki-Inhalte veröffentlicht werden sollen:'; $lang['i_license_none'] = 'Keine Lizenzinformationen anzeigen'; diff --git a/inc/lang/de-informal/locked.txt b/inc/lang/de-informal/locked.txt index 4430fc6dd..1cfa089c0 100644 --- a/inc/lang/de-informal/locked.txt +++ b/inc/lang/de-informal/locked.txt @@ -1,4 +1,4 @@ ====== Seite gesperrt ====== -Diese Seite ist momentan von einem anderen Nutzer gesperrt. Warte, bis dieser mit dem Bearbeiten fertig ist oder die Sperre abläuft. +Diese Seite ist momentan von einem anderen Benutzer gesperrt. Warte, bis dieser mit dem Bearbeiten fertig ist oder die Sperre abläuft. diff --git a/inc/lang/de-informal/password.txt b/inc/lang/de-informal/password.txt index 8ce252966..e17dba4bf 100644 --- a/inc/lang/de-informal/password.txt +++ b/inc/lang/de-informal/password.txt @@ -1,6 +1,6 @@ Hallo @FULLNAME@! -Hier sind deine Nutzerdaten für @TITLE@ auf @DOKUWIKIURL@ +Hier sind deine Benutzerdaten für @TITLE@ auf @DOKUWIKIURL@ Benutzername: @LOGIN@ Passwort : @PASSWORD@ diff --git a/inc/lang/de-informal/register.txt b/inc/lang/de-informal/register.txt index 8fe4718dc..f6bf6ed85 100644 --- a/inc/lang/de-informal/register.txt +++ b/inc/lang/de-informal/register.txt @@ -1,4 +1,4 @@ -====== Als neuer Nutzer registrieren ====== +====== Als neuer Benutzer registrieren ====== -Bitte fülle alle Felder aus, um einen neuen Nutzer-Account in diesem Wiki anzulegen. Stelle sicher, dass eine **gültige E-Mail-Adresse** angegeben wird - das Passwort wird an diese Adresse gesendet. Der Nutzername sollte aus einem Wort ohne Umlaute, Leer- oder Sonderzeichen bestehen. +Bitte fülle alle Felder aus, um einen neuen Benutzer-Account in diesem Wiki anzulegen. Stelle sicher, dass eine **gültige E-Mail-Adresse** angegeben wird - das Passwort wird an diese Adresse gesendet. Der Benutzername sollte aus einem Wort ohne Umlaute, Leer- oder Sonderzeichen bestehen. diff --git a/inc/lang/de/admin.txt b/inc/lang/de/admin.txt index c52f343ea..f079f7e91 100644 --- a/inc/lang/de/admin.txt +++ b/inc/lang/de/admin.txt @@ -1,4 +1,4 @@ ====== Administration ====== -Folgende administrative Aufgaben stehen in DokuWiki zur Verfügung. +Folgende administrative Aufgaben stehen in DokuWiki zur Verfügung: diff --git a/inc/lang/de/backlinks.txt b/inc/lang/de/backlinks.txt index b797b0003..1ffa815c2 100644 --- a/inc/lang/de/backlinks.txt +++ b/inc/lang/de/backlinks.txt @@ -1,5 +1,5 @@ ====== Links hierher ====== -Dies ist eine Liste der Seiten, die zurück zur momentanen Seite linken. +Dies ist eine Liste der Seiten, welche zurück zur momentanen Seite verlinken. diff --git a/inc/lang/de/install.html b/inc/lang/de/install.html index 5af3198d4..47dcdf61d 100644 --- a/inc/lang/de/install.html +++ b/inc/lang/de/install.html @@ -15,11 +15,11 @@ hosten, über FTP oder ein entsprechendes Werkzeug (z.B. cPanel) durchführen.</ (<abbr title="access control list">ACL</abbr>) von DokuWiki, welcher eine Administratoranmeldung und damit Zugang zum Administrationsmenu ermöglicht. Dort können Sie dann weitere Tätigkeiten wie das Installieren von Plugins, dass -Verwalten von Nutzern und das Ändern von Konfigurationseinstellungen durchführen. +Verwalten von Benutzern und das Ändern von Konfigurationseinstellungen durchführen. Das Nutzen der Zugangskontrolle ist nicht zwingend erforderlich, es erleichtert aber die Administration von DokuWiki.</p> -<p>Erfahrene Anwender oder Nutzer mit speziellen Konfigurationsbedürfnissen sollten +<p>Erfahrene Anwender oder Benutzer mit speziellen Konfigurationsbedürfnissen sollten die folgenden Links nutzen, um sich über <a href="http://dokuwiki.org/install">Installation</a> und <a href="http://dokuwiki.org/config">Konfiguration</a> zu diff --git a/inc/lang/de/lang.php b/inc/lang/de/lang.php index af6f32bf4..dceaf1af0 100644 --- a/inc/lang/de/lang.php +++ b/inc/lang/de/lang.php @@ -1,8 +1,8 @@ <?php + /** - * german language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Andreas Gohr <andi@splitbrain.org> * @author Christof <gagi@fin.de> * @author Anika Henke <anika@selfthinker.org> @@ -65,6 +65,7 @@ $lang['btn_revert'] = 'Wiederherstellen'; $lang['btn_register'] = 'Registrieren'; $lang['btn_apply'] = 'Übernehmen'; $lang['btn_media'] = 'Medien-Manager'; +$lang['btn_deleteuser'] = 'Benutzerprofil löschen'; $lang['loggedinas'] = 'Angemeldet als'; $lang['user'] = 'Benutzername'; $lang['pass'] = 'Passwort'; @@ -75,14 +76,15 @@ $lang['remember'] = 'Angemeldet bleiben'; $lang['fullname'] = 'Voller Name'; $lang['email'] = 'E-Mail'; $lang['profile'] = 'Benutzerprofil'; -$lang['badlogin'] = 'Nutzername oder Passwort sind falsch.'; +$lang['badlogin'] = 'Benutzername oder Passwort sind falsch.'; +$lang['badpassconfirm'] = 'Das Passwort war falsch.'; $lang['minoredit'] = 'kleine Änderung'; $lang['draftdate'] = 'Entwurf gespeichert am'; $lang['nosecedit'] = 'Diese Seite wurde in der Zwischenzeit geändert, Sektionsinfo ist veraltet, lade stattdessen volle Seite.'; $lang['regmissing'] = 'Alle Felder müssen ausgefüllt werden.'; -$lang['reguexists'] = 'Der Nutzername existiert leider schon.'; -$lang['regsuccess'] = 'Der neue Nutzer wurde angelegt und das Passwort per E-Mail versandt.'; -$lang['regsuccess2'] = 'Der neue Nutzer wurde angelegt.'; +$lang['reguexists'] = 'Der Benutzername existiert leider schon.'; +$lang['regsuccess'] = 'Der neue Benutzer wurde angelegt und das Passwort per E-Mail versandt.'; +$lang['regsuccess2'] = 'Der neue Benutzer wurde angelegt.'; $lang['regmailfail'] = 'Offenbar ist ein Fehler beim Versenden der Passwort-E-Mail aufgetreten. Bitte wenden Sie sich an den Wiki-Admin.'; $lang['regbadmail'] = 'Die angegebene E-Mail-Adresse scheint ungültig zu sein. Falls dies ein Fehler ist, wenden Sie sich bitte an den Wiki-Admin.'; $lang['regbadpass'] = 'Die beiden eingegeben Passwörter stimmen nicht überein. Bitte versuchen Sie es noch einmal.'; @@ -92,6 +94,11 @@ $lang['profna'] = 'Änderung des Benutzerprofils in diesem Wiki n $lang['profnochange'] = 'Keine Änderungen, nichts zu tun.'; $lang['profnoempty'] = 'Es muss ein Name und eine E-Mail-Adresse angegeben werden.'; $lang['profchanged'] = 'Benutzerprofil erfolgreich geändert.'; +$lang['profnodelete'] = 'Dieses Wiki unterstützt nicht das Löschen von Benutzern.'; +$lang['profdeleteuser'] = 'Benutzerprofil löschen'; +$lang['profdeleted'] = 'Ihr Benutzerprofil wurde im Wiki gelöscht.'; +$lang['profconfdelete'] = 'Ich möchte mein Benutzerprofil löschen.<br/> Diese Aktion ist nicht umkehrbar.'; +$lang['profconfdeletemissing'] = 'Bestätigungs-Checkbox wurde nicht angehakt.'; $lang['pwdforget'] = 'Passwort vergessen? Fordere ein neues an'; $lang['resendna'] = 'Passwörter versenden ist in diesem Wiki nicht möglich.'; $lang['resendpwd'] = 'Neues Passwort setzen für'; @@ -148,7 +155,7 @@ $lang['js']['media_diff_portions'] = 'Übergang'; $lang['js']['media_select'] = 'Dateien auswählen…'; $lang['js']['media_upload_btn'] = 'Hochladen'; $lang['js']['media_done_btn'] = 'Fertig'; -$lang['js']['media_drop'] = 'Dateien hier draufziehen um sie hochzuladen'; +$lang['js']['media_drop'] = 'Dateien hier hinziehen um sie hochzuladen'; $lang['js']['media_cancel'] = 'Entfernen'; $lang['js']['media_overwrt'] = 'Existierende Dateien überschreiben'; $lang['rssfailed'] = 'Es ist ein Fehler beim Laden des Feeds aufgetreten: '; @@ -235,7 +242,7 @@ $lang['qb_extlink'] = 'Externer Link'; $lang['qb_hr'] = 'Horizontale Linie'; $lang['qb_ol'] = 'Nummerierter Listenpunkt'; $lang['qb_ul'] = 'Listenpunkt'; -$lang['qb_media'] = 'Bilder und andere Dateien hinzufügen'; +$lang['qb_media'] = 'Bilder und andere Dateien hinzufügen (öffnet sich in einem neuen Fenster)'; $lang['qb_sig'] = 'Unterschrift einfügen'; $lang['qb_smileys'] = 'Smileys'; $lang['qb_chars'] = 'Sonderzeichen'; @@ -274,7 +281,6 @@ $lang['subscr_m_receive'] = 'Benachrichtigung'; $lang['subscr_style_every'] = 'E-Mail bei jeder Bearbeitung'; $lang['subscr_style_digest'] = 'Zusammenfassung der Änderungen für jede veränderte Seite (Alle %.2f Tage)'; $lang['subscr_style_list'] = 'Liste der geänderten Seiten (Alle %.2f Tage)'; -$lang['authmodfailed'] = 'Benutzerüberprüfung nicht möglich. Bitte wenden Sie sich an den Admin.'; $lang['authtempfail'] = 'Benutzerüberprüfung momentan nicht möglich. Falls das Problem andauert, wenden Sie sich an den Admin.'; $lang['authpwdexpire'] = 'Ihr Passwort läuft in %d Tag(en) ab. Sie sollten es frühzeitig ändern.'; $lang['i_chooselang'] = 'Wählen Sie Ihre Sprache'; @@ -294,9 +300,9 @@ $lang['i_badval'] = '<code>%s</code> - unerlaubter oder leerer Wert $lang['i_success'] = 'Die Konfiguration wurde erfolgreich abgeschlossen. Sie können jetzt die install.php löschen. Ihr <a href="doku.php?id=wiki:welcome">neues DokuWiki</a> ist jetzt für Sie bereit.'; $lang['i_failure'] = 'Es sind Fehler beim Schreiben der Konfigurationsdateien aufgetreten. Sie müssen diese von Hand beheben, bevor Sie Ihr <a href="doku.php?id=wiki:welcome">neues DokuWiki</a> nutzen können.'; $lang['i_policy'] = 'Anfangseinstellungen der Zugangskontrolle (ACL)'; -$lang['i_pol0'] = 'Offenes Wiki (lesen, schreiben und hochladen für alle Nutzer)'; -$lang['i_pol1'] = 'Öffentliches Wiki (Lesen für alle, Schreiben und Hochladen nur für registrierte Nutzer)'; -$lang['i_pol2'] = 'Geschlossenes Wiki (Lesen, Schreiben und Hochladen nur für registrierte Nutzer)'; +$lang['i_pol0'] = 'Offenes Wiki (lesen, schreiben und hochladen für alle Benutzer)'; +$lang['i_pol1'] = 'Öffentliches Wiki (Lesen für alle, Schreiben und Hochladen nur für registrierte Benutzer)'; +$lang['i_pol2'] = 'Geschlossenes Wiki (Lesen, Schreiben und Hochladen nur für registrierte Benutzer)'; $lang['i_retry'] = 'Wiederholen'; $lang['i_license'] = 'Bitte wählen Sie die Lizenz, unter die Sie Ihre Inhalte stellen möchten:'; $lang['i_license_none'] = 'Lizensierungsinformation nicht anzeigen'; diff --git a/inc/lang/de/locked.txt b/inc/lang/de/locked.txt index 6656beece..97323ca61 100644 --- a/inc/lang/de/locked.txt +++ b/inc/lang/de/locked.txt @@ -1,4 +1,4 @@ ====== Seite gesperrt ====== -Diese Seite ist momentan von einem anderen Nutzer gesperrt. Warten Sie, bis dieser mit dem Bearbeiten fertig ist oder die Sperre abläuft. +Diese Seite ist momentan von einem anderen Benutzer gesperrt. Warten Sie, bis dieser mit dem Bearbeiten fertig ist oder die Sperre abläuft. diff --git a/inc/lang/de/password.txt b/inc/lang/de/password.txt index dd10b43e2..cce3b8ea6 100644 --- a/inc/lang/de/password.txt +++ b/inc/lang/de/password.txt @@ -1,6 +1,6 @@ Hallo @FULLNAME@! -Hier sind Ihre Nutzerdaten für @TITLE@ auf @DOKUWIKIURL@ +Hier sind Ihre Benutzerdaten für @TITLE@ auf @DOKUWIKIURL@ Benutzername: @LOGIN@ Passwort : @PASSWORD@ diff --git a/inc/lang/de/register.txt b/inc/lang/de/register.txt index 83684f500..f1ea30a47 100644 --- a/inc/lang/de/register.txt +++ b/inc/lang/de/register.txt @@ -1,4 +1,4 @@ -====== Als neuer Nutzer registrieren ====== +====== Als neuer Benutzer registrieren ====== -Bitte füllen Sie alle Felder aus, um einen neuen Nutzer-Account in diesem Wiki anzulegen. Stellen Sie sicher, dass eine **gültige E-Mail-Adresse** angegeben wird - das Passwort wird an diese Adresse gesendet. Der Nutzername sollte aus einem Wort ohne Umlaute, Leer- oder Sonderzeichen bestehen. +Bitte füllen Sie alle Felder aus, um einen neuen Benutzer-Account in diesem Wiki anzulegen. Stellen Sie sicher, dass eine **gültige E-Mail-Adresse** angegeben wird - das Passwort wird an diese Adresse gesendet. Der Benutzername sollte aus einem Wort ohne Umlaute, Leer- oder Sonderzeichen bestehen. diff --git a/inc/lang/el/lang.php b/inc/lang/el/lang.php index 0fe343026..61b2fda9d 100644 --- a/inc/lang/el/lang.php +++ b/inc/lang/el/lang.php @@ -1,14 +1,15 @@ <?php + /** - * Greek language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Thanos Massias <tm@thriasio.gr> * @author Αθανάσιος Νταής <homunculus@wana.gr> * @author Konstantinos Koryllos <koryllos@gmail.com> * @author George Petsagourakis <petsagouris@gmail.com> * @author Petros Vidalis <pvidalis@gmail.com> * @author Vasileios Karavasilis vasileioskaravasilis@gmail.com + * @author Constantinos Xanthopoulos <conx@xanthopoulos.info> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -52,6 +53,7 @@ $lang['btn_revert'] = 'Αποκατάσταση'; $lang['btn_register'] = 'Εγγραφή'; $lang['btn_apply'] = 'Εφαρμογή'; $lang['btn_media'] = 'Διαχειριστής πολυμέσων'; +$lang['btn_deleteuser'] = 'Αφαίρεσε τον λογαριασμό μου'; $lang['loggedinas'] = 'Συνδεδεμένος ως'; $lang['user'] = 'Όνομα χρήστη'; $lang['pass'] = 'Κωδικός'; @@ -63,6 +65,7 @@ $lang['fullname'] = 'Ονοματεπώνυμο'; $lang['email'] = 'e-mail'; $lang['profile'] = 'Προφίλ χρήστη'; $lang['badlogin'] = 'Συγνώμη, το όνομα χρήστη ή ο κωδικός ήταν λανθασμένο.'; +$lang['badpassconfirm'] = 'Ο κωδικός που εισάγατε είναι λανθασμένος'; $lang['minoredit'] = 'Ασήμαντες αλλαγές'; $lang['draftdate'] = 'Αυτόματη αποθήκευση πρόχειρης σελίδας στις'; $lang['nosecedit'] = 'Η σελίδα τροποποιήθηκε στο μεταξύ και τα στοιχεία της ενότητας δεν ήταν συγχρονισμένα, οπότε φορτώθηκε η πλήρης σελίδα. '; @@ -79,6 +82,9 @@ $lang['profna'] = 'Αυτό το wiki δεν υποστηρίζε $lang['profnochange'] = 'Καμία αλλαγή.'; $lang['profnoempty'] = 'Δεν επιτρέπεται κενό όνομα χρήστη η κενή διεύθυνση email.'; $lang['profchanged'] = 'Το προφίλ χρήστη τροποποιήθηκε επιτυχώς.'; +$lang['profnodelete'] = 'Το wiki δεν υποστηρίζει την διαγραφή χρηστών'; +$lang['profdeleteuser'] = 'Διαγραφή λογαριασμού'; +$lang['profdeleted'] = 'Ο λογαριασμός διαγράφηκε από αυτό το wiki'; $lang['pwdforget'] = 'Ξεχάσατε το κωδικό σας; Αποκτήστε νέο.'; $lang['resendna'] = 'Αυτό το wiki δεν υποστηρίζει την εκ\' νέου αποστολή κωδικών.'; $lang['resendpwd'] = 'Εισαγωγή νέου ωδικού για'; @@ -262,9 +268,8 @@ $lang['subscr_m_receive'] = 'Λήψη'; $lang['subscr_style_every'] = 'email σε κάθε αλλαγή'; $lang['subscr_style_digest'] = 'συνοπτικό email αλλαγών της σελίδας (κάθε %.2f μέρες)'; $lang['subscr_style_list'] = 'λίστα σελίδων με αλλαγές μετά από το τελευταίο email (κάθε %.2f μέρες)'; -$lang['authmodfailed'] = 'Κακή ρύθμιση λίστας χρηστών. Παρακαλούμε ενημερώστε τον διαχειριστή του wiki.'; $lang['authtempfail'] = 'Η συνδεση χρηστών είναι απενεργοποιημένη αυτή την στιγμή. Αν αυτό διαρκέσει για πολύ, παρακαλούμε ενημερώστε τον διαχειριστή του wiki.'; -$lang['authpwdexpire'] = 'Ο κωδικός πρόσβασης θα λήξει σε %s ημέρες. Προτείνουμε να τον αλλάξετε σύντομα.'; +$lang['authpwdexpire'] = 'Ο κωδικός πρόσβασης θα λήξει σε %d ημέρες. Προτείνουμε να τον αλλάξετε σύντομα.'; $lang['i_chooselang'] = 'Επιλογή γλώσσας'; $lang['i_installer'] = 'Οδηγός εγκατάστασης DokuWiki'; $lang['i_wikiname'] = 'Ονομασία wiki'; diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index 41f86f131..73b9981d2 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -51,6 +51,7 @@ $lang['btn_revert'] = 'Restore'; $lang['btn_register'] = 'Register'; $lang['btn_apply'] = 'Apply'; $lang['btn_media'] = 'Media Manager'; +$lang['btn_deleteuser'] = 'Remove My Account'; $lang['loggedinas'] = 'Logged in as'; $lang['user'] = 'Username'; @@ -63,6 +64,7 @@ $lang['fullname'] = 'Real name'; $lang['email'] = 'E-Mail'; $lang['profile'] = 'User Profile'; $lang['badlogin'] = 'Sorry, username or password was wrong.'; +$lang['badpassconfirm'] = 'Sorry, the password was wrong'; $lang['minoredit'] = 'Minor Changes'; $lang['draftdate'] = 'Draft autosaved on'; // full dformat date will be added $lang['nosecedit'] = 'The page was changed in the meantime, section info was out of date loaded full page instead.'; @@ -81,6 +83,11 @@ $lang['profna'] = 'This wiki does not support profile modificatio $lang['profnochange'] = 'No changes, nothing to do.'; $lang['profnoempty'] = 'An empty name or email address is not allowed.'; $lang['profchanged'] = 'User profile successfully updated.'; +$lang['profnodelete'] = 'This wiki does not support deleting users'; +$lang['profdeleteuser'] = 'Delete Account'; +$lang['profdeleted'] = 'Your user account has been deleted from this wiki'; +$lang['profconfdelete'] = 'I wish to remove my account from this wiki. <br/> This action can not be undone.'; +$lang['profconfdeletemissing'] = 'Confirmation check box not ticked'; $lang['pwdforget'] = 'Forgotten your password? Get a new one'; $lang['resendna'] = 'This wiki does not support password resending.'; @@ -238,7 +245,7 @@ $lang['qb_extlink'] = 'External Link'; $lang['qb_hr'] = 'Horizontal Rule'; $lang['qb_ol'] = 'Ordered List Item'; $lang['qb_ul'] = 'Unordered List Item'; -$lang['qb_media'] = 'Add Images and other files'; +$lang['qb_media'] = 'Add Images and other files (opens in a new window)'; $lang['qb_sig'] = 'Insert Signature'; $lang['qb_smileys'] = 'Smileys'; $lang['qb_chars'] = 'Special Chars'; @@ -284,7 +291,6 @@ $lang['subscr_style_digest'] = 'digest email of changes for each page (ev $lang['subscr_style_list'] = 'list of changed pages since last email (every %.2f days)'; /* auth.class language support */ -$lang['authmodfailed'] = 'Bad user authentication configuration. Please inform your Wiki Admin.'; $lang['authtempfail'] = 'User authentication is temporarily unavailable. If this situation persists, please inform your Wiki Admin.'; $lang['authpwdexpire'] = 'Your password will expire in %d days, you should change it soon.'; @@ -313,6 +319,7 @@ $lang['i_policy'] = 'Initial ACL policy'; $lang['i_pol0'] = 'Open Wiki (read, write, upload for everyone)'; $lang['i_pol1'] = 'Public Wiki (read for everyone, write and upload for registered users)'; $lang['i_pol2'] = 'Closed Wiki (read, write, upload for registered users only)'; +$lang['i_allowreg'] = 'Allow users to register themselves'; $lang['i_retry'] = 'Retry'; $lang['i_license'] = 'Please choose the license you want to put your content under:'; $lang['i_license_none'] = 'Do not show any license information'; @@ -354,4 +361,8 @@ $lang['media_perm_upload'] = 'Sorry, you don\'t have enough rights to upload $lang['media_update'] = 'Upload new version'; $lang['media_restore'] = 'Restore this version'; +$lang['currentns'] = 'Current namespace'; +$lang['searchresult'] = 'Search Result'; +$lang['plainhtml'] = 'Plain HTML'; +$lang['wikimarkup'] = 'Wiki Markup'; //Setup VIM: ex: et ts=2 : diff --git a/inc/lang/eo/admin.txt b/inc/lang/eo/admin.txt index 2ede2763c..4b0cf7909 100644 --- a/inc/lang/eo/admin.txt +++ b/inc/lang/eo/admin.txt @@ -1,3 +1,3 @@ -====== Administro ====== +====== Administrado ====== Sube vi povas trovi liston de administraj taskoj disponeblaj en DokuWiki. diff --git a/inc/lang/eo/lang.php b/inc/lang/eo/lang.php index 1bafe5191..a543b2571 100644 --- a/inc/lang/eo/lang.php +++ b/inc/lang/eo/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Esperanta dosiero - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Antono Vasiljev <esperanto.minsk ĈE tut.by> * @author Felipe Castro <fefcas@yahoo.com.br> * @author Felipe Castro <fefcas@uol.com.br> @@ -53,6 +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['loggedinas'] = 'Ensalutinta kiel'; $lang['user'] = 'Uzant-nomo'; $lang['pass'] = 'Pasvorto'; @@ -64,6 +65,7 @@ $lang['fullname'] = 'Kompleta nomo'; $lang['email'] = 'Retpoŝto'; $lang['profile'] = 'Uzanto-profilo'; $lang['badlogin'] = 'Pardonu, uzant-nomo aŭ pasvorto estis erara.'; +$lang['badpassconfirm'] = 'Pardonu, la pasvorto malĝustis'; $lang['minoredit'] = 'Etaj modifoj'; $lang['draftdate'] = 'Lasta konservo de la skizo:'; $lang['nosecedit'] = 'La paĝo ŝanĝiĝis intertempe, sekcio-informo estis malĝisdata, tial la tuta paĝo estas reŝargita.'; @@ -80,6 +82,11 @@ $lang['profna'] = 'Tiu ĉi vikio ne ebligas modifon en la profilo $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['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'; +$lang['profconfdelete'] = 'Mi deziras forigi mian aliĝon de tiu ĉi vikio. <br/> Tiu ĉi ago ne povos esti malfarata.'; +$lang['profconfdeletemissing'] = 'Konfirmilo ne estas markita'; $lang['pwdforget'] = 'Ĉu vi forgesis vian pasvorton? Prenu novan'; $lang['resendna'] = 'Tiu ĉi vikio ne ebligas resendon de la pasvortoj.'; $lang['resendpwd'] = 'Sendi novan pasvorton al'; @@ -263,7 +270,6 @@ $lang['subscr_m_receive'] = 'Ricevi'; $lang['subscr_style_every'] = 'retpoŝtaĵo pro ĉiu ŝanĝo'; $lang['subscr_style_digest'] = 'resuma retpoŝtaĵo de ŝanĝoj por ĉiu paĝo (je %.2f tagoj)'; $lang['subscr_style_list'] = 'listo de ŝanĝitaj paĝoj ekde la lasta retpoŝtaĵo (je %.2f tagoj)'; -$lang['authmodfailed'] = 'Malbona agordo por identigi la uzanton. Bonvolu informi la administranton de la vikio.'; $lang['authtempfail'] = 'La identigo de via uzantonomo estas intertempe maldisponebla. Se tiu ĉi situacio daŭros, bonvolu informi la adminstranton de la vikio.'; $lang['authpwdexpire'] = 'Via pasvorto malvalidos post %d tagoj, prefere ŝanĝu ĝin baldaũ.'; $lang['i_chooselang'] = 'Elektu vian lingvon'; @@ -324,3 +330,7 @@ $lang['media_perm_read'] = 'Bedaûrinde viaj rajtoj ne sufiĉas por legi d $lang['media_perm_upload'] = 'Bedaûrinde viaj rajtoj ne sufiĉas por alŝuti dosierojn.'; $lang['media_update'] = 'Alŝuti novan version'; $lang['media_restore'] = 'Restarigi ĉi tiun version'; +$lang['currentns'] = 'Aktuala nomspaco'; +$lang['searchresult'] = 'Serĉrezulto'; +$lang['plainhtml'] = 'Plena HTML'; +$lang['wikimarkup'] = 'Vikiteksto'; diff --git a/inc/lang/es/lang.php b/inc/lang/es/lang.php index 193ec9a7d..0764621b0 100644 --- a/inc/lang/es/lang.php +++ b/inc/lang/es/lang.php @@ -1,8 +1,8 @@ <?php + /** - * spanish language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Zigor Astarbe <zigor@astarbe.com> * @author Adrián Ariza <adrian_ariza.ciudad.com.ar> * @author Gabiel Molina <gabriel191@gmail.com> @@ -28,6 +28,8 @@ * @author Ruben Figols <ruben.figols@gmail.com> * @author Gerardo Zamudio <gerardo@gerardozamudio.net> * @author Mercè López mercelz@gmail.com + * @author r0sk <r0sk10@gmail.com> + * @author monica <may.dorado@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -71,6 +73,7 @@ $lang['btn_revert'] = 'Restaurar'; $lang['btn_register'] = 'Registrarse'; $lang['btn_apply'] = 'Aplicar'; $lang['btn_media'] = 'Gestor de ficheros'; +$lang['btn_deleteuser'] = 'Elimina Mi Cuenta'; $lang['loggedinas'] = 'Conectado como '; $lang['user'] = 'Usuario'; $lang['pass'] = 'Contraseña'; @@ -82,6 +85,7 @@ $lang['fullname'] = 'Nombre real'; $lang['email'] = 'E-Mail'; $lang['profile'] = 'Perfil del usuario'; $lang['badlogin'] = 'Lo siento, el usuario o la contraseña es incorrecto.'; +$lang['badpassconfirm'] = 'Lo siento, la contraseña es errónea'; $lang['minoredit'] = 'Cambios menores'; $lang['draftdate'] = 'Borrador guardado automáticamente:'; $lang['nosecedit'] = 'La página ha cambiado en el lapso, la información de sección estaba anticuada, en su lugar se cargó la página completa.'; @@ -98,6 +102,11 @@ $lang['profna'] = 'Este wiki no permite la modificación del perf $lang['profnochange'] = 'Sin cambios, nada que hacer.'; $lang['profnoempty'] = 'No se permite que el nombre o la dirección de correo electrónico estén vacíos.'; $lang['profchanged'] = 'Se actualizó correctamente el perfil del usuario.'; +$lang['profnodelete'] = 'Este wiki no soporta el borrado de usuarios'; +$lang['profdeleteuser'] = 'Eliminar Cuenta'; +$lang['profdeleted'] = 'Tu cuenta de usuario ha sido eliminada de este wiki'; +$lang['profconfdelete'] = 'Deseo eliminar mi cuenta de este wiki. <br /> Esta acción es irreversible.'; +$lang['profconfdeletemissing'] = 'Casilla de verificación no activada.'; $lang['pwdforget'] = '¿Has olvidado tu contraseña? Consigue una nueva'; $lang['resendna'] = 'Este wiki no brinda la posibilidad de reenvío de contraseña.'; $lang['resendpwd'] = 'Establecer nueva contraseña para'; @@ -280,7 +289,8 @@ $lang['subscr_m_unsubscribe'] = 'Darse de baja'; $lang['subscr_m_subscribe'] = 'Suscribirse'; $lang['subscr_m_receive'] = 'Recibir'; $lang['subscr_style_every'] = 'enviar correo en cada cambio'; -$lang['authmodfailed'] = 'Está mal configurada la autenticación de usuarios. Por favor, avisa al administrador del wiki.'; +$lang['subscr_style_digest'] = 'Resumen de correo electrónico de cambios por cada página (cada %.2f días)'; +$lang['subscr_style_list'] = 'lista de páginas modificadas desde el último correo electrónico (cada %.2f días)'; $lang['authtempfail'] = 'La autenticación de usuarios no está disponible temporalmente. Si esta situación persiste, por favor avisa al administrador del wiki.'; $lang['authpwdexpire'] = 'Su contraseña caducara en %d días, debería cambiarla lo antes posible'; $lang['i_chooselang'] = 'Elija su idioma'; @@ -305,6 +315,9 @@ $lang['i_pol1'] = 'Wiki público (leer para todos, escribir y sub $lang['i_pol2'] = 'Wiki cerrado (leer, escribir y subir archivos para usuarios registrados únicamente)'; $lang['i_retry'] = 'Reintentar'; $lang['i_license'] = 'Por favor escoja una licencia bajo la que publicar su contenido:'; +$lang['i_license_none'] = 'No mostrar ninguna información sobre licencias'; +$lang['i_pop_field'] = 'Por favor, ayúdanos a mejorar la experiencia de DokuWiki:'; +$lang['i_pop_label'] = 'Una vez al mes, enviar información anónima de uso de datos a los desarrolladores de DokuWiki'; $lang['recent_global'] = 'Actualmente estás viendo los cambios dentro del namespace <b>%s</b>. También puedes <a href="%s">ver los cambios recientes en el wiki completo</a>.'; $lang['years'] = '%d años atrás'; $lang['months'] = '%d meses atrás'; diff --git a/inc/lang/et/lang.php b/inc/lang/et/lang.php index 0a0310832..cc736db4d 100644 --- a/inc/lang/et/lang.php +++ b/inc/lang/et/lang.php @@ -208,7 +208,6 @@ $lang['img_copyr'] = 'Autoriõigused'; $lang['img_format'] = 'Formaat'; $lang['img_camera'] = 'Kaamera'; $lang['img_keywords'] = 'Võtmesõnad'; -$lang['authmodfailed'] = 'Vigane kasutajate autentimise konfiguratsioon. Palun teavita sellest serveri haldajat.'; $lang['authtempfail'] = 'Kasutajate autentimine on ajutiselt rivist väljas. Kui see olukord mõne aja jooksul ei parane, siis teavita sellest serveri haldajat.'; $lang['i_chooselang'] = 'Vali keel'; $lang['i_installer'] = 'DokuWiki paigaldaja'; diff --git a/inc/lang/eu/lang.php b/inc/lang/eu/lang.php index 7aab8b44c..c7e7ead9a 100644 --- a/inc/lang/eu/lang.php +++ b/inc/lang/eu/lang.php @@ -257,7 +257,6 @@ $lang['subscr_m_receive'] = 'Jaso'; $lang['subscr_style_every'] = 'e-posta aldaketa bakoitzean'; $lang['subscr_style_digest'] = 'e-posta laburbildua orri bakoitzeko aldaketentzat (%.2f egunero)'; $lang['subscr_style_list'] = 'aldatutako orrien zerrenda azken e-postatik (%.2f egunero)'; -$lang['authmodfailed'] = 'Erabiltzaile kautotzearen konfigurazioa okerra da. Mesedez, eman honen berri Wiki administratzaileari'; $lang['authtempfail'] = 'Erabiltzaile kautotzea denboraldi batez ez dago erabilgarri. Egoerak hala jarraitzen badu, mesedez, eman honen berri Wiki administratzaileari'; $lang['authpwdexpire'] = 'Zure pasahitza %d egun barru iraungiko da, laster aldatu beharko zenuke.'; $lang['i_chooselang'] = 'Hautatu zure hizkuntza'; diff --git a/inc/lang/fa/lang.php b/inc/lang/fa/lang.php index eb828a472..6cb5164d8 100644 --- a/inc/lang/fa/lang.php +++ b/inc/lang/fa/lang.php @@ -1,19 +1,15 @@ <?php + /** - * fa language file - * - * This file was initially built by fetching translations from other - * Wiki projects. See the @url lines below. Additional translations - * and fixes where done for DokuWiki by the people mentioned in the - * lines starting with @author - * - * @url http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/messages/MessagesFa.php?view=co + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author behrad eslamifar <behrad_es@yahoo.com) * @author Mohsen Firoozmandan <info@mambolearn.com> * @author Omid Mottaghi <omidmr@gmail.com> * @author Mohammad Reza Shoaei <shoaei@gmail.com> * @author Milad DZand <M.DastanZand@gmail.com> * @author AmirH Hassaneini <mytechmix@gmail.com> + * @author mehrdad <mehrdad.jafari.bojd@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'rtl'; @@ -57,6 +53,7 @@ $lang['btn_revert'] = 'بازیابی'; $lang['btn_register'] = 'یک حساب جدید بسازید'; $lang['btn_apply'] = 'اعمال کن'; $lang['btn_media'] = 'مدیریت محتوای چند رسانه ای'; +$lang['btn_deleteuser'] = 'حذف حساب کاربری خود'; $lang['loggedinas'] = 'به عنوان کاربر روبرو وارد شدهاید:'; $lang['user'] = 'نام کاربری:'; $lang['pass'] = 'گذرواژهی شما'; @@ -68,6 +65,7 @@ $lang['fullname'] = '*نام واقعی شما'; $lang['email'] = 'ایمیل شما*'; $lang['profile'] = 'پروفایل کاربر'; $lang['badlogin'] = 'خطا در ورود به سیستم'; +$lang['badpassconfirm'] = 'متاسفم ، رمز عبور اشتباه است'; $lang['minoredit'] = 'این ویرایش خُرد است'; $lang['draftdate'] = 'ذخیره خودکار پیشنویس'; $lang['nosecedit'] = 'این صفحه در این میان تغییر کرده است، اطلاعات بخش قدیمی شده است، در عوض محتوای کل نمایش داده میشود.'; @@ -84,6 +82,8 @@ $lang['profna'] = 'این ویکی اجازه ویرایش پرو $lang['profnochange'] = 'تغییری صورت نگرفت'; $lang['profnoempty'] = 'نام و آدرس ایمیل باید پر شود'; $lang['profchanged'] = 'پروفایل کاربر با موفقیت به روز شد'; +$lang['profnodelete'] = 'ویکی توانایی پشتیبانی از حذف کاربران را ندارد'; +$lang['profdeleteuser'] = 'حذف حساب کاربری'; $lang['pwdforget'] = 'گذرواژهی خود را فراموش کردهاید؟ جدید دریافت کنید'; $lang['resendna'] = 'این ویکی ارسال مجدد گذرواژه را پشتیبانی نمیکند'; $lang['resendpwd'] = 'تعیین کلمه عبور جدید برای '; @@ -266,7 +266,6 @@ $lang['subscr_m_unsubscribe'] = 'لغو آبونه'; $lang['subscr_m_subscribe'] = 'آبونه شدن'; $lang['subscr_m_receive'] = 'دریافت کردن'; $lang['subscr_style_every'] = 'ارسال راینامه در تمامی تغییرات'; -$lang['authmodfailed'] = 'اشکال در نوع معتبرسازی کاربران، مدیر ویکی را باخبر سازید.'; $lang['authtempfail'] = 'معتبرسازی کابران موقتن مسدود میباشد. اگر این حالت پایدار بود، مدیر ویکی را باخبر سازید.'; $lang['authpwdexpire'] = 'کلمه عبور شما در %d روز منقضی خواهد شد ، شما باید آن را زود تغییر دهید'; $lang['i_chooselang'] = 'انتخاب زبان'; diff --git a/inc/lang/fi/lang.php b/inc/lang/fi/lang.php index b66558d26..4a0a88ac8 100644 --- a/inc/lang/fi/lang.php +++ b/inc/lang/fi/lang.php @@ -262,7 +262,6 @@ $lang['subscr_m_receive'] = 'Vastaanota'; $lang['subscr_style_every'] = 'Sähköposti joka muutoksesta'; $lang['subscr_style_digest'] = 'yhteenveto-sähköposti joka sivusta (joka %.2f. päivä)'; $lang['subscr_style_list'] = 'lista muuttuneista sivuista edellisen sähköpostin jälkeen (joka %.2f. päivä)'; -$lang['authmodfailed'] = 'Käyttäjien autentikoinnin asetukset ovat virheelliset. Ilmoita asiasta wikin ylläpitäjälle.'; $lang['authtempfail'] = 'Käyttäjien autentikointi ei tällä hetkellä onnistu. Jos ongelma jatkuu, ota yhteyttä wikin ylläpitäjään.'; $lang['authpwdexpire'] = 'Salasanasi vanhenee %d pv:n päästä, vaihda salasanasi pikaisesti.'; $lang['i_chooselang'] = 'Valitse kieli'; diff --git a/inc/lang/fo/lang.php b/inc/lang/fo/lang.php index 9f51824db..161e7321a 100644 --- a/inc/lang/fo/lang.php +++ b/inc/lang/fo/lang.php @@ -168,5 +168,4 @@ $lang['img_copyr'] = 'Upphavsrættur'; $lang['img_format'] = 'Snið'; $lang['img_camera'] = 'Fototól'; $lang['img_keywords'] = 'Evnisorð'; -$lang['authmodfailed'] = 'Brek við validering av brúkarasamansetingv. Fá samband við umboðsstjóran á hesi wiki.'; $lang['authtempfail'] = 'Validering av brúkara virkar fyribils ikki. Um hetta er varandi, fá so samband við umboðsstjóran á hesi wiki.'; diff --git a/inc/lang/fr/diff.txt b/inc/lang/fr/diff.txt index 8569f3497..d1230ccaf 100644 --- a/inc/lang/fr/diff.txt +++ b/inc/lang/fr/diff.txt @@ -1,4 +1,4 @@ ====== Différences ====== -Cette page vous affiche les différences entre la révision choisie et la version actuelle de la page. +Ci-dessous, les différences entre deux révisions de la page. diff --git a/inc/lang/fr/lang.php b/inc/lang/fr/lang.php index adeb175ef..44bc0f859 100644 --- a/inc/lang/fr/lang.php +++ b/inc/lang/fr/lang.php @@ -1,8 +1,8 @@ <?php + /** - * french language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Sébastien Bauer <sebastien.bauer@advalvas.be> * @author Antoine Fixary <antoine.fixary@freesbee.fr> * @author cumulus <pta-n56@myamail.com> @@ -27,6 +27,7 @@ * @author Olivier DUVAL <zorky00@gmail.com> * @author Anael Mobilia <contrib@anael.eu> * @author Bruno Veilleux <bruno.vey@gmail.com> + * @author Emmanuel <seedfloyd@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -70,6 +71,7 @@ $lang['btn_revert'] = 'Restaurer'; $lang['btn_register'] = 'S\'enregistrer'; $lang['btn_apply'] = 'Appliquer'; $lang['btn_media'] = 'Gestionnaire de médias'; +$lang['btn_deleteuser'] = 'Supprimer mon compte'; $lang['loggedinas'] = 'Connecté en tant que '; $lang['user'] = 'Utilisateur'; $lang['pass'] = 'Mot de passe'; @@ -81,6 +83,7 @@ $lang['fullname'] = 'Nom'; $lang['email'] = 'Adresse de courriel'; $lang['profile'] = 'Profil utilisateur'; $lang['badlogin'] = 'L\'utilisateur ou le mot de passe est incorrect.'; +$lang['badpassconfirm'] = 'Désolé, le mot de passe est erroné'; $lang['minoredit'] = 'Modification mineure'; $lang['draftdate'] = 'Brouillon enregistré de manière automatique le'; $lang['nosecedit'] = 'La page a changé entre temps, les informations de la section sont obsolètes ; la page complète a été chargée à la place.'; @@ -97,6 +100,11 @@ $lang['profna'] = 'Ce wiki ne permet pas de modifier les profils' $lang['profnochange'] = 'Pas de modification, rien à faire.'; $lang['profnoempty'] = 'Un nom ou une adresse de courriel vide n\'est pas permis.'; $lang['profchanged'] = 'Mise à jour du profil réussie.'; +$lang['profnodelete'] = 'Ce wiki ne permet pas la suppression des utilisateurs'; +$lang['profdeleteuser'] = 'Supprimer le compte'; +$lang['profdeleted'] = 'Votre compte utilisateur a été supprimé de ce wiki'; +$lang['profconfdelete'] = 'Je veux supprimer mon compte sur ce wiki. </br> Cette action est irréversible.'; +$lang['profconfdeletemissing'] = 'La case de confirmation n\'est pas cochée'; $lang['pwdforget'] = 'Mot de passe oublié ? Obtenez-en un nouveau'; $lang['resendna'] = 'Ce wiki ne permet pas le renvoi de mot de passe.'; $lang['resendpwd'] = 'Définir un nouveau mot de passe pour'; @@ -279,7 +287,6 @@ $lang['subscr_m_receive'] = 'Recevoir'; $lang['subscr_style_every'] = 'Recevoir un courriel à chaque modification'; $lang['subscr_style_digest'] = 'Courriel, tous les %.2f jours, résumant les modifications de chaque page'; $lang['subscr_style_list'] = 'Liste des pages modifiées depuis le dernier courriel (tous les %.2f jours)'; -$lang['authmodfailed'] = 'Mauvais paramétrage de l\'authentification. Merci d\'en informer l\'administrateur du wiki.'; $lang['authtempfail'] = 'L\'authentification est temporairement indisponible. Si cela perdure, merci d\'en informer l\'administrateur du wiki.'; $lang['authpwdexpire'] = 'Votre mot de passe expirera dans %d jours, vous devriez le changer bientôt.'; $lang['i_chooselang'] = 'Choisissez votre langue'; diff --git a/inc/lang/gl/lang.php b/inc/lang/gl/lang.php index fa49c1121..65967a3b5 100644 --- a/inc/lang/gl/lang.php +++ b/inc/lang/gl/lang.php @@ -258,7 +258,6 @@ $lang['subscr_m_unsubscribe'] = 'Desubscribir'; $lang['subscr_m_subscribe'] = 'Subscribir'; $lang['subscr_m_receive'] = 'Recibir'; $lang['subscr_style_every'] = 'correo-e en cada troco'; -$lang['authmodfailed'] = 'Configuración de autenticación de usuario incorrecta. Por favor, informa ao Administrador do teu Wiki.'; $lang['authtempfail'] = 'A autenticación de usuario non está dispoñible de xeito temporal. De persistir esta situación, por favor, informa ao Administrador do teu Wiki.'; $lang['authpwdexpire'] = 'A túa contrasinal expirará en %d días, deberías cambiala pronto.'; $lang['i_chooselang'] = 'Escolle o teu idioma'; diff --git a/inc/lang/he/lang.php b/inc/lang/he/lang.php index 4853a0e2b..2c4d758ff 100644 --- a/inc/lang/he/lang.php +++ b/inc/lang/he/lang.php @@ -1,15 +1,16 @@ <?php + /** - * Hebrew language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) - * @link http://sourceforge.net/projects/hebdokuwiki/ + * * @author גיא שפר <guysoft@ort.org.il> * @author Denis Simakov <akinoame1@gmail.com> * @author Dotan Kamber <kamberd@yahoo.com> * @author Moshe Kaplan <mokplan@gmail.com> * @author Yaron Yogev <yaronyogev@gmail.com> * @author Yaron Shahrabani <sh.yaron@gmail.com> + * @author Roy Zahor <roy.zahor@gmail.com> + * @author alex <ralexay@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'rtl'; @@ -45,11 +46,13 @@ $lang['btn_backtomedia'] = 'חזרה לבחירת קובץ מדיה'; $lang['btn_subscribe'] = 'מעקב אחרי שינוים'; $lang['btn_profile'] = 'עדכון הפרופיל'; $lang['btn_reset'] = 'איפוס'; +$lang['btn_resendpwd'] = 'הגדר סיסמה חדשה'; $lang['btn_draft'] = 'עריכת טיוטה'; $lang['btn_recover'] = 'שחזור טיוטה'; $lang['btn_draftdel'] = 'מחיקת טיוטה'; $lang['btn_revert'] = 'שחזור'; $lang['btn_register'] = 'הרשמה'; +$lang['btn_media'] = 'מנהל המדיה'; $lang['loggedinas'] = 'נכנסת בשם'; $lang['user'] = 'שם משתמש'; $lang['pass'] = 'ססמה'; @@ -61,6 +64,7 @@ $lang['fullname'] = 'שם מלא'; $lang['email'] = 'דוא״ל'; $lang['profile'] = 'פרופיל המשתמש'; $lang['badlogin'] = 'שם המשתמש או הססמה שגויים, עמך הסליחה'; +$lang['badpassconfirm'] = 'מצטערים, הסיסמה שגויה'; $lang['minoredit'] = 'שינוים מזעריים'; $lang['draftdate'] = 'הטיוטה נשמרה אוטומטית ב־'; $lang['nosecedit'] = 'הדף השתנה בינתיים, הקטע שערכת אינו מעודכן - העמוד כולו נטען במקום זאת.'; @@ -77,8 +81,10 @@ $lang['profna'] = 'בוויקי הזה לא ניתן לשנות $lang['profnochange'] = 'אין שינויים, הפרופיל לא עודכן'; $lang['profnoempty'] = 'השם וכתובת הדוא״ל לא יכולים להיות ריקים'; $lang['profchanged'] = 'הפרופיל עודכן בהצלחה'; +$lang['profdeleteuser'] = 'הסר חשבון'; $lang['pwdforget'] = 'שכחת את הססמה שלך? ניתן לקבל חדשה'; $lang['resendna'] = 'הוויקי הזה אינו תומך בחידוש ססמה'; +$lang['resendpwd'] = 'הגדר סיסמא חדשה בעבור'; $lang['resendpwdmissing'] = 'עליך למלא את כל השדות, עמך הסליחה.'; $lang['resendpwdnouser'] = 'משתמש בשם זה לא נמצא במסד הנתונים, עמך הסליחה.'; $lang['resendpwdbadauth'] = 'קוד אימות זה אינו תקף. יש לוודא כי נעשה שימוש בקישור האימות המלא, עמך הסליחה.'; @@ -93,7 +99,7 @@ $lang['txt_filename'] = 'העלאה בשם (נתון לבחירה)'; $lang['txt_overwrt'] = 'שכתוב על קובץ קיים'; $lang['lockedby'] = 'נעול על ידי'; $lang['lockexpire'] = 'הנעילה פגה'; -$lang['js']['willexpire'] = 'הנעילה תחלוף עוד זמן קצר. \nלמניעת התנגשויות יש להשתמש בכפתור הרענון מטה כדי לאפס את מד משך הנעילה.'; +$lang['js']['willexpire'] = 'הנעילה תחלוף עוד זמן קצר. \nלמניעת התנגשויות יש להשתמש בכפתור הרענון מטה כדי לאפס את מד משך הנעילה.'; $lang['js']['notsavedyet'] = 'שינויים שלא נשמרו ילכו לאיבוד.'; $lang['js']['searchmedia'] = 'חיפוש אחר קבצים'; $lang['js']['keepopen'] = 'השארת חלון פתוח על הבחירה'; @@ -124,6 +130,15 @@ $lang['js']['nosmblinks'] = 'קישור לכונני שיתוף של Window $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_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'] = 'קובצי מדיה'; @@ -158,6 +173,9 @@ $lang['yours'] = 'הגרסה שלך'; $lang['diff'] = 'הצגת שינוים מגרסה זו ועד הנוכחית'; $lang['diff2'] = 'הצגת הבדלים בין הגרסאות שנבחרו'; $lang['difflink'] = 'קישור לתצוגה השוואה זו'; +$lang['diff_type'] = 'הצגת הבדלים:'; +$lang['diff_inline'] = 'באותה השורה'; +$lang['diff_side'] = 'זה לצד זה'; $lang['line'] = 'שורה'; $lang['breadcrumb'] = 'ביקורים אחרונים'; $lang['youarehere'] = 'זהו מיקומך'; @@ -170,11 +188,18 @@ $lang['external_edit'] = 'עריכה חיצונית'; $lang['summary'] = 'תקציר העריכה'; $lang['noflash'] = '<a href="http://www.adobe.com/products/flashplayer/">תוסף פלאש לדפדפן</a> נדרש כדי להציג תוכן זה.'; $lang['download'] = 'הורדת מקטע'; +$lang['tools'] = 'כלים'; +$lang['user_tools'] = 'כלים של משתמש'; +$lang['site_tools'] = 'כלים של אתר'; +$lang['page_tools'] = 'כלים של דף'; +$lang['skip_to_content'] = 'עבור לתוכן'; $lang['mail_newpage'] = 'דף נוסף:'; $lang['mail_changed'] = 'דף שונה:'; $lang['mail_subscribe_list'] = 'דפים שהשתנו במרחב השם:'; $lang['mail_new_user'] = 'משתמש חדש:'; $lang['mail_upload'] = 'קובץ הועלה:'; +$lang['pages_changes'] = 'דפים'; +$lang['media_changes'] = 'קבצי מדיה'; $lang['qb_bold'] = 'טקסט מודגש'; $lang['qb_italic'] = 'טקסט נטוי'; $lang['qb_underl'] = 'טקסט עם קו תחתון'; @@ -215,6 +240,8 @@ $lang['img_copyr'] = 'זכויות יוצרים'; $lang['img_format'] = 'מבנה'; $lang['img_camera'] = 'מצלמה'; $lang['img_keywords'] = 'מילות מפתח'; +$lang['img_width'] = 'רוחב'; +$lang['img_height'] = 'גובה'; $lang['subscr_subscribe_success'] = '%s נוסף לרשימת המינויים לדף %s'; $lang['subscr_subscribe_error'] = 'אירעה שגיאה בהוספת %s לרשימת המינויים לדף %s'; $lang['subscr_subscribe_noaddress'] = 'אין כתובת המשויכת עם הכניסה שלך, נא ניתן להוסיף אותך לרשימת המינויים'; @@ -231,7 +258,6 @@ $lang['subscr_m_receive'] = 'קבלת'; $lang['subscr_style_every'] = 'דוא״ל עם כל שינוי'; $lang['subscr_style_digest'] = 'הודעת דוא״ל המציגה את כל השינויים בכל עמוד (בכל %.2f ימים)'; $lang['subscr_style_list'] = 'רשימת השינויים בדפים מאז הודעת הדוא״ל האחרונה (בכל %.2f ימים)'; -$lang['authmodfailed'] = 'תצורת אימות המשתמשים אינה תקינה. נא ליידע את מנהל הוויקי.'; $lang['authtempfail'] = 'אימות משתמשים אינו זמין כרגע. אם מצב זה נמשך נא ליידע את מנהל הוויקי.'; $lang['i_chooselang'] = 'נא לבחור שפה'; $lang['i_installer'] = 'תכנית ההתקנה של DokuWiki'; @@ -265,3 +291,12 @@ $lang['hours'] = 'לפני %d שעות'; $lang['minutes'] = 'לפני %d דקות'; $lang['seconds'] = 'לפני %d שניות'; $lang['wordblock'] = 'השינויים שלך לא נשמרו כיוון שהם מכילים טקסט חסום (ספאם).'; +$lang['media_searchtab'] = 'חיפוש'; +$lang['media_file'] = 'קובץ'; +$lang['media_viewtab'] = 'תצוגה'; +$lang['media_edittab'] = 'עריכה'; +$lang['media_historytab'] = 'היסטוריה'; +$lang['media_list_rows'] = 'שורות'; +$lang['media_sort_name'] = 'שם'; +$lang['media_sort_date'] = 'תאריך'; +$lang['media_namespaces'] = 'בחר מרחב שמות'; diff --git a/inc/lang/hi/diff.txt b/inc/lang/hi/diff.txt new file mode 100644 index 000000000..6f88c1985 --- /dev/null +++ b/inc/lang/hi/diff.txt @@ -0,0 +1,3 @@ +======असमानता====== + +यह आपको पृष्ठ के दो संस्करणों के बीच असमानता को दर्शाता है.
\ No newline at end of file diff --git a/inc/lang/hi/lang.php b/inc/lang/hi/lang.php index d2021fcae..184eeedbc 100644 --- a/inc/lang/hi/lang.php +++ b/inc/lang/hi/lang.php @@ -1,15 +1,11 @@ <?php + /** - * hi language file - * - * This file was initially built by fetching translations from other - * Wiki projects. See the @url lines below. Additional translations - * and fixes where done for DokuWiki by the people mentioned in the - * lines starting with @author - * - * @url http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/languages/messages/MessagesHi.php?view=co + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Abhinav Tyagi <abhinavtyagi11@gmail.com> * @author yndesai@gmail.com + * @author Santosh Joshi <sanjujoshhi@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -44,6 +40,12 @@ $lang['btn_backlink'] = 'पिछली कड़ियाँ'; $lang['btn_backtomedia'] = 'मीडिया फाइल चयन पर पीछे जायें'; $lang['btn_subscribe'] = 'सदस्यता प्रबंधन'; $lang['btn_profile'] = 'परिचय संपादित करें'; +$lang['btn_resendpwd'] = 'नया पासवर्ड सेट करें'; +$lang['btn_draft'] = 'प्रारूप सम्पादित करें'; +$lang['btn_draftdel'] = 'प्रारूप मिटायें'; +$lang['btn_revert'] = 'वापस लौटाएं'; +$lang['btn_apply'] = 'लागू करें'; +$lang['btn_deleteuser'] = 'खाता मिटायें'; $lang['user'] = 'उपयोगकर्ता का नाम'; $lang['pass'] = 'गुप्त शब्द'; $lang['newpass'] = 'नव गुप्त शब्द'; diff --git a/inc/lang/hr/lang.php b/inc/lang/hr/lang.php index a607210d7..f19610827 100644 --- a/inc/lang/hr/lang.php +++ b/inc/lang/hr/lang.php @@ -231,7 +231,6 @@ $lang['subscr_m_receive'] = 'Primaj'; $lang['subscr_style_every'] = 'email za svaku promjenu'; $lang['subscr_style_digest'] = 'email s kratakim prikazom promjena za svaku stranicu (svaka %.2f dana)'; $lang['subscr_style_list'] = 'listu promijenjenih stranica od zadnjeg primljenog email-a (svaka %.2f dana)'; -$lang['authmodfailed'] = 'Greška u konfiguraciji korisničke autentifikacije. Molimo Vas da kontaktirate administratora.'; $lang['authtempfail'] = 'Autentifikacija korisnika je privremeno nedostupna. Molimo Vas da kontaktirate administratora.'; $lang['i_chooselang'] = 'Izaberite vaš jezik'; $lang['i_installer'] = 'DokuWiki instalacija'; diff --git a/inc/lang/hu/diff.txt b/inc/lang/hu/diff.txt index 6a09cdea2..50bd067e9 100644 --- a/inc/lang/hu/diff.txt +++ b/inc/lang/hu/diff.txt @@ -1,4 +1,4 @@ ====== Különbségek ====== -A kiválasztott változat és az aktuális verzió közötti különbséget mutatjuk. +A kiválasztott változat és az aktuális verzió közötti különbségek a következők. diff --git a/inc/lang/hu/draft.txt b/inc/lang/hu/draft.txt index 4d12e2e0c..cae980aa5 100644 --- a/inc/lang/hu/draft.txt +++ b/inc/lang/hu/draft.txt @@ -2,4 +2,4 @@ Az oldal utolsó szerkesztését nem fejezted be rendesen. A DokuWiki elmentette piszkozatként, így most folytathatod a szerkesztést. Lent látható, amit az utolsó szerkesztésből elmentettünk. -Válassz a //helyreállítás// vagy a //törlés// opciók közül a piszkozat sorsát illetően.
\ No newline at end of file +Válassz a //helyreállítás// vagy a //törlés// opciók közül a piszkozat sorsát illetően vagy //megszakíthatod// a szerkesztési folyamatot.
\ No newline at end of file diff --git a/inc/lang/hu/edit.txt b/inc/lang/hu/edit.txt index 898387cf2..0992723c1 100644 --- a/inc/lang/hu/edit.txt +++ b/inc/lang/hu/edit.txt @@ -1 +1 @@ -Szerkeszd az oldalt majd üsd le a ''Mentés'' gombot. Lásd a [[wiki:syntax|nyelvtan]] oldalt a formázási lehetőségekért. Kérünk, hogy csak akkor szerkeszd az oldalt ha **jobbítani** tudod. Ha ki akarsz próbálni dolgokat akkor az első lépéseid a [[playground:playground|játszótéren]] (playground) tedd. +Szerkeszd az oldalt majd kattints a ''Mentés'' gombra! Lásd a [[wiki:syntax|formázás]] oldalt a formázási lehetőségekért. Kérünk, hogy csak akkor szerkeszd az oldalt ha **javítani** tudsz rajta. Ha ki akarsz próbálni dolgokat, akkor az első lépéseid a [[playground:playground|játszótéren]] tedd. diff --git a/inc/lang/hu/install.html b/inc/lang/hu/install.html index a7d681667..c0373932e 100644 --- a/inc/lang/hu/install.html +++ b/inc/lang/hu/install.html @@ -15,12 +15,12 @@ vagy a tárhelyszolgáltató által rendelkezésre bocsátott beállítóeszköz <p>A Beállító Varázsló felkészíti ezt a DokuWikit a hozzáférési listák (<abbr title="access control list">ACL</abbr>-ek) használatára. Így -a Wiki-gazda felhasználóval hozzáférünk az admin menühöz, mellyel +az Adminisztrátor felhasználóval hozzáférünk az admin menühöz, mellyel bővítményeket telepíthetünk, felhasználókat és hozzáférési jogokat kezelhetünk, valamint változtathatunk a konfigurációs beállításokon. Ez tulajdonképpen nem szükséges a DokuWiki működéséhez, de megkönnyíti az adminisztrációt.</p> <p>Szakértők illetve speciális beállítást igénylő felhasználók további információkat -találnak a következő oldalakon <a href="http://dokuwiki.org/install">telepítéssel</a> +találnak a következő oldalakon a <a href="http://dokuwiki.org/install">telepítéssel</a> és <a href="http://dokuwiki.org/config">konfigurálási lehetőségekkel</a> kapcsolatban.</p> diff --git a/inc/lang/hu/lang.php b/inc/lang/hu/lang.php index 275fb15d5..2622934c2 100644 --- a/inc/lang/hu/lang.php +++ b/inc/lang/hu/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Hungarian language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Ziegler Gábor <gziegler@freemail.hu> * @author Sandor TIHANYI <stihanyi+dw@gmail.com> * @author Siaynoq Mage <siaynoqmage@gmail.com> @@ -10,6 +10,8 @@ * @author Szabó Dávid <szabo.david@gyumolcstarhely.hu> * @author Sándor TIHANYI <stihanyi+dw@gmail.com> * @author David Szabo <szabo.david@gyumolcstarhely.hu> + * @author Marton Sebok <sebokmarton@gmail.com> + * @author Serenity87HUN <anikototh87@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -42,14 +44,18 @@ $lang['btn_delete'] = 'Törlés'; $lang['btn_back'] = 'Vissza'; $lang['btn_backlink'] = 'Hivatkozások'; $lang['btn_backtomedia'] = 'Vissza a médiafájlok kezeléséhez'; -$lang['btn_subscribe'] = 'Oldalváltozások-hírlevél feliratkozás'; +$lang['btn_subscribe'] = 'Feliratkozás az oldalváltozásokra'; $lang['btn_profile'] = 'Személyes beállítások'; $lang['btn_reset'] = 'Alaphelyzet'; +$lang['btn_resendpwd'] = 'Jelszóváltoztatás'; $lang['btn_draft'] = 'Piszkozat szerkesztése'; $lang['btn_recover'] = 'Piszkozat folytatása'; $lang['btn_draftdel'] = 'Piszkozat törlése'; $lang['btn_revert'] = 'Helyreállítás'; $lang['btn_register'] = 'Regisztráció'; +$lang['btn_apply'] = 'Alkalmaz'; +$lang['btn_media'] = 'Médiakezelő'; +$lang['btn_deleteuser'] = 'Felhasználói fiókom eltávolítása'; $lang['loggedinas'] = 'Belépett felhasználó: '; $lang['user'] = 'Azonosító'; $lang['pass'] = 'Jelszó'; @@ -60,16 +66,17 @@ $lang['remember'] = 'Emlékezz rám'; $lang['fullname'] = 'Teljes név'; $lang['email'] = 'E-Mail'; $lang['profile'] = 'Személyes beállítások'; -$lang['badlogin'] = 'Sajnáljuk, az azonosító, vagy a jelszó nem jó.'; +$lang['badlogin'] = 'Sajnáljuk, az azonosító vagy a jelszó nem jó.'; +$lang['badpassconfirm'] = 'Hibás jelszó'; $lang['minoredit'] = 'Apróbb változások'; $lang['draftdate'] = 'Piszkozat elmentve:'; -$lang['nosecedit'] = 'Időközben megváltozott az oldal, emiatt a szakasz nem friss. Töltse újra az egész oldalt!'; +$lang['nosecedit'] = 'Időközben megváltozott az oldal, emiatt a szakasz nem friss. Töltsd újra az egész oldalt!'; $lang['regmissing'] = 'Sajnáljuk, az összes mezőt ki kell töltened.'; $lang['reguexists'] = 'Sajnáljuk, ilyen azonosítójú felhasználónk már van.'; $lang['regsuccess'] = 'A felhasználói azonosítót létrehoztuk. A jelszót postáztuk.'; $lang['regsuccess2'] = 'A felhasználói azonosítót létrehoztuk.'; -$lang['regmailfail'] = 'Úgy tűnik hiba történt a jelszó postázása során. Kérjük lépj kapcsolatba a Wiki-gazdával!!'; -$lang['regbadmail'] = 'A megadott e-mail cím érvénytelennek tűnik. Ha úgy gondolod ez hiba, lépj kapcsolatba Wiki-gazdával!'; +$lang['regmailfail'] = 'Úgy tűnik hiba történt a jelszó postázása során. Kérjük lépj kapcsolatba az Adminisztrátorokkal!'; +$lang['regbadmail'] = 'A megadott e-mail cím érvénytelennek tűnik. Ha úgy gondolod ez hiba, lépj kapcsolatba az Adminisztrátorokkal!'; $lang['regbadpass'] = 'A két megadott jelszó nem egyezik, próbáld újra!'; $lang['regpwmail'] = 'A DokuWiki jelszavad'; $lang['reghere'] = 'Még nincs azonosítód? Itt kérhetsz'; @@ -77,23 +84,30 @@ $lang['profna'] = 'Ez a wiki nem támogatja a személyes beállí $lang['profnochange'] = 'Nem történt változás.'; $lang['profnoempty'] = 'A név és e-mail mező nem maradhat üresen!'; $lang['profchanged'] = 'A személyes beállítások változtatása megtörtént.'; +$lang['profnodelete'] = 'Ez a wiki nem támogatja a felhasználói fiókok törlését'; +$lang['profdeleteuser'] = 'Felhasználói fiók törlése'; +$lang['profdeleted'] = 'Felhasználói fiókodat eltávolítottuk erről a wiki-ről.'; +$lang['profconfdelete'] = 'Szeretném eltávolítani a felhasználói fiókomat erről a wikiről. <br/> Ez a cselekvés nem visszavonható.'; +$lang['profconfdeletemissing'] = 'A megerősítő négyzet nincs bepipálva'; $lang['pwdforget'] = 'Elfelejtetted a jelszavad? Itt kérhetsz újat'; $lang['resendna'] = 'Ez a wiki nem támogatja a jelszó újraküldést.'; +$lang['resendpwd'] = 'Új jelszó beállítása a következőhöz:'; $lang['resendpwdmissing'] = 'Sajnáljuk, az összes mezőt ki kell töltened.'; $lang['resendpwdnouser'] = 'Sajnáljuk, ilyen azonosítójú felhasználónk nem létezik.'; -$lang['resendpwdbadauth'] = 'Sajnáljuk, ez a megerősítő kód nem helyes. Biztos, hogy a teljes megerősítés linket beírtad pontosan?'; -$lang['resendpwdconfirm'] = 'A megerősítés linket e-mailben elküldtük.'; +$lang['resendpwdbadauth'] = 'Sajnáljuk, ez a megerősítő kód nem helyes. Biztos, hogy a teljes megerősítő linket pontosan beírtad?'; +$lang['resendpwdconfirm'] = 'A megerősítő linket e-mailben elküldtük.'; $lang['resendpwdsuccess'] = 'Az új jelszavadat elküldtük e-mailben.'; $lang['license'] = 'Hacsak máshol nincs egyéb rendelkezés, ezen wiki tartalma a következő licenc alatt érhető el:'; $lang['licenseok'] = 'Megjegyzés: az oldal szerkesztésével elfogadja, hogy a tartalom a következő licenc alatt lesz elérhető:'; $lang['searchmedia'] = 'Keresett fájl neve:'; $lang['searchmedia_in'] = 'Keresés a következőben: %s'; $lang['txt_upload'] = 'Válaszd ki a feltöltendő fájlt'; -$lang['txt_filename'] = 'feltöltési név (elhagyható)'; +$lang['txt_filename'] = 'Feltöltési név (elhagyható)'; $lang['txt_overwrt'] = 'Létező fájl felülírása'; +$lang['maxuploadsize'] = 'Maximum %s méretű fájlokat tölthetsz fel.'; $lang['lockedby'] = 'Jelenleg zárolta:'; $lang['lockexpire'] = 'A zárolás lejár:'; -$lang['js']['willexpire'] = 'Az oldalszerkesztési zárolásod körülbelül egy percen belül lejár.\nAz ütközések elkerülése végett használd az előnézet gombot a zárolási időzítés frissítéséhez.'; +$lang['js']['willexpire'] = 'Az oldalszerkesztési zárolásod körülbelül egy percen belül lejár.\nAz ütközések elkerülése végett használd az előnézet gombot a zárolásod frissítéséhez.'; $lang['js']['notsavedyet'] = 'Elmentetlen változások vannak, amelyek el fognak veszni. Tényleg ezt akarod?'; $lang['js']['searchmedia'] = 'Fájlok keresése'; @@ -103,50 +117,60 @@ $lang['js']['mediatitle'] = 'Link beállítások'; $lang['js']['mediadisplay'] = 'Link típusa'; $lang['js']['mediaalign'] = 'Igazítás'; $lang['js']['mediasize'] = 'Képméret'; -$lang['js']['mediatarget'] = 'Link'; +$lang['js']['mediatarget'] = 'Link célja'; $lang['js']['mediaclose'] = 'Bezárás'; $lang['js']['mediainsert'] = 'Beillesztés'; $lang['js']['mediadisplayimg'] = 'Kép megtekintése.'; $lang['js']['mediadisplaylnk'] = 'Link megtekintése.'; -$lang['js']['mediasmall'] = 'Kisebb méret'; +$lang['js']['mediasmall'] = 'Kis méret'; $lang['js']['mediamedium'] = 'Közepes méret'; -$lang['js']['medialarge'] = 'Nagyobb méret'; -$lang['js']['mediaoriginal'] = 'Eredeti'; +$lang['js']['medialarge'] = 'Nagy méret'; +$lang['js']['mediaoriginal'] = 'Eredeti verzió'; $lang['js']['medialnk'] = 'Link a részletekre'; $lang['js']['mediadirect'] = 'Közvetlen link az eredetire'; -$lang['js']['medianolnk'] = 'Nincsen link'; +$lang['js']['medianolnk'] = 'Nincs link'; $lang['js']['medianolink'] = 'Ne linkelje a képet'; $lang['js']['medialeft'] = 'Kép igazítása balra.'; $lang['js']['mediaright'] = 'Kép igazítása jobbra.'; $lang['js']['mediacenter'] = 'Kép igazítása középre.'; $lang['js']['medianoalign'] = 'Nem legyen igazítás.'; -$lang['js']['nosmblinks'] = 'A Windows megosztott könyvtárak kereszthivatkozása csak Microsoft Internet Explorerben működik közvetlenül. -A hivatkozást másolni és beszúrni ettől fügetlenül mndig tudod.'; +$lang['js']['nosmblinks'] = 'A Windows megosztott könyvtárak kereszthivatkozása csak Microsoft Internet Explorerben működik közvetlenül.\nA hivatkozást másolni és beszúrni ettől függetlenül mindig tudod.'; $lang['js']['linkwiz'] = 'Hivatkozás varázsló'; $lang['js']['linkto'] = 'Hivatkozás erre:'; $lang['js']['del_confirm'] = 'Valóban törölni akarod a kiválasztott elem(ek)et?'; -$lang['rssfailed'] = 'Hiba történt ennek a betöltésekor: '; -$lang['nothingfound'] = 'Semmit sem találtam.'; +$lang['js']['restore_confirm'] = 'Valóban visszaállítod ezt a verziót?'; +$lang['js']['media_diff'] = 'Különbségek megtekintése:'; +$lang['js']['media_diff_both'] = 'Egymás mellett'; +$lang['js']['media_diff_opacity'] = 'Áttetszően'; +$lang['js']['media_diff_portions'] = 'Húzással'; +$lang['js']['media_select'] = 'Fájlok kiválasztása...'; +$lang['js']['media_upload_btn'] = 'Feltöltés'; +$lang['js']['media_done_btn'] = 'Kész'; +$lang['js']['media_drop'] = 'Húzd ide a fájlokat a feltöltéshez'; +$lang['js']['media_cancel'] = 'eltávolítás'; +$lang['js']['media_overwrt'] = 'Meglévő fájlok felülírása'; +$lang['rssfailed'] = 'Hiba történt a hírfolyam betöltésekor: '; +$lang['nothingfound'] = 'Üres mappa.'; $lang['mediaselect'] = 'Médiafájl kiválasztása'; $lang['fileupload'] = 'Médiafájl feltöltése'; -$lang['uploadsucc'] = 'A feltöltés sikerült'; +$lang['uploadsucc'] = 'Sikeres feltöltés'; $lang['uploadfail'] = 'A feltöltés nem sikerült. Talán rosszak a jogosultságok?'; -$lang['uploadwrong'] = 'A feltöltés megtagadva. Ez a fájl kiterjesztés tiltott.'; +$lang['uploadwrong'] = 'A feltöltés megtagadva. Ez a fájlkiterjesztés tiltott.'; $lang['uploadexist'] = 'A fájl már létezik, nem történt semmi.'; -$lang['uploadbadcontent'] = 'A feltöltött tartalom nem egyezik a %s fájl kiterjesztéssel.'; +$lang['uploadbadcontent'] = 'A feltöltött tartalom nem egyezik a %s fájlkiterjesztéssel.'; $lang['uploadspam'] = 'A feltöltést visszautasítottuk spam-gyanú miatt.'; $lang['uploadxss'] = 'A feltöltést visszautasítottuk, mert lehetséges, hogy kártékony kódot tartalmaz.'; $lang['uploadsize'] = 'A feltöltött fájl túl nagy. (max. %s)'; $lang['deletesucc'] = 'A "%s" fájlt töröltük.'; -$lang['deletefail'] = 'A "%s" fájl nem törölhető. - Ellenőrizd a jogosultságokat!'; -$lang['mediainuse'] = 'A "%s" fájl nem törlődött - még használat alatt van.'; -$lang['namespaces'] = 'Névtér'; +$lang['deletefail'] = 'A "%s" fájl nem törölhető - ellenőrizd a jogosultságokat!'; +$lang['mediainuse'] = 'A "%s" fájl nem törlődött - még használat alatt van!'; +$lang['namespaces'] = 'Névterek'; $lang['mediafiles'] = 'Elérhető fájlok itt:'; -$lang['accessdenied'] = 'Nincsen jogod az oldal megtekintésére.'; -$lang['mediausage'] = 'A következő formában hivatkozhatsz erre az állományra:'; -$lang['mediaview'] = 'Eredeti állomány megtekintése'; +$lang['accessdenied'] = 'Nincs jogod az oldal megtekintésére.'; +$lang['mediausage'] = 'A következő formában hivatkozhatsz erre a fájlra:'; +$lang['mediaview'] = 'Eredeti fájl megtekintése'; $lang['mediaroot'] = 'kiindulási hely'; -$lang['mediaupload'] = 'Itt tölthetsz fel állományt az aktuális névtérbe. Al-névtér létrehozásához a "Feltöltési név" mezőben kell kettősponttal elválasztva megadnod azt.'; +$lang['mediaupload'] = 'Itt tölthetsz fel állományt az aktuális névtérbe. Alnévtér létrehozásához a "Feltöltési név" mezőben kell kettősponttal elválasztva megadnod azt.'; $lang['mediaextchange'] = 'Az állomány kiterjesztése erről: .%s erre: .%s változott!'; $lang['reference'] = 'Hivatkozások'; $lang['ref_inuse'] = 'A fájl nem törölhető, mert a következő oldalakon használják:'; @@ -155,34 +179,44 @@ $lang['hits'] = 'Találatok'; $lang['quickhits'] = 'Illeszkedő oldalnevek'; $lang['toc'] = 'Tartalomjegyzék'; $lang['current'] = 'aktuális'; -$lang['yours'] = 'A te változatod'; -$lang['diff'] = 'a különbségeket mutatja az aktuális változathoz képest'; -$lang['diff2'] = 'a különbségeket mutatja a kiválasztott változatok között'; +$lang['yours'] = 'A Te változatod'; +$lang['diff'] = 'Különbségek az aktuális változathoz képest'; +$lang['diff2'] = 'Különbségek a kiválasztott változatok között'; $lang['difflink'] = 'Összehasonlító nézet linkje'; $lang['diff_type'] = 'Összehasonlítás módja:'; $lang['diff_inline'] = 'Sorok között'; -$lang['diff_side'] = 'Kétoldalas'; -$lang['line'] = 'sorszám'; +$lang['diff_side'] = 'Egymás mellett'; +$lang['line'] = 'Sor'; $lang['breadcrumb'] = 'Nyomvonal'; $lang['youarehere'] = 'Itt vagy'; $lang['lastmod'] = 'Utolsó módosítás'; $lang['by'] = 'szerkesztette:'; $lang['deleted'] = 'eltávolítva'; $lang['created'] = 'létrehozva'; -$lang['restored'] = 'az előző változat helyreállítva (%s)'; +$lang['restored'] = 'régebbi változat helyreállítva (%s)'; $lang['external_edit'] = 'külső szerkesztés'; $lang['summary'] = 'A változások összefoglalása'; $lang['noflash'] = 'Ennek a tartalomnak a megtekintéséhez <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Plugin</a> szükséges.'; $lang['download'] = 'Kódrészlet letöltése'; +$lang['tools'] = 'Eszközök'; +$lang['user_tools'] = 'Felhasználói eszközök'; +$lang['site_tools'] = 'Eszközök a webhelyen'; +$lang['page_tools'] = 'Eszközök az oldalon'; +$lang['skip_to_content'] = 'ugrás a tartalomhoz'; +$lang['sidebar'] = 'Oldalsáv'; $lang['mail_newpage'] = 'új oldal jött létre:'; $lang['mail_changed'] = 'oldal megváltozott:'; $lang['mail_subscribe_list'] = 'oldalak megváltoztak ebben a névtérben:'; -$lang['mail_new_user'] = 'Új felhasználó:'; -$lang['mail_upload'] = 'állományt töltöttek fel:'; +$lang['mail_new_user'] = 'új felhasználó:'; +$lang['mail_upload'] = 'új állományt töltöttek fel:'; +$lang['changes_type'] = 'A következő változásainak megtekintése:'; +$lang['pages_changes'] = 'Oldalak'; +$lang['media_changes'] = 'Médiafájlok'; +$lang['both_changes'] = 'Oldalak és médiafájlok'; $lang['qb_bold'] = 'Félkövér szöveg'; $lang['qb_italic'] = 'Dőlt szöveg'; $lang['qb_underl'] = 'Aláhúzott szöveg'; -$lang['qb_code'] = 'Forráskód szöveg'; +$lang['qb_code'] = 'Forráskód'; $lang['qb_strike'] = 'Áthúzott szöveg'; $lang['qb_h1'] = '1. szintű címsor'; $lang['qb_h2'] = '2. szintű címsor'; @@ -198,16 +232,16 @@ $lang['qb_link'] = 'Belső hivatkozás'; $lang['qb_extlink'] = 'Külső hivatkozás'; $lang['qb_hr'] = 'Vízszintes elválasztó vonal'; $lang['qb_ol'] = 'Sorszámozott lista elem'; -$lang['qb_ul'] = 'Felsorolás lista elem'; +$lang['qb_ul'] = 'Felsorolásos lista elem'; $lang['qb_media'] = 'Képek és más fájlok hozzáadása'; $lang['qb_sig'] = 'Aláírás beszúrása'; -$lang['qb_smileys'] = 'Szmájlik'; +$lang['qb_smileys'] = 'Smiley-k'; $lang['qb_chars'] = 'Speciális karakterek'; -$lang['upperns'] = 'Ugrás a szülő névtérhez'; +$lang['upperns'] = 'ugrás a tartalmazó névtérhez'; $lang['admin_register'] = 'Új felhasználó'; -$lang['metaedit'] = 'Meta-adatok szerkesztése'; -$lang['metasaveerr'] = 'A meta-adatok írása meghiúsult '; -$lang['metasaveok'] = 'Meta-adatok elmentve'; +$lang['metaedit'] = 'Metaadatok szerkesztése'; +$lang['metasaveerr'] = 'A metaadatok írása nem sikerült'; +$lang['metasaveok'] = 'Metaadatok elmentve'; $lang['img_backto'] = 'Vissza'; $lang['img_title'] = 'Cím'; $lang['img_caption'] = 'Képaláírás'; @@ -215,17 +249,20 @@ $lang['img_date'] = 'Dátum'; $lang['img_fname'] = 'Fájlnév'; $lang['img_fsize'] = 'Méret'; $lang['img_artist'] = 'Készítette'; -$lang['img_copyr'] = 'Copyright'; +$lang['img_copyr'] = 'Szerzői jogok'; $lang['img_format'] = 'Formátum'; -$lang['img_camera'] = 'Fényképező típusa'; +$lang['img_camera'] = 'Fényképezőgép típusa'; $lang['img_keywords'] = 'Kulcsszavak'; +$lang['img_width'] = 'Szélesség'; +$lang['img_height'] = 'Magasság'; +$lang['img_manager'] = 'Megtekintés a médiakezelőben'; $lang['subscr_subscribe_success'] = '%s hozzáadva az értesítési listához: %s'; $lang['subscr_subscribe_error'] = 'Hiba történt %s hozzáadásakor az értesítési listához: %s'; -$lang['subscr_subscribe_noaddress'] = 'Nincsen e-mail cím megadva az adataidnál, így a rendszer nem tudott hozzáadni az értesítési listához'; +$lang['subscr_subscribe_noaddress'] = 'Nincs e-mail cím megadva az adataidnál, így a rendszer nem tudott hozzáadni az értesítési listához'; $lang['subscr_unsubscribe_success'] = '%s eltávolítva az értesítési listából: %s'; $lang['subscr_unsubscribe_error'] = 'Hiba történt %s eltávolításakor az értesítési listából: %s'; $lang['subscr_already_subscribed'] = '%s már feliratkozott erre: %s'; -$lang['subscr_not_subscribed'] = '%s nincsen feliratkozva erre: %s'; +$lang['subscr_not_subscribed'] = '%s nincs feliratkozva erre: %s'; $lang['subscr_m_not_subscribed'] = 'Jelenleg nem vagy feliratkozva erre az oldalra vagy névtérre'; $lang['subscr_m_new_header'] = 'Feliratkozás hozzáadása'; $lang['subscr_m_current_header'] = 'Feliratkozások'; @@ -235,13 +272,13 @@ $lang['subscr_m_receive'] = 'Küldj'; $lang['subscr_style_every'] = 'e-mailt minden változásról'; $lang['subscr_style_digest'] = 'összefoglaló e-mailt oldalanként (minden %.2f nap)'; $lang['subscr_style_list'] = 'egy listát a módosított oldalakról a legutóbbi e-mail óta (minden %.2f nap)'; -$lang['authmodfailed'] = 'Hibás felhasználó-aznosítási módszer van beállítva. Légy szíves értesítsd a Wiki-gazdát!'; -$lang['authtempfail'] = 'A felhasználó azonosítás átmenetileg nem működik. Ha sokáig így lenne, légy szíves értesítsd a Wiki-gazdát!'; +$lang['authtempfail'] = 'A felhasználó azonosítás átmenetileg nem működik. Ha sokáig így lenne, légy szíves értesítsd az Adminisztrátorokat!'; +$lang['authpwdexpire'] = 'A jelszavad %d nap múlva lejár, hamarosan meg kell változtatnod.'; $lang['i_chooselang'] = 'Válassz nyelvet'; $lang['i_installer'] = 'DokuWiki Beállító Varázsló'; $lang['i_wikiname'] = 'A Wiki neve'; $lang['i_enableacl'] = 'Hozzáférési listák engedélyezése (ajánlott)'; -$lang['i_superuser'] = 'Wiki-gazda'; +$lang['i_superuser'] = 'Adminisztrátor'; $lang['i_problems'] = 'A Beállító Varázsló a következő problémák miatt megakadt. Nem tudjuk folytatni, amíg ezek nincsenek elhárítva!'; $lang['i_modified'] = 'Biztonsági okokból ez a Varázsló csak új és módosítatlan DokuWiki változaton működik. Csomagold ki újra a fájlokat a letöltött csomagból, vagy nézd meg a teljes <a href="http://dokuwiki.org/install">Dokuwiki telepítési útmutatót</a>.'; @@ -254,12 +291,15 @@ $lang['i_badhash'] = 'A dokuwiki.php nem felismerhető vagy módosí $lang['i_badval'] = '<code>%s</code> - nem helyes vagy üres érték'; $lang['i_success'] = 'A beállítás sikeresen befejeződött. Most már letörölhető az install.php fájl. Látogasd meg az <a href="doku.php?id=wiki:welcome">új DokuWikidet</a>!'; $lang['i_failure'] = 'Hiba lépett fel a konfigurációs állományok írásakor. Ki kell javítanod kézzel, mielőtt használni kezded az <a href="doku.php?id=wiki:welcome">új DokuWikidet</a>.'; -$lang['i_policy'] = 'Kezdeti hozzáférési politika'; -$lang['i_pol0'] = 'Nyitott Wiki (mindenki olvashatja, írhatja, és fájlokat tölthet fel)'; -$lang['i_pol1'] = 'Publikus Wiki (mindenki olvashatja, de csak regisztrált felhasználók írhatják, és tölthetnek fel fájlokat)'; -$lang['i_pol2'] = 'Zárt Wiki (csak regisztrált felhasználók olvashatják, írhatják és tölthetnek fel fájlokat)'; +$lang['i_policy'] = 'Kezdeti hozzáférési lista házirend'; +$lang['i_pol0'] = 'Nyitott wiki (mindenki olvashatja, írhatja és fájlokat tölthet fel)'; +$lang['i_pol1'] = 'Publikus wiki (mindenki olvashatja, de csak regisztrált felhasználók írhatják és tölthetnek fel fájlokat)'; +$lang['i_pol2'] = 'Zárt wiki (csak regisztrált felhasználók olvashatják, írhatják és tölthetnek fel fájlokat)'; $lang['i_retry'] = 'Újra'; -$lang['i_license'] = 'Kérlek válassz licenszt a feltöltött tartalomhoz:'; +$lang['i_license'] = 'Kérlek, válassz licencet a feltöltött tartalomhoz:'; +$lang['i_license_none'] = 'Ne jelenítsen meg licenc információt'; +$lang['i_pop_field'] = 'Kérjük, segíts a DokuWiki továbbfejlesztésében:'; +$lang['i_pop_label'] = 'Havonta egyszer névtelen üzenet küldése a DokuWiki fejlesztőinek'; $lang['recent_global'] = 'Jelenleg csak a <b>%s</b> névtér friss változásai látszanak. Megtekinthetők <a href="%s">a teljes wiki friss változásai</a> is.'; $lang['years'] = '%d évvel ezelőtt'; $lang['months'] = '%d hónappal ezelőtt'; @@ -268,4 +308,27 @@ $lang['days'] = '%d nappal ezelőtt'; $lang['hours'] = '%d órával ezelőtt'; $lang['minutes'] = '%d perccel ezelőtt'; $lang['seconds'] = '%d másodperccel ezelőtt'; -$lang['wordblock'] = 'A változásokat nem sikerült menteni, mert tiltott tartalom van benne (spam)'; +$lang['wordblock'] = 'A változásokat nem sikerült menteni, mert tiltott tartalom van benne (spam).'; +$lang['media_uploadtab'] = 'Feltöltés'; +$lang['media_searchtab'] = 'Keresés'; +$lang['media_file'] = 'Fájl'; +$lang['media_viewtab'] = 'Megtekintés'; +$lang['media_edittab'] = 'Szerkesztés'; +$lang['media_historytab'] = 'Korábbi változatok'; +$lang['media_list_thumbs'] = 'Bélyegképek'; +$lang['media_list_rows'] = 'Sorok'; +$lang['media_sort_name'] = 'Név'; +$lang['media_sort_date'] = 'Dátum'; +$lang['media_namespaces'] = 'Névtér kiválasztása'; +$lang['media_files'] = 'Fájlok itt: %s'; +$lang['media_upload'] = 'Feltöltés ide: %s'; +$lang['media_search'] = 'Keresés itt: %s'; +$lang['media_view'] = '%s'; +$lang['media_viewold'] = '%s itt: %s'; +$lang['media_edit'] = '%s szerkesztése'; +$lang['media_history'] = '%s korábbi változatai'; +$lang['media_meta_edited'] = 'metaadatot szerkesztve'; +$lang['media_perm_read'] = 'Sajnáljuk, nincs jogod a fájlok olvasásához.'; +$lang['media_perm_upload'] = 'Sajnáljuk, nincs jogod a feltöltéshez.'; +$lang['media_update'] = 'Új verzió feltöltése'; +$lang['media_restore'] = 'Ezen verzió visszaállítása'; diff --git a/inc/lang/hu/locked.txt b/inc/lang/hu/locked.txt index 229141674..004c46191 100644 --- a/inc/lang/hu/locked.txt +++ b/inc/lang/hu/locked.txt @@ -1,4 +1,4 @@ ====== Az oldal zárolva ====== -Ezt az oldalt épp szerkeszti egy másik felhasználó. Várnod kell, amíg a másik felhasználó befejezi, vagy amíg a zárolási időzítő le nem jár. +Ezt az oldalt épp szerkeszti egy másik felhasználó. Várnod kell, amíg a másik felhasználó befejezi, vagy amíg a zárolási ideje le nem jár. diff --git a/inc/lang/hu/mailwrap.html b/inc/lang/hu/mailwrap.html new file mode 100644 index 000000000..50fc497fd --- /dev/null +++ b/inc/lang/hu/mailwrap.html @@ -0,0 +1,13 @@ +<html> +<head> +<title>@TITLE@</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +</head> +<body> + +@HTMLBODY@ + +<br /><hr /> +<small>Ezt a levelet a @DOKUWIKIURL@ DokuWiki generálta.</small> +</body> +</html>
\ No newline at end of file diff --git a/inc/lang/hu/norev.txt b/inc/lang/hu/norev.txt index 4dd408459..1f4e6725b 100644 --- a/inc/lang/hu/norev.txt +++ b/inc/lang/hu/norev.txt @@ -1,5 +1,5 @@ ====== Nincs ilyen változat ====== -A megadott változat nem létezik. Használd az ''Előző változatok'' nyomógombot az előzmények listájának megtekintéséhez. +A megadott változat nem létezik. Használd az ''Előző változatok'' gombot az előzmények listájának megtekintéséhez. diff --git a/inc/lang/hu/preview.txt b/inc/lang/hu/preview.txt index ad7f7d4b0..e04b2c838 100644 --- a/inc/lang/hu/preview.txt +++ b/inc/lang/hu/preview.txt @@ -1,4 +1,3 @@ ====== Előnézet ====== -Ez a szöveged előnézete, így fog kinézni. Figyelj jól: ez **még nincs elmentve**! - +Ez a szöveged előnézete, így fog kinézni élesben. Viszont ez **még nincs elmentve**! diff --git a/inc/lang/hu/pwconfirm.txt b/inc/lang/hu/pwconfirm.txt index 617419ee8..da677d151 100644 --- a/inc/lang/hu/pwconfirm.txt +++ b/inc/lang/hu/pwconfirm.txt @@ -5,8 +5,8 @@ címen lévő @TITLE@ wiki felhasználódhoz. Ha nem kértél ilyet, hagyd figyelmen kívül ezt a levelet. -Ha Te voltál, az új jelszó kérelmed megerősítéséhez a -következő linkre kattints, vagy másold a böngésződbe: +Ha Te voltál, az új jelszó kérelmed megerősítéséhez kattints a +következő linkre vagy másold a böngésződbe: @CONFIRM@ diff --git a/inc/lang/hu/read.txt b/inc/lang/hu/read.txt index 89ac96338..223a6fe1c 100644 --- a/inc/lang/hu/read.txt +++ b/inc/lang/hu/read.txt @@ -1,2 +1 @@ -Ez az oldal csak olvasható. Megtekintheted a forrását, de nem változtathatod meg. Ha úgy gondolod, hogy ez helytelen, kérdezd a Wiki-gazdát. - +Ez az oldal csak olvasható. Megtekintheted a forrását, de nem változtathatod meg. Ha úgy gondolod, hogy ez helytelen, kérdezd az Adminisztrátorokat! diff --git a/inc/lang/hu/register.txt b/inc/lang/hu/register.txt index 2745c4d77..523b720e7 100644 --- a/inc/lang/hu/register.txt +++ b/inc/lang/hu/register.txt @@ -1,4 +1,4 @@ ====== Új felhasználó regisztrálása ====== -Töltsd ki az összes alábbi adatot az új Wiki felhasználói azonosítód létrehozásához. Győződj meg róla, hogy **érvényes e-mail címet** adtál meg -- az új jelszavad erre a címre küldjük el. Az azonosítód érvényes [[doku>pagename|oldalnév]] kell legyen. +Töltsd ki az összes alábbi adatot az új Wiki felhasználói azonosítód létrehozásához. Győződj meg róla, hogy **érvényes e-mail címet** adtál meg, mivel az új jelszavad erre a címre küldjük el. Az azonosítód érvényes [[doku>pagename|oldalnév]] kell legyen. diff --git a/inc/lang/hu/resendpwd.txt b/inc/lang/hu/resendpwd.txt index 24931a7ed..b73fa42b2 100644 --- a/inc/lang/hu/resendpwd.txt +++ b/inc/lang/hu/resendpwd.txt @@ -1,3 +1,3 @@ ===== Új jelszó kérése ===== -Kérlek add meg a felhasználó neved az új jelszó elküldéséhez. A jelszó cseréjéhez szükséges megerősítő linket a regisztrált e-mail címedre küldjük.
\ No newline at end of file +Kérlek, add meg a felhasználói azonosítód az új jelszó elküldéséhez. A jelszó cseréjéhez szükséges megerősítő linket elküldjük a regisztrált e-mail címedre.
\ No newline at end of file diff --git a/inc/lang/hu/resetpwd.txt b/inc/lang/hu/resetpwd.txt new file mode 100644 index 000000000..53b28d75c --- /dev/null +++ b/inc/lang/hu/resetpwd.txt @@ -0,0 +1,3 @@ +====== Új jelszó beállítása ====== + +Kérlek, add meg az új jelszót a felhasználódhoz.
\ No newline at end of file diff --git a/inc/lang/hu/searchpage.txt b/inc/lang/hu/searchpage.txt index b1defed84..ffde87b66 100644 --- a/inc/lang/hu/searchpage.txt +++ b/inc/lang/hu/searchpage.txt @@ -1,5 +1,5 @@ ====== Keresés ====== -A keresés eredményét lentebb láthatod. Ha nem találtad meg amit kerestél, akkor létrehozhatsz egy új oldalt a keresésed alapján ''Az oldal szerkesztése'' gombbal. +A keresés eredményét lentebb láthatod. Ha nem találtad meg amit kerestél, akkor létrehozhatsz egy új oldalt a keresésed alapján ''Az oldal szerkesztése'' gombbal. ===== Eredmény(ek) =====
\ No newline at end of file diff --git a/inc/lang/hu/subscr_digest.txt b/inc/lang/hu/subscr_digest.txt index 62e777faf..b00e0bba7 100644 --- a/inc/lang/hu/subscr_digest.txt +++ b/inc/lang/hu/subscr_digest.txt @@ -13,5 +13,4 @@ Régi verzió: @OLDPAGE@ Ha nem szeretnél értesítéseket kapni, jelentkezz be a wiki-be itt: @DOKUWIKIURL@, majd ezen az oldalon tudsz leiratkozni: @SUBSCRIBE@. -- -Ezt a levelet a DokuWiki generálta -@DOKUWIKIURL@
\ No newline at end of file +Ezt a levelet a @DOKUWIKIURL@ DokuWiki generálta.
\ No newline at end of file diff --git a/inc/lang/hu/subscr_list.txt b/inc/lang/hu/subscr_list.txt index f68e6fc0a..13295ff41 100644 --- a/inc/lang/hu/subscr_list.txt +++ b/inc/lang/hu/subscr_list.txt @@ -1,7 +1,7 @@ Szia, A @PAGE@ névtérhez tartozó oldalak megváltoztak a @TITLE wikiben. -Itt vannak a módosított oldalak: +A módosított oldalak a következők: -------------------------------------------------------- @DIFF@ @@ -10,5 +10,4 @@ Itt vannak a módosított oldalak: Ha nem szeretnél értesítéseket kapni, jelentkezz be a wiki-be itt: @DOKUWIKIURL@, majd ezen az oldalon tudsz leiratkozni: @SUBSCRIBE@. -- -Ezt a levelet a DokuWiki generálta -@DOKUWIKIURL@
\ No newline at end of file +Ezt a levelet a @DOKUWIKIURL@ DokuWiki generálta.
\ No newline at end of file diff --git a/inc/lang/hu/subscr_single.txt b/inc/lang/hu/subscr_single.txt index a17a98cfd..e28226de5 100644 --- a/inc/lang/hu/subscr_single.txt +++ b/inc/lang/hu/subscr_single.txt @@ -1,7 +1,7 @@ Szia, A @PAGE@ oldal a @TITLE wikiben megváltozott. -Itt vannak az eltérések: +Az eltérések a következők: -------------------------------------------------------- @DIFF@ diff --git a/inc/lang/ia/lang.php b/inc/lang/ia/lang.php index e8a11479c..144dfe33b 100644 --- a/inc/lang/ia/lang.php +++ b/inc/lang/ia/lang.php @@ -227,7 +227,6 @@ $lang['subscr_m_unsubscribe'] = 'Cancellar subscription'; $lang['subscr_m_subscribe'] = 'Subscriber'; $lang['subscr_m_receive'] = 'Reciper'; $lang['subscr_style_every'] = 'un message pro cata modification'; -$lang['authmodfailed'] = 'Configuration incorrecte de authentication de usator. Per favor informa le administrator de tu wiki.'; $lang['authtempfail'] = 'Le authentication de usator temporarimente non es disponibile. Si iste situation persiste, per favor informa le administrator de tu wiki.'; $lang['i_chooselang'] = 'Selige tu lingua'; $lang['i_installer'] = 'Installator de DokuWiki'; diff --git a/inc/lang/id/lang.php b/inc/lang/id/lang.php index 6c6d1c70f..1c8610923 100644 --- a/inc/lang/id/lang.php +++ b/inc/lang/id/lang.php @@ -39,7 +39,6 @@ $lang['btn_back'] = 'Kembali'; $lang['btn_backlink'] = 'Backlinks'; $lang['btn_backtomedia'] = 'Kembali ke Pilihan Mediafile'; $lang['btn_subscribe'] = 'Ikuti Perubahan'; -$lang['btn_unsubscribe'] = 'Berhenti Ikuti Perubahan'; $lang['btn_profile'] = 'Ubah Profil'; $lang['btn_reset'] = 'Reset'; $lang['btn_draft'] = 'Edit draft'; @@ -168,12 +167,6 @@ $lang['img_copyr'] = 'Hakcipta'; $lang['img_format'] = 'Format'; $lang['img_camera'] = 'Kamera'; $lang['img_keywords'] = 'Katakunci'; -$lang['subscribe_success'] = 'Penambahan %s ke data subsripsi untuk %s'; -$lang['subscribe_error'] = 'Gagal menambahkan %s ke data subsripsi untuk %s'; -$lang['subscribe_noaddress'] = 'Tidak ditemukan alamat yang berhubungan dengan login Anda, Anda tidak dapat menambahkan daftar subscription'; -$lang['unsubscribe_success'] = 'Menghapus %s dari daftar subscription untuk %s'; -$lang['unsubscribe_error'] = 'Gagal menghapus %s dari daftar subscription untuk %s'; -$lang['authmodfailed'] = 'Konfigurasi autentikasi user tidak valid. Harap informasikan admin Wiki Anda.'; $lang['authtempfail'] = 'Autentikasi user saat ini sedang tidak dapat digunakan. Jika kejadian ini berlanjut, Harap informasikan admin Wiki Anda.'; $lang['i_chooselang'] = 'Pilih bahasa'; $lang['i_installer'] = 'Instalasi DokuWiki'; diff --git a/inc/lang/is/lang.php b/inc/lang/is/lang.php index 78ae7e249..fbc7e9049 100644 --- a/inc/lang/is/lang.php +++ b/inc/lang/is/lang.php @@ -44,7 +44,6 @@ $lang['btn_back'] = 'Til baka'; $lang['btn_backlink'] = 'Hvað tengist hingað'; $lang['btn_backtomedia'] = 'Aftur til miðlaskrá'; $lang['btn_subscribe'] = 'Vakta'; -$lang['btn_unsubscribe'] = 'Afvakta'; $lang['btn_profile'] = 'Uppfæra notanda'; $lang['btn_reset'] = 'Endurstilla'; $lang['btn_draft'] = 'Breyta uppkasti'; diff --git a/inc/lang/it/lang.php b/inc/lang/it/lang.php index 92bf5fea8..5300dfd2a 100644 --- a/inc/lang/it/lang.php +++ b/inc/lang/it/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Italian language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Giorgio Vecchiocattivi <giorgio@vecchio.it> * @author Roberto Bolli [http://www.rbnet.it/] * @author Silvia Sargentoni <polinnia@tin.it> @@ -15,6 +15,7 @@ * @author Jacopo Corbetta <jacopo.corbetta@gmail.com> * @author Matteo Pasotti <matteo@xquiet.eu> * @author snarchio@gmail.com + * @author Edmondo Di Tucci <snarchio@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -58,6 +59,7 @@ $lang['btn_revert'] = 'Ripristina'; $lang['btn_register'] = 'Registrazione'; $lang['btn_apply'] = 'Applica'; $lang['btn_media'] = 'Gestore Media'; +$lang['btn_deleteuser'] = 'Rimuovi il mio account'; $lang['loggedinas'] = 'Collegato come'; $lang['user'] = 'Nome utente'; $lang['pass'] = 'Password'; @@ -69,6 +71,7 @@ $lang['fullname'] = 'Nome completo'; $lang['email'] = 'Email'; $lang['profile'] = 'Profilo utente'; $lang['badlogin'] = 'Il nome utente o la password non sono validi.'; +$lang['badpassconfirm'] = 'La password è errata'; $lang['minoredit'] = 'Modifiche minori'; $lang['draftdate'] = 'Bozza salvata in automatico il'; $lang['nosecedit'] = 'La pagina è stata modificata nel frattempo; è impossibile modificare solo la sezione scelta, quindi è stata caricata la pagina intera.'; @@ -85,6 +88,11 @@ $lang['profna'] = 'Questo wiki non supporta modifiche al profilo' $lang['profnochange'] = 'Nessuna modifica, niente da aggiornare.'; $lang['profnoempty'] = 'Nome o indirizzo email vuoti non sono consentiti.'; $lang['profchanged'] = 'Aggiornamento del profilo utente riuscito.'; +$lang['profnodelete'] = 'Questa wiki non supporta la cancellazione degli utenti'; +$lang['profdeleteuser'] = 'Elimina account'; +$lang['profdeleted'] = 'Il tuo account utente è stato rimosso da questa wiki'; +$lang['profconfdelete'] = 'Voglio rimuovere il mio account da questa wiki. <br/> Questa operazione non può essere annullata.'; +$lang['profconfdeletemissing'] = 'La check box di conferma non è selezionata'; $lang['pwdforget'] = 'Hai dimenticato la password? Richiedine una nuova'; $lang['resendna'] = 'Questo wiki non supporta l\'invio di nuove password.'; $lang['resendpwd'] = 'Imposta nuova password per'; @@ -266,7 +274,6 @@ $lang['subscr_m_receive'] = 'Ricevi'; $lang['subscr_style_every'] = 'email per ogni modifica'; $lang['subscr_style_digest'] = 'email di riassunto dei cambiamenti per ogni pagina (ogni %.2f giorni)'; $lang['subscr_style_list'] = 'lista delle pagine cambiate dall\'ultima email (ogni %.2f giorni)'; -$lang['authmodfailed'] = 'La configurazione dell\'autenticazione non è corretta. Informa l\'amministratore di questo wiki.'; $lang['authtempfail'] = 'L\'autenticazione è temporaneamente non disponibile. Se questa situazione persiste, informa l\'amministratore di questo wiki.'; $lang['authpwdexpire'] = 'La tua password scadrà in %d giorni, dovresti cambiarla quanto prima.'; $lang['i_chooselang'] = 'Scegli la lingua'; diff --git a/inc/lang/ja/lang.php b/inc/lang/ja/lang.php index 34ff5b21d..b032e1ce5 100644 --- a/inc/lang/ja/lang.php +++ b/inc/lang/ja/lang.php @@ -1,14 +1,16 @@ <?php + /** - * japanese language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Yuji Takenaka <webmaster@davilin.com> * @author Ikuo Obataya <i.obataya@gmail.com> * @author Daniel Dupriest <kououken@gmail.com> * @author Kazutaka Miyasaka <kazmiya@gmail.com> * @author Taisuke Shimamoto <dentostar@gmail.com> * @author Satoshi Sahara <sahara.satoshi@gmail.com> + * @author Hideaki SAWADA <chuno@live.jp> + * @author Hideaki SAWADA <sawadakun@live.jp> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -52,6 +54,7 @@ $lang['btn_revert'] = '元に戻す'; $lang['btn_register'] = 'ユーザー登録'; $lang['btn_apply'] = '適用'; $lang['btn_media'] = 'メディアマネージャー'; +$lang['btn_deleteuser'] = '自分のアカウントの抹消'; $lang['loggedinas'] = 'ようこそ'; $lang['user'] = 'ユーザー名'; $lang['pass'] = 'パスワード'; @@ -63,6 +66,7 @@ $lang['fullname'] = 'フルネーム'; $lang['email'] = 'メールアドレス'; $lang['profile'] = 'ユーザー情報'; $lang['badlogin'] = 'ユーザー名かパスワードが違います。'; +$lang['badpassconfirm'] = 'パスワードが間違っています。'; $lang['minoredit'] = '小変更'; $lang['draftdate'] = 'ドラフト保存日時:'; $lang['nosecedit'] = 'ページ内容が変更されていますがセクション情報が古いため、代わりにページ全体をロードしました。'; @@ -79,6 +83,11 @@ $lang['profna'] = 'ユーザー情報の変更は出来ません' $lang['profnochange'] = '変更点はありませんでした。'; $lang['profnoempty'] = 'ユーザー名とメールアドレスを入力して下さい。'; $lang['profchanged'] = 'ユーザー情報は更新されました。'; +$lang['profnodelete'] = 'この wiki はユーザーを削除できない。'; +$lang['profdeleteuser'] = 'アカウントの削除'; +$lang['profdeleted'] = 'このwikiからあなたのユーザーアカウントは削除済です。'; +$lang['profconfdelete'] = 'このwikiから自分のアカウント抹消を希望します。<br/> この操作は取消すことができません。'; +$lang['profconfdeletemissing'] = '確認のチェックボックスがチェックされていません。'; $lang['pwdforget'] = 'パスワードをお忘れですか?パスワード再発行'; $lang['resendna'] = 'パスワードの再発行は出来ません。'; $lang['resendpwd'] = '新しいパスワードをセット'; @@ -261,7 +270,6 @@ $lang['subscr_m_receive'] = '受信'; $lang['subscr_style_every'] = '全ての変更にメールを送信'; $lang['subscr_style_digest'] = 'それぞれのページへの変更の要約をメールする(%.2f 日毎)'; $lang['subscr_style_list'] = '前回のメールから変更されたページをリスト(%.2f 日毎)'; -$lang['authmodfailed'] = 'ユーザー認証の設定が正しくありません。Wikiの管理者に連絡して下さい。'; $lang['authtempfail'] = 'ユーザー認証が一時的に使用できなくなっています。この状態が続いているようであれば、Wikiの管理者に連絡して下さい。'; $lang['authpwdexpire'] = 'あなたのパスワードは、あと%d日で有効期限が切れます。パスワードを変更してください。'; $lang['i_chooselang'] = '使用言語を選択してください'; @@ -288,6 +296,9 @@ $lang['i_pol1'] = 'パブリック Wiki(閲覧は全ての人 $lang['i_pol2'] = 'クローズド Wiki (登録ユーザーにのみ使用を許可)'; $lang['i_retry'] = '再試行'; $lang['i_license'] = 'あなたが作成したコンテンツが属するライセンスを選択してください:'; +$lang['i_license_none'] = 'ライセンス情報を表示しません。'; +$lang['i_pop_field'] = 'Dokuwiki の内容の向上に協力して下さい:'; +$lang['i_pop_label'] = '月に一回、DokuWikiの開発者に匿名の使用データを送信します。'; $lang['recent_global'] = '現在、<b>%s</b> 名前空間内の変更点を閲覧中です。<a href="%s">Wiki全体の最近の変更点の確認</a>もできます。'; $lang['years'] = '%d年前'; $lang['months'] = '%dカ月前'; diff --git a/inc/lang/km/lang.php b/inc/lang/km/lang.php index c056e3acc..4800b6c23 100644 --- a/inc/lang/km/lang.php +++ b/inc/lang/km/lang.php @@ -36,7 +36,6 @@ $lang['btn_back'] = 'ត្រឡប់'; $lang['btn_backlink'] = 'ខ្សែចំណងក្រោយ'; $lang['btn_backtomedia'] = 'ទៅប្រព័នឯកសាវិញ'; $lang['btn_subscribe'] = 'ដាក់ដំណឹងផ្លស់ប្តូរ'; -$lang['btn_unsubscribe'] = 'ដកដំណឹងផ្លស់ប្តូរ'; $lang['btn_profile'] = 'កែប្រវត្តិរូប'; $lang['btn_reset'] = 'កមណត់ឡើងរិញ'; $lang['btn_draft'] = 'កែគំរោង'; @@ -140,8 +139,6 @@ $lang['mail_changed'] = 'ទំព័រប្រែប្រួល'; $lang['mail_new_user'] = 'អ្នកប្រើថ្មី'; $lang['mail_upload'] = 'រុញអក្សាលើង'; -$lang['nosmblinks'] = 'ខ្សែបន្តទៅ «Windows share» ប្រើបានក្នុង «Microsoft IE»។ អ្នកអាច កាត់ឬបិត ខ្សែនេះ។'; - $lang['qb_bold'] = 'ឃ្វាមក្រស'; $lang['qb_italic'] = 'ឃ្វាមជ្រៀង'; $lang['qb_underl'] = 'ឃ្វាម'; @@ -165,13 +162,6 @@ $lang['qb_chars'] = 'អក្ខរៈពិសេស'; $lang['js']['del_confirm']= 'លុប'; $lang['admin_register']= 'តែមអ្នកប្រើ';//'Add new user'; -$lang['spell_start'] = 'ពិនិត្យអក្ខរាវិរុទ្ធ';//'Check Spelling'; -$lang['spell_stop'] = 'បណ្តកំរែ'; -$lang['spell_wait'] = 'សូមចាំ';//'Please wait...'; -$lang['spell_noerr'] = 'ឥតមានខុះទេ'; -$lang['spell_nosug'] = 'ឥតមានយោបល់'; -$lang['spell_change']= 'ដូរជំនួស';//'Change'; - $lang['metaedit'] = 'កែទិន្នន័យអរូប';//'Edit Metadata'; $lang['metasaveerr'] = 'ពំអាចកត់រទិន្នន័យអរូប';//'Writing metadata failed'; $lang['metasaveok'] = 'ទិន្នន័យអរូប'; @@ -187,14 +177,7 @@ $lang['img_format'] = 'ធុនប្រភេទ'; $lang['img_camera'] = 'គ្រឿងថត'; $lang['img_keywords']= 'មេពាក្ស';//'Keywords'; -$lang['subscribe_success'] = ' ដកថែម %s ចូលបញ្ជីបរិវិសកមចំពោះ %s'; -$lang['subscribe_error'] = 'មានកំហុសពេលបន្ថែម %s ចូលបញ្ជីបរិវិសកមចំពោះ %s'; -$lang['subscribe_noaddress']= 'ឥតមានអាសយដ្ឋាន អ្នកមិនអាចកត់ចុល'; -$lang['unsubscribe_success']= 'ដក %s ចេញពីបញ្ជីបរិវិសកមចំពោះ %s'; -$lang['unsubscribe_error'] = 'មានកំហុសពេលដក %s ចេញពីបញ្ជីបរិវិសកមចំពោះ %s'; - /* auth.class language support */ -$lang['authmodfailed'] = 'និនផ្ទៀងផ្ទាត់ភាពត្រឹមត្រូវបានទេ។ សុំទាកទងអ្នកក្របគ្រោង។'; $lang['authtempfail'] = 'ការផ្ទៀងផ្ទាត់ភាពត្រឹមត្រូវឥតដំនេ។ ប្រើ ....'; /* installer strings */ diff --git a/inc/lang/ko/admin.txt b/inc/lang/ko/admin.txt index c61db1a42..2f81e8961 100644 --- a/inc/lang/ko/admin.txt +++ b/inc/lang/ko/admin.txt @@ -1,3 +1,3 @@ -====== 관리 작업 ====== +====== 관리 ====== -DokuWiki에서 사용 가능한 관리 작업 목록을 아래에서 찾을 수 있습니다.
\ No newline at end of file +도쿠위키에서 사용할 수 있는 관리 작업 목록을 아래에서 찾을 수 있습니다.
\ No newline at end of file diff --git a/inc/lang/ko/conflict.txt b/inc/lang/ko/conflict.txt index 9b7764d46..b5420333b 100644 --- a/inc/lang/ko/conflict.txt +++ b/inc/lang/ko/conflict.txt @@ -1,5 +1,5 @@ ====== 새 판 있음 ====== -편집한 문서의 새 판이 있습니다. 당신이 편집하고 있는 동안 다른 사람이 같은 파일을 편집하였을 경우 이런 일이 생길 수 있습니다. +편집한 문서의 새 판이 있습니다. 당신이 편집하고 있는 동안 다른 사용자가 문서를 바꾸면 이런 일이 생길 수 있습니다. -아래의 차이를 철저하게 검토하고 어떤 판을 저장하실지 결정하세요. **저장**을 선택하면 당신의 판이 저장됩니다. **취소**를 선택하면 현재 판이 유지됩니다.
\ No newline at end of file +아래의 차이를 철저하게 검토하고 어떤 판을 저장하실지 결정하세요. ''저장''을 선택하면 당신의 판이 저장됩니다. ''취소''를 선택하면 현재 판이 유지됩니다.
\ No newline at end of file diff --git a/inc/lang/ko/denied.txt b/inc/lang/ko/denied.txt index 89d417f7b..cff844bf4 100644 --- a/inc/lang/ko/denied.txt +++ b/inc/lang/ko/denied.txt @@ -1,3 +1,3 @@ ====== 권한 거절 ====== -계속할 수 있는 권한이 없습니다. 로그인하세요.
\ No newline at end of file +죄송하지만 계속할 수 있는 권한이 없습니다. 로그인하세요.
\ No newline at end of file diff --git a/inc/lang/ko/diff.txt b/inc/lang/ko/diff.txt index 8237342f7..3fef83221 100644 --- a/inc/lang/ko/diff.txt +++ b/inc/lang/ko/diff.txt @@ -1,3 +1,3 @@ ====== 차이 ====== -이 문서의 선택한 이전 판과 현재 판 사이의 차이를 보여줍니다.
\ No newline at end of file +문서의 선택한 두 판 사이의 차이를 보여줍니다.
\ No newline at end of file diff --git a/inc/lang/ko/draft.txt b/inc/lang/ko/draft.txt index b655d7c92..7e700f725 100644 --- a/inc/lang/ko/draft.txt +++ b/inc/lang/ko/draft.txt @@ -1,5 +1,5 @@ ====== 문서 초안 있음 ====== -이 문서의 마지막 편집 세션은 정상적으로 끝나지 않았습니다. DokuWiki는 작업 도중 자동으로 저장된 문서 초안을 사용해 편집을 계속 할 수 있습니다. 마지막 세션 동안 저장된 문서 초안을 아래에서 볼 수 있습니다. +이 문서의 마지막 편집 세션은 올바르게 끝나지 않았습니다. 도쿠위키는 작업 도중 자동으로 저장된 초안을 사용해 편집을 계속 할 수 있습니다. 마지막 세션 동안 저장된 초안을 아래에서 볼 수 있습니다. 비정상적으로 끝난 편집 세션을 **되돌릴**지 여부를 결정하고, 자동으로 저장되었던 초안을 **삭제**하거나 편집 과정을 **취소**하세요.
\ No newline at end of file diff --git a/inc/lang/ko/edit.txt b/inc/lang/ko/edit.txt index 97927b7fe..8da90266c 100644 --- a/inc/lang/ko/edit.txt +++ b/inc/lang/ko/edit.txt @@ -1 +1 @@ -문서를 편집하고 **저장**을 누르세요. 위키 구문은 [[wiki:syntax]] 또는 [[wiki:ko_syntax|(한국어) 구문]]을 참고하세요. 이 문서를 **더 좋게 만들 자신이 있을 때**에만 편집하세요. 연습을 하고 싶다면 먼저 [[playground:playground|연습장]]에 가서 연습하세요.
\ No newline at end of file +문서를 편집하고 ''저장''을 누르세요. 위키 구문은 [[wiki:syntax]]를 참고하세요. 문서를 **더 좋게 만들 자신이 있을 때**에만 편집하세요. 연습을 하고 싶다면 먼저 [[playground:playground|연습장]]에 가서 연습하세요.
\ No newline at end of file diff --git a/inc/lang/ko/editrev.txt b/inc/lang/ko/editrev.txt index 911ea5f1b..8d3aeb813 100644 --- a/inc/lang/ko/editrev.txt +++ b/inc/lang/ko/editrev.txt @@ -1,2 +1,2 @@ -**문서의 이전 판을 선택했습니다!** 저장할 경우 이 데이터로 새 판을 만듭니다. +**문서의 이전 판을 선택했습니다!** 저장하면 이 데이터로 새 판을 만듭니다. ----
\ No newline at end of file diff --git a/inc/lang/ko/index.txt b/inc/lang/ko/index.txt index 058f04254..ce94e09c8 100644 --- a/inc/lang/ko/index.txt +++ b/inc/lang/ko/index.txt @@ -1,3 +1,3 @@ ====== 사이트맵 ====== -[[doku>namespaces|이름공간]]에서 정렬한 모든 문서의 목록입니다.
\ No newline at end of file +[[doku>ko:namespaces|이름공간]] 순으로 정렬한 모든 문서의 사이트맵입니다.
\ No newline at end of file diff --git a/inc/lang/ko/install.html b/inc/lang/ko/install.html index a9961b47e..886ed2d30 100644 --- a/inc/lang/ko/install.html +++ b/inc/lang/ko/install.html @@ -1,6 +1,5 @@ <p>이 페이지는 <a href="http://dokuwiki.org">Dokuwiki</a> 설치와 환경 설정을 도와줍니다. -설치 과정에 대한 더 자세한 정보는 <a href="http://dokuwiki.org/ko:install">(한국어) 설치 문서</a>와 -<a href="http://dokuwiki.org/install">(영어) 설치 문서</a>를 참고하시기 바랍니다.</p> +설치 과정에 대한 더 자세한 정보는 <a href="http://dokuwiki.org/ko:installer">관련 문서</a>를 참고하시기 바랍니다.</p> <p>DokuWiki는 위키 문서와 문서와 관련된 정보(예를 들어 그림, 검색 색인, 이전 판 문서)를 저장하기 위해 일반적인 텍스트 파일을 사용합니다. 정상적으로 DokuWiki를 사용하려면 이 파일을 담고 있는 디렉토리에 대한 쓰기 권한을 가지고 있어야 합니다. 현재 설치 과정 중에는 디렉토리 권한 설정이 불가능합니다. 보통 직접 셸 명령어를 사용하거나, 호스팅을 사용한다면 FTP나 호스팅 제어판(예를 들어 CPanel)을 사용해서 설정해야 합니다.</p> @@ -8,8 +7,4 @@ <p>현재 설치 과정중에 관리자로 로그인 후 DokuWiki의 관리 메뉴(플러그인 설치, 사용자 관리, 위키 문서 접근 권한 관리, 옵션 설정)를 가능하게 <acronym title="접근 제어 목록">ACL</acronym>에 대한 환경 설정을 수행합니다. DokuWiki가 동작하는데 필요한 사항은 아니지만, 어쨌든 더 쉽게 관리자가 관리할 수 있도록 해줍니다.</p> -<p>숙련된 사용자나 특별한 설치 과정이 필요한 경우에 다음 링크를 참고하시기 바랍니다: -<a href="http://dokuwiki.org/ko:install">설치 과정 (한국어)</a> -과 <a href="http://dokuwiki.org/ko:config">환경 설정 (한국어),</a> -<a href="http://dokuwiki.org/install">설치 과정 (영어)</a> -과 <a href="http://dokuwiki.org/config">환경 설정 (영어)</a></p>
\ No newline at end of file +<p>숙련된 사용자나 특별한 설치 과정이 필요한 경우에는 <a href="http://dokuwiki.org/ko:install">설치 과정</a>과 <a href="http://dokuwiki.org/ko:config">환경 설정</a> 링크를 참고하시기 바랍니다.</p>
\ No newline at end of file diff --git a/inc/lang/ko/lang.php b/inc/lang/ko/lang.php index 76684659c..39f2428fa 100644 --- a/inc/lang/ko/lang.php +++ b/inc/lang/ko/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Korean language file - * - * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Hyun Kim <lawfully@gmail.com> * @author jk Lee * @author dongnak@gmail.com @@ -10,6 +10,7 @@ * @author Seung-Chul Yoo <dryoo@live.com> * @author erial2@gmail.com * @author Myeongjin <aranet100@gmail.com> + * @author Gerrit Uitslag <klapinklapin@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -19,10 +20,10 @@ $lang['singlequoteopening'] = '‘'; $lang['singlequoteclosing'] = '’'; $lang['apostrophe'] = '’'; $lang['btn_edit'] = '문서 편집'; -$lang['btn_source'] = '내용 보기'; +$lang['btn_source'] = '원본 보기'; $lang['btn_show'] = '문서 보기'; $lang['btn_create'] = '문서 만들기'; -$lang['btn_search'] = '찾기'; +$lang['btn_search'] = '검색'; $lang['btn_save'] = '저장'; $lang['btn_preview'] = '미리 보기'; $lang['btn_top'] = '맨 위로'; @@ -44,63 +45,70 @@ $lang['btn_backlink'] = '백링크'; $lang['btn_backtomedia'] = '미디어 파일 선택으로 돌아가기'; $lang['btn_subscribe'] = '구독 관리'; $lang['btn_profile'] = '개인 정보 바꾸기'; -$lang['btn_reset'] = '초기화'; +$lang['btn_reset'] = '재설정'; $lang['btn_resendpwd'] = '새 비밀번호 설정'; -$lang['btn_draft'] = '문서 초안 편집'; -$lang['btn_recover'] = '문서 초안 되돌리기'; -$lang['btn_draftdel'] = '문서 초안 삭제'; +$lang['btn_draft'] = '초안 편집'; +$lang['btn_recover'] = '초안 되돌리기'; +$lang['btn_draftdel'] = '초안 삭제'; $lang['btn_revert'] = '되돌리기'; $lang['btn_register'] = '등록'; $lang['btn_apply'] = '적용'; $lang['btn_media'] = '미디어 관리'; -$lang['loggedinas'] = '다음 사용자로 로그인'; +$lang['btn_deleteuser'] = '내 계정 제거'; +$lang['loggedinas'] = '로그인한 사용자'; $lang['user'] = '사용자 이름'; $lang['pass'] = '비밀번호'; $lang['newpass'] = '새 비밀번호'; $lang['oldpass'] = '현재 비밀번호 확인'; $lang['passchk'] = '비밀번호 다시 확인'; $lang['remember'] = '기억하기'; -$lang['fullname'] = '실제 이름'; +$lang['fullname'] = '실명'; $lang['email'] = '이메일'; $lang['profile'] = '개인 정보'; -$lang['badlogin'] = '사용자 이름이거나 비밀번호가 잘못되었습니다.'; +$lang['badlogin'] = '죄송하지만 사용자 이름이나 비밀번호가 잘못되었습니다.'; +$lang['badpassconfirm'] = '죄송하지만 비밀번호가 잘못되었습니다'; $lang['minoredit'] = '사소한 바뀜'; -$lang['draftdate'] = '문서 초안 자동 저장 시간'; -$lang['nosecedit'] = '한동안 문서가 바뀌어 세션 정보의 유효 시간이 지나 문서 전부를 다시 읽습니다.'; -$lang['regmissing'] = '모든 항목을 입력해야 합니다.'; -$lang['reguexists'] = '같은 이름을 사용하는 사용자가 있습니다.'; +$lang['draftdate'] = '초안 자동 저장 시간'; +$lang['nosecedit'] = '한동안 문서가 바뀌었으며, 문단 정보가 오래되어 문서 전체를 대신 열었습니다.'; +$lang['regmissing'] = '죄송하지만 모든 필드를 채워야 합니다.'; +$lang['reguexists'] = '죄송하지만 같은 이름을 사용하는 사용자가 있습니다.'; $lang['regsuccess'] = '사용자를 만들었으며 비밀번호는 이메일로 보냈습니다.'; $lang['regsuccess2'] = '사용자를 만들었습니다.'; -$lang['regmailfail'] = '비밀번호를 이메일로 보낼 때 오류가 발생했습니다. 관리자에게 문의하시기 바랍니다!'; -$lang['regbadmail'] = '이메일 주소가 잘못됐습니다 - 오류라고 생각하면 관리자에게 문의하시기 바랍니다'; -$lang['regbadpass'] = '새 비밀번호가 일치하지 않습니다. 다시 입력하세요.'; -$lang['regpwmail'] = 'DokuWiki 비밀번호'; +$lang['regmailfail'] = '비밀번호를 이메일로 보낼 때 오류가 발생했습니다. 관리자에게 문의하세요!'; +$lang['regbadmail'] = '이메일 주소가 잘못됐습니다 - 오류라고 생각하면 관리자에게 문의하세요'; +$lang['regbadpass'] = '새 비밀번호가 같지 않습니다. 다시 입력하세요.'; +$lang['regpwmail'] = '도쿠위키 비밀번호'; $lang['reghere'] = '계정이 없나요? 계정을 등록할 수 있습니다'; $lang['profna'] = '이 위키는 개인 정보 수정을 할 수 없습니다'; -$lang['profnochange'] = '바뀜이 없습니다.'; +$lang['profnochange'] = '바뀐 내용이 없습니다.'; $lang['profnoempty'] = '이름이나 이메일 주소가 비었습니다.'; $lang['profchanged'] = '개인 정보가 성공적으로 바뀌었습니다.'; +$lang['profnodelete'] = '이 위키는 사용자 삭제를 지원하지 않습니다'; +$lang['profdeleteuser'] = '계정 삭제'; +$lang['profdeleted'] = '내 사용자 계정이 이 위키에서 삭제되었습니다'; +$lang['profconfdelete'] = '이 위키에서 내 계정을 제거하고 싶습니다. <br/> 이 행동은 되돌릴 수 없습니다.'; +$lang['profconfdeletemissing'] = '선택하지 않은 확인 상자를 확인'; $lang['pwdforget'] = '비밀번호를 잊으셨나요? 비밀번호를 재설정할 수 있습니다'; $lang['resendna'] = '이 위키는 비밀번호 재설정을 지원하지 않습니다.'; $lang['resendpwd'] = '다음으로 새 비밀번호 보내기'; -$lang['resendpwdmissing'] = '모든 비밀번호를 입력해야 합니다.'; -$lang['resendpwdnouser'] = '등록된 사용자가 아닙니다.'; -$lang['resendpwdbadauth'] = '인증 코드가 잘못됐습니다. 잘못된 링크인지 확인하시기 바랍니다.'; +$lang['resendpwdmissing'] = '죄송하지만 모든 필드를 채워야 합니다.'; +$lang['resendpwdnouser'] = '죄송하지만 데이터베이스에서 이 사용자를 찾을 수 없습니다.'; +$lang['resendpwdbadauth'] = '죄송하지만 인증 코드가 올바르지 않습니다. 잘못된 확인 링크인지 확인하세요.'; $lang['resendpwdconfirm'] = '확인 링크를 이메일로 보냈습니다.'; -$lang['resendpwdsuccess'] = '새로운 비밀번호를 이메일로 보냈습니다.'; -$lang['license'] = '별도로 라이선스를 알리지 않을 경우, 이 위키의 내용은 다음의 라이선스에 따릅니다:'; -$lang['licenseok'] = '참고: 이 문서를 편집할 경우 다음의 라이선스에 동의함을 의미합니다:'; -$lang['searchmedia'] = '파일 이름 찾기:'; -$lang['searchmedia_in'] = '%s에서 찾기'; +$lang['resendpwdsuccess'] = '새 비밀번호를 이메일로 보냈습니다.'; +$lang['license'] = '별도로 명시하지 않을 경우, 이 위키의 내용은 다음 라이선스에 따라 사용할 수 있습니다:'; +$lang['licenseok'] = '참고: 이 문서를 편집하면 내용은 다음 라이선스에 따라 배포하는 데 동의합니다:'; +$lang['searchmedia'] = '파일 이름 검색:'; +$lang['searchmedia_in'] = '%s에서 검색'; $lang['txt_upload'] = '올릴 파일 선택'; $lang['txt_filename'] = '올릴 파일 이름 입력 (선택 사항)'; $lang['txt_overwrt'] = '기존 파일에 덮어쓰기'; -$lang['maxuploadsize'] = '최대 올리기 용량입니다. 파일당 %s입니다.'; +$lang['maxuploadsize'] = '최대 올리기 용량. 파일당 %s입니다.'; $lang['lockedby'] = '현재 잠겨진 사용자'; $lang['lockexpire'] = '잠금 해제 시간'; $lang['js']['willexpire'] = '잠시 후 편집 잠금이 해제됩니다.\n편집 충돌을 피하려면 미리 보기를 눌러 잠금 시간을 다시 설정하세요.'; -$lang['js']['notsavedyet'] = '저장하지 않은 바뀜이 지워집니다.'; -$lang['js']['searchmedia'] = '파일 찾기'; +$lang['js']['notsavedyet'] = '저장하지 않은 바뀜이 사라집니다.'; +$lang['js']['searchmedia'] = '파일 검색'; $lang['js']['keepopen'] = '선택할 때 창을 열어 놓기'; $lang['js']['hidedetails'] = '자세한 정보 숨기기'; $lang['js']['mediatitle'] = '링크 설정'; @@ -109,7 +117,7 @@ $lang['js']['mediaalign'] = '배치'; $lang['js']['mediasize'] = '그림 크기'; $lang['js']['mediatarget'] = '링크 목표'; $lang['js']['mediaclose'] = '닫기'; -$lang['js']['mediainsert'] = '삽입'; +$lang['js']['mediainsert'] = '넣기'; $lang['js']['mediadisplayimg'] = '그림을 보여줍니다.'; $lang['js']['mediadisplaylnk'] = '링크만 보여줍니다.'; $lang['js']['mediasmall'] = '작게'; @@ -120,10 +128,10 @@ $lang['js']['medialnk'] = '자세한 정보 문서로 링크'; $lang['js']['mediadirect'] = '원본으로 직접 링크'; $lang['js']['medianolnk'] = '링크 없음'; $lang['js']['medianolink'] = '그림을 링크하지 않음'; -$lang['js']['medialeft'] = '왼쪽 배치'; -$lang['js']['mediaright'] = '오른쪽 배치'; -$lang['js']['mediacenter'] = '가운데 배치'; -$lang['js']['medianoalign'] = '배치 없음'; +$lang['js']['medialeft'] = '왼쪽으로 그림 배치'; +$lang['js']['mediaright'] = '오른쪽으로 그림 배치'; +$lang['js']['mediacenter'] = '가운데으로 그림 배치'; +$lang['js']['medianoalign'] = '배치하지 않음'; $lang['js']['nosmblinks'] = '윈도우 공유 파일과의 연결은 마이크로소프트 인터넷 익스플로러에서만 동작합니다.\n그러나 링크를 복사하거나 붙여넣기를 할 수 있습니다.'; $lang['js']['linkwiz'] = '링크 마법사'; $lang['js']['linkto'] = '다음으로 연결:'; @@ -136,37 +144,37 @@ $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_drop'] = '올릴 파일을 여기에 끌어넣으세요'; +$lang['js']['media_cancel'] = '제거'; $lang['js']['media_overwrt'] = '기존 파일에 덮어쓰기'; $lang['rssfailed'] = '이 피드를 가져오는 동안 오류가 발생했습니다:'; $lang['nothingfound'] = '아무 것도 없습니다.'; -$lang['mediaselect'] = '미디어 파일 선택'; +$lang['mediaselect'] = '미디어 파일'; $lang['fileupload'] = '미디어 파일 올리기'; $lang['uploadsucc'] = '올리기 성공'; $lang['uploadfail'] = '올리기를 실패했습니다. 잘못된 권한 때문일지도 모릅니다.'; -$lang['uploadwrong'] = '올리기를 거부했습니다. 금지된 파일 확장자입니다!'; +$lang['uploadwrong'] = '올리기가 거부되었습니다. 금지된 파일 확장자입니다!'; $lang['uploadexist'] = '파일이 이미 존재합니다.'; $lang['uploadbadcontent'] = '올린 파일이 %s 파일 확장자와 일치하지 않습니다.'; -$lang['uploadspam'] = '스팸 차단 목록이 올리기를 취소했습니다.'; -$lang['uploadxss'] = '악성 코드의 가능성이 있어 올리기를 취소했습니다.'; +$lang['uploadspam'] = '스팸 차단 목록이 올리기를 차단했습니다.'; +$lang['uploadxss'] = '악성 코드의 가능성이 있어 올리기를 차단했습니다.'; $lang['uploadsize'] = '올린 파일이 너무 큽니다. (최대 %s)'; $lang['deletesucc'] = '"%s" 파일이 삭제되었습니다.'; -$lang['deletefail'] = '"%s" 파일을 삭제할 수 없습니다 - 삭제 권한이 있는지 확인하세요.'; +$lang['deletefail'] = '"%s" 파일을 삭제할 수 없습니다 - 권한이 있는지 확인하세요.'; $lang['mediainuse'] = '"%s" 파일을 삭제할 수 없습니다 - 아직 사용 중입니다.'; $lang['namespaces'] = '이름공간'; -$lang['mediafiles'] = '사용 가능한 파일 목록'; +$lang['mediafiles'] = '사용할 수 있는 파일 목록'; $lang['accessdenied'] = '이 문서를 볼 권한이 없습니다.'; $lang['mediausage'] = '이 파일을 참고하려면 다음 문법을 사용하세요:'; $lang['mediaview'] = '원본 파일 보기'; -$lang['mediaroot'] = '루트 (root)'; +$lang['mediaroot'] = '루트'; $lang['mediaupload'] = '파일을 현재 이름공간으로 올립니다. 하위 이름공간으로 만들려면 선택한 파일 이름 앞에 쌍점(:)으로 구분되는 이름을 붙이면 됩니다. 파일을 드래그 앤 드롭해 선택할 수 있습니다.'; $lang['mediaextchange'] = '파일 확장자가 .%s에서 .%s(으)로 바뀌었습니다!'; $lang['reference'] = '참고'; $lang['ref_inuse'] = '다음 문서에서 아직 사용 중이므로 파일을 삭제할 수 없습니다:'; $lang['ref_hidden'] = '문서의 일부 참고는 읽을 수 있는 권한이 없습니다'; $lang['hits'] = '조회 수'; -$lang['quickhits'] = '일치하는 문서 이름'; +$lang['quickhits'] = '일치하는 문서이름'; $lang['toc'] = '목차'; $lang['current'] = '현재'; $lang['yours'] = '판'; @@ -179,22 +187,22 @@ $lang['diff_side'] = '다중 창 방식'; $lang['line'] = '줄'; $lang['breadcrumb'] = '추적'; $lang['youarehere'] = '현재 위치'; -$lang['lastmod'] = '마지막으로 수정함'; -$lang['by'] = '작성자'; -$lang['deleted'] = '삭제함'; +$lang['lastmod'] = '마지막으로 수정됨'; +$lang['by'] = '저자'; +$lang['deleted'] = '제거됨'; $lang['created'] = '새로 만듦'; $lang['restored'] = '이전 판으로 되돌림 (%s)'; -$lang['external_edit'] = '바깥 편집기'; +$lang['external_edit'] = '바깥 편집'; $lang['summary'] = '편집 요약'; -$lang['noflash'] = '이 콘텐츠를 표시하기 위해서 <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash 플러그인</a>이 필요합니다.'; +$lang['noflash'] = '이 내용을 표시하기 위해서 <a href="http://www.adobe.com/products/flashplayer/">Adobe 플래시 플러그인</a>이 필요합니다.'; $lang['download'] = '조각 다운로드'; $lang['tools'] = '도구'; $lang['user_tools'] = '사용자 도구'; $lang['site_tools'] = '사이트 도구'; $lang['page_tools'] = '문서 도구'; -$lang['skip_to_content'] = '콘텐츠 넘기기'; +$lang['skip_to_content'] = '내용으로 건너뛰기'; $lang['sidebar'] = '사이드바'; -$lang['mail_newpage'] = '문서 추가함:'; +$lang['mail_newpage'] = '문서 추가됨:'; $lang['mail_changed'] = '문서 바뀜:'; $lang['mail_subscribe_list'] = '이름공간에서 바뀐 문서:'; $lang['mail_new_user'] = '새 사용자:'; @@ -205,7 +213,7 @@ $lang['media_changes'] = '미디어 파일'; $lang['both_changes'] = '문서와 미디어 파일 모두'; $lang['qb_bold'] = '굵은 글씨'; $lang['qb_italic'] = '기울인 글씨'; -$lang['qb_underl'] = '밑줄 그어진 글씨'; +$lang['qb_underl'] = '밑줄 글씨'; $lang['qb_code'] = '코드 글씨'; $lang['qb_strike'] = '취소선 글씨'; $lang['qb_h1'] = '1단계 문단 제목'; @@ -223,22 +231,22 @@ $lang['qb_extlink'] = '바깥 링크'; $lang['qb_hr'] = '가로줄'; $lang['qb_ol'] = '순서 있는 목록'; $lang['qb_ul'] = '순서 없는 목록'; -$lang['qb_media'] = '그림과 기타 파일 추가'; +$lang['qb_media'] = '그림과 기타 파일 추가 (새 창에서 열림)'; $lang['qb_sig'] = '서명 넣기'; $lang['qb_smileys'] = '이모티콘'; $lang['qb_chars'] = '특수 문자'; $lang['upperns'] = '상위 이름공간으로 이동'; $lang['admin_register'] = '새 사용자 추가'; -$lang['metaedit'] = '메타 데이터 편집'; -$lang['metasaveerr'] = '메타 데이터 쓰기 실패'; -$lang['metasaveok'] = '메타 데이터 저장됨'; +$lang['metaedit'] = '메타데이터 편집'; +$lang['metasaveerr'] = '메타데이터 쓰기 실패'; +$lang['metasaveok'] = '메타데이터 저장됨'; $lang['img_backto'] = '뒤로'; -$lang['img_title'] = '이름'; +$lang['img_title'] = '제목'; $lang['img_caption'] = '설명'; $lang['img_date'] = '날짜'; -$lang['img_fname'] = '파일 이름'; +$lang['img_fname'] = '파일이름'; $lang['img_fsize'] = '크기'; -$lang['img_artist'] = '만든이'; +$lang['img_artist'] = '촬영자'; $lang['img_copyr'] = '저작권'; $lang['img_format'] = '포맷'; $lang['img_camera'] = '카메라'; @@ -253,7 +261,7 @@ $lang['subscr_unsubscribe_success'] = '%s 사용자가 %s 구독 목록에서 $lang['subscr_unsubscribe_error'] = '%s 사용자가 %s 구독 목록에서 삭제하는데 실패했습니다'; $lang['subscr_already_subscribed'] = '%s 사용자가 이미 %s에 구독하고 있습니다'; $lang['subscr_not_subscribed'] = '%s 사용자가 %s에 구독하고 있지 않습니다'; -$lang['subscr_m_not_subscribed'] = '현재의 문서나 이름공간에 구독하고 있지 않습니다.'; +$lang['subscr_m_not_subscribed'] = '문서나 이름공간에 현재 구독하고 있지 않습니다.'; $lang['subscr_m_new_header'] = '구독 추가'; $lang['subscr_m_current_header'] = '현재 구독 중인 문서'; $lang['subscr_m_unsubscribe'] = '구독 취소'; @@ -262,26 +270,25 @@ $lang['subscr_m_receive'] = '받기'; $lang['subscr_style_every'] = '모든 바뀜을 이메일로 받기'; $lang['subscr_style_digest'] = '각 문서의 바뀜을 요약 (매 %.2f일 마다)'; $lang['subscr_style_list'] = '마지막 이메일 이후 바뀐 문서의 목록 (매 %.2f일 마다)'; -$lang['authmodfailed'] = '잘못된 사용자 인증 설정입니다. 관리자에게 문의하시기 바랍니다.'; -$lang['authtempfail'] = '사용자 인증이 일시적으로 불가능합니다. 만일 계속해서 문제가 발생하면 관리자에게 문의하시기 바랍니다.'; -$lang['authpwdexpire'] = '비밀번호를 바꾼지 %d일이 지났습니다. 비민번호를 곧 바꿔야 합니다.'; +$lang['authtempfail'] = '사용자 인증을 일시적으로 사용할 수 없습니다. 만약 계속해서 문제가 발생하면 위키 관리자에게 문의하시기 바랍니다.'; +$lang['authpwdexpire'] = '비밀번호를 바꾼지 %d일이 지났으며, 비민번호를 곧 바꿔야 합니다.'; $lang['i_chooselang'] = '사용할 언어를 선택하세요'; $lang['i_installer'] = 'DokuWiki 설치'; $lang['i_wikiname'] = '위키 이름'; -$lang['i_enableacl'] = 'ACL 기능 사용 (권장)'; +$lang['i_enableacl'] = 'ACL 활성화 (권장)'; $lang['i_superuser'] = '슈퍼 유저'; -$lang['i_problems'] = '설치하는 동안 아래와 같은 문제가 발생했습니다. 문제를 해결한 후 설치를 계속하세요.'; -$lang['i_modified'] = '보안 상의 이유로 이 스크립트는 수정되지 않은 새 Dokuwiki 설치에서만 동작됩니다. -다운로드한 압축 패키지를 다시 설치하거나 <a href="http://dokuwiki.org/install">DokuWiki 설치 과정</a>을 참고해서 설치하세요.'; -$lang['i_funcna'] = '<code>%s</code> PHP 함수의 사용이 불가능합니다. 호스트 제공자가 어떤 이유에서인지 막아 놓았을지 모릅니다.'; +$lang['i_problems'] = '설치하는 동안 아래와 같은 문제가 발생했습니다. 문제를 해결한 후 설치를 계속할 수 있습니다.'; +$lang['i_modified'] = '보안 상의 이유로 이 스크립트는 수정되지 않은 새 도쿠위키 설치에서만 동작됩니다. +다운로드한 압축 패키지를 다시 설치하거나 <a href="http://dokuwiki.org/ko:install">도쿠위키 설치 과정</a>을 참고해서 설치하세요.'; +$lang['i_funcna'] = '<code>%s</code> PHP 함수를 사용할 수 없습니다. 호스트 제공자가 어떤 이유에서인지 막아 놓았을지 모릅니다.'; $lang['i_phpver'] = 'PHP <code>%s</code> 버전은 필요한 <code>%s</code> 버전보다 오래되었습니다. PHP를 업그레이드할 필요가 있습니다.'; -$lang['i_permfail'] = 'DokuWiki는 <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">새 DokuWiki</a>로 들어갑니다.'; -$lang['i_failure'] = '환경 설정 파일에 쓰는 도중에 오류가 발생했습니다. <a href="doku.php?id=wiki:welcome">새 DokuWiki</a>를 사용하기 전에 수동으로 문제를 해결해야 합니다.'; +$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>를 사용하기 전에 수동으로 문제를 해결해야 합니다.'; $lang['i_policy'] = '초기 ACL 정책'; $lang['i_pol0'] = '열린 위키 (누구나 읽기, 쓰기, 올리기가 가능합니다)'; $lang['i_pol1'] = '공개 위키 (누구나 읽을 수 있지만, 등록된 사용자만 쓰기와 올리기가 가능합니다)'; @@ -289,19 +296,19 @@ $lang['i_pol2'] = '닫힌 위키 (등록된 사용자만 읽기, $lang['i_retry'] = '다시 시도'; $lang['i_license'] = '내용을 배포하기 위한 라이선스를 선택하세요:'; $lang['i_license_none'] = '라이선스 정보를 보여주지 않습니다'; -$lang['i_pop_field'] = 'DokuWiki 경험을 개선하는 데 도움을 주세요:'; -$lang['i_pop_label'] = '한 달에 한 번씩, DokuWiki 개발자에게 익명의 사용 데이터를 보냅니다'; -$lang['recent_global'] = '<b>%s</b> 이름공간을 구독 중입니다. <a href="%s">전체 위키의 최근 바뀜도 볼 수</a> 있습니다.'; +$lang['i_pop_field'] = '도쿠위키 경험을 개선하는 데 도움을 주세요:'; +$lang['i_pop_label'] = '한 달에 한 번씩, 도쿠위키 개발자에게 익명의 사용 데이터를 보냅니다'; +$lang['recent_global'] = '현재 <b>%s</b> 이름공간을 구독 중입니다. <a href="%s">전체 위키의 최근 바뀜도 볼 수</a> 있습니다.'; $lang['years'] = '%d년 전'; -$lang['months'] = '%d개월 전'; +$lang['months'] = '%d달 전'; $lang['weeks'] = '%d주 전'; $lang['days'] = '%d일 전'; $lang['hours'] = '%d시간 전'; $lang['minutes'] = '%d분 전'; $lang['seconds'] = '%d초 전'; -$lang['wordblock'] = '차단 문구(스팸 문구)를 포함하고 있어서 저장하지 않았습니다.'; +$lang['wordblock'] = '차단 문구(스팸)를 포함하고 있어서 바뀜을 저장하지 않았습니다.'; $lang['media_uploadtab'] = '올리기'; -$lang['media_searchtab'] = '찾기'; +$lang['media_searchtab'] = '검색'; $lang['media_file'] = '파일'; $lang['media_viewtab'] = '보기'; $lang['media_edittab'] = '편집'; @@ -313,13 +320,17 @@ $lang['media_sort_date'] = '날짜'; $lang['media_namespaces'] = '이름공간 선택'; $lang['media_files'] = '%s에 있는 파일'; $lang['media_upload'] = '%s에 올리기'; -$lang['media_search'] = '%s 찾기'; +$lang['media_search'] = '%s에서 검색'; $lang['media_view'] = '%s'; -$lang['media_viewold'] = '%s (%s에 있음)'; +$lang['media_viewold'] = '%2$s (%1$s에 있음)'; $lang['media_edit'] = '%s 편집'; -$lang['media_history'] = '%s 바뀜 내역'; -$lang['media_meta_edited'] = '메타 데이터 편집됨'; -$lang['media_perm_read'] = '이 파일을 읽을 권한이 없습니다.'; -$lang['media_perm_upload'] = '파일을 올릴 권한이 없습니다.'; +$lang['media_history'] = '%s의 내역'; +$lang['media_meta_edited'] = '메타데이터 편집됨'; +$lang['media_perm_read'] = '죄송하지만 파일을 읽을 권한이 없습니다.'; +$lang['media_perm_upload'] = '죄송하지만 파일을 올릴 권한이 없습니다.'; $lang['media_update'] = '새 판 올리기'; $lang['media_restore'] = '이 판으로 되돌리기'; +$lang['currentns'] = '현재 이름공간'; +$lang['searchresult'] = '검색 결과'; +$lang['plainhtml'] = '일반 HTML'; +$lang['wikimarkup'] = '위키 문법'; diff --git a/inc/lang/ko/locked.txt b/inc/lang/ko/locked.txt index 8e2eab9f9..38832d06e 100644 --- a/inc/lang/ko/locked.txt +++ b/inc/lang/ko/locked.txt @@ -1,3 +1,3 @@ -====== 문서 잠금 ====== +====== 문서 잠김 ====== -다른 사용자가 이 문서를 편집하기 위해 잠금을 실행했습니다. 해당 사용자가 편집을 끝내거나 잠금이 해제될 때까지 기다리세요.
\ No newline at end of file +이 문서는 다른 사용자가 편집하기 위해 현재 잠겨있습니다. 해당 사용자가 편집을 끝내거나 잠금이 만료될 때까지 기다리세요.
\ No newline at end of file diff --git a/inc/lang/ko/mailtext.txt b/inc/lang/ko/mailtext.txt index 8fb6fd446..e9e9c25e1 100644 --- a/inc/lang/ko/mailtext.txt +++ b/inc/lang/ko/mailtext.txt @@ -1,4 +1,4 @@ -DokuWiki 문서가 추가 또는 바뀌었습니다. 자세한 정보는 다음과 같습니다: +도쿠위키 문서가 추가되거나 바뀌었습니다. 자세한 내용은 다음과 같습니다: 날짜 : @DATE@ 브라우저 : @BROWSER@ @@ -12,5 +12,5 @@ IP 주소 : @IPADDRESS@ @DIFF@ --- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +-- +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다
\ No newline at end of file diff --git a/inc/lang/ko/mailwrap.html b/inc/lang/ko/mailwrap.html index 885730428..ef061f10f 100644 --- a/inc/lang/ko/mailwrap.html +++ b/inc/lang/ko/mailwrap.html @@ -1,13 +1,13 @@ <html> - <head> - <title>@TITLE@</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - </head> - <body> +<head> + <title>@TITLE@</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +</head> +<body> - @HTMLBODY@ +@HTMLBODY@ - <br /><hr /> - <small>@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.</small> - </body> - </html>
\ No newline at end of file +<br /><hr /> +<small>이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다.</small> +</body> +</html> diff --git a/inc/lang/ko/newpage.txt b/inc/lang/ko/newpage.txt index fa7864610..a553cf9c2 100644 --- a/inc/lang/ko/newpage.txt +++ b/inc/lang/ko/newpage.txt @@ -1,3 +1,3 @@ ====== 이 주제는 아직 없습니다 ====== -아직 없는 주제에 대한 링크를 따라왔습니다. **문서 만들기** 버튼을 클릭해 새로 만들 수 있습니다.
\ No newline at end of file +아직 없는 주제에 대한 링크를 따라왔습니다. "문서 만들기"를 클릭해 새로 만들 수 있습니다.
\ No newline at end of file diff --git a/inc/lang/ko/norev.txt b/inc/lang/ko/norev.txt index 246f3e4f6..5cb7360d7 100644 --- a/inc/lang/ko/norev.txt +++ b/inc/lang/ko/norev.txt @@ -1,3 +1,3 @@ ====== 지정한 판 없음 ====== -지정한 판이 존재하지 않습니다. **이전 판** 버튼을 사용해 이 문서의 이전 판 목록을 보세요.
\ No newline at end of file +지정한 판이 존재하지 않습니다. 이 문서의 이전 판 목록을 보려면 "이전 판"을 클릭하세요.
\ No newline at end of file diff --git a/inc/lang/ko/password.txt b/inc/lang/ko/password.txt index 02b23d17c..790f6b479 100644 --- a/inc/lang/ko/password.txt +++ b/inc/lang/ko/password.txt @@ -1,9 +1,9 @@ -@FULLNAME@ 안녕하세요! +@FULLNAME@님 안녕하세요! -@DOKUWIKIURL@의 @TITLE@의 사용자 정보입니다. +여기에 @DOKUWIKIURL@에서 @TITLE@의 사용자 정보가 있습니다. -사용자 이름 : @LOGIN@ +로그인 : @LOGIN@ 비밀번호 : @PASSWORD@ -- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다
\ No newline at end of file diff --git a/inc/lang/ko/pwconfirm.txt b/inc/lang/ko/pwconfirm.txt index 6e447a021..d820664f0 100644 --- a/inc/lang/ko/pwconfirm.txt +++ b/inc/lang/ko/pwconfirm.txt @@ -1,13 +1,13 @@ -@FULLNAME@ 안녕하세요! +@FULLNAME@님 안녕하세요! 누군가가 @DOKUWIKIURL@에 @TITLE@에 대해 새 비밀번호가 필요하다고 요청했습니다. -새로운 비밀번호 요청한 적이 없다면 이 이메일을 무시해버리세요. +새 비밀번호를 요청하지 않았다면 이 이메일을 무시해버리세요. -정말로 당신이 요청을 했는지 다음 링크에서 확인하세요. +정말로 당신이 요청을 해서 보내졌는지 확인하려면 다음 링크를 사용하세요. @CONFIRM@ -- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다
\ No newline at end of file diff --git a/inc/lang/ko/read.txt b/inc/lang/ko/read.txt index 8f080fcb1..079b8e130 100644 --- a/inc/lang/ko/read.txt +++ b/inc/lang/ko/read.txt @@ -1 +1 @@ -이 문서는 읽기 전용입니다. 내용을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
\ No newline at end of file +이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
\ No newline at end of file diff --git a/inc/lang/ko/register.txt b/inc/lang/ko/register.txt index 6509bed91..4df968896 100644 --- a/inc/lang/ko/register.txt +++ b/inc/lang/ko/register.txt @@ -1,3 +1,3 @@ ====== 새 사용자 등록 ====== -이 위키에 새 계정을 만드려면 아래의 모든 내용을 입력하세요. **올바른 이메일 주소**를 사용하세요. 비밀번호를 입력하는 곳이 없다면 비밀번호는 이 이메일로 보내집니다. 사용자 이름은 올바른 [[doku>pagename|pagename]]이어야 합니다.
\ No newline at end of file +이 위키에 새 계정을 만드려면 아래의 모든 내용을 입력하세요. **올바른 이메일 주소**를 사용하세요. 비밀번호를 입력하는 곳이 없다면 비밀번호는 이 이메일로 보내집니다. 사용자 이름은 올바른 [[doku>ko:pagename|문서이름]]이어야 합니다.
\ No newline at end of file diff --git a/inc/lang/ko/registermail.txt b/inc/lang/ko/registermail.txt index 4707dfa13..e7c808047 100644 --- a/inc/lang/ko/registermail.txt +++ b/inc/lang/ko/registermail.txt @@ -1,7 +1,7 @@ -새 사용자가 등록되었습니다: +새 사용자가 등록되었습니다. 자세한 내용은 다음과 같습니다: 사용자 이름 : @NEWUSER@ -사용자 실제 이름 : @NEWNAME@ +실제 이름 : @NEWNAME@ 이메일 : @NEWEMAIL@ 날짜 : @DATE@ @@ -10,4 +10,4 @@ IP 주소 : @IPADDRESS@ 호스트 이름 : @HOSTNAME@ -- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다
\ No newline at end of file diff --git a/inc/lang/ko/resendpwd.txt b/inc/lang/ko/resendpwd.txt index faee2072c..44cd5ad98 100644 --- a/inc/lang/ko/resendpwd.txt +++ b/inc/lang/ko/resendpwd.txt @@ -1,3 +1,3 @@ ====== 새 비밀번호 보내기 ====== -이 위키 계정에 대한 새 비밀번호를 요구하기 위해 아래 양식에서 사용자 이름을 입력하세요. 확인 링크는 새로 등록한 이메일 주소로 보냅니다.
\ No newline at end of file +이 위키 계정에 대한 새 비밀번호를 요청하기 위해 아래 양식에서 사용자 이름을 입력하세요. 확인 링크는 새로 등록한 이메일 주소로 보냅니다.
\ No newline at end of file diff --git a/inc/lang/ko/resetpwd.txt b/inc/lang/ko/resetpwd.txt index ed909456f..cc2ec6a94 100644 --- a/inc/lang/ko/resetpwd.txt +++ b/inc/lang/ko/resetpwd.txt @@ -1,3 +1,3 @@ ====== 새 비밀번호 설정 ====== -이 위키 계정의 새 비밀번호를 입력하세요.
\ No newline at end of file +이 위키에 있는 계정의 새 비밀번호를 입력하세요.
\ No newline at end of file diff --git a/inc/lang/ko/revisions.txt b/inc/lang/ko/revisions.txt index f499e2f72..ed80dbcd5 100644 --- a/inc/lang/ko/revisions.txt +++ b/inc/lang/ko/revisions.txt @@ -1,3 +1,3 @@ ====== 이전 판 ====== -이 문서의 이전 판은 다음과 같습니다. 이전 판으로 되돌리려면, 아래에서 선택한 다음 **문서 편집**을 클릭하고 나서 저장하세요.
\ No newline at end of file +이 문서의 이전 판은 다음과 같습니다. 이전 판으로 되돌리려면, 아래에서 선택한 다음 ''문서 편집''을 클릭하고 나서 저장하세요.
\ No newline at end of file diff --git a/inc/lang/ko/searchpage.txt b/inc/lang/ko/searchpage.txt index d3b37ec7c..35384c536 100644 --- a/inc/lang/ko/searchpage.txt +++ b/inc/lang/ko/searchpage.txt @@ -1,5 +1,5 @@ -====== 찾기 ====== +====== 검색 ====== -아래에서 찾기 결과를 볼 수 있습니다. 만일 원하는 문서를 찾지 못하였다면, **문서 만들기**나 **문서 편집** 버튼을 사용해 쿼리 내용과 같은 이름의 문서를 만들거나 편집할 수 있습니다. +아래에서 검색 결과를 볼 수 있습니다. 만일 원하는 문서를 찾지 못하였다면, "문서 만들기"나 "문서 편집"을 사용해 쿼리 내용과 같은 이름의 문서를 만들거나 편집할 수 있습니다. ===== 결과 =====
\ No newline at end of file diff --git a/inc/lang/ko/stopwords.txt b/inc/lang/ko/stopwords.txt index c0dc2a79b..b0be85166 100644 --- a/inc/lang/ko/stopwords.txt +++ b/inc/lang/ko/stopwords.txt @@ -1,7 +1,7 @@ -# 색인이 만들어지지 않는 단어 목록입니다. (한줄에 한 단어) -# 이 파일을 편집한다면 UNIX 줄 종료 문자를 사용해야 합니다.(단일 개행 문자) +# 색인이 만들어지지 않는 단어 목록입니다. (한 줄에 한 단어) +# 이 파일을 편집할 때 UNIX 줄 종료 문자를 사용해야 합니다.(단일 개행 문자) # 3문자 이하 단어는 자동으로 무시되므로 3문자보다 짧은 단어는 포함시킬 필요가 없습니다. -# http://www.ranks.nl/stopwords/을 기준으로 만들어진 목록입니다. +# http://www.ranks.nl/stopwords/ 을 기준으로 만들어진 목록입니다. about are as diff --git a/inc/lang/ko/subscr_digest.txt b/inc/lang/ko/subscr_digest.txt index 6db7b963c..7a044736a 100644 --- a/inc/lang/ko/subscr_digest.txt +++ b/inc/lang/ko/subscr_digest.txt @@ -11,8 +11,8 @@ 새 판 : @NEWPAGE@ -이 문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 +문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 @SUBSCRIBE@ 문서를 방문해 문서나 이름공간의 구독을 취소하세요. -- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다
\ No newline at end of file diff --git a/inc/lang/ko/subscr_list.txt b/inc/lang/ko/subscr_list.txt index c13e0097a..57aa78cf7 100644 --- a/inc/lang/ko/subscr_list.txt +++ b/inc/lang/ko/subscr_list.txt @@ -7,8 +7,8 @@ @DIFF@ -------------------------------------------------------- -이 문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 +문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 @SUBSCRIBE@ 문서를 방문해 문서나 이름공간의 구독을 취소하세요. -- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다.
\ No newline at end of file diff --git a/inc/lang/ko/subscr_single.txt b/inc/lang/ko/subscr_single.txt index d4e38e044..ed5478441 100644 --- a/inc/lang/ko/subscr_single.txt +++ b/inc/lang/ko/subscr_single.txt @@ -13,8 +13,8 @@ 이전 판 : @OLDPAGE@ 새 판 : @NEWPAGE@ -이 문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 +문서의 알림을 취소하려면, @DOKUWIKIURL@에 로그인한 뒤 @SUBSCRIBE@ 문서를 방문해 문서나 이름공간의 구독을 취소하세요. -- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다
\ No newline at end of file diff --git a/inc/lang/ko/uploadmail.txt b/inc/lang/ko/uploadmail.txt index 8e0a4d70b..1304ee331 100644 --- a/inc/lang/ko/uploadmail.txt +++ b/inc/lang/ko/uploadmail.txt @@ -1,4 +1,4 @@ -DokuWiki가 파일을 올렸습니다. 자세한 정보는 다음과 같습니다: +도쿠위키가 파일을 올렸습니다. 자세한 정보는 다음과 같습니다: 파일 : @MEDIA@ 이전 판 : @OLD@ @@ -11,4 +11,4 @@ MIME 종류 : @MIME@ 사용자 : @USER@ -- -@DOKUWIKIURL@의 DokuWiki가 자동으로 만들어낸 메일입니다.
\ No newline at end of file +이 메일은 @DOKUWIKIURL@에서 도쿠위키가 생성했습니다
\ No newline at end of file diff --git a/inc/lang/ku/lang.php b/inc/lang/ku/lang.php index 51ed6c8bf..b6287806d 100644 --- a/inc/lang/ku/lang.php +++ b/inc/lang/ku/lang.php @@ -33,7 +33,6 @@ $lang['btn_back'] = 'Paş'; $lang['btn_backlink'] = 'Girêdanên paş'; $lang['btn_backtomedia'] = 'Back to Mediafile Selection'; $lang['btn_subscribe'] = 'Subscribe Changes'; -$lang['btn_unsubscribe'] = 'Unsubscribe Changes'; $lang['btn_register'] = 'Register'; $lang['loggedinas'] = 'Logged in as'; @@ -123,22 +122,8 @@ $lang['qb_sig'] = 'Insert Signature'; $lang['js']['del_confirm']= 'Delete this entry?'; -$lang['admin_acl'] = 'Access Control List Management...'; $lang['admin_register']= 'Add new user...'; -$lang['acl_group'] = 'Group'; -$lang['acl_user'] = 'User'; -$lang['acl_perms'] = 'Permissions for'; -$lang['page'] = 'Rûpel'; -$lang['namespace'] = 'Namespace'; - -$lang['acl_perm1'] = 'Bixwîne'; -$lang['acl_perm2'] = 'Biguherîne'; -$lang['acl_perm4'] = 'Biafirîne'; -$lang['acl_perm8'] = 'Upload'; -$lang['acl_perm16'] = 'Jê bibe'; -$lang['acl_new'] = 'Add new Entry'; - $lang['metaedit'] = 'Edit Metadata'; $lang['metasaveerr'] = 'Writing metadata failed'; $lang['metasaveok'] = 'Metadata saved'; @@ -154,10 +139,4 @@ $lang['img_format'] = 'Format'; $lang['img_camera'] = 'Camera'; $lang['img_keywords']= 'Keywords'; -$lang['subscribe_success'] = 'Added %s to subscription list for %s'; -$lang['subscribe_error'] = 'Error adding %s to subscription list for %s'; -$lang['subscribe_noaddress']= 'There is no address associated with your login, you cannot be added to the subscription list'; -$lang['unsubscribe_success']= 'Removed %s from subscription list for %s'; -$lang['unsubscribe_error'] = 'Error removing %s from subscription list for %s'; - //Setup VIM: ex: et ts=2 : diff --git a/inc/lang/la/lang.php b/inc/lang/la/lang.php index bea921abc..c71a71bdd 100644 --- a/inc/lang/la/lang.php +++ b/inc/lang/la/lang.php @@ -229,7 +229,6 @@ $lang['subscr_m_receive'] = 'Accipere'; $lang['subscr_style_every'] = 'Cursus mutationibus omnibus'; $lang['subscr_style_digest'] = 'Accipere litteras in mutando paginam (%.2f dies)'; $lang['subscr_style_list'] = 'Index mutatarum paginarum ab extremis litteris (%.2f dies)'; -$lang['authmodfailed'] = 'Confirmatio infeliciter facta est. Rectorem conuenis.'; $lang['authtempfail'] = 'Confirmare non potes. Rectorem conuenis.'; $lang['i_chooselang'] = 'Linguam eligere'; $lang['i_installer'] = 'Docuuicis creator'; diff --git a/inc/lang/lb/lang.php b/inc/lang/lb/lang.php index 76dd2ac15..55113745a 100644 --- a/inc/lang/lb/lang.php +++ b/inc/lang/lb/lang.php @@ -173,7 +173,6 @@ $lang['img_copyr'] = 'Copyright'; $lang['img_format'] = 'Format'; $lang['img_camera'] = 'Kamera'; $lang['img_keywords'] = 'Schlësselwieder'; -$lang['authmodfailed'] = 'Falsch Konfiguratioun vun der Benotzerautentifikatioun. Informéier w.e.g. de Wiki Admin.'; $lang['authtempfail'] = 'D\'Benotzerautentifikatioun ass de Moment net verfügbar. Wann dës Situatioun unhält, dann informéier w.e.g. de Wiki Admin.'; $lang['i_chooselang'] = 'Wiel deng Sprooch'; $lang['i_installer'] = 'DokuWiki Installer'; diff --git a/inc/lang/lt/lang.php b/inc/lang/lt/lang.php index b284555ef..c38ea8838 100644 --- a/inc/lang/lt/lang.php +++ b/inc/lang/lt/lang.php @@ -40,7 +40,6 @@ $lang['btn_back'] = 'Atgal'; $lang['btn_backlink'] = 'Atgalinės nuorodos'; $lang['btn_backtomedia'] = 'Atgal į Mediabylos išsirinkimą'; $lang['btn_subscribe'] = 'Užsisakyti keitimų prenumeratą'; -$lang['btn_unsubscribe'] = 'Atsisakyti keitimų prenumeratos'; $lang['btn_profile'] = 'Atnaujinti profilį'; $lang['btn_reset'] = 'Atstata'; $lang['btn_draft'] = 'Redaguoti juodraštį'; @@ -175,12 +174,6 @@ $lang['img_copyr'] = 'Autorinės teisės'; $lang['img_format'] = 'Formatas'; $lang['img_camera'] = 'Kamera'; $lang['img_keywords'] = 'Raktiniai žodžiai'; -$lang['subscribe_success'] = '%s užsakyta "%s" prenumerata'; -$lang['subscribe_error'] = '%s užsakant "%s" prenumeratą įvyko klaida'; -$lang['subscribe_noaddress'] = 'Jūs nesatė nurodęs el. pašto adreso, todėl negalima Jums užsakyti prenumeratos'; -$lang['unsubscribe_success'] = '%s ištrintas iš "%s" prenumeratos'; -$lang['unsubscribe_error'] = '%s trinant iš "%s" prenumeratos įvyko klaida'; -$lang['authmodfailed'] = 'Bloga vartotojo tapatumo nustatymo konfigūracija. Praneškite apie tai savo administratoriui.'; $lang['authtempfail'] = 'Vartotojo tapatumo nustatymas laikinai nepasiekiamas. Jei ši situacija kartojasi, tai praneškite savo administratoriui.'; $lang['i_chooselang'] = 'Pasirinkite kalbą'; $lang['i_installer'] = 'DokuWiki Instaliatorius'; diff --git a/inc/lang/lv/lang.php b/inc/lang/lv/lang.php index 4d2b5d23c..898125d60 100644 --- a/inc/lang/lv/lang.php +++ b/inc/lang/lv/lang.php @@ -258,7 +258,6 @@ $lang['subscr_m_receive'] = 'Saņemt'; $lang['subscr_style_every'] = 'vēstuli par katru izmaiņu'; $lang['subscr_style_digest'] = 'kopsavilkumu par katru lapu (reizi %.2f dienās)'; $lang['subscr_style_list'] = 'kopš pēdējās vēstules notikušo labojumu sarakstu (reizi %.2f dienās)'; -$lang['authmodfailed'] = 'Aplami konfigurēta lietotāju autentifikācija. Lūdzu ziņo Wiki administratoram.'; $lang['authtempfail'] = 'Lietotāju autentifikācija pašlaik nedarbojas. Ja tas turpinās ilgstoši, lūduz ziņo Wiki administratoram.'; $lang['authpwdexpire'] = 'Tavai parolei pēc %d dienām biegsies termiņš, tā drīzumā jānomaina.'; $lang['i_chooselang'] = 'Izvēlies valodu'; diff --git a/inc/lang/mg/lang.php b/inc/lang/mg/lang.php index e3c7a0c2b..c5ed669a9 100644 --- a/inc/lang/mg/lang.php +++ b/inc/lang/mg/lang.php @@ -116,20 +116,6 @@ $lang['qb_sig'] = 'Manisy sonia'; $lang['js']['del_confirm']= 'Hofafana ilay andalana?'; -$lang['admin_acl'] = 'Fitantanana ACL (Access Control List)...'; $lang['admin_register']= 'Ampio mpampiasa vaovao...'; -$lang['acl_group'] = 'Vondrona'; -$lang['acl_user'] = 'Mpampiasa'; -$lang['acl_perms'] = 'Alalana @'; -$lang['page'] = 'Pejy'; -$lang['namespace'] = 'Namespace'; - -$lang['acl_perm1'] = 'Mamaky'; -$lang['acl_perm2'] = 'Manova'; -$lang['acl_perm4'] = 'Manamboatra'; -$lang['acl_perm8'] = 'Mandefa rakitra'; -$lang['acl_perm16'] = 'Mamafa'; -$lang['acl_new'] = 'Ampio andalana vaovao'; - //Setup VIM: ex: et ts=2 : diff --git a/inc/lang/mk/lang.php b/inc/lang/mk/lang.php index 9e1628562..2b2c9fb7f 100644 --- a/inc/lang/mk/lang.php +++ b/inc/lang/mk/lang.php @@ -196,7 +196,6 @@ $lang['subscr_m_unsubscribe'] = 'Отплатување'; $lang['subscr_m_subscribe'] = 'Претплата'; $lang['subscr_m_receive'] = 'Прими'; $lang['subscr_style_every'] = 'е-пошта за секоја промена'; -$lang['authmodfailed'] = 'Лоша конфигурација за автентикација на корисник. Ве молам информирајте го вики администратор.'; $lang['authtempfail'] = 'Автентикација на корисник е привремено недостапна. Ако оваа ситуација истрајува, ве молам известете го вики администратор.'; $lang['i_chooselang'] = 'Избере јазик'; $lang['i_installer'] = 'Инсталер за DokuWiki'; diff --git a/inc/lang/mr/lang.php b/inc/lang/mr/lang.php index d95813efa..54b69974d 100644 --- a/inc/lang/mr/lang.php +++ b/inc/lang/mr/lang.php @@ -241,7 +241,6 @@ $lang['img_keywords'] = 'मुख्य शब्द'; $lang['img_width'] = 'रुंदी'; $lang['img_height'] = 'उंची'; $lang['img_manager'] = 'मिडिया व्यवस्थापकात बघू'; -$lang['authmodfailed'] = 'सदस्य अधिकृत करण्याची व्यवस्था चुकीची आहे. कृपया तुमच्या विकीच्या व्यवस्थापकाशी सम्पर्क साधा.'; $lang['authtempfail'] = 'सदस्य अधिकृत करण्याची सुविधा सध्या चालू नाही. सतत हा मजकूर दिसल्यास कृपया तुमच्या विकीच्या व्यवस्थापकाशी सम्पर्क साधा.'; $lang['i_chooselang'] = 'तुमची भाषा निवडा'; $lang['i_installer'] = 'डॉक्युविकि इनस्टॉलर'; diff --git a/inc/lang/ne/lang.php b/inc/lang/ne/lang.php index 908b1a1dd..7fd14d2c5 100644 --- a/inc/lang/ne/lang.php +++ b/inc/lang/ne/lang.php @@ -1,6 +1,7 @@ <?php + /** - * Nepali language file + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * * @author Saroj Kumar Dhakal <lotusnagarkot@gmail.com> * @author Saroj Kumar Dhakal <lotusnagarkot@yahoo.com> @@ -37,7 +38,6 @@ $lang['btn_back'] = 'पछाडि'; $lang['btn_backlink'] = 'पछाडिका लिङ्कहरु '; $lang['btn_backtomedia'] = 'मिडिया छनौटमा फर्कनुहोस्'; $lang['btn_subscribe'] = 'पृष्ठ परिवर्तन ग्राह्य गर्नुहोस्'; -$lang['btn_unsubscribe'] = 'पृष्ठ परिवर्तन अग्राह्य गर्नुहोस्'; $lang['btn_profile'] = 'प्रोफाइल अध्यावधिक गर्नुहोस् '; $lang['btn_reset'] = 'पूर्वरुपमा फर्काउनुहोस'; $lang['btn_draft'] = ' ड्राफ्ट सम्पादन गर्नुहोस् '; @@ -85,8 +85,12 @@ $lang['txt_filename'] = 'अर्को रुपमा अपलो $lang['txt_overwrt'] = 'रहेको उहि नामको फाइललाई मेटाउने'; $lang['lockedby'] = 'अहिले ताल्चा लगाइएको'; $lang['lockexpire'] = 'ताल्चा अवधि सकिने :'; -$lang['js']['willexpire'] = 'तपाईलले यो पृष्ठ सम्पादन गर्न लगाउनु भएको ताल्चाको अवधि एक मिनेट भित्र सकिदै छ। \n द्वन्द हुन नदिन पूर्वरुप वा ताल्चा समय परिवर्तन गर्नुहोस् ।'; +$lang['js']['willexpire'] = 'तपाईलले यो पृष्ठ सम्पादन गर्न लगाउनु भएको ताल्चाको अवधि एक मिनेट भित्र सकिदै छ। \n द्वन्द हुन नदिन पूर्वरुप वा ताल्चा समय परिवर्तन गर्नुहोस् ।'; $lang['js']['notsavedyet'] = 'तपाईले वचन गर्नु नभएको परिवर्रन हराउने छ। \n साच्चै जारी गर्नुहुन्छ ।'; +$lang['js']['keepopen'] = 'छनौटमा विन्डो खुला राख्नुहोस् '; +$lang['js']['hidedetails'] = 'जानकारी लुकाउनु होस् '; +$lang['js']['nosmblinks'] = 'विन्डोहरु लिङ्क गर्दा माइक्रो सफ्ट एक्सप्लोररमामात्र काम साझा हुन्छ । तर कपि गर्न र टास्न मिल्छ। '; +$lang['js']['del_confirm'] = 'साच्चै छानिएका वस्तुहरु मेट्ने हो ?'; $lang['rssfailed'] = 'यो फिड लिइ आउदा गल्ति भयो ।'; $lang['nothingfound'] = 'केहि पनि भेटिएन ।'; $lang['mediaselect'] = 'मिडिया फाइलहरू '; @@ -103,9 +107,6 @@ $lang['deletefail'] = '"%s" मेट्न सकिएन - अन $lang['mediainuse'] = 'फाइल "%s" मेटिएको छैन - प्रयोगमा छ।'; $lang['namespaces'] = 'नेमस्पेसहरु '; $lang['mediafiles'] = ' उपलब्ध फाइलहरु '; -$lang['js']['keepopen'] = 'छनौटमा विन्डो खुला राख्नुहोस् '; -$lang['js']['hidedetails'] = 'जानकारी लुकाउनु होस् '; -$lang['js']['nosmblinks'] = 'विन्डोहरु लिङ्क गर्दा माइक्रो सफ्ट एक्सप्लोररमामात्र काम साझा हुन्छ । तर कपि गर्न र टास्न मिल्छ। '; $lang['mediausage'] = 'फाइललाई रेफरेन्स गर्न निम्न सुत्र प्रयोग गर्नुहोस् :'; $lang['mediaview'] = 'सक्कली फाइल हेर्नुहोस् '; $lang['mediaroot'] = 'रुट(मूख्य प्रयोगकर्ता)'; @@ -153,7 +154,6 @@ $lang['qb_media'] = 'तस्विर र अरु फाइल $lang['qb_sig'] = 'हस्ताक्षर थप्नुहोस् '; $lang['qb_smileys'] = 'स्माइलीहरु '; $lang['qb_chars'] = 'विशेष वर्णहरु '; -$lang['js']['del_confirm'] = 'साच्चै छानिएका वस्तुहरु मेट्ने हो ?'; $lang['admin_register'] = 'नयाँ प्रयोगकर्ता थप्नुहोस् '; $lang['metaedit'] = 'मेटाडेटा सम्पादन गर्नुहोस्'; $lang['metasaveerr'] = 'मेटाडाटा लेखन असफल'; @@ -169,12 +169,6 @@ $lang['img_copyr'] = 'सर्वाधिकार'; $lang['img_format'] = 'ढाचा'; $lang['img_camera'] = 'क्यामेरा'; $lang['img_keywords'] = 'खोज शब्द'; -$lang['subscribe_success'] = '%s ,%s को ग्राह्यताको लागि थपियो '; -$lang['subscribe_error'] = '%s ,%s को ग्राह्यताको लागि थपिदा त्रुटि'; -$lang['subscribe_noaddress'] = 'तपाईको खातासँग कुनै पनि ठेगाना संबन्धित छैन , तपाईलाई ग्रहाक सुचीमा राखन मिलेन।'; -$lang['unsubscribe_success'] = '%s लाई %s को ग्रहाक सुचीबाट हटाइयो'; -$lang['unsubscribe_error'] = '%s लाई %s को ग्राहक सुचीबाट हटाउदा त्रुटि'; -$lang['authmodfailed'] = 'खराब प्रयोगकर्ता प्रामाणिकरण विधि ।तपाईको विकी एड्मिनलाई खवर गर्नुहोस् ।'; $lang['authtempfail'] = 'प्रयोगकर्ता प्रामाणिकरण अस्थाइरुपमा अनुपलब्ध छ। यदि यो समस्या रहि रहेमा तपाईको विकि एड्मिनलाई खवर गर्नुहोला ।'; $lang['i_chooselang'] = 'भाषा छान्नुहोस् '; $lang['i_installer'] = 'DokuWiki स्थापक'; diff --git a/inc/lang/nl/lang.php b/inc/lang/nl/lang.php index 18d031cea..cf5c5dae5 100644 --- a/inc/lang/nl/lang.php +++ b/inc/lang/nl/lang.php @@ -1,8 +1,8 @@ <?php + /** - * dutch language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author François Kooman <fkooman.tuxed.net> * @author Jack van Klaren <dokuwiki@afentoe.xs4all.nl> * @author Riny Heijdendael <riny@heijdendael.nl> @@ -17,6 +17,10 @@ * @author Jeroen * @author Ricardo Guijt <ricardoguijt@gmail.com> * @author Gerrit <klapinklapin@gmail.com> + * @author mprins <mprins@users.sf.net> + * @author Gerrit Uitslag <klapinklapin@gmail.com> + * @author Klap-in <klapinklapin@gmail.com> + * @author Remon <no@email.local> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -60,6 +64,7 @@ $lang['btn_revert'] = 'Herstellen'; $lang['btn_register'] = 'Registreren'; $lang['btn_apply'] = 'Toepassen'; $lang['btn_media'] = 'Mediabeheerder'; +$lang['btn_deleteuser'] = 'Verwijder mijn account'; $lang['loggedinas'] = 'Ingelogd als'; $lang['user'] = 'Gebruikersnaam'; $lang['pass'] = 'Wachtwoord'; @@ -71,6 +76,7 @@ $lang['fullname'] = 'Volledige naam'; $lang['email'] = 'E-mail'; $lang['profile'] = 'Gebruikersprofiel'; $lang['badlogin'] = 'Sorry, gebruikersnaam of wachtwoord onjuist'; +$lang['badpassconfirm'] = 'Sorry, het wachtwoord was onjuist'; $lang['minoredit'] = 'Kleine wijziging'; $lang['draftdate'] = 'Concept automatisch opgeslagen op'; $lang['nosecedit'] = 'De pagina is tussentijds veranderd, sectie-informatie was verouderd, volledige pagina geladen.'; @@ -87,6 +93,11 @@ $lang['profna'] = 'Deze wiki ondersteunt geen profielwijzigingen' $lang['profnochange'] = 'Geen wijzigingen, niets gedaan'; $lang['profnoempty'] = 'Een lege gebruikersnaam of e-mailadres is niet toegestaan'; $lang['profchanged'] = 'Gebruikersprofiel succesvol aangepast'; +$lang['profnodelete'] = 'Deze wiki heeft biedt geen ondersteuning voor verwijdering van gebruikers'; +$lang['profdeleteuser'] = 'Verwijder gebruiker'; +$lang['profdeleted'] = 'Uw gebruikersaccount is verwijderd van deze wiki'; +$lang['profconfdelete'] = 'Ik wil mijn gebruikersaccount verwijderen van deze wiki. <br/> Deze actie kan niet ongedaan gemaakt worden.'; +$lang['profconfdeletemissing'] = 'Bevestigingsvinkje niet gezet'; $lang['pwdforget'] = 'Je wachtwoord vergeten? Vraag een nieuw wachtwoord aan'; $lang['resendna'] = 'Deze wiki ondersteunt het verzenden van wachtwoorden niet'; $lang['resendpwd'] = 'Nieuw wachtwoord bepalen voor'; @@ -216,7 +227,7 @@ $lang['changes_type'] = 'Bekijk wijzigingen van'; $lang['pages_changes'] = 'Pagina\'s'; $lang['media_changes'] = 'Mediabestanden'; $lang['both_changes'] = 'Zowel pagina\'s als mediabestanden'; -$lang['qb_bold'] = 'Vette tekst'; +$lang['qb_bold'] = 'Vetgedrukte tekst'; $lang['qb_italic'] = 'Cursieve tekst'; $lang['qb_underl'] = 'Onderstreepte tekst'; $lang['qb_code'] = 'Code tekst'; @@ -261,7 +272,7 @@ $lang['img_height'] = 'Hoogte'; $lang['img_manager'] = 'In mediabeheerder bekijken'; $lang['subscr_subscribe_success'] = '%s is ingeschreven voor %s'; $lang['subscr_subscribe_error'] = 'Fout bij inschrijven van %s voor %s'; -$lang['subscr_subscribe_noaddress'] = 'Er is geen emailadres geassocieerd met uw account, u kunt daardoor niet worden ingeschreven.'; +$lang['subscr_subscribe_noaddress'] = 'Er is geen e-mailadres gekoppeld aan uw account, u kunt daardoor niet worden ingeschreven.'; $lang['subscr_unsubscribe_success'] = '%s is nu uitgeschreven bij %s.'; $lang['subscr_unsubscribe_error'] = 'Fout bij uitschrijven van %s bij %s.'; $lang['subscr_already_subscribed'] = '%s is reeds ingeschreven bij %s.'; @@ -275,7 +286,6 @@ $lang['subscr_m_receive'] = 'Ontvang'; $lang['subscr_style_every'] = 'Email bij iedere wijziging'; $lang['subscr_style_digest'] = 'Samenvattings-email met wijzigingen per pagina (elke %.2f dagen)'; $lang['subscr_style_list'] = 'Lijst van veranderde pagina\'s sinds laatste email (elke %.2f dagen)'; -$lang['authmodfailed'] = 'Ongeldige gebruikersauthenticatie-configuratie. Informeer de wikibeheerder.'; $lang['authtempfail'] = 'Gebruikersauthenticatie is tijdelijk niet beschikbaar. Als deze situatie zich blijft voordoen, informeer dan de wikibeheerder.'; $lang['authpwdexpire'] = 'Je wachtwoord verloopt in %d dagen, je moet het binnenkort veranderen'; $lang['i_chooselang'] = 'Kies je taal'; @@ -335,3 +345,7 @@ $lang['media_perm_read'] = 'Sorry, u heeft niet voldoende rechten om besta $lang['media_perm_upload'] = 'Sorry, u heeft niet voldoende rechten om bestanden te uploaden.'; $lang['media_update'] = 'Upload nieuwe versie'; $lang['media_restore'] = 'Deze versie terugzetten'; +$lang['currentns'] = 'Huidige namespace'; +$lang['searchresult'] = 'Zoekresultaat'; +$lang['plainhtml'] = 'Alleen HTML'; +$lang['wikimarkup'] = 'Wiki Opmaak'; diff --git a/inc/lang/nl/mailtext.txt b/inc/lang/nl/mailtext.txt index dbe35c519..d12093a5b 100644 --- a/inc/lang/nl/mailtext.txt +++ b/inc/lang/nl/mailtext.txt @@ -1,9 +1,9 @@ -Er is een pagina in je DokuWiki toegevoegd of gewijzigd. Hier zijn de details +Er is een pagina in je DokuWiki toegevoegd of gewijzigd. Hier zijn de details: Datum : @DATE@ Browser : @BROWSER@ IP-Adres : @IPADDRESS@ -Hostname : @HOSTNAME@ +Hostnaam : @HOSTNAME@ Oude revisie : @OLDPAGE@ Nieuwe revisie: @NEWPAGE@ Samenvatting : @SUMMARY@ diff --git a/inc/lang/nl/read.txt b/inc/lang/nl/read.txt index fcb791811..2a9bb9a93 100644 --- a/inc/lang/nl/read.txt +++ b/inc/lang/nl/read.txt @@ -1,2 +1,2 @@ -Deze pagina is niet beschrijfbaar. Je kan de broncode bekijken maar niks veranderen. Neem contact op met de beheerder als je denkt dat dit niet klopt. +Deze pagina is alleen-lezen. Je kan de broncode bekijken maar niet veranderen. Neem contact op met de beheerder als je denkt dat dit niet klopt. diff --git a/inc/lang/nl/resendpwd.txt b/inc/lang/nl/resendpwd.txt index ed4617748..3a67587d7 100644 --- a/inc/lang/nl/resendpwd.txt +++ b/inc/lang/nl/resendpwd.txt @@ -1,3 +1,3 @@ ==== Verstuur een nieuw wachtwoord ==== -Voer uw gebruikersnaam in het formulier hieronder in om een nieuw wachtwoord aan te vragen voor deze wiki. Een bevestigingslink zal worden verzonden naar het geregistreerde e-mailadres. +Voer je gebruikersnaam in het formulier hieronder in om een nieuw wachtwoord aan te vragen voor deze wiki. Een bevestigingslink zal worden verzonden naar het geregistreerde e-mailadres. diff --git a/inc/lang/nl/subscr_form.txt b/inc/lang/nl/subscr_form.txt index a554f843e..0f9f2d006 100644 --- a/inc/lang/nl/subscr_form.txt +++ b/inc/lang/nl/subscr_form.txt @@ -1,3 +1,3 @@ ====== Beheer inschrijvingen ====== -Deze pagina stelt u in staat uw inschrijven voor de huidige pagina en namespace te configureren.
\ No newline at end of file +Deze pagina stelt u in staat uw abonnementen voor de huidige pagina en namespace te configureren.
\ No newline at end of file diff --git a/inc/lang/nl/subscr_list.txt b/inc/lang/nl/subscr_list.txt index 5e1a62144..7cde7128e 100644 --- a/inc/lang/nl/subscr_list.txt +++ b/inc/lang/nl/subscr_list.txt @@ -6,7 +6,7 @@ Pagina's in de namespace @PAGE@ van de @TITLE@ wiki zijn veranderd. Hier zijn de @DIFF@ -------------------------------------------------------- -Om het verzenden van deze wijzigingsberichtente te stoppen, logt u in op het wiki op @DOKUWIKIURL@ en navigeert u naar @SUBSCRIBE@. Vervolgens kunt u zich voor elke gewenste pagina of namespace uitschrijven. +Om het verzenden van deze wijzigingsberichten te stoppen, logt u in op het wiki op @DOKUWIKIURL@ en navigeert u naar @SUBSCRIBE@. Vervolgens kunt u zich voor elke gewenste pagina of namespace uitschrijven. -- Deze email is gegenereerd door DokuWiki op @DOKUWIKIURL@
\ No newline at end of file diff --git a/inc/lang/no/lang.php b/inc/lang/no/lang.php index 8235bfb91..254d3c56b 100644 --- a/inc/lang/no/lang.php +++ b/inc/lang/no/lang.php @@ -263,7 +263,6 @@ $lang['subscr_m_receive'] = 'Motta'; $lang['subscr_style_every'] = 'e-post for alle endringer'; $lang['subscr_style_digest'] = 'e-post med sammendrag av endringer for hver side (%.2f dager mellom hver)'; $lang['subscr_style_list'] = 'liste med sider som er endra siden forrige e-post (%.2f dager mellom hver)'; -$lang['authmodfailed'] = 'Feilkonfigurert brukerautorisasjon. Vennligst innformer Wiki-admin.'; $lang['authtempfail'] = 'Brukerautorisasjon er midlertidig utilgjengelig. Om dette vedvarer, vennligst informer Wiki-admin.'; $lang['i_chooselang'] = 'Velg språk'; $lang['i_installer'] = 'DokuWiki-installasjon'; diff --git a/inc/lang/pl/lang.php b/inc/lang/pl/lang.php index 51149e88f..118f0e5ab 100644 --- a/inc/lang/pl/lang.php +++ b/inc/lang/pl/lang.php @@ -265,7 +265,6 @@ $lang['subscr_m_unsubscribe'] = 'Zrezygnuj z subskrypcji'; $lang['subscr_m_subscribe'] = 'Subskrybuj'; $lang['subscr_m_receive'] = 'Otrzymuj'; $lang['subscr_style_every'] = 'email przy każdej zmianie'; -$lang['authmodfailed'] = 'Błąd uwierzytelnienia. Powiadom administratora tego wiki.'; $lang['authtempfail'] = 'Uwierzytelnienie użytkownika jest w tej chwili niemożliwe. Jeśli ta sytuacja się powtórzy, powiadom administratora tego wiki.'; $lang['authpwdexpire'] = 'Twoje hasło wygaśnie za %d dni. Należy je zmienić w krótkim czasie.'; $lang['i_chooselang'] = 'Wybierz język'; diff --git a/inc/lang/pt-br/lang.php b/inc/lang/pt-br/lang.php index a92afc0a0..812799f04 100644 --- a/inc/lang/pt-br/lang.php +++ b/inc/lang/pt-br/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Brazilian Portuguese language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Luis Fernando Enciso <lfenciso@certto.com.br> * @author Alauton/Loug * @author Frederico Gonçalves Guimarães <frederico@teia.bio.br> @@ -20,6 +20,8 @@ * @author Frederico Guimarães <frederico@teia.bio.br> * @author Balaco Baco <balacobaco@imap.cc> * @author Victor Westmann <victor.westmann@gmail.com> + * @author Leone Lisboa Magevski <leone1983@gmail.com> + * @author Dário Estevão <darioems@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -63,6 +65,7 @@ $lang['btn_revert'] = 'Restaurar'; $lang['btn_register'] = 'Cadastre-se'; $lang['btn_apply'] = 'Aplicar'; $lang['btn_media'] = 'Gerenciador de mídias'; +$lang['btn_deleteuser'] = 'Remover minha conta'; $lang['loggedinas'] = 'Identificado(a) como'; $lang['user'] = 'Nome de usuário'; $lang['pass'] = 'Senha'; @@ -74,6 +77,7 @@ $lang['fullname'] = 'Nome completo'; $lang['email'] = 'E-mail'; $lang['profile'] = 'Perfil do usuário'; $lang['badlogin'] = 'Desculpe, mas o nome de usuário ou a senha estão incorretos.'; +$lang['badpassconfirm'] = 'Desculpe, mas a senha está errada '; $lang['minoredit'] = 'Alterações mínimas'; $lang['draftdate'] = 'O rascunho foi salvo automaticamente em'; $lang['nosecedit'] = 'A página foi modificada nesse intervalo de tempo. Como a informação da seção estava desatualizada, foi carregada a página inteira.'; @@ -90,6 +94,9 @@ $lang['profna'] = 'Esse wiki não suporta modificações do perfi $lang['profnochange'] = 'Sem alterações, nada para fazer.'; $lang['profnoempty'] = 'Não são permitidos nomes ou endereços de e-mail em branco.'; $lang['profchanged'] = 'O perfil do usuário foi atualizado com sucesso.'; +$lang['profnodelete'] = 'Esse wiki não suporta a exclusão de usuários '; +$lang['profdeleteuser'] = 'Excluir a conta'; +$lang['profdeleted'] = 'Sua conta de usuário foi excluída desse wiki'; $lang['pwdforget'] = 'Esqueceu sua senha? Solicite outra'; $lang['resendna'] = 'Esse wiki não tem suporte para o reenvio de senhas.'; $lang['resendpwd'] = 'Definir a nova senha para'; @@ -274,7 +281,6 @@ $lang['subscr_m_receive'] = 'Receber'; $lang['subscr_style_every'] = 'um e-mail a cada modificação'; $lang['subscr_style_digest'] = 'um agrupamento de e-mails com as mudanças para cada página (a cada %.2f dias)'; $lang['subscr_style_list'] = 'uma lista de páginas modificadas desde o último e-mail (a cada %.2f dias)'; -$lang['authmodfailed'] = 'A configuração da autenticação de usuário está com problemas. Por favor, informe ao administrador do wiki.'; $lang['authtempfail'] = 'A autenticação de usuários está temporariamente desabilitada. Se essa situação persistir, por favor, informe ao administrador do Wiki.'; $lang['authpwdexpire'] = 'Sua senha vai expirar em %d dias. Você deve mudá-la assim que for possível.'; $lang['i_chooselang'] = 'Selecione o seu idioma'; diff --git a/inc/lang/pt/lang.php b/inc/lang/pt/lang.php index ac9c59c3e..46405c444 100644 --- a/inc/lang/pt/lang.php +++ b/inc/lang/pt/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Portuguese language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author José Carlos Monteiro <jose.c.monteiro@netcabo.pt> * @author José Monteiro <Jose.Monteiro@DoWeDo-IT.com> * @author Enrico Nicoletto <liverig@gmail.com> @@ -12,12 +12,11 @@ */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; -$lang['doublequoteopening'] = '“';//“ -$lang['doublequoteclosing'] = '”';//” -$lang['singlequoteopening'] = '‘';//‘ -$lang['singlequoteclosing'] = '’';//’ -$lang['apostrophe'] = '’';//’ - +$lang['doublequoteopening'] = '“'; +$lang['doublequoteclosing'] = '”'; +$lang['singlequoteopening'] = '‘'; +$lang['singlequoteclosing'] = '’'; +$lang['apostrophe'] = '’'; $lang['btn_edit'] = 'Editar página'; $lang['btn_source'] = 'Ver fonte'; $lang['btn_show'] = 'Ver página'; @@ -52,7 +51,7 @@ $lang['btn_revert'] = 'Restaurar'; $lang['btn_register'] = 'Registar'; $lang['btn_apply'] = 'Aplicar'; $lang['btn_media'] = 'Gestor de Media'; - +$lang['btn_deleteuser'] = 'Remover a Minha Conta'; $lang['loggedinas'] = 'Está em sessão como'; $lang['user'] = 'Utilizador'; $lang['pass'] = 'Senha'; @@ -67,7 +66,6 @@ $lang['badlogin'] = 'O utilizador inválido ou senha inválida.'; $lang['minoredit'] = 'Alterações Menores'; $lang['draftdate'] = 'Rascunho automaticamente gravado em'; $lang['nosecedit'] = 'A página foi modificada entretanto. Como a informação da secção estava desactualizada, foi carregada a página inteira.'; - $lang['regmissing'] = 'Por favor, preencha todos os campos.'; $lang['reguexists'] = 'Este utilizador já está inscrito. Por favor escolha outro nome de utilizador.'; $lang['regsuccess'] = 'O utilizador foi criado e a senha foi enviada para o endereço de correio electrónico usado na inscrição.'; @@ -77,12 +75,13 @@ $lang['regbadmail'] = 'O endereço de correio electrónico é inváli $lang['regbadpass'] = 'As duas senhas não são idênticas, por favor tente de novo.'; $lang['regpwmail'] = 'A sua senha DokuWiki'; $lang['reghere'] = 'Para se registar, clique em'; - $lang['profna'] = 'Este Wiki não suporta modificações aos perfis.'; $lang['profnochange'] = 'Nada alteração, nada a fazer.'; $lang['profnoempty'] = 'Não são permitidos nomes ou endereços em branco.'; $lang['profchanged'] = 'Perfil do utilizador actualizado com sucesso.'; - +$lang['profnodelete'] = 'Esta wiki não suporta remoção de utilizadores'; +$lang['profdeleteuser'] = 'Apagar Conta'; +$lang['profdeleted'] = 'A sua conta de utilizador foi removida desta wiki'; $lang['pwdforget'] = 'Esqueceu a sua senha? Pedir nova senha'; $lang['resendna'] = 'Este wiki não suporta reenvio de senhas.'; $lang['resendpwdmissing'] = 'É preciso preencher todos os campos.'; @@ -90,10 +89,8 @@ $lang['resendpwdnouser'] = 'Não foi possível encontrar este utilizador.' $lang['resendpwdbadauth'] = 'O código de autenticação não é válido. Por favor, assegure-se de que o link de confirmação está completo.'; $lang['resendpwdconfirm'] = 'O link de confirmação foi enviado por e-mail.'; $lang['resendpwdsuccess'] = 'A nova senha foi enviada por e-mail.'; - $lang['license'] = 'Excepto menção em contrário, o conteúdo neste wiki está sob a seguinte licença:'; $lang['licenseok'] = 'Nota: Ao editar esta página você aceita disponibilizar o seu conteúdo sob a seguinte licença:'; - $lang['searchmedia'] = 'Procurar nome de ficheiro:'; $lang['searchmedia_in'] = 'Procurar em %s'; $lang['txt_upload'] = 'Escolha ficheiro para carregar'; @@ -102,9 +99,7 @@ $lang['txt_overwrt'] = 'Escrever por cima do ficheiro já existente'; $lang['lockedby'] = 'Bloqueado por'; $lang['lockexpire'] = 'Expira em'; $lang['js']['willexpire'] = 'O bloqueio de edição para este documento irá expirar num minuto.\nPara evitar conflitos use o botão Prever para re-iniciar o temporizador de bloqueio.'; - $lang['js']['notsavedyet'] = 'Alterações não gravadas serão perdidas.'; - $lang['js']['searchmedia'] = 'Procurar por ficheiros'; $lang['js']['keepopen'] = 'Mantenha a janela aberta durante a selecção'; $lang['js']['hidedetails'] = 'Esconder Detalhes'; @@ -135,6 +130,16 @@ $lang['js']['linkwiz'] = 'Assistente de Criação de Ligação'; $lang['js']['linkto'] = 'Ligação para:'; $lang['js']['del_confirm'] = 'Remover o(s) item(s) selecionados?'; $lang['js']['restore_confirm'] = 'Restaurar esta versão?'; +$lang['js']['media_diff'] = 'Ver diferenças:'; +$lang['js']['media_diff_both'] = 'Lado a Lado'; +$lang['js']['media_diff_opacity'] = 'Sobreposição'; +$lang['js']['media_diff_portions'] = 'Slider'; +$lang['js']['media_select'] = 'Selecione ficheiros…'; +$lang['js']['media_upload_btn'] = 'Enviar'; +$lang['js']['media_done_btn'] = 'Feito'; +$lang['js']['media_drop'] = 'Largue ficheiros aqui para enviar'; +$lang['js']['media_cancel'] = 'remover'; +$lang['js']['media_overwrt'] = 'Escrever por cima de ficheiros existentes'; $lang['rssfailed'] = 'Ocorreu um erro neste canal RSS: '; $lang['nothingfound'] = 'Nada foi encontrado.'; $lang['mediaselect'] = 'Selecção de ficheiros'; @@ -184,15 +189,21 @@ $lang['external_edit'] = 'Edição externa'; $lang['summary'] = 'Sumário da Edição'; $lang['noflash'] = 'O <a href="http://www.adobe.com/products/flashplayer/">Plugin Adobe Flash</a> é necessário para exibir este conteúdo.'; $lang['download'] = 'Descarregar Snippet'; -$lang['changes_type'] = 'Ver alterações de'; -$lang['pages_changes'] = 'Páginas'; -$lang['media_changes'] = 'Ficheiros Media'; -$lang['both_changes'] = 'Tanto páginas como ficheiros media'; +$lang['tools'] = 'Ferramentas'; +$lang['user_tools'] = 'Ferramentas de Utilizador'; +$lang['site_tools'] = 'Ferramentas de Site'; +$lang['page_tools'] = 'Ferramentas de Página'; +$lang['skip_to_content'] = 'saltar para conteúdo'; +$lang['sidebar'] = 'Barra Lateral'; $lang['mail_newpage'] = 'documento adicionado:'; $lang['mail_changed'] = 'documento modificado:'; $lang['mail_subscribe_list'] = 'páginas alteradas no espaço de nome:'; $lang['mail_new_user'] = 'Novo utilizador:'; $lang['mail_upload'] = 'Ficheiro carregado:'; +$lang['changes_type'] = 'Ver alterações de'; +$lang['pages_changes'] = 'Páginas'; +$lang['media_changes'] = 'Ficheiros Media'; +$lang['both_changes'] = 'Tanto páginas como ficheiros media'; $lang['qb_bold'] = 'Texto com Ênfase'; $lang['qb_italic'] = 'Texto Itálico'; $lang['qb_underl'] = 'Texto Sublinhado'; @@ -252,8 +263,8 @@ $lang['subscr_m_receive'] = 'Receber'; $lang['subscr_style_every'] = 'email em qualquer alteração'; $lang['subscr_style_digest'] = '"digest email" de alterações em cada página (cada %.2f dias)'; $lang['subscr_style_list'] = 'lista de páginas alteradas desde o último email (cada %.2f dias)'; -$lang['authmodfailed'] = 'Configuração de autenticação errada. Por favor, informe o Wiki Admin.'; $lang['authtempfail'] = 'Autenticação temporariamente indisponível. Se a situação persistir, por favor informe o Wiki Admin.'; +$lang['authpwdexpire'] = 'A sua senha expirará dentro de %d dias, deve mudá-la em breve.'; $lang['i_chooselang'] = 'Escolha a linguagem'; $lang['i_installer'] = 'Instalador do DokuWiki'; $lang['i_wikiname'] = 'Nome Wiki'; @@ -276,6 +287,9 @@ $lang['i_pol1'] = 'Wiki Público (ler para todos, escrever e carr $lang['i_pol2'] = 'Wiki Fechado (ler, escrever e carregar somente para utilizadores inscritos)'; $lang['i_retry'] = 'Repetir'; $lang['i_license'] = 'Por favor escolha a licença sob a qual quer colocar o seu conteúdo:'; +$lang['i_license_none'] = 'Não mostrar nenhuma informação de licença'; +$lang['i_pop_field'] = 'Por favor ajude-nos a melhorar a experiência Dokuwiki:'; +$lang['i_pop_label'] = 'Uma vez por mês, enviar dados anónimos de uso para os desenvolvedores DokuWiki'; $lang['recent_global'] = 'Você está a observar as alterações dentro do espaço de nomes <b>%s</b>. Também é possível ver as <a href="%s">modificações recentes no wiki inteiro</a>.'; $lang['years'] = '%d anos atrás'; $lang['months'] = '%d meses atrás'; @@ -285,35 +299,23 @@ $lang['hours'] = '%d horas atrás'; $lang['minutes'] = '%d minutos atrás'; $lang['seconds'] = '%d segundos atrás'; $lang['wordblock'] = 'A sua alteração não foi guardada porque contém texto bloqueado (spam).'; - -$lang['media_uploadtab'] = 'Enviar'; -$lang['media_searchtab'] = 'Procurar'; -$lang['media_viewtab'] = 'Ver'; -$lang['media_edittab'] = 'Editar'; -$lang['media_historytab'] = 'Histórico'; -$lang['media_sort'] = 'Ordenar'; -$lang['media_sort_name'] = 'Ordenar por nome'; -$lang['media_sort_date'] = 'Ordenar por data'; -$lang['media_upload'] = 'Enviar para o grupo <strong>%s</strong>.'; -$lang['media_search'] = 'Procurar no grupo <strong>%s</strong>.'; -$lang['media_view'] = '%s'; -$lang['media_edit'] = 'Editar %s'; -$lang['media_history'] = 'Histórico do %s'; -$lang['media_meta_edited']= 'metadata editada'; -$lang['media_perm_read'] = 'Perdão, não tem permissão para ler ficheiros.'; -$lang['media_perm_upload']= 'Perdão, não tem permissão para enviar ficheiros.'; -$lang['media_update'] = 'enviar nova versão'; -$lang['media_restore'] = 'Restaurar esta versão'; - -$lang['js']['media_diff'] = 'Ver diferenças:'; -$lang['js']['media_diff_both'] = 'Lado a Lado'; -$lang['js']['media_diff_opacity'] = 'Sobreposição'; -$lang['js']['media_diff_portions'] = 'Slider'; // Needs translation. 'Deslizador' ? - -$lang['js']['media_select'] = 'Selecione ficheiros…'; -$lang['js']['media_upload_btn'] = 'Enviar'; -$lang['js']['media_done_btn'] = 'Feito'; -$lang['js']['media_drop'] = 'Largue ficheiros aqui para enviar'; -$lang['js']['media_cancel'] = 'remover'; -$lang['js']['media_overwrt'] = 'Escrever por cima de ficheiros existentes'; - +$lang['media_uploadtab'] = 'Enviar'; +$lang['media_searchtab'] = 'Procurar'; +$lang['media_file'] = 'Ficheiro'; +$lang['media_viewtab'] = 'Ver'; +$lang['media_edittab'] = 'Editar'; +$lang['media_historytab'] = 'Histórico'; +$lang['media_list_rows'] = 'Linhas'; +$lang['media_sort_name'] = 'Ordenar por nome'; +$lang['media_sort_date'] = 'Ordenar por data'; +$lang['media_files'] = 'Ficheiros em %s'; +$lang['media_upload'] = 'Enviar para o grupo <strong>%s</strong>.'; +$lang['media_search'] = 'Procurar no grupo <strong>%s</strong>.'; +$lang['media_view'] = '%s'; +$lang['media_edit'] = 'Editar %s'; +$lang['media_history'] = 'Histórico do %s'; +$lang['media_meta_edited'] = 'metadata editada'; +$lang['media_perm_read'] = 'Perdão, não tem permissão para ler ficheiros.'; +$lang['media_perm_upload'] = 'Perdão, não tem permissão para enviar ficheiros.'; +$lang['media_update'] = 'enviar nova versão'; +$lang['media_restore'] = 'Restaurar esta versão'; diff --git a/inc/lang/ro/lang.php b/inc/lang/ro/lang.php index 797d1a917..028c55a20 100644 --- a/inc/lang/ro/lang.php +++ b/inc/lang/ro/lang.php @@ -21,7 +21,7 @@ $lang['apostrophe'] = '\''; $lang['btn_edit'] = 'Editează această pagină'; $lang['btn_source'] = 'Arată sursa paginii'; $lang['btn_show'] = 'Arată pagina'; -$lang['btn_create'] = 'Crează această pagină'; +$lang['btn_create'] = 'Creează această pagină'; $lang['btn_search'] = 'Caută'; $lang['btn_save'] = 'Salvează'; $lang['btn_preview'] = 'Previzualizează'; @@ -34,18 +34,18 @@ $lang['btn_upload'] = 'Upload'; $lang['btn_cancel'] = 'Renunțare'; $lang['btn_index'] = 'Index'; $lang['btn_secedit'] = 'Editează'; -$lang['btn_login'] = 'Login'; -$lang['btn_logout'] = 'Logout'; -$lang['btn_admin'] = 'Admin'; +$lang['btn_login'] = 'Autentificare'; +$lang['btn_logout'] = 'Deconectare'; +$lang['btn_admin'] = 'Administrativ'; $lang['btn_update'] = 'Actualizează'; $lang['btn_delete'] = 'Șterge'; $lang['btn_back'] = 'Înapoi'; $lang['btn_backlink'] = 'Legătură anterioară'; -$lang['btn_backtomedia'] = 'Înapoi la Selecția Mediafile'; -$lang['btn_subscribe'] = 'Subscrie Modificarea Paginii'; -$lang['btn_profile'] = 'Actualizează Profil'; +$lang['btn_backtomedia'] = 'Înapoi la selecția mediafile'; +$lang['btn_subscribe'] = 'Subscrie modificarea paginii'; +$lang['btn_profile'] = 'Actualizează profil'; $lang['btn_reset'] = 'Resetează'; -$lang['btn_resendpwd'] = 'Setează o parolă nouă'; +$lang['btn_resendpwd'] = 'Configurează o parolă nouă'; $lang['btn_draft'] = 'Editează schiță'; $lang['btn_recover'] = 'Recuperează schiță'; $lang['btn_draftdel'] = 'Șterge schiță'; @@ -58,51 +58,51 @@ $lang['user'] = 'Utilizator'; $lang['pass'] = 'Parola'; $lang['newpass'] = 'Parola nouă'; $lang['oldpass'] = 'Confirmă parola curentă'; -$lang['passchk'] = 'încă o dată'; +$lang['passchk'] = 'Încă o dată'; $lang['remember'] = 'Ține-mă minte'; $lang['fullname'] = 'Nume complet'; -$lang['email'] = 'E-Mail'; -$lang['profile'] = 'Profil Utilizator'; -$lang['badlogin'] = 'Imi pare rău, utilizatorul și/sau parola au fost greșite.'; -$lang['minoredit'] = 'Modificare Minoră'; +$lang['email'] = 'E-mail'; +$lang['profile'] = 'Profil utilizator'; +$lang['badlogin'] = 'Ne pare rău, utilizatorul și/sau parola au fost greșite.'; +$lang['minoredit'] = 'Modificare minoră'; $lang['draftdate'] = 'Schiță salvată automat la'; $lang['nosecedit'] = 'Pagina s-a modificat între timp, secțiunea info a expirat, s-a încărcat pagina întreagă în loc.'; $lang['regmissing'] = 'Ne pare rău, trebuie să completezi toate cîmpurile.'; -$lang['reguexists'] = 'Ne pare rău, un utilizator cu acest nume există deja logat.'; -$lang['regsuccess'] = 'Utilizatorul a fost creat. Parola a fost trimisă prin email.'; +$lang['reguexists'] = 'Ne pare rău, un utilizator cu acest nume este deja autentificat.'; +$lang['regsuccess'] = 'Utilizatorul a fost creat. Parola a fost trimisă prin e-mail.'; $lang['regsuccess2'] = 'Utilizatorul a fost creat.'; -$lang['regmailfail'] = 'Se pare că a fost o eroare la trimiterea parolei prin email. Contactați administratorul!'; -$lang['regbadmail'] = 'Adresa de email este invalidă - dacă credeți că este o eroare contactați administratorul.'; +$lang['regmailfail'] = 'Se pare că a fost o eroare la trimiterea parolei prin e-mail. Contactează administratorul!'; +$lang['regbadmail'] = 'Adresa de e-mail este nevalidă - dacă sunteți de părere că este o eroare contactează administratorul.'; $lang['regbadpass'] = 'Cele două parole furnizate nu sunt identice; încercați din nou.'; $lang['regpwmail'] = 'Parola ta DokuWiki'; -$lang['reghere'] = 'Înca nu ai un cont? Fă-ți unul'; -$lang['profna'] = 'Această wiki nu suportă modificarea profilului'; +$lang['reghere'] = 'Înca nu ai un cont? Fă-ți unul!'; +$lang['profna'] = 'Acest wiki nu permite modificarea profilului'; $lang['profnochange'] = 'Nici o modificare; nimic de făcut.'; -$lang['profnoempty'] = 'Nu sunt admise numele sau adresa de email necompletate.'; -$lang['profchanged'] = 'Profilul de utilizator a fost actualizat succes.'; -$lang['pwdforget'] = 'Parola uitată? Luați una nouă'; -$lang['resendna'] = 'Această wiki nu suportă retrimiterea parolei.'; -$lang['resendpwd'] = 'Setează o parolă nouă pentru'; +$lang['profnoempty'] = 'Nu sunt admise numele sau adresa de e-mail necompletate.'; +$lang['profchanged'] = 'Profilul de utilizator a fost actualizat cu succes.'; +$lang['pwdforget'] = 'Parola uitată? Obține una nouă!'; +$lang['resendna'] = 'Acest wiki nu permite retrimiterea parolei.'; +$lang['resendpwd'] = 'Configurează o parolă nouă pentru'; $lang['resendpwdmissing'] = 'Ne pare rău, trebuie completate toate câmpurile.'; $lang['resendpwdnouser'] = 'Ne pare rău, acest utilizator nu poate fi găsit în baza de date.'; -$lang['resendpwdbadauth'] = 'Ne pare rău, acest cod de autorizare nu este corect. Verificați dacă ați folosit tot link-ul de confirmare.'; -$lang['resendpwdconfirm'] = 'Un link de confirmare a fost trimis prin email.'; -$lang['resendpwdsuccess'] = 'Parola nouă'; +$lang['resendpwdbadauth'] = 'Ne pare rău, acest cod de autorizare nu este corect. Verifică dacă ai folosit întreg link-ul de confirmare.'; +$lang['resendpwdconfirm'] = 'Un link de confirmare a fost trimis prin e-mail.'; +$lang['resendpwdsuccess'] = 'Noua parolă a fost trimisă prin e-mail.'; $lang['license'] = 'Exceptând locurile unde este altfel specificat, conținutul acestui wiki este licențiat sub următoarea licență:'; -$lang['licenseok'] = 'Notă: Prin editarea acestei pagini sunteți de acord să vă licențiați conțintul sub următoarea licență:'; +$lang['licenseok'] = 'Notă: Prin editarea acestei pagini ești de acord să publici conțintul sub următoarea licență:'; $lang['searchmedia'] = 'Caută numele fișierului:'; $lang['searchmedia_in'] = 'Caută în %s'; -$lang['txt_upload'] = 'Selectează fisierul de încărcat'; +$lang['txt_upload'] = 'Selectează fișierul de încărcat'; $lang['txt_filename'] = 'Încarcă fișierul ca (opțional)'; $lang['txt_overwrt'] = 'Suprascrie fișierul existent'; $lang['lockedby'] = 'Momentan blocat de'; $lang['lockexpire'] = 'Blocarea expiră la'; $lang['js']['willexpire'] = 'Blocarea pentru editarea paginii expiră intr-un minut.\nPentru a preveni conflictele folosește butonul de previzualizare pentru resetarea blocării.'; -$lang['js']['notsavedyet'] = 'Există modificări nesalvate, care se vor pierde. +$lang['js']['notsavedyet'] = 'Există modificări nesalvate care se vor pierde. Dorești să continui?'; $lang['js']['searchmedia'] = 'Caută fișiere'; $lang['js']['keepopen'] = 'Menține fereastra deschisă la selecție'; -$lang['js']['hidedetails'] = 'Ascunde Detalii'; +$lang['js']['hidedetails'] = 'Ascunde detalii'; $lang['js']['mediatitle'] = 'Setări link'; $lang['js']['mediadisplay'] = 'Tip link'; $lang['js']['mediaalign'] = 'Aliniere'; @@ -110,26 +110,26 @@ $lang['js']['mediasize'] = 'Mărime imagine'; $lang['js']['mediatarget'] = 'Țintă link'; $lang['js']['mediaclose'] = 'Închide'; $lang['js']['mediainsert'] = 'Inserează'; -$lang['js']['mediadisplayimg'] = 'Afișează imaginea.'; -$lang['js']['mediadisplaylnk'] = 'Afișează doar linkul.'; +$lang['js']['mediadisplayimg'] = 'Afișează imaginea'; +$lang['js']['mediadisplaylnk'] = 'Afișează doar linkul'; $lang['js']['mediasmall'] = 'Versiune mică'; $lang['js']['mediamedium'] = 'Versiune medie'; $lang['js']['medialarge'] = 'Versiune mare'; -$lang['js']['mediaoriginal'] = 'Versiune originală'; +$lang['js']['mediaoriginal'] = 'Versiune inițială'; $lang['js']['medialnk'] = 'Link către pagina detaliilor'; -$lang['js']['mediadirect'] = 'Link direct către original'; +$lang['js']['mediadirect'] = 'Link direct către versiunea inițială'; $lang['js']['medianolnk'] = 'Fără link'; $lang['js']['medianolink'] = 'Nu crea link către imagine'; -$lang['js']['medialeft'] = 'Aliniază imaginea la stânga.'; -$lang['js']['mediaright'] = 'Aliniază imaginea la dreapta.'; -$lang['js']['mediacenter'] = 'Aliniază imaginea la centru.'; -$lang['js']['medianoalign'] = 'Nu utiliza aliniere.'; -$lang['js']['nosmblinks'] = 'Legăturile către sharing-uri Windows funcționeaza numai in Microsoft Internet Explorer. -Puteți însă copia și insera legătura.'; +$lang['js']['medialeft'] = 'Aliniază imaginea la stânga'; +$lang['js']['mediaright'] = 'Aliniază imaginea la dreapta'; +$lang['js']['mediacenter'] = 'Aliniază imaginea la centru'; +$lang['js']['medianoalign'] = 'Nu utiliza aliniere'; +$lang['js']['nosmblinks'] = 'Link-urile către sharing-uri Windows funcționeaza numai în Microsoft Internet Explorer. +Poți însă copia și insera link-ul.'; $lang['js']['linkwiz'] = 'Asistent legătură'; $lang['js']['linkto'] = 'Legătură la:'; -$lang['js']['del_confirm'] = 'Doriți într-adevăr ștergerea elementelor selectate?'; -$lang['js']['restore_confirm'] = 'Sunteți sigur că doriți restaurarea acestei versiuni?'; +$lang['js']['del_confirm'] = 'Ești sigur de ștergerea elementele selectate?'; +$lang['js']['restore_confirm'] = 'Ești sigur de restaurarea acestei versiuni?'; $lang['js']['media_diff'] = 'Arată diferențele:'; $lang['js']['media_diff_both'] = 'Unul lângă altul'; $lang['js']['media_diff_opacity'] = 'Străveziu'; @@ -138,40 +138,40 @@ $lang['js']['media_select'] = 'Selectează fișierele...'; $lang['js']['media_upload_btn'] = 'Încarcă'; $lang['js']['media_done_btn'] = 'Gata'; $lang['js']['media_drop'] = 'Lasă fișierele aici pentru încărcarea lor'; -$lang['js']['media_cancel'] = 'înlătură'; +$lang['js']['media_cancel'] = 'Înlătură'; $lang['js']['media_overwrt'] = 'Suprascrie fișierele deja existente'; -$lang['rssfailed'] = 'A apărut o eroare in timpul descărcării acestui cîmp: '; +$lang['rssfailed'] = 'A apărut o eroare in timpul descărcării acestui câmp: '; $lang['nothingfound'] = 'Nu am găsit nimic.'; -$lang['mediaselect'] = 'Selectare fișiere media'; -$lang['fileupload'] = 'Încarcă fișier media'; +$lang['mediaselect'] = 'Fișiere media'; +$lang['fileupload'] = 'Încarcare fișier media'; $lang['uploadsucc'] = 'Încărcare reușită'; $lang['uploadfail'] = 'Încărcare eșuată. Poate din cauza permisiunilor?'; $lang['uploadwrong'] = 'Încărcare nepermisă. Extensia fișierului e nepermisă'; $lang['uploadexist'] = 'Fișierul există deja. Nimic nu a fost făcut.'; $lang['uploadbadcontent'] = 'Conținutul încărcat nu corespunde extensiei fișierului %s.'; -$lang['uploadspam'] = 'Încărcarea a fost blocată datorită listei negre de spam.'; -$lang['uploadxss'] = 'Încărcarea a fost blocată datorită unui posibil conținut dăunător.'; +$lang['uploadspam'] = 'Încărcarea a fost blocată din cauza listei negre de spam.'; +$lang['uploadxss'] = 'Încărcarea a fost blocată din cauza unui posibil conținut dăunător.'; $lang['uploadsize'] = 'Fișierul uploadat a fost prea mare. (max %s)'; $lang['deletesucc'] = 'Fișierul "%s" a fost șters.'; -$lang['deletefail'] = '"%s" nu a putut fi șters - verificați drepturile.'; +$lang['deletefail'] = '"%s" nu a putut fi șters - verifică permisiunile.'; $lang['mediainuse'] = 'Fișierul "%s" nu a fost șters - este încă în uz.'; $lang['namespaces'] = 'Spații de nume'; $lang['mediafiles'] = 'Fișiere disponibile în'; -$lang['accessdenied'] = 'Nu vă este permis să vizualizați această pagină.'; -$lang['mediausage'] = 'Folosiți următoarea sintaxă pentru a face referință la acest fișier:'; -$lang['mediaview'] = 'Vizualizează fișierul original'; +$lang['accessdenied'] = 'Nu îți este permis să vizualizezi această pagină.'; +$lang['mediausage'] = 'Folosește următoarea sintaxă pentru a face referință la acest fișier:'; +$lang['mediaview'] = 'Vizualizează fișierul inițial'; $lang['mediaroot'] = 'root'; $lang['mediaupload'] = 'Încarcă un fișier in acest spațiu de nume. Pentru a crea sub-spații de nume, adaugă-le la fișierul de încărcat, separate de doua puncte (:).'; -$lang['mediaextchange'] = 'Extensia fișierului a fost modificată din .%s în .%s!'; +$lang['mediaextchange'] = 'Extensia fișierului a fost modificată din .%s în .%s.'; $lang['reference'] = 'Referință pentru'; -$lang['ref_inuse'] = 'Fișierul nu a putut fi șters întrucât este folosit încă de următoarele pagini:'; -$lang['ref_hidden'] = 'Nu aveți permisiunea să citiți o parte din referințele din pagină.'; -$lang['hits'] = 'Hituri'; +$lang['ref_inuse'] = 'Fișierul nu a putut fi șters întrucât este folosit de următoarele pagini:'; +$lang['ref_hidden'] = 'Nu ai permisiunea să citești o parte din referințele din pagină.'; +$lang['hits'] = 'Accese'; $lang['quickhits'] = 'Nume de pagini potrivite'; $lang['toc'] = 'Cuprins'; $lang['current'] = 'curent'; $lang['yours'] = 'Versiunea ta'; -$lang['diff'] = 'arată diferențele față de versiunea curentă'; +$lang['diff'] = 'Arată diferențele față de versiunea curentă'; $lang['diff2'] = 'Arată diferențele dintre versiunile selectate'; $lang['difflink'] = 'Link către această vizualizare comparativă'; $lang['diff_type'] = 'Vezi diferențe:'; @@ -179,7 +179,7 @@ $lang['diff_inline'] = 'Succesiv'; $lang['diff_side'] = 'Alăturate'; $lang['line'] = 'Linia'; $lang['breadcrumb'] = 'Traseu'; -$lang['youarehere'] = 'Sunteți aici'; +$lang['youarehere'] = 'Ești aici'; $lang['lastmod'] = 'Ultima modificare'; $lang['by'] = 'de către'; $lang['deleted'] = 'șters'; @@ -191,11 +191,11 @@ $lang['noflash'] = 'Plugin-ul <a href="http://www.adobe.com/produc $lang['download'] = 'Bloc descărcări'; $lang['tools'] = 'Unelte'; $lang['user_tools'] = 'Unelte utilizator'; -$lang['site_tools'] = 'Unelte Site'; -$lang['page_tools'] = 'Unelte Pagină'; -$lang['skip_to_content'] = 'sari la conținut'; -$lang['mail_newpage'] = 'pagina adăugată:'; -$lang['mail_changed'] = 'page schimbată:'; +$lang['site_tools'] = 'Unelte site'; +$lang['page_tools'] = 'Unelte pagină'; +$lang['skip_to_content'] = 'mergi la conținut'; +$lang['mail_newpage'] = 'pagină adăugată:'; +$lang['mail_changed'] = 'pagină schimbată:'; $lang['mail_subscribe_list'] = 'pagini modificate în spațiul de nume:'; $lang['mail_new_user'] = 'utilizator nou'; $lang['mail_upload'] = 'fișier încărcat:'; @@ -203,43 +203,43 @@ $lang['changes_type'] = 'Vizualizare modificări'; $lang['pages_changes'] = 'Pagini'; $lang['media_changes'] = 'Fișiere media'; $lang['both_changes'] = 'Ambele pagini și fișiere media'; -$lang['qb_bold'] = 'Text Îngroșat'; -$lang['qb_italic'] = 'Text Italic'; -$lang['qb_underl'] = 'Text Subliniat'; -$lang['qb_code'] = 'Text Cod'; -$lang['qb_strike'] = 'Text Tăiat'; -$lang['qb_h1'] = 'Titlu de Nivel 1'; -$lang['qb_h2'] = 'Titlu de Nivel 2'; -$lang['qb_h3'] = 'Titlu de Nivel 3'; -$lang['qb_h4'] = 'Titlu de Nivel 4'; -$lang['qb_h5'] = 'Titlu de Nivel 5'; +$lang['qb_bold'] = 'Text aldin'; +$lang['qb_italic'] = 'Text cursiv'; +$lang['qb_underl'] = 'Text subliniat'; +$lang['qb_code'] = 'Text cod'; +$lang['qb_strike'] = 'Text tăiat'; +$lang['qb_h1'] = 'Titlu de nivel 1'; +$lang['qb_h2'] = 'Titlu de nivel 2'; +$lang['qb_h3'] = 'Titlu de nivel 3'; +$lang['qb_h4'] = 'Titlu de nivel 4'; +$lang['qb_h5'] = 'Titlu de nivel 5'; $lang['qb_h'] = 'Titlu'; -$lang['qb_hs'] = 'Selectați Titlul'; +$lang['qb_hs'] = 'Selectează titlul'; $lang['qb_hplus'] = 'Titlu mai mare'; $lang['qb_hminus'] = 'Titlu mai mic'; $lang['qb_hequal'] = 'Titlu de același nivel'; -$lang['qb_link'] = 'Legătură internă'; -$lang['qb_extlink'] = 'Legătura externă'; -$lang['qb_hr'] = 'Linie Orizontal'; -$lang['qb_ol'] = 'Listă Ordonată'; -$lang['qb_ul'] = 'Listă Neordoată'; +$lang['qb_link'] = 'Link intern'; +$lang['qb_extlink'] = 'Link extern'; +$lang['qb_hr'] = 'Linie orizontală'; +$lang['qb_ol'] = 'Listă ordonată'; +$lang['qb_ul'] = 'Listă neordoată'; $lang['qb_media'] = 'Adaugă imagini și alte fișiere'; $lang['qb_sig'] = 'Inserează semnătură'; $lang['qb_smileys'] = 'Smiley-uri'; $lang['qb_chars'] = 'Caractere speciale'; -$lang['upperns'] = 'sari la numele de spațiu părinte'; +$lang['upperns'] = 'Accesează spațiul de nume părinte'; $lang['admin_register'] = 'Adaugă utilizator nou'; -$lang['metaedit'] = 'Editează Metadata'; +$lang['metaedit'] = 'Editează metadata'; $lang['metasaveerr'] = 'Scrierea metadatelor a eșuat'; $lang['metasaveok'] = 'Metadatele au fost salvate'; $lang['img_backto'] = 'Înapoi la'; $lang['img_title'] = 'Titlu'; $lang['img_caption'] = 'Legendă'; -$lang['img_date'] = 'Data'; +$lang['img_date'] = 'Dată'; $lang['img_fname'] = 'Nume fișier'; $lang['img_fsize'] = 'Dimensiune'; $lang['img_artist'] = 'Fotograf'; -$lang['img_copyr'] = 'Copyright'; +$lang['img_copyr'] = 'Drept de autor'; $lang['img_format'] = 'Format'; $lang['img_camera'] = 'Camera'; $lang['img_keywords'] = 'Cuvinte cheie'; @@ -248,47 +248,46 @@ $lang['img_height'] = 'Înălțime'; $lang['img_manager'] = 'Vizualizează în administratorul media'; $lang['subscr_subscribe_success'] = 'Adăugat %s la lista de abonare pentru %s'; $lang['subscr_subscribe_error'] = 'Eroare la adăugarea %s la lista de abonare pentru %s'; -$lang['subscr_subscribe_noaddress'] = 'Nu există adresa asociată cu logarea dvs., nu puteți fi adăugat la lista de abonare'; +$lang['subscr_subscribe_noaddress'] = 'Nu există adresă de e-mail asociată autentificării curente, nu poți fi adăugat la lista de abonare'; $lang['subscr_unsubscribe_success'] = 'Șters %s din lista de abonare pentru %s'; $lang['subscr_unsubscribe_error'] = 'Eroare la ștergerea %s din lista de abonare pentru %s'; $lang['subscr_already_subscribed'] = '%s este deja abonat la %s'; $lang['subscr_not_subscribed'] = '%s nu este abonat la %s'; -$lang['subscr_m_not_subscribed'] = 'Momentan nu sunteți abonat la pagina curentă sau la numele de spațiu.'; +$lang['subscr_m_not_subscribed'] = 'Momentan nu ești abonat la pagina curentă sau la spațiul de nume.'; $lang['subscr_m_new_header'] = 'Adaugă abonare'; $lang['subscr_m_current_header'] = 'Abonări curente'; -$lang['subscr_m_unsubscribe'] = 'Dezabonați-vă'; -$lang['subscr_m_subscribe'] = 'Abonați-vă'; -$lang['subscr_m_receive'] = 'Primiți'; -$lang['subscr_style_every'] = 'email la ficare schimbare'; -$lang['subscr_style_digest'] = 'digerează email la schimbări pentru fiecare pagină (la fiecare %.2f zile)'; -$lang['subscr_style_list'] = 'lista paginilor schimbate de la ultimul email (la fiecare %.2f zile)'; -$lang['authmodfailed'] = 'Configurația autentificării utilizatorului este eronată. Anunțați Wiki Admin-ul.'; -$lang['authtempfail'] = 'Autentificarea utilizatorului este temporar indisponibilă. Anunțați Wiki Admin-ul.'; -$lang['authpwdexpire'] = 'Parola vă va expira în %d zile, ar trebui să o schimbați curând.'; -$lang['i_chooselang'] = 'Alegeți limba'; -$lang['i_installer'] = 'DokuWiki Installer'; -$lang['i_wikiname'] = 'Numele Wiki'; -$lang['i_enableacl'] = 'Activează ACL (recomandat)'; -$lang['i_superuser'] = 'Superutilizator'; -$lang['i_problems'] = 'Programul de instalare a găsit câteva probleme, indicate mai jos. Nu puteți continua până nu le rezolvați.'; -$lang['i_modified'] = 'Din motive de securitate, acest script va funcționa doar cu o instalare nouă și nemodificată a Docuwiki. -Puteți fie să extrageți din nou fișierele din arhiva descărcată fie să consultați instrucțiunile de instalare Dokuwiki la <a href="http://dokuwiki.org/install">'; -$lang['i_funcna'] = 'Funcția PHP <code>%s</code> nu este disponibilă. Probabil provider-ul dvs. a inactivat-o pentru un motiv oarecare.'; -$lang['i_phpver'] = 'Versiunea dvs. de PHP <code>%s</code> este mai veche decât cea necesară (<code>%s</code>). Trebuie să vă actualizați instalarea PHP.'; -$lang['i_permfail'] = '<code>%s</code> nu poate fi scris de către DokuWiki. Trebuie să modificați drepturile acestui director!'; +$lang['subscr_m_unsubscribe'] = 'Dezabonează-te'; +$lang['subscr_m_subscribe'] = 'Abonează-te'; +$lang['subscr_m_receive'] = 'Primește'; +$lang['subscr_style_every'] = 'e-mail la ficare schimbare'; +$lang['subscr_style_digest'] = 'e-mail cu sumar al modificărilor pentru fiecare pagină (la fiecare %.2f zile)'; +$lang['subscr_style_list'] = 'lista paginilor modificate de la ultimul e-mail (la fiecare %.2f zile)'; +$lang['authtempfail'] = 'Autentificarea utilizatorului este temporar indisponibilă. Contactează administratorul.'; +$lang['authpwdexpire'] = 'Parola va expira în %d zile, ar trebui să o schimbi în curând.'; +$lang['i_chooselang'] = 'Alege limba'; +$lang['i_installer'] = 'Installer DokuWiki'; +$lang['i_wikiname'] = 'Numele acestui wiki'; +$lang['i_enableacl'] = 'Activează ACL (liste de control a accesului) (recomandat)'; +$lang['i_superuser'] = 'Utilizator privilegiat'; +$lang['i_problems'] = 'Programul de instalare a găsit câteva probleme, indicate mai jos. Nu poți continua până nu le rezolvi.'; +$lang['i_modified'] = 'Din motive de securitate, acest script va funcționa doar cu o instalare nouă și nemodificată a DokuWiki. +Poți fie să extragi din nou fișierele din arhiva descărcată fie să consulți instrucțiunile de instalare DokuWiki la <a href="http://dokuwiki.org/install">'; +$lang['i_funcna'] = 'Funcția PHP <code>%s</code> nu este disponibilă. Probabil provider-ul tău a dezactivat-o pentru un motiv anume.'; +$lang['i_phpver'] = 'Versiunea ta de PHP <code>%s</code> este mai veche decât cea necesară (<code>%s</code>). Trebuie să îți actualizezi instalarea PHP.'; +$lang['i_permfail'] = '<code>%s</code> nu poate fi scris de către DokuWiki. Trebuie să modifici permisiunile pe acest director.'; $lang['i_confexists'] = '<code>%s</code> există deja'; -$lang['i_writeerr'] = 'Nu s-a putut crea <code>%s</code>. Trebuie să verificați drepturile directorului/fișierului și să creați fișierul manual.'; +$lang['i_writeerr'] = 'Nu s-a putut crea <code>%s</code>. Trebuie să verifici permisiunile directorului/fișierului și să creezi fișierul manual.'; $lang['i_badhash'] = 'dokuwiki.php nu a fost recunoscut sau a fost modificat (hash=<code>%s</code>)'; $lang['i_badval'] = '<code>%s</code> - valoare nepemisă sau neintrodusă'; -$lang['i_success'] = 'Configurarea a fost finalizată cu succes. Acum puteți sterge fișierul install.php. Continuați cu <a href="doku.php?id=wiki:welcome">your new DokuWiki</a>.'; -$lang['i_failure'] = 'Au apărut erori la scrierea fișierelor de configurare. Va trebui să le corectați manual înainte de a putea folosi <a href="doku.php?id=wiki:welcome">your new DokuWiki</a>.'; -$lang['i_policy'] = 'Politica ACL inițială'; -$lang['i_pol0'] = 'Wiki Deschisă (citește, scrie și încarcă oricine)'; -$lang['i_pol1'] = 'Wiki Deschisă (citeste oricine, scrie și încarcă doar utilizatorul înregistrat)'; -$lang['i_pol2'] = 'Wiki Închisă (citește, scrie și încarcă doar utilizatorul înregistrat)'; +$lang['i_success'] = 'Configurarea a fost finalizată cu succes. Acum poți sterge fișierul install.php. Poți accesa <a href="doku.php?id=wiki:welcome">noua ta instanță DokuWiki</a>.'; +$lang['i_failure'] = 'Au apărut erori la scrierea fișierelor de configurare. Va trebui să le corectezi manual înainte de a putea folosi <a href="doku.php?id=wiki:welcome">noua ta instanță DokuWiki</a>.'; +$lang['i_policy'] = 'Politica ACL (liste de control a accesului) inițială'; +$lang['i_pol0'] = 'Wiki deschis (oricine poate citi, scrie și încărca fișiere)'; +$lang['i_pol1'] = 'Wiki public (oricine poate citi, utilizatorii înregistrați pot scrie și încărca fișiere'; +$lang['i_pol2'] = 'Wiki închis (doar utilizatorii înregistrați pot citi, scrie și încărca fișiere)'; $lang['i_retry'] = 'Încearcă din nou'; -$lang['i_license'] = 'Vă rugăm alegeți licența sub care doriți să vă licențiați materialul:'; -$lang['recent_global'] = 'Acum vizualizați modificările în interiorul numelui de spațiu <b>%s</b>. De asemenea puteți <a href="%s">vizualiza modificările recente ale întregului wiki</a>.'; +$lang['i_license'] = 'Te rugăm să alegi licența sub care dorești să publici conținutul:'; +$lang['recent_global'] = 'În acest moment vizualizezi modificările în interiorul spațiului de nume <b>%s</b>. De asemenea poți <a href="%s">vizualiza modificările recente în întregului wiki-ul</a>.'; $lang['years'] = 'acum %d ani'; $lang['months'] = 'acum %d luni'; $lang['weeks'] = 'acum %d săptămâni'; @@ -296,8 +295,8 @@ $lang['days'] = 'acum %d zile'; $lang['hours'] = 'acum %d ore'; $lang['minutes'] = 'acum %d minute'; $lang['seconds'] = 'acum %d secunde'; -$lang['wordblock'] = 'Modificarea dvs. nu au fost salvate deoarece conține text blocat (spam).'; -$lang['media_uploadtab'] = 'Încarcă'; +$lang['wordblock'] = 'Modificarea ta nu a fost salvată deoarece conține text blocat (spam).'; +$lang['media_uploadtab'] = 'Încărcare fișier'; $lang['media_searchtab'] = 'Căutare'; $lang['media_file'] = 'Fișier'; $lang['media_viewtab'] = 'Vizualizare'; @@ -306,17 +305,17 @@ $lang['media_historytab'] = 'Istoric'; $lang['media_list_thumbs'] = 'Miniaturi'; $lang['media_list_rows'] = 'Linii'; $lang['media_sort_name'] = 'Nume'; -$lang['media_sort_date'] = 'Data'; -$lang['media_namespaces'] = 'Alegeți numele se spațiu'; +$lang['media_sort_date'] = 'Dată'; +$lang['media_namespaces'] = 'Alege spațiul de nume'; $lang['media_files'] = 'Fișiere în %s'; -$lang['media_upload'] = 'Încarcă în %s'; -$lang['media_search'] = 'Caută în %s'; +$lang['media_upload'] = 'Încărcare în %s'; +$lang['media_search'] = 'Cautare în %s'; $lang['media_view'] = '%s'; $lang['media_viewold'] = '%s în %s'; $lang['media_edit'] = 'Editare %s'; $lang['media_history'] = 'Istoricul pentru %s'; $lang['media_meta_edited'] = 'metadate editate'; -$lang['media_perm_read'] = 'Ne pare rău, dar nu aveți suficiente drepturi pentru a putea citi fișiere.'; -$lang['media_perm_upload'] = 'Ne pare rău, dar nu aveți suficiente drepturi pentru a putea încărca fișiere.'; +$lang['media_perm_read'] = 'Ne pare rău, dar nu ai suficiente permisiuni pentru a putea citi fișiere.'; +$lang['media_perm_upload'] = 'Ne pare rău, dar nu ai suficiente permisiuni pentru a putea încărca fișiere.'; $lang['media_update'] = 'Încarcă noua versiune'; $lang['media_restore'] = 'Restaurează această versiune'; diff --git a/inc/lang/ru/denied.txt b/inc/lang/ru/denied.txt index 2cc33cff7..f7f53ce88 100644 --- a/inc/lang/ru/denied.txt +++ b/inc/lang/ru/denied.txt @@ -1,3 +1,3 @@ ====== Доступ запрещён ====== -Извините, у вас не хватает прав для этого действия. Может быть, вы забыли войти в вики под своим логином? +Извините, у вас не хватает прав для этого действия. Может быть вы забыли войти в вики под своим логином? diff --git a/inc/lang/ru/diff.txt b/inc/lang/ru/diff.txt index 4d1d4d031..80252614f 100644 --- a/inc/lang/ru/diff.txt +++ b/inc/lang/ru/diff.txt @@ -1,4 +1,4 @@ ====== Различия ====== -Здесь показаны различия между выбранной ревизией и текущей версией данной страницы. +Здесь показаны различия между двумя версиями данной страницы. diff --git a/inc/lang/ru/lang.php b/inc/lang/ru/lang.php index 6709ebc59..237b819db 100644 --- a/inc/lang/ru/lang.php +++ b/inc/lang/ru/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Russian language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Yuri Pimenov <up@ftpsearch.lv> * @author Igor Tarasov <tigr@mail15.com> * @author Denis Simakov <akinoame1@gmail.com> @@ -21,6 +21,8 @@ * @author Eugene <windy.wanderer@gmail.com> * @author Johnny Utah <pcpa@cyberpunk.su> * @author Ivan I. Udovichenko (sendtome@mymailbox.pp.ua) + * @author Pavel <ivanovtsk@mail.ru> + * @author Artur <ncuxxx@gmail.com> */ $lang['encoding'] = ' utf-8'; $lang['direction'] = 'ltr'; @@ -63,7 +65,8 @@ $lang['btn_draftdel'] = 'Удалить черновик'; $lang['btn_revert'] = 'Восстановить'; $lang['btn_register'] = 'Зарегистрироваться'; $lang['btn_apply'] = 'Применить'; -$lang['btn_media'] = 'Media Manager'; +$lang['btn_media'] = 'Управление медиафайлами'; +$lang['btn_deleteuser'] = 'Удалить мой аккаунт'; $lang['loggedinas'] = 'Зашли как'; $lang['user'] = 'Логин'; $lang['pass'] = 'Пароль'; @@ -75,12 +78,13 @@ $lang['fullname'] = 'Полное имя'; $lang['email'] = 'Эл. адрес'; $lang['profile'] = 'Профиль пользователя'; $lang['badlogin'] = 'Извините, неверное имя пользователя или пароль.'; +$lang['badpassconfirm'] = 'Простите, пароль неверный'; $lang['minoredit'] = 'Небольшие изменения'; $lang['draftdate'] = 'Черновик сохранён'; $lang['nosecedit'] = 'За это время страница была изменена и информация о секции устарела. Загружена полная версия страницы.'; $lang['regmissing'] = 'Извините, вам следует заполнить все поля.'; $lang['reguexists'] = 'Извините, пользователь с таким логином уже существует.'; -$lang['regsuccess'] = 'Пользователь создан, пароль выслан на адрес электронной почты.'; +$lang['regsuccess'] = 'Пользователь создан; пароль выслан на адрес электронной почты.'; $lang['regsuccess2'] = 'Пользователь создан.'; $lang['regmailfail'] = 'Похоже есть проблема с отправкой пароля по почте. Пожалуйста, сообщите об этом администратору.'; $lang['regbadmail'] = 'Данный вами адрес электронной почты выглядит неправильным. Если вы считаете это ошибкой, сообщите администратору.'; @@ -91,6 +95,11 @@ $lang['profna'] = 'Данная вики не поддержив $lang['profnochange'] = 'Изменений не было внесено, профиль не обновлён.'; $lang['profnoempty'] = 'Логин и адрес электронной почты не могут быть пустыми.'; $lang['profchanged'] = 'Профиль пользователя успешно обновлён.'; +$lang['profnodelete'] = 'Удалённый пользователь не может работать с этим документом'; +$lang['profdeleteuser'] = 'Удалить аккаунт'; +$lang['profdeleted'] = 'Ваш аккаунт был удален из этой вики'; +$lang['profconfdelete'] = 'Я хочу удалить мой аккаунт из этой вики.<br />Это действие необратимо.'; +$lang['profconfdeletemissing'] = 'Флажок подтверждения не установлен'; $lang['pwdforget'] = 'Забыли пароль? Получите новый'; $lang['resendna'] = 'Данная вики не поддерживает повторную отправку пароля.'; $lang['resendpwd'] = 'Установить новый пароль для'; @@ -109,7 +118,7 @@ $lang['txt_overwrt'] = 'Перезаписать существующ $lang['maxuploadsize'] = 'Максимальный размер загружаемого файла %s'; $lang['lockedby'] = 'В данный момент заблокирован'; $lang['lockexpire'] = 'Блокировка истекает в'; -$lang['js']['willexpire'] = 'Ваша блокировка этой страницы на редактирование истекает в течении минуты.\nЧтобы предотвратить конфликты используйте кнопку "Просмотр" для сброса таймера блокировки.'; +$lang['js']['willexpire'] = 'Ваша блокировка этой страницы на редактирование истекает в течение минуты.\nЧтобы предотвратить конфликты используйте кнопку «Просмотр» для сброса таймера блокировки.'; $lang['js']['notsavedyet'] = 'Несохранённые изменения будут потеряны. Вы действительно хотите продолжить?'; $lang['js']['searchmedia'] = 'Поиск файлов'; $lang['js']['keepopen'] = 'Не закрывать окно после выбора'; @@ -141,8 +150,8 @@ $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_both'] = 'рядом'; +$lang['js']['media_diff_opacity'] = 'наложением'; $lang['js']['media_diff_portions'] = 'Частями'; $lang['js']['media_select'] = 'Выбрать файлы…'; $lang['js']['media_upload_btn'] = 'Загрузить'; @@ -162,9 +171,9 @@ $lang['uploadbadcontent'] = 'Содержание файла не соот $lang['uploadspam'] = 'Загрузка заблокирована спам-фильтром.'; $lang['uploadxss'] = 'Загрузка заблокирована по соображениям безопасности.'; $lang['uploadsize'] = 'Загруженный файл был слишком большой. (макс. %s)'; -$lang['deletesucc'] = 'Файл "%s" был удалён.'; -$lang['deletefail'] = 'Невозможно удалить файл "%s". Проверьте права доступа к файлу.'; -$lang['mediainuse'] = 'Файл "%s" не был удалён — файл всё ещё используется.'; +$lang['deletesucc'] = 'Файл «%s» был удалён.'; +$lang['deletefail'] = 'Невозможно удалить файл «%s». Проверьте права доступа к файлу.'; +$lang['mediainuse'] = 'Файл «%s» не был удалён — файл всё ещё используется.'; $lang['namespaces'] = 'Пространства имён'; $lang['mediafiles'] = 'Доступные файлы'; $lang['accessdenied'] = 'Вы не можете просмотреть эту страницу.'; @@ -185,8 +194,8 @@ $lang['diff'] = 'показать отличия от теку $lang['diff2'] = 'Показать различия между ревизиями '; $lang['difflink'] = 'Ссылка на это сравнение'; $lang['diff_type'] = 'Посмотреть отличия'; -$lang['diff_inline'] = 'Встроенный'; -$lang['diff_side'] = 'Бок о бок'; +$lang['diff_inline'] = 'встроенный'; +$lang['diff_side'] = 'бок о бок'; $lang['line'] = 'Строка'; $lang['breadcrumb'] = 'Вы посетили'; $lang['youarehere'] = 'Вы находитесь здесь'; @@ -204,16 +213,16 @@ $lang['user_tools'] = 'Инструменты пользовател $lang['site_tools'] = 'Инструменты сайта'; $lang['page_tools'] = 'Инструменты страницы'; $lang['skip_to_content'] = 'Перейти к содержанию'; -$lang['sidebar'] = 'Боковая колонна'; +$lang['sidebar'] = 'Боковая панель'; $lang['mail_newpage'] = 'страница добавлена:'; $lang['mail_changed'] = 'страница изменена:'; $lang['mail_subscribe_list'] = 'изменились страницы в пространстве имён:'; $lang['mail_new_user'] = 'новый пользователь:'; $lang['mail_upload'] = 'файл закачан:'; $lang['changes_type'] = 'Посмотреть изменения'; -$lang['pages_changes'] = 'Страниц'; -$lang['media_changes'] = 'Медиа файлов'; -$lang['both_changes'] = 'И страниц и медиа файлов'; +$lang['pages_changes'] = 'страниц'; +$lang['media_changes'] = 'медиафайлов'; +$lang['both_changes'] = 'и страниц, и медиафайлов'; $lang['qb_bold'] = 'Полужирный'; $lang['qb_italic'] = 'Курсив'; $lang['qb_underl'] = 'Подчёркнутый'; @@ -234,7 +243,7 @@ $lang['qb_extlink'] = 'Внешняя ссылка'; $lang['qb_hr'] = 'Разделитель'; $lang['qb_ol'] = 'Элемент нумерованного списка'; $lang['qb_ul'] = 'Элемент ненумерованного списка'; -$lang['qb_media'] = 'Добавить изображения или другие файлы'; +$lang['qb_media'] = 'Добавить изображения или другие файлы (откроется в новом окне)'; $lang['qb_sig'] = 'Вставить подпись'; $lang['qb_smileys'] = 'Смайлики'; $lang['qb_chars'] = 'Специальные символы'; @@ -256,7 +265,7 @@ $lang['img_camera'] = 'Модель'; $lang['img_keywords'] = 'Ключевые слова'; $lang['img_width'] = 'Ширина'; $lang['img_height'] = 'Высота'; -$lang['img_manager'] = 'Просмотр в media manager'; +$lang['img_manager'] = 'Просмотр в «управлении медиафайлами»'; $lang['subscr_subscribe_success'] = 'Добавлен %s в подписку на %s'; $lang['subscr_subscribe_error'] = 'Невозможно добавить %s в подписку на %s'; $lang['subscr_subscribe_noaddress'] = 'Нет адреса электронной почты, сопоставленного с вашей учётной записью. Вы не можете подписаться на рассылку'; @@ -271,9 +280,8 @@ $lang['subscr_m_unsubscribe'] = 'Отменить подписку'; $lang['subscr_m_subscribe'] = 'Подписаться'; $lang['subscr_m_receive'] = 'Получить'; $lang['subscr_style_every'] = 'уведомлять о каждом изменении'; -$lang['subscr_style_digest'] = 'информационное электронное письмо со списком изменений для каждоый страницы (каждые %.2f дней)'; +$lang['subscr_style_digest'] = 'информационное электронное письмо со списком изменений для каждой страницы (каждые %.2f дней)'; $lang['subscr_style_list'] = 'список изменённых страниц со времени последнего отправленного электронного письма (каждые %.2f дней)'; -$lang['authmodfailed'] = 'Неправильная конфигурация аутентификации пользователя. Пожалуйста, сообщите об этом своему администратору вики.'; $lang['authtempfail'] = 'Аутентификация пользователей временно недоступна. Если проблема продолжается какое-то время, пожалуйста, сообщите об этом своему администратору вики.'; $lang['authpwdexpire'] = 'Действие вашего пароля истекает через %d дней. Вы должны изменить его как можно скорее'; $lang['i_chooselang'] = 'Выберите свой язык/Choose your language'; @@ -302,8 +310,8 @@ $lang['i_pol2'] = 'Закрытая вики (чтение, за $lang['i_retry'] = 'Повторить попытку'; $lang['i_license'] = 'Пожалуйста, выберите тип лицензии для своей вики:'; $lang['i_license_none'] = 'Не отображать информацию о лицензионных операциях'; -$lang['i_pop_field'] = 'Пожалуйста, помогите нам улучшить DokuWiki:'; -$lang['i_pop_label'] = 'Отправлять раз в месяц анонимную пользовательскую информацию разработчикам DokuWiki'; +$lang['i_pop_field'] = 'Пожалуйста, помогите нам улучшить «ДокуВики»:'; +$lang['i_pop_label'] = 'Отправлять раз в месяц анонимную пользовательскую информацию разработчикам «ДокуВики»'; $lang['recent_global'] = 'Вы просматриваете изменения в пространстве имён <b>%s</b>. Вы можете также <a href="%s">просмотреть недавние изменения во всей вики</a>.'; $lang['years'] = '%d лет назад'; $lang['months'] = '%d месяц(ев) назад'; @@ -333,7 +341,7 @@ $lang['media_viewold'] = '%s в %s $lang['media_edit'] = 'Правка %s'; $lang['media_history'] = 'История %s'; $lang['media_meta_edited'] = 'метаданные изменены'; -$lang['media_perm_read'] = 'Извините, у Вас недостаточно прав для чтения файлов.'; -$lang['media_perm_upload'] = 'Извините, у Вас недостаточно прав для загрузки файлов.'; +$lang['media_perm_read'] = 'Извините, у вас недостаточно прав для чтения файлов.'; +$lang['media_perm_upload'] = 'Извините, у вас недостаточно прав для загрузки файлов.'; $lang['media_update'] = 'Загрузить новую версию'; $lang['media_restore'] = 'Восстановить эту версию'; diff --git a/inc/lang/ru/mailtext.txt b/inc/lang/ru/mailtext.txt index 53d3431a3..2b3f76bbd 100644 --- a/inc/lang/ru/mailtext.txt +++ b/inc/lang/ru/mailtext.txt @@ -1,13 +1,13 @@ В вашей вики была добавлена или изменена страница. Подробности: -Дата : @DATE@ -Браузер : @BROWSER@ -IP-адрес : @IPADDRESS@ -Хост : @HOSTNAME@ -Старая версия : @OLDPAGE@ -Новая версия : @NEWPAGE@ -Сводка изменений : @SUMMARY@ -Пользователь : @USER@ +Дата: @DATE@ +Браузер: @BROWSER@ +IP-адрес: @IPADDRESS@ +Хост: @HOSTNAME@ +Старая версия: @OLDPAGE@ +Новая версия: @NEWPAGE@ +Сводка изменений: @SUMMARY@ +Пользователь: @USER@ @DIFF@ diff --git a/inc/lang/ru/password.txt b/inc/lang/ru/password.txt index 91117ca56..eb100f334 100644 --- a/inc/lang/ru/password.txt +++ b/inc/lang/ru/password.txt @@ -3,7 +3,6 @@ Ваши данные для @TITLE@ (@DOKUWIKIURL@) Имя пользователя: @LOGIN@ - Пароль: @PASSWORD@ -- diff --git a/inc/lang/ru/registermail.txt b/inc/lang/ru/registermail.txt index 77094e8d8..fc862b034 100644 --- a/inc/lang/ru/registermail.txt +++ b/inc/lang/ru/registermail.txt @@ -1,13 +1,13 @@ Был зарегистрирован новый пользователь. Подробности: -Логин : @NEWUSER@ -Полное имя : @NEWNAME@ -Эл. адрес : @NEWEMAIL@ +Логин: @NEWUSER@ +Полное имя: @NEWNAME@ +Эл. адрес: @NEWEMAIL@ -Дата : @DATE@ -Браузер : @BROWSER@ -Адрес IP : @IPADDRESS@ -Хост : @HOSTNAME@ +Дата: @DATE@ +Браузер: @BROWSER@ +Адрес IP: @IPADDRESS@ +Хост: @HOSTNAME@ -- Это сообщение было сгенерировано «ДокуВики» по адресу diff --git a/inc/lang/ru/subscr_single.txt b/inc/lang/ru/subscr_single.txt index 0e67d8f59..911a48e96 100644 --- a/inc/lang/ru/subscr_single.txt +++ b/inc/lang/ru/subscr_single.txt @@ -1,6 +1,5 @@ Привет. - Страница @PAGE@ в вики @TITLE@ изменилась. Список изменений: diff --git a/inc/lang/ru/uploadmail.txt b/inc/lang/ru/uploadmail.txt index 77f79231e..f696f2c44 100644 --- a/inc/lang/ru/uploadmail.txt +++ b/inc/lang/ru/uploadmail.txt @@ -1,14 +1,14 @@ В вашу вики был закачан файл. Подробная информация: -Файл : @MEDIA@ +Файл: @MEDIA@ Старая версия: @OLD@ -Дата : @DATE@ -Браузер : @BROWSER@ -Адрес IP : @IPADDRESS@ -Хост : @HOSTNAME@ -Размер : @SIZE@ -Тип MIME : @MIME@ -Пользователь : @USER@ +Дата: @DATE@ +Браузер: @BROWSER@ +Адрес IP: @IPADDRESS@ +Хост: @HOSTNAME@ +Размер: @SIZE@ +Тип MIME: @MIME@ +Пользователь: @USER@ -- Это письмо было сгенерировано «ДокуВики» по адресу diff --git a/inc/lang/sk/lang.php b/inc/lang/sk/lang.php index 5bda5fdaf..a5fc47f5f 100644 --- a/inc/lang/sk/lang.php +++ b/inc/lang/sk/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Slovak language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Ondrej Vegh <ov@vsieti.sk> with help of the scholars from Zdruzena stredna skola polygraficka in Bratislava * @author Michal Mesko <michal.mesko@gmail.com> * @author exusik@gmail.com @@ -50,6 +50,7 @@ $lang['btn_revert'] = 'Obnoviť'; $lang['btn_register'] = 'Registrovať'; $lang['btn_apply'] = 'Použiť'; $lang['btn_media'] = 'Správa médií'; +$lang['btn_deleteuser'] = 'Zrušiť môj účet'; $lang['loggedinas'] = 'Prihlásený(á) ako'; $lang['user'] = 'Užívateľské meno'; $lang['pass'] = 'Heslo'; @@ -61,6 +62,7 @@ $lang['fullname'] = 'Celé meno'; $lang['email'] = 'E-Mail'; $lang['profile'] = 'Užívateľský profil'; $lang['badlogin'] = 'Zadané užívateľské meno a heslo nie je správne.'; +$lang['badpassconfirm'] = 'Ľutujem, heslo bolo nesprávne.'; $lang['minoredit'] = 'Menšie zmeny'; $lang['draftdate'] = 'Koncept automaticky uložený'; $lang['nosecedit'] = 'Stránka bola medzičasom zmenená, informácie o sekcii sú zastaralé a z tohto dôvodu bola nahraná celá stránka.'; @@ -77,6 +79,11 @@ $lang['profna'] = 'Táto wiki nepodporuje zmenu profilu'; $lang['profnochange'] = 'Žiadne zmeny, nie je čo robiť.'; $lang['profnoempty'] = 'Prázdne meno alebo mailová adresa nie sú povolené.'; $lang['profchanged'] = 'Užívateľský účet úspešne zmenený.'; +$lang['profnodelete'] = 'Táto wiki neumožňuje zrušenie používateľov.'; +$lang['profdeleteuser'] = 'Zrušiť účet'; +$lang['profdeleted'] = 'Váš účet bol zrušený v tejto wiki.'; +$lang['profconfdelete'] = 'Chcem odstrániť môj účet z tejto wiki. <br/> Táto operácia je nevratná.'; +$lang['profconfdeletemissing'] = 'Nebolo zavolené potvrdzovacie políčko'; $lang['pwdforget'] = 'Zabudli ste heslo? Získajte nové!'; $lang['resendna'] = 'Táto wiki nepodporuje opätovné zasielanie hesla.'; $lang['resendpwd'] = 'Nastaviť nové heslo pre'; @@ -261,7 +268,6 @@ $lang['subscr_m_receive'] = 'Dostávať'; $lang['subscr_style_every'] = 'email pri každej zmene'; $lang['subscr_style_digest'] = 'email so zhrnutím zmien pre každú stránku (perióda %.2f dňa)'; $lang['subscr_style_list'] = 'zoznam zmenených stránok od posledného emailu (perióda %.2f dňa)'; -$lang['authmodfailed'] = 'Užívateľská autentifikácia nie je možná. Prosím informujte správcu systému.'; $lang['authtempfail'] = 'Užívateľská autentifikácia je dočasne nedostupná. Ak táto situácia pretrváva, prosím informujte správcu systému.'; $lang['authpwdexpire'] = 'Platnosť hesla vyprší za %d dní, mali by ste ho zmeniť čo najskôr.'; $lang['i_chooselang'] = 'Zvoľte váš jazyk'; @@ -286,6 +292,9 @@ $lang['i_pol1'] = 'Verejná Wiki (čítanie pre každého, zápis $lang['i_pol2'] = 'Uzatvorená Wiki (čítanie, zápis a nahrávanie len pre registrovaných užívateľov)'; $lang['i_retry'] = 'Skúsiť znovu'; $lang['i_license'] = 'Vyberte licenciu, pod ktorou chcete uložiť váš obsah:'; +$lang['i_license_none'] = 'Nezobrazovať žiadne licenčné informácie'; +$lang['i_pop_field'] = 'Prosím pomôžte nám zlepšiť prácu s DokuWiki:'; +$lang['i_pop_label'] = 'Raz mesačne zaslať anonymné údaje vývojárom DokuWiki'; $lang['recent_global'] = 'Práve prehliadate zmeny v mennom priestore <b>%s</b>. Môžete si tiež pozrieť <a href="%s">aktuálne zmeny celej wiki</a>.'; $lang['years'] = 'pred %d rokmi'; $lang['months'] = 'pred %d mesiacmi'; @@ -318,3 +327,7 @@ $lang['media_perm_read'] = 'Prepáčte, ale nemáte dostatočné oprávnen $lang['media_perm_upload'] = 'Prepáčte, ale nemáte dostatočné oprávnenie na nahrávanie súborov.'; $lang['media_update'] = 'Nahrať novú verziu'; $lang['media_restore'] = 'Obnoviť túto verziu'; +$lang['currentns'] = 'Aktuálny menný priestor'; +$lang['searchresult'] = 'Výsledky hľadania'; +$lang['plainhtml'] = 'Jednoduché HTML'; +$lang['wikimarkup'] = 'Wiki formát'; diff --git a/inc/lang/sl/lang.php b/inc/lang/sl/lang.php index 5c4316b01..2f69163f5 100644 --- a/inc/lang/sl/lang.php +++ b/inc/lang/sl/lang.php @@ -1,13 +1,14 @@ <?php + /** - * Slovenian language file + * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * - * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Jaka Kranjc <lynxlupodian@hotmail.com> * @author Boštjan Seničar <senicar@gmail.com> * @author Dejan Levec <webphp@gmail.com> * @author Gregor Skumavc (grega.skumavc@gmail.com) * @author Matej Urbančič (mateju@svn.gnome.org) + * @author Matej Urbančič <mateju@svn.gnome.org> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -43,6 +44,7 @@ $lang['btn_backtomedia'] = 'Nazaj na izbiro predstavnih datotek'; $lang['btn_subscribe'] = 'Urejanje naročnin'; $lang['btn_profile'] = 'Posodobi profil'; $lang['btn_reset'] = 'Ponastavi'; +$lang['btn_resendpwd'] = 'Nastavi novo geslo'; $lang['btn_draft'] = 'Uredi osnutek'; $lang['btn_recover'] = 'Obnovi osnutek'; $lang['btn_draftdel'] = 'Izbriši osnutek'; @@ -50,6 +52,7 @@ $lang['btn_revert'] = 'Povrni'; $lang['btn_register'] = 'Prijava'; $lang['btn_apply'] = 'Uveljavi'; $lang['btn_media'] = 'Urejevalnik predstavnih vsebin'; +$lang['btn_deleteuser'] = 'Odstrani račun'; $lang['loggedinas'] = 'Prijava kot'; $lang['user'] = 'Uporabniško ime'; $lang['pass'] = 'Geslo'; @@ -61,6 +64,7 @@ $lang['fullname'] = 'Pravo ime'; $lang['email'] = 'Elektronski naslov'; $lang['profile'] = 'Uporabniški profil'; $lang['badlogin'] = 'Uporabniško ime ali geslo je napačno.'; +$lang['badpassconfirm'] = 'Napaka! Geslo ni pravo.'; $lang['minoredit'] = 'Manjše spremembe'; $lang['draftdate'] = 'Samodejno shranjevanje osnutka je omogočeno'; $lang['nosecedit'] = 'Stran je bila v vmesnem času spremenjena. Podatki strani so bili zastareli, zato se je celotna vsebina naložila znova.'; @@ -77,8 +81,12 @@ $lang['profna'] = 'DokuWiki ne podpira spreminjanja profila.'; $lang['profnochange'] = 'Brez sprememb.'; $lang['profnoempty'] = 'Prazno polje elektronskega naslova ali imena ni dovoljeno.'; $lang['profchanged'] = 'Uporabniški profil je uspešno posodobljen.'; +$lang['profnodelete'] = 'Ni omogočena podpora za brisanje uporabnikov.'; +$lang['profdeleteuser'] = 'Izbriši račun'; +$lang['profdeleted'] = 'Uporabniški račun je izbrisan.'; $lang['pwdforget'] = 'Ali ste pozabili geslo? Pridobite si novo geslo.'; $lang['resendna'] = 'DokuWiki ne podpira možnosti ponovnega pošiljanja gesel.'; +$lang['resendpwd'] = 'Nastavi novo geslo za'; $lang['resendpwdmissing'] = 'Izpolniti je treba vsa polja.'; $lang['resendpwdnouser'] = 'Podanega uporabniškega imena v podatkovni zbirki ni mogoče najti.'; $lang['resendpwdbadauth'] = 'Koda za overitev ni prava. Prepričajte se, da ste uporabili celotno povezavo za potrditev.'; @@ -255,7 +263,6 @@ $lang['subscr_m_receive'] = 'Prejmi'; $lang['subscr_style_every'] = 'elektronsko sporočilo ob vsaki spremembi'; $lang['subscr_style_digest'] = 'strnjeno elektronsko sporočilo sprememb za vsako stran (vsakih %.2f dni)'; $lang['subscr_style_list'] = 'seznam spremenjenih strani od zadnjega elektronskega sporočila (vsakih %.2f dni)'; -$lang['authmodfailed'] = 'Slaba nastavitev overitve uporabniškega računa. Stopite v stik s skrbnikom sistema wiki.'; $lang['authtempfail'] = 'Potrditev uporabnika je trenutno nedostopna. Stopite v stik s skrbnikom sistema wiki.'; $lang['i_chooselang'] = 'Izberite jezik'; $lang['i_installer'] = 'DokuWiki namestitev'; @@ -279,6 +286,7 @@ $lang['i_pol1'] = 'Javni Wiki (branje za vse, zapis in nalaganje $lang['i_pol2'] = 'Zaprt Wiki (berejo in urejajo lahko le prijavljeni uporabniki)'; $lang['i_retry'] = 'Ponovni poskus'; $lang['i_license'] = 'Izbor dovoljenja objave vsebine:'; +$lang['i_license_none'] = 'Ne pokaži podrobnosti dovoljenja.'; $lang['recent_global'] = 'Trenutno so prikazane spremembe znotraj imenskega prostora <b>%s</b>. Mogoče si je ogledati tudi spremembe <a href="%s">celotnega sistema Wiki</a>.'; $lang['years'] = '%d let nazaj'; $lang['months'] = '%d mesecev nazaj'; diff --git a/inc/lang/sq/lang.php b/inc/lang/sq/lang.php index 36ed436c8..2ed62ed4e 100644 --- a/inc/lang/sq/lang.php +++ b/inc/lang/sq/lang.php @@ -204,7 +204,6 @@ $lang['subscr_m_unsubscribe'] = 'Fshi Abonimin'; $lang['subscr_m_subscribe'] = 'Abonohu'; $lang['subscr_m_receive'] = 'Mer'; $lang['subscr_style_every'] = 'email mbi çdo ndryshim'; -$lang['authmodfailed'] = 'Konfigurim i gabuar i autentikimit të përdoruesit. Ju lutem informoni Administratorin tuaj të Wiki-it.'; $lang['authtempfail'] = 'Autentikimi i përdoruesve është përkohësisht i padisponueshëm. Nëse kjo gjendje vazhdon, ju lutemi të informoni Administratorin tuaj të Wiki-it.'; $lang['i_chooselang'] = 'Zgjidhni gjuhën tuaj'; $lang['i_installer'] = 'Installer-i DokuWiki'; diff --git a/inc/lang/sr/lang.php b/inc/lang/sr/lang.php index 7fbdf1985..7c434cbc9 100644 --- a/inc/lang/sr/lang.php +++ b/inc/lang/sr/lang.php @@ -228,7 +228,6 @@ $lang['subscr_m_receive'] = 'Прими'; $lang['subscr_style_every'] = 'имејл о свакој промени'; $lang['subscr_style_digest'] = 'скраћени имејл о променама за сваку страницу (сваких %.2f дана)'; $lang['subscr_style_list'] = 'Списак страница промењених након последњег имејла (сваких %.2f дана)'; -$lang['authmodfailed'] = 'Лоше подешена провера корисника. Молим Вас да обавестите администратора викија.'; $lang['authtempfail'] = 'Провера корисника је тренутно недоступна. Ако се ситуација настави, молимо Вас да обавестите администратора викија.'; $lang['i_chooselang'] = 'Одаберите језик'; $lang['i_installer'] = 'Докувики инсталација'; diff --git a/inc/lang/sv/lang.php b/inc/lang/sv/lang.php index 9608784c6..7d85f543e 100644 --- a/inc/lang/sv/lang.php +++ b/inc/lang/sv/lang.php @@ -1,12 +1,11 @@ <?php + /** - * Swedish language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Joaquim Homrighausen <joho@webbplatsen.se> * @author Per Foreby <per@foreby.se> * @author Nicklas Henriksson <nicklas[at]nihe.se> - * @author Håkan Sandell <hakan.sandell[at]mydata.se> * @author Håkan Sandell <hakan.sandell@home.se> * @author Dennis Karlsson * @author Tormod Otter Johansson <tormod@latast.se> @@ -18,6 +17,8 @@ * @author Peter Åström <eaustreum@gmail.com> * @author mikael@mallander.net * @author Smorkster Andersson smorkster@gmail.com + * @author Henrik <henrik@idealis.se> + * @author Tor Härnqvist <tor.harnqvist@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -61,6 +62,7 @@ $lang['btn_revert'] = 'Återställ'; $lang['btn_register'] = 'Registrera'; $lang['btn_apply'] = 'Verkställ'; $lang['btn_media'] = 'Media Hanteraren'; +$lang['btn_deleteuser'] = 'Ta bort Mitt Konto'; $lang['loggedinas'] = 'Inloggad som'; $lang['user'] = 'Användarnamn'; $lang['pass'] = 'Lösenord'; @@ -72,6 +74,7 @@ $lang['fullname'] = 'Namn'; $lang['email'] = 'E-post'; $lang['profile'] = 'Användarprofil'; $lang['badlogin'] = 'Felaktigt användarnamn eller lösenord.'; +$lang['badpassconfirm'] = 'Ledsen, lösenordet var felaktigt'; $lang['minoredit'] = 'Små ändringar'; $lang['draftdate'] = 'Utkast automatiskt sparat'; $lang['nosecedit'] = 'Sidan ändrades medan du skrev, sektionsinformationen var inte uppdaterad. Laddar hela sidan istället.'; @@ -88,6 +91,11 @@ $lang['profna'] = 'Denna wiki stödjer inte ändringar av profile $lang['profnochange'] = 'Ingenting ändrades, inget att göra.'; $lang['profnoempty'] = 'Namn och e-postadress måste fyllas i.'; $lang['profchanged'] = 'Användarprofilen uppdaterad.'; +$lang['profnodelete'] = 'Den här wiki:n stödjer ej borttagning av användare'; +$lang['profdeleteuser'] = 'Radera kontot'; +$lang['profdeleted'] = 'Ditt användarkonto har raderats från den här wiki:n'; +$lang['profconfdelete'] = 'Jag vill ta bort mitt konto/inlogg på den här wiki:n <br/> Denna åtgärd går ej att ångra.'; +$lang['profconfdeletemissing'] = 'Bekräftelse-kryssrutan är ej markerad'; $lang['pwdforget'] = 'Glömt ditt lösenord? Ordna ett nytt'; $lang['resendna'] = 'Den här wikin stödjer inte utskick av lösenord.'; $lang['resendpwd'] = 'Sätt lösenord för'; @@ -252,7 +260,7 @@ $lang['img_height'] = 'Höjd'; $lang['img_manager'] = 'Se mediahanteraren'; $lang['subscr_subscribe_success'] = 'La till %s till prenumerationslista %s'; $lang['subscr_subscribe_noaddress'] = 'Det finns ingen adress associerad med din inloggning, du kan inte bli tillagd i prenumerationslistan'; -$lang['subscr_unsubscribe_success'] = '% borttagen från prenumerationslistan för %'; +$lang['subscr_unsubscribe_success'] = '%s borttagen från prenumerationslistan för %s'; $lang['subscr_unsubscribe_error'] = 'Fel vid borttagning av %s från prenumerationslista %s'; $lang['subscr_already_subscribed'] = '%s prenumererar redan på %s'; $lang['subscr_not_subscribed'] = '%s prenumererar inte på %s'; @@ -264,7 +272,6 @@ $lang['subscr_m_subscribe'] = 'Prenumerera'; $lang['subscr_m_receive'] = 'Ta emot'; $lang['subscr_style_every'] = 'skicka epost vid varje ändring'; $lang['subscr_style_list'] = 'lista över ändrade sidor sedan senaste e-post (varje %.2f dag)'; -$lang['authmodfailed'] = 'Felaktiga inställningar för användarautentisering. Var vänlig meddela wikiadministratören.'; $lang['authtempfail'] = 'Tillfälligt fel på användarautentisering. Om felet kvarstår, var vänlig meddela wikiadministratören.'; $lang['authpwdexpire'] = 'Ditt lösenord kommer att bli ogiltigt om %d dagar, du bör ändra det snart.'; $lang['i_chooselang'] = 'Välj språk'; @@ -310,6 +317,7 @@ $lang['media_searchtab'] = 'Sök'; $lang['media_file'] = 'Fil'; $lang['media_viewtab'] = 'Visa'; $lang['media_edittab'] = 'Redigera'; +$lang['media_historytab'] = 'Historik'; $lang['media_list_thumbs'] = 'Miniatyrbild'; $lang['media_list_rows'] = 'Rader'; $lang['media_sort_name'] = 'Namn'; @@ -321,6 +329,7 @@ $lang['media_search'] = 'Sök i %s'; $lang['media_view'] = '%s'; $lang['media_viewold'] = '%s vid %s'; $lang['media_edit'] = 'Redigera %s'; +$lang['media_history'] = '%s-historik'; $lang['media_meta_edited'] = 'metadata redigerat'; $lang['media_perm_read'] = 'Du har tyvärr inte tillräckliga behörigheter för att läsa filer.'; $lang['media_perm_upload'] = 'Du har tyvärr inte tillräckliga behörigheter för att ladda upp filer.'; diff --git a/inc/lang/th/lang.php b/inc/lang/th/lang.php index e008e9e9f..5d364166b 100644 --- a/inc/lang/th/lang.php +++ b/inc/lang/th/lang.php @@ -45,7 +45,6 @@ $lang['btn_back'] = 'ย้อนกลับ'; $lang['btn_backlink'] = 'หน้าที่ลิงก์มา'; $lang['btn_backtomedia'] = 'กลับไปยังหน้าเลือกไฟล์สื่อ'; $lang['btn_subscribe'] = 'เฝ้าดู'; -$lang['btn_unsubscribe'] = 'เลิกเฝ้าดู'; $lang['btn_profile'] = 'แก้ข้อมูลผู้ใช้'; $lang['btn_reset'] = 'เริ่มใหม่'; $lang['btn_draft'] = 'แก้ไขเอกสารฉบับร่าง'; @@ -193,12 +192,6 @@ $lang['img_copyr'] = 'ผู้ถือลิขสิทธิ์' $lang['img_format'] = 'รูปแบบ'; $lang['img_camera'] = 'กล้อง'; $lang['img_keywords'] = 'คำหลัก'; -$lang['subscribe_success'] = 'เพิ่ม %s เข้าไปในรายชื่อสมาชิกลงทะเบียนสำหรับ %s'; -$lang['subscribe_error'] = 'มีข้อผิดพลาดในการเพิ่ม %s ในรายชื่อสมัครสมาชิกสำหรับ %s'; -$lang['subscribe_noaddress'] = 'ไม่มีที่อยู่ที่ตรงกับชื่อล็อกอินของคุณ ชื่อคุณไม่สามารถถูกเพิ่มเข้าไปในรายชื่อสมัครสมาชิก'; -$lang['unsubscribe_success'] = 'ถอด % ออกจากรายชื่อสมัครสมาชิกของ %s'; -$lang['unsubscribe_error'] = 'มีข้อผิดพลาดในการถอด %s ออกจากรายชื่อสมาชิกของ %s'; -$lang['authmodfailed'] = 'มีการกำหนดค่าสิทธิ์ผู้ใช้ไว้ไม่ดี กรุณาแจ้งผู้ดูแลระบบวิกิของคุณ'; $lang['authtempfail'] = 'ระบบตรวจสอบสิทธิ์ผู้ใช้ไม่พร้อมใช้งานชั่วคราว หากสถานการณ์ยังไม่เปลี่ยนแปลง กรุณาแจ้งผู้ดูแลระบวิกิของคุณ'; $lang['i_chooselang'] = 'เลือกภาษาของคุณ'; $lang['i_installer'] = 'ตัวติดตั้งโดกุวิกิ'; diff --git a/inc/lang/tr/adminplugins.txt b/inc/lang/tr/adminplugins.txt new file mode 100644 index 000000000..7c8de9d9f --- /dev/null +++ b/inc/lang/tr/adminplugins.txt @@ -0,0 +1 @@ +===== İlave Eklentiler =====
\ No newline at end of file diff --git a/inc/lang/tr/lang.php b/inc/lang/tr/lang.php index c6edf74c6..6b9e0dd44 100644 --- a/inc/lang/tr/lang.php +++ b/inc/lang/tr/lang.php @@ -1,14 +1,15 @@ <?php + /** - * turkish language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Selim Farsakoğlu <farsakogluselim@yahoo.de> * @author Aydın Coşkuner <aydinweb@gmail.com> * @author Cihan Kahveci <kahvecicihan@gmail.com> * @author Yavuz Selim <yavuzselim@gmail.com> * @author Caleb Maclennan <caleb@alerque.com> * @author farukerdemoncel@gmail.com + * @author Mustafa Aslan <maslan@hotmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -52,6 +53,7 @@ $lang['btn_revert'] = 'Geri Yükle'; $lang['btn_register'] = 'Kayıt ol'; $lang['btn_apply'] = 'Uygula'; $lang['btn_media'] = 'Çokluortam Yöneticisi'; +$lang['btn_deleteuser'] = 'Hesabımı Sil'; $lang['loggedinas'] = 'Giriş ismi'; $lang['user'] = 'Kullanıcı ismi'; $lang['pass'] = 'Parola'; @@ -63,6 +65,7 @@ $lang['fullname'] = 'Tam isim'; $lang['email'] = 'E-posta'; $lang['profile'] = 'Kullanıcı Bilgileri'; $lang['badlogin'] = 'Üzgünüz, Kullanıcı adı veya şifre yanlış oldu.'; +$lang['badpassconfirm'] = 'Üzgünüz, parolanız yanlış'; $lang['minoredit'] = 'Küçük Değişiklikler'; $lang['draftdate'] = 'Taslak şu saatte otomatik kaydedildi:'; $lang['nosecedit'] = 'Sayfa yakın zamanda değiştirilmiştir, bölüm bilgisi eski kalmıştır. Bunun için bölüm yerine tüm sayfa yüklenmiştir.'; @@ -79,6 +82,11 @@ $lang['profna'] = 'Bu wiki kullanıcı bilgilerini değiştirmeyi $lang['profnochange'] = 'Değişiklik yok, birşey yapılmadı.'; $lang['profnoempty'] = 'Boş isim veya e-posta adresine izin verilmiyor.'; $lang['profchanged'] = 'Kullanıcı bilgileri başarıyla değiştirildi.'; +$lang['profnodelete'] = 'Bu wiki kullanıcı silmeyi desteklemiyor'; +$lang['profdeleteuser'] = 'Hesabı Sil'; +$lang['profdeleted'] = 'Bu wiki\'den hesabınız silindi'; +$lang['profconfdelete'] = 'Bu wiki\'den hesabımı silmek istiyorum. <br/>Bu işlem geri alınamaz'; +$lang['profconfdeletemissing'] = 'Onay kutusu işaretlenmedi'; $lang['pwdforget'] = 'Parolanızı mı unuttunuz? Yeni bir parola alın'; $lang['resendna'] = 'Bu wiki parolayı tekrar göndermeyi desteklememektedir.'; $lang['resendpwd'] = 'İçin yeni şifre belirle'; @@ -94,6 +102,7 @@ $lang['searchmedia_in'] = '%s içinde ara'; $lang['txt_upload'] = 'Yüklenecek dosyayı seç'; $lang['txt_filename'] = 'Dosya adı (zorunlu değil)'; $lang['txt_overwrt'] = 'Mevcut dosyanın üstüne yaz'; +$lang['maxuploadsize'] = 'Yükleme dosya başına en fazla %s'; $lang['lockedby'] = 'Şu an şunun tarafından kilitli:'; $lang['lockexpire'] = 'Kilitin açılma tarihi:'; $lang['js']['willexpire'] = 'Bu sayfayı değiştirme kilidinin süresi yaklaşık bir dakika içinde geçecek.\nÇakışmaları önlemek için önizleme tuşunu kullanarak kilit sayacını sıfırla.'; @@ -129,6 +138,7 @@ $lang['js']['linkto'] = 'Bağlantı:'; $lang['js']['del_confirm'] = 'Bu girişi sil?'; $lang['js']['restore_confirm'] = 'Bu sürüme geri dönmek istediğinizden emin misiniz?'; $lang['js']['media_diff'] = 'Farkları gör:'; +$lang['js']['media_diff_both'] = 'Yan yana'; $lang['js']['media_select'] = 'Dosyalar seç...'; $lang['js']['media_upload_btn'] = 'Yükle'; $lang['js']['media_done_btn'] = 'Bitti'; @@ -230,7 +240,6 @@ $lang['img_height'] = 'Yükseklik'; $lang['img_manager'] = 'Ortam oynatıcısında göster'; $lang['subscr_m_subscribe'] = 'Kayıt ol'; $lang['subscr_m_receive'] = 'Al'; -$lang['authmodfailed'] = 'Yanlış kullanıcı onaylama ayarı. Lütfen Wiki yöneticisine bildiriniz.'; $lang['authtempfail'] = 'Kullanıcı doğrulama geçici olarak yapılamıyor. Eğer bu durum devam ederse lütfen Wiki yöneticine haber veriniz.'; $lang['authpwdexpire'] = 'Şifreniz %d gün sonra geçersiz hale gelecek, yakın bir zamanda değiştirmelisiniz.'; $lang['i_chooselang'] = 'Dili seçiniz'; diff --git a/inc/lang/uk/lang.php b/inc/lang/uk/lang.php index 6aa468c50..4e91e82a2 100644 --- a/inc/lang/uk/lang.php +++ b/inc/lang/uk/lang.php @@ -1,14 +1,15 @@ <?php + /** - * ukrainian language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author Oleksiy Voronin <ovoronin@gmail.com> * @author serg_stetsuk@ukr.net * @author Oleksandr Kunytsia <okunia@gmail.com> * @author Uko <uko@uar.net> * @author Ulrikhe Lukoie <lukoie@gmail.com> * @author Kate Arzamastseva pshns@ukr.net + * @author Egor Smkv <egorsmkv@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -44,12 +45,14 @@ $lang['btn_backtomedia'] = 'Назад до вибору медіа-фай $lang['btn_subscribe'] = 'Підписатися'; $lang['btn_profile'] = 'Оновити профіль'; $lang['btn_reset'] = 'Очистити'; +$lang['btn_resendpwd'] = 'Встановити новий пароль'; $lang['btn_draft'] = 'Редагувати чернетку'; $lang['btn_recover'] = 'Відновити чернетку'; $lang['btn_draftdel'] = 'Знищити чернетку'; $lang['btn_revert'] = 'Відновити'; $lang['btn_register'] = 'Реєстрація'; $lang['btn_apply'] = 'Застосувати'; +$lang['btn_deleteuser'] = 'Видалити мій аккаунт'; $lang['loggedinas'] = 'Ви'; $lang['user'] = 'Користувач'; $lang['pass'] = 'Пароль'; @@ -61,6 +64,7 @@ $lang['fullname'] = 'Повне ім\'я'; $lang['email'] = 'E-Mail'; $lang['profile'] = 'Профіль користувача'; $lang['badlogin'] = 'Вибачте, невірне ім\'я чи пароль.'; +$lang['badpassconfirm'] = 'Вибачте, але пароль невірний'; $lang['minoredit'] = 'Незначні зміни'; $lang['draftdate'] = 'Чернетка збережена'; $lang['nosecedit'] = 'Сторінку змінено, дані розділу застарілі. Завантажено сторінку повністю.'; @@ -77,8 +81,10 @@ $lang['profna'] = 'Ця Вікі не підтримує змін $lang['profnochange'] = 'Немає змін, немає що робити.'; $lang['profnoempty'] = 'Ім’я або e-mail не можуть бути пустими.'; $lang['profchanged'] = 'Профіль успішно змінено.'; +$lang['profdeleteuser'] = 'Видалити аккаунт'; $lang['pwdforget'] = 'Забули пароль? Отримайте новий'; $lang['resendna'] = 'Ця Вікі не підтримує повторне відправлення пароля.'; +$lang['resendpwd'] = 'Встановити новий пароль для'; $lang['resendpwdmissing'] = 'Необхідно заповнити усі поля.'; $lang['resendpwdnouser'] = 'Такий користувач не існує.'; $lang['resendpwdbadauth'] = 'Код автентифікації невірний. Перевірте, чи ви використали повне посилання для підтвердження.'; @@ -125,6 +131,9 @@ $lang['js']['nosmblinks'] = 'Посилання на мережеві па $lang['js']['linkwiz'] = 'Чарівник посилань'; $lang['js']['linkto'] = 'Посилання на:'; $lang['js']['del_confirm'] = 'Дійсно знищити обрані елементи?'; +$lang['js']['media_upload_btn'] = 'Завантажити'; +$lang['js']['media_done_btn'] = 'Успішно'; +$lang['js']['media_cancel'] = 'видалити'; $lang['rssfailed'] = 'Виникла помилка під час отримання RSS-стрічки: '; $lang['nothingfound'] = 'Нічого не знайдено.'; $lang['mediaselect'] = 'Вибір медіа-файлу'; @@ -174,11 +183,17 @@ $lang['external_edit'] = 'зовнішнє редагування'; $lang['summary'] = 'Підсумок змін'; $lang['noflash'] = 'Для перегляду цієї сторінки необхідно встановити <a href="http://www.adobe.com/products/flashplayer/">Adobe Flash Plugin</a>.'; $lang['download'] = 'Завантажити фрагмент'; +$lang['tools'] = 'Налаштування'; +$lang['user_tools'] = 'Користувальницькькі налаштування'; +$lang['site_tools'] = 'Налаштування сайту'; +$lang['page_tools'] = 'Налаштування сторінки'; +$lang['sidebar'] = 'Сайдбар'; $lang['mail_newpage'] = 'сторінку додано:'; $lang['mail_changed'] = 'сторінку змінено:'; $lang['mail_subscribe_list'] = 'сторінки, що змінено у просторі імен:'; $lang['mail_new_user'] = 'новий користувач:'; $lang['mail_upload'] = 'завантажено файл:'; +$lang['pages_changes'] = 'Сторінок'; $lang['qb_bold'] = 'Напівжирний текст'; $lang['qb_italic'] = 'Курсив'; $lang['qb_underl'] = 'Підкреслений текст'; @@ -235,7 +250,6 @@ $lang['subscr_m_receive'] = 'Отримувати'; $lang['subscr_style_every'] = 'повідомляти на пошту про кожну зміну'; $lang['subscr_style_digest'] = 'лист з дайджестом для зміни кожної сторінки (кожні %.2f днів)'; $lang['subscr_style_list'] = 'список змінених сторінок від часу отримання останнього листа (кожні %.2f днів)'; -$lang['authmodfailed'] = 'Неправильні налаштування автентифікації користувача. Будь ласка, повідомте про це адміністратора.'; $lang['authtempfail'] = 'Автентифікація користувача тимчасово не доступна. Якщо це буде продовжуватись, будь ласка, повідомте адміністратора.'; $lang['i_chooselang'] = 'Виберіть мову'; $lang['i_installer'] = 'Програма установки ДокуВікі'; diff --git a/inc/lang/zh-tw/lang.php b/inc/lang/zh-tw/lang.php index 0a3dbf51f..456377810 100644 --- a/inc/lang/zh-tw/lang.php +++ b/inc/lang/zh-tw/lang.php @@ -1,17 +1,18 @@ <?php + /** - * Chinese(Traditional) language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author chinsan <chinsan@mail2000.com.tw> * @author Li-Jiun Huang <ljhuang.tw@gmail.com> * @author http://www.chinese-tools.com/tools/converter-simptrad.html * @author Wayne San <waynesan@zerozone.tw> * @author Cheng-Wei Chien <e.cwchien@gmail.com> - * @author Danny Lin * @author Shuo-Ting Jian <shoting@gmail.com> * @author syaoranhinata@gmail.com * @author Ichirou Uchiki <syaoranhinata@gmail.com> + * @author tsangho <ou4222@gmail.com> + * @author Danny Lin <danny0838@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -55,6 +56,7 @@ $lang['btn_revert'] = '復原'; $lang['btn_register'] = '註冊'; $lang['btn_apply'] = '套用'; $lang['btn_media'] = '多媒體管理器'; +$lang['btn_deleteuser'] = '移除我的帳號'; $lang['loggedinas'] = '登入成'; $lang['user'] = '帳號'; $lang['pass'] = '密碼'; @@ -66,6 +68,7 @@ $lang['fullname'] = '姓名'; $lang['email'] = '電郵'; $lang['profile'] = '使用者個人資料'; $lang['badlogin'] = '很抱歉,您的使用者名稱或密碼可能有錯誤。'; +$lang['badpassconfirm'] = '抱歉,這密碼是錯的'; $lang['minoredit'] = '小修改'; $lang['draftdate'] = '草稿已自動存檔於'; $lang['nosecedit'] = '在您編輯期間,其他使用者修改過本頁面。區段資料已逾時,因此系統載入了全頁,以取代之。'; @@ -78,12 +81,17 @@ $lang['regbadmail'] = '您輸入的電郵地址似乎不正確。若 $lang['regbadpass'] = '兩次輸入的密碼不一致,請再試一次。'; $lang['regpwmail'] = '您的 DokuWiki 帳號密碼'; $lang['reghere'] = '您還沒有帳號嗎?註冊一個吧。'; -$lang['profna'] = '在本 wiki 上,不能修改個人資料。'; +$lang['profna'] = '本 wiki 不支援修改個人資料。'; $lang['profnochange'] = '並未作任何變更。'; $lang['profnoempty'] = '帳號或電郵地址不可空白!'; $lang['profchanged'] = '個人資料已更新。'; +$lang['profnodelete'] = '本 wiki 不支援刪除使用者'; +$lang['profdeleteuser'] = '刪除帳號'; +$lang['profdeleted'] = '您的使用者帳號已從本 wiki 刪除'; +$lang['profconfdelete'] = '我想把帳號從本 wiki 刪除(不能復原)'; +$lang['profconfdeletemissing'] = '未勾選確認方塊'; $lang['pwdforget'] = '忘記密碼了?索取新密碼!'; -$lang['resendna'] = '本 wiki 並不支援重寄密碼。'; +$lang['resendna'] = '本 wiki 不支援重寄密碼。'; $lang['resendpwd'] = '設定新密碼供'; $lang['resendpwdmissing'] = '抱歉,您必須填寫所有欄位。'; $lang['resendpwdnouser'] = '抱歉,資料庫內找不到這個使用者。'; @@ -91,7 +99,7 @@ $lang['resendpwdbadauth'] = '抱歉,認證碼無效。請確認您使用 $lang['resendpwdconfirm'] = '確認連結已通過郵件發送給您了。'; $lang['resendpwdsuccess'] = '您的新密碼已寄出。'; $lang['license'] = '若無特別註明,本 wiki 上的內容都是採用以下授權方式:'; -$lang['licenseok'] = '注意:編輯此頁面表示您已同意以下的授權方式:'; +$lang['licenseok'] = '注意:編輯此頁面表示您同意用以下授權方式發布您撰寫的內容:'; $lang['searchmedia'] = '搜尋檔名:'; $lang['searchmedia_in'] = '在 %s 裏搜尋'; $lang['txt_upload'] = '請選擇要上傳的檔案'; @@ -226,7 +234,7 @@ $lang['qb_extlink'] = '外部連結'; $lang['qb_hr'] = '水平線'; $lang['qb_ol'] = '有序列表項目'; $lang['qb_ul'] = '無序列表項目'; -$lang['qb_media'] = '加入圖片或檔案'; +$lang['qb_media'] = '加入圖片或檔案 (開新視窗)'; $lang['qb_sig'] = '插入簽名'; $lang['qb_smileys'] = '表情符號'; $lang['qb_chars'] = '特殊字元'; @@ -265,7 +273,8 @@ $lang['subscr_m_receive'] = '接收'; $lang['subscr_style_every'] = '每次更改都發送信件'; $lang['subscr_style_digest'] = '對每個頁面發送更改的摘要信件 (每 %.2f 天)'; $lang['subscr_style_list'] = '自上次發信以來更改的頁面的列表 (每 %.2f 天)'; -$lang['authmodfailed'] = '帳號認證的設定不正確,請通知該本 wiki 管理員。'; + +/* auth.class language support */ $lang['authtempfail'] = '暫不提供帳號認證。若本狀況持續,請通知本 wiki 管理員。'; $lang['authpwdexpire'] = '您的密碼將在 %d 天內到期,請馬上更換新密碼。'; $lang['i_chooselang'] = '選擇您的語系'; @@ -302,7 +311,7 @@ $lang['weeks'] = '%d 週前'; $lang['days'] = '%d 天前'; $lang['hours'] = '%d 個小時前'; $lang['minutes'] = '%d 分鐘前'; -$lang['seconds'] = '%s 秒鐘前'; +$lang['seconds'] = '%d 秒鐘前'; $lang['wordblock'] = '無法儲存您的更改,因它含有受阻擋的文字 (垃圾訊息)。'; $lang['media_uploadtab'] = '上傳'; $lang['media_searchtab'] = '搜尋'; @@ -327,3 +336,8 @@ $lang['media_perm_read'] = '抱歉,您沒有足夠權限讀取檔案。' $lang['media_perm_upload'] = '抱歉,您沒有足夠權限上傳檔案。'; $lang['media_update'] = '上傳新的版本'; $lang['media_restore'] = '還原這個版本'; + +$lang['currentns'] = '目前的命名空間'; +$lang['searchresult'] = '搜尋結果'; +$lang['plainhtml'] = '純 HTML'; +$lang['wikimarkup'] = 'Wiki 語法標記'; diff --git a/inc/lang/zh/lang.php b/inc/lang/zh/lang.php index f404010ba..a125e11e7 100644 --- a/inc/lang/zh/lang.php +++ b/inc/lang/zh/lang.php @@ -1,8 +1,8 @@ <?php + /** - * Chinese(Simplified) language file - * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) + * * @author ZDYX <zhangduyixiong@gmail.com> * @author http://www.chinese-tools.com/tools/converter-tradsimp.html * @author George Sheraton <guxd@163.com> @@ -15,6 +15,9 @@ * @author caii, patent agent in China <zhoucaiqi@gmail.com> * @author lainme993@gmail.com * @author Shuo-Ting Jian <shoting@gmail.com> + * @author Rachel <rzhang0802@gmail.com> + * @author Donald <donaldtcong@gmail.com> + * @author Yangyu Huang <yangyu.huang@gmail.com> */ $lang['encoding'] = 'utf-8'; $lang['direction'] = 'ltr'; @@ -58,6 +61,7 @@ $lang['btn_revert'] = '恢复'; $lang['btn_register'] = '注册'; $lang['btn_apply'] = '应用'; $lang['btn_media'] = '媒体管理器'; +$lang['btn_deleteuser'] = '移除我的账户'; $lang['loggedinas'] = '登录为'; $lang['user'] = '用户名'; $lang['pass'] = '密码'; @@ -69,6 +73,7 @@ $lang['fullname'] = '全名'; $lang['email'] = 'E-Mail'; $lang['profile'] = '用户信息'; $lang['badlogin'] = '对不起,用户名或密码错误。'; +$lang['badpassconfirm'] = '对不起,密码错误'; $lang['minoredit'] = '细微修改'; $lang['draftdate'] = '草稿自动保存于'; $lang['nosecedit'] = '在您编辑期间本页刚被他人修改过,局部信息已过期,故载入全页。'; @@ -85,6 +90,11 @@ $lang['profna'] = '本维基不支持修改个人信息'; $lang['profnochange'] = '没有改动,不进行操作。'; $lang['profnoempty'] = '不允许使用空的用户名或邮件地址。'; $lang['profchanged'] = '用户信息更新成功。'; +$lang['profnodelete'] = '这个 wiki 不支持删除用户'; +$lang['profdeleteuser'] = '删除账号'; +$lang['profdeleted'] = '你的用户已经从这个 wiki 中删除'; +$lang['profconfdelete'] = '我希望删除我的账户。<br/>这项操作无法撤销。'; +$lang['profconfdeletemissing'] = '确认框未勾选'; $lang['pwdforget'] = '忘记密码?立即获取新密码'; $lang['resendna'] = '本维基不支持二次发送密码。'; $lang['resendpwd'] = '设置新密码用于'; @@ -269,7 +279,6 @@ $lang['subscr_m_receive'] = '接收'; $lang['subscr_style_every'] = '对每次更改发送邮件'; $lang['subscr_style_digest'] = '对每个页面发送更改的摘要邮件(每 %.2f 天)'; $lang['subscr_style_list'] = '自上封邮件以来更改的页面的列表(每 %.2f 天)'; -$lang['authmodfailed'] = '错误的用户认证设置。请通知维基管理员。'; $lang['authtempfail'] = '用户认证暂时无法使用。如果该状态一直存在,请通知维基管理员。'; $lang['authpwdexpire'] = '您的密码将在 %d 天内过期,请尽快更改'; $lang['i_chooselang'] = '选择您的语言'; diff --git a/inc/lessc.inc.php b/inc/lessc.inc.php new file mode 100644 index 000000000..0699de52f --- /dev/null +++ b/inc/lessc.inc.php @@ -0,0 +1,3675 @@ +<?php + +/** + * lessphp v0.4.0 + * http://leafo.net/lessphp + * + * LESS css compiler, adapted from http://lesscss.org + * + * Copyright 2012, Leaf Corcoran <leafot@gmail.com> + * Licensed under MIT or GPLv3, see LICENSE + */ + + +/** + * The less compiler and parser. + * + * Converting LESS to CSS is a three stage process. The incoming file is parsed + * by `lessc_parser` into a syntax tree, then it is compiled into another tree + * representing the CSS structure by `lessc`. The CSS tree is fed into a + * formatter, like `lessc_formatter` which then outputs CSS as a string. + * + * During the first compile, all values are *reduced*, which means that their + * types are brought to the lowest form before being dump as strings. This + * handles math equations, variable dereferences, and the like. + * + * The `parse` function of `lessc` is the entry point. + * + * In summary: + * + * The `lessc` class creates an intstance of the parser, feeds it LESS code, + * then transforms the resulting tree to a CSS tree. This class also holds the + * evaluation context, such as all available mixins and variables at any given + * time. + * + * The `lessc_parser` class is only concerned with parsing its input. + * + * The `lessc_formatter` takes a CSS tree, and dumps it to a formatted string, + * handling things like indentation. + */ +class lessc { + static public $VERSION = "v0.4.0"; + static protected $TRUE = array("keyword", "true"); + static protected $FALSE = array("keyword", "false"); + + protected $libFunctions = array(); + protected $registeredVars = array(); + protected $preserveComments = false; + + public $vPrefix = '@'; // prefix of abstract properties + public $mPrefix = '$'; // prefix of abstract blocks + public $parentSelector = '&'; + + public $importDisabled = false; + public $importDir = ''; + + protected $numberPrecision = null; + + protected $allParsedFiles = array(); + + // set to the parser that generated the current line when compiling + // so we know how to create error messages + protected $sourceParser = null; + protected $sourceLoc = null; + + static public $defaultValue = array("keyword", ""); + + static protected $nextImportId = 0; // uniquely identify imports + + // attempts to find the path of an import url, returns null for css files + protected function findImport($url) { + foreach ((array)$this->importDir as $dir) { + $full = $dir.(substr($dir, -1) != '/' ? '/' : '').$url; + if ($this->fileExists($file = $full.'.less') || $this->fileExists($file = $full)) { + return $file; + } + } + + return null; + } + + protected function fileExists($name) { + return is_file($name); + } + + static public function compressList($items, $delim) { + if (!isset($items[1]) && isset($items[0])) return $items[0]; + else return array('list', $delim, $items); + } + + static public function preg_quote($what) { + return preg_quote($what, '/'); + } + + protected function tryImport($importPath, $parentBlock, $out) { + if ($importPath[0] == "function" && $importPath[1] == "url") { + $importPath = $this->flattenList($importPath[2]); + } + + $str = $this->coerceString($importPath); + if ($str === null) return false; + + $url = $this->compileValue($this->lib_e($str)); + + // don't import if it ends in css + if (substr_compare($url, '.css', -4, 4) === 0) return false; + + $realPath = $this->findImport($url); + + if ($realPath === null) return false; + + if ($this->importDisabled) { + return array(false, "/* import disabled */"); + } + + if (isset($this->allParsedFiles[realpath($realPath)])) { + return array(false, null); + } + + $this->addParsedFile($realPath); + $parser = $this->makeParser($realPath); + $root = $parser->parse(file_get_contents($realPath)); + + // set the parents of all the block props + foreach ($root->props as $prop) { + if ($prop[0] == "block") { + $prop[1]->parent = $parentBlock; + } + } + + // copy mixins into scope, set their parents + // bring blocks from import into current block + // TODO: need to mark the source parser these came from this file + foreach ($root->children as $childName => $child) { + if (isset($parentBlock->children[$childName])) { + $parentBlock->children[$childName] = array_merge( + $parentBlock->children[$childName], + $child); + } else { + $parentBlock->children[$childName] = $child; + } + } + + $pi = pathinfo($realPath); + $dir = $pi["dirname"]; + + list($top, $bottom) = $this->sortProps($root->props, true); + $this->compileImportedProps($top, $parentBlock, $out, $parser, $dir); + + return array(true, $bottom, $parser, $dir); + } + + protected function compileImportedProps($props, $block, $out, $sourceParser, $importDir) { + $oldSourceParser = $this->sourceParser; + + $oldImport = $this->importDir; + + // TODO: this is because the importDir api is stupid + $this->importDir = (array)$this->importDir; + array_unshift($this->importDir, $importDir); + + foreach ($props as $prop) { + $this->compileProp($prop, $block, $out); + } + + $this->importDir = $oldImport; + $this->sourceParser = $oldSourceParser; + } + + /** + * Recursively compiles a block. + * + * A block is analogous to a CSS block in most cases. A single LESS document + * is encapsulated in a block when parsed, but it does not have parent tags + * so all of it's children appear on the root level when compiled. + * + * Blocks are made up of props and children. + * + * Props are property instructions, array tuples which describe an action + * to be taken, eg. write a property, set a variable, mixin a block. + * + * The children of a block are just all the blocks that are defined within. + * This is used to look up mixins when performing a mixin. + * + * Compiling the block involves pushing a fresh environment on the stack, + * and iterating through the props, compiling each one. + * + * See lessc::compileProp() + * + */ + protected function compileBlock($block) { + switch ($block->type) { + case "root": + $this->compileRoot($block); + break; + case null: + $this->compileCSSBlock($block); + break; + case "media": + $this->compileMedia($block); + break; + case "directive": + $name = "@" . $block->name; + if (!empty($block->value)) { + $name .= " " . $this->compileValue($this->reduce($block->value)); + } + + $this->compileNestedBlock($block, array($name)); + break; + default: + $this->throwError("unknown block type: $block->type\n"); + } + } + + protected function compileCSSBlock($block) { + $env = $this->pushEnv(); + + $selectors = $this->compileSelectors($block->tags); + $env->selectors = $this->multiplySelectors($selectors); + $out = $this->makeOutputBlock(null, $env->selectors); + + $this->scope->children[] = $out; + $this->compileProps($block, $out); + + $block->scope = $env; // mixins carry scope with them! + $this->popEnv(); + } + + protected function compileMedia($media) { + $env = $this->pushEnv($media); + $parentScope = $this->mediaParent($this->scope); + + $query = $this->compileMediaQuery($this->multiplyMedia($env)); + + $this->scope = $this->makeOutputBlock($media->type, array($query)); + $parentScope->children[] = $this->scope; + + $this->compileProps($media, $this->scope); + + if (count($this->scope->lines) > 0) { + $orphanSelelectors = $this->findClosestSelectors(); + if (!is_null($orphanSelelectors)) { + $orphan = $this->makeOutputBlock(null, $orphanSelelectors); + $orphan->lines = $this->scope->lines; + array_unshift($this->scope->children, $orphan); + $this->scope->lines = array(); + } + } + + $this->scope = $this->scope->parent; + $this->popEnv(); + } + + protected function mediaParent($scope) { + while (!empty($scope->parent)) { + if (!empty($scope->type) && $scope->type != "media") { + break; + } + $scope = $scope->parent; + } + + return $scope; + } + + protected function compileNestedBlock($block, $selectors) { + $this->pushEnv($block); + $this->scope = $this->makeOutputBlock($block->type, $selectors); + $this->scope->parent->children[] = $this->scope; + + $this->compileProps($block, $this->scope); + + $this->scope = $this->scope->parent; + $this->popEnv(); + } + + protected function compileRoot($root) { + $this->pushEnv(); + $this->scope = $this->makeOutputBlock($root->type); + $this->compileProps($root, $this->scope); + $this->popEnv(); + } + + protected function compileProps($block, $out) { + foreach ($this->sortProps($block->props) as $prop) { + $this->compileProp($prop, $block, $out); + } + + $out->lines = array_values(array_unique($out->lines)); + } + + protected function sortProps($props, $split = false) { + $vars = array(); + $imports = array(); + $other = array(); + + foreach ($props as $prop) { + switch ($prop[0]) { + case "assign": + if (isset($prop[1][0]) && $prop[1][0] == $this->vPrefix) { + $vars[] = $prop; + } else { + $other[] = $prop; + } + break; + case "import": + $id = self::$nextImportId++; + $prop[] = $id; + $imports[] = $prop; + $other[] = array("import_mixin", $id); + break; + default: + $other[] = $prop; + } + } + + if ($split) { + return array(array_merge($vars, $imports), $other); + } else { + return array_merge($vars, $imports, $other); + } + } + + protected function compileMediaQuery($queries) { + $compiledQueries = array(); + foreach ($queries as $query) { + $parts = array(); + foreach ($query as $q) { + switch ($q[0]) { + case "mediaType": + $parts[] = implode(" ", array_slice($q, 1)); + break; + case "mediaExp": + if (isset($q[2])) { + $parts[] = "($q[1]: " . + $this->compileValue($this->reduce($q[2])) . ")"; + } else { + $parts[] = "($q[1])"; + } + break; + case "variable": + $parts[] = $this->compileValue($this->reduce($q)); + break; + } + } + + if (count($parts) > 0) { + $compiledQueries[] = implode(" and ", $parts); + } + } + + $out = "@media"; + if (!empty($parts)) { + $out .= " " . + implode($this->formatter->selectorSeparator, $compiledQueries); + } + return $out; + } + + protected function multiplyMedia($env, $childQueries = null) { + if (is_null($env) || + !empty($env->block->type) && $env->block->type != "media") + { + return $childQueries; + } + + // plain old block, skip + if (empty($env->block->type)) { + return $this->multiplyMedia($env->parent, $childQueries); + } + + $out = array(); + $queries = $env->block->queries; + if (is_null($childQueries)) { + $out = $queries; + } else { + foreach ($queries as $parent) { + foreach ($childQueries as $child) { + $out[] = array_merge($parent, $child); + } + } + } + + return $this->multiplyMedia($env->parent, $out); + } + + protected function expandParentSelectors(&$tag, $replace) { + $parts = explode("$&$", $tag); + $count = 0; + foreach ($parts as &$part) { + $part = str_replace($this->parentSelector, $replace, $part, $c); + $count += $c; + } + $tag = implode($this->parentSelector, $parts); + return $count; + } + + protected function findClosestSelectors() { + $env = $this->env; + $selectors = null; + while ($env !== null) { + if (isset($env->selectors)) { + $selectors = $env->selectors; + break; + } + $env = $env->parent; + } + + return $selectors; + } + + + // multiply $selectors against the nearest selectors in env + protected function multiplySelectors($selectors) { + // find parent selectors + + $parentSelectors = $this->findClosestSelectors(); + if (is_null($parentSelectors)) { + // kill parent reference in top level selector + foreach ($selectors as &$s) { + $this->expandParentSelectors($s, ""); + } + + return $selectors; + } + + $out = array(); + foreach ($parentSelectors as $parent) { + foreach ($selectors as $child) { + $count = $this->expandParentSelectors($child, $parent); + + // don't prepend the parent tag if & was used + if ($count > 0) { + $out[] = trim($child); + } else { + $out[] = trim($parent . ' ' . $child); + } + } + } + + return $out; + } + + // reduces selector expressions + protected function compileSelectors($selectors) { + $out = array(); + + foreach ($selectors as $s) { + if (is_array($s)) { + list(, $value) = $s; + $out[] = trim($this->compileValue($this->reduce($value))); + } else { + $out[] = $s; + } + } + + return $out; + } + + protected function eq($left, $right) { + return $left == $right; + } + + protected function patternMatch($block, $orderedArgs, $keywordArgs) { + // match the guards if it has them + // any one of the groups must have all its guards pass for a match + if (!empty($block->guards)) { + $groupPassed = false; + foreach ($block->guards as $guardGroup) { + foreach ($guardGroup as $guard) { + $this->pushEnv(); + $this->zipSetArgs($block->args, $orderedArgs, $keywordArgs); + + $negate = false; + if ($guard[0] == "negate") { + $guard = $guard[1]; + $negate = true; + } + + $passed = $this->reduce($guard) == self::$TRUE; + if ($negate) $passed = !$passed; + + $this->popEnv(); + + if ($passed) { + $groupPassed = true; + } else { + $groupPassed = false; + break; + } + } + + if ($groupPassed) break; + } + + if (!$groupPassed) { + return false; + } + } + + if (empty($block->args)) { + return $block->isVararg || empty($orderedArgs) && empty($keywordArgs); + } + + $remainingArgs = $block->args; + if ($keywordArgs) { + $remainingArgs = array(); + foreach ($block->args as $arg) { + if ($arg[0] == "arg" && isset($keywordArgs[$arg[1]])) { + continue; + } + + $remainingArgs[] = $arg; + } + } + + $i = -1; // no args + // try to match by arity or by argument literal + foreach ($remainingArgs as $i => $arg) { + switch ($arg[0]) { + case "lit": + if (empty($orderedArgs[$i]) || !$this->eq($arg[1], $orderedArgs[$i])) { + return false; + } + break; + case "arg": + // no arg and no default value + if (!isset($orderedArgs[$i]) && !isset($arg[2])) { + return false; + } + break; + case "rest": + $i--; // rest can be empty + break 2; + } + } + + if ($block->isVararg) { + return true; // not having enough is handled above + } else { + $numMatched = $i + 1; + // greater than becuase default values always match + return $numMatched >= count($orderedArgs); + } + } + + protected function patternMatchAll($blocks, $orderedArgs, $keywordArgs, $skip=array()) { + $matches = null; + foreach ($blocks as $block) { + // skip seen blocks that don't have arguments + if (isset($skip[$block->id]) && !isset($block->args)) { + continue; + } + + if ($this->patternMatch($block, $orderedArgs, $keywordArgs)) { + $matches[] = $block; + } + } + + return $matches; + } + + // attempt to find blocks matched by path and args + protected function findBlocks($searchIn, $path, $orderedArgs, $keywordArgs, $seen=array()) { + if ($searchIn == null) return null; + if (isset($seen[$searchIn->id])) return null; + $seen[$searchIn->id] = true; + + $name = $path[0]; + + if (isset($searchIn->children[$name])) { + $blocks = $searchIn->children[$name]; + if (count($path) == 1) { + $matches = $this->patternMatchAll($blocks, $orderedArgs, $keywordArgs, $seen); + if (!empty($matches)) { + // This will return all blocks that match in the closest + // scope that has any matching block, like lessjs + return $matches; + } + } else { + $matches = array(); + foreach ($blocks as $subBlock) { + $subMatches = $this->findBlocks($subBlock, + array_slice($path, 1), $orderedArgs, $keywordArgs, $seen); + + if (!is_null($subMatches)) { + foreach ($subMatches as $sm) { + $matches[] = $sm; + } + } + } + + return count($matches) > 0 ? $matches : null; + } + } + if ($searchIn->parent === $searchIn) return null; + return $this->findBlocks($searchIn->parent, $path, $orderedArgs, $keywordArgs, $seen); + } + + // sets all argument names in $args to either the default value + // or the one passed in through $values + protected function zipSetArgs($args, $orderedValues, $keywordValues) { + $assignedValues = array(); + + $i = 0; + foreach ($args as $a) { + if ($a[0] == "arg") { + if (isset($keywordValues[$a[1]])) { + // has keyword arg + $value = $keywordValues[$a[1]]; + } elseif (isset($orderedValues[$i])) { + // has ordered arg + $value = $orderedValues[$i]; + $i++; + } elseif (isset($a[2])) { + // has default value + $value = $a[2]; + } else { + $this->throwError("Failed to assign arg " . $a[1]); + $value = null; // :( + } + + $value = $this->reduce($value); + $this->set($a[1], $value); + $assignedValues[] = $value; + } else { + // a lit + $i++; + } + } + + // check for a rest + $last = end($args); + if ($last[0] == "rest") { + $rest = array_slice($orderedValues, count($args) - 1); + $this->set($last[1], $this->reduce(array("list", " ", $rest))); + } + + // wow is this the only true use of PHP's + operator for arrays? + $this->env->arguments = $assignedValues + $orderedValues; + } + + // compile a prop and update $lines or $blocks appropriately + protected function compileProp($prop, $block, $out) { + // set error position context + $this->sourceLoc = isset($prop[-1]) ? $prop[-1] : -1; + + switch ($prop[0]) { + case 'assign': + list(, $name, $value) = $prop; + if ($name[0] == $this->vPrefix) { + $this->set($name, $value); + } else { + $out->lines[] = $this->formatter->property($name, + $this->compileValue($this->reduce($value))); + } + break; + case 'block': + list(, $child) = $prop; + $this->compileBlock($child); + break; + case 'mixin': + list(, $path, $args, $suffix) = $prop; + + $orderedArgs = array(); + $keywordArgs = array(); + foreach ((array)$args as $arg) { + $argval = null; + switch ($arg[0]) { + case "arg": + if (!isset($arg[2])) { + $orderedArgs[] = $this->reduce(array("variable", $arg[1])); + } else { + $keywordArgs[$arg[1]] = $this->reduce($arg[2]); + } + break; + + case "lit": + $orderedArgs[] = $this->reduce($arg[1]); + break; + default: + $this->throwError("Unknown arg type: " . $arg[0]); + } + } + + $mixins = $this->findBlocks($block, $path, $orderedArgs, $keywordArgs); + + if ($mixins === null) { + // fwrite(STDERR,"failed to find block: ".implode(" > ", $path)."\n"); + break; // throw error here?? + } + + foreach ($mixins as $mixin) { + if ($mixin === $block && !$orderedArgs) { + continue; + } + + $haveScope = false; + if (isset($mixin->parent->scope)) { + $haveScope = true; + $mixinParentEnv = $this->pushEnv(); + $mixinParentEnv->storeParent = $mixin->parent->scope; + } + + $haveArgs = false; + if (isset($mixin->args)) { + $haveArgs = true; + $this->pushEnv(); + $this->zipSetArgs($mixin->args, $orderedArgs, $keywordArgs); + } + + $oldParent = $mixin->parent; + if ($mixin != $block) $mixin->parent = $block; + + foreach ($this->sortProps($mixin->props) as $subProp) { + if ($suffix !== null && + $subProp[0] == "assign" && + is_string($subProp[1]) && + $subProp[1]{0} != $this->vPrefix) + { + $subProp[2] = array( + 'list', ' ', + array($subProp[2], array('keyword', $suffix)) + ); + } + + $this->compileProp($subProp, $mixin, $out); + } + + $mixin->parent = $oldParent; + + if ($haveArgs) $this->popEnv(); + if ($haveScope) $this->popEnv(); + } + + break; + case 'raw': + $out->lines[] = $prop[1]; + break; + case "directive": + list(, $name, $value) = $prop; + $out->lines[] = "@$name " . $this->compileValue($this->reduce($value)).';'; + break; + case "comment": + $out->lines[] = $prop[1]; + break; + case "import"; + list(, $importPath, $importId) = $prop; + $importPath = $this->reduce($importPath); + + if (!isset($this->env->imports)) { + $this->env->imports = array(); + } + + $result = $this->tryImport($importPath, $block, $out); + + $this->env->imports[$importId] = $result === false ? + array(false, "@import " . $this->compileValue($importPath).";") : + $result; + + break; + case "import_mixin": + list(,$importId) = $prop; + $import = $this->env->imports[$importId]; + if ($import[0] === false) { + if (isset($import[1])) { + $out->lines[] = $import[1]; + } + } else { + list(, $bottom, $parser, $importDir) = $import; + $this->compileImportedProps($bottom, $block, $out, $parser, $importDir); + } + + break; + default: + $this->throwError("unknown op: {$prop[0]}\n"); + } + } + + + /** + * Compiles a primitive value into a CSS property value. + * + * Values in lessphp are typed by being wrapped in arrays, their format is + * typically: + * + * array(type, contents [, additional_contents]*) + * + * The input is expected to be reduced. This function will not work on + * things like expressions and variables. + */ + protected function compileValue($value) { + switch ($value[0]) { + case 'list': + // [1] - delimiter + // [2] - array of values + return implode($value[1], array_map(array($this, 'compileValue'), $value[2])); + case 'raw_color': + if (!empty($this->formatter->compressColors)) { + return $this->compileValue($this->coerceColor($value)); + } + return $value[1]; + case 'keyword': + // [1] - the keyword + return $value[1]; + case 'number': + list(, $num, $unit) = $value; + // [1] - the number + // [2] - the unit + if ($this->numberPrecision !== null) { + $num = round($num, $this->numberPrecision); + } + return $num . $unit; + case 'string': + // [1] - contents of string (includes quotes) + list(, $delim, $content) = $value; + foreach ($content as &$part) { + if (is_array($part)) { + $part = $this->compileValue($part); + } + } + return $delim . implode($content) . $delim; + case 'color': + // [1] - red component (either number or a %) + // [2] - green component + // [3] - blue component + // [4] - optional alpha component + list(, $r, $g, $b) = $value; + $r = round($r); + $g = round($g); + $b = round($b); + + if (count($value) == 5 && $value[4] != 1) { // rgba + return 'rgba('.$r.','.$g.','.$b.','.$value[4].')'; + } + + $h = sprintf("#%02x%02x%02x", $r, $g, $b); + + if (!empty($this->formatter->compressColors)) { + // Converting hex color to short notation (e.g. #003399 to #039) + if ($h[1] === $h[2] && $h[3] === $h[4] && $h[5] === $h[6]) { + $h = '#' . $h[1] . $h[3] . $h[5]; + } + } + + return $h; + + case 'function': + list(, $name, $args) = $value; + return $name.'('.$this->compileValue($args).')'; + default: // assumed to be unit + $this->throwError("unknown value type: $value[0]"); + } + } + + protected function lib_pow($args) { + list($base, $exp) = $this->assertArgs($args, 2, "pow"); + return pow($this->assertNumber($base), $this->assertNumber($exp)); + } + + protected function lib_pi() { + return pi(); + } + + protected function lib_mod($args) { + list($a, $b) = $this->assertArgs($args, 2, "mod"); + return $this->assertNumber($a) % $this->assertNumber($b); + } + + protected function lib_tan($num) { + return tan($this->assertNumber($num)); + } + + protected function lib_sin($num) { + return sin($this->assertNumber($num)); + } + + protected function lib_cos($num) { + return cos($this->assertNumber($num)); + } + + protected function lib_atan($num) { + $num = atan($this->assertNumber($num)); + return array("number", $num, "rad"); + } + + protected function lib_asin($num) { + $num = asin($this->assertNumber($num)); + return array("number", $num, "rad"); + } + + protected function lib_acos($num) { + $num = acos($this->assertNumber($num)); + return array("number", $num, "rad"); + } + + protected function lib_sqrt($num) { + return sqrt($this->assertNumber($num)); + } + + protected function lib_extract($value) { + list($list, $idx) = $this->assertArgs($value, 2, "extract"); + $idx = $this->assertNumber($idx); + // 1 indexed + if ($list[0] == "list" && isset($list[2][$idx - 1])) { + return $list[2][$idx - 1]; + } + } + + protected function lib_isnumber($value) { + return $this->toBool($value[0] == "number"); + } + + protected function lib_isstring($value) { + return $this->toBool($value[0] == "string"); + } + + protected function lib_iscolor($value) { + return $this->toBool($this->coerceColor($value)); + } + + protected function lib_iskeyword($value) { + return $this->toBool($value[0] == "keyword"); + } + + protected function lib_ispixel($value) { + return $this->toBool($value[0] == "number" && $value[2] == "px"); + } + + protected function lib_ispercentage($value) { + return $this->toBool($value[0] == "number" && $value[2] == "%"); + } + + protected function lib_isem($value) { + return $this->toBool($value[0] == "number" && $value[2] == "em"); + } + + protected function lib_isrem($value) { + return $this->toBool($value[0] == "number" && $value[2] == "rem"); + } + + protected function lib_rgbahex($color) { + $color = $this->coerceColor($color); + if (is_null($color)) + $this->throwError("color expected for rgbahex"); + + return sprintf("#%02x%02x%02x%02x", + isset($color[4]) ? $color[4]*255 : 255, + $color[1],$color[2], $color[3]); + } + + protected function lib_argb($color){ + return $this->lib_rgbahex($color); + } + + // utility func to unquote a string + protected function lib_e($arg) { + switch ($arg[0]) { + case "list": + $items = $arg[2]; + if (isset($items[0])) { + return $this->lib_e($items[0]); + } + return self::$defaultValue; + case "string": + $arg[1] = ""; + return $arg; + case "keyword": + return $arg; + default: + return array("keyword", $this->compileValue($arg)); + } + } + + protected function lib__sprintf($args) { + if ($args[0] != "list") return $args; + $values = $args[2]; + $string = array_shift($values); + $template = $this->compileValue($this->lib_e($string)); + + $i = 0; + if (preg_match_all('/%[dsa]/', $template, $m)) { + foreach ($m[0] as $match) { + $val = isset($values[$i]) ? + $this->reduce($values[$i]) : array('keyword', ''); + + // lessjs compat, renders fully expanded color, not raw color + if ($color = $this->coerceColor($val)) { + $val = $color; + } + + $i++; + $rep = $this->compileValue($this->lib_e($val)); + $template = preg_replace('/'.self::preg_quote($match).'/', + $rep, $template, 1); + } + } + + $d = $string[0] == "string" ? $string[1] : '"'; + return array("string", $d, array($template)); + } + + protected function lib_floor($arg) { + $value = $this->assertNumber($arg); + return array("number", floor($value), $arg[2]); + } + + protected function lib_ceil($arg) { + $value = $this->assertNumber($arg); + return array("number", ceil($value), $arg[2]); + } + + protected function lib_round($arg) { + $value = $this->assertNumber($arg); + return array("number", round($value), $arg[2]); + } + + protected function lib_unit($arg) { + if ($arg[0] == "list") { + list($number, $newUnit) = $arg[2]; + return array("number", $this->assertNumber($number), + $this->compileValue($this->lib_e($newUnit))); + } else { + return array("number", $this->assertNumber($arg), ""); + } + } + + /** + * Helper function to get arguments for color manipulation functions. + * takes a list that contains a color like thing and a percentage + */ + protected function colorArgs($args) { + if ($args[0] != 'list' || count($args[2]) < 2) { + return array(array('color', 0, 0, 0), 0); + } + list($color, $delta) = $args[2]; + $color = $this->assertColor($color); + $delta = floatval($delta[1]); + + return array($color, $delta); + } + + protected function lib_darken($args) { + list($color, $delta) = $this->colorArgs($args); + + $hsl = $this->toHSL($color); + $hsl[3] = $this->clamp($hsl[3] - $delta, 100); + return $this->toRGB($hsl); + } + + protected function lib_lighten($args) { + list($color, $delta) = $this->colorArgs($args); + + $hsl = $this->toHSL($color); + $hsl[3] = $this->clamp($hsl[3] + $delta, 100); + return $this->toRGB($hsl); + } + + protected function lib_saturate($args) { + list($color, $delta) = $this->colorArgs($args); + + $hsl = $this->toHSL($color); + $hsl[2] = $this->clamp($hsl[2] + $delta, 100); + return $this->toRGB($hsl); + } + + protected function lib_desaturate($args) { + list($color, $delta) = $this->colorArgs($args); + + $hsl = $this->toHSL($color); + $hsl[2] = $this->clamp($hsl[2] - $delta, 100); + return $this->toRGB($hsl); + } + + protected function lib_spin($args) { + list($color, $delta) = $this->colorArgs($args); + + $hsl = $this->toHSL($color); + + $hsl[1] = $hsl[1] + $delta % 360; + if ($hsl[1] < 0) $hsl[1] += 360; + + return $this->toRGB($hsl); + } + + protected function lib_fadeout($args) { + list($color, $delta) = $this->colorArgs($args); + $color[4] = $this->clamp((isset($color[4]) ? $color[4] : 1) - $delta/100); + return $color; + } + + protected function lib_fadein($args) { + list($color, $delta) = $this->colorArgs($args); + $color[4] = $this->clamp((isset($color[4]) ? $color[4] : 1) + $delta/100); + return $color; + } + + protected function lib_hue($color) { + $hsl = $this->toHSL($this->assertColor($color)); + return round($hsl[1]); + } + + protected function lib_saturation($color) { + $hsl = $this->toHSL($this->assertColor($color)); + return round($hsl[2]); + } + + protected function lib_lightness($color) { + $hsl = $this->toHSL($this->assertColor($color)); + return round($hsl[3]); + } + + // get the alpha of a color + // defaults to 1 for non-colors or colors without an alpha + protected function lib_alpha($value) { + if (!is_null($color = $this->coerceColor($value))) { + return isset($color[4]) ? $color[4] : 1; + } + } + + // set the alpha of the color + protected function lib_fade($args) { + list($color, $alpha) = $this->colorArgs($args); + $color[4] = $this->clamp($alpha / 100.0); + return $color; + } + + protected function lib_percentage($arg) { + $num = $this->assertNumber($arg); + return array("number", $num*100, "%"); + } + + // mixes two colors by weight + // mix(@color1, @color2, [@weight: 50%]); + // http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method + protected function lib_mix($args) { + if ($args[0] != "list" || count($args[2]) < 2) + $this->throwError("mix expects (color1, color2, weight)"); + + list($first, $second) = $args[2]; + $first = $this->assertColor($first); + $second = $this->assertColor($second); + + $first_a = $this->lib_alpha($first); + $second_a = $this->lib_alpha($second); + + if (isset($args[2][2])) { + $weight = $args[2][2][1] / 100.0; + } else { + $weight = 0.5; + } + + $w = $weight * 2 - 1; + $a = $first_a - $second_a; + + $w1 = (($w * $a == -1 ? $w : ($w + $a)/(1 + $w * $a)) + 1) / 2.0; + $w2 = 1.0 - $w1; + + $new = array('color', + $w1 * $first[1] + $w2 * $second[1], + $w1 * $first[2] + $w2 * $second[2], + $w1 * $first[3] + $w2 * $second[3], + ); + + if ($first_a != 1.0 || $second_a != 1.0) { + $new[] = $first_a * $weight + $second_a * ($weight - 1); + } + + return $this->fixColor($new); + } + + protected function lib_contrast($args) { + if ($args[0] != 'list' || count($args[2]) < 3) { + return array(array('color', 0, 0, 0), 0); + } + + list($inputColor, $darkColor, $lightColor) = $args[2]; + + $inputColor = $this->assertColor($inputColor); + $darkColor = $this->assertColor($darkColor); + $lightColor = $this->assertColor($lightColor); + $hsl = $this->toHSL($inputColor); + + if ($hsl[3] > 50) { + return $darkColor; + } + + return $lightColor; + } + + protected function assertColor($value, $error = "expected color value") { + $color = $this->coerceColor($value); + if (is_null($color)) $this->throwError($error); + return $color; + } + + protected function assertNumber($value, $error = "expecting number") { + if ($value[0] == "number") return $value[1]; + $this->throwError($error); + } + + protected function assertArgs($value, $expectedArgs, $name="") { + if ($expectedArgs == 1) { + return $value; + } else { + if ($value[0] !== "list" || $value[1] != ",") $this->throwError("expecting list"); + $values = $value[2]; + $numValues = count($values); + if ($expectedArgs != $numValues) { + if ($name) { + $name = $name . ": "; + } + + $this->throwError("${name}expecting $expectedArgs arguments, got $numValues"); + } + + return $values; + } + } + + protected function toHSL($color) { + if ($color[0] == 'hsl') return $color; + + $r = $color[1] / 255; + $g = $color[2] / 255; + $b = $color[3] / 255; + + $min = min($r, $g, $b); + $max = max($r, $g, $b); + + $L = ($min + $max) / 2; + if ($min == $max) { + $S = $H = 0; + } else { + if ($L < 0.5) + $S = ($max - $min)/($max + $min); + else + $S = ($max - $min)/(2.0 - $max - $min); + + if ($r == $max) $H = ($g - $b)/($max - $min); + elseif ($g == $max) $H = 2.0 + ($b - $r)/($max - $min); + elseif ($b == $max) $H = 4.0 + ($r - $g)/($max - $min); + + } + + $out = array('hsl', + ($H < 0 ? $H + 6 : $H)*60, + $S*100, + $L*100, + ); + + if (count($color) > 4) $out[] = $color[4]; // copy alpha + return $out; + } + + protected function toRGB_helper($comp, $temp1, $temp2) { + if ($comp < 0) $comp += 1.0; + elseif ($comp > 1) $comp -= 1.0; + + if (6 * $comp < 1) return $temp1 + ($temp2 - $temp1) * 6 * $comp; + if (2 * $comp < 1) return $temp2; + if (3 * $comp < 2) return $temp1 + ($temp2 - $temp1)*((2/3) - $comp) * 6; + + return $temp1; + } + + /** + * Converts a hsl array into a color value in rgb. + * Expects H to be in range of 0 to 360, S and L in 0 to 100 + */ + protected function toRGB($color) { + if ($color[0] == 'color') return $color; + + $H = $color[1] / 360; + $S = $color[2] / 100; + $L = $color[3] / 100; + + if ($S == 0) { + $r = $g = $b = $L; + } else { + $temp2 = $L < 0.5 ? + $L*(1.0 + $S) : + $L + $S - $L * $S; + + $temp1 = 2.0 * $L - $temp2; + + $r = $this->toRGB_helper($H + 1/3, $temp1, $temp2); + $g = $this->toRGB_helper($H, $temp1, $temp2); + $b = $this->toRGB_helper($H - 1/3, $temp1, $temp2); + } + + // $out = array('color', round($r*255), round($g*255), round($b*255)); + $out = array('color', $r*255, $g*255, $b*255); + if (count($color) > 4) $out[] = $color[4]; // copy alpha + return $out; + } + + protected function clamp($v, $max = 1, $min = 0) { + return min($max, max($min, $v)); + } + + /** + * Convert the rgb, rgba, hsl color literals of function type + * as returned by the parser into values of color type. + */ + protected function funcToColor($func) { + $fname = $func[1]; + if ($func[2][0] != 'list') return false; // need a list of arguments + $rawComponents = $func[2][2]; + + if ($fname == 'hsl' || $fname == 'hsla') { + $hsl = array('hsl'); + $i = 0; + foreach ($rawComponents as $c) { + $val = $this->reduce($c); + $val = isset($val[1]) ? floatval($val[1]) : 0; + + if ($i == 0) $clamp = 360; + elseif ($i < 3) $clamp = 100; + else $clamp = 1; + + $hsl[] = $this->clamp($val, $clamp); + $i++; + } + + while (count($hsl) < 4) $hsl[] = 0; + return $this->toRGB($hsl); + + } elseif ($fname == 'rgb' || $fname == 'rgba') { + $components = array(); + $i = 1; + foreach ($rawComponents as $c) { + $c = $this->reduce($c); + if ($i < 4) { + if ($c[0] == "number" && $c[2] == "%") { + $components[] = 255 * ($c[1] / 100); + } else { + $components[] = floatval($c[1]); + } + } elseif ($i == 4) { + if ($c[0] == "number" && $c[2] == "%") { + $components[] = 1.0 * ($c[1] / 100); + } else { + $components[] = floatval($c[1]); + } + } else break; + + $i++; + } + while (count($components) < 3) $components[] = 0; + array_unshift($components, 'color'); + return $this->fixColor($components); + } + + return false; + } + + protected function reduce($value, $forExpression = false) { + switch ($value[0]) { + case "interpolate": + $reduced = $this->reduce($value[1]); + $var = $this->compileValue($reduced); + $res = $this->reduce(array("variable", $this->vPrefix . $var)); + + if ($res[0] == "raw_color") { + $res = $this->coerceColor($res); + } + + if (empty($value[2])) $res = $this->lib_e($res); + + return $res; + case "variable": + $key = $value[1]; + if (is_array($key)) { + $key = $this->reduce($key); + $key = $this->vPrefix . $this->compileValue($this->lib_e($key)); + } + + $seen =& $this->env->seenNames; + + if (!empty($seen[$key])) { + $this->throwError("infinite loop detected: $key"); + } + + $seen[$key] = true; + $out = $this->reduce($this->get($key, self::$defaultValue)); + $seen[$key] = false; + return $out; + case "list": + foreach ($value[2] as &$item) { + $item = $this->reduce($item, $forExpression); + } + return $value; + case "expression": + return $this->evaluate($value); + case "string": + foreach ($value[2] as &$part) { + if (is_array($part)) { + $strip = $part[0] == "variable"; + $part = $this->reduce($part); + if ($strip) $part = $this->lib_e($part); + } + } + return $value; + case "escape": + list(,$inner) = $value; + return $this->lib_e($this->reduce($inner)); + case "function": + $color = $this->funcToColor($value); + if ($color) return $color; + + list(, $name, $args) = $value; + if ($name == "%") $name = "_sprintf"; + $f = isset($this->libFunctions[$name]) ? + $this->libFunctions[$name] : array($this, 'lib_'.$name); + + if (is_callable($f)) { + if ($args[0] == 'list') + $args = self::compressList($args[2], $args[1]); + + $ret = call_user_func($f, $this->reduce($args, true), $this); + + if (is_null($ret)) { + return array("string", "", array( + $name, "(", $args, ")" + )); + } + + // convert to a typed value if the result is a php primitive + if (is_numeric($ret)) $ret = array('number', $ret, ""); + elseif (!is_array($ret)) $ret = array('keyword', $ret); + + return $ret; + } + + // plain function, reduce args + $value[2] = $this->reduce($value[2]); + return $value; + case "unary": + list(, $op, $exp) = $value; + $exp = $this->reduce($exp); + + if ($exp[0] == "number") { + switch ($op) { + case "+": + return $exp; + case "-": + $exp[1] *= -1; + return $exp; + } + } + return array("string", "", array($op, $exp)); + } + + if ($forExpression) { + switch ($value[0]) { + case "keyword": + if ($color = $this->coerceColor($value)) { + return $color; + } + break; + case "raw_color": + return $this->coerceColor($value); + } + } + + return $value; + } + + + // coerce a value for use in color operation + protected function coerceColor($value) { + switch($value[0]) { + case 'color': return $value; + case 'raw_color': + $c = array("color", 0, 0, 0); + $colorStr = substr($value[1], 1); + $num = hexdec($colorStr); + $width = strlen($colorStr) == 3 ? 16 : 256; + + for ($i = 3; $i > 0; $i--) { // 3 2 1 + $t = $num % $width; + $num /= $width; + + $c[$i] = $t * (256/$width) + $t * floor(16/$width); + } + + return $c; + case 'keyword': + $name = $value[1]; + if (isset(self::$cssColors[$name])) { + $rgba = explode(',', self::$cssColors[$name]); + + if(isset($rgba[3])) + return array('color', $rgba[0], $rgba[1], $rgba[2], $rgba[3]); + + return array('color', $rgba[0], $rgba[1], $rgba[2]); + } + return null; + } + } + + // make something string like into a string + protected function coerceString($value) { + switch ($value[0]) { + case "string": + return $value; + case "keyword": + return array("string", "", array($value[1])); + } + return null; + } + + // turn list of length 1 into value type + protected function flattenList($value) { + if ($value[0] == "list" && count($value[2]) == 1) { + return $this->flattenList($value[2][0]); + } + return $value; + } + + protected function toBool($a) { + if ($a) return self::$TRUE; + else return self::$FALSE; + } + + // evaluate an expression + protected function evaluate($exp) { + list(, $op, $left, $right, $whiteBefore, $whiteAfter) = $exp; + + $left = $this->reduce($left, true); + $right = $this->reduce($right, true); + + if ($leftColor = $this->coerceColor($left)) { + $left = $leftColor; + } + + if ($rightColor = $this->coerceColor($right)) { + $right = $rightColor; + } + + $ltype = $left[0]; + $rtype = $right[0]; + + // operators that work on all types + if ($op == "and") { + return $this->toBool($left == self::$TRUE && $right == self::$TRUE); + } + + if ($op == "=") { + return $this->toBool($this->eq($left, $right) ); + } + + if ($op == "+" && !is_null($str = $this->stringConcatenate($left, $right))) { + return $str; + } + + // type based operators + $fname = "op_${ltype}_${rtype}"; + if (is_callable(array($this, $fname))) { + $out = $this->$fname($op, $left, $right); + if (!is_null($out)) return $out; + } + + // make the expression look it did before being parsed + $paddedOp = $op; + if ($whiteBefore) $paddedOp = " " . $paddedOp; + if ($whiteAfter) $paddedOp .= " "; + + return array("string", "", array($left, $paddedOp, $right)); + } + + protected function stringConcatenate($left, $right) { + if ($strLeft = $this->coerceString($left)) { + if ($right[0] == "string") { + $right[1] = ""; + } + $strLeft[2][] = $right; + return $strLeft; + } + + if ($strRight = $this->coerceString($right)) { + array_unshift($strRight[2], $left); + return $strRight; + } + } + + + // make sure a color's components don't go out of bounds + protected function fixColor($c) { + foreach (range(1, 3) as $i) { + if ($c[$i] < 0) $c[$i] = 0; + if ($c[$i] > 255) $c[$i] = 255; + } + + return $c; + } + + protected function op_number_color($op, $lft, $rgt) { + if ($op == '+' || $op == '*') { + return $this->op_color_number($op, $rgt, $lft); + } + } + + protected function op_color_number($op, $lft, $rgt) { + if ($rgt[0] == '%') $rgt[1] /= 100; + + return $this->op_color_color($op, $lft, + array_fill(1, count($lft) - 1, $rgt[1])); + } + + protected function op_color_color($op, $left, $right) { + $out = array('color'); + $max = count($left) > count($right) ? count($left) : count($right); + foreach (range(1, $max - 1) as $i) { + $lval = isset($left[$i]) ? $left[$i] : 0; + $rval = isset($right[$i]) ? $right[$i] : 0; + switch ($op) { + case '+': + $out[] = $lval + $rval; + break; + case '-': + $out[] = $lval - $rval; + break; + case '*': + $out[] = $lval * $rval; + break; + case '%': + $out[] = $lval % $rval; + break; + case '/': + if ($rval == 0) $this->throwError("evaluate error: can't divide by zero"); + $out[] = $lval / $rval; + break; + default: + $this->throwError('evaluate error: color op number failed on op '.$op); + } + } + return $this->fixColor($out); + } + + function lib_red($color){ + $color = $this->coerceColor($color); + if (is_null($color)) { + $this->throwError('color expected for red()'); + } + + return $color[1]; + } + + function lib_green($color){ + $color = $this->coerceColor($color); + if (is_null($color)) { + $this->throwError('color expected for green()'); + } + + return $color[2]; + } + + function lib_blue($color){ + $color = $this->coerceColor($color); + if (is_null($color)) { + $this->throwError('color expected for blue()'); + } + + return $color[3]; + } + + + // operator on two numbers + protected function op_number_number($op, $left, $right) { + $unit = empty($left[2]) ? $right[2] : $left[2]; + + $value = 0; + switch ($op) { + case '+': + $value = $left[1] + $right[1]; + break; + case '*': + $value = $left[1] * $right[1]; + break; + case '-': + $value = $left[1] - $right[1]; + break; + case '%': + $value = $left[1] % $right[1]; + break; + case '/': + if ($right[1] == 0) $this->throwError('parse error: divide by zero'); + $value = $left[1] / $right[1]; + break; + case '<': + return $this->toBool($left[1] < $right[1]); + case '>': + return $this->toBool($left[1] > $right[1]); + case '>=': + return $this->toBool($left[1] >= $right[1]); + case '=<': + return $this->toBool($left[1] <= $right[1]); + default: + $this->throwError('parse error: unknown number operator: '.$op); + } + + return array("number", $value, $unit); + } + + + /* environment functions */ + + protected function makeOutputBlock($type, $selectors = null) { + $b = new stdclass; + $b->lines = array(); + $b->children = array(); + $b->selectors = $selectors; + $b->type = $type; + $b->parent = $this->scope; + return $b; + } + + // the state of execution + protected function pushEnv($block = null) { + $e = new stdclass; + $e->parent = $this->env; + $e->store = array(); + $e->block = $block; + + $this->env = $e; + return $e; + } + + // pop something off the stack + protected function popEnv() { + $old = $this->env; + $this->env = $this->env->parent; + return $old; + } + + // set something in the current env + protected function set($name, $value) { + $this->env->store[$name] = $value; + } + + + // get the highest occurrence entry for a name + protected function get($name, $default=null) { + $current = $this->env; + + $isArguments = $name == $this->vPrefix . 'arguments'; + while ($current) { + if ($isArguments && isset($current->arguments)) { + return array('list', ' ', $current->arguments); + } + + if (isset($current->store[$name])) + return $current->store[$name]; + else { + $current = isset($current->storeParent) ? + $current->storeParent : $current->parent; + } + } + + return $default; + } + + // inject array of unparsed strings into environment as variables + protected function injectVariables($args) { + $this->pushEnv(); + $parser = new lessc_parser($this, __METHOD__); + foreach ($args as $name => $strValue) { + if ($name{0} != '@') $name = '@'.$name; + $parser->count = 0; + $parser->buffer = (string)$strValue; + if (!$parser->propertyValue($value)) { + throw new Exception("failed to parse passed in variable $name: $strValue"); + } + + $this->set($name, $value); + } + } + + /** + * Initialize any static state, can initialize parser for a file + * $opts isn't used yet + */ + public function __construct($fname = null) { + if ($fname !== null) { + // used for deprecated parse method + $this->_parseFile = $fname; + } + } + + public function compile($string, $name = null) { + $locale = setlocale(LC_NUMERIC, 0); + setlocale(LC_NUMERIC, "C"); + + $this->parser = $this->makeParser($name); + $root = $this->parser->parse($string); + + $this->env = null; + $this->scope = null; + + $this->formatter = $this->newFormatter(); + + if (!empty($this->registeredVars)) { + $this->injectVariables($this->registeredVars); + } + + $this->sourceParser = $this->parser; // used for error messages + $this->compileBlock($root); + + ob_start(); + $this->formatter->block($this->scope); + $out = ob_get_clean(); + setlocale(LC_NUMERIC, $locale); + return $out; + } + + public function compileFile($fname, $outFname = null) { + if (!is_readable($fname)) { + throw new Exception('load error: failed to find '.$fname); + } + + $pi = pathinfo($fname); + + $oldImport = $this->importDir; + + $this->importDir = (array)$this->importDir; + $this->importDir[] = $pi['dirname'].'/'; + + $this->addParsedFile($fname); + + $out = $this->compile(file_get_contents($fname), $fname); + + $this->importDir = $oldImport; + + if ($outFname !== null) { + return file_put_contents($outFname, $out); + } + + return $out; + } + + // compile only if changed input has changed or output doesn't exist + public function checkedCompile($in, $out) { + if (!is_file($out) || filemtime($in) > filemtime($out)) { + $this->compileFile($in, $out); + return true; + } + return false; + } + + /** + * Execute lessphp on a .less file or a lessphp cache structure + * + * The lessphp cache structure contains information about a specific + * less file having been parsed. It can be used as a hint for future + * calls to determine whether or not a rebuild is required. + * + * The cache structure contains two important keys that may be used + * externally: + * + * compiled: The final compiled CSS + * updated: The time (in seconds) the CSS was last compiled + * + * The cache structure is a plain-ol' PHP associative array and can + * be serialized and unserialized without a hitch. + * + * @param mixed $in Input + * @param bool $force Force rebuild? + * @return array lessphp cache structure + */ + public function cachedCompile($in, $force = false) { + // assume no root + $root = null; + + if (is_string($in)) { + $root = $in; + } elseif (is_array($in) and isset($in['root'])) { + if ($force or ! isset($in['files'])) { + // If we are forcing a recompile or if for some reason the + // structure does not contain any file information we should + // specify the root to trigger a rebuild. + $root = $in['root']; + } elseif (isset($in['files']) and is_array($in['files'])) { + foreach ($in['files'] as $fname => $ftime ) { + if (!file_exists($fname) or filemtime($fname) > $ftime) { + // One of the files we knew about previously has changed + // so we should look at our incoming root again. + $root = $in['root']; + break; + } + } + } + } else { + // TODO: Throw an exception? We got neither a string nor something + // that looks like a compatible lessphp cache structure. + return null; + } + + if ($root !== null) { + // If we have a root value which means we should rebuild. + $out = array(); + $out['root'] = $root; + $out['compiled'] = $this->compileFile($root); + $out['files'] = $this->allParsedFiles(); + $out['updated'] = time(); + return $out; + } else { + // No changes, pass back the structure + // we were given initially. + return $in; + } + + } + + // parse and compile buffer + // This is deprecated + public function parse($str = null, $initialVariables = null) { + if (is_array($str)) { + $initialVariables = $str; + $str = null; + } + + $oldVars = $this->registeredVars; + if ($initialVariables !== null) { + $this->setVariables($initialVariables); + } + + if ($str == null) { + if (empty($this->_parseFile)) { + throw new exception("nothing to parse"); + } + + $out = $this->compileFile($this->_parseFile); + } else { + $out = $this->compile($str); + } + + $this->registeredVars = $oldVars; + return $out; + } + + protected function makeParser($name) { + $parser = new lessc_parser($this, $name); + $parser->writeComments = $this->preserveComments; + + return $parser; + } + + public function setFormatter($name) { + $this->formatterName = $name; + } + + protected function newFormatter() { + $className = "lessc_formatter_lessjs"; + if (!empty($this->formatterName)) { + if (!is_string($this->formatterName)) + return $this->formatterName; + $className = "lessc_formatter_$this->formatterName"; + } + + return new $className; + } + + public function setPreserveComments($preserve) { + $this->preserveComments = $preserve; + } + + public function registerFunction($name, $func) { + $this->libFunctions[$name] = $func; + } + + public function unregisterFunction($name) { + unset($this->libFunctions[$name]); + } + + public function setVariables($variables) { + $this->registeredVars = array_merge($this->registeredVars, $variables); + } + + public function unsetVariable($name) { + unset($this->registeredVars[$name]); + } + + public function setImportDir($dirs) { + $this->importDir = (array)$dirs; + } + + public function addImportDir($dir) { + $this->importDir = (array)$this->importDir; + $this->importDir[] = $dir; + } + + public function allParsedFiles() { + return $this->allParsedFiles; + } + + protected function addParsedFile($file) { + $this->allParsedFiles[realpath($file)] = filemtime($file); + } + + /** + * Uses the current value of $this->count to show line and line number + */ + protected function throwError($msg = null) { + if ($this->sourceLoc >= 0) { + $this->sourceParser->throwError($msg, $this->sourceLoc); + } + throw new exception($msg); + } + + // compile file $in to file $out if $in is newer than $out + // returns true when it compiles, false otherwise + public static function ccompile($in, $out, $less = null) { + if ($less === null) { + $less = new self; + } + return $less->checkedCompile($in, $out); + } + + public static function cexecute($in, $force = false, $less = null) { + if ($less === null) { + $less = new self; + } + return $less->cachedCompile($in, $force); + } + + static protected $cssColors = array( + 'aliceblue' => '240,248,255', + 'antiquewhite' => '250,235,215', + 'aqua' => '0,255,255', + 'aquamarine' => '127,255,212', + 'azure' => '240,255,255', + 'beige' => '245,245,220', + 'bisque' => '255,228,196', + 'black' => '0,0,0', + 'blanchedalmond' => '255,235,205', + 'blue' => '0,0,255', + 'blueviolet' => '138,43,226', + 'brown' => '165,42,42', + 'burlywood' => '222,184,135', + 'cadetblue' => '95,158,160', + 'chartreuse' => '127,255,0', + 'chocolate' => '210,105,30', + 'coral' => '255,127,80', + 'cornflowerblue' => '100,149,237', + 'cornsilk' => '255,248,220', + 'crimson' => '220,20,60', + 'cyan' => '0,255,255', + 'darkblue' => '0,0,139', + 'darkcyan' => '0,139,139', + 'darkgoldenrod' => '184,134,11', + 'darkgray' => '169,169,169', + 'darkgreen' => '0,100,0', + 'darkgrey' => '169,169,169', + 'darkkhaki' => '189,183,107', + 'darkmagenta' => '139,0,139', + 'darkolivegreen' => '85,107,47', + 'darkorange' => '255,140,0', + 'darkorchid' => '153,50,204', + 'darkred' => '139,0,0', + 'darksalmon' => '233,150,122', + 'darkseagreen' => '143,188,143', + 'darkslateblue' => '72,61,139', + 'darkslategray' => '47,79,79', + 'darkslategrey' => '47,79,79', + 'darkturquoise' => '0,206,209', + 'darkviolet' => '148,0,211', + 'deeppink' => '255,20,147', + 'deepskyblue' => '0,191,255', + 'dimgray' => '105,105,105', + 'dimgrey' => '105,105,105', + 'dodgerblue' => '30,144,255', + 'firebrick' => '178,34,34', + 'floralwhite' => '255,250,240', + 'forestgreen' => '34,139,34', + 'fuchsia' => '255,0,255', + 'gainsboro' => '220,220,220', + 'ghostwhite' => '248,248,255', + 'gold' => '255,215,0', + 'goldenrod' => '218,165,32', + 'gray' => '128,128,128', + 'green' => '0,128,0', + 'greenyellow' => '173,255,47', + 'grey' => '128,128,128', + 'honeydew' => '240,255,240', + 'hotpink' => '255,105,180', + 'indianred' => '205,92,92', + 'indigo' => '75,0,130', + 'ivory' => '255,255,240', + 'khaki' => '240,230,140', + 'lavender' => '230,230,250', + 'lavenderblush' => '255,240,245', + 'lawngreen' => '124,252,0', + 'lemonchiffon' => '255,250,205', + 'lightblue' => '173,216,230', + 'lightcoral' => '240,128,128', + 'lightcyan' => '224,255,255', + 'lightgoldenrodyellow' => '250,250,210', + 'lightgray' => '211,211,211', + 'lightgreen' => '144,238,144', + 'lightgrey' => '211,211,211', + 'lightpink' => '255,182,193', + 'lightsalmon' => '255,160,122', + 'lightseagreen' => '32,178,170', + 'lightskyblue' => '135,206,250', + 'lightslategray' => '119,136,153', + 'lightslategrey' => '119,136,153', + 'lightsteelblue' => '176,196,222', + 'lightyellow' => '255,255,224', + 'lime' => '0,255,0', + 'limegreen' => '50,205,50', + 'linen' => '250,240,230', + 'magenta' => '255,0,255', + 'maroon' => '128,0,0', + 'mediumaquamarine' => '102,205,170', + 'mediumblue' => '0,0,205', + 'mediumorchid' => '186,85,211', + 'mediumpurple' => '147,112,219', + 'mediumseagreen' => '60,179,113', + 'mediumslateblue' => '123,104,238', + 'mediumspringgreen' => '0,250,154', + 'mediumturquoise' => '72,209,204', + 'mediumvioletred' => '199,21,133', + 'midnightblue' => '25,25,112', + 'mintcream' => '245,255,250', + 'mistyrose' => '255,228,225', + 'moccasin' => '255,228,181', + 'navajowhite' => '255,222,173', + 'navy' => '0,0,128', + 'oldlace' => '253,245,230', + 'olive' => '128,128,0', + 'olivedrab' => '107,142,35', + 'orange' => '255,165,0', + 'orangered' => '255,69,0', + 'orchid' => '218,112,214', + 'palegoldenrod' => '238,232,170', + 'palegreen' => '152,251,152', + 'paleturquoise' => '175,238,238', + 'palevioletred' => '219,112,147', + 'papayawhip' => '255,239,213', + 'peachpuff' => '255,218,185', + 'peru' => '205,133,63', + 'pink' => '255,192,203', + 'plum' => '221,160,221', + 'powderblue' => '176,224,230', + 'purple' => '128,0,128', + 'red' => '255,0,0', + 'rosybrown' => '188,143,143', + 'royalblue' => '65,105,225', + 'saddlebrown' => '139,69,19', + 'salmon' => '250,128,114', + 'sandybrown' => '244,164,96', + 'seagreen' => '46,139,87', + 'seashell' => '255,245,238', + 'sienna' => '160,82,45', + 'silver' => '192,192,192', + 'skyblue' => '135,206,235', + 'slateblue' => '106,90,205', + 'slategray' => '112,128,144', + 'slategrey' => '112,128,144', + 'snow' => '255,250,250', + 'springgreen' => '0,255,127', + 'steelblue' => '70,130,180', + 'tan' => '210,180,140', + 'teal' => '0,128,128', + 'thistle' => '216,191,216', + 'tomato' => '255,99,71', + 'transparent' => '0,0,0,0', + 'turquoise' => '64,224,208', + 'violet' => '238,130,238', + 'wheat' => '245,222,179', + 'white' => '255,255,255', + 'whitesmoke' => '245,245,245', + 'yellow' => '255,255,0', + 'yellowgreen' => '154,205,50' + ); +} + +// responsible for taking a string of LESS code and converting it into a +// syntax tree +class lessc_parser { + static protected $nextBlockId = 0; // used to uniquely identify blocks + + static protected $precedence = array( + '=<' => 0, + '>=' => 0, + '=' => 0, + '<' => 0, + '>' => 0, + + '+' => 1, + '-' => 1, + '*' => 2, + '/' => 2, + '%' => 2, + ); + + static protected $whitePattern; + static protected $commentMulti; + + static protected $commentSingle = "//"; + static protected $commentMultiLeft = "/*"; + static protected $commentMultiRight = "*/"; + + // regex string to match any of the operators + static protected $operatorString; + + // these properties will supress division unless it's inside parenthases + static protected $supressDivisionProps = + array('/border-radius$/i', '/^font$/i'); + + protected $blockDirectives = array("font-face", "keyframes", "page", "-moz-document", "viewport", "-moz-viewport", "-o-viewport", "-ms-viewport"); + protected $lineDirectives = array("charset"); + + /** + * if we are in parens we can be more liberal with whitespace around + * operators because it must evaluate to a single value and thus is less + * ambiguous. + * + * Consider: + * property1: 10 -5; // is two numbers, 10 and -5 + * property2: (10 -5); // should evaluate to 5 + */ + protected $inParens = false; + + // caches preg escaped literals + static protected $literalCache = array(); + + public function __construct($lessc, $sourceName = null) { + $this->eatWhiteDefault = true; + // reference to less needed for vPrefix, mPrefix, and parentSelector + $this->lessc = $lessc; + + $this->sourceName = $sourceName; // name used for error messages + + $this->writeComments = false; + + if (!self::$operatorString) { + self::$operatorString = + '('.implode('|', array_map(array('lessc', 'preg_quote'), + array_keys(self::$precedence))).')'; + + $commentSingle = lessc::preg_quote(self::$commentSingle); + $commentMultiLeft = lessc::preg_quote(self::$commentMultiLeft); + $commentMultiRight = lessc::preg_quote(self::$commentMultiRight); + + self::$commentMulti = $commentMultiLeft.'.*?'.$commentMultiRight; + self::$whitePattern = '/'.$commentSingle.'[^\n]*\s*|('.self::$commentMulti.')\s*|\s+/Ais'; + } + } + + public function parse($buffer) { + $this->count = 0; + $this->line = 1; + + $this->env = null; // block stack + $this->buffer = $this->writeComments ? $buffer : $this->removeComments($buffer); + $this->pushSpecialBlock("root"); + $this->eatWhiteDefault = true; + $this->seenComments = array(); + + // trim whitespace on head + // if (preg_match('/^\s+/', $this->buffer, $m)) { + // $this->line += substr_count($m[0], "\n"); + // $this->buffer = ltrim($this->buffer); + // } + $this->whitespace(); + + // parse the entire file + $lastCount = $this->count; + while (false !== $this->parseChunk()); + + if ($this->count != strlen($this->buffer)) + $this->throwError(); + + // TODO report where the block was opened + if (!is_null($this->env->parent)) + throw new exception('parse error: unclosed block'); + + return $this->env; + } + + /** + * Parse a single chunk off the head of the buffer and append it to the + * current parse environment. + * Returns false when the buffer is empty, or when there is an error. + * + * This function is called repeatedly until the entire document is + * parsed. + * + * This parser is most similar to a recursive descent parser. Single + * functions represent discrete grammatical rules for the language, and + * they are able to capture the text that represents those rules. + * + * Consider the function lessc::keyword(). (all parse functions are + * structured the same) + * + * The function takes a single reference argument. When calling the + * function it will attempt to match a keyword on the head of the buffer. + * If it is successful, it will place the keyword in the referenced + * argument, advance the position in the buffer, and return true. If it + * fails then it won't advance the buffer and it will return false. + * + * All of these parse functions are powered by lessc::match(), which behaves + * the same way, but takes a literal regular expression. Sometimes it is + * more convenient to use match instead of creating a new function. + * + * Because of the format of the functions, to parse an entire string of + * grammatical rules, you can chain them together using &&. + * + * But, if some of the rules in the chain succeed before one fails, then + * the buffer position will be left at an invalid state. In order to + * avoid this, lessc::seek() is used to remember and set buffer positions. + * + * Before parsing a chain, use $s = $this->seek() to remember the current + * position into $s. Then if a chain fails, use $this->seek($s) to + * go back where we started. + */ + protected function parseChunk() { + if (empty($this->buffer)) return false; + $s = $this->seek(); + + // setting a property + if ($this->keyword($key) && $this->assign() && + $this->propertyValue($value, $key) && $this->end()) + { + $this->append(array('assign', $key, $value), $s); + return true; + } else { + $this->seek($s); + } + + + // look for special css blocks + if ($this->literal('@', false)) { + $this->count--; + + // media + if ($this->literal('@media')) { + if (($this->mediaQueryList($mediaQueries) || true) + && $this->literal('{')) + { + $media = $this->pushSpecialBlock("media"); + $media->queries = is_null($mediaQueries) ? array() : $mediaQueries; + return true; + } else { + $this->seek($s); + return false; + } + } + + if ($this->literal("@", false) && $this->keyword($dirName)) { + if ($this->isDirective($dirName, $this->blockDirectives)) { + if (($this->openString("{", $dirValue, null, array(";")) || true) && + $this->literal("{")) + { + $dir = $this->pushSpecialBlock("directive"); + $dir->name = $dirName; + if (isset($dirValue)) $dir->value = $dirValue; + return true; + } + } elseif ($this->isDirective($dirName, $this->lineDirectives)) { + if ($this->propertyValue($dirValue) && $this->end()) { + $this->append(array("directive", $dirName, $dirValue)); + return true; + } + } + } + + $this->seek($s); + } + + // setting a variable + if ($this->variable($var) && $this->assign() && + $this->propertyValue($value) && $this->end()) + { + $this->append(array('assign', $var, $value), $s); + return true; + } else { + $this->seek($s); + } + + if ($this->import($importValue)) { + $this->append($importValue, $s); + return true; + } + + // opening parametric mixin + if ($this->tag($tag, true) && $this->argumentDef($args, $isVararg) && + ($this->guards($guards) || true) && + $this->literal('{')) + { + $block = $this->pushBlock($this->fixTags(array($tag))); + $block->args = $args; + $block->isVararg = $isVararg; + if (!empty($guards)) $block->guards = $guards; + return true; + } else { + $this->seek($s); + } + + // opening a simple block + if ($this->tags($tags) && $this->literal('{')) { + $tags = $this->fixTags($tags); + $this->pushBlock($tags); + return true; + } else { + $this->seek($s); + } + + // closing a block + if ($this->literal('}', false)) { + try { + $block = $this->pop(); + } catch (exception $e) { + $this->seek($s); + $this->throwError($e->getMessage()); + } + + $hidden = false; + if (is_null($block->type)) { + $hidden = true; + if (!isset($block->args)) { + foreach ($block->tags as $tag) { + if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) { + $hidden = false; + break; + } + } + } + + foreach ($block->tags as $tag) { + if (is_string($tag)) { + $this->env->children[$tag][] = $block; + } + } + } + + if (!$hidden) { + $this->append(array('block', $block), $s); + } + + // this is done here so comments aren't bundled into he block that + // was just closed + $this->whitespace(); + return true; + } + + // mixin + if ($this->mixinTags($tags) && + ($this->argumentDef($argv, $isVararg) || true) && + ($this->keyword($suffix) || true) && $this->end()) + { + $tags = $this->fixTags($tags); + $this->append(array('mixin', $tags, $argv, $suffix), $s); + return true; + } else { + $this->seek($s); + } + + // spare ; + if ($this->literal(';')) return true; + + return false; // got nothing, throw error + } + + protected function isDirective($dirname, $directives) { + // TODO: cache pattern in parser + $pattern = implode("|", + array_map(array("lessc", "preg_quote"), $directives)); + $pattern = '/^(-[a-z-]+-)?(' . $pattern . ')$/i'; + + return preg_match($pattern, $dirname); + } + + protected function fixTags($tags) { + // move @ tags out of variable namespace + foreach ($tags as &$tag) { + if ($tag{0} == $this->lessc->vPrefix) + $tag[0] = $this->lessc->mPrefix; + } + return $tags; + } + + // a list of expressions + protected function expressionList(&$exps) { + $values = array(); + + while ($this->expression($exp)) { + $values[] = $exp; + } + + if (count($values) == 0) return false; + + $exps = lessc::compressList($values, ' '); + return true; + } + + /** + * Attempt to consume an expression. + * @link http://en.wikipedia.org/wiki/Operator-precedence_parser#Pseudo-code + */ + protected function expression(&$out) { + if ($this->value($lhs)) { + $out = $this->expHelper($lhs, 0); + + // look for / shorthand + if (!empty($this->env->supressedDivision)) { + unset($this->env->supressedDivision); + $s = $this->seek(); + if ($this->literal("/") && $this->value($rhs)) { + $out = array("list", "", + array($out, array("keyword", "/"), $rhs)); + } else { + $this->seek($s); + } + } + + return true; + } + return false; + } + + /** + * recursively parse infix equation with $lhs at precedence $minP + */ + protected function expHelper($lhs, $minP) { + $this->inExp = true; + $ss = $this->seek(); + + while (true) { + $whiteBefore = isset($this->buffer[$this->count - 1]) && + ctype_space($this->buffer[$this->count - 1]); + + // If there is whitespace before the operator, then we require + // whitespace after the operator for it to be an expression + $needWhite = $whiteBefore && !$this->inParens; + + if ($this->match(self::$operatorString.($needWhite ? '\s' : ''), $m) && self::$precedence[$m[1]] >= $minP) { + if (!$this->inParens && isset($this->env->currentProperty) && $m[1] == "/" && empty($this->env->supressedDivision)) { + foreach (self::$supressDivisionProps as $pattern) { + if (preg_match($pattern, $this->env->currentProperty)) { + $this->env->supressedDivision = true; + break 2; + } + } + } + + + $whiteAfter = isset($this->buffer[$this->count - 1]) && + ctype_space($this->buffer[$this->count - 1]); + + if (!$this->value($rhs)) break; + + // peek for next operator to see what to do with rhs + if ($this->peek(self::$operatorString, $next) && self::$precedence[$next[1]] > self::$precedence[$m[1]]) { + $rhs = $this->expHelper($rhs, self::$precedence[$next[1]]); + } + + $lhs = array('expression', $m[1], $lhs, $rhs, $whiteBefore, $whiteAfter); + $ss = $this->seek(); + + continue; + } + + break; + } + + $this->seek($ss); + + return $lhs; + } + + // consume a list of values for a property + public function propertyValue(&$value, $keyName = null) { + $values = array(); + + if ($keyName !== null) $this->env->currentProperty = $keyName; + + $s = null; + while ($this->expressionList($v)) { + $values[] = $v; + $s = $this->seek(); + if (!$this->literal(',')) break; + } + + if ($s) $this->seek($s); + + if ($keyName !== null) unset($this->env->currentProperty); + + if (count($values) == 0) return false; + + $value = lessc::compressList($values, ', '); + return true; + } + + protected function parenValue(&$out) { + $s = $this->seek(); + + // speed shortcut + if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "(") { + return false; + } + + $inParens = $this->inParens; + if ($this->literal("(") && + ($this->inParens = true) && $this->expression($exp) && + $this->literal(")")) + { + $out = $exp; + $this->inParens = $inParens; + return true; + } else { + $this->inParens = $inParens; + $this->seek($s); + } + + return false; + } + + // a single value + protected function value(&$value) { + $s = $this->seek(); + + // speed shortcut + if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "-") { + // negation + if ($this->literal("-", false) && + (($this->variable($inner) && $inner = array("variable", $inner)) || + $this->unit($inner) || + $this->parenValue($inner))) + { + $value = array("unary", "-", $inner); + return true; + } else { + $this->seek($s); + } + } + + if ($this->parenValue($value)) return true; + if ($this->unit($value)) return true; + if ($this->color($value)) return true; + if ($this->func($value)) return true; + if ($this->string($value)) return true; + + if ($this->keyword($word)) { + $value = array('keyword', $word); + return true; + } + + // try a variable + if ($this->variable($var)) { + $value = array('variable', $var); + return true; + } + + // unquote string (should this work on any type? + if ($this->literal("~") && $this->string($str)) { + $value = array("escape", $str); + return true; + } else { + $this->seek($s); + } + + // css hack: \0 + if ($this->literal('\\') && $this->match('([0-9]+)', $m)) { + $value = array('keyword', '\\'.$m[1]); + return true; + } else { + $this->seek($s); + } + + return false; + } + + // an import statement + protected function import(&$out) { + $s = $this->seek(); + if (!$this->literal('@import')) return false; + + // @import "something.css" media; + // @import url("something.css") media; + // @import url(something.css) media; + + if ($this->propertyValue($value)) { + $out = array("import", $value); + return true; + } + } + + protected function mediaQueryList(&$out) { + if ($this->genericList($list, "mediaQuery", ",", false)) { + $out = $list[2]; + return true; + } + return false; + } + + protected function mediaQuery(&$out) { + $s = $this->seek(); + + $expressions = null; + $parts = array(); + + if (($this->literal("only") && ($only = true) || $this->literal("not") && ($not = true) || true) && $this->keyword($mediaType)) { + $prop = array("mediaType"); + if (isset($only)) $prop[] = "only"; + if (isset($not)) $prop[] = "not"; + $prop[] = $mediaType; + $parts[] = $prop; + } else { + $this->seek($s); + } + + + if (!empty($mediaType) && !$this->literal("and")) { + // ~ + } else { + $this->genericList($expressions, "mediaExpression", "and", false); + if (is_array($expressions)) $parts = array_merge($parts, $expressions[2]); + } + + if (count($parts) == 0) { + $this->seek($s); + return false; + } + + $out = $parts; + return true; + } + + protected function mediaExpression(&$out) { + $s = $this->seek(); + $value = null; + if ($this->literal("(") && + $this->keyword($feature) && + ($this->literal(":") && $this->expression($value) || true) && + $this->literal(")")) + { + $out = array("mediaExp", $feature); + if ($value) $out[] = $value; + return true; + } elseif ($this->variable($variable)) { + $out = array('variable', $variable); + return true; + } + + $this->seek($s); + return false; + } + + // an unbounded string stopped by $end + protected function openString($end, &$out, $nestingOpen=null, $rejectStrs = null) { + $oldWhite = $this->eatWhiteDefault; + $this->eatWhiteDefault = false; + + $stop = array("'", '"', "@{", $end); + $stop = array_map(array("lessc", "preg_quote"), $stop); + // $stop[] = self::$commentMulti; + + if (!is_null($rejectStrs)) { + $stop = array_merge($stop, $rejectStrs); + } + + $patt = '(.*?)('.implode("|", $stop).')'; + + $nestingLevel = 0; + + $content = array(); + while ($this->match($patt, $m, false)) { + if (!empty($m[1])) { + $content[] = $m[1]; + if ($nestingOpen) { + $nestingLevel += substr_count($m[1], $nestingOpen); + } + } + + $tok = $m[2]; + + $this->count-= strlen($tok); + if ($tok == $end) { + if ($nestingLevel == 0) { + break; + } else { + $nestingLevel--; + } + } + + if (($tok == "'" || $tok == '"') && $this->string($str)) { + $content[] = $str; + continue; + } + + if ($tok == "@{" && $this->interpolation($inter)) { + $content[] = $inter; + continue; + } + + if (!empty($rejectStrs) && in_array($tok, $rejectStrs)) { + break; + } + + $content[] = $tok; + $this->count+= strlen($tok); + } + + $this->eatWhiteDefault = $oldWhite; + + if (count($content) == 0) return false; + + // trim the end + if (is_string(end($content))) { + $content[count($content) - 1] = rtrim(end($content)); + } + + $out = array("string", "", $content); + return true; + } + + protected function string(&$out) { + $s = $this->seek(); + if ($this->literal('"', false)) { + $delim = '"'; + } elseif ($this->literal("'", false)) { + $delim = "'"; + } else { + return false; + } + + $content = array(); + + // look for either ending delim , escape, or string interpolation + $patt = '([^\n]*?)(@\{|\\\\|' . + lessc::preg_quote($delim).')'; + + $oldWhite = $this->eatWhiteDefault; + $this->eatWhiteDefault = false; + + while ($this->match($patt, $m, false)) { + $content[] = $m[1]; + if ($m[2] == "@{") { + $this->count -= strlen($m[2]); + if ($this->interpolation($inter, false)) { + $content[] = $inter; + } else { + $this->count += strlen($m[2]); + $content[] = "@{"; // ignore it + } + } elseif ($m[2] == '\\') { + $content[] = $m[2]; + if ($this->literal($delim, false)) { + $content[] = $delim; + } + } else { + $this->count -= strlen($delim); + break; // delim + } + } + + $this->eatWhiteDefault = $oldWhite; + + if ($this->literal($delim)) { + $out = array("string", $delim, $content); + return true; + } + + $this->seek($s); + return false; + } + + protected function interpolation(&$out) { + $oldWhite = $this->eatWhiteDefault; + $this->eatWhiteDefault = true; + + $s = $this->seek(); + if ($this->literal("@{") && + $this->openString("}", $interp, null, array("'", '"', ";")) && + $this->literal("}", false)) + { + $out = array("interpolate", $interp); + $this->eatWhiteDefault = $oldWhite; + if ($this->eatWhiteDefault) $this->whitespace(); + return true; + } + + $this->eatWhiteDefault = $oldWhite; + $this->seek($s); + return false; + } + + protected function unit(&$unit) { + // speed shortcut + if (isset($this->buffer[$this->count])) { + $char = $this->buffer[$this->count]; + if (!ctype_digit($char) && $char != ".") return false; + } + + if ($this->match('([0-9]+(?:\.[0-9]*)?|\.[0-9]+)([%a-zA-Z]+)?', $m)) { + $unit = array("number", $m[1], empty($m[2]) ? "" : $m[2]); + return true; + } + return false; + } + + // a # color + protected function color(&$out) { + if ($this->match('(#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3}))', $m)) { + if (strlen($m[1]) > 7) { + $out = array("string", "", array($m[1])); + } else { + $out = array("raw_color", $m[1]); + } + return true; + } + + return false; + } + + // consume an argument definition list surrounded by () + // each argument is a variable name with optional value + // or at the end a ... or a variable named followed by ... + // arguments are separated by , unless a ; is in the list, then ; is the + // delimiter. + protected function argumentDef(&$args, &$isVararg) { + $s = $this->seek(); + if (!$this->literal('(')) return false; + + $values = array(); + $delim = ","; + $method = "expressionList"; + + $isVararg = false; + while (true) { + if ($this->literal("...")) { + $isVararg = true; + break; + } + + if ($this->$method($value)) { + if ($value[0] == "variable") { + $arg = array("arg", $value[1]); + $ss = $this->seek(); + + if ($this->assign() && $this->$method($rhs)) { + $arg[] = $rhs; + } else { + $this->seek($ss); + if ($this->literal("...")) { + $arg[0] = "rest"; + $isVararg = true; + } + } + + $values[] = $arg; + if ($isVararg) break; + continue; + } else { + $values[] = array("lit", $value); + } + } + + + if (!$this->literal($delim)) { + if ($delim == "," && $this->literal(";")) { + // found new delim, convert existing args + $delim = ";"; + $method = "propertyValue"; + + // transform arg list + if (isset($values[1])) { // 2 items + $newList = array(); + foreach ($values as $i => $arg) { + switch($arg[0]) { + case "arg": + if ($i) { + $this->throwError("Cannot mix ; and , as delimiter types"); + } + $newList[] = $arg[2]; + break; + case "lit": + $newList[] = $arg[1]; + break; + case "rest": + $this->throwError("Unexpected rest before semicolon"); + } + } + + $newList = array("list", ", ", $newList); + + switch ($values[0][0]) { + case "arg": + $newArg = array("arg", $values[0][1], $newList); + break; + case "lit": + $newArg = array("lit", $newList); + break; + } + + } elseif ($values) { // 1 item + $newArg = $values[0]; + } + + if ($newArg) { + $values = array($newArg); + } + } else { + break; + } + } + } + + if (!$this->literal(')')) { + $this->seek($s); + return false; + } + + $args = $values; + + return true; + } + + // consume a list of tags + // this accepts a hanging delimiter + protected function tags(&$tags, $simple = false, $delim = ',') { + $tags = array(); + while ($this->tag($tt, $simple)) { + $tags[] = $tt; + if (!$this->literal($delim)) break; + } + if (count($tags) == 0) return false; + + return true; + } + + // list of tags of specifying mixin path + // optionally separated by > (lazy, accepts extra >) + protected function mixinTags(&$tags) { + $s = $this->seek(); + $tags = array(); + while ($this->tag($tt, true)) { + $tags[] = $tt; + $this->literal(">"); + } + + if (count($tags) == 0) return false; + + return true; + } + + // a bracketed value (contained within in a tag definition) + protected function tagBracket(&$parts, &$hasExpression) { + // speed shortcut + if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "[") { + return false; + } + + $s = $this->seek(); + + $hasInterpolation = false; + + if ($this->literal("[", false)) { + $attrParts = array("["); + // keyword, string, operator + while (true) { + if ($this->literal("]", false)) { + $this->count--; + break; // get out early + } + + if ($this->match('\s+', $m)) { + $attrParts[] = " "; + continue; + } + if ($this->string($str)) { + // escape parent selector, (yuck) + foreach ($str[2] as &$chunk) { + $chunk = str_replace($this->lessc->parentSelector, "$&$", $chunk); + } + + $attrParts[] = $str; + $hasInterpolation = true; + continue; + } + + if ($this->keyword($word)) { + $attrParts[] = $word; + continue; + } + + if ($this->interpolation($inter, false)) { + $attrParts[] = $inter; + $hasInterpolation = true; + continue; + } + + // operator, handles attr namespace too + if ($this->match('[|-~\$\*\^=]+', $m)) { + $attrParts[] = $m[0]; + continue; + } + + break; + } + + if ($this->literal("]", false)) { + $attrParts[] = "]"; + foreach ($attrParts as $part) { + $parts[] = $part; + } + $hasExpression = $hasExpression || $hasInterpolation; + return true; + } + $this->seek($s); + } + + $this->seek($s); + return false; + } + + // a space separated list of selectors + protected function tag(&$tag, $simple = false) { + if ($simple) + $chars = '^@,:;{}\][>\(\) "\''; + else + $chars = '^@,;{}["\''; + + $s = $this->seek(); + + $hasExpression = false; + $parts = array(); + while ($this->tagBracket($parts, $hasExpression)); + + $oldWhite = $this->eatWhiteDefault; + $this->eatWhiteDefault = false; + + while (true) { + if ($this->match('(['.$chars.'0-9]['.$chars.']*)', $m)) { + $parts[] = $m[1]; + if ($simple) break; + + while ($this->tagBracket($parts, $hasExpression)); + continue; + } + + if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") { + if ($this->interpolation($interp)) { + $hasExpression = true; + $interp[2] = true; // don't unescape + $parts[] = $interp; + continue; + } + + if ($this->literal("@")) { + $parts[] = "@"; + continue; + } + } + + if ($this->unit($unit)) { // for keyframes + $parts[] = $unit[1]; + $parts[] = $unit[2]; + continue; + } + + break; + } + + $this->eatWhiteDefault = $oldWhite; + if (!$parts) { + $this->seek($s); + return false; + } + + if ($hasExpression) { + $tag = array("exp", array("string", "", $parts)); + } else { + $tag = trim(implode($parts)); + } + + $this->whitespace(); + return true; + } + + // a css function + protected function func(&$func) { + $s = $this->seek(); + + if ($this->match('(%|[\w\-_][\w\-_:\.]+|[\w_])', $m) && $this->literal('(')) { + $fname = $m[1]; + + $sPreArgs = $this->seek(); + + $args = array(); + while (true) { + $ss = $this->seek(); + // this ugly nonsense is for ie filter properties + if ($this->keyword($name) && $this->literal('=') && $this->expressionList($value)) { + $args[] = array("string", "", array($name, "=", $value)); + } else { + $this->seek($ss); + if ($this->expressionList($value)) { + $args[] = $value; + } + } + + if (!$this->literal(',')) break; + } + $args = array('list', ',', $args); + + if ($this->literal(')')) { + $func = array('function', $fname, $args); + return true; + } elseif ($fname == 'url') { + // couldn't parse and in url? treat as string + $this->seek($sPreArgs); + if ($this->openString(")", $string) && $this->literal(")")) { + $func = array('function', $fname, $string); + return true; + } + } + } + + $this->seek($s); + return false; + } + + // consume a less variable + protected function variable(&$name) { + $s = $this->seek(); + if ($this->literal($this->lessc->vPrefix, false) && + ($this->variable($sub) || $this->keyword($name))) + { + if (!empty($sub)) { + $name = array('variable', $sub); + } else { + $name = $this->lessc->vPrefix.$name; + } + return true; + } + + $name = null; + $this->seek($s); + return false; + } + + /** + * Consume an assignment operator + * Can optionally take a name that will be set to the current property name + */ + protected function assign($name = null) { + if ($name) $this->currentProperty = $name; + return $this->literal(':') || $this->literal('='); + } + + // consume a keyword + protected function keyword(&$word) { + if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) { + $word = $m[1]; + return true; + } + return false; + } + + // consume an end of statement delimiter + protected function end() { + if ($this->literal(';')) { + return true; + } elseif ($this->count == strlen($this->buffer) || $this->buffer[$this->count] == '}') { + // if there is end of file or a closing block next then we don't need a ; + return true; + } + return false; + } + + protected function guards(&$guards) { + $s = $this->seek(); + + if (!$this->literal("when")) { + $this->seek($s); + return false; + } + + $guards = array(); + + while ($this->guardGroup($g)) { + $guards[] = $g; + if (!$this->literal(",")) break; + } + + if (count($guards) == 0) { + $guards = null; + $this->seek($s); + return false; + } + + return true; + } + + // a bunch of guards that are and'd together + // TODO rename to guardGroup + protected function guardGroup(&$guardGroup) { + $s = $this->seek(); + $guardGroup = array(); + while ($this->guard($guard)) { + $guardGroup[] = $guard; + if (!$this->literal("and")) break; + } + + if (count($guardGroup) == 0) { + $guardGroup = null; + $this->seek($s); + return false; + } + + return true; + } + + protected function guard(&$guard) { + $s = $this->seek(); + $negate = $this->literal("not"); + + if ($this->literal("(") && $this->expression($exp) && $this->literal(")")) { + $guard = $exp; + if ($negate) $guard = array("negate", $guard); + return true; + } + + $this->seek($s); + return false; + } + + /* raw parsing functions */ + + protected function literal($what, $eatWhitespace = null) { + if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault; + + // shortcut on single letter + if (!isset($what[1]) && isset($this->buffer[$this->count])) { + if ($this->buffer[$this->count] == $what) { + if (!$eatWhitespace) { + $this->count++; + return true; + } + // goes below... + } else { + return false; + } + } + + if (!isset(self::$literalCache[$what])) { + self::$literalCache[$what] = lessc::preg_quote($what); + } + + return $this->match(self::$literalCache[$what], $m, $eatWhitespace); + } + + protected function genericList(&$out, $parseItem, $delim="", $flatten=true) { + $s = $this->seek(); + $items = array(); + while ($this->$parseItem($value)) { + $items[] = $value; + if ($delim) { + if (!$this->literal($delim)) break; + } + } + + if (count($items) == 0) { + $this->seek($s); + return false; + } + + if ($flatten && count($items) == 1) { + $out = $items[0]; + } else { + $out = array("list", $delim, $items); + } + + return true; + } + + + // advance counter to next occurrence of $what + // $until - don't include $what in advance + // $allowNewline, if string, will be used as valid char set + protected function to($what, &$out, $until = false, $allowNewline = false) { + if (is_string($allowNewline)) { + $validChars = $allowNewline; + } else { + $validChars = $allowNewline ? "." : "[^\n]"; + } + if (!$this->match('('.$validChars.'*?)'.lessc::preg_quote($what), $m, !$until)) return false; + if ($until) $this->count -= strlen($what); // give back $what + $out = $m[1]; + return true; + } + + // try to match something on head of buffer + protected function match($regex, &$out, $eatWhitespace = null) { + if ($eatWhitespace === null) $eatWhitespace = $this->eatWhiteDefault; + + $r = '/'.$regex.($eatWhitespace && !$this->writeComments ? '\s*' : '').'/Ais'; + if (preg_match($r, $this->buffer, $out, null, $this->count)) { + $this->count += strlen($out[0]); + if ($eatWhitespace && $this->writeComments) $this->whitespace(); + return true; + } + return false; + } + + // match some whitespace + protected function whitespace() { + if ($this->writeComments) { + $gotWhite = false; + while (preg_match(self::$whitePattern, $this->buffer, $m, null, $this->count)) { + if (isset($m[1]) && empty($this->commentsSeen[$this->count])) { + $this->append(array("comment", $m[1])); + $this->commentsSeen[$this->count] = true; + } + $this->count += strlen($m[0]); + $gotWhite = true; + } + return $gotWhite; + } else { + $this->match("", $m); + return strlen($m[0]) > 0; + } + } + + // match something without consuming it + protected function peek($regex, &$out = null, $from=null) { + if (is_null($from)) $from = $this->count; + $r = '/'.$regex.'/Ais'; + $result = preg_match($r, $this->buffer, $out, null, $from); + + return $result; + } + + // seek to a spot in the buffer or return where we are on no argument + protected function seek($where = null) { + if ($where === null) return $this->count; + else $this->count = $where; + return true; + } + + /* misc functions */ + + public function throwError($msg = "parse error", $count = null) { + $count = is_null($count) ? $this->count : $count; + + $line = $this->line + + substr_count(substr($this->buffer, 0, $count), "\n"); + + if (!empty($this->sourceName)) { + $loc = "$this->sourceName on line $line"; + } else { + $loc = "line: $line"; + } + + // TODO this depends on $this->count + if ($this->peek("(.*?)(\n|$)", $m, $count)) { + throw new exception("$msg: failed at `$m[1]` $loc"); + } else { + throw new exception("$msg: $loc"); + } + } + + protected function pushBlock($selectors=null, $type=null) { + $b = new stdclass; + $b->parent = $this->env; + + $b->type = $type; + $b->id = self::$nextBlockId++; + + $b->isVararg = false; // TODO: kill me from here + $b->tags = $selectors; + + $b->props = array(); + $b->children = array(); + + $this->env = $b; + return $b; + } + + // push a block that doesn't multiply tags + protected function pushSpecialBlock($type) { + return $this->pushBlock(null, $type); + } + + // append a property to the current block + protected function append($prop, $pos = null) { + if ($pos !== null) $prop[-1] = $pos; + $this->env->props[] = $prop; + } + + // pop something off the stack + protected function pop() { + $old = $this->env; + $this->env = $this->env->parent; + return $old; + } + + // remove comments from $text + // todo: make it work for all functions, not just url + protected function removeComments($text) { + $look = array( + 'url(', '//', '/*', '"', "'" + ); + + $out = ''; + $min = null; + while (true) { + // find the next item + foreach ($look as $token) { + $pos = strpos($text, $token); + if ($pos !== false) { + if (!isset($min) || $pos < $min[1]) $min = array($token, $pos); + } + } + + if (is_null($min)) break; + + $count = $min[1]; + $skip = 0; + $newlines = 0; + switch ($min[0]) { + case 'url(': + if (preg_match('/url\(.*?\)/', $text, $m, 0, $count)) + $count += strlen($m[0]) - strlen($min[0]); + break; + case '"': + case "'": + if (preg_match('/'.$min[0].'.*?(?<!\\\\)'.$min[0].'/', $text, $m, 0, $count)) + $count += strlen($m[0]) - 1; + break; + case '//': + $skip = strpos($text, "\n", $count); + if ($skip === false) $skip = strlen($text) - $count; + else $skip -= $count; + break; + case '/*': + if (preg_match('/\/\*.*?\*\//s', $text, $m, 0, $count)) { + $skip = strlen($m[0]); + $newlines = substr_count($m[0], "\n"); + } + break; + } + + if ($skip == 0) $count += strlen($min[0]); + + $out .= substr($text, 0, $count).str_repeat("\n", $newlines); + $text = substr($text, $count + $skip); + + $min = null; + } + + return $out.$text; + } + +} + +class lessc_formatter_classic { + public $indentChar = " "; + + public $break = "\n"; + public $open = " {"; + public $close = "}"; + public $selectorSeparator = ", "; + public $assignSeparator = ":"; + + public $openSingle = " { "; + public $closeSingle = " }"; + + public $disableSingle = false; + public $breakSelectors = false; + + public $compressColors = false; + + public function __construct() { + $this->indentLevel = 0; + } + + public function indentStr($n = 0) { + return str_repeat($this->indentChar, max($this->indentLevel + $n, 0)); + } + + public function property($name, $value) { + return $name . $this->assignSeparator . $value . ";"; + } + + protected function isEmpty($block) { + if (empty($block->lines)) { + foreach ($block->children as $child) { + if (!$this->isEmpty($child)) return false; + } + + return true; + } + return false; + } + + public function block($block) { + if ($this->isEmpty($block)) return; + + $inner = $pre = $this->indentStr(); + + $isSingle = !$this->disableSingle && + is_null($block->type) && count($block->lines) == 1; + + if (!empty($block->selectors)) { + $this->indentLevel++; + + if ($this->breakSelectors) { + $selectorSeparator = $this->selectorSeparator . $this->break . $pre; + } else { + $selectorSeparator = $this->selectorSeparator; + } + + echo $pre . + implode($selectorSeparator, $block->selectors); + if ($isSingle) { + echo $this->openSingle; + $inner = ""; + } else { + echo $this->open . $this->break; + $inner = $this->indentStr(); + } + + } + + if (!empty($block->lines)) { + $glue = $this->break.$inner; + echo $inner . implode($glue, $block->lines); + if (!$isSingle && !empty($block->children)) { + echo $this->break; + } + } + + foreach ($block->children as $child) { + $this->block($child); + } + + if (!empty($block->selectors)) { + if (!$isSingle && empty($block->children)) echo $this->break; + + if ($isSingle) { + echo $this->closeSingle . $this->break; + } else { + echo $pre . $this->close . $this->break; + } + + $this->indentLevel--; + } + } +} + +class lessc_formatter_compressed extends lessc_formatter_classic { + public $disableSingle = true; + public $open = "{"; + public $selectorSeparator = ","; + public $assignSeparator = ":"; + public $break = ""; + public $compressColors = true; + + public function indentStr($n = 0) { + return ""; + } +} + +class lessc_formatter_lessjs extends lessc_formatter_classic { + public $disableSingle = true; + public $breakSelectors = true; + public $assignSeparator = ": "; + public $selectorSeparator = ","; +} + + diff --git a/inc/load.php b/inc/load.php index 5ca9b4cd8..c5b40ffd8 100644 --- a/inc/load.php +++ b/inc/load.php @@ -35,6 +35,7 @@ require_once(DOKU_INC.'inc/template.php'); require_once(DOKU_INC.'inc/toolbar.php'); require_once(DOKU_INC.'inc/utf8.php'); require_once(DOKU_INC.'inc/auth.php'); +require_once(DOKU_INC.'inc/compatibility.php'); /** * spl_autoload_register callback @@ -82,12 +83,17 @@ function load_autoload($name){ 'RemoteAPI' => DOKU_INC.'inc/remote.php', 'RemoteAPICore' => DOKU_INC.'inc/RemoteAPICore.php', 'Subscription' => DOKU_INC.'inc/subscription.php', + 'Crypt_Base' => DOKU_INC.'inc/phpseclib/Crypt_Base.php', + 'Crypt_Rijndael' => DOKU_INC.'inc/phpseclib/Crypt_Rijndael.php', + 'Crypt_AES' => DOKU_INC.'inc/phpseclib/Crypt_AES.php', + 'Crypt_Hash' => DOKU_INC.'inc/phpseclib/Crypt_Hash.php', + 'lessc' => DOKU_INC.'inc/lessc.inc.php', 'DokuWiki_Action_Plugin' => DOKU_PLUGIN.'action.php', 'DokuWiki_Admin_Plugin' => DOKU_PLUGIN.'admin.php', 'DokuWiki_Syntax_Plugin' => DOKU_PLUGIN.'syntax.php', 'DokuWiki_Remote_Plugin' => DOKU_PLUGIN.'remote.php', - 'DokuWiki_Auth_Plugin' => DOKU_PLUGIN.'auth.php', + 'DokuWiki_Auth_Plugin' => DOKU_PLUGIN.'auth.php', ); diff --git a/inc/mail.php b/inc/mail.php index d0ea651bf..0b60c0a5b 100644 --- a/inc/mail.php +++ b/inc/mail.php @@ -284,10 +284,9 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true) // for EBCDIC safeness encode !"#$@[\]^`{|}~, // for complete safeness encode every character :) if ($bEmulate_imap_8bit) - $sRegExp = '/[^\x20\x21-\x3C\x3E-\x7E]/e'; + $sRegExp = '/[^\x20\x21-\x3C\x3E-\x7E]/'; - $sReplmt = 'sprintf( "=%02X", ord ( "$0" ) ) ;'; - $sLine = preg_replace( $sRegExp, $sReplmt, $sLine ); + $sLine = preg_replace_callback( $sRegExp, 'mail_quotedprintable_encode_callback', $sLine ); // encode x09,x20 at lineends { @@ -330,3 +329,6 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true) return implode(MAILHEADER_EOL,$aLines); } +function mail_quotedprintable_encode_callback($matches){ + return sprintf( "=%02X", ord ( $matches[0] ) ) ; +} diff --git a/inc/media.php b/inc/media.php index fbe1363ec..d69426414 100644 --- a/inc/media.php +++ b/inc/media.php @@ -90,7 +90,7 @@ function media_metasave($id,$auth,$data){ * @return bool */ function media_isexternal($id){ - if (preg_match('#^(https?|ftp)://#i', $id)) return true; + if (preg_match('#^(?:https?|ftp)://#i', $id)) return true; return false; } @@ -178,7 +178,7 @@ function media_inuse($id) { global $conf; $mediareferences = array(); if($conf['refcheck']){ - $mediareferences = ft_mediause($id,$conf['refshow']); + $mediareferences = ft_mediause($id,true); if(!count($mediareferences)) { return false; } else { @@ -586,7 +586,10 @@ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false,$sort=fals // FIXME: print permission warning here instead? echo '<div class="nothing">'.$lang['nothingfound'].'</div>'.NL; }else{ - if (!$fullscreenview) media_uploadform($ns, $auth); + if (!$fullscreenview) { + media_uploadform($ns, $auth); + media_searchform($ns); + } $dir = utf8_encodeFN(str_replace(':','/',$ns)); $data = array(); @@ -609,7 +612,6 @@ function media_filelist($ns,$auth=null,$jump='',$fullscreenview=false,$sort=fals if ($fullscreenview) echo '</ul>'.NL; } } - if (!$fullscreenview) media_searchform($ns); } /** @@ -1294,7 +1296,7 @@ function media_restore($image, $rev, $auth){ * @author Kate Arzamastseva <pshns@ukr.net> * @triggers MEDIA_SEARCH */ -function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort=''){ +function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort='natural'){ global $conf; global $lang; @@ -1314,15 +1316,10 @@ function media_searchlist($query,$ns,$auth=null,$fullscreen=false,$sort=''){ $conf['mediadir'], 'search_media', array('showmsg'=>false,'pattern'=>$pattern), - $dir); + $dir, + 1, + $sort); } - - $data = array(); - foreach ($evdata['data'] as $k => $v) { - $data[$k] = ($sort == 'date') ? $v['mtime'] : $v['id']; - } - array_multisort($data, SORT_DESC, SORT_NUMERIC, $evdata['data']); - $evt->advise_after(); unset($evt); } @@ -1487,7 +1484,7 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false } /** - * Prints a thumbnail and metainfos + * Prints a thumbnail and metainfo */ function media_printimgdetail($item, $fullscreen=false){ // prepare thumbnail @@ -1900,7 +1897,7 @@ function media_crop_image($file, $ext, $w, $h=0){ */ function media_get_token($id,$w,$h){ // token is only required for modified images - if ($w || $h) { + if ($w || $h || media_isexternal($id)) { $token = $id; if ($w) $token .= '.'.$w; if ($h) $token .= '.'.$h; diff --git a/inc/pageutils.php b/inc/pageutils.php index 5043d2263..c8d3cf4bb 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -94,9 +94,8 @@ 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 - * @param boolean $media DEPRECATED */ -function cleanID($raw_id,$ascii=false,$media=false){ +function cleanID($raw_id,$ascii=false){ global $conf; static $sepcharpat = null; @@ -366,7 +365,7 @@ function mediaFN($id, $rev=''){ */ function localeFN($id,$ext='txt'){ global $conf; - $file = DOKU_CONF.'/lang/'.$conf['lang'].'/'.$id.'.'.$ext; + $file = DOKU_CONF.'lang/'.$conf['lang'].'/'.$id.'.'.$ext; if(!@file_exists($file)){ $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.'.$ext; if(!@file_exists($file)){ @@ -396,7 +395,7 @@ function resolve_id($ns,$id,$clean=true){ // if the id starts with a dot we need to handle the // relative stuff - if($id{0} == '.'){ + if($id && $id{0} == '.'){ // normalize initial dots without a colon $id = preg_replace('/^(\.+)(?=[^:\.])/','\1:',$id); // prepend the current namespace diff --git a/inc/parser/code.php b/inc/parser/code.php index 6e159b041..0b8e3ee02 100644 --- a/inc/parser/code.php +++ b/inc/parser/code.php @@ -15,7 +15,7 @@ class Doku_Renderer_code extends Doku_Renderer { * * When the correct block was found it exits the script. */ - function code($text, $language = NULL, $filename='' ) { + function code($text, $language = null, $filename='' ) { global $INPUT; if(!$language) $language = 'txt'; if(!$filename) $filename = 'snippet.'.$language; @@ -36,7 +36,7 @@ class Doku_Renderer_code extends Doku_Renderer { /** * Wraps around code() */ - function file($text, $language = NULL, $filename='') { + function file($text, $language = null, $filename='') { $this->code($text, $language, $filename); } diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 1cf32aaed..8ae991209 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -4,9 +4,9 @@ if (!defined('DOKU_PARSER_EOL')) define('DOKU_PARSER_EOL',"\n"); // add this t class Doku_Handler { - var $Renderer = NULL; + var $Renderer = null; - var $CallWriter = NULL; + var $CallWriter = null; var $calls = array(); @@ -35,8 +35,8 @@ class Doku_Handler { $this->CallWriter->finalise(); if ( $this->status['section'] ) { - $last_call = end($this->calls); - array_push($this->calls,array('section_close',array(), $last_call[2])); + $last_call = end($this->calls); + array_push($this->calls,array('section_close',array(), $last_call[2])); } if ( $this->rewriteBlocks ) { @@ -70,12 +70,12 @@ class Doku_Handler { */ function plugin($match, $state, $pos, $pluginname){ $data = array($match); - $plugin =& plugin_load('syntax',$pluginname); + $plugin = plugin_load('syntax',$pluginname); if($plugin != null){ $data = $plugin->handle($match, $state, $pos, $this); } if ($data !== false) { - $this->addPluginCall($pluginname,$data,$state,$pos,$match); + $this->addPluginCall($pluginname,$data,$state,$pos,$match); } return true; } @@ -190,8 +190,8 @@ class Doku_Handler { // footnotes can not be nested - however due to limitations in lexer it can't be prevented // we will still enter a new footnote mode, we just do nothing if ($this->_footnote) { - $this->_addCall('cdata',array($match), $pos); - break; + $this->_addCall('cdata',array($match), $pos); + break; } $this->_footnote = true; @@ -203,8 +203,8 @@ class Doku_Handler { case DOKU_LEXER_EXIT: // check whether we have already exitted the footnote mode, can happen if the modes were nested if (!$this->_footnote) { - $this->_addCall('cdata',array($match), $pos); - break; + $this->_addCall('cdata',array($match), $pos); + break; } $this->_footnote = false; @@ -423,7 +423,7 @@ class Doku_Handler { // Split title from URL $link = explode('|',$link,2); if ( !isset($link[1]) ) { - $link[1] = NULL; + $link[1] = null; } else if ( preg_match('/^\{\{[^\}]+\}\}$/',$link[1]) ) { // If the title is an image, convert it to an array containing the image details $link[1] = Doku_Handler_Parse_Media($link[1]); @@ -433,7 +433,7 @@ class Doku_Handler { //decide which kind of link it is if ( preg_match('/^[a-zA-Z0-9\.]+>{1}.*$/u',$link[0]) ) { - // Interwiki + // Interwiki $interwiki = explode('>',$link[0],2); $this->_addCall( 'interwikilink', @@ -441,35 +441,35 @@ class Doku_Handler { $pos ); }elseif ( preg_match('/^\\\\\\\\[^\\\\]+?\\\\/u',$link[0]) ) { - // Windows Share + // Windows Share $this->_addCall( 'windowssharelink', array($link[0],$link[1]), $pos ); }elseif ( preg_match('#^([a-z0-9\-\.+]+?)://#i',$link[0]) ) { - // external link (accepts all protocols) + // external link (accepts all protocols) $this->_addCall( 'externallink', array($link[0],$link[1]), $pos ); }elseif ( preg_match('<'.PREG_PATTERN_VALID_EMAIL.'>',$link[0]) ) { - // E-Mail (pattern above is defined in inc/mail.php) + // E-Mail (pattern above is defined in inc/mail.php) $this->_addCall( 'emaillink', array($link[0],$link[1]), $pos ); }elseif ( preg_match('!^#.+!',$link[0]) ){ - // local link + // local link $this->_addCall( 'locallink', array(substr($link[0],1),$link[1]), $pos ); }else{ - // internal link + // internal link $this->_addCall( 'internallink', array($link[0],$link[1]), @@ -481,12 +481,12 @@ class Doku_Handler { } function filelink($match, $state, $pos) { - $this->_addCall('filelink',array($match, NULL), $pos); + $this->_addCall('filelink',array($match, null), $pos); return true; } function windowssharelink($match, $state, $pos) { - $this->_addCall('windowssharelink',array($match, NULL), $pos); + $this->_addCall('windowssharelink',array($match, null), $pos); return true; } @@ -520,10 +520,10 @@ class Doku_Handler { $p['details'] = (preg_match('/\b(desc|detail)/',$params)); if (preg_match('/\b(\d+)([dhm])\b/',$params,$match)) { - $period = array('d' => 86400, 'h' => 3600, 'm' => 60); - $p['refresh'] = max(600,$match[1]*$period[$match[2]]); // n * period in seconds, minimum 10 minutes + $period = array('d' => 86400, 'h' => 3600, 'm' => 60); + $p['refresh'] = max(600,$match[1]*$period[$match[2]]); // n * period in seconds, minimum 10 minutes } else { - $p['refresh'] = 14400; // default to 4 hours + $p['refresh'] = 14400; // default to 4 hours } $this->_addCall('rss',array($link,$p),$pos); @@ -550,7 +550,7 @@ class Doku_Handler { function emaillink($match, $state, $pos) { $email = preg_replace(array('/^</','/>$/'),'',$match); - $this->_addCall('emaillink',array($email, NULL), $pos); + $this->_addCall('emaillink',array($email, null), $pos); return true; } @@ -618,7 +618,6 @@ function Doku_Handler_Parse_Media($match) { // Split title from URL $link = explode('|',$link,2); - // Check alignment $ralign = (bool)preg_match('/^ /',$link[0]); $lalign = (bool)preg_match('/ $/',$link[0]); @@ -631,12 +630,12 @@ function Doku_Handler_Parse_Media($match) { } else if ( $lalign ) { $align = 'left'; } else { - $align = NULL; + $align = null; } // The title... if ( !isset($link[1]) ) { - $link[1] = NULL; + $link[1] = null; } //remove aligning spaces @@ -654,11 +653,11 @@ function Doku_Handler_Parse_Media($match) { //parse width and height if(preg_match('#(\d+)(x(\d+))?#i',$param,$size)){ - ($size[1]) ? $w = $size[1] : $w = NULL; - ($size[3]) ? $h = $size[3] : $h = NULL; + !empty($size[1]) ? $w = $size[1] : $w = null; + !empty($size[3]) ? $h = $size[3] : $h = null; } else { - $w = NULL; - $h = NULL; + $w = null; + $h = null; } //get linking command @@ -1034,7 +1033,7 @@ class Doku_Handler_Preformatted { break; case 'preformatted_end': if (trim($this->text)) { - $this->CallWriter->writeCall(array('preformatted',array($this->text),$this->pos)); + $this->CallWriter->writeCall(array('preformatted',array($this->text),$this->pos)); } // see FS#1699 & FS#1652, add 'eol' instructions to ensure proper triggering of following p_open $this->CallWriter->writeCall(array('eol',array(),$this->pos)); @@ -1247,12 +1246,12 @@ class Doku_Handler_Table { } $this->tableCalls[] = array($this->lastCellType.'_close',array(),$call[2]); - $this->tableCalls[] = array($call[0].'_open',array(1,NULL,1),$call[2]); + $this->tableCalls[] = array($call[0].'_open',array(1,null,1),$call[2]); $this->lastCellType = $call[0]; } else { - $this->tableCalls[] = array($call[0].'_open',array(1,NULL,1),$call[2]); + $this->tableCalls[] = array($call[0].'_open',array(1,null,1),$call[2]); $this->lastCellType = $call[0]; $this->firstCell = false; @@ -1289,121 +1288,119 @@ class Doku_Handler_Table { $call = $this->tableCalls[$key]; switch ($call[0]) { - case 'tablerow_open': + case 'tablerow_open': - $lastRow++; - $lastCell = 0; - break; + $lastRow++; + $lastCell = 0; + break; - case 'tablecell_open': - case 'tableheader_open': + case 'tablecell_open': + case 'tableheader_open': - $lastCell++; - $cellKey[$lastRow][$lastCell] = $key; - break; + $lastCell++; + $cellKey[$lastRow][$lastCell] = $key; + break; - case 'table_align': + case 'table_align': - $prev = in_array($this->tableCalls[$key-1][0], array('tablecell_open', 'tableheader_open')); - $next = in_array($this->tableCalls[$key+1][0], array('tablecell_close', 'tableheader_close')); - // If the cell is empty, align left - if ($prev && $next) { - $this->tableCalls[$key-1][1][1] = 'left'; + $prev = in_array($this->tableCalls[$key-1][0], array('tablecell_open', 'tableheader_open')); + $next = in_array($this->tableCalls[$key+1][0], array('tablecell_close', 'tableheader_close')); + // If the cell is empty, align left + if ($prev && $next) { + $this->tableCalls[$key-1][1][1] = 'left'; - // If the previous element was a cell open, align right - } elseif ($prev) { - $this->tableCalls[$key-1][1][1] = 'right'; + // If the previous element was a cell open, align right + } elseif ($prev) { + $this->tableCalls[$key-1][1][1] = 'right'; + + // If the next element is the close of an element, align either center or left + } elseif ( $next) { + if ( $this->tableCalls[$cellKey[$lastRow][$lastCell]][1][1] == 'right' ) { + $this->tableCalls[$cellKey[$lastRow][$lastCell]][1][1] = 'center'; + } else { + $this->tableCalls[$cellKey[$lastRow][$lastCell]][1][1] = 'left'; + } - // If the next element is the close of an element, align either center or left - } elseif ( $next) { - if ( $this->tableCalls[$cellKey[$lastRow][$lastCell]][1][1] == 'right' ) { - $this->tableCalls[$cellKey[$lastRow][$lastCell]][1][1] = 'center'; - } else { - $this->tableCalls[$cellKey[$lastRow][$lastCell]][1][1] = 'left'; } - } + // Now convert the whitespace back to cdata + $this->tableCalls[$key][0] = 'cdata'; + break; - // Now convert the whitespace back to cdata - $this->tableCalls[$key][0] = 'cdata'; - break; + case 'colspan': - case 'colspan': + $this->tableCalls[$key-1][1][0] = false; - $this->tableCalls[$key-1][1][0] = false; + for($i = $key-2; $i >= $cellKey[$lastRow][1]; $i--) { - for($i = $key-2; $i >= $cellKey[$lastRow][1]; $i--) { + if ( $this->tableCalls[$i][0] == 'tablecell_open' || $this->tableCalls[$i][0] == 'tableheader_open' ) { - if ( $this->tableCalls[$i][0] == 'tablecell_open' || $this->tableCalls[$i][0] == 'tableheader_open' ) { + if ( false !== $this->tableCalls[$i][1][0] ) { + $this->tableCalls[$i][1][0]++; + break; + } - if ( false !== $this->tableCalls[$i][1][0] ) { - $this->tableCalls[$i][1][0]++; - break; } - - } - } - $toDelete[] = $key-1; - $toDelete[] = $key; - $toDelete[] = $key+1; - break; - - case 'rowspan': + $toDelete[] = $key-1; + $toDelete[] = $key; + $toDelete[] = $key+1; + break; - if ( $this->tableCalls[$key-1][0] == 'cdata' ) { - // ignore rowspan if previous call was cdata (text mixed with :::) we don't have to check next call as that wont match regex - $this->tableCalls[$key][0] = 'cdata'; + case 'rowspan': - } else { + if ( $this->tableCalls[$key-1][0] == 'cdata' ) { + // ignore rowspan if previous call was cdata (text mixed with :::) we don't have to check next call as that wont match regex + $this->tableCalls[$key][0] = 'cdata'; - $spanning_cell = null; - for($i = $lastRow-1; $i > 0; $i--) { + } else { - if ( $this->tableCalls[$cellKey[$i][$lastCell]][0] == 'tablecell_open' || $this->tableCalls[$cellKey[$i][$lastCell]][0] == 'tableheader_open' ) { + $spanning_cell = null; + for($i = $lastRow-1; $i > 0; $i--) { - if ($this->tableCalls[$cellKey[$i][$lastCell]][1][2] >= $lastRow - $i) { - $spanning_cell = $i; - break; - } + if ( $this->tableCalls[$cellKey[$i][$lastCell]][0] == 'tablecell_open' || $this->tableCalls[$cellKey[$i][$lastCell]][0] == 'tableheader_open' ) { + if ($this->tableCalls[$cellKey[$i][$lastCell]][1][2] >= $lastRow - $i) { + $spanning_cell = $i; + break; + } + } } - } - if (is_null($spanning_cell)) { - // No spanning cell found, so convert this cell to - // an empty one to avoid broken tables - $this->tableCells[$key][1][1] = ''; - continue; - } - $this->tableCalls[$cellKey[$spanning_cell][$lastCell]][1][2]++; + if (is_null($spanning_cell)) { + // No spanning cell found, so convert this cell to + // an empty one to avoid broken tables + $this->tableCalls[$key][0] = 'cdata'; + $this->tableCalls[$key][1][0] = ''; + continue; + } + $this->tableCalls[$cellKey[$spanning_cell][$lastCell]][1][2]++; - $this->tableCalls[$key-1][1][2] = false; + $this->tableCalls[$key-1][1][2] = false; - $toDelete[] = $key-1; - $toDelete[] = $key; - $toDelete[] = $key+1; - } - break; + $toDelete[] = $key-1; + $toDelete[] = $key; + $toDelete[] = $key+1; + } + break; - case 'tablerow_close': + case 'tablerow_close': - // Fix broken tables by adding missing cells - while (++$lastCell < $this->maxCols) { - array_splice($this->tableCalls, $key, 0, array( - array('tablecell_open', array(1, null, 1), $call[2]), - array('cdata', array(''), $call[2]), - array('tablecell_close', array(), $call[2]))); - $key += 3; - } + // Fix broken tables by adding missing cells + while (++$lastCell < $this->maxCols) { + array_splice($this->tableCalls, $key, 0, array( + array('tablecell_open', array(1, null, 1), $call[2]), + array('cdata', array(''), $call[2]), + array('tablecell_close', array(), $call[2]))); + $key += 3; + } - break; + break; } } - // condense cdata $cnt = count($this->tableCalls); for( $key = 0; $key < $cnt; $key++){ @@ -1435,6 +1432,7 @@ class Doku_Handler_Table { class Doku_Handler_Block { var $calls = array(); var $skipEol = false; + var $inParagraph = false; // Blocks these should not be inside paragraphs var $blockOpen = array( diff --git a/inc/parser/lexer.php b/inc/parser/lexer.php index b5bcb9612..2e84eca7c 100644 --- a/inc/parser/lexer.php +++ b/inc/parser/lexer.php @@ -1,18 +1,18 @@ <?php /** -* Author Markus Baker: http://www.lastcraft.com -* Version adapted from Simple Test: http://sourceforge.net/projects/simpletest/ -* For an intro to the Lexer see: -* http://www.phppatterns.com/index.php/article/articleview/106/1/2/ -* @author Marcus Baker -* @package Doku -* @subpackage Lexer -* @version $Id: lexer.php,v 1.1 2005/03/23 23:14:09 harryf Exp $ -*/ + * Author Markus Baker: http://www.lastcraft.com + * Version adapted from Simple Test: http://sourceforge.net/projects/simpletest/ + * For an intro to the Lexer see: + * http://www.phppatterns.com/index.php/article/articleview/106/1/2/ + * @author Marcus Baker + * @package Doku + * @subpackage Lexer + * @version $Id: lexer.php,v 1.1 2005/03/23 23:14:09 harryf Exp $ + */ /** -* Init path constant -*/ + * Init path constant + */ if(!defined('DOKU_INC')) die('meh.'); /**#@+ @@ -26,11 +26,12 @@ define("DOKU_LEXER_SPECIAL", 5); /**#@-*/ /** - * Compounded regular expression. Any of - * the contained patterns could match and - * when one does it's label is returned. - * @package Doku - * @subpackage Lexer + * Compounded regular expression. Any of + * the contained patterns could match and + * when one does it's label is returned. + * + * @package Doku + * @subpackage Lexer */ class Doku_LexerParallelRegex { var $_patterns; @@ -39,10 +40,11 @@ class Doku_LexerParallelRegex { var $_case; /** - * Constructor. Starts with no patterns. - * @param boolean $case True for case sensitive, false - * for insensitive. - * @access public + * Constructor. Starts with no patterns. + * + * @param boolean $case True for case sensitive, false + * for insensitive. + * @access public */ function Doku_LexerParallelRegex($case) { $this->_case = $case; @@ -52,15 +54,16 @@ class Doku_LexerParallelRegex { } /** - * Adds a pattern with an optional label. - * @param mixed $pattern Perl style regex. Must be UTF-8 - * encoded. If its a string, the (, ) - * lose their meaning unless they - * form part of a lookahead or - * lookbehind assertation. - * @param string $label Label of regex to be returned - * on a match. Label must be ASCII - * @access public + * Adds a pattern with an optional label. + * + * @param mixed $pattern Perl style regex. Must be UTF-8 + * encoded. If its a string, the (, ) + * lose their meaning unless they + * form part of a lookahead or + * lookbehind assertation. + * @param string $label Label of regex to be returned + * on a match. Label must be ASCII + * @access public */ function addPattern($pattern, $label = true) { $count = count($this->_patterns); @@ -70,13 +73,13 @@ class Doku_LexerParallelRegex { } /** - * Attempts to match all patterns at once against - * a string. - * @param string $subject String to match against. - * @param string $match First matched portion of - * subject. - * @return boolean True on success. - * @access public + * Attempts to match all patterns at once against a string. + * + * @param string $subject String to match against. + * @param string $match First matched portion of + * subject. + * @return boolean True on success. + * @access public */ function match($subject, &$match) { if (count($this->_patterns) == 0) { @@ -98,14 +101,14 @@ class Doku_LexerParallelRegex { } /** - * Attempts to split the string against all patterns at once + * Attempts to split the string against all patterns at once * - * @param string $subject String to match against. - * @param array $split The split result: array containing, pre-match, match & post-match strings - * @return boolean True on success. - * @access public + * @param string $subject String to match against. + * @param array $split The split result: array containing, pre-match, match & post-match strings + * @return boolean True on success. + * @access public * - * @author Christopher Smith <chris@jalakai.co.uk> + * @author Christopher Smith <chris@jalakai.co.uk> */ function split($subject, &$split) { if (count($this->_patterns) == 0) { @@ -143,12 +146,13 @@ class Doku_LexerParallelRegex { } /** - * Compounds the patterns into a single - * regular expression separated with the - * "or" operator. Caches the regex. - * Will automatically escape (, ) and / tokens. - * @param array $patterns List of patterns in order. - * @access private + * Compounds the patterns into a single + * regular expression separated with the + * "or" operator. Caches the regex. + * Will automatically escape (, ) and / tokens. + * + * @param array $patterns List of patterns in order. + * @access private */ function _getCompoundedRegex() { if ($this->_regex == null) { @@ -176,25 +180,25 @@ class Doku_LexerParallelRegex { */ switch($elt) { - case '(': - $pattern .= '\('; - break; - case ')': - if ($level > 0) - $level--; /* closing (? */ - else - $pattern .= '\\'; - $pattern .= ')'; - break; - case '(?': - $level++; - $pattern .= '(?'; - break; - default: - if (substr($elt, 0, 1) == '\\') - $pattern .= $elt; - else - $pattern .= str_replace('/', '\/', $elt); + case '(': + $pattern .= '\('; + break; + case ')': + if ($level > 0) + $level--; /* closing (? */ + else + $pattern .= '\\'; + $pattern .= ')'; + break; + case '(?': + $level++; + $pattern .= '(?'; + break; + default: + if (substr($elt, 0, 1) == '\\') + $pattern .= $elt; + else + $pattern .= str_replace('/', '\/', $elt); } } $this->_patterns[$i] = "($pattern)"; @@ -205,9 +209,9 @@ class Doku_LexerParallelRegex { } /** - * Accessor for perl regex mode flags to use. - * @return string Perl regex flags. - * @access private + * Accessor for perl regex mode flags to use. + * @return string Perl regex flags. + * @access private */ function _getPerlMatchingFlags() { return ($this->_case ? "msS" : "msSi"); @@ -215,47 +219,47 @@ class Doku_LexerParallelRegex { } /** - * States for a stack machine. - * @package Lexer - * @subpackage Lexer + * States for a stack machine. + * @package Lexer + * @subpackage Lexer */ class Doku_LexerStateStack { var $_stack; /** - * Constructor. Starts in named state. - * @param string $start Starting state name. - * @access public + * Constructor. Starts in named state. + * @param string $start Starting state name. + * @access public */ function Doku_LexerStateStack($start) { $this->_stack = array($start); } /** - * Accessor for current state. - * @return string State. - * @access public + * Accessor for current state. + * @return string State. + * @access public */ function getCurrent() { return $this->_stack[count($this->_stack) - 1]; } /** - * Adds a state to the stack and sets it - * to be the current state. - * @param string $state New state. - * @access public + * Adds a state to the stack and sets it + * to be the current state. + * @param string $state New state. + * @access public */ function enter($state) { array_push($this->_stack, $state); } /** - * Leaves the current state and reverts - * to the previous one. - * @return boolean False if we drop off - * the bottom of the list. - * @access public + * Leaves the current state and reverts + * to the previous one. + * @return boolean False if we drop off + * the bottom of the list. + * @access public */ function leave() { if (count($this->_stack) == 1) { @@ -267,13 +271,13 @@ class Doku_LexerStateStack { } /** - * Accepts text and breaks it into tokens. - * Some optimisation to make the sure the - * content is only scanned by the PHP regex - * parser once. Lexer modes must not start - * with leading underscores. - * @package Doku - * @subpackage Lexer + * Accepts text and breaks it into tokens. + * Some optimisation to make the sure the + * content is only scanned by the PHP regex + * parser once. Lexer modes must not start + * with leading underscores. + * @package Doku + * @subpackage Lexer */ class Doku_Lexer { var $_regexes; @@ -283,13 +287,13 @@ class Doku_Lexer { var $_case; /** - * Sets up the lexer in case insensitive matching - * by default. - * @param Doku_Parser $parser Handling strategy by - * reference. - * @param string $start Starting handler. - * @param boolean $case True for case sensitive. - * @access public + * Sets up the lexer in case insensitive matching + * by default. + * @param Doku_Parser $parser Handling strategy by + * reference. + * @param string $start Starting handler. + * @param boolean $case True for case sensitive. + * @access public */ function Doku_Lexer(&$parser, $start = "accept", $case = false) { $this->_case = $case; @@ -300,15 +304,15 @@ class Doku_Lexer { } /** - * Adds a token search pattern for a particular - * parsing mode. The pattern does not change the - * current mode. - * @param string $pattern Perl style regex, but ( and ) - * lose the usual meaning. - * @param string $mode Should only apply this - * pattern when dealing with - * this type of input. - * @access public + * Adds a token search pattern for a particular + * parsing mode. The pattern does not change the + * current mode. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @access public */ function addPattern($pattern, $mode = "accept") { if (! isset($this->_regexes[$mode])) { @@ -318,17 +322,17 @@ class Doku_Lexer { } /** - * Adds a pattern that will enter a new parsing - * mode. Useful for entering parenthesis, strings, - * tags, etc. - * @param string $pattern Perl style regex, but ( and ) - * lose the usual meaning. - * @param string $mode Should only apply this - * pattern when dealing with - * this type of input. - * @param string $new_mode Change parsing to this new - * nested mode. - * @access public + * Adds a pattern that will enter a new parsing + * mode. Useful for entering parenthesis, strings, + * tags, etc. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @param string $new_mode Change parsing to this new + * nested mode. + * @access public */ function addEntryPattern($pattern, $mode, $new_mode) { if (! isset($this->_regexes[$mode])) { @@ -338,12 +342,12 @@ class Doku_Lexer { } /** - * Adds a pattern that will exit the current mode - * and re-enter the previous one. - * @param string $pattern Perl style regex, but ( and ) - * lose the usual meaning. - * @param string $mode Mode to leave. - * @access public + * Adds a pattern that will exit the current mode + * and re-enter the previous one. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Mode to leave. + * @access public */ function addExitPattern($pattern, $mode) { if (! isset($this->_regexes[$mode])) { @@ -353,16 +357,16 @@ class Doku_Lexer { } /** - * Adds a pattern that has a special mode. Acts as an entry - * and exit pattern in one go, effectively calling a special - * parser handler for this token only. - * @param string $pattern Perl style regex, but ( and ) - * lose the usual meaning. - * @param string $mode Should only apply this - * pattern when dealing with - * this type of input. - * @param string $special Use this mode for this one token. - * @access public + * Adds a pattern that has a special mode. Acts as an entry + * and exit pattern in one go, effectively calling a special + * parser handler for this token only. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @param string $special Use this mode for this one token. + * @access public */ function addSpecialPattern($pattern, $mode, $special) { if (! isset($this->_regexes[$mode])) { @@ -372,24 +376,24 @@ class Doku_Lexer { } /** - * Adds a mapping from a mode to another handler. - * @param string $mode Mode to be remapped. - * @param string $handler New target handler. - * @access public + * Adds a mapping from a mode to another handler. + * @param string $mode Mode to be remapped. + * @param string $handler New target handler. + * @access public */ function mapHandler($mode, $handler) { $this->_mode_handlers[$mode] = $handler; } /** - * Splits the page text into tokens. Will fail - * if the handlers report an error or if no - * content is consumed. If successful then each - * unparsed and parsed token invokes a call to the - * held listener. - * @param string $raw Raw HTML text. - * @return boolean True on success, else false. - * @access public + * Splits the page text into tokens. Will fail + * if the handlers report an error or if no + * content is consumed. If successful then each + * unparsed and parsed token invokes a call to the + * held listener. + * @param string $raw Raw HTML text. + * @return boolean True on success, else false. + * @access public */ function parse($raw) { if (! isset($this->_parser)) { @@ -418,18 +422,18 @@ class Doku_Lexer { } /** - * Sends the matched token and any leading unmatched - * text to the parser changing the lexer to a new - * mode if one is listed. - * @param string $unmatched Unmatched leading portion. - * @param string $matched Actual token match. - * @param string $mode Mode after match. A boolean - * false mode causes no change. - * @param int $pos Current byte index location in raw doc - * thats being parsed - * @return boolean False if there was any error - * from the parser. - * @access private + * Sends the matched token and any leading unmatched + * text to the parser changing the lexer to a new + * mode if one is listed. + * @param string $unmatched Unmatched leading portion. + * @param string $matched Actual token match. + * @param string $mode Mode after match. A boolean + * false mode causes no change. + * @param int $pos Current byte index location in raw doc + * thats being parsed + * @return boolean False if there was any error + * from the parser. + * @access private */ function _dispatchTokens($unmatched, $matched, $mode = false, $initialPos, $matchPos) { if (! $this->_invokeParser($unmatched, DOKU_LEXER_UNMATCHED, $initialPos) ){ @@ -456,50 +460,50 @@ class Doku_Lexer { } /** - * Tests to see if the new mode is actually to leave - * the current mode and pop an item from the matching - * mode stack. - * @param string $mode Mode to test. - * @return boolean True if this is the exit mode. - * @access private + * Tests to see if the new mode is actually to leave + * the current mode and pop an item from the matching + * mode stack. + * @param string $mode Mode to test. + * @return boolean True if this is the exit mode. + * @access private */ function _isModeEnd($mode) { return ($mode === "__exit"); } /** - * Test to see if the mode is one where this mode - * is entered for this token only and automatically - * leaves immediately afterwoods. - * @param string $mode Mode to test. - * @return boolean True if this is the exit mode. - * @access private + * Test to see if the mode is one where this mode + * is entered for this token only and automatically + * leaves immediately afterwoods. + * @param string $mode Mode to test. + * @return boolean True if this is the exit mode. + * @access private */ function _isSpecialMode($mode) { return (strncmp($mode, "_", 1) == 0); } /** - * Strips the magic underscore marking single token - * modes. - * @param string $mode Mode to decode. - * @return string Underlying mode name. - * @access private + * Strips the magic underscore marking single token + * modes. + * @param string $mode Mode to decode. + * @return string Underlying mode name. + * @access private */ function _decodeSpecial($mode) { return substr($mode, 1); } /** - * Calls the parser method named after the current - * mode. Empty content will be ignored. The lexer - * has a parser handler for each mode in the lexer. - * @param string $content Text parsed. - * @param boolean $is_match Token is recognised rather - * than unparsed data. - * @param int $pos Current byte index location in raw doc - * thats being parsed - * @access private + * Calls the parser method named after the current + * mode. Empty content will be ignored. The lexer + * has a parser handler for each mode in the lexer. + * @param string $content Text parsed. + * @param boolean $is_match Token is recognised rather + * than unparsed data. + * @param int $pos Current byte index location in raw doc + * thats being parsed + * @access private */ function _invokeParser($content, $is_match, $pos) { if (($content === "") || ($content === false)) { @@ -513,26 +517,26 @@ class Doku_Lexer { // modes starting with plugin_ are all handled by the same // handler but with an additional parameter if(substr($handler,0,7)=='plugin_'){ - list($handler,$plugin) = explode('_',$handler,2); - return $this->_parser->$handler($content, $is_match, $pos, $plugin); + list($handler,$plugin) = explode('_',$handler,2); + return $this->_parser->$handler($content, $is_match, $pos, $plugin); } return $this->_parser->$handler($content, $is_match, $pos); } /** - * Tries to match a chunk of text and if successful - * removes the recognised chunk and any leading - * unparsed data. Empty strings will not be matched. - * @param string $raw The subject to parse. This is the - * content that will be eaten. - * @return array Three item list of unparsed - * content followed by the - * recognised token and finally the - * action the parser is to take. - * True if no match, false if there - * is a parsing error. - * @access private + * Tries to match a chunk of text and if successful + * removes the recognised chunk and any leading + * unparsed data. Empty strings will not be matched. + * @param string $raw The subject to parse. This is the + * content that will be eaten. + * @return array Three item list of unparsed + * content followed by the + * recognised token and finally the + * action the parser is to take. + * True if no match, false if there + * is a parsing error. + * @access private */ function _reduce(&$raw) { if (! isset($this->_regexes[$this->_mode->getCurrent()])) { @@ -550,9 +554,9 @@ class Doku_Lexer { } /** -* Escapes regex characters other than (, ) and / -* @TODO -*/ + * Escapes regex characters other than (, ) and / + * @TODO + */ function Doku_Lexer_Escape($str) { //$str = addslashes($str); $chars = array( diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index e17b82f8b..8ba159d62 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -23,422 +23,452 @@ require_once DOKU_INC . 'inc/parser/renderer.php'; */ class Doku_Renderer_metadata extends Doku_Renderer { - var $doc = ''; - var $meta = array(); - var $persistent = array(); + var $doc = ''; + var $meta = array(); + var $persistent = array(); - var $headers = array(); - var $capture = true; - var $store = ''; - var $firstimage = ''; + var $headers = array(); + var $capture = true; + var $store = ''; + var $firstimage = ''; - function getFormat(){ - return 'metadata'; - } + function getFormat(){ + return 'metadata'; + } + + function document_start(){ + global $ID; + + $this->headers = array(); + + // external pages are missing create date + if(!$this->persistent['date']['created']){ + $this->persistent['date']['created'] = filectime(wikiFN($ID)); + } + if(!isset($this->persistent['user'])){ + $this->persistent['user'] = ''; + } + if(!isset($this->persistent['creator'])){ + $this->persistent['creator'] = ''; + } + // reset metadata to persistent values + $this->meta = $this->persistent; + } + + function document_end(){ + global $ID; + + // store internal info in metadata (notoc,nocache) + $this->meta['internal'] = $this->info; - function document_start(){ - global $ID; + if (!isset($this->meta['description']['abstract'])){ + // cut off too long abstracts + $this->doc = trim($this->doc); + if (strlen($this->doc) > 500) + $this->doc = utf8_substr($this->doc, 0, 500).'…'; + $this->meta['description']['abstract'] = $this->doc; + } - $this->headers = array(); + $this->meta['relation']['firstimage'] = $this->firstimage; + + if(!isset($this->meta['date']['modified'])){ + $this->meta['date']['modified'] = filemtime(wikiFN($ID)); + } - // external pages are missing create date - if(!$this->persistent['date']['created']){ - $this->persistent['date']['created'] = filectime(wikiFN($ID)); } - if(!isset($this->persistent['user'])){ - $this->persistent['user'] = ''; + + function toc_additem($id, $text, $level) { + global $conf; + + //only add items within configured levels + if($level >= $conf['toptoclevel'] && $level <= $conf['maxtoclevel']){ + // the TOC is one of our standard ul list arrays ;-) + $this->meta['description']['tableofcontents'][] = array( + 'hid' => $id, + 'title' => $text, + 'type' => 'ul', + 'level' => $level-$conf['toptoclevel']+1 + ); + } + } - if(!isset($this->persistent['creator'])){ - $this->persistent['creator'] = ''; + + function header($text, $level, $pos) { + if (!isset($this->meta['title'])) $this->meta['title'] = $text; + + // add the header to the TOC + $hid = $this->_headerToLink($text,'true'); + $this->toc_additem($hid, $text, $level); + + // add to summary + if ($this->capture && ($level > 1)) $this->doc .= DOKU_LF.$text.DOKU_LF; } - // reset metadata to persistent values - $this->meta = $this->persistent; - } - function document_end(){ - global $ID; + function section_open($level){} + function section_close(){} - // store internal info in metadata (notoc,nocache) - $this->meta['internal'] = $this->info; + function cdata($text){ + if ($this->capture) $this->doc .= $text; + } - if (!isset($this->meta['description']['abstract'])){ - // cut off too long abstracts - $this->doc = trim($this->doc); - if (strlen($this->doc) > 500) - $this->doc = utf8_substr($this->doc, 0, 500).'…'; - $this->meta['description']['abstract'] = $this->doc; + function p_open(){ + if ($this->capture) $this->doc .= DOKU_LF; } - $this->meta['relation']['firstimage'] = $this->firstimage; + function p_close(){ + if ($this->capture){ + if (strlen($this->doc) > 250) $this->capture = false; + else $this->doc .= DOKU_LF; + } + } - if(!isset($this->meta['date']['modified'])){ - $this->meta['date']['modified'] = filemtime(wikiFN($ID)); + function linebreak(){ + if ($this->capture) $this->doc .= DOKU_LF; } - } + function hr(){ + if ($this->capture){ + if (strlen($this->doc) > 250) $this->capture = false; + else $this->doc .= DOKU_LF.'----------'.DOKU_LF; + } + } - function toc_additem($id, $text, $level) { - global $conf; + /** + * Callback for footnote start syntax + * + * All following content will go to the footnote instead of + * the document. To achieve this the previous rendered content + * is moved to $store and $doc is cleared + * + * @author Andreas Gohr <andi@splitbrain.org> + */ + function footnote_open() { + if ($this->capture){ + // move current content to store and record footnote + $this->store = $this->doc; + $this->doc = ''; + } + } - //only add items within configured levels - if($level >= $conf['toptoclevel'] && $level <= $conf['maxtoclevel']){ - // the TOC is one of our standard ul list arrays ;-) - $this->meta['description']['tableofcontents'][] = array( - 'hid' => $id, - 'title' => $text, - 'type' => 'ul', - 'level' => $level-$conf['toptoclevel']+1 - ); + /** + * Callback for footnote end syntax + * + * All rendered content is moved to the $footnotes array and the old + * content is restored from $store again + * + * @author Andreas Gohr + */ + function footnote_close() { + if ($this->capture){ + // restore old content + $this->doc = $this->store; + $this->store = ''; + } } - } + function listu_open(){ + if ($this->capture) $this->doc .= DOKU_LF; + } - function header($text, $level, $pos) { - if (!isset($this->meta['title'])) $this->meta['title'] = $text; + function listu_close(){ + if ($this->capture && (strlen($this->doc) > 250)) $this->capture = false; + } - // add the header to the TOC - $hid = $this->_headerToLink($text,'true'); - $this->toc_additem($hid, $text, $level); + function listo_open(){ + if ($this->capture) $this->doc .= DOKU_LF; + } - // add to summary - if ($this->capture && ($level > 1)) $this->doc .= DOKU_LF.$text.DOKU_LF; - } + function listo_close(){ + if ($this->capture && (strlen($this->doc) > 250)) $this->capture = false; + } - function section_open($level){} - function section_close(){} + function listitem_open($level){ + if ($this->capture) $this->doc .= str_repeat(DOKU_TAB, $level).'* '; + } - function cdata($text){ - if ($this->capture) $this->doc .= $text; - } + function listitem_close(){ + if ($this->capture) $this->doc .= DOKU_LF; + } - function p_open(){ - if ($this->capture) $this->doc .= DOKU_LF; - } + function listcontent_open(){} + function listcontent_close(){} - function p_close(){ - if ($this->capture){ - if (strlen($this->doc) > 250) $this->capture = false; - else $this->doc .= DOKU_LF; + function unformatted($text){ + if ($this->capture) $this->doc .= $text; } - } - function linebreak(){ - if ($this->capture) $this->doc .= DOKU_LF; - } + function preformatted($text){ + if ($this->capture) $this->doc .= $text; + } - function hr(){ - if ($this->capture){ - if (strlen($this->doc) > 250) $this->capture = false; - else $this->doc .= DOKU_LF.'----------'.DOKU_LF; + function file($text, $lang = null, $file = null){ + if ($this->capture){ + $this->doc .= DOKU_LF.$text; + if (strlen($this->doc) > 250) $this->capture = false; + else $this->doc .= DOKU_LF; + } } - } - /** - * Callback for footnote start syntax - * - * All following content will go to the footnote instead of - * the document. To achieve this the previous rendered content - * is moved to $store and $doc is cleared - * - * @author Andreas Gohr <andi@splitbrain.org> - */ - function footnote_open() { - if ($this->capture){ - // move current content to store and record footnote - $this->store = $this->doc; - $this->doc = ''; + function quote_open(){ + if ($this->capture) $this->doc .= DOKU_LF.DOKU_TAB.'"'; } - } - /** - * Callback for footnote end syntax - * - * All rendered content is moved to the $footnotes array and the old - * content is restored from $store again - * - * @author Andreas Gohr - */ - function footnote_close() { - if ($this->capture){ - // restore old content - $this->doc = $this->store; - $this->store = ''; - } - } - - function listu_open(){ - if ($this->capture) $this->doc .= DOKU_LF; - } - - function listu_close(){ - if ($this->capture && (strlen($this->doc) > 250)) $this->capture = false; - } - - function listo_open(){ - if ($this->capture) $this->doc .= DOKU_LF; - } - - function listo_close(){ - if ($this->capture && (strlen($this->doc) > 250)) $this->capture = false; - } - - function listitem_open($level){ - if ($this->capture) $this->doc .= str_repeat(DOKU_TAB, $level).'* '; - } - - function listitem_close(){ - if ($this->capture) $this->doc .= DOKU_LF; - } - - function listcontent_open(){} - function listcontent_close(){} - - function unformatted($text){ - if ($this->capture) $this->doc .= $text; - } - - function preformatted($text){ - if ($this->capture) $this->doc .= $text; - } - - function file($text, $lang = null, $file = null){ - if ($this->capture){ - $this->doc .= DOKU_LF.$text; - if (strlen($this->doc) > 250) $this->capture = false; - else $this->doc .= DOKU_LF; - } - } - - function quote_open(){ - if ($this->capture) $this->doc .= DOKU_LF.DOKU_TAB.'"'; - } - - function quote_close(){ - if ($this->capture){ - $this->doc .= '"'; - if (strlen($this->doc) > 250) $this->capture = false; - else $this->doc .= DOKU_LF; - } - } - - function code($text, $language = NULL, $file = null){ - if ($this->capture){ - $this->doc .= DOKU_LF.$text; - if (strlen($this->doc) > 250) $this->capture = false; - else $this->doc .= DOKU_LF; - } - } - - function acronym($acronym){ - if ($this->capture) $this->doc .= $acronym; - } - - function smiley($smiley){ - if ($this->capture) $this->doc .= $smiley; - } - - function entity($entity){ - if ($this->capture) $this->doc .= $entity; - } - - function multiplyentity($x, $y){ - if ($this->capture) $this->doc .= $x.'×'.$y; - } + function quote_close(){ + if ($this->capture){ + $this->doc .= '"'; + if (strlen($this->doc) > 250) $this->capture = false; + else $this->doc .= DOKU_LF; + } + } - function singlequoteopening(){ - global $lang; - if ($this->capture) $this->doc .= $lang['singlequoteopening']; - } + function code($text, $language = null, $file = null){ + if ($this->capture){ + $this->doc .= DOKU_LF.$text; + if (strlen($this->doc) > 250) $this->capture = false; + else $this->doc .= DOKU_LF; + } + } - function singlequoteclosing(){ - global $lang; - if ($this->capture) $this->doc .= $lang['singlequoteclosing']; - } + function acronym($acronym){ + if ($this->capture) $this->doc .= $acronym; + } - function apostrophe() { - global $lang; - if ($this->capture) $this->doc .= $lang['apostrophe']; - } + function smiley($smiley){ + if ($this->capture) $this->doc .= $smiley; + } - function doublequoteopening(){ - global $lang; - if ($this->capture) $this->doc .= $lang['doublequoteopening']; - } + function entity($entity){ + if ($this->capture) $this->doc .= $entity; + } - function doublequoteclosing(){ - global $lang; - if ($this->capture) $this->doc .= $lang['doublequoteclosing']; - } + function multiplyentity($x, $y){ + if ($this->capture) $this->doc .= $x.'×'.$y; + } - function camelcaselink($link) { - $this->internallink($link, $link); - } + function singlequoteopening(){ + global $lang; + if ($this->capture) $this->doc .= $lang['singlequoteopening']; + } - function locallink($hash, $name = NULL){} + function singlequoteclosing(){ + global $lang; + if ($this->capture) $this->doc .= $lang['singlequoteclosing']; + } - /** - * keep track of internal links in $this->meta['relation']['references'] - */ - function internallink($id, $name = NULL){ - global $ID; + function apostrophe() { + global $lang; + if ($this->capture) $this->doc .= $lang['apostrophe']; + } - if(is_array($name)) - $this->_firstimage($name['src']); + function doublequoteopening(){ + global $lang; + if ($this->capture) $this->doc .= $lang['doublequoteopening']; + } - $default = $this->_simpleTitle($id); - - // first resolve and clean up the $id - resolve_pageid(getNS($ID), $id, $exists); - list($page, $hash) = explode('#', $id, 2); - - // set metadata - $this->meta['relation']['references'][$page] = $exists; - // $data = array('relation' => array('isreferencedby' => array($ID => true))); - // p_set_metadata($id, $data); - - // add link title to summary - if ($this->capture){ - $name = $this->_getLinkTitle($name, $default, $id); - $this->doc .= $name; - } - } - - function externallink($url, $name = NULL){ - if(is_array($name)) - $this->_firstimage($name['src']); - - if ($this->capture){ - $this->doc .= $this->_getLinkTitle($name, '<' . $url . '>'); - } - } - - function interwikilink($match, $name = NULL, $wikiName, $wikiUri){ - if(is_array($name)) - $this->_firstimage($name['src']); - - if ($this->capture){ - list($wikiUri, $hash) = explode('#', $wikiUri, 2); - $name = $this->_getLinkTitle($name, $wikiUri); - $this->doc .= $name; - } - } - - function windowssharelink($url, $name = NULL){ - if(is_array($name)) - $this->_firstimage($name['src']); - - if ($this->capture){ - if ($name) $this->doc .= $name; - else $this->doc .= '<'.$url.'>'; - } - } - - function emaillink($address, $name = NULL){ - if(is_array($name)) - $this->_firstimage($name['src']); - - if ($this->capture){ - if ($name) $this->doc .= $name; - else $this->doc .= '<'.$address.'>'; - } - } - - function internalmedia($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL, $linking=NULL){ - if ($this->capture && $title) $this->doc .= '['.$title.']'; - $this->_firstimage($src); - } - - function externalmedia($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL, $linking=NULL){ - if ($this->capture && $title) $this->doc .= '['.$title.']'; - $this->_firstimage($src); - } - - function rss($url,$params) { - $this->meta['relation']['haspart'][$url] = true; - - $this->meta['date']['valid']['age'] = - isset($this->meta['date']['valid']['age']) ? - min($this->meta['date']['valid']['age'],$params['refresh']) : - $params['refresh']; - } - - //---------------------------------------------------------- - // Utils - - /** - * Removes any Namespace from the given name but keeps - * casing and special chars - * - * @author Andreas Gohr <andi@splitbrain.org> - */ - function _simpleTitle($name){ - global $conf; - - if(is_array($name)) return ''; - - if($conf['useslash']){ - $nssep = '[:;/]'; - }else{ - $nssep = '[:;]'; - } - $name = preg_replace('!.*'.$nssep.'!','',$name); - //if there is a hash we use the anchor name only - $name = preg_replace('!.*#!','',$name); - return $name; - } - - /** - * Creates a linkid from a headline - * - * @param string $title The headline title - * @param boolean $create Create a new unique ID? - * @author Andreas Gohr <andi@splitbrain.org> - */ - function _headerToLink($title, $create=false) { - if($create){ - return sectionID($title,$this->headers); - }else{ - $check = false; - return sectionID($title,$check); - } - } - - /** - * Construct a title and handle images in titles - * - * @author Harry Fuecks <hfuecks@gmail.com> - */ - function _getLinkTitle($title, $default, $id=NULL) { - global $conf; - - $isImage = false; - if (is_array($title)){ - if($title['title']) return '['.$title['title'].']'; - } else if (is_null($title) || trim($title)==''){ - if (useHeading('content') && $id){ - $heading = p_get_first_heading($id,METADATA_DONT_RENDER); - if ($heading) return $heading; - } - return $default; - } else { - return $title; + function doublequoteclosing(){ + global $lang; + if ($this->capture) $this->doc .= $lang['doublequoteclosing']; } - } - function _firstimage($src){ - if($this->firstimage) return; - global $ID; + function camelcaselink($link) { + $this->internallink($link, $link); + } + + function locallink($hash, $name = null){ + if(is_array($name)) { + $this->_firstimage($name['src']); + if ($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']); + } + } - list($src,$hash) = explode('#',$src,2); - if(!media_isexternal($src)){ - resolve_mediaid(getNS($ID),$src, $exists); + /** + * keep track of internal links in $this->meta['relation']['references'] + */ + function internallink($id, $name = null){ + global $ID; + + if(is_array($name)) { + $this->_firstimage($name['src']); + if ($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']); + } + + $parts = explode('?', $id, 2); + if (count($parts) === 2) { + $id = $parts[0]; + } + + $default = $this->_simpleTitle($id); + + // first resolve and clean up the $id + resolve_pageid(getNS($ID), $id, $exists); + list($page, $hash) = explode('#', $id, 2); + + // set metadata + $this->meta['relation']['references'][$page] = $exists; + // $data = array('relation' => array('isreferencedby' => array($ID => true))); + // p_set_metadata($id, $data); + + // add link title to summary + if ($this->capture){ + $name = $this->_getLinkTitle($name, $default, $id); + $this->doc .= $name; + } } - if(preg_match('/.(jpe?g|gif|png)$/i',$src)){ - $this->firstimage = $src; + + function externallink($url, $name = null){ + if(is_array($name)) { + $this->_firstimage($name['src']); + if ($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']); + } + + if ($this->capture){ + $this->doc .= $this->_getLinkTitle($name, '<' . $url . '>'); + } + } + + function interwikilink($match, $name = null, $wikiName, $wikiUri){ + if(is_array($name)) { + $this->_firstimage($name['src']); + if ($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']); + } + + if ($this->capture){ + list($wikiUri, $hash) = explode('#', $wikiUri, 2); + $name = $this->_getLinkTitle($name, $wikiUri); + $this->doc .= $name; + } + } + + function windowssharelink($url, $name = null){ + if(is_array($name)) { + $this->_firstimage($name['src']); + if ($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']); + } + + if ($this->capture){ + if ($name) $this->doc .= $name; + else $this->doc .= '<'.$url.'>'; + } + } + + function emaillink($address, $name = null){ + if(is_array($name)) { + $this->_firstimage($name['src']); + if ($name['type'] == 'internalmedia') $this->_recordMediaUsage($name['src']); + } + + if ($this->capture){ + if ($name) $this->doc .= $name; + else $this->doc .= '<'.$address.'>'; + } + } + + function internalmedia($src, $title=null, $align=null, $width=null, + $height=null, $cache=null, $linking=null){ + if ($this->capture && $title) $this->doc .= '['.$title.']'; + $this->_firstimage($src); + $this->_recordMediaUsage($src); + } + + function externalmedia($src, $title=null, $align=null, $width=null, + $height=null, $cache=null, $linking=null){ + if ($this->capture && $title) $this->doc .= '['.$title.']'; + $this->_firstimage($src); + } + + function rss($url,$params) { + $this->meta['relation']['haspart'][$url] = true; + + $this->meta['date']['valid']['age'] = + isset($this->meta['date']['valid']['age']) ? + min($this->meta['date']['valid']['age'],$params['refresh']) : + $params['refresh']; + } + + //---------------------------------------------------------- + // Utils + + /** + * Removes any Namespace from the given name but keeps + * casing and special chars + * + * @author Andreas Gohr <andi@splitbrain.org> + */ + function _simpleTitle($name){ + global $conf; + + if(is_array($name)) return ''; + + if($conf['useslash']){ + $nssep = '[:;/]'; + }else{ + $nssep = '[:;]'; + } + $name = preg_replace('!.*'.$nssep.'!','',$name); + //if there is a hash we use the anchor name only + $name = preg_replace('!.*#!','',$name); + return $name; + } + + /** + * Creates a linkid from a headline + * + * @param string $title The headline title + * @param boolean $create Create a new unique ID? + * @author Andreas Gohr <andi@splitbrain.org> + */ + function _headerToLink($title, $create=false) { + if($create){ + return sectionID($title,$this->headers); + }else{ + $check = false; + return sectionID($title,$check); + } + } + + /** + * Construct a title and handle images in titles + * + * @author Harry Fuecks <hfuecks@gmail.com> + */ + function _getLinkTitle($title, $default, $id=null) { + global $conf; + + $isImage = false; + if (is_array($title)){ + if($title['title']) return '['.$title['title'].']'; + } else if (is_null($title) || trim($title)==''){ + if (useHeading('content') && $id){ + $heading = p_get_first_heading($id,METADATA_DONT_RENDER); + if ($heading) return $heading; + } + return $default; + } else { + return $title; + } + } + + function _firstimage($src){ + if($this->firstimage) return; + global $ID; + + list($src,$hash) = explode('#',$src,2); + if(!media_isexternal($src)){ + resolve_mediaid(getNS($ID),$src, $exists); + } + if(preg_match('/.(jpe?g|gif|png)$/i',$src)){ + $this->firstimage = $src; + } + } + + function _recordMediaUsage($src) { + global $ID; + + list ($src, $hash) = explode('#', $src, 2); + if (media_isexternal($src)) return; + resolve_mediaid(getNS($ID), $src, $exists); + $this->meta['relation']['media'][$src] = $exists; } - } } //Setup VIM: ex: et ts=4 : diff --git a/inc/parser/parser.php b/inc/parser/parser.php index 915899f53..e39a4daf5 100644 --- a/inc/parser/parser.php +++ b/inc/parser/parser.php @@ -45,9 +45,9 @@ $PARSER_MODES = array( //------------------------------------------------------------------- /** -* Sets up the Lexer with modes and points it to the Handler -* For an intro to the Lexer see: wiki:parser -*/ + * Sets up the Lexer with modes and points it to the Handler + * For an intro to the Lexer see: wiki:parser + */ class Doku_Parser { var $Handler; @@ -70,9 +70,9 @@ class Doku_Parser { } /** - * PHP preserves order of associative elements - * Mode sequence is important - */ + * PHP preserves order of associative elements + * Mode sequence is important + */ function addMode($name, & $Mode) { if ( !isset($this->modes['base']) ) { $this->addBaseMode(new Doku_Parser_Mode_base()); @@ -134,7 +134,7 @@ class Doku_Parser { * all modes are registered * * @author Harry Fuecks <hfuecks@gmail.com> -*/ + */ class Doku_Parser_Mode { /** @@ -454,8 +454,8 @@ class Doku_Parser_Mode_table extends Doku_Parser_Mode { } function connectTo($mode) { - $this->Lexer->addEntryPattern('\n\^',$mode,'table'); - $this->Lexer->addEntryPattern('\n\|',$mode,'table'); + $this->Lexer->addEntryPattern('\s*\n\^',$mode,'table'); + $this->Lexer->addEntryPattern('\s*\n\|',$mode,'table'); } function postConnect() { @@ -555,7 +555,7 @@ class Doku_Parser_Mode_preformatted extends Doku_Parser_Mode { class Doku_Parser_Mode_code extends Doku_Parser_Mode { function connectTo($mode) { - $this->Lexer->addEntryPattern('<code(?=.*</code>)',$mode,'code'); + $this->Lexer->addEntryPattern('<code\b(?=.*</code>)',$mode,'code'); } function postConnect() { @@ -571,7 +571,7 @@ class Doku_Parser_Mode_code extends Doku_Parser_Mode { class Doku_Parser_Mode_file extends Doku_Parser_Mode { function connectTo($mode) { - $this->Lexer->addEntryPattern('<file(?=.*</file>)',$mode,'file'); + $this->Lexer->addEntryPattern('<file\b(?=.*</file>)',$mode,'file'); } function postConnect() { @@ -621,7 +621,7 @@ class Doku_Parser_Mode_acronym extends Doku_Parser_Mode { var $pattern = ''; function Doku_Parser_Mode_acronym($acronyms) { - usort($acronyms,array($this,'_compare')); + usort($acronyms,array($this,'_compare')); $this->acronyms = $acronyms; } @@ -652,12 +652,12 @@ class Doku_Parser_Mode_acronym extends Doku_Parser_Mode { $a_len = strlen($a); $b_len = strlen($b); if ($a_len > $b_len) { - return -1; + return -1; } else if ($a_len < $b_len) { - return 1; + return 1; } - return 0; + return 0; } } @@ -807,7 +807,6 @@ class Doku_Parser_Mode_quotes extends Doku_Parser_Mode { "\"",$mode,'doublequoteclosing' ); - } function getSort() { diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 7df369478..c697e990c 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -74,12 +74,12 @@ class Doku_Renderer extends DokuWiki_Plugin { */ function nest($instructions) { - foreach ( $instructions as $instruction ) { - // execute the callback against ourself - if (method_exists($this,$instruction[0])) { - call_user_func_array(array($this, $instruction[0]), $instruction[1] ? $instruction[1] : array()); + foreach ( $instructions as $instruction ) { + // execute the callback against ourself + if (method_exists($this,$instruction[0])) { + call_user_func_array(array($this, $instruction[0]), $instruction[1] ? $instruction[1] : array()); + } } - } } // dummy closing instruction issued by Doku_Handler_Nest, normally the syntax mode should @@ -203,42 +203,42 @@ class Doku_Renderer extends DokuWiki_Plugin { // $link like 'SomePage' function camelcaselink($link) {} - function locallink($hash, $name = NULL) {} + function locallink($hash, $name = null) {} // $link like 'wiki:syntax', $title could be an array (media) - function internallink($link, $title = NULL) {} + function internallink($link, $title = null) {} // $link is full URL with scheme, $title could be an array (media) - function externallink($link, $title = NULL) {} + function externallink($link, $title = null) {} function rss ($url,$params) {} // $link is the original link - probably not much use // $wikiName is an indentifier for the wiki // $wikiUri is the URL fragment to append to some known URL - function interwikilink($link, $title = NULL, $wikiName, $wikiUri) {} + function interwikilink($link, $title = null, $wikiName, $wikiUri) {} // Link to file on users OS, $title could be an array (media) - function filelink($link, $title = NULL) {} + function filelink($link, $title = null) {} // Link to a Windows share, , $title could be an array (media) - function windowssharelink($link, $title = NULL) {} + function windowssharelink($link, $title = null) {} -// function email($address, $title = NULL) {} - function emaillink($address, $name = NULL) {} +// function email($address, $title = null) {} + function emaillink($address, $name = null) {} - function internalmedia ($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL, $linking=NULL) {} + function internalmedia ($src, $title=null, $align=null, $width=null, + $height=null, $cache=null, $linking=null) {} - function externalmedia ($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL, $linking=NULL) {} + function externalmedia ($src, $title=null, $align=null, $width=null, + $height=null, $cache=null, $linking=null) {} function internalmedialink ( - $src,$title=NULL,$align=NULL,$width=NULL,$height=NULL,$cache=NULL + $src,$title=null,$align=null,$width=null,$height=null,$cache=null ) {} function externalmedialink( - $src,$title=NULL,$align=NULL,$width=NULL,$height=NULL,$cache=NULL + $src,$title=null,$align=null,$width=null,$height=null,$cache=null ) {} function table_open($maxcols = null, $numrows = null, $pos = null){} @@ -249,11 +249,11 @@ class Doku_Renderer extends DokuWiki_Plugin { function tablerow_close(){} - function tableheader_open($colspan = 1, $align = NULL, $rowspan = 1){} + function tableheader_open($colspan = 1, $align = null, $rowspan = 1){} function tableheader_close(){} - function tablecell_open($colspan = 1, $align = NULL, $rowspan = 1){} + function tablecell_open($colspan = 1, $align = null, $rowspan = 1){} function tablecell_close(){} diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 84a999e56..fd02c0ce0 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -33,6 +33,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { private $lastsecid = 0; // last section edit id, used by startSectionEdit var $headers = array(); + /** @var array a list of footnotes, list starts at 1! */ var $footnotes = array(); var $lastlevel = 0; var $node = array(0,0,0,0,0); @@ -59,7 +60,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * Finish an edit section range * * @param $end int The byte position for the edit end; null for the rest of - the page + * the page * @author Adrian Lang <lang@cosmocode.de> */ public function finishSectionEdit($end = null) { @@ -100,10 +101,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ( count ($this->footnotes) > 0 ) { $this->doc .= '<div class="footnotes">'.DOKU_LF; - $id = 0; - foreach ( $this->footnotes as $footnote ) { - $id++; // the number of the current footnote - + foreach ( $this->footnotes as $id => $footnote ) { // check its not a placeholder that indicates actual footnote text is elsewhere if (substr($footnote, 0, 5) != "@@FNT") { @@ -116,11 +114,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $alt = array_keys($this->footnotes, "@@FNT$id"); if (count($alt)) { - foreach ($alt as $ref) { - // set anchor and backlink for the other footnotes - $this->doc .= ', <sup><a href="#fnt__'.($ref+1).'" id="fn__'.($ref+1).'" class="fn_bot">'; - $this->doc .= ($ref+1).')</a></sup> '.DOKU_LF; - } + foreach ($alt as $ref) { + // set anchor and backlink for the other footnotes + $this->doc .= ', <sup><a href="#fnt__'.($ref).'" id="fn__'.($ref).'" class="fn_bot">'; + $this->doc .= ($ref).')</a></sup> '.DOKU_LF; + } } // add footnote markup and close this footnote @@ -295,6 +293,10 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @author Andreas Gohr */ function footnote_close() { + /** @var $fnid int takes track of seen footnotes, assures they are unique even across multiple docs FS#2841 */ + static $fnid = 0; + // assign new footnote id (we start at 1) + $fnid++; // recover footnote into the stack and restore old content $footnote = $this->doc; @@ -306,17 +308,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if ($i === false) { // its a new footnote, add it to the $footnotes array - $id = count($this->footnotes)+1; - $this->footnotes[count($this->footnotes)] = $footnote; + $this->footnotes[$fnid] = $footnote; } else { - // seen this one before, translate the index to an id and save a placeholder - $i++; - $id = count($this->footnotes)+1; - $this->footnotes[count($this->footnotes)] = "@@FNT".($i); + // seen this one before, save a placeholder + $this->footnotes[$fnid] = "@@FNT".($i); } // output the footnote reference and link - $this->doc .= '<sup><a href="#fn__'.$id.'" id="fnt__'.$id.'" class="fn_top">'.$id.')</a></sup>'; + $this->doc .= '<sup><a href="#fn__'.$fnid.'" id="fnt__'.$fnid.'" class="fn_top">'.$fnid.')</a></sup>'; } function listu_open() { @@ -367,12 +366,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $conf; if($conf['phpok']){ - ob_start(); - eval($text); - $this->doc .= ob_get_contents(); - ob_end_clean(); + ob_start(); + eval($text); + $this->doc .= ob_get_contents(); + ob_end_clean(); } else { - $this->doc .= p_xhtml_cached_geshi($text, 'php', $wrapper); + $this->doc .= p_xhtml_cached_geshi($text, 'php', $wrapper); } } @@ -392,9 +391,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $conf; if($conf['htmlok']){ - $this->doc .= $text; + $this->doc .= $text; } else { - $this->doc .= p_xhtml_cached_geshi($text, 'html4strict', $wrapper); + $this->doc .= p_xhtml_cached_geshi($text, 'html4strict', $wrapper); } } @@ -541,13 +540,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } /** - */ + */ function camelcaselink($link) { - $this->internallink($link,$link); + $this->internallink($link,$link); } - function locallink($hash, $name = NULL){ + function locallink($hash, $name = null){ global $ID; $name = $this->_getLinkTitle($name, $hash, $isImage); $hash = $this->_headerToLink($hash); @@ -565,7 +564,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * * @author Andreas Gohr <andi@splitbrain.org> */ - function internallink($id, $name = NULL, $search=NULL,$returnonly=false,$linktype='content') { + function internallink($id, $name = null, $search=null,$returnonly=false,$linktype='content') { global $conf; global $ID; global $INFO; @@ -644,7 +643,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { } } - function externallink($url, $name = NULL) { + function externallink($url, $name = null) { global $conf; $name = $this->_getLinkTitle($name, $url, $isImage); @@ -687,7 +686,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** */ - function interwikilink($match, $name = NULL, $wikiName, $wikiUri) { + function interwikilink($match, $name = null, $wikiName, $wikiUri) { global $conf; $link = array(); @@ -721,7 +720,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** */ - function windowssharelink($url, $name = NULL) { + function windowssharelink($url, $name = null) { global $conf; global $lang; //simple setup @@ -737,7 +736,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $link['class'] = 'media'; } - $link['title'] = $this->_xmlEntities($url); $url = str_replace('\\','/',$url); $url = 'file:///'.$url; @@ -747,7 +745,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $this->_formatLink($link); } - function emaillink($address, $name = NULL) { + function emaillink($address, $name = null) { global $conf; //simple setup $link = array(); @@ -782,8 +780,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= $this->_formatLink($link); } - function internalmedia ($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL, $linking=NULL) { + function internalmedia ($src, $title=null, $align=null, $width=null, + $height=null, $cache=null, $linking=null) { global $ID; list($src,$hash) = explode('#',$src,2); resolve_mediaid(getNS($ID),$src, $exists); @@ -818,8 +816,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { else $this->doc .= $this->_formatLink($link); } - function externalmedia ($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL, $linking=NULL) { + function externalmedia ($src, $title=null, $align=null, $width=null, + $height=null, $cache=null, $linking=null) { list($src,$hash) = explode('#',$src,2); $noLink = false; $render = ($linking == 'linkonly') ? false : true; @@ -875,7 +873,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $mod = 1; $start = 0; $end = $feed->get_item_quantity(); - $end = ($end > $params['max']) ? $params['max'] : $end;; + $end = ($end > $params['max']) ? $params['max'] : $end; } $this->doc .= '<ul class="rss">'; @@ -959,7 +957,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= DOKU_LF . DOKU_TAB . '</tr>' . DOKU_LF; } - function tableheader_open($colspan = 1, $align = NULL, $rowspan = 1){ + function tableheader_open($colspan = 1, $align = null, $rowspan = 1){ $class = 'class="col' . $this->_counter['cell_counter']++; if ( !is_null($align) ) { $class .= ' '.$align.'align'; @@ -980,7 +978,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= '</th>'; } - function tablecell_open($colspan = 1, $align = NULL, $rowspan = 1){ + function tablecell_open($colspan = 1, $align = null, $rowspan = 1){ $class = 'class="col' . $this->_counter['cell_counter']++; if ( !is_null($align) ) { $class .= ' '.$align.'align'; @@ -1046,8 +1044,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * * @author Andreas Gohr <andi@splitbrain.org> */ - function _media ($src, $title=NULL, $align=NULL, $width=NULL, - $height=NULL, $cache=NULL, $render = true) { + function _media ($src, $title=null, $align=null, $width=null, + $height=null, $cache=null, $render = true) { $ret = ''; @@ -1149,7 +1147,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * * @author Harry Fuecks <hfuecks@gmail.com> */ - function _getLinkTitle($title, $default, & $isImage, $id=NULL, $linktype='content') { + function _getLinkTitle($title, $default, & $isImage, $id=null, $linktype='content') { global $conf; $isImage = false; @@ -1208,8 +1206,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @access protected * @return array */ - function _getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render) - { + function _getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render) { global $conf; $link = array(); diff --git a/inc/parserutils.php b/inc/parserutils.php index 56161af44..b67daaabb 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -625,7 +625,8 @@ function & p_get_renderer($mode) { $rclass = "Doku_Renderer_$rname"; if( class_exists($rclass) ) { - return new $rclass(); + $Renderer = new $rclass(); + return $Renderer; } // try default renderer first: @@ -641,10 +642,7 @@ function & p_get_renderer($mode) { $Renderer = new $rclass(); }else{ // Maybe a plugin/component is available? - list($plugin, $component) = $plugin_controller->_splitName($rname); - if (!$plugin_controller->isdisabled($plugin)){ - $Renderer =& $plugin_controller->load('renderer',$rname); - } + $Renderer = $plugin_controller->load('renderer',$rname); if(!isset($Renderer) || is_null($Renderer)){ msg("No renderer '$rname' found for mode '$mode'",-1); diff --git a/inc/phpseclib/Crypt_AES.php b/inc/phpseclib/Crypt_AES.php new file mode 100644 index 000000000..81fa2feab --- /dev/null +++ b/inc/phpseclib/Crypt_AES.php @@ -0,0 +1,188 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Pure-PHP implementation of AES. + * + * Uses mcrypt, if available/possible, and an internal implementation, otherwise. + * + * PHP versions 4 and 5 + * + * If {@link Crypt_AES::setKeyLength() setKeyLength()} isn't called, it'll be calculated from + * {@link Crypt_AES::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's 136-bits + * it'll be null-padded to 192-bits and 192 bits will be the key length until {@link Crypt_AES::setKey() setKey()} + * is called, again, at which point, it'll be recalculated. + * + * Since Crypt_AES extends Crypt_Rijndael, some functions are available to be called that, in the context of AES, don't + * make a whole lot of sense. {@link Crypt_AES::setBlockLength() setBlockLength()}, for instance. Calling that function, + * however possible, won't do anything (AES has a fixed block length whereas Rijndael has a variable one). + * + * Here's a short example of how to use this library: + * <code> + * <?php + * include('Crypt/AES.php'); + * + * $aes = new Crypt_AES(); + * + * $aes->setKey('abcdefghijklmnop'); + * + * $size = 10 * 1024; + * $plaintext = ''; + * for ($i = 0; $i < $size; $i++) { + * $plaintext.= 'a'; + * } + * + * echo $aes->decrypt($aes->encrypt($plaintext)); + * ?> + * </code> + * + * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @category Crypt + * @package Crypt_AES + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVIII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ + +/** + * Include Crypt_Rijndael + */ +if (!class_exists('Crypt_Rijndael')) { + require_once('Rijndael.php'); +} + +/**#@+ + * @access public + * @see Crypt_AES::encrypt() + * @see Crypt_AES::decrypt() + */ +/** + * Encrypt / decrypt using the Counter mode. + * + * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 + */ +define('CRYPT_AES_MODE_CTR', CRYPT_MODE_CTR); +/** + * Encrypt / decrypt using the Electronic Code Book mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 + */ +define('CRYPT_AES_MODE_ECB', CRYPT_MODE_ECB); +/** + * Encrypt / decrypt using the Code Book Chaining mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 + */ +define('CRYPT_AES_MODE_CBC', CRYPT_MODE_CBC); +/** + * Encrypt / decrypt using the Cipher Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29 + */ +define('CRYPT_AES_MODE_CFB', CRYPT_MODE_CFB); +/** + * Encrypt / decrypt using the Cipher Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29 + */ +define('CRYPT_AES_MODE_OFB', CRYPT_MODE_OFB); +/**#@-*/ + +/**#@+ + * @access private + * @see Crypt_AES::Crypt_AES() + */ +/** + * Toggles the internal implementation + */ +define('CRYPT_AES_MODE_INTERNAL', CRYPT_MODE_INTERNAL); +/** + * Toggles the mcrypt implementation + */ +define('CRYPT_AES_MODE_MCRYPT', CRYPT_MODE_MCRYPT); +/**#@-*/ + +/** + * Pure-PHP implementation of AES. + * + * @author Jim Wigginton <terrafrost@php.net> + * @version 0.1.0 + * @access public + * @package Crypt_AES + */ +class Crypt_AES extends Crypt_Rijndael { + /** + * The namespace used by the cipher for its constants. + * + * @see Crypt_Base::const_namespace + * @var String + * @access private + */ + var $const_namespace = 'AES'; + + /** + * Default Constructor. + * + * Determines whether or not the mcrypt extension should be used. + * + * $mode could be: + * + * - CRYPT_AES_MODE_ECB + * + * - CRYPT_AES_MODE_CBC + * + * - CRYPT_AES_MODE_CTR + * + * - CRYPT_AES_MODE_CFB + * + * - CRYPT_AES_MODE_OFB + * + * If not explictly set, CRYPT_AES_MODE_CBC will be used. + * + * @see Crypt_Rijndael::Crypt_Rijndael() + * @see Crypt_Base::Crypt_Base() + * @param optional Integer $mode + * @access public + */ + function Crypt_AES($mode = CRYPT_AES_MODE_CBC) + { + parent::Crypt_Rijndael($mode); + } + + /** + * Dummy function + * + * Since Crypt_AES extends Crypt_Rijndael, this function is, technically, available, but it doesn't do anything. + * + * @see Crypt_Rijndael::setBlockLength() + * @access public + * @param Integer $length + */ + function setBlockLength($length) + { + return; + } +} + +// vim: ts=4:sw=4:et: +// vim6: fdl=1: diff --git a/inc/phpseclib/Crypt_Base.php b/inc/phpseclib/Crypt_Base.php new file mode 100644 index 000000000..7c650ca72 --- /dev/null +++ b/inc/phpseclib/Crypt_Base.php @@ -0,0 +1,1989 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Base Class for all Crypt_* cipher classes + * + * PHP versions 4 and 5 + * + * Internally for phpseclib developers: + * If you plan to add a new cipher class, please note following rules: + * + * - The new Crypt_* cipher class should extend Crypt_Base + * + * - Following methods are then required to be overridden/overloaded: + * + * - _encryptBlock() + * + * - _decryptBlock() + * + * - _setupKey() + * + * - All other methods are optional to be overridden/overloaded + * + * - Look at the source code of the current ciphers how they extend Crypt_Base + * and take one of them as a start up for the new cipher class. + * + * - Please read all the other comments/notes/hints here also for each class var/method + * + * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @category Crypt + * @package Crypt_Base + * @author Jim Wigginton <terrafrost@php.net> + * @author Hans-Juergen Petrich <petrich@tronic-media.com> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @version 1.0.1 + * @link http://phpseclib.sourceforge.net + */ + +/**#@+ + * @access public + * @see Crypt_Base::encrypt() + * @see Crypt_Base::decrypt() + */ +/** + * Encrypt / decrypt using the Counter mode. + * + * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 + */ +define('CRYPT_MODE_CTR', -1); +/** + * Encrypt / decrypt using the Electronic Code Book mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 + */ +define('CRYPT_MODE_ECB', 1); +/** + * Encrypt / decrypt using the Code Book Chaining mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 + */ +define('CRYPT_MODE_CBC', 2); +/** + * Encrypt / decrypt using the Cipher Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29 + */ +define('CRYPT_MODE_CFB', 3); +/** + * Encrypt / decrypt using the Output Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29 + */ +define('CRYPT_MODE_OFB', 4); +/** + * Encrypt / decrypt using streaming mode. + * + */ +define('CRYPT_MODE_STREAM', 5); +/**#@-*/ + +/**#@+ + * @access private + * @see Crypt_Base::Crypt_Base() + */ +/** + * Base value for the internal implementation $engine switch + */ +define('CRYPT_MODE_INTERNAL', 1); +/** + * Base value for the mcrypt implementation $engine switch + */ +define('CRYPT_MODE_MCRYPT', 2); +/**#@-*/ + +/** + * Base Class for all Crypt_* cipher classes + * + * @author Jim Wigginton <terrafrost@php.net> + * @author Hans-Juergen Petrich <petrich@tronic-media.com> + * @version 1.0.0 + * @access public + * @package Crypt_Base + */ +class Crypt_Base { + /** + * The Encryption Mode + * + * @see Crypt_Base::Crypt_Base() + * @var Integer + * @access private + */ + var $mode; + + /** + * The Block Length of the block cipher + * + * @var Integer + * @access private + */ + var $block_size = 16; + + /** + * The Key + * + * @see Crypt_Base::setKey() + * @var String + * @access private + */ + var $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + + /** + * The Initialization Vector + * + * @see Crypt_Base::setIV() + * @var String + * @access private + */ + var $iv; + + /** + * A "sliding" Initialization Vector + * + * @see Crypt_Base::enableContinuousBuffer() + * @see Crypt_Base::_clearBuffers() + * @var String + * @access private + */ + var $encryptIV; + + /** + * A "sliding" Initialization Vector + * + * @see Crypt_Base::enableContinuousBuffer() + * @see Crypt_Base::_clearBuffers() + * @var String + * @access private + */ + var $decryptIV; + + /** + * Continuous Buffer status + * + * @see Crypt_Base::enableContinuousBuffer() + * @var Boolean + * @access private + */ + var $continuousBuffer = false; + + /** + * Encryption buffer for CTR, OFB and CFB modes + * + * @see Crypt_Base::encrypt() + * @see Crypt_Base::_clearBuffers() + * @var Array + * @access private + */ + var $enbuffer; + + /** + * Decryption buffer for CTR, OFB and CFB modes + * + * @see Crypt_Base::decrypt() + * @see Crypt_Base::_clearBuffers() + * @var Array + * @access private + */ + var $debuffer; + + /** + * mcrypt resource for encryption + * + * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. + * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. + * + * @see Crypt_Base::encrypt() + * @var Resource + * @access private + */ + var $enmcrypt; + + /** + * mcrypt resource for decryption + * + * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. + * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. + * + * @see Crypt_Base::decrypt() + * @var Resource + * @access private + */ + var $demcrypt; + + /** + * Does the enmcrypt resource need to be (re)initialized? + * + * @see Crypt_Twofish::setKey() + * @see Crypt_Twofish::setIV() + * @var Boolean + * @access private + */ + var $enchanged = true; + + /** + * Does the demcrypt resource need to be (re)initialized? + * + * @see Crypt_Twofish::setKey() + * @see Crypt_Twofish::setIV() + * @var Boolean + * @access private + */ + var $dechanged = true; + + /** + * mcrypt resource for CFB mode + * + * mcrypt's CFB mode, in (and only in) buffered context, + * is broken, so phpseclib implements the CFB mode by it self, + * even when the mcrypt php extension is available. + * + * In order to do the CFB-mode work (fast) phpseclib + * use a separate ECB-mode mcrypt resource. + * + * @link http://phpseclib.sourceforge.net/cfb-demo.phps + * @see Crypt_Base::encrypt() + * @see Crypt_Base::decrypt() + * @see Crypt_Base::_setupMcrypt() + * @var Resource + * @access private + */ + var $ecb; + + /** + * Optimizing value while CFB-encrypting + * + * Only relevant if $continuousBuffer enabled + * and $engine == CRYPT_MODE_MCRYPT + * + * It's faster to re-init $enmcrypt if + * $buffer bytes > $cfb_init_len than + * using the $ecb resource furthermore. + * + * This value depends of the choosen cipher + * and the time it would be needed for it's + * initialization [by mcrypt_generic_init()] + * which, typically, depends on the complexity + * on its internaly Key-expanding algorithm. + * + * @see Crypt_Base::encrypt() + * @var Integer + * @access private + */ + var $cfb_init_len = 600; + + /** + * Does internal cipher state need to be (re)initialized? + * + * @see setKey() + * @see setIV() + * @see disableContinuousBuffer() + * @var Boolean + * @access private + */ + var $changed = true; + + /** + * Padding status + * + * @see Crypt_Base::enablePadding() + * @var Boolean + * @access private + */ + var $padding = true; + + /** + * Is the mode one that is paddable? + * + * @see Crypt_Base::Crypt_Base() + * @var Boolean + * @access private + */ + var $paddable = false; + + /** + * Holds which crypt engine internaly should be use, + * which will be determined automatically on __construct() + * + * Currently available $engines are: + * - CRYPT_MODE_MCRYPT (fast, php-extension: mcrypt, extension_loaded('mcrypt') required) + * - CRYPT_MODE_INTERNAL (slower, pure php-engine, no php-extension required) + * + * In the pipeline... maybe. But currently not available: + * - CRYPT_MODE_OPENSSL (very fast, php-extension: openssl, extension_loaded('openssl') required) + * + * If possible, CRYPT_MODE_MCRYPT will be used for each cipher. + * Otherwise CRYPT_MODE_INTERNAL + * + * @see Crypt_Base::encrypt() + * @see Crypt_Base::decrypt() + * @var Integer + * @access private + */ + var $engine; + + /** + * The mcrypt specific name of the cipher + * + * Only used if $engine == CRYPT_MODE_MCRYPT + * + * @link http://www.php.net/mcrypt_module_open + * @link http://www.php.net/mcrypt_list_algorithms + * @see Crypt_Base::_setupMcrypt() + * @var String + * @access private + */ + var $cipher_name_mcrypt; + + /** + * The default password key_size used by setPassword() + * + * @see Crypt_Base::setPassword() + * @var Integer + * @access private + */ + var $password_key_size = 32; + + /** + * The default salt used by setPassword() + * + * @see Crypt_Base::setPassword() + * @var String + * @access private + */ + var $password_default_salt = 'phpseclib/salt'; + + /** + * The namespace used by the cipher for its constants. + * + * ie: AES.php is using CRYPT_AES_MODE_* for its constants + * so $const_namespace is AES + * + * DES.php is using CRYPT_DES_MODE_* for its constants + * so $const_namespace is DES... and so on + * + * All CRYPT_<$const_namespace>_MODE_* are aliases of + * the generic CRYPT_MODE_* constants, so both could be used + * for each cipher. + * + * Example: + * $aes = new Crypt_AES(CRYPT_AES_MODE_CFB); // $aes will operate in cfb mode + * $aes = new Crypt_AES(CRYPT_MODE_CFB); // identical + * + * @see Crypt_Base::Crypt_Base() + * @var String + * @access private + */ + var $const_namespace; + + /** + * The name of the performance-optimized callback function + * + * Used by encrypt() / decrypt() + * only if $engine == CRYPT_MODE_INTERNAL + * + * @see Crypt_Base::encrypt() + * @see Crypt_Base::decrypt() + * @see Crypt_Base::_setupInlineCrypt() + * @see Crypt_Base::$use_inline_crypt + * @var Callback + * @access private + */ + var $inline_crypt; + + /** + * Holds whether performance-optimized $inline_crypt() can/should be used. + * + * @see Crypt_Base::encrypt() + * @see Crypt_Base::decrypt() + * @see Crypt_Base::inline_crypt + * @var mixed + * @access private + */ + var $use_inline_crypt; + + /** + * Default Constructor. + * + * Determines whether or not the mcrypt extension should be used. + * + * $mode could be: + * + * - CRYPT_MODE_ECB + * + * - CRYPT_MODE_CBC + * + * - CRYPT_MODE_CTR + * + * - CRYPT_MODE_CFB + * + * - CRYPT_MODE_OFB + * + * (or the alias constants of the choosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...) + * + * If not explictly set, CRYPT_MODE_CBC will be used. + * + * @param optional Integer $mode + * @access public + */ + function Crypt_Base($mode = CRYPT_MODE_CBC) + { + $const_crypt_mode = 'CRYPT_' . $this->const_namespace . '_MODE'; + + // Determining the availibility of mcrypt support for the cipher + if (!defined($const_crypt_mode)) { + switch (true) { + case extension_loaded('mcrypt') && in_array($this->cipher_name_mcrypt, mcrypt_list_algorithms()): + define($const_crypt_mode, CRYPT_MODE_MCRYPT); + break; + default: + define($const_crypt_mode, CRYPT_MODE_INTERNAL); + } + } + + // Determining which internal $engine should be used. + // The fastes possible first. + switch (true) { + case empty($this->cipher_name_mcrypt): // The cipher module has no mcrypt-engine support at all so we force CRYPT_MODE_INTERNAL + $this->engine = CRYPT_MODE_INTERNAL; + break; + case constant($const_crypt_mode) == CRYPT_MODE_MCRYPT: + $this->engine = CRYPT_MODE_MCRYPT; + break; + default: + $this->engine = CRYPT_MODE_INTERNAL; + } + + // $mode dependent settings + switch ($mode) { + case CRYPT_MODE_ECB: + $this->paddable = true; + $this->mode = $mode; + break; + case CRYPT_MODE_CTR: + case CRYPT_MODE_CFB: + case CRYPT_MODE_OFB: + case CRYPT_MODE_STREAM: + $this->mode = $mode; + break; + case CRYPT_MODE_CBC: + default: + $this->paddable = true; + $this->mode = CRYPT_MODE_CBC; + } + + // Determining whether inline crypting can be used by the cipher + if ($this->use_inline_crypt !== false && function_exists('create_function')) { + $this->use_inline_crypt = true; + } + } + + /** + * Sets the initialization vector. (optional) + * + * SetIV is not required when CRYPT_MODE_ECB (or ie for AES: CRYPT_AES_MODE_ECB) is being used. If not explictly set, it'll be assumed + * to be all zero's. + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @access public + * @param String $iv + */ + function setIV($iv) + { + if ($this->mode == CRYPT_MODE_ECB) { + return; + } + + $this->iv = $iv; + $this->changed = true; + } + + /** + * Sets the key. + * + * The min/max length(s) of the key depends on the cipher which is used. + * If the key not fits the length(s) of the cipher it will paded with null bytes + * up to the closest valid key length. If the key is more than max length, + * we trim the excess bits. + * + * If the key is not explicitly set, it'll be assumed to be all null bytes. + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @access public + * @param String $key + */ + function setKey($key) + { + $this->key = $key; + $this->changed = true; + } + + /** + * Sets the password. + * + * Depending on what $method is set to, setPassword()'s (optional) parameters are as follows: + * {@link http://en.wikipedia.org/wiki/PBKDF2 pbkdf2}: + * $hash, $salt, $count, $dkLen + * + * Where $hash (default = sha1) currently supports the following hashes: see: Crypt/Hash.php + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @see Crypt/Hash.php + * @param String $password + * @param optional String $method + * @access public + */ + function setPassword($password, $method = 'pbkdf2') + { + $key = ''; + + switch ($method) { + default: // 'pbkdf2' + $func_args = func_get_args(); + + // Hash function + $hash = isset($func_args[2]) ? $func_args[2] : 'sha1'; + + // WPA and WPA2 use the SSID as the salt + $salt = isset($func_args[3]) ? $func_args[3] : $this->password_default_salt; + + // RFC2898#section-4.2 uses 1,000 iterations by default + // WPA and WPA2 use 4,096. + $count = isset($func_args[4]) ? $func_args[4] : 1000; + + // Keylength + $dkLen = isset($func_args[5]) ? $func_args[5] : $this->password_key_size; + + // Determining if php[>=5.5.0]'s hash_pbkdf2() function avail- and useable + switch (true) { + case !function_exists('hash_pbkdf2'): + case !function_exists('hash_algos'): + case !in_array($hash, hash_algos()): + if (!class_exists('Crypt_Hash')) { + require_once('Crypt/Hash.php'); + } + $i = 1; + while (strlen($key) < $dkLen) { + $hmac = new Crypt_Hash(); + $hmac->setHash($hash); + $hmac->setKey($password); + $f = $u = $hmac->hash($salt . pack('N', $i++)); + for ($j = 2; $j <= $count; ++$j) { + $u = $hmac->hash($u); + $f^= $u; + } + $key.= $f; + } + $key = substr($key, 0, $dkLen); + break; + default: + $key = hash_pbkdf2($hash, $password, $salt, $count, $dkLen, true); + } + } + + $this->setKey($key); + } + + /** + * Encrypts a message. + * + * $plaintext will be padded with additional bytes such that it's length is a multiple of the block size. Other cipher + * implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's + * necessary are discussed in the following + * URL: + * + * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html} + * + * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. + * strlen($plaintext) will still need to be a multiple of the block size, however, arbitrary values can be added to make it that + * length. + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @see Crypt_Base::decrypt() + * @access public + * @param String $plaintext + * @return String $cipertext + */ + function encrypt($plaintext) + { + if ($this->engine == CRYPT_MODE_MCRYPT) { + if ($this->changed) { + $this->_setupMcrypt(); + $this->changed = false; + } + if ($this->enchanged) { + mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV); + $this->enchanged = false; + } + + // re: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} + // using mcrypt's default handing of CFB the above would output two different things. using phpseclib's + // rewritten CFB implementation the above outputs the same thing twice. + if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) { + $block_size = $this->block_size; + $iv = &$this->encryptIV; + $pos = &$this->enbuffer['pos']; + $len = strlen($plaintext); + $ciphertext = ''; + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len-= $max; + $pos = 0; + } else { + $i = $len; + $pos+= $len; + $len = 0; + } + $ciphertext = substr($iv, $orig_pos) ^ $plaintext; + $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); + $this->enbuffer['enmcrypt_init'] = true; + } + if ($len >= $block_size) { + if ($this->enbuffer['enmcrypt_init'] === false || $len > $this->cfb_init_len) { + if ($this->enbuffer['enmcrypt_init'] === true) { + mcrypt_generic_init($this->enmcrypt, $this->key, $iv); + $this->enbuffer['enmcrypt_init'] = false; + } + $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size)); + $iv = substr($ciphertext, -$block_size); + $len%= $block_size; + } else { + while ($len >= $block_size) { + $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size); + $ciphertext.= $iv; + $len-= $block_size; + $i+= $block_size; + } + } + } + + if ($len) { + $iv = mcrypt_generic($this->ecb, $iv); + $block = $iv ^ substr($plaintext, -$len); + $iv = substr_replace($iv, $block, 0, $len); + $ciphertext.= $block; + $pos = $len; + } + + return $ciphertext; + } + + if ($this->paddable) { + $plaintext = $this->_pad($plaintext); + } + + $ciphertext = mcrypt_generic($this->enmcrypt, $plaintext); + + if (!$this->continuousBuffer) { + mcrypt_generic_init($this->enmcrypt, $this->key, $this->encryptIV); + } + + return $ciphertext; + } + + if ($this->changed) { + $this->_setup(); + $this->changed = false; + } + if ($this->use_inline_crypt) { + $inline = $this->inline_crypt; + return $inline('encrypt', $this, $plaintext); + } + if ($this->paddable) { + $plaintext = $this->_pad($plaintext); + } + + $buffer = &$this->enbuffer; + $block_size = $this->block_size; + $ciphertext = ''; + switch ($this->mode) { + case CRYPT_MODE_ECB: + for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { + $ciphertext.= $this->_encryptBlock(substr($plaintext, $i, $block_size)); + } + break; + case CRYPT_MODE_CBC: + $xor = $this->encryptIV; + for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { + $block = substr($plaintext, $i, $block_size); + $block = $this->_encryptBlock($block ^ $xor); + $xor = $block; + $ciphertext.= $block; + } + if ($this->continuousBuffer) { + $this->encryptIV = $xor; + } + break; + case CRYPT_MODE_CTR: + $xor = $this->encryptIV; + if (strlen($buffer['encrypted'])) { + for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { + $block = substr($plaintext, $i, $block_size); + if (strlen($block) > strlen($buffer['encrypted'])) { + $buffer['encrypted'].= $this->_encryptBlock($this->_generateXor($xor, $block_size)); + } + $key = $this->_stringShift($buffer['encrypted'], $block_size); + $ciphertext.= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { + $block = substr($plaintext, $i, $block_size); + $key = $this->_encryptBlock($this->_generateXor($xor, $block_size)); + $ciphertext.= $block ^ $key; + } + } + if ($this->continuousBuffer) { + $this->encryptIV = $xor; + if ($start = strlen($plaintext) % $block_size) { + $buffer['encrypted'] = substr($key, $start) . $buffer['encrypted']; + } + } + break; + case CRYPT_MODE_CFB: + // cfb loosely routines inspired by openssl's: + // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1} + if ($this->continuousBuffer) { + $iv = &$this->encryptIV; + $pos = &$buffer['pos']; + } else { + $iv = $this->encryptIV; + $pos = 0; + } + $len = strlen($plaintext); + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len-= $max; + $pos = 0; + } else { + $i = $len; + $pos+= $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize + $ciphertext = substr($iv, $orig_pos) ^ $plaintext; + $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); + } + while ($len >= $block_size) { + $iv = $this->_encryptBlock($iv) ^ substr($plaintext, $i, $block_size); + $ciphertext.= $iv; + $len-= $block_size; + $i+= $block_size; + } + if ($len) { + $iv = $this->_encryptBlock($iv); + $block = $iv ^ substr($plaintext, $i); + $iv = substr_replace($iv, $block, 0, $len); + $ciphertext.= $block; + $pos = $len; + } + break; + case CRYPT_MODE_OFB: + $xor = $this->encryptIV; + if (strlen($buffer['xor'])) { + for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { + $block = substr($plaintext, $i, $block_size); + if (strlen($block) > strlen($buffer['xor'])) { + $xor = $this->_encryptBlock($xor); + $buffer['xor'].= $xor; + } + $key = $this->_stringShift($buffer['xor'], $block_size); + $ciphertext.= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { + $xor = $this->_encryptBlock($xor); + $ciphertext.= substr($plaintext, $i, $block_size) ^ $xor; + } + $key = $xor; + } + if ($this->continuousBuffer) { + $this->encryptIV = $xor; + if ($start = strlen($plaintext) % $block_size) { + $buffer['xor'] = substr($key, $start) . $buffer['xor']; + } + } + break; + case CRYPT_MODE_STREAM: + $ciphertext = $this->_encryptBlock($plaintext); + break; + } + + return $ciphertext; + } + + /** + * Decrypts a message. + * + * If strlen($ciphertext) is not a multiple of the block size, null bytes will be added to the end of the string until + * it is. + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @see Crypt_Base::encrypt() + * @access public + * @param String $ciphertext + * @return String $plaintext + */ + function decrypt($ciphertext) + { + if ($this->engine == CRYPT_MODE_MCRYPT) { + $block_size = $this->block_size; + if ($this->changed) { + $this->_setupMcrypt(); + $this->changed = false; + } + if ($this->dechanged) { + mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV); + $this->dechanged = false; + } + + if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) { + $iv = &$this->decryptIV; + $pos = &$this->debuffer['pos']; + $len = strlen($ciphertext); + $plaintext = ''; + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len-= $max; + $pos = 0; + } else { + $i = $len; + $pos+= $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize + $plaintext = substr($iv, $orig_pos) ^ $ciphertext; + $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); + } + if ($len >= $block_size) { + $cb = substr($ciphertext, $i, $len - $len % $block_size); + $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb; + $iv = substr($cb, -$block_size); + $len%= $block_size; + } + if ($len) { + $iv = mcrypt_generic($this->ecb, $iv); + $plaintext.= $iv ^ substr($ciphertext, -$len); + $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len); + $pos = $len; + } + + return $plaintext; + } + + if ($this->paddable) { + // we pad with chr(0) since that's what mcrypt_generic does. to quote from {@link http://www.php.net/function.mcrypt-generic}: + // "The data is padded with "\0" to make sure the length of the data is n * blocksize." + $ciphertext = str_pad($ciphertext, strlen($ciphertext) + ($block_size - strlen($ciphertext) % $block_size) % $block_size, chr(0)); + } + + $plaintext = mdecrypt_generic($this->demcrypt, $ciphertext); + + if (!$this->continuousBuffer) { + mcrypt_generic_init($this->demcrypt, $this->key, $this->decryptIV); + } + + return $this->paddable ? $this->_unpad($plaintext) : $plaintext; + } + + if ($this->changed) { + $this->_setup(); + $this->changed = false; + } + if ($this->use_inline_crypt) { + $inline = $this->inline_crypt; + return $inline('decrypt', $this, $ciphertext); + } + + $block_size = $this->block_size; + if ($this->paddable) { + // we pad with chr(0) since that's what mcrypt_generic does [...] + $ciphertext = str_pad($ciphertext, strlen($ciphertext) + ($block_size - strlen($ciphertext) % $block_size) % $block_size, chr(0)); + } + + $buffer = &$this->debuffer; + $plaintext = ''; + switch ($this->mode) { + case CRYPT_MODE_ECB: + for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { + $plaintext.= $this->_decryptBlock(substr($ciphertext, $i, $block_size)); + } + break; + case CRYPT_MODE_CBC: + $xor = $this->decryptIV; + for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { + $block = substr($ciphertext, $i, $block_size); + $plaintext.= $this->_decryptBlock($block) ^ $xor; + $xor = $block; + } + if ($this->continuousBuffer) { + $this->decryptIV = $xor; + } + break; + case CRYPT_MODE_CTR: + $xor = $this->decryptIV; + if (strlen($buffer['ciphertext'])) { + for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { + $block = substr($ciphertext, $i, $block_size); + if (strlen($block) > strlen($buffer['ciphertext'])) { + $buffer['ciphertext'].= $this->_encryptBlock($this->_generateXor($xor, $block_size)); + } + $key = $this->_stringShift($buffer['ciphertext'], $block_size); + $plaintext.= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { + $block = substr($ciphertext, $i, $block_size); + $key = $this->_encryptBlock($this->_generateXor($xor, $block_size)); + $plaintext.= $block ^ $key; + } + } + if ($this->continuousBuffer) { + $this->decryptIV = $xor; + if ($start = strlen($ciphertext) % $block_size) { + $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; + } + } + break; + case CRYPT_MODE_CFB: + if ($this->continuousBuffer) { + $iv = &$this->decryptIV; + $pos = &$buffer['pos']; + } else { + $iv = $this->decryptIV; + $pos = 0; + } + $len = strlen($ciphertext); + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len-= $max; + $pos = 0; + } else { + $i = $len; + $pos+= $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize + $plaintext = substr($iv, $orig_pos) ^ $ciphertext; + $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); + } + while ($len >= $block_size) { + $iv = $this->_encryptBlock($iv); + $cb = substr($ciphertext, $i, $block_size); + $plaintext.= $iv ^ $cb; + $iv = $cb; + $len-= $block_size; + $i+= $block_size; + } + if ($len) { + $iv = $this->_encryptBlock($iv); + $plaintext.= $iv ^ substr($ciphertext, $i); + $iv = substr_replace($iv, substr($ciphertext, $i), 0, $len); + $pos = $len; + } + break; + case CRYPT_MODE_OFB: + $xor = $this->decryptIV; + if (strlen($buffer['xor'])) { + for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { + $block = substr($ciphertext, $i, $block_size); + if (strlen($block) > strlen($buffer['xor'])) { + $xor = $this->_encryptBlock($xor); + $buffer['xor'].= $xor; + } + $key = $this->_stringShift($buffer['xor'], $block_size); + $plaintext.= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { + $xor = $this->_encryptBlock($xor); + $plaintext.= substr($ciphertext, $i, $block_size) ^ $xor; + } + $key = $xor; + } + if ($this->continuousBuffer) { + $this->decryptIV = $xor; + if ($start = strlen($ciphertext) % $block_size) { + $buffer['xor'] = substr($key, $start) . $buffer['xor']; + } + } + break; + case CRYPT_MODE_STREAM: + $plaintext = $this->_decryptBlock($ciphertext); + break; + } + return $this->paddable ? $this->_unpad($plaintext) : $plaintext; + } + + /** + * Pad "packets". + * + * Block ciphers working by encrypting between their specified [$this->]block_size at a time + * If you ever need to encrypt or decrypt something that isn't of the proper length, it becomes necessary to + * pad the input so that it is of the proper length. + * + * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH, + * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping + * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is + * transmitted separately) + * + * @see Crypt_Base::disablePadding() + * @access public + */ + function enablePadding() + { + $this->padding = true; + } + + /** + * Do not pad packets. + * + * @see Crypt_Base::enablePadding() + * @access public + */ + function disablePadding() + { + $this->padding = false; + } + + /** + * Treat consecutive "packets" as if they are a continuous buffer. + * + * Say you have a 32-byte plaintext $plaintext. Using the default behavior, the two following code snippets + * will yield different outputs: + * + * <code> + * echo $rijndael->encrypt(substr($plaintext, 0, 16)); + * echo $rijndael->encrypt(substr($plaintext, 16, 16)); + * </code> + * <code> + * echo $rijndael->encrypt($plaintext); + * </code> + * + * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates + * another, as demonstrated with the following: + * + * <code> + * $rijndael->encrypt(substr($plaintext, 0, 16)); + * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16))); + * </code> + * <code> + * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16))); + * </code> + * + * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different + * outputs. The reason is due to the fact that the initialization vector's change after every encryption / + * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. + * + * Put another way, when the continuous buffer is enabled, the state of the Crypt_*() object changes after each + * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that + * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), + * however, they are also less intuitive and more likely to cause you problems. + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @see Crypt_Base::disableContinuousBuffer() + * @access public + */ + function enableContinuousBuffer() + { + if ($this->mode == CRYPT_MODE_ECB) { + return; + } + + $this->continuousBuffer = true; + } + + /** + * Treat consecutive packets as if they are a discontinuous buffer. + * + * The default behavior. + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @see Crypt_Base::enableContinuousBuffer() + * @access public + */ + function disableContinuousBuffer() + { + if ($this->mode == CRYPT_MODE_ECB) { + return; + } + if (!$this->continuousBuffer) { + return; + } + + $this->continuousBuffer = false; + $this->changed = true; + } + + /** + * Encrypts a block + * + * Note: Must extend by the child Crypt_* class + * + * @access private + * @param String $in + * @return String + */ + function _encryptBlock($in) + { + user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR); + } + + /** + * Decrypts a block + * + * Note: Must extend by the child Crypt_* class + * + * @access private + * @param String $in + * @return String + */ + function _decryptBlock($in) + { + user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR); + } + + /** + * Setup the key (expansion) + * + * Only used if $engine == CRYPT_MODE_INTERNAL + * + * Note: Must extend by the child Crypt_* class + * + * @see Crypt_Base::_setup() + * @access private + */ + function _setupKey() + { + user_error((version_compare(PHP_VERSION, '5.0.0', '>=') ? __METHOD__ : __FUNCTION__) . '() must extend by class ' . get_class($this), E_USER_ERROR); + } + + /** + * Setup the CRYPT_MODE_INTERNAL $engine + * + * (re)init, if necessary, the internal cipher $engine and flush all $buffers + * Used (only) if $engine == CRYPT_MODE_INTERNAL + * + * _setup() will be called each time if $changed === true + * typically this happens when using one or more of following public methods: + * + * - setKey() + * + * - setIV() + * + * - disableContinuousBuffer() + * + * - First run of encrypt() / decrypt() with no init-settings + * + * Internally: _setup() is called always before(!) en/decryption. + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @see setKey() + * @see setIV() + * @see disableContinuousBuffer() + * @access private + */ + function _setup() + { + $this->_clearBuffers(); + $this->_setupKey(); + + if ($this->use_inline_crypt) { + $this->_setupInlineCrypt(); + } + } + + /** + * Setup the CRYPT_MODE_MCRYPT $engine + * + * (re)init, if necessary, the (ext)mcrypt resources and flush all $buffers + * Used (only) if $engine = CRYPT_MODE_MCRYPT + * + * _setupMcrypt() will be called each time if $changed === true + * typically this happens when using one or more of following public methods: + * + * - setKey() + * + * - setIV() + * + * - disableContinuousBuffer() + * + * - First run of encrypt() / decrypt() + * + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @see setKey() + * @see setIV() + * @see disableContinuousBuffer() + * @access private + */ + function _setupMcrypt() + { + $this->_clearBuffers(); + $this->enchanged = $this->dechanged = true; + + if (!isset($this->enmcrypt)) { + static $mcrypt_modes = array( + CRYPT_MODE_CTR => 'ctr', + CRYPT_MODE_ECB => MCRYPT_MODE_ECB, + CRYPT_MODE_CBC => MCRYPT_MODE_CBC, + CRYPT_MODE_CFB => 'ncfb', + CRYPT_MODE_OFB => MCRYPT_MODE_NOFB, + CRYPT_MODE_STREAM => MCRYPT_MODE_STREAM, + ); + + $this->demcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); + $this->enmcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); + + // we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer() + // to workaround mcrypt's broken ncfb implementation in buffered mode + // see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} + if ($this->mode == CRYPT_MODE_CFB) { + $this->ecb = mcrypt_module_open($this->cipher_name_mcrypt, '', MCRYPT_MODE_ECB, ''); + } + + } // else should mcrypt_generic_deinit be called? + + if ($this->mode == CRYPT_MODE_CFB) { + mcrypt_generic_init($this->ecb, $this->key, str_repeat("\0", $this->block_size)); + } + } + + /** + * Pads a string + * + * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize. + * $this->block_size - (strlen($text) % $this->block_size) bytes are added, each of which is equal to + * chr($this->block_size - (strlen($text) % $this->block_size) + * + * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless + * and padding will, hence forth, be enabled. + * + * @see Crypt_Base::_unpad() + * @param String $text + * @access private + * @return String + */ + function _pad($text) + { + $length = strlen($text); + + if (!$this->padding) { + if ($length % $this->block_size == 0) { + return $text; + } else { + user_error("The plaintext's length ($length) is not a multiple of the block size ({$this->block_size})"); + $this->padding = true; + } + } + + $pad = $this->block_size - ($length % $this->block_size); + + return str_pad($text, $length + $pad, chr($pad)); + } + + /** + * Unpads a string. + * + * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong + * and false will be returned. + * + * @see Crypt_Base::_pad() + * @param String $text + * @access private + * @return String + */ + function _unpad($text) + { + if (!$this->padding) { + return $text; + } + + $length = ord($text[strlen($text) - 1]); + + if (!$length || $length > $this->block_size) { + return false; + } + + return substr($text, 0, -$length); + } + + /** + * Clears internal buffers + * + * Clearing/resetting the internal buffers is done everytime + * after disableContinuousBuffer() or on cipher $engine (re)init + * ie after setKey() or setIV() + * + * Note: Could, but not must, extend by the child Crypt_* class + * + * @access public + */ + function _clearBuffers() + { + $this->enbuffer = array('encrypted' => '', 'xor' => '', 'pos' => 0, 'enmcrypt_init' => true); + $this->debuffer = array('ciphertext' => '', 'xor' => '', 'pos' => 0, 'demcrypt_init' => true); + + // mcrypt's handling of invalid's $iv: + // $this->encryptIV = $this->decryptIV = strlen($this->iv) == $this->block_size ? $this->iv : str_repeat("\0", $this->block_size); + $this->encryptIV = $this->decryptIV = str_pad(substr($this->iv, 0, $this->block_size), $this->block_size, "\0"); + } + + /** + * String Shift + * + * Inspired by array_shift + * + * @param String $string + * @param optional Integer $index + * @access private + * @return String + */ + function _stringShift(&$string, $index = 1) + { + $substr = substr($string, 0, $index); + $string = substr($string, $index); + return $substr; + } + + /** + * Generate CTR XOR encryption key + * + * Encrypt the output of this and XOR it against the ciphertext / plaintext to get the + * plaintext / ciphertext in CTR mode. + * + * @see Crypt_Base::decrypt() + * @see Crypt_Base::encrypt() + * @param String $iv + * @param Integer $length + * @access private + * @return String $xor + */ + function _generateXor(&$iv, $length) + { + $xor = ''; + $block_size = $this->block_size; + $num_blocks = floor(($length + ($block_size - 1)) / $block_size); + for ($i = 0; $i < $num_blocks; $i++) { + $xor.= $iv; + for ($j = 4; $j <= $block_size; $j+= 4) { + $temp = substr($iv, -$j, 4); + switch ($temp) { + case "\xFF\xFF\xFF\xFF": + $iv = substr_replace($iv, "\x00\x00\x00\x00", -$j, 4); + break; + case "\x7F\xFF\xFF\xFF": + $iv = substr_replace($iv, "\x80\x00\x00\x00", -$j, 4); + break 2; + default: + extract(unpack('Ncount', $temp)); + $iv = substr_replace($iv, pack('N', $count + 1), -$j, 4); + break 2; + } + } + } + + return $xor; + } + + /** + * Setup the performance-optimized function for de/encrypt() + * + * Stores the created (or existing) callback function-name + * in $this->inline_crypt + * + * Internally for phpseclib developers: + * + * _setupInlineCrypt() would be called only if: + * + * - $engine == CRYPT_MODE_INTERNAL and + * + * - $use_inline_crypt === true + * + * - each time on _setup(), after(!) _setupKey() + * + * + * This ensures that _setupInlineCrypt() has allways a + * full ready2go initializated internal cipher $engine state + * where, for example, the keys allready expanded, + * keys/block_size calculated and such. + * + * It is, each time if called, the responsibility of _setupInlineCrypt(): + * + * - to set $this->inline_crypt to a valid and fully working callback function + * as a (faster) replacement for encrypt() / decrypt() + * + * - NOT to create unlimited callback functions (for memory reasons!) + * no matter how often _setupInlineCrypt() would be called. At some + * point of amount they must be generic re-useable. + * + * - the code of _setupInlineCrypt() it self, + * and the generated callback code, + * must be, in following order: + * - 100% safe + * - 100% compatible to encrypt()/decrypt() + * - using only php5+ features/lang-constructs/php-extensions if + * compatibility (down to php4) or fallback is provided + * - readable/maintainable/understandable/commented and... not-cryptic-styled-code :-) + * - >= 10% faster than encrypt()/decrypt() [which is, by the way, + * the reason for the existence of _setupInlineCrypt() :-)] + * - memory-nice + * - short (as good as possible) + * + * Note: - _setupInlineCrypt() is using _createInlineCryptFunction() to create the full callback function code. + * - In case of using inline crypting, _setupInlineCrypt() must extend by the child Crypt_* class. + * - The following variable names are reserved: + * - $_* (all variable names prefixed with an underscore) + * - $self (object reference to it self. Do not use $this, but $self instead) + * - $in (the content of $in has to en/decrypt by the generated code) + * - The callback function should not use the 'return' statement, but en/decrypt'ing the content of $in only + * + * + * @see Crypt_Base::_setup() + * @see Crypt_Base::_createInlineCryptFunction() + * @see Crypt_Base::encrypt() + * @see Crypt_Base::decrypt() + * @access private + */ + function _setupInlineCrypt() + { + // If a Crypt_* class providing inline crypting it must extend _setupInlineCrypt() + + // If, for any reason, an extending Crypt_Base() Crypt_* class + // not using inline crypting then it must be ensured that: $this->use_inline_crypt = false + // ie in the class var declaration of $use_inline_crypt in general for the Crypt_* class, + // in the constructor at object instance-time + // or, if it's runtime-specific, at runtime + + $this->use_inline_crypt = false; + } + + /** + * Creates the performance-optimized function for en/decrypt() + * + * Internally for phpseclib developers: + * + * _createInlineCryptFunction(): + * + * - merge the $cipher_code [setup'ed by _setupInlineCrypt()] + * with the current [$this->]mode of operation code + * + * - create the $inline function, which called by encrypt() / decrypt() + * as its replacement to speed up the en/decryption operations. + * + * - return the name of the created $inline callback function + * + * - used to speed up en/decryption + * + * + * + * The main reason why can speed up things [up to 50%] this way are: + * + * - using variables more effective then regular. + * (ie no use of expensive arrays but integers $k_0, $k_1 ... + * or even, for example, the pure $key[] values hardcoded) + * + * - avoiding 1000's of function calls of ie _encryptBlock() + * but inlining the crypt operations. + * in the mode of operation for() loop. + * + * - full loop unroll the (sometimes key-dependent) rounds + * avoiding this way ++$i counters and runtime-if's etc... + * + * The basic code architectur of the generated $inline en/decrypt() + * lambda function, in pseudo php, is: + * + * <code> + * +----------------------------------------------------------------------------------------------+ + * | callback $inline = create_function: | + * | lambda_function_0001_crypt_ECB($action, $text) | + * | { | + * | INSERT PHP CODE OF: | + * | $cipher_code['init_crypt']; // general init code. | + * | // ie: $sbox'es declarations used for | + * | // encrypt and decrypt'ing. | + * | | + * | switch ($action) { | + * | case 'encrypt': | + * | INSERT PHP CODE OF: | + * | $cipher_code['init_encrypt']; // encrypt sepcific init code. | + * | ie: specified $key or $box | + * | declarations for encrypt'ing. | + * | | + * | foreach ($ciphertext) { | + * | $in = $block_size of $ciphertext; | + * | | + * | INSERT PHP CODE OF: | + * | $cipher_code['encrypt_block']; // encrypt's (string) $in, which is always: | + * | // strlen($in) == $this->block_size | + * | // here comes the cipher algorithm in action | + * | // for encryption. | + * | // $cipher_code['encrypt_block'] has to | + * | // encrypt the content of the $in variable | + * | | + * | $plaintext .= $in; | + * | } | + * | return $plaintext; | + * | | + * | case 'decrypt': | + * | INSERT PHP CODE OF: | + * | $cipher_code['init_decrypt']; // decrypt sepcific init code | + * | ie: specified $key or $box | + * | declarations for decrypt'ing. | + * | foreach ($plaintext) { | + * | $in = $block_size of $plaintext; | + * | | + * | INSERT PHP CODE OF: | + * | $cipher_code['decrypt_block']; // decrypt's (string) $in, which is always | + * | // strlen($in) == $this->block_size | + * | // here comes the cipher algorithm in action | + * | // for decryption. | + * | // $cipher_code['decrypt_block'] has to | + * | // decrypt the content of the $in variable | + * | $ciphertext .= $in; | + * | } | + * | return $ciphertext; | + * | } | + * | } | + * +----------------------------------------------------------------------------------------------+ + * </code> + * + * See also the Crypt_*::_setupInlineCrypt()'s for + * productive inline $cipher_code's how they works. + * + * Structure of: + * <code> + * $cipher_code = array( + * 'init_crypt' => (string) '', // optional + * 'init_encrypt' => (string) '', // optional + * 'init_decrypt' => (string) '', // optional + * 'encrypt_block' => (string) '', // required + * 'decrypt_block' => (string) '' // required + * ); + * </code> + * + * @see Crypt_Base::_setupInlineCrypt() + * @see Crypt_Base::encrypt() + * @see Crypt_Base::decrypt() + * @param Array $cipher_code + * @access private + * @return String (the name of the created callback function) + */ + function _createInlineCryptFunction($cipher_code) + { + $block_size = $this->block_size; + + // optional + $init_crypt = isset($cipher_code['init_crypt']) ? $cipher_code['init_crypt'] : ''; + $init_encrypt = isset($cipher_code['init_encrypt']) ? $cipher_code['init_encrypt'] : ''; + $init_decrypt = isset($cipher_code['init_decrypt']) ? $cipher_code['init_decrypt'] : ''; + // required + $encrypt_block = $cipher_code['encrypt_block']; + $decrypt_block = $cipher_code['decrypt_block']; + + // Generating mode of operation inline code, + // merged with the $cipher_code algorithm + // for encrypt- and decryption. + switch ($this->mode) { + case CRYPT_MODE_ECB: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_text = $self->_pad($_text); + $_plaintext_len = strlen($_text); + + for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { + $in = substr($_text, $_i, '.$block_size.'); + '.$encrypt_block.' + $_ciphertext.= $in; + } + + return $_ciphertext; + '; + + $decrypt = $init_decrypt . ' + $_plaintext = ""; + $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0)); + $_ciphertext_len = strlen($_text); + + for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { + $in = substr($_text, $_i, '.$block_size.'); + '.$decrypt_block.' + $_plaintext.= $in; + } + + return $self->_unpad($_plaintext); + '; + break; + case CRYPT_MODE_CTR: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_plaintext_len = strlen($_text); + $_xor = $self->encryptIV; + $_buffer = &$self->enbuffer; + + if (strlen($_buffer["encrypted"])) { + for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { + $_block = substr($_text, $_i, '.$block_size.'); + if (strlen($_block) > strlen($_buffer["encrypted"])) { + $in = $self->_generateXor($_xor, '.$block_size.'); + '.$encrypt_block.' + $_buffer["encrypted"].= $in; + } + $_key = $self->_stringShift($_buffer["encrypted"], '.$block_size.'); + $_ciphertext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { + $_block = substr($_text, $_i, '.$block_size.'); + $in = $self->_generateXor($_xor, '.$block_size.'); + '.$encrypt_block.' + $_key = $in; + $_ciphertext.= $_block ^ $_key; + } + } + if ($self->continuousBuffer) { + $self->encryptIV = $_xor; + if ($_start = $_plaintext_len % '.$block_size.') { + $_buffer["encrypted"] = substr($_key, $_start) . $_buffer["encrypted"]; + } + } + + return $_ciphertext; + '; + + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_ciphertext_len = strlen($_text); + $_xor = $self->decryptIV; + $_buffer = &$self->debuffer; + + if (strlen($_buffer["ciphertext"])) { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { + $_block = substr($_text, $_i, '.$block_size.'); + if (strlen($_block) > strlen($_buffer["ciphertext"])) { + $in = $self->_generateXor($_xor, '.$block_size.'); + '.$encrypt_block.' + $_buffer["ciphertext"].= $in; + } + $_key = $self->_stringShift($_buffer["ciphertext"], '.$block_size.'); + $_plaintext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { + $_block = substr($_text, $_i, '.$block_size.'); + $in = $self->_generateXor($_xor, '.$block_size.'); + '.$encrypt_block.' + $_key = $in; + $_plaintext.= $_block ^ $_key; + } + } + if ($self->continuousBuffer) { + $self->decryptIV = $_xor; + if ($_start = $_ciphertext_len % '.$block_size.') { + $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"]; + } + } + + return $_plaintext; + '; + break; + case CRYPT_MODE_CFB: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_buffer = &$self->enbuffer; + + if ($self->continuousBuffer) { + $_iv = &$self->encryptIV; + $_pos = &$_buffer["pos"]; + } else { + $_iv = $self->encryptIV; + $_pos = 0; + } + $_len = strlen($_text); + $_i = 0; + if ($_pos) { + $_orig_pos = $_pos; + $_max = '.$block_size.' - $_pos; + if ($_len >= $_max) { + $_i = $_max; + $_len-= $_max; + $_pos = 0; + } else { + $_i = $_len; + $_pos+= $_len; + $_len = 0; + } + $_ciphertext = substr($_iv, $_orig_pos) ^ $_text; + $_iv = substr_replace($_iv, $_ciphertext, $_orig_pos, $_i); + } + while ($_len >= '.$block_size.') { + $in = $_iv; + '.$encrypt_block.'; + $_iv = $in ^ substr($_text, $_i, '.$block_size.'); + $_ciphertext.= $_iv; + $_len-= '.$block_size.'; + $_i+= '.$block_size.'; + } + if ($_len) { + $in = $_iv; + '.$encrypt_block.' + $_iv = $in; + $_block = $_iv ^ substr($_text, $_i); + $_iv = substr_replace($_iv, $_block, 0, $_len); + $_ciphertext.= $_block; + $_pos = $_len; + } + return $_ciphertext; + '; + + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_buffer = &$self->debuffer; + + if ($self->continuousBuffer) { + $_iv = &$self->decryptIV; + $_pos = &$_buffer["pos"]; + } else { + $_iv = $self->decryptIV; + $_pos = 0; + } + $_len = strlen($_text); + $_i = 0; + if ($_pos) { + $_orig_pos = $_pos; + $_max = '.$block_size.' - $_pos; + if ($_len >= $_max) { + $_i = $_max; + $_len-= $_max; + $_pos = 0; + } else { + $_i = $_len; + $_pos+= $_len; + $_len = 0; + } + $_plaintext = substr($_iv, $_orig_pos) ^ $_text; + $_iv = substr_replace($_iv, substr($_text, 0, $_i), $_orig_pos, $_i); + } + while ($_len >= '.$block_size.') { + $in = $_iv; + '.$encrypt_block.' + $_iv = $in; + $cb = substr($_text, $_i, '.$block_size.'); + $_plaintext.= $_iv ^ $cb; + $_iv = $cb; + $_len-= '.$block_size.'; + $_i+= '.$block_size.'; + } + if ($_len) { + $in = $_iv; + '.$encrypt_block.' + $_iv = $in; + $_plaintext.= $_iv ^ substr($_text, $_i); + $_iv = substr_replace($_iv, substr($_text, $_i), 0, $_len); + $_pos = $_len; + } + + return $_plaintext; + '; + break; + case CRYPT_MODE_OFB: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_plaintext_len = strlen($_text); + $_xor = $self->encryptIV; + $_buffer = &$self->enbuffer; + + if (strlen($_buffer["xor"])) { + for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { + $_block = substr($_text, $_i, '.$block_size.'); + if (strlen($_block) > strlen($_buffer["xor"])) { + $in = $_xor; + '.$encrypt_block.' + $_xor = $in; + $_buffer["xor"].= $_xor; + } + $_key = $self->_stringShift($_buffer["xor"], '.$block_size.'); + $_ciphertext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { + $in = $_xor; + '.$encrypt_block.' + $_xor = $in; + $_ciphertext.= substr($_text, $_i, '.$block_size.') ^ $_xor; + } + $_key = $_xor; + } + if ($self->continuousBuffer) { + $self->encryptIV = $_xor; + if ($_start = $_plaintext_len % '.$block_size.') { + $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"]; + } + } + return $_ciphertext; + '; + + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_ciphertext_len = strlen($_text); + $_xor = $self->decryptIV; + $_buffer = &$self->debuffer; + + if (strlen($_buffer["xor"])) { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { + $_block = substr($_text, $_i, '.$block_size.'); + if (strlen($_block) > strlen($_buffer["xor"])) { + $in = $_xor; + '.$encrypt_block.' + $_xor = $in; + $_buffer["xor"].= $_xor; + } + $_key = $self->_stringShift($_buffer["xor"], '.$block_size.'); + $_plaintext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { + $in = $_xor; + '.$encrypt_block.' + $_xor = $in; + $_plaintext.= substr($_text, $_i, '.$block_size.') ^ $_xor; + } + $_key = $_xor; + } + if ($self->continuousBuffer) { + $self->decryptIV = $_xor; + if ($_start = $_ciphertext_len % '.$block_size.') { + $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"]; + } + } + return $_plaintext; + '; + break; + case CRYPT_MODE_STREAM: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + '.$encrypt_block.' + return $_ciphertext; + '; + $decrypt = $init_decrypt . ' + $_plaintext = ""; + '.$decrypt_block.' + return $_plaintext; + '; + break; + // case CRYPT_MODE_CBC: + default: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_text = $self->_pad($_text); + $_plaintext_len = strlen($_text); + + $in = $self->encryptIV; + + for ($_i = 0; $_i < $_plaintext_len; $_i+= '.$block_size.') { + $in = substr($_text, $_i, '.$block_size.') ^ $in; + '.$encrypt_block.' + $_ciphertext.= $in; + } + + if ($self->continuousBuffer) { + $self->encryptIV = $in; + } + + return $_ciphertext; + '; + + $decrypt = $init_decrypt . ' + $_plaintext = ""; + $_text = str_pad($_text, strlen($_text) + ('.$block_size.' - strlen($_text) % '.$block_size.') % '.$block_size.', chr(0)); + $_ciphertext_len = strlen($_text); + + $_iv = $self->decryptIV; + + for ($_i = 0; $_i < $_ciphertext_len; $_i+= '.$block_size.') { + $in = $_block = substr($_text, $_i, '.$block_size.'); + '.$decrypt_block.' + $_plaintext.= $in ^ $_iv; + $_iv = $_block; + } + + if ($self->continuousBuffer) { + $self->decryptIV = $_iv; + } + + return $self->_unpad($_plaintext); + '; + break; + } + + // Create the $inline function and return its name as string. Ready to run! + return create_function('$_action, &$self, $_text', $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }'); + } + + /** + * Holds the lambda_functions table (classwide) + * + * Each name of the lambda function, created from + * _setupInlineCrypt() && _createInlineCryptFunction() + * is stored, classwide (!), here for reusing. + * + * The string-based index of $function is a classwide + * uniqe value representing, at least, the $mode of + * operation (or more... depends of the optimizing level) + * for which $mode the lambda function was created. + * + * @access private + * @return &Array + */ + function &_getLambdaFunctions() + { + static $functions = array(); + return $functions; + } +} + +// vim: ts=4:sw=4:et: +// vim6: fdl=1: diff --git a/inc/phpseclib/Crypt_Hash.php b/inc/phpseclib/Crypt_Hash.php new file mode 100644 index 000000000..840fcd508 --- /dev/null +++ b/inc/phpseclib/Crypt_Hash.php @@ -0,0 +1,823 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions. + * + * Uses hash() or mhash() if available and an internal implementation, otherwise. Currently supports the following: + * + * md2, md5, md5-96, sha1, sha1-96, sha256, sha384, and sha512 + * + * If {@link Crypt_Hash::setKey() setKey()} is called, {@link Crypt_Hash::hash() hash()} will return the HMAC as opposed to + * the hash. If no valid algorithm is provided, sha1 will be used. + * + * PHP versions 4 and 5 + * + * {@internal The variable names are the same as those in + * {@link http://tools.ietf.org/html/rfc2104#section-2 RFC2104}.}} + * + * Here's a short example of how to use this library: + * <code> + * <?php + * include('Crypt/Hash.php'); + * + * $hash = new Crypt_Hash('sha1'); + * + * $hash->setKey('abcdefg'); + * + * echo base64_encode($hash->hash('abcdefg')); + * ?> + * </code> + * + * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @category Crypt + * @package Crypt_Hash + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ + +/**#@+ + * @access private + * @see Crypt_Hash::Crypt_Hash() + */ +/** + * Toggles the internal implementation + */ +define('CRYPT_HASH_MODE_INTERNAL', 1); +/** + * Toggles the mhash() implementation, which has been deprecated on PHP 5.3.0+. + */ +define('CRYPT_HASH_MODE_MHASH', 2); +/** + * Toggles the hash() implementation, which works on PHP 5.1.2+. + */ +define('CRYPT_HASH_MODE_HASH', 3); +/**#@-*/ + +/** + * Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions. + * + * @author Jim Wigginton <terrafrost@php.net> + * @version 0.1.0 + * @access public + * @package Crypt_Hash + */ +class Crypt_Hash { + /** + * Byte-length of compression blocks / key (Internal HMAC) + * + * @see Crypt_Hash::setAlgorithm() + * @var Integer + * @access private + */ + var $b; + + /** + * Byte-length of hash output (Internal HMAC) + * + * @see Crypt_Hash::setHash() + * @var Integer + * @access private + */ + var $l = false; + + /** + * Hash Algorithm + * + * @see Crypt_Hash::setHash() + * @var String + * @access private + */ + var $hash; + + /** + * Key + * + * @see Crypt_Hash::setKey() + * @var String + * @access private + */ + var $key = false; + + /** + * Outer XOR (Internal HMAC) + * + * @see Crypt_Hash::setKey() + * @var String + * @access private + */ + var $opad; + + /** + * Inner XOR (Internal HMAC) + * + * @see Crypt_Hash::setKey() + * @var String + * @access private + */ + var $ipad; + + /** + * Default Constructor. + * + * @param optional String $hash + * @return Crypt_Hash + * @access public + */ + function Crypt_Hash($hash = 'sha1') + { + if ( !defined('CRYPT_HASH_MODE') ) { + switch (true) { + case extension_loaded('hash'): + define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH); + break; + case extension_loaded('mhash'): + define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_MHASH); + break; + default: + define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_INTERNAL); + } + } + + $this->setHash($hash); + } + + /** + * Sets the key for HMACs + * + * Keys can be of any length. + * + * @access public + * @param optional String $key + */ + function setKey($key = false) + { + $this->key = $key; + } + + /** + * Sets the hash function. + * + * @access public + * @param String $hash + */ + function setHash($hash) + { + $hash = strtolower($hash); + switch ($hash) { + case 'md5-96': + case 'sha1-96': + $this->l = 12; // 96 / 8 = 12 + break; + case 'md2': + case 'md5': + $this->l = 16; + break; + case 'sha1': + $this->l = 20; + break; + case 'sha256': + $this->l = 32; + break; + case 'sha384': + $this->l = 48; + break; + case 'sha512': + $this->l = 64; + } + + switch ($hash) { + case 'md2': + $mode = CRYPT_HASH_MODE == CRYPT_HASH_MODE_HASH && in_array('md2', hash_algos()) ? + CRYPT_HASH_MODE_HASH : CRYPT_HASH_MODE_INTERNAL; + break; + case 'sha384': + case 'sha512': + $mode = CRYPT_HASH_MODE == CRYPT_HASH_MODE_MHASH ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE; + break; + default: + $mode = CRYPT_HASH_MODE; + } + + switch ( $mode ) { + case CRYPT_HASH_MODE_MHASH: + switch ($hash) { + case 'md5': + case 'md5-96': + $this->hash = MHASH_MD5; + break; + case 'sha256': + $this->hash = MHASH_SHA256; + break; + case 'sha1': + case 'sha1-96': + default: + $this->hash = MHASH_SHA1; + } + return; + case CRYPT_HASH_MODE_HASH: + switch ($hash) { + case 'md5': + case 'md5-96': + $this->hash = 'md5'; + return; + case 'md2': + case 'sha256': + case 'sha384': + case 'sha512': + $this->hash = $hash; + return; + case 'sha1': + case 'sha1-96': + default: + $this->hash = 'sha1'; + } + return; + } + + switch ($hash) { + case 'md2': + $this->b = 16; + $this->hash = array($this, '_md2'); + break; + case 'md5': + case 'md5-96': + $this->b = 64; + $this->hash = array($this, '_md5'); + break; + case 'sha256': + $this->b = 64; + $this->hash = array($this, '_sha256'); + break; + case 'sha384': + case 'sha512': + $this->b = 128; + $this->hash = array($this, '_sha512'); + break; + case 'sha1': + case 'sha1-96': + default: + $this->b = 64; + $this->hash = array($this, '_sha1'); + } + + $this->ipad = str_repeat(chr(0x36), $this->b); + $this->opad = str_repeat(chr(0x5C), $this->b); + } + + /** + * Compute the HMAC. + * + * @access public + * @param String $text + * @return String + */ + function hash($text) + { + $mode = is_array($this->hash) ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE; + + if (!empty($this->key) || is_string($this->key)) { + switch ( $mode ) { + case CRYPT_HASH_MODE_MHASH: + $output = mhash($this->hash, $text, $this->key); + break; + case CRYPT_HASH_MODE_HASH: + $output = hash_hmac($this->hash, $text, $this->key, true); + break; + case CRYPT_HASH_MODE_INTERNAL: + /* "Applications that use keys longer than B bytes will first hash the key using H and then use the + resultant L byte string as the actual key to HMAC." + + -- http://tools.ietf.org/html/rfc2104#section-2 */ + $key = strlen($this->key) > $this->b ? call_user_func($this->hash, $this->key) : $this->key; + + $key = str_pad($key, $this->b, chr(0)); // step 1 + $temp = $this->ipad ^ $key; // step 2 + $temp .= $text; // step 3 + $temp = call_user_func($this->hash, $temp); // step 4 + $output = $this->opad ^ $key; // step 5 + $output.= $temp; // step 6 + $output = call_user_func($this->hash, $output); // step 7 + } + } else { + switch ( $mode ) { + case CRYPT_HASH_MODE_MHASH: + $output = mhash($this->hash, $text); + break; + case CRYPT_HASH_MODE_HASH: + $output = hash($this->hash, $text, true); + break; + case CRYPT_HASH_MODE_INTERNAL: + $output = call_user_func($this->hash, $text); + } + } + + return substr($output, 0, $this->l); + } + + /** + * Returns the hash length (in bytes) + * + * @access public + * @return Integer + */ + function getLength() + { + return $this->l; + } + + /** + * Wrapper for MD5 + * + * @access private + * @param String $m + */ + function _md5($m) + { + return pack('H*', md5($m)); + } + + /** + * Wrapper for SHA1 + * + * @access private + * @param String $m + */ + function _sha1($m) + { + return pack('H*', sha1($m)); + } + + /** + * Pure-PHP implementation of MD2 + * + * See {@link http://tools.ietf.org/html/rfc1319 RFC1319}. + * + * @access private + * @param String $m + */ + function _md2($m) + { + static $s = array( + 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, + 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, + 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, + 138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251, + 245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63, + 148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50, + 39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165, + 181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210, + 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157, + 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27, + 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15, + 85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, + 234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, + 129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, + 8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233, + 203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228, + 166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237, + 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 + ); + + // Step 1. Append Padding Bytes + $pad = 16 - (strlen($m) & 0xF); + $m.= str_repeat(chr($pad), $pad); + + $length = strlen($m); + + // Step 2. Append Checksum + $c = str_repeat(chr(0), 16); + $l = chr(0); + for ($i = 0; $i < $length; $i+= 16) { + for ($j = 0; $j < 16; $j++) { + // RFC1319 incorrectly states that C[j] should be set to S[c xor L] + //$c[$j] = chr($s[ord($m[$i + $j] ^ $l)]); + // per <http://www.rfc-editor.org/errata_search.php?rfc=1319>, however, C[j] should be set to S[c xor L] xor C[j] + $c[$j] = chr($s[ord($m[$i + $j] ^ $l)] ^ ord($c[$j])); + $l = $c[$j]; + } + } + $m.= $c; + + $length+= 16; + + // Step 3. Initialize MD Buffer + $x = str_repeat(chr(0), 48); + + // Step 4. Process Message in 16-Byte Blocks + for ($i = 0; $i < $length; $i+= 16) { + for ($j = 0; $j < 16; $j++) { + $x[$j + 16] = $m[$i + $j]; + $x[$j + 32] = $x[$j + 16] ^ $x[$j]; + } + $t = chr(0); + for ($j = 0; $j < 18; $j++) { + for ($k = 0; $k < 48; $k++) { + $x[$k] = $t = $x[$k] ^ chr($s[ord($t)]); + //$t = $x[$k] = $x[$k] ^ chr($s[ord($t)]); + } + $t = chr(ord($t) + $j); + } + } + + // Step 5. Output + return substr($x, 0, 16); + } + + /** + * Pure-PHP implementation of SHA256 + * + * See {@link http://en.wikipedia.org/wiki/SHA_hash_functions#SHA-256_.28a_SHA-2_variant.29_pseudocode SHA-256 (a SHA-2 variant) pseudocode - Wikipedia}. + * + * @access private + * @param String $m + */ + function _sha256($m) + { + if (extension_loaded('suhosin')) { + return pack('H*', sha256($m)); + } + + // Initialize variables + $hash = array( + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + ); + // Initialize table of round constants + // (first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311) + static $k = array( + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 + ); + + // Pre-processing + $length = strlen($m); + // to round to nearest 56 mod 64, we'll add 64 - (length + (64 - 56)) % 64 + $m.= str_repeat(chr(0), 64 - (($length + 8) & 0x3F)); + $m[$length] = chr(0x80); + // we don't support hashing strings 512MB long + $m.= pack('N2', 0, $length << 3); + + // Process the message in successive 512-bit chunks + $chunks = str_split($m, 64); + foreach ($chunks as $chunk) { + $w = array(); + for ($i = 0; $i < 16; $i++) { + extract(unpack('Ntemp', $this->_string_shift($chunk, 4))); + $w[] = $temp; + } + + // Extend the sixteen 32-bit words into sixty-four 32-bit words + for ($i = 16; $i < 64; $i++) { + $s0 = $this->_rightRotate($w[$i - 15], 7) ^ + $this->_rightRotate($w[$i - 15], 18) ^ + $this->_rightShift( $w[$i - 15], 3); + $s1 = $this->_rightRotate($w[$i - 2], 17) ^ + $this->_rightRotate($w[$i - 2], 19) ^ + $this->_rightShift( $w[$i - 2], 10); + $w[$i] = $this->_add($w[$i - 16], $s0, $w[$i - 7], $s1); + + } + + // Initialize hash value for this chunk + list($a, $b, $c, $d, $e, $f, $g, $h) = $hash; + + // Main loop + for ($i = 0; $i < 64; $i++) { + $s0 = $this->_rightRotate($a, 2) ^ + $this->_rightRotate($a, 13) ^ + $this->_rightRotate($a, 22); + $maj = ($a & $b) ^ + ($a & $c) ^ + ($b & $c); + $t2 = $this->_add($s0, $maj); + + $s1 = $this->_rightRotate($e, 6) ^ + $this->_rightRotate($e, 11) ^ + $this->_rightRotate($e, 25); + $ch = ($e & $f) ^ + ($this->_not($e) & $g); + $t1 = $this->_add($h, $s1, $ch, $k[$i], $w[$i]); + + $h = $g; + $g = $f; + $f = $e; + $e = $this->_add($d, $t1); + $d = $c; + $c = $b; + $b = $a; + $a = $this->_add($t1, $t2); + } + + // Add this chunk's hash to result so far + $hash = array( + $this->_add($hash[0], $a), + $this->_add($hash[1], $b), + $this->_add($hash[2], $c), + $this->_add($hash[3], $d), + $this->_add($hash[4], $e), + $this->_add($hash[5], $f), + $this->_add($hash[6], $g), + $this->_add($hash[7], $h) + ); + } + + // Produce the final hash value (big-endian) + return pack('N8', $hash[0], $hash[1], $hash[2], $hash[3], $hash[4], $hash[5], $hash[6], $hash[7]); + } + + /** + * Pure-PHP implementation of SHA384 and SHA512 + * + * @access private + * @param String $m + */ + function _sha512($m) + { + if (!class_exists('Math_BigInteger')) { + require_once('Math/BigInteger.php'); + } + + static $init384, $init512, $k; + + if (!isset($k)) { + // Initialize variables + $init384 = array( // initial values for SHA384 + 'cbbb9d5dc1059ed8', '629a292a367cd507', '9159015a3070dd17', '152fecd8f70e5939', + '67332667ffc00b31', '8eb44a8768581511', 'db0c2e0d64f98fa7', '47b5481dbefa4fa4' + ); + $init512 = array( // initial values for SHA512 + '6a09e667f3bcc908', 'bb67ae8584caa73b', '3c6ef372fe94f82b', 'a54ff53a5f1d36f1', + '510e527fade682d1', '9b05688c2b3e6c1f', '1f83d9abfb41bd6b', '5be0cd19137e2179' + ); + + for ($i = 0; $i < 8; $i++) { + $init384[$i] = new Math_BigInteger($init384[$i], 16); + $init384[$i]->setPrecision(64); + $init512[$i] = new Math_BigInteger($init512[$i], 16); + $init512[$i]->setPrecision(64); + } + + // Initialize table of round constants + // (first 64 bits of the fractional parts of the cube roots of the first 80 primes 2..409) + $k = array( + '428a2f98d728ae22', '7137449123ef65cd', 'b5c0fbcfec4d3b2f', 'e9b5dba58189dbbc', + '3956c25bf348b538', '59f111f1b605d019', '923f82a4af194f9b', 'ab1c5ed5da6d8118', + 'd807aa98a3030242', '12835b0145706fbe', '243185be4ee4b28c', '550c7dc3d5ffb4e2', + '72be5d74f27b896f', '80deb1fe3b1696b1', '9bdc06a725c71235', 'c19bf174cf692694', + 'e49b69c19ef14ad2', 'efbe4786384f25e3', '0fc19dc68b8cd5b5', '240ca1cc77ac9c65', + '2de92c6f592b0275', '4a7484aa6ea6e483', '5cb0a9dcbd41fbd4', '76f988da831153b5', + '983e5152ee66dfab', 'a831c66d2db43210', 'b00327c898fb213f', 'bf597fc7beef0ee4', + 'c6e00bf33da88fc2', 'd5a79147930aa725', '06ca6351e003826f', '142929670a0e6e70', + '27b70a8546d22ffc', '2e1b21385c26c926', '4d2c6dfc5ac42aed', '53380d139d95b3df', + '650a73548baf63de', '766a0abb3c77b2a8', '81c2c92e47edaee6', '92722c851482353b', + 'a2bfe8a14cf10364', 'a81a664bbc423001', 'c24b8b70d0f89791', 'c76c51a30654be30', + 'd192e819d6ef5218', 'd69906245565a910', 'f40e35855771202a', '106aa07032bbd1b8', + '19a4c116b8d2d0c8', '1e376c085141ab53', '2748774cdf8eeb99', '34b0bcb5e19b48a8', + '391c0cb3c5c95a63', '4ed8aa4ae3418acb', '5b9cca4f7763e373', '682e6ff3d6b2b8a3', + '748f82ee5defb2fc', '78a5636f43172f60', '84c87814a1f0ab72', '8cc702081a6439ec', + '90befffa23631e28', 'a4506cebde82bde9', 'bef9a3f7b2c67915', 'c67178f2e372532b', + 'ca273eceea26619c', 'd186b8c721c0c207', 'eada7dd6cde0eb1e', 'f57d4f7fee6ed178', + '06f067aa72176fba', '0a637dc5a2c898a6', '113f9804bef90dae', '1b710b35131c471b', + '28db77f523047d84', '32caab7b40c72493', '3c9ebe0a15c9bebc', '431d67c49c100d4c', + '4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817' + ); + + for ($i = 0; $i < 80; $i++) { + $k[$i] = new Math_BigInteger($k[$i], 16); + } + } + + $hash = $this->l == 48 ? $init384 : $init512; + + // Pre-processing + $length = strlen($m); + // to round to nearest 112 mod 128, we'll add 128 - (length + (128 - 112)) % 128 + $m.= str_repeat(chr(0), 128 - (($length + 16) & 0x7F)); + $m[$length] = chr(0x80); + // we don't support hashing strings 512MB long + $m.= pack('N4', 0, 0, 0, $length << 3); + + // Process the message in successive 1024-bit chunks + $chunks = str_split($m, 128); + foreach ($chunks as $chunk) { + $w = array(); + for ($i = 0; $i < 16; $i++) { + $temp = new Math_BigInteger($this->_string_shift($chunk, 8), 256); + $temp->setPrecision(64); + $w[] = $temp; + } + + // Extend the sixteen 32-bit words into eighty 32-bit words + for ($i = 16; $i < 80; $i++) { + $temp = array( + $w[$i - 15]->bitwise_rightRotate(1), + $w[$i - 15]->bitwise_rightRotate(8), + $w[$i - 15]->bitwise_rightShift(7) + ); + $s0 = $temp[0]->bitwise_xor($temp[1]); + $s0 = $s0->bitwise_xor($temp[2]); + $temp = array( + $w[$i - 2]->bitwise_rightRotate(19), + $w[$i - 2]->bitwise_rightRotate(61), + $w[$i - 2]->bitwise_rightShift(6) + ); + $s1 = $temp[0]->bitwise_xor($temp[1]); + $s1 = $s1->bitwise_xor($temp[2]); + $w[$i] = $w[$i - 16]->copy(); + $w[$i] = $w[$i]->add($s0); + $w[$i] = $w[$i]->add($w[$i - 7]); + $w[$i] = $w[$i]->add($s1); + } + + // Initialize hash value for this chunk + $a = $hash[0]->copy(); + $b = $hash[1]->copy(); + $c = $hash[2]->copy(); + $d = $hash[3]->copy(); + $e = $hash[4]->copy(); + $f = $hash[5]->copy(); + $g = $hash[6]->copy(); + $h = $hash[7]->copy(); + + // Main loop + for ($i = 0; $i < 80; $i++) { + $temp = array( + $a->bitwise_rightRotate(28), + $a->bitwise_rightRotate(34), + $a->bitwise_rightRotate(39) + ); + $s0 = $temp[0]->bitwise_xor($temp[1]); + $s0 = $s0->bitwise_xor($temp[2]); + $temp = array( + $a->bitwise_and($b), + $a->bitwise_and($c), + $b->bitwise_and($c) + ); + $maj = $temp[0]->bitwise_xor($temp[1]); + $maj = $maj->bitwise_xor($temp[2]); + $t2 = $s0->add($maj); + + $temp = array( + $e->bitwise_rightRotate(14), + $e->bitwise_rightRotate(18), + $e->bitwise_rightRotate(41) + ); + $s1 = $temp[0]->bitwise_xor($temp[1]); + $s1 = $s1->bitwise_xor($temp[2]); + $temp = array( + $e->bitwise_and($f), + $g->bitwise_and($e->bitwise_not()) + ); + $ch = $temp[0]->bitwise_xor($temp[1]); + $t1 = $h->add($s1); + $t1 = $t1->add($ch); + $t1 = $t1->add($k[$i]); + $t1 = $t1->add($w[$i]); + + $h = $g->copy(); + $g = $f->copy(); + $f = $e->copy(); + $e = $d->add($t1); + $d = $c->copy(); + $c = $b->copy(); + $b = $a->copy(); + $a = $t1->add($t2); + } + + // Add this chunk's hash to result so far + $hash = array( + $hash[0]->add($a), + $hash[1]->add($b), + $hash[2]->add($c), + $hash[3]->add($d), + $hash[4]->add($e), + $hash[5]->add($f), + $hash[6]->add($g), + $hash[7]->add($h) + ); + } + + // Produce the final hash value (big-endian) + // (Crypt_Hash::hash() trims the output for hashes but not for HMACs. as such, we trim the output here) + $temp = $hash[0]->toBytes() . $hash[1]->toBytes() . $hash[2]->toBytes() . $hash[3]->toBytes() . + $hash[4]->toBytes() . $hash[5]->toBytes(); + if ($this->l != 48) { + $temp.= $hash[6]->toBytes() . $hash[7]->toBytes(); + } + + return $temp; + } + + /** + * Right Rotate + * + * @access private + * @param Integer $int + * @param Integer $amt + * @see _sha256() + * @return Integer + */ + function _rightRotate($int, $amt) + { + $invamt = 32 - $amt; + $mask = (1 << $invamt) - 1; + return (($int << $invamt) & 0xFFFFFFFF) | (($int >> $amt) & $mask); + } + + /** + * Right Shift + * + * @access private + * @param Integer $int + * @param Integer $amt + * @see _sha256() + * @return Integer + */ + function _rightShift($int, $amt) + { + $mask = (1 << (32 - $amt)) - 1; + return ($int >> $amt) & $mask; + } + + /** + * Not + * + * @access private + * @param Integer $int + * @see _sha256() + * @return Integer + */ + function _not($int) + { + return ~$int & 0xFFFFFFFF; + } + + /** + * Add + * + * _sha256() adds multiple unsigned 32-bit integers. Since PHP doesn't support unsigned integers and since the + * possibility of overflow exists, care has to be taken. Math_BigInteger() could be used but this should be faster. + * + * @param Integer $... + * @return Integer + * @see _sha256() + * @access private + */ + function _add() + { + static $mod; + if (!isset($mod)) { + $mod = pow(2, 32); + } + + $result = 0; + $arguments = func_get_args(); + foreach ($arguments as $argument) { + $result+= $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument; + } + + return fmod($result, $mod); + } + + /** + * String Shift + * + * Inspired by array_shift + * + * @param String $string + * @param optional Integer $index + * @return String + * @access private + */ + function _string_shift(&$string, $index = 1) + { + $substr = substr($string, 0, $index); + $string = substr($string, $index); + return $substr; + } +} diff --git a/inc/phpseclib/Crypt_Rijndael.php b/inc/phpseclib/Crypt_Rijndael.php new file mode 100644 index 000000000..c63e0ff7e --- /dev/null +++ b/inc/phpseclib/Crypt_Rijndael.php @@ -0,0 +1,1374 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Pure-PHP implementation of Rijndael. + * + * Uses mcrypt, if available/possible, and an internal implementation, otherwise. + * + * PHP versions 4 and 5 + * + * If {@link Crypt_Rijndael::setBlockLength() setBlockLength()} isn't called, it'll be assumed to be 128 bits. If + * {@link Crypt_Rijndael::setKeyLength() setKeyLength()} isn't called, it'll be calculated from + * {@link Crypt_Rijndael::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's + * 136-bits it'll be null-padded to 192-bits and 192 bits will be the key length until + * {@link Crypt_Rijndael::setKey() setKey()} is called, again, at which point, it'll be recalculated. + * + * Not all Rijndael implementations may support 160-bits or 224-bits as the block length / key length. mcrypt, for example, + * does not. AES, itself, only supports block lengths of 128 and key lengths of 128, 192, and 256. + * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=10 Rijndael-ammended.pdf#page=10} defines the + * algorithm for block lengths of 192 and 256 but not for block lengths / key lengths of 160 and 224. Indeed, 160 and 224 + * are first defined as valid key / block lengths in + * {@link http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=44 Rijndael-ammended.pdf#page=44}: + * Extensions: Other block and Cipher Key lengths. + * Note: Use of 160/224-bit Keys must be explicitly set by setKeyLength(160) respectively setKeyLength(224). + * + * {@internal The variable names are the same as those in + * {@link http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf#page=10 fips-197.pdf#page=10}.}} + * + * Here's a short example of how to use this library: + * <code> + * <?php + * include('Crypt/Rijndael.php'); + * + * $rijndael = new Crypt_Rijndael(); + * + * $rijndael->setKey('abcdefghijklmnop'); + * + * $size = 10 * 1024; + * $plaintext = ''; + * for ($i = 0; $i < $size; $i++) { + * $plaintext.= 'a'; + * } + * + * echo $rijndael->decrypt($rijndael->encrypt($plaintext)); + * ?> + * </code> + * + * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @category Crypt + * @package Crypt_Rijndael + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVIII Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ + +/** + * Include Crypt_Base + * + * Base cipher class + */ +if (!class_exists('Crypt_Base')) { + require_once('Base.php'); +} + +/**#@+ + * @access public + * @see Crypt_Rijndael::encrypt() + * @see Crypt_Rijndael::decrypt() + */ +/** + * Encrypt / decrypt using the Counter mode. + * + * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 + */ +define('CRYPT_RIJNDAEL_MODE_CTR', CRYPT_MODE_CTR); +/** + * Encrypt / decrypt using the Electronic Code Book mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 + */ +define('CRYPT_RIJNDAEL_MODE_ECB', CRYPT_MODE_ECB); +/** + * Encrypt / decrypt using the Code Book Chaining mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 + */ +define('CRYPT_RIJNDAEL_MODE_CBC', CRYPT_MODE_CBC); +/** + * Encrypt / decrypt using the Cipher Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29 + */ +define('CRYPT_RIJNDAEL_MODE_CFB', CRYPT_MODE_CFB); +/** + * Encrypt / decrypt using the Cipher Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29 + */ +define('CRYPT_RIJNDAEL_MODE_OFB', CRYPT_MODE_OFB); +/**#@-*/ + +/**#@+ + * @access private + * @see Crypt_Rijndael::Crypt_Rijndael() + */ +/** + * Toggles the internal implementation + */ +define('CRYPT_RIJNDAEL_MODE_INTERNAL', CRYPT_MODE_INTERNAL); +/** + * Toggles the mcrypt implementation + */ +define('CRYPT_RIJNDAEL_MODE_MCRYPT', CRYPT_MODE_MCRYPT); +/**#@-*/ + +/** + * Pure-PHP implementation of Rijndael. + * + * @author Jim Wigginton <terrafrost@php.net> + * @version 0.1.0 + * @access public + * @package Crypt_Rijndael + */ +class Crypt_Rijndael extends Crypt_Base { + /** + * The default password key_size used by setPassword() + * + * @see Crypt_Base::password_key_size + * @see Crypt_Base::setPassword() + * @var Integer + * @access private + */ + var $password_key_size = 16; + + /** + * The namespace used by the cipher for its constants. + * + * @see Crypt_Base::const_namespace + * @var String + * @access private + */ + var $const_namespace = 'RIJNDAEL'; + + /** + * The mcrypt specific name of the cipher + * + * Mcrypt is useable for 128/192/256-bit $block_size/$key_size. For 160/224 not. + * Crypt_Rijndael determines automatically whether mcrypt is useable + * or not for the current $block_size/$key_size. + * In case of, $cipher_name_mcrypt will be set dynamicaly at run time accordingly. + * + * @see Crypt_Base::cipher_name_mcrypt + * @see Crypt_Base::engine + * @see _setupEngine() + * @var String + * @access private + */ + var $cipher_name_mcrypt = 'rijndael-128'; + + /** + * The default salt used by setPassword() + * + * @see Crypt_Base::password_default_salt + * @see Crypt_Base::setPassword() + * @var String + * @access private + */ + var $password_default_salt = 'phpseclib'; + + /** + * Has the key length explicitly been set or should it be derived from the key, itself? + * + * @see setKeyLength() + * @var Boolean + * @access private + */ + var $explicit_key_length = false; + + /** + * The Key Schedule + * + * @see _setup() + * @var Array + * @access private + */ + var $w; + + /** + * The Inverse Key Schedule + * + * @see _setup() + * @var Array + * @access private + */ + var $dw; + + /** + * The Block Length divided by 32 + * + * @see setBlockLength() + * @var Integer + * @access private + * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4. Exists in conjunction with $block_size + * because the encryption / decryption / key schedule creation requires this number and not $block_size. We could + * derive this from $block_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu + * of that, we'll just precompute it once. + * + */ + var $Nb = 4; + + /** + * The Key Length + * + * @see setKeyLength() + * @var Integer + * @access private + * @internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $Nk + * because the encryption / decryption / key schedule creation requires this number and not $key_size. We could + * derive this from $key_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu + * of that, we'll just precompute it once. + */ + var $key_size = 16; + + /** + * The Key Length divided by 32 + * + * @see setKeyLength() + * @var Integer + * @access private + * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4 + */ + var $Nk = 4; + + /** + * The Number of Rounds + * + * @var Integer + * @access private + * @internal The max value is 14, the min value is 10. + */ + var $Nr; + + /** + * Shift offsets + * + * @var Array + * @access private + */ + var $c; + + /** + * Holds the last used key- and block_size information + * + * @var Array + * @access private + */ + var $kl; + + /** + * Precomputed mixColumns table + * + * According to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=19> (section 5.2.1), + * precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so + * those are the names we'll use. + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $t0 = array( + 0xC66363A5, 0xF87C7C84, 0xEE777799, 0xF67B7B8D, 0xFFF2F20D, 0xD66B6BBD, 0xDE6F6FB1, 0x91C5C554, + 0x60303050, 0x02010103, 0xCE6767A9, 0x562B2B7D, 0xE7FEFE19, 0xB5D7D762, 0x4DABABE6, 0xEC76769A, + 0x8FCACA45, 0x1F82829D, 0x89C9C940, 0xFA7D7D87, 0xEFFAFA15, 0xB25959EB, 0x8E4747C9, 0xFBF0F00B, + 0x41ADADEC, 0xB3D4D467, 0x5FA2A2FD, 0x45AFAFEA, 0x239C9CBF, 0x53A4A4F7, 0xE4727296, 0x9BC0C05B, + 0x75B7B7C2, 0xE1FDFD1C, 0x3D9393AE, 0x4C26266A, 0x6C36365A, 0x7E3F3F41, 0xF5F7F702, 0x83CCCC4F, + 0x6834345C, 0x51A5A5F4, 0xD1E5E534, 0xF9F1F108, 0xE2717193, 0xABD8D873, 0x62313153, 0x2A15153F, + 0x0804040C, 0x95C7C752, 0x46232365, 0x9DC3C35E, 0x30181828, 0x379696A1, 0x0A05050F, 0x2F9A9AB5, + 0x0E070709, 0x24121236, 0x1B80809B, 0xDFE2E23D, 0xCDEBEB26, 0x4E272769, 0x7FB2B2CD, 0xEA75759F, + 0x1209091B, 0x1D83839E, 0x582C2C74, 0x341A1A2E, 0x361B1B2D, 0xDC6E6EB2, 0xB45A5AEE, 0x5BA0A0FB, + 0xA45252F6, 0x763B3B4D, 0xB7D6D661, 0x7DB3B3CE, 0x5229297B, 0xDDE3E33E, 0x5E2F2F71, 0x13848497, + 0xA65353F5, 0xB9D1D168, 0x00000000, 0xC1EDED2C, 0x40202060, 0xE3FCFC1F, 0x79B1B1C8, 0xB65B5BED, + 0xD46A6ABE, 0x8DCBCB46, 0x67BEBED9, 0x7239394B, 0x944A4ADE, 0x984C4CD4, 0xB05858E8, 0x85CFCF4A, + 0xBBD0D06B, 0xC5EFEF2A, 0x4FAAAAE5, 0xEDFBFB16, 0x864343C5, 0x9A4D4DD7, 0x66333355, 0x11858594, + 0x8A4545CF, 0xE9F9F910, 0x04020206, 0xFE7F7F81, 0xA05050F0, 0x783C3C44, 0x259F9FBA, 0x4BA8A8E3, + 0xA25151F3, 0x5DA3A3FE, 0x804040C0, 0x058F8F8A, 0x3F9292AD, 0x219D9DBC, 0x70383848, 0xF1F5F504, + 0x63BCBCDF, 0x77B6B6C1, 0xAFDADA75, 0x42212163, 0x20101030, 0xE5FFFF1A, 0xFDF3F30E, 0xBFD2D26D, + 0x81CDCD4C, 0x180C0C14, 0x26131335, 0xC3ECEC2F, 0xBE5F5FE1, 0x359797A2, 0x884444CC, 0x2E171739, + 0x93C4C457, 0x55A7A7F2, 0xFC7E7E82, 0x7A3D3D47, 0xC86464AC, 0xBA5D5DE7, 0x3219192B, 0xE6737395, + 0xC06060A0, 0x19818198, 0x9E4F4FD1, 0xA3DCDC7F, 0x44222266, 0x542A2A7E, 0x3B9090AB, 0x0B888883, + 0x8C4646CA, 0xC7EEEE29, 0x6BB8B8D3, 0x2814143C, 0xA7DEDE79, 0xBC5E5EE2, 0x160B0B1D, 0xADDBDB76, + 0xDBE0E03B, 0x64323256, 0x743A3A4E, 0x140A0A1E, 0x924949DB, 0x0C06060A, 0x4824246C, 0xB85C5CE4, + 0x9FC2C25D, 0xBDD3D36E, 0x43ACACEF, 0xC46262A6, 0x399191A8, 0x319595A4, 0xD3E4E437, 0xF279798B, + 0xD5E7E732, 0x8BC8C843, 0x6E373759, 0xDA6D6DB7, 0x018D8D8C, 0xB1D5D564, 0x9C4E4ED2, 0x49A9A9E0, + 0xD86C6CB4, 0xAC5656FA, 0xF3F4F407, 0xCFEAEA25, 0xCA6565AF, 0xF47A7A8E, 0x47AEAEE9, 0x10080818, + 0x6FBABAD5, 0xF0787888, 0x4A25256F, 0x5C2E2E72, 0x381C1C24, 0x57A6A6F1, 0x73B4B4C7, 0x97C6C651, + 0xCBE8E823, 0xA1DDDD7C, 0xE874749C, 0x3E1F1F21, 0x964B4BDD, 0x61BDBDDC, 0x0D8B8B86, 0x0F8A8A85, + 0xE0707090, 0x7C3E3E42, 0x71B5B5C4, 0xCC6666AA, 0x904848D8, 0x06030305, 0xF7F6F601, 0x1C0E0E12, + 0xC26161A3, 0x6A35355F, 0xAE5757F9, 0x69B9B9D0, 0x17868691, 0x99C1C158, 0x3A1D1D27, 0x279E9EB9, + 0xD9E1E138, 0xEBF8F813, 0x2B9898B3, 0x22111133, 0xD26969BB, 0xA9D9D970, 0x078E8E89, 0x339494A7, + 0x2D9B9BB6, 0x3C1E1E22, 0x15878792, 0xC9E9E920, 0x87CECE49, 0xAA5555FF, 0x50282878, 0xA5DFDF7A, + 0x038C8C8F, 0x59A1A1F8, 0x09898980, 0x1A0D0D17, 0x65BFBFDA, 0xD7E6E631, 0x844242C6, 0xD06868B8, + 0x824141C3, 0x299999B0, 0x5A2D2D77, 0x1E0F0F11, 0x7BB0B0CB, 0xA85454FC, 0x6DBBBBD6, 0x2C16163A + ); + + /** + * Precomputed mixColumns table + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $t1 = array( + 0xA5C66363, 0x84F87C7C, 0x99EE7777, 0x8DF67B7B, 0x0DFFF2F2, 0xBDD66B6B, 0xB1DE6F6F, 0x5491C5C5, + 0x50603030, 0x03020101, 0xA9CE6767, 0x7D562B2B, 0x19E7FEFE, 0x62B5D7D7, 0xE64DABAB, 0x9AEC7676, + 0x458FCACA, 0x9D1F8282, 0x4089C9C9, 0x87FA7D7D, 0x15EFFAFA, 0xEBB25959, 0xC98E4747, 0x0BFBF0F0, + 0xEC41ADAD, 0x67B3D4D4, 0xFD5FA2A2, 0xEA45AFAF, 0xBF239C9C, 0xF753A4A4, 0x96E47272, 0x5B9BC0C0, + 0xC275B7B7, 0x1CE1FDFD, 0xAE3D9393, 0x6A4C2626, 0x5A6C3636, 0x417E3F3F, 0x02F5F7F7, 0x4F83CCCC, + 0x5C683434, 0xF451A5A5, 0x34D1E5E5, 0x08F9F1F1, 0x93E27171, 0x73ABD8D8, 0x53623131, 0x3F2A1515, + 0x0C080404, 0x5295C7C7, 0x65462323, 0x5E9DC3C3, 0x28301818, 0xA1379696, 0x0F0A0505, 0xB52F9A9A, + 0x090E0707, 0x36241212, 0x9B1B8080, 0x3DDFE2E2, 0x26CDEBEB, 0x694E2727, 0xCD7FB2B2, 0x9FEA7575, + 0x1B120909, 0x9E1D8383, 0x74582C2C, 0x2E341A1A, 0x2D361B1B, 0xB2DC6E6E, 0xEEB45A5A, 0xFB5BA0A0, + 0xF6A45252, 0x4D763B3B, 0x61B7D6D6, 0xCE7DB3B3, 0x7B522929, 0x3EDDE3E3, 0x715E2F2F, 0x97138484, + 0xF5A65353, 0x68B9D1D1, 0x00000000, 0x2CC1EDED, 0x60402020, 0x1FE3FCFC, 0xC879B1B1, 0xEDB65B5B, + 0xBED46A6A, 0x468DCBCB, 0xD967BEBE, 0x4B723939, 0xDE944A4A, 0xD4984C4C, 0xE8B05858, 0x4A85CFCF, + 0x6BBBD0D0, 0x2AC5EFEF, 0xE54FAAAA, 0x16EDFBFB, 0xC5864343, 0xD79A4D4D, 0x55663333, 0x94118585, + 0xCF8A4545, 0x10E9F9F9, 0x06040202, 0x81FE7F7F, 0xF0A05050, 0x44783C3C, 0xBA259F9F, 0xE34BA8A8, + 0xF3A25151, 0xFE5DA3A3, 0xC0804040, 0x8A058F8F, 0xAD3F9292, 0xBC219D9D, 0x48703838, 0x04F1F5F5, + 0xDF63BCBC, 0xC177B6B6, 0x75AFDADA, 0x63422121, 0x30201010, 0x1AE5FFFF, 0x0EFDF3F3, 0x6DBFD2D2, + 0x4C81CDCD, 0x14180C0C, 0x35261313, 0x2FC3ECEC, 0xE1BE5F5F, 0xA2359797, 0xCC884444, 0x392E1717, + 0x5793C4C4, 0xF255A7A7, 0x82FC7E7E, 0x477A3D3D, 0xACC86464, 0xE7BA5D5D, 0x2B321919, 0x95E67373, + 0xA0C06060, 0x98198181, 0xD19E4F4F, 0x7FA3DCDC, 0x66442222, 0x7E542A2A, 0xAB3B9090, 0x830B8888, + 0xCA8C4646, 0x29C7EEEE, 0xD36BB8B8, 0x3C281414, 0x79A7DEDE, 0xE2BC5E5E, 0x1D160B0B, 0x76ADDBDB, + 0x3BDBE0E0, 0x56643232, 0x4E743A3A, 0x1E140A0A, 0xDB924949, 0x0A0C0606, 0x6C482424, 0xE4B85C5C, + 0x5D9FC2C2, 0x6EBDD3D3, 0xEF43ACAC, 0xA6C46262, 0xA8399191, 0xA4319595, 0x37D3E4E4, 0x8BF27979, + 0x32D5E7E7, 0x438BC8C8, 0x596E3737, 0xB7DA6D6D, 0x8C018D8D, 0x64B1D5D5, 0xD29C4E4E, 0xE049A9A9, + 0xB4D86C6C, 0xFAAC5656, 0x07F3F4F4, 0x25CFEAEA, 0xAFCA6565, 0x8EF47A7A, 0xE947AEAE, 0x18100808, + 0xD56FBABA, 0x88F07878, 0x6F4A2525, 0x725C2E2E, 0x24381C1C, 0xF157A6A6, 0xC773B4B4, 0x5197C6C6, + 0x23CBE8E8, 0x7CA1DDDD, 0x9CE87474, 0x213E1F1F, 0xDD964B4B, 0xDC61BDBD, 0x860D8B8B, 0x850F8A8A, + 0x90E07070, 0x427C3E3E, 0xC471B5B5, 0xAACC6666, 0xD8904848, 0x05060303, 0x01F7F6F6, 0x121C0E0E, + 0xA3C26161, 0x5F6A3535, 0xF9AE5757, 0xD069B9B9, 0x91178686, 0x5899C1C1, 0x273A1D1D, 0xB9279E9E, + 0x38D9E1E1, 0x13EBF8F8, 0xB32B9898, 0x33221111, 0xBBD26969, 0x70A9D9D9, 0x89078E8E, 0xA7339494, + 0xB62D9B9B, 0x223C1E1E, 0x92158787, 0x20C9E9E9, 0x4987CECE, 0xFFAA5555, 0x78502828, 0x7AA5DFDF, + 0x8F038C8C, 0xF859A1A1, 0x80098989, 0x171A0D0D, 0xDA65BFBF, 0x31D7E6E6, 0xC6844242, 0xB8D06868, + 0xC3824141, 0xB0299999, 0x775A2D2D, 0x111E0F0F, 0xCB7BB0B0, 0xFCA85454, 0xD66DBBBB, 0x3A2C1616 + ); + + /** + * Precomputed mixColumns table + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $t2 = array( + 0x63A5C663, 0x7C84F87C, 0x7799EE77, 0x7B8DF67B, 0xF20DFFF2, 0x6BBDD66B, 0x6FB1DE6F, 0xC55491C5, + 0x30506030, 0x01030201, 0x67A9CE67, 0x2B7D562B, 0xFE19E7FE, 0xD762B5D7, 0xABE64DAB, 0x769AEC76, + 0xCA458FCA, 0x829D1F82, 0xC94089C9, 0x7D87FA7D, 0xFA15EFFA, 0x59EBB259, 0x47C98E47, 0xF00BFBF0, + 0xADEC41AD, 0xD467B3D4, 0xA2FD5FA2, 0xAFEA45AF, 0x9CBF239C, 0xA4F753A4, 0x7296E472, 0xC05B9BC0, + 0xB7C275B7, 0xFD1CE1FD, 0x93AE3D93, 0x266A4C26, 0x365A6C36, 0x3F417E3F, 0xF702F5F7, 0xCC4F83CC, + 0x345C6834, 0xA5F451A5, 0xE534D1E5, 0xF108F9F1, 0x7193E271, 0xD873ABD8, 0x31536231, 0x153F2A15, + 0x040C0804, 0xC75295C7, 0x23654623, 0xC35E9DC3, 0x18283018, 0x96A13796, 0x050F0A05, 0x9AB52F9A, + 0x07090E07, 0x12362412, 0x809B1B80, 0xE23DDFE2, 0xEB26CDEB, 0x27694E27, 0xB2CD7FB2, 0x759FEA75, + 0x091B1209, 0x839E1D83, 0x2C74582C, 0x1A2E341A, 0x1B2D361B, 0x6EB2DC6E, 0x5AEEB45A, 0xA0FB5BA0, + 0x52F6A452, 0x3B4D763B, 0xD661B7D6, 0xB3CE7DB3, 0x297B5229, 0xE33EDDE3, 0x2F715E2F, 0x84971384, + 0x53F5A653, 0xD168B9D1, 0x00000000, 0xED2CC1ED, 0x20604020, 0xFC1FE3FC, 0xB1C879B1, 0x5BEDB65B, + 0x6ABED46A, 0xCB468DCB, 0xBED967BE, 0x394B7239, 0x4ADE944A, 0x4CD4984C, 0x58E8B058, 0xCF4A85CF, + 0xD06BBBD0, 0xEF2AC5EF, 0xAAE54FAA, 0xFB16EDFB, 0x43C58643, 0x4DD79A4D, 0x33556633, 0x85941185, + 0x45CF8A45, 0xF910E9F9, 0x02060402, 0x7F81FE7F, 0x50F0A050, 0x3C44783C, 0x9FBA259F, 0xA8E34BA8, + 0x51F3A251, 0xA3FE5DA3, 0x40C08040, 0x8F8A058F, 0x92AD3F92, 0x9DBC219D, 0x38487038, 0xF504F1F5, + 0xBCDF63BC, 0xB6C177B6, 0xDA75AFDA, 0x21634221, 0x10302010, 0xFF1AE5FF, 0xF30EFDF3, 0xD26DBFD2, + 0xCD4C81CD, 0x0C14180C, 0x13352613, 0xEC2FC3EC, 0x5FE1BE5F, 0x97A23597, 0x44CC8844, 0x17392E17, + 0xC45793C4, 0xA7F255A7, 0x7E82FC7E, 0x3D477A3D, 0x64ACC864, 0x5DE7BA5D, 0x192B3219, 0x7395E673, + 0x60A0C060, 0x81981981, 0x4FD19E4F, 0xDC7FA3DC, 0x22664422, 0x2A7E542A, 0x90AB3B90, 0x88830B88, + 0x46CA8C46, 0xEE29C7EE, 0xB8D36BB8, 0x143C2814, 0xDE79A7DE, 0x5EE2BC5E, 0x0B1D160B, 0xDB76ADDB, + 0xE03BDBE0, 0x32566432, 0x3A4E743A, 0x0A1E140A, 0x49DB9249, 0x060A0C06, 0x246C4824, 0x5CE4B85C, + 0xC25D9FC2, 0xD36EBDD3, 0xACEF43AC, 0x62A6C462, 0x91A83991, 0x95A43195, 0xE437D3E4, 0x798BF279, + 0xE732D5E7, 0xC8438BC8, 0x37596E37, 0x6DB7DA6D, 0x8D8C018D, 0xD564B1D5, 0x4ED29C4E, 0xA9E049A9, + 0x6CB4D86C, 0x56FAAC56, 0xF407F3F4, 0xEA25CFEA, 0x65AFCA65, 0x7A8EF47A, 0xAEE947AE, 0x08181008, + 0xBAD56FBA, 0x7888F078, 0x256F4A25, 0x2E725C2E, 0x1C24381C, 0xA6F157A6, 0xB4C773B4, 0xC65197C6, + 0xE823CBE8, 0xDD7CA1DD, 0x749CE874, 0x1F213E1F, 0x4BDD964B, 0xBDDC61BD, 0x8B860D8B, 0x8A850F8A, + 0x7090E070, 0x3E427C3E, 0xB5C471B5, 0x66AACC66, 0x48D89048, 0x03050603, 0xF601F7F6, 0x0E121C0E, + 0x61A3C261, 0x355F6A35, 0x57F9AE57, 0xB9D069B9, 0x86911786, 0xC15899C1, 0x1D273A1D, 0x9EB9279E, + 0xE138D9E1, 0xF813EBF8, 0x98B32B98, 0x11332211, 0x69BBD269, 0xD970A9D9, 0x8E89078E, 0x94A73394, + 0x9BB62D9B, 0x1E223C1E, 0x87921587, 0xE920C9E9, 0xCE4987CE, 0x55FFAA55, 0x28785028, 0xDF7AA5DF, + 0x8C8F038C, 0xA1F859A1, 0x89800989, 0x0D171A0D, 0xBFDA65BF, 0xE631D7E6, 0x42C68442, 0x68B8D068, + 0x41C38241, 0x99B02999, 0x2D775A2D, 0x0F111E0F, 0xB0CB7BB0, 0x54FCA854, 0xBBD66DBB, 0x163A2C16 + ); + + /** + * Precomputed mixColumns table + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $t3 = array( + 0x6363A5C6, 0x7C7C84F8, 0x777799EE, 0x7B7B8DF6, 0xF2F20DFF, 0x6B6BBDD6, 0x6F6FB1DE, 0xC5C55491, + 0x30305060, 0x01010302, 0x6767A9CE, 0x2B2B7D56, 0xFEFE19E7, 0xD7D762B5, 0xABABE64D, 0x76769AEC, + 0xCACA458F, 0x82829D1F, 0xC9C94089, 0x7D7D87FA, 0xFAFA15EF, 0x5959EBB2, 0x4747C98E, 0xF0F00BFB, + 0xADADEC41, 0xD4D467B3, 0xA2A2FD5F, 0xAFAFEA45, 0x9C9CBF23, 0xA4A4F753, 0x727296E4, 0xC0C05B9B, + 0xB7B7C275, 0xFDFD1CE1, 0x9393AE3D, 0x26266A4C, 0x36365A6C, 0x3F3F417E, 0xF7F702F5, 0xCCCC4F83, + 0x34345C68, 0xA5A5F451, 0xE5E534D1, 0xF1F108F9, 0x717193E2, 0xD8D873AB, 0x31315362, 0x15153F2A, + 0x04040C08, 0xC7C75295, 0x23236546, 0xC3C35E9D, 0x18182830, 0x9696A137, 0x05050F0A, 0x9A9AB52F, + 0x0707090E, 0x12123624, 0x80809B1B, 0xE2E23DDF, 0xEBEB26CD, 0x2727694E, 0xB2B2CD7F, 0x75759FEA, + 0x09091B12, 0x83839E1D, 0x2C2C7458, 0x1A1A2E34, 0x1B1B2D36, 0x6E6EB2DC, 0x5A5AEEB4, 0xA0A0FB5B, + 0x5252F6A4, 0x3B3B4D76, 0xD6D661B7, 0xB3B3CE7D, 0x29297B52, 0xE3E33EDD, 0x2F2F715E, 0x84849713, + 0x5353F5A6, 0xD1D168B9, 0x00000000, 0xEDED2CC1, 0x20206040, 0xFCFC1FE3, 0xB1B1C879, 0x5B5BEDB6, + 0x6A6ABED4, 0xCBCB468D, 0xBEBED967, 0x39394B72, 0x4A4ADE94, 0x4C4CD498, 0x5858E8B0, 0xCFCF4A85, + 0xD0D06BBB, 0xEFEF2AC5, 0xAAAAE54F, 0xFBFB16ED, 0x4343C586, 0x4D4DD79A, 0x33335566, 0x85859411, + 0x4545CF8A, 0xF9F910E9, 0x02020604, 0x7F7F81FE, 0x5050F0A0, 0x3C3C4478, 0x9F9FBA25, 0xA8A8E34B, + 0x5151F3A2, 0xA3A3FE5D, 0x4040C080, 0x8F8F8A05, 0x9292AD3F, 0x9D9DBC21, 0x38384870, 0xF5F504F1, + 0xBCBCDF63, 0xB6B6C177, 0xDADA75AF, 0x21216342, 0x10103020, 0xFFFF1AE5, 0xF3F30EFD, 0xD2D26DBF, + 0xCDCD4C81, 0x0C0C1418, 0x13133526, 0xECEC2FC3, 0x5F5FE1BE, 0x9797A235, 0x4444CC88, 0x1717392E, + 0xC4C45793, 0xA7A7F255, 0x7E7E82FC, 0x3D3D477A, 0x6464ACC8, 0x5D5DE7BA, 0x19192B32, 0x737395E6, + 0x6060A0C0, 0x81819819, 0x4F4FD19E, 0xDCDC7FA3, 0x22226644, 0x2A2A7E54, 0x9090AB3B, 0x8888830B, + 0x4646CA8C, 0xEEEE29C7, 0xB8B8D36B, 0x14143C28, 0xDEDE79A7, 0x5E5EE2BC, 0x0B0B1D16, 0xDBDB76AD, + 0xE0E03BDB, 0x32325664, 0x3A3A4E74, 0x0A0A1E14, 0x4949DB92, 0x06060A0C, 0x24246C48, 0x5C5CE4B8, + 0xC2C25D9F, 0xD3D36EBD, 0xACACEF43, 0x6262A6C4, 0x9191A839, 0x9595A431, 0xE4E437D3, 0x79798BF2, + 0xE7E732D5, 0xC8C8438B, 0x3737596E, 0x6D6DB7DA, 0x8D8D8C01, 0xD5D564B1, 0x4E4ED29C, 0xA9A9E049, + 0x6C6CB4D8, 0x5656FAAC, 0xF4F407F3, 0xEAEA25CF, 0x6565AFCA, 0x7A7A8EF4, 0xAEAEE947, 0x08081810, + 0xBABAD56F, 0x787888F0, 0x25256F4A, 0x2E2E725C, 0x1C1C2438, 0xA6A6F157, 0xB4B4C773, 0xC6C65197, + 0xE8E823CB, 0xDDDD7CA1, 0x74749CE8, 0x1F1F213E, 0x4B4BDD96, 0xBDBDDC61, 0x8B8B860D, 0x8A8A850F, + 0x707090E0, 0x3E3E427C, 0xB5B5C471, 0x6666AACC, 0x4848D890, 0x03030506, 0xF6F601F7, 0x0E0E121C, + 0x6161A3C2, 0x35355F6A, 0x5757F9AE, 0xB9B9D069, 0x86869117, 0xC1C15899, 0x1D1D273A, 0x9E9EB927, + 0xE1E138D9, 0xF8F813EB, 0x9898B32B, 0x11113322, 0x6969BBD2, 0xD9D970A9, 0x8E8E8907, 0x9494A733, + 0x9B9BB62D, 0x1E1E223C, 0x87879215, 0xE9E920C9, 0xCECE4987, 0x5555FFAA, 0x28287850, 0xDFDF7AA5, + 0x8C8C8F03, 0xA1A1F859, 0x89898009, 0x0D0D171A, 0xBFBFDA65, 0xE6E631D7, 0x4242C684, 0x6868B8D0, + 0x4141C382, 0x9999B029, 0x2D2D775A, 0x0F0F111E, 0xB0B0CB7B, 0x5454FCA8, 0xBBBBD66D, 0x16163A2C + ); + + /** + * Precomputed invMixColumns table + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $dt0 = array( + 0x51F4A750, 0x7E416553, 0x1A17A4C3, 0x3A275E96, 0x3BAB6BCB, 0x1F9D45F1, 0xACFA58AB, 0x4BE30393, + 0x2030FA55, 0xAD766DF6, 0x88CC7691, 0xF5024C25, 0x4FE5D7FC, 0xC52ACBD7, 0x26354480, 0xB562A38F, + 0xDEB15A49, 0x25BA1B67, 0x45EA0E98, 0x5DFEC0E1, 0xC32F7502, 0x814CF012, 0x8D4697A3, 0x6BD3F9C6, + 0x038F5FE7, 0x15929C95, 0xBF6D7AEB, 0x955259DA, 0xD4BE832D, 0x587421D3, 0x49E06929, 0x8EC9C844, + 0x75C2896A, 0xF48E7978, 0x99583E6B, 0x27B971DD, 0xBEE14FB6, 0xF088AD17, 0xC920AC66, 0x7DCE3AB4, + 0x63DF4A18, 0xE51A3182, 0x97513360, 0x62537F45, 0xB16477E0, 0xBB6BAE84, 0xFE81A01C, 0xF9082B94, + 0x70486858, 0x8F45FD19, 0x94DE6C87, 0x527BF8B7, 0xAB73D323, 0x724B02E2, 0xE31F8F57, 0x6655AB2A, + 0xB2EB2807, 0x2FB5C203, 0x86C57B9A, 0xD33708A5, 0x302887F2, 0x23BFA5B2, 0x02036ABA, 0xED16825C, + 0x8ACF1C2B, 0xA779B492, 0xF307F2F0, 0x4E69E2A1, 0x65DAF4CD, 0x0605BED5, 0xD134621F, 0xC4A6FE8A, + 0x342E539D, 0xA2F355A0, 0x058AE132, 0xA4F6EB75, 0x0B83EC39, 0x4060EFAA, 0x5E719F06, 0xBD6E1051, + 0x3E218AF9, 0x96DD063D, 0xDD3E05AE, 0x4DE6BD46, 0x91548DB5, 0x71C45D05, 0x0406D46F, 0x605015FF, + 0x1998FB24, 0xD6BDE997, 0x894043CC, 0x67D99E77, 0xB0E842BD, 0x07898B88, 0xE7195B38, 0x79C8EEDB, + 0xA17C0A47, 0x7C420FE9, 0xF8841EC9, 0x00000000, 0x09808683, 0x322BED48, 0x1E1170AC, 0x6C5A724E, + 0xFD0EFFFB, 0x0F853856, 0x3DAED51E, 0x362D3927, 0x0A0FD964, 0x685CA621, 0x9B5B54D1, 0x24362E3A, + 0x0C0A67B1, 0x9357E70F, 0xB4EE96D2, 0x1B9B919E, 0x80C0C54F, 0x61DC20A2, 0x5A774B69, 0x1C121A16, + 0xE293BA0A, 0xC0A02AE5, 0x3C22E043, 0x121B171D, 0x0E090D0B, 0xF28BC7AD, 0x2DB6A8B9, 0x141EA9C8, + 0x57F11985, 0xAF75074C, 0xEE99DDBB, 0xA37F60FD, 0xF701269F, 0x5C72F5BC, 0x44663BC5, 0x5BFB7E34, + 0x8B432976, 0xCB23C6DC, 0xB6EDFC68, 0xB8E4F163, 0xD731DCCA, 0x42638510, 0x13972240, 0x84C61120, + 0x854A247D, 0xD2BB3DF8, 0xAEF93211, 0xC729A16D, 0x1D9E2F4B, 0xDCB230F3, 0x0D8652EC, 0x77C1E3D0, + 0x2BB3166C, 0xA970B999, 0x119448FA, 0x47E96422, 0xA8FC8CC4, 0xA0F03F1A, 0x567D2CD8, 0x223390EF, + 0x87494EC7, 0xD938D1C1, 0x8CCAA2FE, 0x98D40B36, 0xA6F581CF, 0xA57ADE28, 0xDAB78E26, 0x3FADBFA4, + 0x2C3A9DE4, 0x5078920D, 0x6A5FCC9B, 0x547E4662, 0xF68D13C2, 0x90D8B8E8, 0x2E39F75E, 0x82C3AFF5, + 0x9F5D80BE, 0x69D0937C, 0x6FD52DA9, 0xCF2512B3, 0xC8AC993B, 0x10187DA7, 0xE89C636E, 0xDB3BBB7B, + 0xCD267809, 0x6E5918F4, 0xEC9AB701, 0x834F9AA8, 0xE6956E65, 0xAAFFE67E, 0x21BCCF08, 0xEF15E8E6, + 0xBAE79BD9, 0x4A6F36CE, 0xEA9F09D4, 0x29B07CD6, 0x31A4B2AF, 0x2A3F2331, 0xC6A59430, 0x35A266C0, + 0x744EBC37, 0xFC82CAA6, 0xE090D0B0, 0x33A7D815, 0xF104984A, 0x41ECDAF7, 0x7FCD500E, 0x1791F62F, + 0x764DD68D, 0x43EFB04D, 0xCCAA4D54, 0xE49604DF, 0x9ED1B5E3, 0x4C6A881B, 0xC12C1FB8, 0x4665517F, + 0x9D5EEA04, 0x018C355D, 0xFA877473, 0xFB0B412E, 0xB3671D5A, 0x92DBD252, 0xE9105633, 0x6DD64713, + 0x9AD7618C, 0x37A10C7A, 0x59F8148E, 0xEB133C89, 0xCEA927EE, 0xB761C935, 0xE11CE5ED, 0x7A47B13C, + 0x9CD2DF59, 0x55F2733F, 0x1814CE79, 0x73C737BF, 0x53F7CDEA, 0x5FFDAA5B, 0xDF3D6F14, 0x7844DB86, + 0xCAAFF381, 0xB968C43E, 0x3824342C, 0xC2A3405F, 0x161DC372, 0xBCE2250C, 0x283C498B, 0xFF0D9541, + 0x39A80171, 0x080CB3DE, 0xD8B4E49C, 0x6456C190, 0x7BCB8461, 0xD532B670, 0x486C5C74, 0xD0B85742 + ); + + /** + * Precomputed invMixColumns table + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $dt1 = array( + 0x5051F4A7, 0x537E4165, 0xC31A17A4, 0x963A275E, 0xCB3BAB6B, 0xF11F9D45, 0xABACFA58, 0x934BE303, + 0x552030FA, 0xF6AD766D, 0x9188CC76, 0x25F5024C, 0xFC4FE5D7, 0xD7C52ACB, 0x80263544, 0x8FB562A3, + 0x49DEB15A, 0x6725BA1B, 0x9845EA0E, 0xE15DFEC0, 0x02C32F75, 0x12814CF0, 0xA38D4697, 0xC66BD3F9, + 0xE7038F5F, 0x9515929C, 0xEBBF6D7A, 0xDA955259, 0x2DD4BE83, 0xD3587421, 0x2949E069, 0x448EC9C8, + 0x6A75C289, 0x78F48E79, 0x6B99583E, 0xDD27B971, 0xB6BEE14F, 0x17F088AD, 0x66C920AC, 0xB47DCE3A, + 0x1863DF4A, 0x82E51A31, 0x60975133, 0x4562537F, 0xE0B16477, 0x84BB6BAE, 0x1CFE81A0, 0x94F9082B, + 0x58704868, 0x198F45FD, 0x8794DE6C, 0xB7527BF8, 0x23AB73D3, 0xE2724B02, 0x57E31F8F, 0x2A6655AB, + 0x07B2EB28, 0x032FB5C2, 0x9A86C57B, 0xA5D33708, 0xF2302887, 0xB223BFA5, 0xBA02036A, 0x5CED1682, + 0x2B8ACF1C, 0x92A779B4, 0xF0F307F2, 0xA14E69E2, 0xCD65DAF4, 0xD50605BE, 0x1FD13462, 0x8AC4A6FE, + 0x9D342E53, 0xA0A2F355, 0x32058AE1, 0x75A4F6EB, 0x390B83EC, 0xAA4060EF, 0x065E719F, 0x51BD6E10, + 0xF93E218A, 0x3D96DD06, 0xAEDD3E05, 0x464DE6BD, 0xB591548D, 0x0571C45D, 0x6F0406D4, 0xFF605015, + 0x241998FB, 0x97D6BDE9, 0xCC894043, 0x7767D99E, 0xBDB0E842, 0x8807898B, 0x38E7195B, 0xDB79C8EE, + 0x47A17C0A, 0xE97C420F, 0xC9F8841E, 0x00000000, 0x83098086, 0x48322BED, 0xAC1E1170, 0x4E6C5A72, + 0xFBFD0EFF, 0x560F8538, 0x1E3DAED5, 0x27362D39, 0x640A0FD9, 0x21685CA6, 0xD19B5B54, 0x3A24362E, + 0xB10C0A67, 0x0F9357E7, 0xD2B4EE96, 0x9E1B9B91, 0x4F80C0C5, 0xA261DC20, 0x695A774B, 0x161C121A, + 0x0AE293BA, 0xE5C0A02A, 0x433C22E0, 0x1D121B17, 0x0B0E090D, 0xADF28BC7, 0xB92DB6A8, 0xC8141EA9, + 0x8557F119, 0x4CAF7507, 0xBBEE99DD, 0xFDA37F60, 0x9FF70126, 0xBC5C72F5, 0xC544663B, 0x345BFB7E, + 0x768B4329, 0xDCCB23C6, 0x68B6EDFC, 0x63B8E4F1, 0xCAD731DC, 0x10426385, 0x40139722, 0x2084C611, + 0x7D854A24, 0xF8D2BB3D, 0x11AEF932, 0x6DC729A1, 0x4B1D9E2F, 0xF3DCB230, 0xEC0D8652, 0xD077C1E3, + 0x6C2BB316, 0x99A970B9, 0xFA119448, 0x2247E964, 0xC4A8FC8C, 0x1AA0F03F, 0xD8567D2C, 0xEF223390, + 0xC787494E, 0xC1D938D1, 0xFE8CCAA2, 0x3698D40B, 0xCFA6F581, 0x28A57ADE, 0x26DAB78E, 0xA43FADBF, + 0xE42C3A9D, 0x0D507892, 0x9B6A5FCC, 0x62547E46, 0xC2F68D13, 0xE890D8B8, 0x5E2E39F7, 0xF582C3AF, + 0xBE9F5D80, 0x7C69D093, 0xA96FD52D, 0xB3CF2512, 0x3BC8AC99, 0xA710187D, 0x6EE89C63, 0x7BDB3BBB, + 0x09CD2678, 0xF46E5918, 0x01EC9AB7, 0xA8834F9A, 0x65E6956E, 0x7EAAFFE6, 0x0821BCCF, 0xE6EF15E8, + 0xD9BAE79B, 0xCE4A6F36, 0xD4EA9F09, 0xD629B07C, 0xAF31A4B2, 0x312A3F23, 0x30C6A594, 0xC035A266, + 0x37744EBC, 0xA6FC82CA, 0xB0E090D0, 0x1533A7D8, 0x4AF10498, 0xF741ECDA, 0x0E7FCD50, 0x2F1791F6, + 0x8D764DD6, 0x4D43EFB0, 0x54CCAA4D, 0xDFE49604, 0xE39ED1B5, 0x1B4C6A88, 0xB8C12C1F, 0x7F466551, + 0x049D5EEA, 0x5D018C35, 0x73FA8774, 0x2EFB0B41, 0x5AB3671D, 0x5292DBD2, 0x33E91056, 0x136DD647, + 0x8C9AD761, 0x7A37A10C, 0x8E59F814, 0x89EB133C, 0xEECEA927, 0x35B761C9, 0xEDE11CE5, 0x3C7A47B1, + 0x599CD2DF, 0x3F55F273, 0x791814CE, 0xBF73C737, 0xEA53F7CD, 0x5B5FFDAA, 0x14DF3D6F, 0x867844DB, + 0x81CAAFF3, 0x3EB968C4, 0x2C382434, 0x5FC2A340, 0x72161DC3, 0x0CBCE225, 0x8B283C49, 0x41FF0D95, + 0x7139A801, 0xDE080CB3, 0x9CD8B4E4, 0x906456C1, 0x617BCB84, 0x70D532B6, 0x74486C5C, 0x42D0B857 + ); + + /** + * Precomputed invMixColumns table + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $dt2 = array( + 0xA75051F4, 0x65537E41, 0xA4C31A17, 0x5E963A27, 0x6BCB3BAB, 0x45F11F9D, 0x58ABACFA, 0x03934BE3, + 0xFA552030, 0x6DF6AD76, 0x769188CC, 0x4C25F502, 0xD7FC4FE5, 0xCBD7C52A, 0x44802635, 0xA38FB562, + 0x5A49DEB1, 0x1B6725BA, 0x0E9845EA, 0xC0E15DFE, 0x7502C32F, 0xF012814C, 0x97A38D46, 0xF9C66BD3, + 0x5FE7038F, 0x9C951592, 0x7AEBBF6D, 0x59DA9552, 0x832DD4BE, 0x21D35874, 0x692949E0, 0xC8448EC9, + 0x896A75C2, 0x7978F48E, 0x3E6B9958, 0x71DD27B9, 0x4FB6BEE1, 0xAD17F088, 0xAC66C920, 0x3AB47DCE, + 0x4A1863DF, 0x3182E51A, 0x33609751, 0x7F456253, 0x77E0B164, 0xAE84BB6B, 0xA01CFE81, 0x2B94F908, + 0x68587048, 0xFD198F45, 0x6C8794DE, 0xF8B7527B, 0xD323AB73, 0x02E2724B, 0x8F57E31F, 0xAB2A6655, + 0x2807B2EB, 0xC2032FB5, 0x7B9A86C5, 0x08A5D337, 0x87F23028, 0xA5B223BF, 0x6ABA0203, 0x825CED16, + 0x1C2B8ACF, 0xB492A779, 0xF2F0F307, 0xE2A14E69, 0xF4CD65DA, 0xBED50605, 0x621FD134, 0xFE8AC4A6, + 0x539D342E, 0x55A0A2F3, 0xE132058A, 0xEB75A4F6, 0xEC390B83, 0xEFAA4060, 0x9F065E71, 0x1051BD6E, + 0x8AF93E21, 0x063D96DD, 0x05AEDD3E, 0xBD464DE6, 0x8DB59154, 0x5D0571C4, 0xD46F0406, 0x15FF6050, + 0xFB241998, 0xE997D6BD, 0x43CC8940, 0x9E7767D9, 0x42BDB0E8, 0x8B880789, 0x5B38E719, 0xEEDB79C8, + 0x0A47A17C, 0x0FE97C42, 0x1EC9F884, 0x00000000, 0x86830980, 0xED48322B, 0x70AC1E11, 0x724E6C5A, + 0xFFFBFD0E, 0x38560F85, 0xD51E3DAE, 0x3927362D, 0xD9640A0F, 0xA621685C, 0x54D19B5B, 0x2E3A2436, + 0x67B10C0A, 0xE70F9357, 0x96D2B4EE, 0x919E1B9B, 0xC54F80C0, 0x20A261DC, 0x4B695A77, 0x1A161C12, + 0xBA0AE293, 0x2AE5C0A0, 0xE0433C22, 0x171D121B, 0x0D0B0E09, 0xC7ADF28B, 0xA8B92DB6, 0xA9C8141E, + 0x198557F1, 0x074CAF75, 0xDDBBEE99, 0x60FDA37F, 0x269FF701, 0xF5BC5C72, 0x3BC54466, 0x7E345BFB, + 0x29768B43, 0xC6DCCB23, 0xFC68B6ED, 0xF163B8E4, 0xDCCAD731, 0x85104263, 0x22401397, 0x112084C6, + 0x247D854A, 0x3DF8D2BB, 0x3211AEF9, 0xA16DC729, 0x2F4B1D9E, 0x30F3DCB2, 0x52EC0D86, 0xE3D077C1, + 0x166C2BB3, 0xB999A970, 0x48FA1194, 0x642247E9, 0x8CC4A8FC, 0x3F1AA0F0, 0x2CD8567D, 0x90EF2233, + 0x4EC78749, 0xD1C1D938, 0xA2FE8CCA, 0x0B3698D4, 0x81CFA6F5, 0xDE28A57A, 0x8E26DAB7, 0xBFA43FAD, + 0x9DE42C3A, 0x920D5078, 0xCC9B6A5F, 0x4662547E, 0x13C2F68D, 0xB8E890D8, 0xF75E2E39, 0xAFF582C3, + 0x80BE9F5D, 0x937C69D0, 0x2DA96FD5, 0x12B3CF25, 0x993BC8AC, 0x7DA71018, 0x636EE89C, 0xBB7BDB3B, + 0x7809CD26, 0x18F46E59, 0xB701EC9A, 0x9AA8834F, 0x6E65E695, 0xE67EAAFF, 0xCF0821BC, 0xE8E6EF15, + 0x9BD9BAE7, 0x36CE4A6F, 0x09D4EA9F, 0x7CD629B0, 0xB2AF31A4, 0x23312A3F, 0x9430C6A5, 0x66C035A2, + 0xBC37744E, 0xCAA6FC82, 0xD0B0E090, 0xD81533A7, 0x984AF104, 0xDAF741EC, 0x500E7FCD, 0xF62F1791, + 0xD68D764D, 0xB04D43EF, 0x4D54CCAA, 0x04DFE496, 0xB5E39ED1, 0x881B4C6A, 0x1FB8C12C, 0x517F4665, + 0xEA049D5E, 0x355D018C, 0x7473FA87, 0x412EFB0B, 0x1D5AB367, 0xD25292DB, 0x5633E910, 0x47136DD6, + 0x618C9AD7, 0x0C7A37A1, 0x148E59F8, 0x3C89EB13, 0x27EECEA9, 0xC935B761, 0xE5EDE11C, 0xB13C7A47, + 0xDF599CD2, 0x733F55F2, 0xCE791814, 0x37BF73C7, 0xCDEA53F7, 0xAA5B5FFD, 0x6F14DF3D, 0xDB867844, + 0xF381CAAF, 0xC43EB968, 0x342C3824, 0x405FC2A3, 0xC372161D, 0x250CBCE2, 0x498B283C, 0x9541FF0D, + 0x017139A8, 0xB3DE080C, 0xE49CD8B4, 0xC1906456, 0x84617BCB, 0xB670D532, 0x5C74486C, 0x5742D0B8 + ); + + /** + * Precomputed invMixColumns table + * + * @see Crypt_Rijndael:_encryptBlock() + * @see Crypt_Rijndael:_decryptBlock() + * @var Array + * @access private + */ + var $dt3 = array( + 0xF4A75051, 0x4165537E, 0x17A4C31A, 0x275E963A, 0xAB6BCB3B, 0x9D45F11F, 0xFA58ABAC, 0xE303934B, + 0x30FA5520, 0x766DF6AD, 0xCC769188, 0x024C25F5, 0xE5D7FC4F, 0x2ACBD7C5, 0x35448026, 0x62A38FB5, + 0xB15A49DE, 0xBA1B6725, 0xEA0E9845, 0xFEC0E15D, 0x2F7502C3, 0x4CF01281, 0x4697A38D, 0xD3F9C66B, + 0x8F5FE703, 0x929C9515, 0x6D7AEBBF, 0x5259DA95, 0xBE832DD4, 0x7421D358, 0xE0692949, 0xC9C8448E, + 0xC2896A75, 0x8E7978F4, 0x583E6B99, 0xB971DD27, 0xE14FB6BE, 0x88AD17F0, 0x20AC66C9, 0xCE3AB47D, + 0xDF4A1863, 0x1A3182E5, 0x51336097, 0x537F4562, 0x6477E0B1, 0x6BAE84BB, 0x81A01CFE, 0x082B94F9, + 0x48685870, 0x45FD198F, 0xDE6C8794, 0x7BF8B752, 0x73D323AB, 0x4B02E272, 0x1F8F57E3, 0x55AB2A66, + 0xEB2807B2, 0xB5C2032F, 0xC57B9A86, 0x3708A5D3, 0x2887F230, 0xBFA5B223, 0x036ABA02, 0x16825CED, + 0xCF1C2B8A, 0x79B492A7, 0x07F2F0F3, 0x69E2A14E, 0xDAF4CD65, 0x05BED506, 0x34621FD1, 0xA6FE8AC4, + 0x2E539D34, 0xF355A0A2, 0x8AE13205, 0xF6EB75A4, 0x83EC390B, 0x60EFAA40, 0x719F065E, 0x6E1051BD, + 0x218AF93E, 0xDD063D96, 0x3E05AEDD, 0xE6BD464D, 0x548DB591, 0xC45D0571, 0x06D46F04, 0x5015FF60, + 0x98FB2419, 0xBDE997D6, 0x4043CC89, 0xD99E7767, 0xE842BDB0, 0x898B8807, 0x195B38E7, 0xC8EEDB79, + 0x7C0A47A1, 0x420FE97C, 0x841EC9F8, 0x00000000, 0x80868309, 0x2BED4832, 0x1170AC1E, 0x5A724E6C, + 0x0EFFFBFD, 0x8538560F, 0xAED51E3D, 0x2D392736, 0x0FD9640A, 0x5CA62168, 0x5B54D19B, 0x362E3A24, + 0x0A67B10C, 0x57E70F93, 0xEE96D2B4, 0x9B919E1B, 0xC0C54F80, 0xDC20A261, 0x774B695A, 0x121A161C, + 0x93BA0AE2, 0xA02AE5C0, 0x22E0433C, 0x1B171D12, 0x090D0B0E, 0x8BC7ADF2, 0xB6A8B92D, 0x1EA9C814, + 0xF1198557, 0x75074CAF, 0x99DDBBEE, 0x7F60FDA3, 0x01269FF7, 0x72F5BC5C, 0x663BC544, 0xFB7E345B, + 0x4329768B, 0x23C6DCCB, 0xEDFC68B6, 0xE4F163B8, 0x31DCCAD7, 0x63851042, 0x97224013, 0xC6112084, + 0x4A247D85, 0xBB3DF8D2, 0xF93211AE, 0x29A16DC7, 0x9E2F4B1D, 0xB230F3DC, 0x8652EC0D, 0xC1E3D077, + 0xB3166C2B, 0x70B999A9, 0x9448FA11, 0xE9642247, 0xFC8CC4A8, 0xF03F1AA0, 0x7D2CD856, 0x3390EF22, + 0x494EC787, 0x38D1C1D9, 0xCAA2FE8C, 0xD40B3698, 0xF581CFA6, 0x7ADE28A5, 0xB78E26DA, 0xADBFA43F, + 0x3A9DE42C, 0x78920D50, 0x5FCC9B6A, 0x7E466254, 0x8D13C2F6, 0xD8B8E890, 0x39F75E2E, 0xC3AFF582, + 0x5D80BE9F, 0xD0937C69, 0xD52DA96F, 0x2512B3CF, 0xAC993BC8, 0x187DA710, 0x9C636EE8, 0x3BBB7BDB, + 0x267809CD, 0x5918F46E, 0x9AB701EC, 0x4F9AA883, 0x956E65E6, 0xFFE67EAA, 0xBCCF0821, 0x15E8E6EF, + 0xE79BD9BA, 0x6F36CE4A, 0x9F09D4EA, 0xB07CD629, 0xA4B2AF31, 0x3F23312A, 0xA59430C6, 0xA266C035, + 0x4EBC3774, 0x82CAA6FC, 0x90D0B0E0, 0xA7D81533, 0x04984AF1, 0xECDAF741, 0xCD500E7F, 0x91F62F17, + 0x4DD68D76, 0xEFB04D43, 0xAA4D54CC, 0x9604DFE4, 0xD1B5E39E, 0x6A881B4C, 0x2C1FB8C1, 0x65517F46, + 0x5EEA049D, 0x8C355D01, 0x877473FA, 0x0B412EFB, 0x671D5AB3, 0xDBD25292, 0x105633E9, 0xD647136D, + 0xD7618C9A, 0xA10C7A37, 0xF8148E59, 0x133C89EB, 0xA927EECE, 0x61C935B7, 0x1CE5EDE1, 0x47B13C7A, + 0xD2DF599C, 0xF2733F55, 0x14CE7918, 0xC737BF73, 0xF7CDEA53, 0xFDAA5B5F, 0x3D6F14DF, 0x44DB8678, + 0xAFF381CA, 0x68C43EB9, 0x24342C38, 0xA3405FC2, 0x1DC37216, 0xE2250CBC, 0x3C498B28, 0x0D9541FF, + 0xA8017139, 0x0CB3DE08, 0xB4E49CD8, 0x56C19064, 0xCB84617B, 0x32B670D5, 0x6C5C7448, 0xB85742D0 + ); + + /** + * The SubByte S-Box + * + * @see Crypt_Rijndael::_encryptBlock() + * @var Array + * @access private + */ + var $sbox = array( + 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, + 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0, + 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC, 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, + 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75, + 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, + 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF, + 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, + 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2, + 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73, + 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, + 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79, + 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, + 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A, + 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E, 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, + 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF, + 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 + ); + + /** + * The inverse SubByte S-Box + * + * @see Crypt_Rijndael::_decryptBlock() + * @var Array + * @access private + */ + var $isbox = array( + 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5, 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, + 0x7C, 0xE3, 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4, 0xDE, 0xE9, 0xCB, + 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D, 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, + 0x08, 0x2E, 0xA1, 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B, 0xD1, 0x25, + 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4, 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, + 0x6C, 0x70, 0x48, 0x50, 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D, 0x84, + 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4, 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, + 0xD0, 0x2C, 0x1E, 0x8F, 0xCA, 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B, + 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF, 0xCE, 0xF0, 0xB4, 0xE6, 0x73, + 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD, 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, + 0x47, 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E, 0xAA, 0x18, 0xBE, 0x1B, + 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79, 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, + 0x1F, 0xDD, 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xEC, 0x5F, + 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D, 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, + 0xA0, 0xE0, 0x3B, 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53, 0x99, 0x61, + 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D + ); + + /** + * Default Constructor. + * + * Determines whether or not the mcrypt extension should be used. + * + * $mode could be: + * + * - CRYPT_RIJNDAEL_MODE_ECB + * + * - CRYPT_RIJNDAEL_MODE_CBC + * + * - CRYPT_RIJNDAEL_MODE_CTR + * + * - CRYPT_RIJNDAEL_MODE_CFB + * + * - CRYPT_RIJNDAEL_MODE_OFB + * + * If not explictly set, CRYPT_RIJNDAEL_MODE_CBC will be used. + * + * @see Crypt_Base::Crypt_Base() + * @param optional Integer $mode + * @access public + */ + function Crypt_Rijndael($mode = CRYPT_RIJNDAEL_MODE_CBC) + { + parent::Crypt_Base($mode); + } + + /** + * Sets the key. + * + * Keys can be of any length. Rijndael, itself, requires the use of a key that's between 128-bits and 256-bits long and + * whose length is a multiple of 32. If the key is less than 256-bits and the key length isn't set, we round the length + * up to the closest valid key length, padding $key with null bytes. If the key is more than 256-bits, we trim the + * excess bits. + * + * If the key is not explicitly set, it'll be assumed to be all null bytes. + * + * Note: 160/224-bit keys must explicitly set by setKeyLength(), otherwise they will be round/pad up to 192/256 bits. + * + * @see Crypt_Base:setKey() + * @see setKeyLength() + * @access public + * @param String $key + */ + function setKey($key) + { + parent::setKey($key); + + if (!$this->explicit_key_length) { + $length = strlen($key); + switch (true) { + case $length <= 16: + $this->key_size = 16; + break; + case $length <= 24: + $this->key_size = 24; + break; + default: + $this->key_size = 32; + } + $this->_setupEngine(); + } + } + + /** + * Sets the key length + * + * Valid key lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to + * 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount. + * + * Note: phpseclib extends Rijndael (and AES) for using 160- and 224-bit keys but they are officially not defined + * and the most (if not all) implementations are not able using 160/224-bit keys but round/pad them up to + * 192/256 bits as, for example, mcrypt will do. + * + * That said, if you want be compatible with other Rijndael and AES implementations, + * you should not setKeyLength(160) or setKeyLength(224). + * + * Additional: In case of 160- and 224-bit keys, phpseclib will/can, for that reason, not use + * the mcrypt php extention, even if available. + * This results then in slower encryption. + * + * @access public + * @param Integer $length + */ + function setKeyLength($length) + { + switch (true) { + case $length == 160: + $this->key_size = 20; + break; + case $length == 224: + $this->key_size = 28; + break; + case $length <= 128: + $this->key_size = 16; + break; + case $length <= 192: + $this->key_size = 24; + break; + default: + $this->key_size = 32; + } + + $this->explicit_key_length = true; + $this->changed = true; + $this->_setupEngine(); + } + + /** + * Sets the block length + * + * Valid block lengths are 128, 160, 192, 224, and 256. If the length is less than 128, it will be rounded up to + * 128. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount. + * + * @access public + * @param Integer $length + */ + function setBlockLength($length) + { + $length >>= 5; + if ($length > 8) { + $length = 8; + } else if ($length < 4) { + $length = 4; + } + $this->Nb = $length; + $this->block_size = $length << 2; + $this->changed = true; + $this->_setupEngine(); + } + + /** + * Setup the fastest possible $engine + * + * Determines if the mcrypt (MODE_MCRYPT) $engine available + * and usable for the current $block_size and $key_size. + * + * If not, the slower MODE_INTERNAL $engine will be set. + * + * @see setKey() + * @see setKeyLength() + * @see setBlockLength() + * @access private + */ + function _setupEngine() + { + if (constant('CRYPT_' . $this->const_namespace . '_MODE') == CRYPT_MODE_INTERNAL) { + // No mcrypt support at all for rijndael + return; + } + + // The required mcrypt module name for the current $block_size of rijndael + $cipher_name_mcrypt = 'rijndael-' . ($this->block_size << 3); + + // Determining the availibility/usability of $cipher_name_mcrypt + switch (true) { + case $this->key_size % 8: // mcrypt is not usable for 160/224-bit keys, only for 128/192/256-bit keys + case !in_array($cipher_name_mcrypt, mcrypt_list_algorithms()): // $cipher_name_mcrypt is not available for the current $block_size + $engine = CRYPT_MODE_INTERNAL; + break; + default: + $engine = CRYPT_MODE_MCRYPT; + } + + if ($this->engine == $engine && $this->cipher_name_mcrypt == $cipher_name_mcrypt) { + // allready set, so we not unnecessary close $this->enmcrypt/demcrypt/ecb + return; + } + + // Set the $engine + $this->engine = $engine; + $this->cipher_name_mcrypt = $cipher_name_mcrypt; + + if ($this->enmcrypt) { + // Closing the current mcrypt resource(s). _mcryptSetup() will, if needed, + // (re)open them with the module named in $this->cipher_name_mcrypt + mcrypt_module_close($this->enmcrypt); + mcrypt_module_close($this->demcrypt); + $this->enmcrypt = null; + $this->demcrypt = null; + + if ($this->ecb) { + mcrypt_module_close($this->ecb); + $this->ecb = null; + } + } + } + + /** + * Setup the CRYPT_MODE_MCRYPT $engine + * + * @see Crypt_Base::_setupMcrypt() + * @access private + */ + function _setupMcrypt() + { + $this->key = str_pad(substr($this->key, 0, $this->key_size), $this->key_size, "\0"); + parent::_setupMcrypt(); + } + + /** + * Encrypts a block + * + * @access private + * @param String $in + * @return String + */ + function _encryptBlock($in) + { + static $t0, $t1, $t2, $t3, $sbox; + if (!$t0) { + for ($i = 0; $i < 256; ++$i) { + $t0[] = (int)$this->t0[$i]; + $t1[] = (int)$this->t1[$i]; + $t2[] = (int)$this->t2[$i]; + $t3[] = (int)$this->t3[$i]; + $sbox[] = (int)$this->sbox[$i]; + } + } + + $state = array(); + $words = unpack('N*', $in); + + $c = $this->c; + $w = $this->w; + $Nb = $this->Nb; + $Nr = $this->Nr; + + // addRoundKey + $i = -1; + foreach ($words as $word) { + $state[] = $word ^ $w[0][++$i]; + } + + // fips-197.pdf#page=19, "Figure 5. Pseudo Code for the Cipher", states that this loop has four components - + // subBytes, shiftRows, mixColumns, and addRoundKey. fips-197.pdf#page=30, "Implementation Suggestions Regarding + // Various Platforms" suggests that performs enhanced implementations are described in Rijndael-ammended.pdf. + // Rijndael-ammended.pdf#page=20, "Implementation aspects / 32-bit processor", discusses such an optimization. + // Unfortunately, the description given there is not quite correct. Per aes.spec.v316.pdf#page=19 [1], + // equation (7.4.7) is supposed to use addition instead of subtraction, so we'll do that here, as well. + + // [1] http://fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.v316.pdf + $temp = array(); + for ($round = 1; $round < $Nr; ++$round) { + $i = 0; // $c[0] == 0 + $j = $c[1]; + $k = $c[2]; + $l = $c[3]; + + while ($i < $Nb) { + $temp[$i] = $t0[$state[$i] >> 24 & 0x000000FF] ^ + $t1[$state[$j] >> 16 & 0x000000FF] ^ + $t2[$state[$k] >> 8 & 0x000000FF] ^ + $t3[$state[$l] & 0x000000FF] ^ + $w[$round][$i]; + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + $state = $temp; + } + + // subWord + for ($i = 0; $i < $Nb; ++$i) { + $state[$i] = $sbox[$state[$i] & 0x000000FF] | + ($sbox[$state[$i] >> 8 & 0x000000FF] << 8) | + ($sbox[$state[$i] >> 16 & 0x000000FF] << 16) | + ($sbox[$state[$i] >> 24 & 0x000000FF] << 24); + } + + // shiftRows + addRoundKey + $i = 0; // $c[0] == 0 + $j = $c[1]; + $k = $c[2]; + $l = $c[3]; + while ($i < $Nb) { + $temp[$i] = ($state[$i] & 0xFF000000) ^ + ($state[$j] & 0x00FF0000) ^ + ($state[$k] & 0x0000FF00) ^ + ($state[$l] & 0x000000FF) ^ + $w[$Nr][$i]; + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + + switch ($Nb) { + case 8: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]); + case 7: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]); + case 6: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]); + case 5: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]); + default: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]); + } + } + + /** + * Decrypts a block + * + * @access private + * @param String $in + * @return String + */ + function _decryptBlock($in) + { + static $dt0, $dt1, $dt2, $dt3, $isbox; + if (!$dt0) { + for ($i = 0; $i < 256; ++$i) { + $dt0[] = (int)$this->dt0[$i]; + $dt1[] = (int)$this->dt1[$i]; + $dt2[] = (int)$this->dt2[$i]; + $dt3[] = (int)$this->dt3[$i]; + $isbox[] = (int)$this->isbox[$i]; + } + } + + $state = array(); + $words = unpack('N*', $in); + + $c = $this->c; + $dw = $this->dw; + $Nb = $this->Nb; + $Nr = $this->Nr; + + // addRoundKey + $i = -1; + foreach ($words as $word) { + $state[] = $word ^ $dw[$Nr][++$i]; + } + + $temp = array(); + for ($round = $Nr - 1; $round > 0; --$round) { + $i = 0; // $c[0] == 0 + $j = $Nb - $c[1]; + $k = $Nb - $c[2]; + $l = $Nb - $c[3]; + + while ($i < $Nb) { + $temp[$i] = $dt0[$state[$i] >> 24 & 0x000000FF] ^ + $dt1[$state[$j] >> 16 & 0x000000FF] ^ + $dt2[$state[$k] >> 8 & 0x000000FF] ^ + $dt3[$state[$l] & 0x000000FF] ^ + $dw[$round][$i]; + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + $state = $temp; + } + + // invShiftRows + invSubWord + addRoundKey + $i = 0; // $c[0] == 0 + $j = $Nb - $c[1]; + $k = $Nb - $c[2]; + $l = $Nb - $c[3]; + + while ($i < $Nb) { + $word = ($state[$i] & 0xFF000000) | + ($state[$j] & 0x00FF0000) | + ($state[$k] & 0x0000FF00) | + ($state[$l] & 0x000000FF); + + $temp[$i] = $dw[0][$i] ^ ($isbox[$word & 0x000000FF] | + ($isbox[$word >> 8 & 0x000000FF] << 8) | + ($isbox[$word >> 16 & 0x000000FF] << 16) | + ($isbox[$word >> 24 & 0x000000FF] << 24)); + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + + switch ($Nb) { + case 8: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6], $temp[7]); + case 7: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5], $temp[6]); + case 6: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4], $temp[5]); + case 5: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3], $temp[4]); + default: + return pack('N*', $temp[0], $temp[1], $temp[2], $temp[3]); + } + } + + /** + * Setup the key (expansion) + * + * @see Crypt_Base::_setupKey() + * @access private + */ + function _setupKey() + { + // Each number in $rcon is equal to the previous number multiplied by two in Rijndael's finite field. + // See http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse + static $rcon = array(0, + 0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000, + 0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000, + 0x6C000000, 0xD8000000, 0xAB000000, 0x4D000000, 0x9A000000, + 0x2F000000, 0x5E000000, 0xBC000000, 0x63000000, 0xC6000000, + 0x97000000, 0x35000000, 0x6A000000, 0xD4000000, 0xB3000000, + 0x7D000000, 0xFA000000, 0xEF000000, 0xC5000000, 0x91000000 + ); + + $this->key = str_pad(substr($this->key, 0, $this->key_size), $this->key_size, "\0"); + + if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_size === $this->kl['key_size'] && $this->block_size === $this->kl['block_size']) { + // already expanded + return; + } + $this->kl = array('key' => $this->key, 'key_size' => $this->key_size, 'block_size' => $this->block_size); + + $this->Nk = $this->key_size >> 2; + // see Rijndael-ammended.pdf#page=44 + $this->Nr = max($this->Nk, $this->Nb) + 6; + + // shift offsets for Nb = 5, 7 are defined in Rijndael-ammended.pdf#page=44, + // "Table 8: Shift offsets in Shiftrow for the alternative block lengths" + // shift offsets for Nb = 4, 6, 8 are defined in Rijndael-ammended.pdf#page=14, + // "Table 2: Shift offsets for different block lengths" + switch ($this->Nb) { + case 4: + case 5: + case 6: + $this->c = array(0, 1, 2, 3); + break; + case 7: + $this->c = array(0, 1, 2, 4); + break; + case 8: + $this->c = array(0, 1, 3, 4); + } + + $w = array_values(unpack('N*words', $this->key)); + + $length = $this->Nb * ($this->Nr + 1); + for ($i = $this->Nk; $i < $length; $i++) { + $temp = $w[$i - 1]; + if ($i % $this->Nk == 0) { + // according to <http://php.net/language.types.integer>, "the size of an integer is platform-dependent". + // on a 32-bit machine, it's 32-bits, and on a 64-bit machine, it's 64-bits. on a 32-bit machine, + // 0xFFFFFFFF << 8 == 0xFFFFFF00, but on a 64-bit machine, it equals 0xFFFFFFFF00. as such, doing 'and' + // with 0xFFFFFFFF (or 0xFFFFFF00) on a 32-bit machine is unnecessary, but on a 64-bit machine, it is. + $temp = (($temp << 8) & 0xFFFFFF00) | (($temp >> 24) & 0x000000FF); // rotWord + $temp = $this->_subWord($temp) ^ $rcon[$i / $this->Nk]; + } else if ($this->Nk > 6 && $i % $this->Nk == 4) { + $temp = $this->_subWord($temp); + } + $w[$i] = $w[$i - $this->Nk] ^ $temp; + } + + // convert the key schedule from a vector of $Nb * ($Nr + 1) length to a matrix with $Nr + 1 rows and $Nb columns + // and generate the inverse key schedule. more specifically, + // according to <http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf#page=23> (section 5.3.3), + // "The key expansion for the Inverse Cipher is defined as follows: + // 1. Apply the Key Expansion. + // 2. Apply InvMixColumn to all Round Keys except the first and the last one." + // also, see fips-197.pdf#page=27, "5.3.5 Equivalent Inverse Cipher" + $temp = $this->w = $this->dw = array(); + for ($i = $row = $col = 0; $i < $length; $i++, $col++) { + if ($col == $this->Nb) { + if ($row == 0) { + $this->dw[0] = $this->w[0]; + } else { + // subWord + invMixColumn + invSubWord = invMixColumn + $j = 0; + while ($j < $this->Nb) { + $dw = $this->_subWord($this->w[$row][$j]); + $temp[$j] = $this->dt0[$dw >> 24 & 0x000000FF] ^ + $this->dt1[$dw >> 16 & 0x000000FF] ^ + $this->dt2[$dw >> 8 & 0x000000FF] ^ + $this->dt3[$dw & 0x000000FF]; + $j++; + } + $this->dw[$row] = $temp; + } + + $col = 0; + $row++; + } + $this->w[$row][$col] = $w[$i]; + } + + $this->dw[$row] = $this->w[$row]; + + // In case of $this->use_inline_crypt === true we have to use 1-dim key arrays (both ascending) + if ($this->use_inline_crypt) { + $this->dw = array_reverse($this->dw); + $w = array_pop($this->w); + $dw = array_pop($this->dw); + foreach ($this->w as $r => $wr) { + foreach ($wr as $c => $wc) { + $w[] = $wc; + $dw[] = $this->dw[$r][$c]; + } + } + $this->w = $w; + $this->dw = $dw; + } + } + + /** + * Performs S-Box substitutions + * + * @access private + * @param Integer $word + */ + function _subWord($word) + { + $sbox = $this->sbox; + + return $sbox[$word & 0x000000FF] | + ($sbox[$word >> 8 & 0x000000FF] << 8) | + ($sbox[$word >> 16 & 0x000000FF] << 16) | + ($sbox[$word >> 24 & 0x000000FF] << 24); + } + + /** + * Setup the performance-optimized function for de/encrypt() + * + * @see Crypt_Base::_setupInlineCrypt() + * @access private + */ + function _setupInlineCrypt() + { + // Note: _setupInlineCrypt() will be called only if $this->changed === true + // So here we are'nt under the same heavy timing-stress as we are in _de/encryptBlock() or de/encrypt(). + // However...the here generated function- $code, stored as php callback in $this->inline_crypt, must work as fast as even possible. + + $lambda_functions =& Crypt_Rijndael::_getLambdaFunctions(); + + // The first 10 generated $lambda_functions will use the key-words hardcoded for better performance. + // For memory reason we limit those ultra-optimized functions. + // After that, we use pure (extracted) integer vars for the key-words which is faster than accessing them via array. + if (count($lambda_functions) < 10) { + $w = $this->w; + $dw = $this->dw; + $init_encrypt = ''; + $init_decrypt = ''; + } else { + for ($i = 0, $cw = count($this->w); $i < $cw; ++$i) { + $w[] = '$w[' . $i . ']'; + $dw[] = '$dw[' . $i . ']'; + } + $init_encrypt = '$w = $self->w;'; + $init_decrypt = '$dw = $self->dw;'; + } + + $code_hash = md5(str_pad("Crypt_Rijndael, {$this->mode}, {$this->block_size}, ", 32, "\0") . implode(',', $w)); + + if (!isset($lambda_functions[$code_hash])) { + $Nr = $this->Nr; + $Nb = $this->Nb; + $c = $this->c; + + // Generating encrypt code: + $init_encrypt.= ' + static $t0, $t1, $t2, $t3, $sbox; + if (!$t0) { + for ($i = 0; $i < 256; ++$i) { + $t0[$i] = (int)$self->t0[$i]; + $t1[$i] = (int)$self->t1[$i]; + $t2[$i] = (int)$self->t2[$i]; + $t3[$i] = (int)$self->t3[$i]; + $sbox[$i] = (int)$self->sbox[$i]; + } + } + '; + + $s = 'e'; + $e = 's'; + $wc = $Nb - 1; + + // Preround: addRoundKey + $encrypt_block = '$in = unpack("N*", $in);'."\n"; + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$w[++$wc].";\n"; + } + + // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey + for ($round = 1; $round < $Nr; ++$round) { + list($s, $e) = array($e, $s); + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block.= + '$'.$e.$i.' = + $t0[($'.$s.$i .' >> 24) & 0xff] ^ + $t1[($'.$s.(($i + $c[1]) % $Nb).' >> 16) & 0xff] ^ + $t2[($'.$s.(($i + $c[2]) % $Nb).' >> 8) & 0xff] ^ + $t3[ $'.$s.(($i + $c[3]) % $Nb).' & 0xff] ^ + '.$w[++$wc].";\n"; + } + } + + // Finalround: subWord + shiftRows + addRoundKey + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block.= + '$'.$e.$i.' = + $sbox[ $'.$e.$i.' & 0xff] | + ($sbox[($'.$e.$i.' >> 8) & 0xff] << 8) | + ($sbox[($'.$e.$i.' >> 16) & 0xff] << 16) | + ($sbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n"; + } + $encrypt_block .= '$in = pack("N*"'."\n"; + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block.= ', + ($'.$e.$i .' & 0xFF000000) ^ + ($'.$e.(($i + $c[1]) % $Nb).' & 0x00FF0000) ^ + ($'.$e.(($i + $c[2]) % $Nb).' & 0x0000FF00) ^ + ($'.$e.(($i + $c[3]) % $Nb).' & 0x000000FF) ^ + '.$w[$i]."\n"; + } + $encrypt_block .= ');'; + + // Generating decrypt code: + $init_decrypt.= ' + static $dt0, $dt1, $dt2, $dt3, $isbox; + if (!$dt0) { + for ($i = 0; $i < 256; ++$i) { + $dt0[$i] = (int)$self->dt0[$i]; + $dt1[$i] = (int)$self->dt1[$i]; + $dt2[$i] = (int)$self->dt2[$i]; + $dt3[$i] = (int)$self->dt3[$i]; + $isbox[$i] = (int)$self->isbox[$i]; + } + } + '; + + $s = 'e'; + $e = 's'; + $wc = $Nb - 1; + + // Preround: addRoundKey + $decrypt_block = '$in = unpack("N*", $in);'."\n"; + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block .= '$s'.$i.' = $in['.($i + 1).'] ^ '.$dw[++$wc].';'."\n"; + } + + // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey + for ($round = 1; $round < $Nr; ++$round) { + list($s, $e) = array($e, $s); + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block.= + '$'.$e.$i.' = + $dt0[($'.$s.$i .' >> 24) & 0xff] ^ + $dt1[($'.$s.(($Nb + $i - $c[1]) % $Nb).' >> 16) & 0xff] ^ + $dt2[($'.$s.(($Nb + $i - $c[2]) % $Nb).' >> 8) & 0xff] ^ + $dt3[ $'.$s.(($Nb + $i - $c[3]) % $Nb).' & 0xff] ^ + '.$dw[++$wc].";\n"; + } + } + + // Finalround: subWord + shiftRows + addRoundKey + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block.= + '$'.$e.$i.' = + $isbox[ $'.$e.$i.' & 0xff] | + ($isbox[($'.$e.$i.' >> 8) & 0xff] << 8) | + ($isbox[($'.$e.$i.' >> 16) & 0xff] << 16) | + ($isbox[($'.$e.$i.' >> 24) & 0xff] << 24);'."\n"; + } + $decrypt_block .= '$in = pack("N*"'."\n"; + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block.= ', + ($'.$e.$i. ' & 0xFF000000) ^ + ($'.$e.(($Nb + $i - $c[1]) % $Nb).' & 0x00FF0000) ^ + ($'.$e.(($Nb + $i - $c[2]) % $Nb).' & 0x0000FF00) ^ + ($'.$e.(($Nb + $i - $c[3]) % $Nb).' & 0x000000FF) ^ + '.$dw[$i]."\n"; + } + $decrypt_block .= ');'; + + $lambda_functions[$code_hash] = $this->_createInlineCryptFunction( + array( + 'init_crypt' => '', + 'init_encrypt' => $init_encrypt, + 'init_decrypt' => $init_decrypt, + 'encrypt_block' => $encrypt_block, + 'decrypt_block' => $decrypt_block + ) + ); + } + $this->inline_crypt = $lambda_functions[$code_hash]; + } +} + +// vim: ts=4:sw=4:et: +// vim6: fdl=1: diff --git a/inc/phpseclib/LICENSE b/inc/phpseclib/LICENSE new file mode 100644 index 000000000..6ecd9b9be --- /dev/null +++ b/inc/phpseclib/LICENSE @@ -0,0 +1,21 @@ +Copyright 2007-2012 TerraFrost and other contributors +http://phpseclib.sourceforge.net/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file diff --git a/inc/phpseclib/Math_BigInteger.php b/inc/phpseclib/Math_BigInteger.php new file mode 100644 index 000000000..a37662da9 --- /dev/null +++ b/inc/phpseclib/Math_BigInteger.php @@ -0,0 +1,3651 @@ +<?php +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Pure-PHP arbitrary precision integer arithmetic library. + * + * Supports base-2, base-10, base-16, and base-256 numbers. Uses the GMP or BCMath extensions, if available, + * and an internal implementation, otherwise. + * + * PHP versions 4 and 5 + * + * {@internal (all DocBlock comments regarding implementation - such as the one that follows - refer to the + * {@link MATH_BIGINTEGER_MODE_INTERNAL MATH_BIGINTEGER_MODE_INTERNAL} mode) + * + * Math_BigInteger uses base-2**26 to perform operations such as multiplication and division and + * base-2**52 (ie. two base 2**26 digits) to perform addition and subtraction. Because the largest possible + * value when multiplying two base-2**26 numbers together is a base-2**52 number, double precision floating + * point numbers - numbers that should be supported on most hardware and whose significand is 53 bits - are + * used. As a consequence, bitwise operators such as >> and << cannot be used, nor can the modulo operator %, + * which only supports integers. Although this fact will slow this library down, the fact that such a high + * base is being used should more than compensate. + * + * When PHP version 6 is officially released, we'll be able to use 64-bit integers. This should, once again, + * allow bitwise operators, and will increase the maximum possible base to 2**31 (or 2**62 for addition / + * subtraction). + * + * Numbers are stored in {@link http://en.wikipedia.org/wiki/Endianness little endian} format. ie. + * (new Math_BigInteger(pow(2, 26)))->value = array(0, 1) + * + * Useful resources are as follows: + * + * - {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf Handbook of Applied Cryptography (HAC)} + * - {@link http://math.libtomcrypt.com/files/tommath.pdf Multi-Precision Math (MPM)} + * - Java's BigInteger classes. See /j2se/src/share/classes/java/math in jdk-1_5_0-src-jrl.zip + * + * Here's an example of how to use this library: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger(2); + * $b = new Math_BigInteger(3); + * + * $c = $a->add($b); + * + * echo $c->toString(); // outputs 5 + * ?> + * </code> + * + * LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @category Math + * @package Math_BigInteger + * @author Jim Wigginton <terrafrost@php.net> + * @copyright MMVI Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ + +/**#@+ + * Reduction constants + * + * @access private + * @see Math_BigInteger::_reduce() + */ +/** + * @see Math_BigInteger::_montgomery() + * @see Math_BigInteger::_prepMontgomery() + */ +define('MATH_BIGINTEGER_MONTGOMERY', 0); +/** + * @see Math_BigInteger::_barrett() + */ +define('MATH_BIGINTEGER_BARRETT', 1); +/** + * @see Math_BigInteger::_mod2() + */ +define('MATH_BIGINTEGER_POWEROF2', 2); +/** + * @see Math_BigInteger::_remainder() + */ +define('MATH_BIGINTEGER_CLASSIC', 3); +/** + * @see Math_BigInteger::__clone() + */ +define('MATH_BIGINTEGER_NONE', 4); +/**#@-*/ + +/**#@+ + * Array constants + * + * Rather than create a thousands and thousands of new Math_BigInteger objects in repeated function calls to add() and + * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them. + * + * @access private + */ +/** + * $result[MATH_BIGINTEGER_VALUE] contains the value. + */ +define('MATH_BIGINTEGER_VALUE', 0); +/** + * $result[MATH_BIGINTEGER_SIGN] contains the sign. + */ +define('MATH_BIGINTEGER_SIGN', 1); +/**#@-*/ + +/**#@+ + * @access private + * @see Math_BigInteger::_montgomery() + * @see Math_BigInteger::_barrett() + */ +/** + * Cache constants + * + * $cache[MATH_BIGINTEGER_VARIABLE] tells us whether or not the cached data is still valid. + */ +define('MATH_BIGINTEGER_VARIABLE', 0); +/** + * $cache[MATH_BIGINTEGER_DATA] contains the cached data. + */ +define('MATH_BIGINTEGER_DATA', 1); +/**#@-*/ + +/**#@+ + * Mode constants. + * + * @access private + * @see Math_BigInteger::Math_BigInteger() + */ +/** + * To use the pure-PHP implementation + */ +define('MATH_BIGINTEGER_MODE_INTERNAL', 1); +/** + * To use the BCMath library + * + * (if enabled; otherwise, the internal implementation will be used) + */ +define('MATH_BIGINTEGER_MODE_BCMATH', 2); +/** + * To use the GMP library + * + * (if present; otherwise, either the BCMath or the internal implementation will be used) + */ +define('MATH_BIGINTEGER_MODE_GMP', 3); +/**#@-*/ + +/** + * Karatsuba Cutoff + * + * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication? + * + * @access private + */ +define('MATH_BIGINTEGER_KARATSUBA_CUTOFF', 25); + +/** + * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 + * numbers. + * + * @author Jim Wigginton <terrafrost@php.net> + * @version 1.0.0RC4 + * @access public + * @package Math_BigInteger + */ +class Math_BigInteger { + /** + * Holds the BigInteger's value. + * + * @var Array + * @access private + */ + var $value; + + /** + * Holds the BigInteger's magnitude. + * + * @var Boolean + * @access private + */ + var $is_negative = false; + + /** + * Random number generator function + * + * @see setRandomGenerator() + * @access private + */ + var $generator = 'mt_rand'; + + /** + * Precision + * + * @see setPrecision() + * @access private + */ + var $precision = -1; + + /** + * Precision Bitmask + * + * @see setPrecision() + * @access private + */ + var $bitmask = false; + + /** + * Mode independent value used for serialization. + * + * If the bcmath or gmp extensions are installed $this->value will be a non-serializable resource, hence the need for + * a variable that'll be serializable regardless of whether or not extensions are being used. Unlike $this->value, + * however, $this->hex is only calculated when $this->__sleep() is called. + * + * @see __sleep() + * @see __wakeup() + * @var String + * @access private + */ + var $hex; + + /** + * Converts base-2, base-10, base-16, and binary strings (base-256) to BigIntegers. + * + * If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using + * two's compliment. The sole exception to this is -10, which is treated the same as 10 is. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('0x32', 16); // 50 in base-16 + * + * echo $a->toString(); // outputs 50 + * ?> + * </code> + * + * @param optional $x base-10 number or base-$base number if $base set. + * @param optional integer $base + * @return Math_BigInteger + * @access public + */ + function Math_BigInteger($x = 0, $base = 10) + { + if ( !defined('MATH_BIGINTEGER_MODE') ) { + switch (true) { + case extension_loaded('gmp'): + define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP); + break; + case extension_loaded('bcmath'): + define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH); + break; + default: + define('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL); + } + } + + if (function_exists('openssl_public_encrypt') && !defined('MATH_BIGINTEGER_OPENSSL_DISABLE') && !defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) { + define('MATH_BIGINTEGER_OPENSSL_ENABLED', true); + } + + if (!defined('PHP_INT_SIZE')) { + define('PHP_INT_SIZE', 4); + } + + if (!defined('MATH_BIGINTEGER_BASE') && MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_INTERNAL) { + switch (PHP_INT_SIZE) { + case 8: // use 64-bit integers if int size is 8 bytes + define('MATH_BIGINTEGER_BASE', 31); + define('MATH_BIGINTEGER_BASE_FULL', 0x80000000); + define('MATH_BIGINTEGER_MAX_DIGIT', 0x7FFFFFFF); + define('MATH_BIGINTEGER_MSB', 0x40000000); + // 10**9 is the closest we can get to 2**31 without passing it + define('MATH_BIGINTEGER_MAX10', 1000000000); + define('MATH_BIGINTEGER_MAX10_LEN', 9); + // the largest digit that may be used in addition / subtraction + define('MATH_BIGINTEGER_MAX_DIGIT2', pow(2, 62)); + break; + //case 4: // use 64-bit floats if int size is 4 bytes + default: + define('MATH_BIGINTEGER_BASE', 26); + define('MATH_BIGINTEGER_BASE_FULL', 0x4000000); + define('MATH_BIGINTEGER_MAX_DIGIT', 0x3FFFFFF); + define('MATH_BIGINTEGER_MSB', 0x2000000); + // 10**7 is the closest to 2**26 without passing it + define('MATH_BIGINTEGER_MAX10', 10000000); + define('MATH_BIGINTEGER_MAX10_LEN', 7); + // the largest digit that may be used in addition / subtraction + // we do pow(2, 52) instead of using 4503599627370496 directly because some + // PHP installations will truncate 4503599627370496. + define('MATH_BIGINTEGER_MAX_DIGIT2', pow(2, 52)); + } + } + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + if (is_resource($x) && get_resource_type($x) == 'GMP integer') { + $this->value = $x; + return; + } + $this->value = gmp_init(0); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $this->value = '0'; + break; + default: + $this->value = array(); + } + + // '0' counts as empty() but when the base is 256 '0' is equal to ord('0') or 48 + // '0' is the only value like this per http://php.net/empty + if (empty($x) && (abs($base) != 256 || $x !== '0')) { + return; + } + + switch ($base) { + case -256: + if (ord($x[0]) & 0x80) { + $x = ~$x; + $this->is_negative = true; + } + case 256: + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $sign = $this->is_negative ? '-' : ''; + $this->value = gmp_init($sign . '0x' . bin2hex($x)); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + // round $len to the nearest 4 (thanks, DavidMJ!) + $len = (strlen($x) + 3) & 0xFFFFFFFC; + + $x = str_pad($x, $len, chr(0), STR_PAD_LEFT); + + for ($i = 0; $i < $len; $i+= 4) { + $this->value = bcmul($this->value, '4294967296', 0); // 4294967296 == 2**32 + $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + ((ord($x[$i + 1]) << 16) | (ord($x[$i + 2]) << 8) | ord($x[$i + 3])), 0); + } + + if ($this->is_negative) { + $this->value = '-' . $this->value; + } + + break; + // converts a base-2**8 (big endian / msb) number to base-2**26 (little endian / lsb) + default: + while (strlen($x)) { + $this->value[] = $this->_bytes2int($this->_base256_rshift($x, MATH_BIGINTEGER_BASE)); + } + } + + if ($this->is_negative) { + if (MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL) { + $this->is_negative = false; + } + $temp = $this->add(new Math_BigInteger('-1')); + $this->value = $temp->value; + } + break; + case 16: + case -16: + if ($base > 0 && $x[0] == '-') { + $this->is_negative = true; + $x = substr($x, 1); + } + + $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#', '$1', $x); + + $is_negative = false; + if ($base < 0 && hexdec($x[0]) >= 8) { + $this->is_negative = $is_negative = true; + $x = bin2hex(~pack('H*', $x)); + } + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = $this->is_negative ? '-0x' . $x : '0x' . $x; + $this->value = gmp_init($temp); + $this->is_negative = false; + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $x = ( strlen($x) & 1 ) ? '0' . $x : $x; + $temp = new Math_BigInteger(pack('H*', $x), 256); + $this->value = $this->is_negative ? '-' . $temp->value : $temp->value; + $this->is_negative = false; + break; + default: + $x = ( strlen($x) & 1 ) ? '0' . $x : $x; + $temp = new Math_BigInteger(pack('H*', $x), 256); + $this->value = $temp->value; + } + + if ($is_negative) { + $temp = $this->add(new Math_BigInteger('-1')); + $this->value = $temp->value; + } + break; + case 10: + case -10: + // (?<!^)(?:-).*: find any -'s that aren't at the beginning and then any characters that follow that + // (?<=^|-)0*: find any 0's that are preceded by the start of the string or by a - (ie. octals) + // [^-0-9].*: find any non-numeric characters and then any characters that follow that + $x = preg_replace('#(?<!^)(?:-).*|(?<=^|-)0*|[^-0-9].*#', '', $x); + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $this->value = gmp_init($x); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different + // results then doing it on '-1' does (modInverse does $x[0]) + $this->value = $x === '-' ? '0' : (string) $x; + break; + default: + $temp = new Math_BigInteger(); + + $multiplier = new Math_BigInteger(); + $multiplier->value = array(MATH_BIGINTEGER_MAX10); + + if ($x[0] == '-') { + $this->is_negative = true; + $x = substr($x, 1); + } + + $x = str_pad($x, strlen($x) + ((MATH_BIGINTEGER_MAX10_LEN - 1) * strlen($x)) % MATH_BIGINTEGER_MAX10_LEN, 0, STR_PAD_LEFT); + + while (strlen($x)) { + $temp = $temp->multiply($multiplier); + $temp = $temp->add(new Math_BigInteger($this->_int2bytes(substr($x, 0, MATH_BIGINTEGER_MAX10_LEN)), 256)); + $x = substr($x, MATH_BIGINTEGER_MAX10_LEN); + } + + $this->value = $temp->value; + } + break; + case 2: // base-2 support originally implemented by Lluis Pamies - thanks! + case -2: + if ($base > 0 && $x[0] == '-') { + $this->is_negative = true; + $x = substr($x, 1); + } + + $x = preg_replace('#^([01]*).*#', '$1', $x); + $x = str_pad($x, strlen($x) + (3 * strlen($x)) % 4, 0, STR_PAD_LEFT); + + $str = '0x'; + while (strlen($x)) { + $part = substr($x, 0, 4); + $str.= dechex(bindec($part)); + $x = substr($x, 4); + } + + if ($this->is_negative) { + $str = '-' . $str; + } + + $temp = new Math_BigInteger($str, 8 * $base); // ie. either -16 or +16 + $this->value = $temp->value; + $this->is_negative = $temp->is_negative; + + break; + default: + // base not supported, so we'll let $this == 0 + } + } + + /** + * Converts a BigInteger to a byte string (eg. base-256). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('65'); + * + * echo $a->toBytes(); // outputs chr(65) + * ?> + * </code> + * + * @param Boolean $twos_compliment + * @return String + * @access public + * @internal Converts a base-2**26 number to base-2**8 + */ + function toBytes($twos_compliment = false) + { + if ($twos_compliment) { + $comparison = $this->compare(new Math_BigInteger()); + if ($comparison == 0) { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + + $temp = $comparison < 0 ? $this->add(new Math_BigInteger(1)) : $this->copy(); + $bytes = $temp->toBytes(); + + if (empty($bytes)) { // eg. if the number we're trying to convert is -1 + $bytes = chr(0); + } + + if (ord($bytes[0]) & 0x80) { + $bytes = chr(0) . $bytes; + } + + return $comparison < 0 ? ~$bytes : $bytes; + } + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + if (gmp_cmp($this->value, gmp_init(0)) == 0) { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + + $temp = gmp_strval(gmp_abs($this->value), 16); + $temp = ( strlen($temp) & 1 ) ? '0' . $temp : $temp; + $temp = pack('H*', $temp); + + return $this->precision > 0 ? + substr(str_pad($temp, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : + ltrim($temp, chr(0)); + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value === '0') { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + + $value = ''; + $current = $this->value; + + if ($current[0] == '-') { + $current = substr($current, 1); + } + + while (bccomp($current, '0', 0) > 0) { + $temp = bcmod($current, '16777216'); + $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value; + $current = bcdiv($current, '16777216', 0); + } + + return $this->precision > 0 ? + substr(str_pad($value, $this->precision >> 3, chr(0), STR_PAD_LEFT), -($this->precision >> 3)) : + ltrim($value, chr(0)); + } + + if (!count($this->value)) { + return $this->precision > 0 ? str_repeat(chr(0), ($this->precision + 1) >> 3) : ''; + } + $result = $this->_int2bytes($this->value[count($this->value) - 1]); + + $temp = $this->copy(); + + for ($i = count($temp->value) - 2; $i >= 0; --$i) { + $temp->_base256_lshift($result, MATH_BIGINTEGER_BASE); + $result = $result | str_pad($temp->_int2bytes($temp->value[$i]), strlen($result), chr(0), STR_PAD_LEFT); + } + + return $this->precision > 0 ? + str_pad(substr($result, -(($this->precision + 7) >> 3)), ($this->precision + 7) >> 3, chr(0), STR_PAD_LEFT) : + $result; + } + + /** + * Converts a BigInteger to a hex string (eg. base-16)). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('65'); + * + * echo $a->toHex(); // outputs '41' + * ?> + * </code> + * + * @param Boolean $twos_compliment + * @return String + * @access public + * @internal Converts a base-2**26 number to base-2**8 + */ + function toHex($twos_compliment = false) + { + return bin2hex($this->toBytes($twos_compliment)); + } + + /** + * Converts a BigInteger to a bit string (eg. base-2). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('65'); + * + * echo $a->toBits(); // outputs '1000001' + * ?> + * </code> + * + * @param Boolean $twos_compliment + * @return String + * @access public + * @internal Converts a base-2**26 number to base-2**2 + */ + function toBits($twos_compliment = false) + { + $hex = $this->toHex($twos_compliment); + $bits = ''; + for ($i = strlen($hex) - 8, $start = strlen($hex) & 7; $i >= $start; $i-=8) { + $bits = str_pad(decbin(hexdec(substr($hex, $i, 8))), 32, '0', STR_PAD_LEFT) . $bits; + } + if ($start) { // hexdec('') == 0 + $bits = str_pad(decbin(hexdec(substr($hex, 0, $start))), 8, '0', STR_PAD_LEFT) . $bits; + } + $result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0'); + + if ($twos_compliment && $this->compare(new Math_BigInteger()) > 0 && $this->precision <= 0) { + return '0' . $result; + } + + return $result; + } + + /** + * Converts a BigInteger to a base-10 number. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('50'); + * + * echo $a->toString(); // outputs 50 + * ?> + * </code> + * + * @return String + * @access public + * @internal Converts a base-2**26 number to base-10**7 (which is pretty much base-10) + */ + function toString() + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_strval($this->value); + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value === '0') { + return '0'; + } + + return ltrim($this->value, '0'); + } + + if (!count($this->value)) { + return '0'; + } + + $temp = $this->copy(); + $temp->is_negative = false; + + $divisor = new Math_BigInteger(); + $divisor->value = array(MATH_BIGINTEGER_MAX10); + $result = ''; + while (count($temp->value)) { + list($temp, $mod) = $temp->divide($divisor); + $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', MATH_BIGINTEGER_MAX10_LEN, '0', STR_PAD_LEFT) . $result; + } + $result = ltrim($result, '0'); + if (empty($result)) { + $result = '0'; + } + + if ($this->is_negative) { + $result = '-' . $result; + } + + return $result; + } + + /** + * Copy an object + * + * PHP5 passes objects by reference while PHP4 passes by value. As such, we need a function to guarantee + * that all objects are passed by value, when appropriate. More information can be found here: + * + * {@link http://php.net/language.oop5.basic#51624} + * + * @access public + * @see __clone() + * @return Math_BigInteger + */ + function copy() + { + $temp = new Math_BigInteger(); + $temp->value = $this->value; + $temp->is_negative = $this->is_negative; + $temp->generator = $this->generator; + $temp->precision = $this->precision; + $temp->bitmask = $this->bitmask; + return $temp; + } + + /** + * __toString() magic method + * + * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call + * toString(). + * + * @access public + * @internal Implemented per a suggestion by Techie-Michael - thanks! + */ + function __toString() + { + return $this->toString(); + } + + /** + * __clone() magic method + * + * Although you can call Math_BigInteger::__toString() directly in PHP5, you cannot call Math_BigInteger::__clone() + * directly in PHP5. You can in PHP4 since it's not a magic method, but in PHP5, you have to call it by using the PHP5 + * only syntax of $y = clone $x. As such, if you're trying to write an application that works on both PHP4 and PHP5, + * call Math_BigInteger::copy(), instead. + * + * @access public + * @see copy() + * @return Math_BigInteger + */ + function __clone() + { + return $this->copy(); + } + + /** + * __sleep() magic method + * + * Will be called, automatically, when serialize() is called on a Math_BigInteger object. + * + * @see __wakeup() + * @access public + */ + function __sleep() + { + $this->hex = $this->toHex(true); + $vars = array('hex'); + if ($this->generator != 'mt_rand') { + $vars[] = 'generator'; + } + if ($this->precision > 0) { + $vars[] = 'precision'; + } + return $vars; + + } + + /** + * __wakeup() magic method + * + * Will be called, automatically, when unserialize() is called on a Math_BigInteger object. + * + * @see __sleep() + * @access public + */ + function __wakeup() + { + $temp = new Math_BigInteger($this->hex, -16); + $this->value = $temp->value; + $this->is_negative = $temp->is_negative; + $this->setRandomGenerator($this->generator); + if ($this->precision > 0) { + // recalculate $this->bitmask + $this->setPrecision($this->precision); + } + } + + /** + * Adds two BigIntegers. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('10'); + * $b = new Math_BigInteger('20'); + * + * $c = $a->add($b); + * + * echo $c->toString(); // outputs 30 + * ?> + * </code> + * + * @param Math_BigInteger $y + * @return Math_BigInteger + * @access public + * @internal Performs base-2**52 addition + */ + function add($y) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_add($this->value, $y->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $temp = new Math_BigInteger(); + $temp->value = bcadd($this->value, $y->value, 0); + + return $this->_normalize($temp); + } + + $temp = $this->_add($this->value, $this->is_negative, $y->value, $y->is_negative); + + $result = new Math_BigInteger(); + $result->value = $temp[MATH_BIGINTEGER_VALUE]; + $result->is_negative = $temp[MATH_BIGINTEGER_SIGN]; + + return $this->_normalize($result); + } + + /** + * Performs addition. + * + * @param Array $x_value + * @param Boolean $x_negative + * @param Array $y_value + * @param Boolean $y_negative + * @return Array + * @access private + */ + function _add($x_value, $x_negative, $y_value, $y_negative) + { + $x_size = count($x_value); + $y_size = count($y_value); + + if ($x_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $y_value, + MATH_BIGINTEGER_SIGN => $y_negative + ); + } else if ($y_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $x_value, + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + // subtract, if appropriate + if ( $x_negative != $y_negative ) { + if ( $x_value == $y_value ) { + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + $temp = $this->_subtract($x_value, false, $y_value, false); + $temp[MATH_BIGINTEGER_SIGN] = $this->_compare($x_value, false, $y_value, false) > 0 ? + $x_negative : $y_negative; + + return $temp; + } + + if ($x_size < $y_size) { + $size = $x_size; + $value = $y_value; + } else { + $size = $y_size; + $value = $x_value; + } + + $value[] = 0; // just in case the carry adds an extra digit + + $carry = 0; + for ($i = 0, $j = 1; $j < $size; $i+=2, $j+=2) { + $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] + $y_value[$j] * MATH_BIGINTEGER_BASE_FULL + $y_value[$i] + $carry; + $carry = $sum >= MATH_BIGINTEGER_MAX_DIGIT2; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 + $sum = $carry ? $sum - MATH_BIGINTEGER_MAX_DIGIT2 : $sum; + + $temp = (int) ($sum / MATH_BIGINTEGER_BASE_FULL); + + $value[$i] = (int) ($sum - MATH_BIGINTEGER_BASE_FULL * $temp); // eg. a faster alternative to fmod($sum, 0x4000000) + $value[$j] = $temp; + } + + if ($j == $size) { // ie. if $y_size is odd + $sum = $x_value[$i] + $y_value[$i] + $carry; + $carry = $sum >= MATH_BIGINTEGER_BASE_FULL; + $value[$i] = $carry ? $sum - MATH_BIGINTEGER_BASE_FULL : $sum; + ++$i; // ie. let $i = $j since we've just done $value[$i] + } + + if ($carry) { + for (; $value[$i] == MATH_BIGINTEGER_MAX_DIGIT; ++$i) { + $value[$i] = 0; + } + ++$value[$i]; + } + + return array( + MATH_BIGINTEGER_VALUE => $this->_trim($value), + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + /** + * Subtracts two BigIntegers. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('10'); + * $b = new Math_BigInteger('20'); + * + * $c = $a->subtract($b); + * + * echo $c->toString(); // outputs -10 + * ?> + * </code> + * + * @param Math_BigInteger $y + * @return Math_BigInteger + * @access public + * @internal Performs base-2**52 subtraction + */ + function subtract($y) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_sub($this->value, $y->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $temp = new Math_BigInteger(); + $temp->value = bcsub($this->value, $y->value, 0); + + return $this->_normalize($temp); + } + + $temp = $this->_subtract($this->value, $this->is_negative, $y->value, $y->is_negative); + + $result = new Math_BigInteger(); + $result->value = $temp[MATH_BIGINTEGER_VALUE]; + $result->is_negative = $temp[MATH_BIGINTEGER_SIGN]; + + return $this->_normalize($result); + } + + /** + * Performs subtraction. + * + * @param Array $x_value + * @param Boolean $x_negative + * @param Array $y_value + * @param Boolean $y_negative + * @return Array + * @access private + */ + function _subtract($x_value, $x_negative, $y_value, $y_negative) + { + $x_size = count($x_value); + $y_size = count($y_value); + + if ($x_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $y_value, + MATH_BIGINTEGER_SIGN => !$y_negative + ); + } else if ($y_size == 0) { + return array( + MATH_BIGINTEGER_VALUE => $x_value, + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + // add, if appropriate (ie. -$x - +$y or +$x - -$y) + if ( $x_negative != $y_negative ) { + $temp = $this->_add($x_value, false, $y_value, false); + $temp[MATH_BIGINTEGER_SIGN] = $x_negative; + + return $temp; + } + + $diff = $this->_compare($x_value, $x_negative, $y_value, $y_negative); + + if ( !$diff ) { + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + // switch $x and $y around, if appropriate. + if ( (!$x_negative && $diff < 0) || ($x_negative && $diff > 0) ) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + + $x_negative = !$x_negative; + + $x_size = count($x_value); + $y_size = count($y_value); + } + + // at this point, $x_value should be at least as big as - if not bigger than - $y_value + + $carry = 0; + for ($i = 0, $j = 1; $j < $y_size; $i+=2, $j+=2) { + $sum = $x_value[$j] * MATH_BIGINTEGER_BASE_FULL + $x_value[$i] - $y_value[$j] * MATH_BIGINTEGER_BASE_FULL - $y_value[$i] - $carry; + $carry = $sum < 0; // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 + $sum = $carry ? $sum + MATH_BIGINTEGER_MAX_DIGIT2 : $sum; + + $temp = (int) ($sum / MATH_BIGINTEGER_BASE_FULL); + + $x_value[$i] = (int) ($sum - MATH_BIGINTEGER_BASE_FULL * $temp); + $x_value[$j] = $temp; + } + + if ($j == $y_size) { // ie. if $y_size is odd + $sum = $x_value[$i] - $y_value[$i] - $carry; + $carry = $sum < 0; + $x_value[$i] = $carry ? $sum + MATH_BIGINTEGER_BASE_FULL : $sum; + ++$i; + } + + if ($carry) { + for (; !$x_value[$i]; ++$i) { + $x_value[$i] = MATH_BIGINTEGER_MAX_DIGIT; + } + --$x_value[$i]; + } + + return array( + MATH_BIGINTEGER_VALUE => $this->_trim($x_value), + MATH_BIGINTEGER_SIGN => $x_negative + ); + } + + /** + * Multiplies two BigIntegers + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('10'); + * $b = new Math_BigInteger('20'); + * + * $c = $a->multiply($b); + * + * echo $c->toString(); // outputs 200 + * ?> + * </code> + * + * @param Math_BigInteger $x + * @return Math_BigInteger + * @access public + */ + function multiply($x) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_mul($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $temp = new Math_BigInteger(); + $temp->value = bcmul($this->value, $x->value, 0); + + return $this->_normalize($temp); + } + + $temp = $this->_multiply($this->value, $this->is_negative, $x->value, $x->is_negative); + + $product = new Math_BigInteger(); + $product->value = $temp[MATH_BIGINTEGER_VALUE]; + $product->is_negative = $temp[MATH_BIGINTEGER_SIGN]; + + return $this->_normalize($product); + } + + /** + * Performs multiplication. + * + * @param Array $x_value + * @param Boolean $x_negative + * @param Array $y_value + * @param Boolean $y_negative + * @return Array + * @access private + */ + function _multiply($x_value, $x_negative, $y_value, $y_negative) + { + //if ( $x_value == $y_value ) { + // return array( + // MATH_BIGINTEGER_VALUE => $this->_square($x_value), + // MATH_BIGINTEGER_SIGN => $x_sign != $y_value + // ); + //} + + $x_length = count($x_value); + $y_length = count($y_value); + + if ( !$x_length || !$y_length ) { // a 0 is being multiplied + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + return array( + MATH_BIGINTEGER_VALUE => min($x_length, $y_length) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ? + $this->_trim($this->_regularMultiply($x_value, $y_value)) : + $this->_trim($this->_karatsuba($x_value, $y_value)), + MATH_BIGINTEGER_SIGN => $x_negative != $y_negative + ); + } + + /** + * Performs long multiplication on two BigIntegers + * + * Modeled after 'multiply' in MutableBigInteger.java. + * + * @param Array $x_value + * @param Array $y_value + * @return Array + * @access private + */ + function _regularMultiply($x_value, $y_value) + { + $x_length = count($x_value); + $y_length = count($y_value); + + if ( !$x_length || !$y_length ) { // a 0 is being multiplied + return array(); + } + + if ( $x_length < $y_length ) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + + $x_length = count($x_value); + $y_length = count($y_value); + } + + $product_value = $this->_array_repeat(0, $x_length + $y_length); + + // the following for loop could be removed if the for loop following it + // (the one with nested for loops) initially set $i to 0, but + // doing so would also make the result in one set of unnecessary adds, + // since on the outermost loops first pass, $product->value[$k] is going + // to always be 0 + + $carry = 0; + + for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0 + $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 + $carry = (int) ($temp / MATH_BIGINTEGER_BASE_FULL); + $product_value[$j] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + $product_value[$j] = $carry; + + // the above for loop is what the previous comment was talking about. the + // following for loop is the "one with nested for loops" + for ($i = 1; $i < $y_length; ++$i) { + $carry = 0; + + for ($j = 0, $k = $i; $j < $x_length; ++$j, ++$k) { + $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; + $carry = (int) ($temp / MATH_BIGINTEGER_BASE_FULL); + $product_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + $product_value[$k] = $carry; + } + + return $product_value; + } + + /** + * Performs Karatsuba multiplication on two BigIntegers + * + * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=120 MPM 5.2.3}. + * + * @param Array $x_value + * @param Array $y_value + * @return Array + * @access private + */ + function _karatsuba($x_value, $y_value) + { + $m = min(count($x_value) >> 1, count($y_value) >> 1); + + if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) { + return $this->_regularMultiply($x_value, $y_value); + } + + $x1 = array_slice($x_value, $m); + $x0 = array_slice($x_value, 0, $m); + $y1 = array_slice($y_value, $m); + $y0 = array_slice($y_value, 0, $m); + + $z2 = $this->_karatsuba($x1, $y1); + $z0 = $this->_karatsuba($x0, $y0); + + $z1 = $this->_add($x1, false, $x0, false); + $temp = $this->_add($y1, false, $y0, false); + $z1 = $this->_karatsuba($z1[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_VALUE]); + $temp = $this->_add($z2, false, $z0, false); + $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false); + + $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); + $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]); + + $xy = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]); + $xy = $this->_add($xy[MATH_BIGINTEGER_VALUE], $xy[MATH_BIGINTEGER_SIGN], $z0, false); + + return $xy[MATH_BIGINTEGER_VALUE]; + } + + /** + * Performs squaring + * + * @param Array $x + * @return Array + * @access private + */ + function _square($x = false) + { + return count($x) < 2 * MATH_BIGINTEGER_KARATSUBA_CUTOFF ? + $this->_trim($this->_baseSquare($x)) : + $this->_trim($this->_karatsubaSquare($x)); + } + + /** + * Performs traditional squaring on two BigIntegers + * + * Squaring can be done faster than multiplying a number by itself can be. See + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=7 HAC 14.2.4} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=141 MPM 5.3} for more information. + * + * @param Array $value + * @return Array + * @access private + */ + function _baseSquare($value) + { + if ( empty($value) ) { + return array(); + } + $square_value = $this->_array_repeat(0, 2 * count($value)); + + for ($i = 0, $max_index = count($value) - 1; $i <= $max_index; ++$i) { + $i2 = $i << 1; + + $temp = $square_value[$i2] + $value[$i] * $value[$i]; + $carry = (int) ($temp / MATH_BIGINTEGER_BASE_FULL); + $square_value[$i2] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + + // note how we start from $i+1 instead of 0 as we do in multiplication. + for ($j = $i + 1, $k = $i2 + 1; $j <= $max_index; ++$j, ++$k) { + $temp = $square_value[$k] + 2 * $value[$j] * $value[$i] + $carry; + $carry = (int) ($temp / MATH_BIGINTEGER_BASE_FULL); + $square_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + // the following line can yield values larger 2**15. at this point, PHP should switch + // over to floats. + $square_value[$i + $max_index + 1] = $carry; + } + + return $square_value; + } + + /** + * Performs Karatsuba "squaring" on two BigIntegers + * + * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=151 MPM 5.3.4}. + * + * @param Array $value + * @return Array + * @access private + */ + function _karatsubaSquare($value) + { + $m = count($value) >> 1; + + if ($m < MATH_BIGINTEGER_KARATSUBA_CUTOFF) { + return $this->_baseSquare($value); + } + + $x1 = array_slice($value, $m); + $x0 = array_slice($value, 0, $m); + + $z2 = $this->_karatsubaSquare($x1); + $z0 = $this->_karatsubaSquare($x0); + + $z1 = $this->_add($x1, false, $x0, false); + $z1 = $this->_karatsubaSquare($z1[MATH_BIGINTEGER_VALUE]); + $temp = $this->_add($z2, false, $z0, false); + $z1 = $this->_subtract($z1, false, $temp[MATH_BIGINTEGER_VALUE], false); + + $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); + $z1[MATH_BIGINTEGER_VALUE] = array_merge(array_fill(0, $m, 0), $z1[MATH_BIGINTEGER_VALUE]); + + $xx = $this->_add($z2, false, $z1[MATH_BIGINTEGER_VALUE], $z1[MATH_BIGINTEGER_SIGN]); + $xx = $this->_add($xx[MATH_BIGINTEGER_VALUE], $xx[MATH_BIGINTEGER_SIGN], $z0, false); + + return $xx[MATH_BIGINTEGER_VALUE]; + } + + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('10'); + * $b = new Math_BigInteger('20'); + * + * list($quotient, $remainder) = $a->divide($b); + * + * echo $quotient->toString(); // outputs 0 + * echo "\r\n"; + * echo $remainder->toString(); // outputs 10 + * ?> + * </code> + * + * @param Math_BigInteger $y + * @return Array + * @access public + * @internal This function is based off of {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}. + */ + function divide($y) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $quotient = new Math_BigInteger(); + $remainder = new Math_BigInteger(); + + list($quotient->value, $remainder->value) = gmp_div_qr($this->value, $y->value); + + if (gmp_sign($remainder->value) < 0) { + $remainder->value = gmp_add($remainder->value, gmp_abs($y->value)); + } + + return array($this->_normalize($quotient), $this->_normalize($remainder)); + case MATH_BIGINTEGER_MODE_BCMATH: + $quotient = new Math_BigInteger(); + $remainder = new Math_BigInteger(); + + $quotient->value = bcdiv($this->value, $y->value, 0); + $remainder->value = bcmod($this->value, $y->value); + + if ($remainder->value[0] == '-') { + $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0); + } + + return array($this->_normalize($quotient), $this->_normalize($remainder)); + } + + if (count($y->value) == 1) { + list($q, $r) = $this->_divide_digit($this->value, $y->value[0]); + $quotient = new Math_BigInteger(); + $remainder = new Math_BigInteger(); + $quotient->value = $q; + $remainder->value = array($r); + $quotient->is_negative = $this->is_negative != $y->is_negative; + return array($this->_normalize($quotient), $this->_normalize($remainder)); + } + + static $zero; + if ( !isset($zero) ) { + $zero = new Math_BigInteger(); + } + + $x = $this->copy(); + $y = $y->copy(); + + $x_sign = $x->is_negative; + $y_sign = $y->is_negative; + + $x->is_negative = $y->is_negative = false; + + $diff = $x->compare($y); + + if ( !$diff ) { + $temp = new Math_BigInteger(); + $temp->value = array(1); + $temp->is_negative = $x_sign != $y_sign; + return array($this->_normalize($temp), $this->_normalize(new Math_BigInteger())); + } + + if ( $diff < 0 ) { + // if $x is negative, "add" $y. + if ( $x_sign ) { + $x = $y->subtract($x); + } + return array($this->_normalize(new Math_BigInteger()), $this->_normalize($x)); + } + + // normalize $x and $y as described in HAC 14.23 / 14.24 + $msb = $y->value[count($y->value) - 1]; + for ($shift = 0; !($msb & MATH_BIGINTEGER_MSB); ++$shift) { + $msb <<= 1; + } + $x->_lshift($shift); + $y->_lshift($shift); + $y_value = &$y->value; + + $x_max = count($x->value) - 1; + $y_max = count($y->value) - 1; + + $quotient = new Math_BigInteger(); + $quotient_value = &$quotient->value; + $quotient_value = $this->_array_repeat(0, $x_max - $y_max + 1); + + static $temp, $lhs, $rhs; + if (!isset($temp)) { + $temp = new Math_BigInteger(); + $lhs = new Math_BigInteger(); + $rhs = new Math_BigInteger(); + } + $temp_value = &$temp->value; + $rhs_value = &$rhs->value; + + // $temp = $y << ($x_max - $y_max-1) in base 2**26 + $temp_value = array_merge($this->_array_repeat(0, $x_max - $y_max), $y_value); + + while ( $x->compare($temp) >= 0 ) { + // calculate the "common residue" + ++$quotient_value[$x_max - $y_max]; + $x = $x->subtract($temp); + $x_max = count($x->value) - 1; + } + + for ($i = $x_max; $i >= $y_max + 1; --$i) { + $x_value = &$x->value; + $x_window = array( + isset($x_value[$i]) ? $x_value[$i] : 0, + isset($x_value[$i - 1]) ? $x_value[$i - 1] : 0, + isset($x_value[$i - 2]) ? $x_value[$i - 2] : 0 + ); + $y_window = array( + $y_value[$y_max], + ( $y_max > 0 ) ? $y_value[$y_max - 1] : 0 + ); + + $q_index = $i - $y_max - 1; + if ($x_window[0] == $y_window[0]) { + $quotient_value[$q_index] = MATH_BIGINTEGER_MAX_DIGIT; + } else { + $quotient_value[$q_index] = (int) ( + ($x_window[0] * MATH_BIGINTEGER_BASE_FULL + $x_window[1]) + / + $y_window[0] + ); + } + + $temp_value = array($y_window[1], $y_window[0]); + + $lhs->value = array($quotient_value[$q_index]); + $lhs = $lhs->multiply($temp); + + $rhs_value = array($x_window[2], $x_window[1], $x_window[0]); + + while ( $lhs->compare($rhs) > 0 ) { + --$quotient_value[$q_index]; + + $lhs->value = array($quotient_value[$q_index]); + $lhs = $lhs->multiply($temp); + } + + $adjust = $this->_array_repeat(0, $q_index); + $temp_value = array($quotient_value[$q_index]); + $temp = $temp->multiply($y); + $temp_value = &$temp->value; + $temp_value = array_merge($adjust, $temp_value); + + $x = $x->subtract($temp); + + if ($x->compare($zero) < 0) { + $temp_value = array_merge($adjust, $y_value); + $x = $x->add($temp); + + --$quotient_value[$q_index]; + } + + $x_max = count($x_value) - 1; + } + + // unnormalize the remainder + $x->_rshift($shift); + + $quotient->is_negative = $x_sign != $y_sign; + + // calculate the "common residue", if appropriate + if ( $x_sign ) { + $y->_rshift($shift); + $x = $y->subtract($x); + } + + return array($this->_normalize($quotient), $this->_normalize($x)); + } + + /** + * Divides a BigInteger by a regular integer + * + * abc / x = a00 / x + b0 / x + c / x + * + * @param Array $dividend + * @param Array $divisor + * @return Array + * @access private + */ + function _divide_digit($dividend, $divisor) + { + $carry = 0; + $result = array(); + + for ($i = count($dividend) - 1; $i >= 0; --$i) { + $temp = MATH_BIGINTEGER_BASE_FULL * $carry + $dividend[$i]; + $result[$i] = (int) ($temp / $divisor); + $carry = (int) ($temp - $divisor * $result[$i]); + } + + return array($result, $carry); + } + + /** + * Performs modular exponentiation. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger('10'); + * $b = new Math_BigInteger('20'); + * $c = new Math_BigInteger('30'); + * + * $c = $a->modPow($b, $c); + * + * echo $c->toString(); // outputs 10 + * ?> + * </code> + * + * @param Math_BigInteger $e + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + * @internal The most naive approach to modular exponentiation has very unreasonable requirements, and + * and although the approach involving repeated squaring does vastly better, it, too, is impractical + * for our purposes. The reason being that division - by far the most complicated and time-consuming + * of the basic operations (eg. +,-,*,/) - occurs multiple times within it. + * + * Modular reductions resolve this issue. Although an individual modular reduction takes more time + * then an individual division, when performed in succession (with the same modulo), they're a lot faster. + * + * The two most commonly used modular reductions are Barrett and Montgomery reduction. Montgomery reduction, + * although faster, only works when the gcd of the modulo and of the base being used is 1. In RSA, when the + * base is a power of two, the modulo - a product of two primes - is always going to have a gcd of 1 (because + * the product of two odd numbers is odd), but what about when RSA isn't used? + * + * In contrast, Barrett reduction has no such constraint. As such, some bigint implementations perform a + * Barrett reduction after every operation in the modpow function. Others perform Barrett reductions when the + * modulo is even and Montgomery reductions when the modulo is odd. BigInteger.java's modPow method, however, + * uses a trick involving the Chinese Remainder Theorem to factor the even modulo into two numbers - one odd and + * the other, a power of two - and recombine them, later. This is the method that this modPow function uses. + * {@link http://islab.oregonstate.edu/papers/j34monex.pdf Montgomery Reduction with Even Modulus} elaborates. + */ + function modPow($e, $n) + { + $n = $this->bitmask !== false && $this->bitmask->compare($n) < 0 ? $this->bitmask : $n->abs(); + + if ($e->compare(new Math_BigInteger()) < 0) { + $e = $e->abs(); + + $temp = $this->modInverse($n); + if ($temp === false) { + return false; + } + + return $this->_normalize($temp->modPow($e, $n)); + } + + if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP ) { + $temp = new Math_BigInteger(); + $temp->value = gmp_powm($this->value, $e->value, $n->value); + + return $this->_normalize($temp); + } + + if ($this->compare(new Math_BigInteger()) < 0 || $this->compare($n) > 0) { + list(, $temp) = $this->divide($n); + return $temp->modPow($e, $n); + } + + if (defined('MATH_BIGINTEGER_OPENSSL_ENABLED')) { + $components = array( + 'modulus' => $n->toBytes(true), + 'publicExponent' => $e->toBytes(true) + ); + + $components = array( + 'modulus' => pack('Ca*a*', 2, $this->_encodeASN1Length(strlen($components['modulus'])), $components['modulus']), + 'publicExponent' => pack('Ca*a*', 2, $this->_encodeASN1Length(strlen($components['publicExponent'])), $components['publicExponent']) + ); + + $RSAPublicKey = pack('Ca*a*a*', + 48, $this->_encodeASN1Length(strlen($components['modulus']) + strlen($components['publicExponent'])), + $components['modulus'], $components['publicExponent'] + ); + + $rsaOID = pack('H*', '300d06092a864886f70d0101010500'); // hex version of MA0GCSqGSIb3DQEBAQUA + $RSAPublicKey = chr(0) . $RSAPublicKey; + $RSAPublicKey = chr(3) . $this->_encodeASN1Length(strlen($RSAPublicKey)) . $RSAPublicKey; + + $encapsulated = pack('Ca*a*', + 48, $this->_encodeASN1Length(strlen($rsaOID . $RSAPublicKey)), $rsaOID . $RSAPublicKey + ); + + $RSAPublicKey = "-----BEGIN PUBLIC KEY-----\r\n" . + chunk_split(base64_encode($encapsulated)) . + '-----END PUBLIC KEY-----'; + + $plaintext = str_pad($this->toBytes(), strlen($n->toBytes(true)) - 1, "\0", STR_PAD_LEFT); + + if (openssl_public_encrypt($plaintext, $result, $RSAPublicKey, OPENSSL_NO_PADDING)) { + return new Math_BigInteger($result, 256); + } + } + + if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) { + $temp = new Math_BigInteger(); + $temp->value = bcpowmod($this->value, $e->value, $n->value, 0); + + return $this->_normalize($temp); + } + + if ( empty($e->value) ) { + $temp = new Math_BigInteger(); + $temp->value = array(1); + return $this->_normalize($temp); + } + + if ( $e->value == array(1) ) { + list(, $temp) = $this->divide($n); + return $this->_normalize($temp); + } + + if ( $e->value == array(2) ) { + $temp = new Math_BigInteger(); + $temp->value = $this->_square($this->value); + list(, $temp) = $temp->divide($n); + return $this->_normalize($temp); + } + + return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_BARRETT)); + + // is the modulo odd? + if ( $n->value[0] & 1 ) { + return $this->_normalize($this->_slidingWindow($e, $n, MATH_BIGINTEGER_MONTGOMERY)); + } + // if it's not, it's even + + // find the lowest set bit (eg. the max pow of 2 that divides $n) + for ($i = 0; $i < count($n->value); ++$i) { + if ( $n->value[$i] ) { + $temp = decbin($n->value[$i]); + $j = strlen($temp) - strrpos($temp, '1') - 1; + $j+= 26 * $i; + break; + } + } + // at this point, 2^$j * $n/(2^$j) == $n + + $mod1 = $n->copy(); + $mod1->_rshift($j); + $mod2 = new Math_BigInteger(); + $mod2->value = array(1); + $mod2->_lshift($j); + + $part1 = ( $mod1->value != array(1) ) ? $this->_slidingWindow($e, $mod1, MATH_BIGINTEGER_MONTGOMERY) : new Math_BigInteger(); + $part2 = $this->_slidingWindow($e, $mod2, MATH_BIGINTEGER_POWEROF2); + + $y1 = $mod2->modInverse($mod1); + $y2 = $mod1->modInverse($mod2); + + $result = $part1->multiply($mod2); + $result = $result->multiply($y1); + + $temp = $part2->multiply($mod1); + $temp = $temp->multiply($y2); + + $result = $result->add($temp); + list(, $result) = $result->divide($n); + + return $this->_normalize($result); + } + + /** + * Performs modular exponentiation. + * + * Alias for Math_BigInteger::modPow() + * + * @param Math_BigInteger $e + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + */ + function powMod($e, $n) + { + return $this->modPow($e, $n); + } + + /** + * Sliding Window k-ary Modular Exponentiation + * + * Based on {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=27 HAC 14.85} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=210 MPM 7.7}. In a departure from those algorithims, + * however, this function performs a modular reduction after every multiplication and squaring operation. + * As such, this function has the same preconditions that the reductions being used do. + * + * @param Math_BigInteger $e + * @param Math_BigInteger $n + * @param Integer $mode + * @return Math_BigInteger + * @access private + */ + function _slidingWindow($e, $n, $mode) + { + static $window_ranges = array(7, 25, 81, 241, 673, 1793); // from BigInteger.java's oddModPow function + //static $window_ranges = array(0, 7, 36, 140, 450, 1303, 3529); // from MPM 7.3.1 + + $e_value = $e->value; + $e_length = count($e_value) - 1; + $e_bits = decbin($e_value[$e_length]); + for ($i = $e_length - 1; $i >= 0; --$i) { + $e_bits.= str_pad(decbin($e_value[$i]), MATH_BIGINTEGER_BASE, '0', STR_PAD_LEFT); + } + + $e_length = strlen($e_bits); + + // calculate the appropriate window size. + // $window_size == 3 if $window_ranges is between 25 and 81, for example. + for ($i = 0, $window_size = 1; $e_length > $window_ranges[$i] && $i < count($window_ranges); ++$window_size, ++$i); + + $n_value = $n->value; + + // precompute $this^0 through $this^$window_size + $powers = array(); + $powers[1] = $this->_prepareReduce($this->value, $n_value, $mode); + $powers[2] = $this->_squareReduce($powers[1], $n_value, $mode); + + // we do every other number since substr($e_bits, $i, $j+1) (see below) is supposed to end + // in a 1. ie. it's supposed to be odd. + $temp = 1 << ($window_size - 1); + for ($i = 1; $i < $temp; ++$i) { + $i2 = $i << 1; + $powers[$i2 + 1] = $this->_multiplyReduce($powers[$i2 - 1], $powers[2], $n_value, $mode); + } + + $result = array(1); + $result = $this->_prepareReduce($result, $n_value, $mode); + + for ($i = 0; $i < $e_length; ) { + if ( !$e_bits[$i] ) { + $result = $this->_squareReduce($result, $n_value, $mode); + ++$i; + } else { + for ($j = $window_size - 1; $j > 0; --$j) { + if ( !empty($e_bits[$i + $j]) ) { + break; + } + } + + for ($k = 0; $k <= $j; ++$k) {// eg. the length of substr($e_bits, $i, $j+1) + $result = $this->_squareReduce($result, $n_value, $mode); + } + + $result = $this->_multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $mode); + + $i+=$j + 1; + } + } + + $temp = new Math_BigInteger(); + $temp->value = $this->_reduce($result, $n_value, $mode); + + return $temp; + } + + /** + * Modular reduction + * + * For most $modes this will return the remainder. + * + * @see _slidingWindow() + * @access private + * @param Array $x + * @param Array $n + * @param Integer $mode + * @return Array + */ + function _reduce($x, $n, $mode) + { + switch ($mode) { + case MATH_BIGINTEGER_MONTGOMERY: + return $this->_montgomery($x, $n); + case MATH_BIGINTEGER_BARRETT: + return $this->_barrett($x, $n); + case MATH_BIGINTEGER_POWEROF2: + $lhs = new Math_BigInteger(); + $lhs->value = $x; + $rhs = new Math_BigInteger(); + $rhs->value = $n; + return $x->_mod2($n); + case MATH_BIGINTEGER_CLASSIC: + $lhs = new Math_BigInteger(); + $lhs->value = $x; + $rhs = new Math_BigInteger(); + $rhs->value = $n; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + case MATH_BIGINTEGER_NONE: + return $x; + default: + // an invalid $mode was provided + } + } + + /** + * Modular reduction preperation + * + * @see _slidingWindow() + * @access private + * @param Array $x + * @param Array $n + * @param Integer $mode + * @return Array + */ + function _prepareReduce($x, $n, $mode) + { + if ($mode == MATH_BIGINTEGER_MONTGOMERY) { + return $this->_prepMontgomery($x, $n); + } + return $this->_reduce($x, $n, $mode); + } + + /** + * Modular multiply + * + * @see _slidingWindow() + * @access private + * @param Array $x + * @param Array $y + * @param Array $n + * @param Integer $mode + * @return Array + */ + function _multiplyReduce($x, $y, $n, $mode) + { + if ($mode == MATH_BIGINTEGER_MONTGOMERY) { + return $this->_montgomeryMultiply($x, $y, $n); + } + $temp = $this->_multiply($x, false, $y, false); + return $this->_reduce($temp[MATH_BIGINTEGER_VALUE], $n, $mode); + } + + /** + * Modular square + * + * @see _slidingWindow() + * @access private + * @param Array $x + * @param Array $n + * @param Integer $mode + * @return Array + */ + function _squareReduce($x, $n, $mode) + { + if ($mode == MATH_BIGINTEGER_MONTGOMERY) { + return $this->_montgomeryMultiply($x, $x, $n); + } + return $this->_reduce($this->_square($x), $n, $mode); + } + + /** + * Modulos for Powers of Two + * + * Calculates $x%$n, where $n = 2**$e, for some $e. Since this is basically the same as doing $x & ($n-1), + * we'll just use this function as a wrapper for doing that. + * + * @see _slidingWindow() + * @access private + * @param Math_BigInteger + * @return Math_BigInteger + */ + function _mod2($n) + { + $temp = new Math_BigInteger(); + $temp->value = array(1); + return $this->bitwise_and($n->subtract($temp)); + } + + /** + * Barrett Modular Reduction + * + * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly, + * so as not to require negative numbers (initially, this script didn't support negative numbers). + * + * Employs "folding", as described at + * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from + * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x." + * + * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that + * usable on account of (1) its not using reasonable radix points as discussed in + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable + * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that + * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line + * comments for details. + * + * @see _slidingWindow() + * @access private + * @param Array $n + * @param Array $m + * @return Array + */ + function _barrett($n, $m) + { + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + $m_length = count($m); + + // if ($this->_compare($n, $this->_square($m)) >= 0) { + if (count($n) > 2 * $m_length) { + $lhs = new Math_BigInteger(); + $rhs = new Math_BigInteger(); + $lhs->value = $n; + $rhs->value = $m; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + + // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced + if ($m_length < 5) { + return $this->_regularBarrett($n, $m); + } + + // n = 2 * m.length + + if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $m; + + $lhs = new Math_BigInteger(); + $lhs_value = &$lhs->value; + $lhs_value = $this->_array_repeat(0, $m_length + ($m_length >> 1)); + $lhs_value[] = 1; + $rhs = new Math_BigInteger(); + $rhs->value = $m; + + list($u, $m1) = $lhs->divide($rhs); + $u = $u->value; + $m1 = $m1->value; + + $cache[MATH_BIGINTEGER_DATA][] = array( + 'u' => $u, // m.length >> 1 (technically (m.length >> 1) + 1) + 'm1'=> $m1 // m.length + ); + } else { + extract($cache[MATH_BIGINTEGER_DATA][$key]); + } + + $cutoff = $m_length + ($m_length >> 1); + $lsd = array_slice($n, 0, $cutoff); // m.length + (m.length >> 1) + $msd = array_slice($n, $cutoff); // m.length >> 1 + $lsd = $this->_trim($lsd); + $temp = $this->_multiply($msd, false, $m1, false); + $n = $this->_add($lsd, false, $temp[MATH_BIGINTEGER_VALUE], false); // m.length + (m.length >> 1) + 1 + + if ($m_length & 1) { + return $this->_regularBarrett($n[MATH_BIGINTEGER_VALUE], $m); + } + + // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2 + $temp = array_slice($n[MATH_BIGINTEGER_VALUE], $m_length - 1); + // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 + // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 + $temp = $this->_multiply($temp, false, $u, false); + // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 + // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], ($m_length >> 1) + 1); + // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 + // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) + $temp = $this->_multiply($temp, false, $m, false); + + // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit + // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop + // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). + + $result = $this->_subtract($n[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false); + + while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false) >= 0) { + $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $m, false); + } + + return $result[MATH_BIGINTEGER_VALUE]; + } + + /** + * (Regular) Barrett Modular Reduction + * + * For numbers with more than four digits Math_BigInteger::_barrett() is faster. The difference between that and this + * is that this function does not fold the denominator into a smaller form. + * + * @see _slidingWindow() + * @access private + * @param Array $x + * @param Array $n + * @return Array + */ + function _regularBarrett($x, $n) + { + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + $n_length = count($n); + + if (count($x) > 2 * $n_length) { + $lhs = new Math_BigInteger(); + $rhs = new Math_BigInteger(); + $lhs->value = $x; + $rhs->value = $n; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + + if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $n; + $lhs = new Math_BigInteger(); + $lhs_value = &$lhs->value; + $lhs_value = $this->_array_repeat(0, 2 * $n_length); + $lhs_value[] = 1; + $rhs = new Math_BigInteger(); + $rhs->value = $n; + list($temp, ) = $lhs->divide($rhs); // m.length + $cache[MATH_BIGINTEGER_DATA][] = $temp->value; + } + + // 2 * m.length - (m.length - 1) = m.length + 1 + $temp = array_slice($x, $n_length - 1); + // (m.length + 1) + m.length = 2 * m.length + 1 + $temp = $this->_multiply($temp, false, $cache[MATH_BIGINTEGER_DATA][$key], false); + // (2 * m.length + 1) - (m.length - 1) = m.length + 2 + $temp = array_slice($temp[MATH_BIGINTEGER_VALUE], $n_length + 1); + + // m.length + 1 + $result = array_slice($x, 0, $n_length + 1); + // m.length + 1 + $temp = $this->_multiplyLower($temp, false, $n, false, $n_length + 1); + // $temp == array_slice($temp->_multiply($temp, false, $n, false)->value, 0, $n_length + 1) + + if ($this->_compare($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]) < 0) { + $corrector_value = $this->_array_repeat(0, $n_length + 1); + $corrector_value[] = 1; + $result = $this->_add($result, false, $corrector_value, false); + $result = $result[MATH_BIGINTEGER_VALUE]; + } + + // at this point, we're subtracting a number with m.length + 1 digits from another number with m.length + 1 digits + $result = $this->_subtract($result, false, $temp[MATH_BIGINTEGER_VALUE], $temp[MATH_BIGINTEGER_SIGN]); + while ($this->_compare($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false) > 0) { + $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], $result[MATH_BIGINTEGER_SIGN], $n, false); + } + + return $result[MATH_BIGINTEGER_VALUE]; + } + + /** + * Performs long multiplication up to $stop digits + * + * If you're going to be doing array_slice($product->value, 0, $stop), some cycles can be saved. + * + * @see _regularBarrett() + * @param Array $x_value + * @param Boolean $x_negative + * @param Array $y_value + * @param Boolean $y_negative + * @param Integer $stop + * @return Array + * @access private + */ + function _multiplyLower($x_value, $x_negative, $y_value, $y_negative, $stop) + { + $x_length = count($x_value); + $y_length = count($y_value); + + if ( !$x_length || !$y_length ) { // a 0 is being multiplied + return array( + MATH_BIGINTEGER_VALUE => array(), + MATH_BIGINTEGER_SIGN => false + ); + } + + if ( $x_length < $y_length ) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + + $x_length = count($x_value); + $y_length = count($y_value); + } + + $product_value = $this->_array_repeat(0, $x_length + $y_length); + + // the following for loop could be removed if the for loop following it + // (the one with nested for loops) initially set $i to 0, but + // doing so would also make the result in one set of unnecessary adds, + // since on the outermost loops first pass, $product->value[$k] is going + // to always be 0 + + $carry = 0; + + for ($j = 0; $j < $x_length; ++$j) { // ie. $i = 0, $k = $i + $temp = $x_value[$j] * $y_value[0] + $carry; // $product_value[$k] == 0 + $carry = (int) ($temp / MATH_BIGINTEGER_BASE_FULL); + $product_value[$j] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + if ($j < $stop) { + $product_value[$j] = $carry; + } + + // the above for loop is what the previous comment was talking about. the + // following for loop is the "one with nested for loops" + + for ($i = 1; $i < $y_length; ++$i) { + $carry = 0; + + for ($j = 0, $k = $i; $j < $x_length && $k < $stop; ++$j, ++$k) { + $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; + $carry = (int) ($temp / MATH_BIGINTEGER_BASE_FULL); + $product_value[$k] = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * $carry); + } + + if ($k < $stop) { + $product_value[$k] = $carry; + } + } + + return array( + MATH_BIGINTEGER_VALUE => $this->_trim($product_value), + MATH_BIGINTEGER_SIGN => $x_negative != $y_negative + ); + } + + /** + * Montgomery Modular Reduction + * + * ($x->_prepMontgomery($n))->_montgomery($n) yields $x % $n. + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=170 MPM 6.3} provides insights on how this can be + * improved upon (basically, by using the comba method). gcd($n, 2) must be equal to one for this function + * to work correctly. + * + * @see _prepMontgomery() + * @see _slidingWindow() + * @access private + * @param Array $x + * @param Array $n + * @return Array + */ + function _montgomery($x, $n) + { + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + if ( ($key = array_search($n, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $x; + $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($n); + } + + $k = count($n); + + $result = array(MATH_BIGINTEGER_VALUE => $x); + + for ($i = 0; $i < $k; ++$i) { + $temp = $result[MATH_BIGINTEGER_VALUE][$i] * $cache[MATH_BIGINTEGER_DATA][$key]; + $temp = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * ((int) ($temp / MATH_BIGINTEGER_BASE_FULL))); + $temp = $this->_regularMultiply(array($temp), $n); + $temp = array_merge($this->_array_repeat(0, $i), $temp); + $result = $this->_add($result[MATH_BIGINTEGER_VALUE], false, $temp, false); + } + + $result[MATH_BIGINTEGER_VALUE] = array_slice($result[MATH_BIGINTEGER_VALUE], $k); + + if ($this->_compare($result, false, $n, false) >= 0) { + $result = $this->_subtract($result[MATH_BIGINTEGER_VALUE], false, $n, false); + } + + return $result[MATH_BIGINTEGER_VALUE]; + } + + /** + * Montgomery Multiply + * + * Interleaves the montgomery reduction and long multiplication algorithms together as described in + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} + * + * @see _prepMontgomery() + * @see _montgomery() + * @access private + * @param Array $x + * @param Array $y + * @param Array $m + * @return Array + */ + function _montgomeryMultiply($x, $y, $m) + { + $temp = $this->_multiply($x, false, $y, false); + return $this->_montgomery($temp[MATH_BIGINTEGER_VALUE], $m); + + static $cache = array( + MATH_BIGINTEGER_VARIABLE => array(), + MATH_BIGINTEGER_DATA => array() + ); + + if ( ($key = array_search($m, $cache[MATH_BIGINTEGER_VARIABLE])) === false ) { + $key = count($cache[MATH_BIGINTEGER_VARIABLE]); + $cache[MATH_BIGINTEGER_VARIABLE][] = $m; + $cache[MATH_BIGINTEGER_DATA][] = $this->_modInverse67108864($m); + } + + $n = max(count($x), count($y), count($m)); + $x = array_pad($x, $n, 0); + $y = array_pad($y, $n, 0); + $m = array_pad($m, $n, 0); + $a = array(MATH_BIGINTEGER_VALUE => $this->_array_repeat(0, $n + 1)); + for ($i = 0; $i < $n; ++$i) { + $temp = $a[MATH_BIGINTEGER_VALUE][0] + $x[$i] * $y[0]; + $temp = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * ((int) ($temp / MATH_BIGINTEGER_BASE_FULL))); + $temp = $temp * $cache[MATH_BIGINTEGER_DATA][$key]; + $temp = (int) ($temp - MATH_BIGINTEGER_BASE_FULL * ((int) ($temp / MATH_BIGINTEGER_BASE_FULL))); + $temp = $this->_add($this->_regularMultiply(array($x[$i]), $y), false, $this->_regularMultiply(array($temp), $m), false); + $a = $this->_add($a[MATH_BIGINTEGER_VALUE], false, $temp[MATH_BIGINTEGER_VALUE], false); + $a[MATH_BIGINTEGER_VALUE] = array_slice($a[MATH_BIGINTEGER_VALUE], 1); + } + if ($this->_compare($a[MATH_BIGINTEGER_VALUE], false, $m, false) >= 0) { + $a = $this->_subtract($a[MATH_BIGINTEGER_VALUE], false, $m, false); + } + return $a[MATH_BIGINTEGER_VALUE]; + } + + /** + * Prepare a number for use in Montgomery Modular Reductions + * + * @see _montgomery() + * @see _slidingWindow() + * @access private + * @param Array $x + * @param Array $n + * @return Array + */ + function _prepMontgomery($x, $n) + { + $lhs = new Math_BigInteger(); + $lhs->value = array_merge($this->_array_repeat(0, count($n)), $x); + $rhs = new Math_BigInteger(); + $rhs->value = $n; + + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + + /** + * Modular Inverse of a number mod 2**26 (eg. 67108864) + * + * Based off of the bnpInvDigit function implemented and justified in the following URL: + * + * {@link http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js} + * + * The following URL provides more info: + * + * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85} + * + * As for why we do all the bitmasking... strange things can happen when converting from floats to ints. For + * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields + * int(-2147483648). To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't + * auto-converted to floats. The outermost bitmask is present because without it, there's no guarantee that + * the "residue" returned would be the so-called "common residue". We use fmod, in the last step, because the + * maximum possible $x is 26 bits and the maximum $result is 16 bits. Thus, we have to be able to handle up to + * 40 bits, which only 64-bit floating points will support. + * + * Thanks to Pedro Gimeno Fortea for input! + * + * @see _montgomery() + * @access private + * @param Array $x + * @return Integer + */ + function _modInverse67108864($x) // 2**26 == 67,108,864 + { + $x = -$x[0]; + $result = $x & 0x3; // x**-1 mod 2**2 + $result = ($result * (2 - $x * $result)) & 0xF; // x**-1 mod 2**4 + $result = ($result * (2 - ($x & 0xFF) * $result)) & 0xFF; // x**-1 mod 2**8 + $result = ($result * ((2 - ($x & 0xFFFF) * $result) & 0xFFFF)) & 0xFFFF; // x**-1 mod 2**16 + $result = fmod($result * (2 - fmod($x * $result, MATH_BIGINTEGER_BASE_FULL)), MATH_BIGINTEGER_BASE_FULL); // x**-1 mod 2**26 + return $result & MATH_BIGINTEGER_MAX_DIGIT; + } + + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger(30); + * $b = new Math_BigInteger(17); + * + * $c = $a->modInverse($b); + * echo $c->toString(); // outputs 4 + * + * echo "\r\n"; + * + * $d = $a->multiply($c); + * list(, $d) = $d->divide($b); + * echo $d; // outputs 1 (as per the definition of modular inverse) + * ?> + * </code> + * + * @param Math_BigInteger $n + * @return mixed false, if no modular inverse exists, Math_BigInteger, otherwise. + * @access public + * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=21 HAC 14.64} for more information. + */ + function modInverse($n) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_invert($this->value, $n->value); + + return ( $temp->value === false ) ? false : $this->_normalize($temp); + } + + static $zero, $one; + if (!isset($zero)) { + $zero = new Math_BigInteger(); + $one = new Math_BigInteger(1); + } + + // $x mod -$n == $x mod $n. + $n = $n->abs(); + + if ($this->compare($zero) < 0) { + $temp = $this->abs(); + $temp = $temp->modInverse($n); + return $this->_normalize($n->subtract($temp)); + } + + extract($this->extendedGCD($n)); + + if (!$gcd->equals($one)) { + return false; + } + + $x = $x->compare($zero) < 0 ? $x->add($n) : $x; + + return $this->compare($zero) < 0 ? $this->_normalize($n->subtract($x)) : $this->_normalize($x); + } + + /** + * Calculates the greatest common divisor and Bezout's identity. + * + * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that + * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which + * combination is returned is dependant upon which mode is in use. See + * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger(693); + * $b = new Math_BigInteger(609); + * + * extract($a->extendedGCD($b)); + * + * echo $gcd->toString() . "\r\n"; // outputs 21 + * echo $a->toString() * $x->toString() + $b->toString() * $y->toString(); // outputs 21 + * ?> + * </code> + * + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + * @internal Calculates the GCD using the binary xGCD algorithim described in + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=19 HAC 14.61}. As the text above 14.61 notes, + * the more traditional algorithim requires "relatively costly multiple-precision divisions". + */ + function extendedGCD($n) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + extract(gmp_gcdext($this->value, $n->value)); + + return array( + 'gcd' => $this->_normalize(new Math_BigInteger($g)), + 'x' => $this->_normalize(new Math_BigInteger($s)), + 'y' => $this->_normalize(new Math_BigInteger($t)) + ); + case MATH_BIGINTEGER_MODE_BCMATH: + // it might be faster to use the binary xGCD algorithim here, as well, but (1) that algorithim works + // best when the base is a power of 2 and (2) i don't think it'd make much difference, anyway. as is, + // the basic extended euclidean algorithim is what we're using. + + $u = $this->value; + $v = $n->value; + + $a = '1'; + $b = '0'; + $c = '0'; + $d = '1'; + + while (bccomp($v, '0', 0) != 0) { + $q = bcdiv($u, $v, 0); + + $temp = $u; + $u = $v; + $v = bcsub($temp, bcmul($v, $q, 0), 0); + + $temp = $a; + $a = $c; + $c = bcsub($temp, bcmul($a, $q, 0), 0); + + $temp = $b; + $b = $d; + $d = bcsub($temp, bcmul($b, $q, 0), 0); + } + + return array( + 'gcd' => $this->_normalize(new Math_BigInteger($u)), + 'x' => $this->_normalize(new Math_BigInteger($a)), + 'y' => $this->_normalize(new Math_BigInteger($b)) + ); + } + + $y = $n->copy(); + $x = $this->copy(); + $g = new Math_BigInteger(); + $g->value = array(1); + + while ( !(($x->value[0] & 1)|| ($y->value[0] & 1)) ) { + $x->_rshift(1); + $y->_rshift(1); + $g->_lshift(1); + } + + $u = $x->copy(); + $v = $y->copy(); + + $a = new Math_BigInteger(); + $b = new Math_BigInteger(); + $c = new Math_BigInteger(); + $d = new Math_BigInteger(); + + $a->value = $d->value = $g->value = array(1); + $b->value = $c->value = array(); + + while ( !empty($u->value) ) { + while ( !($u->value[0] & 1) ) { + $u->_rshift(1); + if ( (!empty($a->value) && ($a->value[0] & 1)) || (!empty($b->value) && ($b->value[0] & 1)) ) { + $a = $a->add($y); + $b = $b->subtract($x); + } + $a->_rshift(1); + $b->_rshift(1); + } + + while ( !($v->value[0] & 1) ) { + $v->_rshift(1); + if ( (!empty($d->value) && ($d->value[0] & 1)) || (!empty($c->value) && ($c->value[0] & 1)) ) { + $c = $c->add($y); + $d = $d->subtract($x); + } + $c->_rshift(1); + $d->_rshift(1); + } + + if ($u->compare($v) >= 0) { + $u = $u->subtract($v); + $a = $a->subtract($c); + $b = $b->subtract($d); + } else { + $v = $v->subtract($u); + $c = $c->subtract($a); + $d = $d->subtract($b); + } + } + + return array( + 'gcd' => $this->_normalize($g->multiply($v)), + 'x' => $this->_normalize($c), + 'y' => $this->_normalize($d) + ); + } + + /** + * Calculates the greatest common divisor + * + * Say you have 693 and 609. The GCD is 21. + * + * Here's an example: + * <code> + * <?php + * include('Math/BigInteger.php'); + * + * $a = new Math_BigInteger(693); + * $b = new Math_BigInteger(609); + * + * $gcd = a->extendedGCD($b); + * + * echo $gcd->toString() . "\r\n"; // outputs 21 + * ?> + * </code> + * + * @param Math_BigInteger $n + * @return Math_BigInteger + * @access public + */ + function gcd($n) + { + extract($this->extendedGCD($n)); + return $gcd; + } + + /** + * Absolute value. + * + * @return Math_BigInteger + * @access public + */ + function abs() + { + $temp = new Math_BigInteger(); + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp->value = gmp_abs($this->value); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $temp->value = (bccomp($this->value, '0', 0) < 0) ? substr($this->value, 1) : $this->value; + break; + default: + $temp->value = $this->value; + } + + return $temp; + } + + /** + * Compares two numbers. + * + * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is + * demonstrated thusly: + * + * $x > $y: $x->compare($y) > 0 + * $x < $y: $x->compare($y) < 0 + * $x == $y: $x->compare($y) == 0 + * + * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). + * + * @param Math_BigInteger $y + * @return Integer < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. + * @access public + * @see equals() + * @internal Could return $this->subtract($x), but that's not as fast as what we do do. + */ + function compare($y) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_cmp($this->value, $y->value); + case MATH_BIGINTEGER_MODE_BCMATH: + return bccomp($this->value, $y->value, 0); + } + + return $this->_compare($this->value, $this->is_negative, $y->value, $y->is_negative); + } + + /** + * Compares two numbers. + * + * @param Array $x_value + * @param Boolean $x_negative + * @param Array $y_value + * @param Boolean $y_negative + * @return Integer + * @see compare() + * @access private + */ + function _compare($x_value, $x_negative, $y_value, $y_negative) + { + if ( $x_negative != $y_negative ) { + return ( !$x_negative && $y_negative ) ? 1 : -1; + } + + $result = $x_negative ? -1 : 1; + + if ( count($x_value) != count($y_value) ) { + return ( count($x_value) > count($y_value) ) ? $result : -$result; + } + $size = max(count($x_value), count($y_value)); + + $x_value = array_pad($x_value, $size, 0); + $y_value = array_pad($y_value, $size, 0); + + for ($i = count($x_value) - 1; $i >= 0; --$i) { + if ($x_value[$i] != $y_value[$i]) { + return ( $x_value[$i] > $y_value[$i] ) ? $result : -$result; + } + } + + return 0; + } + + /** + * Tests the equality of two numbers. + * + * If you need to see if one number is greater than or less than another number, use Math_BigInteger::compare() + * + * @param Math_BigInteger $x + * @return Boolean + * @access public + * @see compare() + */ + function equals($x) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_cmp($this->value, $x->value) == 0; + default: + return $this->value === $x->value && $this->is_negative == $x->is_negative; + } + } + + /** + * Set Precision + * + * Some bitwise operations give different results depending on the precision being used. Examples include left + * shift, not, and rotates. + * + * @param Integer $bits + * @access public + */ + function setPrecision($bits) + { + $this->precision = $bits; + if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ) { + $this->bitmask = new Math_BigInteger(chr((1 << ($bits & 0x7)) - 1) . str_repeat(chr(0xFF), $bits >> 3), 256); + } else { + $this->bitmask = new Math_BigInteger(bcpow('2', $bits, 0)); + } + + $temp = $this->_normalize($this); + $this->value = $temp->value; + } + + /** + * Logical And + * + * @param Math_BigInteger $x + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> + * @return Math_BigInteger + */ + function bitwise_and($x) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_and($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $left = $this->toBytes(); + $right = $x->toBytes(); + + $length = max(strlen($left), strlen($right)); + + $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($left & $right, 256)); + } + + $result = $this->copy(); + + $length = min(count($x->value), count($this->value)); + + $result->value = array_slice($result->value, 0, $length); + + for ($i = 0; $i < $length; ++$i) { + $result->value[$i]&= $x->value[$i]; + } + + return $this->_normalize($result); + } + + /** + * Logical Or + * + * @param Math_BigInteger $x + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> + * @return Math_BigInteger + */ + function bitwise_or($x) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_or($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $left = $this->toBytes(); + $right = $x->toBytes(); + + $length = max(strlen($left), strlen($right)); + + $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($left | $right, 256)); + } + + $length = max(count($this->value), count($x->value)); + $result = $this->copy(); + $result->value = array_pad($result->value, $length, 0); + $x->value = array_pad($x->value, $length, 0); + + for ($i = 0; $i < $length; ++$i) { + $result->value[$i]|= $x->value[$i]; + } + + return $this->_normalize($result); + } + + /** + * Logical Exclusive-Or + * + * @param Math_BigInteger $x + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> + * @return Math_BigInteger + */ + function bitwise_xor($x) + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + $temp = new Math_BigInteger(); + $temp->value = gmp_xor($this->value, $x->value); + + return $this->_normalize($temp); + case MATH_BIGINTEGER_MODE_BCMATH: + $left = $this->toBytes(); + $right = $x->toBytes(); + + $length = max(strlen($left), strlen($right)); + + $left = str_pad($left, $length, chr(0), STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($left ^ $right, 256)); + } + + $length = max(count($this->value), count($x->value)); + $result = $this->copy(); + $result->value = array_pad($result->value, $length, 0); + $x->value = array_pad($x->value, $length, 0); + + for ($i = 0; $i < $length; ++$i) { + $result->value[$i]^= $x->value[$i]; + } + + return $this->_normalize($result); + } + + /** + * Logical Not + * + * @access public + * @internal Implemented per a request by Lluis Pamies i Juarez <lluis _a_ pamies.cat> + * @return Math_BigInteger + */ + function bitwise_not() + { + // calculuate "not" without regard to $this->precision + // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0) + $temp = $this->toBytes(); + $pre_msb = decbin(ord($temp[0])); + $temp = ~$temp; + $msb = decbin(ord($temp[0])); + if (strlen($msb) == 8) { + $msb = substr($msb, strpos($msb, '0')); + } + $temp[0] = chr(bindec($msb)); + + // see if we need to add extra leading 1's + $current_bits = strlen($pre_msb) + 8 * strlen($temp) - 8; + $new_bits = $this->precision - $current_bits; + if ($new_bits <= 0) { + return $this->_normalize(new Math_BigInteger($temp, 256)); + } + + // generate as many leading 1's as we need to. + $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xFF), $new_bits >> 3); + $this->_base256_lshift($leading_ones, $current_bits); + + $temp = str_pad($temp, ceil($this->bits / 8), chr(0), STR_PAD_LEFT); + + return $this->_normalize(new Math_BigInteger($leading_ones | $temp, 256)); + } + + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. + * + * @param Integer $shift + * @return Math_BigInteger + * @access public + * @internal The only version that yields any speed increases is the internal version. + */ + function bitwise_rightShift($shift) + { + $temp = new Math_BigInteger(); + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + static $two; + + if (!isset($two)) { + $two = gmp_init('2'); + } + + $temp->value = gmp_div_q($this->value, gmp_pow($two, $shift)); + + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $temp->value = bcdiv($this->value, bcpow('2', $shift, 0), 0); + + break; + default: // could just replace _lshift with this, but then all _lshift() calls would need to be rewritten + // and I don't want to do that... + $temp->value = $this->value; + $temp->_rshift($shift); + } + + return $this->_normalize($temp); + } + + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. + * + * @param Integer $shift + * @return Math_BigInteger + * @access public + * @internal The only version that yields any speed increases is the internal version. + */ + function bitwise_leftShift($shift) + { + $temp = new Math_BigInteger(); + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + static $two; + + if (!isset($two)) { + $two = gmp_init('2'); + } + + $temp->value = gmp_mul($this->value, gmp_pow($two, $shift)); + + break; + case MATH_BIGINTEGER_MODE_BCMATH: + $temp->value = bcmul($this->value, bcpow('2', $shift, 0), 0); + + break; + default: // could just replace _rshift with this, but then all _lshift() calls would need to be rewritten + // and I don't want to do that... + $temp->value = $this->value; + $temp->_lshift($shift); + } + + return $this->_normalize($temp); + } + + /** + * Logical Left Rotate + * + * Instead of the top x bits being dropped they're appended to the shifted bit string. + * + * @param Integer $shift + * @return Math_BigInteger + * @access public + */ + function bitwise_leftRotate($shift) + { + $bits = $this->toBytes(); + + if ($this->precision > 0) { + $precision = $this->precision; + if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) { + $mask = $this->bitmask->subtract(new Math_BigInteger(1)); + $mask = $mask->toBytes(); + } else { + $mask = $this->bitmask->toBytes(); + } + } else { + $temp = ord($bits[0]); + for ($i = 0; $temp >> $i; ++$i); + $precision = 8 * strlen($bits) - 8 + $i; + $mask = chr((1 << ($precision & 0x7)) - 1) . str_repeat(chr(0xFF), $precision >> 3); + } + + if ($shift < 0) { + $shift+= $precision; + } + $shift%= $precision; + + if (!$shift) { + return $this->copy(); + } + + $left = $this->bitwise_leftShift($shift); + $left = $left->bitwise_and(new Math_BigInteger($mask, 256)); + $right = $this->bitwise_rightShift($precision - $shift); + $result = MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_BCMATH ? $left->bitwise_or($right) : $left->add($right); + return $this->_normalize($result); + } + + /** + * Logical Right Rotate + * + * Instead of the bottom x bits being dropped they're prepended to the shifted bit string. + * + * @param Integer $shift + * @return Math_BigInteger + * @access public + */ + function bitwise_rightRotate($shift) + { + return $this->bitwise_leftRotate(-$shift); + } + + /** + * Set random number generator function + * + * This function is deprecated. + * + * @param String $generator + * @access public + */ + function setRandomGenerator($generator) + { + } + + /** + * Generate a random number + * + * @param optional Integer $min + * @param optional Integer $max + * @return Math_BigInteger + * @access public + */ + function random($min = false, $max = false) + { + if ($min === false) { + $min = new Math_BigInteger(0); + } + + if ($max === false) { + $max = new Math_BigInteger(0x7FFFFFFF); + } + + $compare = $max->compare($min); + + if (!$compare) { + return $this->_normalize($min); + } else if ($compare < 0) { + // if $min is bigger then $max, swap $min and $max + $temp = $max; + $max = $min; + $min = $temp; + } + + $max = $max->subtract($min); + $max = ltrim($max->toBytes(), chr(0)); + $size = strlen($max) - 1; + + $crypt_random = function_exists('crypt_random_string') || (!class_exists('Crypt_Random') && function_exists('crypt_random_string')); + if ($crypt_random) { + $random = crypt_random_string($size); + } else { + $random = ''; + + if ($size & 1) { + $random.= chr(mt_rand(0, 255)); + } + + $blocks = $size >> 1; + for ($i = 0; $i < $blocks; ++$i) { + // mt_rand(-2147483648, 0x7FFFFFFF) always produces -2147483648 on some systems + $random.= pack('n', mt_rand(0, 0xFFFF)); + } + } + + $fragment = new Math_BigInteger($random, 256); + $leading = $fragment->compare(new Math_BigInteger(substr($max, 1), 256)) > 0 ? + ord($max[0]) - 1 : ord($max[0]); + + if (!$crypt_random) { + $msb = chr(mt_rand(0, $leading)); + } else { + $cutoff = floor(0xFF / $leading) * $leading; + while (true) { + $msb = ord(crypt_random_string(1)); + if ($msb <= $cutoff) { + $msb%= $leading; + break; + } + } + $msb = chr($msb); + } + + $random = new Math_BigInteger($msb . $random, 256); + + return $this->_normalize($random->add($min)); + } + + /** + * Generate a random prime number. + * + * If there's not a prime within the given range, false will be returned. If more than $timeout seconds have elapsed, + * give up and return false. + * + * @param optional Integer $min + * @param optional Integer $max + * @param optional Integer $timeout + * @return Math_BigInteger + * @access public + * @internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=15 HAC 4.44}. + */ + function randomPrime($min = false, $max = false, $timeout = false) + { + if ($min === false) { + $min = new Math_BigInteger(0); + } + + if ($max === false) { + $max = new Math_BigInteger(0x7FFFFFFF); + } + + $compare = $max->compare($min); + + if (!$compare) { + return $min->isPrime() ? $min : false; + } else if ($compare < 0) { + // if $min is bigger then $max, swap $min and $max + $temp = $max; + $max = $min; + $min = $temp; + } + + static $one, $two; + if (!isset($one)) { + $one = new Math_BigInteger(1); + $two = new Math_BigInteger(2); + } + + $start = time(); + + $x = $this->random($min, $max); + + // gmp_nextprime() requires PHP 5 >= 5.2.0 per <http://php.net/gmp-nextprime>. + if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_GMP && function_exists('gmp_nextprime') ) { + $p = new Math_BigInteger(); + $p->value = gmp_nextprime($x->value); + + if ($p->compare($max) <= 0) { + return $p; + } + + if (!$min->equals($x)) { + $x = $x->subtract($one); + } + + return $x->randomPrime($min, $x); + } + + if ($x->equals($two)) { + return $x; + } + + $x->_make_odd(); + if ($x->compare($max) > 0) { + // if $x > $max then $max is even and if $min == $max then no prime number exists between the specified range + if ($min->equals($max)) { + return false; + } + $x = $min->copy(); + $x->_make_odd(); + } + + $initial_x = $x->copy(); + + while (true) { + if ($timeout !== false && time() - $start > $timeout) { + return false; + } + + if ($x->isPrime()) { + return $x; + } + + $x = $x->add($two); + + if ($x->compare($max) > 0) { + $x = $min->copy(); + if ($x->equals($two)) { + return $x; + } + $x->_make_odd(); + } + + if ($x->equals($initial_x)) { + return false; + } + } + } + + /** + * Make the current number odd + * + * If the current number is odd it'll be unchanged. If it's even, one will be added to it. + * + * @see randomPrime() + * @access private + */ + function _make_odd() + { + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + gmp_setbit($this->value, 0); + break; + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value[strlen($this->value) - 1] % 2 == 0) { + $this->value = bcadd($this->value, '1'); + } + break; + default: + $this->value[0] |= 1; + } + } + + /** + * Checks a numer to see if it's prime + * + * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the + * $t parameter is distributability. Math_BigInteger::randomPrime() can be distributed accross multiple pageloads + * on a website instead of just one. + * + * @param optional Integer $t + * @return Boolean + * @access public + * @internal Uses the + * {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. See + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=8 HAC 4.24}. + */ + function isPrime($t = false) + { + $length = strlen($this->toBytes()); + + if (!$t) { + // see HAC 4.49 "Note (controlling the error probability)" + if ($length >= 163) { $t = 2; } // floor(1300 / 8) + else if ($length >= 106) { $t = 3; } // floor( 850 / 8) + else if ($length >= 81 ) { $t = 4; } // floor( 650 / 8) + else if ($length >= 68 ) { $t = 5; } // floor( 550 / 8) + else if ($length >= 56 ) { $t = 6; } // floor( 450 / 8) + else if ($length >= 50 ) { $t = 7; } // floor( 400 / 8) + else if ($length >= 43 ) { $t = 8; } // floor( 350 / 8) + else if ($length >= 37 ) { $t = 9; } // floor( 300 / 8) + else if ($length >= 31 ) { $t = 12; } // floor( 250 / 8) + else if ($length >= 25 ) { $t = 15; } // floor( 200 / 8) + else if ($length >= 18 ) { $t = 18; } // floor( 150 / 8) + else { $t = 27; } + } + + // ie. gmp_testbit($this, 0) + // ie. isEven() or !isOdd() + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + return gmp_prob_prime($this->value, $t) != 0; + case MATH_BIGINTEGER_MODE_BCMATH: + if ($this->value === '2') { + return true; + } + if ($this->value[strlen($this->value) - 1] % 2 == 0) { + return false; + } + break; + default: + if ($this->value == array(2)) { + return true; + } + if (~$this->value[0] & 1) { + return false; + } + } + + static $primes, $zero, $one, $two; + + if (!isset($primes)) { + $primes = array( + 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, + 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, + 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, + 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, + 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, + 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, + 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, + 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, + 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, + 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, + 953, 967, 971, 977, 983, 991, 997 + ); + + if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) { + for ($i = 0; $i < count($primes); ++$i) { + $primes[$i] = new Math_BigInteger($primes[$i]); + } + } + + $zero = new Math_BigInteger(); + $one = new Math_BigInteger(1); + $two = new Math_BigInteger(2); + } + + if ($this->equals($one)) { + return false; + } + + // see HAC 4.4.1 "Random search for probable primes" + if ( MATH_BIGINTEGER_MODE != MATH_BIGINTEGER_MODE_INTERNAL ) { + foreach ($primes as $prime) { + list(, $r) = $this->divide($prime); + if ($r->equals($zero)) { + return $this->equals($prime); + } + } + } else { + $value = $this->value; + foreach ($primes as $prime) { + list(, $r) = $this->_divide_digit($value, $prime); + if (!$r) { + return count($value) == 1 && $value[0] == $prime; + } + } + } + + $n = $this->copy(); + $n_1 = $n->subtract($one); + $n_2 = $n->subtract($two); + + $r = $n_1->copy(); + $r_value = $r->value; + // ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); + if ( MATH_BIGINTEGER_MODE == MATH_BIGINTEGER_MODE_BCMATH ) { + $s = 0; + // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals($one) check earlier + while ($r->value[strlen($r->value) - 1] % 2 == 0) { + $r->value = bcdiv($r->value, '2', 0); + ++$s; + } + } else { + for ($i = 0, $r_length = count($r_value); $i < $r_length; ++$i) { + $temp = ~$r_value[$i] & 0xFFFFFF; + for ($j = 1; ($temp >> $j) & 1; ++$j); + if ($j != 25) { + break; + } + } + $s = 26 * $i + $j - 1; + $r->_rshift($s); + } + + for ($i = 0; $i < $t; ++$i) { + $a = $this->random($two, $n_2); + $y = $a->modPow($r, $n); + + if (!$y->equals($one) && !$y->equals($n_1)) { + for ($j = 1; $j < $s && !$y->equals($n_1); ++$j) { + $y = $y->modPow($two, $n); + if ($y->equals($one)) { + return false; + } + } + + if (!$y->equals($n_1)) { + return false; + } + } + } + return true; + } + + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits. + * + * @param Integer $shift + * @access private + */ + function _lshift($shift) + { + if ( $shift == 0 ) { + return; + } + + $num_digits = (int) ($shift / MATH_BIGINTEGER_BASE); + $shift %= MATH_BIGINTEGER_BASE; + $shift = 1 << $shift; + + $carry = 0; + + for ($i = 0; $i < count($this->value); ++$i) { + $temp = $this->value[$i] * $shift + $carry; + $carry = (int) ($temp / MATH_BIGINTEGER_BASE_FULL); + $this->value[$i] = (int) ($temp - $carry * MATH_BIGINTEGER_BASE_FULL); + } + + if ( $carry ) { + $this->value[] = $carry; + } + + while ($num_digits--) { + array_unshift($this->value, 0); + } + } + + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits. + * + * @param Integer $shift + * @access private + */ + function _rshift($shift) + { + if ($shift == 0) { + return; + } + + $num_digits = (int) ($shift / MATH_BIGINTEGER_BASE); + $shift %= MATH_BIGINTEGER_BASE; + $carry_shift = MATH_BIGINTEGER_BASE - $shift; + $carry_mask = (1 << $shift) - 1; + + if ( $num_digits ) { + $this->value = array_slice($this->value, $num_digits); + } + + $carry = 0; + + for ($i = count($this->value) - 1; $i >= 0; --$i) { + $temp = $this->value[$i] >> $shift | $carry; + $carry = ($this->value[$i] & $carry_mask) << $carry_shift; + $this->value[$i] = $temp; + } + + $this->value = $this->_trim($this->value); + } + + /** + * Normalize + * + * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision + * + * @param Math_BigInteger + * @return Math_BigInteger + * @see _trim() + * @access private + */ + function _normalize($result) + { + $result->precision = $this->precision; + $result->bitmask = $this->bitmask; + + switch ( MATH_BIGINTEGER_MODE ) { + case MATH_BIGINTEGER_MODE_GMP: + if (!empty($result->bitmask->value)) { + $result->value = gmp_and($result->value, $result->bitmask->value); + } + + return $result; + case MATH_BIGINTEGER_MODE_BCMATH: + if (!empty($result->bitmask->value)) { + $result->value = bcmod($result->value, $result->bitmask->value); + } + + return $result; + } + + $value = &$result->value; + + if ( !count($value) ) { + return $result; + } + + $value = $this->_trim($value); + + if (!empty($result->bitmask->value)) { + $length = min(count($value), count($this->bitmask->value)); + $value = array_slice($value, 0, $length); + + for ($i = 0; $i < $length; ++$i) { + $value[$i] = $value[$i] & $this->bitmask->value[$i]; + } + } + + return $result; + } + + /** + * Trim + * + * Removes leading zeros + * + * @param Array $value + * @return Math_BigInteger + * @access private + */ + function _trim($value) + { + for ($i = count($value) - 1; $i >= 0; --$i) { + if ( $value[$i] ) { + break; + } + unset($value[$i]); + } + + return $value; + } + + /** + * Array Repeat + * + * @param $input Array + * @param $multiplier mixed + * @return Array + * @access private + */ + function _array_repeat($input, $multiplier) + { + return ($multiplier) ? array_fill(0, $multiplier, $input) : array(); + } + + /** + * Logical Left Shift + * + * Shifts binary strings $shift bits, essentially multiplying by 2**$shift. + * + * @param $x String + * @param $shift Integer + * @return String + * @access private + */ + function _base256_lshift(&$x, $shift) + { + if ($shift == 0) { + return; + } + + $num_bytes = $shift >> 3; // eg. floor($shift/8) + $shift &= 7; // eg. $shift % 8 + + $carry = 0; + for ($i = strlen($x) - 1; $i >= 0; --$i) { + $temp = ord($x[$i]) << $shift | $carry; + $x[$i] = chr($temp); + $carry = $temp >> 8; + } + $carry = ($carry != 0) ? chr($carry) : ''; + $x = $carry . $x . str_repeat(chr(0), $num_bytes); + } + + /** + * Logical Right Shift + * + * Shifts binary strings $shift bits, essentially dividing by 2**$shift and returning the remainder. + * + * @param $x String + * @param $shift Integer + * @return String + * @access private + */ + function _base256_rshift(&$x, $shift) + { + if ($shift == 0) { + $x = ltrim($x, chr(0)); + return ''; + } + + $num_bytes = $shift >> 3; // eg. floor($shift/8) + $shift &= 7; // eg. $shift % 8 + + $remainder = ''; + if ($num_bytes) { + $start = $num_bytes > strlen($x) ? -strlen($x) : -$num_bytes; + $remainder = substr($x, $start); + $x = substr($x, 0, -$num_bytes); + } + + $carry = 0; + $carry_shift = 8 - $shift; + for ($i = 0; $i < strlen($x); ++$i) { + $temp = (ord($x[$i]) >> $shift) | $carry; + $carry = (ord($x[$i]) << $carry_shift) & 0xFF; + $x[$i] = chr($temp); + } + $x = ltrim($x, chr(0)); + + $remainder = chr($carry >> $carry_shift) . $remainder; + + return ltrim($remainder, chr(0)); + } + + // one quirk about how the following functions are implemented is that PHP defines N to be an unsigned long + // at 32-bits, while java's longs are 64-bits. + + /** + * Converts 32-bit integers to bytes. + * + * @param Integer $x + * @return String + * @access private + */ + function _int2bytes($x) + { + return ltrim(pack('N', $x), chr(0)); + } + + /** + * Converts bytes to 32-bit integers + * + * @param String $x + * @return Integer + * @access private + */ + function _bytes2int($x) + { + $temp = unpack('Nint', str_pad($x, 4, chr(0), STR_PAD_LEFT)); + return $temp['int']; + } + + /** + * DER-encode an integer + * + * The ability to DER-encode integers is needed to create RSA public keys for use with OpenSSL + * + * @see modPow() + * @access private + * @param Integer $length + * @return String + */ + function _encodeASN1Length($length) + { + if ($length <= 0x7F) { + return chr($length); + } + + $temp = ltrim(pack('N', $length), chr(0)); + return pack('Ca*', 0x80 | strlen($temp), $temp); + } +} diff --git a/inc/phpseclib/update.sh b/inc/phpseclib/update.sh new file mode 100755 index 000000000..ff3747a14 --- /dev/null +++ b/inc/phpseclib/update.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +wget -nv https://raw.github.com/phpseclib/phpseclib/master/LICENSE -O LICENSE +wget -nv https://raw.github.com/phpseclib/phpseclib/master/phpseclib/Math/BigInteger.php -O Math_BigInteger.php +wget -nv https://raw.github.com/phpseclib/phpseclib/master/phpseclib/Crypt/AES.php -O Crypt_AES.php +wget -nv https://raw.github.com/phpseclib/phpseclib/master/phpseclib/Crypt/Rijndael.php -O Crypt_Rijndael.php +wget -nv https://raw.github.com/phpseclib/phpseclib/master/phpseclib/Crypt/Base.php -O Crypt_Base.php +wget -nv https://raw.github.com/phpseclib/phpseclib/master/phpseclib/Crypt/Hash.php -O Crypt_Hash.php diff --git a/inc/plugin.php b/inc/plugin.php index 4d3d45f62..dccd37bd9 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -97,7 +97,7 @@ class DokuWiki_Plugin { function localFN($id) { global $conf; $plugin = $this->getPluginName(); - $file = DOKU_CONF.'/plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt'; + $file = DOKU_CONF.'plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt'; if (!@file_exists($file)){ $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; if(!@file_exists($file)){ @@ -199,11 +199,7 @@ class DokuWiki_Plugin { * @return object helper plugin object */ function loadHelper($name, $msg = true){ - if (!plugin_isdisabled($name)){ - $obj = plugin_load('helper',$name); - }else{ - $obj = null; - } + $obj = plugin_load('helper',$name); if (is_null($obj) && $msg) msg("Helper plugin $name is not available or invalid.",-1); return $obj; } diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index 0b4041a77..d80cd4c9e 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -11,15 +11,15 @@ if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); class Doku_Plugin_Controller { - var $list_bytype = array(); - var $tmp_plugins = array(); - var $plugin_cascade = array('default'=>array(),'local'=>array(),'protected'=>array()); - var $last_local_config_file = ''; + protected $list_bytype = array(); + protected $tmp_plugins = array(); + protected $plugin_cascade = array('default'=>array(),'local'=>array(),'protected'=>array()); + protected $last_local_config_file = ''; /** * Populates the master list of plugins */ - function __construct() { + public function __construct() { $this->loadConfig(); $this->_populateMasterList(); } @@ -34,11 +34,13 @@ class Doku_Plugin_Controller { * false to only return enabled plugins, * true to return both enabled and disabled plugins * - * @return array of plugin names + * @return array of + * - plugin names when $type = '' + * - or plugin component names when a $type is given * * @author Andreas Gohr <andi@splitbrain.org> */ - function getList($type='',$all=false){ + public function getList($type='',$all=false){ // request the complete list if (!$type) { @@ -64,9 +66,9 @@ class Doku_Plugin_Controller { * @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 objectreference the plugin object or null on failure + * @return DokuWiki_Plugin|DokuWiki_Syntax_Plugin|null the plugin object or null on failure */ - function load($type,$name,$new=false,$disabled=false){ + public function load($type,$name,$new=false,$disabled=false){ //we keep all loaded plugins available in global scope for reuse global $DOKU_PLUGINS; @@ -108,27 +110,62 @@ class Doku_Plugin_Controller { return $DOKU_PLUGINS[$type][$name]; } - function isdisabled($plugin) { + /** + * Whether plugin is disabled + * + * @param string $plugin name of plugin + * @return bool; true disabled, false enabled + */ + public function isdisabled($plugin) { return empty($this->tmp_plugins[$plugin]); } - function disable($plugin) { + /** + * Disable the plugin + * + * @param string $plugin name of plugin + * @return bool; true saving succeed, false saving failed + */ + public function disable($plugin) { if(array_key_exists($plugin,$this->plugin_cascade['protected'])) return false; $this->tmp_plugins[$plugin] = 0; return $this->saveList(); } - function enable($plugin) { + /** + * Enable the plugin + * + * @param string $plugin name of plugin + * @return bool; true saving succeed, false saving failed + */ + public function enable($plugin) { if(array_key_exists($plugin,$this->plugin_cascade['protected'])) return false; $this->tmp_plugins[$plugin] = 1; return $this->saveList(); } - function get_directory($plugin) { + /** + * Returns directory name of plugin + * + * @param string $plugin name of plugin + * @return string name of directory + */ + public function get_directory($plugin) { return $plugin; } + /** + * Returns cascade of the config files + * + * @return array with arrays of plugin configs + */ + public function getCascade() { + return $this->plugin_cascade; + } + protected function _populateMasterList() { + global $conf; + if ($dh = @opendir(DOKU_PLUGIN)) { $all_plugins = array(); while (false !== ($plugin = readdir($dh))) { @@ -167,6 +204,13 @@ class Doku_Plugin_Controller { } } + /** + * Includes the plugin config $files + * and returns the entries of the $plugins array set in these files + * + * @param array $files list of files to include, latter overrides previous + * @return array with entries of the $plugins arrays of the included files + */ protected function checkRequire($files) { $plugins = array(); foreach($files as $file) { @@ -177,14 +221,15 @@ class Doku_Plugin_Controller { return $plugins; } - function getCascade() { - return $this->plugin_cascade; - } - /** * Save the current list of plugins + * + * @param bool $forceSave; + * false to save only when config changed + * true to always save + * @return bool; true saving succeed, false saving failed */ - function saveList($forceSave = false) { + protected function saveList($forceSave = false) { global $conf; if (empty($this->tmp_plugins)) return false; @@ -204,7 +249,7 @@ class Doku_Plugin_Controller { $backup = $file.'.bak'; if (@file_exists($backup)) @unlink($backup); if (!@copy($file,$backup)) return false; - if ($conf['fperm']) chmod($backup, $conf['fperm']); + if (!empty($conf['fperm'])) chmod($backup, $conf['fperm']); } //check if can open for writing, else restore return io_saveFile($file,$out); @@ -214,9 +259,10 @@ class Doku_Plugin_Controller { /** * Rebuild the set of local plugins + * * @return array array of plugins to be saved in end($config_cascade['plugins']['local']) */ - function rebuildLocal() { + protected function rebuildLocal() { //assign to local variable to avoid overwriting $backup = $this->tmp_plugins; //Can't do anything about protected one so rule them out completely @@ -236,7 +282,7 @@ class Doku_Plugin_Controller { * Build the list of plugins and cascade * */ - function loadConfig() { + protected function loadConfig() { global $config_cascade; foreach(array('default','protected') as $type) { if(array_key_exists($type,$config_cascade['plugins'])) @@ -251,7 +297,18 @@ class Doku_Plugin_Controller { $this->tmp_plugins = array_merge($this->plugin_cascade['default'],$this->plugin_cascade['local'],$this->plugin_cascade['protected']); } - function _getListByType($type, $enabled) { + /** + * Returns a list of available plugin components of given type + * + * @param string $type, plugin_type name; + * the type of plugin to return, + * @param bool $enabled; + * true to return enabled plugins, + * false to return disabled plugins + * + * @return array of plugin components of requested type + */ + protected function _getListByType($type, $enabled) { $master_list = $enabled ? array_keys(array_filter($this->tmp_plugins)) : array_keys(array_filter($this->tmp_plugins,array($this,'negate'))); $plugins = array(); @@ -276,14 +333,29 @@ class Doku_Plugin_Controller { return $plugins; } - function _splitName($name) { + /** + * Split name in a plugin name and a component name + * + * @param string $name + * @return array with + * - plugin name + * - and component name when available, otherwise empty string + */ + protected function _splitName($name) { if (array_search($name, array_keys($this->tmp_plugins)) === false) { return explode('_',$name,2); } return array($name,''); } - function negate($input) { + + /** + * Returns inverse boolean value of the input + * + * @param mixed $input + * @return bool inversed boolean value of input + */ + protected function negate($input) { return !(bool) $input; } } diff --git a/inc/pluginutils.php b/inc/pluginutils.php index 7c37d4f7f..894bbefb6 100644 --- a/inc/pluginutils.php +++ b/inc/pluginutils.php @@ -14,31 +14,92 @@ if(!defined('DOKU_PLUGIN_NAME_REGEX')) define('DOKU_PLUGIN_NAME_REGEX', '[a-zA-Z /** * Original plugin functions, remain for backwards compatibility */ + +/** + * Return list of available plugins + * + * @param string $type type of plugins; empty string for all + * @param bool $all; true to retrieve all, false to retrieve only enabled plugins + * @return array with plugin names or plugin component names + */ function plugin_list($type='',$all=false) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; return $plugin_controller->getList($type,$all); } + +/** + * Returns plugin object + * Returns only new instances of a plugin when $new is true or if plugin is not Singleton, + * otherwise an already loaded instance. + * + * @param $type string type of plugin to load + * @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 + */ function plugin_load($type,$name,$new=false,$disabled=false) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; return $plugin_controller->load($type,$name,$new,$disabled); } + +/** + * Whether plugin is disabled + * + * @param string $plugin name of plugin + * @return bool; true disabled, false enabled + */ function plugin_isdisabled($plugin) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; return $plugin_controller->isdisabled($plugin); } + +/** + * Enable the plugin + * + * @param string $plugin name of plugin + * @return bool; true saving succeed, false saving failed + */ function plugin_enable($plugin) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; return $plugin_controller->enable($plugin); } + +/** + * Disable the plugin + * + * @param string $plugin name of plugin + * @return bool; true saving succeed, false saving failed + */ function plugin_disable($plugin) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; return $plugin_controller->disable($plugin); } + +/** + * Returns directory name of plugin + * + * @param string $plugin name of plugin + * @return string name of directory + */ function plugin_directory($plugin) { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; return $plugin_controller->get_directory($plugin); } + +/** + * Returns cascade of the config files + * + * @return array with arrays of plugin configs + */ function plugin_getcascade() { + /** @var $plugin_controller Doku_Plugin_Controller */ global $plugin_controller; return $plugin_controller->getCascade(); } diff --git a/inc/search.php b/inc/search.php index 6927fff5f..c2d31b959 100644 --- a/inc/search.php +++ b/inc/search.php @@ -9,14 +9,15 @@ if(!defined('DOKU_INC')) die('meh.'); /** - * recurse direcory + * Recurse directory * * This function recurses into a given base directory * and calls the supplied function for each file and directory * - * @param array ref $data The results of the search are stored here + * @param array &$data The results of the search are stored here * @param string $base Where to start the search * @param callback $func Callback (function name or array with object,method) + * @param array $opts option array will be given to the Callback * @param string $dir Current directory beyond $base * @param int $lvl Recursion Level * @param mixed $sort 'natural' to use natural order sorting (default); 'date' to sort by filemtime; leave empty to skip sorting. @@ -68,12 +69,12 @@ function search(&$data,$base,$func,$opts,$dir='',$lvl=1,$sort='natural'){ * decide if this directory should be traversed (true) or not (false) * The function has to accept the following parameters: * - * &$data - Reference to the result data structure - * $base - Base usually $conf['datadir'] - * $file - current file or directory relative to $base - * $type - Type either 'd' for directory or 'f' for file - * $lvl - Current recursion depht - * $opts - option array as given to search() + * array &$data - Reference to the result data structure + * string $base - Base usually $conf['datadir'] + * string $file - current file or directory relative to $base + * string $type - Type either 'd' for directory or 'f' for file + * int $lvl - Current recursion depht + * array $opts - option array as given to search() * * return values for files are ignored * @@ -110,7 +111,7 @@ function search_index(&$data,$base,$file,$type,$lvl,$opts){ $opts = array( 'pagesonly' => true, 'listdirs' => true, - 'listfiles' => !$opts['nofiles'], + 'listfiles' => empty($opts['nofiles']), 'sneakyacl' => $conf['sneaky_index'], // Hacky, should rather use recmatch 'depth' => preg_match('#^'.preg_quote($file, '#').'(/|$)#','/'.$opts['ns']) ? 0 : -1 @@ -273,45 +274,6 @@ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){ return true; } -/** - * Reference search - * This fuction searches for existing references to a given media file - * and returns an array with the found pages. It doesn't pay any - * attention to ACL permissions to find every reference. The caller - * must check if the user has the appropriate rights to see the found - * page and eventually have to prevent the result from displaying. - * - * @param array $data Reference to the result data structure - * @param string $base Base usually $conf['datadir'] - * @param string $file current file or directory relative to $base - * @param char $type Type either 'd' for directory or 'f' for file - * @param int $lvl Current recursion depht - * @param mixed $opts option array as given to search() - * - * $opts['query'] is the demanded media file name - * - * @author Andreas Gohr <andi@splitbrain.org> - * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> - */ -function search_reference(&$data,$base,$file,$type,$lvl,$opts){ - global $conf; - - //we do nothing with directories - if($type == 'd') return true; - - //only search txt files - if(substr($file,-4) != '.txt') return true; - - //we finish after 'cnt' references found. The return value - //'false' will skip subdirectories to speed search up. - $cnt = $conf['refshow'] > 0 ? $conf['refshow'] : 1; - if(count($data) >= $cnt) return false; - - $reg = '\{\{ *\:?'.$opts['query'].' *(\|.*)?\}\}'; - search_regex($data,$base,$file,$reg,array($opts['query'])); - return true; -} - /* ------------- helper functions below -------------- */ /** @@ -373,6 +335,15 @@ function pathID($path,$keeptxt=false){ * showhidden bool show hidden files too * firsthead bool return first heading for pages * + * @param array &$data - Reference to the result data structure + * @param string $base - Base usually $conf['datadir'] + * @param string $file - current file or directory relative to $base + * @param string $type - Type either 'd' for directory or 'f' for file + * @param int $lvl - Current recursion depht + * @param array $opts - option array as given to search() + * @return bool if this directory should be traversed (true) or not (false) + * return value is ignored for files + * * @author Andreas Gohr <gohr@cosmocode.de> */ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ @@ -406,7 +377,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ } // check ACL - if(!$opts['skipacl']){ + if(empty($opts['skipacl'])){ if($type == 'd'){ $item['perm'] = auth_quickaclcheck($item['id'].':*'); }else{ @@ -418,17 +389,17 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){ // are we done here maybe? if($type == 'd'){ - if(!$opts['listdirs']) return $return; - if(!$opts['skipacl'] && $opts['sneakyacl'] && $item['perm'] < AUTH_READ) return false; //neither list nor recurse - if($opts['dirmatch'] && !preg_match('/'.$opts['dirmatch'].'/',$file)) return $return; - if($opts['nsmatch'] && !preg_match('/'.$opts['nsmatch'].'/',$item['ns'])) return $return; + if(empty($opts['listdirs'])) return $return; + if(empty($opts['skipacl']) && !empty($opts['sneakyacl']) && $item['perm'] < AUTH_READ) return false; //neither list nor recurse + if(!empty($opts['dirmatch']) && !preg_match('/'.$opts['dirmatch'].'/',$file)) return $return; + if(!empty($opts['nsmatch']) && !preg_match('/'.$opts['nsmatch'].'/',$item['ns'])) return $return; }else{ - if(!$opts['listfiles']) return $return; - if(!$opts['skipacl'] && $item['perm'] < AUTH_READ) return $return; - if($opts['pagesonly'] && (substr($file,-4) != '.txt')) return $return; - if(!$opts['showhidden'] && isHiddenPage($item['id'])) return $return; - if($opts['filematch'] && !preg_match('/'.$opts['filematch'].'/',$file)) return $return; - if($opts['idmatch'] && !preg_match('/'.$opts['idmatch'].'/',$item['id'])) return $return; + if(empty($opts['listfiles'])) return $return; + if(empty($opts['skipacl']) && $item['perm'] < AUTH_READ) return $return; + if(!empty($opts['pagesonly']) && (substr($file,-4) != '.txt')) return $return; + if(empty($opts['showhidden']) && isHiddenPage($item['id'])) return $return; + if(!empty($opts['filematch']) && !preg_match('/'.$opts['filematch'].'/',$file)) return $return; + if(!empty($opts['idmatch']) && !preg_match('/'.$opts['idmatch'].'/',$item['id'])) return $return; } // still here? prepare the item diff --git a/inc/subscription.php b/inc/subscription.php index 4248e4b11..ddf2f39e6 100644 --- a/inc/subscription.php +++ b/inc/subscription.php @@ -62,7 +62,7 @@ class Subscription { return false; } - if($conf['dperm']) chmod($lock, $conf['dperm']); + if(!empty($conf['dperm'])) chmod($lock, $conf['dperm']); return true; } @@ -617,7 +617,7 @@ class Subscription { * @param string $rev The revision of the page, set to the current revision of the page $id if not set * @return string */ - protected function getMessageID($id, $rev = NULL) { + protected function getMessageID($id, $rev = null) { static $listid = null; if (is_null($listid)) { $server = parse_url(DOKU_URL, PHP_URL_HOST); @@ -694,4 +694,4 @@ class Subscription { function subscription_addresslist(&$data) { $sub = new Subscription(); $sub->notifyaddresses($data); -}
\ No newline at end of file +} diff --git a/inc/template.php b/inc/template.php index a87650b84..60e178d1a 100644 --- a/inc/template.php +++ b/inc/template.php @@ -33,11 +33,13 @@ function template($file) { * This replaces the deprecated DOKU_TPLINC constant * * @author Andreas Gohr <andi@splitbrain.org> + * @param string $tpl The template to use, default to current one * @return string */ -function tpl_incdir() { +function tpl_incdir($tpl='') { global $conf; - return DOKU_INC.'lib/tpl/'.$conf['template'].'/'; + if(!$tpl) $tpl = $conf['template']; + return DOKU_INC.'lib/tpl/'.$tpl.'/'; } /** @@ -46,11 +48,13 @@ function tpl_incdir() { * This replaces the deprecated DOKU_TPL constant * * @author Andreas Gohr <andi@splitbrain.org> + * @param string $tpl The template to use, default to current one * @return string */ -function tpl_basedir() { +function tpl_basedir($tpl='') { global $conf; - return DOKU_BASE.'lib/tpl/'.$conf['template'].'/'; + if(!$tpl) $tpl = $conf['template']; + return DOKU_BASE.'lib/tpl/'.$tpl.'/'; } /** @@ -219,7 +223,7 @@ function tpl_toc($return = false) { if(in_array($class, $pluginlist)) { // attempt to load the plugin /** @var $plugin DokuWiki_Admin_Plugin */ - $plugin =& plugin_load('admin', $class); + $plugin = plugin_load('admin', $class); } } if( ($plugin !== null) && (!$plugin->forAdminOnly() || $INFO['isadmin']) ) { @@ -253,7 +257,7 @@ function tpl_admin() { if(in_array($class, $pluginlist)) { // attempt to load the plugin /** @var $plugin DokuWiki_Admin_Plugin */ - $plugin =& plugin_load('admin', $class); + $plugin = plugin_load('admin', $class); } } @@ -286,17 +290,16 @@ function tpl_metaheaders($alt = true) { global $QUERY; global $lang; global $conf; + global $updateVersion; // prepare the head array $head = array(); // prepare seed for js and css - $tseed = 0; + $tseed = $updateVersion; $depends = getConfigFiles('main'); - foreach($depends as $f) { - $time = @filemtime($f); - if($time > $tseed) $tseed = $time; - } + foreach($depends as $f) $tseed .= @filemtime($f); + $tseed = md5($tseed); // the usual stuff $head['meta'][] = array('name'=> 'generator', 'content'=> 'DokuWiki'); @@ -315,11 +318,11 @@ function tpl_metaheaders($alt = true) { if($alt) { $head['link'][] = array( 'rel' => 'alternate', 'type'=> 'application/rss+xml', - 'title'=> 'Recent Changes', 'href'=> DOKU_BASE.'feed.php' + 'title'=> $lang['btn_recent'], 'href'=> DOKU_BASE.'feed.php' ); $head['link'][] = array( 'rel' => 'alternate', 'type'=> 'application/rss+xml', - 'title'=> 'Current Namespace', + 'title'=> $lang['currentns'], 'href' => DOKU_BASE.'feed.php?mode=list&ns='.$INFO['namespace'] ); if(($ACT == 'show' || $ACT == 'search') && $INFO['writable']) { @@ -333,21 +336,21 @@ function tpl_metaheaders($alt = true) { if($ACT == 'search') { $head['link'][] = array( 'rel' => 'alternate', 'type'=> 'application/rss+xml', - 'title'=> 'Search Result', + 'title'=> $lang['searchresult'], 'href' => DOKU_BASE.'feed.php?mode=search&q='.$QUERY ); } if(actionOK('export_xhtml')) { $head['link'][] = array( - 'rel' => 'alternate', 'type'=> 'text/html', 'title'=> 'Plain HTML', + 'rel' => 'alternate', 'type'=> 'text/html', 'title'=> $lang['plainhtml'], 'href'=> exportlink($ID, 'xhtml', '', false, '&') ); } if(actionOK('export_raw')) { $head['link'][] = array( - 'rel' => 'alternate', 'type'=> 'text/plain', 'title'=> 'Wiki Markup', + 'rel' => 'alternate', 'type'=> 'text/plain', 'title'=> $lang['wikimarkup'], 'href'=> exportlink($ID, 'raw', '', false, '&') ); } @@ -398,7 +401,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'] && $_SERVER['REMOTE_USER']) { + if($conf['useacl'] && !empty($_SERVER['REMOTE_USER'])) { $script .= "var SIG='".toolbar_signature()."';"; } $script .= 'var JSINFO = '.$json->encode($JSINFO).';'; @@ -470,7 +473,7 @@ function tpl_link($url, $name, $more = '', $return = false) { * @author Andreas Gohr <andi@splitbrain.org> */ function tpl_pagelink($id, $name = null) { - print html_wikilink($id, $name); + print '<bdi>'.html_wikilink($id, $name).'</bdi>'; return true; } @@ -543,6 +546,7 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals * @var string $accesskey * @var string $id * @var string $method + * @var bool $nofollow * @var array $params */ extract($data); @@ -557,10 +561,11 @@ function tpl_actionlink($type, $pre = '', $suf = '', $inner = '', $return = fals $akey = 'accesskey="'.$accesskey.'" '; $addTitle = ' ['.strtoupper($accesskey).']'; } + $rel = $nofollow ? 'rel="nofollow" ' : ''; $out = tpl_link( $linktarget, $pre.(($inner) ? $inner : $caption).$suf, 'class="action '.$type.'" '. - $akey.'rel="nofollow" '. + $akey.$rel. 'title="'.hsc($caption).$addTitle.'"', 1 ); } @@ -597,15 +602,18 @@ function tpl_get_action($type) { global $INFO; global $REV; global $ACT; + global $conf; // check disabled actions and fix the badly named ones if($type == 'history') $type = 'revisions'; + if ($type == 'subscription') $type = 'subscribe'; if(!actionOK($type)) return false; $accesskey = null; $id = $ID; $method = 'get'; $params = array('do' => $type); + $nofollow = true; switch($type) { case 'edit': // most complicated type - we need to decide on current action @@ -643,6 +651,10 @@ function tpl_get_action($type) { break; case 'index': $accesskey = 'x'; + // allow searchbots to get to the sitemap from the homepage (when dokuwiki isn't providing a sitemap.xml) + if ($conf['start'] == $ID && !$conf['sitemap']) { + $nofollow = false; + } break; case 'top': $accesskey = 't'; @@ -669,12 +681,12 @@ function tpl_get_action($type) { } break; case 'register': - if($_SERVER['REMOTE_USER']) { + if(!empty($_SERVER['REMOTE_USER'])) { return false; } break; case 'resendpwd': - if($_SERVER['REMOTE_USER']) { + if(!empty($_SERVER['REMOTE_USER'])) { return false; } break; @@ -690,10 +702,6 @@ function tpl_get_action($type) { $params['rev'] = $REV; $params['sectok'] = getSecurityToken(); break; - /** @noinspection PhpMissingBreakStatementInspection */ - case 'subscription': - $type = 'subscribe'; - $params['do'] = 'subscribe'; case 'subscribe': if(!$_SERVER['REMOTE_USER']) { return false; @@ -713,7 +721,7 @@ function tpl_get_action($type) { return '[unknown %s type]'; break; } - return compact('accesskey', 'type', 'id', 'method', 'params'); + return compact('accesskey', 'type', 'id', 'method', 'params', 'nofollow'); } /** @@ -766,7 +774,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) { // don't print the search form if search action has been disabled if(!actionOK('search')) return false; - print '<form action="'.wl().'" accept-charset="utf-8" class="search" id="dw__search" method="get"><div class="no">'; + print '<form action="'.wl().'" accept-charset="utf-8" class="search" id="dw__search" method="get" role="search"><div class="no">'; print '<input type="hidden" name="do" value="search" />'; print '<input type="text" '; if($ACT == 'search') print 'value="'.htmlspecialchars($QUERY).'" '; @@ -794,13 +802,7 @@ function tpl_breadcrumbs($sep = '•') { $crumbs = breadcrumbs(); //setup crumb trace - //reverse crumborder in right-to-left mode, add RLM character to fix heb/eng display mixups - if($lang['direction'] == 'rtl') { - $crumbs = array_reverse($crumbs, true); - $crumbs_sep = ' ‏<span class="bcsep">'.$sep.'</span>‏ '; - } else { - $crumbs_sep = ' <span class="bcsep">'.$sep.'</span> '; - } + $crumbs_sep = ' <span class="bcsep">'.$sep.'</span> '; //render crumbs, highlight the last one print '<span class="bchead">'.$lang['breadcrumb'].':</span>'; @@ -810,7 +812,9 @@ function tpl_breadcrumbs($sep = '•') { $i++; echo $crumbs_sep; if($i == $last) print '<span class="curid">'; + print '<bdi>'; tpl_link(wl($id), hsc($name), 'class="breadcrumbs" title="'.$id.'"'); + print '</bdi>'; if($i == $last) print '</span>'; } return true; @@ -883,7 +887,7 @@ function tpl_userinfo() { global $lang; global $INFO; if(isset($_SERVER['REMOTE_USER'])) { - print $lang['loggedinas'].': '.hsc($INFO['userinfo']['name']).' ('.hsc($_SERVER['REMOTE_USER']).')'; + print $lang['loggedinas'].': <bdi>'.hsc($INFO['userinfo']['name']).'</bdi> (<bdi>'.hsc($_SERVER['REMOTE_USER']).'</bdi>)'; return true; } return false; @@ -922,14 +926,14 @@ function tpl_pageinfo($ret = false) { // print it if($INFO['exists']) { $out = ''; - $out .= $fn; + $out .= '<bdi>'.$fn.'</bdi>'; $out .= ' · '; $out .= $lang['lastmod']; $out .= ': '; $out .= $date; if($INFO['editor']) { $out .= ' '.$lang['by'].' '; - $out .= editorinfo($INFO['editor']); + $out .= '<bdi>'.editorinfo($INFO['editor']).'</bdi>'; } else { $out .= ' ('.$lang['external_edit'].')'; } @@ -937,7 +941,7 @@ function tpl_pageinfo($ret = false) { $out .= ' · '; $out .= $lang['lockedby']; $out .= ': '; - $out .= editorinfo($INFO['locked']); + $out .= '<bdi>'.editorinfo($INFO['locked']).'</bdi>'; } if($ret) { return $out; @@ -1187,6 +1191,34 @@ function tpl_getLang($id) { } /** + * Retrieve a language dependent file and pass to xhtml renderer for display + * template equivalent of p_locale_xhtml() + * + * @param string $id id of language dependent wiki page + * @return string parsed contents of the wiki page in xhtml format + */ +function tpl_locale_xhtml($id) { + return p_cached_output(tpl_localeFN($id)); +} + +/** + * Prepends appropriate path for a language dependent filename + */ +function tpl_localeFN($id) { + $path = tpl_incdir().'lang/'; + global $conf; + $file = DOKU_CONF.'/template_lang/'.$conf['template'].'/'.$conf['lang'].'/'.$id.'.txt'; + if (!@file_exists($file)){ + $file = $path.$conf['lang'].'/'.$id.'.txt'; + if(!@file_exists($file)){ + //fall back to english + $file = $path.'en/'.$id.'.txt'; + } + } + return $file; +} + +/** * prints the "main content" in the mediamanger popup * * Depending on the user's actions this may be a list of @@ -1199,7 +1231,7 @@ function tpl_getLang($id) { * @param bool $fromajax - set true when calling this function via ajax * @author Andreas Gohr <andi@splitbrain.org> */ -function tpl_mediaContent($fromajax = false) { +function tpl_mediaContent($fromajax = false, $sort='natural') { global $IMG; global $AUTH; global $INUSE; @@ -1229,7 +1261,7 @@ function tpl_mediaContent($fromajax = false) { if($do == 'filesinuse') { media_filesinuse($INUSE, $IMG); } elseif($do == 'filelist') { - media_filelist($NS, $AUTH, $JUMPTO); + media_filelist($NS, $AUTH, $JUMPTO,false,$sort); } elseif($do == 'searchlist') { media_searchlist($INPUT->str('q'), $NS, $AUTH); } else { @@ -1377,7 +1409,7 @@ function tpl_actiondropdown($empty = '', $button = '>') { echo '<div class="no">'; echo '<input type="hidden" name="id" value="'.$ID.'" />'; if($REV) echo '<input type="hidden" name="rev" value="'.$REV.'" />'; - if ($_SERVER['REMOTE_USER']) { + if (!empty($_SERVER['REMOTE_USER'])) { echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'; } @@ -1463,8 +1495,8 @@ function tpl_license($img = 'badge', $imgonly = false, $return = false, $wrap = } if(!$imgonly) { $out .= $lang['license'].' '; - $out .= '<a href="'.$lic['url'].'" rel="license" class="urlextern"'.$target; - $out .= '>'.$lic['name'].'</a>'; + $out .= '<bdi><a href="'.$lic['url'].'" rel="license" class="urlextern"'.$target; + $out .= '>'.$lic['name'].'</a></bdi>'; } if($wrap) $out .= '</div>'; @@ -1662,18 +1694,6 @@ function tpl_includeFile($file) { } /** - * Returns icon from data/media root directory if it exists, otherwise - * the one in the template's image directory. - * - * @deprecated Use tpl_getMediaFile() instead - * @author Anika Henke <anika@selfthinker.org> - */ -function tpl_getFavicon($abs = false, $fileName = 'favicon.ico') { - $look = array(":wiki:$fileName", ":$fileName", "images/$fileName"); - return tpl_getMediaFile($look, $abs); -} - -/** * Returns <link> tag for various icon types (favicon|mobile|generic) * * @author Anika Henke <anika@selfthinker.org> @@ -1748,5 +1768,23 @@ function tpl_media() { echo '</div>'.NL; } +/** + * Return useful layout classes + * + * @author Anika Henke <anika@selfthinker.org> + */ +function tpl_classes() { + global $ACT, $conf, $ID, $INFO; + $classes = array( + 'dokuwiki', + 'mode_'.$ACT, + 'tpl_'.$conf['template'], + !empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '', + $INFO['exists'] ? '' : 'notFound', + ($ID == $conf['start']) ? 'home' : '', + ); + return join(' ', $classes); +} + //Setup VIM: ex: et ts=4 : |