Преглед изворни кода

add a admin swicht for the browser sniffer (disable by default)

Juan Carlos Raña пре 13 година
родитељ
комит
c8e578f8b8
3 измењених фајлова са 15 додато и 9 уклоњено
  1. 5 2
      main/install/db_main.sql
  2. 3 0
      main/install/migrate-db-1.8.8-1.9.0-pre.sql
  3. 7 7
      user_portal.php

+ 5 - 2
main/install/db_main.sql

@@ -863,7 +863,8 @@ VALUES
 ('languagePriority4', NULL, 'radio', 'Languages', 'platform_lang','LanguagePriority4Title', 'LanguagePriority4Comment', NULL, NULL, 0),
 ('login_is_email', NULL, 'radio', 'Platform', 'false', 'LoginIsEmailTitle', 'LoginIsEmailComment', NULL, NULL, 0),
 ('courses_default_creation_visibility', NULL, 'radio', 'Course', '2', 'CoursesDefaultCreationVisibilityTitle', 'CoursesDefaultCreationVisibilityComment', NULL, NULL, 1),
-('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.17051','DokeosDatabaseVersion','', NULL, NULL, 0);
+('allow_browser_sniffer', NULL, 'radio', 'Platform', 'false', 'AllowBrowserSnifferTitle', 'AllowBrowserSnifferComment', NULL, NULL, 0),
+('chamilo_database_version',NULL,'textfield',NULL, '1.9.0.17052','DokeosDatabaseVersion','', NULL, NULL, 0);
 
 /*
 ('show_tabs', 'custom_tab_1', 'checkbox', 'Platform', 'true', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom1', 1),
@@ -1198,7 +1199,9 @@ VALUES
 ('courses_default_creation_visibility', '3', 'OpenToTheWorld'),
 ('courses_default_creation_visibility', '2', 'OpenToThePlatform'),
 ('courses_default_creation_visibility', '1', 'Private'),
-('courses_default_creation_visibility', '0', 'CourseVisibilityClosed');
+('courses_default_creation_visibility', '0', 'CourseVisibilityClosed'),
+('allow_browser_sniffer', 'true', 'Yes'),
+('allow_browser_sniffer', 'false', 'No');
 
 UNLOCK TABLES;
 /*

+ 3 - 0
main/install/migrate-db-1.8.8-1.9.0-pre.sql

@@ -144,6 +144,9 @@ INSERT INTO settings_options (variable, value, display_text) VALUES ('courses_de
 INSERT INTO settings_options (variable, value, display_text) VALUES ('courses_default_creation_visibility', '1', 'Private');
 INSERT INTO settings_options (variable, value, display_text) VALUES ('courses_default_creation_visibility', '0', 'CourseVisibilityClosed');
 
+INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES ('allow_browser_sniffer', NULL, 'radio', 'Platform', 'false', 'AllowBrowserSnifferTitle', 'AllowBrowserSnifferComment', NULL, NULL, 0);
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer', 'true', 'Yes');
+INSERT INTO settings_options (variable, value, display_text) VALUES ('allow_browser_sniffer', 'false', 'No');
 
 -- Course ranking
 

+ 7 - 7
user_portal.php

@@ -156,14 +156,14 @@ $controller = new IndexManager(get_lang('MyCourses'));
 $courses_and_sessions = $controller->return_courses_and_sessions();
 $controller->tpl->assign('content', $courses_and_sessions);
 
-/*
- * 
-if ($_SESSION['sniff_navigator']!="checked") {
-	$controller->tpl->assign('show_sniff', 					1);
-} else{
-	$controller->tpl->assign('show_sniff', 					0);
+ 
+if (api_get_setting('allow_browser_sniffer') == 'true') {
+	if ($_SESSION['sniff_navigator']!="checked") {
+		$controller->tpl->assign('show_sniff', 	1);
+	} else{
+		$controller->tpl->assign('show_sniff', 	0);
+	}
 }
-*/
 
 
 //check for flash and message