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.php

1 lines ASCII Unix (LF)
1
<?php
$text = null;
$selected = null;
$saved = null;

if(isset($_POST['stylesheet-editor-text']))
{
    $selected = $_POST['selected-stylesheet'];
    if($selected != "Select stylesheet")
    {
        if (substr(sprintf('%o', fileperms("style/" . $selected)), -4) == 666) {
            writeOverFileContents("style/" . $selected, strip_tags($_POST['stylesheet-editor-text']));
            $saved = true;
        } else
            $saved = false;
    }
}

if(isset($_POST['stylesheet-editor-selection']))
{
    $selected = strip_tags($_POST['stylesheet-editor-selection']);
}

if(isset($selected) & $selected != "Select stylesheet")
    $text = getFileContents("style/" . $selected);
?>

<h1>Stylesheet editor</h1>
<fieldset>
<form method="post">
    <p><label for="stylesheet-editor-selection">Available stylesheets:</label><br>
    <select id="stylesheet-editor-selection" name="stylesheet-editor-selection" onchange='form.submit();'>
        <?php
        $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></p>
</form>

<form method="post">
    <p><textarea rows="4" cols="50" name="stylesheet-editor-text"><?php echo $text; ?></textarea></p>
    <input type="hidden" name="selected-stylesheet" value="<?php echo $selected; ?>">
    <p><input type="submit" name="doSave" value="Save changes">
    <input type="reset" name="reset" value="Reset"></p>
</form>

<?php
if(isset($selected) & $selected != "Select stylesheet")
{
    if (substr(sprintf('%o', fileperms("style/" . $selected)), -4) != 666)
        echo "<p class='notice'>The selected stylesheet cannot be edited.</p>";

    if(isset($saved))
    {
        if ($saved == true)
            echo "<p class='success'>The changes were saved.</p>";
        else if ($saved == false)
            echo "<p class='error'>The changes were not saved.</p>";
    }
}
?>
</fieldset>