/www/admin/edit.php
PHP | 138 lines | 138 code | 0 blank | 0 comment | 0 complexity | 2b1f838db0364719d19ab5a5eb92ed20 MD5 | raw file
Possible License(s): CC0-1.0
- <?php
- $path=substr(str_replace('\\','/',dirname(__FILE__)),0,-6);
- include $path.'/admin/adminses.php';
- $whatpage = preg_replace('/[^a-z0-9-_]/iu','',$_REQUEST['what']);
- $cat = (isset ($_GET['cat']))? trim($_GET['cat']) : '';
- $subcat = (isset ($_GET['subcat']))? trim($_GET['subcat']) : '';
- if($cat==''){
- $folder=ARTICLES; $editpage='?what='; $linkinfo='';
- }else{
- if($subcat ==''){
- $folder=ARTICLES.$cat; $editpage='?cat='.$cat.'&what='; $linkinfo='/'.$cat;
- }else{
- $folder=ARTICLES.$cat.'/'.$subcat; $editpage='?cat='.$cat.'&subcat='.$subcat.'&what='; $linkinfo='/'.$cat.'/'.$subcat;
- }
- }
- $errormessage='';
- $myFile = $folder.'/'.$whatpage.'.dat';
- if(!empty($_REQUEST['action'])){
- $title = filtermessage($_POST['title']);
- $content = filterquotes($_POST['editor']);
- $myinclude = trim($_POST['myinclude']);
- $description = trim($_POST['description']);
- $keywords = trim($_POST['keywords']);
- $templatepage = trim($_POST['templatepage']);
- $commentpage = trim($_POST['commentpage']);
- $pubdate = trim($_POST['pubdate']);
- $for_menu = (int)$_POST['formenu'];
- $tags = trim($_POST['tags']);
- $somecontent = "<!-- Kan_title -->\n";
- $somecontent .= $title;
- $somecontent .= "<!-- Kan_title -->\n";
- $somecontent .= "<!-- Kan_content -->\n";
- $somecontent .= $content;
- $somecontent .= "<!-- Kan_content -->\n";
- $somecontent .= "<!-- Kan_myinclude -->\n";
- $somecontent .= $myinclude;
- $somecontent .= "<!-- Kan_myinclude -->\n";
- $somecontent .= "<!-- Kan_description -->\n";
- $somecontent .= $description;
- $somecontent .= "<!-- Kan_description -->\n";
- $somecontent .= "<!-- Kan_keywords -->\n";
- $somecontent .= $keywords;
- $somecontent .= "<!-- Kan_keywords -->\n";
- $somecontent .= "<!-- Kan_templatepage -->\n";
- $somecontent .= $templatepage;
- $somecontent .= "<!-- Kan_templatepage -->\n";
- $somecontent .= "<!-- Kan_comment -->\n";
- $somecontent .= $commentpage;
- $somecontent .= "<!-- Kan_comment -->\n";
- $somecontent .= "<!-- Kan_pubdate -->\n";
- $somecontent .= strtotime($pubdate);
- $somecontent .= "<!-- Kan_pubdate -->\n";
- $somecontent .= "<!-- Kan_tags -->\n";
- $somecontent .= $tags;
- $somecontent .= "<!-- Kan_tags -->\n";
- $somecontent=stripslashes($somecontent);
- if(!save($myFile,$somecontent,'w'))$errormessage.='<li>?????????? ?????? ? ???? ('.$myFile.')</li>';
- if($for_menu == 1)if(!savedata(ENGINE.'menudb.php',array('page'=>($linkinfo.'/'.$whatpage.'.html'),'head'=>$title)))
- $errormessage.='<li>?????????? ???????? ???? ????</li>';
- }else{
- if(file_exists($myFile)){
- $data = file_get_contents($myFile);
- $title=articlesparam('title',$data);
- $content = articlesparam('content',$data);
- $myinclude = articlesparam('myinclude',$data);
- $description = articlesparam('description',$data);
- $keywords = articlesparam('keywords',$data);
- $templatepage = articlesparam('templatepage',$data);
- $commentpage = articlesparam('comment',$data);
- $pubdate = articlesparam('pubdate',$data);
- if($pubdate!=='')$pubdate = date("d.m.Y",$pubdate);
- $tags = articlesparam('tags',$data);
- }else $errormessage='<li>???? '.$myFile.' ???????????</li>';
- }
- if(''!=$errormessage){
- $contentcenter = '<h3>??????</h3><ul>' . $errormessage . '</b><br /><br />';
- }elseif($_REQUEST['action']=='go'){
- $url=$_SERVER['PHP_SELF'] . $editpage.$whatpage;
- @$contentcenter .= '<h3>??????? ????????</h3> ????????: <b>'.$title.'</b><br /><br />
- ?????? ??? ?????: <b>'.$linkinfo.'/'.$whatpage.'.html</b><br />
- ???? ???????? ????????? ????????, ?? ?????????????? ????? ???? ??????!</b><br /><br />
- <a href="'.$url.'">???????????? ? ?????????????? ????????</a><br /><br />
- <a href="index.php'.$editpage.'">????????? ? ????????? ????????</a><br /><br />
- <a href="menueditor.php">??????? ? ?????? ?????????????? ????</a>';
- }else{
- $is_checked_commentpage=array_fill(0, 2, '');
- $is_checked_commentpage[(int)$commentpage]='checked="checked"';
- $url=$_SERVER['PHP_SELF'] . $editpage.$whatpage;
- $templatedrop=get_templatepage($templatepage);
- $get_kan_phpfile=get_kan_phpfile($myinclude);
- if($whatpage=='main')$disabled_comment='disabled="disabled"';else $disabled_comment='';
- $sitetitle='???????? ????????: '.admlinkator($cat, $subcat).$title;
- $contentcenter .=<<<EOT
- <h3>?????????????? ????????</h3>$myFile
- <form action="$url" method="post" name="my_form">
- <input type="hidden" name="action" id="action" value="go" />
- <br /><label><b>?????????:</b>
- <input type="text" name="title" id="title" value="$title" size=40 /></label><br /><br />
- <label><b>???? ??????????:</b>
- <input type="text" name="pubdate" id="pubdate" size="10" maxlength="10" readonly="readonly" value="$pubdate" />
- <img src="images/calendar.png" title="????? ????" /></label>
- <img src="images/delete.png" title="??????? ????" onclick="document.forms['my_form'].elements['pubdate'].value='';" /><br /><br />
- <textarea name="editor" id="editor" cols=99 rows=25>$content</textarea><br />
- <label title="???????? ??? - ??? ???????? ????? (??? ??????? ?? .php), ???????????? ? ???????? /mycode, ? ??????? ?????????? ???, ??????? ????? ?????????? ????? ????????? ?????? ??????????? ????????. ??? ???????? ???????? ?????? ? ?????????? ??????????? ??? <b>main</b>, ???? ?????????? ??????? ???????? ?? ??????? ????? ???????? ????? ???????? ?????, ???????????? ??????? ??????????, ????????, ????? ? ????? ???????, ?????????? ??????? <b>feedback</b>. ?? ?????? ??????? ? ?????? ????, ??????? ?????????? ?????????? ? ???????? <b>/mycode</b> ? ????? ??????????; ?? ????? ??????? ? ????????? ?????? ??????????? ????????. ?????? ?????? ?????? ????????? //phpfile"><b>??? php-????:</b>
- <span class="select-and-input">
- $get_kan_phpfile
- <input type="myinclude" name="myinclude" id="myinclude" value="$myinclude" size=10 />
- </span></label><br><br>
- <label title="???????? ???????? :: ???????? ???????? ???????? ??? ??????? ?????; ?? ????????? ??????? meta-description ??????????? ????????. ? ???????? ????????? ??????? ?????????? ????, ??? ???????????? ?? ????????. ?? ????? ?????? ???? ????????? ????????? ???????. ????? ???????? ???? ?????? ?? ??????? ????????? ?????????? ? ???????? ?????."><b>???????? (description):</b> </label>
- <input type="description" name="description" id="description" value="$description" /></label><br /><br />
- <label title="???????? ????? :: ???????? ????? ???????? ????? ???????; ??? ????????? ??????? meta-keywords ??????????? ????????. ?????? ???????? ???????????? ? ????????? ???????? ?? ?????? ??? ?????????? ???????? ??????. ????? ???????, ??? ????????? ????????? ??????? (????????, ??????) ?? ??????? ???????? ??????????? ???????? ??????. ???????? ?????, ?????????? ??? ?????????? ???????? ??????????? ?????? ?????????????? ? ???. ????????? ???????? ???? (????? ???????? ????, ?????????? ? ?????? ????? ????) ? ?????? ?? ?????? ????????? 5-10%, ????? ????????? ?????? ????? ?????? ???????? ?? ????."><b>???????? ????? (keywords):</b>
- <input type="text" name="keywords" id="keywords" value="$keywords" size="40" /></label><br /><br />
- <label title="???? :: ???? (?????) ???????? ????? ??????; ???????????? ? ?????? ????? ??????????? ????????."><b>???? (?????):</b>
- <input type="text" name="tags" class="settings" id="keywords" value="$tags" size="40" /></label><br /><br />
- <label title="?????? ??? ?????? ????????. ????????? ??????? ??? ?????? ???????? ???? ??????. ????????? ? ???????? ??????? ? ????? ??? ? ???? template<...>,php"><b>????????? ??????: </b> $templatedrop</label><br /><br />
- <label><b>???????????:</b></label>
- <label><input name="commentpage" type="radio" value="0" $is_checked_commentpage[0] /> ?????????</label>
- <label><input name="commentpage" type="radio" value="1" $is_checked_commentpage[1] /> ???????????</label>
- <label><input name="commentpage" type="radio" value="2" $is_checked_commentpage[2] /> ?????????</label>
- <br /><br />
- <label><b>???????? ?????? ???????? ? ?????</b></label>
- <input type="radio" name="formenu" value="1" style="border: 0;" /> ??
- <input checked type="radio" name="formenu" value="0" style="border: 0;" /> ???<br /><br />
- <br /><br />
- <div class="submit"><input type="submit" class="submit-button" value="????????" /></div><br />
- </form>
- EOT;
- }
- include $localpath.'admin/admintemplate.php';
- ?>