Example #1
0
<?php

# user login page
$p = new \User\LoginPage(array('path' => page_login(), 'title' => 'User authentication'));
$p->register();
# dashboard page
$p = new \App\Dashboard(array('path' => page_home(), 'title' => 'Home'));
$p->menu = new \Meta\Menu\Item(array('icon' => 'glyphicon-home'));
$p->restrict = true;
$p->register();
# user profile page
$p = new \Meta\Page(array('path' => page_profile(), 'title' => 'Edit profile'));
$p->add(new \User\ProfileForm());
$p->register();
# manage menu root
$p = new \Meta\Page(array('path' => 'manage', 'title' => 'Manage'));
$p->menu = new \Meta\Menu\Item(array('icon' => 'glyphicon-cog'));
$p->restrict = true;
$p->register();
# users crud
$p = new \Meta\Page\Crud(array('path' => 'admin-users', 'title' => 'Users', 'table' => 'users'));
$p->menu = new \Meta\Menu\Item(array('icon' => 'glyphicon-user', 'parent' => 'manage'));
$p->restrict = true;
$p->form = new \User\UsersForm();
$p->view->query->searchFields = array('login', 'name', 'mail');
$p->register();
# groups crud
$p = new \Meta\Page\Crud(array('path' => 'admin-groups', 'title' => 'Groups', 'table' => 'groups'));
$p->menu = new \Meta\Menu\Item(array('icon' => 'glyphicon-tasks', 'parent' => 'manage'));
$p->restrict = true;
$p->form = new \User\GroupsForm();
Example #2
0
                        <i class="fa fa-user fa-fw"></i>  <i class="fa fa-caret-down"></i>
                        <?php 
    echo $user->login;
    ?>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="<?php 
    echo url(page_profile());
    ?>
"><i class="fa fa-user fa-fw"></i> My profile</a>
                        </li>
<!--                        <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
                        </li>-->
                        <li class="divider"></li>
                        <li><a href="<?php 
    echo url(page_login(), array('action' => 'logout'));
    ?>
"><i class="fa fa-sign-out fa-fw"></i> <?php 
    echo t('Logout');
    ?>
</a>
                        </li>
                    </ul>
                </li>
            </ul>
            <?php 
}
?>

            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse">
Example #3
0
    page_login("failed");
    exit;
} elseif ($x7s->loggedin == 3 && !in_array(@$_GET['act'], $no_login_req)) {
    // They tried to login but their username was invalid
    include_once "./sources/loginout.php";
    page_login("invalid");
    exit;
} elseif ($x7s->loggedin == 4 && !in_array(@$_GET['act'], $no_login_req)) {
    // They tried to login but their username was invalid
    include_once "./sources/loginout.php";
    page_login("activated");
    exit;
} elseif ($x7s->loggedin == 5 && !in_array(@$_GET['act'], $no_login_req)) {
    // They tried to login but their username was invalid
    include_once "./sources/loginout.php";
    page_login("frozen");
    exit;
}
//This is used to return to flat http after login
if ($_SERVER["SERVER_PORT"] == 443) {
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
    exit;
}
// Prevent their username and room from being deleted
if (@$_GET['act'] != "frame") {
    prevent_cleanup();
    cleanup_inactive_users();
    // If the user has just entered as a guest then we need to remove old logs
    // This variable is set in lib/auth.php IF it is set at all
    if (isset($remove_old_guest_logs)) {
Example #4
0
--------------------------------------*/
if (!isset($_REQUEST['action'])) {
    page_login();
}
switch ($_REQUEST['action']) {
    case "do_login":
        do_login();
        break;
    case "do_logout":
        do_logout();
        break;
    case "page_relogin":
        page_relogin();
        break;
    default:
        page_login();
        break;
}
/*------------------------------------
	responser functions
--------------------------------------*/
function page_login()
{
    global $smarty;
    smarty_output('cpanel/page_login.tpl');
    exit;
}
function page_relogin()
{
    global $smarty;
    $smarty->assign("callback", urlencode($_REQUEST['callback']));
Example #5
0
 public function register()
 {
     if (!$this->path) {
         throw new \Exception(t('Page path not defined'));
     }
     // add menu item
     if ($this->menu && $this->isUserAllowed()) {
         $this->menu->path = $this->path;
         // set menu label same as page title
         if (!$this->menu->label) {
             $this->menu->label = $this->title;
         }
         Menu::get()->add($this->menu);
     }
     // add route callback
     $obj = $this;
     Route::get()->add($this->path, function () use($obj) {
         if (!$obj->isUserAllowed()) {
             if (!User::hasLoggedUser()) {
                 redirect(page_login());
             }
             echo new Page\AccessDenied();
         }
         echo $obj->render();
     });
 }