| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | $myfile = $base."static".$path.$language['file'].".txt"; |
|---|
| 6 | if (!file_exists($myfile)) { |
|---|
| 7 | $myfile = $base."static$path.txt"; |
|---|
| 8 | |
|---|
| 9 | if (!file_exists($myfile)) { |
|---|
| 10 | header("HTTP/1.1 404 Not Found"); |
|---|
| 11 | $smarty->assign("body", file_get_contents($base."static/404.txt")); |
|---|
| 12 | $smarty->assign("pathlist", array("", "Error")); |
|---|
| 13 | $smarty->assign("title", "File not found"); |
|---|
| 14 | return; |
|---|
| 15 | } |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | $permission = "html"; |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | if (@$_REQUEST['action']=="Save" && $session->groups[$permission]) { |
|---|
| 24 | file_put_contents($myfile, $_REQUEST['body'], LOCK_EX); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | if (isset($pathlist[2])) |
|---|
| 28 | $title = $pathlist[2]; |
|---|
| 29 | elseif (isset($pathlist[1])) |
|---|
| 30 | $title = $pathlist[1]; |
|---|
| 31 | else |
|---|
| 32 | $title = "Static Page Producer"; |
|---|
| 33 | |
|---|
| 34 | $body = file_get_contents($myfile); |
|---|
| 35 | $modified = filectime($myfile); |
|---|
| 36 | |
|---|
| 37 | $smarty->assign("title", $title); |
|---|
| 38 | $smarty->assign("modified", date("r", $modified)); |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | if (isset($session->groups[$permission])) { |
|---|
| 43 | |
|---|
| 44 | $smarty->assign("editable", true); |
|---|
| 45 | |
|---|
| 46 | if (@$_REQUEST['action']=="edit") { |
|---|
| 47 | $smarty->assign("editcontent", htmlentities($body)); |
|---|
| 48 | $body = $smarty->fetch('static_edit.tpl'); |
|---|
| 49 | $smarty->assign("action", $_REQUEST['action']); |
|---|
| 50 | } |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | $smarty->assign("body", $body); |
|---|
| 54 | |
|---|
| 55 | ?> |
|---|