Added composer.json for admin

This commit is contained in:
Antonio de la Rosa 2025-11-20 12:30:06 +01:00
parent 90aefd81c9
commit 0b21909a78
2 changed files with 163 additions and 149 deletions

View file

@ -0,0 +1,18 @@
{
"repositories": [
{
"type": "vcs",
"url": "git@bitbucket.org:phangoapp/phamodels.git"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require-dev": {
"phpunit/phpunit": "^10.4"
},
"require": {
"phangoapp/phamodels": "dev-master"
}
}

View file

@ -1,36 +1,29 @@
<?php <?php
use PhangoApp\PhaView\View; //use PhangoApp\PhaView\View;
use PhangoApp\PDO\MySQL; //use PhangoApp\WPDO\WPDO;
//use PhangoApp\PhaModels\Webmodel; //use PhangoApp\PhaModels\Webmodel;
include('./modules/admin/libraries/login.php'); include('./modules/admin/libraries/login.php');
function controller($switch='') { include('modules/admin/libraries/tplcontroller.php');
session_start(); class AppController extends TplController{
switch($switch) { public function app($op='') {
switch($op) {
default: default:
if(PhangoModule\Admin\login()) { if($this->check_login()) {
if($switch=='') { //Default admin page.
echo View::load_view(['title' => 'Admin', 'content' => ''], 'dashboard');
} }
else { else {
//Include module admin. header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['login']));
}
}
else {
header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin', 'app', 'login'));
} }
@ -38,7 +31,9 @@ function controller($switch='') {
case 'login': case 'login':
$conn=MySQL::get_pdo_connection(); echo 'login';
/*$conn=MySQL::get_pdo_connection();
$sth=$conn->query('SELECT count(*) as num_items from useradmin'); $sth=$conn->query('SELECT count(*) as num_items from useradmin');
@ -46,17 +41,17 @@ function controller($switch='') {
if($count==0) { if($count==0) {
header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin', 'app', 'register')); header('Location: '.PhangoApp\PhaRouter\Url::make_url('admin', 'app', ['signup']));
} }
echo View::load_view(['login' => 1], 'login'); echo View::load_view(['login' => 1], 'login');*/
break; break;
case 'login_check': case 'login_check':
$conn=MySQL::get_pdo_connection(); /*$conn=MySQL::get_pdo_connection();
$data=['error' => 1]; $data=['error' => 1];
@ -179,10 +174,11 @@ function controller($switch='') {
header('Content-Type: application/json; charset=utf-8'); header('Content-Type: application/json; charset=utf-8');
return json_encode($data); return json_encode($data);*/
break; break;
} }
}
} }