예제 #1
0
파일: page.php 프로젝트: decima/M2-platine
 public static function content($c = null)
 {
     if ($c != null) {
         self::$content = $c;
     }
     return self::$content;
 }
예제 #2
0
파일: page.php 프로젝트: decima/M2-platine
* 
*/
?>
            <div class="">
                <?php 
if (page::title() != NULL) {
    ?>
                    <h1 class="page_title"><?php 
    echo page::title();
    ?>
</h1>
                <?php 
}
?>
                <?php 
echo page::content();
?>
            </div>
        </div>
        <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
        <script src="<?php 
echo page::url("theme/united/js/jquery.js");
?>
"></script>
        <!-- Include all compiled plugins (below), or include individual files as needed -->
        <script src="<?php 
echo page::url("theme/united/js/bootstrap.min.js");
?>
"></script>
    </body>
예제 #3
0
function client()
{
    global $main;
    global $db;
    global $style;
    global $type;
    global $email;
    ob_start();
    // Stop the output buffer
    if (!$main->getvar['page']) {
        $main->getvar['page'] = "home";
    }
    $query = $db->query("SELECT * FROM `<PRE>clientnav` WHERE `link` = '{$main->getvar['page']}'");
    $page = $db->fetch_array($query);
    $header = $page['visual'];
    $link = "pages/" . $main->getvar['page'] . ".php";
    if (!file_exists($link)) {
        $html = "Seems like the .php is non existant. Is it deleted?";
    } else {
        //If deleting something
        if (preg_match("/[\\.*]/", $main->getvar['page']) == 0) {
            include $link;
            $content = new page();
            // Main Side Bar HTML
            $nav = "Sidebar";
            if (!$db->config("delacc")) {
                $sub = $db->query("SELECT * FROM `<PRE>clientnav` WHERE `link` != 'delete' ORDER BY `weight` ASC");
            } else {
                $sub = $db->query("SELECT * FROM `<PRE>clientnav` ORDER BY `weight` ASC");
            }
            while ($row = $db->fetch_array($sub)) {
                $array2['IMGURL'] = $row['icon'];
                $array2['LINK'] = "?page=" . $row['link'];
                $array2['VISUAL'] = $row['visual'];
                $array['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
            }
            // Types Navbar
            $navquery = $db->query("SELECT * FROM `<PRE>user_packs` WHERE `userid` = '{$_SESSION['cuser']}'");
            $navdata = $db->fetch_array($navquery);
            $class = $type->createType($type->determineType($navdata['pid']));
            if ($class->clientNav) {
                foreach ($class->clientNav as $key2 => $value) {
                    $array2['IMGURL'] = $value[2];
                    $array2['LINK'] = "?page=type&type=" . $type->determineType($navdata['pid']) . "&sub=" . $value[1];
                    $array2['VISUAL'] = $value[0];
                    $array['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
                    if ($main->getvar['page'] == "type" && $main->getvar['type'] == $type->determineType($navdata['pid']) && $main->getvar['sub'] == $value[1]) {
                        define("SUB", $value[3]);
                        $header = $value[3];
                        $main->getvar['myheader'] = $value[3];
                    }
                }
            }
            $type->classes[$type->determineType($navdata['pid'])] = $class;
            $array2['IMGURL'] = "delete.png";
            $array2['LINK'] = "?page=logout";
            $array2['VISUAL'] = "Logout";
            $array['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
            $sidebar = $style->replaceVar("tpl/sidebar.tpl", $array);
            //Page Sidebar
            if ($content->navtitle) {
                $subnav = $content->navtitle;
                $sub = $db->query("SELECT * FROM `<PRE>clientnav`");
                foreach ($content->navlist as $key => $value) {
                    $array2['IMGURL'] = $value[1];
                    $array2['LINK'] = "?page=" . $main->getvar['page'] . "&sub=" . $value[2];
                    $array2['VISUAL'] = $value[0];
                    $array3['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
                }
                $subsidebar = $style->replaceVar("tpl/sidebar.tpl", $array3);
            }
            if ($main->getvar['sub'] == "delete" && isset($main->getvar['do']) && !$_POST && !$main->getvar['confirm']) {
                foreach ($main->postvar as $key => $value) {
                    $array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />';
                }
                $array['HIDDEN'] .= " ";
                $html = $style->replaceVar("tpl/warning.tpl", $array);
            } elseif ($main->getvar['sub'] == "delete" && isset($main->getvar['do']) && $_POST && !$main->getvar['confirm']) {
                if ($main->postvar['yes']) {
                    foreach ($main->getvar as $key => $value) {
                        if ($i) {
                            $i = "&";
                        } else {
                            $i = "?";
                        }
                        $url .= $i . $key . "=" . $value;
                    }
                    $url .= "&confirm=1";
                    $main->redirect($url);
                } elseif ($main->postvar['no']) {
                    $main->done();
                }
            } else {
                if ($content->navlist && !isset($main->getvar['sub'])) {
                    $html = "Select a sub-page from the sidebar.";
                    if (isset($content->defaultNav)) {
                        header("Location: ?page=" . $main->getvar['page'] . "&sub=" . $content->navlist[$content->defaultNav][2]);
                        die;
                    }
                } else {
                    ob_start();
                    $content->content();
                    $html = ob_get_clean();
                }
            }
        } else {
            $html = "You trying to hack me? You've been warned. An email has been sent.. May I say, Owned?";
            $email->staff("Possible Hacking Attempt", "A user has been logged trying to hack your copy of THT, their IP is: " . $_SERVER['REMOTE_ADDR']);
        }
    }
    if ($main->getvar['sub'] && $main->getvar['page'] != "type") {
        foreach ($content->navlist as $key => $value) {
            if ($value[2] == $main->getvar['sub']) {
                define("SUB", $value[0]);
                $header = $value[0];
            }
        }
    }
    $staffuser = $db->client($_SESSION['cuser']);
    define("SUB", $header);
    define("INFO", '<b>Welcome back, ' . $staffuser['user'] . '</b><br />' . SUB);
    echo '<div id="left">';
    echo $main->table($nav, $sidebar);
    if ($content->navtitle) {
        echo "<br />";
        echo $main->table($subnav, $subsidebar);
    }
    echo '</div>';
    echo '<div id="right">';
    echo $main->table($header, $html);
    echo '</div>';
    $data = ob_get_clean();
    return $data;
    // Return the HTML
}
예제 #4
0
    $link = "pages/" . $support_item['link'] . ".php";
    $header = $support_item['visual'];
}
if ($db->config("senabled") == 0) {
    $html = $db->config("smessage");
} else {
    if (!file_exists($link)) {
        $html = "Seems like the .php is non existant. Is it deleted?";
    } else {
        //If deleting something
        if (preg_match("/[\\.*]/", $main->getvar['page']) == 0) {
            require $link;
            $content = new page();
            if (isset($main->getvar['sub'])) {
                ob_start();
                $content->content();
                $html = ob_get_contents();
                # Retrieve the HTML
                ob_clean();
                # Flush the HTML
            } elseif (isset($content->navlist)) {
                $html = $content->description();
            } else {
                ob_start();
                $content->content();
                $html = ob_get_contents();
                # Retrieve the HTML
                ob_clean();
                # Flush the HTML
            }
        } else {
예제 #5
0
function acp()
{
    global $main;
    global $db;
    global $style;
    global $type;
    global $email;
    ob_start();
    # Stop the output buffer
    if (!$main->getvar['page']) {
        $main->getvar['page'] = "home";
    }
    $query = $db->query("SELECT * FROM `<PRE>acpnav` WHERE `link` = '{$main->getvar['page']}'");
    $page = $db->fetch_array($query);
    // "Hack" to get the credits and tickets page looking nicer
    switch ($main->getvar["page"]) {
        case "credits":
            $header = "Credits";
            break;
        case "ticketsall":
            $header = "All Tickets";
            break;
        default:
            $header = $page['visual'];
            break;
    }
    $link = "pages/" . $main->getvar['page'] . ".php";
    if (!file_exists($link)) {
        $html = "<strong>THT Fatal Error:</strong> Seems like the .php is non existant. Is it deleted?";
    } elseif (!$main->checkPerms($page['id']) && $db->num_rows($query) != 0) {
        $html = "You don't have access to this page.";
    } else {
        //If deleting something
        if (preg_match("/[\\.*]/", $main->getvar['page']) == 0) {
            include $link;
            $content = new page();
            // Main Side Bar HTML
            $nav = "Sidebar Menu";
            $sub = $db->query("SELECT * FROM `<PRE>acpnav`");
            while ($row = $db->fetch_array($sub)) {
                if ($main->checkPerms($row['id'])) {
                    $array2['IMGURL'] = $row['icon'];
                    $array2['LINK'] = "?page=" . $row['link'];
                    $array2['VISUAL'] = $row['visual'];
                    $array['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
                }
            }
            # Types Navbar
            /*
             * When Working on the navbar, to make a spacer use this:
             * $array['LINKS'] .= $style->replaceVar("tpl/spacer.tpl");
             */
            $type->createAll();
            foreach ($type->classes as $key => $value) {
                if ($type->classes[$key]->acpNav) {
                    foreach ($type->classes[$key]->acpNav as $key2 => $value) {
                        $array2['IMGURL'] = $value[2];
                        $array2['LINK'] = "?page=type&type=" . $key . "&sub=" . $value[1];
                        $array2['VISUAL'] = $value[0];
                        $array['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
                        if ($main->getvar['page'] == "type" && $main->getvar['type'] == $key && $main->getvar['sub'] == $value[1]) {
                            define("SUB", $value[3]);
                            $header = $value[3];
                            $main->getvar['myheader'] = $value[3];
                        }
                    }
                }
            }
            $array2['IMGURL'] = "information.png";
            $array2['LINK'] = "?page=credits";
            $array2['VISUAL'] = "Credits";
            $array['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
            $array2['IMGURL'] = "delete.png";
            $array2['LINK'] = "?page=logout";
            $array2['VISUAL'] = "Logout";
            $array['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
            $sidebar = $style->replaceVar("tpl/sidebar.tpl", $array);
            //Page Sidebar
            if ($content->navtitle) {
                $subnav = $content->navtitle;
                $sub = $db->query("SELECT * FROM `<PRE>acpnav`");
                foreach ($content->navlist as $key => $value) {
                    $array2['IMGURL'] = $value[1];
                    $array2['LINK'] = "?page=" . $main->getvar['page'] . "&sub=" . $value[2];
                    $array2['VISUAL'] = $value[0];
                    $array3['LINKS'] .= $style->replaceVar("tpl/sidebarlink.tpl", $array2);
                }
                $subsidebar = $style->replaceVar("tpl/sidebar.tpl", $array3);
            }
            if ($main->getvar['sub'] && $main->getvar['page'] != "type") {
                foreach ($content->navlist as $key => $value) {
                    if ($value[2] == $main->getvar['sub']) {
                        if (!$value[0]) {
                            define("SUB", $main->getvar['page']);
                            $header = $main->getvar['page'];
                        } else {
                            define("SUB", $value[0]);
                            $header = $value[0];
                        }
                    }
                }
            }
            if ($main->getvar['sub'] == "delete" && isset($main->getvar['do']) && !$_POST && !$main->getvar['confirm']) {
                foreach ($main->postvar as $key => $value) {
                    $array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />';
                }
                $array['HIDDEN'] .= " ";
                $html = $style->replaceVar("tpl/warning.tpl", $array);
            } elseif ($main->getvar['sub'] == "delete" && isset($main->getvar['do']) && $_POST && !$main->getvar['confirm']) {
                if ($main->postvar['yes']) {
                    foreach ($main->getvar as $key => $value) {
                        if ($i) {
                            $i = "&";
                        } else {
                            $i = "?";
                        }
                        $url .= $i . $key . "=" . $value;
                    }
                    $url .= "&confirm=1";
                    $main->redirect($url);
                } elseif ($main->postvar['no']) {
                    $main->done();
                }
            } else {
                if (isset($main->getvar['sub'])) {
                    ob_start();
                    $content->content();
                    $html = ob_get_contents();
                    # Retrieve the HTML
                    ob_clean();
                    # Flush the HTML
                } elseif ($content->navlist) {
                    $html .= $content->description();
                    # First, we gotta get the page description.
                    $html .= "<br /><br />";
                    # Break it up
                    // Now we should prepend some stuff here
                    $subsidebar2 .= "<strong>Page Submenu</strong><div class='break'></div>";
                    $subsidebar2 .= $subsidebar;
                    // Done, now output it in a sub() table
                    $html .= $main->sub($subsidebar2, NULL);
                    # Initial implementation, add the SubSidebar(var) into the description, basically append it
                    if (isset($content->defaultNav)) {
                        header("Location: ?page=" . $main->getvar['page'] . "&sub=" . $content->navlist[$content->defaultNav][2]);
                        die;
                    }
                } else {
                    ob_start();
                    $content->content();
                    $html = ob_get_contents();
                    # Retrieve the HTML
                    ob_clean();
                    # Flush the HTML
                }
            }
        } else {
            $html = "No.";
        }
    }
    $staffuser = $db->staff($_SESSION['user']);
    define("SUB", $header);
    define("INFO", '<b>Welcome back, ' . strip_tags($staffuser['name']) . '</b><br />' . SUB);
    echo '<div id="left">';
    echo $main->table($nav, $sidebar);
    if ($content->navtitle) {
        echo "<br />";
        echo $main->table($subnav, $subsidebar);
    }
    echo '</div>';
    echo '<div id="right">';
    echo $main->table($header, $html);
    echo '</div>';
    $data = ob_get_contents();
    # Retrieve the HTML
    ob_clean();
    # Flush the HTML
    return $data;
    # Return the HTML
}
예제 #6
0
 static function fromDir($dir, $parent)
 {
     // create a new page for this dir
     $page = new page();
     $parent = $parent ? $parent : new obj();
     $name = self::parseName($dir['name']);
     // apply all variables
     $page->parent = $parent;
     $page->num = $name['num'];
     $page->uid = $name['uid'];
     $page->uri = ltrim($parent->uri . '/' . $page->uid, '/');
     $page->dirname = $dir['name'];
     $page->modified = $dir['modified'];
     $page->root = $dir['root'];
     $page->diruri = self::parseDirURI($dir['root']);
     $page->rawfiles = $dir['files'];
     $page->children = $dir['children'];
     $page->visible = empty($name['num']) ? false : true;
     // create a default title. we always need a title!
     $page->title = new variable($name['uid'], $page);
     // gather all files
     $page->files();
     // fetch the content
     $content = $page->files()->contents();
     if (c::get('lang.support')) {
         $fallback = $content->filterBy('languageCode', c::get('lang.default'))->first();
         if (!$fallback) {
             $fallback = $content->first();
         }
         // get the fallback variables
         $variables = $fallback ? $fallback->variables : array();
         $page->intendedTemplate = $fallback ? $fallback->template : false;
         if (c::get('lang.translated')) {
             // don't use url_key as fallback
             // the fallback should always be the folder name
             unset($variables['url_key']);
             $translation = $content->filterBy('languageCode', c::get('lang.current'))->first();
             $variables = $translation ? array_merge($variables, $translation->variables) : $variables;
         }
     } else {
         $contentfile = $content->first();
         $variables = $contentfile ? $contentfile->variables : array();
         $page->intendedTemplate = $contentfile ? $contentfile->template : false;
     }
     // merge all variables
     foreach ($variables as $key => $var) {
         $page->_[$key] = new variable($var, $page);
     }
     // multi-language translatable urls
     if (c::get('lang.support') && $page->url_key != '') {
         $page->translatedUID = $page->url_key();
         $page->translatedURI = ltrim($parent->translatedURI . '/' . $page->url_key(), '/');
     } else {
         $page->translatedUID = $page->uid;
         $page->translatedURI = ltrim($parent->translatedURI . '/' . $page->uid, '/');
     }
     // attach a cached version of the default content
     // for backwards compatibility
     $page->content = $page->content();
     return $page;
 }
예제 #7
0
function acp()
{
    global $dbh, $postvar, $getvar, $instance;
    ob_start();
    if ($_SESSION['clogged'] || $_SESSION['cuser']) {
        session_destroy();
        main::redirect("?page=home");
    }
    if (!$getvar['page']) {
        $getvar['page'] = "home";
    }
    $page = $dbh->select("acpnav", array("link", "=", $getvar['page']));
    // "Hack" to get the credits and tickets page looking nicer
    switch ($getvar["page"]) {
        case "credits":
            $header = "Credits";
            break;
        default:
            if ($page['visual'] == "Tickets" && $getvar['mode'] == 'ticketsall') {
                $header = "All Tickets";
            } else {
                $header = $page['visual'];
            }
            break;
    }
    $link = "pages/" . $getvar['page'] . ".php";
    $staff_data = $dbh->select("staff", array("id", "=", $_SESSION['user']));
    $user_perms = $staff_data['perms'];
    if (substr_count($user_perms, "paid") == '1') {
        $nopaid = '1';
    }
    if (substr_count($user_perms, "p2h") == '1') {
        $nop2h = '1';
    }
    if (!file_exists($link)) {
        $html = "<strong>THT Fatal Error:</strong> That page doesn't exist.";
    } elseif (!main::checkPerms($page['id']) && !$nopaid && !$nop2h && $user_perms) {
        $html = "You don't have access to this page.";
    } elseif ($getvar['page'] == "type" && $getvar['type'] == "paid" && $nopaid) {
        $html = "You don't have access to this page.";
    } elseif ($getvar['page'] == "type" && $getvar['type'] == "p2h" && $nop2h) {
        $html = "You don't have access to this page.";
    } else {
        include $link;
        $content = new page();
        // Main Side Bar HTML
        $nav = "Sidebar Menu";
        $sub = $dbh->select("acpnav", 0, array("id", "ASC"));
        while ($row = $dbh->fetch_array($sub)) {
            if (main::checkPerms($row['id'])) {
                $sidebarlink_array['IMGURL'] = $row['icon'];
                $sidebarlink_array['LINK'] = "?page=" . $row['link'];
                $sidebarlink_array['VISUAL'] = $row['visual'];
                $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
            }
        }
        // Types Navbar
        /*
         * When Working on the navbar, to make a spacer use this:
         * $sidebar_array['LINKS'] .= style::replaceVar("tpl/spacer.tpl");
         */
        foreach ($instance->packtypes as $key => $value) {
            if ($key == "paid" && $nopaid != "1" || $key == "p2h" && $nop2h != "1" || $key != "paid" && $key != "p2h") {
                if ($instance->packtypes[$key]->acpNav) {
                    foreach ($instance->packtypes[$key]->acpNav as $key2 => $value) {
                        $sidebarlink_array['IMGURL'] = $value[2];
                        $sidebarlink_array['LINK'] = "?page=type&type=" . $key . "&sub=" . $value[1];
                        $sidebarlink_array['VISUAL'] = $value[0];
                        $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
                        if ($getvar['page'] == "type" && $getvar['type'] == $key && $getvar['sub'] == $value[1]) {
                            define("SUB", $value[3]);
                            $header = $value[3];
                            $getvar['myheader'] = $value[3];
                        }
                    }
                }
            }
        }
        $sidebarlink_array['IMGURL'] = "information.png";
        $sidebarlink_array['LINK'] = "?page=credits";
        $sidebarlink_array['VISUAL'] = "Credits";
        $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
        $sidebarlink_array['IMGURL'] = "delete.png";
        $sidebarlink_array['LINK'] = "?page=logout";
        $sidebarlink_array['VISUAL'] = "Logout";
        $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebarlink_array);
        $sidebar = style::replaceVar("tpl/sidebar.tpl", $sidebar_array);
        //Page Sidebar
        if ($content->navtitle) {
            $subnav = $content->navtitle;
            foreach ($content->navlist as $key => $value) {
                $sub_sidebarlink_array['IMGURL'] = $value[1];
                $sub_sidebarlink_array['LINK'] = "?page=" . $getvar['page'] . "&sub=" . $value[2];
                $sub_sidebarlink_array['VISUAL'] = $value[0];
                $sub_sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sub_sidebarlink_array);
            }
            $subsidebar = style::replaceVar("tpl/sidebar.tpl", $sub_sidebar_array);
        }
        if ($getvar['sub'] && $getvar['page'] != "type") {
            foreach ($content->navlist as $key => $value) {
                if ($value[2] == $getvar['sub']) {
                    if (!$value[0]) {
                        define("SUB", $getvar['page']);
                        $header = $getvar['page'];
                    } else {
                        define("SUB", $value[0]);
                        $header = $value[0];
                    }
                }
            }
        }
        if ($getvar['sub'] == "delete" && isset($getvar['do']) && !$_POST && !$getvar['confirm']) {
            foreach ($postvar as $key => $value) {
                $warning_array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />';
            }
            $warning_array['HIDDEN'] .= " ";
            $html = style::replaceVar("tpl/warning.tpl", $warning_array);
        } elseif ($getvar['sub'] == "delete" && isset($getvar['do']) && $_POST && !$getvar['confirm']) {
            if ($postvar['yes']) {
                foreach ($getvar as $key => $value) {
                    if ($i) {
                        $i = "&";
                    } else {
                        $i = "?";
                    }
                    $url .= $i . $key . "=" . $value;
                }
                $url .= "&confirm=1";
                main::redirect($url);
            } elseif ($postvar['no']) {
                main::done();
            }
        } else {
            if (isset($getvar['sub'])) {
                ob_start();
                $content->content();
                $html = ob_get_contents();
                // Retrieve the HTML
                ob_clean();
                // Flush the HTML
            } elseif ($content->navlist) {
                $html .= $content->description();
                // First, we gotta get the page description.
                $html .= "<br /><br />";
                // Break it up
                // Now we should prepend some stuff here
                $subsidebar2 .= "<strong>Page Submenu</strong><div class='break'></div>";
                $subsidebar2 .= $subsidebar;
                // Done, now output it in a sub() table
                $html .= main::sub($subsidebar2, NULL);
                // Initial implementation, add the SubSidebar(var) into the description, basically append it
            } else {
                ob_start();
                $content->content();
                $html = ob_get_contents();
                // Retrieve the HTML
                ob_clean();
                // Flush the HTML
            }
        }
    }
    $staffuser = $dbh->staff($_SESSION['user']);
    define("SUB", $header);
    define("INFO", '<b>Welcome back, ' . strip_tags($staffuser['name']) . '</b><br />' . SUB);
    echo '<div id="left">';
    echo main::table($nav, $sidebar);
    if ($content->navtitle) {
        echo "<br />";
        echo main::table($subnav, $subsidebar);
    }
    echo '</div>';
    echo '<div id="right">';
    echo main::table($header, $html);
    echo '</div>';
    $html_buff = ob_get_contents();
    ob_clean();
    return $html_buff;
}
예제 #8
0
function acp()
{
    global $main, $db, $style, $type, $email, $user;
    if (!isset($main->getvar['page'])) {
        $main->getvar['page'] = 'home';
    }
    $admin_navigation = $main->getAdminNavigation();
    $admin_nave_item = false;
    if (isset($admin_navigation[$main->getvar['page']]) && !empty($admin_navigation[$main->getvar['page']])) {
        $admin_nave_item = $admin_navigation[$main->getvar['page']];
    }
    $link = 'pages/home.php';
    $header = null;
    if (isset($admin_nave_item) && !empty($admin_nave_item)) {
        if ($admin_nave_item['link'] != 'home') {
            $header = $admin_nave_item['visual'];
        }
        $link = 'pages/' . $admin_nave_item['link'] . '.php';
    }
    // Left menu
    $array['LINKS'] = '';
    foreach ($admin_navigation as $row) {
        if ($main->checkPerms($row['link'])) {
            $array_item['IMGURL'] = $row['icon'];
            $array_item['LINK'] = "?page=" . $row['link'];
            $array_item['VISUAL'] = $row['visual'];
            /*if ($row['link'] == $admin_nave_item['link']) {
            			$array_item['ACTIVE'] 	= 'active';
            		} else {
            			$array_item['ACTIVE'] 	=	 ' ';
            		}*/
            $array['LINKS'] .= $style->replaceVar("menu/leftmenu_link.tpl", $array_item);
        }
    }
    //Adding the logout link
    $array_item['IMGURL'] = "logout.png";
    $array_item['LINK'] = "?page=logout";
    $array_item['VISUAL'] = "Logout";
    $array['LINKS'] .= $style->replaceVar("menu/leftmenu_link.tpl", $array_item);
    $sidebar = $style->replaceVar("menu/leftmenu_main.tpl", $array);
    $user_permission = true;
    if (!file_exists($link)) {
        $html = "<strong>Fatal Error:</strong> Seems like the .php is non existant. Is it deleted?";
    } elseif (!$main->checkPerms($admin_nave_item['link'])) {
        $user_permission = false;
        $html = "You don't have access to the {$admin_nave_item['visual']} page";
    } else {
        //If deleting something
        //&& $main->linkAdminMenuExists($main->getvar['page']) == true
        if (preg_match("/[\\.*]/", $main->getvar['page']) == 0) {
            require $link;
            $content = new page();
            //Page Sidebar
            $sidebar_link_link = "menu/leftmenu_link.tpl";
            $sidebar_link = "menu/leftmenu_main.tpl";
            if (isset($main->getvar['sub']) && $main->getvar['sub'] && $admin_nave_item['link'] != "type") {
                if (is_array($content->navlist)) {
                    foreach ($content->navlist as $key => $value) {
                        if ($value[2] == $main->getvar['sub']) {
                            if (!$value[0]) {
                                define("SUB", $admin_nave_item['link']);
                                $header = $admin_nave_item['link'];
                            } else {
                                define("SUB", $value[0]);
                                $header = $value[0];
                            }
                        }
                    }
                }
            }
            $array['HIDDEN'] = '';
            if (isset($main->getvar['sub']) && $main->getvar['sub'] == 'delete' && isset($main->getvar['do']) && !$_POST && !isset($main->getvar['confirm'])) {
                if (!empty($main->postvar)) {
                    foreach ($main->postvar as $key => $value) {
                        $array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />';
                    }
                }
                $array['HIDDEN'] .= " ";
                $html = $style->replaceVar("tpl/warning.tpl", $array);
            } elseif (isset($main->getvar['sub']) && $main->getvar['sub'] == "delete" && isset($main->getvar['do']) && $_POST && !isset($main->getvar['confirm'])) {
                if ($main->postvar['yes']) {
                    foreach ($main->getvar as $key => $value) {
                        if ($i) {
                            $i = "&";
                        } else {
                            $i = "?";
                        }
                        $url .= $i . $key . "=" . $value;
                    }
                    $url .= "&confirm=1";
                    $main->redirect($url);
                } elseif ($main->postvar['no']) {
                    $main->done();
                }
            } else {
                $html = '';
                /** 
                 * 	Experimental changes only applied to the billing cycle objects otherwise work as usual
                 * 	 */
                if (isset($content->pagename)) {
                    $method_list = array('add', 'edit', 'delete', 'show', 'listing');
                    $sub = $main->get_variable('sub');
                    if (in_array($sub, $method_list)) {
                        $content->{$sub}();
                    } else {
                        $content->listing();
                    }
                } else {
                    $content->content();
                }
            }
        } else {
            $html = "You trying to hack me? You've been warned. An email has been sent.. May I say, Owned?";
            $email->staff("Possible Hacking Attempt", "A user has been logged trying to hack your copy of BNPanel, their IP is: " . $main->removeXSS($_SERVER['REMOTE_ADDR']));
        }
    }
    $staffuser = $db->staff($main->getCurrentStaffId());
    define("INFO", '<b>Welcome back, ' . strip_tags($staffuser['name']) . '</b><br />');
    $style->assign('sidebar', $sidebar);
    $style->assign('sub_menu', $content->get_submenu());
    if (!empty($content->content)) {
        $style->assign('content', $content->content);
    }
}
예제 #9
0
function client()
{
    global $dbh, $postvar, $getvar, $instance;
    ob_start();
    // Stop the output buffer
    if (!$getvar['page']) {
        $getvar['page'] = "home";
    }
    $page = $dbh->select("clientnav", array("link", "=", $getvar['page']), array("id", "ASC"));
    $header = $page['visual'];
    $link = "pages/" . $getvar['page'] . ".php";
    if (!file_exists($link)) {
        $html = "That page doesn't exist.";
    } else {
        if (preg_match("/[\\.*]/", $getvar['page']) == 0) {
            include $link;
            $content = new page();
            // Main Side Bar HTML
            $nav = "Sidebar";
            if (!$dbh->config("delacc")) {
                $clientnav_query = $dbh->select("clientnav", array("link", "!=", "delete"), array("id", "ASC"), 0, 1);
            } else {
                $clientnav_query = $dbh->select("clientnav", 0, array("id", "ASC"), 0, 1);
            }
            while ($clientnav_data = $dbh->fetch_array($clientnav_query)) {
                $sidebar_link_array['IMGURL'] = $clientnav_data['icon'];
                $sidebar_link_array['LINK'] = "?page=" . $clientnav_data['link'];
                $sidebar_link_array['VISUAL'] = $clientnav_data['visual'];
                $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
            }
            // Types Navbar
            $client = $dbh->client($_SESSION['cuser']);
            $packtype = $instance->packtypes[type::packagetype($client['pid'])];
            if ($packtype->clientNav) {
                foreach ($packtype->clientNav as $key2 => $value) {
                    $sidebar_link_array['IMGURL'] = $value[2];
                    $sidebar_link_array['LINK'] = "?page=type&type=" . type::packagetype($client['pid']) . "&sub=" . $value[1];
                    $sidebar_link_array['VISUAL'] = $value[0];
                    $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
                    if ($getvar['page'] == "type" && $getvar['type'] == type::packagetype($client['pid']) && $getvar['sub'] == $value[1]) {
                        define("SUB", $value[3]);
                        $header = $value[3];
                        $getvar['myheader'] = $value[3];
                    }
                }
            }
            $sidebar_link_array['IMGURL'] = "delete.png";
            $sidebar_link_array['LINK'] = "?page=logout";
            $sidebar_link_array['VISUAL'] = "Logout";
            $sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
            $sidebar = style::replaceVar("tpl/sidebar.tpl", $sidebar_array);
            //Page Sidebar
            if ($content->navtitle) {
                $subnav = $content->navtitle;
                foreach ($content->navlist as $key => $value) {
                    $sidebar_link_array['IMGURL'] = $value[1];
                    $sidebar_link_array['LINK'] = "?page=" . $getvar['page'] . "&sub=" . $value[2];
                    $sidebar_link_array['VISUAL'] = $value[0];
                    $sub_sidebar_array['LINKS'] .= style::replaceVar("tpl/sidebar-link.tpl", $sidebar_link_array);
                }
                $subsidebar = style::replaceVar("tpl/sidebar.tpl", $sub_sidebar_array);
            }
            if ($getvar['sub'] == "delete" && isset($getvar['do']) && !$_POST && !$getvar['confirm']) {
                foreach ($postvar as $key => $value) {
                    $warning_array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />';
                }
                $warning_array['HIDDEN'] .= " ";
                $html = style::replaceVar("tpl/warning.tpl", $warning_array);
            } elseif ($getvar['sub'] == "delete" && isset($getvar['do']) && $_POST && !$getvar['confirm']) {
                if ($postvar['yes']) {
                    foreach ($getvar as $key => $value) {
                        if ($i) {
                            $i = "&";
                        } else {
                            $i = "?";
                        }
                        $url .= $i . $key . "=" . $value;
                    }
                    $url .= "&confirm=1";
                    main::redirect($url);
                } elseif ($postvar['no']) {
                    main::done();
                }
            } else {
                if (isset($getvar['sub'])) {
                    ob_start();
                    $content->content();
                    $html = ob_get_contents();
                    // Retrieve the HTML
                    ob_clean();
                    // Flush the HTML
                } elseif ($content->navlist) {
                    if ($content->description()) {
                        $html = $content->description() . "<br><br>";
                    }
                    $html .= "Select a sub-page from the sidebar.";
                } else {
                    ob_start();
                    $content->content();
                    $html = ob_get_contents();
                    // Retrieve the HTML
                    ob_clean();
                    // Flush the HTML
                }
            }
        }
    }
    if ($getvar['sub'] && $getvar['page'] != "type") {
        foreach ($content->navlist as $key => $value) {
            if ($value[2] == $getvar['sub']) {
                define("SUB", $value[0]);
                $header = $value[0];
            }
        }
    }
    $staffuser = $dbh->client($_SESSION['cuser']);
    define("SUB", $header);
    define("INFO", '<b>Welcome back, ' . $staffuser['user'] . '</b><br />' . SUB);
    echo '<div id="left">';
    echo main::table($nav, $sidebar);
    if ($content->navtitle) {
        echo "<br />";
        echo main::table($subnav, $subsidebar);
    }
    echo '</div>';
    echo '<div id="right">';
    echo main::table($header, $html);
    echo '</div>';
    $html_buff = ob_get_contents();
    ob_clean();
    return $html_buff;
}
예제 #10
0
function client()
{
    global $main, $db, $style, $type, $email;
    if (!$main->getvar['page']) {
        $main->getvar['page'] = 'home';
    }
    $client_navigation = $main->getClientNavigation();
    $client_item = $client_navigation[$main->getvar['page']];
    $header = 'Home';
    $link = 'pages/home.php';
    if (isset($client_item) && !empty($client_item)) {
        $header = $client_item['visual'];
        $link = "pages/" . $client_item['link'] . ".php";
    }
    if (!file_exists($link)) {
        $html = "Seems like the .php is non existant. Is it deleted?";
    } else {
        //If deleting something
        if (preg_match("/[\\.*]/", $main->getvar['page']) == 0) {
            require $link;
            $content = new page();
            // Main Side Bar HTML
            $nav = "Sidebar";
            $array = array();
            $array['LINKS'] = null;
            foreach ($client_navigation as $row) {
                if ($row['link'] == 'delete' && !$db->config('delacc')) {
                    continue;
                }
                $array2['IMGURL'] = $row['icon'];
                $array2['LINK'] = "?page=" . $row['link'];
                $array2['VISUAL'] = $row['visual'];
                $array2['ACTIVE'] = 'active';
                $array['LINKS'] .= $style->replaceVar("menu/leftmenu_link.tpl", $array2);
            }
            # Types Navbar
            $user_id = $main->getCurrentUserId();
            $array2['IMGURL'] = "logout.png";
            $array2['LINK'] = "?page=logout";
            $array2['VISUAL'] = "Logout";
            $array['LINKS'] .= $style->replaceVar("menu/leftmenu_link.tpl", $array2);
            $sidebar = $style->replaceVar("menu/leftmenu_main.tpl", $array);
            //Page Sidebar
            if (isset($content->navtitle)) {
                $subnav = $content->navtitle;
                $array3 = array();
                $array3['LINKS'] = null;
                if (!empty($content->navlist)) {
                    foreach ($content->navlist as $key => $value) {
                        $array2['IMGURL'] = $value[1];
                        $array2['LINK'] = "?page=" . $client_item['link'] . "&sub=" . $value[2];
                        $array2['VISUAL'] = $value[0];
                        $array3['LINKS'] .= $style->replaceVar("tpl/menu/submenu_link.tpl", $array2);
                    }
                }
                $subsidebar = $style->replaceVar("menu/submenu_main.tpl", $array3);
            }
            if (isset($main->getvar['sub']) && $main->getvar['sub'] == "delete" && isset($main->getvar['do']) && !$_POST && !$main->getvar['confirm']) {
                foreach ($main->postvar as $key => $value) {
                    $array['HIDDEN'] .= '<input name="' . $key . '" type="hidden" value="' . $value . '" />';
                }
                $array['HIDDEN'] .= " ";
                $html = $style->replaceVar("warning.tpl", $array);
            } elseif (isset($main->getvar['sub']) && $main->getvar['sub'] == "delete" && isset($main->getvar['do']) && $_POST && !$main->getvar['confirm']) {
                if ($main->postvar['yes']) {
                    foreach ($main->getvar as $key => $value) {
                        if ($i) {
                            $i = "&";
                        } else {
                            $i = "?";
                        }
                        $url .= $i . $key . "=" . $value;
                    }
                    $url .= "&confirm=1";
                    $main->redirect($url);
                } elseif ($main->postvar['no']) {
                    $main->done();
                }
            } else {
                $content->content();
            }
        } else {
            $html = "You trying to hack me? You've been warned. An email has been sent.. May I say, Owned?";
            $email->staff("Possible Hacking Attempt", "A user has been logged trying to hack your copy of THT, their IP is: " . $main->removeXSS($_SERVER['REMOTE_ADDR']));
        }
    }
    if (isset($main->getvar['sub']) && $main->getvar['sub'] && $main->getvar['page'] != "type") {
        if (is_array($content->navlist)) {
            foreach ($content->navlist as $key => $value) {
                if ($value[2] == $main->getvar['sub']) {
                    define("SUB", $value[0]);
                    $header = $value[0];
                }
            }
        }
    }
    $staffuser = $db->client($main->getCurrentUserId());
    $style->assign('sidebar', $sidebar);
    $style->assign('sub_menu', $content->get_submenu());
    if (!empty($content->content)) {
        $style->assign('content', $content->content);
    }
}