Merge pull request #1 from giandonatoinverso/master
sync master branch with remote
This commit is contained in:
@@ -23,7 +23,6 @@ services:
|
|||||||
DATABASE_NAME: "qrcode"
|
DATABASE_NAME: "qrcode"
|
||||||
DATABASE_USER: "qrcode"
|
DATABASE_USER: "qrcode"
|
||||||
DATABASE_PASSWORD: "changeme"
|
DATABASE_PASSWORD: "changeme"
|
||||||
DATABASE_PREFIX: ""
|
|
||||||
DATABASE_CHARSET: "utf8"
|
DATABASE_CHARSET: "utf8"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/app/config:/var/www/html/config
|
- ./data/app/config:/var/www/html/config
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ a:hover {
|
|||||||
.navbar {
|
.navbar {
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
clear: both;
|
clear: both;
|
||||||
margin-bottom: 0
|
margin-bottom: 0;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-default {
|
.navbar-default {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ if(is_string($docker_cid)) {
|
|||||||
define('DATABASE_NAME', Getenv('DATABASE_NAME'));
|
define('DATABASE_NAME', Getenv('DATABASE_NAME'));
|
||||||
define('DATABASE_USER', Getenv('DATABASE_USER'));
|
define('DATABASE_USER', Getenv('DATABASE_USER'));
|
||||||
define('DATABASE_PASSWORD', Getenv('DATABASE_PASSWORD'));
|
define('DATABASE_PASSWORD', Getenv('DATABASE_PASSWORD'));
|
||||||
|
// This must have a trailing underscore.
|
||||||
|
// Example: qr_
|
||||||
define('DATABASE_PREFIX', Getenv('DATABASE_PREFIX'));
|
define('DATABASE_PREFIX', Getenv('DATABASE_PREFIX'));
|
||||||
define('DATABASE_CHARSET', Getenv('DATABASE_CHARSET'));
|
define('DATABASE_CHARSET', Getenv('DATABASE_CHARSET'));
|
||||||
} else {
|
} else {
|
||||||
@@ -20,6 +22,8 @@ if(is_string($docker_cid)) {
|
|||||||
define('DATABASE_NAME', "qrcode");
|
define('DATABASE_NAME', "qrcode");
|
||||||
define('DATABASE_USER', "root");
|
define('DATABASE_USER', "root");
|
||||||
define('DATABASE_PASSWORD', "root");
|
define('DATABASE_PASSWORD', "root");
|
||||||
|
// This must have a trailing underscore.
|
||||||
|
// Example: qr_
|
||||||
define('DATABASE_PREFIX', "");
|
define('DATABASE_PREFIX', "");
|
||||||
define('DATABASE_CHARSET', "utf8");
|
define('DATABASE_CHARSET', "utf8");
|
||||||
}
|
}
|
||||||
@@ -29,4 +33,4 @@ if(is_string($docker_cid)) {
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
+3
-3
@@ -25,12 +25,12 @@ $numQrcode_static = $db->getValue ("static_qrcodes", "count(*)");
|
|||||||
$total = $numQrcode_dynamic + $numQrcode_static;
|
$total = $numQrcode_dynamic + $numQrcode_static;
|
||||||
|
|
||||||
//Get Total scan
|
//Get Total scan
|
||||||
$numScan = $db->query("SELECT sum(scan) FROM dynamic_qrcodes");
|
$numScan = $db->query("SELECT sum(scan) FROM ".DATABASE_PREFIX."dynamic_qrcodes");
|
||||||
|
|
||||||
/* CREATED CHART *///I initialize the variables that will contain the daily values to 0 otherwise in the foreach loop they will be reset every time
|
/* CREATED CHART *///I initialize the variables that will contain the daily values to 0 otherwise in the foreach loop they will be reset every time
|
||||||
|
|
||||||
//Get the number of DYNAMIC qr code created in 7 days and total scan
|
//Get the number of DYNAMIC qr code created in 7 days and total scan
|
||||||
$createdQrcode_dynamic = $db->query("select `created_at`, `scan` from dynamic_qrcodes where `created_at` > curdate()-7;");
|
$createdQrcode_dynamic = $db->query("select `created_at`, `scan` from ".DATABASE_PREFIX."dynamic_qrcodes where `created_at` > curdate()-7;");
|
||||||
|
|
||||||
$dynamic_today = $dynamic_oneday = $dynamic_twoday = $dynamic_threeday = $dynamic_fourday = $dynamic_fiveday = $dynamic_sixday = 0;
|
$dynamic_today = $dynamic_oneday = $dynamic_twoday = $dynamic_threeday = $dynamic_fourday = $dynamic_fiveday = $dynamic_sixday = 0;
|
||||||
$scan_today = $scan_oneday = $scan_twoday = $scan_threeday = $scan_fourday = $scan_fiveday = $scan_sixday = 0;
|
$scan_today = $scan_oneday = $scan_twoday = $scan_threeday = $scan_fourday = $scan_fiveday = $scan_sixday = 0;
|
||||||
@@ -49,7 +49,7 @@ foreach ($createdQrcode_dynamic as $row) {
|
|||||||
|
|
||||||
/* SCAN CHART */
|
/* SCAN CHART */
|
||||||
//Get the number of STATIC qr code created in 7 days
|
//Get the number of STATIC qr code created in 7 days
|
||||||
$createdQrcode_static = $db->query("select `created_at` from static_qrcodes where `created_at` > curdate()-7;");
|
$createdQrcode_static = $db->query("select `created_at` from ".DATABASE_PREFIX."static_qrcodes where `created_at` > curdate()-7;");
|
||||||
|
|
||||||
$static_today = $static_oneday = $static_twoday = $static_threeday = $static_fourday = $static_fiveday = $static_sixday = 0;
|
$static_today = $static_oneday = $static_twoday = $static_threeday = $static_fourday = $static_fiveday = $static_sixday = 0;
|
||||||
foreach ($createdQrcode_static as $row) {
|
foreach ($createdQrcode_static as $row) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Function to create the tables and fill them with the default data
|
// Function to create the tables and fill them with the default data
|
||||||
function create_tables($db_host, $db_user, $db_password, $db_name, $db_port)
|
function create_tables($db_host, $db_user, $db_password, $db_name, $db_port, $db_prefix)
|
||||||
{
|
{
|
||||||
// Connect to the database
|
// Connect to the database
|
||||||
$mysqli = new mysqli($db_host,$db_user,$db_password,$db_name, $db_port);
|
$mysqli = new mysqli($db_host,$db_user,$db_password,$db_name, $db_port);
|
||||||
@@ -43,6 +43,9 @@ class Database {
|
|||||||
// Open the default SQL file
|
// Open the default SQL file
|
||||||
$query = file_get_contents('sql/sample_data.sql');
|
$query = file_get_contents('sql/sample_data.sql');
|
||||||
|
|
||||||
|
// Run prefix regex; if none is set, then it will replace #prefix# with an empty string.
|
||||||
|
$query = preg_replace('/#prefix#/', $db_prefix, $query);
|
||||||
|
|
||||||
// Execute a multi query
|
// Execute a multi query
|
||||||
$mysqli->multi_query($query);
|
$mysqli->multi_query($query);
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ if (!$database->create_database(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD,
|
|||||||
echo "The database could not be created, please check your database credentials!";
|
echo "The database could not be created, please check your database credentials!";
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
else if (!$database->create_tables(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)) {
|
else if (!$database->create_tables(DATABASE_HOST, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT, DATABASE_PREFIX)) {
|
||||||
echo "The database tables could not be created, please check your database credentials!";
|
echo "The database tables could not be created, please check your database credentials!";
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ SET time_zone = "+00:00";
|
|||||||
-- Struttura della tabella `admin_accounts`
|
-- Struttura della tabella `admin_accounts`
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `admin_accounts` (
|
CREATE TABLE IF NOT EXISTS `#prefix#admin_accounts` (
|
||||||
`id` int(25) NOT NULL AUTO_INCREMENT,
|
`id` int(25) NOT NULL AUTO_INCREMENT,
|
||||||
`user_name` varchar(50) NOT NULL,
|
`user_name` varchar(50) NOT NULL,
|
||||||
`password` varchar(255) NOT NULL,
|
`password` varchar(255) NOT NULL,
|
||||||
@@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS `admin_accounts` (
|
|||||||
-- Dump dei dati per la tabella `admin_accounts`
|
-- Dump dei dati per la tabella `admin_accounts`
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `admin_accounts` (`id`, `user_name`, `password`, `series_id`, `remember_token`, `expires`, `admin_type`) VALUES
|
INSERT INTO `#prefix#admin_accounts` (`id`, `user_name`, `password`, `series_id`, `remember_token`, `expires`, `admin_type`) VALUES
|
||||||
(1, 'superadmin', '$2y$10$xpZc5KC.aU2XHkcqhuZGFuAnqmtL4Unt8MysOyylceq.19XIyoZpG', 'F5V8N81eQKYJbiyj', '$2y$10$MRWA31CVjAmtrojbm4r18ezDfqC3msAxzJ1ZdbyoRpD5pxF3IdJG6', '2020-09-30 16:19:08', 'super');
|
(1, 'superadmin', '$2y$10$xpZc5KC.aU2XHkcqhuZGFuAnqmtL4Unt8MysOyylceq.19XIyoZpG', 'F5V8N81eQKYJbiyj', '$2y$10$MRWA31CVjAmtrojbm4r18ezDfqC3msAxzJ1ZdbyoRpD5pxF3IdJG6', '2020-09-30 16:19:08', 'super');
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
@@ -51,7 +51,7 @@ INSERT INTO `admin_accounts` (`id`, `user_name`, `password`, `series_id`, `remem
|
|||||||
-- Struttura della tabella `dynamic_qrcodes`
|
-- Struttura della tabella `dynamic_qrcodes`
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `dynamic_qrcodes` (
|
CREATE TABLE IF NOT EXISTS `#prefix#dynamic_qrcodes` (
|
||||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
`filename` varchar(45) NOT NULL,
|
`filename` varchar(45) NOT NULL,
|
||||||
`format` varchar(45) DEFAULT NULL,
|
`format` varchar(45) DEFAULT NULL,
|
||||||
@@ -71,7 +71,7 @@ CREATE TABLE IF NOT EXISTS `dynamic_qrcodes` (
|
|||||||
-- Dump dei dati per la tabella `dynamic_qrcodes`
|
-- Dump dei dati per la tabella `dynamic_qrcodes`
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `dynamic_qrcodes` (`id`, `filename`, `format`, `identifier`, `link`, `qrcode`, `scan`, `state`, `created_by`, `created_at`, `updated_by`, `updated_at`) VALUES
|
INSERT INTO `#prefix#dynamic_qrcodes` (`id`, `filename`, `format`, `identifier`, `link`, `qrcode`, `scan`, `state`, `created_by`, `created_at`, `updated_by`, `updated_at`) VALUES
|
||||||
(1, 'Facebook', 'png', 'rcCeC', 'https://facebook.com', 'Facebook.png', 0, 'enable', 0, '2020-09-01 15:35:13', 0, NULL),
|
(1, 'Facebook', 'png', 'rcCeC', 'https://facebook.com', 'Facebook.png', 0, 'enable', 0, '2020-09-01 15:35:13', 0, NULL),
|
||||||
(2, 'Amazon', 'png', 'F7GOY6', 'https://amazon.com', 'Amazon.png', 0, 'enable', 0, '2020-09-01 15:40:34', 0, NULL),
|
(2, 'Amazon', 'png', 'F7GOY6', 'https://amazon.com', 'Amazon.png', 0, 'enable', 0, '2020-09-01 15:40:34', 0, NULL),
|
||||||
(3, 'Youtube', 'png', '8dK5Nd', 'https://youtube.com', 'Youtube.png', 0, 'enable', 0, '2020-09-01 15:41:43', 0, NULL),
|
(3, 'Youtube', 'png', '8dK5Nd', 'https://youtube.com', 'Youtube.png', 0, 'enable', 0, '2020-09-01 15:41:43', 0, NULL),
|
||||||
@@ -85,7 +85,7 @@ INSERT INTO `dynamic_qrcodes` (`id`, `filename`, `format`, `identifier`, `link`,
|
|||||||
-- Struttura della tabella `static_qrcodes`
|
-- Struttura della tabella `static_qrcodes`
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `static_qrcodes` (
|
CREATE TABLE IF NOT EXISTS `#prefix#static_qrcodes` (
|
||||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
`filename` varchar(45) CHARACTER SET utf8 NOT NULL,
|
`filename` varchar(45) CHARACTER SET utf8 NOT NULL,
|
||||||
`format` varchar(45) DEFAULT NULL,
|
`format` varchar(45) DEFAULT NULL,
|
||||||
@@ -104,7 +104,7 @@ CREATE TABLE IF NOT EXISTS `static_qrcodes` (
|
|||||||
-- Dump dei dati per la tabella `static_qrcodes`
|
-- Dump dei dati per la tabella `static_qrcodes`
|
||||||
--
|
--
|
||||||
|
|
||||||
INSERT INTO `static_qrcodes` (`id`, `filename`, `format`, `type`, `content`, `qrcode`, `state`, `created_by`, `created_at`, `updated_by`, `updated_at`) VALUES
|
INSERT INTO `#prefix#static_qrcodes` (`id`, `filename`, `format`, `type`, `content`, `qrcode`, `state`, `created_by`, `created_at`, `updated_by`, `updated_at`) VALUES
|
||||||
(1, 'Text qr code', 'png', 'text', '<strong>Text:</strong> My first text', 'Text qr code.png', 'enable', 0, '2020-08-24 08:41:31', 0, NULL),
|
(1, 'Text qr code', 'png', 'text', '<strong>Text:</strong> My first text', 'Text qr code.png', 'enable', 0, '2020-08-24 08:41:31', 0, NULL),
|
||||||
(2, 'Email', 'jpg', 'email', '<strong>Email:</strong> assistance@domain.com<br><strong>Subject:</strong> Assistance request<br><strong>Message:</strong> Regarding my order N ° ... I require assistance', 'Email.jpg', 'enable', 0, '2020-08-24 08:44:13', 0, NULL),
|
(2, 'Email', 'jpg', 'email', '<strong>Email:</strong> assistance@domain.com<br><strong>Subject:</strong> Assistance request<br><strong>Message:</strong> Regarding my order N ° ... I require assistance', 'Email.jpg', 'enable', 0, '2020-08-24 08:44:13', 0, NULL),
|
||||||
(3, 'Call me', 'png', 'phone', '<strong>Phone number:</strong> 12563776756', 'Call me.png', 'enable', 0, '2020-08-24 08:45:10', 0, NULL),
|
(3, 'Call me', 'png', 'phone', '<strong>Phone number:</strong> 12563776756', 'Call me.png', 'enable', 0, '2020-08-24 08:45:10', 0, NULL),
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class Dynamic_Qrcode
|
|||||||
$dynamic_id = htmlspecialchars($_GET['dynamic_id'], ENT_QUOTES, 'UTF-8'); // get dynamic id
|
$dynamic_id = htmlspecialchars($_GET['dynamic_id'], ENT_QUOTES, 'UTF-8'); // get dynamic id
|
||||||
$old_filename = htmlspecialchars($_GET['filename'], ENT_QUOTES, 'UTF-8'); // get filename
|
$old_filename = htmlspecialchars($_GET['filename'], ENT_QUOTES, 'UTF-8'); // get filename
|
||||||
|
|
||||||
$query = $db->query("SELECT format FROM dynamic_qrcodes WHERE id=$dynamic_id"); // get format
|
$query = $db->query("SELECT format FROM ".DATABASE_PREFIX."dynamic_qrcodes WHERE id=$dynamic_id"); // get format
|
||||||
$format = $query[0]['format'];
|
$format = $query[0]['format'];
|
||||||
|
|
||||||
$data_to_db = $this->collect();
|
$data_to_db = $this->collect();
|
||||||
@@ -190,7 +190,7 @@ class Dynamic_Qrcode
|
|||||||
|
|
||||||
$db = getDbInstance();
|
$db = getDbInstance();
|
||||||
|
|
||||||
$query = $db->query("SELECT format FROM dynamic_qrcodes WHERE id=$dynamic_id");
|
$query = $db->query("SELECT format FROM ".DATABASE_PREFIX."dynamic_qrcodes WHERE id=$dynamic_id");
|
||||||
$format = $query[0]['format'];
|
$format = $query[0]['format'];
|
||||||
|
|
||||||
$db->where('id', $dynamic_id);
|
$db->where('id', $dynamic_id);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class MysqliDb
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $prefix = '';
|
public static $prefix = DATABASE_PREFIX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MySQLi instances
|
* MySQLi instances
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ class Static_Qrcode
|
|||||||
$static_id = htmlspecialchars($_GET['static_id'], ENT_QUOTES, 'UTF-8');
|
$static_id = htmlspecialchars($_GET['static_id'], ENT_QUOTES, 'UTF-8');
|
||||||
$old_filename = htmlspecialchars($_GET['filename'], ENT_QUOTES, 'UTF-8');
|
$old_filename = htmlspecialchars($_GET['filename'], ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
$query = $db->query("SELECT format FROM static_qrcodes WHERE id=$static_id"); // get format
|
$query = $db->query("SELECT format FROM ".DATABASE_PREFIX."static_qrcodes WHERE id=$static_id"); // get format
|
||||||
$format = $query[0]['format'];
|
$format = $query[0]['format'];
|
||||||
|
|
||||||
$data_to_db = $this->collect();
|
$data_to_db = $this->collect();
|
||||||
@@ -487,7 +487,7 @@ class Static_Qrcode
|
|||||||
|
|
||||||
$db = getDbInstance();
|
$db = getDbInstance();
|
||||||
|
|
||||||
$query = $db->query("SELECT format FROM static_qrcodes WHERE id=$static_id"); // get format
|
$query = $db->query("SELECT format FROM ".DATABASE_PREFIX."static_qrcodes WHERE id=$static_id"); // get format
|
||||||
$format = $query[0]['format'];
|
$format = $query[0]['format'];
|
||||||
|
|
||||||
$db->where('id', $static_id);
|
$db->where('id', $static_id);
|
||||||
|
|||||||
Reference in New Issue
Block a user