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/trunk@161 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
- Loading branch information
Dave Goodwin
committed
Oct 20, 2011
1 parent
4a57be9
commit 77ea751
Showing
2 changed files
with
46 additions
and
49 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 |
---|---|---|
@@ -1,66 +1,65 @@ | ||
<?PHP /** | ||
* | ||
* delete_template, allows the template to be deleted (placed in the recycle bin) | ||
* | ||
* @author Patrick Lockley | ||
* @version 1.0 | ||
* @copyright Copyright (c) 2008,2009 University of Nottingham | ||
* @package | ||
*/ | ||
<?php | ||
/** | ||
* | ||
* delete_template, allows the template to be deleted (placed in the recycle bin) | ||
* | ||
* @author Patrick Lockley | ||
* @version 1.0 | ||
* @copyright Copyright (c) 2008,2009 University of Nottingham | ||
* @package | ||
*/ | ||
|
||
include "../database_library.php"; | ||
include "../user_library.php"; | ||
include "../deletion_library.php"; | ||
include "../template_status.php"; | ||
require("../../../config.php"); | ||
require("../../../session.php"); | ||
|
||
$database_id = database_connect("delete template database connect success","delete template database connect failed"); | ||
require_once("../../../config.php"); | ||
include "../user_library.php"; | ||
include "../deletion_library.php"; | ||
include "../template_status.php"; | ||
|
||
/* | ||
* get the folder id to delete | ||
*/ | ||
$database_id = database_connect("delete template database connect success","delete template database connect failed"); | ||
|
||
$safe_template_id = mysql_real_escape_string($_POST['template_id']); | ||
/* | ||
* get the folder id to delete | ||
*/ | ||
|
||
if(!is_template_syndicated($safe_template_id)){ | ||
$safe_template_id = mysql_real_escape_string($_POST['template_id']); | ||
|
||
if(is_user_creator($safe_template_id)){ | ||
if(!is_template_syndicated($safe_template_id)){ | ||
|
||
$query_for_folder_id = "select * from " .$xerte_toolkits_site->database_table_prefix . "templaterights where template_id=\"" . $safe_template_id . "\""; | ||
if(is_user_creator($safe_template_id)){ | ||
|
||
$query_for_folder_id_response = mysql_query($query_for_folder_id); | ||
$query_for_folder_id = "select * from " .$xerte_toolkits_site->database_table_prefix . "templaterights where template_id=\"" . $safe_template_id . "\""; | ||
|
||
$row = mysql_fetch_array($query_for_folder_id_response); | ||
|
||
// delete from the database | ||
$query_for_folder_id_response = mysql_query($query_for_folder_id); | ||
|
||
$query_to_delete_template = "update " .$xerte_toolkits_site->database_table_prefix . "templaterights set folder=\"" . get_recycle_bin() . "\" where template_id=\"" . $safe_template_id . "\" and user_id=\"" . $_SESSION['toolkits_logon_id'] . "\""; | ||
$row = mysql_fetch_array($query_for_folder_id_response); | ||
|
||
if(mysql_query($query_to_delete_template)){ | ||
// delete from the database | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "ADMIN", "CRITICAL", "Moved file to users recycle bin", "Moved file to users recycle bin"); | ||
$query_to_delete_template = "update " .$xerte_toolkits_site->database_table_prefix . "templaterights set folder=\"" . get_recycle_bin() . "\" where template_id=\"" . $safe_template_id . "\" and user_id=\"" . $_SESSION['toolkits_logon_id'] . "\""; | ||
|
||
}else{ | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "ADMIN", "CRITICAL", "Failed to move file to the recycle bin", "Failed to move file to the recycle bin"); | ||
if(mysql_query($query_to_delete_template)){ | ||
|
||
} | ||
|
||
receive_message($_SESSION['toolkits_logon_username'], "ADMIN", "CRITICAL", "Moved file to users recycle bin", "Moved file to users recycle bin"); | ||
|
||
}else{ | ||
}else{ | ||
|
||
echo "Sorry you aren't the creator of this file and as such cannot delete it"; | ||
|
||
} | ||
receive_message($_SESSION['toolkits_logon_username'], "ADMIN", "CRITICAL", "Failed to move file to the recycle bin", "Failed to move file to the recycle bin"); | ||
|
||
}else{ | ||
} | ||
|
||
echo "Sorry you cannot delete a syndicated project. To delete this project, first turn off syndication in the project's properties."; | ||
|
||
} | ||
|
||
}else{ | ||
|
||
mysql_close($database_id); | ||
echo "Sorry you aren't the creator of this file and as such cannot delete it"; | ||
|
||
?> | ||
} | ||
|
||
}else{ | ||
|
||
echo "Sorry you cannot delete a syndicated project. To delete this project, first turn off syndication in the project's properties."; | ||
|
||
} | ||
|
||
|
||
mysql_close($database_id); | ||
|
||
?> |
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