- <?php
- /** Beállítások változtatása
- *
- * Itt lehet változtatni a variables tábla tartalmát.
- *
- * @package koliportal
- */
-
-
-
- $yesno = array("yes" => "yes", "no" => "no");
- if (isset($_POST["edit_config"]) && ("edit_config" == $_POST["edit_config"]))
- {
- if (isset($_POST["login_allowed"]) && isset($yesno[$_POST["login_allowed"]]))
- {
- variable_set("login_allowed", $_POST["login_allowed"]);
- }
- if (isset($_POST["edit_wishes_allowed"]) && isset($yesno[$_POST["edit_wishes_allowed"]]))
- {
- variable_set("edit_wishes_allowed", $_POST["edit_wishes_allowed"]);
- }
- }
-
-
- /** Egy változó beállátásához szükséges xhtml elemek kiírása
- *
- * @param string $vname a változó neve
- * @param string $page_action A form elküldéséhez az action GET változó értéke
- */
-
- function config_variable_yesno($vname, $page_action)
- {
-
- $value = variable_get($vname);
- $info = variable_info_get($vname);
-
- if ((false === $value) || (false === $info))
- {
- return false;
- }
-
- $select_fields = '';
- foreach (array("yes" => "igen", "no" => "nem") as $a => $n)
- {
- $select_fields .= sprintf('<option value="%s"%s>%s</option>%s',
- $a, is_selected($value == $a), $n, "\n");
-
- }
-
- ?>
- <tr>
- <td><?= $vname ?></td>
- <td><?= $info["tname"] ?>,<br />
- <?= $info["description"] ?></td>
- </td>
-
- <form action="<?= $_SERVER["PHP_SELF"] ?>?action=<?= $page_action ?>" method="post">
- <input type="hidden" name="edit_config" value="edit_config">
-
- <td>
- <select name="<?= $vname ?>">
- <?= $select_fields ?>
- </select>
- </td>
- <td>
- <input type="submit" value="Módosít">
- </td>
-
- </form>
-
- </tr>
- <?php
-
- }
-
- ?>
- <table border="1" alt="beállítások">
- <tr>
- <th>azonosító</th>
- <th>Változó neve, leírása</th>
- <th>Értéke</th>
- <th>funkciók</th>
- <tr>
-
-
- <?php
- config_variable_yesno("login_allowed", $action);
- config_variable_yesno("edit_wishes_allowed", $action);
-
- ?>
-
- </table>