Fixing PHP fatal errors due relative paths

1.10.x
Julio Montoya 12 years ago
parent 873b190169
commit cad76e0fd8
  1. 6
      main/newscorm/lp_ajax_initialize.php
  2. 4
      main/newscorm/lp_ajax_last_update_status.php
  3. 4
      main/newscorm/lp_ajax_log.php
  4. 4
      main/newscorm/lp_ajax_save_item.php
  5. 4
      main/newscorm/lp_ajax_save_objectives.php
  6. 4
      main/newscorm/lp_ajax_start_timer.php
  7. 4
      main/newscorm/lp_ajax_switch_item.php
  8. 4
      main/newscorm/lp_ajax_switch_item_toc.php
  9. 8
      main/newscorm/lp_upload.php
  10. 1
      main/newscorm/scorm_api.php
  11. 10
      main/upload/form.scorm.php
  12. 2
      main/upload/upload.scorm.php
  13. 2
      main/upload/upload_ppt.php
  14. 2
      main/upload/upload_word.php

@ -20,6 +20,11 @@ $use_anonymous = true;
// Name of the language file that needs to be included. // Name of the language file that needs to be included.
$language_file[] = 'learnpath'; $language_file[] = 'learnpath';
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
require_once 'scorm.class.php'; require_once 'scorm.class.php';
require_once 'aicc.class.php'; require_once 'aicc.class.php';
@ -27,6 +32,7 @@ require_once 'learnpathItem.class.php';
require_once 'scormItem.class.php'; require_once 'scormItem.class.php';
require_once 'aiccItem.class.php'; require_once 'aiccItem.class.php';
/** /**
* Get one item's details * Get one item's details
* @param integer LP ID * @param integer LP ID

@ -31,6 +31,10 @@ $language_file[] = 'learnpath';
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
/** /**
* Writes an item's new values into the database and returns the operation result * Writes an item's new values into the database and returns the operation result
* @param integer Learnpath ID * @param integer Learnpath ID

@ -19,6 +19,10 @@ $language_file[] = 'learnpath';
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
/** /**
* Write a log with the current message * Write a log with the current message
* @param string Message * @param string Message

@ -23,6 +23,10 @@ $language_file[] = 'learnpath';
// Including the global initialization file. // Including the global initialization file.
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
require_once 'scorm.class.php'; require_once 'scorm.class.php';
require_once 'aicc.class.php'; require_once 'aicc.class.php';

@ -18,6 +18,10 @@ $language_file[] = 'learnpath';
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
/** /**
* Writes an item's new values into the database and returns the operation result * Writes an item's new values into the database and returns the operation result
* @param integer Learnpath ID * @param integer Learnpath ID

@ -11,6 +11,10 @@
* var asset_timer * var asset_timer
* @return string JavaScript time intializer * @return string JavaScript time intializer
*/ */
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
function start_timer() { function start_timer() {
$time = time(); $time = time();
return $time; //"olms.asset_timer='$time'; olms.asset_timer_total = 0;"; return $time; //"olms.asset_timer='$time'; olms.asset_timer_total = 0;";

@ -19,6 +19,10 @@ $language_file[] = 'learnpath';
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
require_once 'learnpath.class.php'; require_once 'learnpath.class.php';
require_once 'scorm.class.php'; require_once 'scorm.class.php';
require_once 'aicc.class.php'; require_once 'aicc.class.php';

@ -18,6 +18,10 @@ $language_file[] = 'learnpath';
require_once '../inc/global.inc.php'; require_once '../inc/global.inc.php';
$app['template.show_footer'] = false;
$app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl';
/** /**
* Get one item's details * Get one item's details
* @param integer LP ID * @param integer LP ID

@ -20,19 +20,19 @@ if (empty($_POST['current_dir'])) {
} }
$uncompress = 1; $uncompress = 1;
//error_log('New LP - lp_upload.php', 0);
/* /*
* Check the request method in place of a variable from POST * Check the request method in place of a variable from POST
* because if the file size exceed the maximum file upload * because if the file size exceed the maximum file upload
* size set in php.ini, all variables from POST are cleared ! * size set in php.ini, all variables from POST are cleared !
*/ */
$user_file = Request::is_post() ? Request::file('user_file') : array(); $user_file = isset($_POST) ? isset($_FILES['user_file']) : array();
$user_file = $user_file ? $user_file : array(); $user_file = $user_file ? $user_file : array();
$is_error = isset($user_file['error']) ? $user_file['error'] : false; $is_error = isset($user_file['error']) ? $user_file['error'] : false;
if( Request::is_post() && $is_error){
if (isset($_POST) && $is_error) {
return api_failure::set_failure('upload_file_too_big'); return api_failure::set_failure('upload_file_too_big');
unset($_FILEs['user_file']); unset($_FILES['user_file']);
} else if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES['user_file']['name'])) { } else if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES['user_file']['name'])) {
// A file upload has been detected, now deal with the file... // A file upload has been detected, now deal with the file...

@ -37,7 +37,6 @@ $app['template.show_footer'] = false;
$app['template.show_header'] = false; $app['template.show_header'] = false;
$app['default_layout'] = 'default/layout/blank.tpl'; $app['default_layout'] = 'default/layout/blank.tpl';
$file = (empty($_SESSION['file'])?'':$_SESSION['file']); $file = (empty($_SESSION['file'])?'':$_SESSION['file']);
$oLP = unserialize($_SESSION['lpobject']); $oLP = unserialize($_SESSION['lpobject']);
$oItem = $oLP->items[$oLP->current]; $oItem = $oLP->items[$oLP->current];

@ -38,7 +38,7 @@ $nameTools = get_lang("FileUpload");
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("ToolLearnpath")); $interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("ToolLearnpath"));
Display::display_header($nameTools, "Path"); Display::display_header($nameTools, "Path");
require_once '../newscorm/content_makers.inc.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/content_makers.inc.php';
require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
echo '<div class="actions">'; echo '<div class="actions">';
@ -54,8 +54,9 @@ $form->addElement('file', 'user_file', get_lang('FileToUpload'));
$form->add_real_progress_bar('uploadScorm', 'user_file'); $form->add_real_progress_bar('uploadScorm', 'user_file');
$form->addRule('user_file', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('user_file', get_lang('ThisFieldIsRequired'), 'required');
unset($content_origins[0]); /*unset($content_origins[0]);
unset($content_origins[1]); unset($content_origins[1]);*/
if (api_get_setting('search_enabled') == 'true') { if (api_get_setting('search_enabled') == 'true') {
$form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument')); $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
@ -89,6 +90,3 @@ $defaults = array('index_document' => 'checked="checked"', 'use_max_score' => 1)
$form->setDefaults($defaults); $form->setDefaults($defaults);
Display::display_normal_message(Display::tag('strong', get_lang('SupportedScormContentMakers')).': '.implode(', ', $content_origins), false); Display::display_normal_message(Display::tag('strong', get_lang('SupportedScormContentMakers')).': '.implode(', ', $content_origins), false);
$form->display(); $form->display();
// footer
Display::display_footer();

@ -12,7 +12,7 @@
*/ */
$language_file = 'scorm'; $language_file = 'scorm';
$cwdir = getcwd(); $cwdir = getcwd();
require_once '../newscorm/lp_upload.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_upload.php';
//reinit current working directory as many functions in upload change it //reinit current working directory as many functions in upload change it
chdir($cwdir); chdir($cwdir);

@ -28,7 +28,7 @@ if (isset($_POST['convert'])) {
if (isset($_FILES['user_file'])) { if (isset($_FILES['user_file'])) {
$allowed_extensions = array('odp', 'sxi', 'ppt', 'pps', 'sxd', 'pptx'); $allowed_extensions = array('odp', 'sxi', 'ppt', 'pps', 'sxd', 'pptx');
if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) { if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) {
require('../newscorm/lp_upload.php'); require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_upload.php';
if (isset($o_ppt) && $first_item_id != 0) { if (isset($o_ppt) && $first_item_id != 0) {
if (api_get_setting('search_enabled') == 'true') { if (api_get_setting('search_enabled') == 'true') {
require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'); require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');

@ -45,7 +45,7 @@ if (isset($_POST['convert'])) {
if (isset($_FILES['user_file'])) { if (isset($_FILES['user_file'])) {
$allowed_extensions = array('doc', 'docx', 'odt', 'txt', 'sxw', 'rtf'); $allowed_extensions = array('doc', 'docx', 'odt', 'txt', 'sxw', 'rtf');
if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) { if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) {
require('../newscorm/lp_upload.php'); require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_upload.php';
if (isset($o_doc) && $first_item_id != 0) { if (isset($o_doc) && $first_item_id != 0) {
// Search-related section // Search-related section
if (api_get_setting('search_enabled') == 'true') { if (api_get_setting('search_enabled') == 'true') {

Loading…
Cancel
Save