- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
<?php
/* Подключаемые файлы */
require_once('data/config.test.php');
 
/**
* Сохранение настроек модуля
*/
if ($action == "dosave") {
    $find[]     = "'\r'";
    $replace[]  = "";
    $find[]     = "'\n'";
    $replace[]  = "";
 
if ($member_db[1] != 1) {
    msg ("error", $lang['opt_denied'], $lang['opt_denied']);
}
$handler = @fopen('data/config.test.php', "wb");
fwrite ($handler, "<?php \n\n//Test configurations
                         \n\n\$config_test = array(
                         \n\n'version' => \"v.1.0\",\n\n");
 
foreach ($save_con as $name => $value) {    
    $value = trim(stripslashes ($value));
    $value = htmlspecialchars  ($value, ENT_QUOTES);
    $value = preg_replace($find, $replace, $value);
    fwrite($handler, "'{$name}' => \"{$value}\",\n\n");
}
    
fwrite($handler, ");\n\n?>");
fclose($handler);
 
msg ("info", "Строка изменена",
     "{$lang['opt_sysok_1']}<br /><br />
      <a href=\"{$PHP_SELF}?mod=test_adm\">{$lang['db_prev']}</a>");
}
echo"Шапка";
echo<<<HTML
<form action="" method="POST">
<table width="100%">
  <tr>
    <td class="option" style="padding:4px;">
      <b> Текст выводимой строки: </b><br />
      <span class="small"> например: Hello world </span>
    <td align="middle" width="400">
      <input class="edit" style="text-align:center" size="40" value="{$config_test['text']}" name="save_con[text]"></td>
  </tr>
  
  <tr>
    <td class="option" style="padding:4px;">
       <b> Комментарий к тексту: </b><br />
       <span class="small"> например: Это ваш первый пример модуля с админпанелью </span>
    <td align="middle" width="400">
       <input class="edit" style="text-align:center" size="40" value="{$config_test['detail']}" name="save_con[detail]"></td>
  </tr>
  <tr>
    <td class="option" style="padding-bottom:10px; padding-top:10px; padding-left:10px;" colspan="2">
      <input class="buttons" type="hidden" name="action" value="dosave" />
      <input class="buttons" type="submit" name="do" value=" Сохранить " /></td>
  </tr>
  
</table>
</form>
HTML;
echo"Подвал";
?>
                                 
        
Что за магическая строка?