1<?php
2/**
3 * Plugin twcheckliste:
4 * v1.0
5 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 * @author   web@agentur-triebwerk.de
7 */
8
9// must be run within Dokuwiki
10if (!defined('DOKU_INC'))
11	die();
12
13if (!defined('DOKU_LF'))
14	define('DOKU_LF', "\n");
15if (!defined('DOKU_TAB'))
16	define('DOKU_TAB', "\t");
17if (!defined('DOKU_PLUGIN'))
18	define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
19
20class admin_plugin_twcheckliste extends DokuWiki_Admin_Plugin {
21	private $tgzurl;
22	private $tgzfile;
23	private $tgzdir;
24
25	public function __construct() {
26		global $conf;
27	}
28
29	public function getMenuSort() {
30		return 555;
31	}
32
33	public function handle() {
34		if ($_REQUEST['btn_speichern'] && checkSecurityToken()) {
35
36			$this-> document_root = pathinfo($_SERVER['SCRIPT_FILENAME']);
37			$this-> document_root = $this-> document_root['dirname'];
38
39			$config = '
40<?
41	$conf["logo"] = "' . $_REQUEST['logo'] . '";
42	$conf["farbcode"] = "' . $_REQUEST['farbcode'] . '";
43	$conf["footertext"] = "' . $_REQUEST['footertext'] . '";
44?>';
45
46			$filename = $this-> document_root . '/lib/plugins/twcheckliste/config.php';
47
48			if (!$handle = fopen($filename, "w+")) {
49				print "Kann die Datei $filename nicht öffnen";
50				exit ;
51			}
52
53			if (!fwrite($handle, $config)) {
54				print "Kann in die Datei $filename nicht schreiben";
55				exit ;
56			}
57
58			fclose($handle);
59		}
60	}
61
62	public function html() {
63		global $ID;
64
65		$this-> document_root = pathinfo($_SERVER['SCRIPT_FILENAME']);
66		$this-> document_root = $this-> document_root['dirname'];
67
68		require_once $this-> document_root . '/lib/plugins/twcheckliste/config.php';
69
70		if ($_REQUEST['btn_speichern']) {
71			$conf["logo"] = $_REQUEST['logo'];
72			$conf["farbcode"] = $_REQUEST['farbcode'];
73			$conf["footertext"] = $_REQUEST['footertext'];
74		}
75
76		echo '
77<div class="plugin_twcheckliste_form">
78	<h1>' . $this -> getLang('menu') . '</h1>
79	<form action="" method="get" id="plugin_twcheckliste_form">
80		<input type="hidden" name="do" value="admin" />
81		<input type="hidden" name="page" value="twcheckliste" />
82		<input type="hidden" name="sectok" value="' . getSecurityToken() . '" />
83		<fieldset>
84			<legend>
85				' . $this -> getLang('label_config') . '
86			</legend>
87			<label class="block"><span>' . $this -> getLang('label_logo') . '</span>
88				<input type="text" size="50" class="edit" value="' . $conf['logo'] . '" name="logo">
89			</label>
90			<br>
91			<label class="block"><span>' . $this -> getLang('label_farbcode') . '</span>
92				<input type="text" size="50" class="edit" value="' . $conf['farbcode'] . '" name="farbcode">
93			</label>
94			<br>
95			<label class="block"><span>' . $this -> getLang('label_footertext') . '</span>
96				<input type="text" size="50" class="edit" value="' . $conf['footertext'] . '" name="footertext">
97			</label>
98			<br>
99			<input type="submit" class="button" name="btn_speichern" value="' . $this -> getLang('btn_save') . '">
100		</fieldset>
101	</form>
102</div>';
103
104	}
105
106}
107
108// vim:ts=4:sw=4:et:enc=utf-8:
109