xref: /plugin/qc/helper.php (revision 8437661ab10aad0f822c440f92e1762ae977040d)
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;
14d2a33339SDominik Eckelmann        if (!function_exists('gd_info')) {
15d2a33339SDominik Eckelmann            msg('You have to install php-gd lib to use the QC plugin.');
16d2a33339SDominik Eckelmann            return;
17d2a33339SDominik Eckelmann        }
188fce80b1SAndreas Gohr        if($ACT != 'show' || !$INFO['exists']) return;
1932905264SAndreas Gohr        if(p_get_metadata($ID, 'relation qcplugin_disabled')) return;
20c8193605SDominik Eckelmann        if ($this->getConf('adminonly')) {
21c8193605SDominik Eckelmann            if (!isset($_SERVER['REMOTE_USER']) || !auth_isadmin())
22c8193605SDominik Eckelmann                return;
23c8193605SDominik Eckelmann        }
249068e431SAndreas Gohr        echo '<div id="plugin__qc__wrapper">';
2563ee528dSAndreas Gohr        echo '<img src="'.DOKU_BASE.'lib/plugins/qc/icon.php?id='.$ID.'" width="600" height="25" alt="" id="plugin__qc__icon" />';
268fce80b1SAndreas Gohr        echo '<div id="plugin__qc__out" style="display:none"></div>';
279068e431SAndreas Gohr        echo '</div>';
288fce80b1SAndreas Gohr    }
298fce80b1SAndreas Gohr
308fce80b1SAndreas Gohr
318fce80b1SAndreas Gohr
328fce80b1SAndreas Gohr    function getQCData($theid){
338fce80b1SAndreas Gohr        global $ID;
348fce80b1SAndreas Gohr        $oldid = $ID;
358fce80b1SAndreas Gohr        $ID = $theid;
36*8437661aSAdrian Lang        require_once DOKU_INC.'inc/parserutils.php';
37*8437661aSAdrian Lang        $data = unserialize(p_cached_output(wikiFN($ID), 'qc', $ID));
388fce80b1SAndreas Gohr        $ID = $oldid;
398fce80b1SAndreas Gohr        return $data;
408fce80b1SAndreas Gohr    }
418fce80b1SAndreas Gohr
428fce80b1SAndreas Gohr}
438fce80b1SAndreas Gohr// vim:ts=4:sw=4:et:enc=utf-8:
44