Show sourcecode
The following files exists in this folder. Click to view.
test/
.idea/
audio/
blokket.php
blokket2.php
dbtest.php
edit-stylesheet-process.php
edit-stylesheet.php
edit-stylesheet_original.php
ex/
favorites.php
img/
incl/
kmom03_get.php
kmom03_getform.php
kmom03_postform.php
kmom03_validate.php
login.php
login_MOS.php
me.php
report.php
select-stylesheet-process.php
select-stylesheet.php
select-stylesheet_original.php
social.php
src/
style/
style-default.php
style-default_original.php
style.php
style_original.php
test.php
viewsource.php
edit-stylesheet_original.php
1 lines ASCII Unix (LF)
<?php
$text = null;
$selected = null;
if(isset($_POST['stylesheet-editor-text']))
{
$selected = $_SESSION['stylesheet-in-editor'];
writeOverFileContents("style/" . $selected, strip_tags($_POST['stylesheet-editor-text']));
// TODO Make it so that if one has edited the stylesheet currently selected for the site, the site is to be refreshed with the edited stylesheet.
}
if(isset($_POST['stylesheet-editor-selection']))
{
$selected = strip_tags($_POST['stylesheet-editor-selection']);
$_SESSION['stylesheet-in-editor'] = $selected;
}
if(isset($selected) & $selected != "Select stylesheet")
$text = getFileContents("style/" . $selected);
?>
<h1>Stylesheet editor</h1>
<fieldset>
<form method="post">
<legend>Available stylesheets:</legend>
<select name="stylesheet-editor-selection" onchange='form.submit();'>
<?php
$selected = null;
$path = "style";
$filenames = readDirectory($path);
echo "<option value='" . "Select stylesheet" . "' ' selected>" . "Select stylesheet" . "</option>";
foreach ($filenames as $filename)
{
if($selected == $filename)
echo "<option value='" . $filename . "' selected>" . $filename . "</option>";
else
echo "<option value='" . $filename . "'>" . $filename . "</option>";
}
?>
</select>
</form>
<form method="post">
<p><textarea rows="4" cols="50" name="stylesheet-editor-text"><?php echo $text; ?></textarea></p>
<p><input type="submit" name="doSave" value="Save changes"></p>
</form>
<?php
if(isset($selected) & $selected != "Select stylesheet")
{
if (substr(sprintf('%o', fileperms("style/" . $selected)), -4) != 666)
echo "<p>The selected stylesheet cannot be edited.</p>";
}
?>
</fieldset>