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