1<?php 2/** 3 * Configuration Manager guestbook plugin 4 * 5 * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6 * @author Gerry Wei�bach <gerry.w@gammaproduction.de> 7 */ 8 9if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/'); 10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 11require_once(DOKU_PLUGIN.'admin.php'); 12 13require_once(DOKU_PLUGIN.'/guestbook/basic.class.php'); // settings classes specific to these settings 14 15/** 16 * All DokuWiki plugins to extend the admin function 17 * need to inherit from this class 18 */ 19class admin_plugin_guestbook extends DokuWiki_Admin_Plugin { 20 21 var $_SESSION_started = false; 22 23 /** 24 * return some info 25 */ 26 function getInfo(){ 27 28 return array( 29 'author' => 'Gerry Weißbach', 30 'email' => 'gerry.w@gammaproduction.de', 31 'date' => '2006-01-28', 32 'name' => 'guestbook Plugin', 33 'desc' => 'Edit, delete and activate entrys', 34 'url' => '', 35 ); 36 } 37 38 function getMenuSort() { return 100; } 39 40 /** 41 * handle user request 42 */ 43 function handle() { 44 45 $guestbook_database = new guestbook_database(); 46 $guestbook_database->checkStatus($this); 47 48 if (!empty($_POST['newEntry'])) 49 { 50 $form = new guestbook(TRUE); 51 $form->newEntry($this, intval($_POST['oldID'])); 52 } 53 54 if (!empty($_POST['guestActivate'])) 55 { 56 $form = new guestbook(TRUE); 57 $form->guestActivate($this); 58 } 59 60 if (!empty($_GET['activate'])) 61 { 62 $form = new guestbook(TRUE); 63 $form->guestActivateViaMail($this); 64 } 65 66 if (!empty($_POST['guestDelete'])) 67 { 68 $form = new guestbook(TRUE); 69 $form->deleteEntry($this); 70 } 71 } 72 73 /** 74 * output appropriate html 75 */ 76 function html() { 77 global $lang, $_SESSION; 78 79 $guestbook = new guestbook(TRUE); 80 81 print '<div id="guestbook">'; 82 83 if(!empty($_POST['createEntry']) || !empty($_POST['guestEdit'])) 84 print $guestbook->form($this, intval($_POST['guestEdit'])); 85 else 86 { 87 print $this->locale_xhtml('intro'); 88 89 print $guestbook->html($this, TRUE); 90 } 91 92 print '</div>'; 93 } 94} 95