function properties_display($xerte_toolkits_site, $tutorial_id, $change, $msgtype) { echo "<p class=\"header\"><span>" . PROPERTIES_LIBRARY_PROJECT . "</span></p>"; $prefix = $xerte_toolkits_site->database_table_prefix; $query_for_names = "select {$prefix}templatedetails.template_name, template_framework, date_created, date_modified, extra_flags from " . "{$prefix}templatedetails, {$prefix}originaltemplatesdetails where template_id= ? and {$prefix}originaltemplatesdetails.template_type_id = {$prefix}templatedetails.template_type_id "; $params = array($tutorial_id); $row = db_query_one($query_for_names, $params); $_POST['template_id'] = (int) $_POST['template_id']; if (is_user_creator($_POST['template_id'])) { $query_for_template_name = "select template_name from {$prefix}templatedetails where template_id= ?"; $params = array($_POST['template_id']); $row_template_name = db_query_one($query_for_template_name, $params); echo "<p>" . PROPERTIES_LIBRARY_PROJECT_NAME . "</p>"; echo "<form id=\"rename_form\" action=\"javascript:rename_template('" . $_POST['template_id'] . "', 'rename_form')\"><input type=\"text\" value=\"" . str_replace("_", " ", $row_template_name['template_name']) . "\" name=\"newfilename\" /><button type=\"submit\" class=\"xerte_button\" style=\"padding-left:5px;\" align=\"top\" ><i class=\"fa fa-floppy-o\"></i> " . PROPERTIES_LIBRARY_RENAME . "</button></form>"; if ($change && $msgtype == "name") { echo "<p>" . PROPERTIES_LIBRARY_PROJECT_CHANGED . "</p>"; } } echo "<br><br><br><p>" . PROPERTIES_LIBRARY_PROJECT_CREATE . " " . $row['date_created'] . "</p>"; echo "<p>" . PROPERTIES_LIBRARY_PROJECT_MODIFY . " " . $row['date_modified'] . "</p>"; include "../../../modules/" . $row['template_framework'] . "/module_functions.php"; if (function_exists("display_property_engines")) { display_property_engines($change, $msgtype); } if (template_access_settings($_POST['template_id']) != 'Private') { echo "<p>" . PROPERTIES_LIBRARY_PROJECT_LINK . "</p>"; echo "<p><a target=\"new\" href='" . $xerte_toolkits_site->site_url . url_return("play", $_POST['template_id']) . "'>" . $xerte_toolkits_site->site_url . url_return("play", $_POST['template_id']) . "</a></p>"; $template = explode("_", get_template_type($_POST['template_id'])); if (file_exists($xerte_toolkits_site->root_file_path . "/modules/" . $template[0] . "/play_links.php")) { require_once $xerte_toolkits_site->root_file_path . "/modules/" . $template[0] . "/play_links.php"; show_play_links($template[1]); } // Get the template screen size $query_for_template_name = "select {$prefix}originaltemplatesdetails.template_name, " . "{$prefix}originaltemplatesdetails.template_framework from " . "{$prefix}originaltemplatesdetails, {$prefix}templatedetails where" . " {$prefix}templatedetails.template_type_id = {$prefix}originaltemplatesdetails.template_type_id AND template_id = ?"; $params = array($tutorial_id); $row_name = db_query_one($query_for_template_name, $params); if (isset($xerte_toolkits_site->learning_objects->{$row_name['template_framework'] . "_" . $row_name['template_name']}->preview_size)) { if ($xerte_toolkits_site->learning_objects->{$row_name['template_framework'] . "_" . $row_name['template_name']}->preview_size != "*") { $temp_string = $xerte_toolkits_site->learning_objects->{$row_name['template_framework'] . "_" . $row_name['template_name']}->preview_size; } else { $temp_string = "100%,100%"; } } else { $temp_string = "100%,100%"; } $temp_array = explode(",", $temp_string); echo "<br><br><p>" . PROPERTIES_LIBRARY_PROJECT_IFRAME . "</p><form><textarea rows='3' cols='40' onfocus='this.select()'><iframe src=\"" . $xerte_toolkits_site->site_url . url_return("play", $_POST['template_id']) . "\" width=\"" . $temp_array[0] . "\" height=\"" . $temp_array[1] . "\" frameborder=\"0\" style=\"float:left; position:relative; top:0px; left:0px; z-index:0;\"></iframe></textarea></form>"; } }
* @author Patrick Lockley * @version 1.0 * @copyright Copyright (c) 2008,2009 University of Nottingham * @package */ require_once "../../../config.php"; include "../user_library.php"; include "../template_library.php"; include "../template_status.php"; _load_language_file("/website_code/php/templates/duplicate_template.inc"); $database_connect_id = database_connect("new_template database connect success", "new_template database connect fail"); /* * get the root folder for this user */ if (is_numeric($_POST['template_id'])) { if (is_user_creator(mysql_real_escape_string($_POST['template_id']))) { if ($_POST['folder_id'] == "workspace") { $folder_id = get_user_root_folder(); } else { $folder_id = $_POST['folder_id']; } /* * get the maximum id number from templates, as the id for this template */ $maximum_template_id = get_maximum_template_number(); //$query_for_root_folder = "select folder_id from " . $xerte_toolkits_site->database_table_prefix . "folderdetails where login_id = '" . $_SESSION['toolkits_logon_id'] . "' and folder_parent='0'"; //$query_for_root_folder_response = mysql_query($query_for_root_folder); //$row_root = mysql_fetch_array($query_for_root_folder_response); $query_for_template_type_id = "select otd.template_type_id, otd.template_name, otd.template_framework, td.extra_flags from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails otd, " . $xerte_toolkits_site->database_table_prefix . "templatedetails td where otd.template_type_id = td.template_type_id AND td.template_id = '" . mysql_real_escape_string($_POST['template_id']) . "'"; $query_for_template_type_id_response = mysql_query($query_for_template_type_id); $row_template_type = mysql_fetch_array($query_for_template_type_id_response);
* @author Patrick Lockley * @version 1.0 * @package */ require_once "../../../config.php"; _load_language_file("/website_code/php/properties/export_template.inc"); require_once "../template_library.php"; include "../template_status.php"; include "../url_library.php"; include "../user_library.php"; $database_id = database_connect("Export template database connect success", "Export template database connect failed"); /* * check user has some rights to this template */ if (is_numeric($_POST['template_id'])) { if (is_user_creator($_POST['template_id'], $_SESSION['toolkits_logon_id']) || is_user_admin()) { echo "<p class=\"header\"><span>" . EXPORT_TITLE . "</span></p>"; $query_for_play_content_strip = str_replace("\" . \$xerte_toolkits_site->database_table_prefix . \"", $xerte_toolkits_site->database_table_prefix, $xerte_toolkits_site->play_edit_preview_query); $safe_template_id = (int) $_POST['template_id']; $query_for_play_content = str_replace("TEMPLATE_ID_TO_REPLACE", $safe_template_id, $query_for_play_content_strip); $row_play = db_query_one($query_for_play_content); $export_exists = false; if (!empty($row_play)) { $export_exists = file_exists($xerte_toolkits_site->root_file_path . "modules/" . $row_play['template_framework'] . "/export_page.php"); } if ($export_exists) { require_once $xerte_toolkits_site->root_file_path . "modules/" . $row_play['template_framework'] . "/export_page.php"; } else { echo "<p>" . EXPORT_NOT_AVAILABLE . "</p>"; } } else {
* limitations under the License. */ /** * * syndication template, shows the syndication status for this template * * @author Patrick Lockley * @version 1.0 * @package */ require_once "../../../config.php"; include "../template_status.php"; include "../user_library.php"; include "../url_library.php"; include "properties_library.php"; if (!is_numeric($_POST['tutorial_id'])) { syndication_display_fail(); exit(0); } if (!is_user_creator((int) $_POST['tutorial_id']) && !is_user_admin()) { syndication_display_fail(); exit(0); } /** * Check template is public */ if (template_access_settings((int) $_POST['tutorial_id']) == "Public") { syndication_display($xerte_toolkits_site, false); } else { syndication_not_public($xerte_toolkits_site); }
* @version 1.0 * @copyright Copyright (c) 2008,2009 University of Nottingham * @package */ require_once "../../../config.php"; _load_language_file("/website_code/php/properties/export_template.inc"); require_once "../template_library.php"; include "../template_status.php"; include "../url_library.php"; include "../user_library.php"; $database_id = database_connect("Export template database connect success", "Export template database connect failed"); /* * check user has some rights to this template */ if (is_numeric($_POST['template_id'])) { if (is_user_creator(mysql_real_escape_string($_POST['template_id']), $_SESSION['toolkits_logon_id']) || is_user_admin()) { echo "<p class=\"header\"><span>" . EXPORT_TITLE . "</span></p>"; $query_for_play_content_strip = str_replace("\" . \$xerte_toolkits_site->database_table_prefix . \"", $xerte_toolkits_site->database_table_prefix, $xerte_toolkits_site->play_edit_preview_query); $safe_template_id = htmlentities($_POST['template_id']); $query_for_play_content = str_replace("TEMPLATE_ID_TO_REPLACE", $safe_template_id, $query_for_play_content_strip); $query_for_play_content_response = mysql_query($query_for_play_content); $row_play = mysql_fetch_array($query_for_play_content_response); if (file_exists($xerte_toolkits_site->root_file_path . "modules/" . $row_play['template_framework'] . "/export_page.php")) { require_once $xerte_toolkits_site->root_file_path . "modules/" . $row_play['template_framework'] . "/export_page.php"; } else { echo "<p>" . EXPORT_NOT_AVAILABLE . "</p>"; } } else { echo "<p>" . EXPORT_FAIL . "</p>"; } }
* * syndication change template, adds a template to the syndication RSS * * @author Patrick Lockley * @version 1.0 * @package */ require_once "../../../config.php"; include "../template_status.php"; include "../user_library.php"; include "../url_library.php"; include "properties_library.php"; $prefix = $xerte_toolkits_site->database_table_prefix; if (is_numeric($_POST['tutorial_id'])) { $database_connect_id = database_connect("syndication change template database connect success", "syndication change template database connect failed"); if (is_user_creator($_POST['tutorial_id']) || is_user_admin()) { $query_for_syndication_status = "select syndication from {$prefix}templatesyndication where template_id=?"; $params = array($_POST['tutorial_id']); $query_for_syndication_response = db_query($query_for_syndication_status, $params); if (sizeof($query_for_syndication_response) == 0) { $query_to_change_syndication_status = "INSERT into {$prefix}templatesyndication(template_id,syndication,keywords,description,category,license) VALUES (?,?,?,?,?,?)"; $params = array($_POST['tutorial_id'], $_POST['synd'], $_POST['keywords'], $_POST['description'], $_POST['category_value'], $_POST['license_value']); } else { $query_to_change_syndication_status = "UPDATE {$prefix}templatesyndication SET " . "syndication = ?, keywords = ?, description = ?, category = ?, license = ? WHERE template_id=?"; $params = array($_POST['synd'], $_POST['keywords'], $_POST['description'], $_POST['category_value'], $_POST['license_value'], $_POST['tutorial_id']); } $query_to_change_syndication_status_response = db_query($query_to_change_syndication_status, $params); /** * Check template is public */ if (template_access_settings($_POST['tutorial_id']) == "Public") {
*/ /** * * rss change template, allows a user to rename a template * * @author Patrick Lockley * @version 1.0 * @package */ require_once "../../../config.php"; include "../template_status.php"; include "../url_library.php"; include "../user_library.php"; include "properties_library.php"; if (is_numeric($_POST['template_id'])) { if (is_user_creator($_POST['template_id']) || is_user_admin()) { $query_for_rss_status = "select rss from {$xerte_toolkits_site->database_table_prefix}templatesyndication where template_id=?"; $rows = db_query($query_for_rss_status, array($_POST['template_id'])); $status = false; if (sizeof($rows) == 0) { $query_to_change_rss_status = "Insert into {$xerte_toolkits_site->database_table_prefix}templatesyndication (template_id,rss,export,description) VALUES (?,?,?,?)"; $status = db_query($query_to_change_rss_status, array($_POST['template_id'], $_POST['rss'], $_POST['export'], $_POST['desc'])); } else { $query_to_change_rss_status = "update {$xerte_toolkits_site->database_table_prefix}templatesyndication \n set rss=?, export=?, description=? WHERE template_id = ?"; $status = db_query($query_to_change_rss_status, array($_POST['rss'], $_POST['export'], $_POST['desc'], $_POST['template_id'])); } if ($status === false) { echo "<p class='error'>Error saving change to template.</p>"; } if (template_access_settings($_POST['template_id']) == "Public") { $query_for_name = "select firstname,surname from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?";
* @package */ require_once "../../../config.php"; include "../user_library.php"; include "../template_library.php"; include "../template_status.php"; _load_language_file("/website_code/php/templates/duplicate_template.inc"); if (empty($_SESSION['toolkits_logon_id'])) { die("Please login"); } /* * get the root folder for this user */ $prefix = $xerte_toolkits_site->database_table_prefix; if (is_numeric($_POST['template_id'])) { if (is_user_creator($_POST['template_id'])) { if ($_POST['folder_id'] == "workspace") { $folder_id = get_user_root_folder(); } else { $folder_id = $_POST['folder_id']; } /* * get the maximum id number from templates, as the id for this template */ $maximum_template_id = get_maximum_template_number(); $query_for_template_type_id = "select otd.template_type_id, otd.template_name, otd.template_framework, td.extra_flags FROM " . "{$prefix}originaltemplatesdetails otd, {$prefix}templatedetails td where " . "otd.template_type_id = td.template_type_id AND " . "td.template_id = ? "; $params = array($_POST['template_id']); $row_template_type = db_query_one($query_for_template_type_id, $params); /* * create the new template record in the database */
echo "<p class=\"share_files_paragraph\"><span>" . $row['firstname'] . " " . $row['surname'] . " (" . $row['role'] . ")</span></p>"; if ($row['role'] != "creator") { if (is_user_creator(mysql_real_escape_string($_POST['template_id']))) { echo "<p class=\"share_files_paragraph\">"; if ($row['role'] == "editor") { echo "<img src=\"website_code/images/TickBoxOn.gif\" style=\"\" class=\"share_files_img\" /> " . SHARING_EDITOR; } else { echo "<img src=\"website_code/images/TickBoxOff.gif\" onclick=\"javascript:set_sharing_rights_template('editor', '" . $row['template_id'] . "','" . $row['user_id'] . "')\" class=\"share_files_img\" /> " . SHARING_EDITOR; } if ($row['role'] == "read-only") { echo "<img src=\"website_code/images/TickBoxOn.gif\" class=\"share_files_img\" /> " . SHARING_READONLY; } else { echo "<img src=\"website_code/images/TickBoxOff.gif\" onclick=\"javascript:set_sharing_rights_template('read-only', '" . $row['template_id'] . "','" . $row['user_id'] . "')\" class=\"share_files_img\" /> " . SHARING_READONLY; } echo "</p>"; echo "<p>" . SHARING_REMOVE_DESCRIPTION . "</p>"; echo "<button type=\"button\" class=\"xerte_button\" onclick=\"javascript:delete_sharing_template('" . $row['template_id'] . "','" . $row['user_id'] . "',false)\" style=\"vertical-align:middle\" >" . SHARING_REMOVE . "</button>"; echo "<p class=\"share_border\"></p>"; } } } if (!is_user_creator(mysql_real_escape_string($_POST['template_id'])) && !is_user_admin()) { echo "<p><a href=\"javascript:delete_sharing_template('" . $_POST['template_id'] . "','" . $_SESSION['toolkits_logon_id'] . "',true)\">" . SHARING_STOP . "</a></p>"; } } else { echo "<p class=\"share_files_paragraph\"><span>" . SHARING_NOT_SHARED . "</span</p>"; } } else { echo "<p>" . SHARING_FAIL . "</p>"; } }
} /* Check on POST and FILES */ if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == "POST") { if (!isset($_FILES['filenameuploaded']['name'])) { if (isset($php_errormsg)) { die("Error: " . $php_errormsg . ".<br/>" . IMPORT_FAILED . "<br/>(upload_max_filesize=" . ini_get("upload_max_filesize") . ", post_max_size=" . ini_get("post_max_size") . ")****"); } else { die(IMPORT_FAILED . "<br/>(upload_max_filesize=" . ini_get("upload_max_filesize") . ", post_max_size=" . ini_get("post_max_size") . ")****"); } } } /* * Check who made the template */ if (!empty($_POST['replace'])) { if (!is_user_creator($_POST['replace'])) { die(IMPORT_OWNER_FILE . "****"); } } $folder_id = ""; /* * Check the file is the right type */ if (substr($_FILES['filenameuploaded']['name'], strlen($_FILES['filenameuploaded']['name']) - 3, 3) === "zip") { $this_dir = rand() . "/"; if (!_is_writable($xerte_toolkits_site->import_path)) { _debug("{$xerte_toolkits_site->import_path} needs to be writeable. Cannot perform import"); die("{$xerte_toolkits_site->import_path}: " . IMPORT_NOT_WRITABLE . "****"); } $ok = mkdir($xerte_toolkits_site->import_path . $this_dir) && chmod($xerte_toolkits_site->import_path . $this_dir, 0777); if (!$ok) {
<?php // Code to run the ajax query to show and allow the usert to change a templates notes // // Version 1.0 University of Nottingham require_once "../../../config.php"; include "../url_library.php"; include "../template_status.php"; include "../user_library.php"; include "properties_library.php"; //connect to the database $database_connect_id = database_connect("notes template database connect success", "notes template database connect failed"); if (is_user_creator(mysql_real_escape_string($_POST['tutorial_id'])) || is_user_admin()) { if (template_access_settings(mysql_real_escape_string($_POST['tutorial_id'])) == "Public") { rss_display($xerte_toolkits_site, mysql_real_escape_string($_POST['tutorial_id']), false); } else { rss_display_public(); } } else { rss_display_fail(); }
$folder = explode('"', substr($template_check, strpos($template_check, "targetFolder"), strpos($template_check, "version") - strpos($template_check, "targetFolder"))); $start_point = strpos($template_check, "version"); $version = explode('"', substr($template_check, $start_point, strpos($template_check, " ", $start_point) - $start_point)); $temp_array = array($folder[1], $version[1]); array_push($likelihood_array, $temp_array); } else { } } } closedir($d); } /* * Check who made the template */ if (!empty($_POST['replace'])) { if (!is_user_creator(mysql_real_escape_string($_POST['replace']))) { die(IMPORT_OWNER_FILE . "****"); } } $folder_id = ""; /* * Check the file is the write type */ if ($_FILES['filenameuploaded']['type'] == "application/x-zip-compressed" || $_FILES['filenameuploaded']['type'] == "application/zip" || $_FILES['filenameuploaded']['type'] == "application/octet-stream") { $this_dir = rand() . "/"; if (!is_writeable($xerte_toolkits_site->import_path)) { _debug("{$xerte_toolkits_site->import_path} needs to be writeable. Cannot perform import"); die("{$xerte_toolkits_site->import_path} needs to be writeable"); } $ok = mkdir($xerte_toolkits_site->import_path . $this_dir) && chmod($xerte_toolkits_site->import_path . $this_dir, 0777); if (!$ok) {
* @copyright Copyright (c) 2008,2009 University of Nottingham * @package */ require_once "../../../config.php"; include "../user_library.php"; include "../deletion_library.php"; include "../template_status.php"; _load_language_file("/website_code/php/templates/delete_template.inc"); $database_id = database_connect("delete template database connect success", "delete template database connect failed"); /* * get the folder id to delete */ if (is_numeric($_POST['template_id'])) { $safe_template_id = mysql_real_escape_string($_POST['template_id']); if (!is_template_syndicated($safe_template_id)) { if (is_user_creator($safe_template_id)) { $query_for_folder_id = "select * from " . $xerte_toolkits_site->database_table_prefix . "templaterights where template_id=\"" . $safe_template_id . "\""; $query_for_folder_id_response = mysql_query($query_for_folder_id); $row = mysql_fetch_array($query_for_folder_id_response); // delete from the database $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'] . "\""; 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 { 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 DELETE_TEMPLATE_NOT_CREATOR; } } else { echo DELETE_TEMPLATE_SYNDICATED;
*/ if (sizeof($query_sharing_rows) == 0) { echo "<p class=\"share_files_paragraph\"><span>" . SHARING_NOT_SHARED . "</span></p>"; exit(0); } echo "<p class=\"share_intro_p\"><span>" . SHARING_CURRENT . "</span></p>"; foreach ($query_sharing_rows as $row) { echo "<p class=\"share_files_paragraph\"><span>" . $row['firstname'] . " " . $row['surname'] . " (" . $row['username'] . ") - (" . $row['role'] . ")</span></p>"; if ($row['role'] != "creator") { if (is_user_creator($_POST['template_id'])) { echo "<p class=\"share_files_paragraph\">"; if ($row['role'] == "editor") { echo "<img src=\"website_code/images/TickBoxOn.gif\" style=\"\" class=\"share_files_img\" /> " . SHARING_EDITOR; } else { echo "<img src=\"website_code/images/TickBoxOff.gif\" onclick=\"javascript:set_sharing_rights_template('editor', '" . $row['template_id'] . "','" . $row['user_id'] . "')\" class=\"share_files_img\" /> " . SHARING_EDITOR; } if ($row['role'] == "read-only") { echo "<img src=\"website_code/images/TickBoxOn.gif\" class=\"share_files_img\" /> " . SHARING_READONLY; } else { echo "<img src=\"website_code/images/TickBoxOff.gif\" onclick=\"javascript:set_sharing_rights_template('read-only', '" . $row['template_id'] . "','" . $row['user_id'] . "')\" class=\"share_files_img\" /> " . SHARING_READONLY; } echo "</p>"; echo "<p>" . SHARING_REMOVE_DESCRIPTION . "</p>"; echo " <button type=\"button\" class=\"xerte_button\" onclick=\"javascript:delete_sharing_template('" . $row['template_id'] . "','" . $row['user_id'] . "',false)\" style=\"vertical-align:middle\" ><i class=\"fa fa-user-times\"></i> " . SHARING_REMOVE . "</button>"; echo "<p class=\"share_border\"></p>"; } } } if (!is_user_creator($_POST['template_id']) && !is_user_admin()) { echo "<p><a href=\"javascript:delete_sharing_template('" . $_POST['template_id'] . "','" . $_SESSION['toolkits_logon_id'] . "',true)\">" . SHARING_STOP . "</a></p>"; }