mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-01 05:44:41 +03:00
Do not use global $page variable in form_value_mb func
This commit is contained in:
parent
3d907f260e
commit
5661cb318d
@ -44,11 +44,20 @@ function form_value_cb($page, $name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function form_value_mb($key, $id)
|
||||
{
|
||||
global $page;
|
||||
if (isset($page) && isset($page["form$key"]) && is_array($page["form$key"])) {
|
||||
return in_array($id, $page["form$key"]);
|
||||
|
||||
/**
|
||||
* Checks if form variable is array and has element with specified key.
|
||||
*
|
||||
* @param array $page The page array. All form variables are prefixed with
|
||||
* "form" string.
|
||||
* @param string $name Form variable name.
|
||||
* @param string $key Key of the element to check.
|
||||
* @return boolean Returns TRUE only if specified form variable is set, is an
|
||||
* array has element with the specified key. In all other cases returns FALSE.
|
||||
*/
|
||||
function form_value_mb($page, $name, $key) {
|
||||
if (!empty($page) && isset($page["form$name"]) && is_array($page["form$name"])) {
|
||||
return in_array($key, $page["form$name"]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ require_once(dirname(__FILE__).'/inc_errors.php');
|
||||
<?php foreach( $page['operators'] as $pm ) { ?>
|
||||
<div class="field">
|
||||
<div class="fvaluenodesc">
|
||||
<input id="op<?php echo htmlspecialchars($pm['operatorid']); ?>" type="checkbox" name="op<?php echo htmlspecialchars($pm['operatorid']); ?>" value="on"<?php echo form_value_mb('op',$pm['operatorid']) ? " checked=\"checked\"" : "" ?>/>
|
||||
<input id="op<?php echo htmlspecialchars($pm['operatorid']); ?>" type="checkbox" name="op<?php echo htmlspecialchars($pm['operatorid']); ?>" value="on"<?php echo form_value_mb($page, 'op',$pm['operatorid']) ? " checked=\"checked\"" : "" ?>/>
|
||||
<label for="op<?php echo htmlspecialchars($pm['operatorid']); ?>"><?php echo htmlspecialchars(topage($pm['vclocalename'])) ?> (<a href="operator.php?op=<?php echo $pm['operatorid'] ?>"><?php echo htmlspecialchars(topage($pm['vclogin'])) ?></a>)</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -45,7 +45,7 @@ require_once(dirname(__FILE__).'/inc_errors.php');
|
||||
<div class="field level<?php echo $pm['level'] ?>">
|
||||
<label for="group<?php echo htmlspecialchars($pm['groupid']); ?>" class="flabel"><?php echo htmlspecialchars(topage($pm['vclocalname'])) ?></label>
|
||||
<div class="fvalue">
|
||||
<input id="group<?php echo htmlspecialchars($pm['groupid']); ?>" type="checkbox" name="group<?php echo htmlspecialchars($pm['groupid']); ?>" value="on"<?php echo form_value_mb('group',$pm['groupid']) ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
|
||||
<input id="group<?php echo htmlspecialchars($pm['groupid']); ?>" type="checkbox" name="group<?php echo htmlspecialchars($pm['groupid']); ?>" value="on"<?php echo form_value_mb($page, 'group',$pm['groupid']) ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/>
|
||||
</div>
|
||||
<label for="group<?php echo htmlspecialchars($pm['groupid']); ?>" class="fdescr"> — <?php echo $pm['vclocaldescription'] ? htmlspecialchars(topage($pm['vclocaldescription'])) : getlocal("operator.group.no_description") ?></label>
|
||||
<br clear="all"/>
|
||||
|
@ -43,7 +43,7 @@ require_once(dirname(__FILE__).'/inc_errors.php');
|
||||
</p>
|
||||
<?php foreach( $page['permissionsList'] as $pm ) { ?>
|
||||
<label>
|
||||
<input type="checkbox" name="permissions<?php echo $pm['id'] ?>" value="on"<?php echo form_value_mb('permissions',$pm['id']) ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/> <?php echo $pm['descr'] ?>
|
||||
<input type="checkbox" name="permissions<?php echo $pm['id'] ?>" value="on"<?php echo form_value_mb($page, 'permissions',$pm['id']) ? " checked=\"checked\"" : "" ?><?php echo $page['canmodify'] ? "" : " disabled=\"disabled\"" ?>/> <?php echo $pm['descr'] ?>
|
||||
</label>
|
||||
<br/>
|
||||
<?php } ?>
|
||||
|
Loading…
Reference in New Issue
Block a user