PHP warning/notices avoided

skala
Julio Montoya 13 years ago
parent f8031f3e78
commit 45e40247dd
  1. 4
      main/css/base.css
  2. 130
      main/document/create_document.php
  3. 6
      main/document/document.php
  4. 12
      main/document/document_quota.php
  5. 28
      main/inc/ajax/chat.ajax.php
  6. 3
      main/inc/lib/course.lib.php
  7. 86
      main/inc/lib/document.lib.php
  8. 4
      main/inc/lib/formvalidator/FormValidator.class.php
  9. 9
      main/social/myfiles.php
  10. 3
      main/social/profile.php

@ -4718,3 +4718,7 @@ i.size-32.icon-new-work{
.section-social #main_content .span9 { .section-social #main_content .span9 {
float: right; float: right;
} }
.xdebug-error {
margin-top: 20px;
}

@ -21,28 +21,28 @@ $this_section = SECTION_COURSES;
$htmlHeadXtra[] = ' $htmlHeadXtra[] = '
<script> <script>
var hide_bar = function() { var hide_bar = function() {
$("#template_col").hide(); $("#template_col").hide();
$("#doc_form").removeClass("span9"); $("#doc_form").removeClass("span9");
$("#doc_form").addClass("span11"); $("#doc_form").addClass("span11");
$("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'}) $("#hide_bar_template").css({"background-image" : \'url("../img/hide2.png")\'})
} }
$(document).ready(function() { $(document).ready(function() {
if ($(window).width() <= 785 ) { if ($(window).width() <= 785 ) {
hide_bar(); hide_bar();
} }
$("#hide_bar_template").toggle( $("#hide_bar_template").toggle(
function() { function() {
hide_bar(); hide_bar();
}, },
function() { function() {
$("#template_col").show(); $("#template_col").show();
$("#doc_form").removeClass("span11"); $("#doc_form").removeClass("span11");
$("#doc_form").addClass("span9"); $("#doc_form").addClass("span9");
$(this).css("background-image", \'url("../img/hide0.png")\'); $(this).css("background-image", \'url("../img/hide0.png")\');
} }
); );
}); });
function InnerDialogLoaded() { function InnerDialogLoaded() {
@ -75,7 +75,7 @@ function InnerDialogLoaded() {
}; };
var temp=false; var temp=false;
var temp2=false; var temp2=false;
var load_default_template = '. ((isset($_POST['submit']) || empty($_SERVER['QUERY_STRING'])) ? 'false' : 'true' ) .'; var load_default_template = '. ((isset($_POST['submit']) || empty($_SERVER['QUERY_STRING'])) ? 'false' : 'true' ) .';
function FCKeditor_OnComplete( editorInstance ) { function FCKeditor_OnComplete( editorInstance ) {
@ -147,7 +147,7 @@ function InnerDialogLoaded() {
function setFocus() { function setFocus() {
$("#document_title").focus(); $("#document_title").focus();
} }
$(window).load(function () { $(window).load(function () {
setFocus(); setFocus();
}); });
@ -174,13 +174,13 @@ if ($is_certificate_mode) {
$doc_table = Database::get_course_table(TABLE_DOCUMENT); $doc_table = Database::get_course_table(TABLE_DOCUMENT);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$document_data = DocumentManager::get_document_data_by_id($_REQUEST['id'], api_get_course_id(), true); $document_data = DocumentManager::get_document_data_by_id($_REQUEST['id'], api_get_course_id(), true);
if (empty($document_data)) { if (empty($document_data)) {
if (api_is_in_group()) { if (api_is_in_group()) {
$group_properties = GroupManager::get_group_properties(api_get_group_id()); $group_properties = GroupManager::get_group_properties(api_get_group_id());
$document_id = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']); $document_id = DocumentManager::get_document_id(api_get_course_info(), $group_properties['directory']);
$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id()); $document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
$dir = $document_data['path']; $dir = $document_data['path'];
$folder_id = $document_data['id']; $folder_id = $document_data['id'];
} else { } else {
@ -223,8 +223,8 @@ $doc_tree = explode('/', $dir);
$count_dir = count($doc_tree) -2; // "2" because at the begin and end there are 2 "/" $count_dir = count($doc_tree) -2; // "2" because at the begin and end there are 2 "/"
if (api_is_in_group()) { if (api_is_in_group()) {
$group_properties = GroupManager::get_group_properties(api_get_group_id()); $group_properties = GroupManager::get_group_properties(api_get_group_id());
// Level correction for group documents. // Level correction for group documents.
if (!empty($group_properties['directory'])) { if (!empty($group_properties['directory'])) {
$count_dir = $count_dir > 0 ? $count_dir - 1 : 0; $count_dir = $count_dir > 0 ? $count_dir - 1 : 0;
@ -262,7 +262,7 @@ if ($is_certificate_mode) {
} }
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir; $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$dir;
if (!is_dir($filepath)) { if (!is_dir($filepath)) {
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/'; $filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/'; $dir = '/';
@ -271,12 +271,13 @@ if (!is_dir($filepath)) {
$to_group_id = 0; $to_group_id = 0;
if (!$is_certificate_mode) { if (!$is_certificate_mode) {
$req_gid = null;
if (api_is_in_group()) { if (api_is_in_group()) {
$req_gid = '&amp;gidReq='.api_get_group_id(); $req_gid = '&amp;gidReq='.api_get_group_id();
$interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".api_get_group_id(), "name" => get_lang('GroupSpace')); $interbreadcrumb[] = array ("url" => "../group/group_space.php?gidReq=".api_get_group_id(), "name" => get_lang('GroupSpace'));
$noPHP_SELF = true; $noPHP_SELF = true;
$to_group_id = api_get_group_id(); $to_group_id = api_get_group_id();
$path = explode('/', $dir); $path = explode('/', $dir);
if ('/'.$path[1] != $group_properties['directory']) { if ('/'.$path[1] != $group_properties['directory']) {
api_not_allowed(true); api_not_allowed(true);
} }
@ -296,6 +297,7 @@ if (!($is_allowed_to_edit || $_SESSION['group_member_with_upload_rights'] || is_
/* Header */ /* Header */
event_access_tool(TOOL_DOCUMENT); event_access_tool(TOOL_DOCUMENT);
$display_dir = $dir; $display_dir = $dir;
if (isset ($group_properties)) { if (isset ($group_properties)) {
$display_dir = explode('/', $dir); $display_dir = explode('/', $dir);
@ -304,8 +306,10 @@ if (isset ($group_properties)) {
$display_dir = implode('/', $display_dir); $display_dir = implode('/', $display_dir);
} }
$select_cat = isset($_GET['selectcat']) ? intval($_GET['selectcat']) : null;
// Create a new form // Create a new form
$form = new FormValidator('create_document','post',api_get_self().'?'.api_get_cidreq().'&dir='.Security::remove_XSS(urlencode($dir)).'&selectcat='.Security::remove_XSS($_GET['selectcat']), null, array('class' =>'form-vertical' )); $form = new FormValidator('create_document','post',api_get_self().'?'.api_get_cidreq().'&dir='.Security::remove_XSS(urlencode($dir)).'&selectcat='.$select_cat, null, array('class' =>'form-vertical'));
// form title // form title
$form->addElement('header', $nameTools); $form->addElement('header', $nameTools);
@ -313,7 +317,7 @@ $form->addElement('header', $nameTools);
if ($is_certificate_mode) {//added condition for certicate in gradebook if ($is_certificate_mode) {//added condition for certicate in gradebook
$form->addElement('hidden','certificate','true',array('id'=>'certificate')); $form->addElement('hidden','certificate','true',array('id'=>'certificate'));
if (isset($_GET['selectcat'])) if (isset($_GET['selectcat']))
$form->addElement('hidden','selectcat', intval($_GET['selectcat'])); $form->addElement('hidden','selectcat', $select_cat);
} }
// Hidden element with current directory // Hidden element with current directory
@ -337,7 +341,7 @@ function document_exists($filename) {
} }
// Add group to the form // Add group to the form
if ($is_certificate_mode) { if ($is_certificate_mode) {
$form->addElement('text', 'title', get_lang('CertificateName'), 'class="span4" id="document_title"'); $form->addElement('text', 'title', get_lang('CertificateName'), 'class="span4" id="document_title"');
} else { } else {
$form->addElement('text', 'title', get_lang('Title'), 'class="span4" id="document_title"'); $form->addElement('text', 'title', get_lang('Title'), 'class="span4" id="document_title"');
@ -357,25 +361,25 @@ $form->add_html_editor('content','', false, false, $html_editor_config);
$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit); $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
// If we are not in the certificates creation, display a folder chooser for the // If we are not in the certificates creation, display a folder chooser for the
// new document created // new document created
if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $dir, $current_session_id)) { if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $dir, $current_session_id)) {
$folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit); $folders = DocumentManager::get_all_document_folders($_course, $to_group_id, $is_allowed_to_edit);
$parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory'))); $parent_select = $form->addElement('select', 'curdirpath', array(null, get_lang('DestinationDirectory')));
// Following two conditions copied from document.inc.php::build_directory_selector() // Following two conditions copied from document.inc.php::build_directory_selector()
$folder_titles = array(); $folder_titles = array();
if (is_array($folders)) { if (is_array($folders)) {
$escaped_folders = array(); $escaped_folders = array();
foreach ($folders as $key => & $val) { foreach ($folders as $key => & $val) {
//Hide some folders //Hide some folders
if ($val=='/HotPotatoes_files' || $val=='/certificates' || basename($val)=='css'){ if ($val=='/HotPotatoes_files' || $val=='/certificates' || basename($val)=='css'){
continue; continue;
} }
//Admin setting for Hide/Show the folders of all users //Admin setting for Hide/Show the folders of all users
if (api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))){ if (api_get_setting('show_users_folders') == 'false' && (strstr($val, '/shared_folder') || strstr($val, 'shared_folder_session_'))){
continue; continue;
} }
//Admin setting for Hide/Show Default folders to all users //Admin setting for Hide/Show Default folders to all users
@ -385,7 +389,7 @@ if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $dir, $curr
//Admin setting for Hide/Show chat history folder //Admin setting for Hide/Show chat history folder
if (api_get_setting('show_chat_folder') == 'false' && $val=='/chat_files'){ if (api_get_setting('show_chat_folder') == 'false' && $val=='/chat_files'){
continue; continue;
} }
$escaped_folders[$key] = Database::escape_string($val); $escaped_folders[$key] = Database::escape_string($val);
} }
@ -393,22 +397,22 @@ if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $dir, $curr
$sql = "SELECT * FROM $doc_table WHERE c_id = $course_id AND filetype='folder' AND path IN ('".$folder_sql."')"; $sql = "SELECT * FROM $doc_table WHERE c_id = $course_id AND filetype='folder' AND path IN ('".$folder_sql."')";
$res = Database::query($sql); $res = Database::query($sql);
$folder_titles = array(); $folder_titles = array();
while ($obj = Database::fetch_object($res)) { while ($obj = Database::fetch_object($res)) {
$folder_titles[$obj->path] = $obj->title; $folder_titles[$obj->path] = $obj->title;
} }
} }
if (empty($group_dir)) { if (empty($group_dir)) {
$parent_select -> addOption(get_lang('HomeDirectory'), '/'); $parent_select -> addOption(get_lang('HomeDirectory'), '/');
if (is_array($folders)) { if (is_array($folders)) {
foreach ($folders as & $folder) { foreach ($folders as & $folder) {
//Hide some folders //Hide some folders
if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css'){ if ($folder=='/HotPotatoes_files' || $folder=='/certificates' || basename($folder)=='css'){
continue; continue;
} }
//Admin setting for Hide/Show the folders of all users //Admin setting for Hide/Show the folders of all users
if (api_get_setting('show_users_folders') == 'false' && (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))){ if (api_get_setting('show_users_folders') == 'false' && (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))){
continue; continue;
} }
//Admin setting for Hide/Show Default folders to all users //Admin setting for Hide/Show Default folders to all users
@ -418,8 +422,8 @@ if (!$is_certificate_mode && !is_my_shared_folder($_user['user_id'], $dir, $curr
//Admin setting for Hide/Show chat history folder //Admin setting for Hide/Show chat history folder
if (api_get_setting('show_chat_folder') == 'false' && $folder=='/chat_files'){ if (api_get_setting('show_chat_folder') == 'false' && $folder=='/chat_files'){
continue; continue;
} }
$selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : ''; $selected = (substr($dir,0,-1) == $folder) ? ' selected="selected"' : '';
$path_parts = explode('/', $folder); $path_parts = explode('/', $folder);
$folder_titles[$folder] = cut($folder_titles[$folder], 80); $folder_titles[$folder] = cut($folder_titles[$folder], 80);
@ -463,29 +467,29 @@ $form->setDefaults($defaults);
// If form validates -> save the new document // If form validates -> save the new document
if ($form->validate()) { if ($form->validate()) {
$values = $form->exportValues(); $values = $form->exportValues();
$readonly = isset($values['readonly']) ? 1 : 0; $readonly = isset($values['readonly']) ? 1 : 0;
$values['title'] = trim($values['title']); $values['title'] = trim($values['title']);
if (!empty($values['curdirpath'])) { if (!empty($values['curdirpath'])) {
$dir = $values['curdirpath']; $dir = $values['curdirpath'];
} }
if ($dir[strlen($dir) - 1] != '/') { if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/'; $dir .= '/';
} }
//Setting the filename //Setting the filename
$filename = $values['title']; $filename = $values['title'];
$filename = addslashes(trim($filename)); $filename = addslashes(trim($filename));
$filename = Security::remove_XSS($filename); $filename = Security::remove_XSS($filename);
$filename = replace_dangerous_char($filename); $filename = replace_dangerous_char($filename);
$filename = disable_dangerous_file($filename); $filename = disable_dangerous_file($filename);
//Setting the title //Setting the title
$title = $values['title']; $title = $values['title'];
//Setting the extension //Setting the extension
$extension = 'html'; $extension = 'html';
@ -493,10 +497,10 @@ if ($form->validate()) {
if (strpos($content, '/css/frames.css') === false) { if (strpos($content, '/css/frames.css') === false) {
$content = str_replace('</head>', '<style> body{margin:10px;}</style><link rel="stylesheet" href="./css/frames.css" type="text/css" /></head>', $content); $content = str_replace('</head>', '<style> body{margin:10px;}</style><link rel="stylesheet" href="./css/frames.css" type="text/css" /></head>', $content);
} }
if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) { if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
$content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content); $content = str_replace(api_get_path(WEB_COURSE_PATH), $_configuration['url_append'].'/courses/', $content);
// change the path of mp3 to absolute // change the path of mp3 to absolute
// first regexp deals with ../../../ urls // first regexp deals with ../../../ urls
// Disabled by Ivan Tcholakov. // Disabled by Ivan Tcholakov.
@ -572,7 +576,7 @@ if ($form->validate()) {
// Copied from document.php // Copied from document.php
$dir_array = explode('/', $dir); $dir_array = explode('/', $dir);
$array_len = count($dir_array); $array_len = count($dir_array);
// Interbreadcrumb for the current directory root path // Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) { if (empty($document_data['parents'])) {
$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']); $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
@ -584,26 +588,26 @@ if ($form->validate()) {
Display :: display_header($nameTools, "Doc"); Display :: display_header($nameTools, "Doc");
//api_display_tool_title($nameTools); //api_display_tool_title($nameTools);
// actions // actions
echo '<div class="actions">'; echo '<div class="actions">';
// link back to the documents overview // link back to the documents overview
if ($is_certificate_mode) if ($is_certificate_mode)
echo '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>'; echo '<a href="document.php?certificate=true&id='.$folder_id.'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview'),'',ICON_SIZE_MEDIUM).'</a>';
else else
echo '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>'; echo '<a href="document.php?curdirpath='.Security::remove_XSS($dir).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo '</div>';
if ($is_certificate_mode) { if ($is_certificate_mode) {
$all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id()); $all_information_by_create_certificate = DocumentManager::get_all_info_to_certificate(api_get_user_id(), api_get_course_id());
$str_info = ''; $str_info = '';
foreach ($all_information_by_create_certificate[0] as $info_value) { foreach ($all_information_by_create_certificate[0] as $info_value) {
$str_info.=$info_value.'<br/>'; $str_info.=$info_value.'<br/>';
} }
$create_certificate = get_lang('CreateCertificateWithTags'); $create_certificate = get_lang('CreateCertificateWithTags');
Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false); Display::display_normal_message($create_certificate.': <br /><br/>'.$str_info,false);
} }
// HTML-editor // HTML-editor
echo '<div class="row-fluid" style="overflow:hidden"> echo '<div class="row-fluid" style="overflow:hidden">
<div id="template_col" class="span2" style="width:162px"> <div id="template_col" class="span2" style="width:162px">

@ -244,7 +244,10 @@ switch ($action) {
} }
// I'm in the certification module? // I'm in the certification module?
$is_certificate_mode = DocumentManager::is_certificate_mode($_GET['curdirpath']); $is_certificate_mode = false;
if (isset($_GET['curdirpath'])) {
$is_certificate_mode = DocumentManager::is_certificate_mode($_GET['curdirpath']);
}
if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') { if (isset($_REQUEST['certificate']) && $_REQUEST['certificate'] == 'true') {
$is_certificate_mode = true; $is_certificate_mode = true;
} }
@ -491,6 +494,7 @@ $mediaplayer_path = api_get_path(WEB_LIBRARY_PATH) . 'mediaplayer/player.swf';
$docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, false); $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath, $to_group_id, null, $is_allowed_to_edit || $group_member_with_upload_rights, false);
$count = 1; $count = 1;
$jquery = null;
if (!empty($docs_and_folders)) if (!empty($docs_and_folders))
foreach ($docs_and_folders as $file) { foreach ($docs_and_folders as $file) {

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
$language_file = array('document'); $language_file = array('document');
@ -49,7 +50,7 @@ if (!empty($session_list)) {
if ($session_id == $session_data['id']) { if ($session_id == $session_data['id']) {
$session_data['name'] = $session_data['name'] . ' * '; $session_data['name'] = $session_data['name'] . ' * ';
} }
$used_quota_bytes += $quota_bytes; $used_quota_bytes += $quota_bytes;
$session[] = array(addslashes(get_lang('Session').': '.$session_data['name']).' ('.format_file_size($quota_bytes).')', $quota_percentage); $session[] = array(addslashes(get_lang('Session').': '.$session_data['name']).' ('.format_file_size($quota_bytes).')', $quota_percentage);
} }
} }
@ -60,14 +61,14 @@ if (!empty($group_list)) {
foreach ($group_list as $group_data) { foreach ($group_list as $group_data) {
$quota_percentage = 0; $quota_percentage = 0;
$my_group_id = $group_data['id']; $my_group_id = $group_data['id'];
$quota_bytes = intval(DocumentManager::documents_total_space($course_id, $my_group_id, 0)); $quota_bytes = intval(DocumentManager::documents_total_space($course_id, $my_group_id, 0));
if (!empty($quota_bytes)) { if (!empty($quota_bytes)) {
$quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100; $quota_percentage = round($quota_bytes/$total_quota_bytes, 2)*100;
} }
if ($group_id == $my_group_id) { if ($group_id == $my_group_id) {
$group_data['name'] = $group_data['name'] . ' * '; $group_data['name'] = $group_data['name'] . ' * ';
} }
$used_quota_bytes += $quota_bytes; $used_quota_bytes += $quota_bytes;
$session[] = array(addslashes(get_lang('Group').': '.$group_data['name']).' ('.format_file_size($quota_bytes).')', $quota_percentage); $session[] = array(addslashes(get_lang('Group').': '.$group_data['name']).' ('.format_file_size($quota_bytes).')', $quota_percentage);
} }
} }
@ -97,12 +98,7 @@ $(document).ready(function(){
}); });
</script>"; </script>";
$tpl = new Template($tool_name); $tpl = new Template($tool_name);
$content = Display::page_subheader(get_lang('ShowCourseQuotaUse')).'<div id="chart1"></div>'; $content = Display::page_subheader(get_lang('ShowCourseQuotaUse')).'<div id="chart1"></div>';
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
$tpl->assign('content', $content); $tpl->assign('content', $content);
$tpl->display_one_col_template(); $tpl->display_one_col_template();

@ -15,20 +15,20 @@ if (api_is_anonymous()) {
} }
if (api_get_setting('allow_global_chat') == 'false') { if (api_get_setting('allow_global_chat') == 'false') {
exit; exit;
} }
$to_user_id = $_REQUEST['to']; $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null;
$message = $_REQUEST['message']; $message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
if (!isset($_SESSION['chatHistory'])) { if (!isset($_SESSION['chatHistory'])) {
$_SESSION['chatHistory'] = array(); $_SESSION['chatHistory'] = array();
} }
if (!isset($_SESSION['openChatBoxes'])) { if (!isset($_SESSION['openChatBoxes'])) {
$_SESSION['openChatBoxes'] = array(); $_SESSION['openChatBoxes'] = array();
} }
$chat = new Chat(); $chat = new Chat();
if ($chat->is_chat_blocked_by_exercises()) { if ($chat->is_chat_blocked_by_exercises()) {
@ -39,22 +39,22 @@ if ($chat->is_chat_blocked_by_exercises()) {
switch ($action) { switch ($action) {
case 'chatheartbeat': case 'chatheartbeat':
$chat->heartbeat(); $chat->heartbeat();
break; break;
case 'closechat': case 'closechat':
$chat->close(); $chat->close();
break; break;
case 'sendchat': case 'sendchat':
$chat->send(api_get_user_id(), $to_user_id, $message); $chat->send(api_get_user_id(), $to_user_id, $message);
break; break;
case 'startchatsession': case 'startchatsession':
$chat->start_session(); $chat->start_session();
break; break;
case 'set_status': case 'set_status':
$status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0; $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
$chat->set_user_status($status); $chat->set_user_status($status);
break; break;
default: default:
echo ''; echo '';
} }
exit; exit;

@ -2855,6 +2855,7 @@ class CourseManager {
if (!empty($special_course_list)) { if (!empty($special_course_list)) {
$with_special_courses = ' course.code IN ("'.implode('","',$special_course_list).'")'; $with_special_courses = ' course.code IN ("'.implode('","',$special_course_list).'")';
} }
$html = null;
if (!empty($with_special_courses)) { if (!empty($with_special_courses)) {
$sql = "SELECT course.id, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status, $sql = "SELECT course.id, course.code, course.subscribe subscr, course.unsubscribe unsubscr, course_rel_user.status status,
@ -2867,8 +2868,6 @@ class CourseManager {
$number_of_courses = Database::num_rows($rs_special_course); $number_of_courses = Database::num_rows($rs_special_course);
$key = 0; $key = 0;
$html = '';
if ($number_of_courses > 0) { if ($number_of_courses > 0) {
while ($course = Database::fetch_array($rs_special_course)) { while ($course = Database::fetch_array($rs_special_course)) {
$course_info = api_get_course_info($course['code']); $course_info = api_get_course_info($course['code']);

@ -17,11 +17,11 @@
class DocumentManager { class DocumentManager {
private function __construct() { private function __construct() {
} }
/** /**
* @return the document folder quota for the current course, in bytes, or the default quota * @return the document folder quota for the current course, in bytes, or the default quota
*/ */
public static function get_course_quota($course_code = null) { public static function get_course_quota($course_code = null) {
if (empty($course_code)) { if (empty($course_code)) {
@ -485,24 +485,24 @@ class DocumentManager {
//condition for search (get ALL folders and documents) //condition for search (get ALL folders and documents)
$sql = "SELECT docs.id, $sql = "SELECT docs.id,
docs.filetype, docs.filetype,
docs.path, docs.path,
docs.title, docs.title,
docs.comment, docs.comment,
docs.size, docs.size,
docs.readonly, docs.readonly,
docs.session_id, docs.session_id,
last.id_session item_property_session_id, last.id_session item_property_session_id,
last.lastedit_date, last.lastedit_date,
last.visibility, last.visibility,
last.insert_user_id last.insert_user_id
FROM " . $TABLE_ITEMPROPERTY . " AS last INNER JOIN " . $TABLE_DOCUMENT . " AS docs FROM " . $TABLE_ITEMPROPERTY . " AS last INNER JOIN " . $TABLE_DOCUMENT . " AS docs
ON (docs.id = last.ref AND last.tool = '" . TOOL_DOCUMENT . "' AND docs.c_id = {$_course['real_id']} AND last.c_id = {$_course['real_id']}) ON (docs.id = last.ref AND last.tool = '" . TOOL_DOCUMENT . "' AND docs.c_id = {$_course['real_id']} AND last.c_id = {$_course['real_id']})
WHERE WHERE
docs.path LIKE '" . $path . $added_slash . "%' AND docs.path LIKE '" . $path . $added_slash . "%' AND
docs.path NOT LIKE '" . $path . $added_slash . "%/%' AND docs.path NOT LIKE '" . $path . $added_slash . "%/%' AND
" . $to_field . " = " . $to_value . " AND " . $to_field . " = " . $to_value . " AND
last.visibility" . $visibility_bit . $condition_session; last.visibility" . $visibility_bit . $condition_session;
$result = Database::query($sql); $result = Database::query($sql);
@ -623,11 +623,11 @@ class DocumentManager {
//condition for the session //condition for the session
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$sql = "SELECT DISTINCT docs.id, path $sql = "SELECT DISTINCT docs.id, path
FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs FROM $TABLE_ITEMPROPERTY AS last INNER JOIN $TABLE_DOCUMENT AS docs
ON (docs.id = last.ref AND last.tool = '" . TOOL_DOCUMENT . "' AND last.c_id = {$_course['real_id']} AND docs.c_id = {$_course['real_id']} ) ON (docs.id = last.ref AND last.tool = '" . TOOL_DOCUMENT . "' AND last.c_id = {$_course['real_id']} AND docs.c_id = {$_course['real_id']} )
WHERE WHERE
docs.filetype = 'folder' AND docs.filetype = 'folder' AND
last.to_group_id = " . $to_group_id . " AND last.to_group_id = " . $to_group_id . " AND
last.visibility <> 2 $condition_session "; last.visibility <> 2 $condition_session ";
@ -877,7 +877,7 @@ class DocumentManager {
if ($document_id) { if ($document_id) {
self::delete_document_from_db($document_id); self::delete_document_from_db($document_id);
//checking //checking
//$file_exists_in_db = self::get_document_data_by_id($document_id, $_course['code']); //$file_exists_in_db = self::get_document_data_by_id($document_id, $_course['code']);
$file_deleted_from_db = true; $file_deleted_from_db = true;
} }
@ -933,7 +933,7 @@ class DocumentManager {
} }
} }
//Checking inconsistency //Checking inconsistency
if ($file_deleted_from_db && $file_deleted_from_disk || if ($file_deleted_from_db && $file_deleted_from_disk ||
$file_deleted_from_db && $file_renamed_from_disk) { $file_deleted_from_db && $file_renamed_from_disk) {
return true; return true;
@ -1536,7 +1536,7 @@ class DocumentManager {
$is_certificate_mode = false; $is_certificate_mode = false;
$is_certificate_array = explode('/', $dir); $is_certificate_array = explode('/', $dir);
array_shift($is_certificate_array); array_shift($is_certificate_array);
if ($is_certificate_array[0] == 'certificates') { if (isset($is_certificate_array[0]) && $is_certificate_array[0] == 'certificates') {
$is_certificate_mode = true; $is_certificate_mode = true;
} }
return $is_certificate_mode; return $is_certificate_mode;
@ -2005,7 +2005,7 @@ class DocumentManager {
} }
} else { } else {
if ($type_url == 'url') { if ($type_url == 'url') {
} }
} }
} }
@ -2368,7 +2368,7 @@ class DocumentManager {
docs.id = props.ref AND docs.id = props.ref AND
props.tool = '" . TOOL_DOCUMENT . "' AND props.tool = '" . TOOL_DOCUMENT . "' AND
props.visibility <> 2 props.visibility <> 2
$group_condition $group_condition
$session_condition $session_condition
"; ";
$result = Database::query($sql); $result = Database::query($sql);
@ -2465,30 +2465,30 @@ class DocumentManager {
} }
/** /**
* *
* @param array paremeters: count, url, extension * @param array paremeters: count, url, extension
* @return string * @return string
*/ */
static function generate_jplayer_jquery($params = array()) { static function generate_jplayer_jquery($params = array()) {
$js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/'; $js_path = api_get_path(WEB_LIBRARY_PATH) . 'javascript/';
$jplayer_definition = ' $("#jquery_jplayer_' . $params['count'] . '").jPlayer({ $jplayer_definition = ' $("#jquery_jplayer_' . $params['count'] . '").jPlayer({
ready: function() { ready: function() {
$(this).jPlayer("setMedia", { $(this).jPlayer("setMedia", {
' . $params['extension'] . ' : "' . $params['url'] . '" ' . $params['extension'] . ' : "' . $params['url'] . '"
}); });
}, },
play: function() { // To avoid both jPlayers playing together. play: function() { // To avoid both jPlayers playing together.
$(this).jPlayer("pauseOthers"); $(this).jPlayer("pauseOthers");
}, },
//errorAlerts: true, //errorAlerts: true,
//warningAlerts: true, //warningAlerts: true,
swfPath: "' . $js_path . 'jquery-jplayer", swfPath: "' . $js_path . 'jquery-jplayer",
//supplied: "m4a, oga, mp3, ogg, wav", //supplied: "m4a, oga, mp3, ogg, wav",
supplied: "' . $params['extension'] . '", supplied: "' . $params['extension'] . '",
wmode: "window", wmode: "window",
solution: "flash, html", // Do not change this setting solution: "flash, html", // Do not change this setting
cssSelectorAncestor: "#jp_container_' . $params['count'] . '", cssSelectorAncestor: "#jp_container_' . $params['count'] . '",
}); ' . "\n\n"; }); ' . "\n\n";
return $jplayer_definition; return $jplayer_definition;
} }
@ -2523,8 +2523,8 @@ class DocumentManager {
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li> <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li> <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
' . $extra_controls . ' ' . $extra_controls . '
</ul> </ul>
' . $progress . ' ' . $progress . '
</div> </div>
</div> </div>
</div>'; </div>';
@ -2639,13 +2639,13 @@ class DocumentManager {
$sql_doc = "SELECT last.visibility, docs.* $sql_doc = "SELECT last.visibility, docs.*
FROM $tbl_item_prop AS last, $tbl_doc AS docs FROM $tbl_item_prop AS last, $tbl_doc AS docs
WHERE docs.id = last.ref AND WHERE docs.id = last.ref AND
docs.path LIKE '" . $path . $added_slash . "%' AND docs.path LIKE '" . $path . $added_slash . "%' AND
docs.path NOT LIKE '%_DELETED_%' AND docs.path NOT LIKE '%_DELETED_%' AND
last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND last.tool = '" . TOOL_DOCUMENT . "' $condition_session AND
last.visibility = '1' AND last.visibility = '1' AND
docs.c_id = {$course_info['real_id']} AND docs.c_id = {$course_info['real_id']} AND
last.c_id = {$course_info['real_id']} last.c_id = {$course_info['real_id']}
$add_folder_filter $add_folder_filter
ORDER BY docs.title ASC"; ORDER BY docs.title ASC";
@ -2852,7 +2852,7 @@ class DocumentManager {
// Show the "image name" not the filename of the image. // Show the "image name" not the filename of the image.
if ($lp_id) { if ($lp_id) {
//LP URL //LP URL
$url = api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;file=' . $key . '&amp;lp_id=' . $lp_id; $url = api_get_self() . '?cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&amp;action=add_item&amp;type=' . TOOL_DOCUMENT . '&amp;file=' . $key . '&amp;lp_id=' . $lp_id;
if (!empty($overwrite_url)) { if (!empty($overwrite_url)) {
$url = $overwrite_url . '&document_id=' . $key; $url = $overwrite_url . '&document_id=' . $key;
@ -2868,8 +2868,8 @@ class DocumentManager {
if (!file_exists($img_sys_path . $icon)) { if (!file_exists($img_sys_path . $icon)) {
$img = $img_path . 'icons/16/default_small.gif'; $img = $img_path . 'icons/16/default_small.gif';
} }
$link = Display::url('<img alt="" src="' . $img . '" title="" />&nbsp;' . $my_file_title, $url, array('target' => $target)); $link = Display::url('<img alt="" src="' . $img . '" title="" />&nbsp;' . $my_file_title, $url, array('target' => $target));
if ($lp_id == false) { if ($lp_id == false) {

@ -216,7 +216,7 @@ class FormValidator extends HTML_QuickForm
* *
*/ */
} }
//Set Header template //Set Header template
$renderer->setHeaderTemplate('<legend>{header}</legend>'); $renderer->setHeaderTemplate('<legend>{header}</legend>');
@ -331,7 +331,7 @@ EOT;
$config = array('FullPage' => (bool) $full_page); $config = array('FullPage' => (bool) $full_page);
} }
if ($full_page) { if ($full_page) {
$html_type = $_SESSION['status'] == COURSEMANAGER ? TEACHER_HTML_FULLPAGE : STUDENT_HTML_FULLPAGE; $html_type = isset($_SESSION['status']) && $_SESSION['status'] == COURSEMANAGER ? TEACHER_HTML_FULLPAGE : STUDENT_HTML_FULLPAGE;
//First *filter* the HTML (markup, indenting, ...) //First *filter* the HTML (markup, indenting, ...)
//$this->applyFilter($name,'html_filter_teacher_fullpage'); //$this->applyFilter($name,'html_filter_teacher_fullpage');
} else { } else {

@ -68,6 +68,8 @@ function register_friend(element_input) {
</script>'; </script>';
$show_message = null;
// easy links // easy links
if (is_array($_GET) && count($_GET)>0) { if (is_array($_GET) && count($_GET)>0) {
foreach($_GET as $key => $value) { foreach($_GET as $key => $value) {
@ -93,21 +95,22 @@ if (is_array($_GET) && count($_GET)>0) {
} }
$social_left_content = SocialManager::show_social_menu('myfiles'); $social_left_content = SocialManager::show_social_menu('myfiles');
$actions = null;
if (isset($_GET['cidReq'])){ if (isset($_GET['cidReq'])){
$actions = '<a href="'.api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&amp;id_session='.Security::remove_XSS($_GET['id_session']).'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;id='.Security::remove_XSS($_GET['parent_id']).'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('Documents').' ('.get_lang('Course').')').'</a>'; $actions = '<a href="'.api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&amp;id_session='.Security::remove_XSS($_GET['id_session']).'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;id='.Security::remove_XSS($_GET['parent_id']).'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('Documents').' ('.get_lang('Course').')').'</a>';
} }
$social_right_content .= '<div class="span9">'; $social_right_content = '<div class="span9">';
$social_right_content .= '<iframe name="fileManager" id="fileManager" src="'.api_get_path(WEB_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=stand_alone" scrolling="no" noresize="noresize" frameborder="no" style="height:450px; width:100%; float:left"></iframe>'; $social_right_content .= '<iframe name="fileManager" id="fileManager" src="'.api_get_path(WEB_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=stand_alone" scrolling="no" noresize="noresize" frameborder="no" style="height:450px; width:100%; float:left"></iframe>';
$social_right_content .= '</div>'; $social_right_content .= '</div>';
$tpl = new Template(); $tpl = new Template();
$tpl->assign('social_left_content', $social_left_content); $tpl->assign('social_left_content', $social_left_content);
$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content); $tpl->assign('social_right_content', $social_right_content);
$tpl->assign('actions', $actions); $tpl->assign('actions', $actions);
$tpl->assign('message', $show_message); $tpl->assign('message', $show_message);
$tpl->assign('content', $content);
$social_layout = $tpl->get_template('layout/social_layout.tpl'); $social_layout = $tpl->get_template('layout/social_layout.tpl');
$tpl->display($social_layout); $tpl->display($social_layout);

@ -541,7 +541,8 @@ if ($show_full_profile) {
} }
$social_right_content .= SocialManager::social_wrapper_div($my_groups, 9); $social_right_content .= SocialManager::social_wrapper_div($my_groups, 9);
} }
$my_courses = null;
// COURSES LIST // COURSES LIST
if ( is_array($list) ) { if ( is_array($list) ) {
$my_courses .= '<div><h3>'.api_ucfirst(get_lang('MyCourses')).'</h3></div>'; $my_courses .= '<div><h3>'.api_ucfirst(get_lang('MyCourses')).'</h3></div>';

Loading…
Cancel
Save