2006-04-26 12:28:53 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
$Id: bro_editor.php,v 1.5 2005/05/03 14:49:06 anarcat Exp $
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
AlternC - Web Hosting System
|
|
|
|
Copyright (C) 2002 by the AlternC Development Team.
|
|
|
|
http://alternc.org/
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Based on:
|
|
|
|
Valentin Lacambre's web hosting softwares: http://altern.org/
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License (GPL)
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Original Author of file: Benjamin Sonntag
|
|
|
|
Purpose of file: Editor of the browser
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
require_once("../class/config.php");
|
|
|
|
|
2012-08-22 16:47:18 +00:00
|
|
|
$fields = array (
|
|
|
|
"editfile" => array ("request", "string", ""),
|
|
|
|
"texte" => array ("post", "string", ""),
|
|
|
|
"save" => array ("post", "string", ""),
|
|
|
|
"saveret" => array ("post", "string", ""),
|
|
|
|
"cancel" => array ("post", "string", ""),
|
|
|
|
"R" => array ("request", "string", ""),
|
|
|
|
);
|
|
|
|
getFields($fields);
|
|
|
|
|
2011-03-28 12:00:33 +00:00
|
|
|
$editfile=ssla($editfile);
|
2006-04-26 12:28:53 +00:00
|
|
|
$texte=ssla($texte);
|
|
|
|
|
|
|
|
$R=$bro->convertabsolute($R,1);
|
|
|
|
$p=$bro->GetPrefs();
|
|
|
|
|
2012-06-19 15:26:48 +00:00
|
|
|
if (isset($cancel) && $cancel) {
|
2006-04-26 12:28:53 +00:00
|
|
|
include("bro_main.php");
|
|
|
|
exit();
|
|
|
|
}
|
2012-06-19 15:26:48 +00:00
|
|
|
if (isset($saveret) && $saveret) {
|
2011-06-04 14:28:57 +00:00
|
|
|
if ($bro->Save($editfile,$R,$texte)) {
|
2012-10-31 12:56:32 +00:00
|
|
|
$error=sprintf(_("Your file %s has been saved"),$editfile)." (".format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s")).")";
|
2011-06-04 14:28:57 +00:00
|
|
|
} else {
|
|
|
|
$error=$err->errstr();
|
|
|
|
}
|
|
|
|
include("bro_main.php");
|
|
|
|
exit();
|
2006-04-26 12:28:53 +00:00
|
|
|
}
|
2012-06-19 15:26:48 +00:00
|
|
|
if (isset($save) && $save) {
|
2011-06-04 14:28:57 +00:00
|
|
|
if ($bro->Save($editfile,$R,$texte)) {
|
2012-10-31 12:56:32 +00:00
|
|
|
$error=sprintf(_("Your file %s has been saved"),$editfile)." (".format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s")).")";
|
2011-06-04 14:28:57 +00:00
|
|
|
} else {
|
|
|
|
$error=$err->errstr();
|
|
|
|
}
|
2006-04-26 12:28:53 +00:00
|
|
|
}
|
|
|
|
|
2009-09-08 05:29:38 +00:00
|
|
|
include_once("head.php");
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
?>
|
|
|
|
<p>
|
2012-06-19 15:26:48 +00:00
|
|
|
<?php if (isset($error) && $error) echo "<p class=\"error\">$error</p>"; ?>
|
2012-08-23 12:49:20 +00:00
|
|
|
<h3><?php echo _("File editing")." <code>$R/<b>$editfile</b></code><br />"; ?></h3>
|
2006-04-26 12:28:53 +00:00
|
|
|
</p>
|
2009-09-08 05:29:38 +00:00
|
|
|
<form action="bro_editor.php" method="post"><br />
|
2012-08-23 12:49:20 +00:00
|
|
|
<textarea class="int" style="font-family: <?php echo $p["editor_font"]; ?>; font-size: <?php echo $p["editor_size"]; ?>; width: 90%; height: 400px;" name="texte"><?php
|
|
|
|
$content=$bro->content($R,$editfile);
|
2012-08-29 07:25:33 +00:00
|
|
|
if (empty($content)) {
|
2013-01-31 17:00:39 +00:00
|
|
|
$error=_("This file is empty");
|
2012-08-29 07:25:33 +00:00
|
|
|
} else {
|
|
|
|
echo $content;
|
|
|
|
}
|
2011-06-04 14:28:57 +00:00
|
|
|
?></textarea>
|
2013-01-31 17:00:39 +00:00
|
|
|
<?php if (!empty($error)) echo "<p class=\"error\">".$error."</p>"; ?>
|
2011-03-28 12:00:33 +00:00
|
|
|
<input type="hidden" name="editfile" value="<?php echo str_replace("\"",""",$editfile); ?>" />
|
2009-09-08 05:29:38 +00:00
|
|
|
<input type="hidden" name="R" value="<?php echo str_replace("\"",""",$R); ?>" />
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
|
|
<input type="submit" class="inb" value="<?php __("Save"); ?>" name="save" />
|
2009-09-08 05:29:38 +00:00
|
|
|
<input type="submit" class="inb" value="<?php __("Save & Quit"); ?>" name="saveret" />
|
2006-04-26 12:28:53 +00:00
|
|
|
<input type="submit" class="inb" value="<?php __("Quit"); ?>" name="cancel" />
|
2009-09-08 05:29:38 +00:00
|
|
|
<br />
|
2006-04-26 12:28:53 +00:00
|
|
|
</form>
|
2011-05-18 20:26:12 +00:00
|
|
|
<?php include_once("foot.php"); ?>
|