"; $id_edit=$url_a[filename]; } include("../conect.html"); //основные переменные $file_templit = "temp/temp_adm.htm"; $main_templit = load_from_file ($file_templit) ; $temp_templit="adm_edit_main"; $templit_array[$temp_templit]=cut_temp($main_templit,"",""); $temp_form_enter=$templit_array["adm_edit_main"]; if($adm_lit_height<1){$adm_lit_height=4;} $temp_form_enter=str_replace("#adm_lit_height#", $adm_lit_height, $temp_form_enter); if($adm_text_height<1){$adm_text_height=400;} $temp_form_enter=str_replace("#adm_text_height#", $adm_text_height, $temp_form_enter); if($adm_title_hide==1){ $temp_form_enter=str_replace("#adm_title_show#", "none", $temp_form_enter); }else{ $temp_form_enter=str_replace("#adm_title_show#", "block", $temp_form_enter); } if($adm_dop_info_hide==1){ $temp_form_enter=str_replace("#adm_dop_info_show#", "none", $temp_form_enter); }else{ $temp_form_enter=str_replace("#adm_dop_info_show#", "block", $temp_form_enter); } if($adm_count_foto_show>0){ $temp_form_enter=str_replace("#adm_count_foto_show#", "$adm_count_foto_show", $temp_form_enter); }else{ $temp_form_enter=str_replace("#adm_count_foto_show#", "0", $temp_form_enter); } //переменные POST if($_POST[id]){ //print_r($_POST); if(key_exists("id",$_POST)){ $id_write = htmlspecialchars($_POST["id"], ENT_QUOTES);} if(key_exists("zag",$_POST)){ $zag_write = htmlspecialchars($_POST["zag"], ENT_QUOTES);} if(key_exists("lit",$_POST)){ $lit_write = htmlspecialchars($_POST["lit"], ENT_QUOTES);} if(key_exists("text",$_POST)){ $text_write = htmlspecialchars($_POST["text"], ENT_QUOTES);} if(key_exists("autor",$_POST)){ $autor_write = htmlspecialchars($_POST["autor"], ENT_QUOTES);} if(key_exists("hide",$_POST)){ $hide_write = htmlspecialchars($_POST["hide"], ENT_QUOTES);} if(key_exists("later",$_POST)){ $later_write = htmlspecialchars($_POST["later"], ENT_QUOTES);} if(key_exists("prosmotrov",$_POST)){ $prosmotrov_write = htmlspecialchars($_POST["prosmotrov"], ENT_QUOTES);} if(key_exists("komentariev",$_POST)){ $komentariev_write = htmlspecialchars($_POST["komentariev"], ENT_QUOTES);} if(key_exists("raiting",$_POST)){ $raiting_write = htmlspecialchars($_POST["raiting"], ENT_QUOTES);} if(key_exists("shablon",$_POST)){ $shablon_write = htmlspecialchars($_POST["shablon"], ENT_QUOTES);} if(key_exists("day",$_POST)){ $day_w = htmlspecialchars($_POST["day"], ENT_QUOTES); $mon_w = htmlspecialchars($_POST["mon"], ENT_QUOTES); $year_w = htmlspecialchars($_POST["year"], ENT_QUOTES); $hour_w = htmlspecialchars($_POST["hour"], ENT_QUOTES); $min_w = htmlspecialchars($_POST["min"], ENT_QUOTES); $data_write = date("U",mktime ( $hour_w, $min_w , 0 , $mon_w ,$day_w , $year_w )); } if(key_exists("title",$_POST)){$title_write = htmlspecialchars($_POST["title"], ENT_QUOTES);} if(strlen($title_write)<2){$title_write = htmlspecialchars($zag_write);} if(key_exists("desc",$_POST)){ $desc_write = htmlspecialchars($_POST["desc"], ENT_QUOTES);} if(strlen($desc_write)<2){$desc_write = htmlspecialchars($lit_write);} if(key_exists("keyw",$_POST)){ $keyw_write = htmlspecialchars($_POST["keyw"], ENT_QUOTES);} if(strlen($keyw_write)<2){$keyw_write = keys(htmlspecialchars_decode( $zag_write." ".$text_write." ".$lit_write));} //построить дополнительные поля // показать список всех for($i=1;$i<=20;$i++){ $temp_dop_info = htmlspecialchars(@$_POST["dop_info_$i"], ENT_QUOTES); $add_text_category.=" `dop_info_{$i}`='$temp_dop_info', "; } } //выбрать все категории в массив $query= "SELECT * FROM $table_category order by zag";$result= MYSQL_QUERY($query);$number = MYSQL_NUMROWS($result); while($row = mysql_fetch_array($result)){ $all_cat[$row[id]]=$row[zag]; $all_cat_first[$row[id]]=$row[cat]; $all_cat_level[$row[id]]=$row[level]; $all_sub_cat[$row[level]][$row[cat_1]][$row[id]]=$row[cat_1]; $all_sub_cat[$row[level]][$row[cat_2]][$row[id]]=$row[cat_2]; $all_sub_cat[$row[level]][$row[cat_3]][$row[id]]=$row[cat_3]; $all_sub_cat[$row[level]][$row[cat_4]][$row[id]]=$row[cat_4]; $all_cat_tree[$row[cat]][$row[level]][$row[id]]=$row["cat_{$row[level]}"]; //$all_cat_tree[$row[cat]][$row[level]][$row[id]]=$row["cat_{$row[level]}"]; $tree_cur_a[$row[id]][1]=$row[cat_1]; $tree_cur_a[$row[id]][2]=$row[cat_2]; $tree_cur_a[$row[id]][3]=$row[cat_3]; $tree_cur_a[$row[id]][4]=$row[cat_4]; } //сохранение новой if($id_edit =="new"){ $data_write = time(); $querywrite = "INSERT INTO $table_main(date, hide ) VALUES ('$data_write', '1' ) "; $resultwrite= MYSQL_QUERY($querywrite); $id_edit=mysql_insert_id($id_conect); } //изменение if(abs($id_write) >1){ $zag_write= rtrim ($zag_write,"\n");$zag_write= rtrim ($zag_write,"\r"); $lit_write= rtrim ($lit_write,"\n");$lit_write= rtrim ($lit_write,"\r"); $text_write= rtrim ($text_write,"\n");$text_write= rtrim ($text_write,"\r"); //построение категорий //print_r($tree_cur_a); for($i=1;$i<6;$i++){ if(key_exists("id_cat_$i",$_POST)){ $cat_write[$i] = htmlspecialchars($_POST["id_cat_$i"], ENT_QUOTES);}else{$cat_write[$i] ="0";} $level=$all_cat_level[$cat_write[$i]]; $cur_level=$level+1; for($j=5;$j>=1;$j--){ if($j==$cur_level){ $temp_i_1=$cat_write[$i]; }else{ $temp_i_1=$tree_cur_a[$cat_write[$i]][$j]; } $add_text_category.=" `category_{$i}_{$j}`='$temp_i_1', "; } } //echo"$add_text_category"; //print_r($all_cat_tree); //выбрать первую фотку $query= "SELECT * FROM $table_photo where id=$id_write order by sort ASC limit 1"; $result= MYSQL_QUERY($query);$number = @MYSQL_NUMROWS($result); while($row = @mysql_fetch_array($result)) { $urlphoto_write=$row[url]; $textphoto_write=$row[phototext]; } //$urlphoto_write $querywrite = " UPDATE $table_main SET `date` = '$data_write', `hide` = '$hide_write', `later` = '$later_write', `zag` = '$zag_write', `lit` = '$lit_write', `text` = '$text_write', `autor` = '$autor_write', `komentariev` = '$komentariev_write', `prosmotrov` = '$prosmotrov_write', `raiting` = '$raiting_write', `id_shablon` = '$shablon_write', `title` = '$title_write', `desc` = '$desc_write', `keyw` = '$keyw_write', $add_text_category `urlphoto` = '$urlphoto_write', `textphoto` = '$textphoto_write' WHERE `id` ='$id_write' "; //echo"
$querywrite
"; $resultwrite= MYSQL_QUERY($querywrite); $id_edit=$id_write; resave_first_photo($id_edit); } //изменение старой //загрузка текста $query= "SELECT * FROM $table_main WHERE id=$id_edit"; //echo"$query
"; $result= MYSQL_QUERY($query);$number = MYSQL_NUMROWS($result); if($id_edit=="new"){ $row[id]="new"; $row[date]=time(); $row[hide]=1; }else{ $row = mysql_fetch_array($result); } //выборка списка категорий //подготовить вывод по уровням //$text_1_line="
"; for($i=1;$i<6;$i++){ //$text_1_line.=" + "; //$text_1_line.=" ++
"; reset($all_cat_first); while ( list($key, $val) = each( $all_cat_first )) { if($val==$i and $all_cat_level[$key]==0 ){ if($row["category_{$i}_1"]==$key ){$sel_text=" selected ";}else{$sel_text="";} $text_cat[$i] .=""; reset($all_sub_cat[1]); while ( list($key1, $val1) = each( $all_sub_cat[1][$key] )) { if($val1==$key ){ if($row["category_{$i}_2"]==$key1 ){$sel_text=" selected ";}else{$sel_text="";} $text_cat[$i] .=""; reset($all_sub_cat[2]); while ( list($key2, $val2) = each( $all_sub_cat[2][$key1] )) { if($val2==$key1 ){ if($row["category_{$i}_3"]==$key2 ){$sel_text=" selected ";}else{$sel_text="";} $text_cat[$i] .=""; reset($all_sub_cat[3]); while ( list($key3, $val3) = each( $all_sub_cat[3][$key2] )) { if($val3==$key2 ){ if($row["category_{$i}_4"]==$key3 ){$sel_text=" selected ";}else{$sel_text="";} $text_cat[$i] .=""; reset($all_sub_cat[4]); while ( list($key4, $val4) = each( $all_sub_cat[4][$key3] )) { if($val4==$key3 ){ if($row["category_{$i}_5"]==$key4 ){$sel_text=" selected ";}else{$sel_text="";} $text_cat[$i] .=""; }} }} }} }} }} $text_1_line.="
"; $temp_form_enter=str_replace("#id_cat_$i#",$text_cat[$i] , $temp_form_enter); } $text_1_line.="
"; $main_text=$text_1_line; //постороение даты $day_b=date("d", $row[date]);$temp_form_enter=str_replace("#day#", $day_b, $temp_form_enter); $mon_b=date("m", $row[date]);$temp_form_enter=str_replace("#mon#", $mon_b, $temp_form_enter); $year_b=date("Y", $row[date]);$temp_form_enter=str_replace("#year#", $year_b, $temp_form_enter); $hour_b=date("H", $row[date]);$temp_form_enter=str_replace("#hour#", $hour_b, $temp_form_enter); $min_b=date("i", $row[date]);$temp_form_enter=str_replace("#min#", $min_b, $temp_form_enter); //отложенная if($row[later]==1){$temp_form_enter=str_replace("#later#"," checked ", $temp_form_enter);} //скрытая if($row[hide]==1){$temp_form_enter=str_replace("#hide#"," checked ", $temp_form_enter);} //просмотров $temp_form_enter=str_replace("#prosmotrov#", $row[prosmotrov], $temp_form_enter); //коментариев $temp_form_enter=str_replace("#komentariev#", $row[komentariev], $temp_form_enter); //рейтинг $temp_form_enter=str_replace("#raiting#", $row[raiting], $temp_form_enter); //zag $temp_form_enter=str_replace("#zag#", $row[zag], $temp_form_enter); //lit $temp_form_enter=str_replace("#lit#", $row[lit], $temp_form_enter); //text $temp_form_enter=str_replace("#text#", $row[text], $temp_form_enter); //autor $temp_form_enter=str_replace("#autor#", $row[autor], $temp_form_enter); //скрытые $temp_form_enter=str_replace("#id#", $row[id], $temp_form_enter); $temp_form_enter=str_replace("#raz#", $id_raz_cur, $temp_form_enter); //загрузка списка шаблонов $query= "SELECT * FROM $table_shablons WHERE cat_or_id = 0";$result1= MYSQL_QUERY($query);$number1 = MYSQL_NUMROWS($result1); while($row1 = mysql_fetch_array($result1)) { if($row[id_shablon]==$row1[id_shablon]){$sel_text=" selected ";}else{$sel_text="";}//echo"$row[id_shablon]==$row1[id_shablon]
"; $text_shablon .=""; }mysql_free_result($result1); $temp_form_enter=str_replace("#shablon#", $text_shablon, $temp_form_enter); //title desc keyw $temp_form_enter=str_replace("#title#", $row[title], $temp_form_enter); $temp_form_enter=str_replace("#desc#", $row[desc], $temp_form_enter); $temp_form_enter=str_replace("#keyw#", $row[keyw], $temp_form_enter); // дополнительные поля // показать список всех $query= "SELECT * FROM $table_dop_info order by id asc ";$result= MYSQL_QUERY($query);$number = MYSQL_NUMROWS($result); //echo"$query"; //while($row = mysql_fetch_array($result)){ for($i=0;$i<20;$i++){ $name = @mysql_result($result,$i,"name"); $j=$i+1;$value=$row["dop_info_{$j}"]; if(strlen($name)){ $count_use_dop++; $dop_info_text.="
$name:
    

"; } } $temp_form_enter=str_replace("#dop_info#", $dop_info_text, $temp_form_enter); $main_text=$temp_form_enter; echo"$main_text $temp_text $war_mes_text"; exit; //создание нового if($id_edit =="new"){ $sort_write_new= Date('U', time()); $querywrite = "INSERT INTO $table_main(hide,date,sort) VALUES ('1','$sort_write_new','$sort_write_new') "; $resultwrite= MYSQL_QUERY($querywrite); $id_edit=mysql_insert_id($id_conect); } if(key_exists("id",$_POST)){ $id_write = htmlspecialchars($_POST["id"], ENT_QUOTES);} if(key_exists("idp",$_POST)){ $idp_write = htmlspecialchars($_POST["idp"], ENT_QUOTES);} if(key_exists("razdel",$_POST)){ $razdel_write = htmlspecialchars($_POST["razdel"], ENT_QUOTES);} if(key_exists("news",$_POST)){ $news_write = htmlspecialchars($_POST["news"], ENT_QUOTES);} if(key_exists("topnews",$_POST)){ $topnews_write = htmlspecialchars($_POST["topnews"], ENT_QUOTES);} if(key_exists("texts",$_POST)){ $texts_write = htmlspecialchars($_POST["texts"], ENT_QUOTES);} if(key_exists("photo",$_POST)){ $photo_write = htmlspecialchars($_POST["photo"], ENT_QUOTES);} if(key_exists("video",$_POST)){ $video_write = htmlspecialchars($_POST["video"], ENT_QUOTES);} if(key_exists("audio",$_POST)){ $audio_write = htmlspecialchars($_POST["audio"], ENT_QUOTES);} if(key_exists("arhive",$_POST)){ $arhive_write = htmlspecialchars($_POST["arhive"], ENT_QUOTES);} if(key_exists("hide",$_POST)){ $hide_write = htmlspecialchars($_POST["hide"], ENT_QUOTES);} if(key_exists("prosmotrov",$_POST)){ $prosmotrov_write = htmlspecialchars($_POST["prosmotrov"], ENT_QUOTES);} if(key_exists("komentariev",$_POST)){ $komentariev_write = htmlspecialchars($_POST["komentariev"], ENT_QUOTES);} if(key_exists("day",$_POST)){ $day_w = htmlspecialchars($_POST["day"], ENT_QUOTES); $mon_w = htmlspecialchars($_POST["mon"], ENT_QUOTES); $year_w = htmlspecialchars($_POST["year"], ENT_QUOTES); $hour_w = htmlspecialchars($_POST["hour"], ENT_QUOTES); $min_w = htmlspecialchars($_POST["min"], ENT_QUOTES); $data_write = date("U",mktime ( $hour_w, $min_w , 0 , $mon_w ,$day_w , $year_w )); } if(key_exists("1day",$_POST)){ $day_w1 = htmlspecialchars($_POST["1day"], ENT_QUOTES); $mon_w1 = htmlspecialchars($_POST["1mon"], ENT_QUOTES); $year_w1 = htmlspecialchars($_POST["1year"], ENT_QUOTES); $hour_w1 = htmlspecialchars($_POST["1hour"], ENT_QUOTES); $min_w1 = htmlspecialchars($_POST["1min"], ENT_QUOTES); $sort_write = date("U",mktime ( $hour_w1, $min_w1 , 0 , $mon_w1 ,$day_w1 , $year_w1 )); } if(key_exists("url",$_POST)){ $url_write = htmlspecialchars($_POST["url"], ENT_QUOTES);} if(key_exists("region",$_POST)){ $region_write = htmlspecialchars($_POST["region"], ENT_QUOTES);} if($id_write>1){$id_set=$id_write;}else{$id_set=$id_edit;} test_folder($id_set,$id_lan); //сохранение if($id_write>0){ //проверить есть ли такая запись в базе $sort_add=""; $query= "SELECT id,sort FROM $table_main WHERE id=$id_write "; $result= MYSQL_QUERY($query);$number = MYSQL_NUMROWS($result); if($number>=1){ if(mysql_result($result,0,1)<$data_write) {$sort_add="`sort` = '$data_write',";} else{ $sort_add="`sort` = '$sort_write',"; } $querywrite = " UPDATE `optimist_main` SET `idpodraz` = '$idp_write', `razdel` = '$razdel_write', `news` = '$news_write', `top_news` = '$topnews_write', `statia` = '$texts_write', `photo` = '$photo_write', `video` = '$video_write', `id_user` = '$redactor_write', `arhive` = '$arhive_write', `date` = '$data_write', $sort_add `prosmotrov` = '$prosmotrov_write', `komentariev` = '$komentariev_write', `audio` = '$audio_write', `hide` = '$hide_write', `url` = '$url_write' WHERE id ='$id_write' ; "; }else{ //$querywrite = "INSERT INTO $table_text( id, id_lan, zag, text) VALUES ('$id_write', '$id_lan', '$zag_write', '$text_write') "; } $resultwrite= MYSQL_QUERY($querywrite); $id_edit=$id_write; $test=save_group ($id_edit,1); include("clear_cashe.html"); //echo"../!arrays/main/{$id_write}.arr
"; //@unlink("../!arrays/cur/{$id_write}.arr"); //@unlink("../../rus.4post.com.ua/!arrays/cur/{$id_write}.arr"); //@unlink("../!arrays/razdel.arr"); //@unlink("../../rus.4post.com.ua/!arrays/razdel.arr"); //@unlink("../!arrays/more/{$id_write}.arr"); //@unlink("../../rus.4post.com.ua/!arrays/more/{$id_write}.arr"); //echo" $querywrite
"; } //echo"$query 0.03
"; //$query= "SELECT $table_main.id, $table_lit.zag FROM $table_main,$table_lit where $table_lit.id=$table_main.id limit 100,100"; //загрузка списка всех разделов $query= "SELECT t1.id,t1.idpodraz,$table_lit.zag FROM $table_lit,(SELECT * FROM $table_main where razdel='1' order by sort desc ) as t1 where t1.id=$table_lit.id and $table_lit.id_lan = '1'";$result1= MYSQL_QUERY($query);$number1 = MYSQL_NUMROWS($result1); while($row1 = mysql_fetch_array($result1)) {$f1_a[$row1[1]][$row1[0]]=$row1[2];$razdel_all_array[$row1[0]]=$row1[2];}mysql_free_result($result1); //загрузка списка всех редакторов $query= "SELECT id_redactor ,name FROM $table_redactors ";$result1= MYSQL_QUERY($query);$number1 = MYSQL_NUMROWS($result1); while($row1 = mysql_fetch_array($result1)) {$redactors_array[$row1[0]]=$row1[1];}mysql_free_result($result1); $query= "SELECT * FROM $table_main WHERE id=$id_edit"; //echo"$query
"; $result= MYSQL_QUERY($query);$number = MYSQL_NUMROWS($result); while($row = mysql_fetch_array($result)) { while ( list($key, $val) = each( $redactors_array )) { if($row[7]==$key){$add_text="selected";}else{$add_text="";} $redactor_text.=""; } $temp_form_enter=str_replace("#id#", $row[0], $temp_form_enter); $temp_form_enter=str_replace("#idp1#", find_podraz(0,"",$f1_a,-1,$row[1]), $temp_form_enter); if($row[2]==1){$temp_form_enter=str_replace("#razdel#"," checked ", $temp_form_enter);} if($row[3]==1){$temp_form_enter=str_replace("#news#"," checked ", $temp_form_enter);} if($row[4]==1){$temp_form_enter=str_replace("#texts#"," checked ", $temp_form_enter);} if($row[5]==1){$temp_form_enter=str_replace("#photo#"," checked ", $temp_form_enter);} if($row[6]==1){$temp_form_enter=str_replace("#video#"," checked ", $temp_form_enter);} $temp_form_enter=str_replace("#redactor#", $redactor_text, $temp_form_enter); if($row[8]==1){$temp_form_enter=str_replace("#arhive#"," checked ", $temp_form_enter);} //$temp_form_enter=str_replace("#data#", $row[9], $temp_form_enter); $day_b=date("d", $row[9]); $temp_form_enter=str_replace("#day#", $day_b, $temp_form_enter); $mon_b=date("m", $row[9]); $temp_form_enter=str_replace("#mon#", $mon_b, $temp_form_enter); $year_b=date("Y", $row[9]); $temp_form_enter=str_replace("#year#", $year_b, $temp_form_enter); $hour_b=date("H", $row[9]); $temp_form_enter=str_replace("#hour#", $hour_b, $temp_form_enter); $min_b=date("i", $row[9]); $temp_form_enter=str_replace("#min#", $min_b, $temp_form_enter); $day_b1=date("d", $row[12]); $temp_form_enter=str_replace("#1day#", $day_b1, $temp_form_enter); $mon_b1=date("m", $row[12]); $temp_form_enter=str_replace("#1mon#", $mon_b1, $temp_form_enter); $year_b1=date("Y", $row[12]); $temp_form_enter=str_replace("#1year#", $year_b1, $temp_form_enter); $hour_b1=date("H", $row[12]); $temp_form_enter=str_replace("#1hour#", $hour_b1, $temp_form_enter); $min_b1=date("i", $row[12]); $temp_form_enter=str_replace("#1min#", $min_b1, $temp_form_enter); $temp_form_enter=str_replace("#prosmotrov#", $row[10], $temp_form_enter); $temp_form_enter=str_replace("#komentariev#", $row[11], $temp_form_enter); //$temp_form_enter=str_replace("#sort#", $row[12], $temp_form_enter); if($row[13]==1){$temp_form_enter=str_replace("#audio#"," checked ", $temp_form_enter);} if($row[14]==1){$temp_form_enter=str_replace("#hide#"," checked ", $temp_form_enter);} if($row[15]==1){$temp_form_enter=str_replace("#topnews#"," checked ", $temp_form_enter);} $temp_form_enter=str_replace("#url#", $row[16], $temp_form_enter); } $main_text=$temp_form_enter; echo"$main_text $temp_text $war_mes_text"; echo" "; exit; ?>