\n";
- if (in_array('banner', $plugin_info['location']))
+ if (in_array($location, $plugin_info['location']))
{
- if (in_array($testplugin, $usedplugins['banner']))
+ if (in_array($current_plugin, $active_plugins[$location]))
{
$checked = "checked";
}
@@ -341,15 +348,9 @@ function handle_plugins()
{
$checked = '';
}
- echo '';
+ echo '';
}
echo "\t\t
\n";
- echo "\t\n";
- }
- }
- echo '';
-
- echo '';
}
/**
@@ -370,7 +371,10 @@ function handle_stylesheets()
$counter=1;
while (false !== ($style_dir = readdir($handle)))
{
- if(substr($style_dir,0,1)=='.'){continue;} //skip dirs starting with a '.'
+ if(substr($style_dir,0,1)=='.') //skip dirs starting with a '.'
+ {
+ continue;
+ }
$dirpath = api_get_path(SYS_PATH).'main/css/'.$style_dir;
if (is_dir($dirpath))
{
@@ -413,11 +417,11 @@ function store_plugins()
$sql = "DELETE FROM $table_settings_current WHERE category='Plugins'";
api_sql_query($sql, __LINE__, __FILE__);
- // step 2: looping through all the post values we only store these which end on loginpage_menu or campushomepage_menu or banner
+ // step 2: looping through all the post values we only store these which are really a valid plugin location.
foreach ($_POST as $form_name => $formvalue)
{
$form_name_elements = explode("-", $form_name);
- if (in_array('loginpage_menu', $form_name_elements) OR in_array('campushomepage_menu', $form_name_elements) OR in_array('banner', $form_name_elements))
+ if (is_valid_plugin_location($form_name_elements[1]))
{
$sql = "INSERT into $table_settings_current (variable,category,selected_value) VALUES ('".$form_name_elements['1']."','Plugins','".$form_name_elements['0']."')";
api_sql_query($sql, __LINE__, __FILE__);
@@ -425,6 +429,24 @@ function store_plugins()
}
}
+/**
+ * Check if the post information is really a valid plugin location.
+ * @author Patrick Cool , Ghent University
+*/
+function is_valid_plugin_location($location)
+{
+ $valid_locations=array('loginpage_main', 'loginpage_menu', 'campushomepage_main', 'campushomepage_menu', 'mycourses_main', 'mycourses_menu','header', 'footer');
+ if (in_array($location, $valid_locations))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
/**
* This function allows the platform admin to choose which should be the default stylesheet
* @author Patrick Cool , Ghent University