예제 #1
0
function kona3_action_plugin()
{
    global $kona3conf;
    $page = $kona3conf["page"];
    $name = isset($_GET['name']) ? $_GET['name'] : '';
    if ($name == '') {
        header("location: index.php");
        exit;
    }
    if (!preg_match('#^[a-zA-Z0-9]+$#', $name)) {
        err404("Invalid plugin name");
    }
    // pinfo
    $pinfo = konawiki_parser_getPlugin($name);
    if (empty($pinfo['file']) || !file_exists($pinfo['file'])) {
        err404("Invalid plugin name");
    }
    // execute
    include_once $pinfo['file'];
    $func_name = "kona3plugins_{$name}_action";
    if (!function_exists($func_name)) {
        err404("Plugin function not found");
    }
    @call_user_func($func_name);
}
예제 #2
0
function konawiki_parser_render_plugin($value)
{
    $pname = $value['text'];
    $params = $value['params'];
    $info = konawiki_parser_getPlugin($pname);
    $func = $info['func'];
    $res = "[Plugin Error:" . kona3text2html($pname) . "({$func})]";
    // check
    if ($info['disallow']) {
        $res = "[Plugin Error:" . kona3text2html($pname) . "]";
        return $res;
    }
    // execute
    if (is_callable($func)) {
        $res = @call_user_func($func, $params);
    }
    return $res;
}