1<?php
2/**
3 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
4 * @author     Etienne M. <emauvaisfr@yahoo.fr>
5 */
6
7// must be run within Dokuwiki
8if(!defined('DOKU_INC')) die();
9
10if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
11require_once(DOKU_PLUGIN.'action.php');
12
13class action_plugin_message extends DokuWiki_Action_Plugin {
14
15    /**
16     * return some info
17     */
18    function getInfo() {
19        return array(
20                'author' => 'Etienne M.',
21                'email'  => 'emauvaisfr@yahoo.fr',
22                'date'   => @file_get_contents(DOKU_PLUGIN.'message/VERSION'),
23                'name'   => 'message Plugin',
24                'url'   => 'http://www.dokuwiki.org/plugin:message',
25                );
26    }
27
28    /**
29     * Constructor
30     */
31    function action_plugin_message() {
32      $this->setupLocale();
33    }
34
35    /**
36     * register the eventhandlers
37     */
38    function register(&$contr) {
39        $contr->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, '_display_message', array());
40    }
41
42    function _display_message(&$event, $param) {
43        global $conf;
44
45        $file=$conf['cachedir'].'/message_error.txt';
46        if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),-1);
47
48        $file=$conf['cachedir'].'/message_info.txt';
49        if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),0);
50
51        $file=$conf['cachedir'].'/message_valid.txt';
52        if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),1);
53
54        $file=$conf['cachedir'].'/message_remind.txt';
55        if (file_exists($file) && filesize($file)) msg(@file_get_contents($file),2);
56
57        return;
58    }
59}
60
61// vim:ts=4:sw=4:et:enc=utf-8:
62