From db74f1830e1562ddc440b18e5f1db7cb1c1441c2 Mon Sep 17 00:00:00 2001 From: Patrick Lockley Date: Wed, 7 Mar 2012 19:54:25 +0000 Subject: [PATCH] Config.php Problem in _load_language_file if path doesn't exist (two files had typos in name). Added a file_exists call - better than a require fail? I thought possibly Index.php Deleted mine by mistake - should be identical as taken from trunk Some language files changes to fix the properties errors and a typo in Peer review Modules/Xerte/Peer.php had some eeeeengggggleeeeeesh in it still. Now removed. Toppie! RSS.PHP - all garbled up, now put back together again (suspect the merge) Website_code/php/fileupload.php - typo in name of language file website_code/php/peer/peer_review.php - typo in name of language file website_code/php/properties/access_template.php - all messed up by the merge i think (code had reappeared that had been taken out). website_code/php/properties/xml_template.php - all messed up by the merge i think (code had reappeared that had been taken out). website_code/php/scorm/export.php added isset check to some variables so as to pass STRICT_WARNINGS and resolved all manner of crazy post mergeness - the file had it's contents copied three times. website_code/php/scorm/scorm_library.php fixed typo in array index for licences (to licence) git-svn-id: https://xerteonlinetoolkits.googlecode.com/svn/trunk@283 912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641 --- config.php | 9 +- index.php | 68 ++++---- languages/en-gb/modules/xerte/peer.inc | 2 + .../php/properties/properties_library.inc | 2 - modules/xerte/peer.php | 2 +- rss.php | 20 +-- website_code/php/import/fileupload.php | 2 +- website_code/php/peer/peer_review.php | 8 +- .../php/properties/access_template.php | 28 +--- website_code/php/properties/xml_template.php | 6 - website_code/php/scorm/export.php | 158 ++---------------- website_code/php/scorm/scorm_library.php | 2 +- 12 files changed, 78 insertions(+), 229 deletions(-) diff --git a/config.php b/config.php index a3135ae44d..7719a7a9f7 100644 --- a/config.php +++ b/config.php @@ -54,14 +54,19 @@ function _debug($string, $up = 0) { if(!function_exists('_load_language_file')) { function _load_language_file($file_path) { if(isset($_SESSION['toolkits_language'])) { - $file_path = dirname(__FILE__) . '/languages/' . $_SESSION['toolkits_language'] . "/" . $file_path; + $file_path = dirname(__FILE__) . '/languages/' . $_SESSION['toolkits_language'] . $file_path; } else { // additional logic could use e.g. $_GET['language'] or $_COOKIE['language'] at this point... or something like Zend_Locale and HTTP accept headers... // we'll just fall back to assuming en-gb if nothing else is specified here. $file_path = dirname(__FILE__) . '/languages/en-gb/' . $file_path; } - require_once($file_path); + if(file_exists($file_path)){ + + require_once($file_path); + + } + return true; } } diff --git a/index.php b/index.php index 746787387c..48037df8f7 100644 --- a/index.php +++ b/index.php @@ -52,7 +52,7 @@ function show_page($extra,$xerte_toolkits_site){

welcome_message; ?>

- +
-
+
-
-
+
+

site_text; ?>

-
+
@@ -212,7 +212,7 @@ function show_page($extra,$xerte_toolkits_site){ include $xerte_toolkits_site->php_library_path . "user_library.php"; - $mysql_id=database_connect("index.php database connect success","index.php database connect fail"); + $mysql_id=database_connect("index.php database connect success","index.php database connect fail"); $_SESSION['toolkits_logon_username'] = $_POST["login"]; @@ -223,7 +223,7 @@ function show_page($extra,$xerte_toolkits_site){ if(check_if_first_time($_SESSION['toolkits_logon_username'])){ /* - * create the user a new id + * create the user a new id */ $_SESSION['toolkits_logon_id'] = create_user_id($_SESSION['toolkits_logon_username'], $_SESSION['toolkits_firstname'], $_SESSION['toolkits_surname']); @@ -232,7 +232,7 @@ function show_page($extra,$xerte_toolkits_site){ * create a virtual root folder for this user */ - create_a_virtual_root_folder(); + create_a_virtual_root_folder(); }else{ @@ -246,7 +246,7 @@ function show_page($extra,$xerte_toolkits_site){ } - recycle_bin(); + recycle_bin(); /* * Output the main page, including the user's and blank templates @@ -313,7 +313,7 @@ function show_page($extra,$xerte_toolkits_site){ --> -
+
@@ -324,7 +324,7 @@ function show_page($extra,$xerte_toolkits_site){

-
+
@@ -354,8 +354,8 @@ function show_page($extra,$xerte_toolkits_site){
@@ -372,15 +372,15 @@ function show_page($extra,$xerte_toolkits_site){
-
+
- -
-
- - + +
+
+ +
-
-
+
+
@@ -445,7 +445,7 @@ function show_page($extra,$xerte_toolkits_site){ -
-
+
-
+
-
+
+ copyright; ?>

@@ -476,7 +476,7 @@ function show_page($extra,$xerte_toolkits_site){ }else{ - if(($_POST["login"]==$xerte_toolkits_site->admin_username)&&(stripslashes($_POST["password"])==$xerte_toolkits_site->admin_password)){ + if(($_POST["login"]==$xerte_toolkits_site->admin_username)&&(stripslashes($_POST["password"])==$xerte_toolkits_site->admin_password)){ show_page("

" . INDEX_SITE_ADMIN . "

",$xerte_toolkits_site); @@ -498,4 +498,4 @@ function show_page($extra,$xerte_toolkits_site){ ?> - + \ No newline at end of file diff --git a/languages/en-gb/modules/xerte/peer.inc b/languages/en-gb/modules/xerte/peer.inc index 0a056021ae..0c513452ff 100644 --- a/languages/en-gb/modules/xerte/peer.inc +++ b/languages/en-gb/modules/xerte/peer.inc @@ -15,4 +15,6 @@ define("XERTE_PEER_GUIDANCE", "Please review this learning object. Use the feedback form below to submit your feedback."); + define("XERTE_PEER_TEXTAREA_INSTRUCTIONS", "You have been asked to provide some feedback on this learning object. Please enter your feedback and click save when you have finished. This feedback is anonymous."); + ?> \ No newline at end of file diff --git a/languages/en-gb/website_code/php/properties/properties_library.inc b/languages/en-gb/website_code/php/properties/properties_library.inc index 891211f186..01106b7456 100644 --- a/languages/en-gb/website_code/php/properties/properties_library.inc +++ b/languages/en-gb/website_code/php/properties/properties_library.inc @@ -134,8 +134,6 @@ define("PROPERTIES_LIBRARY_RSS_INCLUDE", "Include this project in the RSS Feeds"); - define("PROPERTIES_LIBRARY_RSS_EXPORT", "You can also include a description for your project in the RSS Feed as well"); - define("PROPERTIES_LIBRARY_RSS_DESCRIPTION", "You can also include a description for your project in the RSS Feed as well"); define("PROPERTIES_LIBRARY_RSS_SITE", "You can include this content in the site's RSS feeds. People who subscribe to the feeds will see new content as it as added to the feeds. There are several feeds available"); diff --git a/modules/xerte/peer.php b/modules/xerte/peer.php index 9bf33447c9..7dadfb95a4 100644 --- a/modules/xerte/peer.php +++ b/modules/xerte/peer.php @@ -63,7 +63,7 @@ function enableTTS(){ echo "

"; - echo "

"; + echo "

"; echo ""; diff --git a/rss.php b/rss.php index 729103eec9..f3f7eda396 100644 --- a/rss.php +++ b/rss.php @@ -52,16 +52,16 @@ $folder_string = " - " . _html_escape(str_replace("_", " ", $_GET['folder_name'])); } - echo " - " . _html_escape($temp_array[0]) . " " . _html_escape($temp_array[1]) . RSS_LO . " - " . {$xerte_toolkits_site->name} - {$xerte_toolkits_site->site_url} - " . RSS_FEED_DESC . _html_escape($temp_array[0]) . " " . _html_escape($temp_array[1]) . RSS_PLURAL . " {$folder_string} . " . RSS_FEED_PUBLIC . {$xerte_toolkits_site->name} - en-gb - - {$xerte_toolkits_site->rss_title} - {$xerte_toolkits_site->site_url}website_code/images/xerteLogo.jpg - {$xerte_toolkits_site->site_url}"; - $row_create = $rows[1]; + echo " + {$xerte_toolkits_site->name} + {$xerte_toolkits_site->site_url} + " . RSS_DESCRIPTION . " " . $xerte_toolkits_site->name . " + " . RSS_LANGUAGE . " + {$xerte_toolkits_site->name} + {$xerte_toolkits_site->site_url}website_code/images/xerteLogo.jpg + {$xerte_toolkits_site->site_url}"; + + $row_create = $rows[0]; } } diff --git a/website_code/php/import/fileupload.php b/website_code/php/import/fileupload.php index 419aa98b30..6822fb2a32 100644 --- a/website_code/php/import/fileupload.php +++ b/website_code/php/import/fileupload.php @@ -2,7 +2,7 @@ require_once "../../../config.php"; -_load_language_file("/website_code/php/fileupload.inc"); +_load_language_file("/website_code/php/import/fileupload.inc"); if(in_array($_FILES['filenameuploaded']['type'],$xerte_toolkits_site->mimetypes)){ diff --git a/website_code/php/peer/peer_review.php b/website_code/php/peer/peer_review.php index ac5b894cb9..0e59616841 100644 --- a/website_code/php/peer/peer_review.php +++ b/website_code/php/peer/peer_review.php @@ -12,7 +12,7 @@ require_once("../../../config.php"); -_load_language_file("/website_code/php/peer_review.inc"); +_load_language_file("/website_code/php/peer/peer_review.inc"); if(empty($_POST['template_id'])) { die("invalid form submission"); @@ -26,7 +26,11 @@ if(isset($_POST['user'])){ - if(mail( $_POST['user'] . "@" . $xerte_toolkits_site->email_to_add_to_username, PEER_REVIEW_FEEDBACK . " - \"" . str_replace("_"," ",$row_template_name['template_name']) ."\"", PEER_REVIEW_EMAIL_GREETING . "

" . PEER_REVIEW_EMAIL_INTRO . "


" . $_POST['feedback'] . "


" . PEER_REVIEW_EMAIL_YOURS . "

" . PEER_REVIEW_EMAIL_SIGNATURE, $headers)){ + $message = PEER_REVIEW_FEEDBACK . " - \"" . str_replace("_"," ",$row_template_name['template_name']) ."\""; + + $subject = PEER_REVIEW_EMAIL_GREETING . "

" . PEER_REVIEW_EMAIL_INTRO . "


" . $_POST['feedback'] . "


" . PEER_REVIEW_EMAIL_YOURS . "

" . PEER_REVIEW_EMAIL_SIGNATURE; + + if(mail( $_POST['user'] . "@" . $xerte_toolkits_site->email_to_add_to_username, $subject, $message, $headers)){ echo "" . PEER_REVIEW_USER_FEEDBACK . ""; diff --git a/website_code/php/properties/access_template.php b/website_code/php/properties/access_template.php index 41d1a81fe2..2fb0ce5525 100644 --- a/website_code/php/properties/access_template.php +++ b/website_code/php/properties/access_template.php @@ -56,34 +56,10 @@ function template_share_status($string){ access_display_fail(); - } - - mysql_close($database_connect_id); - - if(mysql_num_rows($query_for_security_content_response)!=0){ - - while($row_security = mysql_fetch_array($query_for_security_content_response)){ - - if(template_share_status($row_security['security_setting'])){ - - echo "

"; - - }else{ - - echo "

"; - - } - - echo " " . $row_security['security_setting'] . "

" . $row_security['security_info'] . "

"; - - } - } - echo ""; - - echo "

"; - }else{ + echo "

Sorry only the creator can set the access settings

"; + } diff --git a/website_code/php/properties/xml_template.php b/website_code/php/properties/xml_template.php index b568168589..c6028c7eb4 100644 --- a/website_code/php/properties/xml_template.php +++ b/website_code/php/properties/xml_template.php @@ -33,12 +33,6 @@ } - mysql_close($database_id); - - echo "

Sorry, only creators of templates can set up XML sharing

"; - - } - mysql_close($database_id); } diff --git a/website_code/php/scorm/export.php b/website_code/php/scorm/export.php index 65238f4333..1f47dd95b9 100644 --- a/website_code/php/scorm/export.php +++ b/website_code/php/scorm/export.php @@ -157,156 +157,26 @@ */ if($scorm=="true"){ + + if(isset($_GET['data'])){ - if($_GET['data']==true){ + if($_GET['data']==true){ - $query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templatesyndication where template_id = " . mysql_real_escape_string($_GET['template_id']); + $query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templatesyndication where template_id = " . mysql_real_escape_string($_GET['template_id']); - $query_response_metadata = mysql_query($query); + $query_response_metadata = mysql_query($query); - $metadata = mysql_fetch_array($query_response_metadata); + $metadata = mysql_fetch_array($query_response_metadata); - $query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templaterights, " . $xerte_toolkits_site->database_table_prefix ."logindetails where template_id = " . mysql_real_escape_string($_GET['template_id']) . " and login_id = user_id"; + $query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templaterights, " . $xerte_toolkits_site->database_table_prefix ."logindetails where template_id = " . mysql_real_escape_string($_GET['template_id']) . " and login_id = user_id"; - $query_response_users = mysql_query($query); + $query_response_users = mysql_query($query); + + lmsmanifest_create_rich($row, $metadata, $query_response_users); - lmsmanifest_create_rich($row, $metadata, $query_response_users); - - }else{ - - lmsmanifest_create($row['zipname']); - - } - - scorm_html_page_create($row['template_name'],$row['template_framework']); - - }else{ - - basic_html_page_create($row['template_name'],$row['template_framework']); - - } - - - /* - * Add the files to the zip file, create the archive, then send it to the user - */ - - xerte_zip_files(); - - $zipfile->create_archive(); - - $zipfile->download_file($row['zipname']); - - - /* - * remove the files - */ - - clean_up_files(); - - unlink($dir_path . "template.xml"); - - } - -} - - copy_parent_files(); - - /* - * If scorm copy the scorn files as well - */ - - $scorm=mysql_real_escape_string($_GET['scorm']); - - if($scorm=="true"){ - - folder_loop($scorm_path); - - copy_scorm_files(); - - }else{ - - copy($scorm_path . "rloObject.js", $dir_path . "rloObject.js"); - - array_push($delete_file_array, $dir_path . "rloObject.js"); - - copy($scorm_path . "MainPreloader.swf", $dir_path . "MainPreloader.swf"); - - array_push($delete_file_array, $dir_path . "MainPreloader.swf"); - - copy($scorm_path . "resources.swf", $dir_path . "resources.swf"); - - array_push($delete_file_array, $dir_path . "resources.swf"); - - } - - copy($xerte_toolkits_site->root_file_path . "XMLEngine.swf", $dir_path . "XMLEngine.swf"); - - array_push($delete_file_array, $dir_path . "XMLEngine.swf"); - - - - /* - * Language support - */ - - mkdir($dir_path . 'languages'); - chmod($dir_path . 'languages', 0777); - array_push($delete_folder_array, $dir_path . 'languages'); - - - copy($xerte_toolkits_site->root_file_path . "languages/language-config.xml", $dir_path . "languages/language-config.xml"); - - array_push($delete_file_array, $dir_path . "languages/language-config.xml"); - - copy($xerte_toolkits_site->root_file_path . "languages/english.xml", $dir_path . "languages/english.xml"); - - array_push($delete_file_array, $dir_path . "languages/english.xml"); - - - - - if($scorm=="true"){ - - copy($dir_path . $row['template_name'] . ".rlt", $dir_path . "learningobject.rlo"); - - unlink($dir_path . $row['template_name'] . ".rlt"); - - array_push($delete_file_array, $dir_path . "learningobject.rlo"); - - }else{ - - copy($dir_path . $row['template_name'] . ".rlt", $dir_path . "learningobject.rlt"); - - unlink($dir_path . $row['template_name'] . ".rlt"); - - array_push($delete_file_array, $dir_path . "learningobject.rlt"); - - } - - folder_loop($dir_path); - - /* - * Create scorm manifests of a basic HTML page - */ - - if($scorm=="true"){ - - if($_GET['data']==true){ - - $query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templatesyndication where template_id = " . mysql_real_escape_string($_GET['template_id']); - - $query_response_metadata = mysql_query($query); - - $metadata = mysql_fetch_array($query_response_metadata); - - $query = "select * from " . $xerte_toolkits_site->database_table_prefix ."templaterights, " . $xerte_toolkits_site->database_table_prefix ."logindetails where template_id = " . mysql_real_escape_string($_GET['template_id']) . " and login_id = user_id"; - - $query_response_users = mysql_query($query); - - lmsmanifest_create_rich($row, $metadata, $query_response_users); - - }else{ + } + + }else{ lmsmanifest_create($row['zipname']); @@ -342,4 +212,4 @@ } -} +} \ No newline at end of file diff --git a/website_code/php/scorm/scorm_library.php b/website_code/php/scorm/scorm_library.php index a43f83dac4..5c74d99a7b 100644 --- a/website_code/php/scorm/scorm_library.php +++ b/website_code/php/scorm/scorm_library.php @@ -68,7 +68,7 @@ function lmsmanifest_create_rich($row, $metadata, $users){ $scorm_top_string .= "text/html" . url_return("play", mysql_real_escape_string($_GET['template_id'])) . ""; - $scorm_top_string .= "LOMv1.0yes" . $metadata['licenses'] . "" . $metadata['licenses'] . ""; + $scorm_top_string .= "LOMv1.0yes" . $metadata['license'] . "" . $metadata['license'] . ""; $scorm_top_string .= "";