diff options
29 files changed, 319 insertions, 241 deletions
diff --git a/_test/tests/inc/httpclient_http.test.php b/_test/tests/inc/httpclient_http.test.php index 9cae3736a..9959a1f06 100644 --- a/_test/tests/inc/httpclient_http.test.php +++ b/_test/tests/inc/httpclient_http.test.php @@ -124,6 +124,11 @@ class httpclient_http_test extends DokuWikiTest { $http->max_bodysize = 250; $data = $http->get($this->server.'/stream/30'); $this->assertTrue($data === false, 'HTTP response'); + $http->max_bodysize_abort = false; + $data = $http->get($this->server.'/stream/30'); + $this->assertFalse($data === false, 'HTTP response'); + /* should read no more than max_bodysize+1 */ + $this->assertLessThanOrEqual(251,strlen($data)); } /** @@ -176,5 +181,15 @@ class httpclient_http_test extends DokuWikiTest { $this->assertArrayHasKey('foo',$http->resp_headers); $this->assertEquals('bar',$http->resp_headers['foo']); } + + /** + * @group internet + */ + function test_chunked(){ + $http = new HTTPClient(); + $data = $http->get('http://whoopdedo.org/cgi-bin/chunked/2550'); + $this->assertFalse($data === false, 'HTTP response'); + $this->assertEquals(2550,strlen($data)); + } } //Setup VIM: ex: et ts=4 : diff --git a/inc/DifferenceEngine.php b/inc/DifferenceEngine.php index 0a7ce8e7c..1b68cf6d3 100644 --- a/inc/DifferenceEngine.php +++ b/inc/DifferenceEngine.php @@ -1039,8 +1039,8 @@ class TableDiffFormatter extends DiffFormatter { // Preserve whitespaces by converting some to non-breaking spaces. // Do not convert all of them to allow word-wrap. $val = parent::format($diff); - $val = str_replace(' ',' ', $val); - $val = preg_replace('/ (?=<)|(?<=[ >]) /', ' ', $val); + $val = str_replace(' ','  ', $val); + $val = preg_replace('/ (?=<)|(?<=[ >]) /', ' ', $val); return $val; } @@ -1078,7 +1078,7 @@ class TableDiffFormatter extends DiffFormatter { } function emptyLine() { - return '<td colspan="2"> </td>'; + return '<td colspan="2"> </td>'; } function contextLine($line) { @@ -1132,8 +1132,8 @@ class InlineDiffFormatter extends DiffFormatter { // Preserve whitespaces by converting some to non-breaking spaces. // Do not convert all of them to allow word-wrap. $val = parent::format($diff); - $val = str_replace(' ',' ', $val); - $val = preg_replace('/ (?=<)|(?<=[ >]) /', ' ', $val); + $val = str_replace(' ','  ', $val); + $val = preg_replace('/ (?=<)|(?<=[ >]) /', ' ', $val); return $val; } diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 26bee52a7..a25846c31 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -61,6 +61,8 @@ class DokuHTTPClient extends HTTPClient { } +class HTTPClientException extends Exception { } + /** * This class implements a basic HTTP client * @@ -227,7 +229,7 @@ class HTTPClient { $path = $uri['path']; if(empty($path)) $path = '/'; if(!empty($uri['query'])) $path .= '?'.$uri['query']; - if(isset($uri['port']) && !empty($uri['port'])) $port = $uri['port']; + if(!empty($uri['port'])) $port = $uri['port']; if(isset($uri['user'])) $this->user = $uri['user']; if(isset($uri['pass'])) $this->pass = $uri['pass']; @@ -249,7 +251,7 @@ class HTTPClient { // prepare headers $headers = $this->headers; $headers['Host'] = $uri['host']; - if($uri['port']) $headers['Host'].= ':'.$uri['port']; + if(!empty($uri['port'])) $headers['Host'].= ':'.$uri['port']; $headers['User-Agent'] = $this->agent; $headers['Referer'] = $this->referer; if ($this->keep_alive) { @@ -279,16 +281,13 @@ class HTTPClient { $headers['Proxy-Authorization'] = 'Basic '.base64_encode($this->proxy_user.':'.$this->proxy_pass); } - // stop time - $start = time(); - // already connected? $connectionId = $this->_uniqueConnectionId($server,$port); - $this->_debug('connection pool', $this->connections); + $this->_debug('connection pool', self::$connections); $socket = null; - if (isset($this->connections[$connectionId])) { + if (isset(self::$connections[$connectionId])) { $this->_debug('reusing connection', $connectionId); - $socket = $this->connections[$connectionId]; + $socket = self::$connections[$connectionId]; } if (is_null($socket) || feof($socket)) { $this->_debug('opening connection', $connectionId); @@ -302,222 +301,161 @@ class HTTPClient { // keep alive? if ($this->keep_alive) { - $this->connections[$connectionId] = $socket; + self::$connections[$connectionId] = $socket; } else { - unset($this->connections[$connectionId]); - } - } - - //set blocking - stream_set_blocking($socket,1); - - // build request - $request = "$method $request_url HTTP/".$this->http.HTTP_NL; - $request .= $this->_buildHeaders($headers); - $request .= $this->_getCookies(); - $request .= HTTP_NL; - $request .= $data; - - $this->_debug('request',$request); - - // select parameters - $sel_r = null; - $sel_w = array($socket); - $sel_e = null; - - // send request - $towrite = strlen($request); - $written = 0; - while($written < $towrite){ - // check timeout - if(time()-$start > $this->timeout){ - $this->status = -100; - $this->error = sprintf('Timeout while sending request (%.3fs)',$this->_time() - $this->start); - unset($this->connections[$connectionId]); - return false; - } - - // wait for stream ready or timeout (1sec) - if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){ - usleep(1000); - continue; - } - - // write to stream - $ret = fwrite($socket, substr($request,$written,4096)); - if($ret === false){ - $this->status = -100; - $this->error = 'Failed writing to socket'; - unset($this->connections[$connectionId]); - return false; + unset(self::$connections[$connectionId]); } - $written += $ret; } - // continue non-blocking - stream_set_blocking($socket,0); - - // read headers from socket - $r_headers = ''; - do{ - if(time()-$start > $this->timeout){ - $this->status = -100; - $this->error = sprintf('Timeout while reading headers (%.3fs)',$this->_time() - $this->start); - unset($this->connections[$connectionId]); - return false; - } - if(feof($socket)){ - $this->error = 'Premature End of File (socket)'; - unset($this->connections[$connectionId]); - return false; - } - usleep(1000); - $r_headers .= fgets($socket,1024); - }while(!preg_match('/\r?\n\r?\n$/',$r_headers)); - - $this->_debug('response headers',$r_headers); - - // check if expected body size exceeds allowance - if($this->max_bodysize && preg_match('/\r?\nContent-Length:\s*(\d+)\r?\n/i',$r_headers,$match)){ - if($match[1] > $this->max_bodysize){ - $this->error = 'Reported content length exceeds allowed response size'; - if ($this->max_bodysize_abort) - unset($this->connections[$connectionId]); - return false; + try { + //set non-blocking + stream_set_blocking($socket, false); + + // build request + $request = "$method $request_url HTTP/".$this->http.HTTP_NL; + $request .= $this->_buildHeaders($headers); + $request .= $this->_getCookies(); + $request .= HTTP_NL; + $request .= $data; + + $this->_debug('request',$request); + $this->_sendData($socket, $request, 'request'); + + // read headers from socket + $r_headers = ''; + do{ + $r_line = $this->_readLine($socket, 'headers'); + $r_headers .= $r_line; + }while($r_line != "\r\n" && $r_line != "\n"); + + $this->_debug('response headers',$r_headers); + + // check if expected body size exceeds allowance + if($this->max_bodysize && preg_match('/\r?\nContent-Length:\s*(\d+)\r?\n/i',$r_headers,$match)){ + if($match[1] > $this->max_bodysize){ + if ($this->max_bodysize_abort) + throw new HTTPClientException('Reported content length exceeds allowed response size'); + else + $this->error = 'Reported content length exceeds allowed response size'; + } } - } - // get Status - if (!preg_match('/^HTTP\/(\d\.\d)\s*(\d+).*?\n/', $r_headers, $m)) { - $this->error = 'Server returned bad answer'; - unset($this->connections[$connectionId]); - return false; - } - $this->status = $m[2]; - - // handle headers and cookies - $this->resp_headers = $this->_parseHeaders($r_headers); - if(isset($this->resp_headers['set-cookie'])){ - foreach ((array) $this->resp_headers['set-cookie'] as $cookie){ - list($cookie) = explode(';',$cookie,2); - list($key,$val) = explode('=',$cookie,2); - $key = trim($key); - if($val == 'deleted'){ - if(isset($this->cookies[$key])){ - unset($this->cookies[$key]); + // get Status + if (!preg_match('/^HTTP\/(\d\.\d)\s*(\d+).*?\n/', $r_headers, $m)) + throw new HTTPClientException('Server returned bad answer'); + + $this->status = $m[2]; + + // handle headers and cookies + $this->resp_headers = $this->_parseHeaders($r_headers); + if(isset($this->resp_headers['set-cookie'])){ + foreach ((array) $this->resp_headers['set-cookie'] as $cookie){ + list($cookie) = explode(';',$cookie,2); + list($key,$val) = explode('=',$cookie,2); + $key = trim($key); + if($val == 'deleted'){ + if(isset($this->cookies[$key])){ + unset($this->cookies[$key]); + } + }elseif($key){ + $this->cookies[$key] = $val; } - }elseif($key){ - $this->cookies[$key] = $val; } } - } - - $this->_debug('Object headers',$this->resp_headers); - // check server status code to follow redirect - if($this->status == 301 || $this->status == 302 ){ - // close the connection because we don't handle content retrieval here - // that's the easiest way to clean up the connection - fclose($socket); - unset($this->connections[$connectionId]); + $this->_debug('Object headers',$this->resp_headers); - if (empty($this->resp_headers['location'])){ - $this->error = 'Redirect but no Location Header found'; - return false; - }elseif($this->redirect_count == $this->max_redirect){ - $this->error = 'Maximum number of redirects exceeded'; - return false; - }else{ - $this->redirect_count++; - $this->referer = $url; - // handle non-RFC-compliant relative redirects - if (!preg_match('/^http/i', $this->resp_headers['location'])){ - if($this->resp_headers['location'][0] != '/'){ - $this->resp_headers['location'] = $uri['scheme'].'://'.$uri['host'].':'.$uri['port']. - dirname($uri['path']).'/'.$this->resp_headers['location']; - }else{ - $this->resp_headers['location'] = $uri['scheme'].'://'.$uri['host'].':'.$uri['port']. - $this->resp_headers['location']; + // check server status code to follow redirect + if($this->status == 301 || $this->status == 302 ){ + if (empty($this->resp_headers['location'])){ + throw new HTTPClientException('Redirect but no Location Header found'); + }elseif($this->redirect_count == $this->max_redirect){ + throw new HTTPClientException('Maximum number of redirects exceeded'); + }else{ + // close the connection because we don't handle content retrieval here + // that's the easiest way to clean up the connection + fclose($socket); + unset(self::$connections[$connectionId]); + + $this->redirect_count++; + $this->referer = $url; + // handle non-RFC-compliant relative redirects + if (!preg_match('/^http/i', $this->resp_headers['location'])){ + if($this->resp_headers['location'][0] != '/'){ + $this->resp_headers['location'] = $uri['scheme'].'://'.$uri['host'].':'.$uri['port']. + dirname($uri['path']).'/'.$this->resp_headers['location']; + }else{ + $this->resp_headers['location'] = $uri['scheme'].'://'.$uri['host'].':'.$uri['port']. + $this->resp_headers['location']; + } } + // perform redirected request, always via GET (required by RFC) + return $this->sendRequest($this->resp_headers['location'],array(),'GET'); } - // perform redirected request, always via GET (required by RFC) - return $this->sendRequest($this->resp_headers['location'],array(),'GET'); } - } - // check if headers are as expected - if($this->header_regexp && !preg_match($this->header_regexp,$r_headers)){ - $this->error = 'The received headers did not match the given regexp'; - unset($this->connections[$connectionId]); - return false; - } + // check if headers are as expected + if($this->header_regexp && !preg_match($this->header_regexp,$r_headers)) + throw new HTTPClientException('The received headers did not match the given regexp'); - //read body (with chunked encoding if needed) - $r_body = ''; - if(preg_match('/transfer\-(en)?coding:\s*chunked\r\n/i',$r_headers)){ - do { - unset($chunk_size); + //read body (with chunked encoding if needed) + $r_body = ''; + if((isset($this->resp_headers['transfer-encoding']) && $this->resp_headers['transfer-encoding'] == 'chunked') + || (isset($this->resp_headers['transfer-coding']) && $this->resp_headers['transfer-coding'] == 'chunked')){ + $abort = false; do { - if(feof($socket)){ - $this->error = 'Premature End of File (socket)'; - unset($this->connections[$connectionId]); - return false; + $chunk_size = ''; + while (preg_match('/^[a-zA-Z0-9]?$/',$byte=$this->_readData($socket,1,'chunk'))){ + // read chunksize until \r + $chunk_size .= $byte; + if (strlen($chunk_size) > 128) // set an abritrary limit on the size of chunks + throw new HTTPClientException('Allowed response size exceeded'); } - if(time()-$start > $this->timeout){ - $this->status = -100; - $this->error = sprintf('Timeout while reading chunk (%.3fs)',$this->_time() - $this->start); - unset($this->connections[$connectionId]); - return false; + $this->_readLine($socket, 'chunk'); // readtrailing \n + $chunk_size = hexdec($chunk_size); + + if($this->max_bodysize && $chunk_size+strlen($r_body) > $this->max_bodysize){ + if ($this->max_bodysize_abort) + throw new HTTPClientException('Allowed response size exceeded'); + $this->error = 'Allowed response size exceeded'; + $chunk_size = $this->max_bodysize - strlen($r_body); + $abort = true; } - $byte = fread($socket,1); - $chunk_size .= $byte; - } while (preg_match('/[a-zA-Z0-9]/',$byte)); // read chunksize including \r - - $byte = fread($socket,1); // readtrailing \n - $chunk_size = hexdec($chunk_size); - if ($chunk_size) { - $this_chunk = fread($socket,$chunk_size); - $r_body .= $this_chunk; - $byte = fread($socket,2); // read trailing \r\n - } - if($this->max_bodysize && strlen($r_body) > $this->max_bodysize){ - $this->error = 'Allowed response size exceeded'; - if ($this->max_bodysize_abort){ - unset($this->connections[$connectionId]); - return false; - } else { - break; + if ($chunk_size > 0) { + $r_body .= $this->_readData($socket, $chunk_size, 'chunk'); + $byte = $this->_readData($socket, 2, 'chunk'); // read trailing \r\n } - } - } while ($chunk_size); - }else{ - // read entire socket - while (!feof($socket)) { - if(time()-$start > $this->timeout){ - $this->status = -100; - $this->error = sprintf('Timeout while reading response (%.3fs)',$this->_time() - $this->start); - unset($this->connections[$connectionId]); - return false; - } - $r_body .= fread($socket,4096); - $r_size = strlen($r_body); - if($this->max_bodysize && $r_size > $this->max_bodysize){ - $this->error = 'Allowed response size exceeded'; + } while ($chunk_size && !$abort); + }elseif($this->max_bodysize){ + // read just over the max_bodysize + $r_body = $this->_readData($socket, $this->max_bodysize+1, 'response', true); + if(strlen($r_body) > $this->max_bodysize){ if ($this->max_bodysize_abort) { - unset($this->connections[$connectionId]); - return false; + throw new HTTPClientException('Allowed response size exceeded'); } else { - break; + $this->error = 'Allowed response size exceeded'; } } - if(isset($this->resp_headers['content-length']) && - !isset($this->resp_headers['transfer-encoding']) && - $this->resp_headers['content-length'] == $r_size){ - // we read the content-length, finish here - break; + }elseif(isset($this->resp_headers['content-length']) && + !isset($this->resp_headers['transfer-encoding'])){ + // read up to the content-length + $r_body = $this->_readData($socket, $this->resp_headers['content-length'], 'response', true); + }else{ + // read entire socket + $r_size = 0; + while (!feof($socket)) { + $r_body .= $this->_readData($socket, 4096, 'response', true); } } + + } catch (HTTPClientException $err) { + $this->error = $err->getMessage(); + if ($err->getCode()) + $this->status = $err->getCode(); + unset(self::$connections[$connectionId]); + fclose($socket); + return false; } if (!$this->keep_alive || @@ -525,7 +463,7 @@ class HTTPClient { // close socket $status = socket_get_status($socket); fclose($socket); - unset($this->connections[$connectionId]); + unset(self::$connections[$connectionId]); } // decode gzip if needed @@ -547,6 +485,126 @@ class HTTPClient { } /** + * Safely write data to a socket + * + * @param handle $socket An open socket handle + * @param string $data The data to write + * @param string $message Description of what is being read + * @author Tom N Harris <tnharris@whoopdedo.org> + */ + function _sendData($socket, $data, $message) { + // select parameters + $sel_r = null; + $sel_w = array($socket); + $sel_e = null; + + // send request + $towrite = strlen($data); + $written = 0; + while($written < $towrite){ + // check timeout + $time_used = $this->_time() - $this->start; + if($time_used > $this->timeout) + throw new HTTPClientException(sprintf('Timeout while sending %s (%.3fs)',$message, $time_used), -100); + if(feof($socket)) + throw new HTTPClientException("Socket disconnected while writing $message"); + + // wait for stream ready or timeout + self::selecttimeout($this->timeout - $time_used, $sec, $usec); + if(@stream_select($sel_r, $sel_w, $sel_e, $sec, $usec) !== false){ + // write to stream + $nbytes = fwrite($socket, substr($data,$written,4096)); + if($nbytes === false) + throw new HTTPClientException("Failed writing to socket while sending $message", -100); + $written += $nbytes; + } + } + } + + /** + * Safely read data from a socket + * + * Reads up to a given number of bytes or throws an exception if the + * response times out or ends prematurely. + * + * @param handle $socket An open socket handle in non-blocking mode + * @param int $nbytes Number of bytes to read + * @param string $message Description of what is being read + * @param bool $ignore_eof End-of-file is not an error if this is set + * @author Tom N Harris <tnharris@whoopdedo.org> + */ + function _readData($socket, $nbytes, $message, $ignore_eof = false) { + // select parameters + $sel_r = array($socket); + $sel_w = null; + $sel_e = null; + + $r_data = ''; + // Does not return immediately so timeout and eof can be checked + if ($nbytes < 0) $nbytes = 0; + $to_read = $nbytes; + do { + $time_used = $this->_time() - $this->start; + if ($time_used > $this->timeout) + throw new HTTPClientException( + sprintf('Timeout while reading %s (%.3fs)', $message, $time_used), + -100); + if(feof($socket)) { + if(!$ignore_eof) + throw new HTTPClientException("Premature End of File (socket) while reading $message"); + break; + } + + if ($to_read > 0) { + // wait for stream ready or timeout + self::selecttimeout($this->timeout - $time_used, $sec, $usec); + if(@stream_select($sel_r, $sel_w, $sel_e, $sec, $usec) !== false){ + $bytes = fread($socket, $to_read); + if($bytes === false) + throw new HTTPClientException("Failed reading from socket while reading $message", -100); + $r_data .= $bytes; + $to_read -= strlen($bytes); + } + } + } while ($to_read > 0 && strlen($r_data) < $nbytes); + return $r_data; + } + + /** + * Safely read a \n-terminated line from a socket + * + * Always returns a complete line, including the terminating \n. + * + * @param handle $socket An open socket handle in non-blocking mode + * @param string $message Description of what is being read + * @author Tom N Harris <tnharris@whoopdedo.org> + */ + function _readLine($socket, $message) { + // select parameters + $sel_r = array($socket); + $sel_w = null; + $sel_e = null; + + $r_data = ''; + do { + $time_used = $this->_time() - $this->start; + if ($time_used > $this->timeout) + throw new HTTPClientException( + sprintf('Timeout while reading %s (%.3fs)', $message, $time_used), + -100); + if(feof($socket)) + throw new HTTPClientException("Premature End of File (socket) while reading $message"); + + // wait for stream ready or timeout + self::selecttimeout($this->timeout - $time_used, $sec, $usec); + if(@stream_select($sel_r, $sel_w, $sel_e, $sec, $usec) !== false){ + $r_data = fgets($socket, 1024); + } + } while (!preg_match('/\n$/',$r_data)); + return $r_data; + } + + /** * print debug info * * @author Andreas Gohr <andi@splitbrain.org> @@ -566,12 +624,20 @@ class HTTPClient { /** * Return current timestamp in microsecond resolution */ - function _time(){ + static function _time(){ list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } /** + * Calculate seconds and microseconds + */ + static function selecttimeout($time, &$sec, &$usec){ + $sec = floor($time); + $usec = (int)(($time - $sec) * 1000000); + } + + /** * convert given header string to Header array * * All Keys are lowercased. @@ -583,7 +649,7 @@ class HTTPClient { $lines = explode("\n",$string); array_shift($lines); //skip first line (status) foreach($lines as $line){ - list($key, $val) = explode(':',$line,2); + @list($key, $val) = explode(':',$line,2); $key = trim($key); $val = trim($val); $key = strtolower($key); diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index 5c043fb6b..ac29bca66 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -2972,7 +2972,7 @@ class JpegMeta { elseif ($c == 62) $ascii .= '>'; elseif ($c == 32) - $ascii .= ' '; + $ascii .= ' '; elseif ($c > 32) $ascii .= chr($c); else diff --git a/inc/html.php b/inc/html.php index 738b1f1b4..f9712d975 100644 --- a/inc/html.php +++ b/inc/html.php @@ -327,7 +327,7 @@ function html_search(){ //show progressbar print '<div id="dw__loading">'.NL; - print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL; + print '<script type="text/javascript"><!--//--><![CDATA[//><!--'.NL; print 'showLoadBar();'.NL; print '//--><!]]></script>'.NL; print '</div>'.NL; @@ -389,7 +389,7 @@ function html_search(){ } //hide progressbar - print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL; + print '<script type="text/javascript"><!--//--><![CDATA[//><!--'.NL; print 'hideLoadBar("dw__loading");'.NL; print '//--><!]]></script>'.NL; flush(); @@ -494,7 +494,7 @@ function html_revisions($first=0, $media_id = false){ if (!$media_id) { $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); - $form->addElement(' – '); + $form->addElement(' – '); $form->addElement(htmlspecialchars($INFO['sum'])); $form->addElement(form_makeCloseTag('span')); } @@ -573,7 +573,7 @@ function html_revisions($first=0, $media_id = false){ if ($info['sum']) { $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); - if (!$media_id) $form->addElement(' – '); + if (!$media_id) $form->addElement(' – '); $form->addElement(htmlspecialchars($info['sum'])); $form->addElement(form_makeCloseTag('span')); } @@ -765,7 +765,7 @@ function html_recent($first=0, $show_changes='both'){ $form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?null:$recent['id'])); } $form->addElement(form_makeOpenTag('span', array('class' => 'sum'))); - $form->addElement(' – '.htmlspecialchars($recent['sum'])); + $form->addElement(' – '.htmlspecialchars($recent['sum'])); $form->addElement(form_makeCloseTag('span')); $form->addElement(form_makeOpenTag('span', array('class' => 'user'))); @@ -1418,7 +1418,7 @@ function html_edit(){ if ($wr) { // sets changed to true when previewed - echo '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'. NL; + echo '<script type="text/javascript"><!--//--><![CDATA[//><!--'. NL; echo 'textChanged = ' . ($mod ? 'true' : 'false'); echo '//--><!]]></script>' . NL; } ?> diff --git a/inc/media.php b/inc/media.php index 2462a1deb..e1d5d511e 100644 --- a/inc/media.php +++ b/inc/media.php @@ -1442,7 +1442,7 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false $size .= (int) $item['meta']->getField('File.Height'); echo '<dd class="size">'.$size.'</dd>'.NL; } else { - echo '<dd class="size"> </dd>'.NL; + echo '<dd class="size"> </dd>'.NL; } $date = dformat($item['mtime']); echo '<dd class="date">'.$date.'</dd>'.NL; @@ -1723,7 +1723,7 @@ function media_nstree_li($item){ if($item['open']){ $class .= ' open'; $img = DOKU_BASE.'lib/images/minus.gif'; - $alt = '−'; + $alt = '−'; }else{ $class .= ' closed'; $img = DOKU_BASE.'lib/images/plus.gif'; diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 119ac3f01..2f09dbd4f 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -549,7 +549,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { global $ID; $name = $this->_getLinkTitle($name, $hash, $isImage); $hash = $this->_headerToLink($hash); - $title = $ID.' ↵'; + $title = $ID.' ↵'; $this->doc .= '<a href="#'.$hash.'" title="'.$title.'" class="wikilink1">'; $this->doc .= $name; $this->doc .= '</a>'; diff --git a/inc/template.php b/inc/template.php index c9e899034..76d4d4bbe 100644 --- a/inc/template.php +++ b/inc/template.php @@ -592,7 +592,7 @@ function tpl_get_action($type) { $accesskey = 'x'; break; case 'top': - $accesskey = 'x'; + $accesskey = 't'; $params = array(); $id = '#dokuwiki__top'; break; @@ -714,7 +714,7 @@ function tpl_searchform($ajax=true,$autocomplete=true){ * * @author Andreas Gohr <andi@splitbrain.org> */ -function tpl_breadcrumbs($sep='•'){ +function tpl_breadcrumbs($sep='•'){ global $lang; global $conf; @@ -757,7 +757,7 @@ function tpl_breadcrumbs($sep='•'){ * @author <fredrik@averpil.com> * @todo May behave strangely in RTL languages */ -function tpl_youarehere($sep=' » '){ +function tpl_youarehere($sep=' » '){ global $conf; global $ID; global $lang; @@ -843,7 +843,7 @@ function tpl_pageinfo($ret=false){ if($INFO['exists']){ $out = ''; $out .= $fn; - $out .= ' · '; + $out .= ' · '; $out .= $lang['lastmod']; $out .= ': '; $out .= $date; @@ -854,7 +854,7 @@ function tpl_pageinfo($ret=false){ $out .= ' ('.$lang['external_edit'].')'; } if($INFO['locked']){ - $out .= ' · '; + $out .= ' · '; $out .= $lang['lockedby']; $out .= ': '; $out .= editorinfo($INFO['locked']); diff --git a/install.php b/install.php index a1d406209..3d9fddbb2 100644 --- a/install.php +++ b/install.php @@ -78,7 +78,7 @@ header('Content-Type: text/html; charset=utf-8'); select.text, input.text { width: 30em; margin: 0 0.5em; } a {text-decoration: none} </style> - <script type="text/javascript" language="javascript"> + <script type="text/javascript"> function acltoggle(){ var cb = document.getElementById('acl'); var fs = document.getElementById('acldep'); diff --git a/lib/images/interwiki/amazon.de.gif b/lib/images/interwiki/amazon.de.gif Binary files differindex 6e36a051a..a0d2cd4cb 100644 --- a/lib/images/interwiki/amazon.de.gif +++ b/lib/images/interwiki/amazon.de.gif diff --git a/lib/images/interwiki/amazon.gif b/lib/images/interwiki/amazon.gif Binary files differindex 6e36a051a..a0d2cd4cb 100644 --- a/lib/images/interwiki/amazon.gif +++ b/lib/images/interwiki/amazon.gif diff --git a/lib/images/interwiki/amazon.uk.gif b/lib/images/interwiki/amazon.uk.gif Binary files differindex 6e36a051a..a0d2cd4cb 100644 --- a/lib/images/interwiki/amazon.uk.gif +++ b/lib/images/interwiki/amazon.uk.gif diff --git a/lib/images/interwiki/callto.gif b/lib/images/interwiki/callto.gif Binary files differindex f6d424554..60158c565 100644 --- a/lib/images/interwiki/callto.gif +++ b/lib/images/interwiki/callto.gif diff --git a/lib/images/interwiki/paypal.gif b/lib/images/interwiki/paypal.gif Binary files differindex 1d2834062..a2dc89431 100644 --- a/lib/images/interwiki/paypal.gif +++ b/lib/images/interwiki/paypal.gif diff --git a/lib/images/interwiki/skype.gif b/lib/images/interwiki/skype.gif Binary files differnew file mode 100644 index 000000000..2c900a8b2 --- /dev/null +++ b/lib/images/interwiki/skype.gif diff --git a/lib/images/interwiki/skype.png b/lib/images/interwiki/skype.png Binary files differdeleted file mode 100644 index c70216702..000000000 --- a/lib/images/interwiki/skype.png +++ /dev/null diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php index 1f88c6ff9..a0d2e430e 100644 --- a/lib/plugins/acl/admin.php +++ b/lib/plugins/acl/admin.php @@ -507,7 +507,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { if($item['type']=='d'){ if($item['open']){ $img = DOKU_BASE.'lib/images/minus.gif'; - $alt = '−'; + $alt = '−'; }else{ $img = DOKU_BASE.'lib/images/plus.gif'; $alt = '+'; @@ -747,7 +747,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { //build code $ret .= '<label for="pbox'.$label.'" title="'.$this->getLang('acl_perm'.$perm).'"'.$class.'>'; - $ret .= '<input '.buildAttributes($atts).' /> '; + $ret .= '<input '.buildAttributes($atts).' /> '; $ret .= $this->getLang('acl_perm'.$perm); $ret .= '</label>'.NL; } @@ -783,7 +783,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { echo ' <option value="__g__" class="aclgroup"'.$gsel.'>'.$this->getLang('acl_group').':</option>'.NL; echo ' <option value="__u__" class="acluser"'.$usel.'>'.$this->getLang('acl_user').':</option>'.NL; if (!empty($this->specials)) { - echo ' <optgroup label=" ">'.NL; + echo ' <optgroup label=" ">'.NL; foreach($this->specials as $ug){ if($ug == $this->who){ $sel = ' selected="selected"'; @@ -801,7 +801,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { echo ' </optgroup>'.NL; } if (!empty($this->usersgroups)) { - echo ' <optgroup label=" ">'.NL; + echo ' <optgroup label=" ">'.NL; foreach($this->usersgroups as $ug){ if($ug == $this->who){ $sel = ' selected="selected"'; diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php index 9a9bb5329..c5f7ee532 100644 --- a/lib/plugins/config/admin.php +++ b/lib/plugins/config/admin.php @@ -118,6 +118,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { // config setting group if ($in_fieldset) { ptln(' </table>'); + ptln(' </div>'); ptln(' </fieldset>'); } else { $in_fieldset = true; diff --git a/lib/plugins/config/lang/no/lang.php b/lib/plugins/config/lang/no/lang.php index ec97fe966..b01637dd1 100644 --- a/lib/plugins/config/lang/no/lang.php +++ b/lib/plugins/config/lang/no/lang.php @@ -43,8 +43,8 @@ $lang['_links'] = 'Innstillinger for lenker'; $lang['_media'] = 'Innstillinger for mediafiler'; $lang['_advanced'] = 'Avanserte innstillinger'; $lang['_network'] = 'Nettverksinnstillinger'; -$lang['_plugin_sufix'] = '– innstillinger for tillegg'; -$lang['_template_sufix'] = '– innstillinger for mal'; +$lang['_plugin_sufix'] = '– innstillinger for tillegg'; +$lang['_template_sufix'] = '– innstillinger for mal'; $lang['_msg_setting_undefined'] = 'Ingen innstillingsmetadata'; $lang['_msg_setting_no_class'] = 'Ingen innstillingsklasse'; $lang['_msg_setting_no_default'] = 'Ingen standard verdi'; diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 1cdab607f..a1430016e 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -452,8 +452,8 @@ if (!class_exists('setting')) { function _out_key($pretty=false,$url=false) { if($pretty){ - $out = str_replace(CM_KEYMARKER,"»",$this->_key); - if ($url && !strstr($out,'»')) {//provide no urls for plugins, etc. + $out = str_replace(CM_KEYMARKER,"»",$this->_key); + if ($url && !strstr($out,'»')) {//provide no urls for plugins, etc. if ($out == 'start') //one exception return '<a href="http://www.dokuwiki.org/config:startpage">'.$out.'</a>'; else diff --git a/lib/plugins/revert/admin.php b/lib/plugins/revert/admin.php index 2aaf1395f..ff5fa69ba 100644 --- a/lib/plugins/revert/admin.php +++ b/lib/plugins/revert/admin.php @@ -159,7 +159,7 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { echo '</a> '; echo html_wikilink(':'.$recent['id'],(useHeading('navigation'))?NULL:$recent['id']); - echo ' – '.htmlspecialchars($recent['sum']); + echo ' – '.htmlspecialchars($recent['sum']); echo ' <span class="user">'; echo $recent['user'].' '.$recent['ip']; diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index 8b646b426..2bb0a863d 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -153,7 +153,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { ptln(" <table class=\"inline\">"); ptln(" <thead>"); ptln(" <tr>"); - ptln(" <th> </th><th>".$this->lang["user_id"]."</th><th>".$this->lang["user_name"]."</th><th>".$this->lang["user_mail"]."</th><th>".$this->lang["user_groups"]."</th>"); + ptln(" <th> </th><th>".$this->lang["user_id"]."</th><th>".$this->lang["user_name"]."</th><th>".$this->lang["user_mail"]."</th><th>".$this->lang["user_groups"]."</th>"); ptln(" </tr>"); ptln(" <tr>"); diff --git a/lib/scripts/page.js b/lib/scripts/page.js index 728887687..74aca9c06 100644 --- a/lib/scripts/page.js +++ b/lib/scripts/page.js @@ -119,7 +119,7 @@ dw_page = { $handle.addClass('closed'); $handle.removeClass('open'); }else{ - $clicky.html('<span>−</span>'); + $clicky.html('<span>−</span>'); $handle.addClass('open'); $handle.removeClass('closed'); } diff --git a/lib/tpl/default/main.php b/lib/tpl/default/main.php index 3e85c58f2..9a14f29a2 100644 --- a/lib/tpl/default/main.php +++ b/lib/tpl/default/main.php @@ -61,7 +61,7 @@ if (!defined('DOKU_INC')) die(); <div class="bar-right" id="bar__topright"> <?php tpl_button('recent')?> - <?php tpl_searchform()?> + <?php tpl_searchform()?>  </div> <div class="clearer"></div> @@ -121,7 +121,7 @@ if (!defined('DOKU_INC')) die(); <?php tpl_button('profile')?> <?php tpl_button('login')?> <?php tpl_button('index')?> - <?php tpl_button('top')?> + <?php tpl_button('top')?>  </div> <div class="clearer"></div> </div> diff --git a/lib/tpl/dokuwiki/css/_links.css b/lib/tpl/dokuwiki/css/_links.css index 240e336bd..22502f6a9 100644 --- a/lib/tpl/dokuwiki/css/_links.css +++ b/lib/tpl/dokuwiki/css/_links.css @@ -39,22 +39,19 @@ .dokuwiki a.interwiki { background-repeat: no-repeat; background-position: 0 center; - padding: 0 0 0 20px; + padding: 0 0 0 18px; } /* external link */ .dokuwiki a.urlextern { background-image: url(images/external-link.png); - padding: 0 0 0 15px; } /* windows share */ .dokuwiki a.windows { background-image: url(images/unc.png); - padding: 0 0 0 16px; } /* email link */ .dokuwiki a.mail { background-image: url(images/email.png); - padding: 0 0 0 16px; } /* icons of the following are set by dokuwiki in lib/exe/css.php */ @@ -63,7 +60,6 @@ } /* interwiki link */ .dokuwiki a.interwiki { - padding: 0 0 0 17px; } /* RTL corrections; if link icons don't work as expected, remove the following lines */ @@ -73,5 +69,5 @@ [dir=rtl] .dokuwiki a.interwiki, [dir=rtl] .dokuwiki a.mediafile { background-position: right center; - padding: 0 17px 0 0; + padding: 0 18px 0 0; } diff --git a/lib/tpl/dokuwiki/images/email.png b/lib/tpl/dokuwiki/images/email.png Binary files differindex 37f776a33..d1d4a5fd5 100644 --- a/lib/tpl/dokuwiki/images/email.png +++ b/lib/tpl/dokuwiki/images/email.png diff --git a/lib/tpl/dokuwiki/images/external-link.png b/lib/tpl/dokuwiki/images/external-link.png Binary files differindex 23c825027..a4d5de17c 100644 --- a/lib/tpl/dokuwiki/images/external-link.png +++ b/lib/tpl/dokuwiki/images/external-link.png diff --git a/lib/tpl/dokuwiki/images/unc.png b/lib/tpl/dokuwiki/images/unc.png Binary files differindex dbd225c2b..a552d6e6f 100644 --- a/lib/tpl/dokuwiki/images/unc.png +++ b/lib/tpl/dokuwiki/images/unc.png diff --git a/lib/tpl/index.php b/lib/tpl/index.php index 0273e5678..4570f70f5 100644 --- a/lib/tpl/index.php +++ b/lib/tpl/index.php @@ -54,7 +54,7 @@ if ($ini) { echo '<td>'.htmlspecialchars($val).'</td>'; echo '<td>'; if(preg_match('/^#[0-f]{3,6}$/i',$val)){ - echo '<div class="color" style="background-color:'.$val.';"> </div>'; + echo '<div class="color" style="background-color:'.$val.';"> </div>'; } echo '</td>'; echo '</tr>'; |