File size: 2.85Kb
<?php
require('includes/header.php');
require('includes/utils.php');
require('includes/db.php');
require('includes/auth.php');
if(preg_match('/[^\w\.]/', $_GET['page']) || (isset($_POST['pagename']) && preg_match('/[^\w\.]/', $_POST['pagename'])))
{
?>
<wml>
<card id="error" title="error" ontimer="main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"><timer value="15"/>
<p align="center">
Неправильное имя страницы
</p>
</card>
</wml>
<?php
exit;
}
if(isset($_GET['action']) && $_GET['action'] == 'rename')
{
rename("$login/$_GET[page]", "$login/$_POST[pagename]");
$_GET['page'] = $_POST['pagename'];
}
if(isset($_GET['action']) && $_GET['action'] == 'delete')
{
unlink("$login/$_GET[page]");
?>
<wml>
<card id="added" title="added" ontimer="manager.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"><timer value="15"/>
<p>
Страница удалена<br/>
</p>
</card>
</wml>
<?php
exit;
}
?>
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="manager" title="Менеджер файлов">
<do type="options" name="main" label="Меню"><go href="main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"/></do>
<p>
name:<?php echo $_GET['page']?>, size:<?php echo filesize("$login/" . addslashes($_GET['page'])); ?> byte
<br/>*********<br/>
<a href="view.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>">Обзор</a><br/>
<a href="edit.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>">Редактировать</a><br/>
*********<br/>
<b>Переименовать</b><br/>
Имя страницы(без wml):<br/>
<input name="pagename" type="text" maxlength="20" value="<?php echo preg_replace('/\..*?$/',"", $_GET['page']); ?>" title="page"/><br/>
<anchor title="go">Ok<go href="pageview.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>&action=rename" method="post">
<postfield name="pagename" value="$(pagename).wml"/>
</go></anchor><br/>
*********<br/>
<a href="pageview.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>&action=delete">Удалить</a><br/>
*********<br/>
<a href="manager.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>">К списку</a><br/>
</p>
</card>
</wml>