From 40e4cfafe4457d79e48f6e6d4231bec8760ff616 Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 30 Oct 2015 12:43:09 -0400 Subject: [PATCH] Applied fixes from StyleCI --- _sakura/components/Bans.php | 2 -- _sakura/components/Comments.php | 7 ---- _sakura/components/Configuration.php | 5 --- _sakura/components/Database.php | 15 --------- _sakura/components/Forum.php | 9 ------ _sakura/components/Hashing.php | 8 ----- _sakura/components/Main.php | 35 -------------------- _sakura/components/Manage.php | 1 - _sakura/components/News.php | 8 ----- _sakura/components/Payments.php | 3 -- _sakura/components/Permissions.php | 3 -- _sakura/components/Rank.php | 17 ---------- _sakura/components/Session.php | 4 --- _sakura/components/Template.php | 1 - _sakura/components/Templates.php | 4 --- _sakura/components/Trick.php | 1 - _sakura/components/Upload.php | 1 - _sakura/components/Urls.php | 1 - _sakura/components/User.php | 37 --------------------- _sakura/components/Users.php | 46 --------------------------- _sakura/components/Whois.php | 6 ---- _sakura/components/database/mysql.php | 24 ++------------ _sakura/sakura.php | 2 -- public/authenticate.php | 1 - public/settings.php | 3 -- public/support.php | 3 -- 26 files changed, 3 insertions(+), 244 deletions(-) diff --git a/_sakura/components/Bans.php b/_sakura/components/Bans.php index 53329c7..34f498f 100755 --- a/_sakura/components/Bans.php +++ b/_sakura/components/Bans.php @@ -40,11 +40,9 @@ class Bans 'reason' => $ban['ban_reason'], ]; - } // Else just return false return false; - } } diff --git a/_sakura/components/Comments.php b/_sakura/components/Comments.php index 66ce880..b25aa1e 100755 --- a/_sakura/components/Comments.php +++ b/_sakura/components/Comments.php @@ -35,7 +35,6 @@ class Comments // Feed them into the sorter $this->comments = $this->sortComments($comments); - } // Sorting @@ -91,7 +90,6 @@ class Comments } return $layer; - } // Getting a single comment @@ -102,7 +100,6 @@ class Comments return Database::fetch('comments', false, [ 'comment_id' => [$cid, '='], ]); - } // Getting comment votes @@ -113,7 +110,6 @@ class Comments return Database::fetch('comment_votes', true, [ 'vote_comment' => [$cid, '='], ]); - } // Creating @@ -141,7 +137,6 @@ class Comments // Return success return [1, 'SUCCESS']; - } // Voting @@ -185,7 +180,6 @@ class Comments } return true; - } // Deleting @@ -196,6 +190,5 @@ class Comments return Database::delete('comments', [ 'comment_id' => [$cid, '='], ]); - } } diff --git a/_sakura/components/Configuration.php b/_sakura/components/Configuration.php index 0db5898..035aebf 100755 --- a/_sakura/components/Configuration.php +++ b/_sakura/components/Configuration.php @@ -38,7 +38,6 @@ class Configuration E_USER_ERROR ); } - } /* @@ -62,7 +61,6 @@ class Configuration // Assign the temporary array to the static one self::$database = $_DBCN; - } // Get values from the configuration on the file system @@ -85,7 +83,6 @@ class Configuration 'Unable to get local configuration value "' . $key . '"', E_USER_ERROR ); - } // Dynamically set local configuration values, does not update the configuration file @@ -105,7 +102,6 @@ class Configuration // Otherwise we just straight up assign it self::$local[$key] = $value; - } // Get values from the configuration in the database @@ -126,6 +122,5 @@ class Configuration 'Unable to get configuration value "' . $key . '"', E_USER_ERROR ); - } } diff --git a/_sakura/components/Database.php b/_sakura/components/Database.php index 809768e..65221e7 100755 --- a/_sakura/components/Database.php +++ b/_sakura/components/Database.php @@ -28,62 +28,47 @@ class Database // Initialise SQL wrapper self::$database = new $wrapper; - } // Select from database public static function select($table, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) { - return self::$database->select($table, $data, $order, $limit, $group, $distinct, $column, $prefix); - } // Fetch from database public static function fetch($table, $fetchAll = true, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) { - return self::$database->fetch($table, $fetchAll, $data, $order, $limit, $group, $distinct, $column, $prefix); - } // Insert into database public static function insert($table, $data, $prefix = null) { - return self::$database->insert($table, $data, $prefix); - } // Update in database public static function update($table, $data, $prefix = null) { - return self::$database->update($table, $data, $prefix); - } // Delete from database public static function delete($table, $data, $prefix = null) { - return self::$database->delete($table, $data, $prefix); - } // Count from database public static function count($table, $data = null, $prefix = null) { - return self::$database->count($table, $data, $prefix); - } // Get the ID of the last inserted item public static function lastInsertID($name = null) { - return self::$database->lastInsertID($name); - } } diff --git a/_sakura/components/Forum.php b/_sakura/components/Forum.php index 138e411..7f49bf4 100755 --- a/_sakura/components/Forum.php +++ b/_sakura/components/Forum.php @@ -77,7 +77,6 @@ class Forum // Return the resorted data return $return; - } // Get a forum or category @@ -137,7 +136,6 @@ class Forum // Return the forum/category return $forum; - } // Getting all topics from a forum @@ -182,7 +180,6 @@ class Forum } return $topics; - } // Get posts of a thread @@ -272,7 +269,6 @@ class Forum // Return the compiled topic data return $topic; - } // Get a forum ID from a topic ID @@ -291,7 +287,6 @@ class Forum // Return the forum id return $topic['forum_id']; - } // Get a topic ID from a post ID @@ -310,7 +305,6 @@ class Forum // Return the topic id return $post['topic_id']; - } // Parse different markup flavours @@ -337,7 +331,6 @@ class Forum default: return $text; } - } // Get forum statistics of a user @@ -359,7 +352,6 @@ class Forum ['topic_id'] )), ]; - } // Creating a new post @@ -416,6 +408,5 @@ class Forum // Return success return [1, 'SUCCESS', $getPost['forum_id'], $getPost['topic_id'], $getPost['post_id']]; - } } diff --git a/_sakura/components/Hashing.php b/_sakura/components/Hashing.php index ae96b78..fe805c4 100755 --- a/_sakura/components/Hashing.php +++ b/_sakura/components/Hashing.php @@ -46,7 +46,6 @@ class Hashing // Returns an array formatted like: [algorithm, iterations, salt, hash] public static function createHash($pass) { - $salt = base64_encode( \mcrypt_create_iv( self::$saltBytes, @@ -73,13 +72,11 @@ class Hashing ]; return $passwordData; - } // Validates hashed password public static function validatePassword($password, $params) { - if (count($params) < 4) { return false; } @@ -99,13 +96,11 @@ class Hashing ); return $validate; - } // Compares two strings $a and $b in length-constant time. public static function slowEquals($a, $b) { - $diff = strlen($a) ^ strlen($b); for ($i = 0; $i < strlen($a) && $i < strlen($b); $i++) { @@ -113,7 +108,6 @@ class Hashing } return $diff === 0; - } /* @@ -134,7 +128,6 @@ class Hashing private static function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false) { - $algorithm = strtolower($algorithm); if (!in_array($algorithm, hash_algos(), true)) { @@ -185,6 +178,5 @@ class Hashing return bin2hex(substr($output, 0, $key_length)); } - } } diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index b6e31d2..c1035e6 100755 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -26,27 +26,22 @@ class Main // "Dynamic" Configuration Configuration::initDB(); - } // Parse markdown public static function mdParse($text, $escape = false) { - $pd = new Parsedown(); return $escape ? $pd->setMarkupEscaped(true)->text($text) : $pd->text($text); - } // Get bbcodes public static function getBBcodes() { - return Database::fetch('bbcodes'); - } // Parse bbcodes @@ -71,15 +66,12 @@ class Main // Return the parsed text return $text; - } // Get emoticons public static function getEmotes() { - return Database::fetch('emoticons'); - } // Parsing emoticons @@ -100,7 +92,6 @@ class Main // Return the parsed text return $text; - } // Verify ReCAPTCHA @@ -125,7 +116,6 @@ class Main // Return shit return $resp; - } // Error Handler @@ -171,7 +161,6 @@ class Main ]); } - } switch ($errno) { @@ -263,7 +252,6 @@ class Main $errorPage .= ''; } - } $errorPage .= ' @@ -276,7 +264,6 @@ class Main // Die and display error message die($errorPage); - } // Send emails @@ -351,7 +338,6 @@ class Main // Else just return whatever return $send; - } // Cleaning strings @@ -375,7 +361,6 @@ class Main // Return clean string return $string; - } // Loading info pages @@ -387,7 +372,6 @@ class Main // Return the data if there is any else just return false return count($infopage) ? $infopage : false; - } // Validate MX records @@ -402,7 +386,6 @@ class Main // Return the record data return $record; - } // Check IP version @@ -424,7 +407,6 @@ class Main // Not an IP or unknown type return 0; - } // Convert inet_pton to string with bits @@ -447,7 +429,6 @@ class Main // Return IP return $binaryIP; - } // Match IP subnets @@ -493,7 +474,6 @@ class Main return 0; } - } // Check if IP is a CloudFlare IP @@ -526,7 +506,6 @@ class Main // Return false if fails return false; - } // Gets IP of current visitor @@ -546,7 +525,6 @@ class Main // Return the correct IP return $ip; - } // Get country code from CloudFlare header (which just returns XX if not found) @@ -560,7 +538,6 @@ class Main // Return XX as a fallback return 'XX'; - } // Create a new action code @@ -588,7 +565,6 @@ class Main // Return the key return $key; - } // Use an action code @@ -620,7 +596,6 @@ class Main // Return success return [1, 'SUCCESS', $keyRow['instruction']]; - } // Calculate password entropy @@ -632,7 +607,6 @@ class Main // Count the amount of unique characters in the password string and calculate the entropy return count(count_chars($pw, 1)) * log(256, 2); - } // Get country name from ISO 3166 code @@ -656,7 +630,6 @@ class Main // Else return unknown return 'Unknown'; - } // Get FAQ data @@ -668,7 +641,6 @@ class Main // Return FAQ data return $faq; - } // Get log type string @@ -685,7 +657,6 @@ class Main // Return the string return $return['string']; - } // Get formatted logs @@ -713,7 +684,6 @@ class Main // Return new logs return $logs; - } // Time elapsed @@ -750,7 +720,6 @@ class Main return $round . ' ' . $times[$secs] . ($round == 1 ? '' : 's') . $append; } } - } // Get the byte symbol from a value @@ -773,7 +742,6 @@ class Main // Return the formatted string return $bytes; - } // Get Premium tracker data @@ -808,13 +776,11 @@ class Main // Return the data return $data; - } // Update donation tracker public static function updatePremiumTracker($id, $amount, $comment) { - Database::insert('premium_log', [ 'user_id' => $id, @@ -823,6 +789,5 @@ class Main 'transaction_comment' => $comment, ]); - } } diff --git a/_sakura/components/Manage.php b/_sakura/components/Manage.php index de3ccbb..9faf2af 100755 --- a/_sakura/components/Manage.php +++ b/_sakura/components/Manage.php @@ -11,5 +11,4 @@ namespace Sakura; */ class Manage { - } diff --git a/_sakura/components/News.php b/_sakura/components/News.php index 0d17f19..c4e6e9d 100755 --- a/_sakura/components/News.php +++ b/_sakura/components/News.php @@ -41,31 +41,24 @@ class News // Add post to posts array $this->posts[$post['news_id']] = $post; } - } // Get the amount of posts public function getCount() { - return count($this->posts); - } // Get the amount of posts public function postExists($pid) { - return array_key_exists($pid, $this->posts) ? $pid : 0; - } // Get a single post public function getPost($pid) { - return array_key_exists($pid, $this->posts) ? $this->posts[$pid] : 0; - } // Getting posts @@ -85,6 +78,5 @@ class News } return $posts; - } } diff --git a/_sakura/components/Payments.php b/_sakura/components/Payments.php index efd8c26..157cb42 100755 --- a/_sakura/components/Payments.php +++ b/_sakura/components/Payments.php @@ -41,7 +41,6 @@ class Payments } return true; - } // Create transaction @@ -117,7 +116,6 @@ class Payments // Return the approval link if everything is gucci return $payment->getApprovalLink(); - } // Complete the PayPal transaction @@ -142,6 +140,5 @@ class Payments // If everything was cute return true return true; - } } diff --git a/_sakura/components/Permissions.php b/_sakura/components/Permissions.php index cd0ca36..59ee9d2 100755 --- a/_sakura/components/Permissions.php +++ b/_sakura/components/Permissions.php @@ -103,7 +103,6 @@ class Permissions // Else just return false return false; - } // Get permission data of a rank from the database @@ -150,7 +149,6 @@ class Permissions // Return the compiled permission strings return $perms; - } // Get permission data for a user @@ -191,6 +189,5 @@ class Permissions // Return permissions return $rankPerms; - } } diff --git a/_sakura/components/Rank.php b/_sakura/components/Rank.php index e94795e..1a5833c 100755 --- a/_sakura/components/Rank.php +++ b/_sakura/components/Rank.php @@ -32,70 +32,53 @@ class Rank // If not assign as the fallback rank $this->data = Users::$emptyRank; } - } // Get the rank id public function id() { - return $this->data['rank_id']; - } // Get the rank hierarchy public function hierarchy() { - return $this->data['rank_hierarchy']; - } // Get the rank name public function name($multi = false) { - return $this->data['rank_name'] . ($multi ? $this->data['rank_multiple'] : null); - } // Get the rank title public function title() { - return $this->data['rank_title']; - } // Get the rank description public function description() { - return $this->data['rank_description']; - } // Get the rank colour public function colour() { - return $this->data['rank_colour']; - } // Check if the rank is hidden public function hidden() { - return $this->data['rank_hidden'] || $this->checkPermission('SITE', 'DEACTIVATED') || $this->checkPermission('SITE', 'RESTRICTED'); - } // Check if the rank has the proper permissions public function checkPermission($layer, $action) { - return Permissions::check($layer, $action, [$this->id()], 2); - } } diff --git a/_sakura/components/Session.php b/_sakura/components/Session.php index f670ab4..70c718c 100755 --- a/_sakura/components/Session.php +++ b/_sakura/components/Session.php @@ -27,7 +27,6 @@ class Session if (session_status() != PHP_SESSION_ACTIVE) { session_start(); } - } // Destroy this session @@ -48,7 +47,6 @@ class Session if (session_status() == PHP_SESSION_ACTIVE) { session_destroy(); } - } // Create a new session @@ -71,7 +69,6 @@ class Session // Return the session key return $session; - } // Validate an apparently existing session @@ -155,6 +152,5 @@ class Session // Return 2 if the remember flag is set and return 1 if not return $session['session_remember'] ? 2 : 1; - } } diff --git a/_sakura/components/Template.php b/_sakura/components/Template.php index 275eec2..8d18614 100644 --- a/_sakura/components/Template.php +++ b/_sakura/components/Template.php @@ -11,5 +11,4 @@ namespace Sakura; */ class Template { - } diff --git a/_sakura/components/Templates.php b/_sakura/components/Templates.php index 89e6d89..9a489b3 100755 --- a/_sakura/components/Templates.php +++ b/_sakura/components/Templates.php @@ -45,7 +45,6 @@ class Templates // Start Twig self::twigLoader(); - } // Twig Loader @@ -68,18 +67,15 @@ class Templates // Load String template loader self::$engine->addExtension(new Twig_Extension_StringLoader()); - } // Render template public static function render($file, $tags) { - try { return self::$engine->render($file, $tags); } catch (\Exception $e) { trigger_error($e->getMessage(), E_USER_ERROR); } - } } diff --git a/_sakura/components/Trick.php b/_sakura/components/Trick.php index a48d080..66468f2 100644 --- a/_sakura/components/Trick.php +++ b/_sakura/components/Trick.php @@ -11,5 +11,4 @@ namespace Sakura; */ class Trick { - } diff --git a/_sakura/components/Upload.php b/_sakura/components/Upload.php index 20a1302..b2301ed 100755 --- a/_sakura/components/Upload.php +++ b/_sakura/components/Upload.php @@ -11,5 +11,4 @@ namespace Sakura; */ class Upload { - } diff --git a/_sakura/components/Urls.php b/_sakura/components/Urls.php index 938ce5b..7552ffa 100755 --- a/_sakura/components/Urls.php +++ b/_sakura/components/Urls.php @@ -291,6 +291,5 @@ class Urls // Return the formatted url return $formatted; - } } diff --git a/_sakura/components/User.php b/_sakura/components/User.php index 177d90c..0fca361 100755 --- a/_sakura/components/User.php +++ b/_sakura/components/User.php @@ -60,7 +60,6 @@ class User $this->data['rank_main'] : array_keys($this->ranks)[0] ]; - } // Check if the user has the specified ranks @@ -82,52 +81,41 @@ class User // If all fails return false return false; - } // Get the user's colour public function colour() { - return empty($this->data['user_colour']) ? $this->mainRank->colour() : $this->data['user_colour']; - } // Get the user's title public function userTitle() { - return empty($this->data['user_title']) ? $this->mainRank->title() : $this->data['user_title']; - } // Get the user's long and short country names public function country() { - return [ 'long' => Main::getCountryName($this->data['user_country']), 'short' => $this->data['user_country'], ]; - } // Check if a user is online public function checkOnline() { - return $this->data['user_last_online'] > (time() - Configuration::getConfig('max_online_time')); - } // Get user's forum statistics public function forumStats() { - return Forum::getUserStats($this->data['user_id']); - } // Add a new friend @@ -159,7 +147,6 @@ class User // Return true because yay return [1, $check == 2 ? 'FRIENDS' : 'NOT_MUTUAL']; - } // Remove a friend @@ -195,7 +182,6 @@ class User // Return true because yay return [1, 'REMOVED']; - } // Check if the user is friends with the currently authenticated @@ -220,45 +206,35 @@ class User // Return true if all went through return 0; - } // Get all the friend of this user public function getFriends($timestamps = false, $getData = false, $checkOnline = false) { - return Users::getFriends($this->data['user_id'], $timestamps, $getData, $checkOnline); - } // Check if the user is banned public function checkBan() { - return Bans::checkBan($this->data['user_id']); - } // Check if the user has the proper permissions public function checkPermission($layer, $action) { - return Permissions::check($layer, $action, $this->data['user_id'], 1); - } // Get a user's profile comments public function profileComments() { - return new Comments('profile-' . $this->data['user_id']); - } // Get amount of time since user events public function elapsed($append = ' ago', $none = 'Just now') { - return [ 'joined' => Main::timeElapsed($this->data['user_registered'], $append, $none), @@ -266,7 +242,6 @@ class User 'birth' => Main::timeElapsed(strtotime($this->data['user_birthday']), $append, $none), ]; - } // Get the user's profile fields @@ -334,7 +309,6 @@ class User // Return appropiate profile data return $profile; - } // Get the user's option fields @@ -375,7 +349,6 @@ class User // Return appropiate profile data return $options; - } // Check if user has Premium @@ -406,7 +379,6 @@ class User // Else return the start and expiration date return [1, $getRecord['premium_start'], $getRecord['premium_expire']]; - } // Get all warnings issued to the user @@ -458,13 +430,11 @@ class User // Return all the warnings return $warnings; - } // Get a user's userpage public function userPage() { - return isset($this->data['user_data']['userPage']) ? Main::mdParse( base64_decode( @@ -473,13 +443,11 @@ class User true ) : null; - } // Get a user's signature public function signature() { - return isset($this->data['user_data']['signature']) ? Main::bbParse( Main::parseEmotes( @@ -489,7 +457,6 @@ class User ) ) : null; - } // Get username change history @@ -503,7 +470,6 @@ class User // Return all the warnings return $changes; - } // Set a new username @@ -567,7 +533,6 @@ class User // Return success return [1, 'SUCCESS', $username]; - } // Set a new e-mail address @@ -601,7 +566,6 @@ class User // Return success return [1, 'SUCCESS', $email]; - } // Set a new password @@ -655,6 +619,5 @@ class User // Return success return [1, 'SUCCESS']; - } } diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index 19446d0..1b7b04d 100755 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -11,7 +11,6 @@ namespace Sakura; */ class Users { - // Empty user template public static $emptyUser = [ 'user_id' => 0, @@ -126,7 +125,6 @@ class Users // If everything went through return true return [$uid, $sid]; - } // Log a user in @@ -210,7 +208,6 @@ class Users // Successful login! (also has a thing for the legacy password system) return [1, 'LOGIN_SUCCESS', $user['user_id']]; - } // Logout and kill the session @@ -245,7 +242,6 @@ class Users // Return true indicating a successful logout return true; - } // Register user @@ -361,7 +357,6 @@ class Users // Return true with a specific message if needed return [1, ($requireActive ? 'EMAILSENT' : 'SUCCESS')]; - } // Check if a user exists and then send the password forgot email @@ -419,7 +414,6 @@ class Users // Return success return [1, 'SUCCESS']; - } // Reset password with key @@ -469,7 +463,6 @@ class Users // Return success return [1, 'SUCCESS']; - } // Check if a user exists and then resend the activation e-mail @@ -506,7 +499,6 @@ class Users // Return success return [1, 'SUCCESS']; - } // Send the activation e-mail and do other required stuff @@ -557,7 +549,6 @@ class Users // Return true indicating that the things have been sent return true; - } // Activating a user @@ -611,7 +602,6 @@ class Users // Return success return [1, 'SUCCESS']; - } // Deactivating a user @@ -644,7 +634,6 @@ class Users // Return success return [1, 'SUCCESS']; - } // Check if registration code is valid @@ -656,7 +645,6 @@ class Users // Check if it exists and return it return count($keyRow) ? $keyRow[0]['id'] : false; - } // Mark registration code as used @@ -681,7 +669,6 @@ class Users // Return true because yeah return true; - } // Create new registration code @@ -715,7 +702,6 @@ class Users // Return the code return $code; - } // Set the default rank of a user @@ -745,7 +731,6 @@ class Users // Return true if everything was successful return true; - } // Add a rank to a user @@ -781,7 +766,6 @@ class Users // Return true because return true; - } // Removing ranks from a user @@ -817,15 +801,12 @@ class Users // Return true return true; - } // Check if a user has these ranks public static function checkIfUserHasRanks($ranks, $userid, $userIdIsUserData = false) { - return $userIdIsUserData ? $userid->checkIfUserHasRanks($ranks) : (new User($userid))->checkIfUserHasRanks($ranks); - } // Check if a user exists @@ -840,7 +821,6 @@ class Users // Return count (which would return 0, aka false, if nothing was found) return count($user) ? $user[0]['user_id'] : false; - } // Get the available profile fields @@ -867,7 +847,6 @@ class Users // Return the yeahs return $fields; - } // Get the available option fields @@ -896,7 +875,6 @@ class Users // Return the yeahs return $fields; - } // Get user's profile fields @@ -966,7 +944,6 @@ class Users // Return appropiate profile data return $profile; - } // Updating the profile data of a user @@ -991,7 +968,6 @@ class Users 'user_id' => [$id, '='], ], ]); - } // Check if a user is online @@ -1008,7 +984,6 @@ class Users // Return true if the user was online in the last 5 minutes return ($user['user_last_online'] > (time() - 500)); - } // Get all online users @@ -1023,7 +998,6 @@ class Users // Return all the online users return $getAll; - } // Add premium to a user @@ -1059,17 +1033,14 @@ class Users // Return the expiration timestamp return $expire; - } // Remove the premium status of a user public static function removeUserPremium($id) { - Database::delete('premium', [ 'user_id' => [$id, '='], ]); - } // Check if user has Premium @@ -1100,7 +1071,6 @@ class Users // Else return the start and expiration date return [1, $getRecord['premium_start'], $getRecord['premium_expire']]; - } // Update the premium data @@ -1126,7 +1096,6 @@ class Users // Else remove the rank from them self::removeRanksFromUser([$premiumRank], $id); } - } // Get user data by id @@ -1135,7 +1104,6 @@ class Users // If user was found return user data return (new User($id))->data; - } // Get rank data by id @@ -1144,7 +1112,6 @@ class Users // If rank was found return rank data return (new Rank($id))->data; - } // Get user(s) by IP @@ -1162,7 +1129,6 @@ class Users // Return the array with users return $users; - } // Get users in rank @@ -1188,7 +1154,6 @@ class Users // Then return the array with the user rows return $rank; - } // Get all users @@ -1218,7 +1183,6 @@ class Users // and return an array with the users return $users; - } // Get all ranks @@ -1238,7 +1202,6 @@ class Users // and return an array with the ranks return $ranks; - } // Get all warnings issued to a user (or all warnings a user issued) @@ -1252,7 +1215,6 @@ class Users // Return all the warnings return $warnings; - } // Get a user's notifications @@ -1290,7 +1252,6 @@ class Users // Return the notifications return $notifications; - } // Marking notifications as read @@ -1306,7 +1267,6 @@ class Users 'alert_id' => [$id, '='], ], ]); - } // Adding a new notification @@ -1328,7 +1288,6 @@ class Users 'alert_img' => $img, 'alert_timeout' => $timeout, ]); - } // Getting a user's PMs @@ -1357,7 +1316,6 @@ class Users // Return store array return $store; - } // Get friends @@ -1400,7 +1358,6 @@ class Users // Return formatted array return $friends; - } // Get non-mutual friends @@ -1438,14 +1395,11 @@ class Users // Return the pending friends return $pending; - } // Get the ID of the newest user public static function getNewestUserId() { - return Database::fetch('users', false, ['password_algo' => ['nologin', '!=']], ['user_id', true], ['1'])['user_id']; - } } diff --git a/_sakura/components/Whois.php b/_sakura/components/Whois.php index 66a0735..76b6f56 100755 --- a/_sakura/components/Whois.php +++ b/_sakura/components/Whois.php @@ -64,7 +64,6 @@ class Whois // If everything is gucci set self::$servers self::$servers = $servers; - } // Query the whois servers @@ -83,7 +82,6 @@ class Whois default: // ...a false is returned by this function return false; } - } // Validates an address @@ -102,7 +100,6 @@ class Whois // If unsuccessful return 0 return 0; - } // Look up a domain @@ -154,7 +151,6 @@ class Whois // If all is good return the return variable return $return; - } // Look up an IP @@ -194,7 +190,6 @@ class Whois // Return results return $return; - } // Query whois server @@ -230,6 +225,5 @@ class Whois // Return results return $out; - } } diff --git a/_sakura/components/database/mysql.php b/_sakura/components/database/mysql.php index 542db69..25d6100 100755 --- a/_sakura/components/database/mysql.php +++ b/_sakura/components/database/mysql.php @@ -13,7 +13,7 @@ use \Sakura\Configuration; * Class MySQL * @package Sakura\DBWrapper */ -class MySQL +class mysql { // Variable that will contain the SQL connection // Please refrain from referring to this, unless it's for your personal branch/purpose, despite it being public @@ -23,7 +23,6 @@ class MySQL // Constructor public function __construct() { - if (!extension_loaded('PDO')) { // Return error and die trigger_error('PDO extension not loaded.', E_USER_ERROR); @@ -50,33 +49,27 @@ class MySQL Configuration::getLocalConfig('database', 'username'), Configuration::getLocalConfig('database', 'password') ); - } // Regular IP/Hostname connection method prepare function private function prepareHost($dbHost, $dbName, $dbPort = 3306) { - $dsn = 'mysql:host=' . $dbHost . ';port=' . $dbPort . ';dbname=' . $dbName; return $dsn; - } // Unix Socket connection method prepare function private function prepareSock($dbHost, $dbName) { - $dsn = 'mysql:unix_socket=' . $dbHost . ';dbname=' . $dbName; return $dsn; - } // Initialise connection using default PDO stuff private function initConnect($dsn, $dbUname, $dbPword) { - try { // Connect to SQL server using PDO $this->sql = new PDO($dsn, $dbUname, $dbPword, [ @@ -89,7 +82,6 @@ class MySQL } return true; - } public function select($table, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) @@ -121,9 +113,7 @@ class MySQL // Unset variables to be safe unset($key); unset($value); - } - } // If $group is set and is an array continue @@ -192,7 +182,6 @@ class MySQL // Return the query return $query; - } // Fetch array from database @@ -204,7 +193,6 @@ class MySQL // Return the output return $fetchAll ? $query->fetchAll(PDO::FETCH_ASSOC) : $query->fetch(PDO::FETCH_ASSOC); - } // Insert data to database @@ -222,7 +210,6 @@ class MySQL if (strlen($value)) { $prepare .= ($i ? ':' : '`') . $key . ($i ? '' : '`') . ($key == key(array_slice($data, -1, 1, true)) ? '' : ', '); } - } $prepare .= ')' . ($i ? ';' : ' VALUES '); @@ -247,7 +234,6 @@ class MySQL // Return whatever can be returned return $result; - } // Update data in the database @@ -301,7 +287,6 @@ class MySQL // Return whatever can be returned return $result; - } // Delete data from the database @@ -341,7 +326,6 @@ class MySQL // Return whatever can be returned return $result; - } // Count data from the database @@ -386,14 +370,12 @@ class MySQL // Return the output return $query->fetch(PDO::FETCH_BOTH); - } // Get the ID of the last inserted item public function lastInsertID($name = null) { - - return $this->sql->lastInsertID($name);; - + return $this->sql->lastInsertID($name); + ; } } diff --git a/_sakura/sakura.php b/_sakura/sakura.php index e2b3102..c4b97aa 100755 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -83,9 +83,7 @@ if (Configuration::getConfig('no_cron_service')) { 'config_name' => ['no_cron_last', '='], ], ]); - } - } // Start output buffering diff --git a/public/authenticate.php b/public/authenticate.php index ea646c6..c16b26a 100755 --- a/public/authenticate.php +++ b/public/authenticate.php @@ -281,7 +281,6 @@ if (isset($_REQUEST['mode'])) { break; } - } // Print page contents or if the AJAX request is set only display the render data diff --git a/public/settings.php b/public/settings.php index 6f61453..6a5dbfe 100755 --- a/public/settings.php +++ b/public/settings.php @@ -710,7 +710,6 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification 'user_id' => [$currentUser->data['user_id'], '='], ], ]); - } break; @@ -979,7 +978,6 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification break; } - } // Print page contents or if the AJAX request is set only display the render data @@ -991,7 +989,6 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification ) : Templates::render('global/information.tpl', $renderData); exit; - } if (Users::checkLogin()) { diff --git a/public/support.php b/public/support.php index ceb1bae..a6b9628 100755 --- a/public/support.php +++ b/public/support.php @@ -67,7 +67,6 @@ if (isset($_REQUEST['mode']) } else { header('Location: ' . $urls->format('SITE_PREMIUM') . '?fail=true'); } - } break; @@ -128,11 +127,9 @@ if (isset($_REQUEST['mode']) break; } - } exit; - } // Premium tracker