createpage.php

File Type: php File Location: monofiles/ File name: createpage.php
<?php 
        
    
include_once 'data_connect.php';
    include 
'log.php';
    
    if(
get_account($_SESSION['userID'])['rights'] != 'administrator'){
        
header('Location:panel.php');
        exit();
    }
?>
<!doctype html>
<html>
<head>
<title>Page</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="cmstyle.css">
<style type="text/css">@charset "utf-8"; .main{left:0;max-width:initial}</style>
<?php include 'csstheme.php' ?>
<script type="text/javascript">
    function loadc() {
        var _code = document.getElementById("output").value;
        document.getElementById("editor").innerHTML = _code;
    }
</script>
<script type="text/javascript" src="javascript/save.js"></script>
</head>
<body>

    <?php
    
    
include 'mypanel.php';

    if ( isset(
$_GET['savedname']))  {
        
        
$savedfile $_GET['savedname'];
        
        if (!
file_exists($savedfile)){
            print 
'<div class="main">Error: Information about the file cannot be found</div>';
            exit;
        }
        
        
$xmlfile simplexml_load_file($savedfile);
    
        
$xmlbase basename($savedfile,'.xml');
        
        
$xmltitle $xmlfile->pageinfo->page->title;
        
$xmldescription $xmlfile->pageinfo->page->description;
        
$xmlfilename $xmlfile->pageinfo->page->filename;
        
$xmlcontent $xmlfile->pageinfo->page->content;
        
$include $xmlfile->pageinfo->page->menulink;
    }
    
?>
    <div class="main">
        
        <form action="pagepost.php" method="post" id="mainform" target="resultt"></form>
        
            <div id="action-block">
                
                
                
                <!-- iframe -->
                <div id="result-block">
                    <iframe name="resultt" id="result" src="<?php echo (isset($oscategory)) ? 'post.php' 'pagepost.php' ?>" onload="iframeLoad();"></iframe>
                </div>
                
                
                
                <!-- SAVE -->
                <input name="button" type="submit" id="submit-page" class="stylish-button" value="Save" onClick="postsave();" form="mainform">
                
                
                
                <!-- Unique id hidden -->
                <input type="text" id="uuid" name="uniqueid" value="<?php print (isset($xmlbase)) ? $xmlbase time() ?>" form="mainform" hidden>
                
                
                
                <!-- Title -->
                <textarea name="title" class="grow" id="headline-page" form="mainform" placeholder="Title"><?php
                    
                    
include 'en_code.php';

                    if (isset(
$xmltitle))
                        print 
load_xml($xmltitle

                
?></textarea>
            
                
                <?php 
                        
include 'text-editor.php'
                
?>
                <div style="height:60px"></div>
                
                
                
                <!-- Meta description -->
                
                <label for="description-page">Meta description</label>
                <textarea name="meta-description" class="mini-editor" id="description-page" form="mainform"><?php

                        
if(isset($xmldescription))
                            print 
$xmldescription
                        
                ?>
</textarea>
                
                
                <div class="clear" style="height:30px"></div>
                
                
                
                <!-- Filename -->
                
                <label for="filename-page" style="clear:both">Filename</label>
                <textarea type="text" name="filename" id="filename-page" form="mainform"><?php

                        
if(isset($xmlfilename))
                            print 
$xmlfilename
                        
                ?>
</textarea>
                
            </div>
        </div>
        
        <div style="height:80px"></div>
        
    </div>
    
    
    
    
    
    <script type="text/javascript">
        function warning(){
        var d = document.getElementById("page");
        if ( d.className == "nocontent" ){
        d.className = d.className + " warn";
        }
    }    
        document.getElementById("headline-page").onkeyup = function() { warning(); }
        document.getElementById("headline-page").onpaste = function() { warning(); }
        document.getElementById("description-page").onkeyup = function() { warning(); }
        document.getElementById("description-page").onpaste = function() { warning(); }
        document.getElementById("filename-page").onkeyup = function() { warning(); }
        document.getElementById("filename-page").onpaste = function() { warning(); }
        document.getElementById("output").onkeyup = function() { warning(); }
        document.getElementById("output").onpaste = function() { warning(); }

    </script>
    <script type="text/javascript">
    window.onbeforeunload = function(e) {
        if (document.querySelector(".warn") !== null) return false;
    }

    addEventListener("load",loadc);

    </script>
</body>
</html>