From 3f6521600b3a186b6e8f9b1df671dca952c58d13 Mon Sep 17 00:00:00 2001 From: Tom Reijnders Date: Wed, 22 Feb 2023 21:51:11 +0100 Subject: [PATCH] Fix export of xot template - error if plugins folder does not exist, - wrong parameter order form deployment and archive exports --- modules/xerte/export.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/xerte/export.php b/modules/xerte/export.php index c00622229..e9b7f527e 100644 --- a/modules/xerte/export.php +++ b/modules/xerte/export.php @@ -445,27 +445,27 @@ function create_offline_file($varname, $sourcefile, $destfile) // Get plugins -$pluginfiles = scandir($parent_template_path . "plugins/"); $plugins = array(); -foreach($pluginfiles as $pluginfile) { - // get base name of plugin - $plugininfo = pathinfo($pluginfile); - if ($plugininfo['basename'] == '.' || $plugininfo['basename'] == '..') { - continue; - } - if (!isset($plugins[$plugininfo['filename']])) - { - $plugins[$plugininfo['filename']] = new stdClass(); - } - if ($plugininfo['extension'] == 'js') { - $plugins[$plugininfo['filename']]->script = file_get_contents($parent_template_path . "plugins/" . $pluginfile); - } - if ($plugininfo['extension'] == 'css') { - $plugins[$plugininfo['filename']]->css = file_get_contents($parent_template_path . "plugins/" . $pluginfile); +if (file_exists($parent_template_path . "plugins")) { + $pluginfiles = scandir($parent_template_path . "plugins/"); + foreach ($pluginfiles as $pluginfile) { + // get base name of plugin + $plugininfo = pathinfo($pluginfile); + if ($plugininfo['basename'] == '.' || $plugininfo['basename'] == '..') { + continue; + } + if (!isset($plugins[$plugininfo['filename']])) { + $plugins[$plugininfo['filename']] = new stdClass(); + } + if ($plugininfo['extension'] == 'js') { + $plugins[$plugininfo['filename']]->script = file_get_contents($parent_template_path . "plugins/" . $pluginfile); + } + if ($plugininfo['extension'] == 'css') { + $plugins[$plugininfo['filename']]->css = file_get_contents($parent_template_path . "plugins/" . $pluginfile); + } } } - /* * Create scorm manifests or a basic HTML page */ @@ -512,7 +512,7 @@ function create_offline_file($varname, $sourcefile, $destfile) basic_html_page_create($_GET['template_id'], $row['template_name'], $row['template_framework'], $rlo_file, $lo_name); } if ($export_html5) { - basic_html5_page_create($_GET['template_id'], $row['template_framework'], $row['parent_template'],$lo_name, $row['date_modified'], $row['date_created'], $tsugi, $export_offline, $offline_includes, $need_download_url, $export_logo, $plugins); + basic_html5_page_create($_GET['template_id'], $row['template_framework'], $row['parent_template'],$lo_name, $row['date_modified'], $row['date_created'], $tsugi, $export_offline, $offline_includes, $need_download_url, $export_logo, '', $plugins); } }