diff --git a/root/adm/style/portal/acp_portal_calendar.html b/root/adm/style/portal/acp_portal_calendar.html
index e0576ff0..f6abb463 100644
--- a/root/adm/style/portal/acp_portal_calendar.html
+++ b/root/adm/style/portal/acp_portal_calendar.html
@@ -117,6 +117,10 @@
px
+
+
{L_MODULE_RESET_EXP}
+
+
{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_config.html b/root/adm/style/portal/acp_portal_config.html
index 0b94bffe..7ecc39fe 100644
--- a/root/adm/style/portal/acp_portal_config.html
+++ b/root/adm/style/portal/acp_portal_config.html
@@ -63,6 +63,10 @@
- px
+
+
{L_MODULE_RESET_EXP}
+
+
{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_custom.html b/root/adm/style/portal/acp_portal_custom.html
index 539f0551..76cacfdf 100644
--- a/root/adm/style/portal/acp_portal_custom.html
+++ b/root/adm/style/portal/acp_portal_custom.html
@@ -35,6 +35,10 @@
- px
+
+
{L_MODULE_RESET_EXP}
+
+
{L_ACP_PORTAL_CUSTOM_PERMISSION_EXP}
diff --git a/root/adm/style/portal/acp_portal_links.html b/root/adm/style/portal/acp_portal_links.html
index da9a57b3..3e450710 100644
--- a/root/adm/style/portal/acp_portal_links.html
+++ b/root/adm/style/portal/acp_portal_links.html
@@ -86,6 +86,10 @@
- px
+
+
{L_MODULE_RESET_EXP}
+
+
{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_menu.html b/root/adm/style/portal/acp_portal_menu.html
index f4abe0fa..3dcb8acf 100644
--- a/root/adm/style/portal/acp_portal_menu.html
+++ b/root/adm/style/portal/acp_portal_menu.html
@@ -93,6 +93,10 @@
- px
+
+
{L_MODULE_RESET_EXP}
+
+
{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/adm/style/portal/acp_portal_welcome.html b/root/adm/style/portal/acp_portal_welcome.html
index d05394be..2346669f 100644
--- a/root/adm/style/portal/acp_portal_welcome.html
+++ b/root/adm/style/portal/acp_portal_welcome.html
@@ -35,6 +35,10 @@
- px
+
+
{L_MODULE_RESET_EXP}
+
+
{L_MODULE_PERMISSIONS_EXP}
diff --git a/root/includes/acp/acp_portal.php b/root/includes/acp/acp_portal.php
index 4858cee9..d1ba2b50 100644
--- a/root/includes/acp/acp_portal.php
+++ b/root/includes/acp/acp_portal.php
@@ -78,7 +78,7 @@ class acp_portal
{
$sql = 'SELECT *
FROM ' . PORTAL_MODULES_TABLE . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$result = $db->sql_query_limit($sql, 1);
$module_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -156,10 +156,52 @@ class acp_portal
$submit = false;
}
+ // Reset module
+ $reset_module = request_var('module_reset', 0);
+
+ if($reset_module)
+ {
+ if (confirm_box(true))
+ {
+ $sql_ary = array(
+ 'module_name' => $c_class->name,
+ 'module_image_src' => $c_class->image_src,
+ 'module_group_ids' => '',
+ 'module_image_height' => 16,
+ 'module_image_width' => 16,
+ );
+ $sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
+ SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
+ WHERE module_id = ' . (int) $module_id;
+ $db->sql_query($sql);
+
+ $cache->destroy('config');
+ $cache->destroy('portal_config');
+ $portal_config = obtain_portal_config(); // we need to prevent duplicate entry errors
+ $c_class->install($module_id);
+ $cache->purge();
+
+ // We need to return to the module config
+ meta_refresh(3, reapply_sid($this->u_action . "&module_id=$module_id"));
+
+ trigger_error($user->lang['MODULE_RESET_SUCCESS'] . adm_back_link($this->u_action . "&module_id=$module_id"));
+ }
+ else
+ {
+ $confirm_text = (isset($user->lang[$module_data['module_name']])) ? sprintf($user->lang['MODULE_RESET_CONFIRM'], $user->lang[$module_data['module_name']]) : sprintf($user->lang['DELETE_MODULE_CONFIRM'], utf8_normalize_nfc($module_data['module_name']));
+ confirm_box(false, $confirm_text, build_hidden_fields(array(
+ 'i' => $id,
+ 'mode' => $mode,
+ 'module_reset' => true,
+ 'module_id' => $module_id,
+ )));
+ }
+ }
+
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
{
- if ($submit && ($null['type'] == 'custom' || $null['submit_type'] == 'custom'))
+ if ($submit && ($null['type'] == 'custom' || (isset($null['submit_type']) && $null['submit_type'] == 'custom')))
{
$func = array($c_class, $null['submit']);
@@ -227,7 +269,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
$cache->destroy('portal_modules');
@@ -325,7 +367,7 @@ class acp_portal
{
$sql = 'SELECT module_order, module_column
FROM ' . PORTAL_MODULES_TABLE . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$result = $db->sql_query_limit($sql, 1);
$module_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -342,7 +384,7 @@ class acp_portal
{
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_order = module_order - 1
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
}
}
@@ -353,7 +395,7 @@ class acp_portal
{
$sql = 'SELECT module_order, module_column
FROM ' . PORTAL_MODULES_TABLE . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$result = $db->sql_query_limit($sql, 1);
$module_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -370,7 +412,7 @@ class acp_portal
{
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_order = module_order + 1
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
}
}
@@ -381,7 +423,7 @@ class acp_portal
{
$sql = 'SELECT module_order, module_column, module_classname
FROM ' . PORTAL_MODULES_TABLE . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$result = $db->sql_query_limit($sql, 1);
$module_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -410,7 +452,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_column = module_column + 1
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
@@ -430,7 +472,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_order = ' . $new_order . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
}
}
@@ -448,7 +490,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_column = module_column + 2
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
@@ -468,7 +510,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_order = ' . $new_order . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
}
@@ -485,7 +527,7 @@ class acp_portal
{
$sql = 'SELECT module_order, module_column, module_classname
FROM ' . PORTAL_MODULES_TABLE . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$result = $db->sql_query_limit($sql, 1);
$module_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -514,7 +556,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_column = module_column - 1
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
@@ -534,7 +576,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_order = ' . $new_order . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
}
}
@@ -552,7 +594,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_column = module_column - 2
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
@@ -572,7 +614,7 @@ class acp_portal
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
SET module_order = ' . $new_order . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
}
}
@@ -588,7 +630,7 @@ class acp_portal
{
$sql = 'SELECT *
FROM ' . PORTAL_MODULES_TABLE . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$result = $db->sql_query_limit($sql, 1);
$module_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -614,7 +656,7 @@ class acp_portal
$c_class->uninstall($module_data['module_id']);
$sql = 'DELETE FROM ' . PORTAL_MODULES_TABLE . '
- WHERE module_id = ' . $module_id;
+ WHERE module_id = ' . (int) $module_id;
$db->sql_query($sql);
$sql = 'UPDATE ' . PORTAL_MODULES_TABLE . '
diff --git a/root/language/de/mods/info_acp_portal.php b/root/language/de/mods/info_acp_portal.php
index daf1c3f8..73929594 100644
--- a/root/language/de/mods/info_acp_portal.php
+++ b/root/language/de/mods/info_acp_portal.php
@@ -55,6 +55,8 @@ $lang = array_merge($lang, array(
'B3P_FILE_NOT_FOUND' => 'Die angegebene Datei konnte nicht gefunden werden',
'UNABLE_TO_MOVE' => 'Es ist nicht möglich den Block in die gewählte Spalte zu verschieben.',
'DELETE_MODULE_CONFIRM' => 'Bist du sicher, dass du das Module "%1$s" löschen möchtest?',
+ 'MODULE_RESET_SUCCESS' => 'Modul Einstellungen erfolgreich zurückgesetzt.',
+ 'MODULE_RESET_CONFIRM' => 'Bist du sicher, dass du die Einstellungen des Moduls "%1$s" zurücksetzen willst?',
'MODULE_OPTIONS' => 'Modul Optionen',
'MODULE_NAME' => 'Modul Name',
@@ -63,7 +65,9 @@ $lang = array_merge($lang, array(
'MODULE_IMAGE_EXP' => 'Gebe den Dateinamen des Modul Bildes ein. Bilder müssen sich in styles/*yourstyle*/theme/images/portal/ befinden.',
'MODULE_PERMISSIONS' => 'Modul Berechtigungen',
'MODULE_PERMISSIONS_EXP' => 'Wähle die Gruppen aus, die berechtigt sein sollen, das Modul zu sehen. Sollen alle Benutzer das Modul sehen können, wähle nichts aus.
An- / abwählen mehrerer Gruppen indem man Strg gedrückt hält und klickt.',
-
+ 'MODULE_RESET' => 'Modul Einstellungen zurücksetzen',
+ 'MODULE_RESET_EXP' => 'Dies wird alle Einstellungen des Moduls auf die Standardeinstellungen zurücksetzen!',
+
// general
'ACP_PORTAL' => 'Portal',
'ACP_PORTAL_GENERAL_INFO' => 'Allgemeine Einstellungen',
diff --git a/root/language/en/mods/info_acp_portal.php b/root/language/en/mods/info_acp_portal.php
index ec493397..ccf4a67a 100644
--- a/root/language/en/mods/info_acp_portal.php
+++ b/root/language/en/mods/info_acp_portal.php
@@ -54,6 +54,8 @@ $lang = array_merge($lang, array(
'B3P_FILE_NOT_FOUND' => 'The requested file could not be found',
'UNABLE_TO_MOVE' => 'It is not possible to move the block to the selected column.',
'DELETE_MODULE_CONFIRM' => 'Are you sure you wish to delete the module "%1$s"?',
+ 'MODULE_RESET_SUCCESS' => 'Successfully reset the module settings.',
+ 'MODULE_RESET_CONFIRM' => 'Are you sure you wish to reset the settings of the module "%1$s"?',
'MODULE_OPTIONS' => 'Module options',
'MODULE_NAME' => 'Module name',
@@ -66,6 +68,8 @@ $lang = array_merge($lang, array(
'MODULE_IMAGE_WIDTH_EXP' => 'Enter the width of the module image in pixels',
'MODULE_IMAGE_HEIGHT' => 'Module image height',
'MODULE_IMAGE_HEIGHT_EXP' => 'Enter the height of the module image in pixels',
+ 'MODULE_RESET' => 'Reset module configuration',
+ 'MODULE_RESET_EXP' => 'This will reset all settings to the default!',
// general
'ACP_PORTAL' => 'Portal',