Task #763 - All the replacements api_get_path('WEB_COURSE_PATH') --> api_get_path(WEB_COURSE_PATH) and other similar to them.

skala
Ivan Tcholakov 16 years ago
parent 4f978ed93e
commit 54a9b942c2
  1. 2
      main/admin/sub_language.php
  2. 14
      main/admin/sub_language_add.php
  3. 2
      main/admin/sub_language_ajax.inc.php
  4. 42
      main/admin/user_import.php
  5. 40
      main/document/create_document.php
  6. 28
      main/document/edit_document.php
  7. 2
      main/document/headerpage.php
  8. 2
      main/document/showinframes.php
  9. 4
      main/dropbox/dropbox_config.inc.php
  10. 4
      main/exercice/export/exercise_import.php
  11. 174
      main/forum/forumfunction.inc.php
  12. 74
      main/inc/lib/document.lib.php
  13. 2
      main/inc/lib/fckeditor/fckeditor.php
  14. 4
      main/inc/lib/fckeditor/fcktemplates.xml.php
  15. 4
      main/inc/lib/online.inc.php
  16. 26
      main/inc/lib/system_announcements.lib.php
  17. 6
      main/metadata/md_funcs.php
  18. 4
      main/metadata/phpdig/search.php
  19. 2
      main/mySpace/myspace.lib.php
  20. 16
      main/newscorm/aicc.class.php
  21. 32
      main/newscorm/learnpath.class.php
  22. 16
      main/newscorm/learnpath_functions.inc.php
  23. 6
      main/newscorm/lp_admin_view.php
  24. 4
      main/newscorm/lp_list.php
  25. 12
      main/newscorm/resourcelinker.inc.php
  26. 2
      main/newscorm/resourcelinker.php
  27. 14
      main/newscorm/scorm.class.php
  28. 2
      main/newscorm/scorm.lib.php
  29. 12
      main/resourcelinker/resourcelinker.inc.php
  30. 2
      main/resourcelinker/resourcelinker.php
  31. 2
      main/work/work.php
  32. 4
      tests/main/inc/lib/online.inc.test.php

@ -81,7 +81,7 @@ if (isset($_GET['id']) && $_GET['id']==strval(intval($_GET['id']))) {
}
$language_name=get_lang('RegisterTermsOfSubLanguageForLanguage').' ( '.strtolower($language_name).' )';
$dokeos_path_folder=api_get_path('SYS_LANG_PATH').$all_data_of_language['dokeos_folder'];
$dokeos_path_folder=api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder'];
//
if (!is_dir($dokeos_path_folder) || strlen($all_data_of_language['dokeos_folder'])==0) {
api_not_allowed(true);

@ -48,9 +48,9 @@ function add_sub_language ($original_name,$english_name,$isocode,$sublanguage_av
* @param string English language name (occitan, wallon, flanders)
* @param string ISO code (fr_FR, ...)
* @param int Whether the sublanguage is published (0=unpublished, 1=published)
* @return array Array describing the number of items found that match the
* current language insert attempt (original_name => true,
* english_name => true, isocode => true,
* @return array Array describing the number of items found that match the
* current language insert attempt (original_name => true,
* english_name => true, isocode => true,
* execute_add => true/false). If execute_add is true, then we
* can proceed.
* @todo This function is not transaction-safe and should probably be included
@ -93,7 +93,7 @@ function check_if_language_exist ($original_name,$english_name,$isocode,$sublang
}
/**
* Get the name of a language by id. This is just a wrapper for the
* Get the name of a language by id. This is just a wrapper for the
* SubLanguageManager::get_name_of_language_by_id() method and should not exist
* @param int Language ID
* @return string Language name
@ -103,7 +103,7 @@ function get_name_of_language_by_id ($language_id) {
return SubLanguageManager::get_name_of_language_by_id($language_id);
}
/**
* Check if language exist, given its ID. This is just a wrapper for the
* Check if language exist, given its ID. This is just a wrapper for the
* SubLanguageManager::check_if_exist_language_by_id() method and should not exist
* @param int Language ID
* @return bool
@ -254,7 +254,7 @@ if (isset($_POST['SubmitAddNewLanguage'])) {
$english_name=str_replace(' ','_',$english_name);
$isocode=str_replace(' ','_',$isocode);
$str_info='<br/>'.get_lang('OriginalName').' : '.$original_name.'<br/>'.get_lang('EnglishName').' : '.$english_name.'<br/>'.get_lang('PlatformCharsetTitle').' : '.$isocode;
$path=api_get_path('SYS_LANG_PATH').$english_name;
$path=api_get_path(SYS_LANG_PATH).$english_name;
$mkdir_result=add_directory_of_sub_language($path);
if ($mkdir_result) {
@ -275,7 +275,7 @@ if (isset($_POST['SubmitAddNewLanguage'])) {
}
}
if (isset($_POST['SubmitAddDeleteLanguage'])) {
$path=api_get_path('SYS_LANG_PATH').$english_name;
$path=api_get_path(SYS_LANG_PATH).$english_name;
if (is_dir($path)) {
$rs=remove_directory_of_sub_language($path);
if ($rs===true) {

@ -17,7 +17,7 @@ if (isset($new_language) && isset($language_variable) && isset($file_id)) {
$id_language = intval($_REQUEST['id']);
$sub_language_id = intval($_REQUEST['sub']);
$all_data_of_language=SubLanguageManager::get_all_information_of_sub_language($id_language,$sub_language_id);
$dokeos_path_folder=api_get_path('SYS_LANG_PATH').$all_data_of_language['dokeos_folder'].'/'.$file_language;
$dokeos_path_folder=api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder'].'/'.$file_language;
$all_file_of_directory=SubLanguageManager::get_all_language_variable_in_file($dokeos_path_folder);
SubLanguageManager::add_file_in_language_directory ($dokeos_path_folder);

@ -25,7 +25,7 @@ function validate_data($users) {
global $defined_auth_sources;
$errors = array();
$usernames = array();
// 1. Check if mandatory fields are set.
$mandatory_fields = array('LastName', 'FirstName');
if (api_get_setting('registration', 'email') == 'true') {
@ -38,7 +38,7 @@ function validate_data($users) {
$errors[] = $user;
}
}
// 2. Check username, first, check whether it is empty.
if (!UserManager::is_username_empty($user['UserName'])) {
// 2.1. Check whether username is too long.
@ -173,7 +173,7 @@ function save_data($users) {
if ($send_mail) {
$recipient_name = api_get_person_name($user['FirstName'], $user['LastName'], null, PERSON_NAME_EMAIL_ADDRESS);
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$emailbody = get_lang('Dear').' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : $user[UserName]\n".get_lang('Pass')." : $user[Password]\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".api_get_path('WEB_PATH')." \n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator')."";
$emailbody = get_lang('Dear').' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : $user[UserName]\n".get_lang('Pass')." : $user[Password]\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator')."";
$sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS);
$email_admin = api_get_setting('emailAdministrator');
@api_mail($recipient_name, $user['Email'], $emailsubject, $emailbody, $sender_name, $email_admin);
@ -291,17 +291,17 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
$file_type = $_POST['file_type'];
Security::clear_token();
$tok = Security::get_token();
$allowed_file_mimetype = array('csv','xml');
$allowed_file_mimetype = array('csv','xml');
$error_kind_file = false;
$ext_import_file = substr($_FILES['import_file']['name'],(strrpos($_FILES['import_file']['name'],'.')+1));
if (in_array($ext_import_file,$allowed_file_mimetype)) {
if (strcmp($file_type, 'csv') === 0 && $ext_import_file==$allowed_file_mimetype[0]) {
$users = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users);
if (strcmp($file_type, 'csv') === 0 && $ext_import_file==$allowed_file_mimetype[0]) {
$users = parse_csv_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users);
$error_kind_file = false;
} elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file==$allowed_file_mimetype[1]) {
} elseif (strcmp($file_type, 'xml') === 0 && $ext_import_file==$allowed_file_mimetype[1]) {
$users = parse_xml_data($_FILES['import_file']['tmp_name']);
$errors = validate_data($users);
$error_kind_file = false;
@ -330,12 +330,12 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
$inserted_in_course = array();
// this replace if (strcmp($_FILES['import_file']['type'], 'text/'.$file_type.'') === 0)
if (strcmp($file_type, 'csv') === 0) {
save_data($users_to_insert);
} elseif (strcmp($file_type, 'xml') === 0) {
save_data($users_to_insert);
} else {
save_data($users_to_insert);
} elseif (strcmp($file_type, 'xml') === 0) {
save_data($users_to_insert);
} else {
$error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
}
}
if (count($errors) > 0) {
$see_message_import = get_lang('FileImportedJustUsersThatAreNotRegistered');
@ -353,7 +353,7 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
$msg2 .= '</br>';
}
*/
if (count($errors) != 0) {
$warning_message = '<ul>';
foreach ($errors as $index => $error_user) {
@ -362,19 +362,19 @@ if ($_POST['formSent'] AND $_FILES['import_file']['size'] !== 0) {
$warning_message .= '</li>';
}
$warning_message .= '</ul>';
}
}
// if the warning message is too long then we display the warning message trough a session
if (api_strlen($warning_message) > 150) {
$_SESSION['session_message_import_users'] = $warning_message;
$warning_message = 'session_message';
}
if ($error_kind_file) {
$error_message = get_lang('YouMustImportAFileAccordingToSelectedOption');
} else {
header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=show_message&warn='.urlencode($warning_message).'&message='.urlencode($see_message_import).'&sec_token='.$tok);
exit;
exit;
}
}
@ -442,7 +442,7 @@ if ($count_fields > 0) {
<b>&lt;Email&gt;xxx&lt;/Email&gt;</b>
&lt;OfficialCode&gt;xxx&lt;/OfficialCode&gt;
&lt;PhoneNumber&gt;xxx&lt;/PhoneNumber&gt;
&lt;Status&gt;user/teacher/drh<?php if ($result_xml != '') { echo '<br /><font style="color:red;">', $result_xml; echo '</font>'; } ?>&lt;/Status&gt;
&lt;Status&gt;user/teacher/drh<?php if ($result_xml != '') { echo '<br /><font style="color:red;">', $result_xml; echo '</font>'; } ?>&lt;/Status&gt;
&lt;Courses&gt;xxx1|xxx2|xxx3&lt;/Courses&gt;
&lt;/Contact&gt;
&lt;/Contacts&gt;

@ -169,9 +169,9 @@ require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
if (isset($_REQUEST['certificate'])) {
$nameTools = get_lang('CreateCertificate');
$nameTools = get_lang('CreateCertificate');
} else {
$nameTools = get_lang('CreateDocument');
$nameTools = get_lang('CreateDocument');
}
$nameTools = get_lang('CreateDocument');
@ -231,19 +231,19 @@ $html_editor_config = array(
'InDocument' => true,
'CreateDocumentDir' => $relative_url,
'CreateDocumentWebDir' => (empty($group_properties['directory']))
? api_get_path('WEB_COURSE_PATH').$_course['path'].'/document/'
: api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document'.$group_properties['directory'].'/',
'BaseHref' => api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$dir
? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
: api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
);
$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)) {
$filepath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/';
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/';
}
//I'm in the certification module?
//I'm in the certification module?
$is_certificate_mode = false;
$is_certificate_array = explode('/',$_GET['dir']);
array_shift($is_certificate_array);
@ -266,7 +266,7 @@ if (!$is_certificate_mode) {
}
$interbreadcrumb[] = array ("url" => "./document.php?curdirpath=".urlencode($_GET['dir']).$req_gid, "name" => get_lang('Documents'));
} else {
$interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
$interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
}
if (!$is_allowed_in_course) {
@ -296,8 +296,8 @@ $form->addElement('header', '', $nameTools);
if (isset($_REQUEST['certificate'])) {//added condition for certicate in gradebook
$form->addElement('hidden','certificate','true',array('id'=>'certificate'));
if (isset($_GET['selectcat']))
$form->addElement('hidden','selectcat',intval($_GET['selectcat']));
$form->addElement('hidden','selectcat',intval($_GET['selectcat']));
}
$renderer = & $form->defaultRenderer();
@ -366,7 +366,7 @@ if ($is_certificate_mode)
$form->addGroup($group, 'filename_group', get_lang('CertificateName') ,'&nbsp;&nbsp;&nbsp;', false);
else
$form->addGroup($group, 'filename_group', api_get_setting('use_document_title') == 'true' ? get_lang('Title') : get_lang('FileName') ,'&nbsp;&nbsp;&nbsp;', false);
$form->addRule('filename_group', get_lang('ThisFieldIsRequired'), 'required');
if (api_get_setting('use_document_title') == 'true') {
@ -397,9 +397,9 @@ $form->add_html_editor('content','', false, false, $html_editor_config);
//$form->addElement('textarea', 'comment', get_lang('Comment'), array ('rows' => 5, 'cols' => 50));
if ($is_certificate_mode)
$form->addElement('style_submit_button', 'submit', get_lang('CreateCertificate'), 'class="save"');
else
else
$form->addElement('style_submit_button', 'submit', get_lang('langCreateDoc'), 'class="save"');
$form->setDefaults($default);
// HTML
@ -439,7 +439,7 @@ if ($form->validate()) {
}
if ($fp = @fopen($filepath.$filename.'.'.$extension, 'w')) {
$content = text_filter($content);
$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
// first regexp deals with ../../../ urls
// Disabled by Ivan Tcholakov.
@ -485,10 +485,10 @@ if ($form->validate()) {
Database::query("UPDATE $TABLE_DOCUMENT SET".substr($ct, 1)." WHERE id = '$document_id'");
}
$dir= substr($dir,0,-1);
$selectcat = '';
$selectcat = '';
if (isset($_REQUEST['selectcat']))
$selectcat = "&selectcat=".Security::remove_XSS($_REQUEST['selectcat']);
header('Location: document.php?curdirpath='.urlencode($dir).$selectcat);
header('Location: document.php?curdirpath='.urlencode($dir).$selectcat);
exit ();
} else {
Display :: display_header($nameTools, 'Doc');
@ -516,10 +516,10 @@ if ($form->validate()) {
}
echo '<div class="actions">';
// link back to the documents overview
if ($is_certificate_mode)
if ($is_certificate_mode)
echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['dir']).'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview')).get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview').'</a>';
else
echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['dir']).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview')).get_lang('BackTo').' '.get_lang('DocumentsOverview').'</a>';
else
echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['dir']).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('DocumentsOverview')).get_lang('BackTo').' '.get_lang('DocumentsOverview').'</a>';
echo '</div>';
$form->display();
Display :: display_footer();

@ -101,7 +101,7 @@ $doc = basename($file);
//echo('doc: '.$doc.'<br />');
$dir = Security::remove_XSS($_GET['curdirpath']);
//I'm in the certification module?
//I'm in the certification module?
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
@ -136,9 +136,9 @@ $html_editor_config = array(
'InDocument' => true,
'CreateDocumentDir' => $relative_url,
'CreateDocumentWebDir' => (empty($group_properties['directory']))
? api_get_path('WEB_COURSE_PATH').$_course['path'].'/document/'
: api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document'.$group_properties['directory'].'/',
'BaseHref' => api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$dir
? api_get_path(WEB_COURSE_PATH).$_course['path'].'/document/'
: api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/',
'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir
);
$use_document_title = api_get_setting('use_document_title') == 'true';
@ -164,10 +164,10 @@ if ($dir[strlen($dir) - 1] != '/') {
$dir .= '/';
}
$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)) {
$filepath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/';
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
$dir = '/';
}
@ -182,8 +182,8 @@ if (!empty($_SESSION['_gid'])) {
$my_cur_dir_path = Security::remove_XSS($_GET['curdirpath']);
if (!$is_certificate_mode)
$interbreadcrumb[]=array("url"=>"./document.php?curdirpath=".urlencode($my_cur_dir_path).$req_gid, "name"=> get_lang('Documents'));
else
$interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
else
$interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
$is_allowedToEdit = is_allowed_to_edit() || $_SESSION['group_member_with_upload_rights'];
@ -440,7 +440,7 @@ if (file_exists($filepath.$doc)) {
if (in_array($extension, array('html', 'htm'))) {
$content = file($filepath.$doc);
$content = implode('', $content);
$path_to_append = api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$dir;
$path_to_append = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir;
$content = str_replace('="./', '="'.$path_to_append, $content);
$content = str_replace('mp3player.swf?son=.%2F', 'mp3player.swf?son='.urlencode($path_to_append), $content);
}
@ -544,11 +544,11 @@ if ($owner_id == $_user['user_id'] || api_is_platform_admin() || $is_allowed_to_
}
if ($is_certificate_mode)
$form->addElement('style_submit_button', 'submit', get_lang('SaveCertificate'), 'class="save"');
else
else
$form->addElement('style_submit_button','submit',get_lang('SaveDocument'), 'class="save"');
$defaults['filename'] = $filename;
$defaults['extension'] = $extension;
$defaults['file_path'] = Security::remove_XSS($_GET['file']);
@ -571,7 +571,7 @@ if (isset($_REQUEST['curdirpath']) && $_GET['curdirpath']=='/certificates') {
}
$create_certificate=get_lang('CreateCertificateWithTags');
Display::display_normal_message($create_certificate.': <br /><br />'.$str_info,false);
}
}
if ($is_certificate_mode) {
echo '<div class="actions">';
echo '<a href="document.php?curdirpath='.Security::remove_XSS($_GET['curdirpath']).'&selectcat=' . Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('back.png',get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview')).get_lang('Back').' '.get_lang('To').' '.get_lang('CertificateOverview').'</a>';

@ -30,5 +30,5 @@ $this_section = SECTION_COURSES;
Display::display_header(null, 'Doc');
echo '<div align="center">';
$file_url_web = api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
$file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
echo '<a href="'.$file_url_web.'" target="blank">'.get_lang('_cut_paste_link').'</a></div>';

@ -140,7 +140,7 @@ $htmlHeadXtra[] = '<script type="text/javascript">
Display::display_header(null, 'Doc');
echo "<div align=\"center\">";
$file_url_web = api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
$file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
echo '<a href="'.$file_url_web.'" target="_blank">'.get_lang('_cut_paste_link').'</a></div>';
//echo '<div>';

@ -22,8 +22,8 @@ $dropbox_cnf['tbl_feedback'] = Database::get_course_table(TABLE_DROPBOX_FEEDBAC
* INITIALISE OTHER VARIABLES & CONSTANTS
*/
$dropbox_cnf['courseId'] = $_cid;
$dropbox_cnf['sysPath'] = api_get_path('SYS_COURSE_PATH') . $_course['path'] . '/dropbox'; //path to dropbox subdir in course containing the uploaded files
$dropbox_cnf['webPath'] = api_get_path('WEB_COURSE_PATH') . $_course['path'] . '/dropbox';
$dropbox_cnf['sysPath'] = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox'; //path to dropbox subdir in course containing the uploaded files
$dropbox_cnf['webPath'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/dropbox';
$dropbox_cnf['maxFilesize'] = api_get_setting('dropbox_max_filesize'); //file size limit as imposed by the platform admin (see Chamilo Config Settings on the platform administration section)
//$dropbox_cnf['version'] = '1.4';
$dropbox_cnf['allowOverwrite'] = string_2_boolean(api_get_setting('dropbox_allow_overwrite'));

@ -104,9 +104,9 @@ include api_get_path(INCLUDE_PATH) . '/header.inc.php';
// Tool introduction
// TODO: These settings to be checked when it is possible.
Display::display_introduction_section(TOOL_QUIZ, array(
'CreateDocumentWebDir' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/',
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'CreateDocumentDir' => '../../../courses/'.api_get_course_path().'/document/',
'BaseHref' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/'
'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
)
);

@ -121,20 +121,20 @@ function handle_forum_and_forumcategories() {
*/
function show_add_forumcategory_form($inputvalues=array()) {
$gradebook=Security::remove_XSS($_GET['gradebook']);
// initiate the object
$form = new FormValidator('forumcategory','post','index.php?&gradebook='.$gradebook.'');
// settting the form elements
$form->addElement('header', '', get_lang('AddForumCategory'));
$form->addElement('text', 'forum_category_title', get_lang('Title'),'class="input_titles" id="category_title"');
//$form->applyFilter('forum_category_title', 'html_filter');
$form->addElement('html_editor', 'forum_category_comment', get_lang('Comment'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
//$form->applyFilter('forum_category_comment', 'html_filter');
$form->addElement('style_submit_button', 'SubmitForumCategory', get_lang('CreateCategory'), 'class="add"');
// setting the rules
$form->addRule('forum_category_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
@ -164,7 +164,7 @@ function show_add_forumcategory_form($inputvalues=array()) {
*/
function show_add_forum_form($inputvalues=array()) {
global $_course;
$gradebook=Security::remove_XSS($_GET['gradebook']);
// initiate the object
$form = new FormValidator('forumcategory', 'post', 'index.php?gradebook='.$gradebook.'');
@ -385,7 +385,7 @@ function show_add_forum_form($inputvalues=array()) {
*/
function delete_forum_image($forum_id) {
$table_forums = Database::get_course_table(TABLE_FORUM);
$forum_id = Database::escape_string($forum_id);
$sql="SELECT forum_image FROM $table_forums WHERE forum_id = '".$forum_id."' ";
$result=Database::query($sql);
@ -420,13 +420,13 @@ function show_edit_forumcategory_form($inputvalues=array()) {
$form->addElement('header', '', get_lang('EditForumCategory'));
$form->addElement('hidden', 'forum_category_id');
$form->addElement('text', 'forum_category_title', get_lang('Title'),'class="input_titles"');
//$form->applyFilter('forum_category_title', 'html_filter');
$form->addElement('html_editor', 'forum_category_comment', get_lang('Comment'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
//$form->applyFilter('forum_category_comment', 'html_filter');
$form->addElement('style_submit_button', 'SubmitEditForumCategory',get_lang('ModifyCategory'), 'class="save"');
global $charset;
// setting the default values
$defaultvalues['forum_category_id']=$inputvalues['cat_id'];
@ -467,7 +467,7 @@ function show_edit_forumcategory_form($inputvalues=array()) {
function store_forumcategory($values) {
global $_course;
global $_user;
$table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY);
// find the max cat_order. The new forum category is added at the end => max cat_order + &
@ -647,7 +647,7 @@ function store_forum($values) {
*/
function delete_forum_forumcategory_thread($content, $id) {
global $_course;
$table_forums = Database::get_course_table(TABLE_FORUM);
$table_forums_post = Database::get_course_table(TABLE_FORUM_POST);
$table_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
@ -1161,16 +1161,16 @@ function get_forums_in_category($cat_id) {
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
*/
function get_forums($id='', $course_db_name = '') {
function get_forums($id='', $course_db_name = '') {
if (!isset($course_db_name)) {
$course_db_name = '';
}
}
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
$table_forums = Database :: get_course_table(TABLE_FORUM, $course_db_name);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db_name);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST, $course_db_name);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_db_name);
// **************** GETTING ALL THE FORUMS ************************* //
@ -1247,17 +1247,17 @@ function get_forums($id='', $course_db_name = '') {
AND item_properties.tool='".TOOL_FORUM."'
$condition_session
ORDER BY forum_order ASC";
// select the number of threads of the forum
$sql2="SELECT count(*) AS number_of_threads, forum_id FROM $table_threads
WHERE forum_id=".Database::escape_string($id)."
GROUP BY forum_id";
// select the number of posts of the forum
$sql3="SELECT count(*) AS number_of_posts, forum_id FROM $table_posts
WHERE forum_id=".Database::escape_string($id)."
GROUP BY forum_id";
// select the last post and the poster (note: this is probably no longer needed)
$sql4="SELECT post.post_id, post.forum_id, post.poster_id, post.poster_name, post.post_date, users.lastname, users.firstname
FROM $table_posts post, $table_users users
@ -1266,7 +1266,7 @@ function get_forums($id='', $course_db_name = '') {
GROUP BY post.forum_id
ORDER BY post.post_id ASC";
}
// handling all the forum information
$result=Database::query($sql);
while ($row=Database::fetch_array($result)) {
@ -1286,7 +1286,7 @@ function get_forums($id='', $course_db_name = '') {
$forum_list['number_of_threads']=$row2['number_of_threads'];;
}
}
// handling the postcount information
$result3=Database::query($sql3);
while ($row3=Database::fetch_array($result3)) {
@ -1340,14 +1340,14 @@ function get_forums($id='', $course_db_name = '') {
function get_last_post_information($forum_id, $show_invisibles=false, $course_db_name = '') {
if (!isset($course_db_name)) {
$course_db_name = '';
}
}
$table_forums = Database :: get_course_table(TABLE_FORUM,$course_db_name);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD,$course_db_name);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db_name);
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db_name);
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
$sql="SELECT post.post_id, post.forum_id, post.poster_id, post.poster_name, post.post_date, users.lastname, users.firstname, post.visible, thread_properties.visibility AS thread_visibility, forum_properties.visibility AS forum_visibility
FROM $table_posts post, $table_users users, $table_item_property thread_properties, $table_item_property forum_properties
WHERE post.forum_id=".Database::escape_string($forum_id)."
@ -1358,7 +1358,7 @@ function get_last_post_information($forum_id, $show_invisibles=false, $course_db
AND forum_properties.tool='".TOOL_FORUM."'
ORDER BY post.post_id DESC";
$result=Database::query($sql);
if ($show_invisibles==true) {
$row=Database::fetch_array($result);
$return_array['last_post_id']=$row['post_id'];
@ -1395,12 +1395,12 @@ function get_last_post_information($forum_id, $show_invisibles=false, $course_db
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
*/
function get_threads($forum_id, $course_db = '') {
function get_threads($forum_id, $course_db = '') {
if (!isset($course_db)) {
$course_db = '';
}
}
$table_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY,$course_db);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD, $course_db);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST,$course_db);
@ -1467,7 +1467,7 @@ function get_threads($forum_id, $course_db = '') {
function get_posts($thread_id) {
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
// note: change these SQL so that only the relevant fields of the user table are used
if (api_is_allowed_to_edit(null,true)) {
$sql = "SELECT * FROM $table_posts posts
@ -1528,7 +1528,7 @@ function icon($image_url,$alt='',$title='') {
function get_post_information($post_id) {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$table_users = Database :: get_main_table(TABLE_MAIN_USER);
$sql="SELECT * FROM ".$table_posts."posts, ".$table_users." users WHERE posts.poster_id=users.user_id AND posts.post_id='".Database::escape_string($post_id)."'";
$result=Database::query($sql);
$row=Database::fetch_array($result);
@ -1571,7 +1571,7 @@ function get_thread_users_details($thread_id, $db_name = null) {
$t_posts = Database :: get_course_table(TABLE_FORUM_POST, (empty($db_name)?null:$db_name));
$t_users = Database :: get_main_table(TABLE_MAIN_USER);
$t_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT DISTINCT user.user_id, user.lastname, user.firstname, thread_id
FROM $t_posts , $t_users user, $t_course_user course_user
WHERE poster_id = user.user_id
@ -1738,11 +1738,11 @@ function store_thread($values) {
global $_course;
global $current_forum;
global $origin;
$forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$gradebook=Security::remove_XSS($_GET['gradebook']);
$upload_ok=1;
$has_attachment=false;
@ -1890,7 +1890,7 @@ function show_add_post_form($action='', $id='', $form_values='') {
global $_user;
global $origin;
global $charset;
$gradebook=Security::remove_XSS($_GET['gradebook']);
// setting the class and text of the form title and submit button
if ($_GET['action']=='quote'){
@ -1944,7 +1944,7 @@ function show_add_post_form($action='', $id='', $form_values='') {
$form->addElement('html','<div id="id_qualify" style="display:none">');
if( (api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && !($my_thread) ) {
// thread qualify
$form->addElement('static','Group', '<br /><strong>'.get_lang('AlterQualifyThread').'</strong>');
$form->applyFilter('numeric_calification', 'html_filter');
@ -2060,7 +2060,7 @@ function show_add_post_form($action='', $id='', $form_values='') {
function store_theme_qualify($user_id,$thread_id,$thread_qualify=0,$qualify_user_id=0,$qualify_time,$session_id=null) {
$table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY,'');
$table_threads = Database::get_course_table(TABLE_FORUM_THREAD,'');
if ($user_id==strval(intval($user_id)) && $thread_id==strval(intval($thread_id)) && $thread_qualify==strval(floatval($thread_qualify))) {
//testing
$sql_string="SELECT thread_qualify_max FROM ". $table_threads ." WHERE thread_id=".$thread_id.";";
@ -2108,7 +2108,7 @@ function store_theme_qualify($user_id,$thread_id,$thread_qualify=0,$qualify_user
function show_qualify($option,$couser_id,$forum_id,$user_id,$thread_id) {
$table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY,'');
$table_threads = Database::get_course_table(TABLE_FORUM_THREAD,'');
if ($user_id==strval(intval($user_id)) && $thread_id==strval(intval($thread_id)) && $option==1) {
$sql="SELECT qualify FROM ".$table_threads_qualify." WHERE user_id=".$user_id." and thread_id=".$thread_id.";";
@ -2139,7 +2139,7 @@ function store_theme_qualify($user_id,$thread_id,$thread_qualify=0,$qualify_user
*/
function get_historical_qualify($user_id,$thread_id,$opt) {
$table_threads_qualify_log = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY_LOG,'');
$my_qualify_log=array();
$opt = Database::escape_string($opt);
if ($opt=='false') {
@ -2223,14 +2223,14 @@ function store_reply($values) {
global $_course;
global $current_forum;
global $origin;
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$gradebook=Security::remove_XSS($_GET['gradebook']);
$post_date=date('Y-m-d H:i:s');
if ($current_forum['approval_direct_post']=='1' AND !api_is_allowed_to_edit(null,true)) {
$visible=0; // the post is not approved yet.
} else {
@ -2315,7 +2315,7 @@ function store_reply($values) {
}
send_notification_mails($values['thread_id'], $values);
session_unregister('formelements');
session_unregister('origin');
session_unregister('breadcrumbs');
@ -2346,7 +2346,7 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
global $forum_setting;
global $_user;
global $origin;
$gradebook=Security::remove_XSS($_GET['gradebook']);
// initiate the object
@ -2470,10 +2470,10 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
*/
function store_edit_post($values) {
global $origin;
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$gradebook=Security::remove_XSS($_GET['gradebook']);
// first we check if the change affects the thread and if so we commit the changes (sticky and post_title=thread_title are relevant)
//if (array_key_exists('is_first_post_of_thread',$values) AND $values['is_first_post_of_thread']=='1') {
@ -2590,7 +2590,7 @@ function display_user_image($user_id,$name, $origin='') {
*/
function increase_thread_view($thread_id) {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$sql="UPDATE $table_threads SET thread_views=thread_views+1 WHERE thread_id='".Database::escape_string($thread_id)."'"; // this needs to be cleaned first
$result=Database::query($sql);
}
@ -2606,7 +2606,7 @@ function increase_thread_view($thread_id) {
*/
function update_thread($thread_id, $last_post_id,$post_date) {
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$sql="UPDATE $table_threads SET thread_replies=thread_replies+1,
thread_last_post='".Database::escape_string($last_post_id)."',
thread_date='".Database::escape_string($post_date)."' WHERE thread_id='".Database::escape_string($thread_id)."'"; // this needs to be cleaned first
@ -2638,10 +2638,10 @@ function forum_not_allowed_here() {
function get_whats_new() {
global $_user;
global $_course;
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$tracking_last_tool_access = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_LASTACCESS);
// note this has later to be replaced by the tool constant. But temporarily bb_forum is used since this is the only thing that is in the tracking currently.
//$tool=TOOL_FORUM;
$tool=TOOL_FORUM; //
@ -2754,7 +2754,7 @@ function get_post_topics_of_forum($forum_id) {
*/
function approve_post($post_id, $action) {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
if ($action=='invisible') {
$visibility_value=0;
}
@ -2783,7 +2783,7 @@ function approve_post($post_id, $action) {
*/
function get_unaproved_messages($forum_id) {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$return_array=array();
$sql="SELECT DISTINCT thread_id FROM $table_posts WHERE forum_id='".Database::escape_string($forum_id)."' AND visible='0'";
$result=Database::query($sql);
@ -2799,7 +2799,7 @@ function get_unaproved_messages($forum_id) {
* was added to a given thread.
*
* @param array reply information
* @return void
* @return void
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
@ -2939,7 +2939,7 @@ function send_mail($user_info=array(), $thread_information=array()) {
$email_subject = get_lang('NewForumPost')." - ".$_course['official_code'];
if (isset($thread_information) and is_array($thread_information)) {
$thread_link= api_get_path('WEB_CODE_PATH').'forum/viewthread.php?'.api_get_cidreq().'&forum='.$thread_information['forum_id'].'&thread='.$thread_information['thread_id'];
$thread_link= api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&forum='.$thread_information['forum_id'].'&thread='.$thread_information['thread_id'];
}
$email_body = api_get_person_name($user_info['firstname'], $user_info['lastname'], null, PERSON_NAME_EMAIL_ADDRESS)."\n\r";
$email_body .= '['.$_course['official_code'].'] - ['.$_course['name']."]<br />\n";
@ -3056,14 +3056,14 @@ function move_post_form() {
/**
*
* @param array
* @return string HTML language variable
* @return string HTML language variable
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
*/
function store_move_post($values) {
global $_course;
$table_forums = Database :: get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
@ -3125,14 +3125,14 @@ function store_move_post($values) {
/**
*
* @param array
* @return string HTML language variable
* @return string HTML language variable
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @version february 2006, dokeos 1.8
*/
function store_move_thread($values) {
global $_course;
$table_forums = Database :: get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
@ -3193,7 +3193,7 @@ function prepare4display($input='') {
*/
function forum_search() {
global $origin;
// initiate the object
$form = new FormValidator('forumsearch','post','forumsearch.php?origin='.$origin.'');
@ -3221,14 +3221,14 @@ function forum_search() {
}
/**
* Display the search results
* @param string
* @param string
* @return void display the results
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
* @version march 2008, dokeos 1.8.5
*/
function display_forum_search_results($search_term) {
global $origin;
$table_categories = Database :: get_course_table(TABLE_FORUM_CATEGORY);
$table_forums = Database :: get_course_table(TABLE_FORUM);
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
@ -3254,7 +3254,7 @@ function display_forum_search_results($search_term) {
// getting all the information of the forum categories
$forum_categories_list=get_forum_categories();
// getting all the information of the forums
$forum_list=get_forums();
@ -3307,7 +3307,7 @@ function display_forum_search_results($search_term) {
*/
function search_link() {
global $origin;
$return = '';
if ($origin != 'learnpath') {
@ -3334,9 +3334,9 @@ function search_link() {
*/
function add_forum_attachment_file($file_comment,$last_id) {
global $_course;
$agenda_forum_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
// Storing the attachments
if(!empty($_FILES['user_upload']['name'])) {
$upload_ok = process_uploaded_file($_FILES['user_upload']);
@ -3385,9 +3385,9 @@ function add_forum_attachment_file($file_comment,$last_id) {
*/
function edit_forum_attachment_file($file_comment,$post_id,$id_attach) {
global $_course;
$table_forum_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
// Storing the attachments
if(!empty($_FILES['user_upload']['name'])) {
$upload_ok = process_uploaded_file($_FILES['user_upload']);
@ -3437,7 +3437,7 @@ function edit_forum_attachment_file($file_comment,$post_id,$id_attach) {
function get_attachment($post_id) {
$forum_table_attachment = Database :: get_course_table(TABLE_FORUM_ATTACHMENT);
$row=array();
$post_id = intval($post_id);
$sql = 'SELECT id, path, filename,comment FROM '. $forum_table_attachment.' WHERE post_id ="'.$post_id.'"';
@ -3458,7 +3458,7 @@ function get_attachment($post_id) {
function delete_attachment($post_id,$id_attach=0) {
global $_course;
$forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT);
$cond = (!empty($id_attach))?" id = ".(int)$id_attach."" : " post_id = ".(int)$post_id."";
@ -3479,7 +3479,7 @@ function delete_attachment($post_id,$id_attach=0) {
$sql="DELETE FROM $forum_table_attachment WHERE $cond ";
$result=Database::query($sql);
$last_id_file=Database::insert_id();
// update item_property
api_item_property_update($_course, TOOL_FORUM_ATTACH, $id_attach ,'ForumAttachmentDelete', api_get_user_id());
@ -3606,14 +3606,14 @@ function set_notification($content,$id, $add_only = false) {
// database table definition
$table_notification = Database::get_course_table(TABLE_FORUM_NOTIFICATION);
// which database field do we have to store the id in?
if ($content == 'forum') {
$database_field = 'forum_id';
} else {
$database_field = 'thread_id';
}
// first we check if the notification is already set for this
$sql = "SELECT * FROM $table_notification WHERE $database_field = '".Database::escape_string($id)."' AND user_id = '".Database::escape_string($_user['user_id'])."'";
$result=Database::query($sql);
@ -3664,10 +3664,10 @@ function get_notifications($content,$id) {
$sql = "SELECT user.user_id, user.firstname, user.lastname, user.email, user.user_id user FROM $table_users user, $table_notification notification
WHERE user.user_id = notification.user_id
AND notification.$database_field= '".Database::escape_string($id)."'";
$result=Database::query($sql);
$return = array();
while ($row=Database::fetch_array($result)) {
$return['user'.$row['user_id']]=array('email' => $row['email'], 'user_id' => $row['user_id']);
}
@ -3692,7 +3692,7 @@ function send_notifications($forum_id=0, $thread_id=0, $post_id=0) {
// the content of the mail
$email_subject = get_lang('NewForumPost')." - ".$_course['official_code'];
$thread_link= api_get_path('WEB_CODE_PATH').'forum/viewthread.php?'.api_get_cidreq().'&forum='.$forum_id.'&thread='.$thread_id;
$thread_link= api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&forum='.$forum_id.'&thread='.$thread_id;
$my_link=isset($link)?$link:'';
$my_message=isset($message)?$message:'';
$my_message .= $my_link;
@ -3741,10 +3741,10 @@ function send_notifications($forum_id=0, $thread_id=0, $post_id=0) {
*/
function get_notifications_of_user($user_id = 0, $force = false) {
global $_course;
// database table definition
$table_notification = Database::get_course_table(TABLE_FORUM_NOTIFICATION);
$course = api_get_course_id();
if (empty($course) OR $course==-1) {
return null;
@ -3753,9 +3753,9 @@ function get_notifications_of_user($user_id = 0, $force = false) {
global $_user;
$user_id = $_user['user_id'];
}
$my_code = isset($_course['code']) ? $_course['code'] : '';
if (!isset($_SESSION['forum_notification']) OR $_SESSION['forum_notification']['course'] <> $my_code OR $force=true) {
$_SESSION['forum_notification']['course'] = $my_code;
@ -3781,7 +3781,7 @@ function get_notifications_of_user($user_id = 0, $force = false) {
*/
function count_number_of_post_in_thread($thread_id) {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$sql = "SELECT * FROM $table_posts WHERE thread_id='".Database::escape_string($thread_id)."' ";
$result = Database::query($sql);
return count(Database::store_result($result));
@ -3797,7 +3797,7 @@ function count_number_of_post_in_thread($thread_id) {
*/
function count_number_of_post_for_user_thread($thread_id, $user_id) {
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$sql = "SELECT * FROM $table_posts WHERE thread_id='".Database::escape_string($thread_id)."'
AND poster_id = '".Database::escape_string($user_id)."' ";
$result = Database::query($sql);
@ -3813,7 +3813,7 @@ function count_number_of_post_for_user_thread($thread_id, $user_id) {
*/
function count_number_of_user_in_course($course_id) {
$table_course_rel_user = Database::get_main_table("course_rel_user");
$sql = "SELECT * FROM $table_course_rel_user WHERE course_code ='".Database::escape_string($course_id)."' ";
$result = Database::query($sql);
return count(Database::store_result($result));
@ -3833,7 +3833,7 @@ function get_statistical_information($thread_id, $user_id, $course_id) {
$stadistic['user_course'] = count_number_of_user_in_course($course_id);
$stadistic['post'] = count_number_of_post_in_thread($thread_id);
$stadistic['user_post'] = count_number_of_post_for_user_thread($thread_id, $user_id);
//$stadistic['average'] = get_average_of_thread_post_user();
return $stadistic;
}
@ -3886,7 +3886,7 @@ function get_thread_user_post($course_db, $thread_id, $user_id ) {
*/
function get_name_user_by_id($user_id) {
$t_users = Database :: get_main_table(TABLE_MAIN_USER);
$sql = "SELECT firstname, lastname FROM ".$t_users." WHERE user_id = '".$user_id."' ";
$result = Database::query($sql);
$row = Database::fetch_array($result);
@ -3936,7 +3936,7 @@ function get_thread_user_post($course_db, $thread_id, $user_id ) {
$hand_forums.= Display::return_icon('forumthread.gif', get_lang('Thread'));
$hand_forums.= Security::remove_XSS($thread['thread_title'], STUDENT);
$hand_forums.= '</div>';
foreach($post_list as $posts) {
$hand_forums.= '<div id="social-post">';
$hand_forums.= '<strong>'.Security::remove_XSS($posts['post_title'], STUDENT).'</strong>';
@ -3946,8 +3946,8 @@ function get_thread_user_post($course_db, $thread_id, $user_id ) {
$hand_forums.= '<br / >';
}
}
}
$i++;
}
@ -3970,7 +3970,7 @@ function get_thread_user_post($course_db, $thread_id, $user_id ) {
/**
* @param string
* @param int
* @param int
* @param int
* @param int
* @return void
*/
@ -4006,7 +4006,7 @@ function calculate_children($rows) {
$rows_with_children[$row["post_id"]]=$row;
$rows_with_children[$row["post_parent_id"]]["children"][]=$row["post_id"];
}
$rows=$rows_with_children;
$sorted_rows=array(0=>array());
_phorum_recursive_sort($rows, $sorted_rows);

@ -983,18 +983,18 @@ class DocumentManager {
} else {
$sql_session='';
}
$sql='UPDATE '.$tbl_category.' SET document_id="'.Database::escape_string($document_id).'"
$sql='UPDATE '.$tbl_category.' SET document_id="'.Database::escape_string($document_id).'"
WHERE course_code="'.Database::escape_string($course_id).'" '.$sql_session;
$rs=Database::query($sql,__FILE__,__LINE__);
}
/**
* get the document id of default certificate
* @param string The course id
* @return int The default certificate id
*/
function get_default_certificate_id ($course_id) {
$tbl_category=Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$tbl_category=Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$session_id=api_get_session_id();
if ($session_id==0 || is_null($session_id)) {
$sql_session='AND (session_id='.Database::escape_string($session_id).' OR isnull(session_id)) ';
@ -1002,14 +1002,14 @@ class DocumentManager {
$sql_session='AND session_id='.Database::escape_string($session_id);
} else {
$sql_session='';
}
$sql='SELECT document_id FROM '.$tbl_category.'
}
$sql='SELECT document_id FROM '.$tbl_category.'
WHERE course_code="'.Database::escape_string($course_id).'" '.$sql_session;
$rs=Database::query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($rs);
return $row['document_id'];
}
/**
* allow replace user info in file html
* @param string The course id
@ -1018,41 +1018,41 @@ class DocumentManager {
function replace_user_info_into_html($course_id) {
global $_course;
$course_info = api_get_course_info($course_id);
$course_info = api_get_course_info($course_id);
$tbl_document=Database::get_course_table(TABLE_DOCUMENT,$course_info['dbName']);
$document_id=self::get_default_certificate_id($course_id);
$sql='SELECT path FROM '.$tbl_document.' WHERE id="'.Database::escape_string($document_id).'" ';
$document_id=self::get_default_certificate_id($course_id);
$sql='SELECT path FROM '.$tbl_document.' WHERE id="'.Database::escape_string($document_id).'" ';
$rs=Database::query($sql,__FILE__,__LINE__);
$new_content = '';
if (Database::num_rows($rs)) {
$row=Database::fetch_array($rs);
$filepath = api_get_path('SYS_COURSE_PATH').$course_info['path'].'/document'.$row['path'];
$filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
if (is_file($filepath)) {
$my_content_html=file_get_contents($filepath);
}
$all_user_info=self::get_all_info_to_certificate();
$info_to_be_replaced_in_content_html=$all_user_info[0];
$info_to_replace_in_content_html=$all_user_info[1];
$new_content=str_replace($info_to_be_replaced_in_content_html,$info_to_replace_in_content_html,$my_content_html);
$new_content=str_replace($info_to_be_replaced_in_content_html,$info_to_replace_in_content_html,$my_content_html);
}
return $new_content;
}
/**
* return all content to replace and all content to be replace
*/
function get_all_info_to_certificate () {
global $charset, $dateFormatLong;
$info_list = array();
$user_id = api_get_user_id();
$course_id = api_get_course_id();
//info portal
//info portal
$organization_name = api_get_setting('Institution');
$portal_name = api_get_setting('siteName');
@ -1060,31 +1060,31 @@ class DocumentManager {
$extra_user_info_data = UserManager::get_extra_user_data($user_id,false,false);
//info student
$user_info = api_get_user_info($user_id);
$user_info = api_get_user_info($user_id);
$first_name = $user_info['firstname'];
$last_name = $user_info['lastname'];
$official_code = $user_info['official_code'];
//info teacher
$info_teacher_id = UserManager::get_user_id_of_course_admin_or_session_admin($course_id);
$teacher_info = api_get_user_info($info_teacher_id);
$teacher_first_name = $teacher_info['firstname'];
$teacher_last_name = $teacher_info['lastname'];
// info gradebook certificate
$info_grade_certificate = UserManager::get_info_gradebook_certificate($course_id,$user_id);
$date_certificate = $info_grade_certificate['created_at'];
$date_long_certificate = '';
$date_long_certificate = '';
if (!empty($date_certificate)) {
$date_long_certificate = api_convert_and_format_date($date_certificate);
$date_long_certificate = api_convert_and_format_date($date_certificate);
}
//replace content
$info_to_replace_in_content_html = array($first_name,$last_name,$organization_name,$portal_name,$teacher_first_name,$teacher_last_name, $official_code, $date_long_certificate);
$info_to_be_replaced_in_content_html= array('((user_firstname))','((user_lastname))','((gradebook_institution))',
'((gradebook_sitename))','((teacher_firstname))','((teacher_lastname))','((official_code))','((date_certificate))');
foreach ($extra_user_info_data as $key_extra=>$value_extra) {
$info_to_be_replaced_in_content_html[]='(('.strtolower($key_extra).'))';
$info_to_replace_in_content_html[]=$value_extra;
@ -1111,20 +1111,20 @@ class DocumentManager {
} else {
$sql_session='';
}
$sql='UPDATE '.$tbl_category.' SET document_id=null
$sql='UPDATE '.$tbl_category.' SET document_id=null
WHERE course_code="'.Database::escape_string($course_id).'" AND document_id="'.$default_certificate_id.'" '.$sql_session;
$rs=Database::query($sql,__FILE__,__LINE__);
}
}
/**
* Create directory certificate
* @param string The course id
* @return void()
* @return void()
*/
function create_directory_certificate_in_course ($course_id) {
global $_course;
global $_user;
$to_group_id=0;
@ -1153,25 +1153,25 @@ class DocumentManager {
$sql='SELECT id FROM '.$tbl_document.' WHERE path="/certificates" ';
$rs=Database::query($sql,__FILE__,__LINE__);
$row=Database::fetch_array($rs);
return $row['id'];
return $row['id'];
}
/**
* Check if a directory given is for certificate
* Check if a directory given is for certificate
* @param string path of directory
* @return bool true if is a certificate or false otherwise
*/
*/
function is_certificate_mode($dir) {
//I'm in the certification module?
//I'm in the certification module?
$is_certificate_mode = false;
$is_certificate_array = explode('/',$dir);
array_shift($is_certificate_array);
if ($is_certificate_array[0]=='certificates') {
$is_certificate_mode = true;
}
}
return $is_certificate_mode;
}
/**
* Gets the list of included resources as a list of absolute or relative paths from a html file or string html
* This allows for a better SCORM export or replace urls inside content html from copy course

@ -510,7 +510,7 @@ class FCKeditor
$config['BaseHref'] = api_get_path(WEB_PATH).'home/default_platform_document/';
} else {
// 4. The user is outside courses.
$config['CreateDocumentWebDir'] = api_get_path('WEB_PATH').'main/upload/users/'.api_get_user_id().'/my_files/';
$config['CreateDocumentWebDir'] = api_get_path(WEB_PATH).'main/upload/users/'.api_get_user_id().'/my_files/';
$config['CreateDocumentDir'] = $relative_path_prefix.'upload/users/'.api_get_user_id().'/my_files/';
$config['BaseHref'] = $script_path;
}

@ -182,8 +182,8 @@ function load_personal_templates($user_id=0) {
$result_template = Database::query($sql);
while ($row = Database::fetch_array($result_template))
{
$row['content'] = file_get_contents(api_get_path('SYS_COURSE_PATH').$_course['path'].'/document'.$row['path']);
//$row['content'] = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document'.$row['path'];
$row['content'] = file_get_contents(api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row['path']);
//$row['content'] = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$row['path'];
if (!empty($row['image']))
{

@ -147,7 +147,7 @@ function WhoIsOnline($valid, $friends = false)
if ($friends) {
// friends from social network is online
$query = "SELECT distinct login_user_id,login_date
FROM $track_online_table track
FROM $track_online_table track
INNER JOIN $friend_user_table ON (friend_user_id = login_user_id)
WHERE track.access_url_id = $access_url_id AND DATE_ADD(login_date,INTERVAL $valid MINUTE) >= '".$current_date."' AND friend_user_id <> '".api_get_user_id()."' AND relation_type='".USER_RELATION_TYPE_FRIEND."' ";
} else {
@ -252,7 +252,7 @@ function chatcall() {
. get_lang("Yes")
."</a>"
."&nbsp;&nbsp;|&nbsp;&nbsp;"
."<a href=\"".api_get_path('WEB_PATH')."webchatdeny.php\">"
."<a href=\"".api_get_path(WEB_PATH)."webchatdeny.php\">"
. get_lang("No")
."</a>"
."</p>";

@ -86,7 +86,7 @@ class SystemAnnouncementManager
public static function display_all_announcements($visible, $id = -1,$start = 0,$user_id='')
{
$user_selected_language = api_get_interface_language();
$start = intval($start);
$start = intval($start);
$db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
$sql = "SELECT *, DATE_FORMAT(date_start,'%d-%m-%Y') AS display_date FROM ".$db_table."
@ -148,7 +148,7 @@ class SystemAnnouncementManager
echo '</tr>';
echo '</table>';
echo '</div>';
}
}
}
public static function display_fleche($user_id)
@ -260,11 +260,11 @@ class SystemAnnouncementManager
$end = $date_end[0]."-".$date_end[1]."-".$date_end[2]." ".$date_end[3].":".$date_end[4].":".$date_start[5];
$title = Database::escape_string($title);
$content = Database::escape_string($content);
//Fixing urls that are sent by email
$content = str_replace('src=\"/home/', 'src=\"'.api_get_path('WEB_PATH').'home/', $content);
$content = str_replace('file=/home/', 'file='.api_get_path('WEB_PATH').'home/', $content);
$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
$lang = is_null($lang) ? 'NULL' : "'".Database::escape_string($lang)."'";
$sql = "INSERT INTO ".$db_table." (title,content,date_start,date_end,visible_teacher,visible_student,visible_guest, lang)
VALUES ('".$title."','".$content."','".$start."','".$end."','".$visible_teacher."','".$visible_student."','".$visible_guest."',".$lang.")";
@ -310,11 +310,11 @@ class SystemAnnouncementManager
$end = $date_end[0]."-".$date_end[1]."-".$date_end[2]." ".$date_end[3].":".$date_end[4].":".$date_start[5];
$title = Database::escape_string($title);
$content = Database::escape_string($content);
//Fixing urls that are sent by email
$content = str_replace('src=\"/home/', 'src=\"'.api_get_path('WEB_PATH').'home/', $content);
$content = str_replace('file=/home/', 'file='.api_get_path('WEB_PATH').'home/', $content);
//Fixing urls that are sent by email
$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content);
$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content);
$id = intval($id);
$sql = "UPDATE ".$db_table." SET lang=$lang,title='".$title."',content='".$content."',date_start='".$start."',date_end='".$end."', ";
$sql .= " visible_teacher = '".$visible_teacher."', visible_student = '".$visible_student."', visible_guest = '".$visible_guest."' WHERE id='".$id."'";
@ -358,7 +358,7 @@ class SystemAnnouncementManager
$db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
$visible = intval($visible);
$announcement_id = intval($announcement_id);
$field = ($user == VISIBLE_TEACHER ? 'visible_teacher' : ($user == VISIBLE_STUDENT ? 'visible_student' : 'visible_guest'));
$sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."' WHERE id='".$announcement_id."'";
return Database::query($sql);
@ -383,7 +383,7 @@ class SystemAnnouncementManager
return true;
}
$result = Database::query($sql);
while($row = Database::fetch_array($result,'ASSOC')) {
while($row = Database::fetch_array($result,'ASSOC')) {
@api_mail_html(api_get_person_name($row['firstname'], $row['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $row['email'], api_html_entity_decode(stripslashes($title), ENT_QUOTES, $charset), api_html_entity_decode(stripslashes(str_replace(array('\r\n', '\n', '\r'),'',$content)), ENT_QUOTES, $charset), api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS), api_get_setting('emailAdministrator'), api_get_setting('emailAdministrator'));
}
}

@ -69,14 +69,12 @@ function getpar($name, $description, $default = '')
function get_course_path()
{
return function_exists('api_get_path') ? // 1.6
api_get_path('SYS_COURSE_PATH') : api_get_path(SYS_PATH); // 1.5.4
return api_get_path(SYS_COURSE_PATH);
}
function get_course_web()
{
return function_exists('api_get_path') ? // 1.6
api_get_path('WEB_COURSE_PATH') : api_get_path(WEB_PATH); // 1.5.4
return api_get_path(WEB_COURSE_PATH);
}

@ -73,13 +73,13 @@ extract(phpdigHttpVars(
// Course keywords
$_course = api_get_course_info(); $ckw = $_course['path'] . '/CourseKwds.js';
define('KEYWORDS_CACHE', api_get_path('SYS_COURSE_PATH') . $ckw);
define('KEYWORDS_CACHE', api_get_path(SYS_COURSE_PATH) . $ckw);
if (file_exists(KEYWORDS_CACHE)) $kcdt =
htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE)));
$keywordscache = $kcdt ?
'<script type="text/javascript" src="' . api_get_path('WEB_COURSE_PATH') . $ckw . '"></script>' .
'<script type="text/javascript" src="' . api_get_path(WEB_COURSE_PATH) . $ckw . '"></script>' .
'<br /><small><i>(CourseKwds cache: ' . $kcdt . ')</i></small>' : '';

@ -959,7 +959,7 @@ class MySpace {
foreach ($users as $index => $user) {
$emailto = api_get_person_name($user['FirstName'], $user['LastName'], null, PERSON_NAME_EMAIL_ADDRESS).' <'.$user['Email'].'>';
$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
$emailbody = get_lang('Dear').' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : $user[UserName]\n".get_lang('Pass')." : $user[Password]\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".api_get_path('WEB_PATH')." \n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator')."";
$emailbody = get_lang('Dear').' '.api_get_person_name($user['FirstName'], $user['LastName']).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : $user[UserName]\n".get_lang('Pass')." : $user[Password]\n\n".get_lang('Address')." ".api_get_setting('siteName')." ".get_lang('Is')." : ".api_get_path(WEB_PATH)." \n\n".get_lang('Problem')."\n\n".get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".get_lang('Manager')." ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n".get_lang('Email')." : ".api_get_setting('emailAdministrator')."";
$emailheaders = 'From: '.api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS).' <'.api_get_setting('emailAdministrator').">\n";
$emailheaders .= 'Reply-To: '.api_get_setting('emailAdministrator');
@api_send_mail($emailto, $emailsubject, $emailbody, $emailheaders);

@ -675,20 +675,20 @@ class aicc extends learnpath {
$result = Database::query($sql);
$row = Database::fetch_array($result);
$LPname = $row['path'];
$list = split('/',$LPname);
$list = split('/', $LPname);
$LPnamesafe = $list[0];
//$zipfoldername = '/tmp';
//$zipfoldername = '../../courses/'.$_course['directory']."/temp/".$LPnamesafe;
$zipfoldername = api_get_path('SYS_COURSE_PATH').$_course['directory']."/temp/".$LPnamesafe;
$scormfoldername = api_get_path('SYS_COURSE_PATH').$_course['directory']."/scorm/".$LPnamesafe;
$zipfilename = $zipfoldername."/".$LPnamesafe.".zip";
//$zipfoldername = '../../courses/'.$_course['directory'].'/temp/'.$LPnamesafe;
$zipfoldername = api_get_path(SYS_COURSE_PATH).$_course['directory'].'/temp/'.$LPnamesafe;
$scormfoldername = api_get_path(SYS_COURSE_PATH).$_course['directory'].'/scorm/'.$LPnamesafe;
$zipfilename = $zipfoldername.'/'.$LPnamesafe.'.zip';
//Get a temporary dir for creating the zip file
// Get a temporary dir for creating the zip file
//error_log('New LP - cleaning dir '.$zipfoldername,0);
//error_log('New LP - cleaning dir '.$zipfoldername, 0);
deldir($zipfoldername); //make sure the temp dir is cleared
mkdir($zipfoldername, api_get_permissions_for_new_directories());
//error_log('New LP - made dir '.$zipfoldername,0);
//error_log('New LP - made dir '.$zipfoldername, 0);
//create zipfile of given directory
$zip_folder = new PclZip($zipfilename);

@ -555,7 +555,7 @@ class learnpath {
if (!empty ($_FILES['mp3']['name'])) {
// create the audio folder if it does not exist yet
global $_course;
$filepath = api_get_path('SYS_COURSE_PATH') . $_course['path'] . '/document/';
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
if (!is_dir($filepath . 'audio')) {
mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
$audio_id = add_document($_course, '/audio', 'folder', 0, 'audio');
@ -564,7 +564,7 @@ class learnpath {
// upload the file in the documents tool
include_once (api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
$file_path = handle_uploaded_document($_course, $_FILES['mp3'], api_get_path('SYS_COURSE_PATH') . $_course['path'] . '/document', '/audio', api_get_user_id(), '', '', '', '', '', false);
$file_path = handle_uploaded_document($_course, $_FILES['mp3'], api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document', '/audio', api_get_user_id(), '', '', '', '', '', false);
// getting the filename only
$file_components = explode('/', $file_path);
@ -1024,7 +1024,7 @@ class learnpath {
if (is_array($audio) && !empty ($audio['tmp_name']) && $audio['error'] === 0) {
// create the audio folder if it does not exist yet
global $_course;
$filepath = api_get_path('SYS_COURSE_PATH') . $_course['path'] . '/document/';
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
if (!is_dir($filepath . 'audio')) {
mkdir($filepath . 'audio', api_get_permissions_for_new_directories());
$audio_id = add_document($_course, '/audio', 'folder', 0, 'audio');
@ -4694,7 +4694,7 @@ class learnpath {
}
} else {
if ($arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] != 'dokeos_module' && $arrLP[$i]['item_type'] != 'dir') {
$return .= ' <input type="file" name="mp3file' . $arrLP[$i]['id'] . '" id="mp3file" />';
if (!empty ($arrLP[$i]['audio'])) {
$return .= '<br />'.Security::remove_XSS($arrLP[$i]['audio']).'<input type="checkbox" name="removemp3' . $arrLP[$i]['id'] . '" id="checkbox' . $arrLP[$i]['id'] . '" />' . get_lang('RemoveAudio');
@ -4882,10 +4882,10 @@ class learnpath {
if ($dir[strlen($dir) - 1] != '/')
$dir .= '/';
$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)) {
$filepath = api_get_path('SYS_COURSE_PATH') . $_course['path'] . '/document/';
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
$dir = '/';
}
@ -4908,7 +4908,7 @@ class learnpath {
$content = stripslashes(text_filter($content));
$content = str_replace(api_get_path('WEB_COURSE_PATH'), api_get_path(REL_PATH) . 'courses/', $content);
$content = str_replace(api_get_path(WEB_COURSE_PATH), api_get_path(REL_PATH) . 'courses/', $content);
// change the path of mp3 to absolute
// first regexp deals with ../../../ urls
@ -4984,10 +4984,10 @@ class learnpath {
if ($dir[strlen($dir) - 1] != '/')
$dir .= '/';
$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)) {
$filepath = api_get_path('SYS_COURSE_PATH') . $_course['path'] . '/document/';
$filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/';
$dir = '/';
}
@ -5004,7 +5004,7 @@ class learnpath {
if ($fp = @ fopen($file, 'w')) {
$content = text_filter($content);
$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
// first regexp deals with ../../../ urls
@ -6693,8 +6693,8 @@ class learnpath {
}
$editor_config = array('ToolbarSet' => 'LearningPathDocuments', 'Width' => '100%', 'Height' => '700', 'FullPage' => true,
'CreateDocumentDir' => $relative_prefix,
'CreateDocumentWebDir' => api_get_path('WEB_COURSE_PATH') . api_get_course_path() . '/document/',
'BaseHref' => api_get_path('WEB_COURSE_PATH') . api_get_course_path() . '/document/' . $relative_path
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/',
'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path() . '/document/' . $relative_path
);
if ($_GET['action'] == 'add_item') {
@ -7588,8 +7588,8 @@ class learnpath {
$return .= '<th width="70" height="24" style="border:1px solid gray; background-color:#F0F0F0;">' . get_lang('Minimum') . '</th>';
$return .= '<th width="70" height="24" style="border:1px solid gray; background-color:#F0F0F0;">' . get_lang('Maximum') . '</th>';
$return .= '</tr>';
//Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
//Adding the none option to the prerequisites see http://www.chamilo.org/es/node/146
$return .= '<tr >';
$return .= '<td colspan="3" class="radio" style="border:1px solid gray;border-collapse:collapse;">';
$return .= '<input checked="checked" id="idNone" name="prerequisites" style="margin-left:0; margin-right:10px;" type="radio" />';
@ -8694,7 +8694,7 @@ class learnpath {
//error_log(__LINE__.'getting document from '.$sys_course_path.$_course['path'].'/'.$file_path.' removing '.$sys_course_path.$_course['path'].'/',0);
$dest_file = $archive_path.$temp_dir_short.'/'.$file_path;
$this->create_path($dest_file);
//error_log('copy '.api_get_path('SYS_COURSE_PATH').$_course['path'].'/'.$file_path.' to '.api_get_path('SYS_ARCHIVE_PATH').$temp_dir_short.'/'.$file_path,0);
//error_log('copy '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/'.$file_path.' to '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/'.$file_path,0);
//echo $main_path.$file_path.'<br>';
@copy($sys_course_path.$_course['path'].'/'.$file_path,$dest_file);
//check if the file needs a link update
@ -8726,7 +8726,7 @@ class learnpath {
if(empty($file_path)){continue;}
//error_log(__LINE__.'checking existence of '.$main_path.$file_path.'',0);
if(!is_file($main_path.$file_path) || !is_readable($main_path.$file_path)){continue;}
//error_log(__LINE__.'getting document from '.$main_path.$file_path.' removing '.api_get_path('SYS_COURSE_PATH').$_course['path'].'/',0);
//error_log(__LINE__.'getting document from '.$main_path.$file_path.' removing '.api_get_path(SYS_COURSE_PATH).$_course['path'].'/',0);
$dest_file = $archive_path.$temp_dir_short.'/document/'.$file_path;
$this->create_path($dest_file);
//error_log('Created path '.api_get_path(SYS_ARCHIVE_PATH).$temp_dir_short.'/document/'.$file_path,0);

@ -2208,7 +2208,7 @@ function exportpath($learnpath_id)
$LPnamesafe = replace_dangerous_char($LPname, 'strict');
//3 Get a temporary dir for creating the zip file
$expdir = api_get_path('SYS_COURSE_PATH').$_course['path']."/temp/".$LPnamesafe;
$expdir = api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$LPnamesafe;
$fromdir = '../scorm/export/'; //this dir contains some standard files
deldir($expdir); //make sure the temp dir is cleared
@ -2288,18 +2288,18 @@ function exportpath($learnpath_id)
//8 put the files in the exportdir into a zip and force download
include_once (api_get_path(LIBRARY_PATH)."pclzip/pclzip.lib.php");
//create zipfile of given directory
$zip_folder = new PclZip(api_get_path('SYS_COURSE_PATH').$_course['path']."/temp/".$LPnamesafe.".zip");
$zip_folder = new PclZip(api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$LPnamesafe.".zip");
$zip_folder->create(api_get_path('SYS_COURSE_PATH').$_course['path']."/temp/".$LPnamesafe."/", PCLZIP_OPT_REMOVE_PATH, api_get_path('SYS_COURSE_PATH').$_course['path']."/temp/");
//api_get_path('SYS_COURSE_PATH').$_course['path']."/temp/".$LPnamesafe); // whitout folder
$zip_folder->create(api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$LPnamesafe."/", PCLZIP_OPT_REMOVE_PATH, api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/");
//api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$LPnamesafe); // whitout folder
// modified by imandak80
/* copy(api_get_path('SYS_COURSE_PATH').$_course['path']."/temp/".$LPnamesafe.".zip",
api_get_path('SYS_COURSE_PATH').$_course['path']."/document/".$LPnamesafe.".zip");
/* copy(api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$LPnamesafe.".zip",
api_get_path(SYS_COURSE_PATH).$_course['path']."/document/".$LPnamesafe.".zip");
*/
$zipfoldername = api_get_path('SYS_COURSE_PATH').$_course['path']."/temp/".$LPnamesafe;
$zipfoldername = api_get_path(SYS_COURSE_PATH).$_course['path']."/temp/".$LPnamesafe;
$zipfilename = $zipfoldername.".zip";
DocumentManager :: file_send_for_download($zipfilename, false, basename($LPnamesafe.".zip"));
@ -2330,7 +2330,7 @@ function exportSCORM($scormname, $course)
global $_course;
//initialize
$tmpname = api_get_path('SYS_COURSE_PATH').$_course['path']."/scorm";
$tmpname = api_get_path(SYS_COURSE_PATH).$_course['path']."/scorm";
$zipfoldername = $tmpname.$scormname;
$zipfilename = $zipfoldername.".zip";

@ -226,7 +226,7 @@ if (isset($_POST['save_audio']))
// create the audio folder if it does not exist yet
global $_course;
$filepath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/';
$filepath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/';
if(!is_dir($filepath.'audio'))
{
mkdir($filepath.'audio', api_get_permissions_for_new_directories());
@ -244,7 +244,7 @@ if (isset($_POST['save_audio']))
//no "dangerous" files
$clean_name = disable_dangerous_file($clean_name);
$check_file_path = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document/audio/'.$clean_name;
$check_file_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document/audio/'.$clean_name;
// if the file exists we generate a new name
if (file_exists($check_file_path)) {
@ -262,7 +262,7 @@ if (isset($_POST['save_audio']))
// upload the file in the documents tool
include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php');
$file_path = handle_uploaded_document($_course, $_FILES[$key],api_get_path('SYS_COURSE_PATH').$_course['path'].'/document','/audio',api_get_user_id(),'','','','','',false);
$file_path = handle_uploaded_document($_course, $_FILES[$key],api_get_path(SYS_COURSE_PATH).$_course['path'].'/document','/audio',api_get_user_id(),'','','','','',false);
// getting the filename only
$file_components = explode('/',$file_path);

@ -68,9 +68,9 @@ $current_session = api_get_session_id();
-----------------------------------------------------------
*/
Display::display_introduction_section(TOOL_LEARNPATH, array(
'CreateDocumentWebDir' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/document/',
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'CreateDocumentDir' => '../../courses/'.api_get_course_path().'/document/',
'BaseHref' => api_get_path('WEB_COURSE_PATH').api_get_course_path().'/'
'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
)
);

@ -611,7 +611,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
case 'hotpotatoes':
case "HotPotatoes":
$TBL_DOCUMENT = $_course['dbNameGlu'].'document';
$documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
$myrow= Database::fetch_array($result);
$path=$myrow["path"];
@ -1026,7 +1026,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>"; }
}
} else {
$s=api_get_path('WEB_COURSE_PATH')."$_cid/index.php?intro_cmdEdit=1";
$s=api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1";
echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>";
}
break;
@ -1066,7 +1066,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>"; }
}
} else {
$s=api_get_path('WEB_CODE_PATH')."course_description";
$s=api_get_path(WEB_CODE_PATH)."course_description";
echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>";
}
break;
@ -1257,7 +1257,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
case "HotPotatoes":
$TBL_DOCUMENT = $_course['dbNameGlu'].'document';
$documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
$myrow= Database::fetch_array($result);
$path=$myrow["path"];
@ -1409,7 +1409,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
{
$link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path";
} else {
$s=api_get_path('WEB_COURSE_PATH')."$_cid/index.php?intro_cmdEdit=1";
$s=api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1";
$link .= $s;
}
break;
@ -1418,7 +1418,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
{
$link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path";
} else {
$s=api_get_path('WEB_CODE_PATH')."course_description";
$s=api_get_path(WEB_CODE_PATH)."course_description";
$link .= $s;
}
break;

@ -993,7 +993,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
{
$uploadPath = "/HotPotatoes_files";
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY `id` ASC";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result))

@ -371,7 +371,7 @@ class scorm extends learnpath {
{
$is_session=api_get_session_id();
$is_session!=0?$session_id=$is_session:$session_id=0;
$oOrganization =& $this->organizations[$id];
//prepare and execute insert queries
//-for learnpath
@ -394,7 +394,7 @@ class scorm extends learnpath {
"VALUES (2,'".$myname."', '".$oOrganization->get_ref()."','','".$this->subdir."', 0, 'embedded', '".$this->manifest_encoding."','scorm_api.php',$dsp,$session_id)";
if($this->debug>1){error_log('New LP - In import_manifest(), inserting path: '. $sql,0);}
$res = Database::query($sql);
$lp_id = Database::insert_id();
$this->lp_id = $lp_id;
@ -565,7 +565,7 @@ class scorm extends learnpath {
require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
$maxFilledSpace = DocumentManager :: get_course_quota();
//$maxFilledSpace = 1000000000;
$zip_file_path = $zip_file_info['tmp_name'];
$zip_file_name = $zip_file_info['name'];
if($this->debug>1){error_log('New LP - import_package() - zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name,0);}
@ -877,8 +877,8 @@ class scorm extends learnpath {
$LPnamesafe = $list[0];
//$zipfoldername = '/tmp';
//$zipfoldername = '../../courses/'.$_course['directory']."/temp/".$LPnamesafe;
$zipfoldername = api_get_path('SYS_COURSE_PATH').$_course['directory']."/temp/".$LPnamesafe;
$scormfoldername = api_get_path('SYS_COURSE_PATH').$_course['directory']."/scorm/".$LPnamesafe;
$zipfoldername = api_get_path(SYS_COURSE_PATH).$_course['directory']."/temp/".$LPnamesafe;
$scormfoldername = api_get_path(SYS_COURSE_PATH).$_course['directory']."/scorm/".$LPnamesafe;
$zipfilename = $zipfoldername."/".$LPnamesafe.".zip";
//Get a temporary dir for creating the zip file
@ -1016,9 +1016,9 @@ class scorm extends learnpath {
$this->subdir = $row['path'];
}
//parse the manifest (it is already in this lp's details)
$manifest_file = api_get_path('SYS_COURSE_PATH').$_course['directory'].'/scorm/'.$this->subdir.'/imsmanifest.xml';
$manifest_file = api_get_path(SYS_COURSE_PATH).$_course['directory'].'/scorm/'.$this->subdir.'/imsmanifest.xml';
if($this->subdir == ''){
$manifest_file = api_get_path('SYS_COURSE_PATH').$_course['directory'].'/scorm/imsmanifest.xml';
$manifest_file = api_get_path(SYS_COURSE_PATH).$_course['directory'].'/scorm/imsmanifest.xml';
}
echo $manifest_file;
if(is_file($manifest_file) && is_readable($manifest_file)){

@ -54,7 +54,7 @@ function removescormDir($dir)
if ($pos) { //so we have the imsmanifest in this dir
//from d:/myworks/dokeos/dokeos_cvs/dokeos/dokeos/courses/CVSCODE4/scorm/LP2/LP2
//we have to get /LP2/LP2
$path=api_get_path('SYS_COURSE_PATH').$_course['official_code'].'/scorm';
$path=api_get_path(SYS_COURSE_PATH).$_course['official_code'].'/scorm';
$pos=strpos($dir,$path);
if ($pos==0) {
$scormdir=substr($dir,strlen($path),strlen($dir)-strlen($path));

@ -599,7 +599,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
case "HotPotatoes":
$TBL_DOCUMENT = $_course['dbNameGlu'].'document';
$documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
$myrow= Database::fetch_array($result);
$path=$myrow["path"];
@ -1004,7 +1004,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>"; }
}
} else {
$s=api_get_path('WEB_COURSE_PATH')."$_cid/index.php?intro_cmdEdit=1";
$s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1";
echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>";
}
break;
@ -1042,7 +1042,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
echo "<div class='description'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".shorten($desc,($length-3*$level))."</div>"; }
}
} else {
$s=api_get_path('WEB_CODE_PATH')."course_description";
$s=api_get_path(WEB_CODE_PATH)."course_description";
echo "<a href=\"$s\" class='$completed' target='_blank'>".shorten($name,($length-3*$level))."</a>";
}
break;
@ -1228,7 +1228,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
case "HotPotatoes":
$TBL_DOCUMENT = $_course['dbNameGlu'].'document';
$documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
$myrow= Database::fetch_array($result);
$path=$myrow["path"];
@ -1382,7 +1382,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
{
$link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Introduction_text&origin=$origin#$id_in_path";
} else {
$s=api_get_path('WEB_COURSE_PATH')."$_cid/index.php?intro_cmdEdit=1";
$s = api_get_path(WEB_COURSE_PATH)."$_cid/index.php?intro_cmdEdit=1";
$link .= $s;
}
break;
@ -1391,7 +1391,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
{
$link .= api_get_self()."?action=closelesson&source_forum=".$_GET['source_forum']."&how=complete&id_in_path=$id_in_path&learnpath_id=$learnpath_id&type=Course_description&origin=$origin#$id_in_path";
} else {
$s=api_get_path('WEB_CODE_PATH')."course_description";
$s=api_get_path(WEB_CODE_PATH)."course_description";
$link .= $s;
}
break;

@ -895,7 +895,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
{
$uploadPath = "/HotPotatoes_files";
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$documentPath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY `id` ASC";
$result = Database::query($sql);
while ($myrow = Database::fetch_array($result))

@ -154,7 +154,7 @@ if ($is_special > 0) {
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$course_dir = $sys_course_path . $_course['path'];
$base_work_dir = $course_dir . '/work';
$http_www = api_get_path('WEB_COURSE_PATH') . $_course['path'] . '/work';
$http_www = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/work';
$cur_dir_path = '';
if (isset ($_GET['curdirpath']) && $_GET['curdirpath'] != '') {
//$cur_dir_path = preg_replace('#[\.]+/#','',$_GET['curdirpath']); //escape '..' hack attempts

@ -15,7 +15,7 @@ class TestOnline extends UnitTestCase {
. get_lang("Yes")
."</a>"
."&nbsp;&nbsp;|&nbsp;&nbsp;"
."<a href=\"".api_get_path('WEB_PATH')."webchatdeny.php\">"
."<a href=\"".api_get_path(WEB_PATH)."webchatdeny.php\">"
. get_lang("No")
."</a>"
."</p>";
@ -90,7 +90,7 @@ class TestOnline extends UnitTestCase {
//var_dump($rarray);
}
function testWhoIsOnline() {
function testWhoIsOnline() {
$valid='';
$res=WhoIsOnline($valid);
$this->assertTrue(is_array($res));

Loading…
Cancel
Save