Remove any call to ['Name']

This commit is contained in:
Emmanuel Papin 2015-05-14 20:49:36 +02:00
parent 7766ec4c72
commit 775da60382
1 changed files with 22 additions and 22 deletions

View File

@ -170,30 +170,30 @@ foreach( dbFetchAll( $sql, NULL, array( $mid, $zid, $plugin ) ) as $popt )
} }
} }
foreach($pOptions as $name => $values) // Add option in database if missing
foreach($pOptions as $key => $popt)
{ {
if(!in_array($name, $optionNames)) if(!in_array($key, $optionNames))
{ {
$popt=$pOptions[$name];
switch($popt['Type']) switch($popt['Type'])
{ {
case "select": case "select":
$sql="INSERT INTO PluginsConfig VALUES ('',?,?,?,?,'','',?,?,?)"; $sql="INSERT INTO PluginsConfig VALUES ('',?,?,?,?,'','',?,?,?)";
dbQuery($sql, array( $popt['Name'], $popt['Value'], $popt['Type'], $popt['Choices'], $mid, $zid, $plugin ) ); dbQuery($sql, array( $key, $popt['Value'], $popt['Type'], $popt['Choices'], $mid, $zid, $plugin ) );
break; break;
case "integer": case "integer":
$sql="INSERT INTO PluginsConfig VALUES ('',?,?,?,'',?,?,?,?,?)"; $sql="INSERT INTO PluginsConfig VALUES ('',?,?,?,'',?,?,?,?,?)";
dbQuery($sql, array( $popt['Name'], $popt['Value'], $popt['Type'], $popt['Min'], $popt['Max'], $mid, $zid, $plugin ) ); dbQuery($sql, array( $key, $popt['Value'], $popt['Type'], $popt['Min'], $popt['Max'], $mid, $zid, $plugin ) );
break; break;
case "list": case "list":
$sql="INSERT INTO PluginsConfig VALUES ('',?,'',?,'','','',?,?,?)"; $sql="INSERT INTO PluginsConfig VALUES ('',?,'',?,'','','',?,?,?)";
dbQuery($sql, array( $popt['Name'], $popt['Type'], $mid, $zid, $plugin ) ); dbQuery($sql, array( $key, $popt['Type'], $mid, $zid, $plugin ) );
break; break;
case "checkbox": case "checkbox":
case "text": case "text":
default: default:
$sql="INSERT INTO PluginsConfig VALUES ('',?,?,?,'','','',?,?,?)"; $sql="INSERT INTO PluginsConfig VALUES ('',?,?,?,'','','',?,?,?)";
dbQuery($sql, array( $popt['Name'], $popt['Value'], $popt['Type'], $mid, $zid, $plugin ) ); dbQuery($sql, array( $key, $popt['Value'], $popt['Type'], $mid, $zid, $plugin ) );
} }
} }
} }
@ -263,18 +263,18 @@ xhtmlHeaders(__FILE__, $SLANG['Plugin'] );
<table id="pluginSettings" cellspacing="0"> <table id="pluginSettings" cellspacing="0">
<tbody> <tbody>
<?php <?php
foreach($pOptions as $name => $popt) foreach($pOptions as $key => $popt)
{ {
?> ?>
<tr><th scope="row"><?php echo pLang($name) ?></th> <tr><th scope="row"><?php echo pLang($key) ?></th>
<?php <?php
switch($popt['Type']) switch($popt['Type'])
{ {
case "checkbox": case "checkbox":
?> ?>
<td> <td>
<input type="checkbox" name="dsp_pluginOpt[<?php echo $popt['Name']; ?>]" id="dsp_pluginOpt[<?php echo $popt['Name']; ?>]" <?php if ($popt['Value'] == "Yes") echo 'checked="checked"'; if (!isEnabled($popt['Name'])) echo 'disabled="disabled"'; ?> onchange="applyChanges();"> <input type="checkbox" name="dsp_pluginOpt[<?php echo $key; ?>]" id="dsp_pluginOpt[<?php echo $key; ?>]" <?php if ($popt['Value'] == "Yes") echo 'checked="checked"'; if (!isEnabled($key)) echo 'disabled="disabled"'; ?> onchange="applyChanges();">
<input type="hidden" name="pluginOpt[<?php echo $popt['Name'] ?>]" id="pluginOpt[<?php echo $popt['Name']; ?>]" value="<?php if ($popt['Value'] == "Yes") echo "Yes"; else echo "No"; ?>"> <input type="hidden" name="pluginOpt[<?php echo $key; ?>]" id="pluginOpt[<?php echo $key; ?>]" value="<?php if ($popt['Value'] == "Yes") echo "Yes"; else echo "No"; ?>">
</td> </td>
<?php <?php
break; break;
@ -282,7 +282,7 @@ foreach($pOptions as $name => $popt)
$pchoices=explode(',',$popt['Choices']); $pchoices=explode(',',$popt['Choices']);
?> ?>
<td colspan="2"> <td colspan="2">
<select name="dsp_pluginOpt[<?php echo $popt['Name'] ?>]" id="dsp_pluginOpt[<?php echo $popt['Name']; ?>]" <?php if (!isEnabled($popt['Name'])) echo 'disabled="disabled"'; ?> onchange="applyChanges();"> <select name="dsp_pluginOpt[<?php echo $key; ?>]" id="dsp_pluginOpt[<?php echo $key; ?>]" <?php if (!isEnabled($key)) echo 'disabled="disabled"'; ?> onchange="applyChanges();">
<?php <?php
foreach($pchoices as $pchoice) { foreach($pchoices as $pchoice) {
$psel=""; $psel="";
@ -294,23 +294,23 @@ foreach($pOptions as $name => $popt)
} }
?> ?>
</select> </select>
<input type="hidden" name="pluginOpt[<?php echo $popt['Name'] ?>]" id="pluginOpt[<?php echo $popt['Name']; ?>]" value="<?php echo $popt['Value']; ?>" /> <input type="hidden" name="pluginOpt[<?php echo $key; ?>]" id="pluginOpt[<?php echo $key; ?>]" value="<?php echo $popt['Value']; ?>" />
</td> </td>
<?php <?php
break; break;
case "text": case "text":
?> ?>
<td> <td>
<input type="text" name="dsp_pluginOpt[<?php echo $popt['Name'] ?>]" id="dsp_pluginOpt[<?php echo $popt['Name']; ?>]" value="<?php echo $popt['Value']; ?>" <?php if (!isEnabled($popt['Name'])) echo 'disabled="disabled"'; ?> onchange="applyChanges();"> <input type="text" name="dsp_pluginOpt[<?php echo $key; ?>]" id="dsp_pluginOpt[<?php echo $key; ?>]" value="<?php echo $popt['Value']; ?>" <?php if (!isEnabled($key)) echo 'disabled="disabled"'; ?> onchange="applyChanges();">
<input type="hidden" name="pluginOpt[<?php echo $popt['Name'] ?>]" id="pluginOpt[<?php echo $popt['Name']; ?>]" value="<?php echo $popt['Value']; ?>" /> <input type="hidden" name="pluginOpt[<?php echo $key; ?>]" id="pluginOpt[<?php echo $key; ?>]" value="<?php echo $popt['Value']; ?>" />
</td> </td>
<?php <?php
break; break;
case "integer": case "integer":
?> ?>
<td> <td>
<input type="text" name="dsp_pluginOpt[<?php echo $popt['Name'] ?>]" id="dsp_pluginOpt[<?php echo $popt['Name']; ?>]" onchange="limitRange( this, <?php echo $popt['Min'] ?>, <?php echo $popt['Max']; ?> ); applyChanges();" value="<?php echo $popt['Value']; ?>" size="4" <?php if (!isEnabled($popt['Name'])) echo 'disabled="disabled"'; ?>> <input type="text" name="dsp_pluginOpt[<?php echo $key; ?>]" id="dsp_pluginOpt[<?php echo $key; ?>]" onchange="limitRange( this, <?php echo $popt['Min'] ?>, <?php echo $popt['Max']; ?> ); applyChanges();" value="<?php echo $popt['Value']; ?>" size="4" <?php if (!isEnabled($key)) echo 'disabled="disabled"'; ?>>
<input type="hidden" name="pluginOpt[<?php echo $popt['Name'] ?>]" id="pluginOpt[<?php echo $popt['Name']; ?>]" value="<?php echo $popt['Value']; ?>" /> <input type="hidden" name="pluginOpt[<?php echo $key; ?>]" id="pluginOpt[<?php echo $key; ?>]" value="<?php echo $popt['Value']; ?>" />
</td> </td>
<?php <?php
break; break;
@ -321,14 +321,14 @@ foreach($pOptions as $name => $popt)
<td style="padding:0px;"><table class="listSetting"> <td style="padding:0px;"><table class="listSetting">
<tr> <tr>
<td> <td>
<input type="text" name="dsp_input_pluginOpt[<?php echo $popt['Name'] ?>]" id="dsp_input_pluginOpt[<?php echo $popt['Name']; ?>]" <?php if (!isEnabled($popt['Name'])) echo 'disabled="disabled"'; ?> onkeyup="updateAddBtn('<?php echo $popt['Name'] ?>');" /> <input type="text" name="dsp_input_pluginOpt[<?php echo $key; ?>]" id="dsp_input_pluginOpt[<?php echo $key; ?>]" <?php if (!isEnabled($key)) echo 'disabled="disabled"'; ?> onkeyup="updateAddBtn('<?php echo $key; ?>');" />
</td> </td>
<td> <td>
<input type="button" name="addBtn[<?php echo $popt['Name'] ?>]" id="addBtn[<?php echo $popt['Name'] ?>]" value="<?php echo $SLANG['Add'] ?>" onclick="addOption('<?php echo $popt['Name'] ?>');" disabled="disabled" /> <input type="button" name="addBtn[<?php echo $key; ?>]" id="addBtn[<?php echo $key; ?>]" value="<?php echo $SLANG['Add'] ?>" onclick="addOption('<?php echo $key; ?>');" disabled="disabled" />
</td> </td>
</tr><tr> </tr><tr>
<td> <td>
<select multiple="multiple" name="dsp_pluginOpt[<?php echo $popt['Name'] ?>]" id="dsp_pluginOpt[<?php echo $popt['Name']; ?>]" <?php if (!isEnabled($popt['Name'])) echo 'disabled="disabled"'; ?>> <select multiple="multiple" name="dsp_pluginOpt[<?php echo $key; ?>]" id="dsp_pluginOpt[<?php echo $key; ?>]" <?php if (!isEnabled($key)) echo 'disabled="disabled"'; ?>>
<?php <?php
foreach($pvalues as $pvalue) { foreach($pvalues as $pvalue) {
if(!empty($pvalue)) { if(!empty($pvalue)) {
@ -340,10 +340,10 @@ foreach($pOptions as $name => $popt)
} }
?> ?>
</select> </select>
<input type="hidden" name="pluginOpt[<?php echo $popt['Name'] ?>]" id="pluginOpt[<?php echo $popt['Name']; ?>]" value="<?php echo $popt['Value']; ?>" /> <input type="hidden" name="pluginOpt[<?php echo $key; ?>]" id="pluginOpt[<?php echo $key; ?>]" value="<?php echo $popt['Value']; ?>" />
</td> </td>
<td> <td>
<input type="button" name="removeBtn[<?php echo $popt['Name'] ?>]" id="removeBtn[<?php echo $popt['Name'] ?>]" value="<?php echo $SLANG['Remove'] ?>" onclick="removeOptionSelected('<?php echo $popt['Name'] ?>');" <?php if ($nbopt == 0) echo 'disabled="disabled"'; ?> /> <input type="button" name="removeBtn[<?php echo $key; ?>]" id="removeBtn[<?php echo $key; ?>]" value="<?php echo $SLANG['Remove'] ?>" onclick="removeOptionSelected('<?php echo $key; ?>');" <?php if ($nbopt == 0) echo 'disabled="disabled"'; ?> />
</td> </td>
</tr> </tr>
</table></td> </table></td>