public static function fallback() { $output = ['page' => 'home.twig', 'user' => User::checkLoginStatus(FALSE), 'activeAdsAmount' => self::getActiveAds(), 'usersAmount' => self::getUsers(), 'latestUpload' => self::latestUploadedAd()]; return $output; }
public static function getNewInterests() { $user = User::checkLoginStatus(FALSE); if ($user) { $sql = "SELECT user2.firstname, ads.title\n\t\t\t\tFROM user, ads, user_interested_in_ad, user as user2\n\t\t\t\tWHERE user2.id = user_interested_in_ad.user_id\n\t\t\t\tAND user_interested_in_ad.ad_id = ads.id\n\t\t\t\tAND user.id = ads.user_id \n\t\t\t\tAND ads.user_id = " . $user->id . "\n\t\t\t\tAND user_interested_in_ad.new = 1"; $data = DB::query($sql); $output = $data; } else { $output = FALSE; } return $output; }
private static function getInterestedUsers($adId, $userId) { //Kollar först om anv är inloggad, om nej ska man inte bli skickad till loginfomulär därför skickas FALSE med. $user = User::checkLoginStatus(FALSE); $cleanAdId = DB::clean($adId); $cleanUserId = DB::clean($userId); if ($user && $user->id == $cleanUserId) { $sql = "SELECT user.id \t\t\t\t\tAS id, \n\t\t\t\t\tuser.firstname \t\t\t\t\tAS firstname, \n\t\t\t\t\tuser.lastname \t\t\t\t\tAS lastname, \n\t\t\t\t\tuser.email \t\t\t\t\t\tAS email,\n\t\t\t\t\tuser_interested_in_ad.denied\tAS denied\n\t\t\t\t\tFROM user, user_interested_in_ad\n\t\t\t\t\tWHERE user.id = user_interested_in_ad.user_id\n\t\t\t\t\tAND user_interested_in_ad.ad_id = " . $cleanAdId . "\n\t\t\t\t\tORDER BY user_interested_in_ad.date DESC"; $data = DB::query($sql); $output = $data; } else { $output = FALSE; } return $output; }
public static function ohDearyMeQueueTheFourohfour() { $user = User::checkLoginStatus(false); $output = ['user' => $user, 'page' => '404.twig', 'browserTitle' => 'Sidan kan inte visas']; return $output; }