Пример #1
0
         $form = new ModuleTemplate('CLFRM', 'forum_editcat.tpl.php');
         $form->assign('header', get_lang('Add a category'));
         $form->assign('catName', '');
         $form->assign('nextCommand', 'exMkCat');
         $form->assign('catId', 0);
         $dialogBox->form($form->render());
     } catch (Exception $ex) {
         if (claro_debug_mode()) {
             $dialogBox->error('<pre>' . $ex->__toString() . '</pre>');
         } else {
             $dialogBox->error($ex->getMessage());
         }
     }
 }
 if ('exEdCat' == $cmd) {
     if (update_category_title($catId, $catName)) {
         $dialogBox->success(get_lang('Category updated'));
     } else {
         $dialogBox->error(get_lang('Unable to update category'));
     }
 }
 if ('rqEdCat' == $cmd) {
     $categorySettingList = get_category_settings($catId);
     if ($categorySettingList) {
         try {
             $form = new ModuleTemplate('CLFRM', 'forum_editcat.tpl.php');
             $form->assign('header', get_lang('Edit category'));
             $form->assign('catName', $categorySettingList['cat_title']);
             $form->assign('nextCommand', 'exEdCat');
             $form->assign('catId', $catId);
             $dialogBox->form($form->render());
Пример #2
0
        foreach ($formCategoryList as $thisFormCategory) {
            $catSelectBox .= '<option  value="' . $thisFormCategory['cat_id'] . '">' . $thisFormCategory['cat_title'] . '</option>';
        }
        $catSelectBox .= '</select><br />' . "\n";
    } else {
        $catSelectBox = '';
    }
    $reqForumName = isset($_REQUEST['forumName']) ? $_REQUEST['forumName'] : '';
    $reqForumDesc = isset($_REQUEST['forumDesc']) ? $_REQUEST['forumDesc'] : '';
    $reqForumPostUnallowedState = isset($_REQUEST['forumPostUnallowed']) ? ' checked ' : '';
    $htmlAddForum = '<strong>' . get_lang('Add forum') . '</strong>' . '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="cmd" value="exMkForum" />' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<label for="forumName">' . get_lang('Name') . ': </label><br />' . "\n" . '<input type="text" name="forumName" id="forumName"' . ' value="' . $reqForumName . '" /><br />' . "\n" . '<label for="forumDesc">' . get_lang('Description') . ' : </label><br />' . "\n" . '<textarea name="forumDesc" id="forumDesc" cols="50" rows="3">' . "\n" . $reqForumDesc . '</textarea><br />' . "\n" . $catSelectBox . "\n" . '<br />' . "\n" . '<input type="checkbox" id="forumPostUnallowed" name="forumPostUnallowed" ' . $reqForumPostUnallowedState . ' />' . "\n" . '<label for="forumPostUnallowed">' . get_lang('Locked') . ' <small>(' . get_lang('No new post allowed') . ')</small></label><br />' . "\n" . '<br />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp; ' . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</form>' . "\n\n";
    $dialogBox->form($htmlAddForum);
}
if ($cmd == 'exEdCat') {
    if (trim($_REQUEST['catName']) != '') {
        if (update_category_title($_REQUEST['catId'], $_REQUEST['catName'])) {
            $dialogBox->success(get_lang('Category updated'));
        } else {
            $dialogBox->error(get_lang('Unable to update category'));
        }
    } else {
        $dialogBox->error(get_lang('Missing field(s)'));
        $cmd = 'rqEdCat';
    }
}
if ($cmd == 'rqEdCat') {
    $categorySettingList = get_category_settings($_REQUEST['catId']);
    if ($categorySettingList) {
        $htmlEditCat = '<strong>' . get_lang('Edit category') . '</strong>' . "\n" . '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<input type="hidden" name="catId" value="' . $categorySettingList['cat_id'] . '" />' . "\n" . '<input type="hidden" name="cmd" value="exEdCat" />' . "\n" . '<label for="catName">' . get_lang('Name') . ' : </label><br />' . "\n" . '<input type="text" name="catName" id="catName"' . ' value="' . $categorySettingList['cat_title'] . '" /><br /><br />' . "\n" . '<input type="submit" value="' . get_lang('Ok') . '" />&nbsp; ' . claro_html_button($_SERVER['PHP_SELF'], get_lang('Cancel')) . '</form>' . "\n" . "\n";
        $dialogBox->form($htmlEditCat);
    }