Exemplo n.º 1
0
 public function __construct($REQUEST, $model, $view)
 {
     switch ($REQUEST->get('act')) {
         default:
             \CORE\BC\UI::init()->static_page($REQUEST->get('act'));
             break;
     }
 }
Exemplo n.º 2
0
 public function show_template()
 {
     global $conf, $start;
     $UI = \CORE\BC\UI::init();
     if ($UI->tpl() != '') {
         include $UI->tpl();
     }
 }
Exemplo n.º 3
0
 public function __construct($REQUEST, $model, $view)
 {
     switch ($REQUEST->get('act')) {
         case 'login':
             $model->login();
             break;
         case 'logout':
             $model->logout();
             break;
         case 'profile':
             $view->profile($model);
             break;
         case 'change_password':
             $UI = \CORE\BC\UI::init();
             $UI->pos['main'] .= $view->change_pwd();
             break;
         case 'passwd':
             $model->passwd();
             break;
         case 'manage':
             if (isset($_GET['do'])) {
                 switch ($_GET['do']) {
                     case 'add':
                         $model->add();
                         break;
                     case 'edit':
                         $model->edit();
                         break;
                     case 'update':
                         $model->update();
                         break;
                     case 'del':
                         $model->del();
                         break;
                 }
             } else {
                 $UI = \CORE\BC\UI::init();
                 $UI->pos['main'] .= $view->manage($model);
             }
             break;
     }
     if (\CORE::init()->is_ajax()) {
         \DB::init()->close();
         exit;
     }
 }
Exemplo n.º 4
0
    public function manage_groups($model)
    {
        if ($model != null) {
            $UI = \CORE\BC\UI::init();
            $groups = $model->get_groups();
            $count = count($groups);
            // test
            $UI->pos['main'] .= '<div class="btn-group" role="group" aria-label="...">
		  <button id="new_group" type="button" class="btn btn-default"
		  data-toggle="modal" data-target="#myModal">New</button>
		</div>' . $UI::modal();
            if ($count > 0) {
                //... show table
            } else {
                $UI->pos['main'] .= '<h4 class="text-danger">No records found in the database</h4>';
            }
        }
    }
Exemplo n.º 5
0
<?php

if (!defined('DIR_BASE')) {
    echo '[+_+]';
    exit;
}
if (is_readable(DIR_CORE . '/bc/core.php')) {
    require DIR_CORE . '/bc/core.php';
} else {
    echo 'Core class not found';
    exit;
}
$CORE = CORE::init();
$USER = \CORE\BC\USER::init();
$UI = \CORE\BC\UI::init();
$APP = \CORE\BC\APP::init();
$CORE->unload();
$UI->show_template();
Exemplo n.º 6
0
    public function change_pwd()
    {
        $result = '';
        $UI = \CORE\BC\UI::init();
        $result .= '
<div class="col-md-4">
	<h4>Change password:</h4>
	<br>
	<form id="frm_chpwd">
	<div class="form-group">
		<label for="pwd">New password</label>
		<input type="password" class="form-control" id="pwd" placeholder="password">
	</div>
	<div class="form-group">
		<label for="pwd2">Retype new password</label>
		<input type="password" class="form-control" id="pwd2" placeholder="password">
	</div>
	<div class="form-group">
		<input type="submit" id="chpwd" class="btn btn-danger" value="Change password">
	</div>
	</form>
</div>
';
        $UI->pos['js'] .= '
<script type="text/javascript">
$(document).ready(function(){

	function check_pwd(pwd){
		var xlen = pwd.length
		if(xlen>=8 && xlen<255){ return true; } else { return false; }
	}

	$("#pwd").focus();

	$("#frm_chpwd").submit(function(e){
		e.preventDefault();
	});

	$("#chpwd").click(function(){
		var xpwd = $("#pwd").val();
		if(check_pwd(xpwd)){
			if(xpwd==$("#pwd2").val()){
				$.post("./?c=user&act=passwd&ajax", {pwd:xpwd}, function(data){
					if(data=="Password successfully changed."){
						alert("Password successfully changed.");
						window.location.replace("./");
						// location.reload();
					} else {
						alert("Error. Check JS console log.");
						console.log(data);
					}
				});
			} else {
				alert("Password does not match the confirm password.");
			}
		} else {
			alert("Password is not valid.");
		}
	});

});
</script>';
        return $result;
    }