Minor - format code.

ofaj
jmontoya 9 years ago
parent 853dc01c6f
commit efbd4fb268
  1. 33
      main/blog/blog_admin.php

@ -2,17 +2,17 @@
/* For licensing terms, see /license.txt */
/**
* BLOG HOMEPAGE
* This file takes care of all blog navigation and displaying.
* @package chamilo.blogs
*/
* BLOG HOMEPAGE
* This file takes care of all blog navigation and displaying.
* @package chamilo.blogs
*/
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_BLOGS;
$this_section = SECTION_COURSES;
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
/* ACCESS RIGHTS */
// notice for unauthorized people.
@ -33,26 +33,26 @@ if (api_is_allowed_to_edit()) {
$interbreadcrumb[]= array ('url' => 'blog_admin.php?','name' => $nameTools);
$my_url='';
if (isset($_GET['action']) && $_GET['action']=='add') {
$current_section=get_lang('AddBlog');
$current_section = get_lang('AddBlog');
$my_url='action=add';
} elseif (isset($_GET['action']) && $_GET['action']=='edit') {
$current_section=get_lang('EditBlog');
$current_section = get_lang('EditBlog');
$my_url='action=edit&blog_id='.Security::remove_XSS($_GET['blog_id']);
}
Display::display_header('');
}
echo '<div class="actions">';
echo "<a href='".api_get_self()."?".api_get_cidreq()."&action=add'>",
Display::return_icon('new_blog.png',get_lang('AddBlog'),'',ICON_SIZE_MEDIUM)."</a>";
Display::return_icon('new_blog.png', get_lang('AddBlog'),'',ICON_SIZE_MEDIUM)."</a>";
echo '</div>';
if (!empty($_POST['new_blog_submit']) AND !empty($_POST['blog_name'])) {
if (!empty($_POST['new_blog_submit']) && !empty($_POST['blog_name'])) {
if (isset($_POST['blog_name'])) {
Blog::create_blog($_POST['blog_name'], $_POST['blog_subtitle']);
Display::display_confirmation_message(get_lang('BlogStored'));
}
}
if (!empty($_POST['edit_blog_submit']) AND !empty($_POST['blog_name'])) {
if (!empty($_POST['edit_blog_submit']) && !empty($_POST['blog_name'])) {
if (strlen(trim($_POST['blog_name']))>0) {
Blog::edit_blog($_POST['blog_id'], $_POST['blog_name'], $_POST['blog_subtitle']);
Display::display_confirmation_message(get_lang('BlogEdited'));
@ -76,16 +76,7 @@ if (api_is_allowed_to_edit()) {
// 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 OR (!empty($_POST) AND (empty($_POST['new_blog_submit']) OR empty($_POST['blog_name'])))) {
// if there is post data there is certainly an error in the form
/*if ($_POST){
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
}*/
/*if (strlen($_POST['blog_name'])==0) {
if (count($_POST)>0) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
}
}*/
if (!$_POST || (!empty($_POST) && (empty($_POST['new_blog_submit']) || empty($_POST['blog_name'])))) {
Blog::display_new_blog_form();
}
}
@ -94,7 +85,7 @@ if (api_is_allowed_to_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 OR (!empty($_POST) AND (empty($_POST['edit_blog_submit']) OR empty($_POST['blog_name']) ))) {
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) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));

Loading…
Cancel
Save