'blog_admin.php?'.api_get_cidreq(), 'name' => $nameTools, ]; $my_url = ''; if ($action == 'add') { $current_section = get_lang('Create a new project'); $my_url = 'action=add'; } elseif ($action == 'edit') { $current_section = get_lang('Edit a project'); $my_url = 'action=edit&blog_id='.Security::remove_XSS($_GET['blog_id']); } Display::display_header(''); } echo '
'; echo "", Display::return_icon('new_blog.png', get_lang('Create a new project'), '', ICON_SIZE_MEDIUM).""; echo '
'; if (!empty($_POST['new_blog_submit']) && !empty($_POST['blog_name'])) { if (isset($_POST['blog_name'])) { Blog::addBlog($_POST['blog_name'], $_POST['blog_subtitle']); echo Display::return_message(get_lang('The project has been added.'), 'confirmation'); } } if (!empty($_POST['edit_blog_submit']) && !empty($_POST['blog_name'])) { if (strlen(trim($_POST['blog_name'])) > 0) { Blog::editBlog($_POST['blog_id'], $_POST['blog_name'], $_POST['blog_subtitle']); echo Display::return_message(get_lang('The project has been edited.'), 'confirmation'); } } if (isset($_GET['action']) && $_GET['action'] == 'visibility') { Blog::changeBlogVisibility(intval($_GET['blog_id'])); echo Display::return_message(get_lang('The visibility has been changed.'), 'confirmation'); } if (isset($_GET['action']) && $_GET['action'] == 'delete') { Blog::deleteBlog(intval($_GET['blog_id'])); echo Display::return_message(get_lang('The project has been deleted.'), 'confirmation'); } if (isset($_GET['action']) && $_GET['action'] == 'add') { // we show the form if // 1. no post data // 2. there is post data and one of the required form elements is empty if (!$_POST || (!empty($_POST) && (empty($_POST['new_blog_submit']) || empty($_POST['blog_name'])))) { Blog::displayBlogCreateForm(); } } if (isset($_GET['action']) && $_GET['action'] == 'edit') { // we show the form if // 1. no post data // 2. there is post data and one of the three form elements is empty if (!$_POST || (!empty($_POST) && (empty($_POST['edit_blog_submit']) || empty($_POST['blog_name'])))) { // if there is post data there is certainly an error in the form if ($_POST) { echo Display::return_message(get_lang('The form contains incorrect or incomplete data. Please check your input.'), 'error'); } Blog::displayBlogEditForm(intval($_GET['blog_id'])); } } Blog::displayBlogsList(); } else { api_not_allowed(true); } // Display the footer Display::display_footer();