<?php


    # Menu and page structure
    include_once 'data_connect.php';

    
    # Clear error buffer and disable errors
    libxml_clear_errors();
    libxml_use_internal_errors(true);
    
    
    $xmls = new getXMLSettings();

    
    # Account info 
    $log_info = get_log();
    
    if (!isset($acc_info))
        $acc_info = get_account($_SESSION['userID']);
    
    $monrights = $acc_info['rights'];
    $user = $_SESSION['username'];
    $urlicon = '../images/'.$acc_info['urlicon'];
    $usericon = is_file($urlicon) ? $urlicon : $acc_info['icon'];
    $c = $monrights == 'administrator' ? $log_info['posts'] : myPosts()[0];
    $d = $log_info['pages'];

    $lgparam = (get_included_files())

    
?>
<div class="topbar topbg"></div>
<div id="top">
    <!-- Left section -->
    <div class="editbar">
        <div id="dropdown" class="wico">
            <div id="dropdown-content" class="dropcon">
        
                
                <!-- Navigation menu -->

                <a href="opensaved.php" id="posts" class="dropdown-title"><span class="text">Posts<?php print '<span class="dinf">'.$c.'</span>' ?></span></a>
                <a href="newpage.php" id="newpost" class="dropdown-title"><span class="text">Write post</span></a>
                <a href="category.php" id="categories" class="dropdown-title"><span class="text">Categories</span></a>
                <div class="clear clearmenu"></div>


                <?php if ($monrights == 'administrator') : ?>

                <a href="createpage.php" id="newpage" class="dropdown-title" title="New page"><span class="text">New page</span></a>
                <a href="pages.php" id="allpages" class="dropdown-title" title="All pages"><span class="text">All pages<?php print '<span class="dinf">'.$d.'</span>' ?></span></a>
                <div class="clear clearmenu"></div>
                <a href="general.php" id="settings" class="dropdown-title" title="Settings"><span class="text">Settings</span></a>
                <a href="uploads.php" id="images" class="dropdown-title" title="Images"><span class="text">Images</span></a>
                <a href="accmanage.php" id="accounts" class="dropdown-title" title="User accounts"><span class="text">Accounts</span></a>
                <div class="clear clearmenu"></div>
                <a href="plugins.php" id="plugins" class="dropdown-title" title="Plugins"><span class="text">Plugins</span></a>
                <?php else : ?>
                <a href="generaluser.php" id="settings" class="dropdown-title" title="Settings"><span class="text">Settings</span></a>
                <a href="uploads.php" id="images" class="dropdown-title" title="Images"><span class="text">Images</span></a>
                <div class="clear clearmenu"></div>
                <a href="plugins.php" id="plugins" class="dropdown-title" title="Plugins"><span class="text">Plugins</span></a>
                <?php endif ?>
                <span class="dropdown-title menu-separator">&nbsp;:::</span>
            </div>    
        </div>
        <!-- logo -->
        <div class="logo">
            <a href="../" id="logolink" title="Visit website" target="_blank"><?php print $xmls->title ?>&nbsp;</a>
        </div>
    </div>        
    
    <div class="user-info">
        <img class="panelicon" src="<?php print $usericon ?>" title="<?php print $user ?>">
        <div class="useradmin">
            <input id="general-submit" type="submit" value="Save" onmousedown="this.blur()" name="submitted" form="MONform">
            <a id="lgcon" href="?logout=1" onclick="this.blur()" ondragstart="this.blur()" title="Logout">Logout</a>
            <span id="user">
                <span class="username"><?php print $user ?></span>
            </span>
        </div>
    </div>
</div>