Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
pgogy committed Jul 24, 2012
1 parent 30a324a commit 60f178f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
2 changes: 2 additions & 0 deletions languages/en-GB/website_code/php/import/import.inc
Expand Up @@ -27,6 +27,8 @@
define("IMPORT_ZIP_FAIL","You can only import Zip Files");

define("IMPORT_XERTE_ONLY","Only Xerte templates are currently imported");

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.");


?>
29 changes: 25 additions & 4 deletions website_code/php/import/import.php
Expand Up @@ -134,6 +134,7 @@ function make_new_template($type,$zip_path){


}else{


receive_message($_SESSION['toolkits_logon_username'], "ADMIN", "CRITICAL", "Failed to create new template record for the database", $query_for_template_rights);

Expand Down Expand Up @@ -185,6 +186,10 @@ function replace_existing_template($path_to_copy_from, $template_id){
array_splice($delete_folder_array,0);

delete_loop($path_to_copy_from);

echo "HELLO****";

die();

while($delete_folder = array_pop($delete_folder_array)){

Expand Down Expand Up @@ -362,7 +367,7 @@ function folder_loop($path){

if(@move_uploaded_file($_FILES['filenameuploaded']['tmp_name'], $new_file_name)){

require_once dirname(__FILE__)."/dUnzip2.inc.php";
require_once dirname(__FILE__) . "/dUnzip2.inc.php";

$zip = new dUnzip2($new_file_name);

Expand All @@ -382,6 +387,12 @@ function folder_loop($path){

foreach($x as $y){

if(count(explode("/",$y))==3){

die(IMPORT_ZIP_FOLDER_LEVEL . "****");

}

if(!(strpos($y,"media/")===false)){

$string = $zip->unzip($y, false, 0777);
Expand All @@ -392,7 +403,7 @@ function folder_loop($path){

}

if(!(strpos($y,".rlt")===false)){
if((strpos($y,".rlt")!==false)){

$string = $zip->unzip($y, false, 0777);

Expand Down Expand Up @@ -422,6 +433,8 @@ function folder_loop($path){
* Look for an xml file linked to the RLO
*/

echo $template_data_equivalent . "<br />";

if($template_data_equivalent!=null){

foreach($zip->compressedList as $x){
Expand All @@ -436,7 +449,15 @@ function folder_loop($path){

array_push($file_data,$temp_array);

}
}else if($y==="preview.xml"){

$preview_xml = $zip->unzip($y, false, 0777);

$temp_array = array("preview.xml",$preview_xml,null);

array_push($file_data,$temp_array);

}

}

Expand Down Expand Up @@ -622,7 +643,7 @@ function folder_loop($path){

unlink($xerte_toolkits_site->import_path . $this_dir . $rlt_name);

$preview_xml = file_get_contents($xerte_toolkits_site->import_path . $this_dir . "data.xml");
$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");

Expand Down
2 changes: 1 addition & 1 deletion workspaceproperties.php
Expand Up @@ -52,7 +52,7 @@
-->

<iframe id="upload_iframe" name="upload_iframe" src="#" style="width:0px;height:0px; display:none"></iframe>
<iframe id="upload_iframe" name="upload_iframe" src="" style="width:0px;height:0px; display:none"></iframe>


<div class="properties_main">
Expand Down

0 comments on commit 60f178f

Please sign in to comment.