1<?php
2/**
3 * Offline Plugin: Helper progam that give information about installed standard
4 * archivers and wget.
5 *
6 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author Carsten Graw <dokuwiki@graw.eu>
8 */
9	echo '<h1>Installed programs</h1>' . "\n";
10	echo '<h2>Archivers</h2>' . "\n";
11	echo '<p>The table below lists information about some standard archivers (aka \'packers\') on your system.</p>' . "\n";
12	echo '<p>If a program is installed, the second column will list the path to this archiver. Just copy the value from the column <em>Path to archiver\'s binary</em> and insert in your DokuWiki\'s plugin configuration in the field <em>plugin &gt; offline &gt; archiverPathToBinary </em>.</p>' . "\n";
13	echo '<p>If one of the programs is not available the information \'Not installed\' will be given. This means you cannot use this specific program to include all your wiki files in one single file for convenient download.</p>' . "\n";
14
15	$outStr .= '<table border="1" cellspacing="0" cellpadding="2">' . "\n";
16	$outStr .= '	<tr>' . "\n";
17	$outStr .= '		<th>Program</th>' . "\n";
18	$outStr .= '		<th>Path to binary</th>' . "\n";
19	$outStr .= '	</tr>' . "\n";
20	foreach(array('zip', 'unzip', 'bzip', 'gzip', 'rar', 'tar') as $packerNameStr) {
21		unset($outputArr);
22		exec('which ' . $packerNameStr, $outputArr);
23		if (isset($outputArr[0])) {
24			$packerPathStr = '<input type="text" id="' . $packerNameStr . '" value="' . $outputArr[0] . '" style="font-family: Courier,fixed; font-size: 0.9em; " />';
25			$tdStyleStr = '';
26		} else {
27			$packerPathStr = 'Not installed.';
28			$tdStyleStr = ' style="color: #AAAAAA; "';
29		}
30
31		$outStr .= '	<tr>' . "\n";
32		$outStr .= '		<td style="width: 130px; ">' . $packerNameStr . '</td>' . "\n";
33		$outStr .= '		<td' . $tdStyleStr . '>' . $packerPathStr . '</td>' . "\n";
34		$outStr .= '	</tr>' . "\n";
35
36
37	}
38	$outStr .= '</table>' . "\n";
39
40
41	$outStr .= '<h2>Wget</h2>' . "\n";
42	$outStr .= '<p>(In some configurations the command \'which\' might not return a path though wget is installed.)</p>' . "\n";
43	$outStr .= '<table border="1" cellspacing="0" cellpadding="2">' . "\n";
44	$outStr .= '	<tr>' . "\n";
45	$outStr .= '		<th>Program</th>' . "\n";
46	$outStr .= '		<th>Path to binary</th>' . "\n";
47	$outStr .= '	</tr>' . "\n";
48
49	unset($outputArr);
50	exec('which wget', $outputArr);
51	if (isset($outputArr[0])) {
52		$wgetPathStr = '<input type="text" id="wget" value="' . $outputArr[0] . '" style="font-family: Courier,fixed; font-size: 0.9em; " />';
53		$tdStyleStr = '';
54	} else {
55		$wgetPathStr = 'Not installed.';
56		$tdStyleStr = ' style="color: #AAAAAA; "';
57	}
58
59	$outStr .= '	<tr>' . "\n";
60	$outStr .= '		<td style="width: 130px; ">wget</td>' . "\n";
61	$outStr .= '		<td' . $tdStyleStr . '>' . $wgetPathStr . '</td>' . "\n";
62	$outStr .= '	</tr>' . "\n";
63	$outStr .= '</table>' . "\n";
64
65	echo $outStr;
66?>