Changed db connect and database query structure so PhpStorm can detect it.
This commit is contained in:
@@ -5,7 +5,7 @@ require_once ("../queries/connect.php");
|
|||||||
require_once ("../queries/checkInput.php");
|
require_once ("../queries/checkInput.php");
|
||||||
|
|
||||||
function getNietSlechtCountForPost(int $postID) : int {
|
function getNietSlechtCountForPost(int $postID) : int {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`
|
`userID`
|
||||||
FROM
|
FROM
|
||||||
@@ -19,7 +19,7 @@ function getNietSlechtCountForPost(int $postID) : int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNietSlechtUsersForPost(int $postID) {
|
function getNietSlechtUsersForPost(int $postID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
|
|||||||
@@ -9,3 +9,7 @@ else {
|
|||||||
"$dbconf->mysql_username", "$dbconf->mysql_password")
|
"$dbconf->mysql_username", "$dbconf->mysql_password")
|
||||||
or die('Error connecting to mysql server');
|
or die('Error connecting to mysql server');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepareQuery(string $query) : PDOStatement {
|
||||||
|
return $GLOBALS["db"]->prepare($query);
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function sendConfirmEmailUsername(string $username) {
|
function sendConfirmEmailUsername(string $username) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`
|
`userID`
|
||||||
FROM
|
FROM
|
||||||
@@ -16,7 +16,7 @@ function sendConfirmEmailUsername(string $username) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendConfirmEmail(int $userID) {
|
function sendConfirmEmail(int $userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`,
|
`email`,
|
||||||
`fname`
|
`fname`
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function selectFriends($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectLimitedFriends($userID, $limit) {
|
function selectLimitedFriends($userID, $limit) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -41,7 +41,7 @@ function selectLimitedFriends($userID, $limit) {
|
|||||||
|
|
||||||
|
|
||||||
function selectAllFriends($userID) {
|
function selectAllFriends($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -73,7 +73,7 @@ function selectAllFriends($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectAllFriendRequests() {
|
function selectAllFriendRequests() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -115,7 +115,7 @@ function getFriendshipStatus($userID) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
CASE `status` IS NULL
|
CASE `status` IS NULL
|
||||||
WHEN TRUE THEN 0
|
WHEN TRUE THEN 0
|
||||||
@@ -148,7 +148,7 @@ function getFriendshipStatus($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function requestFriendship($userID) {
|
function requestFriendship($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO `friendship` (user1ID, user2ID)
|
INSERT INTO `friendship` (user1ID, user2ID)
|
||||||
VALUES (:user1, :user2)
|
VALUES (:user1, :user2)
|
||||||
");
|
");
|
||||||
@@ -159,7 +159,7 @@ function requestFriendship($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeFriendship($userID) {
|
function removeFriendship($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
DELETE FROM `friendship`
|
DELETE FROM `friendship`
|
||||||
WHERE
|
WHERE
|
||||||
`user1ID` = :user1 AND
|
`user1ID` = :user1 AND
|
||||||
@@ -175,7 +175,7 @@ function removeFriendship($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function acceptFriendship($userID) {
|
function acceptFriendship($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE `friendship`
|
UPDATE `friendship`
|
||||||
SET `status`='confirmed'
|
SET `status`='confirmed'
|
||||||
WHERE
|
WHERE
|
||||||
@@ -190,7 +190,7 @@ function acceptFriendship($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setLastVisited($friend) {
|
function setLastVisited($friend) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`friendship`
|
`friendship`
|
||||||
SET `friendship`.chatLastVisted1=(
|
SET `friendship`.chatLastVisted1=(
|
||||||
@@ -220,7 +220,7 @@ function setLastVisited($friend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeFriends($n, $m, $search) {
|
function searchSomeFriends($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ function selectAllGroupsFromUser($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectLimitedGroupsFromUser($userID, $limit) {
|
function selectLimitedGroupsFromUser($userID, $limit) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
@@ -28,7 +28,7 @@ function selectLimitedGroupsFromUser($userID, $limit) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeOwnGroups($n, $m, $search) {
|
function searchSomeOwnGroups($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
require("connect.php");
|
require("connect.php");
|
||||||
|
|
||||||
function selectGroupByName($name) {
|
function selectGroupByName($name) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -29,7 +29,7 @@ function selectGroupByName($name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectGroupMembers(int $groupID) {
|
function selectGroupMembers(int $groupID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`username`,
|
`username`,
|
||||||
`fname`,
|
`fname`,
|
||||||
@@ -54,7 +54,7 @@ function selectGroupMembers(int $groupID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectGroupById($groupID) {
|
function selectGroupById($groupID) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`,
|
`group_page`.`picture`,
|
||||||
@@ -73,7 +73,7 @@ function selectGroupById($groupID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsFromN($n) {
|
function select20GroupsFromN($n) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -95,7 +95,7 @@ function select20GroupsFromN($n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select20GroupsByStatusFromN($n, $status) {
|
function select20GroupsByStatusFromN($n, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
@@ -120,7 +120,7 @@ function select20GroupsByStatusFromN($n, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
function search20GroupsFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`,
|
`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -147,7 +147,7 @@ function search20GroupsFromNByStatus($n, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
|
function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
|
||||||
$q = $GLOBALS['db']->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`groupID`,
|
`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -175,7 +175,7 @@ function searchSomeGroupsByStatus($n, $m, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeGroupsByStatus($keyword, $status) {
|
function countSomeGroupsByStatus($keyword, $status) {
|
||||||
$q = $GLOBALS['db']->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -196,7 +196,7 @@ function countSomeGroupsByStatus($keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeGroupStatusByID($id, $status) {
|
function changeGroupStatusByID($id, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`group_page`
|
`group_page`
|
||||||
SET
|
SET
|
||||||
@@ -212,7 +212,7 @@ function changeGroupStatusByID($id, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeMultipleGroupStatusByID($ids, $status) {
|
function changeMultipleGroupStatusByID($ids, $status) {
|
||||||
$q = $GLOBALS['db']->prepare("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`group_page`
|
`group_page`
|
||||||
SET
|
SET
|
||||||
@@ -229,7 +229,7 @@ function changeMultipleGroupStatusByID($ids, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeGroups($n, $m, $search) {
|
function searchSomeGroups($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`name`,
|
`name`,
|
||||||
`picture`
|
`picture`
|
||||||
@@ -252,7 +252,7 @@ function searchSomeGroups($n, $m, $search) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeGroups($search) {
|
function countSomeGroups($search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -268,4 +268,3 @@ function countSomeGroups($search) {
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
return $stmt;
|
return $stmt;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
function getHeaderInfo() {
|
function getHeaderInfo() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`password`,
|
`password`,
|
||||||
`userID`,
|
`userID`,
|
||||||
@@ -61,5 +61,4 @@ class loginException extends Exception
|
|||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectPostById($postID) {
|
function selectPostById($postID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`user`.`fname`,
|
`user`.`fname`,
|
||||||
`user`.`lname`,
|
`user`.`lname`,
|
||||||
@@ -26,7 +26,7 @@ function selectPostById($postID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectCommentsByPostId($postID) {
|
function selectCommentsByPostId($postID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`comment`.`commentID`,
|
`comment`.`commentID`,
|
||||||
`comment`.`postID`,
|
`comment`.`postID`,
|
||||||
@@ -52,7 +52,7 @@ function selectCommentsByPostId($postID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makePost($userID, $groupID, $title, $content) {
|
function makePost($userID, $groupID, $title, $content) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`post` (
|
`post` (
|
||||||
`author`,
|
`author`,
|
||||||
@@ -76,7 +76,7 @@ function makePost($userID, $groupID, $title, $content) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeComment($postID, $userID, $content) : int {
|
function makeComment($postID, $userID, $content) : int {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`comment` (
|
`comment` (
|
||||||
`postID`,
|
`postID`,
|
||||||
@@ -106,7 +106,7 @@ function makeNietSlecht(int $postID, int $userID) : int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function checkNietSlecht(int $postID, int $userID) {
|
function checkNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -122,7 +122,7 @@ function checkNietSlecht(int $postID, int $userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addNietSlecht(int $postID, int $userID) {
|
function addNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`niet_slecht` (`userID`, `postID`)
|
`niet_slecht` (`userID`, `postID`)
|
||||||
VALUES (:userID, :postID)
|
VALUES (:userID, :postID)
|
||||||
@@ -134,7 +134,7 @@ function addNietSlecht(int $postID, int $userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteNietSlecht(int $postID, int $userID) {
|
function deleteNietSlecht(int $postID, int $userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
`niet_slecht`
|
`niet_slecht`
|
||||||
WHERE
|
WHERE
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ function getOldChatMessages($user2ID) {
|
|||||||
require_once ("friendship.php");
|
require_once ("friendship.php");
|
||||||
$user1ID = $_SESSION["userID"];
|
$user1ID = $_SESSION["userID"];
|
||||||
if (getFriendshipStatus($user2ID) == 1) {
|
if (getFriendshipStatus($user2ID) == 1) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -32,7 +32,7 @@ function getOldChatMessages($user2ID) {
|
|||||||
function sendMessage($destination, $content) {
|
function sendMessage($destination, $content) {
|
||||||
require_once("friendship.php");
|
require_once("friendship.php");
|
||||||
if (getFriendshipStatus($destination) == 1) {
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`private_message`
|
`private_message`
|
||||||
(
|
(
|
||||||
@@ -61,7 +61,7 @@ function sendMessage($destination, $content) {
|
|||||||
function getNewChatMessages($lastID, $destination) {
|
function getNewChatMessages($lastID, $destination) {
|
||||||
require_once("friendship.php");
|
require_once("friendship.php");
|
||||||
if (getFriendshipStatus($destination) == 1) {
|
if (getFriendshipStatus($destination) == 1) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
*
|
*
|
||||||
FROM
|
FROM
|
||||||
@@ -91,7 +91,7 @@ function getNewChatMessages($lastID, $destination) {
|
|||||||
|
|
||||||
|
|
||||||
function selectAllUnreadChat() {
|
function selectAllUnreadChat() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
|
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) AS `fullname`,
|
||||||
`user`.`userID`,
|
`user`.`userID`,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function getExistingUsername() {
|
function getExistingUsername() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`username`
|
`username`
|
||||||
FROM
|
FROM
|
||||||
@@ -17,7 +17,7 @@ function getExistingUsername() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getExistingEmail() {
|
function getExistingEmail() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
@@ -33,7 +33,7 @@ function getExistingEmail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getResetEmail() {
|
function getResetEmail() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
@@ -49,7 +49,7 @@ function getResetEmail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function registerAccount() {
|
function registerAccount() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
INSERT INTO
|
INSERT INTO
|
||||||
`user`(fname,
|
`user`(fname,
|
||||||
lname,
|
lname,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ include_once "../queries/connect.php";
|
|||||||
|
|
||||||
function sendPasswordRecovery(string $email) {
|
function sendPasswordRecovery(string $email) {
|
||||||
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`
|
`username`
|
||||||
@@ -39,7 +39,7 @@ function doSendPasswordRecovery(int $userID, string $email, string $username, st
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setHashToDatabase(int $userID, string $hash) {
|
function setHashToDatabase(int $userID, string $hash) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class AngryAlert extends AlertMessage {
|
|||||||
* @return mixed Setting as an array.
|
* @return mixed Setting as an array.
|
||||||
*/
|
*/
|
||||||
function getSettings() {
|
function getSettings() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`fname`,
|
`fname`,
|
||||||
`lname`,
|
`lname`,
|
||||||
@@ -77,7 +77,7 @@ function getSettings() {
|
|||||||
* @return mixed passwordhash
|
* @return mixed passwordhash
|
||||||
*/
|
*/
|
||||||
function getPasswordHash() {
|
function getPasswordHash() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`password`,
|
`password`,
|
||||||
`username`
|
`username`
|
||||||
@@ -96,7 +96,7 @@ function getPasswordHash() {
|
|||||||
* @throws HappyAlert
|
* @throws HappyAlert
|
||||||
*/
|
*/
|
||||||
function updateSettings() {
|
function updateSettings() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -146,7 +146,7 @@ function changePassword() {
|
|||||||
* @throws HappyAlert
|
* @throws HappyAlert
|
||||||
*/
|
*/
|
||||||
function doChangePassword() {
|
function doChangePassword() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -184,7 +184,7 @@ function changeEmail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function emailIsAvailableInDatabase($email) {
|
function emailIsAvailableInDatabase($email) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`email`
|
`email`
|
||||||
FROM
|
FROM
|
||||||
@@ -201,7 +201,7 @@ function emailIsAvailableInDatabase($email) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function doChangeEmail($email) {
|
function doChangeEmail($email) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -245,7 +245,7 @@ function updateAvatar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removeOldAvatar() {
|
function removeOldAvatar() {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`profilepicture`
|
`profilepicture`
|
||||||
FROM
|
FROM
|
||||||
@@ -262,7 +262,7 @@ function removeOldAvatar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setAvatarToDatabase(string $url) {
|
function setAvatarToDatabase(string $url) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require("connect.php");
|
require_once ("connect.php");
|
||||||
|
|
||||||
function getUserID($username) {
|
function getUserID($username) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`
|
`userID`
|
||||||
FROM
|
FROM
|
||||||
@@ -18,7 +18,7 @@ function getUserID($username) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getUsername($userID) {
|
function getUsername($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`username`
|
`username`
|
||||||
FROM
|
FROM
|
||||||
@@ -33,7 +33,7 @@ function getUsername($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectUser($me, $other) {
|
function selectUser($me, $other) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -81,7 +81,7 @@ function selectUser($me, $other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectAllUserGroups($userID) {
|
function selectAllUserGroups($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`groupID`,
|
`group_page`.`groupID`,
|
||||||
`name`,
|
`name`,
|
||||||
@@ -104,7 +104,7 @@ function selectAllUserGroups($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectAllUserPosts($userID) {
|
function selectAllUserPosts($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`post`.`postID`,
|
`post`.`postID`,
|
||||||
`post`.`author`,
|
`post`.`author`,
|
||||||
@@ -146,7 +146,7 @@ function selectAllUserPosts($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function select20UsersFromN($n) {
|
function select20UsersFromN($n) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -167,7 +167,7 @@ function select20UsersFromN($n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromN($n, $keyword) {
|
function search20UsersFromN($n, $keyword) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -191,7 +191,7 @@ function search20UsersFromN($n, $keyword) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function search20UsersFromNByStatus($n, $keyword, $status) {
|
function search20UsersFromNByStatus($n, $keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -219,7 +219,7 @@ function search20UsersFromNByStatus($n, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeUsersByStatus($n, $m, $keyword, $status) {
|
function searchSomeUsersByStatus($n, $m, $keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -248,7 +248,7 @@ function searchSomeUsersByStatus($n, $m, $keyword, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeUsersByStatus($keyword, $status) {
|
function countSomeUsersByStatus($keyword, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -271,7 +271,7 @@ function countSomeUsersByStatus($keyword, $status) {
|
|||||||
|
|
||||||
|
|
||||||
function changeUserStatusByID($id, $status) {
|
function changeUserStatusByID($id, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -287,7 +287,7 @@ function changeUserStatusByID($id, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeMultipleUserStatusByID($ids, $status) {
|
function changeMultipleUserStatusByID($ids, $status) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
UPDATE
|
UPDATE
|
||||||
`user`
|
`user`
|
||||||
SET
|
SET
|
||||||
@@ -304,7 +304,7 @@ function changeMultipleUserStatusByID($ids, $status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function selectRandomNotFriendUser($userID) {
|
function selectRandomNotFriendUser($userID) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`user`.`username`
|
`user`.`username`
|
||||||
FROM
|
FROM
|
||||||
@@ -332,7 +332,7 @@ function selectRandomNotFriendUser($userID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchSomeUsers($n, $m, $search) {
|
function searchSomeUsers($n, $m, $search) {
|
||||||
$stmt = $GLOBALS["db"]->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`userID`,
|
`userID`,
|
||||||
`username`,
|
`username`,
|
||||||
@@ -367,7 +367,7 @@ function searchSomeUsers($n, $m, $search) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function countSomeUsers($search) {
|
function countSomeUsers($search) {
|
||||||
$q = $GLOBALS["db"]->prepare("
|
$q = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
@@ -389,7 +389,7 @@ function countSomeUsers($search) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRoleByID($userID) {
|
function getRoleByID($userID) {
|
||||||
$stmt = $GLOBALS['db']->prepare("
|
$stmt = prepareQuery("
|
||||||
SELECT
|
SELECT
|
||||||
`role`
|
`role`
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
Reference in New Issue
Block a user