Clean History
This commit is contained in:
76
src/Database/Connect.php
Executable file
76
src/Database/Connect.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\LobbySIO\Database;
|
||||
use App\LobbySIO\Config\Registry;
|
||||
|
||||
/**
|
||||
* Database connection class
|
||||
*
|
||||
* @author josh.north
|
||||
*/
|
||||
|
||||
|
||||
class Connect {
|
||||
public $dbconn;
|
||||
|
||||
// open conn
|
||||
public function __construct() {
|
||||
$this->openPDO();
|
||||
}
|
||||
|
||||
// close conn
|
||||
public function __destruct() {
|
||||
$this->dbconn = NULL;
|
||||
}
|
||||
|
||||
// class-internal to open the connection if not already open
|
||||
private function openPDO() {
|
||||
if ($this->dbconn == NULL) {
|
||||
$connstring = "" . Registry::DB_DRVR . ":host=" . Registry::DB_HOST . ";dbname=" . Registry::DB_NAME;
|
||||
$connoptions = [
|
||||
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
|
||||
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
|
||||
\PDO::ATTR_EMULATE_PREPARES => false,
|
||||
];
|
||||
try {
|
||||
$this->dbconn = new \PDO( $connstring, Registry::DB_USER, Registry::DB_PASS, $connoptions );
|
||||
} catch( \PDOException $e ) {
|
||||
echo __LINE__.$e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// insert or update something
|
||||
public function runQuery( $sql ) {
|
||||
try {
|
||||
$count = $this->dbconn->exec($sql) or print_r($this->dbconn->errorInfo());
|
||||
} catch(\PDOException $e) {
|
||||
echo __LINE__.$e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// select something
|
||||
public function getQuery( $sql ) {
|
||||
$stmt = $this->dbconn->query( $sql );
|
||||
$stmt->setFetchMode(\PDO::FETCH_ASSOC);
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
}
|
||||
42
src/Database/IDTypeInfo.php
Executable file
42
src/Database/IDTypeInfo.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\LobbySIO\Database;
|
||||
use App\LobbySIO\Config\Registry;
|
||||
|
||||
/**
|
||||
* Get id type info as array by id type id. Pass % for all.
|
||||
*
|
||||
* @author josh.north
|
||||
*/
|
||||
|
||||
class IDTypeInfo {
|
||||
public function getIDTypeInfo ($idtypeid){
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "idtypes.id as idtypes_id,
|
||||
" . Registry::DB_PRFX . "idtypes.name as idtypes_name
|
||||
FROM " . Registry::DB_PRFX . "idtypes
|
||||
WHERE " . Registry::DB_PRFX . "idtypes.id LIKE \"$idtypeid\"";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
}
|
||||
55
src/Database/SiteInfo.php
Executable file
55
src/Database/SiteInfo.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\LobbySIO\Database;
|
||||
use App\LobbySIO\Config\Registry;
|
||||
|
||||
/**
|
||||
* Get site info as array by site id. Pass % for all.
|
||||
*
|
||||
* @author josh.north
|
||||
*/
|
||||
|
||||
class SiteInfo {
|
||||
public function getSiteInfo ($siteid){
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name,
|
||||
" . Registry::DB_PRFX . "sites.timezone as sites_timezone
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
WHERE " . Registry::DB_PRFX . "sites.id LIKE \"$siteid\"";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function getSiteName ($siteid) {
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "sites.id as sites_id,
|
||||
" . Registry::DB_PRFX . "sites.name as sites_name
|
||||
FROM " . Registry::DB_PRFX . "sites
|
||||
WHERE " . Registry::DB_PRFX . "sites.id LIKE $siteid";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows[0]["sites_name"];
|
||||
}
|
||||
|
||||
}
|
||||
140
src/Database/Users.php
Executable file
140
src/Database/Users.php
Executable file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\LobbySIO\Database;
|
||||
use App\LobbySIO\Config\Registry;
|
||||
|
||||
/**
|
||||
* User management functions
|
||||
*
|
||||
* @author josh.north
|
||||
*/
|
||||
class Users {
|
||||
// Get site info as array by site id. Pass % for all.
|
||||
public function getUserInfo($userid, $rowsperpage, $offset) {
|
||||
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
|
||||
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "users.id as users_id,
|
||||
" . Registry::DB_PRFX . "users.username as users_username,
|
||||
" . Registry::DB_PRFX . "users.email as users_email,
|
||||
" . Registry::DB_PRFX . "users.created as users_created,
|
||||
" . Registry::DB_PRFX . "users.firstname as users_firstname,
|
||||
" . Registry::DB_PRFX . "users.lastname as users_lastname,
|
||||
" . Registry::DB_PRFX . "users.usertype as users_usertypeid,
|
||||
" . Registry::DB_PRFX . "usertypes.name as users_usertype,
|
||||
" . Registry::DB_PRFX . "users.password as users_password
|
||||
FROM " . Registry::DB_PRFX . "users
|
||||
INNER JOIN " . Registry::DB_PRFX . "usertypes ON " . Registry::DB_PRFX . "users.usertype = " . Registry::DB_PRFX . "usertypes.id
|
||||
WHERE " . Registry::DB_PRFX . "users.id LIKE \"$userid\"
|
||||
ORDER BY " . Registry::DB_PRFX . "users.lastname ASC" . $cond_rowsperpage . $cond_offset;
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function loginUser ($username) {
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "users.id as users_id,
|
||||
" . Registry::DB_PRFX . "users.password as users_password,
|
||||
UNIX_TIMESTAMP(" . Registry::DB_PRFX . "users.created) AS users_salt,
|
||||
" . Registry::DB_PRFX . "users.firstname as users_firstname,
|
||||
" . Registry::DB_PRFX . "users.lastname as users_lastname
|
||||
FROM " . Registry::DB_PRFX . "users
|
||||
WHERE " . Registry::DB_PRFX . "users.username = \"$username\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function checkUser ($username, $email) {
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "users.username as users_username,
|
||||
" . Registry::DB_PRFX . "users.email as users_email
|
||||
FROM " . Registry::DB_PRFX . "users
|
||||
WHERE " . Registry::DB_PRFX . "users.username = \"$username\" OR " . Registry::DB_PRFX . "users.email = \"$email\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function addUser ($firstname, $lastname, $username, $timezone, $password, $email, $usertype) {
|
||||
$query = "
|
||||
INSERT INTO " . Registry::DB_PRFX . "users (" . Registry::DB_PRFX . "users.firstname, " . Registry::DB_PRFX . "users.lastname, " . Registry::DB_PRFX . "users.username, " . Registry::DB_PRFX . "users.timezone, " . Registry::DB_PRFX . "users.password, " . Registry::DB_PRFX . "users.email, " . Registry::DB_PRFX . "users.created, " . Registry::DB_PRFX . "users.usertype)
|
||||
VALUES (\"$firstname\", \"$lastname\", \"$username\", \"$timezone\", \"$password\", \"$email\", NOW(), \"$usertype\")
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
}
|
||||
|
||||
public function setUserInfo($uid, $firstname, $lastname, $email, $usertypeid, $password) {
|
||||
$query = "
|
||||
UPDATE
|
||||
" . Registry::DB_PRFX . "users
|
||||
SET
|
||||
" . Registry::DB_PRFX . "users.firstname = \"$firstname\",
|
||||
" . Registry::DB_PRFX . "users.lastname = \"$lastname\",
|
||||
" . Registry::DB_PRFX . "users.email = \"$email\",
|
||||
" . Registry::DB_PRFX . "users.usertype = \"$usertypeid\",
|
||||
" . Registry::DB_PRFX . "users.password = \"$password\"
|
||||
WHERE " . Registry::DB_PRFX . "users.id = \"$uid\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
}
|
||||
|
||||
public function getUserType ($usertypeid){
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "usertypes.id as usertypes_id,
|
||||
" . Registry::DB_PRFX . "usertypes.name as usertypes_name
|
||||
FROM " . Registry::DB_PRFX . "usertypes
|
||||
WHERE " . Registry::DB_PRFX . "usertypes.id LIKE \"$usertypeid\"";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public function deleteUser ($userid) {
|
||||
$query = "
|
||||
DELETE FROM " . Registry::DB_PRFX . "users WHERE " . Registry::DB_PRFX . "users.id=\"$userid\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
}
|
||||
|
||||
public function getUserTypeInfo ($usertypeid) {
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "usertypes.id as usertypes_id,
|
||||
" . Registry::DB_PRFX . "usertypes.name as usertypes_name
|
||||
FROM " . Registry::DB_PRFX . "usertypes
|
||||
WHERE " . Registry::DB_PRFX . "usertypes.id LIKE \"$usertypeid\"";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
78
src/Database/VisitActions.php
Executable file
78
src/Database/VisitActions.php
Executable file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\LobbySIO\Database;
|
||||
use App\LobbySIO\Config\Registry;
|
||||
|
||||
/**
|
||||
* Perform visit actions (approve/void/end/new)
|
||||
*
|
||||
* @author josh.north
|
||||
*/
|
||||
|
||||
class VisitActions {
|
||||
public function endVisit ($visitid, $outtime) {
|
||||
$query = "
|
||||
UPDATE " . Registry::DB_PRFX . "visits
|
||||
SET " . Registry::DB_PRFX . "visits.outtime = \"$outtime\"
|
||||
WHERE " . Registry::DB_PRFX . "visits.id = \"$visitid\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
}
|
||||
|
||||
public function voidVisit ($visitid, $approved) {
|
||||
$query = "
|
||||
UPDATE " . Registry::DB_PRFX . "visits
|
||||
SET " . Registry::DB_PRFX . "visits.approved = \"$approved\"
|
||||
WHERE " . Registry::DB_PRFX . "visits.id = \"$visitid\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
}
|
||||
|
||||
public function approveVisit ($approvevisit, $id_type, $id_checked, $citizen, $badge, $initials, $approved) {
|
||||
$query = "
|
||||
UPDATE " . Registry::DB_PRFX . "visits
|
||||
SET
|
||||
" . Registry::DB_PRFX . "visits.initials = \"$initials\",
|
||||
" . Registry::DB_PRFX . "visits.approved = \"$approved\",
|
||||
" . Registry::DB_PRFX . "visits.id_type = \"$id_type\",
|
||||
" . Registry::DB_PRFX . "visits.id_checked = \"$id_checked\",
|
||||
" . Registry::DB_PRFX . "visits.badge = \"$badge\",
|
||||
" . Registry::DB_PRFX . "visits.citizen = \"$citizen\"
|
||||
WHERE " . Registry::DB_PRFX . "visits.id = \"$approvevisit\"
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
}
|
||||
|
||||
public function newVisit ($firstname, $lastname, $company, $reason, $intime, $signature, $siteid, $approved, $escort_signature, $escort) {
|
||||
$query = "
|
||||
INSERT INTO " . Registry::DB_PRFX . "visits (" . Registry::DB_PRFX . "visits.firstname, " . Registry::DB_PRFX . "visits.lastname,
|
||||
" . Registry::DB_PRFX . "visits.company, " . Registry::DB_PRFX . "visits.reason, " . Registry::DB_PRFX . "visits.intime,
|
||||
" . Registry::DB_PRFX . "visits.signature, " . Registry::DB_PRFX . "visits.site_id, " . Registry::DB_PRFX . "visits.approved,
|
||||
" . Registry::DB_PRFX . "visits.escort_signature, " . Registry::DB_PRFX . "visits.escort)
|
||||
VALUES (\"$firstname\", \"$lastname\", \"$company\", \"$reason\", \"$intime\", \"$signature\", \"$siteid\",
|
||||
\"$approved\", \"$escort_signature\", \"$escort\")
|
||||
";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$count = $database->runQuery($query);
|
||||
}
|
||||
}
|
||||
74
src/Database/VisitInfo.php
Executable file
74
src/Database/VisitInfo.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\LobbySIO\Database;
|
||||
use App\LobbySIO\Config\Registry;
|
||||
|
||||
/**
|
||||
* Get visit info as array by visit id. Pass % for all.
|
||||
* TODO - break into select sections for speed by pagination
|
||||
* Pass NULL for nulls, % for any not null
|
||||
*
|
||||
* @author josh.north
|
||||
*/
|
||||
|
||||
class VisitInfo {
|
||||
// Pass "empty" to get unset or empty valued rows, pass "%" for all rows, or pass int/string for 1 row.
|
||||
public function getVisitInfo ($siteid, $approved, $outtime, $visitid, $intime, $starttime, $endtime, $rowsperpage, $offset){
|
||||
if ($outtime === "empty") {
|
||||
$cond_outtime = Registry::DB_PRFX . "visits.outtime IS NULL AND ";
|
||||
} elseif ($outtime == "%") {
|
||||
$cond_outtime = NULL;
|
||||
} else {
|
||||
$cond_outtime = Registry::DB_PRFX . "visits.outtime LIKE \"$outtime\" AND ";
|
||||
};
|
||||
if ($rowsperpage == "%") { $cond_rowsperpage = NULL; } else { $cond_rowsperpage = " LIMIT " . Registry::ROWSPERPAGE; };
|
||||
if ($offset == "%") { $cond_offset = NULL; } else { $cond_offset = " OFFSET " . $offset; };
|
||||
if ($intime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime=\"$intime\" AND "; };
|
||||
if ($siteid == "%") { $cond_siteid = NULL; } else { $cond_siteid = Registry::DB_PRFX . "visits.site_id=\"$siteid\" AND "; };
|
||||
if ($visitid == "%") { $cond_visitid = NULL; } else { $cond_visitid = Registry::DB_PRFX . "visits.id LIKE \"$visitid\" AND "; };
|
||||
if ($starttime == "%") { $cond_intime = NULL; } else { $cond_intime = Registry::DB_PRFX . "visits.intime BETWEEN \"$starttime\" and \"$endtime\" AND "; };
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "visits.id as visits_id,
|
||||
" . Registry::DB_PRFX . "visits.intime as visits_intime,
|
||||
" . Registry::DB_PRFX . "visits.outtime as visits_outtime,
|
||||
" . Registry::DB_PRFX . "visits.firstname as visits_firstname,
|
||||
" . Registry::DB_PRFX . "visits.lastname as visits_lastname,
|
||||
" . Registry::DB_PRFX . "visits.signature as visits_signature,
|
||||
" . Registry::DB_PRFX . "visits.escort as visits_escort,
|
||||
" . Registry::DB_PRFX . "visits.escort_signature as visits_escort_signature,
|
||||
" . Registry::DB_PRFX . "visits.reason as visits_reason,
|
||||
" . Registry::DB_PRFX . "visits.citizen as visits_citizen,
|
||||
" . Registry::DB_PRFX . "visits.id_type as visits_id_type,
|
||||
" . Registry::DB_PRFX . "visits.id_checked as visits_id_checked,
|
||||
" . Registry::DB_PRFX . "visits.initials as visits_initials,
|
||||
" . Registry::DB_PRFX . "visits.badge as visits_badge,
|
||||
" . Registry::DB_PRFX . "visits.site_id as visits_site_id,
|
||||
" . Registry::DB_PRFX . "visits.company as visits_company,
|
||||
" . Registry::DB_PRFX . "visits.approved as visits_approved
|
||||
FROM " . Registry::DB_PRFX . "visits
|
||||
WHERE " . $cond_siteid . Registry::DB_PRFX . "visits.approved>=\"$approved\" AND " . $cond_outtime . $cond_intime . Registry::DB_PRFX . "visits.id LIKE \"$visitid\"" . $cond_rowsperpage . $cond_offset;
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
42
src/Database/VisitTypeInfo.php
Executable file
42
src/Database/VisitTypeInfo.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2018 josh.north
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace App\LobbySIO\Database;
|
||||
use App\LobbySIO\Config\Registry;
|
||||
|
||||
/**
|
||||
* Get visit type info as array by visit type id. Pass % for all.
|
||||
*
|
||||
* @author josh.north
|
||||
*/
|
||||
|
||||
class VisitTypeInfo {
|
||||
public function getVisitTypeInfo ($visittypeid){
|
||||
$query = "
|
||||
SELECT
|
||||
" . Registry::DB_PRFX . "visittypes.id as visittypes_id,
|
||||
" . Registry::DB_PRFX . "visittypes.name as visittypes_name
|
||||
FROM " . Registry::DB_PRFX . "visittypes
|
||||
WHERE " . Registry::DB_PRFX . "visittypes.id LIKE \"$visittypeid\"";
|
||||
$database = new \App\LobbySIO\Database\Connect();
|
||||
$rows = $database->getQuery($query);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
}
|
||||
1
src/Database/index.php
Normal file
1
src/Database/index.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php //PROTECT
|
||||
Reference in New Issue
Block a user