Skip to content

Commit

Permalink
rearrange requires
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 49 deletions.
91 changes: 45 additions & 46 deletions website_code/php/templates/delete_template.php
@@ -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);

?>
4 changes: 1 addition & 3 deletions website_code/php/templates/new_template.php
@@ -1,4 +1,4 @@
<?PHP
<?php

/**
*
Expand All @@ -15,8 +15,6 @@
include "../user_library.php";
include "../template_library.php";
include "../file_library.php";
include "../database_library.php";
include "../error_library.php";

/*
* get the root folder for this user
Expand Down

0 comments on commit 77ea751

Please sign in to comment.