Fix old fckeditor calls + fix PHP warnings see BT#8968

1.10.x
Julio Montoya 10 years ago
parent 4e517c5b25
commit 3b56cc764b
  1. 2
      main/admin/add_courses_to_usergroup.php
  2. 2
      main/admin/add_users_to_usergroup.php
  3. 2
      main/admin/course_import.php
  4. 2
      main/admin/dashboard_add_users_to_user.php
  5. 2
      main/admin/session_user_edit.php
  6. 213
      main/blog/blog.php
  7. 16
      main/blog/blog_admin.php
  8. 2
      main/course_description/course_description_form.class.php
  9. 2
      main/course_description/upload_file_form.class.php
  10. 2
      main/glossary/glossary_form.class.php
  11. 2
      main/glossary/upload_file_form.class.php
  12. 375
      main/inc/lib/blog.lib.php
  13. 2
      main/inc/lib/document.lib.php
  14. 2
      main/inc/lib/formvalidator/FormValidator.class.php
  15. 18
      main/link/category_form.class.php
  16. 3
      main/link/link_form.class.php
  17. 2
      main/link/upload_file_form.class.php
  18. 2
      main/notebook/notebook_form.class.php
  19. 2
      main/notebook/upload_file_form.class.php

@ -100,7 +100,7 @@ $filters = array(
);
$searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
$searchForm->add_header(get_lang('AdvancedSearch'));
$searchForm->addHeader(get_lang('AdvancedSearch'));
$renderer =& $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'id', $id);
foreach ($filters as $param) {

@ -184,7 +184,7 @@ $filters = array(
);
$searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
$searchForm->add_header(get_lang('AdvancedSearch'));
$searchForm->addHeader(get_lang('AdvancedSearch'));
$renderer =& $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'id', $id);

@ -210,7 +210,7 @@ if (isset($errors) && count($errors) != 0) {
}
$form = new FormValidator('import', 'post', api_get_self(), null, array('enctype' => 'multipart/form-data'));
$form->add_header($tool_name);
$form->addHeader($tool_name);
$form->addElement('file', 'import_file', get_lang('ImportCSVFileLocation'));
$form->addElement('checkbox', 'add_me_as_teacher', null, get_lang('AddMeAsTeacherInCourses'));
$form->addElement('button', 'save', get_lang('Import'));

@ -259,7 +259,7 @@ $filters = array(
);
$searchForm = new FormValidator('search', 'get', api_get_self().'?user='.$user_id);
$searchForm->add_header(get_lang('AdvancedSearch'));
$searchForm->addHeader(get_lang('AdvancedSearch'));
$renderer =& $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'user', $user_id);

@ -33,7 +33,7 @@ $interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('Sessi
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$sessionId, "name" => get_lang('SessionOverview'));
$form = new FormValidator('edit', 'post', api_get_self().'?session_id='.$sessionId.'&user_id='.$userId);
$form->add_header(get_lang('EditUserSessionDuration'));
$form->addHeader(get_lang('EditUserSessionDuration'));
$data = SessionManager::getUserSession($userId, $sessionId);
$userInfo = api_get_user_info($userId);

@ -6,9 +6,6 @@
* @package chamilo.blogs
*/
/**
* INIT
*/
// name of the language file that needs to be included
$language_file = "blog";
require_once '../inc/global.inc.php';
@ -22,18 +19,11 @@ if (empty($blog_id)) {
$this_section = SECTION_COURSES;
$current_course_tool = TOOL_BLOGS;
/* ACCESS RIGHTS */
// notice for unauthorized people.
api_protect_course_script(true);
//session
if(isset($_GET['id_session'])) {
$_SESSION['id_session'] = intval($_GET['id_session']);
}
$lib_path = api_get_path(LIBRARY_PATH);
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$nameTools = get_lang('Blogs');
@ -41,95 +31,146 @@ $DaysShort = api_get_week_days_short();
$DaysLong = api_get_week_days_long();
$MonthsLong = api_get_months_long();
$current_page = $_GET['action'];
$action = isset($_GET['action']) ? $_GET['action'] : null;
/*
PROCESSING
*/
$safe_post_title = Security::remove_XSS($_POST['post_title']);
$safe_post_file_comment = Security::remove_XSS($_POST['post_file_comment']);
$safe_post_full_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['post_full_text'])), COURSEMANAGERLOWSECURITY);
$safe_comment_text = Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['comment_text'])), COURSEMANAGERLOWSECURITY);
$safe_comment_title = Security::remove_XSS($_POST['comment_title']);
$safe_task_name = Security::remove_XSS($_POST['task_name']);
$safe_task_description = Security::remove_XSS($_POST['task_description']);
if (!empty($_POST['new_post_submit']) AND !empty($_POST['post_title'])) {
Blog :: create_post($safe_post_title, $safe_post_full_text, $safe_post_file_comment,$blog_id);
$safe_post_file_comment = isset($_GET['post_file_comment']) ? Security::remove_XSS($_POST['post_file_comment']) : null;
$safe_comment_text = isset($_GET['comment_text']) ? Security::remove_XSS(stripslashes(api_html_entity_decode($_POST['comment_text'])), COURSEMANAGERLOWSECURITY) : null;
$safe_comment_title = isset($_GET['comment_title']) ? Security::remove_XSS($_POST['comment_title']) : null;
$safe_task_name = isset($_GET['task_name']) ? Security::remove_XSS($_POST['task_name']) : null;
$safe_task_description = isset($_GET['task_description']) ? Security::remove_XSS($_POST['task_description']) : null;
if (!empty($_POST['new_post_submit'])) {
Blog:: create_post(
$_POST['title'],
$_POST['full_text'],
$_POST['post_file_comment'],
$blog_id
);
$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded'));
}
if (!empty($_POST['edit_post_submit']))
{
$safe_post_title = Security::remove_XSS($_POST['post_title']);
Blog :: edit_post($_POST['post_id'], $safe_post_title, $safe_post_full_text, $blog_id);
if (!empty($_POST['edit_post_submit'])) {
Blog:: edit_post(
$_POST['post_id'],
$_POST['title'],
$_POST['full_text'],
$blog_id
);
$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited'));
}
if (!empty($_POST['new_comment_submit']))
{
Blog :: create_comment($safe_comment_title, $safe_comment_text, $safe_post_file_comment,$blog_id, (int)$_GET['post_id'], $_POST['comment_parent_id']);
if (!empty($_POST['new_comment_submit'])) {
Blog:: create_comment(
$_POST['title'],
$_POST['comment'],
$_POST['post_file_comment'],
$blog_id,
$_GET['post_id'],
$_POST['comment_parent_id']
);
$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded'));
}
if (!empty($_POST['new_task_submit']))
{
Blog :: create_task($blog_id, $safe_task_name, $safe_task_description, $_POST['chkArticleDelete'], $_POST['chkArticleEdit'], $_POST['chkCommentsDelete'], $_POST['task_color']);
if (!empty($_POST['new_task_submit'])) {
Blog:: create_task(
$blog_id,
$safe_task_name,
$safe_task_description,
$_POST['chkArticleDelete'],
$_POST['chkArticleEdit'],
$_POST['chkCommentsDelete'],
$_POST['task_color']
);
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated'));
}
if (isset($_POST['edit_task_submit']))
{
Blog :: edit_task($_POST['blog_id'], $_POST['task_id'], $safe_task_name, $safe_task_description, $_POST['chkArticleDelete'], $_POST['chkArticleEdit'],$_POST['chkCommentsDelete'], $_POST['task_color']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskEdited'));
if (isset($_POST['edit_task_submit'])) {
Blog:: edit_task(
$_POST['blog_id'],
$_POST['task_id'],
$safe_task_name,
$safe_task_description,
$_POST['chkArticleDelete'],
$_POST['chkArticleEdit'],
$_POST['chkCommentsDelete'],
$_POST['task_color']
);
$return_message = array(
'type' => 'confirmation',
'message' => get_lang('TaskEdited')
);
}
if (!empty($_POST['assign_task_submit']))
{
Blog :: assign_task($blog_id, $_POST['task_user_id'], $_POST['task_task_id'], $_POST['task_year']."-".$_POST['task_month']."-".$_POST['task_day']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssigned'));
if (!empty($_POST['assign_task_submit'])) {
Blog:: assign_task(
$blog_id,
$_POST['task_user_id'],
$_POST['task_task_id'],
$_POST['task_year'] . "-" . $_POST['task_month'] . "-" . $_POST['task_day']
);
$return_message = array(
'type' => 'confirmation',
'message' => get_lang('TaskAssigned')
);
}
if (isset($_POST['assign_task_edit_submit']))
{
Blog :: edit_assigned_task($blog_id, $_POST['task_user_id'], $_POST['task_task_id'], $_POST['task_year']."-".$_POST['task_month']."-".$_POST['task_day'], $_POST['old_user_id'], $_POST['old_task_id'], $_POST['old_target_date']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('AssignedTaskEdited'));
if (isset($_POST['assign_task_edit_submit'])) {
Blog:: edit_assigned_task(
$blog_id,
$_POST['task_user_id'],
$_POST['task_task_id'],
$_POST['task_year'] . "-" . $_POST['task_month'] . "-" . $_POST['task_day'],
$_POST['old_user_id'],
$_POST['old_task_id'],
$_POST['old_target_date']
);
$return_message = array(
'type' => 'confirmation',
'message' => get_lang('AssignedTaskEdited')
);
}
if (!empty($_POST['new_task_execution_submit']))
{
Blog :: create_comment($safe_comment_title, $safe_comment_text, $blog_id, (int)$_GET['post_id'], $_POST['comment_parent_id'], $_POST['task_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentCreated'));
if (!empty($_POST['new_task_execution_submit'])) {
Blog:: create_comment(
$safe_comment_title,
$safe_comment_text,
$blog_id,
(int)$_GET['post_id'],
$_POST['comment_parent_id'],
$_POST['task_id']
);
$return_message = array(
'type' => 'confirmation',
'message' => get_lang('CommentCreated')
);
}
if (!empty($_POST['register']))
{
if (!empty($_POST['register'])) {
if (is_array($_POST['user'])) {
foreach ($_POST['user'] as $index => $user_id)
{
foreach ($_POST['user'] as $index => $user_id) {
Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id);
}
}
}
if (!empty($_POST['unregister']))
{
if (!empty($_POST['unregister'])) {
if (is_array($_POST['user'])) {
foreach ($_POST['user'] as $index => $user_id)
{
foreach ($_POST['user'] as $index => $user_id) {
Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id);
}
}
}
if (!empty($_GET['register']))
{
if (!empty($_GET['register'])) {
Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered'));
$flag = 1;
}
if (!empty($_GET['unregister']))
{
if (!empty($_GET['unregister'])) {
Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']);
}
if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
if (isset($_GET['do']) && $_GET['do'] == 'delete')
{
if (isset($_GET['do']) && $_GET['do'] == 'delete') {
Blog :: delete_task($blog_id, (int)$_GET['task_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted'));
}
@ -138,54 +179,40 @@ if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') {
Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id']));
$return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted'));
}
}
if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
$task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0;
if (isset($_GET['do']) && $_GET['do'] == 'delete_comment')
{
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id))
{
if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) {
Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted'));
}
else
{
} else {
$error = true;
$message = get_lang('ActionNotAllowed');
}
}
if (isset($_GET['do']) && $_GET['do'] == 'delete_article')
{
if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id))
{
if (isset($_GET['do']) && $_GET['do'] == 'delete_article') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) {
Blog :: delete_post($blog_id, (int)$_GET['article_id']);
$current_page = ''; // Article is gone, go to blog home
$action = ''; // Article is gone, go to blog home
$return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted'));
}
else
{
} else {
$error = true;
$message = get_lang('ActionNotAllowed');
}
}
if (isset($_GET['do']) && $_GET['do'] == 'rate')
{
if (isset($_GET['type']) && $_GET['type'] == 'post')
{
if (api_is_allowed('BLOG_'.$blog_id, 'article_rate'))
{
if (isset($_GET['do']) && $_GET['do'] == 'rate') {
if (isset($_GET['type']) && $_GET['type'] == 'post') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) {
Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
}
}
if (isset($_GET['type']) && $_GET['type'] == 'comment')
{
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add'))
{
if (isset($_GET['type']) && $_GET['type'] == 'comment') {
if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) {
Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']);
$return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded'));
}
@ -198,7 +225,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'view_post') {
$htmlHeadXtra[] = '<script src="tbl_change.js" type="text/javascript"></script>';
// Set bredcrumb
switch ($current_page) {
switch ($action) {
case 'new_post' :
$nameTools = get_lang('NewPost');
$interbreadcrumb[] = array ('url' => "blog.php?blog_id=$blog_id", "name" => Blog :: get_blog_title($blog_id));
@ -244,7 +271,6 @@ if (!empty($return_message)) {
}
}
// actions
echo '<div class=actions>';
?>
@ -258,7 +284,6 @@ echo '</div>';
// Tool introduction
Display::display_introduction_section(TOOL_BLOGS);
//Display::display_header($nameTools,'Blogs');
?>
<div class="sectiontitle"><?php echo Blog::get_blog_title($blog_id); ?></div>
<div class="sectioncomment"><?php echo Blog::get_blog_subtitle($blog_id); ?></div>
@ -309,7 +334,7 @@ if (isset($error)) {
}
if (isset($flag) && $flag == '1') {
$current_page = "manage_tasks";
$action = "manage_tasks";
Blog :: display_assign_task_form($blog_id);
}
@ -338,13 +363,13 @@ if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) {
$user_task = true;
}
switch ($current_page) {
case 'new_post' :
switch ($action) {
case 'new_post':
if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) {
// we show the form if
// 1. no post data
// 2. there is post data and the required field is empty
if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) {
if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) {
// if there is post data there is certainly an error in the form
if ($_POST) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* BLOG HOMEPAGE
* This file takes care of all blog navigation and displaying.
@ -52,22 +53,15 @@ if (api_is_allowed_to_edit()) {
Display::return_icon('new_blog.png',get_lang('AddBlog'),'',ICON_SIZE_MEDIUM)."</a>";
echo '</div>';
/*
PROCESSING..
*/
$get_blog_name = Security::remove_XSS($_POST['blog_name']);
$get_blog_subtitle = Security::remove_XSS($_POST['blog_subtitle']);
$get_blog_id = Security::remove_XSS($_POST['blog_id']);
if (!empty($_POST['new_blog_submit']) AND !empty($_POST['blog_name'])) {
if (isset($_POST['blog_name'])) {
Blog::create_blog($get_blog_name,$get_blog_subtitle);
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 (strlen(trim($_POST['blog_name']))>0) {
Blog::edit_blog($get_blog_id,$get_blog_name,$get_blog_subtitle);
Blog::edit_blog($_POST['blog_id'], $_POST['blog_name'], $_POST['blog_subtitle']);
Display::display_confirmation_message(get_lang('BlogEdited'));
}
}
@ -94,11 +88,11 @@ if (api_is_allowed_to_edit()) {
/*if ($_POST){
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
}*/
if (strlen($_POST['blog_name'])==0) {
/*if (strlen($_POST['blog_name'])==0) {
if (count($_POST)>0) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'));
}
}
}*/
Blog::display_new_blog_form();
}
}

@ -70,7 +70,7 @@ class CourseDescriptionForm extends \FormValidator
$defaults['title'] = $description->title;
$defaults['content'] = $description->content;
$this->add_header($description->get_title());
$this->addHeader($description->get_title());
$this->addHidden('description_type', $description->get_description_type());
$this->addHidden('c_id', $description->c_id);
$this->addHidden('id', $description->id);

@ -33,7 +33,7 @@ class UploadFileForm extends \FormValidator
function init()
{
$form_name = get_lang('UploadFile');
$this->add_header($form_name);
$this->addHeader($form_name);
$label = get_lang('File');
$this->add_file('file', $label);

@ -74,7 +74,7 @@ class GlossaryForm extends \FormValidator
$this->addHidden(Request::PARAM_SEC_TOKEN, Access::instance()->get_token());
$form_name = $glossary->id ? get_lang('TermEdit') : get_lang('TermAddNew');
$this->add_header($form_name);
$this->addHeader($form_name);
$this->add_textfield('name', get_lang('TermName'), $required = true, array('class' => 'span3'));
$this->add_html_editor('description', get_lang('TermDefinition'), true, array('ToolbarSet' => 'Glossary', 'Width' => '90%', 'Height' => '300'));

@ -42,7 +42,7 @@ class UploadFileForm extends \FormValidator
function init()
{
$form_name = get_lang('ImportGlossary');
$this->add_header($form_name);
$this->addHeader($form_name);
$this->addHidden(Request::PARAM_SEC_TOKEN, Access::instance()->get_token());
$label = get_lang('ImportCSVFileLocation');

@ -15,7 +15,8 @@
* Class
* @package chamilo.blogs
*/
class Blog {
class Blog
{
/**
* Get the title of a blog
* @author Toon Keppens
@ -227,19 +228,18 @@ class Blog {
* @param String $full_text
* @param Integer $blog_id
*/
public static function create_post ($title, $full_text, $file_comment, $blog_id) {
global $_user;
global $_course;
public static function create_post($title, $full_text, $file_comment, $blog_id)
{
$_user = api_get_user_info();
$_course = api_get_course_info();
$course_id = api_get_course_int_id();
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$upload_ok=true;
$has_attachment=false;
$current_date=date('Y-m-d H:i:s',time());
$course_id = api_get_course_int_id();
$current_date = api_get_utc_datetime();
if(!empty($_FILES['user_upload']['name'])) {
if (!empty($_FILES['user_upload']['name'])) {
$upload_ok = process_uploaded_file($_FILES['user_upload']);
$has_attachment=true;
}
@ -270,16 +270,16 @@ class Blog {
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
} else {
$new_file_name = uniqid('');
$new_path=$updir.'/'.$new_file_name;
$new_path = $updir.'/'.$new_file_name;
$result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path);
$comment=Database::escape_string($file_comment);
$comment = Database::escape_string($file_comment);
// Storing the attachments if any
if ($result) {
$sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '.
"VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )";
$result=Database::query($sql);
$message.=' / '.get_lang('AttachmentUpload');
$sql = 'INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size, blog_id,comment_id) '.
"VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$last_post_id."', '".intval($_FILES['user_upload']['size'])."', '".$blog_id."', '0' )";
Database::query($sql);
//Display::display_confirmation_message(get_lang('AttachmentUpload'));
}
}
}
@ -346,9 +346,10 @@ class Blog {
* @param Integer $post_id
* @param Integer $parent_id
*/
public static function create_comment($title, $full_text, $file_comment,$blog_id, $post_id, $parent_id, $task_id = 'NULL') {
global $_user;
global $_course;
public static function create_comment($title, $full_text, $file_comment, $blog_id, $post_id, $parent_id, $task_id = 'NULL')
{
$_user = api_get_user_info();
$_course = api_get_course_info();
global $blog_table_attachment;
$upload_ok = true;
@ -356,7 +357,7 @@ class Blog {
$current_date = date('Y-m-d H:i:s',time());
$course_id = api_get_course_int_id();
if(!empty($_FILES['user_upload']['name'])) {
if (!empty($_FILES['user_upload']['name'])) {
$upload_ok = process_uploaded_file($_FILES['user_upload']);
$has_attachment=true;
}
@ -371,10 +372,7 @@ class Blog {
Database::query($sql);
// Empty post values, or they are shown on the page again
$_POST['comment_title'] = "";
$_POST['comment_text'] = "";
$last_id=Database::insert_id();
$last_id = Database::insert_id();
if ($has_attachment) {
$courseDir = $_course['path'].'/upload/blog';
@ -382,29 +380,28 @@ class Blog {
$updir = $sys_course_path.$courseDir;
// Try to add an extension to the file if it hasn't one
$new_file_name = add_ext_on_mime(stripslashes($_FILES['user_upload']['name']), $_FILES['user_upload']['type']);
$new_file_name = add_ext_on_mime(
stripslashes($_FILES['user_upload']['name']),
$_FILES['user_upload']['type']
);
// user's file name
$file_name =$_FILES['user_upload']['name'];
if (!filter_extension($new_file_name))
{
if (!filter_extension($new_file_name)) {
Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
}
else
{
} else {
$new_file_name = uniqid('');
$new_path=$updir.'/'.$new_file_name;
$result= @move_uploaded_file($_FILES['user_upload']['tmp_name'], $new_path);
$comment=Database::escape_string($file_comment);
$comment = Database::escape_string($file_comment);
// Storing the attachments if any
if ($result)
{
if ($result) {
$sql='INSERT INTO '.$blog_table_attachment.'(c_id, filename,comment, path, post_id,size,blog_id,comment_id) '.
"VALUES ($course_id, '".Database::escape_string($file_name)."', '".$comment."', '".Database::escape_string($new_file_name)."' , '".$post_id."', '".$_FILES['user_upload']['size']."', '".$blog_id."', '".$last_id."' )";
$result=Database::query($sql);
$message.=' / '.get_lang('AttachmentUpload');
Database::query($sql);
//$message.=' / '.get_lang('AttachmentUpload');
}
}
}
@ -417,24 +414,25 @@ class Blog {
* @param Integer $blog_id
* @param Integer $comment_id
*/
public static function delete_comment ($blog_id, $post_id, $comment_id) {
// Init
public static function delete_comment ($blog_id, $post_id, $comment_id)
{
$tbl_blogs_comments = Database::get_course_table(TABLE_BLOGS_COMMENTS);
$tbl_blogs_rating = Database::get_course_table(TABLE_BLOGS_RATING);
$blog_id = intval($blog_id);
$post_id = intval($post_id);
$comment_id = intval($comment_id);
$course_id = api_get_course_int_id();
delete_all_blog_attachment($blog_id,$post_id,$comment_id);
delete_all_blog_attachment($blog_id, $post_id, $comment_id);
// Delete ratings on this comment
$sql = "DELETE FROM $tbl_blogs_rating WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND item_id = '".(int)$comment_id."' AND rating_type = 'comment'";
$sql = "DELETE FROM $tbl_blogs_rating
WHERE c_id = $course_id AND blog_id = '".$blog_id."' AND item_id = '".$comment_id."' AND rating_type = 'comment'";
Database::query($sql);
// select comments that have the selected comment as their parent
$sql = "SELECT comment_id FROM $tbl_blogs_comments WHERE c_id = $course_id AND parent_comment_id = '".(int)$comment_id."'";
$sql = "SELECT comment_id FROM $tbl_blogs_comments
WHERE c_id = $course_id AND parent_comment_id = '".$comment_id."'";
$result = Database::query($sql);
// Delete them recursively
@ -443,7 +441,8 @@ class Blog {
}
// Finally, delete the selected comment to
$sql = "DELETE FROM $tbl_blogs_comments WHERE c_id = $course_id AND comment_id = '".(int)$comment_id."'";
$sql = "DELETE FROM $tbl_blogs_comments
WHERE c_id = $course_id AND comment_id = '".$comment_id."'";
Database::query($sql);
}
@ -455,9 +454,10 @@ class Blog {
* @param String $description
* @param String $color
*/
public static function create_task ($blog_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) {
public static function create_task ($blog_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color)
{
// Init
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
$course_id = api_get_course_int_id();
@ -491,7 +491,7 @@ class Blog {
Database::query($sql);
}
if($commentsDelete == 'on') {
if ($commentsDelete == 'on') {
$sql = "
INSERT INTO " . $tbl_tasks_permissions . " (c_id, task_id, tool, action ) VALUES (
'" . (int)$course_id . "',
@ -512,14 +512,13 @@ class Blog {
* @param String $description
* @param String $color
*/
public static function edit_task($blog_id, $task_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color) {
// Init
public static function edit_task($blog_id, $task_id, $title, $description, $articleDelete, $articleEdit, $commentsDelete, $color)
{
$tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
$tbl_tasks_permissions = Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS);
$course_id = api_get_course_int_id();
// Create the task
$sql = "UPDATE $tbl_blogs_tasks SET
title = '".Database::escape_string($title)."',
@ -530,7 +529,8 @@ class Blog {
$tool = 'BLOG_' . $blog_id;
$sql = "DELETE FROM " . $tbl_tasks_permissions . " WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'";
$sql = "DELETE FROM " . $tbl_tasks_permissions . "
WHERE c_id = $course_id AND task_id = '" . (int)$task_id."'";
Database::query($sql);
if ($articleDelete == 'on') {
@ -575,7 +575,8 @@ class Blog {
$course_id = api_get_course_int_id();
// Delete posts
$sql = "DELETE FROM $tbl_blogs_tasks WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."'";
$sql = "DELETE FROM $tbl_blogs_tasks
WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."'";
Database::query($sql);
}
@ -584,12 +585,14 @@ class Blog {
* @param Integer $blog_id
* @param Integer $assignment_id
*/
public static function delete_assigned_task ($blog_id, $task_id,$user_id) {
public static function delete_assigned_task ($blog_id, $task_id, $user_id)
{
$tbl_blogs_tasks_rel_user = Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER);
$course_id = api_get_course_int_id();
// Delete posts
$sql = "DELETE FROM $tbl_blogs_tasks_rel_user WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."' AND user_id = '".(int)$user_id."'";
$sql = "DELETE FROM $tbl_blogs_tasks_rel_user
WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."' AND task_id = '".(int)$task_id."' AND user_id = '".(int)$user_id."'";
Database::query($sql);
}
@ -628,17 +631,12 @@ class Blog {
echo '<li><a href="blog.php?action=execute_task&amp;blog_id=' . $mytask['blog_id'] . '&amp;task_id='.stripslashes($mytask['task_id']) . '" title="[Blog: '.stripslashes($mytask['blog_name']) . '] ' . get_lang('ExecuteThisTask') . '">'.stripslashes($mytask['title']) . '</a></li>';
}
echo '<ul>';
}
else
{
} else {
echo get_lang('NoTasks');
}
}
else
{
} else {
echo get_lang('NoTasks');
}
}
/**
@ -646,14 +644,16 @@ class Blog {
* @author Toon Keppens
* @param Integer $blog_id
*/
public static function change_blog_visibility ($blog_id) {
public static function change_blog_visibility($blog_id)
{
// Init
$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$tbl_tool = Database::get_course_table(TABLE_TOOL_LIST);
$course_id = api_get_course_int_id();
// Get blog properties
$sql = "SELECT blog_name, visibility FROM $tbl_blogs WHERE c_id = $course_id AND blog_id='".(int)$blog_id."'";
$sql = "SELECT blog_name, visibility FROM $tbl_blogs
WHERE c_id = $course_id AND blog_id='".(int)$blog_id."'";
$result = Database::query($sql);
$blog = Database::fetch_array($result);
$visibility = $blog['visibility'];
@ -672,11 +672,11 @@ class Blog {
{
// Change visibility state, add to course home.
$sql = "UPDATE $tbl_blogs SET visibility = '1' WHERE c_id = $course_id AND blog_id ='".(int)$blog_id."' LIMIT 1";
$result = Database::query($sql);
Database::query($sql);
$sql = "INSERT INTO $tbl_tool (c_id, name, link, image, visibility, admin, address, added_tool, target )
VALUES ($course_id, '".Database::escape_string($title)."', 'blog/blog.php?blog_id=".(int)$blog_id."', 'blog.gif', '1', '0', 'pastillegris.gif', '0', '_self')";
$result = Database::query($sql);
Database::query($sql);
}
}
@ -720,8 +720,6 @@ class Blog {
$blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get());
// Create an introduction text (but keep FULL sentences)
$introduction_text = "";
$words = 0;
$blog_post_text_cut = cut($blog_post_text, $limit) ;
$words = strlen($blog_post_text);
@ -742,8 +740,7 @@ class Blog {
echo '<div class="blogpost_introduction" id="blogpost_introduction_'.$blog_post_id.'">' . $introduction_text.$readMoreLink.'</div>';
echo '<div class="blogpost_text" id="blogpost_text_' . $blog_post_id . '" style="display: none">' . $blog_post_text . '</div>';
$file_name_array=get_blog_attachment($blog_id,$blog_post_id,0);
$file_name_array = get_blog_attachment($blog_id,$blog_post_id,0);
if (!empty($file_name_array)) {
echo '<br /><br />';
@ -1107,24 +1104,26 @@ class Blog {
*
* @param Integer $blog_id
*/
public static function display_form_new_post ($blog_id)
public static function display_form_new_post($blog_id)
{
if (api_is_allowed('BLOG_' . $blog_id, 'article_add')) {
$form = new FormValidator(
'add_post',
'post',
api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq()
api_get_path(WEB_CODE_PATH)."blog/blog.php?action=new_post&blog_id=" . $blog_id . "&" . api_get_cidreq(),
null,
array('enctype' => 'multipart/form-data')
);
$form->addHidden('post_title_edited', 'false');
$form->add_header(get_lang('NewPost'));
$form->add_textfield('post_title', get_lang('Title'));
$form->addHeader(get_lang('NewPost'));
$form->add_textfield('title', get_lang('Title'));
$config = array();
if (!api_is_allowed_to_edit()) {
$config['ToolbarSet'] = 'ProjectStudent';
} else {
$config['ToolbarSet'] = 'Project';
}
$form->add_html_editor('post_full_text', get_lang('Content'), false, false, $config);
$form->add_html_editor('full_text', get_lang('Content'), false, false, $config);
$form->add_file('user_upload', get_lang('AddAnAttachment'));
$form->add_textarea('post_file_comment', get_lang('FileComment'));
$form->addHidden('new_post_submit', 'true');
@ -1142,16 +1141,16 @@ class Blog {
*
* @param Integer $blog_id
*/
public static function display_form_edit_post ($blog_id, $post_id)
public static function display_form_edit_post($blog_id, $post_id)
{
// Init
$tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
$tbl_users = Database::get_main_table(TABLE_MAIN_USER);
$course_id = api_get_course_int_id();
// Get posts and author
$sql = "SELECT post.*, user.lastname, user.firstname FROM $tbl_blogs_posts post
$sql = "SELECT post.*, user.lastname, user.firstname
FROM $tbl_blogs_posts post
INNER JOIN $tbl_users user ON post.author_id = user.user_id
WHERE
post.c_id = $course_id AND
@ -1161,48 +1160,30 @@ class Blog {
$result = Database::query($sql);
$blog_post = Database::fetch_array($result);
// Prepare data
$blog_post_text = stripslashes($blog_post['full_text']);
echo '<form name="edit_post" method="post" action="blog.php?action=edit_post&post_id=' . Security::remove_XSS($_GET['post_id']) . '&blog_id=' . Security::remove_XSS($blog_id) . '&article_id='.Security::remove_XSS($_GET['article_id']).'&task_id='.Security::remove_XSS($_GET['task_id']).'">';
// Form
// form title
echo '<legend>' . get_lang('EditPost') . '</legend>';
// article title
echo '<div><span class="form_required">*</span>' . get_lang('Title') . ': <input name="post_title" id="post_title" type="text" size="60" value="'.stripslashes($blog_post['title']) . '" /><br /></div>';
$form = new FormValidator(
'edit_post',
'post',
api_get_path(WEB_CODE_PATH).'blog/blog.php?action=edit_post&post_id=' . intval($_GET['post_id']) . '&blog_id=' . intval($blog_id) . '&article_id='.intval($_GET['article_id']).'&task_id='.intval($_GET['task_id'])
);
// article text
//$oFCKeditor = new FCKeditor('post_full_text') ;
$oFCKeditor = new CKeditor();
$form->addHeader(get_lang('EditPost'));
$form->add_textfield('title', get_lang('Title'));
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '200';
if(!api_is_allowed_to_edit()) {
$oFCKeditor->ToolbarSet = 'Project_Student';
if (!api_is_allowed_to_edit()) {
$config['ToolbarSet'] = 'ProjectStudent';
} else {
$oFCKeditor->ToolbarSet = 'Project';
$config['ToolbarSet'] = 'Project';
}
$oFCKeditor->Value = isset($_POST['post_full_text'])?stripslashes($_POST['post_full_text']):$blog_post_text;
echo '<div class="controls">';
//echo $oFCKeditor->Create();
$oFCKeditor->editor('post_full_text', $oFCKeditor->Value);
echo '</div>';
// submit
echo ' <div class="control-group">
<div class="controls">
<input type="hidden" name="action" value="" />
<input type="hidden" name="edit_post_submit" value="true" />
<input type="hidden" name="post_id" value="' . (int)$_GET['post_id'] . '" />
<button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button>
</div>
</div>';
echo '</form>';
$form->add_html_editor('full_text', get_lang('Content'), false, false, $config);
$form->addHidden('action', '');
$form->addHidden('edit_post_submit', 'true');
$form->addHidden('post_id', intval($_GET['post_id']));
$form->addButton('save', get_lang('Save'));
$form->setDefaults($blog_post);
$form->display();
}
/**
@ -2221,75 +2202,45 @@ class Blog {
*
* @param Integer $blog_id
*/
public static function display_new_comment_form ($blog_id, $post_id, $title) {
echo '<form name="add_post" enctype="multipart/form-data" method="post" action="blog.php?action=view_post&amp;blog_id=' . intval($blog_id) . '&amp;post_id=' . intval($post_id) . '">';
// form title
echo '<legend>';
echo (isset($_GET['task_id']) ? get_lang('ExecuteThisTask') : get_lang('AddNewComment'));
echo '</legend>';
// comment title
echo '<div><span class="form_required">*</span>' . get_lang('Title') . ': <input name="comment_title" id="comment_title" type="text" size="60" value="Re: '.stripslashes($title) . '" /></div><br />';
// comment text
//$oFCKeditor = new FCKeditor('comment_text') ;
$oFCKeditor = new CKeditor();
$oFCKeditor->Width = '100%';
$oFCKeditor->Height = '200';
if(!api_is_allowed_to_edit())
{
$oFCKeditor->ToolbarSet = 'Project_Comment_Student';
public static function display_new_comment_form($blog_id, $post_id, $title)
{
$form = new FormValidator(
'add_post',
'post',
api_get_path(WEB_CODE_PATH)."blog/blog.php?action=view_post&blog_id=" . intval($blog_id) . "&post_id=".intval($post_id)."&".api_get_cidreq(),
null,
array('enctype' => 'multipart/form-data')
);
$header = get_lang('AddNewComment');
if (isset($_GET['task_id'])) {
$header = get_lang('ExecuteThisTask');
}
else
{
$oFCKeditor->ToolbarSet = 'Project_Comment';
$form->addHeader($header);
$form->add_textfield('title', get_lang('Title'));
$config = array();
if (!api_is_allowed_to_edit()) {
$config['ToolbarSet'] = 'ProjectComment';
} else {
$config['ToolbarSet'] = 'ProjectCommentStudent';
}
$oFCKeditor->Value = isset($_POST['comment_text'])?stripslashes($_POST['comment_text']):'';
echo '<div class="controls">';
//echo $oFCKeditor->Create() ;
$oFCKeditor->editor('comment_text');
echo '
</div>';
$form->add_html_editor('comment', get_lang('Comment'), false, false, $config);
$form->add_file('user_upload', get_lang('AddAnAttachment'));
// attachment
echo ' <div class="control-group">
<label class="control-label">
' . get_lang('AddAnAttachment') . '
</label>
<div class="controls">
<input type="file" name="user_upload"/>
</div>
</div>';
$form->add_textarea('post_file_comment', get_lang('FileComment'));
// attachment comment
echo ' <div class="control-group">
<label class="control-label">
' . get_lang('FileComment') . '
</label>
<div class="controls">
<textarea name="post_file_comment" cols="34" /></textarea>
</div>
</div>';
$form->addHidden('action', null);
$form->addHidden('comment_parent_id', 0);
// attachment comment
echo ' <div class="control-group">
<div class="controls">
<input type="hidden" name="action" value="" />
<input type="hidden" name="comment_parent_id" id="comment_parent_id" value="0" />';
if(isset($_GET['task_id']))
{
echo ' <input type="hidden" name="new_task_execution_submit" value="true" />';
echo ' <input type="hidden" name="task_id" value="' . intval($_GET['task_id']) . '" />';
}
else
{
echo ' <input type="hidden" name="new_comment_submit" value="true" />';
}
echo ' <button class="save" type="submit" name="Submit">' . get_lang('Save') . '</button>
</div>
</div>';
echo '</form>';
if (isset($_GET['task_id'])) {
$form->addHidden('new_task_execution_submit', 'true');
$form->addHidden('task_id', intval($_GET['task_id']));
} else {
$form->addHidden('new_comment_submit', 'true');
}
$form->addButton('save', get_lang('Save'));
$form->display();
}
@ -2305,7 +2256,8 @@ class Blog {
*
* @return html code
*/
public static function display_minimonthcalendar ($month, $year, $blog_id) {
public static function display_minimonthcalendar ($month, $year, $blog_id)
{
// Init
global $_user;
global $DaysShort;
@ -2334,17 +2286,21 @@ class Blog {
//Start the week on monday
$startdayofweek = $dayone['wday'] <> 0 ? ($dayone['wday'] - 1) : 6;
$backwardsURL = api_get_self()."?blog_id=" . (int)$_GET['blog_id']."&amp;filter=" . Security::remove_XSS($_GET['filter'])."&amp;month=". ($month == 1 ? 12 : $month -1)."&amp;year=". ($month == 1 ? $year -1 : $year);
$forewardsURL = api_get_self()."?blog_id=" . (int)$_GET['blog_id']."&amp;filter=" . Security::remove_XSS($_GET['filter'])."&amp;month=". ($month == 12 ? 1 : $month +1)."&amp;year=". ($month == 12 ? $year +1 : $year);
$blogId = isset($_GET['blog_id']) ? intval($_GET['blog_id']) : null;
$filter = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null;
$backwardsURL = api_get_self()."?blog_id=" . $blogId."&amp;filter=" . $filter."&amp;month=". ($month == 1 ? 12 : $month -1)."&amp;year=". ($month == 1 ? $year -1 : $year);
$forewardsURL = api_get_self()."?blog_id=" . $blogId."&amp;filter=" . $filter."&amp;month=". ($month == 12 ? 1 : $month +1)."&amp;year=". ($month == 12 ? $year +1 : $year);
// Get posts for this month
$sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname FROM $tbl_blogs_posts post
$sql = "SELECT post.*, DAYOFMONTH(date_creation) as post_day, user.lastname, user.firstname
FROM $tbl_blogs_posts post
INNER JOIN $tbl_users user
ON post.author_id = user.user_id
WHERE post.c_id = $course_id AND
post.blog_id = '".(int)$blog_id."' AND
MONTH(date_creation) = '".(int)$month."' AND
YEAR(date_creation) = '".(int)$year."'
WHERE
post.c_id = $course_id AND
post.blog_id = '".(int)$blog_id."' AND
MONTH(date_creation) = '".(int)$month."' AND
YEAR(date_creation) = '".(int)$year."'
ORDER BY date_creation";
$result = Database::query($sql);
@ -2461,9 +2417,9 @@ class Blog {
* Blog admin | Display the form to add a new blog.
*
*/
public static function display_new_blog_form () {
$form = new FormValidator('add_blog', 'post','blog_admin.php?action=add');
public static function display_new_blog_form()
{
$form = new FormValidator('add_blog', 'post', 'blog_admin.php?action=add');
$form->addElement('header', get_lang('AddBlog'));
$form->addElement('text', 'blog_name', get_lang('Title'));
$form->addElement('textarea', 'blog_subtitle', get_lang('Subtitle'));
@ -2471,9 +2427,10 @@ class Blog {
$form->addElement('hidden', 'new_blog_submit', 'true');
$form->addElement('style_submit_button', null, get_lang('SaveProject'));
$defaults = array();
$defaults['blog_name'] = Security::remove_XSS($_POST['blog_name']);
$defaults['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']);
$defaults = array(
'blog_name' => isset($_POST['blog_name']) ? Security::remove_XSS($_POST['blog_name']) : null,
'blog_subtitle' => isset($_POST['blog_subtitle']) ? Security::remove_XSS($_POST['blog_subtitle']) : null
);
$form->setDefaults($defaults);
$form->display();
}
@ -2482,11 +2439,13 @@ class Blog {
* Blog admin | Display the form to edit a blog.
*
*/
public static function display_edit_blog_form ($blog_id) {
public static function display_edit_blog_form($blog_id)
{
$course_id = api_get_course_int_id();
$blog_id= intval($blog_id);
$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
$sql = "SELECT blog_id, blog_name, blog_subtitle FROM $tbl_blogs WHERE c_id = $course_id AND blog_id = '".(int)$blog_id."'";
$sql = "SELECT blog_id, blog_name, blog_subtitle FROM $tbl_blogs WHERE c_id = $course_id AND blog_id = '".$blog_id."'";
$result = Database::query($sql);
$blog = Database::fetch_array($result);
@ -2496,7 +2455,7 @@ class Blog {
$blog['blog_subtitle'] = Security::remove_XSS($_POST['blog_subtitle']);
}
$form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.Security::remove_XSS($_GET['blog_id']));
$form = new FormValidator('edit_blog', 'post','blog_admin.php?action=edit&blog_id='.intval($_GET['blog_id']));
$form->addElement('header', get_lang('EditBlog'));
$form->addElement('text', 'blog_name', get_lang('Title'));
$form->addElement('textarea', 'blog_subtitle', get_lang('Subtitle'));
@ -2527,21 +2486,24 @@ class Blog {
$session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id, false);
$sql = "SELECT blog_name,blog_subtitle,visibility,blog_id FROM $tbl_blogs WHERE c_id = $course_id ORDER BY date_creation DESC";
$sql = "SELECT blog_name, blog_subtitle, visibility, blog_id, session_id
FROM $tbl_blogs WHERE c_id = $course_id
ORDER BY date_creation DESC";
$result = Database::query($sql);
$list_info = array();
if (Database::num_rows($result)) {
while ($row_project=Database::fetch_row($result)) {
$list_info[]=$row_project;
}
}
$list_content_blog = array();
$list_body_blog = array();
$_user = api_get_user_info();
if (is_array($list_info)) {
foreach($list_info as $key => $info_log) {
//validacion when belongs to a session
foreach ($list_info as $key => $info_log) {
// Validation when belongs to a session
$session_img = api_get_session_image($info_log[4], $_user['status']);
$url_start_blog = 'blog.php' ."?". "blog_id=".$info_log[3]. "&amp;".api_get_cidreq();
@ -2554,19 +2516,18 @@ class Blog {
$visibility_icon=($info_log[2]==0) ? 'invisible' : 'visible';
$visibility_info=($info_log[2]==0) ? 'Visible' : 'Invisible';
$my_image.='<a href="' .api_get_self(). '?action=edit&amp;blog_id=' . $info_log[3] . '">';
$my_image.='<img src="../img/edit.gif" border="0" title="' . get_lang('EditBlog') . '" />';
$my_image.="</a>\n";
$my_image.='<a href="' .api_get_self(). '?action=delete&amp;blog_id=' . $info_log[3] . '" ';
$my_image.='onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >';
$my_image.='<img src="../img/delete.gif" border="0" title="' . get_lang('DeleteBlog') . '" />';
$my_image.="</a>\n";
$my_image.='<a href="' .api_get_self(). '?action=visibility&amp;blog_id=' . $info_log[3] . '">';
$my_image.='<img src="../img/' . $visibility_icon . '.gif" border="0" title="' . get_lang($visibility_info) . '" />';
$my_image.="</a>\n";
$my_image = '<a href="' .api_get_self(). '?action=edit&amp;blog_id=' . $info_log[3] . '">';
$my_image.= '<img src="../img/edit.gif" border="0" title="' . get_lang('EditBlog') . '" />';
$my_image.= "</a>\n";
$my_image.= '<a href="' .api_get_self(). '?action=delete&amp;blog_id=' . $info_log[3] . '" ';
$my_image.= 'onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES,$charset)). '\')) return false;" >';
$my_image.= '<img src="../img/delete.gif" border="0" title="' . get_lang('DeleteBlog') . '" />';
$my_image.= "</a>\n";
$my_image.= '<a href="' .api_get_self(). '?action=visibility&amp;blog_id=' . $info_log[3] . '">';
$my_image.= '<img src="../img/' . $visibility_icon . '.gif" border="0" title="' . get_lang($visibility_info) . '" />';
$my_image.= "</a>\n";
$list_body_blog[]=$my_image;
$my_image='';
$list_content_blog[]=$list_body_blog;
$list_body_blog = array();

@ -1446,7 +1446,7 @@ class DocumentManager
}
/**
* Allow to set a specific document as a new template for FCKEditor
* Allow to set a specific document as a new template for CKeditor
* for a particular user in a particular course
*
* @param string $title

@ -345,7 +345,7 @@ EOT;
/**
* @param string $text
*/
public function add_header($text)
public function addHeader($text)
{
$this->addElement('header', $text);
}

@ -12,7 +12,7 @@ namespace Link;
/**
* Edit/create a LinkCategory.
*
*
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Genevas
* @license /license.txt
*/
@ -25,7 +25,7 @@ class CategoryForm extends \FormValidator
{
parent::__construct($form_name, $method, $action, $target, $attributes, $track_submit);
}
/**
*
* @return object
@ -41,32 +41,30 @@ class CategoryForm extends \FormValidator
}
/**
*
* @param \Link\LinkCategory $category
* @param \Link\LinkCategory $category
*/
function init($category = null)
{
$this->set_category($category);
$defaults = array();
$defaults['category_title'] = $category->category_title;
$defaults['category_description'] = $category->description;
$this->addElement('hidden', 'c_id', $category->c_id);
$this->addElement('hidden', 'id', $category->id);
$this->addElement('hidden', 'session_id', $category->session_id);
$form_name = $category->id ? get_lang('ModifyCategory') : get_lang('AddCategory');
$this->add_header($form_name);
$this->addHeader($form_name);
$this->add_textfield('category_title', get_lang('Title'));
$this->addRule('category_title', get_lang('Required'), 'required');
$this->addElement('textarea', 'category_description', get_lang('Description'));
$this->addElement('button', 'save', get_lang('Save'), array('class' => 'btn save'));
$this->setDefaults($defaults);
}
function update_model()
{
$values = $this->exportValues();

@ -63,8 +63,7 @@ class LinkForm extends \FormValidator
$this->add_hidden('session_id', $link->session_id);
$form_name = $category->id ? get_lang('LinkMod') : get_lang('LinkAdd');
$this->add_header($form_name);
$this->addHeader($form_name);
$this->add_textfield('url', get_lang('Url'), $required = true, array('class' => 'span6'));
$this->addRule('url', get_lang('MalformedUrl'), 'regex', '|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i');

@ -33,7 +33,7 @@ class UploadFileForm extends \FormValidator
function init()
{
$form_name = get_lang('UploadFile');
$this->add_header($form_name);
$this->addHeader($form_name);
$label = get_lang('File');
$this->add_file('file', $label);

@ -67,7 +67,7 @@ class NotebookForm extends \FormValidator
$this->add_hidden(Request::PARAM_SEC_TOKEN, Access::instance()->get_token());
$form_name = $notebook->id ? get_lang('ModifyNote') : get_lang('NoteAddNew');
$this->add_header($form_name);
$this->addHeader($form_name);
$this->add_textfield('title', get_lang('NoteTitle'), $required = true, array('class' => 'span3'));

@ -35,7 +35,7 @@ class UploadFileForm extends \FormValidator
function init()
{
$form_name = get_lang('Import');
$this->add_header($form_name);
$this->addHeader($form_name);
$this->add_hidden(Request::PARAM_SEC_TOKEN, Access::instance()->get_token());
$label = get_lang('File');

Loading…
Cancel
Save