Просмотр файла includes/wap/builder/insert2.php

Размер файла: 23.51Kb
<?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].'"/>';
	    }
	}

if ($HTTP_POST_VARS['cacheop']!='') $nocache=$HTTP_POST_VARS['cacheop']+0;
$fp = @fopen ($userpath."opeation.cache", "r");$testcache = trim(@fgets($fp, 10));@fclose ($fp);
if ($nocache==$testcache)
	{
	$param1=$param2=$param3='';
	include($buildpath.'structure.php');
	exit;
	}

$str=trim($page[$i]);
$stra=explode(' ',$str);
switch ($stra[0])
    {
    case '<card':
    	if ($param3!='softkey')
	        {
	        $param2=$param3='';
	        include($buildpath.'element.php');
	        exit;
	        }
		break;
    case '<!--':
        $param2=$param3='';
        include($buildpath.'element.php');
        exit;
    case '<p':
        $i++;
        break;
    }

$page[$i]=trim($page[$i])."\n<!-- insert -->\n";
$page=implode("",$page);

if ($HTTP_POST_VARS['autobr']=='yes') $autobr="<br/>"; else $autobr='';

switch ($param3)
    {
    case 'softkey':
        if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url1']!=''))
            {
            $random='';
			for ($i=0;$i<4;$i++) $random .= round(('0.'.substr(mt_rand(),1))*9+0.5);
			$caption=obrab($HTTP_POST_VARS['caption']);
			if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
	        $page=str_replace("<!-- insert -->",'<do name="sk'.$random.'" type="options" label="'.$caption.'"><go href="'.obrab($HTTP_POST_VARS['url1']).'"/></do>',$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            include($buildpath.'structure.php');
            exit;
            }
        print $head2.
		cyr2utf('<br/><u>Soft-кнопка</u>:'.
        '<br/>URL:<input name="url1'.$nocache.'" type="text" title="URL" value="http://" maxlength="128"/>'.
        '<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="" maxlength="32"/>'.
        '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
        '<br/><anchor>Вставить'.
        '<go href="http://wap.kmx.ru" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/softkey"/>'.
        '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
        '<postfield name="url1" value="$(url1'.$nocache.')"/>'.
        '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
        '<postfield name="cacheop" value="'.$nocache.'"/>'.
        '</go>'.
        '</anchor>');
        break;
    case 'break':
        $page=str_replace("<!-- insert -->","<br/>",$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=str_replace("<!-- insert -->",'</p><p align="'.$HTTP_POST_VARS['align'].'"'.$wrapmode.'>',$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/align"/>'.
        '<postfield name="align" value="$(align'.$nocache.')"/>'.
        '<postfield name="wrap" value="$(wrap'.$nocache.')"/>'.
        '<postfield name="cacheop" value="'.$nocache.'"/>'.
        '</go>'.
        '</anchor>');
        break;
    case 'banner':
        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=str_replace("<!-- insert -->",'<a href="'.obrab($HTTP_POST_VARS['url1']).'"><img src="'.obrab($HTTP_POST_VARS['url2']).'" alt="'.$caption."\"/></a>".$autobr,$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/banner"/>'.
        '<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.')"/>'.
        '<postfield name="cacheop" value="'.$nocache.'"/>'.
        '</go>'.
        '</anchor>');
        break;
    case 'link':
        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']))));

			$instext='<a href="'.obrab($HTTP_POST_VARS['url']).'">'.$caption.'</a>';
	        if (strpos(' '.$HTTP_POST_VARS['atrib'],'i')) $instext='<i>'.$instext.'</i>';
	        if (strpos(' '.$HTTP_POST_VARS['atrib'],'u')) $instext='<u>'.$instext.'</u>';
	        if (strpos(' '.$HTTP_POST_VARS['atrib'],'b')) $instext='<b>'.$instext.'</b>';
	        if (strpos(' '.$HTTP_POST_VARS['size'],'big')) $instext='<big>'.$instext.'</big>';
	        if (strpos(' '.$HTTP_POST_VARS['size'],'small')) $instext='<small>'.$instext.'</small>';

	        $page=str_replace("<!-- insert -->",$instext.$autobr,$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/link"/>'.
        '<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.')"/>'.
        '<postfield name="cacheop" value="'.$nocache.'"/>'.
        '</go>'.
        '</anchor>');
        break;
    case 'image':
        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=str_replace("<!-- insert -->",'<img src="'.obrab($HTTP_POST_VARS['url']).'" alt="'.$caption."\"/>".$autobr,$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/image"/>'.
        '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
        '<postfield name="url" value="$(url'.$nocache.')"/>'.
        '<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
        '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
        '<postfield name="cacheop" value="'.$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=str_replace("<!-- insert -->",'<input name="'.$var_.'" type="'.$type.'" emptyok="true" title="'.$caption.'" maxlength="'.$size.'" value="'.$def.'"/>'.$autobr,$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/input"/>'.
        '<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.')"/>'.
        '<postfield name="cacheop" value="'.$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=str_replace("<!-- insert -->",'<anchor >'.$caption.'<go href="'.$url.'" method="'.$method.'">'.$variables.'</go></anchor>'.$autobr,$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/anchor"/>'.
        '<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.')"/>'.
        '<postfield name="cacheop" value="'.$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=str_replace("<!-- insert -->",'<!--var |'.obrab($HTTP_POST_VARS['name']).'|'.$value."|-->",$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/var"/>'.
        '<postfield name="name" value="$(name'.$nocache.')"/>'.
        '<postfield name="value" value="$(value'.$nocache.')"/>'.
        '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
        '<postfield name="cacheop" value="'.$nocache.'"/>'.
        '</go>'.
        '</anchor>');
        break;
    case 'code':
        if ($HTTP_POST_VARS['code']!='')
            {
			$code=str_replace("\n",' ',str_replace("\r",' ',stripslashes($HTTP_POST_VARS['code'])));
	        $page=str_replace("<!-- insert -->",'<!--r -->'.$code,$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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.'/insert/code"/>'.
        '<postfield name="code" value="$(code'.$nocache.')"/>'.
        '</go>'.
        '</anchor>');
        break;
    default :
        if ($HTTP_POST_VARS['text']!='')
            {
			$text=obrab($HTTP_POST_VARS['text']);
			if ($HTTP_POST_VARS['tr2cyr']=='yes') $text=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['text']))));
	        if (strpos(' '.$HTTP_POST_VARS['atrib'],'i')) $text='<i>'.$text.'</i>';
	        if (strpos(' '.$HTTP_POST_VARS['atrib'],'u')) $text='<u>'.$text.'</u>';
	        if (strpos(' '.$HTTP_POST_VARS['atrib'],'b')) $text='<b>'.$text.'</b>';
	        if (strpos(' '.$HTTP_POST_VARS['size'],'big')) $text='<big>'.$text.'</big>';
	        if (strpos(' '.$HTTP_POST_VARS['size'],'small')) $text='<small>'.$text.'</small>';
	        $page=str_replace("<!-- insert -->",$text.$autobr,$page);
            $fp = fopen ($userpath.$editfile.'.wml', "w+");
            fwrite ($fp, $page);
            fclose ($fp);
            $param1=$param2=$param3='';
			$fp = fopen ($userpath."opeation.cache", "w+");fwrite ($fp, $nocache);fclose ($fp);
            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/>Автоперенос: '.
        '<br/><select name="autobr'.$nocache.'" value="yes"><option value="yes">Включен</option><option value="no">Выключен</option></select>'.
        '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
        '<br/><anchor>Вставить'.
        '<go href="http://wap.kmx.ru" method="post">'.
        '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert/text"/>'.
        '<postfield name="text" value="$(text'.$nocache.')"/>'.
        '<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.')"/>'.
        '<postfield name="cacheop" value="'.$nocache.'"/>'.
        '</go>'.
        '</anchor>');
        break;
    }

print cyr2utf('<br/><a href="http://wap.kmx.ru?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/insert">Отмена</a><br/>');
print '</p></card></wml>';
exit;
?>