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

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