Файл: ftp/edit11.php
Строк: 77
<?php
error_reporting(0);
$k=trim($_GET['k']); include("key.php");
$d=rawurldecode(trim($_GET['d'])); $n=rawurldecode(trim($_GET['n']));
if ($d==NULL) {$d="";} elseif ($d=="/") {$d="";} if ($n==NULL) {$n="";}
$p=trim($_GET['p']); if ($p==NULL) {$p=trim($_POST['p']);} $ed=trim($_GET['ed']);
$kdr=trim($_GET['kdr']); $ikdr=trim($_GET['ikdr']);
$rf=strtolower(preg_replace("~.*.([^.]*)~m","\1",$n));
$rd=rawurlencode($d); $rn=rawurlencode($n);
$d=str_replace(".|htaccess",".htaccess",$d);
$n=str_replace(".|htaccess",".htaccess",$n);
include("utf.php"); include("esc.php"); include("koi.php"); $v=$_GET['ln'];
require_once '../api_core/apicms_system.php';
require_once '../api_core/head.php';
ftp_get($ftp,"data/$k.ed","$d/$n",FTP_BINARY);
$fl=@file("data/$k.ed");
$file_opt = 'true';
if (isset($_GET['n']) && isset($_GET['id']) && isset($_GET['edit']) || isset($_GET['path']) && isset($_GET['id']) && isset($_GET['add']) || isset($_GET['path']) && isset($_GET['id']) && isset($_GET['delete_str'])) {
$post_str = trim($_POST['str_txt'])."n";
$file_path = htmlspecialchars($_GET['path']);
$id_str = intval($_GET['id']);
$str = file(ROOT.'/'.$_GET['path']);
if (isset($_GET['add'])) {
$str[$id_str] .= $post_str;
} else if (isset($_GET['edit'])) {
$str[$id_str] = $post_str;
} else if (isset($_GET['delete_str'])) {
unset($str[$id_str]);
}
$files = fopen(ROOT.$file_path, "w");
foreach($str as $key => $value) {
fwrite($files, $value);
}
fclose($files);
}
if (isset($_GET['path']))
$path = ROOT.'/'.trim($_GET['path']);
else {
header("Location: /sman/index.php");
exit;
}
$files = file($path);
if (count($files) == 0) {
echo '<center><a href="?id=0&path='.$_GET['path'].'&add_strs">Добавить строку</a></center>';
$files = array(" ");
}
for($i=$min_str; $i<=$max_str; $i++) {
if (!empty($files[$i])) {
$color = NULL;
$string = 0;
if (isset($_GET['id']) && isset($_GET['add'])) {
$string = 1;
}
if (isset($_GET['id']) && $_GET['id']+$string == $i && isset($_GET['to_str'])) {
echo '<a name = "to_str"></a>';
$color = '<span style = "color: red;">';
}
echo '<br />';
echo '<font color = "red">'.$i.')</font> <a href="?id='.$i.'&path='.htmlspecialchars($_GET['path']).'&page='.intval($_GET['page']).'&edit_str#to_edit_str">';
echo $color.htmlspecialchars($files[$i]).'</span></a> ';
echo '<a href="?id='.$i.'&path='.$_GET['path'].'&page='.intval($_GET['page']).'&add_str#to_add_str"><img src = "/sman/style/icons/add_str.png" height = "13" width = "13"></a> <a href="?id='.$i.'&path='.$_GET['path'].'&page='.intval($_GET['page']).'&'.rand(0, 9999999).'&delete_str&to_str#to_str"><img src = "/sman/style/icons/delete_str.png" height = "13" width = "13"></a><br />';
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] == $i && isset($_GET['edit_str']) || isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] == $i && isset($_GET['add_str']) || isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] == 0 && isset($_GET['add_strs'])) {
if (isset($_GET['add_str'])) {
$get = 'add';
$input = 'Добавить';
$files[$i] = NULL;
} else if (isset($_GET['edit_str'])) {
$get = 'edit';
$input = 'Изменить';
}
echo '<a name = "to_edit_str"></a>';
if (isset($_GET['id']) && $_GET['id'] == $i && isset($_GET['add_str'])) {
echo '<a name = "to_add_str"></a>'
;
}
echo '<br />';
echo '<form action = "?path='.htmlspecialchars($_GET['path']).'&page='.intval($_GET['page']).'&id='.$i.'&'.$get.'&to_str#to_str" method = "POST">';
echo '<center><textarea name = "str_txt">'.trim($files[$i]).'</textarea><br />';
echo '<br />';
echo '<input type = "submit" value = "'.$input.'"></center><br />';
}
}
}
include_once '../../sman/includs/paginator.php';
echo '<br />';
echo '<div><a href="show.php?path='.htmlspecialchars($_GET['path']).'"><img src = "/sman/style/icons/show.png"> Посмотреть</a></div>';
include_once '../../sman/includs/foot.php';
?>