register_hook('HTMLOK_ACCESS_EVENT', 'BEFORE', $this, 'errors_top'); $controller->register_hook('PARSER_CACHE_USE', 'BEFORE', $this, 'bypasss_cache'); $controller->register_hook('TEMPLATE_USERTOOLS_DISPLAY', 'BEFORE', $this, 'action_link', array('user')); $controller->register_hook('TEMPLATE_HTMLOKAYTOOLS_DISPLAY', 'BEFORE', $this, 'action_link', array('ok')); $controller->register_hook('ACTION_HEADERS_SEND', 'BEFORE', $this, 'modify_headers', array()); $controller->register_hook('DOKUWIKI_STARTED', 'BEFORE', $this, 'dw_started', array()); $controller->register_hook('TPL_ACT_RENDER', 'BEFORE', $this, 'errors_top', array()); } function dw_started(&$event, $param) { $this->_init(); } function modify_headers(&$event, $param) { global $INFO, $ID; $this->get_info(); $page = noNS($ID) . '.txt'; if(!$this->files) { return; } if(!in_array('all', $this->files) && !in_array($page, $this->files)) { return; } $event->data[] = 'Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT'; $event->data[] = 'Cache-control: no-cache,must-revalidate,no-store'; } function bypasss_cache(&$event, $param) { global $INFO; $cache =$event->data; if (!isset($cache->page)) return; if (isset($cache->mode) && $cache->mode == 'metadata') return; $depends = p_get_metadata($cache->page, 'relation htmlokay'); $meta_file = metaFN($cache->page,'.meta'); if(isset($depends)) { if(!empty($cache->depends['files'])) { $cache->depends['files'][] = $meta_file; //msg($cache->cache); //msg('
c = ' . print_r($event->data, 1) .''); } else $cache->depends['files'] = array($meta_file); } } function get_info() { global $conf; global $INFO; $this->helper->get_info(); $namespace = $this->helper->get_namespace(); $this->namespace = $namespace; $namespace = str_replace(':', '#', $namespace); $access_file = $this->helper->get_access_file(HTMLOK_ACCESS_DIR, $namespace); $this->set_dbg_msg("access file: $access_file"); if (file_exists($access_file)) { $INFO['htmlOK_access_scope'] = $this->helper->get_access_scope($access_file); $this->set_dbg_msg("file exists: access file: $access_file"); $this->saved_inf = $this->helper->get_saved_inf(); if (!$this->saved_inf) { return; } $this->files = $this->saved_inf['filespecs']; if(!empty($INFO['filepath'])) { $this->curent_file = basename($INFO['filepath']); } else { $this->curent_file = noNS($ID) . '.txt'; } $this->access_file = $access_file; } } function action_link(&$event, $param) { global $INFO; if(!empty($INFO['userinfo'])) { $name = "HTML Error Window"; if($param[0] == 'ok') { $htm_open = ''; $htm_close = ''; } else { $htm_open = '
"; echo ""; echo "
\$INFO array:
"; $str = print_r($INFO,true); echo htmlentities($str,ENT_QUOTES); echo "
\$conf array:
"; $str = print_r($conf,true); echo htmlentities($str,ENT_QUOTES); echo "
Saved Info:"; print_r($this->saved_inf,true); echo "