if (!cc_check_perm($form)) {
    redirect_header('index.php', 3, _NOPERM);
    exit;
}
include XOOPS_ROOT_PATH . "/header.php";
$xoopsOption['template_main'] = "ccenter_reception.html";
$id = $form['formid'];
$items = get_form_attribute($form['defs']);
$breadcrumbs->set(htmlspecialchars($form['title']), "reception.php?formid={$id}");
$breadcrumbs->assign();
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
if ($form['custom']) {
    $reg = array('/\\[desc\\](.*)\\[\\/desc\\]/sU', '/<form[^>]*>(.*)<\\/form[^>]*>/sU', '/{CHECK_SCRIPT}/');
    $rep = array('\\1', '', '');
    $form['action'] = '';
    $form['description'] = preg_replace($reg, $rep, custom_template($form, $items));
} else {
    $form['description'] = $myts->displayTarea($form['description']);
}
$form['mdate'] = formatTimestamp($form['mtime']);
foreach ($items as $k => $item) {
    if (empty($item['label'])) {
        unset($items[$k]);
    }
}
$max_cols = 3;
$form['items'] = array_slice($items, 0, $max_cols);
$n = $mpos = -1;
foreach ($form['items'] as $item) {
    $n++;
    if ($item['type'] == 'mail') {
function render_form(&$form, $op)
{
    global $xoopsTpl;
    set_checkvalue($form);
    $myts =& MyTextSanitizer::getInstance();
    $html = 0;
    $br = 1;
    switch ($form['custom']) {
        case _CC_TPL_FRAME:
            $xoopsTpl->assign(array('xoops_showcblock' => 0, 'xoops_showlblock' => 0, 'xoops_showrblock' => 0));
        case _CC_TPL_BLOCK:
        case _CC_TPL_FULL:
            $xoopsTpl->assign('content', custom_template($form, $form['items'], $op == 'confirm'));
            $template = "ccenter_custom.html";
            break;
        case _CC_TPL_NONE_HTML:
            $html = 1;
            $br = 0;
        case _CC_TPL_NONE:
            $str = $rep = array();
            if (!empty($form['priuser'])) {
                $priuser =& $form['priuser'];
                $str[] = "{TO_UNAME}";
                $rep[] = $priuser['uname'];
                $str[] = "{TO_NAME}";
                $rep[] = $priuser['name'];
            }
            $str[] = "{XOOPS_URL}";
            $rep[] = XOOPS_URL;
            $form['desc'] = $myts->displayTarea(str_replace($str, $rep, $form['description']), $html, 1, 1, 1, $br);
            $xoopsTpl->assign('op', 'confirm');
            $template = $op == 'confirm' ? "ccenter_confirm.html" : "ccenter_form.html";
    }
    $dirname = basename(dirname(__FILE__));
    $form['cc_url'] = XOOPS_URL . "/modules/{$dirname}";
    $xoopsTpl->assign('form', $form);
    return $template;
}