check(5); include dirname(__FILE__).'/inc/connexion.php'; $err = ''; $cat_libelle = ''; $cat_libelle_url = ''; $cat_desc = ''; # Edition d'une catégorie if (!empty($_REQUEST['cat_id'])) { $rsCat = $blog->getCat($_REQUEST['cat_id']); $cat_libelle = $rsCat->field('cat_libelle'); $cat_libelle_url = $rsCat->field('cat_libelle_url'); $cat_desc = $rsCat->field('cat_desc'); $cat_id = $rsCat->field('cat_id'); # Suppression if (!empty($_GET['del'])) { if ($blog->delCat($cat_id) !== false) { $msg = __('Category has been deleted'); header('Location: cat_list.php?msg='.rawurlencode($msg)); exit; } else { $msg = __('Cannot delete category'); header('Location: cat_list.php?msg='.rawurlencode($msg)); } } # Modification if (!empty($_POST['submit']) && $cat_id) { $cat_libelle = $_POST['cat_libelle']; $cat_libelle_url = $_POST['cat_libelle_url']; $cat_desc = $_POST['cat_desc']; if ($blog->updCat($cat_id,$cat_libelle,$cat_desc,$cat_libelle_url) !== false) { $msg = __('Category has been updated'); header('Location: cat_list.php?msg='.rawurlencode($msg)); exit; } else { $err = $blog->error(1); } } } # Ajout d'une catégorie elseif (!empty($_POST['submit'])) { $cat_libelle = $_POST['cat_libelle']; $cat_libelle_url = $_POST['cat_libelle_url']; $cat_desc = $_POST['cat_desc']; if ($blog->addCat($cat_libelle,$cat_desc,$cat_libelle_url) !== false) { $msg = __('Category has been created'); header('Location: cat_list.php?msg='.rawurlencode($msg)); exit; } else { $err = $blog->error(1); } } openPage(__('Category')); if ($err != '') { echo '

'.__('Error(s)').' :

'. $err.'
'; } echo '

'.__('Back').'

'. '

'.__('Category').'

'. '
'. '

'. form::field('cat_libelle',40,255,$cat_libelle,'','class="max"').'

'. '

'. form::field('cat_libelle_url',40,255,$cat_libelle_url,'','class="max"').'

'. '

'. form::textArea('cat_desc',60,8,htmlspecialchars($cat_desc),'','class="max"'). '

'. '

'. ((!empty($cat_id)) ? form::hidden('cat_id',$cat_id) : ''). '

'. '
'; closePage(); ?>