Skip to content

Commit

Permalink
If .zip to imported doesn't have a preview.xml, an empty preview.xml is
Browse files Browse the repository at this point in the history
generated.

This prevents the newly imported LO to be edited and/or previewed
properly.
  • Loading branch information
torinfo committed Oct 28, 2013
1 parent 3b29220 commit d7d8a85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions languages/en-GB/website_code/php/import/import.inc
Expand Up @@ -30,5 +30,7 @@

define("IMPORT_ZIP_FOLDER_LEVEL","The files in your zip folder need to be in the main folder, not within another folder in the zip.");

define("IMPORT_NOT_WRITABLE", "The folder needs to writable.")


?>
11 changes: 7 additions & 4 deletions website_code/php/import/import.php
Expand Up @@ -365,7 +365,7 @@ function folder_loop($path){

if(!_is_writable($xerte_toolkits_site->import_path)) {
_debug("{$xerte_toolkits_site->import_path} needs to be writeable. Cannot perform import");
die("{$xerte_toolkits_site->import_path} needs to be writeable****");
die("{$xerte_toolkits_site->import_path}: " . IMPORT_NOT_WRITABLE . "****");
}

$ok = mkdir($xerte_toolkits_site->import_path . $this_dir) && chmod($xerte_toolkits_site->import_path . $this_dir,0777);
Expand Down Expand Up @@ -648,11 +648,14 @@ function folder_loop($path){

$preview_xml = file_get_contents(str_replace("\\","/",$xerte_toolkits_site->import_path . $this_dir) . "preview.xml");

$fh = fopen($xerte_toolkits_site->import_path . $this_dir . "preview.xml", "w");
if ($preview_xml !== false)
{
$fh = fopen($xerte_toolkits_site->import_path . $this_dir . "preview.xml", "w");

fwrite($fh, $preview_xml);
fwrite($fh, $preview_xml);

fclose($fh);
fclose($fh);
}

make_new_template($folder[1], $xerte_toolkits_site->import_path . $this_dir);

Expand Down

0 comments on commit d7d8a85

Please sign in to comment.