Размер файла: 2.81Kb
- <?PHP
- define('SHCMS', true);
- include_once'../system/inc/basic_settings.php';
- $shcmsengine['title'] = 'SHCMS Engine - Управление файлами';
- include_once'../template/head.php';
- registrat();
- $adminka->admin();
-
- if($_POST['submit'])
- {
- if($_POST['filename']) {
- $data = $_POST['fileentry'];
- $data = get_magic_quotes_gpc() ? stripslashes($data) : $data;
- $fp = fopen($_POST['filename'], 'w');
- fwrite($fp, $data);
- fclose($fp);
- messag('Настройки файла '.$_POST['filename'].'');
- }
- }
- switch($act):
- case '':
-
- if($_GET['path']) {
- $path=$_GET['path'];
- }
- else {
- $path=$_GET['path']='../template/designs/';
- }
- if(strlen($_SERVER['DOCUMENT_ROOT'])<strlen($path))
- {
- echo '<p class="posts"><a href="?path='.substr($path, 0, strrpos($path, '/')).'"><strong>../ назад</strong></a></p>';
- }
- foreach(glob($path.'/*') as $obj) {
- $filename=substr($obj, strlen($path)+1, strlen($obj)-strlen($path));
- if(is_dir($obj)) {
- echo '<p class="posts"><img src="../template/icon/dir.png"> <a href="?path='.$obj.'">'.$filename.'/</a></p>';
- }
- else {
- if($_GET['path']) {
- echo '<p class="posts"><img src="../template/icon/edit.png"> <a href="?act=edit&path='.$_GET['path'].'&file='.$obj.'">'.$filename.'</a></p>';
- }
- else{
- echo '<p class="posts"><a href="?file='.$obj.'"></a></p>';
- }
- }
- }
- break;
- case 'edit':
- if($_GET['path']){
- echo '<form action="?act=edit&path='.$_GET['path'].'&file='.$_GET['file'].'" method=post>';
- }
- else {
- echo '<form action="?" method="post">';
- }
-
- if($_GET['file']) {
- $filename=$_GET['file'];
- echo '<div class="posts">Путь файла: <b>'.$filename.'</b><br/>';
- echo 'Для поиска по шаблону используйте горячие клавиши: Ctrl-F начать поиск, Ctrl-G продолжить поиск.</div>';
- echo '<input type=hidden name=filename value="'.$filename.'">';
- }
- else {
- echo 'Ничего не выбрано';
- }
- echo '<textarea rows=40; style="width:98%; height:300px;font-size:14px;" name=fileentry>';
- if($_GET['file']) {
- $filerows=file($filename);
- foreach($filerows as $value) {
- echo htmlspecialchars($value);
- }
- }
- echo '</textarea>';
- echo '<input type=submit value="Сохранить" name="submit" style="margin-top:10px;">';
- echo '</form>';
- break;
-
- endswitch;
-
-
-
-
-
-
- include_once'../template/foot.php';
- ?>