Skip to content
Snippets Groups Projects
Commit 8da2ebf4 authored by Gerry Weißbach's avatar Gerry Weißbach
Browse files

Merge remote-tracking branch 'splitbrain/master'

parents 5e7f4d50 1bf4abb0
No related branches found
No related tags found
No related merge requests found
Showing
with 555 additions and 31 deletions
......@@ -4,14 +4,13 @@ php:
- "5.5"
- "5.4"
- "5.3"
# PHP 5.6 is not yet released, allow failures
matrix:
allow_failures:
- php: "5.6"
notifications:
irc:
channels:
- "chat.freenode.net#dokuwiki"
on_success: change
on_failure: change
script: cd _test && phpunit --verbose --stderr
install:
- wget https://phar.phpunit.de/phpunit-4.3.5.phar -O _test/phpunit
- chmod 755 _test/phpunit
script: cd _test && ./phpunit --verbose --stderr
......@@ -45,8 +45,6 @@ class TestRequest {
*/
public function execute($uri='/doku.php') {
global $INPUT;
global $ID;
global $INFO;
// save old environment
$server = $_SERVER;
......
File added
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File added
<?php
/**
* Tests for requesting revisioninfo of a revision of a page with getRevisionInfo()
*
* This class uses the files:
* - data/pages/mailinglist.txt
* - data/meta/mailinglist.changes
*/
class changelog_getlastrevisionat_test extends DokuWikiTest {
private $pageid = 'mailinglist';
function setup() {
parent::setup();
global $cache_revinfo;
$cache =& $cache_revinfo;
if(isset($cache['nonexist'])) {
unset($cache['nonexist']);
}
if(isset($cache['mailinglist'])) {
unset($cache['mailinglist']);
}
}
/**
* no nonexist.changes meta file available
*/
function test_changemetadatanotexists() {
$rev = 1362525899;
$id = 'nonexist';
$revsexpected = false;
$pagelog = new PageChangeLog($id, $chunk_size = 8192);
$revs = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($revsexpected, $revs);
}
/**
* start at exact current revision of mailinglist page
*
*/
function test_startatexactcurrentrev() {
$rev = 1385051947;
$revsexpected = '';
//set a known timestamp
touch(wikiFN($this->pageid), $rev);
$pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
$revs = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($revsexpected, $revs);
}
/**
* test a future revision
*
*/
function test_futurerev() {
$rev = 1385051947;
$revsexpected = '';
//set a known timestamp
touch(wikiFN($this->pageid), $rev);
$rev +=1;
$pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
$revs = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($revsexpected, $revs);
}
/**
* start at exact last revision of mailinglist page
*
*/
function test_exactlastrev() {
$rev = 1360110636;
$revsexpected = 1360110636;
$pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
$revs = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($revsexpected, $revs);
}
/**
* Request not existing revision
*
*/
function test_olderrev() {
$rev = 1;
$revexpected = false;
$pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
$revfound = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($revexpected, $revfound);
}
/**
* Start at non existing revision somewhere between existing revisions
*/
function test_notexistingrev() {
$rev = 1362525890;
$revexpected = 1362525359;
$pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
$revfound = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($revexpected, $revfound);
}
/**
* request nonexisting page
*
*/
function test_notexistingpage() {
$rev = 1385051947;
$currentexpected = false;
$pagelog = new PageChangeLog('nonexistingpage', $chunk_size = 8192);
$current = $pagelog->getLastRevisionAt($rev);
$this->assertEquals($currentexpected, $current);
}
}
\ No newline at end of file
......@@ -146,4 +146,15 @@ class common_ml_test extends DokuWikiTest {
$this->assertEquals($expect, ml($id, $args));
}
function test_ml_empty_rev() {
global $conf;
$conf['useslash'] = 0;
$conf['userewrite'] = 0;
$args = array('a' => 'b', 'c' => 'd', 'rev' => '');
$expect = DOKU_BASE . $this->script . '?a=b&amp;c=d&amp;media=some:img.jpg';
$this->assertEquals($expect, ml('some:img.jpg', $args));
}
}
......@@ -142,6 +142,17 @@ class common_wl_test extends DokuWikiTest {
$expect = DOKU_BASE . DOKU_SCRIPT . '/some/one?a=b&c=d';
$this->assertEquals($expect, wl('some:one', 'a=b,c=d', false, '&'));
}
function test_wl_empty_rev() {
global $conf;
$conf['useslash'] = 0;
$conf['userewrite'] = 0;
$args = array('a' => 'b', 'c' => 'd', 'rev' => '');
$expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&amp;a=b&amp;c=d';
$this->assertEquals($expect, wl('some:', $args));
}
......
<?php
class init_checkssl_test extends DokuWikiTest {
/**
* Running behind an SSL proxy, HTTP between server and proxy
* HTTPS not set
* HTTP_X_FORWARDED_PROTO
* set to https
*/
function test1() {
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
$this->assertEquals(is_ssl(), true);
}
/**
* Running behind a plain HTTP proxy, HTTP between server and proxy
* HTTPS not set
* HTTP_X_FORWARDED_PROTO set to http
*/
function test2() {
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http';
$this->assertEquals(is_ssl(), false);
}
/**
* Running behind an SSL proxy, HTTP between server and proxy
* HTTPS set to off,
* HTTP_X_FORWARDED_PROTO set to https
*/
function test3() {
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
$_SERVER['HTTPS'] = 'off';
$this->assertEquals(is_ssl(), true);
}
/**
* Not running behind a proxy, HTTPS server
* HTTPS set to on,
* HTTP_X_FORWARDED_PROTO not set
*/
function test4() {
$_SERVER['HTTPS'] = 'on';
$this->assertEquals(is_ssl(), true);
}
/**
* Not running behind a proxy, plain HTTP server
* HTTPS not set
* HTTP_X_FORWARDED_PROTO not set
*/
function test5() {
$this->assertEquals(is_ssl(), false);
}
/**
* Not running behind a proxy, plain HTTP server
* HTTPS set to off
* HTTP_X_FORWARDED_PROTO not set
*/
function test6() {
$_SERVER['HTTPS'] = 'off';
$this->assertEquals(is_ssl(), false);
}
/**
* Running behind an SSL proxy, SSL between proxy and HTTP server
* HTTPS set to on,
* HTTP_X_FORWARDED_PROTO set to https
*/
function test7() {
$_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
$_SERVER['HTTPS'] = 'on';
$this->assertEquals(is_ssl(), true);
}
}
......@@ -14,8 +14,58 @@ class input_test extends DokuWikiTest {
'empty' => '',
'emptya' => array(),
'do' => array('save' => 'Speichern'),
);
/**
* custom filter function
*
* @param $string
* @return mixed
*/
public function myfilter($string) {
$string = str_replace('foo', 'bar', $string);
$string = str_replace('baz', '', $string);
return $string;
}
public function test_filter() {
$_GET = array(
'foo' => 'foo',
'zstring'=> "foo\0bar",
'znull' => "\0",
'zint' => '42'."\0".'42',
'zintbaz'=> "baz42",
);
$_POST = $_GET;
$_REQUEST = $_GET;
$INPUT = new Input();
$filter = array($this,'myfilter');
$this->assertNotSame('foobar', $INPUT->str('zstring'));
$this->assertSame('foobar', $INPUT->filter()->str('zstring'));
$this->assertSame('bar', $INPUT->filter($filter)->str('foo'));
$this->assertSame('bar', $INPUT->filter()->str('znull', 'bar', true));
$this->assertNotSame('foobar', $INPUT->str('zstring')); // make sure original input is unmodified
$this->assertNotSame('foobar', $INPUT->get->str('zstring'));
$this->assertSame('foobar', $INPUT->get->filter()->str('zstring'));
$this->assertSame('bar', $INPUT->get->filter($filter)->str('foo'));
$this->assertSame('bar', $INPUT->get->filter()->str('znull', 'bar', true));
$this->assertNotSame('foobar', $INPUT->get->str('zstring')); // make sure original input is unmodified
$this->assertNotSame(4242, $INPUT->int('zint'));
$this->assertSame(4242, $INPUT->filter()->int('zint'));
$this->assertSame(42, $INPUT->filter($filter)->int('zintbaz'));
$this->assertSame(42, $INPUT->filter()->str('znull', 42, true));
$this->assertSame(true, $INPUT->bool('znull'));
$this->assertSame(false, $INPUT->filter()->bool('znull'));
$this->assertSame('foobar', $INPUT->filter()->valid('zstring', array('foobar', 'bang')));
}
public function test_str() {
$_REQUEST = $this->data;
$_POST = $this->data;
......
......@@ -303,7 +303,7 @@ class TestOfDoku_Parser_Footnote extends TestOfDoku_Parser {
array('nest', array ( array (
array('footnote_open',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('listcontent_close',array()),
......
......@@ -13,7 +13,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser {
$calls = array (
array('document_start',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('listcontent_close',array()),
......@@ -46,7 +46,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser {
$calls = array (
array('document_start',array()),
array('listo_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('listcontent_close',array()),
......@@ -80,7 +80,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser {
$calls = array (
array('document_start',array()),
array('listo_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('listcontent_close',array()),
......@@ -109,7 +109,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser {
$calls = array (
array('document_start',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('listcontent_close',array()),
......@@ -138,7 +138,7 @@ class TestOfDoku_Parser_Lists extends TestOfDoku_Parser {
$calls = array (
array('document_start',array()),
array('listo_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('listcontent_close',array()),
......@@ -188,7 +188,7 @@ Bar');
array('cdata',array("Foo")),
array('p_close',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('listcontent_close',array()),
......@@ -227,7 +227,7 @@ Bar');
$calls = array (
array('document_start',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('strong_open',array()),
array('cdata',array("A")),
......@@ -262,7 +262,7 @@ Bar');
$calls = array (
array('document_start',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('unformatted',array("A")),
array('listcontent_close',array()),
......@@ -291,7 +291,7 @@ Bar');
$calls = array (
array('document_start',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('cdata',array("A")),
array('linebreak',array()),
......@@ -355,7 +355,7 @@ Bar');
$calls = array (
array('document_start',array()),
array('listu_open',array()),
array('listitem_open',array(1)),
array('listitem_open',array(1,Doku_Handler_List::NODE)),
array('listcontent_open',array()),
array('nest', array( array(
array('footnote_open',array()),
......
<?php
require_once 'parser.inc.php';
/**
* Tests for the implementation of audio and video files
*
* @author Michael Große <grosse@cosmocode.de>
*/
class TestOfDoku_Parser_Media extends TestOfDoku_Parser {
function testVideoOGVExternal() {
$file = 'http://some.where.far/away.ogv';
$parser_response = p_get_instructions('{{' . $file . '}}');
$calls = array (
array('document_start',array()),
array('p_open',array()),
array('externalmedia',array($file,null,null,null,null,'cache','details')),
array('cdata',array(null)),
array('p_close',array()),
array('document_end',array()),
);
$this->assertEquals(array_map('stripbyteindex',$parser_response),$calls);
$Renderer = new Doku_Renderer_xhtml();
$url = $Renderer->externalmedia($file,null,null,null,null,'cache','details',true);
//print_r("url: " . $url);
$video = '<video class="media" width="320" height="240" controls="controls">';
$this->assertEquals(substr($url,0,66),$video);
$source = '<source src="http://some.where.far/away.ogv" type="video/ogg" />';
$this->assertEquals(substr($url,67,64),$source);
// work around random token
$a_first_part = '<a href="/./lib/exe/fetch.php?cache=&amp;tok=';
$a_second_part = '&amp;media=http%3A%2F%2Fsome.where.far%2Faway.ogv" class="media mediafile mf_ogv" title="http://some.where.far/away.ogv">';
$this->assertEquals(substr($url,132,45),$a_first_part);
$this->assertEquals(substr($url,183,121),$a_second_part);
$rest = 'away.ogv</a></video>'."\n";
$this->assertEquals(substr($url,304),$rest);
}
/**
* unknown extension of external media file
*/
function testVideoVIDExternal() {
$file = 'http://some.where.far/away.vid';
$parser_response = p_get_instructions('{{' . $file . '}}');
$calls = array(
array('document_start', array()),
array('p_open', array()),
array('externalmedia', array($file, null, null, null, null, 'cache', 'details')),
array('cdata', array(null)),
array('p_close', array()),
array('document_end', array()),
);
$this->assertEquals(array_map('stripbyteindex', $parser_response), $calls);
$Renderer = new Doku_Renderer_xhtml();
$url = $Renderer->externalmedia($file, null, null, null, null, 'cache', 'details', true);
// work around random token
$a_first_part = '<a href="/./lib/exe/fetch.php?tok=';
$a_second_part = '&amp;media=http%3A%2F%2Fsome.where.far%2Faway.vid" class="media mediafile mf_vid" title="http://some.where.far/away.vid">';
$this->assertEquals(substr($url,0,34),$a_first_part);
$this->assertEquals(substr($url,40,121),$a_second_part);
$rest = 'away.vid</a>';
$this->assertEquals(substr($url,161),$rest);
}
function testVideoOGVInternal() {
$file = 'wiki:kind_zu_katze.ogv';
$parser_response = p_get_instructions('{{' . $file . '}}');
$calls = array (
array('document_start',array()),
array('p_open',array()),
array('internalmedia',array($file,null,null,null,null,'cache','details')),
array('cdata',array(null)),
array('p_close',array()),
array('document_end',array()),
);
$this->assertEquals(array_map('stripbyteindex',$parser_response),$calls);
$Renderer = new Doku_Renderer_xhtml();
$url = $Renderer->externalmedia($file,null,null,null,null,'cache','details',true);
$video = '<video class="media" width="320" height="240" controls="controls" poster="/./lib/exe/fetch.php?media=wiki:kind_zu_katze.png">';
$this->assertEquals(substr($url,0,125),$video);
$source_webm = '<source src="/./lib/exe/fetch.php?media=wiki:kind_zu_katze.webm" type="video/webm" />';
$this->assertEquals(substr($url,126,85),$source_webm);
$source_ogv = '<source src="/./lib/exe/fetch.php?media=wiki:kind_zu_katze.ogv" type="video/ogg" />';
$this->assertEquals(substr($url,212,83),$source_ogv);
$a_webm = '<a href="/./lib/exe/fetch.php?id=&amp;cache=&amp;media=wiki:kind_zu_katze.webm" class="media mediafile mf_webm" title="wiki:kind_zu_katze.webm (99.1 KB)">kind_zu_katze.webm</a>';
$a_ogv = '<a href="/./lib/exe/fetch.php?id=&amp;cache=&amp;media=wiki:kind_zu_katze.ogv" class="media mediafile mf_ogv" title="wiki:kind_zu_katze.ogv (44.8 KB)">kind_zu_katze.ogv</a>';
$this->assertEquals(substr($url,296,176),$a_webm);
$this->assertEquals(substr($url,472,172),$a_ogv);
$rest = '</video>'."\n";
$this->assertEquals(substr($url,644),$rest);
}
}
......@@ -58,6 +58,18 @@ class js_js_compress_test extends DokuWikiTest {
$this->assertEquals(js_compress($text), 'text.replace(/"/,"//")');
}
function test_regex_after_and_with_slashes_outside_string(){
$text = 'if ( peng == bla && /pattern\//.test(url)) request = new Something();';
$this->assertEquals(js_compress($text),
'if(peng==bla&&/pattern\//.test(url))request=new Something();');
}
function test_regex_after_or_with_slashes_outside_string(){
$text = 'if ( peng == bla || /pattern\//.test(url)) request = new Something();';
$this->assertEquals(js_compress($text),
'if(peng==bla||/pattern\//.test(url))request=new Something();');
}
function test_dquot1(){
$text = 'var foo="Now what \\" \'do we//get /*here*/ ?";';
$this->assertEquals(js_compress($text), $text);
......@@ -145,6 +157,72 @@ EOF;
$this->assertEquals($out, js_compress($text));
}
function test_plusplus1(){
$text = 'a = 5 + ++b;';
$this->assertEquals('a=5+ ++b;',js_compress($text));
}
function test_plusplus2(){
$text = 'a = 5+ ++b;';
$this->assertEquals('a=5+ ++b;',js_compress($text));
}
function test_plusplus3(){
$text = 'a = 5++ + b;';
$this->assertEquals('a=5++ +b;',js_compress($text));
}
function test_plusplus4(){
$text = 'a = 5++ +b;';
$this->assertEquals('a=5++ +b;',js_compress($text));
}
function test_minusminus1(){
$text = 'a = 5 - --b;';
$this->assertEquals('a=5- --b;',js_compress($text));
}
function test_minusminus2(){
$text = 'a = 5- --b;';
$this->assertEquals('a=5- --b;',js_compress($text));
}
function test_minusminus3(){
$text = 'a = 5-- - b;';
$this->assertEquals('a=5-- -b;',js_compress($text));
}
function test_minusminus4(){
$text = 'a = 5-- -b;';
$this->assertEquals('a=5-- -b;',js_compress($text));
}
function test_minusplus1(){
$text = 'a = 5-- +b;';
$this->assertEquals('a=5--+b;',js_compress($text));
}
function test_minusplus2(){
$text = 'a = 5-- + b;';
$this->assertEquals('a=5--+b;',js_compress($text));
}
function test_plusminus1(){
$text = 'a = 5++ - b;';
$this->assertEquals('a=5++-b;',js_compress($text));
}
function test_plusminus2(){
$text = 'a = 5++ -b;';
$this->assertEquals('a=5++-b;',js_compress($text));
}
function test_unusual_signs(){
$text='var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, radians = π / 180, degrees = 180 / π;';
$this->assertEquals(js_compress($text),
'var π=Math.PI,τ=2*π,halfπ=π/2,ε=1e-6,ε2=ε*ε,radians=π/180,degrees=180/π;');
}
/**
* Test the files provided with the original JsStrip
*/
......
......@@ -101,7 +101,7 @@ class GitToolCLI extends DokuCLI {
/**
* Tries to install the given extensions using git clone
*
* @param $extensions
* @param array $extensions
*/
public function cmd_clone($extensions) {
$errors = array();
......@@ -130,7 +130,7 @@ class GitToolCLI extends DokuCLI {
/**
* Tries to install the given extensions using git clone with fallback to install
*
* @param $extensions
* @param array $extensions
*/
public function cmd_install($extensions) {
$errors = array();
......@@ -206,12 +206,13 @@ class GitToolCLI extends DokuCLI {
* Install extension from the given download URL
*
* @param string $ext
* @return bool
* @return bool|null
*/
private function downloadExtension($ext) {
/** @var helper_plugin_extension_extension $plugin */
$plugin = plugin_load('helper', 'extension_extension');
if(!$ext) die("extension plugin not available, can't continue");
$plugin->setExtension($ext);
$url = $plugin->getDownloadURL();
......@@ -291,12 +292,13 @@ class GitToolCLI extends DokuCLI {
* Returns the repository for the given extension
*
* @param $extension
* @return bool|string
* @return false|string
*/
private function getSourceRepo($extension) {
/** @var helper_plugin_extension_extension $ext */
$ext = plugin_load('helper', 'extension_extension');
if(!$ext) die("extension plugin not available, can't continue");
$ext->setExtension($extension);
$repourl = $ext->getSourcerepoURL();
......
......@@ -26,7 +26,8 @@ class StripLangsCLI extends DokuCLI {
$options->registerOption(
'keep',
'Comma separated list of languages to keep in addition to English.',
'k'
'k',
'langcodes'
);
$options->registerOption(
'english-only',
......
......@@ -61,6 +61,13 @@ class WantedPagesCLI extends DokuCLI {
}
}
/**
* Determine directions of the search loop
*
* @param string $entry
* @param string $basepath
* @return int
*/
protected function dir_filter($entry, $basepath) {
if($entry == '.' || $entry == '..') {
return WantedPagesCLI::DIR_CONTINUE;
......@@ -77,6 +84,13 @@ class WantedPagesCLI extends DokuCLI {
return WantedPagesCLI::DIR_CONTINUE;
}
/**
* Collects recursively the pages in a namespace
*
* @param string $dir
* @return array
* @throws DokuCLI_Exception
*/
protected function get_pages($dir) {
static $trunclen = null;
if(!$trunclen) {
......@@ -108,6 +122,12 @@ class WantedPagesCLI extends DokuCLI {
return $pages;
}
/**
* Parse instructions and returns the non-existing links
*
* @param array $page array with page id and file path
* @return array
*/
function internal_links($page) {
global $conf;
$instructions = p_get_instructions(file_get_contents($page['file']));
......
......@@ -9,7 +9,6 @@ gif image/gif
png image/png
ico image/vnd.microsoft.icon
swf application/x-shockwave-flash
mp3 audio/mpeg
ogg audio/ogg
wav audio/wav
......@@ -66,3 +65,7 @@ odt !application/vnd.oasis.opendocument.text
#xml text/xml
#csv text/csv
# Also flash may be able to execute arbitrary scripts in the website's
# context
#swf application/x-shockwave-flash
......@@ -56,7 +56,7 @@ $conf['plugin']['authmysql']['TablesToLock']= array("users", "users AS u","group
* of the user. If the result table is empty or contains more than one
* row, access will be denied.
*
* The plugin accesses the password as 'pass' so a alias might be necessary.
* The plugin accesses the password as 'pass' so an alias might be necessary.
*
* Following patters will be replaced:
* %{user} user name
......@@ -107,10 +107,10 @@ $conf['plugin']['authmysql']['getGroups'] = "SELECT name as `group`
/* This statement should return a table containing all user login names
* that meet certain filter criteria. The filter expressions will be added
* case dependend by the plugin. At the end a sort expression will be added.
* Important is that this list contains no double entries fo a user. Each
* Important is that this list contains no double entries for a user. Each
* user name is only allowed once in the table.
*
* The login name will be accessed as 'user' to a alias might be neseccary.
* The login name will be accessed as 'user' to an alias might be neseccary.
* No patterns will be replaced in this statement but following patters
* will be replaced in the filter expressions:
* %{user} in FilterLogin user's login name
......@@ -174,7 +174,7 @@ $conf['plugin']['authmysql']['delGroup'] = "DELETE FROM groups
WHERE gid='%{gid}'";
/* This statement should return the database index of a given user name.
* The plugin will access the index with the name 'id' so a alias might be
* The plugin will access the index with the name 'id' so an alias might be
* necessary.
* following patters will be replaced:
* %{user} user name
......@@ -240,7 +240,7 @@ $conf['plugin']['authmysql']['delUserGroup']= "DELETE FROM usergroup
AND gid='%{gid}'";
/* This statement should return the database index of a given group name.
* The plugin will access the index with the name 'id' so a alias might
* The plugin will access the index with the name 'id' so an alias might
* be necessary.
*
* Following patters will be replaced:
......
......@@ -9,12 +9,17 @@
*/
// update message version
$updateVersion = 45;
$updateVersion = 47;
// xdebug_start_profiling();
if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__).'/');
// define all DokuWiki globals here (needed within test requests but also helps to keep track)
global $ACT, $INPUT, $QUERY, $ID, $REV, $DATE_AT, $IDX,
$DATE, $RANGE, $HIGH, $TEXT, $PRE, $SUF, $SUM, $INFO, $JSINFO;
if(isset($_SERVER['HTTP_X_DOKUWIKI_DO'])) {
$ACT = trim(strtolower($_SERVER['HTTP_X_DOKUWIKI_DO']));
} elseif(!empty($_REQUEST['idx'])) {
......@@ -34,6 +39,7 @@ $QUERY = trim($INPUT->str('id'));
$ID = getID();
$REV = $INPUT->int('rev');
$DATE_AT = $INPUT->str('at');
$IDX = $INPUT->str('idx');
$DATE = $INPUT->int('date');
$RANGE = $INPUT->str('range');
......@@ -47,7 +53,41 @@ $PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1));
$SUF = cleanText($INPUT->post->str('suffix'));
$SUM = $INPUT->post->str('summary');
//make info about the selected page available
//parse DATE_AT
if($DATE_AT) {
$date_parse = strtotime($DATE_AT);
if($date_parse) {
$DATE_AT = $date_parse;
} else { // check for UNIX Timestamp
$date_parse = @date('Ymd',$DATE_AT);
if(!$date_parse || $date_parse === '19700101') {
msg(sprintf($lang['unable_to_parse_date'], $DATE_AT));
$DATE_AT = null;
}
}
}
//check for existing $REV related to $DATE_AT
if($DATE_AT) {
$pagelog = new PageChangeLog($ID);
$rev_t = $pagelog->getLastRevisionAt($DATE_AT);
if($rev_t === '') { //current revision
$REV = null;
$DATE_AT = null;
} else if ($rev_t === false) { //page did not exist
$rev_n = $pagelog->getRelativeRevision($DATE_AT,+1);
msg(sprintf($lang['page_nonexist_rev'],
strftime($conf['dformat'],$DATE_AT),
wl($ID, array('rev' => $rev_n)),
strftime($conf['dformat'],$rev_n)));
$REV = $DATE_AT; //will result in a page not exists message
} else {
$REV = $rev_t;
}
}
//make infos about the selected page available
$INFO = pageinfo();
//export minimal info to JS, plugins can add more
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment