Файл: modules/pages/admin.php
Строк: 216
<?php
if ($Siteman->userinfo["level"] >= 4) {
switch ($mdo) {
case "editpage":
if (($page = $db->select(array("table" => "pages","where" => array("name = ".$_GET["page"])))) !== FALSE) {
if ($Siteman->userinfo["id"] == $page[0]["owner"] || $Siteman->userinfo["level"] == 5) {
$content = $db->select(array("table" => $_GET["page"],"db" => "pages"));
$in_page = htmlspecialchars($content[0]["content"]);
echo"<b><big>Editing page '".$page[0]["title"]."' (".$page[0]["name"].")</big></b><br /><br />
<script type="text/javascript" src="public/fck/fckeditor.js"></script>
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'content', '100%', 400 ) ;
oFCKeditor.BasePath = "public/fck/";
function copycontent() {
if (document.forms['mainform'].content.value.indexOf('<!-- REMOVE -->') == -1) {
if (document.forms['mainform'].content.value.length == 0) {
document.forms['mainform'].content.value = "<br /><br /><br />";
}
document.forms['mainform'].content.value = "<table cellspacing='0' cellpadding='0' width='100%' height='100%' border='0'><tr><td class='content' valign='top'><!-- REMOVE -->" + document.forms['mainform'].content.value + "<!-- REMOVE --></td></tr></table>";
}
}
</script>
<form action="admin.php?module=pages&mdo=save&page=".$page[0]["name"]."" method="post" name="mainform" id="mainform">
<table cellspacing="0" cellpadding="2"><tr><td>Page Title (Will appear as the heading on the page)</td><td><input type="text" name="title" size="40" value="".htmlspecialchars($page[0]["title"])."" /></td></tr>
<tr><td>User level required to view the page</td><td>";
draw_levelbox($page[0]["level"]);
echo"</td></tr>
<tr><td>Keywords (used by the search section, separate using comma)<br />e.g. keyword1,keyword2,keyword3 etc.</td><td><input type="text" name="keywords" size="40" value="".htmlspecialchars($page[0]["keywords"])."" /></td></tr>
<tr><td colspan="2">Page content (note: using PHP code is no longer supported for security reasons. If you want to use PHP, you should create a module instead)</td></tr>
<tr><td colspan="2"><textarea rows="25" cols="".$Siteman->settings["textarea_width"]."" name="content" id="content">$in_page</textarea></td></tr>
<tr><td colspan="2"><table cellspacing="0" cellpadding="2"><tr><td><input type="submit" name="save" value="Save" /></td><td><input type="submit" name="save" value="Save and Exit" /></td><td><input type="button" value="Cancel Edit" onclick="document.forms['cancel'].submit()" /></td><td><input type="button" value="Open page" onclick="document.forms['open'].submit()" /></td><td><input type="button" value="Use FCKeditor" onclick="copycontent();oFCKeditor.ReplaceTextarea();this.disabled=1;" /></td></tr></table></td></tr></table></form><form action="index.php?module=pages&page=".$_GET["page"]."" name="open" id="open" target="_blank" method="post"></form>
<form action="admin.php?module=pages" method="post" name="cancel" id="cancel"></form><br />
<b>Note:</b> When editing the source code in FCKeditor, do not remove the <!-- REMOVE --> tags, or the HTML code before the first one or after the last one. Please allow FCKeditor some time to load after clicking 'Use FCKeditor'.<br />
FCKeditor was developed by Frederico Caldeira Knabben, see <a href="http://www.fckeditor.net" target="_blank">fckeditor.net</a>";
}
}
break 1;
case "delpage":
$page = $_GET["page"];
$pageinfo = $db->select(array("table" => "pages","db" => "siteman","where" => array("name = $page")));
$owner = $db->select(array("table" => "users","where" => array("id = ".$pageinfo[0]["owner"])));
if ($Siteman->userinfo["level"] > $owner[0]["level"] || $Siteman->userinfo["id"] == $owner[0]["id"]) {
if ($page != "index") {
echo"<br /><br />Are you sure you want to delete the page ".$pageinfo[0]["title"]." ($page)?<br /><br />
<table cellspacing="0" cellpadding="2"><tr><td><form action="admin.php?module=pages&mdo=dodelpage&page=$page" method="post"><input type="submit" value="Yes" /></form></td>
<td> </td>
<td><form action="admin.php?module=pages" method="post"><input type="submit" value="No " /></form></td></tr></table>";
}
}
break 1;
default:
if ($Siteman->userinfo["level"] >= 4) {
echo"<b>Create New Page</b> (To go directly to editing an existing page, you can enter the filename here)<br />
<form action="admin.php?module=pages&mdo=create" method="post">
<table cellspacing="0" cellpadding="2"><tr><td>Filename</td>
<td><input type="text" name="name" size="30" /></td>
<td><input type="submit" value="Create" /></td></tr></table></form><br /><br />
<table cellspacing="1" cellpadding="2"><tr><td>Actions</td><td>Filename</td><td>Title</td><td>Owner</td><td>Level</td><td>Clicks</td><td>Last updated</tr>";
$pages = $db->select(array("table" => "pages","db" => "siteman"));
$pageclicks = $db->select(array("table" => "pages_clicks","db" => "siteman"));
$clicks = array();
foreach ($pageclicks as $cl) {
$nm = $cl["name"];
$clicks[$nm] = $cl["clicks"];
}
foreach ($pages as $page) {
$owner = $db->select(array("table" => "users","db" => "siteman","select" => array("username"),"where" => array("id = ".$page["owner"])));
$name = $page["name"];
echo"<tr><td>";
if ($Siteman->userinfo["id"] == $page["owner"] || $Siteman->userinfo["level"] == 5) {
echo"<a href="admin.php?module=pages&mdo=editpage&page=".$page["name"]."">Edit</a> - <a href="admin.php?module=pages&mdo=delpage&page=".$page["name"]."">Delete</a> - <a href="admin.php?module=pages&mdo=rcc&page=".$page["name"]."">Reset Clicks</a>";
}
echo"</td><td>".$page["name"]."</td><td>".$page["title"]."</td><td>".$owner[0]["username"]."</td><td>".$page["level"]."</td><td>".$clicks[$name]."</td><td>".date($Siteman->settings["long_dateformat"],$page["last_edited"]+$Siteman->settings["timezone_offset"])."</tr>";
}
echo"</table>";
}
break 1;
}
}
?>