jQuery rewrite branch merged into master branch of whole project
This commit is contained in:
commit
35838d22a5
|
@ -6,6 +6,8 @@
|
|||
/conf/user*.css
|
||||
/conf/user*.js
|
||||
/conf/words.aspell
|
||||
/conf/lang/*
|
||||
/conf/plugin_lang/*
|
||||
.htaccess
|
||||
*.swp
|
||||
*.bak
|
||||
|
|
|
@ -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 @@ <span class="diff-deletedline"><del>' . $lang['deleted'] .
|
||||
'</del></span> <span class="diff-addedline">' . $lang['created'] .
|
||||
'</span></td></tr>
|
||||
|
||||
<tr><td colspan="4">example <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 <strong>example2</strong></td></tr>
|
||||
');
|
||||
}
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 :
|
|
@ -136,4 +136,4 @@ class ixr_library_ixr_message_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -31,4 +31,4 @@ class ixr_library_date_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -228,4 +228,4 @@ class auth_acl_test extends UnitTestCase {
|
|||
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -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);
|
||||
|
@ -25,12 +52,19 @@ class auth_admin_test extends UnitTestCase {
|
|||
$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';
|
||||
|
||||
|
@ -48,6 +82,50 @@ class auth_admin_test extends UnitTestCase {
|
|||
$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 :
|
||||
|
|
|
@ -47,4 +47,4 @@ class auth_nameencode_test extends UnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -15,6 +15,11 @@ 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',
|
||||
);
|
||||
|
||||
|
||||
|
@ -22,7 +27,7 @@ class auth_password_test extends UnitTestCase {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,10 +39,25 @@ class auth_password_test extends UnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
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 :
|
||||
|
|
|
@ -152,4 +152,4 @@ class common_clientIP_test extends UnitTestCase {
|
|||
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -25,4 +25,4 @@ class common_obfuscate_test extends UnitTestCase {
|
|||
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once DOKU_INC.'inc/common.php';
|
||||
|
||||
class common_pagetemplate_test extends UnitTestCase {
|
||||
|
||||
function test_none(){
|
||||
global $conf;
|
||||
$conf['sepchar'] = '-';
|
||||
$data = array(
|
||||
'id' => 'page-id-long',
|
||||
'tpl' => '"@PAGE@" "@!PAGE@" "@!!PAGE@" "@!PAGE!@"',
|
||||
);
|
||||
$old = error_reporting(E_ALL & ~E_NOTICE);
|
||||
$this->assertEqual(parsePageTemplate($data), '"page id long" "Page id long" "Page Id Long" "PAGE ID LONG"');
|
||||
error_reporting($old);
|
||||
}
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 :
|
|
@ -57,4 +57,4 @@ class indexer_idx_indexlengths_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -86,4 +86,4 @@ class init_fullpath_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -275,6 +275,31 @@ class init_getBaseURL_test extends UnitTestCase {
|
|||
$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 :
|
||||
|
|
|
@ -25,7 +25,8 @@ class mail_isvalid extends UnitTestCase {
|
|||
$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
|
||||
|
||||
|
@ -62,7 +63,6 @@ class mail_isvalid extends UnitTestCase {
|
|||
$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);
|
||||
|
||||
|
@ -80,4 +80,4 @@ class mail_isvalid extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -41,4 +41,4 @@ class mail_quotedprintable_encode extends UnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -46,4 +46,4 @@ class mail_send extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -144,4 +144,4 @@ class init_clean_id_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -103,4 +103,4 @@ class init_getID_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -42,4 +42,4 @@ class init_resolve_id_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -60,4 +60,4 @@ class init_resolve_pageid_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -13,7 +13,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("Foo".DOKU_PARSER_EOL."Bar".DOKU_PARSER_EOL)),
|
||||
array('cdata',array("Foo".DOKU_PARSER_EOL."Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser {
|
|||
array('cdata',array("Foo")),
|
||||
array('p_close',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("bar".DOKU_PARSER_EOL."Foo".DOKU_PARSER_EOL)),
|
||||
array('cdata',array("bar".DOKU_PARSER_EOL."Foo")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -42,7 +42,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("Foo".DOKU_PARSER_EOL."Bar".DOKU_PARSER_EOL)),
|
||||
array('cdata',array("Foo".DOKU_PARSER_EOL."Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -57,7 +57,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\nFoo")),
|
||||
array('linebreak',array()),
|
||||
array('cdata',array("Bar\n")),
|
||||
array('cdata',array("Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -76,7 +76,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser {
|
|||
array('linebreak',array()),
|
||||
array('p_close',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("Bar".DOKU_PARSER_EOL)),
|
||||
array('cdata',array("Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -89,7 +89,7 @@ class TestOfDoku_Parser_Eol extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo\\\\Bar'."\n")),
|
||||
array('cdata',array("\n".'Foo\\\\Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -23,7 +23,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' testing ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -35,7 +35,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nFoo (( testing\n Bar\n")),
|
||||
array('cdata',array("\nFoo (( testing\n Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -54,7 +54,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(" testing\ntesting ")),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'.DOKU_PARSER_EOL)),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -72,7 +72,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' x((y')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array('z )) Bar'."\n")),
|
||||
array('cdata',array('z )) Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -91,7 +91,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(" test\ning ")),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array('Y'.DOKU_PARSER_EOL.' Bar'.DOKU_PARSER_EOL)),
|
||||
array('cdata',array('Y'.DOKU_PARSER_EOL.' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -114,7 +114,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -135,7 +135,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array("\n ")),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -156,7 +156,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -177,7 +177,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -199,7 +199,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'.DOKU_PARSER_EOL)),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -221,7 +221,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -240,7 +240,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(" \n====Test====\n ")),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -286,7 +286,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -328,7 +328,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -356,7 +356,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
array('cdata',array(' ')),
|
||||
array('footnote_close',array()),
|
||||
))),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -381,7 +381,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
|
|||
))),
|
||||
array('cdata',array(" ")),
|
||||
array('strong_close',array()),
|
||||
array('cdata',array(" c ))\n")),
|
||||
array('cdata',array(" c ))")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('strong_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('strong_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -30,7 +30,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc **bar def\n")),
|
||||
array('cdata',array("\nabc **bar def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -47,7 +47,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -64,7 +64,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_open',array()),
|
||||
array('cdata',array('Тест: ')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -81,7 +81,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_open',array()),
|
||||
array('cdata',array('b')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -98,7 +98,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_open',array()),
|
||||
array('cdata',array('foo:')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array(' bar// def'."\n")),
|
||||
array('cdata',array(' bar// def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -118,7 +118,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('externallink',array('http://www.google.com', NULL)),
|
||||
array('cdata',array(' bar')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -131,7 +131,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc //bar def\n")),
|
||||
array('cdata',array("\nabc //bar def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -148,7 +148,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -161,7 +161,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc //http:// def\n")),
|
||||
array('cdata',array("\nabc //http:// def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -185,7 +185,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_open',array()),
|
||||
array('cdata',array('text:')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array(" another Blablabla Blablabla\n")),
|
||||
array('cdata',array(" another Blablabla Blablabla")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -203,7 +203,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_open',array()),
|
||||
array('cdata',array('Тест:')),
|
||||
array('emphasis_close',array()),
|
||||
array('cdata',array("\n")),
|
||||
array('cdata', array('')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -248,7 +248,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('underline_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('underline_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -261,7 +261,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc __bar def\n")),
|
||||
array('cdata',array("\nabc __bar def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -278,7 +278,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('monospace_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('monospace_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -291,7 +291,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc ''bar def\n")),
|
||||
array('cdata',array("\nabc ''bar def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -308,7 +308,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('subscript_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('subscript_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -321,7 +321,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc <sub>bar def\n")),
|
||||
array('cdata',array("\nabc <sub>bar def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -338,7 +338,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('superscript_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('superscript_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -351,7 +351,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc <sup>bar def\n")),
|
||||
array('cdata',array("\nabc <sup>bar def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -368,7 +368,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('deleted_open',array()),
|
||||
array('cdata',array('bar')),
|
||||
array('deleted_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -381,7 +381,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc <del>bar def\n")),
|
||||
array('cdata',array("\nabc <del>bar def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -403,7 +403,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('emphasis_close',array()),
|
||||
array('cdata',array('c')),
|
||||
array('strong_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -424,7 +424,7 @@ class TestOfDoku_Parser_Formatting extends TestOfDoku_Parser {
|
|||
array('strong_open',array()),
|
||||
array('cdata',array('c')),
|
||||
array('strong_close',array()),
|
||||
array('cdata',array(' def'."\n")),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -13,12 +13,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',1,6)),
|
||||
array('section_open',array(1)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -32,12 +32,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',2,6)),
|
||||
array('section_open',array(2)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -51,12 +51,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',3,6)),
|
||||
array('section_open',array(3)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -70,12 +70,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',4,6)),
|
||||
array('section_open',array(4)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -89,12 +89,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',5,6)),
|
||||
array('section_open',array(5)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -108,12 +108,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',2,6)),
|
||||
array('section_open',array(2)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -127,12 +127,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',2,6)),
|
||||
array('section_open',array(2)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -146,12 +146,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',1,6)),
|
||||
array('section_open',array(1)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -165,7 +165,7 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n= Header =\n def\n")),
|
||||
array('cdata',array("\nabc \n= Header =\n def")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -179,12 +179,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('== Header ==',1,6)),
|
||||
array('section_open',array(1)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -198,12 +198,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('====== Header ======',5,6)),
|
||||
array('section_open',array(5)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -217,12 +217,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n== ====== Header\n")),
|
||||
array('cdata',array("\nabc \n== ====== Header")),
|
||||
array('p_close',array()),
|
||||
array('header',array('',1,23)),
|
||||
array('section_open',array(1)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -243,12 +243,12 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('abc '.DOKU_PARSER_EOL)),
|
||||
array('cdata',array('abc ')),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',1, 6)),
|
||||
array('section_open',array(1)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array(' def'.DOKU_PARSER_EOL)),
|
||||
array('cdata',array(' def')),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -263,18 +263,18 @@ class TestOfDoku_Parser_Headers extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc \n")),
|
||||
array('cdata',array("\nabc ")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Header',1,6)),
|
||||
array('section_open',array(1)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def abc \n")),
|
||||
array('cdata',array("\n def abc ")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('header',array('Header2',2,39)),
|
||||
array('section_open',array(2)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n def\n")),
|
||||
array('cdata',array("\n def")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array())
|
||||
|
|
|
@ -47,7 +47,7 @@ class TestOfDoku_Parser_i18n extends TestOfDoku_Parser {
|
|||
array('deleted_open',array()),
|
||||
array('cdata',array('æ')),
|
||||
array('deleted_close',array()),
|
||||
array('cdata',array("tiøn\n")),
|
||||
array('cdata',array("tiøn")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -60,12 +60,12 @@ class TestOfDoku_Parser_i18n extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nFoo\n")),
|
||||
array('cdata',array("\nFoo")),
|
||||
array('p_close',array()),
|
||||
array('header',array('Iñtërnâtiônàlizætiøn',3,5)),
|
||||
array('section_open',array(3)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n Bar\n")),
|
||||
array('cdata',array("\n Bar")),
|
||||
array('p_close',array()),
|
||||
array('section_close',array()),
|
||||
array('document_end',array()),
|
||||
|
@ -110,7 +110,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(153)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -126,7 +126,7 @@ def');
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\nFoo ")),
|
||||
array('acronym',array('Iñtërnâtiônàlizætiøn')),
|
||||
array('cdata',array(" Bar\n")),
|
||||
array('cdata',array(" Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -141,7 +141,7 @@ def');
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('interwikilink',array('wp>Iñtërnâtiônàlizætiøn','Iñtërnâtiônàlizætiøn','wp','Iñtërnâtiônàlizætiøn')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -156,7 +156,7 @@ def');
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internallink',array('x:Iñtërnâtiônàlizætiøn:y:foo_bar:z','Iñtërnâtiônàlizætiøn')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -16,7 +16,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('http://www.google.com', NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -31,20 +31,100 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('HTTP://WWW.GOOGLE.COM', NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
$this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls);
|
||||
}
|
||||
|
||||
function testExternalIPv4() {
|
||||
$this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink());
|
||||
$this->P->parse("Foo http://123.123.3.21/foo Bar");
|
||||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('http://123.123.3.21/foo', NULL)),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
$this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls);
|
||||
}
|
||||
|
||||
function testExternalIPv6() {
|
||||
$this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink());
|
||||
$this->P->parse("Foo http://[3ffe:2a00:100:7031::1]/foo Bar");
|
||||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('http://[3ffe:2a00:100:7031::1]/foo', NULL)),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
$this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls);
|
||||
}
|
||||
|
||||
function testExternalMulti(){
|
||||
$this->teardown();
|
||||
|
||||
$links = array(
|
||||
'http://www.google.com',
|
||||
'HTTP://WWW.GOOGLE.COM',
|
||||
'http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html',
|
||||
'http://[1080:0:0:0:8:800:200C:417A]/index.html',
|
||||
'http://[3ffe:2a00:100:7031::1]',
|
||||
'http://[1080::8:800:200C:417A]/foo',
|
||||
'http://[::192.9.5.5]/ipng',
|
||||
'http://[::FFFF:129.144.52.38]:80/index.html',
|
||||
'http://[2010:836B:4179::836B:4179]',
|
||||
);
|
||||
$titles = array(false,null,'foo bar');
|
||||
foreach($links as $link){
|
||||
foreach($titles as $title){
|
||||
if($title === false){
|
||||
$source = $link;
|
||||
$name = null;
|
||||
}elseif($title === null){
|
||||
$source = "[[$link]]";
|
||||
$name = null;
|
||||
}else{
|
||||
$source = "[[$link|$title]]";
|
||||
$name = $title;
|
||||
}
|
||||
$this->signal('failinfo',$source);
|
||||
|
||||
$this->setup();
|
||||
$this->P->addMode('internallink',new Doku_Parser_Mode_InternalLink());
|
||||
$this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink());
|
||||
$this->P->parse("Foo $source Bar");
|
||||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array($link, $name)),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
$this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls);
|
||||
$this->teardown();
|
||||
}
|
||||
}
|
||||
|
||||
$this->setup();
|
||||
}
|
||||
|
||||
function testExternalLinkJavascript() {
|
||||
$this->P->addMode('externallink',new Doku_Parser_Mode_ExternalLink());
|
||||
$this->P->parse("Foo javascript:alert('XSS'); Bar");
|
||||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nFoo javascript:alert('XSS'); Bar\n")),
|
||||
array('cdata',array("\nFoo javascript:alert('XSS'); Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -59,7 +139,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('http://www.google.com', 'www.google.com')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -74,15 +154,13 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('ftp://ftp.sunsite.com', 'ftp.sunsite.com')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
$this->assertEqual(array_map('stripByteIndex',$this->H->calls),$calls);
|
||||
}
|
||||
function testEmail() {
|
||||
/* $this->fail('The emaillink mode seems to cause php 5.0.5 to segfault');
|
||||
return; //FIXME: is this still true?*/
|
||||
$this->P->addMode('emaillink',new Doku_Parser_Mode_Emaillink());
|
||||
$this->P->parse("Foo <bugs@php.net> Bar");
|
||||
$calls = array (
|
||||
|
@ -90,7 +168,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('emaillink',array('bugs@php.net', NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -105,7 +183,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('emaillink',array("~fix+bug's.for/ev{e}r@php.net", NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -120,7 +198,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('emaillink',array('bugs@pHp.net', NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -136,7 +214,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internallink',array('l',NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -151,7 +229,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internallink',array('foo:bar',NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -166,7 +244,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internallink',array('x:1:y:foo_bar:z','Test')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -181,7 +259,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internallink',array('wiki:syntax#internal','Syntax')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -196,7 +274,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('http://www.google.com','Google')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -211,7 +289,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('interwikilink',array('iw>somepage','Some Page','iw','somepage')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -226,7 +304,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('interwikilink',array('IW>somepage','Some Page','iw','somepage')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -241,7 +319,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('interwikilink',array('wp>Callback_(computer_science)','callbacks','wp','Callback_(computer_science)')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -256,7 +334,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('camelcaselink',array('FooBar')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -271,7 +349,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('filelink',array('file://temp/file.txt ',NULL)),
|
||||
array('cdata',array('Bar'."\n")),
|
||||
array('cdata',array('Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -286,7 +364,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externallink',array('file://temp/file.txt','Some File')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -301,7 +379,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('windowssharelink',array('\\\server\share',NULL)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -316,7 +394,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('windowssharelink',array('\\\server\share','My Documents')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -331,7 +409,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('img.gif',NULL,NULL,NULL,NULL,'cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -346,7 +424,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('img.gif',NULL,NULL,NULL,NULL,'cache','linkonly')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -361,7 +439,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('foo.txt','Some File',null,10,10,'cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -376,7 +454,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('img.gif',NULL,'left',NULL,NULL,'cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -391,7 +469,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('img.gif',NULL,'right',NULL,NULL,'cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -406,7 +484,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('img.gif',NULL,'center',NULL,NULL,'cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -421,7 +499,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('img.gif',NULL,NULL,'50','100','nocache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -436,7 +514,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',array('img.gif','Some Image',NULL,'50','100','cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -451,7 +529,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externalmedia',array('http://www.google.com/img.gif',NULL,NULL,NULL,NULL,'cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -466,7 +544,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('externalmedia',array('http://www.google.com/img.gif',NULL,NULL,'50','100','nocache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -482,7 +560,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('cdata',array("\n".'Foo ')),
|
||||
array('externalmedia',
|
||||
array('http://www.google.com/img.gif','Some Image',NULL,'50','100','cache','details')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -509,7 +587,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internallink',array('x:1:y:foo_bar:z',$image)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -536,7 +614,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('internallink',array('x:1:y:foo_bar:z',$image)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -563,7 +641,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('emaillink',array('foo@example.com',$image)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -579,7 +657,7 @@ class TestOfDoku_Parser_Links extends TestOfDoku_Parser {
|
|||
array('cdata',array("\n".'Foo ')),
|
||||
array('internalmedia',
|
||||
array('img.gif','{{foo.gif|{{bar.gif|Bar',NULL,NULL,NULL,'cache','details')),
|
||||
array('cdata',array('}}}} Bar'."\n")),
|
||||
array('cdata',array('}}}} Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -171,7 +171,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nFoo -bar *foo Bar\n")),
|
||||
array('cdata',array("\nFoo -bar *foo Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -211,7 +211,7 @@ Bar');
|
|||
array('listitem_close',array()),
|
||||
array('listu_close',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("Bar".DOKU_PARSER_EOL)),
|
||||
array('cdata',array("Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('file',array('testing',null,null)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -35,7 +35,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('code',array('testing', null, null)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -52,7 +52,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('code',array('testing', null, null)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -69,7 +69,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('code',array('testing', 'php', null)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -86,7 +86,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('preformatted',array("x \n y ")),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('Bar'."\n\n")),
|
||||
array('cdata',array('Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -103,7 +103,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('preformatted',array("x \n y ")),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('Bar'."\n\n")),
|
||||
array('cdata',array('Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -120,7 +120,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('preformatted',array("x\t\n\ty\t")),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("Bar\n\n")),
|
||||
array('cdata',array("Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -137,7 +137,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('preformatted',array("x\t\n\ty\t")),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("Bar\n\n")),
|
||||
array('cdata',array("Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -169,7 +169,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('preformatted',array("x \n y \n-X\n*Y")),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("Bar\n\n")),
|
||||
array('cdata',array("Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -186,7 +186,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('php',array('testing')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -203,7 +203,7 @@ class TestOfDoku_Parser_Preformatted extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('html',array('testing')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ class TestOfDoku_Parser_Quote extends TestOfDoku_Parser {
|
|||
array('quote_close',array()),
|
||||
array('quote_close',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("klm\n")),
|
||||
array('cdata',array("klm")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
|
||||
|
@ -45,7 +45,7 @@ class TestOfDoku_Parser_Quote extends TestOfDoku_Parser {
|
|||
array('quote_close',array()),
|
||||
array('quote_close',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("klm\n")),
|
||||
array('cdata',array("klm")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
|
||||
|
@ -86,7 +86,7 @@ class TestOfDoku_Parser_Quote extends TestOfDoku_Parser {
|
|||
array('quote_close',array()),
|
||||
array('quote_close',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("klm".DOKU_PARSER_EOL)),
|
||||
array('cdata',array("klm")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('singlequoteopening',array()),
|
||||
array('cdata',array('hello Bar'."\n")),
|
||||
array('cdata',array('hello Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo said:')),
|
||||
array('singlequoteopening',array()),
|
||||
array('cdata',array('hello Bar'."\n")),
|
||||
array('cdata',array('hello Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -56,7 +56,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo hello')),
|
||||
array('singlequoteclosing',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -73,7 +73,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo hello')),
|
||||
array('singlequoteclosing',array()),
|
||||
array('cdata',array(') Bar'."\n")),
|
||||
array('cdata',array(') Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -92,7 +92,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('singlequoteopening',array()),
|
||||
array('cdata',array('hello')),
|
||||
array('singlequoteclosing',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -109,7 +109,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'hey it')),
|
||||
array('apostrophe',array()),
|
||||
array('cdata',array('s fine weather today'."\n")),
|
||||
array('cdata',array('s fine weather today')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -129,7 +129,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('singlequoteopening',array()),
|
||||
array('cdata',array('hello')),
|
||||
array('singlequoteclosing',array()),
|
||||
array('cdata',array(') Bar'."\n")),
|
||||
array('cdata',array(') Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -146,7 +146,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('doublequoteopening',array()),
|
||||
array('cdata',array('hello Bar'."\n")),
|
||||
array('cdata',array('hello Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -163,7 +163,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo said:')),
|
||||
array('doublequoteopening',array()),
|
||||
array('cdata',array('hello Bar'."\n")),
|
||||
array('cdata',array('hello Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -180,7 +180,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo hello')),
|
||||
array('doublequoteclosing',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -197,7 +197,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo hello')),
|
||||
array('doublequoteclosing',array()),
|
||||
array('cdata',array(') Bar'."\n")),
|
||||
array('cdata',array(') Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -216,7 +216,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('doublequoteopening',array()),
|
||||
array('cdata',array('hello')),
|
||||
array('doublequoteclosing',array()),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -235,7 +235,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('doublequoteopening',array()),
|
||||
array('cdata',array('hello')),
|
||||
array('doublequoteclosing',array()),
|
||||
array('cdata',array(') Bar'."\n")),
|
||||
array('cdata',array(') Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -261,7 +261,7 @@ class TestOfDoku_Parser_Quotes extends TestOfDoku_Parser {
|
|||
array('cdata',array('s world')),
|
||||
array('singlequoteclosing',array()),
|
||||
array('doublequoteclosing',array()),
|
||||
array('cdata',array(".\n")),
|
||||
array('cdata',array(".")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -17,7 +17,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'abc ')),
|
||||
array('acronym',array('FOOBAR')),
|
||||
array('cdata',array(' xyz'."\n")),
|
||||
array('cdata',array(' xyz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -32,7 +32,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n".'abcFOOBARxyz'."\n")),
|
||||
array('cdata',array("\n".'abcFOOBARxyz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -49,7 +49,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'FOOBAR ')),
|
||||
array('acronym',array('FOO')),
|
||||
array('cdata',array("\n")),
|
||||
array('cdata',array('')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -68,7 +68,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('acronym',array('FOO')),
|
||||
array('cdata',array(' def ')),
|
||||
array('acronym',array('BAR')),
|
||||
array('cdata',array(' xyz'."\n")),
|
||||
array('cdata',array(' xyz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -92,7 +92,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('acronym',array('FOO.1')),
|
||||
array('cdata',array(" ")),
|
||||
array('acronym',array('A.FOO.1')),
|
||||
array('cdata',array("\n")),
|
||||
array('cdata',array('')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -115,7 +115,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('acronym',array('FOO.1')),
|
||||
array('cdata',array(" ")),
|
||||
array('acronym',array('A.FOO.1')),
|
||||
array('cdata',array("\n")),
|
||||
array('cdata',array('')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -130,7 +130,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc:-)xyz\n")),
|
||||
array('cdata',array("\nabc:-)xyz")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -147,7 +147,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'abc ')),
|
||||
array('smiley',array(':-)')),
|
||||
array('cdata',array(' xyz'."\n")),
|
||||
array('cdata',array(' xyz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -162,7 +162,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc:-)x^_^yz\n")),
|
||||
array('cdata',array("\nabc:-)x^_^yz")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -181,7 +181,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('smiley',array(':-)')),
|
||||
array('cdata',array(' x ')),
|
||||
array('smiley',array('^_^')),
|
||||
array('cdata',array(' yz'."\n")),
|
||||
array('cdata',array(' yz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -197,7 +197,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\nabc".':-\\\\'."xyz\n")),
|
||||
array('cdata',array("\nabc".':-\\\\'."xyz")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -215,7 +215,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'abc ')),
|
||||
array('smiley',array(':-\\\\')),
|
||||
array('cdata',array(' xyz'."\n")),
|
||||
array('cdata',array(' xyz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -232,7 +232,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'abc ')),
|
||||
array('wordblock',array('CAT')),
|
||||
array('cdata',array(' xyz'."\n")),
|
||||
array('cdata',array(' xyz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -249,7 +249,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'abc ')),
|
||||
array('wordblock',array('cat')),
|
||||
array('cdata',array(' xyz'."\n")),
|
||||
array('cdata',array(' xyz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -268,7 +268,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('wordblock',array('cat')),
|
||||
array('cdata',array(' x ')),
|
||||
array('wordblock',array('DOG')),
|
||||
array('cdata',array(' yz'."\n")),
|
||||
array('cdata',array(' yz')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -285,7 +285,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'x ')),
|
||||
array('entity',array('->')),
|
||||
array('cdata',array(' y'."\n")),
|
||||
array('cdata',array(' y')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -304,7 +304,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('entity',array('->')),
|
||||
array('cdata',array(' y ')),
|
||||
array('entity',array('<-')),
|
||||
array('cdata',array(' z'."\n")),
|
||||
array('cdata',array(' z')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -321,7 +321,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('multiplyentity',array(10,20)),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -337,7 +337,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo 0x123 Bar'."\n")),
|
||||
array('cdata',array("\n".'Foo 0x123 Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -356,7 +356,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('hr',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n Bar\n")),
|
||||
array('cdata',array("\n Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -374,7 +374,7 @@ class TestOfDoku_Parser_Replacements extends TestOfDoku_Parser {
|
|||
array('p_close',array()),
|
||||
array('hr',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array("\n Bar\n")),
|
||||
array('cdata',array("\n Bar")),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -44,7 +44,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(121)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -84,7 +84,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(121)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -108,7 +108,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(7)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -142,7 +142,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(19)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -177,7 +177,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(23)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -220,7 +220,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(31)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -268,7 +268,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(51)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -306,7 +306,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(27)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -326,7 +326,7 @@ def');
|
|||
$calls = array (
|
||||
array('document_start',array()),
|
||||
array('p_open',array()),
|
||||
array('cdata',array(DOKU_PARSER_EOL."abc")),
|
||||
array('cdata',array("abc")),
|
||||
array('p_close',array()),
|
||||
array('table_open',array(3, 2, 6)),
|
||||
array('tablerow_open',array()),
|
||||
|
@ -353,7 +353,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(121)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'.DOKU_PARSER_EOL)),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -408,7 +408,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(129)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -459,7 +459,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(155)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -506,7 +506,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(123)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -566,7 +566,7 @@ def');
|
|||
array('tablerow_close',array()),
|
||||
array('table_close',array(129)),
|
||||
array('p_open',array()),
|
||||
array('cdata',array('def'."\n")),
|
||||
array('cdata',array('def')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -15,7 +15,7 @@ class TestOfDoku_Parser_Unformatted extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('unformatted',array('testing')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
@ -32,7 +32,7 @@ class TestOfDoku_Parser_Unformatted extends TestOfDoku_Parser {
|
|||
array('p_open',array()),
|
||||
array('cdata',array("\n".'Foo ')),
|
||||
array('unformatted',array('testing')),
|
||||
array('cdata',array(' Bar'."\n")),
|
||||
array('cdata',array(' Bar')),
|
||||
array('p_close',array()),
|
||||
array('document_end',array()),
|
||||
);
|
||||
|
|
|
@ -12,7 +12,7 @@ class xhtml_links_test extends UnitTestCase {
|
|||
$p = new Doku_Renderer_xhtml();
|
||||
$p->emaillink('foo@example.com','<script>alert(\'"alert"\');</script>');
|
||||
|
||||
$expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="mail JSnocheck" title="foo [at] example [dot] com"><script>alert('"alert"');</script></a>';
|
||||
$expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="mail" title="foo [at] example [dot] com"><script>alert('"alert"');</script></a>';
|
||||
|
||||
$this->assertEqual($p->doc,$expect);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ class xhtml_links_test extends UnitTestCase {
|
|||
$p = new Doku_Renderer_xhtml();
|
||||
$p->emaillink('foo@example.com',$image);
|
||||
|
||||
$expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="media JSnocheck" title="foo [at] example [dot] com"><img src="'.DOKU_BASE.'lib/exe/fetch.php/img.gif?w=10&h=20&cache=nocache" class="media" title="Some Image" alt="Some Image" width="10" height="20" /></a>';
|
||||
$expect = '<a href="mailto:foo%20%5Bat%5D%20example%20%5Bdot%5D%20com" class="media" title="foo [at] example [dot] com"><img src="'.DOKU_BASE.'lib/exe/fetch.php/img.gif?w=10&h=20&cache=nocache" class="media" title="Some Image" alt="Some Image" width="10" height="20" /></a>';
|
||||
|
||||
$this->assertEqual($p->doc,$expect);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
require_once DOKU_INC.'inc/init.php';
|
||||
|
||||
class parserutils_set_metadata_during_rendering_test extends UnitTestCase {
|
||||
// the id used for this test case
|
||||
private $id;
|
||||
// if the test case is currently running
|
||||
private $active = false;
|
||||
// the original plugin controller
|
||||
private $plugin_controller;
|
||||
|
||||
// the actual test
|
||||
function test_p_set_metadata_during_rendering() {
|
||||
global $EVENT_HANDLER;
|
||||
$this->id = 'test:p_set_metadata_during_rendering';
|
||||
$this->active = true;
|
||||
|
||||
// write the wiki page so it exists and needs to be rendered
|
||||
saveWikiText($this->id, 'Test '.time(), 'Test data setup');
|
||||
|
||||
$EVENT_HANDLER->register_hook('PARSER_METADATA_RENDER', 'BEFORE', $this, 'helper_set_metadata', array('test_before_set' => 'test'));
|
||||
$EVENT_HANDLER->register_hook('PARSER_METADATA_RENDER', 'AFTER', $this, 'helper_set_metadata', array('test_after_set' => 'test'));
|
||||
$EVENT_HANDLER->register_hook('PARSER_HANDLER_DONE', 'BEFORE', $this, 'helper_inject_test_instruction');
|
||||
|
||||
// Change the global plugin controller so this test can be a fake syntax plugin
|
||||
global $plugin_controller;
|
||||
$this->plugin_controller = $plugin_controller;
|
||||
$plugin_controller = $this;
|
||||
|
||||
// the actual rendering, all hooks should be executed here
|
||||
$newMeta = p_get_metadata($this->id);
|
||||
|
||||
// restore the plugin controller
|
||||
$plugin_controller = $this->plugin_controller;
|
||||
|
||||
// assert that all three calls to p_set_metadata have been successful
|
||||
$this->assertEqual($newMeta['test_before_set'], 'test');
|
||||
$this->assertEqual($newMeta['test_after_set'], 'test');
|
||||
$this->assertEqual($newMeta['test_during_rendering'], 'test');
|
||||
|
||||
// clean up
|
||||
$this->active = false;
|
||||
|
||||
// make sure the saved metadata is the one that has been rendered
|
||||
$this->assertEqual($newMeta, p_get_metadata($this->id));
|
||||
|
||||
saveWikiText($this->id, '', 'Test data remove');
|
||||
}
|
||||
|
||||
// helper for the action plugin part of the test, tries executing p_set_metadata during rendering
|
||||
function helper_set_metadata($event, $meta) {
|
||||
if ($this->active) {
|
||||
p_set_metadata($this->id, $meta, false, true);
|
||||
$key = array_pop(array_keys($meta));
|
||||
$this->assertTrue(is_string($meta[$key])); // ensure we really have a key
|
||||
// ensure that the metadata property hasn't been set previously
|
||||
$this->assertNotEqual($meta[$key], p_get_metadata($this->id, $key));
|
||||
}
|
||||
}
|
||||
|
||||
// helper for injecting an instruction for this test case
|
||||
function helper_inject_test_instruction($event) {
|
||||
if ($this->active)
|
||||
$event->data->calls[] = array('plugin', array('parserutils_test', array()));
|
||||
}
|
||||
|
||||
// fake syntax plugin rendering method that tries calling p_set_metadata during the actual rendering process
|
||||
function render($format, &$renderer, $data) {
|
||||
if ($this->active) {
|
||||
$key = 'test_during_rendering';
|
||||
p_set_metadata($this->id, array($key => 'test'), false, true);
|
||||
// ensure that the metadata property hasn't been set previously
|
||||
$this->assertNotEqual($key, p_get_metadata($this->id, $key));
|
||||
}
|
||||
}
|
||||
|
||||
// wrapper function for the fake plugin controller
|
||||
function getList($type='',$all=false){
|
||||
return $this->plugin_controller->getList();
|
||||
}
|
||||
|
||||
// wrapper function for the fake plugin controller, return $this for the fake syntax of this test
|
||||
function &load($type,$name,$new=false,$disabled=false){
|
||||
if ($name == 'parserutils_test') {
|
||||
return $this;
|
||||
} else {
|
||||
return $this->plugin_controller->load($type, $name, $new, $disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// vim:ts=4:sw=4:et:
|
|
@ -10,6 +10,8 @@ class safeFN_test extends UnitTestCase {
|
|||
function test1(){
|
||||
// we test multiple cases here - format: string, repl, additional, test
|
||||
$tests = array();
|
||||
$tests[] = array('äa.txt', '%5g.a.txt');
|
||||
$tests[] = array('ä.', '%5g..');
|
||||
$tests[] = array('asciistring','asciistring');
|
||||
$tests[] = array('ascii-_/.string','ascii-_/.string');
|
||||
$tests[] = array('AName','%x%1a.ame');
|
||||
|
@ -18,8 +20,8 @@ class safeFN_test extends UnitTestCase {
|
|||
$tests[] = array('Aß∂ƒName','%x%5b%6oy%aa%1a.ame');
|
||||
$tests[] = array('A%ß-∂_.ƒName','%x%%5b.-%6oy._.%aa%1a.ame');
|
||||
$tests[] = array('A%%ß-∂_.ƒName','%x%%%5b.-%6oy._.%aa%1a.ame');
|
||||
$tests[] = array('데이터도 함께 복원됩니다. 강력한','%zf4%13dg%15ao%zhg%0%164o%yig%0%11at%138w%zk9%zag%zb8..%0%xyt%10cl%164c');
|
||||
$tests[] = array('совместимая','%td%ta%sy%t8%t1%td%te%t4%t8%sw%tr');
|
||||
$tests[] = array('데이터도 함께 복원됩니다. 강력한','%zf4%13dg%15ao%zhg%0%164o%yig%0%11at%138w%zk9%zag%zb8..%0%xyt%10cl%164c.');
|
||||
$tests[] = array('совместимая','%td%ta%sy%t8%t1%td%te%t4%t8%sw%tr.');
|
||||
$tests[] = array('нехватка_файлового_пространства_на_сервере_p0-squid.some.domain.1270211897.txt.gz','%t9%t1%th%sy%sw%te%t6%sw._%tg%sw%t5%t7%ta%sy%ta%sz%ta._%tb%tc%ta%td%te%tc%sw%t9%td%te%sy%sw._%t9%sw._%td%t1%tc%sy%t1%tc%t1._p0-squid.some.domain.1270211897.txt.gz');
|
||||
|
||||
foreach($tests as $test){
|
||||
|
@ -30,4 +32,4 @@ class safeFN_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -75,4 +75,4 @@ class utf8_correctidx_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -69,4 +69,4 @@ class utf8_html_test extends UnitTestCase {
|
|||
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -33,4 +33,4 @@ class utf8_romanize_test extends UnitTestCase {
|
|||
$this->assertEqual("a A a A a o O",utf8_romanize("å Å ä Ä ä ö Ö"));
|
||||
}
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -24,4 +24,4 @@ class utf8_stripspecials extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -40,4 +40,4 @@ class utf8_substr_test extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -57,4 +57,4 @@ class utf8_unicode_test extends UnitTestCase {
|
|||
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -25,4 +25,4 @@ class utf8_utf16be_test extends UnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -65,4 +65,4 @@ class css_css_compress_test extends UnitTestCase {
|
|||
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
require_once DOKU_INC.'lib/exe/css.php';
|
||||
|
||||
class css_css_loadfile_test extends UnitTestCase {
|
||||
public function setUp() {
|
||||
$this->file = tempnam('/tmp', 'css');
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
private function csstest($input, $output = null, $location = 'http://www.example.com/') {
|
||||
io_saveFile($this->file, $input);
|
||||
$this->assertEqual(css_loadfile($this->file, $location), (is_null($output) ? $input : $output));
|
||||
}
|
||||
|
||||
public function test_url_relative() {
|
||||
$this->csstest('#test { background: url("test/test.png"); }', '#test { background: url("http://www.example.com/test/test.png"); }');
|
||||
$this->csstest('#test { background: url(\'test/test.png\'); }', '#test { background: url(\'http://www.example.com/test/test.png\'); }');
|
||||
}
|
||||
|
||||
public function test_url_absolute() {
|
||||
$this->csstest('#test { background: url("/test/test.png"); }');
|
||||
$this->csstest('#test { background: url(\'/test/test.png\'); }');
|
||||
}
|
||||
|
||||
public function test_url_with_protocol() {
|
||||
$this->csstest('#test { background: url("http://www.test.com/test/test.png"); }');
|
||||
$this->csstest('#test { background: url("https://www.test.com/test/test.png"); }');
|
||||
$this->csstest('#test { background: url(\'http://www.test.com/test/test.png\'); }');
|
||||
$this->csstest('#test { background: url(\'https://www.test.com/test/test.png\'); }');
|
||||
}
|
||||
|
||||
public function test_import_relative() {
|
||||
$this->csstest('@import "test/test.png";', '@import "http://www.example.com/test/test.png";');
|
||||
$this->csstest('@import \'test/test.png\';', '@import \'http://www.example.com/test/test.png\';');
|
||||
}
|
||||
|
||||
public function test_import_absolute() {
|
||||
$this->csstest('@import "/test/test.png";');
|
||||
$this->csstest('@import \'/test/test.png\';');
|
||||
}
|
||||
|
||||
public function test_import_with_protocol() {
|
||||
$this->csstest('@import "http://www.test.com/test/test.png";');
|
||||
$this->csstest('@import "https://www.test.com/test/test.png";');
|
||||
$this->csstest('@import \'http://www.test.com/test/test.png\';');
|
||||
$this->csstest('@import \'https://www.test.com/test/test.png\';');
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
unlink($this->file);
|
||||
unset($this->file);
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 sw=4 :
|
|
@ -120,4 +120,4 @@ class js_js_compress_test extends UnitTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -13,10 +13,6 @@ require_once(DOKU_INC.'inc/auth.php');
|
|||
require_once(DOKU_INC.'inc/cliopts.php');
|
||||
session_write_close();
|
||||
|
||||
// Version tag used to force rebuild on upgrade
|
||||
// Need to keep in sync with lib/exe/indexer.php
|
||||
if(!defined('INDEXER_VERSION')) define('INDEXER_VERSION', 2);
|
||||
|
||||
// handle options
|
||||
$short_opts = 'hcuq';
|
||||
$long_opts = array('help', 'clear', 'update', 'quiet');
|
||||
|
@ -28,6 +24,7 @@ if ( $OPTS->isError() ) {
|
|||
}
|
||||
$CLEAR = false;
|
||||
$QUIET = false;
|
||||
$INDEXER = null;
|
||||
foreach ($OPTS->options as $key => $val) {
|
||||
switch ($key) {
|
||||
case 'h':
|
||||
|
@ -70,13 +67,9 @@ function _usage() {
|
|||
|
||||
function _update(){
|
||||
global $conf;
|
||||
global $INDEXER;
|
||||
|
||||
// upgrade to version 2
|
||||
if (!@file_exists($conf['indexdir'].'/pageword.idx')){
|
||||
_lock();
|
||||
idx_upgradePageWords();
|
||||
_unlock();
|
||||
}
|
||||
$INDEXER = idx_get_indexer();
|
||||
|
||||
$data = array();
|
||||
_quietecho("Searching pages... ");
|
||||
|
@ -89,25 +82,21 @@ function _update(){
|
|||
}
|
||||
|
||||
function _index($id){
|
||||
global $INDEXER;
|
||||
global $CLEAR;
|
||||
global $QUIET;
|
||||
|
||||
// if not cleared only update changed and new files
|
||||
if(!$CLEAR){
|
||||
if($CLEAR){
|
||||
$idxtag = metaFN($id,'.indexed');
|
||||
if(@file_exists($idxtag)){
|
||||
if(io_readFile($idxtag) >= INDEXER_VERSION){
|
||||
$last = @filemtime(metaFN($id,'.indexed'));
|
||||
if($last > @filemtime(wikiFN($id))) return;
|
||||
}
|
||||
@unlink($idxtag);
|
||||
}
|
||||
}
|
||||
|
||||
_lock();
|
||||
_quietecho("$id... ");
|
||||
idx_addPage($id);
|
||||
io_saveFile(metaFN($id,'.indexed'),INDEXER_VERSION);
|
||||
idx_addPage($id, !$QUIET);
|
||||
_quietecho("done.\n");
|
||||
_unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -152,7 +141,7 @@ function _clearindex(){
|
|||
_lock();
|
||||
_quietecho("Clearing index... ");
|
||||
io_saveFile($conf['indexdir'].'/page.idx','');
|
||||
io_saveFile($conf['indexdir'].'/title.idx','');
|
||||
//io_saveFile($conf['indexdir'].'/title.idx','');
|
||||
$dir = @opendir($conf['indexdir']);
|
||||
if($dir!==false){
|
||||
while(($f = readdir($dir)) !== false){
|
||||
|
@ -161,6 +150,7 @@ function _clearindex(){
|
|||
@unlink($conf['indexdir']."/$f");
|
||||
}
|
||||
}
|
||||
@unlink($conf['indexdir'].'/lengths.idx');
|
||||
_quietecho("done.\n");
|
||||
_unlock();
|
||||
}
|
||||
|
@ -170,4 +160,4 @@ function _quietecho($msg) {
|
|||
if(!$QUIET) echo $msg;
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* Strip unwanted languages from the DokuWiki install
|
||||
*
|
||||
* @author Martin 'E.T.' Misuth <et.github@ethome.sk>
|
||||
*/
|
||||
if ('cli' != php_sapi_name()) die();
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
|
||||
require_once DOKU_INC.'inc/cliopts.php';
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
function usage($show_examples = false) {
|
||||
print "Usage: striplangs.php [-h [-x]] [-e] [-k lang1[,lang2]..[,langN]]
|
||||
|
||||
Removes all languages from the instalation, besides the ones
|
||||
after the -k option. English language is never removed!
|
||||
|
||||
OPTIONS
|
||||
-h, --help get this help
|
||||
-x, --examples get also usage examples
|
||||
-k, --keep comma separated list of languages, -e is always implied
|
||||
-e, --english keeps english, dummy to use without -k";
|
||||
if ( $show_examples ) {
|
||||
print "\n
|
||||
EXAMPLES
|
||||
Strips all languages, but keeps 'en' and 'de':
|
||||
striplangs -k de
|
||||
|
||||
Strips all but 'en','ca-valencia','cs','de','is','sk':
|
||||
striplangs --keep ca-valencia,cs,de,is,sk
|
||||
|
||||
Strips all but 'en':
|
||||
striplangs -e
|
||||
|
||||
No option specified, prints usage and throws error:
|
||||
striplangs\n";
|
||||
}
|
||||
}
|
||||
|
||||
function getSuppliedArgument($OPTS, $short, $long) {
|
||||
$arg = $OPTS->get($short);
|
||||
if ( is_null($arg) ) {
|
||||
$arg = $OPTS->get($long);
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
|
||||
function processPlugins($path, $keep_langs) {
|
||||
if (is_dir($path)) {
|
||||
$entries = scandir($path);
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if ( is_dir($path.'/'.$entry) ) {
|
||||
|
||||
$plugin_langs = $path.'/'.$entry.'/lang';
|
||||
|
||||
if ( is_dir( $plugin_langs ) ) {
|
||||
stripDirLangs($plugin_langs, $keep_langs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function stripDirLangs($path, $keep_langs) {
|
||||
$dir = dir($path);
|
||||
|
||||
while(($cur_dir = $dir->read()) !== false) {
|
||||
if( $cur_dir != '.' and $cur_dir != '..' and is_dir($path.'/'.$cur_dir)) {
|
||||
|
||||
if ( !in_array($cur_dir, $keep_langs, true ) ) {
|
||||
killDir($path.'/'.$cur_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
$dir->close();
|
||||
}
|
||||
|
||||
function killDir($dir) {
|
||||
if (is_dir($dir)) {
|
||||
$entries = scandir($dir);
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
if ($entry != "." && $entry != "..") {
|
||||
if ( is_dir($dir.'/'.$entry) ) {
|
||||
killDir($dir.'/'.$entry);
|
||||
} else {
|
||||
unlink($dir.'/'.$entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
reset($entries);
|
||||
rmdir($dir);
|
||||
}
|
||||
}
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
// handle options
|
||||
$short_opts = 'hxk:e';
|
||||
$long_opts = array('help', 'examples', 'keep=','english');
|
||||
|
||||
$OPTS = Doku_Cli_Opts::getOptions(__FILE__, $short_opts, $long_opts);
|
||||
|
||||
if ( $OPTS->isError() ) {
|
||||
fwrite( STDERR, $OPTS->getMessage() . "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// handle '--examples' option
|
||||
$show_examples = ( $OPTS->has('x') or $OPTS->has('examples') ) ? true : false;
|
||||
|
||||
// handle '--help' option
|
||||
if ( $OPTS->has('h') or $OPTS->has('help') ) {
|
||||
usage($show_examples);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// handle both '--keep' and '--english' options
|
||||
if ( $OPTS->has('k') or $OPTS->has('keep') ) {
|
||||
$preserved_langs = getSuppliedArgument($OPTS,'k','keep');
|
||||
$langs = explode(',', $preserved_langs);
|
||||
|
||||
// ! always enforce 'en' lang when using '--keep' (DW relies on it)
|
||||
if ( !isset($langs['en']) ) {
|
||||
$langs[]='en';
|
||||
}
|
||||
} elseif ( $OPTS->has('e') or $OPTS->has('english') ) {
|
||||
// '--english' was specified strip everything besides 'en'
|
||||
$langs = array ('en');
|
||||
} else {
|
||||
// no option was specified, print usage but don't do anything as
|
||||
// this run might not be intented
|
||||
usage();
|
||||
print "\n
|
||||
ERROR
|
||||
No option specified, use either -h -x to get more info,
|
||||
or -e to strip every language besides english.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Kill all language directories in /inc/lang and /lib/plugins besides those in $langs array
|
||||
stripDirLangs(realpath(dirname(__FILE__).'/../inc/lang'), $langs);
|
||||
processPlugins(realpath(dirname(__FILE__).'/../lib/plugins'), $langs);
|
|
@ -62,6 +62,7 @@ JPEG Joint Photographics Experts Group
|
|||
JPG Joint Photographics Experts Group
|
||||
JS JavaScript
|
||||
KISS Keep it simple stupid
|
||||
LAN Local Area Network
|
||||
LDAP Lightweight Directory Access Protocol
|
||||
LGPL GNU Lesser General Public License
|
||||
LOL Laughing out loud
|
||||
|
@ -71,8 +72,8 @@ MHz Megahertz
|
|||
MIME Multipurpose Internet Mail Extension
|
||||
MIT Massachusetts Institute of Technology
|
||||
MML Mathematical Markup Language
|
||||
MP3 Motion Picture Experts Group Layer 3
|
||||
MPEG Motion Picture Experts Group
|
||||
MP3 Moving Picture Experts Group Layer 3
|
||||
MPEG Moving Picture Experts Group
|
||||
MSDN Microsoft Developer Network
|
||||
MS Microsoft
|
||||
MSIE Microsoft Internet Explorer
|
||||
|
@ -101,6 +102,7 @@ POP Post Office Protocol
|
|||
QoS Quality of Service
|
||||
RAID Redundant Array of Inexpensive Disks
|
||||
RDF Resource Description Framework
|
||||
RFC Request for Comments
|
||||
ROTFL Rolling on the floor laughing
|
||||
RPC Remote Procedure Call
|
||||
RSS Rich Site Summary
|
||||
|
|
|
@ -99,6 +99,7 @@ $conf['fetchsize'] = 0; //maximum size (bytes) fetch.php may do
|
|||
$conf['notify'] = ''; //send change info to this email (leave blank for nobody)
|
||||
$conf['registernotify'] = ''; //send info about newly registered users to this email (leave blank for nobody)
|
||||
$conf['mailfrom'] = ''; //use this email when sending mails
|
||||
$conf['mailprefix'] = ''; //use this as prefix of outgoing mails
|
||||
$conf['gzip_output'] = 0; //use gzip content encodeing for the output xhtml (if allowed by browser)
|
||||
$conf['gdlib'] = 2; //the GDlib version (0, 1 or 2) 2 tries to autodetect
|
||||
$conf['im_convert'] = ''; //path to ImageMagicks convert (will be used instead of GD)
|
||||
|
@ -121,7 +122,7 @@ $conf['rss_linkto'] = 'diff'; //what page RSS entries link to:
|
|||
// '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 deafult?
|
||||
$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
|
||||
|
@ -133,6 +134,8 @@ $conf['broken_iua'] = 0; //Platform with broken ignore_user_abor
|
|||
$conf['xsendfile'] = 0; //Use X-Sendfile (1 = lighttpd, 2 = standard)
|
||||
$conf['renderer_xhtml'] = 'xhtml'; //renderer to use for main page generation
|
||||
$conf['rememberme'] = 1; //Enable/disable remember me on login
|
||||
$conf['external_tokenizer'] = 0; //Use an external program to split pages into words for indexing
|
||||
$conf['tokenizer_cmd'] = '/usr/bin/mecab -O wakati';
|
||||
|
||||
//Set target to use when creating links - leave empty for same window
|
||||
$conf['target']['wiki'] = '';
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
# no further encoding is done
|
||||
# If no placeholder is defined the urlencoded name is appended to the URL
|
||||
|
||||
# You can add more InterWiki shortcuts here.
|
||||
# To prevent losing your added InterWiki shortcuts after an upgrade,
|
||||
# you should add new ones to interwiki.local.conf
|
||||
|
||||
wp http://en.wikipedia.org/wiki/{NAME}
|
||||
wpfr http://fr.wikipedia.org/wiki/{NAME}
|
||||
|
@ -15,19 +16,24 @@ wppl http://pl.wikipedia.org/wiki/{NAME}
|
|||
wpjp http://ja.wikipedia.org/wiki/{NAME}
|
||||
wpmeta http://meta.wikipedia.org/wiki/{NAME}
|
||||
doku http://www.dokuwiki.org/
|
||||
dokubug http://bugs.splitbrain.org/index.php?do=details&task_id=
|
||||
dokubug http://bugs.dokuwiki.org/index.php?do=details&task_id=
|
||||
rfc http://www.cs.ccu.edu.tw/~chm91u/rfc2html.php?in=
|
||||
man http://man.cx/
|
||||
amazon http://www.amazon.com/exec/obidos/ASIN/{URL}/splitbrain-20/
|
||||
amazon.de http://www.amazon.de/exec/obidos/ASIN/{URL}/splitbrain-21/
|
||||
amazon.uk http://www.amazon.co.uk/exec/obidos/ASIN/
|
||||
paypal https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=
|
||||
phpfn http://www.php.net/{NAME}
|
||||
coral http://{HOST}.{PORT}.nyud.net:8090/{PATH}?{QUERY}
|
||||
freecache http://freecache.org/{NAME}
|
||||
sb http://www.splitbrain.org/go/
|
||||
skype skype:{NAME}
|
||||
google.de http://www.google.de/search?q=
|
||||
go http://www.google.com/search?q={URL}&btnI=lucky
|
||||
|
||||
# To support VoIP/SIP links
|
||||
callto callto://{NAME}
|
||||
|
||||
# Standards from http://usemod.com/intermap.txt follow
|
||||
|
||||
AbbeNormal http://www.ourpla.net/cgi-bin/pikie.cgi?
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
:-X icon_silenced.gif
|
||||
:-| icon_neutral.gif
|
||||
;-) icon_wink.gif
|
||||
m( facepalm.gif
|
||||
^_^ icon_fun.gif
|
||||
:?: icon_question.gif
|
||||
:!: icon_exclaim.gif
|
||||
|
|
|
@ -26,4 +26,7 @@ downgradetowindowsxp\.com
|
|||
elegantugg\.com
|
||||
classicedhardy\.com
|
||||
research-service\.com
|
||||
https?:\/\/(\S*?)(2-pay-secure|911essay|academia-research|anypapers|applicationessay|bestbuyessay|bestdissertation|bestessay|bestresume|besttermpaper|college-paper|customessay|custom-made-paper|custom-writing|dissertationblog|dissertation-service|dissertations?expert|essaybank|essay-?blog|essaycapital|essaylogic|essaymill|essayontime|essaypaper|essays?land|essaytownsucks|essaywrit|essay-writing-service|fastessays|freelancercareers|genuinecontent|genuineessay|genuinepaper|goessay|grandresume|killer-content|ma-dissertation|masterpaper|mightystudent|needessay|researchedge|researchpaper-blog|resumecvservice|resumesexperts|resumesplanet|rushessay|samedayessay|superiorcontent|superiorpaper|superiorthesis|term-paper|termpaper-blog|term-paper-research|thesisblog|universalresearch|valwriting|vdwriters|wisetranslation|writersassembly|writers\.com\.ph|writers\.ph)
|
||||
https?:\/\/(\S*?)(2-pay-secure|911essay|academia-research|anypapers|applicationessay|bestbuyessay|bestdissertation|bestessay|bestresume|besttermpaper|businessessay|college-paper|customessay|custom-made-paper|custom-writing|degree-?result|dissertationblog|dissertation-service|dissertations?expert|essaybank|essay-?blog|essaycapital|essaylogic|essaymill|essayontime|essaypaper|essays?land|essaytownsucks|essay-?writ|fastessays|freelancercareers|genuinecontent|genuineessay|genuinepaper|goessay|grandresume|killer-content|ma-dissertation|managementessay|masterpaper|mightystudent|needessay|researchedge|researchpaper-blog|resumecvservice|resumesexperts|resumesplanet|rushessay|samedayessay|superiorcontent|superiorpaper|superiorthesis|term-paper|termpaper-blog|term-paper-research|thesisblog|universalresearch|valwriting|vdwriters|wisetranslation|writersassembly|writers\.com\.ph|writers\.ph)
|
||||
flatsinmumbai\.co\.in
|
||||
https?:\/\/(\S*?)penny-?stock
|
||||
mattressreview\.biz
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
personal_ws-1.1 en 4 utf-8
|
||||
DokuWiki
|
||||
Wiki
|
||||
WikiWiki
|
||||
Gohr
|
|
@ -0,0 +1,242 @@
|
|||
# This is a list of files that were present in previous DokuWiki releases
|
||||
# but were removed later. An up to date DokuWiki should not have any of
|
||||
# the files installed
|
||||
# A copy of this list is maintained at
|
||||
# http://www.dokuwiki.org/install:upgrade#files_to_remove
|
||||
|
||||
|
||||
# removed in 2010-11-07
|
||||
inc/lang/ar/subscribermail.txt
|
||||
inc/lang/az/subscribermail.txt
|
||||
inc/lang/bg/subscribermail.txt
|
||||
inc/lang/ca/subscribermail.txt
|
||||
inc/lang/ca-valencia/subscribermail.txt
|
||||
inc/lang/cs/subscribermail.txt
|
||||
inc/lang/da/subscribermail.txt
|
||||
inc/lang/de-informal/subscribermail.txt
|
||||
inc/lang/el/subscribermail.txt
|
||||
inc/lang/eo/subscribermail.txt
|
||||
inc/lang/es/subscribermail.txt
|
||||
inc/lang/et/subscribermail.txt
|
||||
inc/lang/eu/subscribermail.txt
|
||||
inc/lang/fa/subscribermail.txt
|
||||
inc/lang/fi/subscribermail.txt
|
||||
inc/lang/fo/subscribermail.txt
|
||||
inc/lang/fr/subscribermail.txt
|
||||
inc/lang/gl/subscribermail.txt
|
||||
inc/lang/he/subscribermail.txt
|
||||
inc/lang/hr/subscribermail.txt
|
||||
inc/lang/hu/subscribermail.txt
|
||||
inc/lang/id/subscribermail.txt
|
||||
inc/lang/is/subscribermail.txt
|
||||
inc/lang/it/subscribermail.txt
|
||||
inc/lang/ja/subscribermail.txt
|
||||
inc/lang/ko/subscribermail.txt
|
||||
inc/lang/ku/subscribermail.txt
|
||||
inc/lang/lt/subscribermail.txt
|
||||
inc/lang/lv/subscribermail.txt
|
||||
inc/lang/mr/subscribermail.txt
|
||||
inc/lang/ne/subscribermail.txt
|
||||
inc/lang/nl/subscribermail.txt
|
||||
inc/lang/no/subscribermail.txt
|
||||
inc/lang/pl/subscribermail.txt
|
||||
inc/lang/pt-br/subscribermail.txt
|
||||
inc/lang/pt/subscribermail.txt
|
||||
inc/lang/ro/subscribermail.txt
|
||||
inc/lang/ru/subscribermail.txt
|
||||
inc/lang/sk/subscribermail.txt
|
||||
inc/lang/sr/subscribermail.txt
|
||||
inc/lang/sv/subscribermail.txt
|
||||
inc/lang/th/subscribermail.txt
|
||||
inc/lang/tr/subscribermail.txt
|
||||
inc/lang/uk/subscribermail.txt
|
||||
inc/lang/zh/subscribermail.txt
|
||||
inc/lang/zh-tw/subscribermail.txt
|
||||
|
||||
# removed in rc2010-10-07
|
||||
conf/msg
|
||||
inc/lang/bg/wordblock.txt
|
||||
inc/lang/ca-valencia/wordblock.txt
|
||||
inc/lang/ca/wordblock.txt
|
||||
inc/lang/cs/wordblock.txt
|
||||
inc/lang/da/wordblock.txt
|
||||
inc/lang/de-informal/wordblock.txt
|
||||
inc/lang/de/subscribermail.txt
|
||||
inc/lang/de/wordblock.txt
|
||||
inc/lang/el/wordblock.txt
|
||||
inc/lang/en/subscribermail.txt
|
||||
inc/lang/en/wordblock.txt
|
||||
inc/lang/eo/wordblock.txt
|
||||
inc/lang/es/wordblock.txt
|
||||
inc/lang/et/wordblock.txt
|
||||
inc/lang/eu/wordblock.txt
|
||||
inc/lang/fa/wordblock.txt
|
||||
inc/lang/fi/wordblock.txt
|
||||
inc/lang/fo/wordblock.txt
|
||||
inc/lang/fr/wordblock.txt
|
||||
inc/lang/he/wordblock.txt
|
||||
inc/lang/hr/wordblock.txt
|
||||
inc/lang/hu/wordblock.txt
|
||||
inc/lang/id/wordblock.txt
|
||||
inc/lang/it/wordblock.txt
|
||||
inc/lang/ja/wordblock.txt
|
||||
inc/lang/ko/wordblock.txt
|
||||
inc/lang/ku/wordblock.txt
|
||||
inc/lang/lt/wordblock.txt
|
||||
inc/lang/lv/wordblock.txt
|
||||
inc/lang/mg/wordblock.txt
|
||||
inc/lang/mr/wordblock.txt
|
||||
inc/lang/nl/wordblock.txt
|
||||
inc/lang/no/wordblock.txt
|
||||
inc/lang/pl/wordblock.txt
|
||||
inc/lang/pt-br/wordblock.txt
|
||||
inc/lang/pt/wordblock.txt
|
||||
inc/lang/ro/wordblock.txt
|
||||
inc/lang/sk/wordblock.txt
|
||||
inc/lang/sl/wordblock.txt
|
||||
inc/lang/sr/wordblock.txt
|
||||
inc/lang/sv/wordblock.txt
|
||||
inc/lang/th/wordblock.txt
|
||||
inc/lang/tr/wordblock.txt
|
||||
inc/lang/uk/wordblock.txt
|
||||
inc/lang/vi/wordblock.txt
|
||||
inc/lang/zh-tw/wordblock.txt
|
||||
inc/lang/zh/wordblock.txt
|
||||
lib/scripts/pngbehavior.htc
|
||||
|
||||
# removed in rc2009-12-02
|
||||
inc/lang/ar/wordblock.txt
|
||||
inc/lang/ca-va/
|
||||
lib/plugins/acl/lang/ca-va/
|
||||
lib/plugins/config/lang/ca-va/
|
||||
lib/plugins/plugin/lang/ca-va/
|
||||
lib/plugins/popularity/lang/ca-va/
|
||||
lib/plugins/revert/lang/ca-va/
|
||||
lib/plugins/usermanager/lang/ca-va/
|
||||
|
||||
# removed in rc2009-01-30
|
||||
lib/plugins/upgradeplugindirectory
|
||||
lib/plugins/upgradeplugindirectory/action.php
|
||||
|
||||
# removed in rc2009-01-26
|
||||
inc/auth/punbb.class.php
|
||||
inc/lang/ko/edit.txt_bak
|
||||
inc/lang/ko/lang.php_bak
|
||||
inc/lang/ku/admin_acl.txt
|
||||
inc/lang/mg/admin_acl.txt
|
||||
lib/plugins/importoldchangelog
|
||||
lib/plugins/importoldchangelog/action.php
|
||||
lib/plugins/importoldindex
|
||||
lib/plugins/importoldindex/action.php
|
||||
lib/plugins/usermanager/images/no_user_edit.png
|
||||
lib/plugins/usermanager/images/user_edit.png
|
||||
lib/tpl/default/UWEB.css
|
||||
|
||||
# removed in rc2008-03-31
|
||||
inc/aspell.php
|
||||
inc/geshi/css-gen.cfg
|
||||
inc/lang/fr/admin_acl.txt
|
||||
lib/exe/spellcheck.php
|
||||
lib/images/toolbar/spellcheck.png
|
||||
lib/images/toolbar/spellnoerr.png
|
||||
lib/images/toolbar/spellstop.png
|
||||
lib/images/toolbar/spellwait.gif
|
||||
lib/plugins/acl/lang/ar/intro.txt
|
||||
lib/plugins/acl/lang/bg/intro.txt
|
||||
lib/plugins/acl/lang/ca/intro.txt
|
||||
lib/plugins/acl/lang/cs/intro.txt
|
||||
lib/plugins/acl/lang/da/intro.txt
|
||||
lib/plugins/acl/lang/de/intro.txt
|
||||
lib/plugins/acl/lang/el/intro.txt
|
||||
lib/plugins/acl/lang/en/intro.txt
|
||||
lib/plugins/acl/lang/es/intro.txt
|
||||
lib/plugins/acl/lang/et/intro.txt
|
||||
lib/plugins/acl/lang/eu/intro.txt
|
||||
lib/plugins/acl/lang/fi/intro.txt
|
||||
lib/plugins/acl/lang/fr/intro.txt
|
||||
lib/plugins/acl/lang/gl/intro.txt
|
||||
lib/plugins/acl/lang/he/intro.txt
|
||||
lib/plugins/acl/lang/id/intro.txt
|
||||
lib/plugins/acl/lang/it/intro.txt
|
||||
lib/plugins/acl/lang/ja/intro.txt
|
||||
lib/plugins/acl/lang/ko/intro.txt
|
||||
lib/plugins/acl/lang/lt/intro.txt
|
||||
lib/plugins/acl/lang/lv/intro.txt
|
||||
lib/plugins/acl/lang/nl/intro.txt
|
||||
lib/plugins/acl/lang/no/intro.txt
|
||||
lib/plugins/acl/lang/pl/intro.txt
|
||||
lib/plugins/acl/lang/pt/intro.txt
|
||||
lib/plugins/acl/lang/ru/intro.txt
|
||||
lib/plugins/acl/lang/sk/intro.txt
|
||||
lib/plugins/acl/lang/sr/intro.txt
|
||||
lib/plugins/acl/lang/sv/intro.txt
|
||||
lib/plugins/acl/lang/tr/intro.txt
|
||||
lib/plugins/acl/lang/uk/intro.txt
|
||||
lib/plugins/acl/lang/vi/intro.txt
|
||||
lib/plugins/acl/lang/zh/intro.txt
|
||||
lib/plugins/acl/lang/zh-tw/intro.txt
|
||||
lib/scripts/spellcheck.js
|
||||
lib/styles/spellcheck.css
|
||||
|
||||
# removed in 2007-06-26
|
||||
inc/parser/wiki.php
|
||||
lib/images/interwiki/bug.gif
|
||||
lib/plugins/base.php
|
||||
lib/plugins/plugin/inc
|
||||
lib/plugins/plugin/inc/tarlib.class.php
|
||||
lib/plugins/plugin/inc/zip.lib.php
|
||||
lib/scripts/domLib.js
|
||||
lib/scripts/domTT.js
|
||||
|
||||
# removed in 2006-11-06
|
||||
inc/admin_acl.php
|
||||
inc/lang/lt/stopwords.txt
|
||||
inc/magpie
|
||||
inc/magpie/rss_cache.inc
|
||||
inc/magpie/rss_fetch.inc
|
||||
inc/magpie/rss_parse.inc
|
||||
inc/magpie/rss_utils.inc
|
||||
lib/exe/media.php
|
||||
lib/tpl/default/mediaedit.php
|
||||
lib/tpl/default/media.php
|
||||
lib/tpl/default/mediaref.php
|
||||
|
||||
# removed in 2006-03-09
|
||||
data/pages/wiki/playground.txt
|
||||
inc/auth/ldap.php
|
||||
inc/auth/mysql.php
|
||||
inc/auth/pgsql.php
|
||||
inc/auth/plain.php
|
||||
inc/lang/ca/admin_acl.txt
|
||||
inc/lang/cs/admin_acl.txt
|
||||
inc/lang/da/admin_acl.txt
|
||||
inc/lang/de/admin_acl.txt
|
||||
inc/lang/en/admin_acl.txt
|
||||
inc/lang/et/admin_acl.txt
|
||||
inc/lang/eu/admin_acl.txt
|
||||
inc/lang/fr/admin_acl.txt
|
||||
inc/lang/it/admin_acl.txt
|
||||
inc/lang/ja/admin_acl.txt
|
||||
inc/lang/lt/admin_acl.txt
|
||||
inc/lang/lv/admin_acl.txt
|
||||
inc/lang/nl/admin_acl.txt
|
||||
inc/lang/no/admin_acl.txt
|
||||
inc/lang/pl/admin_acl.txt
|
||||
inc/lang/pt/admin_acl.txt
|
||||
inc/lang/vi/admin_acl.txt
|
||||
inc/lang/zh-tw/admin_acl.txt
|
||||
inc/parser/spamcheck.php
|
||||
lib/images/favicon.ico
|
||||
lib/images/thumbup.gif
|
||||
lib/images/toolbar/code.png
|
||||
lib/images/toolbar/empty.png
|
||||
lib/images/toolbar/extlink.png
|
||||
lib/images/toolbar/fonth1.png
|
||||
lib/images/toolbar/fonth2.png
|
||||
lib/images/toolbar/fonth3.png
|
||||
lib/images/toolbar/fonth4.png
|
||||
lib/images/toolbar/fonth5.png
|
||||
lib/images/toolbar/list.png
|
||||
lib/images/toolbar/list_ul.png
|
||||
lib/images/toolbar/rule.png
|
||||
lib/tpl/default/images/interwiki.png
|
6
doku.php
6
doku.php
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
// update message version
|
||||
$updateVersion = 27;
|
||||
$updateVersion = 30;
|
||||
|
||||
// xdebug_start_profiling();
|
||||
|
||||
|
@ -27,9 +27,13 @@ if (isset($_SERVER['HTTP_X_DOKUWIKI_DO'])){
|
|||
require_once(DOKU_INC.'inc/init.php');
|
||||
|
||||
//import variables
|
||||
$_REQUEST['id'] = str_replace("\xC2\xAD",'',$_REQUEST['id']); //soft-hyphen
|
||||
$QUERY = trim($_REQUEST['id']);
|
||||
$ID = getID();
|
||||
|
||||
// deprecated 2011-01-14
|
||||
$NS = getNS($ID);
|
||||
|
||||
$REV = $_REQUEST['rev'];
|
||||
$IDX = $_REQUEST['idx'];
|
||||
$DATE = $_REQUEST['date'];
|
||||
|
|
72
feed.php
72
feed.php
|
@ -24,7 +24,7 @@ $cache = new cache($key, '.feed');
|
|||
// prepare cache depends
|
||||
$depends['files'] = getConfigFiles('main');
|
||||
$depends['age'] = $conf['rss_update'];
|
||||
$depends['purge'] = ($_REQUEST['purge']) ? true : false;
|
||||
$depends['purge'] = isset($_REQUEST['purge']);
|
||||
|
||||
// check cacheage and deliver if nothing has changed since last
|
||||
// time or the update interval has not passed, also handles conditional requests
|
||||
|
@ -55,18 +55,20 @@ $image->link = DOKU_URL;
|
|||
$rss->image = $image;
|
||||
|
||||
$data = null;
|
||||
if($opt['feed_mode'] == 'list'){
|
||||
$data = rssListNamespace($opt);
|
||||
}elseif($opt['feed_mode'] == 'search'){
|
||||
$data = rssSearch($opt);
|
||||
}else{
|
||||
$modes = array('list' => 'rssListNamespace',
|
||||
'search' => 'rssSearch',
|
||||
'recent' => 'rssRecentChanges');
|
||||
if (isset($modes[$opt['feed_mode']])) {
|
||||
$data = $modes[$opt['feed_mode']]($opt);
|
||||
} else {
|
||||
$eventData = array(
|
||||
'opt' => &$opt,
|
||||
'data' => &$data,
|
||||
);
|
||||
$event = new Doku_Event('FEED_MODE_UNKNOWN', $eventData);
|
||||
if ($event->advise_before(true)) {
|
||||
$data = rssRecentChanges($opt);
|
||||
echo sprintf('<error>Unknown feed mode %s</error>', hsc($opt['feed_mode']));
|
||||
exit;
|
||||
}
|
||||
$event->advise_after();
|
||||
}
|
||||
|
@ -83,29 +85,53 @@ print $feed;
|
|||
// ---------------------------------------------------------------- //
|
||||
|
||||
/**
|
||||
* Get URL parameters and config options and return a initialized option array
|
||||
* Get URL parameters and config options and return an initialized option array
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
function rss_parseOptions(){
|
||||
global $conf;
|
||||
|
||||
$opt['items'] = (int) $_REQUEST['num'];
|
||||
$opt['feed_type'] = $_REQUEST['type'];
|
||||
$opt['feed_mode'] = $_REQUEST['mode'];
|
||||
$opt['show_minor'] = $_REQUEST['minor'];
|
||||
$opt['namespace'] = $_REQUEST['ns'];
|
||||
$opt['link_to'] = $_REQUEST['linkto'];
|
||||
$opt['item_content'] = $_REQUEST['content'];
|
||||
$opt['search_query'] = $_REQUEST['q'];
|
||||
$opt = array();
|
||||
|
||||
foreach(array(
|
||||
// Basic feed properties
|
||||
// Plugins may probably want to add new values to these
|
||||
// properties for implementing own feeds
|
||||
|
||||
// One of: list, search, recent
|
||||
'feed_mode' => array('mode', 'recent'),
|
||||
// One of: diff, page, rev, current
|
||||
'link_to' => array('linkto', $conf['rss_linkto']),
|
||||
// One of: abstract, diff, htmldiff, html
|
||||
'item_content' => array('content', $conf['rss_content']),
|
||||
|
||||
// Special feed properties
|
||||
// These are only used by certain feed_modes
|
||||
|
||||
// String, used for feed title, in list and rc mode
|
||||
'namespace' => array('ns', null),
|
||||
// Positive integer, only used in rc mode
|
||||
'items' => array('num', $conf['recent']),
|
||||
// Boolean, only used in rc mode
|
||||
'show_minor' => array('minor', false),
|
||||
// String, only used in search mode
|
||||
'search_query' => array('q', null),
|
||||
|
||||
) as $name => $val) {
|
||||
$opt[$name] = (isset($_REQUEST[$val[0]]) && !empty($_REQUEST[$val[0]]))
|
||||
? $_REQUEST[$val[0]] : $val[1];
|
||||
}
|
||||
|
||||
$opt['items'] = max(0, (int) $opt['items']);
|
||||
$opt['show_minor'] = (bool) $opt['show_minor'];
|
||||
|
||||
if(!$opt['feed_type']) $opt['feed_type'] = $conf['rss_type'];
|
||||
if(!$opt['item_content']) $opt['item_content'] = $conf['rss_content'];
|
||||
if(!$opt['link_to']) $opt['link_to'] = $conf['rss_linkto'];
|
||||
if(!$opt['items']) $opt['items'] = $conf['recent'];
|
||||
$opt['guardmail'] = ($conf['mailguard'] != '' && $conf['mailguard'] != 'none');
|
||||
|
||||
switch ($opt['feed_type']){
|
||||
$type = valid_input_set('type', array('rss','rss2','atom','atom1','rss1',
|
||||
'default' => $conf['rss_type']),
|
||||
$_REQUEST);
|
||||
switch ($type){
|
||||
case 'rss':
|
||||
$opt['feed_type'] = 'RSS0.91';
|
||||
$opt['mime_type'] = 'text/xml';
|
||||
|
@ -279,7 +305,7 @@ function rss_buildItems(&$rss,&$data,$opt){
|
|||
}
|
||||
|
||||
// add category
|
||||
if($meta['subject']){
|
||||
if(isset($meta['subject'])) {
|
||||
$item->category = $meta['subject'];
|
||||
}else{
|
||||
$cat = getNS($id);
|
||||
|
@ -349,4 +375,4 @@ function rssSearch($opt){
|
|||
return $data;
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -30,7 +30,7 @@ class _DiffOp {
|
|||
class _DiffOp_Copy extends _DiffOp {
|
||||
var $type = 'copy';
|
||||
|
||||
function _DiffOp_Copy ($orig, $closing = false) {
|
||||
function _DiffOp_Copy($orig, $closing = false) {
|
||||
if (!is_array($closing))
|
||||
$closing = $orig;
|
||||
$this->orig = $orig;
|
||||
|
@ -45,7 +45,7 @@ class _DiffOp_Copy extends _DiffOp {
|
|||
class _DiffOp_Delete extends _DiffOp {
|
||||
var $type = 'delete';
|
||||
|
||||
function _DiffOp_Delete ($lines) {
|
||||
function _DiffOp_Delete($lines) {
|
||||
$this->orig = $lines;
|
||||
$this->closing = false;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class _DiffOp_Delete extends _DiffOp {
|
|||
class _DiffOp_Add extends _DiffOp {
|
||||
var $type = 'add';
|
||||
|
||||
function _DiffOp_Add ($lines) {
|
||||
function _DiffOp_Add($lines) {
|
||||
$this->closing = $lines;
|
||||
$this->orig = false;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class _DiffOp_Add extends _DiffOp {
|
|||
class _DiffOp_Change extends _DiffOp {
|
||||
var $type = 'change';
|
||||
|
||||
function _DiffOp_Change ($orig, $closing) {
|
||||
function _DiffOp_Change($orig, $closing) {
|
||||
$this->orig = $orig;
|
||||
$this->closing = $closing;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class _DiffOp_Change extends _DiffOp {
|
|||
*/
|
||||
class _DiffEngine {
|
||||
|
||||
function diff ($from_lines, $to_lines) {
|
||||
function diff($from_lines, $to_lines) {
|
||||
$n_from = count($from_lines);
|
||||
$n_to = count($to_lines);
|
||||
|
||||
|
@ -135,7 +135,7 @@ class _DiffEngine {
|
|||
$xhash[$from_lines[$xi]] = 1;
|
||||
for ($yi = $skip; $yi < $n_to - $endskip; $yi++) {
|
||||
$line = $to_lines[$yi];
|
||||
if ( ($this->ychanged[$yi] = empty($xhash[$line])) )
|
||||
if (($this->ychanged[$yi] = empty($xhash[$line])))
|
||||
continue;
|
||||
$yhash[$line] = 1;
|
||||
$this->yv[] = $line;
|
||||
|
@ -143,7 +143,7 @@ class _DiffEngine {
|
|||
}
|
||||
for ($xi = $skip; $xi < $n_from - $endskip; $xi++) {
|
||||
$line = $from_lines[$xi];
|
||||
if ( ($this->xchanged[$xi] = empty($yhash[$line])) )
|
||||
if (($this->xchanged[$xi] = empty($yhash[$line])))
|
||||
continue;
|
||||
$this->xv[] = $line;
|
||||
$this->xind[] = $xi;
|
||||
|
@ -165,8 +165,7 @@ class _DiffEngine {
|
|||
|
||||
// Skip matching "snake".
|
||||
$copy = array();
|
||||
while ( $xi < $n_from && $yi < $n_to
|
||||
&& !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
|
||||
while ($xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi]) {
|
||||
$copy[] = $from_lines[$xi++];
|
||||
++$yi;
|
||||
}
|
||||
|
@ -210,15 +209,14 @@ class _DiffEngine {
|
|||
* match. The caller must trim matching lines from the beginning and end
|
||||
* of the portions it is going to specify.
|
||||
*/
|
||||
function _diag ($xoff, $xlim, $yoff, $ylim, $nchunks) {
|
||||
function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) {
|
||||
$flip = false;
|
||||
|
||||
if ($xlim - $xoff > $ylim - $yoff) {
|
||||
// Things seems faster (I'm not sure I understand why)
|
||||
// when the shortest sequence in X.
|
||||
$flip = true;
|
||||
list ($xoff, $xlim, $yoff, $ylim)
|
||||
= array( $yoff, $ylim, $xoff, $xlim);
|
||||
list ($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim);
|
||||
}
|
||||
|
||||
if ($flip)
|
||||
|
@ -284,7 +282,7 @@ class _DiffEngine {
|
|||
return array($this->lcs, $seps);
|
||||
}
|
||||
|
||||
function _lcs_pos ($ypos) {
|
||||
function _lcs_pos($ypos) {
|
||||
$end = $this->lcs;
|
||||
if ($end == 0 || $ypos > $this->seq[$end]) {
|
||||
$this->seq[++$this->lcs] = $ypos;
|
||||
|
@ -295,7 +293,7 @@ class _DiffEngine {
|
|||
$beg = 1;
|
||||
while ($beg < $end) {
|
||||
$mid = (int)(($beg + $end) / 2);
|
||||
if ( $ypos > $this->seq[$mid] )
|
||||
if ($ypos > $this->seq[$mid])
|
||||
$beg = $mid + 1;
|
||||
else
|
||||
$end = $mid;
|
||||
|
@ -321,17 +319,15 @@ class _DiffEngine {
|
|||
* Note that XLIM, YLIM are exclusive bounds.
|
||||
* All line numbers are origin-0 and discarded lines are not counted.
|
||||
*/
|
||||
function _compareseq ($xoff, $xlim, $yoff, $ylim) {
|
||||
function _compareseq($xoff, $xlim, $yoff, $ylim) {
|
||||
// Slide down the bottom initial diagonal.
|
||||
while ($xoff < $xlim && $yoff < $ylim
|
||||
&& $this->xv[$xoff] == $this->yv[$yoff]) {
|
||||
while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff]) {
|
||||
++$xoff;
|
||||
++$yoff;
|
||||
}
|
||||
|
||||
// Slide up the top initial diagonal.
|
||||
while ($xlim > $xoff && $ylim > $yoff
|
||||
&& $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
|
||||
while ($xlim > $xoff && $ylim > $yoff && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) {
|
||||
--$xlim;
|
||||
--$ylim;
|
||||
}
|
||||
|
@ -379,7 +375,7 @@ class _DiffEngine {
|
|||
*
|
||||
* This is extracted verbatim from analyze.c (GNU diffutils-2.7).
|
||||
*/
|
||||
function _shift_boundaries ($lines, &$changed, $other_changed) {
|
||||
function _shift_boundaries($lines, &$changed, $other_changed) {
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
|
||||
|
@ -519,7 +515,7 @@ class Diff {
|
|||
* @return object A Diff object representing the inverse of the
|
||||
* original diff.
|
||||
*/
|
||||
function reverse () {
|
||||
function reverse() {
|
||||
$rev = $this;
|
||||
$rev->edits = array();
|
||||
foreach ($this->edits as $edit) {
|
||||
|
@ -533,7 +529,7 @@ class Diff {
|
|||
*
|
||||
* @return bool True iff two sequences were identical.
|
||||
*/
|
||||
function isEmpty () {
|
||||
function isEmpty() {
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->type != 'copy')
|
||||
return false;
|
||||
|
@ -548,7 +544,7 @@ class Diff {
|
|||
*
|
||||
* @return int The length of the LCS.
|
||||
*/
|
||||
function lcs () {
|
||||
function lcs() {
|
||||
$lcs = 0;
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->type == 'copy')
|
||||
|
@ -598,7 +594,7 @@ class Diff {
|
|||
*
|
||||
* This is here only for debugging purposes.
|
||||
*/
|
||||
function _check ($from_lines, $to_lines) {
|
||||
function _check($from_lines, $to_lines) {
|
||||
if (serialize($from_lines) != serialize($this->orig()))
|
||||
trigger_error("Reconstructed original doesn't match", E_USER_ERROR);
|
||||
if (serialize($to_lines) != serialize($this->closing()))
|
||||
|
@ -612,7 +608,7 @@ class Diff {
|
|||
|
||||
$prevtype = 'none';
|
||||
foreach ($this->edits as $edit) {
|
||||
if ( $prevtype == $edit->type )
|
||||
if ($prevtype == $edit->type)
|
||||
trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
|
||||
$prevtype = $edit->type;
|
||||
}
|
||||
|
@ -649,8 +645,7 @@ class MappedDiff extends Diff {
|
|||
* @param $mapped_to_lines array This array should
|
||||
* have the same number of elements as $to_lines.
|
||||
*/
|
||||
function MappedDiff($from_lines, $to_lines,
|
||||
$mapped_from_lines, $mapped_to_lines) {
|
||||
function MappedDiff($from_lines, $to_lines, $mapped_from_lines, $mapped_to_lines) {
|
||||
|
||||
assert(count($from_lines) == count($mapped_from_lines));
|
||||
assert(count($to_lines) == count($mapped_to_lines));
|
||||
|
@ -727,9 +722,7 @@ class DiffFormatter {
|
|||
$context = array_slice($edit->orig, 0, $ntrail);
|
||||
$block[] = new _DiffOp_Copy($context);
|
||||
}
|
||||
$this->_block($x0, $ntrail + $xi - $x0,
|
||||
$y0, $ntrail + $yi - $y0,
|
||||
$block);
|
||||
$this->_block($x0, $ntrail + $xi - $x0, $y0, $ntrail + $yi - $y0, $block);
|
||||
$block = false;
|
||||
}
|
||||
}
|
||||
|
@ -754,9 +747,7 @@ class DiffFormatter {
|
|||
}
|
||||
|
||||
if (is_array($block))
|
||||
$this->_block($x0, $xi - $x0,
|
||||
$y0, $yi - $y0,
|
||||
$block);
|
||||
$this->_block($x0, $xi - $x0, $y0, $yi - $y0, $block);
|
||||
|
||||
return $this->_end_diff();
|
||||
}
|
||||
|
@ -836,17 +827,21 @@ class DiffFormatter {
|
|||
define('NBSP', "\xC2\xA0"); // utf-8 non-breaking space.
|
||||
|
||||
class _HWLDF_WordAccumulator {
|
||||
function _HWLDF_WordAccumulator () {
|
||||
function _HWLDF_WordAccumulator() {
|
||||
$this->_lines = array();
|
||||
$this->_line = '';
|
||||
$this->_group = '';
|
||||
$this->_tag = '';
|
||||
}
|
||||
|
||||
function _flushGroup ($new_tag) {
|
||||
function _flushGroup($new_tag) {
|
||||
if ($this->_group !== '') {
|
||||
if ($this->_tag == 'mark')
|
||||
$this->_line .= '<strong>'.$this->_group.'</strong>';
|
||||
elseif ($this->_tag == 'add')
|
||||
$this->_line .= '<span class="diff-addedline">'.$this->_group.'</span>';
|
||||
elseif ($this->_tag == 'del')
|
||||
$this->_line .= '<span class="diff-deletedline"><del>'.$this->_group.'</del></span>';
|
||||
else
|
||||
$this->_line .= $this->_group;
|
||||
}
|
||||
|
@ -854,14 +849,14 @@ class _HWLDF_WordAccumulator {
|
|||
$this->_tag = $new_tag;
|
||||
}
|
||||
|
||||
function _flushLine ($new_tag) {
|
||||
function _flushLine($new_tag) {
|
||||
$this->_flushGroup($new_tag);
|
||||
if ($this->_line != '')
|
||||
$this->_lines[] = $this->_line;
|
||||
$this->_line = '';
|
||||
}
|
||||
|
||||
function addWords ($words, $tag = '') {
|
||||
function addWords($words, $tag = '') {
|
||||
if ($tag != $this->_tag)
|
||||
$this->_flushGroup($tag);
|
||||
|
||||
|
@ -887,46 +882,80 @@ class _HWLDF_WordAccumulator {
|
|||
|
||||
class WordLevelDiff extends MappedDiff {
|
||||
|
||||
function WordLevelDiff ($orig_lines, $closing_lines) {
|
||||
function WordLevelDiff($orig_lines, $closing_lines) {
|
||||
list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
|
||||
list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
|
||||
|
||||
$this->MappedDiff($orig_words, $closing_words,
|
||||
$orig_stripped, $closing_stripped);
|
||||
$this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped);
|
||||
}
|
||||
|
||||
function _split($lines) {
|
||||
if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
|
||||
implode("\n", $lines),
|
||||
$m)) {
|
||||
if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xsu',
|
||||
implode("\n", $lines), $m)) {
|
||||
return array(array(''), array(''));
|
||||
}
|
||||
return array($m[0], $m[1]);
|
||||
}
|
||||
}
|
||||
return array($m[0], $m[1]);
|
||||
}
|
||||
|
||||
function orig () {
|
||||
$orig = new _HWLDF_WordAccumulator;
|
||||
function orig() {
|
||||
$orig = new _HWLDF_WordAccumulator;
|
||||
|
||||
foreach ($this->edits as $edit) {
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->type == 'copy')
|
||||
$orig->addWords($edit->orig);
|
||||
$orig->addWords($edit->orig);
|
||||
elseif ($edit->orig)
|
||||
$orig->addWords($edit->orig, 'mark');
|
||||
}
|
||||
return $orig->getLines();
|
||||
}
|
||||
$orig->addWords($edit->orig, 'mark');
|
||||
}
|
||||
return $orig->getLines();
|
||||
}
|
||||
|
||||
function closing () {
|
||||
$closing = new _HWLDF_WordAccumulator;
|
||||
function closing() {
|
||||
$closing = new _HWLDF_WordAccumulator;
|
||||
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->type == 'copy')
|
||||
$closing->addWords($edit->closing);
|
||||
elseif ($edit->closing)
|
||||
$closing->addWords($edit->closing, 'mark');
|
||||
}
|
||||
return $closing->getLines();
|
||||
}
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->type == 'copy')
|
||||
$closing->addWords($edit->closing);
|
||||
elseif ($edit->closing)
|
||||
$closing->addWords($edit->closing, 'mark');
|
||||
}
|
||||
return $closing->getLines();
|
||||
}
|
||||
}
|
||||
|
||||
class InlineWordLevelDiff extends MappedDiff {
|
||||
|
||||
function InlineWordLevelDiff($orig_lines, $closing_lines) {
|
||||
list ($orig_words, $orig_stripped) = $this->_split($orig_lines);
|
||||
list ($closing_words, $closing_stripped) = $this->_split($closing_lines);
|
||||
|
||||
$this->MappedDiff($orig_words, $closing_words, $orig_stripped, $closing_stripped);
|
||||
}
|
||||
|
||||
function _split($lines) {
|
||||
if (!preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xsu',
|
||||
implode("\n", $lines), $m)) {
|
||||
return array(array(''), array(''));
|
||||
}
|
||||
return array($m[0], $m[1]);
|
||||
}
|
||||
|
||||
function inline() {
|
||||
$orig = new _HWLDF_WordAccumulator;
|
||||
foreach ($this->edits as $edit) {
|
||||
if ($edit->type == 'copy')
|
||||
$orig->addWords($edit->closing);
|
||||
elseif ($edit->type == 'change'){
|
||||
$orig->addWords($edit->orig, 'del');
|
||||
$orig->addWords($edit->closing, 'add');
|
||||
} elseif ($edit->type == 'delete')
|
||||
$orig->addWords($edit->orig, 'del');
|
||||
elseif ($edit->type == 'add')
|
||||
$orig->addWords($edit->closing, 'add');
|
||||
elseif ($edit->orig)
|
||||
$orig->addWords($edit->orig, 'del');
|
||||
}
|
||||
return $orig->getLines();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -986,78 +1015,148 @@ class TableDiffFormatter extends DiffFormatter {
|
|||
return $text;
|
||||
}
|
||||
|
||||
function _block_header( $xbeg, $xlen, $ybeg, $ylen ) {
|
||||
function _block_header($xbeg, $xlen, $ybeg, $ylen) {
|
||||
global $lang;
|
||||
$l1 = $lang['line'].' '.$xbeg;
|
||||
$l2 = $lang['line'].' '.$ybeg;
|
||||
$r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n" .
|
||||
'<td class="diff-blockheader" colspan="2">'.$l2.":</td></tr>\n";
|
||||
$r = '<tr><td class="diff-blockheader" colspan="2">'.$l1.":</td>\n".
|
||||
' <td class="diff-blockheader" colspan="2">'.$l2.":</td>\n".
|
||||
"</tr>\n";
|
||||
return $r;
|
||||
}
|
||||
|
||||
function _start_block( $header ) {
|
||||
print( $header );
|
||||
function _start_block($header) {
|
||||
print($header);
|
||||
}
|
||||
|
||||
function _end_block() {
|
||||
}
|
||||
|
||||
function _lines( $lines, $prefix=' ', $color="white" ) {
|
||||
function _lines($lines, $prefix=' ', $color="white") {
|
||||
}
|
||||
|
||||
function addedLine( $line ) {
|
||||
return '<td>+</td><td class="diff-addedline">' .
|
||||
$line.'</td>';
|
||||
|
||||
function addedLine($line) {
|
||||
return '<td>+</td><td class="diff-addedline">' . $line.'</td>';
|
||||
}
|
||||
|
||||
function deletedLine( $line ) {
|
||||
return '<td>-</td><td class="diff-deletedline">' .
|
||||
$line.'</td>';
|
||||
function deletedLine($line) {
|
||||
return '<td>-</td><td class="diff-deletedline">' . $line.'</td>';
|
||||
}
|
||||
|
||||
function emptyLine() {
|
||||
return '<td colspan="2"> </td>';
|
||||
}
|
||||
|
||||
function contextLine( $line ) {
|
||||
function contextLine($line) {
|
||||
return '<td> </td><td class="diff-context">'.$line.'</td>';
|
||||
}
|
||||
|
||||
function _added($lines) {
|
||||
foreach ($lines as $line) {
|
||||
print( '<tr>' . $this->emptyLine() .
|
||||
$this->addedLine( $line ) . "</tr>\n" );
|
||||
print('<tr>' . $this->emptyLine() . $this->addedLine($line) . "</tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
function _deleted($lines) {
|
||||
foreach ($lines as $line) {
|
||||
print( '<tr>' . $this->deletedLine( $line ) .
|
||||
$this->emptyLine() . "</tr>\n" );
|
||||
print('<tr>' . $this->deletedLine($line) . $this->emptyLine() . "</tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
function _context( $lines ) {
|
||||
function _context($lines) {
|
||||
foreach ($lines as $line) {
|
||||
print( '<tr>' . $this->contextLine( $line ) .
|
||||
$this->contextLine( $line ) . "</tr>\n" );
|
||||
print('<tr>' . $this->contextLine($line) . $this->contextLine($line) . "</tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
function _changed( $orig, $closing ) {
|
||||
$diff = new WordLevelDiff( $orig, $closing );
|
||||
function _changed($orig, $closing) {
|
||||
$diff = new WordLevelDiff($orig, $closing);
|
||||
$del = $diff->orig();
|
||||
$add = $diff->closing();
|
||||
|
||||
while ( $line = array_shift( $del ) ) {
|
||||
$aline = array_shift( $add );
|
||||
print( '<tr>' . $this->deletedLine( $line ) .
|
||||
$this->addedLine( $aline ) . "</tr>\n" );
|
||||
while ($line = array_shift($del)) {
|
||||
$aline = array_shift($add);
|
||||
print('<tr>' . $this->deletedLine($line) . $this->addedLine($aline) . "</tr>\n");
|
||||
}
|
||||
$this->_added( $add ); # If any leftovers
|
||||
$this->_added($add); # If any leftovers
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline style diff formatter.
|
||||
*
|
||||
*/
|
||||
class InlineDiffFormatter extends DiffFormatter {
|
||||
var $colspan = 4;
|
||||
|
||||
function InlineDiffFormatter() {
|
||||
$this->leading_context_lines = 2;
|
||||
$this->trailing_context_lines = 2;
|
||||
}
|
||||
|
||||
function format($diff) {
|
||||
// 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);
|
||||
return $val;
|
||||
}
|
||||
|
||||
function _pre($text){
|
||||
$text = htmlspecialchars($text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
function _block_header($xbeg, $xlen, $ybeg, $ylen) {
|
||||
global $lang;
|
||||
if ($xlen != 1)
|
||||
$xbeg .= "," . $xlen;
|
||||
if ($ylen != 1)
|
||||
$ybeg .= "," . $ylen;
|
||||
$r = '<tr><td colspan="'.$this->colspan.'" class="diff-blockheader">@@ '.$lang['line']." -$xbeg +$ybeg @@";
|
||||
$r .= ' <span class="diff-deletedline"><del>'.$lang['deleted'].'</del></span>';
|
||||
$r .= ' <span class="diff-addedline">'.$lang['created'].'</span>';
|
||||
$r .= "</td></tr>\n";
|
||||
return $r;
|
||||
}
|
||||
|
||||
function _start_block($header) {
|
||||
print($header."\n");
|
||||
}
|
||||
|
||||
function _end_block() {
|
||||
}
|
||||
|
||||
function _lines($lines, $prefix=' ', $color="white") {
|
||||
}
|
||||
|
||||
function _added($lines) {
|
||||
foreach ($lines as $line) {
|
||||
print('<tr><td colspan="'.$this->colspan.'" class="diff-addedline">'. $line . "</td></tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
function _deleted($lines) {
|
||||
foreach ($lines as $line) {
|
||||
print('<tr><td colspan="'.$this->colspan.'" class="diff-deletedline"><del>' . $line . "</del></td></tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
function _context($lines) {
|
||||
foreach ($lines as $line) {
|
||||
print('<tr><td colspan="'.$this->colspan.'" class="diff-context">'.$line."</td></tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
function _changed($orig, $closing) {
|
||||
$diff = new InlineWordLevelDiff($orig, $closing);
|
||||
$add = $diff->inline();
|
||||
|
||||
foreach ($add as $line)
|
||||
print('<tr><td colspan="'.$this->colspan.'">'.$line."</td></tr>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -5,21 +5,38 @@
|
|||
* @author Dave Child <dave@addedbytes.com>
|
||||
* @link http://code.google.com/p/php-email-address-validation/
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @version SVN r10 + Issue 15 fix + Issue 12 fix
|
||||
*/
|
||||
class EmailAddressValidator {
|
||||
/**
|
||||
* Set true to allow addresses like me@localhost
|
||||
*/
|
||||
public $allowLocalAddresses = false;
|
||||
|
||||
/**
|
||||
* Check email address validity
|
||||
* @param strEmailAddress Email address to be checked
|
||||
* @return True if email is valid, false if not
|
||||
*/
|
||||
function check_email_address($strEmailAddress) {
|
||||
public function check_email_address($strEmailAddress) {
|
||||
|
||||
// If magic quotes is "on", email addresses with quote marks will
|
||||
// fail validation because of added escape characters. Uncommenting
|
||||
// the next three lines will allow for this issue.
|
||||
//if (get_magic_quotes_gpc()) {
|
||||
// $strEmailAddress = stripslashes($strEmailAddress);
|
||||
//}
|
||||
|
||||
// Control characters are not allowed
|
||||
if (preg_match('/[\x00-\x1F\x7F-\xFF]/', $strEmailAddress)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check email length - min 3 (a@a), max 256
|
||||
if (!$this->check_text_length($strEmailAddress, 3, 256)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Split it into sections using last instance of "@"
|
||||
$intAtSymbol = strrpos($strEmailAddress, '@');
|
||||
if ($intAtSymbol === false) {
|
||||
|
@ -31,10 +48,15 @@ class EmailAddressValidator {
|
|||
|
||||
// Count the "@" symbols. Only one is allowed, except where
|
||||
// contained in quote marks in the local part. Quickest way to
|
||||
// check this is to remove anything in quotes.
|
||||
$arrTempAddress[0] = preg_replace('/"[^"]+"/'
|
||||
// check this is to remove anything in quotes. We also remove
|
||||
// characters escaped with backslash, and the backslash
|
||||
// character.
|
||||
$arrTempAddress[0] = preg_replace('/\./'
|
||||
,''
|
||||
,$arrEmailAddress[0]);
|
||||
$arrTempAddress[0] = preg_replace('/"[^"]+"/'
|
||||
,''
|
||||
,$arrTempAddress[0]);
|
||||
$arrTempAddress[1] = $arrEmailAddress[1];
|
||||
$strTempAddress = $arrTempAddress[0] . $arrTempAddress[1];
|
||||
// Then check - should be no "@" symbols.
|
||||
|
@ -63,7 +85,7 @@ class EmailAddressValidator {
|
|||
* @param strLocalPortion Text to be checked
|
||||
* @return True if local portion is valid, false if not
|
||||
*/
|
||||
function check_local_portion($strLocalPortion) {
|
||||
protected function check_local_portion($strLocalPortion) {
|
||||
// Local portion can only be from 1 to 64 characters, inclusive.
|
||||
// Please note that servers are encouraged to accept longer local
|
||||
// parts than 64 characters.
|
||||
|
@ -94,22 +116,39 @@ class EmailAddressValidator {
|
|||
* @param strDomainPortion Text to be checked
|
||||
* @return True if domain portion is valid, false if not
|
||||
*/
|
||||
function check_domain_portion($strDomainPortion) {
|
||||
protected function check_domain_portion($strDomainPortion) {
|
||||
// Total domain can only be from 1 to 255 characters, inclusive
|
||||
if (!$this->check_text_length($strDomainPortion, 1, 255)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// some IPv4/v6 regexps borrowed from Feyd
|
||||
// see: http://forums.devnetwork.net/viewtopic.php?f=38&t=53479
|
||||
$dec_octet = '(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|[0-9])';
|
||||
$hex_digit = '[A-Fa-f0-9]';
|
||||
$h16 = "{$hex_digit}{1,4}";
|
||||
$IPv4Address = "$dec_octet\\.$dec_octet\\.$dec_octet\\.$dec_octet";
|
||||
$ls32 = "(?:$h16:$h16|$IPv4Address)";
|
||||
$IPv6Address =
|
||||
"(?:(?:{$IPv4Address})|(?:".
|
||||
"(?:$h16:){6}$ls32" .
|
||||
"|::(?:$h16:){5}$ls32" .
|
||||
"|(?:$h16)?::(?:$h16:){4}$ls32" .
|
||||
"|(?:(?:$h16:){0,1}$h16)?::(?:$h16:){3}$ls32" .
|
||||
"|(?:(?:$h16:){0,2}$h16)?::(?:$h16:){2}$ls32" .
|
||||
"|(?:(?:$h16:){0,3}$h16)?::(?:$h16:){1}$ls32" .
|
||||
"|(?:(?:$h16:){0,4}$h16)?::$ls32" .
|
||||
"|(?:(?:$h16:){0,5}$h16)?::$h16" .
|
||||
"|(?:(?:$h16:){0,6}$h16)?::" .
|
||||
")(?:\\/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))?)";
|
||||
|
||||
// Check if domain is IP, possibly enclosed in square brackets.
|
||||
if (preg_match('/^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])'
|
||||
.'(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}$/'
|
||||
,$strDomainPortion) ||
|
||||
preg_match('/^\[(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])'
|
||||
.'(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}\]$/'
|
||||
,$strDomainPortion)) {
|
||||
if (preg_match("/^($IPv4Address|\[$IPv4Address\]|\[$IPv6Address\])$/",
|
||||
$strDomainPortion)){
|
||||
return true;
|
||||
} else {
|
||||
$arrDomainPortion = explode('.', $strDomainPortion);
|
||||
if (sizeof($arrDomainPortion) < 2) {
|
||||
if (!$this->allowLocalAddresses && sizeof($arrDomainPortion) < 2) {
|
||||
return false; // Not enough parts to domain
|
||||
}
|
||||
for ($i = 0, $max = sizeof($arrDomainPortion); $i < $max; $i++) {
|
||||
|
@ -121,6 +160,11 @@ class EmailAddressValidator {
|
|||
.'([A-Za-z0-9]+))$/', $arrDomainPortion[$i])) {
|
||||
return false;
|
||||
}
|
||||
if ($i == $max - 1) { // TLD cannot be only numbers
|
||||
if (strlen(preg_replace('/[0-9]/', '', $arrDomainPortion[$i])) <= 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -133,7 +177,7 @@ class EmailAddressValidator {
|
|||
* @param intMaximum Maximum acceptable length
|
||||
* @return True if string is within bounds (inclusive), false if not
|
||||
*/
|
||||
function check_text_length($strText, $intMinimum, $intMaximum) {
|
||||
protected function check_text_length($strText, $intMinimum, $intMaximum) {
|
||||
// Minimum and maximum are both inclusive
|
||||
$intTextLength = strlen($strText);
|
||||
if (($intTextLength < $intMinimum) || ($intTextLength > $intMaximum)) {
|
||||
|
@ -142,5 +186,6 @@ class EmailAddressValidator {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class FeedParser_File extends SimplePie_File {
|
|||
*/
|
||||
function FeedParser_File($url, $timeout=10, $redirects=5,
|
||||
$headers=null, $useragent=null, $force_fsockopen=false) {
|
||||
parent::__construct();
|
||||
$this->http = new DokuHTTPClient();
|
||||
$this->success = $this->http->sendRequest($url);
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ class DokuHTTPClient extends HTTPClient {
|
|||
* @link http://www.splitbrain.org/go/videodb
|
||||
* @author Andreas Goetz <cpuidle@gmx.de>
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @author Tobias Sarnowski <sarnowski@new-thoughts.org>
|
||||
*/
|
||||
class HTTPClient {
|
||||
//set these if you like
|
||||
|
@ -86,13 +87,14 @@ class HTTPClient {
|
|||
var $headers;
|
||||
var $debug;
|
||||
var $start = 0; // for timings
|
||||
var $keep_alive = true; // keep alive rocks
|
||||
|
||||
// don't set these, read on error
|
||||
var $error;
|
||||
var $redirect_count;
|
||||
|
||||
// read these after a successful request
|
||||
var $resp_status;
|
||||
var $status;
|
||||
var $resp_body;
|
||||
var $resp_headers;
|
||||
|
||||
|
@ -108,6 +110,9 @@ class HTTPClient {
|
|||
var $proxy_ssl; //boolean set to true if your proxy needs SSL
|
||||
var $proxy_except; // regexp of URLs to exclude from proxy
|
||||
|
||||
// list of kept alive connections
|
||||
static $connections = array();
|
||||
|
||||
// what we use as boundary on multipart/form-data posts
|
||||
var $boundary = '---DokuWikiHTTPClient--4523452351';
|
||||
|
||||
|
@ -222,7 +227,7 @@ class HTTPClient {
|
|||
$path = $uri['path'];
|
||||
if(empty($path)) $path = '/';
|
||||
if(!empty($uri['query'])) $path .= '?'.$uri['query'];
|
||||
$port = $uri['port'];
|
||||
if(isset($uri['port']) && !empty($uri['port'])) $port = $uri['port'];
|
||||
if(isset($uri['user'])) $this->user = $uri['user'];
|
||||
if(isset($uri['pass'])) $this->pass = $uri['pass'];
|
||||
|
||||
|
@ -235,7 +240,7 @@ class HTTPClient {
|
|||
}else{
|
||||
$request_url = $path;
|
||||
$server = $server;
|
||||
if (empty($port)) $port = ($uri['scheme'] == 'https') ? 443 : 80;
|
||||
if (!isset($port)) $port = ($uri['scheme'] == 'https') ? 443 : 80;
|
||||
}
|
||||
|
||||
// add SSL stream prefix if needed - needs SSL support in PHP
|
||||
|
@ -247,7 +252,11 @@ class HTTPClient {
|
|||
if($uri['port']) $headers['Host'].= ':'.$uri['port'];
|
||||
$headers['User-Agent'] = $this->agent;
|
||||
$headers['Referer'] = $this->referer;
|
||||
$headers['Connection'] = 'Close';
|
||||
if ($this->keep_alive) {
|
||||
$headers['Connection'] = 'Keep-Alive';
|
||||
} else {
|
||||
$headers['Connection'] = 'Close';
|
||||
}
|
||||
if($method == 'POST'){
|
||||
if(is_array($data)){
|
||||
if($headers['Content-Type'] == 'multipart/form-data'){
|
||||
|
@ -273,15 +282,34 @@ class HTTPClient {
|
|||
// stop time
|
||||
$start = time();
|
||||
|
||||
// open socket
|
||||
$socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout);
|
||||
if (!$socket){
|
||||
$this->status = -100;
|
||||
$this->error = "Could not connect to $server:$port\n$errstr ($errno)";
|
||||
return false;
|
||||
// already connected?
|
||||
$connectionId = $this->_uniqueConnectionId($server,$port);
|
||||
$this->_debug('connection pool', $this->connections);
|
||||
$socket = null;
|
||||
if (isset($this->connections[$connectionId])) {
|
||||
$this->_debug('reusing connection', $connectionId);
|
||||
$socket = $this->connections[$connectionId];
|
||||
}
|
||||
//set non blocking
|
||||
stream_set_blocking($socket,0);
|
||||
if (is_null($socket) || feof($socket)) {
|
||||
$this->_debug('opening connection', $connectionId);
|
||||
// open socket
|
||||
$socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout);
|
||||
if (!$socket){
|
||||
$this->status = -100;
|
||||
$this->error = "Could not connect to $server:$port\n$errstr ($errno)";
|
||||
return false;
|
||||
}
|
||||
|
||||
// keep alive?
|
||||
if ($this->keep_alive) {
|
||||
$this->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;
|
||||
|
@ -292,29 +320,52 @@ class HTTPClient {
|
|||
|
||||
$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){
|
||||
$ret = fwrite($socket, substr($request,$written));
|
||||
// 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) 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;
|
||||
}
|
||||
$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;
|
||||
}
|
||||
$r_headers .= fgets($socket,1024);
|
||||
|
@ -327,6 +378,7 @@ class HTTPClient {
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
@ -334,6 +386,7 @@ class HTTPClient {
|
|||
// 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];
|
||||
|
@ -359,6 +412,11 @@ class HTTPClient {
|
|||
|
||||
// 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]);
|
||||
|
||||
if (empty($this->resp_headers['location'])){
|
||||
$this->error = 'Redirect but no Location Header found';
|
||||
return false;
|
||||
|
@ -386,6 +444,7 @@ class HTTPClient {
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
@ -397,11 +456,13 @@ class HTTPClient {
|
|||
do {
|
||||
if(feof($socket)){
|
||||
$this->error = 'Premature End of File (socket)';
|
||||
unset($this->connections[$connectionId]);
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
$byte = fread($socket,1);
|
||||
|
@ -418,10 +479,12 @@ class HTTPClient {
|
|||
|
||||
if($this->max_bodysize && strlen($r_body) > $this->max_bodysize){
|
||||
$this->error = 'Allowed response size exceeded';
|
||||
if ($this->max_bodysize_abort)
|
||||
if ($this->max_bodysize_abort){
|
||||
unset($this->connections[$connectionId]);
|
||||
return false;
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while ($chunk_size);
|
||||
}else{
|
||||
|
@ -430,16 +493,19 @@ class HTTPClient {
|
|||
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';
|
||||
if ($this->max_bodysize_abort)
|
||||
if ($this->max_bodysize_abort) {
|
||||
unset($this->connections[$connectionId]);
|
||||
return false;
|
||||
else
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isset($this->resp_headers['content-length']) &&
|
||||
!isset($this->resp_headers['transfer-encoding']) &&
|
||||
|
@ -450,9 +516,13 @@ class HTTPClient {
|
|||
}
|
||||
}
|
||||
|
||||
// close socket
|
||||
$status = socket_get_status($socket);
|
||||
fclose($socket);
|
||||
if (!$this->keep_alive ||
|
||||
(isset($this->resp_headers['connection']) && $this->resp_headers['connection'] == 'Close')) {
|
||||
// close socket
|
||||
$status = socket_get_status($socket);
|
||||
fclose($socket);
|
||||
unset($this->connections[$connectionId]);
|
||||
}
|
||||
|
||||
// decode gzip if needed
|
||||
if(isset($this->resp_headers['content-encoding']) &&
|
||||
|
@ -506,12 +576,13 @@ class HTTPClient {
|
|||
*/
|
||||
function _parseHeaders($string){
|
||||
$headers = array();
|
||||
$lines = explode("\n",$string);
|
||||
foreach($lines as $line){
|
||||
list($key,$val) = explode(':',$line,2);
|
||||
$key = strtolower(trim($key));
|
||||
$val = trim($val);
|
||||
if(empty($val)) continue;
|
||||
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;
|
||||
$key = strtolower($key);
|
||||
if(isset($headers[$key])){
|
||||
if(is_array($headers[$key])){
|
||||
$headers[$key][] = $val;
|
||||
|
@ -598,6 +669,14 @@ class HTTPClient {
|
|||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a unique identifier for a connection.
|
||||
*
|
||||
* @return string unique identifier
|
||||
*/
|
||||
function _uniqueConnectionId($server, $port) {
|
||||
return "$server:$port";
|
||||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -395,13 +395,8 @@ EOD;
|
|||
$this->output($error->getXml());
|
||||
}
|
||||
function output($xml) {
|
||||
$xml = '<?xml version="1.0"?>'."\n".$xml;
|
||||
$length = strlen($xml);
|
||||
header('Connection: close');
|
||||
header('Content-Length: '.$length);
|
||||
header('Content-Type: text/xml');
|
||||
header('Date: '.date('r'));
|
||||
echo $xml;
|
||||
header('Content-Type: text/xml; charset=utf-8');
|
||||
echo '<?xml version="1.0"?>', "\n", $xml;
|
||||
exit;
|
||||
}
|
||||
function hasMethod($method) {
|
||||
|
|
17
inc/JSON.php
17
inc/JSON.php
|
@ -112,6 +112,16 @@ define('JSON_STRICT_TYPE', 11);
|
|||
* @deprecated
|
||||
*/
|
||||
class JSON {
|
||||
|
||||
/**
|
||||
* Disables the use of PHP5's native json_decode()
|
||||
*
|
||||
* You shouldn't change this usually because the native function is much
|
||||
* faster. However, this non-native will also parse slightly broken JSON
|
||||
* which might be handy when talking to a non-conform endpoint
|
||||
*/
|
||||
public $skipnative = false;
|
||||
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
|
@ -130,6 +140,7 @@ class JSON {
|
|||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
* If available the native PHP JSON implementation is used.
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to JSON() above for array-parsing behavior.
|
||||
|
@ -140,6 +151,7 @@ class JSON {
|
|||
* @access public
|
||||
*/
|
||||
function encode($var) {
|
||||
if (function_exists('json_encode')) return json_encode($var);
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
@ -352,6 +364,7 @@ class JSON {
|
|||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
* If available the native PHP JSON implementation is used.
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
|
@ -363,6 +376,10 @@ class JSON {
|
|||
* @access public
|
||||
*/
|
||||
function decode($str) {
|
||||
if (!$this->skipnative && function_exists('json_decode')){
|
||||
return json_decode($str,($this->use == JSON_LOOSE_TYPE));
|
||||
}
|
||||
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
|
|
|
@ -1466,16 +1466,21 @@ class JpegMeta {
|
|||
$parser = xml_parser_create();
|
||||
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
|
||||
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
|
||||
xml_parse_into_struct($parser, $data, $values, $tags);
|
||||
$result = xml_parse_into_struct($parser, $data, $values, $tags);
|
||||
xml_parser_free($parser);
|
||||
|
||||
if ($result == 0) {
|
||||
$this->_info['xmp'] = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_info['xmp'] = array();
|
||||
$count = count($values);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if ($values[$i]['tag'] == 'rdf:Description' && $values[$i]['type'] == 'open') {
|
||||
|
||||
while ($values[++$i]['tag'] != 'rdf:Description') {
|
||||
$this->_parseXmpNode($values, $i, $this->_info['xmp'][$values[$i]['tag']]);
|
||||
while ((++$i < $count) && ($values[$i]['tag'] != 'rdf:Description')) {
|
||||
$this->_parseXmpNode($values, $i, $this->_info['xmp'][$values[$i]['tag']], $count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1487,7 +1492,7 @@ class JpegMeta {
|
|||
*
|
||||
* @author Hakan Sandell <hakan.sandell@mydata.se>
|
||||
*/
|
||||
function _parseXmpNode($values, &$i, &$meta) {
|
||||
function _parseXmpNode($values, &$i, &$meta, $count) {
|
||||
if ($values[$i]['type'] == 'close') return;
|
||||
|
||||
if ($values[$i]['type'] == 'complete') {
|
||||
|
@ -1497,11 +1502,13 @@ class JpegMeta {
|
|||
}
|
||||
|
||||
$i++;
|
||||
if ($i >= $count) return;
|
||||
|
||||
if ($values[$i]['tag'] == 'rdf:Bag' || $values[$i]['tag'] == 'rdf:Seq') {
|
||||
// Array property
|
||||
$meta = array();
|
||||
while ($values[++$i]['tag'] == 'rdf:li') {
|
||||
$this->_parseXmpNode($values, $i, $meta[]);
|
||||
$this->_parseXmpNode($values, $i, $meta[], $count);
|
||||
}
|
||||
$i++; // skip closing Bag/Seq tag
|
||||
|
||||
|
@ -1509,8 +1516,8 @@ class JpegMeta {
|
|||
// Language Alternative property, only the first (default) value is used
|
||||
if ($values[$i]['type'] == 'open') {
|
||||
$i++;
|
||||
$this->_parseXmpNode($values, $i, $meta);
|
||||
while ($values[++$i]['tag'] != 'rdf:Alt');
|
||||
$this->_parseXmpNode($values, $i, $meta, $count);
|
||||
while ((++$i < $count) && ($values[$i]['tag'] != 'rdf:Alt'));
|
||||
$i++; // skip closing Alt tag
|
||||
}
|
||||
|
||||
|
@ -1519,8 +1526,8 @@ class JpegMeta {
|
|||
$meta = array();
|
||||
$startTag = $values[$i-1]['tag'];
|
||||
do {
|
||||
$this->_parseXmpNode($values, $i, $meta[$values[$i]['tag']]);
|
||||
} while ($values[++$i]['tag'] != $startTag);
|
||||
$this->_parseXmpNode($values, $i, $meta[$values[$i]['tag']], $count);
|
||||
} while ((++$i < $count) && ($values[$i]['tag'] != $startTag));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,379 @@
|
|||
<?php
|
||||
/**
|
||||
* Password Hashing Class
|
||||
*
|
||||
* This class implements various mechanisms used to hash passwords
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @license LGPL2
|
||||
*/
|
||||
class PassHash {
|
||||
/**
|
||||
* Verifies a cleartext password against a crypted hash
|
||||
*
|
||||
* The method and salt used for the crypted hash is determined automatically,
|
||||
* then the clear text password is crypted using the same method. If both hashs
|
||||
* match true is is returned else false
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @return bool
|
||||
*/
|
||||
function verify_hash($clear,$hash){
|
||||
$method='';
|
||||
$salt='';
|
||||
$magic='';
|
||||
|
||||
//determine the used method and salt
|
||||
$len = strlen($hash);
|
||||
if(preg_match('/^\$1\$([^\$]{0,8})\$/',$hash,$m)){
|
||||
$method = 'smd5';
|
||||
$salt = $m[1];
|
||||
$magic = '1';
|
||||
}elseif(preg_match('/^\$apr1\$([^\$]{0,8})\$/',$hash,$m)){
|
||||
$method = 'apr1';
|
||||
$salt = $m[1];
|
||||
$magic = 'apr1';
|
||||
}elseif(preg_match('/^\$P\$(.{31})$/',$hash,$m)){
|
||||
$method = 'pmd5';
|
||||
$salt = $m[1];
|
||||
$magic = 'P';
|
||||
}elseif(preg_match('/^\$H\$(.{31})$/',$hash,$m)){
|
||||
$method = 'pmd5';
|
||||
$salt = $m[1];
|
||||
$magic = 'H';
|
||||
}elseif(preg_match('/^sha1\$(.{5})\$/',$hash,$m)){
|
||||
$method = 'djangosha1';
|
||||
$salt = $m[1];
|
||||
}elseif(preg_match('/^md5\$(.{5})\$/',$hash,$m)){
|
||||
$method = 'djangomd5';
|
||||
$salt = $m[1];
|
||||
}elseif(substr($hash,0,6) == '{SSHA}'){
|
||||
$method = 'ssha';
|
||||
$salt = substr(base64_decode(substr($hash, 6)),20);
|
||||
}elseif($len == 32){
|
||||
$method = 'md5';
|
||||
}elseif($len == 40){
|
||||
$method = 'sha1';
|
||||
}elseif($len == 16){
|
||||
$method = 'mysql';
|
||||
}elseif($len == 41 && $hash[0] == '*'){
|
||||
$method = 'my411';
|
||||
}elseif($len == 34){
|
||||
$method = 'kmd5';
|
||||
$salt = $hash;
|
||||
}else{
|
||||
$method = 'crypt';
|
||||
$salt = substr($hash,0,2);
|
||||
}
|
||||
|
||||
//crypt and compare
|
||||
$call = 'hash_'.$method;
|
||||
if($this->$call($clear,$salt,$magic) === $hash){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a random salt
|
||||
*
|
||||
* @param int $len - The length of the salt
|
||||
*/
|
||||
public function gen_salt($len=32){
|
||||
$salt = '';
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
for($i=0;$i<$len,$i++;) $salt .= $chars[mt_rand(0,61)];
|
||||
return $salt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the passed variable with a salt if needed.
|
||||
*
|
||||
* If $salt is not null, the value is kept, but the lenght restriction is
|
||||
* applied.
|
||||
*
|
||||
* @param stringref $salt - The salt, pass null if you want one generated
|
||||
* @param int $len - The length of the salt
|
||||
*/
|
||||
public function init_salt(&$salt,$len=32){
|
||||
if(is_null($salt)) $salt = $this->gen_salt($len);
|
||||
if(strlen($salt) > $len) $salt = substr($salt,0,$len);
|
||||
}
|
||||
|
||||
// Password hashing methods follow below
|
||||
|
||||
/**
|
||||
* Password hashing method 'smd5'
|
||||
*
|
||||
* Uses salted MD5 hashs. Salt is 8 bytes long.
|
||||
*
|
||||
* The same mechanism is used by Apache's 'apr1' method. This will
|
||||
* fallback to a implementation in pure PHP if MD5 support is not
|
||||
* available in crypt()
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @author <mikey_nich at hotmail dot com>
|
||||
* @link http://de.php.net/manual/en/function.crypt.php#73619
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @param string $magic - the hash identifier (apr1 or 1)
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_smd5($clear, $salt=null){
|
||||
$this->init_salt($salt,8);
|
||||
|
||||
if(defined('CRYPT_MD5') && CRYPT_MD5){
|
||||
return crypt($clear,'$1$'.$salt.'$');
|
||||
}else{
|
||||
// Fall back to PHP-only implementation
|
||||
return $this->apr1($clear, $salt, '1');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'apr1'
|
||||
*
|
||||
* Uses salted MD5 hashs. Salt is 8 bytes long.
|
||||
*
|
||||
* This is basically the same as smd1 above, but as used by Apache.
|
||||
*
|
||||
* @author <mikey_nich at hotmail dot com>
|
||||
* @link http://de.php.net/manual/en/function.crypt.php#73619
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @param string $magic - the hash identifier (apr1 or 1)
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_apr1($clear, $salt=null, $magic='apr1'){
|
||||
$this->init_salt($salt,8);
|
||||
|
||||
$len = strlen($clear);
|
||||
$text = $clear.'$'.$magic.'$'.$salt;
|
||||
$bin = pack("H32", md5($clear.$salt.$clear));
|
||||
for($i = $len; $i > 0; $i -= 16) {
|
||||
$text .= substr($bin, 0, min(16, $i));
|
||||
}
|
||||
for($i = $len; $i > 0; $i >>= 1) {
|
||||
$text .= ($i & 1) ? chr(0) : $clear{0};
|
||||
}
|
||||
$bin = pack("H32", md5($text));
|
||||
for($i = 0; $i < 1000; $i++) {
|
||||
$new = ($i & 1) ? $clear : $bin;
|
||||
if ($i % 3) $new .= $salt;
|
||||
if ($i % 7) $new .= $clear;
|
||||
$new .= ($i & 1) ? $bin : $clear;
|
||||
$bin = pack("H32", md5($new));
|
||||
}
|
||||
$tmp = '';
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$k = $i + 6;
|
||||
$j = $i + 12;
|
||||
if ($j == 16) $j = 5;
|
||||
$tmp = $bin[$i].$bin[$k].$bin[$j].$tmp;
|
||||
}
|
||||
$tmp = chr(0).chr(0).$bin[11].$tmp;
|
||||
$tmp = strtr(strrev(substr(base64_encode($tmp), 2)),
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
||||
return '$'.$magic.'$'.$salt.'$'.$tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'md5'
|
||||
*
|
||||
* Uses MD5 hashs.
|
||||
*
|
||||
* @param string $clear - the clear text to hash
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_md5($clear){
|
||||
return md5($clear);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'sha1'
|
||||
*
|
||||
* Uses SHA1 hashs.
|
||||
*
|
||||
* @param string $clear - the clear text to hash
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_sha1($clear){
|
||||
return sha1($clear);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'ssha' as used by LDAP
|
||||
*
|
||||
* Uses salted SHA1 hashs. Salt is 4 bytes long.
|
||||
*
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_ssha($clear, $salt=null){
|
||||
$this->init_salt($salt,4);
|
||||
return '{SSHA}'.base64_encode(pack("H*", sha1($clear.$salt)).$salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'crypt'
|
||||
*
|
||||
* Uses salted crypt hashs. Salt is 2 bytes long.
|
||||
*
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_crypt($clear, $salt=null){
|
||||
$this->init_salt($salt,2);
|
||||
return crypt($clear,$salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'mysql'
|
||||
*
|
||||
* This method was used by old MySQL systems
|
||||
*
|
||||
* @link http://www.php.net/mysql
|
||||
* @author <soren at byu dot edu>
|
||||
* @param string $clear - the clear text to hash
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_mysql($clear){
|
||||
$nr=0x50305735;
|
||||
$nr2=0x12345671;
|
||||
$add=7;
|
||||
$charArr = preg_split("//", $clear);
|
||||
foreach ($charArr as $char) {
|
||||
if (($char == '') || ($char == ' ') || ($char == '\t')) continue;
|
||||
$charVal = ord($char);
|
||||
$nr ^= ((($nr & 63) + $add) * $charVal) + ($nr << 8);
|
||||
$nr2 += ($nr2 << 8) ^ $nr;
|
||||
$add += $charVal;
|
||||
}
|
||||
return sprintf("%08x%08x", ($nr & 0x7fffffff), ($nr2 & 0x7fffffff));
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'my411'
|
||||
*
|
||||
* Uses SHA1 hashs. This method is used by MySQL 4.11 and above
|
||||
*
|
||||
* @param string $clear - the clear text to hash
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_my411($clear){
|
||||
return '*'.sha1(pack("H*", sha1($clear)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'kmd5'
|
||||
*
|
||||
* Uses salted MD5 hashs.
|
||||
*
|
||||
* Salt is 2 bytes long, but stored at position 16, so you need to pass at
|
||||
* least 18 bytes. You can pass the crypted hash as salt.
|
||||
*
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_kmd5($clear, $salt=null){
|
||||
$this->init_salt($salt);
|
||||
|
||||
$key = substr($salt, 16, 2);
|
||||
$hash1 = strtolower(md5($key . md5($clear)));
|
||||
$hash2 = substr($hash1, 0, 16) . $key . substr($hash1, 16);
|
||||
return $hash2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'pmd5'
|
||||
*
|
||||
* Uses salted MD5 hashs. Salt is 1+8 bytes long, 1st byte is the
|
||||
* iteration count.
|
||||
*
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @param string $magic - the hash identifier (P or H)
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_pmd5($clear, $salt=null, $magic='P'){
|
||||
$this->init_salt($salt);
|
||||
|
||||
$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
||||
$iterc = $salt[0]; // pos 0 of salt is iteration count
|
||||
$iter = strpos($itoa64,$iterc);
|
||||
$iter = 1 << $iter;
|
||||
$salt = substr($salt,1,8);
|
||||
|
||||
// iterate
|
||||
$hash = md5($salt . $clear, true);
|
||||
do {
|
||||
$hash = md5($hash . $clear, true);
|
||||
} while (--$iter);
|
||||
|
||||
// encode
|
||||
$output = '';
|
||||
$count = 16;
|
||||
$i = 0;
|
||||
do {
|
||||
$value = ord($hash[$i++]);
|
||||
$output .= $itoa64[$value & 0x3f];
|
||||
if ($i < $count)
|
||||
$value |= ord($hash[$i]) << 8;
|
||||
$output .= $itoa64[($value >> 6) & 0x3f];
|
||||
if ($i++ >= $count)
|
||||
break;
|
||||
if ($i < $count)
|
||||
$value |= ord($hash[$i]) << 16;
|
||||
$output .= $itoa64[($value >> 12) & 0x3f];
|
||||
if ($i++ >= $count)
|
||||
break;
|
||||
$output .= $itoa64[($value >> 18) & 0x3f];
|
||||
} while ($i < $count);
|
||||
|
||||
return '$'.$magic.'$'.$iterc.$salt.$output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for hash_pmd5
|
||||
*/
|
||||
public function hash_hmd5($clear, $salt=null, $magic='H'){
|
||||
return $this->hash_pmd5($clear, $salt, $magic);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'djangosha1'
|
||||
*
|
||||
* Uses salted SHA1 hashs. Salt is 5 bytes long.
|
||||
* This is used by the Django Python framework
|
||||
*
|
||||
* @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_djangosha1($clear, $salt=null){
|
||||
$this->init_salt($salt,5);
|
||||
return 'sha1$'.$salt.'$'.sha1($salt.$clear);
|
||||
}
|
||||
|
||||
/**
|
||||
* Password hashing method 'djangomd5'
|
||||
*
|
||||
* Uses salted MD5 hashs. Salt is 5 bytes long.
|
||||
* This is used by the Django Python framework
|
||||
*
|
||||
* @link http://docs.djangoproject.com/en/dev/topics/auth/#passwords
|
||||
* @param string $clear - the clear text to hash
|
||||
* @param string $salt - the salt to use, null for random
|
||||
* @returns string - hashed password
|
||||
*/
|
||||
public function hash_djangomd5($clear, $salt=null){
|
||||
$this->init_salt($salt,5);
|
||||
return 'md5$'.$salt.'$'.md5($salt.$clear);
|
||||
}
|
||||
|
||||
}
|
|
@ -114,6 +114,7 @@ class SafeFN {
|
|||
$converted = true;
|
||||
}
|
||||
}
|
||||
if($converted) $safe .= self::$post_indicator;
|
||||
return $safe;
|
||||
}
|
||||
|
||||
|
|
10404
inc/SimplePie.php
10404
inc/SimplePie.php
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,203 @@
|
|||
<?php
|
||||
/**
|
||||
* Sitemap handling functions
|
||||
*
|
||||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
* @author Michael Hamann <michael@content-space.de>
|
||||
*/
|
||||
|
||||
if(!defined('DOKU_INC')) die('meh.');
|
||||
|
||||
/**
|
||||
* A class for building sitemaps and pinging search engines with the sitemap URL.
|
||||
*
|
||||
* @author Michael Hamann
|
||||
*/
|
||||
class Sitemapper {
|
||||
/**
|
||||
* Builds a Google Sitemap of all public pages known to the indexer
|
||||
*
|
||||
* The map is placed in the cache directory named sitemap.xml.gz - This
|
||||
* file needs to be writable!
|
||||
*
|
||||
* @author Michael Hamann
|
||||
* @author Andreas Gohr
|
||||
* @link https://www.google.com/webmasters/sitemaps/docs/en/about.html
|
||||
* @link http://www.sitemaps.org/
|
||||
*/
|
||||
public function generate(){
|
||||
global $conf;
|
||||
if($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) return false;
|
||||
|
||||
$sitemap = Sitemapper::getFilePath();
|
||||
|
||||
if(@file_exists($sitemap)){
|
||||
if(!is_writable($sitemap)) return false;
|
||||
}else{
|
||||
if(!is_writable(dirname($sitemap))) return false;
|
||||
}
|
||||
|
||||
if(@filesize($sitemap) &&
|
||||
@filemtime($sitemap) > (time()-($conf['sitemap']*86400))){ // 60*60*24=86400
|
||||
dbglog('Sitemapper::generate(): Sitemap up to date'); // FIXME: only in debug mode
|
||||
return false;
|
||||
}
|
||||
|
||||
dbglog("Sitemapper::generate(): using $sitemap"); // FIXME: Only in debug mode
|
||||
|
||||
$pages = idx_get_indexer()->getPages();
|
||||
dbglog('Sitemapper::generate(): creating sitemap using '.count($pages).' pages');
|
||||
$items = array();
|
||||
|
||||
// build the sitemap items
|
||||
foreach($pages as $id){
|
||||
//skip hidden, non existing and restricted files
|
||||
if(isHiddenPage($id)) continue;
|
||||
if(auth_aclcheck($id,'','') < AUTH_READ) continue;
|
||||
$item = SitemapItem::createFromID($id);
|
||||
if ($item !== NULL)
|
||||
$items[] = $item;
|
||||
}
|
||||
|
||||
$eventData = array('items' => &$items, 'sitemap' => &$sitemap);
|
||||
$event = new Doku_Event('SITEMAP_GENERATE', $eventData);
|
||||
if ($event->advise_before(true)) {
|
||||
//save the new sitemap
|
||||
$result = io_saveFile($sitemap, Sitemapper::getXML($items));
|
||||
}
|
||||
$event->advise_after();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the sitemap XML string from the given array auf SitemapItems.
|
||||
*
|
||||
* @param $items array The SitemapItems that shall be included in the sitemap.
|
||||
* @return string The sitemap XML.
|
||||
* @author Michael Hamann
|
||||
*/
|
||||
private function getXML($items) {
|
||||
ob_start();
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>'.NL;
|
||||
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.NL;
|
||||
foreach ($items as $item) {
|
||||
echo $item->toXML();
|
||||
}
|
||||
echo '</urlset>'.NL;
|
||||
$result = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for getting the path to the sitemap file.
|
||||
*
|
||||
* @return The path to the sitemap file.
|
||||
* @author Michael Hamann
|
||||
*/
|
||||
public function getFilePath() {
|
||||
global $conf;
|
||||
|
||||
$sitemap = $conf['cachedir'].'/sitemap.xml';
|
||||
if($conf['compression'] === 'bz2' || $conf['compression'] === 'gz'){
|
||||
$sitemap .= '.gz';
|
||||
}
|
||||
|
||||
return $sitemap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pings search engines with the sitemap url. Plugins can add or remove
|
||||
* urls to ping using the SITEMAP_PING event.
|
||||
*
|
||||
* @author Michael Hamann
|
||||
*/
|
||||
public function pingSearchEngines() {
|
||||
//ping search engines...
|
||||
$http = new DokuHTTPClient();
|
||||
$http->timeout = 8;
|
||||
|
||||
$encoded_sitemap_url = urlencode(wl('', array('do' => 'sitemap'), true, '&'));
|
||||
$ping_urls = array(
|
||||
'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap='.$encoded_sitemap_url,
|
||||
'yahoo' => 'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=dokuwiki&url='.$encoded_sitemap_url,
|
||||
'microsoft' => 'http://www.bing.com/webmaster/ping.aspx?siteMap='.$encoded_sitemap_url,
|
||||
);
|
||||
|
||||
$data = array('ping_urls' => $ping_urls,
|
||||
'encoded_sitemap_url' => $encoded_sitemap_url
|
||||
);
|
||||
$event = new Doku_Event('SITEMAP_PING', $data);
|
||||
if ($event->advise_before(true)) {
|
||||
foreach ($data['ping_urls'] as $name => $url) {
|
||||
dbglog("Sitemapper::PingSearchEngines(): pinging $name");
|
||||
$resp = $http->get($url);
|
||||
if($http->error) dbglog("Sitemapper:pingSearchengines(): $http->error");
|
||||
dbglog('Sitemapper:pingSearchengines(): '.preg_replace('/[\n\r]/',' ',strip_tags($resp)));
|
||||
}
|
||||
}
|
||||
$event->advise_after();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An item of a sitemap.
|
||||
*
|
||||
* @author Michael Hamann
|
||||
*/
|
||||
class SitemapItem {
|
||||
public $url;
|
||||
public $lastmod;
|
||||
public $changefreq;
|
||||
public $priority;
|
||||
|
||||
/**
|
||||
* Create a new item.
|
||||
*
|
||||
* @param $url string The url of the item
|
||||
* @param $lastmod int Timestamp of the last modification
|
||||
* @param $changefreq string How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never.
|
||||
* @param $priority float|string The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0.
|
||||
*/
|
||||
public function __construct($url, $lastmod, $changefreq = null, $priority = null) {
|
||||
$this->url = $url;
|
||||
$this->lastmod = $lastmod;
|
||||
$this->changefreq = $changefreq;
|
||||
$this->priority = $priority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for creating an item for a wikipage id.
|
||||
*
|
||||
* @param $id string A wikipage id.
|
||||
* @param $changefreq string How frequently the item is likely to change. Valid values: always, hourly, daily, weekly, monthly, yearly, never.
|
||||
* @param $priority float|string The priority of the item relative to other URLs on your site. Valid values range from 0.0 to 1.0.
|
||||
* @return The sitemap item.
|
||||
*/
|
||||
public static function createFromID($id, $changefreq = null, $priority = null) {
|
||||
$id = trim($id);
|
||||
$date = @filemtime(wikiFN($id));
|
||||
if(!$date) return NULL;
|
||||
return new SitemapItem(wl($id, '', true), $date, $changefreq, $priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the XML representation of the sitemap item.
|
||||
*
|
||||
* @return The XML representation.
|
||||
*/
|
||||
public function toXML() {
|
||||
$result = ' <url>'.NL
|
||||
.' <loc>'.hsc($this->url).'</loc>'.NL
|
||||
.' <lastmod>'.date_iso8601($this->lastmod).'</lastmod>'.NL;
|
||||
if ($this->changefreq !== NULL)
|
||||
$result .= ' <changefreq>'.hsc($this->changefreq).'</changefreq>'.NL;
|
||||
if ($this->priority !== NULL)
|
||||
$result .= ' <priority>'.hsc($this->priority).'</priority>'.NL;
|
||||
$result .= ' </url>'.NL;
|
||||
return $result;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@
|
|||
*
|
||||
* Modified for Dokuwiki
|
||||
*
|
||||
* @license GPL
|
||||
* @license LGPL-2.1
|
||||
* @link http://docs.maxg.info
|
||||
* @author Bouchon <tarlib@bouchon.org> (Maxg)
|
||||
* @author Christopher Smith <chris@jalakai.co.uk>
|
||||
|
|
|
@ -18,8 +18,10 @@ if(!defined('DOKU_INC')) die('meh.');
|
|||
function act_dispatch(){
|
||||
global $ACT;
|
||||
global $ID;
|
||||
global $INFO;
|
||||
global $QUERY;
|
||||
global $lang;
|
||||
global $conf;
|
||||
|
||||
$preact = $ACT;
|
||||
|
||||
|
@ -50,9 +52,20 @@ function act_dispatch(){
|
|||
}
|
||||
}
|
||||
|
||||
//display some infos
|
||||
if($ACT == 'check'){
|
||||
check();
|
||||
$ACT = 'show';
|
||||
}
|
||||
|
||||
//check permissions
|
||||
$ACT = act_permcheck($ACT);
|
||||
|
||||
//sitemap
|
||||
if ($ACT == 'sitemap'){
|
||||
$ACT = act_sitemap($ACT);
|
||||
}
|
||||
|
||||
//register
|
||||
if($ACT == 'register' && $_POST['save'] && register()){
|
||||
$ACT = 'login';
|
||||
|
@ -115,12 +128,6 @@ function act_dispatch(){
|
|||
if(substr($ACT,0,7) == 'export_')
|
||||
$ACT = act_export($ACT);
|
||||
|
||||
//display some infos
|
||||
if($ACT == 'check'){
|
||||
check();
|
||||
$ACT = 'show';
|
||||
}
|
||||
|
||||
//handle admin tasks
|
||||
if($ACT == 'admin'){
|
||||
// retrieve admin plugin name from $_REQUEST['page']
|
||||
|
@ -128,8 +135,15 @@ function act_dispatch(){
|
|||
$pluginlist = plugin_list('admin');
|
||||
if (in_array($_REQUEST['page'], $pluginlist)) {
|
||||
// attempt to load the plugin
|
||||
if ($plugin =& plugin_load('admin',$_REQUEST['page']) !== null)
|
||||
$plugin->handle();
|
||||
if ($plugin =& plugin_load('admin',$_REQUEST['page']) !== null){
|
||||
if($plugin->forAdminOnly() && !$INFO['isadmin']){
|
||||
// a manager tried to load a plugin that's for admins only
|
||||
unset($_REQUEST['page']);
|
||||
msg('For admins only',-1);
|
||||
}else{
|
||||
$plugin->handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +152,10 @@ function act_dispatch(){
|
|||
$ACT = act_permcheck($ACT);
|
||||
} // end event ACTION_ACT_PREPROCESS default action
|
||||
$evt->advise_after();
|
||||
// Make sure plugs can handle 'denied'
|
||||
if($conf['send404'] && $ACT == 'denied') {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
}
|
||||
unset($evt);
|
||||
|
||||
// when action 'show', the intial not 'show' and POST, do a redirect
|
||||
|
@ -205,7 +223,7 @@ function act_clean($act){
|
|||
'preview','search','show','check','index','revisions',
|
||||
'diff','recent','backlink','admin','subscribe','revert',
|
||||
'unsubscribe','profile','resendpwd','recover',
|
||||
'draftdel','subscribens','unsubscribens',)) && substr($act,0,7) != 'export_' ) {
|
||||
'draftdel','subscribens','unsubscribens','sitemap')) && substr($act,0,7) != 'export_' ) {
|
||||
msg('Command unknown: '.htmlspecialchars($act),-1);
|
||||
return 'show';
|
||||
}
|
||||
|
@ -233,7 +251,7 @@ function act_permcheck($act){
|
|||
}else{
|
||||
$permneed = AUTH_CREATE;
|
||||
}
|
||||
}elseif(in_array($act,array('login','search','recent','profile','index'))){
|
||||
}elseif(in_array($act,array('login','search','recent','profile','index', 'sitemap'))){
|
||||
$permneed = AUTH_NONE;
|
||||
}elseif($act == 'revert'){
|
||||
$permneed = AUTH_ADMIN;
|
||||
|
@ -281,10 +299,10 @@ function act_draftsave($act){
|
|||
global $conf;
|
||||
if($conf['usedraft'] && $_POST['wikitext']){
|
||||
$draft = array('id' => $ID,
|
||||
'prefix' => $_POST['prefix'],
|
||||
'prefix' => substr($_POST['prefix'], 0, -1),
|
||||
'text' => $_POST['wikitext'],
|
||||
'suffix' => $_POST['suffix'],
|
||||
'date' => $_POST['date'],
|
||||
'date' => (int) $_POST['date'],
|
||||
'client' => $INFO['client'],
|
||||
);
|
||||
$cname = getCacheName($draft['client'].$ID,'.draft');
|
||||
|
@ -586,6 +604,52 @@ function act_export($act){
|
|||
return 'show';
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle sitemap delivery
|
||||
*
|
||||
* @author Michael Hamann <michael@content-space.de>
|
||||
*/
|
||||
function act_sitemap($act) {
|
||||
global $conf;
|
||||
|
||||
if ($conf['sitemap'] < 1 || !is_numeric($conf['sitemap'])) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
print "Sitemap generation is disabled.";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sitemap = Sitemapper::getFilePath();
|
||||
if(strrchr($sitemap, '.') === '.gz'){
|
||||
$mime = 'application/x-gzip';
|
||||
}else{
|
||||
$mime = 'application/xml; charset=utf-8';
|
||||
}
|
||||
|
||||
// Check if sitemap file exists, otherwise create it
|
||||
if (!is_readable($sitemap)) {
|
||||
Sitemapper::generate();
|
||||
}
|
||||
|
||||
if (is_readable($sitemap)) {
|
||||
// Send headers
|
||||
header('Content-Type: '.$mime);
|
||||
header('Content-Disposition: attachment; filename='.basename($sitemap));
|
||||
|
||||
http_conditionalRequest(filemtime($sitemap));
|
||||
|
||||
// Send file
|
||||
//use x-sendfile header to pass the delivery to compatible webservers
|
||||
if (http_sendfile($sitemap)) exit;
|
||||
|
||||
readfile($sitemap);
|
||||
exit;
|
||||
}
|
||||
|
||||
header("HTTP/1.0 500 Internal Server Error");
|
||||
print "Could not read the sitemap file - bad permissions?";
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle page 'subscribe'
|
||||
*
|
||||
|
@ -687,4 +751,4 @@ function subscription_handle_post(&$params) {
|
|||
$params = compact('target', 'style', 'data', 'action');
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
133
inc/adLDAP.php
133
inc/adLDAP.php
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* PHP LDAP CLASS FOR MANIPULATING ACTIVE DIRECTORY
|
||||
* Version 3.3.1
|
||||
* Version 3.3.2
|
||||
*
|
||||
* PHP Version 5 with SSL and LDAP support
|
||||
*
|
||||
|
@ -9,7 +9,7 @@
|
|||
* email: scott@wiggumworld.com, adldap@richardhyland.com
|
||||
* http://adldap.sourceforge.net/
|
||||
*
|
||||
* Copyright (c) 2006-2009 Scott Barnett, Richard Hyland
|
||||
* Copyright (c) 2006-2010 Scott Barnett, Richard Hyland
|
||||
*
|
||||
* We'd appreciate any improvements or additions to be submitted back
|
||||
* to benefit the entire community :)
|
||||
|
@ -27,10 +27,10 @@
|
|||
* @category ToolsAndUtilities
|
||||
* @package adLDAP
|
||||
* @author Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2009 Scott Barnett, Richard Hyland
|
||||
* @copyright (c) 2006-2010 Scott Barnett, Richard Hyland
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
|
||||
* @revision $Revision: 67 $
|
||||
* @version 3.3.1
|
||||
* @revision $Revision: 91 $
|
||||
* @version 3.3.2
|
||||
* @link http://adldap.sourceforge.net/
|
||||
*/
|
||||
|
||||
|
@ -409,25 +409,26 @@ class adLDAP {
|
|||
* @param bool optional $prevent_rebind
|
||||
* @return bool
|
||||
*/
|
||||
public function authenticate($username,$password,$prevent_rebind=false){
|
||||
public function authenticate($username, $password, $prevent_rebind = false) {
|
||||
// Prevent null binding
|
||||
if ($username===NULL || $password===NULL){ return (false); }
|
||||
if (empty($username) || empty($password)){ return (false); }
|
||||
if ($username === NULL || $password === NULL) { return false; }
|
||||
if (empty($username) || empty($password)) { return false; }
|
||||
|
||||
// Bind as the user
|
||||
$this->_bind = @ldap_bind($this->_conn,$username.$this->_account_suffix,$password);
|
||||
if (!$this->_bind){ return (false); }
|
||||
$ret = true;
|
||||
$this->_bind = @ldap_bind($this->_conn, $username . $this->_account_suffix, $password);
|
||||
if (!$this->_bind){ $ret = false; }
|
||||
|
||||
// Cnce we've checked their details, kick back into admin mode if we have it
|
||||
if ($this->_ad_username!=NULL && !$prevent_rebind){
|
||||
$this->_bind = @ldap_bind($this->_conn,$this->_ad_username.$this->_account_suffix,$this->_ad_password);
|
||||
if ($this->_ad_username !== NULL && !$prevent_rebind) {
|
||||
$this->_bind = @ldap_bind($this->_conn, $this->_ad_username . $this->_account_suffix , $this->_ad_password);
|
||||
if (!$this->_bind){
|
||||
// This should never happen in theory
|
||||
throw new adLDAPException('Rebind to Active Directory failed. AD said: ' . $this->get_last_error());
|
||||
}
|
||||
}
|
||||
|
||||
return (true);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//*****************************************************************************************************************
|
||||
|
@ -758,7 +759,7 @@ class adLDAP {
|
|||
$ret_groups=array();
|
||||
|
||||
$groups=$this->group_info($group,array("memberof"));
|
||||
if (is_array($groups[0]["memberof"])) {
|
||||
if (isset($groups[0]["memberof"]) && is_array($groups[0]["memberof"])) {
|
||||
$groups=$groups[0]["memberof"];
|
||||
|
||||
if ($groups){
|
||||
|
@ -861,7 +862,7 @@ class adLDAP {
|
|||
* @param array $attributes The attributes to set to the user account
|
||||
* @return bool
|
||||
*/
|
||||
public function user_create($attributes){
|
||||
public function user_create($attributes){
|
||||
// Check for compulsory fields
|
||||
if (!array_key_exists("username",$attributes)){ return ("Missing compulsory field [username]"); }
|
||||
if (!array_key_exists("firstname",$attributes)){ return ("Missing compulsory field [firstname]"); }
|
||||
|
@ -963,25 +964,36 @@ class adLDAP {
|
|||
$username = $this->strguid2hex($username);
|
||||
$filter="objectguid=".$username;
|
||||
}
|
||||
else {
|
||||
$filter="samaccountname=".$username;
|
||||
else if (strstr($username, "@")) {
|
||||
$filter="userPrincipalName=".$username;
|
||||
}
|
||||
else {
|
||||
$filter="samaccountname=".$username;
|
||||
}
|
||||
$filter = "(&(objectCategory=person)({$filter}))";
|
||||
if ($fields===NULL){ $fields=array("samaccountname","mail","memberof","department","displayname","telephonenumber","primarygroupid","objectsid"); }
|
||||
if (!in_array("objectsid",$fields)){
|
||||
$fields[] = "objectsid";
|
||||
}
|
||||
$sr=ldap_search($this->_conn,$this->_base_dn,$filter,$fields);
|
||||
$entries = ldap_get_entries($this->_conn, $sr);
|
||||
|
||||
if ($entries[0]['count'] >= 1) {
|
||||
// AD does not return the primary group in the ldap query, we may need to fudge it
|
||||
if ($this->_real_primarygroup && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["objectsid"][0])){
|
||||
//$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
|
||||
$entries[0]["memberof"][]=$this->get_primary_group($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
|
||||
} else {
|
||||
$entries[0]["memberof"][]="CN=Domain Users,CN=Users,".$this->_base_dn;
|
||||
if (isset($entries[0])) {
|
||||
if ($entries[0]['count'] >= 1) {
|
||||
if (in_array("memberof", $fields)) {
|
||||
// AD does not return the primary group in the ldap query, we may need to fudge it
|
||||
if ($this->_real_primarygroup && isset($entries[0]["primarygroupid"][0]) && isset($entries[0]["objectsid"][0])){
|
||||
//$entries[0]["memberof"][]=$this->group_cn($entries[0]["primarygroupid"][0]);
|
||||
$entries[0]["memberof"][]=$this->get_primary_group($entries[0]["primarygroupid"][0], $entries[0]["objectsid"][0]);
|
||||
} else {
|
||||
$entries[0]["memberof"][]="CN=Domain Users,CN=Users,".$this->_base_dn;
|
||||
}
|
||||
$entries[0]["memberof"]["count"]++;
|
||||
}
|
||||
}
|
||||
return $entries;
|
||||
}
|
||||
|
||||
$entries[0]["memberof"]["count"]++;
|
||||
return ($entries);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1171,8 +1183,17 @@ class adLDAP {
|
|||
$add=array();
|
||||
$add["unicodePwd"][0]=$this->encode_password($password);
|
||||
|
||||
$result=ldap_mod_replace($this->_conn,$user_dn,$add);
|
||||
if ($result==false){ return (false); }
|
||||
$result=@ldap_mod_replace($this->_conn,$user_dn,$add);
|
||||
if ($result==false){
|
||||
$err = ldap_errno($this->_conn);
|
||||
if($err){
|
||||
$msg = 'Error '.$err.': '.ldap_err2str($err).'.';
|
||||
if($err == 53) $msg .= ' Your password might not match the password policy.';
|
||||
throw new adLDAPException($msg);
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
@ -1232,6 +1253,33 @@ class adLDAP {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a user account to a different OU
|
||||
*
|
||||
* @param string $username The username to move (please be careful here!)
|
||||
* @param array $container The container or containers to move the user to (please be careful here!).
|
||||
* accepts containers in 1. parent 2. child order
|
||||
* @return array
|
||||
*/
|
||||
public function user_move($username, $container) {
|
||||
if (!$this->_bind){ return (false); }
|
||||
if ($username === null){ return ("Missing compulsory field [username]"); }
|
||||
if ($container === null){ return ("Missing compulsory field [container]"); }
|
||||
if (!is_array($container)){ return ("Container must be an array"); }
|
||||
|
||||
$userinfo = $this->user_info($username, array("*"));
|
||||
$dn = $userinfo[0]['distinguishedname'][0];
|
||||
$newrdn = "cn=" . $username;
|
||||
$container = array_reverse($container);
|
||||
$newcontainer = "ou=" . implode(",ou=",$container);
|
||||
$newbasedn = strtolower($newcontainer) . "," . $this->_base_dn;
|
||||
$result=@ldap_rename($this->_conn,$dn,$newrdn,$newbasedn,true);
|
||||
if ($result !== true) {
|
||||
return (false);
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
|
||||
//*****************************************************************************************************************
|
||||
// CONTACT FUNCTIONS
|
||||
// * Still work to do in this area, and new functions to write
|
||||
|
@ -1567,6 +1615,32 @@ class adLDAP {
|
|||
return ($groups);
|
||||
}
|
||||
|
||||
//************************************************************************************************************
|
||||
// ORGANIZATIONAL UNIT FUNCTIONS
|
||||
|
||||
/**
|
||||
* Create an organizational unit
|
||||
*
|
||||
* @param array $attributes Default attributes of the ou
|
||||
* @return bool
|
||||
*/
|
||||
public function ou_create($attributes){
|
||||
if (!is_array($attributes)){ return ("Attributes must be an array"); }
|
||||
if (!array_key_exists("ou_name",$attributes)){ return ("Missing compulsory field [ou_name]"); }
|
||||
if (!array_key_exists("container",$attributes)){ return ("Missing compulsory field [container]"); }
|
||||
if (!is_array($attributes["container"])){ return ("Container attribute must be an array."); }
|
||||
$attributes["container"]=array_reverse($attributes["container"]);
|
||||
|
||||
$add=array();
|
||||
$add["objectClass"] = "organizationalUnit";
|
||||
|
||||
$container="OU=".implode(",OU=",$attributes["container"]);
|
||||
$result=ldap_add($this->_conn,"CN=".$add["cn"].", ".$container.",".$this->_base_dn,$add);
|
||||
if ($result!=true){ return (false); }
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
//************************************************************************************************************
|
||||
// EXCHANGE FUNCTIONS
|
||||
|
||||
|
@ -1998,6 +2072,7 @@ class adLDAP {
|
|||
if ($attributes["exchange_usedefaults"]){ $mod["mDBUseDefaults"][0]=$attributes["exchange_usedefaults"]; }
|
||||
if ($attributes["exchange_policyexclude"]){ $mod["msExchPoliciesExcluded"][0]=$attributes["exchange_policyexclude"]; }
|
||||
if ($attributes["exchange_policyinclude"]){ $mod["msExchPoliciesIncluded"][0]=$attributes["exchange_policyinclude"]; }
|
||||
if ($attributes["exchange_addressbook"]){ $mod["showInAddressBook"][0]=$attributes["exchange_addressbook"]; }
|
||||
|
||||
// This schema is designed for contacts
|
||||
if ($attributes["exchange_hidefromlists"]){ $mod["msExchHideFromAddressLists"][0]=$attributes["exchange_hidefromlists"]; }
|
||||
|
|
289
inc/auth.php
289
inc/auth.php
|
@ -70,6 +70,12 @@ function auth_setup(){
|
|||
$_REQUEST['http_credentials'] = false;
|
||||
if (!$conf['rememberme']) $_REQUEST['r'] = false;
|
||||
|
||||
// handle renamed HTTP_AUTHORIZATION variable (can happen when a fix like
|
||||
// the one presented at
|
||||
// http://www.besthostratings.com/articles/http-auth-php-cgi.html is used
|
||||
// for enabling HTTP authentication with CGI/SuExec)
|
||||
if(isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']))
|
||||
$_SERVER['HTTP_AUTHORIZATION'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
|
||||
// streamline HTTP auth credentials (IIS/rewrite -> mod_php)
|
||||
if(isset($_SERVER['HTTP_AUTHORIZATION'])){
|
||||
list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) =
|
||||
|
@ -183,7 +189,9 @@ function auth_login($user,$pass,$sticky=false,$silent=false){
|
|||
if ($auth->checkPass($user,$pass)){
|
||||
// make logininfo globally available
|
||||
$_SERVER['REMOTE_USER'] = $user;
|
||||
auth_setCookie($user,PMA_blowfish_encrypt($pass,auth_cookiesalt()),$sticky);
|
||||
$secret = auth_cookiesalt();
|
||||
if(!$sticky) $secret .= session_id; //bind non-sticky to session
|
||||
auth_setCookie($user,PMA_blowfish_encrypt($pass,$secret),$sticky);
|
||||
return true;
|
||||
}else{
|
||||
//invalid credentials - log off
|
||||
|
@ -194,23 +202,27 @@ function auth_login($user,$pass,$sticky=false,$silent=false){
|
|||
}else{
|
||||
// read cookie information
|
||||
list($user,$sticky,$pass) = auth_getCookie();
|
||||
// get session info
|
||||
$session = $_SESSION[DOKU_COOKIE]['auth'];
|
||||
if($user && $pass){
|
||||
// we got a cookie - see if we can trust it
|
||||
|
||||
// get session info
|
||||
$session = $_SESSION[DOKU_COOKIE]['auth'];
|
||||
if(isset($session) &&
|
||||
$auth->useSessionCache($user) &&
|
||||
($session['time'] >= time()-$conf['auth_security_timeout']) &&
|
||||
($session['user'] == $user) &&
|
||||
($session['pass'] == $pass) && //still crypted
|
||||
($session['pass'] == sha1($pass)) && //still crypted
|
||||
($session['buid'] == auth_browseruid()) ){
|
||||
|
||||
// he has session, cookie and browser right - let him in
|
||||
$_SERVER['REMOTE_USER'] = $user;
|
||||
$USERINFO = $session['info']; //FIXME move all references to session
|
||||
return true;
|
||||
}
|
||||
// no we don't trust it yet - recheck pass but silent
|
||||
$pass = PMA_blowfish_decrypt($pass,auth_cookiesalt());
|
||||
$secret = auth_cookiesalt();
|
||||
if(!$sticky) $secret .= session_id(); //bind non-sticky to session
|
||||
$pass = PMA_blowfish_decrypt($pass,$secret);
|
||||
return auth_login($user,$pass,$sticky,true);
|
||||
}
|
||||
}
|
||||
|
@ -371,63 +383,15 @@ function auth_ismanager($user=null,$groups=null,$adminonly=false){
|
|||
$user = $_SERVER['REMOTE_USER'];
|
||||
}
|
||||
}
|
||||
$user = trim($auth->cleanUser($user));
|
||||
if($user === '') return false;
|
||||
if(is_null($groups)) $groups = (array) $USERINFO['grps'];
|
||||
$groups = array_map(array($auth,'cleanGroup'),$groups);
|
||||
$user = auth_nameencode($user);
|
||||
|
||||
// check username against superuser and manager
|
||||
$superusers = explode(',', $conf['superuser']);
|
||||
$superusers = array_unique($superusers);
|
||||
$superusers = array_map('trim', $superusers);
|
||||
$superusers = array_filter($superusers);
|
||||
// prepare an array containing only true values for array_map call
|
||||
$alltrue = array_fill(0, count($superusers), true);
|
||||
$superusers = array_map('auth_nameencode', $superusers, $alltrue);
|
||||
|
||||
// case insensitive?
|
||||
if(!$auth->isCaseSensitive()){
|
||||
$superusers = array_map('utf8_strtolower',$superusers);
|
||||
$user = utf8_strtolower($user);
|
||||
if(is_null($groups)){
|
||||
$groups = (array) $USERINFO['grps'];
|
||||
}
|
||||
|
||||
// check user match
|
||||
if(in_array($user, $superusers)) return true;
|
||||
|
||||
// check superuser match
|
||||
if(auth_isMember($conf['superuser'],$user, $groups)) return true;
|
||||
if($adminonly) return false;
|
||||
// check managers
|
||||
if(!$adminonly){
|
||||
$managers = explode(',', $conf['manager']);
|
||||
$managers = array_unique($managers);
|
||||
$managers = array_map('trim', $managers);
|
||||
$managers = array_filter($managers);
|
||||
// prepare an array containing only true values for array_map call
|
||||
$alltrue = array_fill(0, count($managers), true);
|
||||
$managers = array_map('auth_nameencode', $managers, $alltrue);
|
||||
if(!$auth->isCaseSensitive()) $managers = array_map('utf8_strtolower',$managers);
|
||||
if(in_array($user, $managers)) return true;
|
||||
}
|
||||
|
||||
// check user's groups against superuser and manager
|
||||
if (!empty($groups)) {
|
||||
|
||||
//prepend groups with @ and nameencode
|
||||
$cnt = count($groups);
|
||||
for($i=0; $i<$cnt; $i++){
|
||||
$groups[$i] = '@'.auth_nameencode($groups[$i]);
|
||||
if(!$auth->isCaseSensitive()){
|
||||
$groups[$i] = utf8_strtolower($groups[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
// check groups against superuser and manager
|
||||
foreach($superusers as $supu)
|
||||
if(in_array($supu, $groups)) return true;
|
||||
if(!$adminonly){
|
||||
foreach($managers as $mana)
|
||||
if(in_array($mana, $groups)) return true;
|
||||
}
|
||||
}
|
||||
if(auth_isMember($conf['manager'],$user, $groups)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -446,6 +410,52 @@ function auth_isadmin($user=null,$groups=null){
|
|||
return auth_ismanager($user,$groups,true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Match a user and his groups against a comma separated list of
|
||||
* users and groups to determine membership status
|
||||
*
|
||||
* Note: all input should NOT be nameencoded.
|
||||
*
|
||||
* @param $memberlist string commaseparated list of allowed users and groups
|
||||
* @param $user string user to match against
|
||||
* @param $groups array groups the user is member of
|
||||
* @returns bool true for membership acknowledged
|
||||
*/
|
||||
function auth_isMember($memberlist,$user,array $groups){
|
||||
global $auth;
|
||||
if (!$auth) return false;
|
||||
|
||||
// clean user and groups
|
||||
if(!$auth->isCaseSensitive()){
|
||||
$user = utf8_strtolower($user);
|
||||
$groups = array_map('utf8_strtolower',$groups);
|
||||
}
|
||||
$user = $auth->cleanUser($user);
|
||||
$groups = array_map(array($auth,'cleanGroup'),$groups);
|
||||
|
||||
// extract the memberlist
|
||||
$members = explode(',',$memberlist);
|
||||
$members = array_map('trim',$members);
|
||||
$members = array_unique($members);
|
||||
$members = array_filter($members);
|
||||
|
||||
// compare cleaned values
|
||||
foreach($members as $member){
|
||||
if(!$auth->isCaseSensitive()) $member = utf8_strtolower($member);
|
||||
if($member[0] == '@'){
|
||||
$member = $auth->cleanGroup(substr($member,1));
|
||||
if(in_array($member, $groups)) return true;
|
||||
}else{
|
||||
$member = $auth->cleanUser($member);
|
||||
if($member == $user) return true;
|
||||
}
|
||||
}
|
||||
|
||||
// still here? not a member!
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convinience function for auth_aclcheck()
|
||||
*
|
||||
|
@ -536,13 +546,13 @@ function auth_aclcheck($id,$user,$groups){
|
|||
|
||||
//still here? do the namespace checks
|
||||
if($ns){
|
||||
$path = $ns.':\*';
|
||||
$path = $ns.':*';
|
||||
}else{
|
||||
$path = '\*'; //root document
|
||||
$path = '*'; //root document
|
||||
}
|
||||
|
||||
do{
|
||||
$matches = preg_grep('/^'.$path.'\s+('.$regexp.')\s+/'.$ci,$AUTH_ACL);
|
||||
$matches = preg_grep('/^'.preg_quote($path,'/').'\s+('.$regexp.')\s+/'.$ci,$AUTH_ACL);
|
||||
if(count($matches)){
|
||||
foreach($matches as $match){
|
||||
$match = preg_replace('/#.*$/','',$match); //ignore comments
|
||||
|
@ -559,9 +569,9 @@ function auth_aclcheck($id,$user,$groups){
|
|||
//get next higher namespace
|
||||
$ns = getNS($ns);
|
||||
|
||||
if($path != '\*'){
|
||||
$path = $ns.':\*';
|
||||
if($path == ':\*') $path = '\*';
|
||||
if($path != '*'){
|
||||
$path = $ns.':*';
|
||||
if($path == ':*') $path = '*';
|
||||
}else{
|
||||
//we did this already
|
||||
//looks like there is something wrong with the ACL
|
||||
|
@ -681,9 +691,8 @@ function register(){
|
|||
global $conf;
|
||||
global $auth;
|
||||
|
||||
if (!$auth) return false;
|
||||
if(!$_POST['save']) return false;
|
||||
if(!$auth->canDo('addUser')) return false;
|
||||
if(!actionOK('register')) return false;
|
||||
|
||||
//clean username
|
||||
$_POST['login'] = trim($auth->cleanUser($_POST['login']));
|
||||
|
@ -759,12 +768,10 @@ function updateprofile() {
|
|||
global $lang;
|
||||
global $auth;
|
||||
|
||||
if (!$auth) return false;
|
||||
if(empty($_POST['save'])) return false;
|
||||
if(!checkSecurityToken()) return false;
|
||||
|
||||
// should not be able to get here without Profile being possible...
|
||||
if(!$auth->canDo('Profile')) {
|
||||
if(!actionOK('profile')) {
|
||||
msg($lang['profna'],-1);
|
||||
return false;
|
||||
}
|
||||
|
@ -835,11 +842,7 @@ function act_resendpwd(){
|
|||
global $conf;
|
||||
global $auth;
|
||||
|
||||
if(!actionOK('resendpwd')) return false;
|
||||
if (!$auth) return false;
|
||||
|
||||
// should not be able to get here without modPass being possible...
|
||||
if(!$auth->canDo('modPass')) {
|
||||
if(!actionOK('resendpwd')) {
|
||||
msg($lang['resendna'],-1);
|
||||
return false;
|
||||
}
|
||||
|
@ -927,18 +930,6 @@ function act_resendpwd(){
|
|||
* If the selected method needs a salt and none was given, a random one
|
||||
* is chosen.
|
||||
*
|
||||
* The following methods are understood:
|
||||
*
|
||||
* smd5 - Salted MD5 hashing
|
||||
* apr1 - Apache salted MD5 hashing
|
||||
* md5 - Simple MD5 hashing
|
||||
* sha1 - SHA1 hashing
|
||||
* ssha - Salted SHA1 hashing
|
||||
* crypt - Unix crypt
|
||||
* mysql - MySQL password (old method)
|
||||
* my411 - MySQL 4.1.1 password
|
||||
* kmd5 - Salted MD5 hashing as used by UNB
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @return string The crypted password
|
||||
*/
|
||||
|
@ -946,128 +937,26 @@ function auth_cryptPassword($clear,$method='',$salt=null){
|
|||
global $conf;
|
||||
if(empty($method)) $method = $conf['passcrypt'];
|
||||
|
||||
//prepare a salt
|
||||
if(is_null($salt)) $salt = md5(uniqid(rand(), true));
|
||||
$pass = new PassHash();
|
||||
$call = 'hash_'.$method;
|
||||
|
||||
switch(strtolower($method)){
|
||||
case 'smd5':
|
||||
if(defined('CRYPT_MD5') && CRYPT_MD5) return crypt($clear,'$1$'.substr($salt,0,8).'$');
|
||||
// when crypt can't handle SMD5, falls through to pure PHP implementation
|
||||
$magic = '1';
|
||||
case 'apr1':
|
||||
//from http://de.php.net/manual/en/function.crypt.php#73619 comment by <mikey_nich at hotmail dot com>
|
||||
if(!isset($magic)) $magic = 'apr1';
|
||||
$salt = substr($salt,0,8);
|
||||
$len = strlen($clear);
|
||||
$text = $clear.'$'.$magic.'$'.$salt;
|
||||
$bin = pack("H32", md5($clear.$salt.$clear));
|
||||
for($i = $len; $i > 0; $i -= 16) {
|
||||
$text .= substr($bin, 0, min(16, $i));
|
||||
}
|
||||
for($i = $len; $i > 0; $i >>= 1) {
|
||||
$text .= ($i & 1) ? chr(0) : $clear{0};
|
||||
}
|
||||
$bin = pack("H32", md5($text));
|
||||
for($i = 0; $i < 1000; $i++) {
|
||||
$new = ($i & 1) ? $clear : $bin;
|
||||
if ($i % 3) $new .= $salt;
|
||||
if ($i % 7) $new .= $clear;
|
||||
$new .= ($i & 1) ? $bin : $clear;
|
||||
$bin = pack("H32", md5($new));
|
||||
}
|
||||
$tmp = '';
|
||||
for ($i = 0; $i < 5; $i++) {
|
||||
$k = $i + 6;
|
||||
$j = $i + 12;
|
||||
if ($j == 16) $j = 5;
|
||||
$tmp = $bin[$i].$bin[$k].$bin[$j].$tmp;
|
||||
}
|
||||
$tmp = chr(0).chr(0).$bin[11].$tmp;
|
||||
$tmp = strtr(strrev(substr(base64_encode($tmp), 2)),
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
||||
return '$'.$magic.'$'.$salt.'$'.$tmp;
|
||||
case 'md5':
|
||||
return md5($clear);
|
||||
case 'sha1':
|
||||
return sha1($clear);
|
||||
case 'ssha':
|
||||
$salt=substr($salt,0,4);
|
||||
return '{SSHA}'.base64_encode(pack("H*", sha1($clear.$salt)).$salt);
|
||||
case 'crypt':
|
||||
return crypt($clear,substr($salt,0,2));
|
||||
case 'mysql':
|
||||
//from http://www.php.net/mysql comment by <soren at byu dot edu>
|
||||
$nr=0x50305735;
|
||||
$nr2=0x12345671;
|
||||
$add=7;
|
||||
$charArr = preg_split("//", $clear);
|
||||
foreach ($charArr as $char) {
|
||||
if (($char == '') || ($char == ' ') || ($char == '\t')) continue;
|
||||
$charVal = ord($char);
|
||||
$nr ^= ((($nr & 63) + $add) * $charVal) + ($nr << 8);
|
||||
$nr2 += ($nr2 << 8) ^ $nr;
|
||||
$add += $charVal;
|
||||
}
|
||||
return sprintf("%08x%08x", ($nr & 0x7fffffff), ($nr2 & 0x7fffffff));
|
||||
case 'my411':
|
||||
return '*'.sha1(pack("H*", sha1($clear)));
|
||||
case 'kmd5':
|
||||
$key = substr($salt, 16, 2);
|
||||
$hash1 = strtolower(md5($key . md5($clear)));
|
||||
$hash2 = substr($hash1, 0, 16) . $key . substr($hash1, 16);
|
||||
return $hash2;
|
||||
default:
|
||||
msg("Unsupported crypt method $method",-1);
|
||||
if(!method_exists($pass,$call)){
|
||||
msg("Unsupported crypt method $method",-1);
|
||||
return false;
|
||||
}
|
||||
|
||||
return $pass->$call($clear,$salt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies a cleartext password against a crypted hash
|
||||
*
|
||||
* The method and salt used for the crypted hash is determined automatically
|
||||
* then the clear text password is crypted using the same method. If both hashs
|
||||
* match true is is returned else false
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @return bool
|
||||
*/
|
||||
function auth_verifyPassword($clear,$crypt){
|
||||
$method='';
|
||||
$salt='';
|
||||
|
||||
//determine the used method and salt
|
||||
$len = strlen($crypt);
|
||||
if(preg_match('/^\$1\$([^\$]{0,8})\$/',$crypt,$m)){
|
||||
$method = 'smd5';
|
||||
$salt = $m[1];
|
||||
}elseif(preg_match('/^\$apr1\$([^\$]{0,8})\$/',$crypt,$m)){
|
||||
$method = 'apr1';
|
||||
$salt = $m[1];
|
||||
}elseif(substr($crypt,0,6) == '{SSHA}'){
|
||||
$method = 'ssha';
|
||||
$salt = substr(base64_decode(substr($crypt, 6)),20);
|
||||
}elseif($len == 32){
|
||||
$method = 'md5';
|
||||
}elseif($len == 40){
|
||||
$method = 'sha1';
|
||||
}elseif($len == 16){
|
||||
$method = 'mysql';
|
||||
}elseif($len == 41 && $crypt[0] == '*'){
|
||||
$method = 'my411';
|
||||
}elseif($len == 34){
|
||||
$method = 'kmd5';
|
||||
$salt = $crypt;
|
||||
}else{
|
||||
$method = 'crypt';
|
||||
$salt = substr($crypt,0,2);
|
||||
}
|
||||
|
||||
//crypt and compare
|
||||
if(auth_cryptPassword($clear,$method,$salt) === $crypt){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
$pass = new PassHash();
|
||||
return $pass->verify_hash($clear,$crypt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1095,7 +984,7 @@ function auth_setCookie($user,$pass,$sticky) {
|
|||
}
|
||||
// set session
|
||||
$_SESSION[DOKU_COOKIE]['auth']['user'] = $user;
|
||||
$_SESSION[DOKU_COOKIE]['auth']['pass'] = $pass;
|
||||
$_SESSION[DOKU_COOKIE]['auth']['pass'] = sha1($pass);
|
||||
$_SESSION[DOKU_COOKIE]['auth']['buid'] = auth_browseruid();
|
||||
$_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO;
|
||||
$_SESSION[DOKU_COOKIE]['auth']['time'] = time();
|
||||
|
@ -1117,4 +1006,4 @@ function auth_getCookie(){
|
|||
return array($user,$sticky,$pass);
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* $conf['auth']['ad']['ad_password'] = 'pass';
|
||||
* $conf['auth']['ad']['real_primarygroup'] = 1;
|
||||
* $conf['auth']['ad']['use_ssl'] = 1;
|
||||
* $conf['auth']['ad']['use_tls'] = 1;
|
||||
* $conf['auth']['ad']['debug'] = 1;
|
||||
*
|
||||
* // get additional information to the userinfo array
|
||||
|
@ -51,6 +52,7 @@ class auth_ad extends auth_basic {
|
|||
global $conf;
|
||||
$this->cnf = $conf['auth']['ad'];
|
||||
|
||||
|
||||
// additional information fields
|
||||
if (isset($this->cnf['additional'])) {
|
||||
$this->cnf['additional'] = str_replace(' ', '', $this->cnf['additional']);
|
||||
|
@ -60,7 +62,7 @@ class auth_ad extends auth_basic {
|
|||
// ldap extension is needed
|
||||
if (!function_exists('ldap_connect')) {
|
||||
if ($this->cnf['debug'])
|
||||
msg("LDAP err: PHP LDAP extension not found.",-1);
|
||||
msg("AD Auth: PHP LDAP extension not found.",-1);
|
||||
$this->success = false;
|
||||
return;
|
||||
}
|
||||
|
@ -97,7 +99,12 @@ class auth_ad extends auth_basic {
|
|||
$this->opts['domain_controllers'] = array_map('trim',$this->opts['domain_controllers']);
|
||||
$this->opts['domain_controllers'] = array_filter($this->opts['domain_controllers']);
|
||||
|
||||
// we currently just handle authentication, so no capabilities are set
|
||||
// we can change the password if SSL is set
|
||||
if($this->opts['use_ssl'] || $this->opts['use_tls']){
|
||||
$this->cando['modPass'] = true;
|
||||
}
|
||||
$this->cando['modName'] = true;
|
||||
$this->cando['modMail'] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,7 +133,7 @@ class auth_ad extends auth_basic {
|
|||
* at least these fields:
|
||||
*
|
||||
* name string full name of the user
|
||||
* mail string email addres of the user
|
||||
* mail string email address of the user
|
||||
* grps array list of groups the user is in
|
||||
*
|
||||
* This LDAP specific function returns the following
|
||||
|
@ -246,6 +253,49 @@ class auth_ad extends auth_basic {
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify user data
|
||||
*
|
||||
* @param $user nick of the user to be changed
|
||||
* @param $changes array of field/value pairs to be changed
|
||||
* @return bool
|
||||
*/
|
||||
function modifyUser($user, $changes) {
|
||||
$return = true;
|
||||
|
||||
// password changing
|
||||
if(isset($changes['pass'])){
|
||||
try {
|
||||
$return = $this->adldap->user_password($user,$changes['pass']);
|
||||
} catch (adLDAPException $e) {
|
||||
if ($this->cnf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
|
||||
$return = false;
|
||||
}
|
||||
if(!$return) msg('AD Auth: failed to change the password. Maybe the password policy was not met?',-1);
|
||||
}
|
||||
|
||||
// changing user data
|
||||
$adchanges = array();
|
||||
if(isset($changes['name'])){
|
||||
// get first and last name
|
||||
$parts = explode(' ',$changes['name']);
|
||||
$adchanges['surname'] = array_pop($parts);
|
||||
$adchanges['firstname'] = join(' ',$parts);
|
||||
$adchanges['display_name'] = $changes['name'];
|
||||
}
|
||||
if(isset($changes['mail'])){
|
||||
$adchanges['email'] = $changes['mail'];
|
||||
}
|
||||
try {
|
||||
$return = $return & $this->adldap->user_modify($user,$adchanges);
|
||||
} catch (adLDAPException $e) {
|
||||
if ($this->cnf['debug']) msg('AD Auth: '.$e->getMessage(), -1);
|
||||
$return = false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the AdLDAP library and connect to the server
|
||||
*/
|
||||
|
@ -261,7 +311,7 @@ class auth_ad extends auth_basic {
|
|||
return true;
|
||||
} catch (adLDAPException $e) {
|
||||
if ($this->cnf['debug']) {
|
||||
msg($e->getMessage(), -1);
|
||||
msg('AD Auth: '.$e->getMessage(), -1);
|
||||
}
|
||||
$this->success = false;
|
||||
$this->adldap = null;
|
||||
|
@ -296,4 +346,4 @@ class auth_ad extends auth_basic {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -400,4 +400,4 @@ class auth_basic {
|
|||
}
|
||||
|
||||
}
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -222,12 +222,12 @@ class auth_ldap extends auth_basic {
|
|||
$base = $this->_makeFilter($this->cnf['grouptree'], $user_result);
|
||||
$filter = $this->_makeFilter($this->cnf['groupfilter'], $user_result);
|
||||
$sr = $this->_ldapsearch($this->con, $base, $filter, $this->cnf['groupscope'], array($this->cnf['groupkey']));
|
||||
if($this->cnf['debug']){
|
||||
msg('LDAP group search: '.htmlspecialchars(ldap_error($this->con)),0,__LINE__,__FILE__);
|
||||
msg('LDAP search at: '.htmlspecialchars($base.' '.$filter),0,__LINE__,__FILE__);
|
||||
}
|
||||
if(!$sr){
|
||||
msg("LDAP: Reading group memberships failed",-1);
|
||||
if($this->cnf['debug']){
|
||||
msg('LDAP group search: '.htmlspecialchars(ldap_error($this->con)),0,__LINE__,__FILE__);
|
||||
msg('LDAP search at: '.htmlspecialchars($base.' '.$filter),0,__LINE__,__FILE__);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$result = ldap_get_entries($this->con, $sr);
|
||||
|
@ -457,4 +457,4 @@ class auth_ldap extends auth_basic {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -46,7 +46,7 @@ class auth_mysql extends auth_basic {
|
|||
|
||||
// set capabilities based upon config strings set
|
||||
if (empty($this->cnf['server']) || empty($this->cnf['user']) ||
|
||||
empty($this->cnf['password']) || empty($this->cnf['database'])){
|
||||
!isset($this->cnf['password']) || empty($this->cnf['database'])){
|
||||
if ($this->cnf['debug'])
|
||||
msg("MySQL err: insufficient configuration.",-1,__LINE__,__FILE__);
|
||||
$this->success = false;
|
||||
|
@ -936,4 +936,4 @@ class auth_mysql extends auth_basic {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -407,4 +407,4 @@ class auth_pgsql extends auth_mysql {
|
|||
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -325,4 +325,4 @@ class auth_plain extends auth_basic {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -197,18 +197,6 @@ class cache_parser extends cache {
|
|||
}
|
||||
|
||||
class cache_renderer extends cache_parser {
|
||||
|
||||
function useCache($depends=array()) {
|
||||
$use = parent::useCache($depends);
|
||||
|
||||
// meta data needs to be kept in step with the cache
|
||||
if (!$use && isset($this->page)) {
|
||||
p_set_metadata($this->page,array(),true);
|
||||
}
|
||||
|
||||
return $use;
|
||||
}
|
||||
|
||||
function _useCache() {
|
||||
global $conf;
|
||||
|
||||
|
@ -251,19 +239,12 @@ class cache_renderer extends cache_parser {
|
|||
if (isset($this->page)) {
|
||||
|
||||
$metafile = metaFN($this->page,'.meta');
|
||||
if (@file_exists($metafile)) {
|
||||
$files[] = $metafile; // ... the page's own metadata
|
||||
$files[] = DOKU_INC.'inc/parser/metadata.php'; // ... the metadata renderer
|
||||
$files[] = $metafile; // ... the page's own metadata
|
||||
|
||||
$valid = p_get_metadata($this->page, 'date valid');
|
||||
if (!empty($valid['age'])) {
|
||||
$this->depends['age'] = isset($this->depends['age']) ?
|
||||
min($this->depends['age'],$valid['age']) : $valid['age'];
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->depends['purge'] = true; // ... purging cache will generate metadata
|
||||
return;
|
||||
$valid = p_get_metadata($this->page, 'date valid'); // for xhtml this will render the metadata if needed
|
||||
if (!empty($valid['age'])) {
|
||||
$this->depends['age'] = isset($this->depends['age']) ?
|
||||
min($this->depends['age'],$valid['age']) : $valid['age'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,15 @@ function parseChangelogLine($line) {
|
|||
/**
|
||||
* Add's an entry to the changelog and saves the metadata for the page
|
||||
*
|
||||
* @param int $date Timestamp of the change
|
||||
* @param String $id Name of the affected page
|
||||
* @param String $type Type of the change see DOKU_CHANGE_TYPE_*
|
||||
* @param String $summary Summary of the change
|
||||
* @param mixed $extra In case of a revert the revision (timestmp) of the reverted page
|
||||
* @param array $flags Additional flags in a key value array.
|
||||
* Availible flags:
|
||||
* - ExternalEdit - mark as an external edit.
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @author Esther Brunner <wikidesign@gmail.com>
|
||||
* @author Ben Coburn <btcoburn@silicodon.net>
|
||||
|
@ -75,7 +84,10 @@ function addLogEntry($date, $id, $type=DOKU_CHANGE_TYPE_EDIT, $summary='', $extr
|
|||
$meta = array();
|
||||
if (!$INFO['exists'] && empty($oldmeta['persistent']['date']['created'])){ // newly created
|
||||
$meta['date']['created'] = $created;
|
||||
if ($user) $meta['creator'] = $INFO['userinfo']['name'];
|
||||
if ($user){
|
||||
$meta['creator'] = $INFO['userinfo']['name'];
|
||||
$meta['user'] = $user;
|
||||
}
|
||||
} elseif (!$INFO['exists'] && !empty($oldmeta['persistent']['date']['created'])) { // re-created / restored
|
||||
$meta['date']['created'] = $oldmeta['persistent']['date']['created'];
|
||||
$meta['date']['modified'] = $created; // use the files ctime here
|
||||
|
|
|
@ -242,13 +242,16 @@ function buildURLparams($params, $sep='&'){
|
|||
*/
|
||||
function buildAttributes($params,$skipempty=false){
|
||||
$url = '';
|
||||
$white = false;
|
||||
foreach($params as $key => $val){
|
||||
if($key{0} == '_') continue;
|
||||
if($val === '' && $skipempty) continue;
|
||||
if($white) $url .= ' ';
|
||||
|
||||
$url .= $key.'="';
|
||||
$url .= htmlspecialchars ($val);
|
||||
$url .= '" ';
|
||||
$url .= '"';
|
||||
$white = true;
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
@ -636,7 +639,7 @@ function clientIP($single=false){
|
|||
// decide which IP to use, trying to avoid local addresses
|
||||
$ip = array_reverse($ip);
|
||||
foreach($ip as $i){
|
||||
if(preg_match('/^(127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)/',$i)){
|
||||
if(preg_match('/^(::1|[fF][eE]80:|127\.|10\.|192\.168\.|172\.((1[6-9])|(2[0-9])|(3[0-1]))\.)/',$i)){
|
||||
continue;
|
||||
}else{
|
||||
return $i;
|
||||
|
@ -801,7 +804,7 @@ function rawWiki($id,$rev=''){
|
|||
/**
|
||||
* Returns the pagetemplate contents for the ID's namespace
|
||||
*
|
||||
* @triggers COMMON_PAGE_FROMTEMPLATE
|
||||
* @triggers COMMON_PAGETPL_LOAD
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
function pageTemplate($id){
|
||||
|
@ -809,29 +812,50 @@ function pageTemplate($id){
|
|||
|
||||
if (is_array($id)) $id = $id[0];
|
||||
|
||||
$path = dirname(wikiFN($id));
|
||||
$tpl = '';
|
||||
if(@file_exists($path.'/_template.txt')){
|
||||
$tpl = io_readFile($path.'/_template.txt');
|
||||
}else{
|
||||
// search upper namespaces for templates
|
||||
$len = strlen(rtrim($conf['datadir'],'/'));
|
||||
while (strlen($path) >= $len){
|
||||
if(@file_exists($path.'/__template.txt')){
|
||||
$tpl = io_readFile($path.'/__template.txt');
|
||||
break;
|
||||
// prepare initial event data
|
||||
$data = array(
|
||||
'id' => $id, // the id of the page to be created
|
||||
'tpl' => '', // the text used as template
|
||||
'tplfile' => '', // the file above text was/should be loaded from
|
||||
'doreplace' => true // should wildcard replacements be done on the text?
|
||||
);
|
||||
|
||||
$evt = new Doku_Event('COMMON_PAGETPL_LOAD',$data);
|
||||
if($evt->advise_before(true)){
|
||||
// the before event might have loaded the content already
|
||||
if(empty($data['tpl'])){
|
||||
// if the before event did not set a template file, try to find one
|
||||
if(empty($data['tplfile'])){
|
||||
$path = dirname(wikiFN($id));
|
||||
$tpl = '';
|
||||
if(@file_exists($path.'/_template.txt')){
|
||||
$data['tplfile'] = $path.'/_template.txt';
|
||||
}else{
|
||||
// search upper namespaces for templates
|
||||
$len = strlen(rtrim($conf['datadir'],'/'));
|
||||
while (strlen($path) >= $len){
|
||||
if(@file_exists($path.'/__template.txt')){
|
||||
$data['tplfile'] = $path.'/__template.txt';
|
||||
break;
|
||||
}
|
||||
$path = substr($path, 0, strrpos($path, '/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
$path = substr($path, 0, strrpos($path, '/'));
|
||||
// load the content
|
||||
$data['tpl'] = io_readFile($data['tplfile']);
|
||||
}
|
||||
if($data['doreplace']) parsePageTemplate(&$data);
|
||||
}
|
||||
$data = compact('tpl', 'id');
|
||||
trigger_event('COMMON_PAGE_FROMTEMPLATE', $data, 'parsePageTemplate', true);
|
||||
$evt->advise_after();
|
||||
unset($evt);
|
||||
|
||||
return $data['tpl'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs common page template replacements
|
||||
* This is the default action for COMMON_PAGE_FROMTEMPLATE
|
||||
* This works on data from COMMON_PAGETPL_LOAD
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
|
@ -843,7 +867,7 @@ function parsePageTemplate(&$data) {
|
|||
|
||||
// replace placeholders
|
||||
$file = noNS($id);
|
||||
$page = strtr($file,'_',' ');
|
||||
$page = strtr($file, $conf['sepchar'], ' ');
|
||||
|
||||
$tpl = str_replace(array(
|
||||
'@ID@',
|
||||
|
@ -1128,18 +1152,16 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){
|
|||
$diff = rawWiki($id);
|
||||
}
|
||||
$text = str_replace('@DIFF@',$diff,$text);
|
||||
if(utf8_strlen($conf['title']) < 20) {
|
||||
$subject = '['.$conf['title'].'] '.$subject;
|
||||
if(empty($conf['mailprefix'])) {
|
||||
if(utf8_strlen($conf['title']) < 20) {
|
||||
$subject = '['.$conf['title'].'] '.$subject;
|
||||
}else{
|
||||
$subject = '['.utf8_substr($conf['title'], 0, 20).'...] '.$subject;
|
||||
}
|
||||
}else{
|
||||
$subject = '['.utf8_substr($conf['title'], 0, 20).'...] '.$subject;
|
||||
$subject = '['.$conf['mailprefix'].'] '.$subject;
|
||||
}
|
||||
|
||||
$from = $conf['mailfrom'];
|
||||
$from = str_replace('@USER@',$_SERVER['REMOTE_USER'],$from);
|
||||
$from = str_replace('@NAME@',$INFO['userinfo']['name'],$from);
|
||||
$from = str_replace('@MAIL@',$INFO['userinfo']['mail'],$from);
|
||||
|
||||
mail_send($to,$subject,$text,$from,'',$bcc);
|
||||
mail_send($to,$subject,$text,$conf['mailfrom'],'',$bcc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1270,6 +1292,21 @@ function dformat($dt=null,$format=''){
|
|||
return strftime($format,$dt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a timestamp as ISO 8601 date
|
||||
*
|
||||
* @author <ungu at terong dot com>
|
||||
* @link http://www.php.net/manual/en/function.date.php#54072
|
||||
*/
|
||||
function date_iso8601($int_date) {
|
||||
//$int_date: current date in UNIX timestamp
|
||||
$date_mod = date('Y-m-d\TH:i:s', $int_date);
|
||||
$pre_timezone = date('O', $int_date);
|
||||
$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2);
|
||||
$date_mod .= $time_zone;
|
||||
return $date_mod;
|
||||
}
|
||||
|
||||
/**
|
||||
* return an obfuscated email address in line with $conf['mailguard'] setting
|
||||
*
|
||||
|
@ -1528,4 +1565,4 @@ function valid_input_set($param, $valid_values, $array, $exc = '') {
|
|||
}
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=2 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=2 :
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* This array configures the default locations of various files in the
|
||||
* DokuWiki directory hierarchy. It can be overriden in inc/preload.php
|
||||
*/
|
||||
$config_cascade = array(
|
||||
$config_cascade = array_merge(
|
||||
array(
|
||||
'main' => array(
|
||||
'default' => array(DOKU_CONF.'dokuwiki.php'),
|
||||
'local' => array(DOKU_CONF.'local.php'),
|
||||
|
@ -48,10 +49,11 @@ $config_cascade = array(
|
|||
'local' => array(DOKU_CONF.'wordblock.local.conf'),
|
||||
),
|
||||
'userstyle' => array(
|
||||
'default' => DOKU_CONF.'userstyle.css',
|
||||
'print' => DOKU_CONF.'printstyle.css',
|
||||
'feed' => DOKU_CONF.'feedstyle.css',
|
||||
'all' => DOKU_CONF.'allstyle.css',
|
||||
'screen' => DOKU_CONF.'userstyle.css',
|
||||
'rtl' => DOKU_CONF.'userrtl.css',
|
||||
'print' => DOKU_CONF.'userprint.css',
|
||||
'feed' => DOKU_CONF.'userfeed.css',
|
||||
'all' => DOKU_CONF.'userall.css',
|
||||
),
|
||||
'userscript' => array(
|
||||
'default' => DOKU_CONF.'userscript.js'
|
||||
|
@ -62,5 +64,7 @@ $config_cascade = array(
|
|||
'plainauth.users' => array(
|
||||
'default' => DOKU_CONF.'users.auth.php',
|
||||
),
|
||||
),
|
||||
$config_cascade
|
||||
);
|
||||
|
||||
|
|
|
@ -241,17 +241,24 @@ function actionOK($action){
|
|||
// prepare disabled actions array and handle legacy options
|
||||
$disabled = explode(',',$conf['disableactions']);
|
||||
$disabled = array_map('trim',$disabled);
|
||||
if(isset($conf['openregister']) && !$conf['openregister']) $disabled[] = 'register';
|
||||
if(isset($conf['resendpasswd']) && !$conf['resendpasswd']) $disabled[] = 'resendpwd';
|
||||
if(isset($conf['subscribers']) && !$conf['subscribers']) {
|
||||
$disabled[] = 'subscribe';
|
||||
}
|
||||
if (is_null($auth) || !$auth->canDo('addUser')) {
|
||||
if((isset($conf['openregister']) && !$conf['openregister']) || is_null($auth) || !$auth->canDo('addUser')) {
|
||||
$disabled[] = 'register';
|
||||
}
|
||||
if (is_null($auth) || !$auth->canDo('modPass')) {
|
||||
if((isset($conf['resendpasswd']) && !$conf['resendpasswd']) || is_null($auth) || !$auth->canDo('modPass')) {
|
||||
$disabled[] = 'resendpwd';
|
||||
}
|
||||
if((isset($conf['subscribers']) && !$conf['subscribers']) || is_null($auth)) {
|
||||
$disabled[] = 'subscribe';
|
||||
}
|
||||
if (is_null($auth) || !$auth->canDo('Profile')) {
|
||||
$disabled[] = 'profile';
|
||||
}
|
||||
if (is_null($auth)) {
|
||||
$disabled[] = 'login';
|
||||
}
|
||||
if (is_null($auth) || !$auth->canDo('logout')) {
|
||||
$disabled[] = 'logout';
|
||||
}
|
||||
$disabled = array_unique($disabled);
|
||||
}
|
||||
|
||||
|
@ -324,4 +331,4 @@ function conf_decodeString($str) {
|
|||
return $str;
|
||||
}
|
||||
}
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
|
@ -50,11 +50,11 @@
|
|||
* added a switch to select an external stylesheet (thanks to Pascal Van Hecke)
|
||||
* changed default content-type to application/xml
|
||||
* added character encoding setting
|
||||
* fixed numerous smaller bugs (thanks to Sören Fuhrmann of golem.de)
|
||||
* fixed numerous smaller bugs (thanks to Sören Fuhrmann of golem.de)
|
||||
* improved changing ATOM versions handling (thanks to August Trometer)
|
||||
* improved the UniversalFeedCreator's useCached method (thanks to Sören Fuhrmann of golem.de)
|
||||
* added charset output in HTTP headers (thanks to Sören Fuhrmann of golem.de)
|
||||
* added Slashdot namespace to RSS 1.0 (thanks to Sören Fuhrmann of golem.de)
|
||||
* improved the UniversalFeedCreator's useCached method (thanks to Sören Fuhrmann of golem.de)
|
||||
* added charset output in HTTP headers (thanks to Sören Fuhrmann of golem.de)
|
||||
* added Slashdot namespace to RSS 1.0 (thanks to Sören Fuhrmann of golem.de)
|
||||
*
|
||||
* See www.bitfolge.de for additional changelog info
|
||||
*/
|
||||
|
@ -1577,4 +1577,4 @@ class DokuWikiFeedCreator extends UniversalFeedCreator{
|
|||
|
||||
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
20
inc/form.php
20
inc/form.php
|
@ -252,7 +252,7 @@ class Doku_Form {
|
|||
global $lang;
|
||||
$form = '';
|
||||
$this->params['accept-charset'] = $lang['encoding'];
|
||||
$form .= '<form ' . html_attbuild($this->params) . '><div class="no">' . DOKU_LF;
|
||||
$form .= '<form ' . buildAttributes($this->params,true) . '><div class="no">' . DOKU_LF;
|
||||
if (!empty($this->_hidden)) {
|
||||
foreach ($this->_hidden as $name=>$value)
|
||||
$form .= form_hidden(array('name'=>$name, 'value'=>$value));
|
||||
|
@ -597,7 +597,7 @@ function form_makeListboxField($name, $values, $selected='', $label=null, $id=''
|
|||
* @author Tom N Harris <tnharris@whoopdedo.org>
|
||||
*/
|
||||
function form_tag($attrs) {
|
||||
return '<'.$attrs['_tag'].' '.buildAttributes($attrs).'/>';
|
||||
return '<'.$attrs['_tag'].' '.buildAttributes($attrs,true).'/>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -696,7 +696,7 @@ function form_wikitext($attrs) {
|
|||
*/
|
||||
function form_button($attrs) {
|
||||
$p = (!empty($attrs['_action'])) ? 'name="do['.$attrs['_action'].']" ' : '';
|
||||
return '<input '.$p.buildAttributes($attrs,true).'/>';
|
||||
return '<input '.$p.buildAttributes($attrs,true).' />';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -714,7 +714,7 @@ function form_field($attrs) {
|
|||
if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
|
||||
if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
|
||||
$s .= '><span>'.$attrs['_text'].'</span>';
|
||||
$s .= ' <input '.buildAttributes($attrs,true).'/></label>';
|
||||
$s .= ' <input '.buildAttributes($attrs,true).' /></label>';
|
||||
if (preg_match('/(^| )block($| )/', $attrs['_class']))
|
||||
$s .= '<br />';
|
||||
return $s;
|
||||
|
@ -734,7 +734,7 @@ function form_fieldright($attrs) {
|
|||
$s = '<label';
|
||||
if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
|
||||
if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
|
||||
$s .= '><input '.buildAttributes($attrs,true).'/>';
|
||||
$s .= '><input '.buildAttributes($attrs,true).' />';
|
||||
$s .= ' <span>'.$attrs['_text'].'</span></label>';
|
||||
if (preg_match('/(^| )block($| )/', $attrs['_class']))
|
||||
$s .= '<br />';
|
||||
|
@ -758,7 +758,7 @@ function form_textfield($attrs) {
|
|||
if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
|
||||
if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
|
||||
$s .= '><span>'.$attrs['_text'].'</span> ';
|
||||
$s .= '<input type="text" '.buildAttributes($attrs,true).'/></label>';
|
||||
$s .= '<input type="text" '.buildAttributes($attrs,true).' /></label>';
|
||||
if (preg_match('/(^| )block($| )/', $attrs['_class']))
|
||||
$s .= '<br />';
|
||||
return $s;
|
||||
|
@ -781,7 +781,7 @@ function form_passwordfield($attrs) {
|
|||
if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
|
||||
if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
|
||||
$s .= '><span>'.$attrs['_text'].'</span> ';
|
||||
$s .= '<input type="password" '.buildAttributes($attrs,true).'/></label>';
|
||||
$s .= '<input type="password" '.buildAttributes($attrs,true).' /></label>';
|
||||
if (preg_match('/(^| )block($| )/', $attrs['_class']))
|
||||
$s .= '<br />';
|
||||
return $s;
|
||||
|
@ -807,7 +807,7 @@ function form_filefield($attrs) {
|
|||
$s .= '<input type="file" '.buildAttributes($attrs,true);
|
||||
if (!empty($attrs['_maxlength'])) $s .= ' maxlength="'.$attrs['_maxlength'].'"';
|
||||
if (!empty($attrs['_accept'])) $s .= ' accept="'.$attrs['_accept'].'"';
|
||||
$s .= '/></label>';
|
||||
$s .= ' /></label>';
|
||||
if (preg_match('/(^| )block($| )/', $attrs['_class']))
|
||||
$s .= '<br />';
|
||||
return $s;
|
||||
|
@ -837,7 +837,7 @@ function form_checkboxfield($attrs) {
|
|||
. ' value="' . hsc($attrs['value'][1]) . '" />';
|
||||
$attrs['value'] = $attrs['value'][0];
|
||||
}
|
||||
$s .= '<input type="checkbox" '.buildAttributes($attrs,true).'/>';
|
||||
$s .= '<input type="checkbox" '.buildAttributes($attrs,true).' />';
|
||||
$s .= ' <span>'.$attrs['_text'].'</span></label>';
|
||||
if (preg_match('/(^| )block($| )/', $attrs['_class']))
|
||||
$s .= '<br />';
|
||||
|
@ -860,7 +860,7 @@ function form_radiofield($attrs) {
|
|||
$s = '<label';
|
||||
if ($attrs['_class']) $s .= ' class="'.$attrs['_class'].'"';
|
||||
if (!empty($attrs['id'])) $s .= ' for="'.$attrs['id'].'"';
|
||||
$s .= '><input type="radio" '.buildAttributes($attrs,true).'/>';
|
||||
$s .= '><input type="radio" '.buildAttributes($attrs,true).' />';
|
||||
$s .= ' <span>'.$attrs['_text'].'</span></label>';
|
||||
if (preg_match('/(^| )block($| )/', $attrs['_class']))
|
||||
$s .= '<br />';
|
||||
|
|
100
inc/fulltext.php
100
inc/fulltext.php
|
@ -36,19 +36,21 @@ function ft_pageSearch($query,&$highlight){
|
|||
* @author Kazutaka Miyasaka <kazmiya@gmail.com>
|
||||
*/
|
||||
function _ft_pageSearch(&$data) {
|
||||
$Indexer = idx_get_indexer();
|
||||
|
||||
// parse the given query
|
||||
$q = ft_queryParser($data['query']);
|
||||
$q = ft_queryParser($Indexer, $data['query']);
|
||||
$data['highlight'] = $q['highlight'];
|
||||
|
||||
if (empty($q['parsed_ary'])) return array();
|
||||
|
||||
// lookup all words found in the query
|
||||
$lookup = idx_lookup($q['words']);
|
||||
$lookup = $Indexer->lookup($q['words']);
|
||||
|
||||
// get all pages in this dokuwiki site (!: includes nonexistent pages)
|
||||
$pages_all = array();
|
||||
foreach (idx_getIndex('page', '') as $id) {
|
||||
$pages_all[trim($id)] = 0; // base: 0 hit
|
||||
foreach ($Indexer->getPages() as $id) {
|
||||
$pages_all[$id] = 0; // base: 0 hit
|
||||
}
|
||||
|
||||
// process the query
|
||||
|
@ -122,29 +124,12 @@ function _ft_pageSearch(&$data) {
|
|||
/**
|
||||
* Returns the backlinks for a given page
|
||||
*
|
||||
* Does a quick lookup with the fulltext index, then
|
||||
* evaluates the instructions of the found pages
|
||||
* Uses the metadata index.
|
||||
*/
|
||||
function ft_backlinks($id){
|
||||
global $conf;
|
||||
$swfile = DOKU_INC.'inc/lang/'.$conf['lang'].'/stopwords.txt';
|
||||
$stopwords = @file_exists($swfile) ? file($swfile) : array();
|
||||
|
||||
$result = array();
|
||||
|
||||
// quick lookup of the pagename
|
||||
$page = noNS($id);
|
||||
$matches = idx_lookup(idx_tokenizer($page,$stopwords)); // pagename may contain specials (_ or .)
|
||||
$docs = array_keys(ft_resultCombine(array_values($matches)));
|
||||
$docs = array_filter($docs,'isVisiblePage'); // discard hidden pages
|
||||
if(!count($docs)) return $result;
|
||||
|
||||
// check metadata for matching links
|
||||
foreach($docs as $match){
|
||||
// metadata relation reference links are already resolved
|
||||
$links = p_get_metadata($match,'relation references');
|
||||
if (isset($links[$id])) $result[] = $match;
|
||||
}
|
||||
$result = idx_get_indexer()->lookupKey('relation_references', $id);
|
||||
|
||||
if(!count($result)) return $result;
|
||||
|
||||
|
@ -168,17 +153,14 @@ function ft_backlinks($id){
|
|||
* Aborts after $max found results
|
||||
*/
|
||||
function ft_mediause($id,$max){
|
||||
global $conf;
|
||||
$swfile = DOKU_INC.'inc/lang/'.$conf['lang'].'/stopwords.txt';
|
||||
$stopwords = @file_exists($swfile) ? file($swfile) : array();
|
||||
|
||||
if(!$max) $max = 1; // need to find at least one
|
||||
|
||||
$result = array();
|
||||
|
||||
// quick lookup of the mediafile
|
||||
// FIXME use metadata key lookup
|
||||
$media = noNS($id);
|
||||
$matches = idx_lookup(idx_tokenizer($media,$stopwords));
|
||||
$matches = idx_lookup(idx_tokenizer($media));
|
||||
$docs = array_keys(ft_resultCombine(array_values($matches)));
|
||||
if(!count($docs)) return $result;
|
||||
|
||||
|
@ -238,24 +220,32 @@ function _ft_pageLookup(&$data){
|
|||
|
||||
$in_ns = $data['in_ns'];
|
||||
$in_title = $data['in_title'];
|
||||
|
||||
$pages = array_map('rtrim', idx_getIndex('page', ''));
|
||||
$titles = array_map('rtrim', idx_getIndex('title', ''));
|
||||
$pages = array_combine($pages, $titles);
|
||||
|
||||
$cleaned = cleanID($id);
|
||||
|
||||
$Indexer = idx_get_indexer();
|
||||
$page_idx = $Indexer->getPages();
|
||||
|
||||
$pages = array();
|
||||
if ($id !== '' && $cleaned !== '') {
|
||||
foreach ($pages as $p_id => $p_title) {
|
||||
if ((strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) === false) &&
|
||||
(!$in_title || (stripos($p_title, $id) === false)) ) {
|
||||
unset($pages[$p_id]);
|
||||
foreach ($page_idx as $p_id) {
|
||||
if ((strpos($in_ns ? $p_id : noNSorNS($p_id), $cleaned) !== false)) {
|
||||
if (!isset($pages[$p_id]))
|
||||
$pages[$p_id] = p_get_first_heading($p_id, false);
|
||||
}
|
||||
}
|
||||
if ($in_title) {
|
||||
$wildcard_id = "*$id*";
|
||||
foreach ($Indexer->lookupKey('title', $wildcard_id) as $p_id) {
|
||||
if (!isset($pages[$p_id]))
|
||||
$pages[$p_id] = p_get_first_heading($p_id, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($ns)) {
|
||||
foreach (array_keys($pages) as $p_id) {
|
||||
if (strpos($p_id, $ns) !== 0) {
|
||||
unset($pages[$p_id]);
|
||||
foreach ($page_idx as $p_id) {
|
||||
if (strpos($p_id, $ns) === 0) {
|
||||
if (!isset($pages[$p_id]))
|
||||
$pages[$p_id] = p_get_first_heading($p_id, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +260,7 @@ function _ft_pageLookup(&$data){
|
|||
}
|
||||
}
|
||||
|
||||
uasort($pages,'ft_pagesorter');
|
||||
uksort($pages,'ft_pagesorter');
|
||||
return $pages;
|
||||
}
|
||||
|
||||
|
@ -298,6 +288,7 @@ function ft_pagesorter($a, $b){
|
|||
*/
|
||||
function ft_snippet($id,$highlight){
|
||||
$text = rawWiki($id);
|
||||
$text = str_replace("\xC2\xAD",'',$text); // remove soft-hyphens
|
||||
$evdata = array(
|
||||
'id' => $id,
|
||||
'text' => &$text,
|
||||
|
@ -390,6 +381,11 @@ function ft_snippet($id,$highlight){
|
|||
* Wraps a search term in regex boundary checks.
|
||||
*/
|
||||
function ft_snippet_re_preprocess($term) {
|
||||
// do not process asian terms where word boundaries are not explicit
|
||||
if(preg_match('/'.IDX_ASIAN.'/u',$term)){
|
||||
return $term;
|
||||
}
|
||||
|
||||
if(substr($term,0,2) == '\\*'){
|
||||
$term = substr($term,2);
|
||||
}else{
|
||||
|
@ -488,11 +484,7 @@ function ft_resultComplement($args) {
|
|||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @author Kazutaka Miyasaka <kazmiya@gmail.com>
|
||||
*/
|
||||
function ft_queryParser($query){
|
||||
global $conf;
|
||||
$swfile = DOKU_INC.'inc/lang/'.$conf['lang'].'/stopwords.txt';
|
||||
$stopwords = @file_exists($swfile) ? file($swfile) : array();
|
||||
|
||||
function ft_queryParser($Indexer, $query){
|
||||
/**
|
||||
* parse a search query and transform it into intermediate representation
|
||||
*
|
||||
|
@ -538,7 +530,7 @@ function ft_queryParser($query){
|
|||
if (preg_match('/^(-?)"(.+)"$/u', $term, $matches)) {
|
||||
// phrase-include and phrase-exclude
|
||||
$not = $matches[1] ? 'NOT' : '';
|
||||
$parsed = $not.ft_termParser($matches[2], $stopwords, false, true);
|
||||
$parsed = $not.ft_termParser($Indexer, $matches[2], false, true);
|
||||
} else {
|
||||
// fix incomplete phrase
|
||||
$term = str_replace('"', ' ', $term);
|
||||
|
@ -585,10 +577,10 @@ function ft_queryParser($query){
|
|||
$parsed .= '(N+:'.$matches[1].')';
|
||||
} elseif (preg_match('/^-(.+)$/', $token, $matches)) {
|
||||
// word-exclude
|
||||
$parsed .= 'NOT('.ft_termParser($matches[1], $stopwords).')';
|
||||
$parsed .= 'NOT('.ft_termParser($Indexer, $matches[1]).')';
|
||||
} else {
|
||||
// word-include
|
||||
$parsed .= ft_termParser($token, $stopwords);
|
||||
$parsed .= ft_termParser($Indexer, $token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -722,18 +714,18 @@ function ft_queryParser($query){
|
|||
*
|
||||
* @author Kazutaka Miyasaka <kazmiya@gmail.com>
|
||||
*/
|
||||
function ft_termParser($term, &$stopwords, $consider_asian = true, $phrase_mode = false) {
|
||||
function ft_termParser($Indexer, $term, $consider_asian = true, $phrase_mode = false) {
|
||||
$parsed = '';
|
||||
if ($consider_asian) {
|
||||
// successive asian characters need to be searched as a phrase
|
||||
$words = preg_split('/('.IDX_ASIAN.'+)/u', $term, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
foreach ($words as $word) {
|
||||
if (preg_match('/'.IDX_ASIAN.'/u', $word)) $phrase_mode = true;
|
||||
$parsed .= ft_termParser($word, $stopwords, false, $phrase_mode);
|
||||
$phrase_mode = $phrase_mode ? true : preg_match('/'.IDX_ASIAN.'/u', $word);
|
||||
$parsed .= ft_termParser($Indexer, $word, false, $phrase_mode);
|
||||
}
|
||||
} else {
|
||||
$term_noparen = str_replace(array('(', ')'), ' ', $term);
|
||||
$words = idx_tokenizer($term_noparen, $stopwords, true);
|
||||
$words = $Indexer->tokenizer($term_noparen, true);
|
||||
|
||||
// W_: no need to highlight
|
||||
if (empty($words)) {
|
||||
|
@ -750,4 +742,4 @@ function ft_termParser($term, &$stopwords, $consider_asian = true, $phrase_mode
|
|||
return $parsed;
|
||||
}
|
||||
|
||||
//Setup VIM: ex: et ts=4 enc=utf-8 :
|
||||
//Setup VIM: ex: et ts=4 :
|
||||
|
|
100
inc/html.php
100
inc/html.php
|
@ -26,6 +26,7 @@ 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){
|
||||
|
@ -61,17 +62,11 @@ function html_login(){
|
|||
$form->endFieldset();
|
||||
|
||||
if(actionOK('register')){
|
||||
$form->addElement('<p>'
|
||||
. $lang['reghere']
|
||||
. ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>'
|
||||
. '</p>');
|
||||
$form->addElement('<p>'.$lang['reghere'].': '.tpl_actionlink('register','','','',true).'</p>');
|
||||
}
|
||||
|
||||
if (actionOK('resendpwd')) {
|
||||
$form->addElement('<p>'
|
||||
. $lang['pwdforget']
|
||||
. ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>'
|
||||
. '</p>');
|
||||
$form->addElement('<p>'.$lang['pwdforget'].': '.tpl_actionlink('resendpwd','','','',true).'</p>');
|
||||
}
|
||||
|
||||
html_form('login', $form);
|
||||
|
@ -162,11 +157,12 @@ function html_topbtn(){
|
|||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
function html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){
|
||||
function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false){
|
||||
global $conf;
|
||||
global $lang;
|
||||
|
||||
$label = $lang['btn_'.$name];
|
||||
if (!$label)
|
||||
$label = $lang['btn_'.$name];
|
||||
|
||||
$ret = '';
|
||||
$tip = '';
|
||||
|
@ -288,7 +284,8 @@ function html_hilight($html,$phrases){
|
|||
$regex = join('|',array_map('ft_snippet_re_preprocess', array_map('preg_quote_cb',$phrases)));
|
||||
|
||||
if ($regex === '') return $html;
|
||||
$html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);
|
||||
if (!utf8_check($regex)) return $html;
|
||||
$html = @preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
@ -316,7 +313,13 @@ function html_search(){
|
|||
global $ID;
|
||||
global $lang;
|
||||
|
||||
print p_locale_xhtml('searchpage');
|
||||
$intro = p_locale_xhtml('searchpage');
|
||||
// allow use of placeholder in search intro
|
||||
$intro = str_replace(
|
||||
array('@QUERY@','@SEARCH@'),
|
||||
array(hsc(rawurlencode($QUERY)),hsc($QUERY)),
|
||||
$intro);
|
||||
echo $intro;
|
||||
flush();
|
||||
|
||||
//show progressbar
|
||||
|
@ -862,13 +865,18 @@ function html_backlinks(){
|
|||
* show diff
|
||||
*
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
* @param string $text - compare with this text with most current version
|
||||
* @param bool $intr - display the intro text
|
||||
*/
|
||||
function html_diff($text='',$intro=true){
|
||||
function html_diff($text='',$intro=true,$type=null){
|
||||
global $ID;
|
||||
global $REV;
|
||||
global $lang;
|
||||
global $conf;
|
||||
|
||||
if(!$type) $type = $_REQUEST['difftype'];
|
||||
if($type != 'inline') $type = 'sidebyside';
|
||||
|
||||
// we're trying to be clever here, revisions to compare can be either
|
||||
// given as rev and rev2 parameters, with rev2 being optional. Or in an
|
||||
// array in rev2.
|
||||
|
@ -886,6 +894,9 @@ function html_diff($text='',$intro=true){
|
|||
$rev2 = (int) $_REQUEST['rev2'];
|
||||
}
|
||||
|
||||
$r_minor = '';
|
||||
$l_minor = '';
|
||||
|
||||
if($text){ // compare text to the most current revision
|
||||
$l_rev = '';
|
||||
$l_text = rawWiki($ID,'');
|
||||
|
@ -982,17 +993,48 @@ function html_diff($text='',$intro=true){
|
|||
$df = new Diff(explode("\n",htmlspecialchars($l_text)),
|
||||
explode("\n",htmlspecialchars($r_text)));
|
||||
|
||||
$tdf = new TableDiffFormatter();
|
||||
if($type == 'inline'){
|
||||
$tdf = new InlineDiffFormatter();
|
||||
} else {
|
||||
$tdf = new TableDiffFormatter();
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($intro) print p_locale_xhtml('diff');
|
||||
|
||||
if (!$text) {
|
||||
$diffurl = wl($ID, array('do'=>'diff', 'rev2[0]'=>$l_rev, 'rev2[1]'=>$r_rev));
|
||||
ptln('<p class="difflink">');
|
||||
ptln(' <a class="wikilink1" href="'.$diffurl.'">'.$lang['difflink'].'</a>');
|
||||
|
||||
$form = new Doku_Form(array('action'=>wl()));
|
||||
$form->addHidden('id',$ID);
|
||||
$form->addHidden('rev2[0]',$l_rev);
|
||||
$form->addHidden('rev2[1]',$r_rev);
|
||||
$form->addHidden('do','diff');
|
||||
$form->addElement(form_makeListboxField(
|
||||
'difftype',
|
||||
array(
|
||||
'sidebyside' => $lang['diff_side'],
|
||||
'inline' => $lang['diff_inline']),
|
||||
$type,
|
||||
$lang['diff_type'],
|
||||
'','',
|
||||
array('class'=>'quickselect')));
|
||||
$form->addElement(form_makeButton('submit', 'diff','Go'));
|
||||
$form->printForm();
|
||||
|
||||
|
||||
$diffurl = wl($ID, array(
|
||||
'do' => 'diff',
|
||||
'rev2[0]' => $l_rev,
|
||||
'rev2[1]' => $r_rev,
|
||||
'difftype' => $type,
|
||||
));
|
||||
ptln('<br /><a class="wikilink1" href="'.$diffurl.'">'.$lang['difflink'].'</a>');
|
||||
ptln('</p>');
|
||||
}
|
||||
?>
|
||||
<table class="diff">
|
||||
<table class="diff diff_<?php echo $type?>">
|
||||
<tr>
|
||||
<th colspan="2" <?php echo $l_minor?>>
|
||||
<?php echo $l_head?>
|
||||
|
@ -1032,7 +1074,10 @@ function html_conflict($text,$summary){
|
|||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
*/
|
||||
function html_msgarea(){
|
||||
global $MSG;
|
||||
global $MSG, $MSG_shown;
|
||||
// store if the global $MSG has already been shown and thus HTML output has been started
|
||||
$MSG_shown = true;
|
||||
|
||||
if(!isset($MSG)) return;
|
||||
|
||||
$shown = array();
|
||||
|
@ -1044,6 +1089,8 @@ function html_msgarea(){
|
|||
print '</div>';
|
||||
$shown[$hash] = 1;
|
||||
}
|
||||
|
||||
unset($GLOBALS['MSG']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1059,7 +1106,7 @@ function html_register(){
|
|||
print p_locale_xhtml('register');
|
||||
print '<div class="centeralign">'.NL;
|
||||
$form = new Doku_Form(array('id' => 'dw__register'));
|
||||
$form->startFieldset($lang['register']);
|
||||
$form->startFieldset($lang['btn_register']);
|
||||
$form->addHidden('do', 'register');
|
||||
$form->addHidden('save', '1');
|
||||
$form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], null, 'block', array('size'=>'50')));
|
||||
|
@ -1069,7 +1116,7 @@ function html_register(){
|
|||
}
|
||||
$form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', array('size'=>'50')));
|
||||
$form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', array('size'=>'50')));
|
||||
$form->addElement(form_makeButton('submit', '', $lang['register']));
|
||||
$form->addElement(form_makeButton('submit', '', $lang['btn_register']));
|
||||
$form->endFieldset();
|
||||
html_form('register', $form);
|
||||
|
||||
|
@ -1212,9 +1259,9 @@ function html_edit(){
|
|||
if($wr && $conf['license']){
|
||||
$form->addElement(form_makeOpenTag('div', array('class'=>'license')));
|
||||
$out = $lang['licenseok'];
|
||||
$out .= '<a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"';
|
||||
$out .= ' <a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"';
|
||||
if(isset($conf['target']['extern'])) $out .= ' target="'.$conf['target']['extern'].'"';
|
||||
$out .= '> '.$license[$conf['license']]['name'].'</a>';
|
||||
$out .= '>'.$license[$conf['license']]['name'].'</a>';
|
||||
$form->addElement($out);
|
||||
$form->addElement(form_makeCloseTag('div'));
|
||||
}
|
||||
|
@ -1388,10 +1435,11 @@ function html_admin(){
|
|||
}
|
||||
|
||||
// data security check
|
||||
echo '<a style="background: transparent url(data/security.png) left top no-repeat;
|
||||
display: block; width:380px; height:73px; border:none; float:right"
|
||||
target="_blank"
|
||||
href="http://www.dokuwiki.org/security#web_access_security"></a>';
|
||||
// @todo: could be checked and only displayed if $conf['savedir'] is under the web root
|
||||
echo '<a style="border:none; float:right;" target="_blank"
|
||||
href="http://www.dokuwiki.org/security#web_access_security">
|
||||
<img src="data/security.png" alt="Your data directory seems to be protected properly."
|
||||
onerror="this.parentNode.style.display=\'none\'" /></a>';
|
||||
|
||||
print p_locale_xhtml('admin');
|
||||
|
||||
|
|
1817
inc/indexer.php
1817
inc/indexer.php
File diff suppressed because it is too large
Load Diff
|
@ -258,7 +258,7 @@ function check(){
|
|||
* @see html_msgarea
|
||||
*/
|
||||
function msg($message,$lvl=0,$line='',$file=''){
|
||||
global $MSG;
|
||||
global $MSG, $MSG_shown;
|
||||
$errors[-1] = 'error';
|
||||
$errors[0] = 'info';
|
||||
$errors[1] = 'success';
|
||||
|
@ -268,7 +268,7 @@ function msg($message,$lvl=0,$line='',$file=''){
|
|||
|
||||
if(!isset($MSG)) $MSG = array();
|
||||
$MSG[]=array('lvl' => $errors[$lvl], 'msg' => $message);
|
||||
if(headers_sent()){
|
||||
if(isset($MSG_shown) || headers_sent()){
|
||||
if(function_exists('html_msgarea')){
|
||||
html_msgarea();
|
||||
}else{
|
||||
|
|
83
inc/init.php
83
inc/init.php
|
@ -5,13 +5,12 @@
|
|||
|
||||
// start timing Dokuwiki execution
|
||||
function delta_time($start=0) {
|
||||
list($usec, $sec) = explode(" ", microtime());
|
||||
return ((float)$usec+(float)$sec)-((float)$start);
|
||||
return microtime(true)-((float)$start);
|
||||
}
|
||||
define('DOKU_START_TIME', delta_time());
|
||||
|
||||
global $config_cascade;
|
||||
$config_cascade = '';
|
||||
$config_cascade = array();
|
||||
|
||||
// if available load a preload config file
|
||||
$preload = fullpath(dirname(__FILE__)).'/preload.php';
|
||||
|
@ -52,10 +51,9 @@ global $cache_authname;
|
|||
global $cache_metadata;
|
||||
$cache_metadata = array();
|
||||
|
||||
//set the configuration cascade - but only if its not already been set in preload.php
|
||||
if (empty($config_cascade)) {
|
||||
include(DOKU_INC.'inc/config_cascade.php');
|
||||
}
|
||||
// always include 'inc/config_cascade.php'
|
||||
// previously in preload.php set fields of $config_cascade will be merged with the defaults
|
||||
include(DOKU_INC.'inc/config_cascade.php');
|
||||
|
||||
//prepare config array()
|
||||
global $conf;
|
||||
|
@ -200,10 +198,6 @@ init_creationmodes();
|
|||
init_paths();
|
||||
init_files();
|
||||
|
||||
// automatic upgrade to script versions of certain files
|
||||
scriptify(DOKU_CONF.'users.auth');
|
||||
scriptify(DOKU_CONF.'acl.auth');
|
||||
|
||||
// setup plugin controller class (can be overwritten in preload.php)
|
||||
$plugin_types = array('admin','syntax','action','renderer', 'helper');
|
||||
global $plugin_controller_class, $plugin_controller;
|
||||
|
@ -224,6 +218,9 @@ if (!defined('NOSESSION')) {
|
|||
auth_setup();
|
||||
}
|
||||
|
||||
// setup mail system
|
||||
mail_setup();
|
||||
|
||||
/**
|
||||
* Checks paths from config file
|
||||
*/
|
||||
|
@ -277,6 +274,7 @@ function init_files(){
|
|||
}
|
||||
|
||||
# create title index (needs to have same length as page.idx)
|
||||
/*
|
||||
$file = $conf['indexdir'].'/title.idx';
|
||||
if(!@file_exists($file)){
|
||||
$pages = file($conf['indexdir'].'/page.idx');
|
||||
|
@ -291,6 +289,7 @@ function init_files(){
|
|||
nice_die("$file is not writable. Check your permissions settings!");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -420,14 +419,27 @@ function getBaseURL($abs=null){
|
|||
if($conf['baseurl']) return rtrim($conf['baseurl'],'/').$dir;
|
||||
|
||||
//split hostheader into host and port
|
||||
$addr = explode(':',$_SERVER['HTTP_HOST']);
|
||||
$host = $addr[0];
|
||||
$port = '';
|
||||
if (isset($addr[1])) {
|
||||
$port = $addr[1];
|
||||
} elseif (isset($_SERVER['SERVER_PORT'])) {
|
||||
if(isset($_SERVER['HTTP_HOST'])){
|
||||
$parsed_host = parse_url('http://'.$_SERVER['HTTP_HOST']);
|
||||
$host = $parsed_host['host'];
|
||||
$port = $parsed_host['port'];
|
||||
}elseif(isset($_SERVER['SERVER_NAME'])){
|
||||
$parsed_host = parse_url('http://'.$_SERVER['SERVER_NAME']);
|
||||
$host = $parsed_host['host'];
|
||||
$port = $parsed_host['port'];
|
||||
}else{
|
||||
$host = php_uname('n');
|
||||
$port = '';
|
||||
}
|
||||
|
||||
if(!$port && isset($_SERVER['SERVER_PORT'])) {
|
||||
$port = $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
|
||||
if(is_null($port)){
|
||||
$port = '';
|
||||
}
|
||||
|
||||
if(!is_ssl()){
|
||||
$proto = 'http://';
|
||||
if ($port == '80') {
|
||||
|
@ -462,43 +474,6 @@ function is_ssl(){
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a PHP extension to a given file and adds an exit call
|
||||
*
|
||||
* This is used to migrate some old configfiles. An added PHP extension
|
||||
* ensures the contents are not shown to webusers even if .htaccess files
|
||||
* do not work
|
||||
*
|
||||
* @author Jan Decaluwe <jan@jandecaluwe.com>
|
||||
*/
|
||||
function scriptify($file) {
|
||||
// checks
|
||||
if (!is_readable($file)) {
|
||||
return;
|
||||
}
|
||||
$fn = $file.'.php';
|
||||
if (@file_exists($fn)) {
|
||||
return;
|
||||
}
|
||||
$fh = fopen($fn, 'w');
|
||||
if (!$fh) {
|
||||
nice_die($fn.' is not writable. Check your permission settings!');
|
||||
}
|
||||
// write php exit hack first
|
||||
fwrite($fh, "# $fn\n");
|
||||
fwrite($fh, '# <?php exit()?>'."\n");
|
||||
fwrite($fh, "# Don't modify the lines above\n");
|
||||
fwrite($fh, "#\n");
|
||||
// copy existing lines
|
||||
$lines = file($file);
|
||||
foreach ($lines as $line){
|
||||
fwrite($fh, $line);
|
||||
}
|
||||
fclose($fh);
|
||||
//try to rename the old file
|
||||
io_rename($file,"$file.old");
|
||||
}
|
||||
|
||||
/**
|
||||
* print a nice message even if no styles are loaded yet.
|
||||
*/
|
||||
|
|
25
inc/io.php
25
inc/io.php
|
@ -486,7 +486,7 @@ function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=20
|
|||
preg_match('/attachment;\s*filename\s*=\s*"([^"]*)"/i', $content_disposition, $match)) {
|
||||
|
||||
$name = basename($match[1]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ function io_rename($from,$to){
|
|||
|
||||
|
||||
/**
|
||||
* Runs an external command and returns it's output as string
|
||||
* Runs an external command and returns its output as string
|
||||
*
|
||||
* @author Harry Brueckner <harry_b@eml.cc>
|
||||
* @author Andreas Gohr <andi@splitbrain.org>
|
||||
|
@ -546,6 +546,27 @@ function io_runcmd($cmd){
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs an external command with input and output pipes.
|
||||
* Returns the exit code from the process.
|
||||
*
|
||||
* @author Tom N Harris <tnharris@whoopdedo.org>
|
||||
*/
|
||||
function io_exec($cmd, $input, &$output){
|
||||
$descspec = array(
|
||||
0=>array("pipe","r"),
|
||||
1=>array("pipe","w"),
|
||||
2=>array("pipe","w"));
|
||||
$ph = proc_open($cmd, $descspec, $pipes);
|
||||
if(!$ph) return -1;
|
||||
fclose($pipes[2]); // ignore stderr
|
||||
fwrite($pipes[0], $input);
|
||||
fclose($pipes[0]);
|
||||
$output = stream_get_contents($pipes[1]);
|
||||
fclose($pipes[1]);
|
||||
return proc_close($ph);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search a file for matching lines
|
||||
*
|
||||
|
|
|
@ -26,6 +26,7 @@ $lang['btn_backlink'] = 'Wat skakel hierheen';
|
|||
$lang['btn_subscribe'] = 'Hou bladsy dop';
|
||||
$lang['btn_unsubscribe'] = 'Verwyder van bladsy dophoulys';
|
||||
$lang['btn_resendpwd'] = 'E-pos nuwe wagwoord';
|
||||
$lang['btn_register'] = 'Skep gerus \'n rekening';
|
||||
$lang['loggedinas'] = 'Ingeteken as';
|
||||
$lang['user'] = 'Gebruikernaam';
|
||||
$lang['pass'] = 'Wagwoord';
|
||||
|
@ -35,7 +36,6 @@ $lang['passchk'] = 'Herhaal wagwoord';
|
|||
$lang['remember'] = 'Onthou my wagwoord oor sessies';
|
||||
$lang['fullname'] = 'Regte naam';
|
||||
$lang['email'] = 'E-pos';
|
||||
$lang['register'] = 'Skep gerus \'n rekening';
|
||||
$lang['badlogin'] = 'Intekenfout';
|
||||
$lang['minoredit'] = 'Klein wysiging';
|
||||
$lang['reguexists'] = 'Die gebruikersnaam wat jy gebruik het, is alreeds gebruik. Kies asseblief \'n ander gebruikersnaam.';
|
||||
|
|
|
@ -28,7 +28,7 @@ $lang['btn_revs'] = 'نسخ قديمة';
|
|||
$lang['btn_recent'] = 'أحدث التغييرات';
|
||||
$lang['btn_upload'] = 'ارفع';
|
||||
$lang['btn_cancel'] = 'ألغ';
|
||||
$lang['btn_index'] = 'فهرس';
|
||||
$lang['btn_index'] = 'خريطة موقع';
|
||||
$lang['btn_secedit'] = 'حرر';
|
||||
$lang['btn_login'] = 'لج';
|
||||
$lang['btn_logout'] = 'اخرج';
|
||||
|
@ -45,8 +45,8 @@ $lang['btn_resendpwd'] = 'ارسل كلمة سر جديدة';
|
|||
$lang['btn_draft'] = 'حرر المسودة';
|
||||
$lang['btn_recover'] = 'استرجع المسودة';
|
||||
$lang['btn_draftdel'] = 'احذف المسوّدة';
|
||||
$lang['btn_revert'] = 'استعد
|
||||
';
|
||||
$lang['btn_revert'] = 'استعد';
|
||||
$lang['btn_register'] = 'سجّل';
|
||||
$lang['loggedinas'] = 'داخل باسم';
|
||||
$lang['user'] = 'اسم المستخدم';
|
||||
$lang['pass'] = 'كلمة السر';
|
||||
|
@ -54,21 +54,20 @@ $lang['newpass'] = 'كلمة سر جديدة';
|
|||
$lang['oldpass'] = 'أكد كلمة السر الحالية';
|
||||
$lang['passchk'] = 'مرة أخرى';
|
||||
$lang['remember'] = 'تذكرني';
|
||||
$lang['fullname'] = 'الاسم الكامل';
|
||||
$lang['fullname'] = 'الاسم الحقيقي';
|
||||
$lang['email'] = 'البريد الإلكتروني';
|
||||
$lang['register'] = 'سجّل';
|
||||
$lang['profile'] = 'الملف الشخصي';
|
||||
$lang['badlogin'] = 'عذرا، اسم المشترك أو كلمة السر غير صحيحة';
|
||||
$lang['minoredit'] = 'تعديلات طفيفة';
|
||||
$lang['draftdate'] = 'حفظ المسودات تلقائيا مشغل';
|
||||
$lang['nosecedit'] = 'غُيرت الصفحة في هذه الأثناء، معلومات الفقرة اصبحت قديمة. حُمُلت كل الصفحة بدلا.';
|
||||
$lang['regmissing'] = 'عذرا، يجب ملء جميع الحقول';
|
||||
$lang['draftdate'] = 'حفظ المسودات آليا مفعّل';
|
||||
$lang['nosecedit'] = 'غُيرت الصفحة في هذه الأثناء، معلومات الجزء اصبحت قديمة. حُمُلت كل الصفحة بدلا.';
|
||||
$lang['regmissing'] = 'عذرا، عليك ملء جميع الحقول.';
|
||||
$lang['reguexists'] = 'عذرا، يوجد مشترك بنفس الاسم.';
|
||||
$lang['regsuccess'] = 'أنشئ المستخدم و ارسلت كلمة السر بالبريد.';
|
||||
$lang['regsuccess2'] = 'أنشئ المستخدم.';
|
||||
$lang['regmailfail'] = 'حدث خطأ فى إرسال رسالة كلمة اسرر. يرجى مراسلة المدير';
|
||||
$lang['regbadmail'] = 'يبدو البريد الإلكتروني المعطى غير صحيح، إن كنت تظن أن هذا خطأ، راسل المدير';
|
||||
$lang['regbadpass'] = 'كلمتى المرور غير متطابقتين، حاول مرة أخرى.';
|
||||
$lang['regmailfail'] = 'حدث خطأ فى إرسال رسالة كلمة السر. يرجى مراسلة المدير!';
|
||||
$lang['regbadmail'] = 'يبدو البريد الإلكتروني المعطى غيرَ صحيح، إن كنت تظن أن هذا خطأ، راسل المدير';
|
||||
$lang['regbadpass'] = 'كلمتا المرور غير متطابقتين، حاول مرة أخرى.';
|
||||
$lang['regpwmail'] = 'كلمة مرورك إلى دوكو ويكي';
|
||||
$lang['reghere'] = 'ليس لديك حساب بعد؟ احصل على واحد';
|
||||
$lang['profna'] = 'هذه الويكي لا تدعم تعديل الملف الشخصي';
|
||||
|
@ -81,35 +80,35 @@ $lang['resendpwd'] = 'إرسال كلمة مرور';
|
|||
$lang['resendpwdmissing'] = 'عذراّ، يجب أن تملأ كل الحقول.';
|
||||
$lang['resendpwdnouser'] = 'عذراً، لم نجد المستخدم هذا في قاعدة بياناتنا.';
|
||||
$lang['resendpwdbadauth'] = 'عذراً، رمز التفعيل هذا غير صحيح. نأكد من استخدامك كامل وصلة التأكيد.';
|
||||
$lang['resendpwdconfirm'] = 'أرسل رابط التأكيد بواسطة البريد.';
|
||||
$lang['resendpwdsuccess'] = 'كلمة السرالجديدة إرسلت عبر البريد.';
|
||||
$lang['license'] = 'مالم يشر لخلاف ذلك، فإن المحتوى على هذه الويكي مرخص وفق الرخصة التالية:';
|
||||
$lang['resendpwdconfirm'] = 'اُرسل رابط التأكيد بواسطة البريد.';
|
||||
$lang['resendpwdsuccess'] = 'كلمة السرالجديدة اُرسلت عبر البريد.';
|
||||
$lang['license'] = 'مالم يشر لخلاف ذلك، فإن المحتوى في هذه الويكي مرخص وفق الرخصة التالية:';
|
||||
$lang['licenseok'] = 'لاحظ: بتحرير هذه الصفحة أنت توافق على ترخيص محتواها تحت الرخصة التالية:';
|
||||
$lang['searchmedia'] = 'ابحث في اسماء الملفات:';
|
||||
$lang['searchmedia'] = 'ابحث في أسماء الملفات:';
|
||||
$lang['searchmedia_in'] = 'ابحث في %s';
|
||||
$lang['txt_upload'] = 'اختر ملفاً للرفع';
|
||||
$lang['txt_filename'] = 'رفع كـ (اختياري)';
|
||||
$lang['txt_overwrt'] = 'اكتب على ملف موجود';
|
||||
$lang['lockedby'] = 'حالياً مقفل بواسطة';
|
||||
$lang['lockedby'] = 'مقفلة حاليا لـ';
|
||||
$lang['lockexpire'] = 'ينتهي القفل في';
|
||||
$lang['willexpire'] = 'سينتهي قفل تحرير هذه الصفحه خلال دقيقة.\nلتجنب التعارض استخدم زر المعاينة لتصفير مؤقت القفل.';
|
||||
$lang['js']['notsavedyet'] = 'التعديلات غير المحفوظة ستفقد. اكمل فعلا؟';
|
||||
$lang['js']['notsavedyet'] = 'التعديلات غير المحفوظة ستفقد.';
|
||||
$lang['js']['searchmedia'] = 'ابحث عن ملفات';
|
||||
$lang['js']['keepopen'] = 'أبقي النافذة مفتوحة أثناء الاختيار';
|
||||
$lang['js']['hidedetails'] = 'أخف التفاصيل';
|
||||
$lang['js']['mediatitle'] = 'اعدادات الرابط';
|
||||
$lang['js']['mediatitle'] = 'إعدادات الرابط';
|
||||
$lang['js']['mediadisplay'] = 'نوع الرابط';
|
||||
$lang['js']['mediaalign'] = 'المحاذاة';
|
||||
$lang['js']['mediasize'] = 'حجم الصورة';
|
||||
$lang['js']['mediatarget'] = 'هدف الرابط';
|
||||
$lang['js']['mediaclose'] = 'اغلق';
|
||||
$lang['js']['mediaclose'] = 'أغلق';
|
||||
$lang['js']['mediainsert'] = 'أدرج';
|
||||
$lang['js']['mediadisplayimg'] = 'اظهر الصورة.';
|
||||
$lang['js']['mediadisplayimg'] = 'أظهر الصورة.';
|
||||
$lang['js']['mediadisplaylnk'] = 'اظهر الرابط فقط.';
|
||||
$lang['js']['mediasmall'] = 'نسخة مصغرة';
|
||||
$lang['js']['mediamedium'] = 'نسخة متوسطة';
|
||||
$lang['js']['medialarge'] = 'نسخة كبيرة';
|
||||
$lang['js']['mediaoriginal'] = 'نسخة أصلية';
|
||||
$lang['js']['mediaoriginal'] = 'النسخة الأصلية';
|
||||
$lang['js']['medialnk'] = 'الرابط لصفحة التفاصيل';
|
||||
$lang['js']['mediadirect'] = 'رابط مباشر للأصل';
|
||||
$lang['js']['medianolnk'] = 'لا رابط';
|
||||
|
@ -118,70 +117,73 @@ $lang['js']['medialeft'] = 'حاذي الصورة إلى اليسار.';
|
|||
$lang['js']['mediaright'] = 'حاذي الصورة إلى اليمين.';
|
||||
$lang['js']['mediacenter'] = 'حاذي الصورة إلى الوسط.';
|
||||
$lang['js']['medianoalign'] = 'لا تستعمل المحاذاة.';
|
||||
$lang['js']['nosmblinks'] = 'الروابط لمجلدات ويندوز المشاركة تعمل فقط مع متصفح مايكروسفت Internet Explorer. ما زال بإمكانك قص و لصق الرابط.';
|
||||
$lang['js']['nosmblinks'] = 'الروابط لمجلدات مشاركة وندز تعمل فقط مع متصفح مايكروسفت Internet Explorer.
|
||||
ما زال بإمكانك قص و لصق الرابط.';
|
||||
$lang['js']['linkwiz'] = 'مرشد الروابط';
|
||||
$lang['js']['linkto'] = 'الرابط إلى :';
|
||||
$lang['js']['del_confirm'] = 'هل حقاً تريد حذف البنود المختارة؟';
|
||||
$lang['js']['mu_btn'] = 'رفع عدة ملفات في وقت واحد';
|
||||
$lang['rssfailed'] = 'خطأ ما حدث أثناء جلب ملف التغذية:';
|
||||
$lang['nothingfound'] = 'لا يوجد شيء';
|
||||
$lang['mediaselect'] = 'ملفات الوسائط المتعددة';
|
||||
$lang['fileupload'] = 'تحميل ملف وسائط متعددة';
|
||||
$lang['uploadsucc'] = 'تم التحميل بنجاح';
|
||||
$lang['uploadfail'] = 'فشل التحميل، قد يكون الخطأ فى التراخيص؟';
|
||||
$lang['uploadwrong'] = 'التحميل ممنوع، نوع الملف مرفوض!';
|
||||
$lang['uploadexist'] = 'الملف موجود أصلاً. لم يحدث شيء';
|
||||
$lang['uploadbadcontent'] = 'المحتوى المحمّل لم يتطابق مع نوع الملف %s';
|
||||
$lang['uploadspam'] = 'التحميل محجوب بواسطة القائمة السوداء لبرنامج تقفي التطفل';
|
||||
$lang['uploadxss'] = 'التحميل محجوب لمنع المحتويات الخبيثة';
|
||||
$lang['uploadsize'] = 'الملف الذي تم رفعه كبير جدا . ( الحد الأقصى %s )';
|
||||
$lang['deletesucc'] = 'تم حذف الملف "%s"';
|
||||
$lang['deletefail'] = 'لا يمكن حذف "%s"، تأكد من تراخيصك';
|
||||
$lang['mediainuse'] = 'لم يحذف الملف "%s"، مازال موجوداً';
|
||||
$lang['mediaselect'] = 'ملفات الوسائط';
|
||||
$lang['fileupload'] = 'تحميل ملف وسائط';
|
||||
$lang['uploadsucc'] = 'تم الرفع بنجاح';
|
||||
$lang['uploadfail'] = 'فشل الرفع، ربما خطأ تراخيص؟';
|
||||
$lang['uploadwrong'] = 'الرفع ممنوع، نوع الملف مرفوض!';
|
||||
$lang['uploadexist'] = 'الملف موجود أصلاً. لم يُعمل شيئ.';
|
||||
$lang['uploadbadcontent'] = 'المحتوى المرفوع لم يطابق لاحقة ملفات %s.';
|
||||
$lang['uploadspam'] = 'الرفع محجوب بواسطة القائمة السوداء لبرنامج تقفي التطفل.';
|
||||
$lang['uploadxss'] = 'رُفض الرفع للإشتباه بمحتوى ضار.';
|
||||
$lang['uploadsize'] = 'الملف المرفوع كان كبيرا جدا . ( الحد %s )';
|
||||
$lang['deletesucc'] = 'حُذف الملف "%s".';
|
||||
$lang['deletefail'] = 'تعذر حذف "%s" - تأكد من الصلاحيات.';
|
||||
$lang['mediainuse'] = 'لم يحذف الملف "%s" - مازال مستخدما.';
|
||||
$lang['namespaces'] = 'فضاء التسمية';
|
||||
$lang['mediafiles'] = 'ملفات موجودة في';
|
||||
$lang['accessdenied'] = 'لا يسمح لك برؤية هذه الصفحة.';
|
||||
$lang['mediausage'] = 'استخدم هذه الصياغة للدلالة على هذا الملف:';
|
||||
$lang['mediaview'] = 'عرض الملف الأصلي';
|
||||
$lang['mediaview'] = 'اعرض الملف الأصلي';
|
||||
$lang['mediaroot'] = 'الجذر';
|
||||
$lang['mediaupload'] = 'تحميل ملف إلى فضاء التسمية هنا. لإنشاء فضاءات تسمية فرعية، أضفها إلى بداية خانة تحميل باسم وافصل بينها باستخدام الفواصل';
|
||||
$lang['mediaextchange'] = 'تم تغيير نوع الملف من .%s إلى .%s!';
|
||||
$lang['mediaupload'] = 'تحميل ملف إلى فضاء التسمية هنا. لإنشاء فضاءات تسمية فرعية، أضفها إلى بداية خانة تحميل باسم وافصل بينها باستخدام الفاصلتان الرأسيتان.';
|
||||
$lang['mediaextchange'] = 'غُيرت لاحقة الملف من .%s إلى .%s!';
|
||||
$lang['reference'] = 'مراجع لـ';
|
||||
$lang['ref_inuse'] = 'لا يمكن حذف الملف، لأنه مستخدم من قبل الصفحات التالية:';
|
||||
$lang['ref_hidden'] = 'بعض المراجع لصفاحات لا تملك ترخيص برؤيتها';
|
||||
$lang['hits'] = 'زوار';
|
||||
$lang['quickhits'] = 'صفحات بهذا الاسم';
|
||||
$lang['ref_hidden'] = 'بعض المراجع على صفحات لا تملك صلاحيات قراءتها';
|
||||
$lang['hits'] = 'مرة';
|
||||
$lang['quickhits'] = 'صفحات مطابقة';
|
||||
$lang['toc'] = 'جدول المحتويات';
|
||||
$lang['current'] = 'حالي';
|
||||
$lang['yours'] = 'نسختك';
|
||||
$lang['diff'] = 'مقارنة بالنسخة الحالية';
|
||||
$lang['diff2'] = 'مقارنة بين النسخ المختارة';
|
||||
$lang['diff'] = 'أظهر الاختلافات مع النسخة الحالية';
|
||||
$lang['diff2'] = 'أظهر الاختلافات بين النسخ المحددة';
|
||||
$lang['difflink'] = 'رابط إلى هذه المقارنة';
|
||||
$lang['line'] = 'سطر';
|
||||
$lang['breadcrumb'] = 'أثر';
|
||||
$lang['youarehere'] = 'أنت هنا';
|
||||
$lang['lastmod'] = 'آخر تعديل';
|
||||
$lang['by'] = 'بواسطة';
|
||||
$lang['deleted'] = 'تم حذف';
|
||||
$lang['created'] = 'تم إنشاء';
|
||||
$lang['restored'] = 'عودة لنسخة قديمة';
|
||||
$lang['deleted'] = 'حذفت';
|
||||
$lang['created'] = 'اُنشئت';
|
||||
$lang['restored'] = 'استعيدت نسخة قديمة';
|
||||
$lang['external_edit'] = 'تحرير خارجي';
|
||||
$lang['summary'] = 'ملخص التحرير';
|
||||
$lang['noflash'] = 'تحتاج إلى<a href="http://www.adobe.com/products/flashplayer/">ملحق فلاش أدوبي</a> لعرض هذا المحتوى.';
|
||||
$lang['download'] = 'نزل Snippet';
|
||||
$lang['mail_newpage'] = 'إضافة صفحة:';
|
||||
$lang['mail_changed'] = 'تعديل صفحة:';
|
||||
$lang['mail_subscribe_list'] = 'صفحات غيرت في النظاق:';
|
||||
$lang['mail_new_user'] = 'مشترك جديد';
|
||||
$lang['mail_upload'] = 'تحميل ملف:';
|
||||
$lang['mail_subscribe_list'] = 'صفحات غيرت في النطاق:';
|
||||
$lang['mail_new_user'] = 'مشترك جديد:';
|
||||
$lang['mail_upload'] = 'رفع ملف:';
|
||||
$lang['qb_bold'] = 'نص عريض';
|
||||
$lang['qb_italic'] = 'نص مائل';
|
||||
$lang['qb_underl'] = 'نص مسطر';
|
||||
$lang['qb_code'] = 'نص برمجي';
|
||||
$lang['qb_strike'] = 'نص مشطوب';
|
||||
$lang['qb_h1'] = 'عنوان مستوى أول';
|
||||
$lang['qb_h2'] = 'عنوان مستوى ثاني';
|
||||
$lang['qb_h3'] = 'عنوان مستوى ثالث';
|
||||
$lang['qb_h4'] = 'عنوان مستوى رابع';
|
||||
$lang['qb_h5'] = 'عنوان مستوى خامس';
|
||||
$lang['qb_h1'] = 'عنوان مستوى ١';
|
||||
$lang['qb_h2'] = 'عنوان مستوى ٢';
|
||||
$lang['qb_h3'] = 'عنوان مستوى ٣';
|
||||
$lang['qb_h4'] = 'عنوان مستوى ٤';
|
||||
$lang['qb_h5'] = 'عنوان مستوى ٥';
|
||||
$lang['qb_h'] = 'الترويسة';
|
||||
$lang['qb_hs'] = 'حدد الترويسة';
|
||||
$lang['qb_hplus'] = 'ترويسة أعلى';
|
||||
|
@ -192,29 +194,29 @@ $lang['qb_extlink'] = 'رابط خارجي';
|
|||
$lang['qb_hr'] = 'سطر أفقي';
|
||||
$lang['qb_ol'] = 'بند فى قائمة مرتبة';
|
||||
$lang['qb_ul'] = 'بند فى قائمة غير مرتبة';
|
||||
$lang['qb_media'] = 'إضافة صور و ملفات أخرى';
|
||||
$lang['qb_sig'] = 'أضف توقيعك';
|
||||
$lang['qb_smileys'] = 'الابتسامات';
|
||||
$lang['qb_media'] = 'أضف صورا و ملفات أخرى';
|
||||
$lang['qb_sig'] = 'أدرج التوقيع';
|
||||
$lang['qb_smileys'] = 'الإبتسامات';
|
||||
$lang['qb_chars'] = 'محارف خاصة';
|
||||
$lang['upperns'] = 'انتقل للنطاق الأب';
|
||||
$lang['admin_register'] = 'إضافة مشترك جديد';
|
||||
$lang['admin_register'] = 'أضف مستخدما جديدا';
|
||||
$lang['metaedit'] = 'تحرير البيانات الشمولية ';
|
||||
$lang['metasaveerr'] = 'فشلت عملية كتابة البيانات الشمولية';
|
||||
$lang['metasaveok'] = 'تم حفظ البيانت الشمولية';
|
||||
$lang['img_backto'] = 'العودة إلى';
|
||||
$lang['metasaveerr'] = 'فشلت كتابة البيانات الشمولية';
|
||||
$lang['metasaveok'] = 'حُفظت البيانات الشمولية';
|
||||
$lang['img_backto'] = 'عودة إلى';
|
||||
$lang['img_title'] = 'العنوان';
|
||||
$lang['img_caption'] = 'تنويه الصورة';
|
||||
$lang['img_caption'] = 'وصف';
|
||||
$lang['img_date'] = 'التاريخ';
|
||||
$lang['img_fname'] = 'اسم الملف';
|
||||
$lang['img_fsize'] = 'الحجم';
|
||||
$lang['img_artist'] = 'المصور';
|
||||
$lang['img_copyr'] = 'حقوق النسخ';
|
||||
$lang['img_format'] = 'صيغ رسومية';
|
||||
$lang['img_camera'] = 'آلة التصوير';
|
||||
$lang['img_format'] = 'الهيئة';
|
||||
$lang['img_camera'] = 'الكمرا';
|
||||
$lang['img_keywords'] = 'كلمات مفتاحية';
|
||||
$lang['subscr_subscribe_success'] = 'اضيف %s لقائمة اشتراك %s';
|
||||
$lang['subscr_subscribe_error'] = 'خطأ في إضافة %s لقائمة اشتراك %s';
|
||||
$lang['subscr_subscribe_noaddress'] = 'ليس هناك عنوان مرتبط بدخولك، لا يمكن اضافتك لقائمة الاشتراك';
|
||||
$lang['subscr_subscribe_noaddress'] = 'ليس هناك عنوان مرتبط بولوجك، لا يمكن اضافتك لقائمة الاشتراك';
|
||||
$lang['subscr_unsubscribe_success'] = 'أزيل %s من قائمة اشتراك %s';
|
||||
$lang['subscr_unsubscribe_error'] = 'خطأ في إزالة %s من قائمة اشتراك %s';
|
||||
$lang['subscr_already_subscribed'] = '%s مشترك مسبقا في %s';
|
||||
|
@ -224,7 +226,7 @@ $lang['subscr_m_new_header'] = 'أضف اشتراكا';
|
|||
$lang['subscr_m_current_header'] = 'الاشتراكات الحالية';
|
||||
$lang['subscr_m_unsubscribe'] = 'ألغ الاشتراك';
|
||||
$lang['subscr_m_subscribe'] = 'اشترك';
|
||||
$lang['subscr_m_receive'] = 'استقبل';
|
||||
$lang['subscr_m_receive'] = 'استقبال';
|
||||
$lang['subscr_style_every'] = 'بريدا على كل تغيير';
|
||||
$lang['subscr_style_digest'] = 'بريد ملخص عن تغييرات كل صفحة';
|
||||
$lang['subscr_style_list'] = 'قائمة بالصفحات المتغيرة منذ آخر بريد';
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
أهلاً!
|
||||
|
||||
الصفحة @PAGE@ فى @TITLE@ ويكي تم تعديلها.
|
||||
ها هى التعديلات:
|
||||
|
||||
--------------------------------------------------------
|
||||
@DIFF@
|
||||
--------------------------------------------------------
|
||||
|
||||
لإلغاء إشتراكك فى تلك الصفحة أدخل على الويكي على العنوان
|
||||
@DOKUWIKIURL@ ثم أذهب الى
|
||||
@NEWPAGE@
|
||||
و أختار 'إلغاء أشتراكك'.
|
||||
|
||||
--
|
||||
تم ارسال هذه الرسالة من دوكيويكي
|
||||
@DOKUWIKIURL@
|
|
@ -5,7 +5,7 @@
|
|||
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
|
||||
* @author Pasha L. Topchiyev <pasha@itopchiyev.com>
|
||||
*/
|
||||
$lang['encoding'] = ' utf-8';
|
||||
$lang['encoding'] = 'utf-8';
|
||||
$lang['direction'] = 'ltr';
|
||||
$lang['doublequoteopening'] = '«';
|
||||
$lang['doublequoteclosing'] = '»';
|
||||
|
@ -47,6 +47,7 @@ $lang['btn_draft'] = 'Qaralamada düzəliş etmək';
|
|||
$lang['btn_recover'] = 'Qaralamanı qaytar';
|
||||
$lang['btn_draftdel'] = 'Qaralamanı sil';
|
||||
$lang['btn_revert'] = 'Qaytar';
|
||||
$lang['btn_register'] = 'Qeydiyyatdan keç';
|
||||
$lang['loggedinas'] = 'İstifadəcinin adı';
|
||||
$lang['user'] = 'istifadəci adı';
|
||||
$lang['pass'] = 'Şifrə';
|
||||
|
@ -56,7 +57,6 @@ $lang['passchk'] = 'təkrarlayın';
|
|||
$lang['remember'] = 'Məni yadda saxla';
|
||||
$lang['fullname'] = 'Tam ad';
|
||||
$lang['email'] = 'E-Mail';
|
||||
$lang['register'] = 'Qeydiyyatdan keç';
|
||||
$lang['profile'] = 'İstifadəçi profili';
|
||||
$lang['badlogin'] = 'Təssüf ki istifadəçi adı və ya şifrə səhvdir.';
|
||||
$lang['minoredit'] = 'Az dəyişiklər';
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
Salam!
|
||||
|
||||
@TITLE@ adı wiki-də @PAGE@ adlı səhifə dəyişdirilmişdi.
|
||||
Dəyişiklər aşağıda göstərilib:
|
||||
|
||||
--------------------------------------------------------
|
||||
@DIFF@
|
||||
--------------------------------------------------------
|
||||
|
||||
Bu səhifənin dəyişiklərindən imtina etmək üçün,
|
||||
@DOKUWIKIURL@ adresində yerləşən wiki-yə daxil
|
||||
olun, @NEWPAGE@ səhifəsinə keçin
|
||||
və 'Abunəlikdən çıx' düyməsini sıxın.
|
||||
|
||||
|
||||
--
|
||||
Bu məktub DokuWiki tərəfindən yaradıldı.
|
||||
DokuWiki aşağıdakı adresdə yerləşir:
|
||||
@DOKUWIKIURL@
|
|
@ -1,3 +1,3 @@
|
|||
====== Администрация ======
|
||||
====== Администриране ======
|
||||
|
||||
Долу може да намерите списък с администраторски задачи в DokuWiki.
|
||||
Отдолу ще намерите списъка с администраторските задачи в DokuWiki.
|
|
@ -1 +1 @@
|
|||
===== Допълнителни Plugins =====
|
||||
===== Допълнителни приставки =====
|
|
@ -1,3 +1,3 @@
|
|||
====== Задни връзки ======
|
||||
====== Обратни препратки ======
|
||||
|
||||
Това е списък на страници, които изглежда препращат обратно към текущата страница.
|
||||
Това е списък на страниците, които препращат обратно към текущата страница.
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue