예제 #1
0
 public static function prefered($type, $name, $identifier = 0)
 {
     $prefered = '';
     if (USER::is_logged()) {
         $identifier = $identifier == 0 ? USER::get('id') : $identifier;
         $check = OPTIONS::get($type, $name, $identifier);
         if ($check === false) {
             $prefered = OPTIONS::get($type, $name);
         } else {
             $prefered = $check;
         }
     } else {
         $prefered = OPTIONS::get($type, $name);
     }
     return $prefered;
 }
예제 #2
0
<?php

if (!defined("DRAWLINE_RUN_FROM_INDEX")) {
    die;
}
if (isset($_GET['do'])) {
    switch ($_GET['do']) {
        /*
         * login user
         */
        case "login":
            // check if already logged
            if (USER::is_logged()) {
                redirect(LINKS::get("admin_home"));
            }
            // check if sent data
            if (isset($_POST['username'], $_POST['password'])) {
                if (USER::login($_POST['username'], $_POST['password'])) {
                    TPL::message("Perfect! You'll be redirected in 2 seconds..", "success");
                    redirect(isset($_GET['redirect']) ? urldecode($_GET['redirect']) : LINKS::get("admin_home"), 2);
                } else {
                    switch (LOGS::get_error()['log_text']) {
                        case "wrong_username":
                            TPL::message("You entered a wrong username..");
                            break;
                        case "wrong_password":
                            TPL::message("You entered a wrong password..");
                            break;
                    }
                }
            }
예제 #3
0
<?php

// check if logged
if (!USER::is_logged() && !LINKS::on_link("admin_login")) {
    $link = LINKS::get("admin_login") . (LINKS::on_link("admin_home") ? '' : '?redirect=' . urlencode(URL::get_full_url()));
    redirect($link);
}
// check if has permission to access Admin Panel
if (USER::is_logged() && !PERMISSIONS::check("access_admin") && !LINKS::on_link("admin_login") && !LINKS::on_link("admin_logout")) {
    redirect(LINKS::get("base_home"));
}
/* REWRITING */
if (file_exists(FOLDER_ADMIN . "routes.php")) {
    include FOLDER_ADMIN . "routes.php";
}
ob_start();
/*
 * Set default admin menu
 */
/*
 * CONTENT
 */
DRAWLINE::admin_menu('content', array("title" => "Content", "icon" => "book", "link" => "admin_content"));
DRAWLINE::admin_menu('add_page', array("title" => "Add page", "icon" => "plus", "link" => array("admin_pages_add"), "item_active_on_link" => "admin_pages_add", "parent" => "content"));
DRAWLINE::admin_menu('pages_list', array("title" => "Pages list", "icon" => "list", "link" => "admin_pages", "parent" => "content"));
DRAWLINE::admin_menu('categories', array("title" => "Categories", "icon" => "tags", "link" => "admin_categories", "parent" => "content", "item_separator_bottom" => true));
DRAWLINE::admin_menu('media', array("title" => "Media", "icon" => "picture-o", "link" => "admin_media", "parent" => "content"));
DRAWLINE::admin_menu('menus', array("title" => "Menus", "icon" => "plane", "link" => "admin_menus", "parent" => "content", "item_separator_bottom" => true));
DRAWLINE::admin_menu('trash', array("title" => "Trash", "icon" => "trash", "link" => "admin_trash", "parent" => "content"));
/*
 * DESIGN