From 60367d09dbc1aa9340818ceea358c9f42204a8ee Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 8 Mar 2016 18:07:58 -0500 Subject: [PATCH] Applied fixes from StyleCI --- libraries/ActionCode.php | 14 +- libraries/BBcode.php | 20 +-- libraries/BBcodeDefinitions/Align.php | 8 +- libraries/BBcodeDefinitions/Code.php | 8 +- libraries/BBcodeDefinitions/Lists.php | 6 +- libraries/BBcodeDefinitions/Size.php | 8 +- libraries/BBcodeDefinitions/User.php | 8 +- libraries/BBcodeDefinitions/YouTube.php | 8 +- libraries/Bans.php | 8 +- libraries/CSRF.php | 14 +- libraries/Comments.php | 32 ++--- libraries/Console/Application.php | 4 +- libraries/Controllers/ForumController.php | 6 +- libraries/Controllers/MetaController.php | 16 +-- libraries/Controllers/PremiumController.php | 4 +- libraries/DB.php | 4 +- libraries/DBv2.php | 18 +-- libraries/File.php | 22 +-- libraries/Forum/Forum.php | 52 +++---- libraries/Forum/Post.php | 36 ++--- libraries/Forum/Thread.php | 56 ++++---- libraries/Hashing.php | 30 ++--- libraries/Net.php | 38 +++--- libraries/News.php | 14 +- libraries/Payments.php | 16 +-- libraries/Perms.php | 24 ++-- libraries/Perms/Forum.php | 4 +- libraries/Perms/Manage.php | 4 +- libraries/Perms/Site.php | 4 +- libraries/Router.php | 30 ++--- libraries/Session.php | 16 +-- libraries/Template.php | 20 +-- libraries/Trick.php | 4 +- libraries/User.php | 142 ++++++++++---------- libraries/Utils.php | 38 +++--- 35 files changed, 368 insertions(+), 368 deletions(-) diff --git a/libraries/ActionCode.php b/libraries/ActionCode.php index 14179e2..95cc47f 100644 --- a/libraries/ActionCode.php +++ b/libraries/ActionCode.php @@ -1,7 +1,7 @@ */ @@ -17,10 +17,10 @@ class ActionCode { /** * Generate an Action Code. - * + * * @param string $action The identifier of the action. * @param int $user The user this action code is intended for (leave 0 for universal). - * + * * @return string The action code given to the user. */ public static function generate($action, $user = 0) @@ -40,12 +40,12 @@ class ActionCode /** * Validate an action code. - * + * * @param string $action The action identifier. * @param string $code The action code. * @param int $user The id of the user validating this code. * @param bool $invalidate Set if the code should be invalidated once validated. - * + * * @return bool Boolean indicating success. */ public static function validate($action, $code, $user = 0, $invalidate = true) @@ -68,7 +68,7 @@ class ActionCode /** * Make a code invalid. - * + * * @param string $code The code that is being invalidated. */ public static function invalidate($code) diff --git a/libraries/BBcode.php b/libraries/BBcode.php index d4e62c9..63ad4d1 100644 --- a/libraries/BBcode.php +++ b/libraries/BBcode.php @@ -1,7 +1,7 @@ */ @@ -21,7 +21,7 @@ class BBcode { /** * The container for JBBCode. - * + * * @var Parser */ private static $bbcode = null; @@ -120,7 +120,7 @@ class BBcode /** * Set the text to parse. - * + * * @param string $text The text that should be parsed. */ public static function text($text) @@ -135,9 +135,9 @@ class BBcode /** * Convert the parsed text to HTML. - * + * * @param string $text The text that should be parsed. - * + * * @return string The parsed HTML. */ public static function toHTML($text = null) @@ -157,9 +157,9 @@ class BBcode /** * Convert the parsed text to BBCode. - * + * * @param string $text The text that should be parsed. - * + * * @return string The converted bbcode. */ public static function toEditor($text = null) @@ -174,9 +174,9 @@ class BBcode /** * Convert the parsed text to plain. - * + * * @param string $text The text that should be parsed. - * + * * @return string The converted plaintext. */ public static function toPlain($text = null) diff --git a/libraries/BBcodeDefinitions/Align.php b/libraries/BBcodeDefinitions/Align.php index 5abfff8..7956797 100644 --- a/libraries/BBcodeDefinitions/Align.php +++ b/libraries/BBcodeDefinitions/Align.php @@ -1,7 +1,7 @@ */ @@ -30,9 +30,9 @@ class Align extends CodeDefinition /** * Creates compiled HTML from the align bbcode. - * + * * @param ElementNode $el The JBBCode element node. - * + * * @return string Compiled HTML. */ public function asHtml(ElementNode $el) diff --git a/libraries/BBcodeDefinitions/Code.php b/libraries/BBcodeDefinitions/Code.php index 1c61dc2..f0e8395 100644 --- a/libraries/BBcodeDefinitions/Code.php +++ b/libraries/BBcodeDefinitions/Code.php @@ -1,7 +1,7 @@ */ @@ -29,9 +29,9 @@ class Code extends CodeDefinition /** * Compiles the code bbcode to HTML. - * + * * @param ElementNode $el The JBBCode element node. - * + * * @return mixed The compiled HTML. */ public function asHtml(ElementNode $el) diff --git a/libraries/BBcodeDefinitions/Lists.php b/libraries/BBcodeDefinitions/Lists.php index c46703a..3c85542 100644 --- a/libraries/BBcodeDefinitions/Lists.php +++ b/libraries/BBcodeDefinitions/Lists.php @@ -1,7 +1,7 @@ */ @@ -30,9 +30,9 @@ class Size extends CodeDefinition /** * Compiles the size bbcode to HTML - * + * * @param ElementNode $el The JBBCode element node. - * + * * @return string The compiled HTML. */ public function asHtml(ElementNode $el) diff --git a/libraries/BBcodeDefinitions/User.php b/libraries/BBcodeDefinitions/User.php index 40672a5..4195488 100644 --- a/libraries/BBcodeDefinitions/User.php +++ b/libraries/BBcodeDefinitions/User.php @@ -1,7 +1,7 @@ */ @@ -31,9 +31,9 @@ class User extends CodeDefinition /** * Compiles the user bbcode to HTML - * + * * @param ElementNode $el The JBBCode element node. - * + * * @return string The compiled HTML. */ public function asHtml(ElementNode $el) diff --git a/libraries/BBcodeDefinitions/YouTube.php b/libraries/BBcodeDefinitions/YouTube.php index 1c078ef..564f59c 100644 --- a/libraries/BBcodeDefinitions/YouTube.php +++ b/libraries/BBcodeDefinitions/YouTube.php @@ -1,7 +1,7 @@ */ @@ -29,9 +29,9 @@ class YouTube extends CodeDefinition /** * Compiles the YouTube bbcode to HTML - * + * * @param ElementNode $el The JBBCode element node. - * + * * @return string The compiled HTML. */ public function asHtml(ElementNode $el) diff --git a/libraries/Bans.php b/libraries/Bans.php index 4fc6ce5..436e13d 100644 --- a/libraries/Bans.php +++ b/libraries/Bans.php @@ -1,7 +1,7 @@ */ @@ -17,9 +17,9 @@ class Bans { /** * Checks if a user is banned. - * + * * @param int $uid The ID of the user that is being checked. - * + * * @return array|bool Either false or an array containing information about the ban. */ public static function checkBan($uid) diff --git a/libraries/CSRF.php b/libraries/CSRF.php index bef5bf4..bc80910 100644 --- a/libraries/CSRF.php +++ b/libraries/CSRF.php @@ -1,7 +1,7 @@ */ @@ -29,9 +29,9 @@ class CSRF /** * Create a new CSRF token. - * + * * @param mixed $id The ID for this token. - * + * * @return string The token. */ public static function create($id) @@ -51,7 +51,7 @@ class CSRF /** * Generate a CSRF token. - * + * * @return string Cryptographically secure random string. */ public static function generate() @@ -61,10 +61,10 @@ class CSRF /** * Validate a CSRF token. - * + * * @param mixed $token The token. * @param mixed $id The ID. - * + * * @return bool Indicator if it was right or not. */ public static function validate($token, $id) diff --git a/libraries/Comments.php b/libraries/Comments.php index 68ca818..0d6546b 100644 --- a/libraries/Comments.php +++ b/libraries/Comments.php @@ -1,7 +1,7 @@ */ @@ -18,14 +18,14 @@ class Comments { /** * The array containing the comments. - * + * * @var array */ public $comments = []; /** * The comment category. - * + * * @var string */ public $category; @@ -38,7 +38,7 @@ class Comments /** * Constructor. - * + * * @param mixed $category The category that comments should be fetched from. */ public function __construct($category) @@ -59,9 +59,9 @@ class Comments /** * Sort the comments. - * + * * @param array $comments Array containing comments. - * + * * @return array Array containing the sorted comments. */ public function sortComments($comments) @@ -115,9 +115,9 @@ class Comments /** * Get a single comment. - * + * * @param int $cid ID of the comment. - * + * * @return array The comment. */ public function getComment($cid) @@ -132,9 +132,9 @@ class Comments /** * Get the votes for a comment. - * + * * @param int $cid ID of the comment. - * + * * @return array The votes. */ public function getVotes($cid) @@ -149,11 +149,11 @@ class Comments /** * Creating a new comment. - * + * * @param int $uid ID of the user creating the comment. * @param int $reply ID of the comment that is being replied to. * @param string $content Contents of the comment. - * + * * @return array Response identifier. */ public function makeComment($uid, $reply, $content) @@ -184,11 +184,11 @@ class Comments /** * Making a vote. - * + * * @param int $uid User making this vote. * @param int $cid ID of the comment that is being voted on. * @param int $mode Positive or negative vote. - * + * * @return bool Always returns true. */ public function makeVote($uid, $cid, $mode) @@ -235,7 +235,7 @@ class Comments /** * Remove a comment - * + * * @param int $cid ID of the comment to remove. */ public function removeComment($cid) diff --git a/libraries/Console/Application.php b/libraries/Console/Application.php index a4066db..2f1f9d7 100644 --- a/libraries/Console/Application.php +++ b/libraries/Console/Application.php @@ -1,7 +1,7 @@ */ diff --git a/libraries/Controllers/ForumController.php b/libraries/Controllers/ForumController.php index c10890f..2c5d309 100644 --- a/libraries/Controllers/ForumController.php +++ b/libraries/Controllers/ForumController.php @@ -1,7 +1,7 @@ */ @@ -24,7 +24,7 @@ class ForumController extends Controller { /** * Serves the forum index. - * + * * @return mixed HTML for the forum index. */ public function index() diff --git a/libraries/Controllers/MetaController.php b/libraries/Controllers/MetaController.php index 6b27c5e..1b2e367 100644 --- a/libraries/Controllers/MetaController.php +++ b/libraries/Controllers/MetaController.php @@ -1,7 +1,7 @@ */ @@ -24,7 +24,7 @@ class MetaController extends Controller { /** * Serves the site index. - * + * * @return mixed HTML for the index. */ public function index() @@ -52,7 +52,7 @@ class MetaController extends Controller /** * Handles the news pages. - * + * * @return mixed HTML for the correct news section. */ public function news() @@ -81,7 +81,7 @@ class MetaController extends Controller /** * Displays the FAQ. - * + * * @return mixed HTML for the FAQ. */ public function faq() @@ -105,9 +105,9 @@ class MetaController extends Controller /** * Handles the info pages. - * + * * @param string $id The page ID from the database. - * + * * @return mixed HTML for the info page. */ public function infoPage($id = null) @@ -145,7 +145,7 @@ class MetaController extends Controller /** * Search page - * + * * @return mixed HTML for the search page. */ public function search() diff --git a/libraries/Controllers/PremiumController.php b/libraries/Controllers/PremiumController.php index 4d7fcbb..5e15c00 100644 --- a/libraries/Controllers/PremiumController.php +++ b/libraries/Controllers/PremiumController.php @@ -1,7 +1,7 @@ */ diff --git a/libraries/DB.php b/libraries/DB.php index 4c189ce..8622188 100644 --- a/libraries/DB.php +++ b/libraries/DB.php @@ -1,7 +1,7 @@ */ diff --git a/libraries/DBv2.php b/libraries/DBv2.php index 402ad5e..f04b990 100644 --- a/libraries/DBv2.php +++ b/libraries/DBv2.php @@ -1,7 +1,7 @@ */ @@ -21,21 +21,21 @@ class DBv2 { /** * The container for the PDO object. - * + * * @var PDO */ public static $db = null; /** * The table prefix - * + * * @var string */ public static $prefix = ''; /** * Open the SQL connection and creates a PDO object. - * + * * @param string $server A PDO driver. * @param array $dsnParts An array consisting out of DSN string parts. * @param string $username The username used to authenticate with the SQL server. @@ -84,9 +84,9 @@ class DBv2 /** * Get the id of the item that was last inserted into the database. - * + * * @param string $name Sequence of which the last id should be returned. - * + * * @return string The last inserted id. */ public static function lastID($name = null) @@ -96,10 +96,10 @@ class DBv2 /** * Prepares a statement for execution and returns a statement object. - * + * * @param string $stmt The statement to prepare. * @param array $opts Statement specific driver options. - * + * * @return PDOStatement */ public static function prepare($stmt, $opts = []) diff --git a/libraries/File.php b/libraries/File.php index 50f28c6..f688837 100644 --- a/libraries/File.php +++ b/libraries/File.php @@ -1,7 +1,7 @@ */ @@ -25,54 +25,54 @@ class File /** * User instance of the user that uploaded this file. - * + * * @var User */ public $user = null; /** * Data of the file. - * + * * @var string */ public $data = null; /** * Original filename of the file. - * + * * @var string */ public $name = null; /** * Mime type of the file. - * + * * @var string */ public $mime = null; /** * The UNIX timestamp of when this file was created. - * + * * @var int */ public $time = 0; /** * The UNIX timestamp of when this file should automatically remove itself (currently unused). - * + * * @var int */ public $expire = 0; /** * Create a new file. - * + * * @param string $data Contents of the file. * @param string $name Name of the file. * @param User $user User instance of the user creating this file. * @param int $expire UNIX timestamp of when this file should automatically remove itself. - * + * * @return File The created file instance for the file. */ public static function create($data, $name, User $user, $expire = 0) @@ -97,7 +97,7 @@ class File /** * Constructor. - * + * * @param int $fileId ID of the file that should be constructed. */ public function __construct($fileId) diff --git a/libraries/Forum/Forum.php b/libraries/Forum/Forum.php index 7072013..ed69eb1 100644 --- a/libraries/Forum/Forum.php +++ b/libraries/Forum/Forum.php @@ -1,7 +1,7 @@ */ @@ -20,28 +20,28 @@ class Forum { /** * The ID of the forum. - * + * * @var int */ public $id = 0; /** * The order of the forum. - * + * * @var int */ public $order = 0; /** * The name of the forum. - * + * * @var string */ public $name = "Forum"; /** * The description of the forum. - * + * * @var string */ public $description = ""; @@ -54,63 +54,63 @@ class Forum /** * The ID of the parent forum. - * + * * @var int */ public $category = 0; /** * The type of forum. - * + * * @var int */ public $type = 0; /** * The icon of this forum. - * + * * @var string */ public $icon = ""; /** * A cached instance of the first post in this forum. - * + * * @var Post */ private $_firstPost = null; /** * A cached instance of the last post in this forum. - * + * * @var Post */ private $_lastPost = null; /** * Cached instances of the subforums. - * + * * @var array */ private $_forums = []; /** * Cached instances of the threads in this forum. - * + * * @var array */ private $_threads = []; /** * The permission container. - * + * * @var Perms */ private $_permissions; /** * Constructor. - * + * * @param int $forumId The ID of the forum that should be constructed. */ public function __construct($forumId = 0) @@ -141,11 +141,11 @@ class Forum /** * Checking a permission flag. - * + * * @param int $flag Forum permission flag. * @param int $user The ID of the user that is being checked. * @param bool $raw Whether the raw full permission flag should be returned. - * + * * @return bool|int Either a bool indicating the permission or the full flag. */ public function permission($flag, $user, $raw = false) @@ -166,7 +166,7 @@ class Forum /** * Gets all subforums of this forum. - * + * * @return array Array containing forum objects. */ public function forums() @@ -198,7 +198,7 @@ class Forum /** * Gets the threads in this forum. - * + * * @return array Array containing all threads. */ public function threads() @@ -231,7 +231,7 @@ class Forum /** * Gets the first post in this forum. - * + * * @return Post The object of the first post. */ public function firstPost() @@ -260,7 +260,7 @@ class Forum /** * Gets the last post in this forum. - * + * * @return Post The object of the last post. */ public function lastPost() @@ -289,7 +289,7 @@ class Forum /** * Counts the amount of threads in this forum. - * + * * @return int Number of threads in this forum. */ public function threadCount() @@ -301,7 +301,7 @@ class Forum /** * Counts the amount of posts in this forum. - * + * * @return int Number of posts in this forum. */ public function postCount() @@ -313,9 +313,9 @@ class Forum /** * Checks if a user has read every post in the specified forum. - * + * * @param int $user Id of the user in question. - * + * * @return bool Indicator if read or not. */ public function unread($user) @@ -345,7 +345,7 @@ class Forum /** * Update the read status of all threads in this forum at once. - * + * * @param int $user The id of the user in question. */ public function trackUpdateAll($user) diff --git a/libraries/Forum/Post.php b/libraries/Forum/Post.php index 7d864f6..7e83ce1 100644 --- a/libraries/Forum/Post.php +++ b/libraries/Forum/Post.php @@ -1,7 +1,7 @@ */ @@ -23,91 +23,91 @@ class Post { /** * The ID of the post. - * + * * @var int */ public $id = 0; /** * The id of the thread this post is a part of. - * + * * @var int */ public $thread = 0; /** * The id of the forum this post is a part of. - * + * * @var int */ public $forum = 0; /** * The User object of the poster. - * + * * @var User */ public $poster = null; /** * The IP address from which this post was created. - * + * * @var string */ public $ip = ""; /** * The UNIX timestamp from when this post was created. - * + * * @var int */ public $time = 0; /** * The subject of this post. - * + * * @var string */ public $subject = ""; /** * The raw contents of this post. - * + * * @var string */ public $text = ""; /** * The parsed contents of this post. - * + * * @var string */ public $parsed = ""; /** * The UNIX timestamp of the last time this post was edited. - * + * * @var int */ public $editTime = 0; /** * The reason why this post was edited. - * + * * @var string */ public $editReason = ""; /** * The User object of the user that last edited this post. - * + * * @var User */ public $editUser = null; /** * Constructor. - * + * * @param int $postId ID of the post that should be constructed. */ public function __construct($postId) @@ -139,13 +139,13 @@ class Post /** * Creating a new post. - * + * * @param string $subject The subject of the thread. * @param string $text The raw contents of the post. * @param User $poster The User object of the poster. * @param int $thread The ID of the thread this post is a reply to. * @param mixed $forum The forum this post is a reply in. - * + * * @return null|self Either null, indicating a failure, or the Post object. */ public static function create($subject, $text, User $poster, $thread = 0, $forum = 0) @@ -191,7 +191,7 @@ class Post /** * Commit the changes to the Database. - * + * * @return null|Post Either null, indicating a failure, or the Post object. */ public function update() diff --git a/libraries/Forum/Thread.php b/libraries/Forum/Thread.php index 5274909..9496165 100644 --- a/libraries/Forum/Thread.php +++ b/libraries/Forum/Thread.php @@ -1,7 +1,7 @@ */ @@ -19,49 +19,49 @@ class Thread { /** * The ID of this thread. - * + * * @var int */ public $id = 0; /** * The ID of the forum this thread is a part of. - * + * * @var int */ public $forum = 0; /** * Is this forum hidden from the listing? - * + * * @var bool */ public $hidden = false; /** * The title of the thread. - * + * * @var string */ public $title = ""; /** * The UNIX timestamp of when this thread was created. - * + * * @var int */ public $time = 0; /** * The UNIX timestamp of when this thread should be autolocked (currently unused). - * + * * @var int */ public $timeLimit = 0; /** * The amount of times this thread has been viewed. - * + * * @var int */ public $views = 0; @@ -70,14 +70,14 @@ class Thread * The status of this thread. * 0 - Unlocked * 1 - Locked - * + * * @var int */ public $status = 0; /** * The UNIX timestamp of when the status was last changed. - * + * * @var int */ public $statusChange = 0; @@ -87,42 +87,42 @@ class Thread * 0 - Normal thread * 1 - Sticky thread * 2 - Announcement - * + * * @var int */ public $type = 0; /** * The ID of the forum this thread was a part of before the last move. - * + * * @var int */ public $oldForum = 0; /** * The post object cache. - * + * * @var array */ private $_posts = []; /** * A cached instance of opening post. - * + * * @var Post */ private $_firstPost = null; /** * A cached instance of the last reply. - * + * * @var Post */ private $_lastPost = null; /** * Constructor. - * + * * @param mixed $threadId ID of the thread that should be constructed. */ public function __construct($threadId) @@ -151,12 +151,12 @@ class Thread /** * Create a new thread. - * + * * @param mixed $forum ID of the forum this thread is part of. * @param mixed $title Title of the thread. * @param mixed $status Status of the thread. * @param mixed $type Type of thread. - * + * * @return self The new thread instance. */ public static function create($forum, $title, $status = 0, $type = 0) @@ -193,7 +193,7 @@ class Thread /** * Move the thread. - * + * * @param mixed $forum The new forum ID. * @param mixed $setOld Remember the forum ID prior to the move for restoration. */ @@ -215,7 +215,7 @@ class Thread /** * Update the thread data. - * + * * @return self The updated thread. */ public function update() @@ -239,7 +239,7 @@ class Thread /** * Get the replies to this thread. - * + * * @return array Array containing Post instances. */ public function posts() @@ -270,7 +270,7 @@ class Thread /** * Get the opening post. - * + * * @return Post A Post instance of the opening post. */ public function firstPost() @@ -299,7 +299,7 @@ class Thread /** * Get the latest reply. - * + * * @return Post A Post instance of the latest reply. */ public function lastPost() @@ -328,7 +328,7 @@ class Thread /** * Get the amount of replies. - * + * * @return int The number of replies to this thread. */ public function replyCount() @@ -340,9 +340,9 @@ class Thread /** * Check if a user has read this thread before. - * + * * @param mixed $user The id of the user in question. - * + * * @return bool A boolean indicating the read status. */ public function unread($user) @@ -365,7 +365,7 @@ class Thread /** * Update the read status. - * + * * @param mixed $user The id of the user in question. */ public function trackUpdate($user) diff --git a/libraries/Hashing.php b/libraries/Hashing.php index 07bc049..f5052db 100644 --- a/libraries/Hashing.php +++ b/libraries/Hashing.php @@ -25,7 +25,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * @package Sakura */ @@ -33,7 +33,7 @@ namespace Sakura; /** * PBKDF2 password hashing implementation. - * + * * @package Sakura * @author Taylor Hornby * @author Julian van de Groep @@ -42,37 +42,37 @@ class Hashing { /** * Hashing algorithm that should be used. - * + * * @var string */ private static $hashAlgorithm = 'sha256'; /** * Iterations. - * + * * @var int */ private static $iterations = 1000; /** * The amount of bytes the salt should be. - * + * * @var int */ private static $saltBytes = 24; /** * The amount of bytes the hash should be. - * + * * @var int */ private static $hashBytes = 24; /** * Creates a hash. - * + * * @param string $pass The password that should be hashed. - * + * * @return array An array containing the algorithm, iterations, salt and hash. */ public static function createHash($pass) @@ -107,10 +107,10 @@ class Hashing /** * Validate a password. - * + * * @param string $password The password that is being validated. * @param array $params The parametres in the order of algorithm, iterations, salt and hash. - * + * * @return bool Correct? */ public static function validatePassword($password, $params) @@ -138,10 +138,10 @@ class Hashing /** * Compares two strings $a and $b in length-constant time. - * + * * @param string $a String A. * @param string $b String B. - * + * * @return bool Boolean indicating difference. */ public static function slowEquals($a, $b) @@ -157,17 +157,17 @@ class Hashing /** * PBKDF2 key derivation function as defined by RSA's PKCS #5: https://www.ietf.org/rfc/rfc2898.txt - * + * * This implementation of PBKDF2 was originally created by https://defuse.ca * With improvements by http://www.variations-of-shadow.com - * + * * @param mixed $algorithm The hash algorithm to use. Recommended: SHA256. * @param mixed $password The password. * @param mixed $salt A salt that is unique to the password. * @param mixed $count Iteration count. Higher is better, but slower. Recommended: At least 1000. * @param mixed $key_length The length of the derived key in bytes. * @param mixed $raw_output A $key_length-byte key derived from the password and salt. - * + * * @return string The PBKDF2 derivation. */ private static function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false) diff --git a/libraries/Net.php b/libraries/Net.php index 69f3d6f..ae73554 100644 --- a/libraries/Net.php +++ b/libraries/Net.php @@ -1,7 +1,7 @@ */ @@ -17,7 +17,7 @@ class Net { /** * Returns the connecting IP. - * + * * @return string The IP. */ public static function IP() @@ -27,9 +27,9 @@ class Net /** * Detect the version of an IP. - * + * * @param string $ipAddr The IP. - * + * * @return int Either 0, 4 or 6. */ public static function detectIPVersion($ipAddr) @@ -53,11 +53,11 @@ class Net /** * Converts a printable IP address into an unpacked binary string. - * + * * @param string $ip Printable IP string. - * + * * @throws \Exception Thrown if an invalid IP is supplied. - * + * * @return string Unpacked IP address. */ public static function pton($ip) @@ -81,11 +81,11 @@ class Net /** * Converts a binary unpacked IP to a printable packed IP. - * + * * @param string $bin The unpacked IP. - * + * * @throws \Exception Thrown if the unpacked IP is invalid. - * + * * @return string The packed IP. */ public static function ntop($bin) @@ -132,11 +132,11 @@ class Net /** * Match an IPv4 CIDR - * + * * @param string $ip The IP address to match. * @param string $net The Net address to match. * @param string $mask The Mask to match. - * + * * @return bool Returns true if it matches. */ private static function matchCIDRv4($ip, $net, $mask) @@ -154,9 +154,9 @@ class Net /** * Converts an IPv6 mask to a byte array - * + * * @param int $mask The mask. - * + * * @return string The byte array. */ private static function maskToByteArray($mask) @@ -191,11 +191,11 @@ class Net /** * Match an IPv6 CIDR - * + * * @param string $ip The IP address to match. * @param string $net The Net address to match. * @param int $mask The net mask. - * + * * @return bool Returns true if it's a successful match. */ private static function matchCIDRv6($ip, $net, $mask) @@ -213,9 +213,9 @@ class Net /** * Fetch a remote file - * + * * @param string $url The location of the file - * + * * @return mixed The contents of the remote file */ public static function fetch($url) diff --git a/libraries/News.php b/libraries/News.php index 9231c68..f35d69f 100644 --- a/libraries/News.php +++ b/libraries/News.php @@ -1,7 +1,7 @@ */ @@ -17,14 +17,14 @@ class News { /** * Array containing news posts. - * + * * @var array */ public $posts = []; /** * Constructor - * + * * @param mixed $category ID of the category that should be constructed. */ public function __construct($category) @@ -52,7 +52,7 @@ class News /** * Get the amount of news posts. - * + * * @return int Number of posts. */ public function getCount() @@ -62,9 +62,9 @@ class News /** * Check if a post exists in this category. - * + * * @param int $pid The ID of the post. - * + * * @return int If true the post it gets returns, else 0. */ public function postExists($pid) diff --git a/libraries/Payments.php b/libraries/Payments.php index 57a0e55..2fd8b7a 100644 --- a/libraries/Payments.php +++ b/libraries/Payments.php @@ -1,7 +1,7 @@ * @author Julian van de Groep @@ -28,14 +28,14 @@ class Payments { /** * Container for the PayPal API - * + * * @var \PayPal\Rest\ApiContext */ private static $paypal; /** * Initialise the wrapper. - * + * * @return bool Always true. */ public static function init() @@ -63,12 +63,12 @@ class Payments /** * Create a new transaction. - * + * * @param float $total The total amount of money. * @param string $itemName The name of the item being purchased. * @param string $transDescription The description of the item. * @param string $returnUrl The URL that PayPal will redirect back to. - * + * * @return bool|null|string If successful; the PayPal approval link. */ public static function createTransaction($total, $itemName, $transDescription, $returnUrl) @@ -147,10 +147,10 @@ class Payments /** * Complete the PayPal transaction. - * + * * @param string $paymentId ID of the payment. * @param string $payerId ID of the payer. - * + * * @return bool Success indicator. */ public static function completeTransaction($paymentId, $payerId) diff --git a/libraries/Perms.php b/libraries/Perms.php index 62a04cc..3d1d558 100644 --- a/libraries/Perms.php +++ b/libraries/Perms.php @@ -1,7 +1,7 @@ */ @@ -32,21 +32,21 @@ class Perms /** * The table containing the permissions. - * + * * @var string */ protected $table = ''; /** * The column containing the permissions. - * + * * @var string */ protected $column = ''; /** * Constructor. - * + * * @param string $mode One of the modes above. */ public function __construct($mode) @@ -56,7 +56,7 @@ class Perms /** * Set a permission mode. - * + * * @param string $mode One of the modes above. */ public function mode($mode) @@ -71,10 +71,10 @@ class Perms /** * Compare a permission flag. - * + * * @param int $flag The permission flag. * @param int $perm The permissions of the user. - * + * * @return bool Success indicator. */ public function check($flag, $perm) @@ -84,11 +84,11 @@ class Perms /** * Get the permissions from a rank. - * + * * @param int $rid The ID of the rank in question. * @param array $conditions Additional SQL conditions. * @param int $perm A permission flag to append to. - * + * * @return int A permission flag. */ public function rank($rid, $conditions = [], $perm = 0) @@ -130,11 +130,11 @@ class Perms /** * Get the permissions from a user. - * + * * @param int $uid The ID of the user in question. * @param array $conditions Additional SQL conditions. * @param int $perm A permission flag to append to. - * + * * @return int A permission flag. */ public function user($uid, $conditions = [], $perm = 0) diff --git a/libraries/Perms/Forum.php b/libraries/Perms/Forum.php index 14f1410..0d185ac 100644 --- a/libraries/Perms/Forum.php +++ b/libraries/Perms/Forum.php @@ -1,7 +1,7 @@ */ diff --git a/libraries/Perms/Manage.php b/libraries/Perms/Manage.php index 071881e..12065ab 100644 --- a/libraries/Perms/Manage.php +++ b/libraries/Perms/Manage.php @@ -1,7 +1,7 @@ */ diff --git a/libraries/Perms/Site.php b/libraries/Perms/Site.php index 984ab5e..a99e5b2 100644 --- a/libraries/Perms/Site.php +++ b/libraries/Perms/Site.php @@ -1,7 +1,7 @@ */ diff --git a/libraries/Router.php b/libraries/Router.php index 6376dab..5da6db7 100644 --- a/libraries/Router.php +++ b/libraries/Router.php @@ -1,7 +1,7 @@ */ @@ -22,28 +22,28 @@ class Router { /** * Container for RouteCollector - * + * * @var RouteCollector */ protected static $router = null; /** * Base path of the router. - * + * * @var string */ protected static $basePath = null; /** * Container for the Dispatcher - * + * * @var Dispatcher */ protected static $dispatcher = null; /** * Collection of handled HTTP request types. - * + * * @var array */ protected static $methods = [ @@ -58,7 +58,7 @@ class Router /** * Method aliases for adding routes. - * + * * @param string $name A HTTP method. * @param array $args The arguments. */ @@ -76,7 +76,7 @@ class Router /** * Initialisation. - * + * * @param string $basePath The base path of the router. */ public static function init($basePath = '/') @@ -90,7 +90,7 @@ class Router /** * Set the base path. - * + * * @param string $basePath The base path of the router. */ public static function setBasePath($basePath) @@ -100,9 +100,9 @@ class Router /** * Parse a URL. - * + * * @param string $url The URL that is to be parsed. - * + * * @return string THe parsed URL. */ private static function parseUrl($url) @@ -112,10 +112,10 @@ class Router /** * Generate the URI of a route using names. - * + * * @param string $name The identifier of the route. * @param string|array $args The route arguments. - * + * * @return string The generated URI. */ public static function route($name, $args = null) @@ -132,10 +132,10 @@ class Router /** * Handle requests. - * + * * @param string $method The HTTP method used to make the request. * @param string $url The URL the request is made to. - * + * * @return mixed The response. */ public static function handle($method, $url) diff --git a/libraries/Session.php b/libraries/Session.php index 8a078ae..0dcb1d3 100644 --- a/libraries/Session.php +++ b/libraries/Session.php @@ -1,7 +1,7 @@ */ @@ -17,21 +17,21 @@ class Session { /** * The ID of the user this session is from. - * + * * @var int */ public $userId = 0; /** * The ID of the session. - * + * * @var string */ public $sessionId = ""; /** * Constructor. - * + * * @param int $userId The ID of the user. * @param int $sessionId The active session ID. */ @@ -84,9 +84,9 @@ class Session /** * Create a new session. - * + * * @param boolean $permanent Is this a permanent session? - * + * * @return string The session key. */ public function create($permanent) @@ -112,7 +112,7 @@ class Session /** * Validate the session. - * + * * @return int Success indicator; 0 = false, 1 = active, 2 = permanent. */ public function validate() diff --git a/libraries/Template.php b/libraries/Template.php index 9b59465..b18b222 100644 --- a/libraries/Template.php +++ b/libraries/Template.php @@ -1,7 +1,7 @@ */ @@ -22,28 +22,28 @@ class Template { /** * The variables passed on to the templating engine. - * + * * @var array */ private static $vars = []; /** * The templating engine. - * + * * @var Twig_Environment */ private static $template; /** * The template name. - * + * * @var string */ private static $templateName; /** * The template options. - * + * * @var array */ private static $templateOptions; @@ -55,7 +55,7 @@ class Template /** * Set the template name. - * + * * @param string $name The name of the template directory. */ public static function set($name) @@ -108,7 +108,7 @@ class Template /** * Merge the parse variables. - * + * * @param array $vars The new variables. */ public static function vars($vars) @@ -118,9 +118,9 @@ class Template /** * Render a template file. - * + * * @param string $file The filename/path - * + * * @return bool|string An error or the HTML. */ public static function render($file) diff --git a/libraries/Trick.php b/libraries/Trick.php index e0f76e4..11c626f 100644 --- a/libraries/Trick.php +++ b/libraries/Trick.php @@ -1,7 +1,7 @@ */ diff --git a/libraries/User.php b/libraries/User.php index 806e3de..4114df1 100644 --- a/libraries/User.php +++ b/libraries/User.php @@ -1,7 +1,7 @@ */ @@ -20,147 +20,147 @@ class User { /** * The User's ID. - * + * * @var int */ public $id = 0; /** * The user's username. - * + * * @var string */ public $username = 'User'; /** * A cleaned version of the username. - * + * * @var string */ public $usernameClean = 'user'; /** * The user's password hash. - * + * * @var string */ public $passwordHash = ''; /** * The user's password salt. - * + * * @var string */ public $passwordSalt = ''; /** * The user's password algorithm. - * + * * @var string */ public $passwordAlgo = 'disabled'; /** * The password iterations. - * + * * @var int */ public $passwordIter = 0; /** * UNIX timestamp of last time the password was changed. - * + * * @var int */ public $passwordChan = 0; /** * The user's e-mail address. - * + * * @var string */ public $email = 'user@sakura'; /** * The rank object of the user's main rank. - * + * * @var Rank */ public $mainRank = null; /** * The ID of the main rank. - * + * * @var int */ public $mainRankId = 1; /** * The index of rank objects. - * + * * @var array */ public $ranks = []; /** * The user's username colour. - * + * * @var string */ public $colour = ''; /** * The IP the user registered from. - * + * * @var string */ public $registerIp = '0.0.0.0'; /** * The IP the user was last active from. - * + * * @var string */ public $lastIp = '0.0.0.0'; /** * A user's title. - * + * * @var string */ public $title = ''; /** * The UNIX timestamp of when the user registered. - * + * * @var int */ public $registered = 0; /** * The UNIX timestamp of when the user was last online. - * + * * @var int */ public $lastOnline = 0; /** * The 2 character country code of a user. - * + * * @var string */ public $country = 'XX'; /** * The File id of the user's avatar. - * + * * @var int */ public $avatar = 0; /** * The File id of the user's background. - * + * * @var int */ public $background = 0; @@ -173,59 +173,59 @@ class User /** * The raw userpage of the user. - * + * * @var string */ public $page = ''; /** * The raw signature of the user. - * + * * @var string */ public $signature = ''; /** * The user's birthday. - * + * * @var string */ private $birthday = '0000-00-00'; /** * The user's permission container. - * + * * @var Perms */ private $permissions; /** * The user's option fields. - * + * * @var array */ private $optionFields = null; /** * The user's profile fields. - * + * * @var array */ private $profileFields = null; /** * The User instance cache array. - * + * * @var array */ protected static $_userCache = []; /** * Cached constructor. - * + * * @param int|string $uid The user ID or clean username. * @param bool $forceRefresh Force a recreation. - * + * * @return User Returns a user object. */ public static function construct($uid, $forceRefresh = false) @@ -242,12 +242,12 @@ class User /** * Create a new user. - * + * * @param string $username The username of the user. * @param string $password The password of the user. * @param string $email The e-mail, used primarily for activation. * @param array $ranks The ranks assigned to the user on creation. - * + * * @return User The newly created user's object. */ public static function create($username, $password, $email, $ranks = [2]) @@ -290,7 +290,7 @@ class User /** * The actual constructor - * + * * @param int|string $userId The user ID or clean username. */ private function __construct($userId) @@ -367,9 +367,9 @@ class User /** * Get the user's birthday. - * + * * @param bool $age Just get the age. - * + * * @return int|string Return the birthday. */ public function birthday($age = false) @@ -393,9 +393,9 @@ class User /** * Get the user's country. - * + * * @param bool $long Get the full country name. - * + * * @return string The country. */ public function country($long = false) @@ -405,7 +405,7 @@ class User /** * Check if a user is online. - * + * * @return bool Are they online? */ public function isOnline() @@ -426,7 +426,7 @@ class User /** * Get a few forum statistics. - * + * * @return array Post and thread counts. */ public function forumStats() @@ -450,7 +450,7 @@ class User /** * Add ranks to a user. - * + * * @param array $ranks Array containing the rank IDs. */ public function addRanks($ranks) @@ -477,7 +477,7 @@ class User /** * Remove a set of ranks from a user. - * + * * @param array $ranks Array containing the IDs of ranks to remove. */ public function removeRanks($ranks) @@ -496,9 +496,9 @@ class User /** * Change the main rank of a user. - * + * * @param int $rank The ID of the new main rank. - * + * * @return bool Always true. */ public function setMainRank($rank) @@ -516,9 +516,9 @@ class User /** * Check if a user has a certain set of rank. - * + * * @param array $ranks Ranks IDs to check. - * + * * @return bool Successful? */ public function hasRanks($ranks) @@ -542,9 +542,9 @@ class User /** * Add a new friend. - * + * * @param int $uid The ID of the friend. - * + * * @return array Status indicator. */ public function addFriend($uid) @@ -576,10 +576,10 @@ class User /** * Remove a friend. - * + * * @param int $uid The friend Id * @param bool $deleteRequest Delete the open request as well (remove you from their friends list). - * + * * @return array Status indicator. */ public function removeFriend($uid, $deleteRequest = false) @@ -615,9 +615,9 @@ class User /** * Check if this user is friends with another user. - * + * * @param int $with ID of the other user. - * + * * @return int 0 = no, 1 = pending request, 2 = mutual */ public function isFriends($with) @@ -649,10 +649,10 @@ class User /** * Get all the friends from this user. - * + * * @param int $level Friend level; (figure out what the levels are at some point) * @param bool $noObj Just return IDs. - * + * * @return array The array with either the objects or the ids. */ public function friends($level = 0, $noObj = false) @@ -754,7 +754,7 @@ class User /** * Check if the user is banned. - * + * * @return array|bool Ban status. */ public function checkBan() @@ -764,10 +764,10 @@ class User /** * Check if the user has a certaing permission flag. - * + * * @param int $flag The permission flag. * @param string $mode The permission mode. - * + * * @return bool Success? */ public function permission($flag, $mode = null) @@ -795,7 +795,7 @@ class User /** * Get the user's profile fields. - * + * * @return array The profile fields. */ public function profileFields() @@ -883,7 +883,7 @@ class User /** * Get a user's option fields. - * + * * @return array The array containing the fields. */ public function optionFields() @@ -944,7 +944,7 @@ class User /** * Does this user have premium? - * + * * @return array Premium status information. */ public function isPremium() @@ -978,7 +978,7 @@ class User /** * Get the open warnings on this user. - * + * * @return array The warnings. */ public function getWarnings() @@ -1037,7 +1037,7 @@ class User /** * Parse the user's userpage. - * + * * @return string The parsed page. */ public function userPage() @@ -1047,7 +1047,7 @@ class User /** * Parse a user's signature - * + * * @return string The parsed signature. */ public function signature() @@ -1057,7 +1057,7 @@ class User /** * Get a user's username history. - * + * * @return array The history. */ public function getUsernameHistory() @@ -1074,9 +1074,9 @@ class User /** * Alter the user's username - * + * * @param string $username The new username. - * + * * @return array Status indicator. */ public function setUsername($username) @@ -1144,9 +1144,9 @@ class User /** * Alter a user's e-mail address - * + * * @param string $email The new e-mail address. - * + * * @return array Status indicator. */ public function setEMailAddress($email) @@ -1181,11 +1181,11 @@ class User /** * Change the user's password - * + * * @param string $old The old password. * @param string $new The new password * @param string $confirm The new one again. - * + * * @return array Status indicator. */ public function setPassword($old, $new, $confirm) diff --git a/libraries/Utils.php b/libraries/Utils.php index 567f8ee..1ddd287 100644 --- a/libraries/Utils.php +++ b/libraries/Utils.php @@ -1,7 +1,7 @@ */ @@ -19,7 +19,7 @@ class Utils { /** * The error handler. - * + * * @param int $errno The error ID. * @param string $errstr Quick description of the event. * @param string $errfile File the error occurred in. @@ -139,7 +139,7 @@ class Utils /** * Send an e-mail. - * + * * @param string $to Destination e-mail. * @param string $subject E-mail subject. * @param string $body Contents of the message. @@ -205,12 +205,12 @@ class Utils /** * Clean a string - * + * * @param string $string Dirty string. * @param bool $lower Make the string lowercase. * @param bool $noSpecial String all special characters. * @param bool $replaceSpecial Thing to replace special characters with. - * + * * @return string Clean string. */ public static function cleanString($string, $lower = false, $noSpecial = false, $replaceSpecial = '') @@ -236,9 +236,9 @@ class Utils /** * Validate MX records. - * + * * @param string $email E-mail address. - * + * * @return bool Success. */ public static function checkMXRecord($email) @@ -255,7 +255,7 @@ class Utils /** * Get the country code of a visitor. - * + * * @return string 2 character country code. */ public static function getCountryCode() @@ -281,9 +281,9 @@ class Utils /** * Check the entropy of a password. - * + * * @param string $pw Password. - * + * * @return double|int Entropy. */ public static function pwdEntropy($pw) @@ -297,9 +297,9 @@ class Utils /** * Get the country name from a 2 character code. - * + * * @param string $code The country code. - * + * * @return string The country name. */ public static function getCountryName($code) @@ -325,9 +325,9 @@ class Utils /** * Get the byte symbol for a unit from bytes. - * + * * @param int $bytes The amount of bytes. - * + * * @return string The converted amount with the symbol. */ public static function getByteSymbol($bytes) @@ -352,7 +352,7 @@ class Utils /** * Get the premium tracker data. - * + * * @return array The premium tracker data. */ public static function getPremiumTrackerData() @@ -391,7 +391,7 @@ class Utils /** * Add a new entry to the tracker. - * + * * @param int $id The user ID. * @param float $amount The amount of money. * @param string $comment A little information. @@ -409,9 +409,9 @@ class Utils /** * Clean up the contents of tags. - * + * * @param string $text Dirty - * + * * @return string Clean */ public static function fixCodeTags($text)