Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/splitbrain/dokuwiki
Browse files Browse the repository at this point in the history
Conflicts:
	lib/exe/xmlrpc.php
  • Loading branch information
dom-mel committed Mar 14, 2012
2 parents 03d7247 + d0caa56 commit 3a6d760
Show file tree
Hide file tree
Showing 221 changed files with 1,402 additions and 1,387 deletions.
41 changes: 20 additions & 21 deletions COPYING
@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble
Preamble

The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Expand All @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.

When we speak of free software, we are referring to freedom, not
Expand Down Expand Up @@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE

GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains
Expand Down Expand Up @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
Expand Down Expand Up @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
Expand Down Expand Up @@ -225,7 +225,7 @@ impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
Expand Down Expand Up @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

NO WARRANTY
NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
Expand All @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
Expand All @@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) year name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand All @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -4,7 +4,7 @@ at http://www.dokuwiki.org/
For Installation Instructions see
http://www.dokuwiki.org/install

DokuWiki - 2004-2011 (c) Andreas Gohr <andi@splitbrain.org>
DokuWiki - 2004-2012 (c) Andreas Gohr <andi@splitbrain.org>
and the DokuWiki Community
See COPYING and file headers for license info

6 changes: 6 additions & 0 deletions _test/cases/inc/auth_password.test.php
Expand Up @@ -12,6 +12,7 @@ class auth_password_test extends UnitTestCase {
'md5' => '8fa22d62408e5351553acdd91c6b7003',
'sha1' => 'b456d3b0efd105d613744ffd549514ecafcfc7e1',
'ssha' => '{SSHA}QMHG+uC7bHNYKkmoLbNsNI38/dJhYmNk',
'lsmd5' => '{SMD5}HGbkPrkWgy9KgcRGWlrsUWFiY2RlZmdo',
'crypt' => 'ablvoGr1hvZ5k',
'mysql' => '4a1fa3780bd6fd55',
'my411' => '*e5929347e25f82e19e4ebe92f1dc6b6e7c2dbd29',
Expand Down Expand Up @@ -48,6 +49,11 @@ function test_verifySelf(){
}
}

function test_bcrypt_self(){
$hash = auth_cryptPassword('foobcrypt','bcrypt');
$this->assertTrue(auth_verifyPassword('foobcrypt',$hash));
}

function test_verifyPassword_nohash(){
$this->assertTrue(auth_verifyPassword('foo','$1$$n1rTiFE0nRifwV/43bVon/'));
}
Expand Down
34 changes: 34 additions & 0 deletions _test/cases/inc/common_cleanText.test.php
@@ -0,0 +1,34 @@
<?php

require_once DOKU_INC.'inc/init.php';
require_once DOKU_INC.'inc/common.php';

class common_clientIP_test extends UnitTestCase {

function test_unix(){
$unix = 'one
two
three';

$this->assertEqual($unix,cleanText($unix));
}

function test_win(){
$unix = 'one
two
three';
$win = 'one
two
three';

$this->assertEqual(bin2hex($unix),'6f6e650a2020202020202020202020202020202074776f0a0a202020202020202020202020202020207468726565');
$this->assertEqual(bin2hex($win),'6f6e650d0a2020202020202020202020202020202074776f0d0a0d0a202020202020202020202020202020207468726565');
$this->assertNotEqual($unix,$win);
$this->assertEqual($unix,cleanText($win));
}
}

//Setup VIM: ex: et ts=4 :
15 changes: 15 additions & 0 deletions _test/cases/inc/parser/parser_links.test.php
Expand Up @@ -400,6 +400,21 @@ function testWindowsShareLink() {
);
$this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls);
}

function testWindowsShareLinkHyphen() {
$this->P->addMode('windowssharelink',new Doku_Parser_Mode_WindowsShareLink());
$this->P->parse('Foo \\\server\share-hyphen Bar');
$calls = array (
array('document_start',array()),
array('p_open',array()),
array('cdata',array("\n".'Foo ')),
array('windowssharelink',array('\\\server\share-hyphen',NULL)),
array('cdata',array(' Bar')),
array('p_close',array()),
array('document_end',array()),
);
$this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls);
}

function testWindowsShareLinkInternal() {
$this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink());
Expand Down
11 changes: 9 additions & 2 deletions conf/dokuwiki.php
Expand Up @@ -18,6 +18,7 @@
$conf['lang'] = 'en'; //your language
$conf['basedir'] = ''; //absolute dir from serveroot - blank for autodetection
$conf['baseurl'] = ''; //URL to server including protocol - blank for autodetect
$conf['cookiedir'] = ''; //Cookie path. Leave blank for using baseurl.
$conf['savedir'] = './data'; //where to store all the files
$conf['allowdebug'] = 0; //allow debug output, enable if needed 0|1
$conf['mediarevisions'] = 1; //enable/disable media revisions
Expand All @@ -27,6 +28,8 @@
$conf['start'] = 'start'; //name of start page
$conf['title'] = 'DokuWiki'; //what to show in the title
$conf['template'] = 'default'; //see lib/tpl directory
$conf['tagline'] = ''; //tagline in header (if template supports it)
$conf['sidebar'] = 'sidebar'; //name of sidebar in root namespace (if template supports it)
$conf['license'] = 'cc-by-nc-sa'; //see conf/license.php
$conf['fullpath'] = 0; //show full path of the document or relative to datadir only? 0|1
$conf['recent'] = 20; //how many entries to show in recent
Expand Down Expand Up @@ -124,14 +127,18 @@
// 'page' - the revised page itself
// 'rev' - page showing all revisions
// 'current' - most recent revision of page
$conf['rss_content'] = 'abstract'; // what to put in the items by default?
$conf['rss_content'] = 'abstract'; //what to put in the items by default?
// 'abstract' - plain text, first paragraph or so
// 'diff' - plain text unified diff wrapped in <pre> tags
// 'htmldiff' - diff as HTML table
// 'html' - the full page rendered in XHTML
$conf['rss_media'] = 'both'; //what should be listed?
// 'both' - page and media changes
// 'pages' - page changes only
// 'media' - media changes only
$conf['rss_update'] = 5*60; //Update the RSS feed every n seconds (defaults to 5 minutes)
$conf['recent_days'] = 7; //How many days of recent changes to keep. (days)
$conf['rss_show_summary'] = 1; //Add revision summary to title? 0|1
$conf['recent_days'] = 7; //How many days of recent changes to keep. (days)
$conf['broken_iua'] = 0; //Platform with broken ignore_user_abort (IIS+CGI) 0|1
$conf['xsendfile'] = 0; //Use X-Sendfile (1 = lighttpd, 2 = standard)
$conf['renderer_xhtml'] = 'xhtml'; //renderer to use for main page generation
Expand Down
1 change: 0 additions & 1 deletion data/_dummy
@@ -1 +0,0 @@
data directory
2 changes: 1 addition & 1 deletion data/pages/wiki/syntax.txt
Expand Up @@ -368,7 +368,7 @@ Those blocks were created by this source:

==== Syntax Highlighting ====

[[wiki:DokuWiki]] can highlight sourcecode, which makes it easier to read. It uses the [[http://qbnz.com/highlighter/|GeSHi]] Generic Syntax Highlighter -- so any language supported by GeSHi is supported. The syntax is the same like in the code and file blocks in the previous section, but this time the name of the used language is inserted inside the tag. Eg. ''<nowiki><code java></nowiki>'' or ''<nowiki><file java></nowiki>''.
[[wiki:DokuWiki]] can highlight sourcecode, which makes it easier to read. It uses the [[http://qbnz.com/highlighter/|GeSHi]] Generic Syntax Highlighter -- so any language supported by GeSHi is supported. The syntax uses the same code and file blocks described in the previous section, but this time the name of the language syntax to be highlighted is included inside the tag, e.g. ''<nowiki><code java></nowiki>'' or ''<nowiki><file java></nowiki>''.

<code java>
/**
Expand Down
2 changes: 1 addition & 1 deletion doku.php
Expand Up @@ -7,7 +7,7 @@
*/

// update message version
$updateVersion = 35;
$updateVersion = 36;

// xdebug_start_profiling();

Expand Down
6 changes: 3 additions & 3 deletions feed.php
Expand Up @@ -50,7 +50,7 @@

$image = new FeedImage();
$image->title = $conf['title'];
$image->url = tpl_getFavicon(true);
$image->url = tpl_getMediaFile('favicon.ico', true);
$image->link = DOKU_URL;
$rss->image = $image;

Expand Down Expand Up @@ -117,8 +117,8 @@ function rss_parseOptions(){
'show_minor' => array('minor', false),
// String, only used in search mode
'search_query' => array('q', null),
// One of: pages, media, both
'content_type' => array('view', 'both')
// One of: pages, media, both
'content_type' => array('view', $conf['rss_media'])

) as $name => $val) {
$opt[$name] = (isset($_REQUEST[$val[0]]) && !empty($_REQUEST[$val[0]]))
Expand Down
18 changes: 11 additions & 7 deletions inc/HTTPClient.php
Expand Up @@ -338,7 +338,10 @@ function sendRequest($url,$data='',$method='GET'){
}

// wait for stream ready or timeout (1sec)
if(stream_select($sel_r,$sel_w,$sel_e,1) === false) continue;
if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){
usleep(1000);
continue;
}

// write to stream
$ret = fwrite($socket, substr($request,$written,4096));
Expand Down Expand Up @@ -577,13 +580,14 @@ function _time(){
*/
function _parseHeaders($string){
$headers = array();
if (!preg_match_all('/^\s*([\w-]+)\s*:\s*([\S \t]+)\s*$/m', $string,
$matches, PREG_SET_ORDER)) {
return $headers;
}
foreach($matches as $match){
list(, $key, $val) = $match;
$lines = explode("\n",$string);
array_shift($lines); //skip first line (status)
foreach($lines as $line){
list($key, $val) = explode(':',$line,2);
$key = trim($key);
$val = trim($val);
$key = strtolower($key);
if(!$key) continue;
if(isset($headers[$key])){
if(is_array($headers[$key])){
$headers[$key][] = $val;
Expand Down
51 changes: 51 additions & 0 deletions inc/PassHash.class.php
Expand Up @@ -47,9 +47,15 @@ function verify_hash($clear,$hash){
}elseif(preg_match('/^md5\$(.{5})\$/',$hash,$m)){
$method = 'djangomd5';
$salt = $m[1];
}elseif(preg_match('/^\$2a\$(.{2})\$/',$hash,$m)){
$method = 'bcrypt';
$salt = $hash;
}elseif(substr($hash,0,6) == '{SSHA}'){
$method = 'ssha';
$salt = substr(base64_decode(substr($hash, 6)),20);
}elseif(substr($hash,0,6) == '{SMD5}'){
$method = 'lsmd5';
$salt = substr(base64_decode(substr($hash, 6)),16);
}elseif($len == 32){
$method = 'md5';
}elseif($len == 40){
Expand Down Expand Up @@ -130,6 +136,20 @@ public function hash_smd5($clear, $salt=null){
}
}


/**
* Password hashing method 'lsmd5'
*
* Uses salted MD5 hashs. Salt is 8 bytes long.
*
* This is the format used by LDAP.
*/
public function hash_lsmd5($clear, $salt=null){
$this->init_salt($salt,8);
return "{SMD5}".base64_encode(md5($clear.$salt, true).$salt);
}


/**
* Password hashing method 'apr1'
*
Expand Down Expand Up @@ -379,4 +399,35 @@ public function hash_djangomd5($clear, $salt=null){
return 'md5$'.$salt.'$'.md5($salt.$clear);
}


/**
* Passwordhashing method 'bcrypt'
*
* Uses a modified blowfish algorithm called eksblowfish
* This method works on PHP 5.3+ only and will throw an exception
* if the needed crypt support isn't available
*
* A full hash should be given as salt (starting with $a2$) or this
* will break. When no salt is given, the iteration count can be set
* through the $compute variable.
*
* @param string $clear - the clear text to hash
* @param string $salt - the salt to use, null for random
* @param int $compute - the iteration count (between 4 and 31)
* @returns string - hashed password
*/
public function hash_bcrypt($clear, $salt=null, $compute=8){
if(!defined('CRYPT_BLOWFISH') || CRYPT_BLOWFISH != 1){
throw new Exception('This PHP installation has no bcrypt support');
}

if(is_null($salt)){
if($compute < 4 || $compute > 31) $compute = 8;
$salt = '$2a$'.str_pad($compute, 2, '0', STR_PAD_LEFT).'$'.
$this->gen_salt(22);
}

return crypt($password, $salt);
}

}

0 comments on commit 3a6d760

Please sign in to comment.