PageRenderTime 63ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/www/admin/edit.php

http://kandidat-cms.googlecode.com/
PHP | 138 lines | 138 code | 0 blank | 0 comment | 0 complexity | 2b1f838db0364719d19ab5a5eb92ed20 MD5 | raw file
Possible License(s): CC0-1.0
  1. <?php
  2. $path=substr(str_replace('\\','/',dirname(__FILE__)),0,-6);
  3. include $path.'/admin/adminses.php';
  4. $whatpage = preg_replace('/[^a-z0-9-_]/iu','',$_REQUEST['what']);
  5. $cat = (isset ($_GET['cat']))? trim($_GET['cat']) : '';
  6. $subcat = (isset ($_GET['subcat']))? trim($_GET['subcat']) : '';
  7. if($cat==''){
  8. $folder=ARTICLES; $editpage='?what='; $linkinfo='';
  9. }else{
  10. if($subcat ==''){
  11. $folder=ARTICLES.$cat; $editpage='?cat='.$cat.'&what='; $linkinfo='/'.$cat;
  12. }else{
  13. $folder=ARTICLES.$cat.'/'.$subcat; $editpage='?cat='.$cat.'&subcat='.$subcat.'&what='; $linkinfo='/'.$cat.'/'.$subcat;
  14. }
  15. }
  16. $errormessage='';
  17. $myFile = $folder.'/'.$whatpage.'.dat';
  18. if(!empty($_REQUEST['action'])){
  19. $title = filtermessage($_POST['title']);
  20. $content = filterquotes($_POST['editor']);
  21. $myinclude = trim($_POST['myinclude']);
  22. $description = trim($_POST['description']);
  23. $keywords = trim($_POST['keywords']);
  24. $templatepage = trim($_POST['templatepage']);
  25. $commentpage = trim($_POST['commentpage']);
  26. $pubdate = trim($_POST['pubdate']);
  27. $for_menu = (int)$_POST['formenu'];
  28. $tags = trim($_POST['tags']);
  29. $somecontent = "<!-- Kan_title -->\n";
  30. $somecontent .= $title;
  31. $somecontent .= "<!-- Kan_title -->\n";
  32. $somecontent .= "<!-- Kan_content -->\n";
  33. $somecontent .= $content;
  34. $somecontent .= "<!-- Kan_content -->\n";
  35. $somecontent .= "<!-- Kan_myinclude -->\n";
  36. $somecontent .= $myinclude;
  37. $somecontent .= "<!-- Kan_myinclude -->\n";
  38. $somecontent .= "<!-- Kan_description -->\n";
  39. $somecontent .= $description;
  40. $somecontent .= "<!-- Kan_description -->\n";
  41. $somecontent .= "<!-- Kan_keywords -->\n";
  42. $somecontent .= $keywords;
  43. $somecontent .= "<!-- Kan_keywords -->\n";
  44. $somecontent .= "<!-- Kan_templatepage -->\n";
  45. $somecontent .= $templatepage;
  46. $somecontent .= "<!-- Kan_templatepage -->\n";
  47. $somecontent .= "<!-- Kan_comment -->\n";
  48. $somecontent .= $commentpage;
  49. $somecontent .= "<!-- Kan_comment -->\n";
  50. $somecontent .= "<!-- Kan_pubdate -->\n";
  51. $somecontent .= strtotime($pubdate);
  52. $somecontent .= "<!-- Kan_pubdate -->\n";
  53. $somecontent .= "<!-- Kan_tags -->\n";
  54. $somecontent .= $tags;
  55. $somecontent .= "<!-- Kan_tags -->\n";
  56. $somecontent=stripslashes($somecontent);
  57. if(!save($myFile,$somecontent,'w'))$errormessage.='<li>?????????? ?????? ? ???? ('.$myFile.')</li>';
  58. if($for_menu == 1)if(!savedata(ENGINE.'menudb.php',array('page'=>($linkinfo.'/'.$whatpage.'.html'),'head'=>$title)))
  59. $errormessage.='<li>?????????? ???????? ???? ????</li>';
  60. }else{
  61. if(file_exists($myFile)){
  62. $data = file_get_contents($myFile);
  63. $title=articlesparam('title',$data);
  64. $content = articlesparam('content',$data);
  65. $myinclude = articlesparam('myinclude',$data);
  66. $description = articlesparam('description',$data);
  67. $keywords = articlesparam('keywords',$data);
  68. $templatepage = articlesparam('templatepage',$data);
  69. $commentpage = articlesparam('comment',$data);
  70. $pubdate = articlesparam('pubdate',$data);
  71. if($pubdate!=='')$pubdate = date("d.m.Y",$pubdate);
  72. $tags = articlesparam('tags',$data);
  73. }else $errormessage='<li>???? '.$myFile.' ???????????</li>';
  74. }
  75. if(''!=$errormessage){
  76. $contentcenter = '<h3>??????</h3><ul>' . $errormessage . '</b><br /><br />';
  77. }elseif($_REQUEST['action']=='go'){
  78. $url=$_SERVER['PHP_SELF'] . $editpage.$whatpage;
  79. @$contentcenter .= '<h3>??????? ????????</h3> ????????: <b>'.$title.'</b><br /><br />
  80. ?????? ??? ?????: <b>'.$linkinfo.'/'.$whatpage.'.html</b><br />
  81. ???? ???????? ????????? ????????, ?? ?????????????? ????? ???? ??????!</b><br /><br />
  82. <a href="'.$url.'">???????????? ? ?????????????? ????????</a><br /><br />
  83. <a href="index.php'.$editpage.'">????????? ? ????????? ????????</a><br /><br />
  84. <a href="menueditor.php">??????? ? ?????? ?????????????? ????</a>';
  85. }else{
  86. $is_checked_commentpage=array_fill(0, 2, '');
  87. $is_checked_commentpage[(int)$commentpage]='checked="checked"';
  88. $url=$_SERVER['PHP_SELF'] . $editpage.$whatpage;
  89. $templatedrop=get_templatepage($templatepage);
  90. $get_kan_phpfile=get_kan_phpfile($myinclude);
  91. if($whatpage=='main')$disabled_comment='disabled="disabled"';else $disabled_comment='';
  92. $sitetitle='???????? ????????: '.admlinkator($cat, $subcat).$title;
  93. $contentcenter .=<<<EOT
  94. <h3>?????????????? ????????</h3>$myFile
  95. <form action="$url" method="post" name="my_form">
  96. <input type="hidden" name="action" id="action" value="go" />
  97. <br /><label><b>?????????:</b>
  98. <input type="text" name="title" id="title" value="$title" size=40 /></label><br /><br />
  99. <label><b>???? ??????????:</b>
  100. <input type="text" name="pubdate" id="pubdate" size="10" maxlength="10" readonly="readonly" value="$pubdate" />
  101. <img src="images/calendar.png" title="????? ????" /></label>
  102. <img src="images/delete.png" title="??????? ????" onclick="document.forms['my_form'].elements['pubdate'].value='';" /><br /><br />
  103. <textarea name="editor" id="editor" cols=99 rows=25>$content</textarea><br />
  104. <label title="???????? ??? - ??? ???????? ????? (??? ??????? ?? .php), ???????????? ? ???????? /mycode, ? ??????? ?????????? ???, ??????? ????? ?????????? ????? ????????? ?????? ??????????? ????????. ??? ???????? ???????? ?????? ? ?????????? ??????????? ??? <b>main</b>, ???? ?????????? ??????? ???????? ?? ??????? ????? ???????? ????? ???????? ?????, ???????????? ??????? ??????????, ????????, ????? ? ????? ???????, ?????????? ??????? <b>feedback</b>. ?? ?????? ??????? ? ?????? ????, ??????? ?????????? ?????????? ? ???????? <b>/mycode</b> ? ????? ??????????; ?? ????? ??????? ? ????????? ?????? ??????????? ????????. ?????? ?????? ?????? ????????? //phpfile"><b>??? php-????:</b>&nbsp;&nbsp;&nbsp;
  105. <span class="select-and-input">
  106. $get_kan_phpfile
  107. <input type="myinclude" name="myinclude" id="myinclude" value="$myinclude" size=10 />
  108. </span></label><br><br>
  109. <label title="???????? ???????? :: ???????? ???????? ???????? ??? ??????? ?????; ?? ????????? ??????? meta-description ??????????? ????????. ? ???????? ????????? ??????? ?????????? ????, ??? ???????????? ?? ????????. ?? ????? ?????? ???? ????????? ????????? ???????. ????? ???????? ???? ?????? ?? ??????? ????????? ?????????? ? ???????? ?????."><b>???????? (description):</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  110. <input type="description" name="description" id="description" value="$description" /></label><br /><br />
  111. <label title="???????? ????? :: ???????? ????? ???????? ????? ???????; ??? ????????? ??????? meta-keywords ??????????? ????????. ?????? ???????? ???????????? ? ????????? ???????? ?? ?????? ??? ?????????? ???????? ??????. ????? ???????, ??? ????????? ????????? ??????? (????????, ??????) ?? ??????? ???????? ??????????? ???????? ??????. ???????? ?????, ?????????? ??? ?????????? ???????? ??????????? ?????? ?????????????? ? ???. ????????? ???????? ???? (????? ???????? ????, ?????????? ? ?????? ????? ????) ? ?????? ?? ?????? ????????? 5-10%, ????? ????????? ?????? ????? ?????? ???????? ?? ????."><b>???????? ????? (keywords):</b>
  112. <input type="text" name="keywords" id="keywords" value="$keywords" size="40" /></label><br /><br />
  113. <label title="???? :: ???? (?????) ???????? ????? ??????; ???????????? ? ?????? ????? ??????????? ????????."><b>???? (?????):</b>
  114. <input type="text" name="tags" class="settings" id="keywords" value="$tags" size="40" /></label><br /><br />
  115. <label title="?????? ??? ?????? ????????. ????????? ??????? ??? ?????? ???????? ???? ??????. ????????? ? ???????? ??????? ? ????? ??? ? ???? template<...>,php"><b>????????? ??????:&nbsp</b> $templatedrop</label><br /><br />
  116. <label><b>???????????:</b></label>
  117. <label><input name="commentpage" type="radio" value="0" $is_checked_commentpage[0] /> ?????????</label>
  118. <label><input name="commentpage" type="radio" value="1" $is_checked_commentpage[1] /> ???????????</label>
  119. <label><input name="commentpage" type="radio" value="2" $is_checked_commentpage[2] /> ?????????</label>
  120. <br /><br />
  121. <label><b>???????? ?????? ???????? ? ?????</b></label>
  122. <input type="radio" name="formenu" value="1" style="border: 0;" /> ??
  123. <input checked type="radio" name="formenu" value="0" style="border: 0;" /> ???<br /><br />
  124. <br /><br />
  125. <div class="submit"><input type="submit" class="submit-button" value="????????" /></div><br />
  126. </form>
  127. EOT;
  128. }
  129. include $localpath.'admin/admintemplate.php';
  130. ?>