Page MenuHomePhabricator

No OneTemporary

diff --git a/action.php b/action.php
--- a/action.php
+++ b/action.php
@@ -1,78 +1,79 @@
<?php
/**
* DokuWiki Plugin datapopup (Action Component)
*
* @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
* @author Andreas Boehler <dev@aboehler.at>
*/
// must be run within Dokuwiki
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_datapopup extends DokuWiki_Action_Plugin {
var $dthlp = null;
function action_plugin_datapopup() {
$this->dthlp =& plugin_load('helper', 'data');
}
function register(&$controller) {
global $JSINFO;
$JSINFO['plugin']['datapopup']['registered_types'] = $this->getConf('registered_types');
$controller->register_hook('AJAX_CALL_UNKNOWN', 'BEFORE', $this, 'handle_ajax_call_unknown');
}
protected function _getFields($link, $name) {
if(!$this->dthlp)
return "The datapopup plugin reported an error. Please report.";
$sqlite = $this->dthlp->_getDB();
if(!$sqlite) return "The datapopup had an error retrieving the SQLite plugin. Please report.";
$query = "SELECT data.value FROM data JOIN pages ON data.pid=pages.pid WHERE pages.page='".$link."' AND data.key='".strtolower($name)."';";
$res = $sqlite->query($query);
$rows = $sqlite->res2arr($res);
return $rows[0]['value'];
}
public function handle_ajax_call_unknown(Doku_Event &$event, $param) {
if($event->data != 'plugin_datapopup') return;
global $auth;
global $INPUT;
$link = $INPUT->str('link');
+ $link = preg_replace('/\?.*/', '', $link);
$fields = explode(',',$this->getConf('fields'));
$fields = array_map('trim',$fields);
$fields = array_filter($fields);
echo '<ul>';
foreach($fields as $name){
$val = $this->_getFields($link, $name);
if($val != "")
{
echo '<li class="dataov_name">';
echo '<div class="li">';
echo hsc($name);
echo '</div></li>';
echo '<li class="dataov_'.hsc($name).'">';
echo '<div class="li">';
echo hsc($val);
echo '</div></li>';
}
}
echo '</ul>';
$event->preventDefault();
$event->stopPropagation();
}
}
// vim:ts=4:sw=4:et:enc=utf-8:

File Metadata

Mime Type
text/x-diff
Expires
Tue, Dec 24, 5:57 PM (1 d, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
532393
Default Alt Text
(2 KB)

Event Timeline