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

Размер файла: 28.18Kb
  1. <?php
  2. $npage='';
  3. $page_=file($userpath.$editfile.'.wml');
  4. unset($page); array($page);
  5. for ($i=0;$i<sizeof($page_);$i++) if (trim($page_[$i])!='') $page[]=trim($page_[$i])."\n";
  6. $page[sizeof($page)-1]='</p></card></wml>';
  7. for ($i=0;$i<sizeof($page);$i++)
  8. {
  9. if (substr(trim($page[$i]),0,12)=='<!-- cnt -->') {$page[$i]='<!-- delete -->';}
  10. 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";
  11. elseif (trim($page[$i])!='<!-- delete -->') $npage.=trim($page[$i])."\n";
  12. }
  13. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  14. fwrite ($fp, $npage);
  15. fclose ($fp);
  16. $page=file($userpath.$editfile.'.wml');
  17. $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";
  18. $variables='';
  19. for ($j=0;$j<sizeof($page);$j++)
  20. {
  21. $page[$j]=trim($page[$j])."\n";
  22. $stra=explode(' ',$page[$j]);
  23. if ($stra[0]=='<input')
  24. {
  25. $stra=explode('name="',$page[$j]);
  26. $stra=explode('"',$stra[1]);
  27. $var_=$stra[0];
  28. $variables.='<postfield name="'.$var_.'" value="$('.$var_.')"/>';
  29. }
  30. elseif ($stra[0]=='<!--var')
  31. {
  32. $stra=explode('|',$page[$j]);
  33. $variables.='<postfield name="'.$stra[1].'" value="'.$stra[2].'"/>';
  34. }
  35. }
  36.  
  37. $head2.=$head.$meta_nostore.cyr2utf('<card id="main" title="Изменить">'.
  38. '<do name="m" type="options" label="Страница"><go href="?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/"/></do><p>'.
  39. '<b>'.$editfile.'.wml</b>');
  40.  
  41. if (strpos(strtolower($HTTP_POST_VARS['url']),'cnt.kmx.ru/')||
  42. strpos(strtolower($HTTP_POST_VARS['url1']),'cnt.kmx.ru/')||
  43. strpos(strtolower($HTTP_POST_VARS['url2']),'cnt.kmx.ru/'))
  44. die($head.cyr2utf('<card id="main" title="Вставить">'.
  45. '<do name="m" type="options" label="Страница"><go href="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/"/></do><p>'.
  46. '<b>Недоспустимый URL!</b>'.
  47. '<br/><anchor>Назад<prev/></anchor><br/>'.
  48. '</p></card></wml>'));
  49.  
  50. if ($HTTP_POST_VARS['autobr']=='yes') $autobr="<br/>"; else $autobr='';
  51.  
  52. $j=$i=$param1;
  53.  
  54. $str=$code=trim($page[$i]);
  55.  
  56. if (strpos(' '.$str,'<i>')) $atr.='i;';
  57. if (strpos(' '.$str,'<u>')) $atr.='u;';
  58. if (strpos(' '.$str,'<b>')) $atr.='b';
  59. if (strpos(' '.$str,'<big>')) $size='big';
  60. elseif (strpos(' '.$str,'<small>')) $size='small';
  61. else $size='normal';
  62. $str=str_replace('<i>','',$str);$str=str_replace('</i>','',$str);
  63. $str=str_replace('<u>','',$str);$str=str_replace('</u>','',$str);
  64. $str=str_replace('<b>','',$str);$str=str_replace('</b>','',$str);
  65. $str=str_replace('<big>','',$str);$str=str_replace('</big>','',$str);
  66. $str=str_replace('<small>','',$str);$str=str_replace('</small>','',$str);
  67.  
  68. $stra=explode(' ',$str);
  69.  
  70. if (substr($str,-5)=='<br/>') {$flagbr='yes';$str=substr($str,0,-5);} else $flagbr='';
  71.  
  72. switch ($stra[0])
  73. {
  74. case '<card':
  75. if (trim($HTTP_POST_VARS['caption'])!='')
  76. {
  77. $caption=obrab($HTTP_POST_VARS['caption']);
  78. if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
  79.  
  80. if ((substr(strtolower(trim($HTTP_POST_VARS['url'])),0,strlen('http://'.$user.'.kmx.ru'))!='http://'.$user.'.kmx.ru')&&
  81. (trim($HTTP_POST_VARS['url'])!=''))
  82. die($head.cyr2utf('<card id="main" title="Переадресация">'.
  83. '<do name="m" type="options" label="Страница"><go href="http://wap.kmx.ru/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/"/></do><p>'.
  84. '<b>Переадресовать можно только на страницы текущего сайта!</b><br/>'.
  85. '<small>(URL должен начинаться на <u> http://'.$user.'.kmx.ru </u> или быть пустым)</small>'.
  86. '<br/><anchor>Назад<prev/></anchor><br/>'.
  87. '</p></card></wml>'));
  88.  
  89. 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='>';
  90. $page[$i]='<card id="card0" title="'.$caption.'"'.$redirect.'<do name="back" type="options" label="Назад"><prev/></do>'."\n";
  91. $page=implode("",$page);
  92. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  93. fwrite ($fp, $page);
  94. fclose ($fp);
  95. $param1=$param2=$param3='';
  96. include($buildpath.'structure.php');
  97. exit;
  98. }
  99. $stra=explode('title="',$str);
  100. $stra=explode('"',$stra[1]);
  101. $title=$stra[0];
  102. $stra=explode('ontimer="',$str);
  103. $stra=explode('"',$stra[1]);
  104. $url=$stra[0];
  105. $stra=explode('value="',$str);
  106. $stra=explode('"',$stra[1]);
  107. $second=$stra[0];
  108. print $head2.
  109. cyr2utf('<br/><u>Заголовок</u>:<br/>'.
  110. '<input name="caption'.$nocache.'" type="text" title="Заголовок" value="').$title.cyr2utf('" maxlength="16"/>'.
  111. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  112. '<br/>URL для переадресации (если не нужна, оставьте пустым):'.
  113. '<br/><input name="url'.$nocache.'" type="text" emptyok="true" title="URL-redirect" value="').$url.cyr2utf('" maxlength="64"/>'.
  114. '<br/>Переадресовать через (в 0.1 сек):'.
  115. '<br/><input name="timer'.$nocache.'" type="text" emptyok="true" title="Time-redirect" value="').$second.cyr2utf('" maxlength="4"/>'.
  116. '<br/><anchor>Переписать'.
  117. '<go href="/" method="post">'.
  118. '<postfield name="query" value="'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit"/>'.
  119. '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
  120. '<postfield name="url" value="$(url'.$nocache.')"/>'.
  121. '<postfield name="timer" value="$(timer'.$nocache.')"/>'.
  122. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  123. '</go>'.
  124. '</anchor>');
  125. break;
  126. case '<do':
  127. if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url']!=''))
  128. {
  129. $caption=obrab($HTTP_POST_VARS['caption']);
  130. if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
  131. $random=rand(1000,9999);
  132. $page[$i]='<do name="sk'.$random.'" type="options" label="'.$caption.'"><go href="'.obrab($HTTP_POST_VARS['url']).'"/></do>'."\n";
  133. $page=implode("",$page);
  134. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  135. fwrite ($fp, $page);
  136. fclose ($fp);
  137. $param1=$param2=$param3='';
  138. include($buildpath.'structure.php');
  139. exit;
  140. }
  141. $stra=explode('label="',$str);
  142. $stra=explode('"',$stra[1]);
  143. $caption=$stra[0];
  144. $stra=explode('href="',$str);
  145. $stra=explode('"',$stra[1]);
  146. $link_=$stra[0];
  147. print $head2.
  148. cyr2utf('<br/><u>Soft-кнопка</u>:'.
  149. '<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$link_.cyr2utf('" maxlength="128"/>'.
  150. '<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="32"/>'.
  151. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  152. '<br/><anchor>Переписать'.
  153. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  154. '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
  155. '<postfield name="url" value="$(url'.$nocache.')"/>'.
  156. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  157. '</go>'.
  158. '</anchor>');
  159. break;
  160. case '<br/>':
  161. $param2=$param3='';
  162. include($buildpath.'element.php');
  163. exit;
  164. break;
  165. case '<p':
  166. case '</p><p':
  167. if (($HTTP_POST_VARS['align']=='left')||($HTTP_POST_VARS['align']=='center')||($HTTP_POST_VARS['align']=='right'))
  168. {
  169. if (($HTTP_POST_VARS['wrap']=='nowrap')) $wrapmode=' mode="nowrap"';
  170. if (($HTTP_POST_VARS['wrap']=='wrap')) $wrapmode=' mode="wrap"';
  171. if (($HTTP_POST_VARS['wrap']=='null')) $wrapmode='';
  172. $page[$i]=$stra[0].' align="'.$HTTP_POST_VARS['align'].'"'.$wrapmode.">\n";
  173. $page=implode("",$page);
  174. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  175. fwrite ($fp, $page);
  176. fclose ($fp);
  177. $param1=$param2=$param3='';
  178. include($buildpath.'structure.php');
  179. exit;
  180. }
  181. $stra=explode('align="',$str);
  182. $stra=explode('"',$stra[1]);
  183. $algn=$stra[0];
  184. $stra=explode('mode="',$str);
  185. $stra=explode('"',$stra[1]);
  186. $wrp=$stra[0];
  187. if ($algn=='center') $align='center';
  188. elseif ($algn=='right') $align='right';
  189. else $align='left';
  190. if ($wrp=='nowrap') $wrap='nowrap';
  191. elseif ($wrp=='wrap') $wrap='wrap';
  192. else $wrap='null';
  193. print $head2.
  194. cyr2utf('<br/><u>Выравнивать</u>:'.
  195. '<br/><select name="align'.$nocache.'" value="'.$align.'"><option value="left">влево</option><option value="center">по центру</option><option value="right">вправо</option></select>'.
  196. '<br/>Строки:'.
  197. '<br/><select name="wrap'.$nocache.'" value="'.$wrap.'"><option value="wrap">разрывные</option><option value="nowrap">неразрывные</option><option value="null">по умолчанию</option></select>'.
  198. '<br/><anchor>Переписать'.
  199. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  200. '<postfield name="align" value="$(align'.$nocache.')"/>'.
  201. '<postfield name="wrap" value="$(wrap'.$nocache.')"/>'.
  202. '</go>'.
  203. '</anchor>');
  204. break;
  205. break;
  206. case '<a':
  207. $stra=explode('">',$str);
  208. $strb=explode(' ',$stra[1]);
  209. if ($strb[0]=='<img')
  210. {
  211. if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url1']!='')&&($HTTP_POST_VARS['url2']!=''))
  212. {
  213. $caption=obrab($HTTP_POST_VARS['caption']);
  214. if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
  215. $page[$i]='<a href="'.obrab($HTTP_POST_VARS['url1']).'"><img src="'.obrab($HTTP_POST_VARS['url2']).'" alt="'.$caption."\"/></a>".$autobr."\n";
  216. $page=implode("",$page);
  217. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  218. fwrite ($fp, $page);
  219. fclose ($fp);
  220. $param1=$param2=$param3='';
  221. include($buildpath.'structure.php');
  222. exit;
  223. }
  224. $stra=explode('href="',$str);
  225. $stra=explode('"',$stra[1]);
  226. $link_=$stra[0];
  227. $stra=explode('<img src="',$str);
  228. $stra=explode('"',$stra[1]);
  229. $imgurl=$stra[0];
  230. $stra=explode(' alt="',$str);
  231. $stra=explode('"',$stra[1]);
  232. $alttext=$stra[0];
  233. print $head2.
  234. cyr2utf('<br/><u>Баннер</u>:'.
  235. '<br/>URL ссылки:<input name="url1'.$nocache.'" type="text" title="URL ссылки" value="').$link_.cyr2utf('" maxlength="128"/>'.
  236. '<br/>URL рисунка:<input name="url2'.$nocache.'" type="text" title="URL рисунка" value="').$imgurl.cyr2utf('" maxlength="128"/>'.
  237. '<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$alttext.cyr2utf('" maxlength="32"/>'.
  238. '<br/><select name="autobr'.$nocache.'" multiple="true" value="').$flagbr.cyr2utf('"><option value="yes">Автоперенос</option></select>'.
  239. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  240. '<br/><anchor>Переписать'.
  241. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  242. '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
  243. '<postfield name="url1" value="$(url1'.$nocache.')"/>'.
  244. '<postfield name="url2" value="$(url2'.$nocache.')"/>'.
  245. '<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
  246. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  247. '</go>'.
  248. '</anchor>');
  249. }
  250. else
  251. {
  252. if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url']!=''))
  253. {
  254. $caption=obrab($HTTP_POST_VARS['caption']);
  255. if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
  256. $page[$i]='<a href="'.obrab($HTTP_POST_VARS['url']).'">'.$caption."</a>";
  257. if (strpos(' '.$HTTP_POST_VARS['atrib'],'i')) $page[$i]='<i>'.$page[$i].'</i>';
  258. if (strpos(' '.$HTTP_POST_VARS['atrib'],'u')) $page[$i]='<u>'.$page[$i].'</u>';
  259. if (strpos(' '.$HTTP_POST_VARS['atrib'],'b')) $page[$i]='<b>'.$page[$i].'</b>';
  260. if (strpos(' '.$HTTP_POST_VARS['size'],'big')) $page[$i]='<big>'.$page[$i].'</big>';
  261. if (strpos(' '.$HTTP_POST_VARS['size'],'small')) $page[$i]='<small>'.$page[$i].'</small>';
  262. $page[$i].=$autobr."\n";
  263. $page=implode("",$page);
  264. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  265. fwrite ($fp, $page);
  266. fclose ($fp);
  267. $param1=$param2=$param3='';
  268. include($buildpath.'structure.php');
  269. exit;
  270. }
  271. $stra=explode('href="',$str);
  272. $stra=explode('"',$stra[1]);
  273. $link_=$stra[0];
  274. $stra=explode('">',$str);
  275. $stra=explode('</a>',$stra[1]);
  276. $caption=$stra[0];
  277. print $head2.
  278. cyr2utf('<br/><u>Ссылка</u>:'.
  279. '<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$link_.cyr2utf('" maxlength="128"/>'.
  280. '<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="32"/>'.
  281. '<br/>Атрибуты: '.
  282. '<br/><select name="atrib'.$nocache.'" multiple="true" value="'.$atr.'"><option value="b">полужирный</option><option value="u">подчеркнутый</option><option value="i">наклонный</option></select>'.
  283. '<br/>Размер: '.
  284. '<br/><select name="size'.$nocache.'" value="'.$size.'"><option value="small">мелкий</option><option value="normal">нормальный</option><option value="big">крупный</option></select>'.
  285. '<br/><select name="autobr'.$nocache.'" multiple="true" value="').$flagbr.cyr2utf('"><option value="yes">Автоперенос</option></select>'.
  286. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  287. '<br/><anchor>Переписать'.
  288. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  289. '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
  290. '<postfield name="url" value="$(url'.$nocache.')"/>'.
  291. '<postfield name="atrib" value="$(atrib'.$nocache.')"/>'.
  292. '<postfield name="size" value="$(size'.$nocache.')"/>'.
  293. '<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
  294. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  295. '</go>'.
  296. '</anchor>');
  297. }
  298. break;
  299. case '<img':
  300. if (($HTTP_POST_VARS['caption']!='')&&($HTTP_POST_VARS['url']!=''))
  301. {
  302. $caption=obrab($HTTP_POST_VARS['caption']);
  303. if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
  304. $page[$i]='<img src="'.obrab($HTTP_POST_VARS['url']).'" alt="'.$caption.'"/>'.$autobr."\n";
  305. $page=implode("",$page);
  306. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  307. fwrite ($fp, $page);
  308. fclose ($fp);
  309. $param1=$param2=$param3='';
  310. include($buildpath.'structure.php');
  311. exit;
  312. }
  313. $stra=explode('src="',$str);
  314. $stra=explode('"',$stra[1]);
  315. $imgurl=$stra[0];
  316. $stra=explode('alt="',$str);
  317. $stra=explode('"',$stra[1]);
  318. $caption=$stra[0];
  319. print $head2.
  320. cyr2utf('<br/><u>Рисунок</u>:'.
  321. '<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$imgurl.cyr2utf('" maxlength="128"/>'.
  322. '<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="64"/>'.
  323. '<br/><select name="autobr'.$nocache.'" multiple="true" value="').$flagbr.cyr2utf('"><option value="yes">Автоперенос</option></select>'.
  324. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  325. '<br/><anchor>Переписать'.
  326. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  327. '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
  328. '<postfield name="url" value="$(url'.$nocache.')"/>'.
  329. '<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
  330. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  331. '</go>'.
  332. '</anchor>');
  333. break;
  334. case '<input':
  335. if ($HTTP_POST_VARS['var']!='')
  336. {
  337. $caption=obrab($HTTP_POST_VARS['caption']);
  338. $var_=obrab($HTTP_POST_VARS['var']);
  339. $def=obrab($HTTP_POST_VARS['def']);
  340. $size=obrab($HTTP_POST_VARS['size'])+0;
  341. if ($size<1) $size='999';
  342. if ($HTTP_POST_VARS['tr2cyr']=='yes')
  343. {
  344. $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
  345. $def=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['def']))));
  346. }
  347. if ($HTTP_POST_VARS['type']!='password') $type='text'; else $type='password';
  348. $page[$i]='<input name="'.$var_.'" type="'.$type.'" emptyok="true" title="'.$caption.'" maxlength="'.$size.'" value="'.$def.'"/>'.$autobr."\n";
  349. $page=implode("",$page);
  350. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  351. fwrite ($fp, $page);
  352. fclose ($fp);
  353. $param1=$param2=$param3='';
  354. include($buildpath.'structure.php');
  355. exit;
  356. }
  357. $stra=explode('name="',$str);
  358. $stra=explode('"',$stra[1]);
  359. $var_=$stra[0];
  360. $stra=explode('maxlength="',$str);
  361. $stra=explode('"',$stra[1]);
  362. $size=$stra[0];
  363. $stra=explode('value="',$str);
  364. $stra=explode('"',$stra[1]);
  365. $def=$stra[0];
  366. $stra=explode('title="',$str);
  367. $stra=explode('"',$stra[1]);
  368. $caption=$stra[0];
  369. $stra=explode('type="',$str);
  370. $stra=explode('"',$stra[1]);
  371. $type=$stra[0];
  372. print $head2.
  373. cyr2utf('<br/><u>Поле ввода</u>:'.
  374. '<br/>Переменная:<input name="var'.$nocache.'" type="text" title="Переменная" value="').$var_.cyr2utf('" maxlength="16"/>'.
  375. '<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="16"/>'.
  376. '<br/>Размер:<input name="size'.$nocache.'" type="text" title="Размер" value="').$size.cyr2utf('" maxlength="3"/>'.
  377. '<br/>Значение:<input name="def'.$nocache.'" type="text" title="По умолчанию" value="').$def.cyr2utf('" maxlength="32"/>'.
  378. '<br/><select name="type'.$nocache.'" value="').$type.cyr2utf('"><option value="text">Текст</option><option value="password">Пароль</option></select>'.
  379. '<br/><select name="autobr'.$nocache.'" multiple="true" value="yes"><option value="yes">Автоперенос</option></select>'.
  380. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  381. '<br/><anchor>Переписать'.
  382. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  383. '<postfield name="var" value="$(var'.$nocache.')"/>'.
  384. '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
  385. '<postfield name="size" value="$(size'.$nocache.')"/>'.
  386. '<postfield name="def" value="$(def'.$nocache.')"/>'.
  387. '<postfield name="type" value="$(type'.$nocache.')"/>'.
  388. '<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
  389. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  390. '</go>'.
  391. '</anchor>');
  392. break;
  393. case '<anchor':
  394. if (($HTTP_POST_VARS['url']!='')&&($HTTP_POST_VARS['caption']!=''))
  395. {
  396. $caption=obrab($HTTP_POST_VARS['caption']);
  397. if ($HTTP_POST_VARS['tr2cyr']=='yes') $caption=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['caption']))));
  398. $url=obrab($HTTP_POST_VARS['url']);
  399. if ($HTTP_POST_VARS['method']!='get') $method='post'; else $method='get';
  400. $page[$i]='<anchor >'.$caption.'<go href="'.$url.'" method="'.$method.'">'.$variables.'</go></anchor>'.$autobr."\n";
  401. $page=implode("",$page);
  402. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  403. fwrite ($fp, $page);
  404. fclose ($fp);
  405. $param1=$param2=$param3='';
  406. include($buildpath.'structure.php');
  407. exit;
  408. }
  409. $stra=explode('href="',$str);
  410. $stra=explode('"',$stra[1]);
  411. $url=$stra[0];
  412. $stra=explode('<anchor >',$str);
  413. $stra=explode('<',$stra[1]);
  414. $caption=$stra[0];
  415. $stra=explode('method="',$str);
  416. $stra=explode('"',$stra[1]);
  417. $method=$stra[0];
  418. print $head2.
  419. cyr2utf('<br/><u>Ссылка+</u>:'.
  420. '<br/>URL:<input name="url'.$nocache.'" type="text" title="URL" value="').$url.cyr2utf('" maxlength="128"/>'.
  421. '<br/>Подпись:<input name="caption'.$nocache.'" type="text" title="Подпись" value="').$caption.cyr2utf('" maxlength="32"/>'.
  422. '<br/>Метод: '.
  423. '<br/><select name="method'.$nocache.'" value="').$method.cyr2utf('"><option value="get">GET</option><option value="post">POST</option></select>'.
  424. '<br/><select name="autobr'.$nocache.'" multiple="true" value="yes"><option value="yes">Автоперенос</option></select>'.
  425. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  426. '<br/><anchor>Переписать'.
  427. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  428. '<postfield name="url" value="$(url'.$nocache.')"/>'.
  429. '<postfield name="caption" value="$(caption'.$nocache.')"/>'.
  430. '<postfield name="method" value="$(method'.$nocache.')"/>'.
  431. '<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
  432. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  433. '</go>'.
  434. '</anchor>');
  435. break;
  436. case '<!--var':
  437. if (($HTTP_POST_VARS['name']!='')&&($HTTP_POST_VARS['value']!=''))
  438. {
  439. $value=obrab($HTTP_POST_VARS['value']);
  440. if ($HTTP_POST_VARS['tr2cyr']=='yes') $value=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['value']))));
  441. $page[$i]='<!--var |'.obrab($HTTP_POST_VARS['name']).'|'.$value."|-->\n";
  442. $page=implode("",$page);
  443. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  444. fwrite ($fp, $page);
  445. fclose ($fp);
  446. $param1=$param2=$param3='';
  447. include($buildpath.'structure.php');
  448. exit;
  449. }
  450. $stra=explode('|',$str);
  451. print $head2.
  452. cyr2utf('<br/><u>Переменная</u>:'.
  453. '<br/>Переменная:<input name="name'.$nocache.'" type="text" title="Переменная" value="'.$stra[1].'" maxlength="16"/>'.
  454. '<br/>Значение:<input name="value'.$nocache.'" type="text" title="Значение" value="'.$stra[2].'" maxlength="128"/>'.
  455. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  456. '<br/><anchor>Переписать'.
  457. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit/var" method="post">'.
  458. '<postfield name="name" value="$(name'.$nocache.')"/>'.
  459. '<postfield name="value" value="$(value'.$nocache.')"/>'.
  460. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  461. '</go>'.
  462. '</anchor>');
  463. break;
  464. case '<!--r':
  465. if ($HTTP_POST_VARS['code']!='')
  466. {
  467. $code=str_replace("\n",' ',str_replace("\r",' ',stripslashes($HTTP_POST_VARS['code'])));
  468. $page[$i]='<!--r -->'.$code."\n";
  469. $page=implode("",$page);
  470. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  471. fwrite ($fp, $page);
  472. fclose ($fp);
  473. $param1=$param2=$param3='';
  474. include($buildpath.'structure.php');
  475. exit;
  476. }
  477. $str=substr($str,9);
  478. print $head2.
  479. cyr2utf('<br/><u>WML-код</u>:'.
  480. '<br/><input name="code'.$nocache.'" type="text" title="WML-код" value="').str_replace('$','$$',htmlspecialchars($str)).cyr2utf('" maxlength="512"/>'.
  481. '<br/><anchor>Переписать'.
  482. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit/code" method="post">'.
  483. '<postfield name="code" value="$(code'.$nocache.')"/>'.
  484. '</go>'.
  485. '</anchor>');
  486. break;
  487. default :
  488. if ($HTTP_POST_VARS['text']!='')
  489. {
  490. $page[$i]=obrab($HTTP_POST_VARS['text']);
  491. if ($HTTP_POST_VARS['tr2cyr']=='yes') $page[$i]=cyr2utf(tr2rus(utf2cyr(obrab($HTTP_POST_VARS['text']))));
  492. if (strpos(' '.$HTTP_POST_VARS['atrib'],'i')) $page[$i]='<i>'.$page[$i].'</i>';
  493. if (strpos(' '.$HTTP_POST_VARS['atrib'],'u')) $page[$i]='<u>'.$page[$i].'</u>';
  494. if (strpos(' '.$HTTP_POST_VARS['atrib'],'b')) $page[$i]='<b>'.$page[$i].'</b>';
  495. if (strpos(' '.$HTTP_POST_VARS['size'],'big')) $page[$i]='<big>'.$page[$i].'</big>';
  496. if (strpos(' '.$HTTP_POST_VARS['size'],'small')) $page[$i]='<small>'.$page[$i].'</small>';
  497. $page[$i].=$autobr."\n";
  498. $page=implode("",$page);
  499. $fp = fopen ($userpath.$editfile.'.wml', "w+");
  500. fwrite ($fp, $page);
  501. fclose ($fp);
  502. $param1=$param2=$param3='';
  503. include($buildpath.'structure.php');
  504. exit;
  505. }
  506. print $head2.
  507. cyr2utf('<br/><u>Текст</u>:'.
  508. '<br/><input name="text'.$nocache.'" type="text" title="Текст" value="').$str.cyr2utf('" maxlength="2048"/>'.
  509. '<br/>Атрибуты: '.
  510. '<br/><select name="atrib'.$nocache.'" multiple="true" value="'.$atr.'"><option value="b">полужирный</option><option value="u">подчеркнутый</option><option value="i">наклонный</option></select>'.
  511. '<br/>Размер: '.
  512. '<br/><select name="size'.$nocache.'" value="'.$size.'"><option value="small">мелкий</option><option value="normal">нормальный</option><option value="big">крупный</option></select>'.
  513. '<br/><select name="autobr'.$nocache.'" multiple="true" value="'.$flagbr.'"><option value="yes">Автоперенос</option></select>'.
  514. '<br/><select name="tr2cyr'.$nocache.'" multiple="true" value=""><option value="yes">Транслит</option></select>'.
  515. '<br/><anchor>Переписать'.
  516. '<go href="/?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'/edit" method="post">'.
  517. '<postfield name="text" value="$(text'.$nocache.')"/>'.
  518. '<postfield name="atrib" value="$(atrib'.$nocache.')"/>'.
  519. '<postfield name="size" value="$(size'.$nocache.')"/>'.
  520. '<postfield name="autobr" value="$(autobr'.$nocache.')"/>'.
  521. '<postfield name="tr2cyr" value="$(tr2cyr'.$nocache.')"/>'.
  522. '</go>'.
  523. '</anchor>');
  524. break;
  525. }
  526.  
  527. print cyr2utf('<br/><a href="?'.$id.'/pm'.$dmpage.$mpage.'/'.$editfile.'/edit'.$dapage.$apage.'/'.$param1.'">Отмена</a><br/>');
  528. print '</p></card></wml>';
  529. exit;
  530. ?>