Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/branches/1.9@443 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
- Loading branch information
Showing
277 changed files
with
45,493 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?xml version="1.0" encoding="utf-8"?><container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0"><rootfiles><rootfile full-path="chapters/content.opf" media-type="application/chapters-package+xml"/></rootfiles></container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?PHP /** | ||
* | ||
* Delete template page, used by the site to delete a xerte template | ||
* | ||
* @author Patrick Lockley | ||
* @version 1.0 | ||
* @copyright Copyright (c) 2008,2009 University of Nottingham | ||
* @package | ||
*/ | ||
|
||
/** | ||
* | ||
* Function delete_folder_loop | ||
* This function checks http security settings | ||
* @param string $path = Root path to the folder we wish to delete | ||
* @global $folder_id_array, $folder_array, $file_array, $dir_path | ||
* @version 1.0 | ||
* @author Patrick Lockley | ||
*/ | ||
|
||
function delete_folder_loop($path){ | ||
|
||
/** | ||
* @global $folder_id_array, $folder_array, $file_array, $dir_path - several arrays and strings | ||
*/ | ||
|
||
global $folder_id_array, $folder_array, $file_array, $dir_path; | ||
|
||
$d = opendir($path); | ||
|
||
array_push($folder_id_array, $d); | ||
|
||
while($f = readdir($d)){ | ||
|
||
if(($f!=".")&&($f!="..")){ | ||
|
||
if(is_dir($path . "/" . $f)){ | ||
|
||
array_push($folder_array, $path . "/" . $f); | ||
|
||
delete_folder_loop($path . "/" . $f); | ||
|
||
|
||
}else{ | ||
|
||
$string = $path . "/" . $f; | ||
|
||
array_push($file_array, $string); | ||
|
||
} | ||
} | ||
|
||
} | ||
|
||
$x = array_pop($folder_id_array); | ||
|
||
closedir($x); | ||
|
||
} | ||
|
||
/** | ||
* | ||
* Function Clean up files | ||
* This function removes files added in delete_folder_loop | ||
* @version 1.0 | ||
* @author Patrick Lockley | ||
*/ | ||
|
||
function clean_up_files(){ | ||
|
||
global $dir_path, $file_array, $folder_array; | ||
|
||
while($file = array_pop($file_array)){ | ||
|
||
unlink($file); | ||
|
||
} | ||
|
||
while($folder = array_pop($folder_array)){ | ||
|
||
rmdir($folder); | ||
|
||
} | ||
|
||
} | ||
|
||
$dir_path=""; | ||
$temp_dir_path = ""; | ||
$temp_new_path = ""; | ||
|
||
$folder_id_array = array(); | ||
$folder_array = array(); | ||
$file_array = array(); | ||
|
||
/** | ||
* | ||
* Function delete_template | ||
* This function removes files added in delete_folder_loop | ||
* @param string $path = Root path to the folder we wish to delete | ||
* @version 1.0 | ||
* @author Patrick Lockley | ||
*/ | ||
|
||
|
||
function delete_template($path){ | ||
|
||
global $dir_path, $new_path, $temp_dir_path, $temp_new_path; | ||
|
||
$dir_path = $path; | ||
|
||
/* | ||
* find the files to delete | ||
*/ | ||
|
||
delete_folder_loop($dir_path); | ||
|
||
/* | ||
* remove the files | ||
*/ | ||
|
||
clean_up_files(); | ||
|
||
/* | ||
* delete the directory for this template | ||
*/ | ||
|
||
rmdir($path); | ||
|
||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
<?PHP /** | ||
* | ||
* duplicate page, allows the site to duplicate a xerte module | ||
* | ||
* @author Patrick Lockley | ||
* @version 1.0 | ||
* @copyright Copyright (c) 2008,2009 University of Nottingham | ||
* @package | ||
*/ | ||
|
||
$temp_dir_path=""; | ||
$temp_new_path=""; | ||
|
||
/** | ||
* | ||
* Function create folder loop | ||
* This function creates folders needed when duplicating a template | ||
* @param string $foldername - the path to this folder | ||
* @param number $looplevel - a number to make sure that we enter and leave each folder correctly | ||
* @version 1.0 | ||
* @author Patrick Lockley | ||
*/ | ||
|
||
function create_folder_loop($folder_name,$loop_level){ | ||
|
||
global $dir_path, $new_path, $temp_dir_path, $temp_new_path; | ||
|
||
while($f = readdir($folder_name)){ | ||
|
||
$full = $dir_path . "/" . $f; | ||
|
||
if(is_dir($full)){ | ||
|
||
if(($f==".")||($f=="..")){ | ||
|
||
}else{ | ||
|
||
$new_folder = opendir($full); | ||
$temp_dir_path = $dir_path; | ||
$temp_new_path = $new_path; | ||
$new_path = $new_path . "/" . $f; | ||
$dir_path=$full; | ||
|
||
if(@mkdir($new_path)){ | ||
if(@chmod($new_path, 0777)){ | ||
|
||
create_folder_loop($new_folder,++$loop_level); | ||
|
||
}else{ | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "MAJOR", "Failed to set permissions on folder", "Failed to set correct rights on " . $new_path); | ||
|
||
return false; | ||
} | ||
}else{ | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "CRITICIAL", "Failed to create folder", "Failed to create folder " . $new_path); | ||
|
||
return false; | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
}else{ | ||
|
||
$file_dest_path = $new_path . "/" . $f; | ||
if(@copy($full, $file_dest_path)){ | ||
if(@chmod($file_dest_path, 0777)){ | ||
|
||
|
||
}else{ | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "CRITICAL", "Failed to copy file", "Failed to copy file " . $full . " " . $file_dest_path); | ||
return false; | ||
|
||
} | ||
}else{ | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "MAJOR", "Failed to set rights on file", "Failed to set rights on file " . $full . " " . $file_dest_path); | ||
|
||
return false; | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
$dir_path = $temp_dir_path; | ||
$new_path = $temp_new_path; | ||
|
||
/* | ||
* loop level is used to check for the recusion to make sure it has worked ok. A failure in this is not critical but is used in error reporting | ||
*/ | ||
|
||
$loop_level--; | ||
|
||
if($loop_level==-1){ | ||
return true; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* | ||
* Function create folder loop | ||
* This function creates folders needed when duplicating a template | ||
* @param string $folder_name_id - the id of the new template | ||
* @param number $id_to_copy - the id of the old template | ||
* @param string $tutorial_id_from_post - The name of this tutorial type i.e Nottingham | ||
* @version 1.0 | ||
* @author Patrick Lockley | ||
*/ | ||
|
||
function duplicate_template($folder_name_id,$id_to_copy,$tutorial_id_from_post){ | ||
|
||
global $dir_path, $new_path, $temp_dir_path, $temp_new_path, $xerte_toolkits_site; | ||
|
||
$database_id=database_connect("file_library database connect success","file_library database connect fail"); | ||
|
||
$query_for_framework = "select template_framework from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails where template_name =\"" . $tutorial_id_from_post . "\""; | ||
|
||
$query_for_framework_response = mysql_query($query_for_framework); | ||
|
||
$row_framework = mysql_fetch_array($query_for_framework_response); | ||
|
||
$dir_path = $xerte_toolkits_site->users_file_area_full . $id_to_copy. "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/"; | ||
|
||
/* | ||
* Get the id of the folder we are looking to copy into | ||
*/ | ||
|
||
$new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/"; | ||
|
||
$path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/"; | ||
|
||
if(mkdir($path)){ | ||
|
||
if(@chmod($path,0777)){ | ||
|
||
$d = opendir($dir_path); | ||
|
||
if(create_folder_loop($d,-1)){ | ||
|
||
if(file_exists($new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/lockfile.txt")){ | ||
|
||
unlink($new_path = $xerte_toolkits_site->users_file_area_full . $folder_name_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $tutorial_id_from_post . "/lockfile.txt"); | ||
|
||
} | ||
|
||
|
||
return true; | ||
|
||
}else{ | ||
|
||
return false; | ||
|
||
} | ||
|
||
}else{ | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "MAJOR", "Failed to set rights on parent folder for template", "Failed to set rights on parent folder " . $path); | ||
|
||
return false; | ||
|
||
|
||
} | ||
}else{ | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "FILE_SYSTEM", "CRITICAL", "Failed to create parent folder for template", "Failed to create parent folder " . $path); | ||
|
||
return false; | ||
|
||
} | ||
|
||
} | ||
|
||
?> |
Oops, something went wrong.