related to #1530 status verification for option pages in configuration section

This commit is contained in:
Matthieu Leproux 2021-10-21 15:27:46 +02:00
parent 967cbe5e2a
commit d0a331a4b5
9 changed files with 25 additions and 8 deletions

View file

@ -11,6 +11,11 @@ if( !defined("PHPWG_ROOT_PATH") )
die ("Hacking attempt!");
}
if (!is_webmaster())
{
$page['warnings'][] = l10n('Webmaster status is required.');
}
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
@ -253,7 +258,7 @@ if (isset($_POST['submit']))
}
// updating configuration if no error found
if (!in_array($page['section'], array('sizes', 'watermark')) and count($page['errors']) == 0)
if (!in_array($page['section'], array('sizes', 'watermark')) and count($page['errors']) == 0 and is_webmaster())
{
//echo '<pre>'; print_r($_POST); echo '</pre>';
$result = pwg_query('SELECT param FROM '.CONFIG_TABLE);
@ -602,6 +607,8 @@ switch ($page['section'])
}
}
$template->assign('isWebmaster', (is_webmaster()) ? 1 : 0);
//----------------------------------------------------------- sending html code
$template->assign_var_from_handle('ADMIN_CONTENT', 'config');
?>

View file

@ -11,6 +11,11 @@ if( !defined("PHPWG_ROOT_PATH") )
die ("Hacking attempt!");
}
if (!is_webmaster())
{
return;
}
$errors = array();
// original resize

View file

@ -11,6 +11,11 @@ if( !defined("PHPWG_ROOT_PATH") )
die ("Hacking attempt!");
}
if (!is_webmaster())
{
return;
}
function get_watermark_filename($list, $candidate, $step = 0)
{
global $change_name;

View file

@ -153,7 +153,7 @@
</div> <!-- configContent -->
<p class="formButtons">
<button name="submit" type="submit" class="buttonLike">
<button name="submit" type="submit" class="buttonLike" {if $isWebmaster != 1}disabled{/if}>
<i class="icon-floppy"></i> {'Save Settings'|@translate}
</button>
</p>

View file

@ -52,8 +52,8 @@
<p class="bottomButtons">
<input type="hidden" name="pwg_token" value="{$PWG_TOKEN}">
<input class="submit" type="submit" name="validate" value="{'Submit'|translate}">
<input class="submit" type="reset" name="reset" value="{'Reset'|translate}">
<input class="submit" type="submit" name="validate" value="{'Submit'|translate}" {if $isWebmaster != 1}disabled{/if}>
<input class="submit" type="reset" name="reset" value="{'Reset'|translate}" {if $isWebmaster != 1}disabled{/if}>
</p>
</div>

View file

@ -312,7 +312,7 @@
</div> <!-- configContent -->
<p class="formButtons">
<button name="submit" type="submit" class="buttonLike">
<button name="submit" type="submit" class="buttonLike" {if $isWebmaster != 1}disabled{/if}>
<i class="icon-floppy"></i> {'Save Settings'|@translate}
</button>
</p>

View file

@ -236,7 +236,7 @@ jQuery("input[name='mail_theme']").change(function() {
</div> <!-- configContent -->
<p class="formButtons">
<button name="submit" type="submit" class="buttonLike">
<button name="submit" type="submit" class="buttonLike" {if $isWebmaster != 1}disabled{/if}>
<i class="icon-floppy"></i> {'Save Settings'|@translate}
</button>
</p>

View file

@ -241,7 +241,7 @@ $(".restore-settings-button").each(function() {
</div> <!-- configContent -->
<p class="formButtons">
<button name="submit" type="submit" class="buttonLike">
<button name="submit" type="submit" class="buttonLike" {if $isWebmaster != 1}disabled{/if}>
<i class="icon-floppy"></i> {'Save Settings'|@translate}
</button>
</p>

View file

@ -132,7 +132,7 @@
</div> <!-- configContent -->
<p class="formButtons">
<button name="submit" type="submit" class="buttonLike">
<button name="submit" type="submit" class="buttonLike" {if $isWebmaster != 1}disabled{/if}>
<i class="icon-floppy"></i> {'Save Settings'|@translate}
</button>
</p>