xref: /plugin/qc/helper.php (revision c8193605f5861757a8f70a38a70ff7ef71c9e697)
18fce80b1SAndreas Gohr<?php
28fce80b1SAndreas Gohr/**
38fce80b1SAndreas Gohr * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
48fce80b1SAndreas Gohr */
58fce80b1SAndreas Gohr
68fce80b1SAndreas Gohr// must be run within Dokuwiki
78fce80b1SAndreas Gohrif (!defined('DOKU_INC')) die();
82e820792SAndreas Gohrrequire_once(DOKU_INC.'inc/plugin.php');
98fce80b1SAndreas Gohr
108fce80b1SAndreas Gohrclass helper_plugin_qc extends DokuWiki_Plugin {
118fce80b1SAndreas Gohr
128fce80b1SAndreas Gohr    function tpl(){
138fce80b1SAndreas Gohr        global $ACT,$INFO,$ID;
148fce80b1SAndreas Gohr        if($ACT != 'show' || !$INFO['exists']) return;
1532905264SAndreas Gohr        if(p_get_metadata($ID, 'relation qcplugin_disabled')) return;
16*c8193605SDominik Eckelmann        if ($this->getConf('adminonly')) {
17*c8193605SDominik Eckelmann            if (!isset($_SERVER['REMOTE_USER']) || !auth_isadmin())
18*c8193605SDominik Eckelmann                return;
19*c8193605SDominik Eckelmann        }
209068e431SAndreas Gohr        echo '<div id="plugin__qc__wrapper">';
2163ee528dSAndreas Gohr        echo '<img src="'.DOKU_BASE.'lib/plugins/qc/icon.php?id='.$ID.'" width="600" height="25" alt="" id="plugin__qc__icon" />';
228fce80b1SAndreas Gohr        echo '<div id="plugin__qc__out" style="display:none"></div>';
239068e431SAndreas Gohr        echo '</div>';
248fce80b1SAndreas Gohr    }
258fce80b1SAndreas Gohr
268fce80b1SAndreas Gohr
278fce80b1SAndreas Gohr
288fce80b1SAndreas Gohr    function getQCData($theid){
298fce80b1SAndreas Gohr        global $ID;
308fce80b1SAndreas Gohr        $oldid = $ID;
318fce80b1SAndreas Gohr        $ID = $theid;
328fce80b1SAndreas Gohr        require_once(DOKU_INC.'inc/parserutils.php');
338fce80b1SAndreas Gohr        $data = unserialize(p_cached_output(wikiFN($ID), 'qc'));
348fce80b1SAndreas Gohr        $ID = $oldid;
358fce80b1SAndreas Gohr        return $data;
368fce80b1SAndreas Gohr    }
378fce80b1SAndreas Gohr
388fce80b1SAndreas Gohr}
398fce80b1SAndreas Gohr// vim:ts=4:sw=4:et:enc=utf-8:
40