Файл: includes/wap/builder/overwrite2.php
Строк: 431
<?php
$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.$meta_nostore.cyr2utf('<card id="main" title="Вставить">'.
'<do name="m" type="options" label="Страница"><go href="?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/"/></do><p>'.
'<b>Недоспустимый URL!</b>'.
'<br/><anchor>Назад<prev/></anchor><br/>'.
'</p></card></wml>'));
$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].'"/>';
}
}
$str=trim($page[$i]);
$stra=explode(' ',$str);
switch ($stra[0])
{
case '<card':
case '<p':
case '<!--':
$param2=$param3='';
include($buildpath.'element.php');
exit;
break;
}
if ($HTTP_POST_VARS['autobr']=='yes') $autobr="<br/>"; else $autobr='';
switch ($param3)
{
case 'break':
$page[$i]="<br/>n";
$page=implode("",$page);
$fp = fopen ($userpath.$editfile.'.wml', "w+");
fwrite ($fp, $page);
fclose ($fp);
$param1=$param2=$param3='';
include($buildpath.'structure.php');
exit;
case 'align':
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]='</p><p 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;
}
print $head2.
cyr2utf('<br/><u>Выравнивать</u>:'.
'<br/><select name="align'.$nocache.'" value="center"><option value="left">влево</option><option value="center">по центру</option><option value="right">вправо</option></select>'.
'<br/>Строки:'.
'<br/><select name="wrap'.$nocache.'" value="null"><option value="wrap">разрывные</option><option value="nowrap">неразрывные</option><option value="null">по умолчанию</option></select>'.
'<br/><anchor>Заменить'.
'<go href="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/align" method="post">'.
'<postfield name="align" value="$(align'.$nocache.')"/>'.
'<postfield name="wrap" value="$(wrap'.$nocache.')"/>'.
'</go>'.
'</anchor>');
break;
break;
case 'banner':
if ($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']))));
$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;
}
print $head2.
cyr2utf('<br/><u>Баннер</u>:'.
'<br/>URL ссылки:<input name="url1'.$nocache.'" type="text" title="URL ссылки" value="http://" maxlength="128"/>'.
'<br/>URL рисунка:<input name="url2'.$nocache.'" type="text" title="URL рисунка" value="http://" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="" maxlength="32"/>'.
'<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="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/banner" 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>');
break;
case 'link':
if ($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']))));
$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;
}
print $head2.
cyr2utf('<br/><u>Ссылка</u>:'.
'<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="http://" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="" maxlength="64"/>'.
'<br/>Атрибуты: '.
'<br/><select name="atrib'.$nocache.'" multiple="true" value=""><option value="b">полужирный</option><option value="u">подчеркнутый</option><option value="i">наклонный</option></select>'.
'<br/>Размер: '.
'<br/><select name="size'.$nocache.'" value="normal"><option value="small">мелкий</option><option value="normal">нормальный</option><option value="big">крупный</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="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/link" 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 'image':
if ($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']))));
$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;
}
print $head2.
cyr2utf('<br/><u>Рисунок</u>:'.
'<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="http://" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="" maxlength="32"/>'.
'<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="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/image" 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;
}
print $head2.
cyr2utf('<br/><u>Поле ввода</u>:'.
'<br/>Переменная:<input name="var'.$nocache.'" type="text" title="Переменная" value="" maxlength="16"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="" maxlength="16"/>'.
'<br/>Размер:<input name="size'.$nocache.'" type="text" title="Размер" value="999" maxlength="3"/>'.
'<br/>Значение:<input name="def'.$nocache.'" type="text" title="По умолчанию" value="" maxlength="32"/>'.
'<br/><select name="type'.$nocache.'" value="text"><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="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/input" 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;
}
print $head2.
cyr2utf('<br/><u>Ссылка+</u>:'.
'<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="http://" maxlength="128"/>'.
'<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="" maxlength="32"/>'.
'<br/>Метод: '.
'<br/><select name="method'.$nocache.'" value="get"><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="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/anchor" 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;
}
print $head2.
cyr2utf('<br/><u>Переменная</u>:'.
'<br/>Переменная:<input name="name'.$nocache.'" type="text" title="Переменная" value="" maxlength="16"/>'.
'<br/>Значение:<input name="value'.$nocache.'" type="text" title="Значение" value="" maxlength="128"/>'.
'<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
'<br/><anchor>Заменить'.
'<go href="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/var" method="post">'.
'<postfield name="name'.$nocache.'" value="$(name)"/>'.
'<postfield name="value'.$nocache.'" value="$(value)"/>'.
'<postfield name="tr2cyr'.$nocache.'" value="$(tr2cyr)"/>'.
'</go>'.
'</anchor>');
break;
case 'code':
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;
}
print $head2.
cyr2utf('<br/><u>WML-код</u>:'.
'<br/><input name="code'.$nocache.'" type="text" title="WML-код" value="" maxlength="512"/>'.
'<br/><anchor>Заменить'.
'<go href="http://wap.kmx.ru" method="post">'.
'<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/code"/>'.
'<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;
}
$atr='';
print $head2.
cyr2utf('<br/><u>Текст</u>:'.
'<br/><input name="text'.$nocache.'" type="text" title="Текст" value="" maxlength="2048"/>'.
'<br/>Атрибуты: '.
'<br/><select name="atrib'.$nocache.'" multiple="true" value=""><option value="b">полужирный</option><option value="u">подчеркнутый</option><option value="i">наклонный</option></select>'.
'<br/>Размер: '.
'<br/><select name="size'.$nocache.'" value="normal"><option value="small">мелкий</option><option value="normal">нормальный</option><option value="big">крупный</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="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite/text" 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="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/overwrite">Отмена</a><br/>'.
'</p></card></wml>');
exit;
?>