예제 #1
0
파일: index.php 프로젝트: raylouis/kvwebme
/**
 * blah
 *
 * @param int $id id of the banner
 *
 * @return null
 */
function BannerImage_drawForm($id = 0)
{
    if (!$id) {
        $fdata = array('id' => 0, 'html' => '', 'name' => 'banner');
    } else {
        $fdata = dbRow("select * from banners_images where id={$id}");
    }
    echo '<form method="post" action="/ww.admin/plugin.php?_plugin=banner-ima' . 'ge&amp;_page=index" enctype="multipart/form-data"><input type="hidden' . '" name="id" value="' . (int) $fdata['id'] . '" />';
    echo '<table>';
    // {
    echo '<tr><th>Name</th><td><input name="name" value="' . htmlspecialchars($fdata['name']) . '" /></td></tr>';
    // }
    // { what pages should this be applied to
    echo '<tr><th>Pages</th><td>This banner will only be shown on the <select' . ' name="pages_' . $fdata['id'] . '[]" multiple="multiple" style="max-width' . ':200px;height:500px">';
    $ps = dbAll('select * from banners_pages where bannerid=' . $fdata['id']);
    $pages = array();
    if (count($ps)) {
        foreach ($ps as $p) {
            $pages[] = $p['pageid'];
        }
    }
    BannerImage_selectKiddies(0, 1, $pages);
    echo '</select> pages. <span style="color:red;font-weight:bold">If no pag' . 'es are specified, then the banner will be shown on all pages.</span><' . '/td></tr>';
    // }
    // { show HTML form
    echo '<tr><th>Banner</th><td><div id="banner_image_html">' . ckeditor('html_' . $fdata['id'], Core_unfixImageResizes($fdata['html']), 0, '', 180) . '</div></td></tr>';
    // }
    // { show submit button and end form
    echo '<tr><td><a href="./plugin.php?_plugin=banner-image&_page=index&dele' . 'te_banner=' . $fdata['id'] . '" onclick="return confirm(\'are you sure yo' . 'u want to remove this banner?\');" title="remove banner">[x]</a></td>' . '<td><input type="submit" name="save_banner" value="Update" /></td></tr>';
    // }
    echo '</table></form>';
}
예제 #2
0
    die(__('access denied'));
}
require $_SERVER['DOCUMENT_ROOT'] . '/ww.admin/admin_libs.php';
if (isset($_REQUEST['get_content_snippet'])) {
    $id = (int) $_REQUEST['get_content_snippet'];
    $r = dbRow('select * from content_snippets where id=' . $id);
    if ($r == false || !$r['content'] || $r['content'] == 'null') {
        echo '{"id":0,"content":[{"html":""}]}';
    } else {
        $json = json_decode($r['content']);
        if (!$json) {
            // sometimes apostrophes break json_decode?
            $json = json_decode(str_replace('\\\'', '\\\\\'', $r['content']));
        }
        for ($i = 0; $i < count($json); ++$i) {
            $json[$i]->html = Core_unfixImageResizes($json[$i]->html);
            while (strpos($json[$i]->html, '/f/.files/image_resizes//f/') !== false) {
                $json[$i]->html = preg_replace('#/f/.files/image_resizes//f/([^\'"]*)/[0-9]*x[0-9]*.jpg#', '/f/\\1', $json[$i]->html);
            }
        }
        $r['content'] = $json;
        echo json_encode($r);
    }
    Core_quit();
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') {
    $id = (int) $_REQUEST['id'];
    $id_was = $id;
    $content = json_decode($_REQUEST['html']);
    foreach ($content as $k => $v) {
        $content[$k]->html = Core_sanitiseHtml($v->html);