complete framework upload, make it to work with php5/php7/php8
* provide minimal instruction to start to work, adn minimal README also * fix guachi libraries to work with php8 also * fix the script to start a module, move or put missing files into docs as examples * send real http code, specially on 404 response if controllers are not present or error * fix index controller and not found logic model * provide default index and default ini configuration files
This commit is contained in:
parent
7ee4a28350
commit
be6445a6ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,7 +31,6 @@ storage/
|
|||||||
/*-shm
|
/*-shm
|
||||||
/*-wal
|
/*-wal
|
||||||
/guachi.ini
|
/guachi.ini
|
||||||
/modules.ini
|
|
||||||
/cache/*
|
/cache/*
|
||||||
/public/js/guachi.js
|
/public/js/guachi.js
|
||||||
*.css
|
*.css
|
||||||
|
11
README.md
11
README.md
@ -1,15 +1,18 @@
|
|||||||
# Skindb-webdb
|
# Skindb-webdb
|
||||||
|
|
||||||
|
Huge Minetest/Multicraft skin database interface!
|
||||||
|
|
||||||
## Contenido
|
## Introduction
|
||||||
|
|
||||||
|
A huge Minetest/Multicraft skin database interface that makes it possible to search for the skin of your choice.
|
||||||
|
this repository handle the sourcecode of the skin database web interface at https://skindb.sourceforge.io/
|
||||||
|
|
||||||
## Introduccion
|
This is the web front of huge skin database files at https://codeberg.org/minetest-stuffs/minetest-skindb-skindata
|
||||||
|
or the prefered site of https://git.minetest.io/minetest-stuffs/minetest-skindb-skindata repository files!
|
||||||
|
|
||||||
## HOW TO
|
## HOW TO
|
||||||
|
|
||||||
[docs/README.md](docs/README.md)**
|
This uses the GUACHI mini api framework, please refers to [docs/README.md](docs/README.md)
|
||||||
|
|
||||||
## LICENSE
|
## LICENSE
|
||||||
|
|
||||||
|
18
controllers/index.php
Normal file
18
controllers/index.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
____ _ _
|
||||||
|
/ ___|_ _ __ _ ___| |__ (_)
|
||||||
|
| | _| | | |/ _` |/ __| '_ \| |
|
||||||
|
| |_| | |_| | (_| | (__| | | | |
|
||||||
|
\____|\__,_|\__,_|\___|_| |_|_|
|
||||||
|
Copyright (c) 2014 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
Copyright (c) 2018 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
<vitronic2@gmail.com> <mastervitronic@vitronic.com.ve>
|
||||||
|
*/
|
||||||
|
|
||||||
|
class index_controller extends controller {
|
||||||
|
|
||||||
|
public function execute() {
|
||||||
|
$this->model->show();
|
||||||
|
}
|
||||||
|
}
|
9
controllers/notFound.php
Normal file
9
controllers/notFound.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*Controlador del modulo error 404*/
|
||||||
|
|
||||||
|
class notFound_controller extends controller {
|
||||||
|
public function execute() {
|
||||||
|
$this->model->show();
|
||||||
|
}
|
||||||
|
}
|
@ -1,37 +1,50 @@
|
|||||||
# skindb
|
# skindb-webdb
|
||||||
|
|
||||||
TODO
|
Huge Minetest/Multicraft skin database interface!
|
||||||
|
|
||||||
## Contenido
|
## Introduction
|
||||||
|
|
||||||
TODO
|
A huge Minetest/Multicraft skin database interface that makes it possible to search for the skin of your choice.
|
||||||
|
|
||||||
## Introduccion
|
This is the web front of huge skin database files at https://codeberg.org/minetest-stuffs/minetest-skindb-skindata
|
||||||
|
or the prefered site of https://git.minetest.io/minetest-stuffs/minetest-skindb-skindata repository files!
|
||||||
TODO
|
|
||||||
|
|
||||||
## How to use this repo
|
## How to use this repo
|
||||||
|
|
||||||
```
|
``` bash
|
||||||
rm -rf $HOME/Devel/minenux-skindb-webdb && mkdir $HOME/Devel
|
rm -rf $HOME/Devel/minenux-skindb-webdb && mkdir $HOME/Devel
|
||||||
|
|
||||||
git clone --recursive https://codeberg.org/codeigniter/erp-recibosapi $HOME/Devel/minenux-skindb-webdb
|
git clone --recursive https://codeberg.org/minenux/minenux-skindb-webdb $HOME/Devel/minenux-skindb-webdb
|
||||||
|
|
||||||
cd $HOME/Devel && git submodule foreach git checkout develop && git submodule foreach git pull
|
cd $HOME/Devel/minenux-skindb-webdb && git submodule foreach git checkout develop && git submodule foreach git pull
|
||||||
|
|
||||||
|
./server-sample
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deploy and develop
|
## How to start a module
|
||||||
|
|
||||||
TODO
|
``` bash
|
||||||
|
cd $HOME/Devel/minenux-skindb-webdb
|
||||||
|
|
||||||
|
./new_module public newlinktoshow
|
||||||
|
```
|
||||||
|
|
||||||
|
* `controllers/newlinktoshow.php`
|
||||||
|
* `models/newlinktoshow.php`
|
||||||
|
* http://localhost:<port>/newlinktoshow
|
||||||
|
|
||||||
|
## How to Deploy and develop
|
||||||
|
|
||||||
|
Start geany an browse the `Devel/minenux-skindb-webdb` directory for `skindb-webdb` proyect file!
|
||||||
|
|
||||||
#### Requisitos
|
#### Requisitos
|
||||||
|
|
||||||
* Linux:
|
* Linux:
|
||||||
* Debian 7+ o Alpine 3.12+ unicamente
|
* Debian 7+ Alpine 3.12+
|
||||||
* git 2.0+
|
* git 2.0+
|
||||||
* php 5+ 7+ o 8+
|
* php 5+ 7+ o 8+
|
||||||
* database
|
* database
|
||||||
* sqlite3 o perconadb 5.7+ (no se recomienda mariadb, pero sirve o tambien mysql 5.7) + myrocksdb
|
* sqlite3 / perconadb 5.7+
|
||||||
|
|
||||||
#### Despliegue
|
#### Despliegue
|
||||||
|
|
||||||
|
16
docs/example_controller.php
Normal file
16
docs/example_controller.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
____ _ _
|
||||||
|
/ ___|_ _ __ _ ___| |__ (_)
|
||||||
|
| | _| | | |/ _` |/ __| '_ \| |
|
||||||
|
| |_| | |_| | (_| | (__| | | | |
|
||||||
|
\____|\__,_|\__,_|\___|_| |_|_|
|
||||||
|
Copyright (c) 2014 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
Copyright (c) 2018 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
<vitronic2@gmail.com> <mastervitronic@vitronic.com.ve>
|
||||||
|
*/
|
||||||
|
class XXX_controller extends controller {
|
||||||
|
public function execute() {
|
||||||
|
$this->model->show();
|
||||||
|
}
|
||||||
|
}
|
25
docs/example_model.php
Normal file
25
docs/example_model.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
____ _ _
|
||||||
|
/ ___|_ _ __ _ ___| |__ (_)
|
||||||
|
| | _| | | |/ _` |/ __| '_ \| |
|
||||||
|
| |_| | |_| | (_| | (__| | | | |
|
||||||
|
\____|\__,_|\__,_|\___|_| |_|_|
|
||||||
|
Copyright (c) 2014 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
Copyright (c) 2018 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
*/
|
||||||
|
class XXX_model extends model {
|
||||||
|
private $sql;
|
||||||
|
private $err;
|
||||||
|
public function notFound() {
|
||||||
|
$this->borrow('notFound')->show();
|
||||||
|
}
|
||||||
|
public function show() {
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
public function save() {
|
||||||
|
print 'Hola Mundo!';
|
||||||
|
}
|
||||||
|
private function save_ok() {
|
||||||
|
}
|
||||||
|
}
|
36
guachi.ini
Normal file
36
guachi.ini
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
[db]
|
||||||
|
use_db = Off
|
||||||
|
;sqlite , sqlite3 , pgsql , mysqli , mysql_pdo , pgsql_pdo
|
||||||
|
db_type = 'sqlite3'
|
||||||
|
db_database = '/home/general/Devel/minenux-skindb-webdb/skindb.sqlite'
|
||||||
|
db_hostname = ''
|
||||||
|
db_username = ''
|
||||||
|
db_password = ''
|
||||||
|
db_port = ''
|
||||||
|
|
||||||
|
[security]
|
||||||
|
session_timeout = '300'
|
||||||
|
allowed_uploads = 'jpg|jpeg|gif|png|pdf|doc|docx|xls|xlsx|txt|rtf'
|
||||||
|
enforce_https = Off
|
||||||
|
|
||||||
|
[theme]
|
||||||
|
start_module = 'index'
|
||||||
|
|
||||||
|
[site]
|
||||||
|
siteName = 'minenux-skindb'
|
||||||
|
site_url = ''
|
||||||
|
|
||||||
|
[locale]
|
||||||
|
default_date_timezone = 'America/Caracas'
|
||||||
|
locale = 'en_US.UTF-8'
|
||||||
|
locale_money = 'en_US'
|
||||||
|
months_of_year = 'enero|febrero|marzo|abril|mayo|junio|julio|augosto|septiembre|octubre|noviembre|diciembre'
|
||||||
|
days_of_week = 'lunes|martes|miercoles|jueves|viernes|sabado|domingo'
|
||||||
|
|
||||||
|
[datetime]
|
||||||
|
date_format = 'Ymd'
|
||||||
|
date_time_format = 'YmdHis'
|
||||||
|
time_format = 'His'
|
||||||
|
|
||||||
|
[production]
|
||||||
|
production = Off
|
@ -10,6 +10,7 @@ Copyright (c) 2018 Díaz Víctor aka (Máster Vitronic)
|
|||||||
<vitronic2@gmail.com> <mastervitronic@vitronic.com.ve>
|
<vitronic2@gmail.com> <mastervitronic@vitronic.com.ve>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#[\AllowDynamicProperties]
|
||||||
class router {
|
class router {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
define("PASSWORD_MAX_LENGTH", 1000);
|
define("PASSWORD_MAX_LENGTH", 1000);
|
||||||
define("DIR_CONTROLLERS", ROOT . 'controllers' . DS );
|
define("DIR_CONTROLLERS", ROOT . 'controllers' . DS );
|
||||||
define("DIR_MODELS", ROOT . 'models' . DS );
|
define("DIR_MODELS", ROOT . 'models' . DS );
|
||||||
define("DIR_VIEWS", ROOT . 'views' . DS );
|
define("DIR_VIEWS", ROOT . 'public/views' . DS );
|
||||||
define("ERROR_MODULE",'notFound');
|
define("ERROR_MODULE",'notFound');
|
||||||
define("LOGIN_MODULE",'login');
|
define("LOGIN_MODULE",'login');
|
||||||
|
|
||||||
|
@ -1,253 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**!
|
|
||||||
* @package ReceiptAPI
|
|
||||||
* @filename upload.php
|
|
||||||
* @version 1.0
|
|
||||||
* @autor Díaz Urbaneja Víctor Eduardo Diex <diazvictor@tutamail.com>
|
|
||||||
* @date 22.11.2023 01:03:17 -04
|
|
||||||
*/
|
|
||||||
|
|
||||||
class api_v1_upload_model extends model {
|
|
||||||
|
|
||||||
private $sql;
|
|
||||||
private $err;
|
|
||||||
|
|
||||||
public function notFound() {
|
|
||||||
$this->borrow('notFound')->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Crea el directorio en el cloud
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private function create_cloud_dir() {
|
|
||||||
$dir = sprintf('%scloud/%s/%s/%s/', ROOT, date('Y'),date('m'),date('d'));
|
|
||||||
mkdir($dir, 0777, true);
|
|
||||||
return $dir ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decodifica un base64 y lo guarda en el filesystem
|
|
||||||
*/
|
|
||||||
private function save_file($b64,$filepath) {
|
|
||||||
$ifp = fopen( $filepath, 'wb' );
|
|
||||||
$data = explode(',', $b64);
|
|
||||||
if (isset($data[1])){
|
|
||||||
fwrite( $ifp, base64_decode($data[1]));
|
|
||||||
} else {
|
|
||||||
fwrite( $ifp, base64_decode($data[0]));
|
|
||||||
}
|
|
||||||
fclose($ifp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Crea el ID loco de PICCORO posta no es loco.. con esto identificas varias cosas, fecha, donde cuando
|
|
||||||
* ah y de paso se ordena solo ya que nunca dara unnumero menor a menos este el sistema trampeado
|
|
||||||
* @return string YYYYMMDDHHmmss
|
|
||||||
*/
|
|
||||||
private function mkid() {
|
|
||||||
return date('YmdHis');
|
|
||||||
}
|
|
||||||
|
|
||||||
private function save_ok($post) {
|
|
||||||
$result = true; /*esto es true a menos que algo salga mal*/
|
|
||||||
$validator = new validator(); /*inicializo la clase de validacion*/
|
|
||||||
/*los campos a validar en este arreglo, creo que se explica solos*/
|
|
||||||
$validations = [
|
|
||||||
'rif_agente' => [
|
|
||||||
'type' => 'string',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'fecha_recibo' => [
|
|
||||||
'type' => 'string',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'monto_recibo' => [
|
|
||||||
'type' => 'float',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'monto_excento' => [
|
|
||||||
'type' => 'float',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'monto_iva' => [
|
|
||||||
'type' => 'float',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'tasa_iva' => [
|
|
||||||
'type' => 'float',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'tipo_recibo' => [
|
|
||||||
'type' => 'enum',
|
|
||||||
'values' => ['factura', 'nota'],
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'adjunto' => [
|
|
||||||
'type' => 'string',
|
|
||||||
"required" => true
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
if (!empty($post["rif_sujeto"])) {
|
|
||||||
$validations = $validations + [
|
|
||||||
'num_recibo' => [
|
|
||||||
'type' => 'string',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
'num_control' => [
|
|
||||||
'type' => 'string',
|
|
||||||
"required" => true
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
$keys = [
|
|
||||||
"id_recibo",
|
|
||||||
"cod_recibo",
|
|
||||||
"num_recibo",
|
|
||||||
"num_control",
|
|
||||||
];
|
|
||||||
/*esto es una edicion por que id_recibo existe*/
|
|
||||||
if (isset($post["id_recibo"])) {
|
|
||||||
$validations = $validations + [
|
|
||||||
'id_recibo' => [
|
|
||||||
'type' => 'string',
|
|
||||||
"required" => true,
|
|
||||||
'maxlen' => 14,
|
|
||||||
'minlen' => 14,
|
|
||||||
]
|
|
||||||
];
|
|
||||||
$exist = $this->db->exist(
|
|
||||||
'apirec_recibo', $keys,
|
|
||||||
$post, 'id_recibo', $post["id_recibo"]
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
$exist = $this->db->exist(
|
|
||||||
'apirec_recibo', $keys, $post
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($exist) {
|
|
||||||
$this->err = "El campo " . $exist . " ya existe.";
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*hago todas las validaciones*/
|
|
||||||
$check = $validator->execute($validations);
|
|
||||||
if ($check[0] === false ) {
|
|
||||||
$this->err = $check[1];
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function save($post) {
|
|
||||||
$update = false;
|
|
||||||
$this->err = false;
|
|
||||||
$permission = $this->auth->getPermission('upload', $_SESSION['id_user']);
|
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
|
||||||
|
|
||||||
if (isset($post['id_recibo']) and intval($post['id_recibo'])) {
|
|
||||||
$update = true;
|
|
||||||
if (is_false($permission['update'])){
|
|
||||||
$this->err = 'Sin permisos para actualizar';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (is_false($permission['write'])) {
|
|
||||||
$this->err = 'Sin permisos de escritura';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->save_ok($post) === false || $this->err) {
|
|
||||||
print(json_encode([
|
|
||||||
'ok' => false,
|
|
||||||
'msg' => $this->err,
|
|
||||||
'id_recibo' => false
|
|
||||||
]));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*los campos a guardar*/
|
|
||||||
$keys = [
|
|
||||||
"id_recibo",
|
|
||||||
"rif_agente",
|
|
||||||
"rif_sujeto",
|
|
||||||
"cod_recibo",
|
|
||||||
"num_recibo",
|
|
||||||
"num_control",
|
|
||||||
"fecha_recibo",
|
|
||||||
"fecha_compra",
|
|
||||||
"monto_imponible",
|
|
||||||
"monto_excento",
|
|
||||||
"monto_iva",
|
|
||||||
"tasa_iva",
|
|
||||||
"tipo_recibo"
|
|
||||||
]; // @TODO: No se que son los *flags*
|
|
||||||
|
|
||||||
/*inicio la transaccion*/
|
|
||||||
if ($this->db->query("begin") == false) {
|
|
||||||
$this->notFound();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update) {
|
|
||||||
$id_recibo = $post['id_recibo'];
|
|
||||||
/*hago el update*/
|
|
||||||
if ($this->db->update("apirec_recibo", $id_recibo, 'id_recibo', $post, $keys) === false) {
|
|
||||||
$this->db->query("rollback");
|
|
||||||
$this->notFound();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$post["id_recibo"] = $this->mkid();
|
|
||||||
/*hago el insert*/
|
|
||||||
if ($this->db->insert("apirec_recibo", $post, $keys) === false) {
|
|
||||||
$this->db->query("rollback");
|
|
||||||
$this->notFound();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$id_recibo = $post["id_recibo"];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($post["adjunto"])) {
|
|
||||||
$this->db->delete('apirec_recibo_adjunto', 'id_recibo', $id_recibo);
|
|
||||||
$updir = $this->create_cloud_dir();
|
|
||||||
$filepath = $updir . $id_recibo;
|
|
||||||
|
|
||||||
$keys = ["id_recibo", "adjunto", "ruta"]; // @TODO: No se que son los *flags*
|
|
||||||
$values = [
|
|
||||||
"id_recibo" => $id_recibo,
|
|
||||||
"adjunto" => $post["adjunto"],
|
|
||||||
"ruta" => $filepath
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($this->db->insert("apirec_recibo_adjunto", $values, $keys) === false) {
|
|
||||||
$this->db->query("rollback");
|
|
||||||
$this->notFound();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->save_file($post["adjunto"], $filepath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*finalmente hago el commit y retorno*/
|
|
||||||
if ($this->db->query("commit") != false) {
|
|
||||||
print(json_encode([
|
|
||||||
'ok' => true,
|
|
||||||
'msg' => 'Guardado con exito!',
|
|
||||||
'id_recibo' => $id_recibo
|
|
||||||
]));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
print(json_encode([
|
|
||||||
'ok' => false,
|
|
||||||
'msg' => 'Err: Will Robinson!',
|
|
||||||
'id_recibo' => false
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
22
models/index.php
Normal file
22
models/index.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
____ _ _
|
||||||
|
/ ___|_ _ __ _ ___| |__ (_)
|
||||||
|
| | _| | | |/ _` |/ __| '_ \| |
|
||||||
|
| |_| | |_| | (_| | (__| | | | |
|
||||||
|
\____|\__,_|\__,_|\___|_| |_|_|
|
||||||
|
Copyright (c) 2014 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
Copyright (c) 2018 Díaz Víctor aka (Máster Vitronic)
|
||||||
|
<vitronic2@gmail.com> <mastervitronic@vitronic.com.ve>
|
||||||
|
*/
|
||||||
|
|
||||||
|
class index_model extends model {
|
||||||
|
|
||||||
|
public function notFound() {
|
||||||
|
$this->borrow('notFound')->view();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show() {
|
||||||
|
include(DIR_VIEWS."index.php");
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,9 @@ Copyright (c) 2018 Díaz Víctor aka (Máster Vitronic)
|
|||||||
class notFound_model extends model {
|
class notFound_model extends model {
|
||||||
|
|
||||||
public function show() {
|
public function show() {
|
||||||
header("Status: 404");
|
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
|
||||||
|
header($protocol . ' 404');
|
||||||
|
$GLOBALS['http_response_code'] = '404';
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
print(json_encode([
|
print(json_encode([
|
||||||
'msg'=>'Not Found'
|
'msg'=>'Not Found'
|
||||||
|
3
modules.ini
Normal file
3
modules.ini
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[public]
|
||||||
|
page[] = "index"
|
||||||
|
|
@ -79,9 +79,9 @@
|
|||||||
|
|
||||||
/* Copia de la plantillas*/
|
/* Copia de la plantillas*/
|
||||||
print "Creando el controlador, el modelo, la vista y los archivos asociados.\n";
|
print "Creando el controlador, el modelo, la vista y los archivos asociados.\n";
|
||||||
safe_copy("extras/plantillas/controller.php", "controllers/$module.php");
|
safe_copy("docs/example_controller.php", "controllers/$module.php");
|
||||||
print "Creando controllers/$module.php.\n";
|
print "Creando controllers/$module.php.\n";
|
||||||
safe_copy("extras/plantillas/model.php", "models/$module.php");
|
safe_copy("docs/example_model.php", "models/$module.php");
|
||||||
|
|
||||||
|
|
||||||
/* Seteando el nombre del modulo*/
|
/* Seteando el nombre del modulo*/
|
||||||
|
@ -16,7 +16,6 @@ require_once realpath(dirname( __DIR__ ) ) . '/lib/security.php';
|
|||||||
/*Iniciamos todas las instancias*/
|
/*Iniciamos todas las instancias*/
|
||||||
$auth = auth::iniciar();
|
$auth = auth::iniciar();
|
||||||
$router = router::iniciar();
|
$router = router::iniciar();
|
||||||
//$view = view::iniciar();
|
|
||||||
$view = null;
|
$view = null;
|
||||||
|
|
||||||
/*Se incluye el modelo*/
|
/*Se incluye el modelo*/
|
||||||
@ -38,3 +37,10 @@ if (file_exists($file = DIR_CONTROLLERS.$router->module.".php")) {
|
|||||||
unset($_controller);
|
unset($_controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
|
||||||
|
header($protocol . ' 412');
|
||||||
|
$GLOBALS['http_response_code'] = $code;
|
||||||
|
include(DIR_VIEWS."index.php");
|
||||||
|
}
|
||||||
|
1
public/views/index.html
Normal file
1
public/views/index.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<meta http-equiv="refresh" content="0; url=../" />
|
14
public/views/index.php
Normal file
14
public/views/index.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$htmlrender = '
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>SkinsDB</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
SkinDB API database!
|
||||||
|
</body>
|
||||||
|
</html>';
|
||||||
|
|
||||||
|
echo $htmlrender;
|
Loading…
x
Reference in New Issue
Block a user