Skip to content

Commit

Permalink
completed: prefix for table, for multiple installation on a single da…
Browse files Browse the repository at this point in the history
…tabase | minor code fix | upgrade to version 6.8
  • Loading branch information
davide committed Dec 19, 2022
1 parent 7e82551 commit 2df021f
Show file tree
Hide file tree
Showing 34 changed files with 154 additions and 216 deletions.
7 changes: 7 additions & 0 deletions admin/assets/css/bootstrap.min.css

Large diffs are not rendered by default.

File renamed without changes.
19 changes: 0 additions & 19 deletions admin/class/Database.php

This file was deleted.

21 changes: 3 additions & 18 deletions admin/class/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function showAll($from_record_num, $records_per_page,$where){
$query = "SELECT
*
FROM
" . $this->table_name . " ".$where."
" .$this->prx. $this->table_name . " ".$where."
ORDER BY
id
LIMIT
Expand All @@ -136,7 +136,7 @@ function showAll($from_record_num, $records_per_page,$where){

public function countAll(){

$query = "SELECT id FROM files";
$query = "SELECT id FROM " .$this->prx."files";

$stmt = $this->conn->prepare( $query );
$stmt->execute();
Expand All @@ -148,7 +148,7 @@ public function countAll(){

public function countFetch($where){

$query = "SELECT id FROM files".$where."";
$query = "SELECT id FROM " .$this->prx."files".$where."";

$stmt = $this->conn->prepare( $query );
$stmt->execute();
Expand Down Expand Up @@ -302,21 +302,6 @@ function showById(){

}

// function rolename_id(){
// //select all data
// $query = "SELECT
// id, rolename
// FROM
// " . $this->table_name . "
// WHERE
// rolename = :rolename";

// $stmt = $this->conn->prepare( $query );
// $stmt->execute();

// return $stmt;
// }



}
Expand Down
15 changes: 8 additions & 7 deletions admin/class/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function initCheckSessVar(){
if($_FILES['info'.$i_real.'']['name']){
$this->img_info=$_FILES['info'.$i_real.'']['name'];
$this->img_tmp_info=$_FILES['info'.$i_real.'']['tmp_name'];
$this->uploadPicture();
$this->uploadInfo();
$_SESSION['sess_pict_info_'.$i_real.'']=$_FILES['info'.$i_real.'']['name'];
}else{
$_SESSION['sess_pict_info_'.$i_real.'']=$_POST['old_info_'.$i_real.''];
Expand Down Expand Up @@ -279,11 +279,11 @@ function destroyCheckSessVar(){


function insert(){
// if($this->type=="default"){
// $this->table="default_page";
// }else if($this->type=="custom"){
// $this->table="page";
// }
if($this->type=="default"){
$this->table="default_page";
}else if($this->type=="custom"){
$this->table="page";
}

// insert query
$query = "INSERT INTO
Expand Down Expand Up @@ -410,13 +410,14 @@ function update(){
$stmt->bindParam(':use_desc', $this->use_desc);
$stmt->bindParam(':id', $this->id);

if($stmt->execute()){
if($stmt->execute()){
$query1="SELECT * FROM ".$this->prx.$this->table." WHERE page_name = :page_name LIMIT 0,1";
$stmt1 = $this->conn->prepare($query1);
$stmt1->bindParam(':page_name', $this->page_name);
$stmt1->execute();
$row1 = $stmt1->fetch(PDO::FETCH_ASSOC);
$actualImage=$row1['img'];

if($this->header!=0){
if(($this->img)==$actualImage){
return true;
Expand Down
5 changes: 2 additions & 3 deletions admin/class/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,10 @@ function showAll($from_record_num, $records_per_page, $where){
function showById(){
$query = "SELECT *
FROM " .$this->prx. $this->table_name . "
WHERE id = ?
WHERE id = :id
LIMIT 0,1";

$stmt = $this->conn->prepare( $query );
$stmt->bindParam(1, $this->id);
$stmt->bindParam(":id", $this->id);
$stmt->execute();

$row = $stmt->fetch(PDO::FETCH_ASSOC);
Expand Down
12 changes: 7 additions & 5 deletions admin/core/fetchFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
}

// loading class
include("../class/Database.php");
include("../class/File.php");
include("../class/Settings.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();

$file = new File($db);
$settings = new Settings($db);
include "../inc/class_initialize.php";


$stmt=$settings->showLangAndName();
$lang=$settings->dashboard_language;
Expand Down
2 changes: 1 addition & 1 deletion admin/core/fetchPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

spl_autoload_register('autoloader');
function autoloader($class){
include("admin/class/$class.php");
include("../class/$class.php");
}


Expand Down
15 changes: 8 additions & 7 deletions admin/core/fetchUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
exit;
}

// loading class
include("../class/Database.php");
include("../class/User.php");
include("../class/Settings.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();

$user = new User($db);
$settings = new Settings($db);
include "../inc/class_initialize.php";


$stmt=$settings->showLangAndName();
$lang=$settings->dashboard_language;
Expand Down Expand Up @@ -86,7 +87,7 @@
<td>'.$last_login.'</td>
<td>
<a href="index.php?man=user&op=edit&idToMod='.$row['id'].'" class="btn btn-warning btn-icon-split">
<a href="index.php?man=users&op=edit&idToMod='.$row['id'].'" class="btn btn-warning btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-pen"></i>
</span>
Expand Down
13 changes: 7 additions & 6 deletions admin/core/mngColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@
exit;
}

// loading class
include("../class/Database.php");
include("../class/Colors.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();
$database = new Database();
$db = $database->getConnection();

$colors = new Colors($db);
include "../inc/class_initialize.php";

if(filter_input(INPUT_GET,"idToDel")){

Expand Down
13 changes: 8 additions & 5 deletions admin/core/mngFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@
}

// loading class
include("../class/Database.php");
include("../class/File.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();
$database = new Database();
$db = $database->getConnection();

include "../inc/class_initialize.php";

$file = new File($db);

if(filter_input(INPUT_GET,"idToDel")){

Expand Down
12 changes: 7 additions & 5 deletions admin/core/mngGallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
}

// loading class
include("../class/Database.php");
include("../class/File.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();
$database = new Database();
$db = $database->getConnection();

$file = new File($db);
include "../inc/class_initialize.php";

if(filter_input(INPUT_GET,"gallToDel")){
function removeFolder($folderName) {
Expand Down
23 changes: 10 additions & 13 deletions admin/core/mngMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,19 @@


session_start();
// if (!isset($_SESSION['loggedin'])) {
// header('Location: ../');
// exit;
// }

// loading class
include("../class/Database.php");
include("../class/Contact.php");
include("../class/Verify.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();

include "../inc/class_initialize.php";


$database = new Database();
$db = $database->getConnection();

$contact = new Contact($db);
$verify = new Verify($db);


if(!$_POST['name']||!$_POST['email']||!$_POST['message']||!$_POST['subject']){
Expand Down
19 changes: 10 additions & 9 deletions admin/core/mngMailRecap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@
// }

// loading class
include("../class/Database.php");
include("../class/Contact.php");
include("../class/Verify.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();

include "../inc/class_initialize.php";


$database = new Database();
$db = $database->getConnection();

$contact = new Contact($db);
$verify = new Verify($db);


if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recaptcha_response'])) {
Expand Down
20 changes: 12 additions & 8 deletions admin/core/mngPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@
}

// loading class
include("../class/Database.php");
include("../class/Page.php");
include("../class/Menu.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();
$database = new Database();
$db = $database->getConnection();

include "../inc/class_initialize.php";

$page = new Page($db);
$menu = new Menu($db);

if(filter_input(INPUT_GET,"idToDel")){

Expand Down Expand Up @@ -180,12 +181,15 @@
$page->header=0;
}


if($_POST['visual'][0]=="visual_img"){
$page->visual_img=1;
if($_FILES['myfile']['name']){
print_r("file caricato: err");
exit;
$page->img=$_FILES['myfile']['name'];
}else{
$query1="SELECT * FROM default_page WHERE page_name = :page_name LIMIT 0,1";
$query1="SELECT * FROM ".$page->prx."default_page WHERE page_name = :page_name LIMIT 0,1";
$stmt1 = $db->prepare($query1);
$stmt1->bindParam(':page_name', $page->page_name);
$stmt1->execute();
Expand Down
28 changes: 13 additions & 15 deletions admin/core/mngPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,22 @@


session_start();
// if (!isset($_SESSION['loggedin'])) {
// header('Location: ../');
// exit;
// }

$lang=$_POST['lang'];
require "../locale/$lang.php";

// loading class
include("../class/Database.php");
include("../class/User.php");
include("../class/Contact.php");
spl_autoload_register('autoloader');
function autoloader($class){
include("../class/$class.php");
}


$database = new Database();
$db = $database->getConnection();

include "../inc/class_initialize.php";

$lang=$_POST['lang'];
require "../locale/$lang.php";

$database = new Database();
$db = $database->getConnection();

$user = new User($db);
$contact = new Contact($db);

$resetForm = filter_input(INPUT_POST, "resetForm");
$resetMail = filter_input(INPUT_POST, "resetMail");
Expand Down
Loading

0 comments on commit 2df021f

Please sign in to comment.