Skip to content

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
Conflicts:
	data/deleted.files
	doku.php
	lib/exe/xmlrpc.php
  • Loading branch information
adrianheine committed Apr 22, 2011
2 parents e209237 + 23d2737 commit 8ccf9c9
Show file tree
Hide file tree
Showing 785 changed files with 18,084 additions and 9,656 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Expand Up @@ -6,6 +6,8 @@
/conf/user*.css
/conf/user*.js
/conf/words.aspell
/conf/lang/*
/conf/plugin_lang/*
.htaccess
*.swp
*.bak
Expand All @@ -21,3 +23,15 @@
/data/tmp/*
/lib/tpl/*
/lib/plugins/*
!/lib/plugins/acl
!/lib/plugins/config
!/lib/plugins/info
!/lib/plugins/plugin
!/lib/plugins/popularity
!/lib/plugins/revert
!/lib/plugins/safefnrecode
!/lib/plugins/usermanager
!/lib/plugins/action.php
!/lib/plugins/admin.php
!/lib/plugins/index.html
!/lib/plugins/syntax.php
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-2010 (c) Andreas Gohr <andi@splitbrain.org>
DokuWiki - 2004-2011 (c) Andreas Gohr <andi@splitbrain.org>
and the DokuWiki Community
See COPYING and file headers for license info

31 changes: 31 additions & 0 deletions _test/cases/inc/DifferenceEngine.test.php
@@ -0,0 +1,31 @@
<?php
require_once DOKU_INC.'inc/DifferenceEngine.php';

class differenceengine_test extends UnitTestCase {

function test_white_between_words(){
// From FS#2161
global $lang;

$df = new Diff(explode("\n","example"),
explode("\n","example example2"));

$idf = new InlineDiffFormatter();
$tdf = new TableDiffFormatter();

$this->assertEqual($idf->format($df), '<tr><td colspan="4" class="diff-blockheader">@@ ' . $lang['line'] .
' -1 +1 @@&nbsp;<span class="diff-deletedline"><del>' . $lang['deleted'] .
'</del></span>&nbsp;<span class="diff-addedline">' . $lang['created'] .
'</span></td></tr>
<tr><td colspan="4">example&nbsp;<span class="diff-addedline">example2</span></td></tr>
');
$this->assertEqual($tdf->format($df),
'<tr><td class="diff-blockheader" colspan="2">' . $lang['line'] . ' 1:</td>
<td class="diff-blockheader" colspan="2">' . $lang['line'] . ' 1:</td>
</tr>
<tr><td>-</td><td class="diff-deletedline">example</td><td>+</td><td class="diff-addedline">example&nbsp;<strong>example2</strong></td></tr>
');
}
}
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/IXR_Library_IXR_Message.test.php
Expand Up @@ -136,4 +136,4 @@ function test_struct(){
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/IXR_Library_date.test.php
Expand Up @@ -31,4 +31,4 @@ function test_parseIso(){
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/auth_aclcheck.test.php
Expand Up @@ -228,4 +228,4 @@ function test_multiadmin_restricted_ropage(){

}

//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
90 changes: 84 additions & 6 deletions _test/cases/inc/auth_admincheck.test.php
Expand Up @@ -3,20 +3,47 @@
require_once DOKU_INC.'inc/init.php';
require_once DOKU_INC.'inc/auth.php';

class auth_admin_test_AuthInSensitive extends auth_basic {
function isCaseSensitive(){
return false;
}
}

class auth_admin_test extends UnitTestCase {

private $oldauth;

function setup() {
global $auth;
$this->oldauth = $auth;
parent::setup();
}

function setSensitive() {
global $auth;
$auth = new auth_basic;
}

function setInSensitive() {
global $auth;
$auth = new auth_admin_test_AuthInSensitive;
}

function teardown() {
global $auth;
global $conf;
global $AUTH_ACL;
unset($conf);
unset($AUTH_ACL);

$auth = $this->oldauth;
parent::teardown();
}

function test_ismanager(){
function test_ismanager_insensitive(){
$this->setInSensitive();
global $conf;
$conf['superuser'] = 'john,@admin';
$conf['manager'] = 'john,@managers,doe';
$conf['superuser'] = 'john,@admin,@Mötly Görls, Dörte';
$conf['manager'] = 'john,@managers,doe, @Mötly Böys, Dänny';

// anonymous user
$this->assertEqual(auth_ismanager('jill', null,false), false);
Expand All @@ -25,12 +52,19 @@ function test_ismanager(){
$this->assertEqual(auth_ismanager('john', null,false), true);
$this->assertEqual(auth_ismanager('doe', null,false), true);

$this->assertEqual(auth_ismanager('dörte', null,false), true);
$this->assertEqual(auth_ismanager('dänny', null,false), true);

// admin or manager groups
$this->assertEqual(auth_ismanager('jill', array('admin'),false), true);
$this->assertEqual(auth_ismanager('jill', array('managers'),false), true);

$this->assertEqual(auth_ismanager('jill', array('mötly görls'),false), true);
$this->assertEqual(auth_ismanager('jill', array('mötly böys'),false), true);
}

function test_isadmin(){
function test_isadmin_insensitive(){
$this->setInSensitive();
global $conf;
$conf['superuser'] = 'john,@admin,doe,@roots';

Expand All @@ -48,6 +82,50 @@ function test_isadmin(){
$this->assertEqual(auth_ismanager('doe', array('admin'),true), true);
}

function test_ismanager_sensitive(){
$this->setSensitive();
global $conf;
$conf['superuser'] = 'john,@admin,@Mötly Görls, Dörte';
$conf['manager'] = 'john,@managers,doe, @Mötly Böys, Dänny';

// anonymous user
$this->assertEqual(auth_ismanager('jill', null,false), false);

// admin or manager users
$this->assertEqual(auth_ismanager('john', null,false), true);
$this->assertEqual(auth_ismanager('doe', null,false), true);

$this->assertEqual(auth_ismanager('dörte', null,false), false);
$this->assertEqual(auth_ismanager('dänny', null,false), false);

// admin or manager groups
$this->assertEqual(auth_ismanager('jill', array('admin'),false), true);
$this->assertEqual(auth_ismanager('jill', array('managers'),false), true);

$this->assertEqual(auth_ismanager('jill', array('mötly görls'),false), false);
$this->assertEqual(auth_ismanager('jill', array('mötly böys'),false), false);
}

function test_isadmin_sensitive(){
$this->setSensitive();
global $conf;
$conf['superuser'] = 'john,@admin,doe,@roots';

// anonymous user
$this->assertEqual(auth_ismanager('jill', null,true), false);

// admin user
$this->assertEqual(auth_ismanager('john', null,true), true);
$this->assertEqual(auth_ismanager('Doe', null,true), false);

// admin groups
$this->assertEqual(auth_ismanager('jill', array('admin'),true), true);
$this->assertEqual(auth_ismanager('jill', array('roots'),true), true);
$this->assertEqual(auth_ismanager('john', array('admin'),true), true);
$this->assertEqual(auth_ismanager('doe', array('admin'),true), true);
$this->assertEqual(auth_ismanager('Doe', array('admin'),true), true);
}

}

//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/auth_nameencode.test.php
Expand Up @@ -47,4 +47,4 @@ function test_groupskipoff(){
}
}

//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
24 changes: 22 additions & 2 deletions _test/cases/inc/auth_password.test.php
Expand Up @@ -15,14 +15,19 @@ class auth_password_test extends UnitTestCase {
'crypt' => 'ablvoGr1hvZ5k',
'mysql' => '4a1fa3780bd6fd55',
'my411' => '*e5929347e25f82e19e4ebe92f1dc6b6e7c2dbd29',
'kmd5' => 'a579299436d7969791189acadd86fcb716',
'pmd5' => '$P$abcdefgh1RC6Fd32heUzl7EYCG9uGw.',
'hmd5' => '$H$abcdefgh1ZbJodHxmeXVAhEzTG7IAp.',
'djangomd5' => 'md5$abcde$d0fdddeda8cd92725d2b54148ac09158',
'djangosha1' => 'sha1$abcde$c8e65a7f0acc9158843048a53dcc5a6bc4d17678',
);


function test_cryptPassword(){
foreach($this->passes as $method => $hash){
$info = "testing method $method";
$this->signal('failinfo',$info);
$this->assertEqual(auth_cryptPassword('foo'.$method,$method,'abcdefgh'),$hash);
$this->assertEqual(auth_cryptPassword('foo'.$method,$method,'abcdefgh12345678912345678912345678'),$hash);
}
}

Expand All @@ -34,10 +39,25 @@ function test_verifyPassword(){
}
}

function test_verifySelf(){
foreach($this->passes as $method => $hash){
$info = "testing method $method";
$this->signal('failinfo',$info);

$hash = auth_cryptPassword('foo'.$method);
$this->assertTrue(auth_verifyPassword('foo'.$method,$hash));
}
}

function test_verifyPassword_nohash(){
$this->assertTrue(auth_verifyPassword('foo','$1$$n1rTiFE0nRifwV/43bVon/'));
}

function test_verifyPassword_fixedpmd5(){
$this->assertTrue(auth_verifyPassword('test12345','$P$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0'));
$this->assertTrue(auth_verifyPassword('test12345','$H$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0'));
}

}

//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/common_clientip.test.php
Expand Up @@ -152,4 +152,4 @@ function test_malicious(){

}

//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/common_obfuscate.test.php
Expand Up @@ -25,4 +25,4 @@ function test_visible(){


}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/common_pagetemplate.test.php
Expand Up @@ -16,4 +16,4 @@ function test_none(){
error_reporting($old);
}
}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/indexer_idx_indexlengths.test.php
Expand Up @@ -57,4 +57,4 @@ function test_minValue() {
}


//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/init_fullpath.test.php
Expand Up @@ -86,4 +86,4 @@ function test_windows_paths(){
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
27 changes: 26 additions & 1 deletion _test/cases/inc/init_getbaseurl.test.php
Expand Up @@ -275,6 +275,31 @@ function test11(){
$this->assertEqual(getBaseURL(true),$correct_result);
}
}

/**
* Absolute URL with IPv6 domain name.
* lighttpd, fastcgi
*
* data provided by Michael Hamann <michael@content-space.de>
*/
function test12() {
global $conf;
$conf['basedir'] = '';
$conf['baseurl'] = '';
$conf['canonical'] = 0;

$_SERVER['DOCUMENT_ROOT'] = '/srv/http/';
$_SERVER['HTTP_HOST'] = '[fd00::6592:39ed:a2ed:2c78]';
$_SERVER['SCRIPT_FILENAME'] = '/srv/http/~michitux/dokuwiki/doku.php';
$_SERVER['REQUEST_URI'] = '/~michitux/dokuwiki/doku.php?do=debug';
$_SERVER['SCRIPT_NAME'] = '/~michitux/dokuwiki/doku.php';
$_SERVER['PATH_INFO'] = null;
$_SERVER['PATH_TRANSLATED'] = null;
$_SERVER['PHP_SELF'] = '/~michitux/dokuwiki/doku.php';
$_SERVER['SERVER_PORT'] = '80';
$_SERVER['SERVER_NAME'] = '[fd00';
$this->assertEqual(getBaseURL(true), 'http://[fd00::6592:39ed:a2ed:2c78]/~michitux/dokuwiki/');
}
}

//Setup VIM: ex: et ts=2 enc=utf-8 :
//Setup VIM: ex: et ts=2 :
6 changes: 3 additions & 3 deletions _test/cases/inc/mail_isvalid.test.php
Expand Up @@ -25,7 +25,8 @@ function test1(){
$tests[] = array('bu[g]s@php.net1',false);
$tests[] = array('somebody@somewhere.museum',true);
$tests[] = array('somebody@somewhere.travel',true);

$tests[] = array('root@[2010:fb:fdac::311:2101]',true);
$tests[] = array('test@example', true); // we allow local addresses

// tests from http://code.google.com/p/php-email-address-validation/ below

Expand Down Expand Up @@ -62,7 +63,6 @@ function test1(){
$tests[] = array('test@.org', false);
$tests[] = array('12345678901234567890123456789012345678901234567890123456789012345@example.com', false); // 64 characters is maximum length for local part. This is 65.
$tests[] = array('test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com', false); // 255 characters is maximum length for domain. This is 256.
$tests[] = array('test@example', false);
$tests[] = array('test@[123.123.123.123', false);
$tests[] = array('test@123.123.123.123]', false);

Expand All @@ -80,4 +80,4 @@ function test1(){
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/mail_quoted_printable_encode.php
Expand Up @@ -41,4 +41,4 @@ function test_russian_utf8(){
}
}

//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/mail_send.php
Expand Up @@ -46,4 +46,4 @@ function test1(){
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/pageutils_clean_id.test.php
Expand Up @@ -144,4 +144,4 @@ function test_deaccent_ascii(){
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
4 changes: 2 additions & 2 deletions _test/cases/inc/pageutils_getid.test.php
Expand Up @@ -99,8 +99,8 @@ function test5() {
$_SERVER['PATH_TRANSLATED'] = '/var/www/index.html';
$_SERVER['PHP_SELF'] = '/dokuwiki/doku.php/';

$this->assertEqual(getID(), 'start');
$this->assertEqual(getID(), cleanID($conf['start']));
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :
2 changes: 1 addition & 1 deletion _test/cases/inc/pageutils_resolve_id.test.php
Expand Up @@ -42,4 +42,4 @@ function test1(){
}

}
//Setup VIM: ex: et ts=4 enc=utf-8 :
//Setup VIM: ex: et ts=4 :

0 comments on commit 8ccf9c9

Please sign in to comment.