eliminazione file superflui, spostamento file read.php all'interno del progetto, aggiunta astrazione classe Qrcode, miglioramento download bulk, refactoring generale
Signed-off-by: giandonato.inverso@edempg.it <giandonato.inverso@studenti.unimi.it>
This commit is contained in:
committed by
giandonato.inverso@edempg.it
parent
995272fa8d
commit
9a0a2c7928
Executable
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
//Note: This file should be included first in every php page.
|
||||
require_once ('environment.php');
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 'On');
|
||||
define('BASE_PATH', dirname(dirname(__FILE__)));
|
||||
define('CURRENT_PAGE', basename($_SERVER['REQUEST_URI']));
|
||||
|
||||
require_once BASE_PATH . '/lib/MysqliDb/MysqliDb.php';
|
||||
require_once BASE_PATH . '/helpers/helpers.php';
|
||||
|
||||
/* SAVED QR CODES */
|
||||
//You can change the folder where the qr code will be saved
|
||||
define('SAVED_QRCODE_FOLDER', './saved_qrcode/');
|
||||
define('SAVED_QRCODE_DIRECTORY', BASE_PATH.'/saved_qrcode/');
|
||||
define('SAVED_QRCODE_URL', base_url().'/saved_qrcode/');
|
||||
|
||||
//You can change the page name for the redirect and the search parameter (the default is "id")
|
||||
define('READ_PATH', base_url().'/read.php?id=');
|
||||
|
||||
|
||||
/**
|
||||
* Get instance of DB object
|
||||
*/
|
||||
function getDbInstance() {
|
||||
return new MysqliDb (Array (
|
||||
'host' => DATABASE_HOST,
|
||||
'username' => DATABASE_USER,
|
||||
'password' => DATABASE_PASSWORD,
|
||||
'db'=> DATABASE_NAME,
|
||||
'port' => DATABASE_PORT,
|
||||
'prefix' => DATABASE_PREFIX,
|
||||
'charset' => DATABASE_CHARSET));
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DOCKER INSTALLATION
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
$docker_cid = getenv('DOCKER_CID');
|
||||
|
||||
if(is_string($docker_cid)) {
|
||||
define('DATABASE_HOST', Getenv('DATABASE_HOST'));
|
||||
define('DATABASE_PORT', filter_var(Getenv('DATABASE_PORT'), FILTER_VALIDATE_INT));
|
||||
define('DATABASE_NAME', Getenv('DATABASE_NAME'));
|
||||
define('DATABASE_USER', Getenv('DATABASE_USER'));
|
||||
define('DATABASE_PASSWORD', Getenv('DATABASE_PASSWORD'));
|
||||
// This must have a trailing underscore.
|
||||
// Example: qr_
|
||||
define('DATABASE_PREFIX', Getenv('DATABASE_PREFIX'));
|
||||
define('DATABASE_CHARSET', Getenv('DATABASE_CHARSET'));
|
||||
} else {
|
||||
define('DATABASE_HOST', "mariadb");
|
||||
define('DATABASE_PORT', "3306");
|
||||
define('DATABASE_NAME', "qrcode");
|
||||
define('DATABASE_USER', "root");
|
||||
define('DATABASE_PASSWORD', "root");
|
||||
// This must have a trailing underscore.
|
||||
// Example: qr_
|
||||
define('DATABASE_PREFIX', "");
|
||||
define('DATABASE_CHARSET', "utf8");
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| INSTALLATION WITHOUT CONTAINER
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user