<?php
$npage='';
$page_=file($userpath.$editfile.'.wml');
unset($page); array($page);
for ($i=0;$i<sizeof($page_);$i++) if (trim($page_[$i])!='') $page[]=trim($page_[$i])."\n";
$page[sizeof($page)-1]='</p></card></wml>';
for ($i=0;$i<sizeof($page);$i++)
{
if (substr(trim($page[$i]),0,12)=='<!-- cnt -->') {$page[$i]='<!-- delete -->';}
if (($editfile=='index')&&(trim($page[$i])=='</p></card></wml>')) $npage.='<!-- cnt --><br/><a href="http://top.kmx.ru/'.$user.'"><img src="http://cnt.kmx.ru/'.$user.'" alt="TOP-KMX.Ru"/></a>'."\n".trim($page[$i])."\n";
elseif (trim($page[$i])!='<!-- delete -->') $npage.=trim($page[$i])."\n";
}
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $npage);
fclose ($fp);
$page=file($userpath.$editfile.'.wml');
$page[0]='<?xml version="1.0" encoding="Utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.xml"><wml><head><meta forua="true" http-equiv="Cache-Control" content="max-age=0,proxy-revalidate,must-revalidate"/></head>'."\n";
$variables='';
for ($j=0;$j<sizeof($page);$j++)
{
$page[$j]=trim($page[$j])."\n";
$stra=explode(' ',$page[$j]);
if ($stra[0]=='<input')
{
$stra=explode('name="',$page[$j]);
$stra=explode('"',$stra[1]);
$var_=$stra[0];
$variables.='<postfield name="'.$var_.'" value="$('.$var_.')"/>';
}
elseif ($stra[0]=='<!--var')
{
$stra=explode('|',$page[$j]);
$variables.='<postfield name="'.$stra[1].'" value="'.$stra[2].'"/>';
}
}
$head2.=$head.$meta_nostore.cyr2utf('<card id="main" title="Изменить">'.
'<do name="m" type="options" label="Страница"><go href="?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/"/></do><p>'.
'<b>'.$editfile.'.wml</b>');
if (strpos(strtolower($HTTP_POST_VARS['url']),'cnt.kmx.ru/')||
strpos(strtolower($HTTP_POST_VARS['url1']),'cnt.kmx.ru/')||
strpos(strtolower($HTTP_POST_VARS['url2']),'cnt.kmx.ru/'))
die($head.cyr2utf('<card id="main" title="Вставить">'.
'<do name="m" type="options" label="Страница"><go href="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/"/></do><p>'.
'<b>Недоспустимый URL!</b>'.
'<br/><anchor>Назад<prev/></anchor><br/>'.
'</p></card></wml>'));
if ($HTTP_POST_VARS['autobr']=='yes') $autobr="<br/>"; else $autobr='';
$j=$i=$param1;
$str=$code=trim($page[$i]);
if (strpos(' '.$str,'<i>')) $atr.='i;';
if (strpos(' '.$str,'<u>')) $atr.='u;';
if (strpos(' '.$str,'<b>')) $atr.='b';
if (strpos(' '.$str,'<big>')) $size='big';
elseif (strpos(' '.$str,'<small>')) $size='small';
else $size='normal';
$str=str_replace('<i>','',$str);$str=str_replace('</i>','',$str);
$str=str_replace('<u>','',$str);$str=str_replace('</u>','',$str);
$str=str_replace('<b>','',$str);$str=str_replace('</b>','',$str);
$str=str_replace('<big>','',$str);$str=str_replace('</big>','',$str);
$str=str_replace('<small>','',$str);$str=str_replace('</small>','',$str);
$stra=explode(' ',$str);
if (substr($str,-5)=='<br/>') {$flagbr='yes';$str=substr($str,0,-5);} else $flagbr='';
switch ($stra[0])
{
case '<card':
if (trim($HTTP_POST_VARS['caption'])!='')
{
$caption=obrab($HTTP_POST_VARS['caption']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
if ((substr(strtolower(trim($HTTP_POST_VARS['url'])),0,strlen('http://'.$user.'.kmx.ru'))!='http://'.$user.'.kmx.ru')&&
(trim($HTTP_POST_VARS['url'])!=''))
die($head.cyr2utf('<card id="main" title="Переадресация">'.
'<do name="m" type="options" label="Страница"><go href="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/"/></do><p>'.
'<b>Переадресовать можно только на страницы текущего сайта!</b><br/>'.
'<small>(URL должен начинаться на <u> http://'.$user.'.kmx.ru </u> или быть пустым)</small>'.
'<br/><anchor>Назад<prev/></anchor><br/>'.
'</p></card></wml>'));
if (($HTTP_POST_VARS['url']!='')&&(($HTTP_POST_VARS['timer']+0)>0)) $redirect=' ontimer="'.trim(obrab($HTTP_POST_VARS['url'])).'"><timer value="'.($HTTP_POST_VARS['timer']+0).'"/>'; else $redirect='>';
$page[$i]='<card id="card0" title="'.$caption.'"'.$redirect.'<do name="back" type="options" label="Назад"><prev/></do>'."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('title="',$str);
$stra=explode('"',$stra[1]);
$title=$stra[0];
$stra=explode('ontimer="',$str);
$stra=explode('"',$stra[1]);
$url=$stra[0];
$stra=explode('value="',$str);
$stra=explode('"',$stra[1]);
$second=$stra[0];
print $head2.
cyr2utf('<br/><u>Заголовок</u>:<br/>'.
'<input name="caption'.$nocache.'" type="text" title="Заголовок" value="').$title.cyr2utf('" maxlength="16"/>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/>URL для переадресации (если не нужна, оставьте пустым):'.
'<br/><input name="url'.$nocache.'" type="text" emptyok="true" title="URL-redirect" value="').$url.cyr2utf('" maxlength="64"/>'.
'<br/>Переадресовать через (в 0.1 сек):'.
'<br/><input name="timer'.$nocache.'" type="text" emptyok="true" title="Time-redirect" value="').$second.cyr2utf('" maxlength="4"/>'.
'<br/><anchor>Переписать'.
'<go href="/" method="post">'.
'<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit"/>'.
'<postfield name="caption" value="$(caption'.$nocache.')"/>'.
'<postfield name="url" value="$(url'.$nocache.')"/>'.
'<postfield name="timer" value="$(timer'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
case '<do':
if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url']!=''))
{
$caption=obrab($HTTP_POST_VARS['caption']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
$random=rand(1000,9999);
$page[$i]='<do name="sk'.$random.'" type="options" label="'.$caption.'"><go href="'.obrab($HTTP_POST_VARS['url']).'"/></do>'."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('label="',$str);
$stra=explode('"',$stra[1]);
$caption=$stra[0];
$stra=explode('href="',$str);
$stra=explode('"',$stra[1]);
$link_=$stra[0];
print $head2.
cyr2utf('<br/><u>Soft-кнопка</u>:'.
'<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$link_.cyr2utf('" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="32"/>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="caption" value="$(caption'.$nocache.')"/>'.
'<postfield name="url" value="$(url'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
case '<br/>':
$param2=$param3='';
include($buildpath.'element.php');
exit;
break;
case '<p':
case '</p><p':
if (($HTTP_POST_VARS['align']=='left')||($HTTP_POST_VARS['align']=='center')||($HTTP_POST_VARS['align']=='right'))
{
if (($HTTP_POST_VARS['wrap']=='nowrap')) $wrapmode=' mode="nowrap"';
if (($HTTP_POST_VARS['wrap']=='wrap')) $wrapmode=' mode="wrap"';
if (($HTTP_POST_VARS['wrap']=='null')) $wrapmode='';
$page[$i]=$stra[0].' align="'.$HTTP_POST_VARS['align'].'"'.$wrapmode.">\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('align="',$str);
$stra=explode('"',$stra[1]);
$algn=$stra[0];
$stra=explode('mode="',$str);
$stra=explode('"',$stra[1]);
$wrp=$stra[0];
if ($algn=='center') $align='center';
elseif ($algn=='right') $align='right';
else $align='left';
if ($wrp=='nowrap') $wrap='nowrap';
elseif ($wrp=='wrap') $wrap='wrap';
else $wrap='null';
print $head2.
cyr2utf('<br/><u>Выравнивать</u>:'.
'<br/><select name="align'.$nocache.'" value="'.$align.'"><option value="left">влево</option><option value="center">по центру</option><option value="right">вправо</option></select>'.
'<br/>Строки:'.
'<br/><select name="wrap'.$nocache.'" value="'.$wrap.'"><option value="wrap">разрывные</option><option value="nowrap">неразрывные</option><option value="null">по умолчанию</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="align" value="$(align'.$nocache.')"/>'.
'<postfield name="wrap" value="$(wrap'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
break;
case '<a':
$stra=explode('">',$str);
$strb=explode(' ',$stra[1]);
if ($strb[0]=='<img')
{
if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url1']!='')&&($HTTP_POST_VARS['url2']!=''))
{
$caption=obrab($HTTP_POST_VARS['caption']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
$page[$i]='<a href="'.obrab($HTTP_POST_VARS['url1']).'"><img src="'.obrab($HTTP_POST_VARS['url2']).'" alt="'.$caption."\"/></a>".$autobr."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('href="',$str);
$stra=explode('"',$stra[1]);
$link_=$stra[0];
$stra=explode('<img src="',$str);
$stra=explode('"',$stra[1]);
$imgurl=$stra[0];
$stra=explode(' alt="',$str);
$stra=explode('"',$stra[1]);
$alttext=$stra[0];
print $head2.
cyr2utf('<br/><u>Баннер</u>:'.
'<br/>URL ссылки:<input name="url1'.$nocache.'" type="text" title="URL ссылки" value="').$link_.cyr2utf('" maxlength="128"/>'.
'<br/>URL рисунка:<input name="url2'.$nocache.'" type="text" title="URL рисунка" value="').$imgurl.cyr2utf('" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$alttext.cyr2utf('" maxlength="32"/>'.
'<br/><select name="autobr'.$nocache.'" multiple="true" value="').$flagbr.cyr2utf('"><option value="yes">Автоперенос</option></select>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="caption" value="$(caption'.$nocache.')"/>'.
'<postfield name="url1" value="$(url1'.$nocache.')"/>'.
'<postfield name="url2" value="$(url2'.$nocache.')"/>'.
'<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
}
else
{
if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url']!=''))
{
$caption=obrab($HTTP_POST_VARS['caption']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
$page[$i]='<a href="'.obrab($HTTP_POST_VARS['url']).'">'.$caption."</a>";
if (strpos(' '.$HTTP_POST_VARS['atrib'],'i')) $page[$i]='<i>'.$page[$i].'</i>';
if (strpos(' '.$HTTP_POST_VARS['atrib'],'u')) $page[$i]='<u>'.$page[$i].'</u>';
if (strpos(' '.$HTTP_POST_VARS['atrib'],'b')) $page[$i]='<b>'.$page[$i].'</b>';
if (strpos(' '.$HTTP_POST_VARS['size'],'big')) $page[$i]='<big>'.$page[$i].'</big>';
if (strpos(' '.$HTTP_POST_VARS['size'],'small')) $page[$i]='<small>'.$page[$i].'</small>';
$page[$i].=$autobr."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('href="',$str);
$stra=explode('"',$stra[1]);
$link_=$stra[0];
$stra=explode('">',$str);
$stra=explode('</a>',$stra[1]);
$caption=$stra[0];
print $head2.
cyr2utf('<br/><u>Ссылка</u>:'.
'<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$link_.cyr2utf('" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="32"/>'.
'<br/>Атрибуты: '.
'<br/><select name="atrib'.$nocache.'" multiple="true" value="'.$atr.'"><option value="b">полужирный</option><option value="u">подчеркнутый</option><option value="i">наклонный</option></select>'.
'<br/>Размер: '.
'<br/><select name="size'.$nocache.'" value="'.$size.'"><option value="small">мелкий</option><option value="normal">нормальный</option><option value="big">крупный</option></select>'.
'<br/><select name="autobr'.$nocache.'" multiple="true" value="').$flagbr.cyr2utf('"><option value="yes">Автоперенос</option></select>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="caption" value="$(caption'.$nocache.')"/>'.
'<postfield name="url" value="$(url'.$nocache.')"/>'.
'<postfield name="atrib" value="$(atrib'.$nocache.')"/>'.
'<postfield name="size" value="$(size'.$nocache.')"/>'.
'<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
}
break;
case '<img':
if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url']!=''))
{
$caption=obrab($HTTP_POST_VARS['caption']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
$page[$i]='<img src="'.obrab($HTTP_POST_VARS['url']).'" alt="'.$caption.'"/>'.$autobr."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('src="',$str);
$stra=explode('"',$stra[1]);
$imgurl=$stra[0];
$stra=explode('alt="',$str);
$stra=explode('"',$stra[1]);
$caption=$stra[0];
print $head2.
cyr2utf('<br/><u>Рисунок</u>:'.
'<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$imgurl.cyr2utf('" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="64"/>'.
'<br/><select name="autobr'.$nocache.'" multiple="true" value="').$flagbr.cyr2utf('"><option value="yes">Автоперенос</option></select>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="caption" value="$(caption'.$nocache.')"/>'.
'<postfield name="url" value="$(url'.$nocache.')"/>'.
'<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
case '<input':
if ($HTTP_POST_VARS['var']!='')
{
$caption=obrab($HTTP_POST_VARS['caption']);
$var_=obrab($HTTP_POST_VARS['var']);
$def=obrab($HTTP_POST_VARS['def']);
$size=obrab($HTTP_POST_VARS['size'])+0;
if ($size<1) $size='999';
if ($HTTP_POST_VARS['tr2cyr']=='yes')
{
$caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
$def=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['def']))));
}
if ($HTTP_POST_VARS['type']!='password') $type='text'; else $type='password';
$page[$i]='<input name="'.$var_.'" type="'.$type.'" emptyok="true" title="'.$caption.'" maxlength="'.$size.'" value="'.$def.'"/>'.$autobr."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('name="',$str);
$stra=explode('"',$stra[1]);
$var_=$stra[0];
$stra=explode('maxlength="',$str);
$stra=explode('"',$stra[1]);
$size=$stra[0];
$stra=explode('value="',$str);
$stra=explode('"',$stra[1]);
$def=$stra[0];
$stra=explode('title="',$str);
$stra=explode('"',$stra[1]);
$caption=$stra[0];
$stra=explode('type="',$str);
$stra=explode('"',$stra[1]);
$type=$stra[0];
print $head2.
cyr2utf('<br/><u>Поле ввода</u>:'.
'<br/>Переменная:<input name="var'.$nocache.'" type="text" title="Переменная" value="').$var_.cyr2utf('" maxlength="16"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="16"/>'.
'<br/>Размер:<input name="size'.$nocache.'" type="text" title="Размер" value="').$size.cyr2utf('" maxlength="3"/>'.
'<br/>Значение:<input name="def'.$nocache.'" type="text" title="По умолчанию" value="').$def.cyr2utf('" maxlength="32"/>'.
'<br/><select name="type'.$nocache.'" value="').$type.cyr2utf('"><option value="text">Текст</option><option value="password">Пароль</option></select>'.
'<br/><select name="autobr'.$nocache.'" multiple="true" value="yes"><option value="yes">Автоперенос</option></select>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="var" value="$(var'.$nocache.')"/>'.
'<postfield name="caption" value="$(caption'.$nocache.')"/>'.
'<postfield name="size" value="$(size'.$nocache.')"/>'.
'<postfield name="def" value="$(def'.$nocache.')"/>'.
'<postfield name="type" value="$(type'.$nocache.')"/>'.
'<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
case '<anchor':
if (($HTTP_POST_VARS['url']!='')&&($HTTP_POST_VARS['caption']!=''))
{
$caption=obrab($HTTP_POST_VARS['caption']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
$url=obrab($HTTP_POST_VARS['url']);
if ($HTTP_POST_VARS['method']!='get') $method='post'; else $method='get';
$page[$i]='<anchor >'.$caption.'<go href="'.$url.'" method="'.$method.'">'.$variables.'</go></anchor>'.$autobr."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('href="',$str);
$stra=explode('"',$stra[1]);
$url=$stra[0];
$stra=explode('<anchor >',$str);
$stra=explode('<',$stra[1]);
$caption=$stra[0];
$stra=explode('method="',$str);
$stra=explode('"',$stra[1]);
$method=$stra[0];
print $head2.
cyr2utf('<br/><u>Ссылка+</u>:'.
'<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$url.cyr2utf('" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="32"/>'.
'<br/>Метод: '.
'<br/><select name="method'.$nocache.'" value="').$method.cyr2utf('"><option value="get">GET</option><option value="post">POST</option></select>'.
'<br/><select name="autobr'.$nocache.'" multiple="true" value="yes"><option value="yes">Автоперенос</option></select>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="url" value="$(url'.$nocache.')"/>'.
'<postfield name="caption" value="$(caption'.$nocache.')"/>'.
'<postfield name="method" value="$(method'.$nocache.')"/>'.
'<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
case '<!--var':
if (($HTTP_POST_VARS['name']!='')&&($HTTP_POST_VARS['value']!=''))
{
$value=obrab($HTTP_POST_VARS['value']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $value=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['value']))));
$page[$i]='<!--var |'.obrab($HTTP_POST_VARS['name']).'|'.$value."|-->\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$stra=explode('|',$str);
print $head2.
cyr2utf('<br/><u>Переменная</u>:'.
'<br/>Переменная:<input name="name'.$nocache.'" type="text" title="Переменная" value="'.$stra[1].'" maxlength="16"/>'.
'<br/>Значение:<input name="value'.$nocache.'" type="text" title="Значение" value="'.$stra[2].'" maxlength="128"/>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit/var" method="post">'.
'<postfield name="name" value="$(name'.$nocache.')"/>'.
'<postfield name="value" value="$(value'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
case '<!--r':
if ($HTTP_POST_VARS['code']!='')
{
$code=str_replace("\n",' ',str_replace("\r",' ',stripslashes($HTTP_POST_VARS['code'])));
$page[$i]='<!--r -->'.$code."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
$str=substr($str,9);
print $head2.
cyr2utf('<br/><u>WML-код</u>:'.
'<br/><input name="code'.$nocache.'" type="text" title="WML-код" value="').str_replace('$','$$',htmlspecialchars($str)).cyr2utf('" maxlength="512"/>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit/code" method="post">'.
'<postfield name="code" value="$(code'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
default :
if ($HTTP_POST_VARS['text']!='')
{
$page[$i]=obrab($HTTP_POST_VARS['text']);
if ($HTTP_POST_VARS['tr2cyr']=='yes') $page[$i]=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['text']))));
if (strpos(' '.$HTTP_POST_VARS['atrib'],'i')) $page[$i]='<i>'.$page[$i].'</i>';
if (strpos(' '.$HTTP_POST_VARS['atrib'],'u')) $page[$i]='<u>'.$page[$i].'</u>';
if (strpos(' '.$HTTP_POST_VARS['atrib'],'b')) $page[$i]='<b>'.$page[$i].'</b>';
if (strpos(' '.$HTTP_POST_VARS['size'],'big')) $page[$i]='<big>'.$page[$i].'</big>';
if (strpos(' '.$HTTP_POST_VARS['size'],'small')) $page[$i]='<small>'.$page[$i].'</small>';
$page[$i].=$autobr."\n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
}
print $head2.
cyr2utf('<br/><u>Текст</u>:'.
'<br/><input name="text'.$nocache.'" type="text" title="Текст" value="').$str.cyr2utf('" maxlength="2048"/>'.
'<br/>Атрибуты: '.
'<br/><select name="atrib'.$nocache.'" multiple="true" value="'.$atr.'"><option value="b">полужирный</option><option value="u">подчеркнутый</option><option value="i">наклонный</option></select>'.
'<br/>Размер: '.
'<br/><select name="size'.$nocache.'" value="'.$size.'"><option value="small">мелкий</option><option value="normal">нормальный</option><option value="big">крупный</option></select>'.
'<br/><select name="autobr'.$nocache.'" multiple="true" value="'.$flagbr.'"><option value="yes">Автоперенос</option></select>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Переписать'.
'<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
'<postfield name="text" value="$(text'.$nocache.')"/>'.
'<postfield name="atrib" value="$(atrib'.$nocache.')"/>'.
'<postfield name="size" value="$(size'.$nocache.')"/>'.
'<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
'<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
}
print cyr2utf('<br/><a href="?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'">Отмена</a><br/>');
print '</p></card></wml>';
exit;
?>