Skip to content

Commit

Permalink
reindent
Browse files Browse the repository at this point in the history
git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@113 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
Dave Goodwin committed Sep 28, 2011
1 parent 85c9cc3 commit 5e9b7de
Showing 1 changed file with 42 additions and 51 deletions.
93 changes: 42 additions & 51 deletions website_code/php/versioncontrol/template_close.php
@@ -1,80 +1,71 @@
<?PHP /**
*
* template close, code that runs when an editor window is closed to remove the lock file
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/
<?php
/**
*
* template close, code that runs when an editor window is closed to remove the lock file
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/

require('../../../config.php');

require('../../../session.php');

require('../template_status.php');

$temp_array = explode("-",$_POST['file_path']);

if(file_exists($xerte_toolkits_site->users_file_area_full . $_POST['file_path'] . "lockfile.txt")){

/*
* Code to delete the lock file
*/

include('../database_library.php');
/*
* Code to delete the lock file
*/

$lock_file_data = file_get_contents($xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2] . "/lockfile.txt");
include('../database_library.php');

$temp = explode("*",$lock_file_data);
$lock_file_data = file_get_contents($xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2] . "/lockfile.txt");

$lock_file_creator = $temp[0];
$temp = explode("*",$lock_file_data);

$template_id = explode("-",$_POST['file_path']);
$lock_file_creator = $temp[0];

$mysql_id = database_connect("Version Control Database connect success","Version Control database connect failed");
$template_id = explode("-",$_POST['file_path']);

$query_for_file_name = "select template_name from " . $xerte_toolkits_site->database_table_prefix . "templatedetails where template_id =\"" . $template_id[0] . "\"";
$row_template_name = db_query_one("Select template_name from {$xerte_toolkits_site->database_table_prefix}templatedetails WHERE template_id = ?", array($template_id[0]));

$query_response = mysql_query($query_for_file_name);

$row_template_name = mysql_fetch_array($query_response);
$user_list = $temp[1];

$user_list = $temp[1];
$users = explode(" ",$user_list);

$users = explode(" ",$user_list);

/*
* Email users in the lock file
*/
/*
* Email users in the lock file
*/

for($x=0;$x!=count($users)-1;$x++){
for($x=0;$x!=count($users)-1;$x++){

mail($users[$x] . "@" . $xerte_toolkits_site->email_add_to_username, "File available - \"" . str_replace("_"," ",$row_template_name['template_name']) ."\"", "Hello, <br><br> You've requested to be informed when the file \"" . str_replace("_"," ",$row_template_name['template_name']) . "\" becomes available for editing. The file was made available at " . date("h:i a") . " on " . date("l, jS F") . " <br><br> Please note that multiple requests may have been made, and as such you may not be the only person to have receive one of these notifications. As such the file may well be locked by somebody else.<br><br> Please log into the site at <a href=\"" . $xerte_toolkits_site->site_url . "\">" . $xerte_toolkits_site->site_url . "</a>. <br><br> Thank you, <br><br> the Xerte Online toolkits team", $xerte_toolkits_site->headers);
mail($users[$x] . "@" . $xerte_toolkits_site->email_add_to_username, "File available - \"" . str_replace("_"," ",$row_template_name['template_name']) ."\"", "Hello, <br><br> You've requested to be informed when the file \"" . str_replace("_"," ",$row_template_name['template_name']) . "\" becomes available for editing. The file was made available at " . date("h:i a") . " on " . date("l, jS F") . " <br><br> Please note that multiple requests may have been made, and as such you may not be the only person to have receive one of these notifications. As such the file may well be locked by somebody else.<br><br> Please log into the site at <a href=\"" . $xerte_toolkits_site->site_url . "\">" . $xerte_toolkits_site->site_url . "</a>. <br><br> Thank you, <br><br> the Xerte Online toolkits team", $xerte_toolkits_site->headers);

}
}

unlink($xerte_toolkits_site->users_file_area_full . $_POST['file_path'] . "lockfile.txt");
unlink($xerte_toolkits_site->users_file_area_full . $_POST['file_path'] . "lockfile.txt");

}

/*
* Code to check to see if we should warn on a publish
*/
/*
* Code to check to see if we should warn on a publish
*/

if(is_user_an_editor($temp_array[0],$_SESSION['toolkits_logon_id'])){

$preview_xml = file_get_contents($xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2] . "/preview.xml");

$data_xml = file_get_contents($xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2] . "/data.xml");

if($data_xml!=$preview_xml){

echo "Would you like to publish your changes?~*~" . $xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2];

}

$prefix = $xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2];
$preview_file = $prefix . '/preview.xml';
$data_file = $prefix . '/data.xml';

if(file_exists($preview_file) && file_Exists($data_file)) {
$preview_xml = file_get_contents($preview_file);
$data_xml = file_get_contents($data_file);
if($data_xml!=$preview_xml){
echo "Would you like to publish your changes?~*~" . $xerte_toolkits_site->users_file_area_full . $temp_array[0] . "-" . $temp_array[1] . "-" . $temp_array[2];
}
}
}


?>

0 comments on commit 5e9b7de

Please sign in to comment.