Increase Timeout for Synchronization

$this->client = new IXR_Client($this->profiles[$this->profno]['server']);
$this->client->timeout = 60;

Add GeSHi Coloring

By default, dokuwiki uses only one template to render all the code highlighting. This is pretty restrictive given that GeSHi has language-specific highlighting. The guide on the dokuwiki page will show you how to create a CSS and load that up in order to get proper syntax highlighting in dokuwiki.

Batch-Edit Checked Boxes

Add checked="yes" to admin.php for batchedit to tick all the boxes matching the regex and replacement. Meant for the batchedit plugin.

$this->_ptln('<input type="checkbox" id="' . $id . '" name="apply[' . $id . ']" value="on" checked="yes"/>');

Enable Tikz for the LaTeX Plugin

The patch removes going through dvips and uses ImageMagick directly to convert dvi to png for the latex plugin.

class.latexrender.diff
--- latex-original/class.latexrender.php	2011-04-29 10:53:02.000000000 +0300
+++ latex/class.latexrender.php	2013-03-09 21:51:06.000000000 +0200
@@ -51,16 +51,7 @@
 		var $_font_size = 10;
 		var $_latexclass = "article"; //install extarticle class if you wish to have smaller font sizes
     var $_tmp_filename;
-    // this most certainly needs to be extended. in the long term it is planned to use
-    // a positive list for more security. this is hopefully enough for now. i'd be glad
-    // to receive more bad tags !
-    var $_latex_tags_blacklist = array(
-	   "include","def","command","loop","repeat","open","toks","output","input",
-	   "catcode","name","^^",
-	   "\\every","\\errhelp","\\errorstopmode","\\scrollmode","\\nonstopmode","\\batchmode",
-	   "\\read","\\write","csname","\\newhelp","\\uppercase", "\\lowercase","\\relax","\\aftergroup",
-	   "\\afterassignment","\\expandafter","\\noexpand","\\special"
-	    );
+    var $_latex_tags_blacklist = array();
     var $_errorcode = 0;
 		var $_errorextra = "";
 		var $_filename;
@@ -240,18 +231,13 @@
 			return false;
 		}
 
-	   // convert dvi file to postscript using dvips
-	   $command = $this->_dvips_path." -E ".$this->_tmp_filename.".dvi"." -o ".$this->_tmp_filename.".ps";
-	   $this->myexec($command,$status_dvips);
-
-
 	   // imagemagick convert ps to image and trim picture
-	   $command = $this->_convert_path." ".$this->_tmp_filename.".ps ".
+	   $command = $this->_convert_path." ".$this->_tmp_filename.".dvi ".
 				$this->_tmp_filename.".".$this->_image_format;
 	   $this->myexec($command,$status_convert);
 
 
-		 if ($status_dvips || $status_convert) {
+		 if ($status_convert) {
 			if( ! $this->_keep_tmp)
 				$this->cleanTemporaryDirectory();
 			chdir($current_dir);

Disable GeSHi Links

In inc/geshi.php or, on more recent Dokuwiki versions vendor/easybook/geshi/geshi.php, change:

    var $keyword_links = true;

to:

    var $keyword_links = false;

Preview Text Before Edit Form

Dokuwiki by default places the form before the preview text. This seems a little inconvenient because you are meant to pay attention at what you have written at the bottom of the page, such the having the preview window with the last lines of text at the bottom instead of on top (before your eyes) is not helpful. The following patch:

--- template.php.old	2013-05-10 12:45:54.000000000 +0000
+++ template.php	2013-09-03 04:27:11.000000000 +0000
@@ -108,8 +108,8 @@
             html_edit();
             break;
         case 'preview':
-            html_edit();
             html_show($TEXT);
+            html_edit();
             break;
         case 'draft':
             html_draft();

reverses that behavior, by editing inc/template.php and placing the preview text above the edit box.

Split a Large Page into Sub-Pages

The following PHP script reads a dokuwiki file (such as the ones under data/pages) and then splits the file into multiple smaller files by the title of the top-level title. The script only supports pages that contain top-level titles (in dokuwiki syntax, those pre-postfixed with six equal signs).

<?php
 
###########################################################################
##  Copyright (C) Wizardry and Steamworks 2015 - License: GNU GPLv3      ##
###########################################################################
## This scans a dokuwiki page file and branches out all the top-level    ##
## sections into multiple files named after the title and normalized.    ##
###########################################################################

###########################################################################
##                            CONFIGURATION                              ##
###########################################################################

# The dokuwiki file to scan.
$scan = 'Workbook2.txt';
 
# In which directory to save the pages.
$directory = 'drinks';
 
###########################################################################
##                               INTERNALS                               ##
###########################################################################

if(($handle = fopen($scan, "r")) === FALSE)
	die;
 
# The normalization routines for Dokuwiki.	
$pattern[0] = '/[\s\(\)]+?/';
$replace[0] = '_';
 
$pattern[1] = '/[\?#"\'\.]+?/';
$replace[1] = '';
 
# For every line in the dokuwiki document...
$fileName = '';
$title = '';
while (($line = fgets($handle)) !== false) {
	# Check that we have a top-level section
        switch(preg_match('/^====== (.+?) ======/', $line, $matches)) {
		case TRUE: # if we do have a top-level section, normalize the title to a file-name...
			$title = $matches[1];
			$fileName = strtolower(
				preg_replace(
					'/__+?/', 
					'_', 
					preg_replace(
						$pattern, 
						$replace, 
						$matches[1]
						)
				).'.txt'
			);
			# and create the file.
			if(touch($directory.'/'.$fileName) == false) {
				$fileName = '';
				$title = '';
				break;
			}
			break;
		default:
			# if the file could not be created, skip
			if($fileName == '') break;
			# similarly, if the created file could not be opened in append mode then skip
			if(($df = fopen($directory.'/'.$fileName, "a")) === FALSE) break;
			switch($title) {
				case '': # if the title has been written, skip
					break;
				default: # write the title otherwise
					fwrite($df, '====== '.$title.' ======'.PHP_EOL);
					$title = '';
					break;
			}
			# and write the lines to the file
			if(fwrite($df, $line) === FALSE)
				echo 'Error writing: '.$fileName.PHP_EOL;
			# close the temporary file
			fclose($df);
			break;
	}
}
# close the dokuwiki document
fclose($handle);
 
?>

Using Tikz with Dokuwiki LaTeX Plugin

If you use Tikz with the Dokuwiki LaTeX plugin you may notice that it will generate very small images. This is due to the line:

$command = $this->_dvips_path." -E ".$this->_tmp_filename.".dvi"." -o ".$this->_tmp_filename.".ps";

in class.latexrender.php that tells dvips to attempt to generate an EPSF PostScript file from the DVI by drawing a tight bounding box around the text whilst ignoring graphics - and this is explicitly something that we do not want.

To remedy the situation, edit class.latexrender.php and change the former line to:

$command = $this->_dvips_path." ".$this->_tmp_filename.".dvi"." -o ".$this->_tmp_filename.".ps";

Upgrade Plugins for PHP 7 Compatibility

Change directory from the Dokuwiki root to lib/plugins/ and execute the following commands:

find . -type f -exec perl -p -i -e 's/&$handler/Doku_Handler $handler/g' '{}' \;

and:

find . -type f -exec perl -p -i -e 's/&$renderer/Doku_Renderer $renderer/g' '{}' \;

Password Recovery

In case of a lost password, add the following line to conf/users.auth.php:

admin:$1$4fd0ad31$.cId7p1uxI4a.RcrH81On0:DokuWiki Administrator:mail@host.com:admin,user

and then login using the username admin and the password admin.


fuss/dokuwiki.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.