| 1 | <?php |
|---|
| 2 | include_once('.'.DIRECTORY_SEPARATOR.'auth.php'); |
|---|
| 3 | define("JLOG_ADMIN", true); |
|---|
| 4 | require_once('..'.DIRECTORY_SEPARATOR.'scripts'.DIRECTORY_SEPARATOR.'prepend.inc.php'); |
|---|
| 5 | require(JLOG_BASEPATH.'admin'.DIRECTORY_SEPARATOR.'blog.func.php'); |
|---|
| 6 | |
|---|
| 7 | $get = strip($_GET); |
|---|
| 8 | $form_input = strip($_POST); |
|---|
| 9 | |
|---|
| 10 | $c['meta']['title'] = $l['admin']['cat_title']; |
|---|
| 11 | $c['main'] = output_admin_menu()."<h2>".$l['admin']['cat_title']."</h2>\n"; |
|---|
| 12 | |
|---|
| 13 | switch ($get['action']) { |
|---|
| 14 | |
|---|
| 15 | case 'new': |
|---|
| 16 | if(isset($form_input['form_submit'])) { |
|---|
| 17 | if(!is_array($errors = $categories->validate($form_input))) { |
|---|
| 18 | $categories->new_cat($form_input); |
|---|
| 19 | $categories->get_categories(); |
|---|
| 20 | $c['main'] .= "<p><strong>»»</strong> <a href='".add_session_id_to_url("?action=new")."'>".$l['admin']['cat_new']."</a></p> |
|---|
| 21 | ".$categories->output_whole_list_admin(); |
|---|
| 22 | } |
|---|
| 23 | else { |
|---|
| 24 | $c['main'] .= error_output($errors); |
|---|
| 25 | $c['main'] .= $categories->output_form($form_input, 'new', $l['admin']['cat_new']); |
|---|
| 26 | } |
|---|
| 27 | } |
|---|
| 28 | else $c['main'] .= $categories->output_form('', 'new', $l['admin']['cat_new']); |
|---|
| 29 | break; |
|---|
| 30 | |
|---|
| 31 | case 'change': |
|---|
| 32 | if(isset($form_input['form_submit'])) { |
|---|
| 33 | if(!is_array($errors = $categories->validate($form_input))) { |
|---|
| 34 | $categories->change_cat($form_input); |
|---|
| 35 | $categories->get_categories(); |
|---|
| 36 | $c['main'] .= "<p>".$l['admin']['cat_new_ok']."</p>".$categories->output_whole_list_admin(); |
|---|
| 37 | } |
|---|
| 38 | else { |
|---|
| 39 | $c['main'] .= error_output($errors); |
|---|
| 40 | $c['main'] .= $categories->output_form($form_input, 'new', $l['admin']['cat_new']); |
|---|
| 41 | } |
|---|
| 42 | } |
|---|
| 43 | else { |
|---|
| 44 | $form_input['name'] = $categories->get($get['id'], 'name'); |
|---|
| 45 | $form_input['id'] = $get['id']; |
|---|
| 46 | $form_input['url'] = $categories->get($get['id'], 'url'); |
|---|
| 47 | $form_input['description'] = $categories->get($get['id'], 'description'); |
|---|
| 48 | |
|---|
| 49 | $c['main'] .= $categories->output_form($form_input, 'change', $l['admin']['cat_change']); |
|---|
| 50 | } |
|---|
| 51 | break; |
|---|
| 52 | |
|---|
| 53 | case 'trash': |
|---|
| 54 | if($form_input['form_submit'] == $l['admin']['yes']) { |
|---|
| 55 | $categories->trash_cat($form_input['id']); |
|---|
| 56 | $categories->get_categories(); |
|---|
| 57 | $c['main'] .= "<p>".$l['admin']['cat_trash_ok']." |
|---|
| 58 | <a href='".add_session_id_to_url("categories.php")."'>".$l['admin']['cat_admincenter']."</a></p>"; |
|---|
| 59 | } |
|---|
| 60 | else { |
|---|
| 61 | $c['main'] .= "<form action='?action=trash' method='POST' accept-charset='UTF-8'> |
|---|
| 62 | <p>".$l['admin']['cat_really_trash']."</p> |
|---|
| 63 | <h3>".$categories->link($get['id'])."</h3> |
|---|
| 64 | <p><input type='submit' name='form_submit' value='".$l['admin']['yes']."' /> |
|---|
| 65 | <input type='hidden' name='id' value='".$get['id']."' /> |
|---|
| 66 | ".add_session_id_input_tag()." |
|---|
| 67 | <a href='".add_session_id_to_url("categories.php")."'>".$l['admin']['no']."</a></p> |
|---|
| 68 | </form>"; |
|---|
| 69 | } |
|---|
| 70 | break; |
|---|
| 71 | |
|---|
| 72 | default: |
|---|
| 73 | $c['main'] .= "<p><strong>»»</strong> <a href='".add_session_id_to_url("?action=new")."'>".$l['admin']['cat_new']."</a></p> |
|---|
| 74 | ".$categories->output_whole_list_admin(); |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | require(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'do_template.php'); |
|---|
| 78 | echo $body; |
|---|
| 79 | ?> |
|---|