";
}
return $item;
}
/**
*
* Function list files in this folder event free
* This function is used in the folder properties tab to display files
* @param string $folder_id = The id of the folder we are checking
* @version 1.0
* @author Patrick Lockley
*/
function list_files_in_this_folder_event_free($folder_id, $path = '', $item = false, $input_method = 'link') {
global $xerte_toolkits_site,$level;
$query = "select template_name, template_id from " . $xerte_toolkits_site->database_table_prefix . "templatedetails where template_id in ( select " . $xerte_toolkits_site->database_table_prefix . "templaterights.template_id from " . $xerte_toolkits_site->database_table_prefix . "templaterights where user_id =\"" . $_SESSION['toolkits_logon_id'] . "\" and folder=\"" . $folder_id . "\") order by " . $xerte_toolkits_site->database_table_prefix . "templatedetails.date_created ASC";
$query_response = mysql_query($query);
while ($row = mysql_fetch_array($query_response)) {
$extra='
\r\n";
}
return $item;
}
/**
*
* Function list folder contents event free
* This function is used as part of the recursion with the above two functions
* @param string $folder_id = The id of the folder we are checking
* @version 1.0
* @author Patrick Lockley
*/
function list_folder_contents_event_free($folder_id, $path = '', $item = false, $input_method = 'link') {
global $level;
$level++;
$item = list_folders_in_this_folder_event_free($folder_id, $path, $item, $input_method);
$level++;
$item = list_files_in_this_folder_event_free($folder_id, $path, $item, $input_method);
$level--;
$level--;
return $item;
}
/**
*
* Function list folder in this folder
* This function is used as part of the recursion to display the main file system
* @param string $folder_id = The id of the folder we are checking
* @param string $sort_type = A variable which dictates how we are sorting this
* @version 1.0
* @author Patrick Lockley
*/
function list_folders_in_this_folder($folder_id, $sort_type){
/*
* use the global level for folder indenting
*/
global $level, $xerte_toolkits_site;
/*
* select the folders in this folder
*/
$query = "select folder_id, folder_name from " . $xerte_toolkits_site->database_table_prefix . "folderdetails where login_id =\"" . $_SESSION['toolkits_logon_id'] . "\" and folder_parent=\"" . $folder_id . "\" ";
/*
* Add some more to the query to sort the files
*/
if ($sort_type == "alpha_down") {
$query .= " order by folder_name DESC";
} elseif ($sort_type == "alpha_up") {
$query .= " order by folder_name ASC";
} elseif ($sort_type == "date_down") {
$query .= " order by date_created DESC";
} elseif ($sort_type == "date_up") {
$query .= " order by date_created ASC";
}
$query_response = mysql_query($query);
/*
* recurse through the folders
*/
while ($row = mysql_fetch_array($query_response)) {
$query_for_folder_content = "select template_id from " . $xerte_toolkits_site->database_table_prefix . "templaterights where folder=\"" . $row['folder_id'] . "\" UNION SELECT folder_id from " . $xerte_toolkits_site->database_table_prefix . "folderdetails where folder_parent=\"" . $row['folder_id'] . "\"";
$query_response_for_folder_content = mysql_query($query_for_folder_content);
/*
* Use level to nest the folders
*/
echo "
";
}
}
/**
*
* Function list files in this folder
* This function is used as part of the recursion to display the main file system
* @param string $folder_id = The id of the folder we are checking
* @param string $sort_type = A variable which dictates how we are sorting this
* @version 1.0
* @author Patrick Lockley
*/
function list_files_in_this_folder($folder_id, $sort_type) {
global $level, $xerte_toolkits_site;
$query = "select " . $xerte_toolkits_site->database_table_prefix . "templatedetails.template_name as template_name, template_id, template_framework, " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails.template_name as name from " . $xerte_toolkits_site->database_table_prefix . "templatedetails, " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails where template_id in ( select " . $xerte_toolkits_site->database_table_prefix . "templaterights.template_id from " . $xerte_toolkits_site->database_table_prefix . "templaterights where user_id =\"" . $_SESSION['toolkits_logon_id'] . "\" and folder=\"" . $folder_id . "\") and " . $xerte_toolkits_site->database_table_prefix . "templatedetails.template_type_id = " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails.template_type_id ";
if ($sort_type == "alpha_down") {
$query .= "order by " . $xerte_toolkits_site->database_table_prefix . "templatedetails.template_name DESC";
} elseif ($sort_type == "alpha_up") {
$query .= "order by " . $xerte_toolkits_site->database_table_prefix . "templatedetails.template_name ASC";
} elseif ($sort_type == "date_down") {
$query .= "order by " . $xerte_toolkits_site->database_table_prefix . "templatedetails.date_created DESC";
} elseif ($sort_type == "date_up") {
$query .= "order by " . $xerte_toolkits_site->database_table_prefix . "templatedetails.date_created ASC";
}
echo $query;
$query_response = mysql_query($query);
echo "*******************";
echo mysql_num_rows($query_response);
while ($row = mysql_fetch_array($query_response)) {
echo "
";
}
}
/**
*
* Function list folder contents
* This function is used as part of the recursion to display the main file system
* @param string $folder_id = The id of the folder we are checking
* @param string $sort_type = A variable which dictates how we are sorting this
* @version 1.0
* @author Patrick Lockley
*/
function list_folder_contents($folder_id, $sort_type) {
global $level;
$level++;
list_folders_in_this_folder($folder_id, $sort_type);
list_files_in_this_folder($folder_id, $sort_type);
$level--;
}
/**
*
* Function list users projects
* This function is used as part of the recursion to display the main file system
* @param string $sort_type = A variable which dictates how we are sorting this
* @version 1.0
* @author Patrick Lockley
*/
function list_users_projects($sort_type) {
/*
* Called by index.php to start off the process
*/
global $level, $xerte_toolkits_site;
$root_folder = get_user_root_folder();
/*
* Create the workspace folder
*/
echo "
";
}
/**
*
* Function list users projects
* This function is used to display all the unrestricted templates (Access to whom = *)
* @version 1.0
* @author Patrick Lockley
*/
function list_blank_templates() {
/*
* note the access rights to discern what templates this user can see
*/
global $xerte_toolkits_site;
$query_for_blank_templates = "select * from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails where access_rights=\"*\" and active=true order by date_uploaded DESC";
$query_for_blank_templates_response = mysql_query($query_for_blank_templates);
while ($row = mysql_fetch_array($query_for_blank_templates_response)) {
echo "
";
echo $row['display_name'];
echo "
";
echo $row['description'];
/*
* If no example don't display the link
*/
if ($row['display_id'] != 0) {
echo "
";
}
/*
* once done listing the blank templates, list if any the specific templates available for this user
*/
list_specific_templates();
}
/**
*
* Function access check
* This function is used to assess which specific usernames match the access to whom value
* @param string $security_details = the masks used for this template to limit its display
* @version 1.0
* @author Patrick Lockley
*/
function access_check($security_details) {
$list = explode(",", $security_details);
while ($dev_mask = array_pop($list)) {
if (strpos($dev_mask, "*") != 0) {
if (strcmp(substr($dev_mask, 0, strpos($dev_mask, "*")), substr($_SESSION['toolkits_logon_username'], 0, strpos($dev_mask, "*"))) == 0) {
return true;
}
} else {
if (strcmp($dev_mask, $_SESSION['toolkits_logon_username']) == 0) {
return true;
}
}
}
return false;
}
/**
*
* Function list specific templates
* This function is used to display templates with access restrictions
* @version 1.0
* @author Patrick Lockley
*/
function list_specific_templates() {
global $xerte_toolkits_site;
$query_for_blank_templates = "select * from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails where access_rights!=\"*\" order by date_uploaded DESC";
$query_for_blank_templates_response = mysql_query($query_for_blank_templates);
while ($row = mysql_fetch_array($query_for_blank_templates_response)) {
if (access_check($row['access_rights'])) {
echo "
";
echo "
";
echo $row['description'];
/*
* If no example don't display the link
*/
if ($row['display_id'] != 0) {
echo "
";
}
}
}
/**
*
* Function login page format middle
* This function is used to display the index.php HTML
* @param string $buffer = A HTML string to work on
* @version 1.0
* @author Patrick Lockley
*/
function logged_in_page_format_middle($buffer) {
global $xerte_toolkits_site;
$buffer = str_replace("{{pod_one}}", $xerte_toolkits_site->pod_one, $buffer);
$buffer = str_replace("{{pod_two}}", $xerte_toolkits_site->pod_two, $buffer);
return $buffer;
}
/**
*
* Function error show template
* This function is used to display a respinse when the users accesses a resource they have no right to
* @version 1.0
* @author Patrick Lockley
*/
function error_show_template() {
echo DISPLAY_ERROR;
}
/**
*
* Function output locked file code
* This function is used to display a message when a lock file is found
* @version 1.0
* @author Patrick Lockley
*/
function output_locked_file_code($lock_file_creator) {
echo "