Esempio n. 1
0
function plugin_html_convert()
{
    global $script, $vars;
    $qm = get_qm();
    $qt = get_qt();
    $page = isset($vars['page_alt']) ? $vars['page_alt'] : $vars['page'];
    $ids = $qt->getv('plugin_html_id');
    if (!$ids) {
        $ids = array($page => 0);
    }
    $id = ++$ids[$page];
    $qt->setv('plugin_html_id', $ids);
    if (!(PKWK_READONLY > 0 or is_freeze($page) or plugin_html_is_edit_auth($page))) {
        return $qm->replace('fmt_msg_not_editable', '#html', $page);
    }
    $args = func_get_args();
    $body = array_pop($args);
    $size = '';
    $class = 'autofit_iframe';
    foreach ($args as $arg) {
        if ($arg == 'noskin') {
            $noskin = true;
            break;
        } else {
            if ($arg == 'iframe') {
                $iframe = true;
            } else {
                if (preg_match('/^(\\d+)(?:x(\\d+))?$/', $arg, $mts)) {
                    $x = "width:{$mts[1]}px;";
                    $y = isset($mts[2]) ? "height:{$mts[2]}px;" : '';
                    $size = $x . $y;
                    $class = '';
                }
            }
        }
    }
    if ($noskin) {
        pkwk_common_headers();
        print $body;
        exit;
    } else {
        if ($iframe) {
            $qt->setv('jquery_include', true);
            exist_plugin('iframe');
            $qt->appendv_once('plugin_iframe', 'beforescript', PLUGIN_IFRAME_FIT_IFRAME_JS);
            $r_page = rawurlencode($page);
            $body = '<iframe src="' . $script . '?cmd=html&page=' . $r_page . '&id=' . $id . '" frameborder="0" class="' . $class . '" style="' . $size . '"></iframe>';
        }
    }
    return $body;
}
Esempio n. 2
0
function plugin_html_is_edit_restricted($page)
{
    return PKWK_READONLY > 0 or is_freeze($page) or plugin_html_is_edit_auth($page);
}