forked from turnermm/news
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.php
executable file
·47 lines (39 loc) · 1.31 KB
/
action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @author Myron Turner
* @email [email protected]
* action plugin completes processing of news data
*/
if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once DOKU_PLUGIN.'action.php';
class action_plugin_news extends DokuWiki_Action_Plugin {
var $helper;
/**
* Register its handlers with the DokuWiki's event controller
*/
function register(Doku_Event_Handler $controller) {
$controller->register_hook('DOKUWIKI_DONE', 'BEFORE', $this,
'process_feed');
}
function action_plugin_news() {
global $newsUpdated;
$this->helper = $this->loadHelper('news', true);
}
/**
check permissions and send page to be processed
*/
function process_feed(&$event, $param) {
global $ID,$INFO;
$perm = $this->helper->has_permission();
if($perm == 2 && $INFO['perm'] != 1) { //INFO['perm'] = 1 when logging out
msg($this->getLang('no_permission'));
return;
}
if($this->helper->pageUpdated() ) {
$metafile = $this->helper->getMetaFN('wasupdated','.meta') ;
io_saveFile($metafile,time() . "\n" . $ID ."\n");
$this->helper->saveFeedData($ID);
}
}
}