@@ -36,7 +36,7 @@ |
||
| 36 | 36 | 'target_upload_name' => md5_file($_FILES["video_file"]["tmp_name"]) . ".mp4", |
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | - if(move_uploaded_file( |
|
| 39 | + if (move_uploaded_file( |
|
| 40 | 40 | $_FILES['video_file']['tmp_name'], |
| 41 | 41 | "dynamic/temp/" . $video_properties->video_rid . $video_validation->video_file_type |
| 42 | 42 | )) { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | <?php $__time_h = new time_helper(); ?> |
| 15 | 15 | <?php |
| 16 | 16 | $_video = $__video_h->fetch_video_rid($_GET['v']); |
| 17 | - if($_video['author'] != @$_SESSION['siteusername']) { |
|
| 17 | + if ($_video['author'] != @$_SESSION['siteusername']) { |
|
| 18 | 18 | die(); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | $__video_u->update_row($_GET['v'], "thumbnail", $request->thumbnail); |
| 40 | 40 | $__video_u->update_row($_GET['v'], "category", $request->category); |
| 41 | 41 | |
| 42 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['thumbnail']) { |
|
| 43 | - if(!empty($_FILES["thumbnail"]["name"])) { |
|
| 42 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['thumbnail']) { |
|
| 43 | + if (!empty($_FILES["thumbnail"]["name"])) { |
|
| 44 | 44 | $target_dir = "dynamic/thumbs/"; |
| 45 | 45 | $imageFileType = strtolower(pathinfo($_FILES["thumbnail"]["name"], PATHINFO_EXTENSION)); |
| 46 | 46 | $target_name = md5_file($_FILES["thumbnail"]["tmp_name"]) . "." . $imageFileType; |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | $uploadOk = true; |
| 51 | 51 | $movedFile = false; |
| 52 | 52 | |
| 53 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 54 | - && $imageFileType != "gif" ) { |
|
| 53 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 54 | + && $imageFileType != "gif") { |
|
| 55 | 55 | $fileerror = 'unsupported file type. must be jpg, png, jpeg, or gif'; |
| 56 | 56 | $uploadOk = false; |
| 57 | 57 | goto skip; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | <?php $__db_h = new db_helper(); ?> |
| 10 | 10 | <?php $__time_h = new time_helper(); ?> |
| 11 | 11 | <?php |
| 12 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 12 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 13 | 13 | $request = (object) [ |
| 14 | 14 | "username" => $_POST['username'], |
| 15 | 15 | "password" => $_POST['password'], |
@@ -23,25 +23,25 @@ discard block |
||
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | if (!filter_var($request->email, FILTER_VALIDATE_EMAIL)) |
| 26 | - { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 27 | - if(strlen($request->username) > 21) |
|
| 26 | + { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 27 | + if (strlen($request->username) > 21) |
|
| 28 | 28 | { $request->error->message = "Your username must be shorter than 21 characters."; $request->error->status = ""; } |
| 29 | - if(strlen($request->password) < 8) |
|
| 29 | + if (strlen($request->password) < 8) |
|
| 30 | 30 | { $request->error->message = "Your password must at least be 8 characters long."; $request->error->status = ""; } |
| 31 | - if(!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 31 | + if (!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 32 | 32 | { $request->error->message = "Include numbers and letters in your password!"; $request->error->status = ""; } |
| 33 | - if(!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 33 | + if (!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 34 | 34 | { $request->error->message = "Your username cannot contain any special characters!"; $request->error->status = ""; } |
| 35 | - if(empty(trim($request->username))) |
|
| 35 | + if (empty(trim($request->username))) |
|
| 36 | 36 | { $request->error->message = "Your username cannot be empty!"; $request->error->status = ""; } |
| 37 | 37 | |
| 38 | 38 | $stmt = $__db->prepare("SELECT username FROM users WHERE username = :username"); |
| 39 | 39 | $stmt->bindParam(":username", $username); |
| 40 | 40 | $stmt->execute(); |
| 41 | - if($stmt->rowCount()) |
|
| 41 | + if ($stmt->rowCount()) |
|
| 42 | 42 | { $request->error->message = "There's already a user with that same username!"; $request->error->status = ""; } |
| 43 | 43 | |
| 44 | - if($request->error->status == "OK") { |
|
| 44 | + if ($request->error->status == "OK") { |
|
| 45 | 45 | $stmt = $__db->prepare("INSERT INTO users (username, email, password) VALUES (:username, :email, :password)"); |
| 46 | 46 | $stmt->bindParam(":username", $request->username); |
| 47 | 47 | $stmt->bindParam(":email", $request->email); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | <div id="content"> |
| 38 | 38 | <div class="guide-layout-container enable-fancy-subscribe-button"> |
| 39 | 39 | <div class="guide-container"> |
| 40 | - <?php if(!isset($_SESSION['siteusername'])) { ?> |
|
| 40 | + <?php if (!isset($_SESSION['siteusername'])) { ?> |
|
| 41 | 41 | <div id="guide-builder-promo"> |
| 42 | 42 | <h2> |
| 43 | 43 | Sign in to add channels to your homepage |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | </div> |
| 57 | 57 | <div class="guide"> |
| 58 | 58 | <?php |
| 59 | - if(isset($_SESSION['siteusername'])) { |
|
| 59 | + if (isset($_SESSION['siteusername'])) { |
|
| 60 | 60 | ?> |
| 61 | 61 | <div style="/*! margin-top: 0px; *//*! margin-left: 10px; *//*! margin-bottom: 13px; */height: 99px;" class="guide-section feed-header channel first"><img alt="" src="/dynamic/pfp/<?php echo $__user_h->fetch_pfp($_SESSION['siteusername']); ?>" style="height: 88px;position: relative;top: 4px;left: 4px;" class="feed-header-thumb channel-thumb" width="88px"><div id="links" style="/*! margin-left: 5px; */position: relative;left: 13px;top: 7px;"><div style="font-size: 11px;margin-bottom: 6px;" class="metadata"> |
| 62 | 62 | <a href="/user/<?php echo htmlspecialchars($_SESSION['siteusername']); ?>" style="color: inherit;">My channel |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | </span> |
| 175 | 175 | </a> |
| 176 | 176 | </li> |
| 177 | - <?php foreach($__server->featured_channels as $channel) { ?> |
|
| 177 | + <?php foreach ($__server->featured_channels as $channel) { ?> |
|
| 178 | 178 | <li class="guide-item-container "> |
| 179 | 179 | <a class="guide-item" data-external-id="<?php echo htmlspecialchars($channel); ?>" data-feed-name="<?php echo htmlspecialchars($channel); ?>" data-feed-type="user"> |
| 180 | 180 | <span class="thumb"> <span class="video-thumb ux-thumb yt-thumb-square-28 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Thumbnail" data-thumb="/dynamic/pfp/<?php echo $__user_h->fetch_pfp($channel); ?>" width="28"><span class="vertical-align"></span></span></span></span> |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | <?php |
| 213 | 213 | $stmt = $__db->prepare("SELECT * FROM videos ORDER BY rand() LIMIT 4"); |
| 214 | 214 | $stmt->execute(); |
| 215 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 215 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 216 | 216 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 217 | 217 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 218 | 218 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | <?php |
| 236 | 236 | $stmt = $__db->prepare("SELECT * FROM videos WHERE featured = 'v' ORDER BY id DESC LIMIT 4"); |
| 237 | 237 | $stmt->execute(); |
| 238 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 238 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 239 | 239 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 240 | 240 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 241 | 241 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | <?php |
| 269 | 269 | $stmt = $__db->prepare("SELECT * FROM videos ORDER BY id DESC LIMIT 20"); |
| 270 | 270 | $stmt->execute(); |
| 271 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 271 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 272 | 272 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 273 | 273 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 274 | 274 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -21,15 +21,15 @@ discard block |
||
| 21 | 21 | "db_connected" => false, |
| 22 | 22 | ], |
| 23 | 23 | |
| 24 | - "video_properties" => (object) [ "status" => "unloaded" ], |
|
| 25 | - "user_properties" => (object) [ "status" => "unloaded" ], |
|
| 26 | - "group_properties" => (object) [ "status" => "unloaded" ], |
|
| 27 | - "forum_properties" => (object) [ "status" => "unloaded" ], |
|
| 24 | + "video_properties" => (object) ["status" => "unloaded"], |
|
| 25 | + "user_properties" => (object) ["status" => "unloaded"], |
|
| 26 | + "group_properties" => (object) ["status" => "unloaded"], |
|
| 27 | + "forum_properties" => (object) ["status" => "unloaded"], |
|
| 28 | 28 | ]; |
| 29 | 29 | |
| 30 | 30 | try |
| 31 | 31 | { |
| 32 | - $__db = new PDO("mysql:host=".$__server->db_properties->db_host.";dbname=".$__server->db_properties->db_database.";charset=utf8mb4", |
|
| 32 | + $__db = new PDO("mysql:host=" . $__server->db_properties->db_host . ";dbname=" . $__server->db_properties->db_database . ";charset=utf8mb4", |
|
| 33 | 33 | $__server->db_properties->db_user, |
| 34 | 34 | $__server->db_properties->db_password, |
| 35 | 35 | [ |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | ); |
| 40 | 40 | $__server->db_properties->db_connected = true; |
| 41 | 41 | } |
| 42 | - catch(PDOException $e) |
|
| 42 | + catch (PDOException $e) |
|
| 43 | 43 | { |
| 44 | 44 | $__server->db_properties->db_connected = false; |
| 45 | 45 | die($e); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class user_insert { |
| 11 | 11 | public $__db; |
| 12 | 12 | |
| 13 | - public function __construct($conn){ |
|
| 13 | + public function __construct($conn) { |
|
| 14 | 14 | $this->__db = $conn; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $stmt->bindParam(":user", $user); |
| 20 | 20 | $stmt->bindParam(":vidid", $vidid); |
| 21 | 21 | $stmt->execute(); |
| 22 | - if($stmt->rowCount() === 0) { |
|
| 22 | + if ($stmt->rowCount() === 0) { |
|
| 23 | 23 | $this->add_view_channel($vidid, $user); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | class user_helper { |
| 12 | 12 | public $__db; |
| 13 | 13 | |
| 14 | - public function __construct($conn){ |
|
| 14 | + public function __construct($conn) { |
|
| 15 | 15 | $this->__db = $conn; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $stmt = $this->__db->prepare("SELECT pfp FROM users WHERE username = :username"); |
| 20 | 20 | $stmt->bindParam(":username", $username); |
| 21 | 21 | $stmt->execute(); |
| 22 | - while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 22 | + while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 23 | 23 | $pfp = $row['pfp']; |
| 24 | 24 | } // why the while statement? just remove it (i cant be bothered to) |
| 25 | 25 | |
@@ -10,20 +10,20 @@ |
||
| 10 | 10 | class user_update { |
| 11 | 11 | public $__db; |
| 12 | 12 | |
| 13 | - public function __construct($conn){ |
|
| 13 | + public function __construct($conn) { |
|
| 14 | 14 | $this->__db = $conn; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // fuck this, this can be compressed into 2 functions |
| 18 | 18 | |
| 19 | 19 | function update_cooldown_time($username, $rowName) { |
| 20 | - $stmt = $this->__db->prepare("UPDATE users SET ".$rowName." = now() WHERE username = :username"); |
|
| 20 | + $stmt = $this->__db->prepare("UPDATE users SET " . $rowName . " = now() WHERE username = :username"); |
|
| 21 | 21 | $stmt->bindParam(":username", $username); |
| 22 | 22 | $stmt->execute(); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | function update_row($username, $rowName, $new) { |
| 26 | - $stmt = $this->__db->prepare("UPDATE users SET ".$rowName." = :new WHERE username = :username"); |
|
| 26 | + $stmt = $this->__db->prepare("UPDATE users SET " . $rowName . " = :new WHERE username = :username"); |
|
| 27 | 27 | $stmt->bindParam(":new", $new); |
| 28 | 28 | $stmt->bindParam(":username", $username); |
| 29 | 29 | $stmt->execute(); |
@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | $ago = new DateTime($datetime); |
| 15 | 15 | $diff = $now->diff($ago); |
| 16 | 16 | |
| 17 | - $diff->w = floor($diff->d / 7); |
|
| 18 | - $diff->d -= $diff->w * 7; |
|
| 17 | + $diff->w = floor($diff->d/7); |
|
| 18 | + $diff->d -= $diff->w*7; |
|
| 19 | 19 | |
| 20 | - if(!isset($cLang)) { |
|
| 20 | + if (!isset($cLang)) { |
|
| 21 | 21 | $string = array( |
| 22 | 22 | 'y' => 'year', |
| 23 | 23 | 'm' => 'month', |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | ); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(!isset($cLang)) { |
|
| 42 | + if (!isset($cLang)) { |
|
| 43 | 43 | foreach ($string as $k => &$v) { |
| 44 | 44 | if ($diff->$k) { |
| 45 | 45 | $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : ''); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if(!isset($cLang)) { |
|
| 60 | + if (!isset($cLang)) { |
|
| 61 | 61 | if (!$full) $string = array_slice($string, 0, 1); |
| 62 | 62 | return $string ? implode(', ', $string) . ' ago' : 'just now'; |
| 63 | 63 | } else { |
@@ -71,23 +71,23 @@ discard block |
||
| 71 | 71 | if ($seconds > 60*60*24) { |
| 72 | 72 | // over a day |
| 73 | 73 | return sprintf("%d:%s:%s:%s", |
| 74 | - floor($seconds/60/60/24), // Days |
|
| 75 | - str_pad( floor($seconds/60/60%24), 2, "0", STR_PAD_LEFT), // Hours |
|
| 76 | - str_pad( floor($seconds/60%60), 2, "0", STR_PAD_LEFT), // Minutes |
|
| 77 | - str_pad( $seconds%60, 2, "0", STR_PAD_LEFT) // Seconds |
|
| 74 | + floor($seconds/60/60/24), // Days |
|
| 75 | + str_pad(floor($seconds/60/60%24), 2, "0", STR_PAD_LEFT), // Hours |
|
| 76 | + str_pad(floor($seconds/60%60), 2, "0", STR_PAD_LEFT), // Minutes |
|
| 77 | + str_pad($seconds%60, 2, "0", STR_PAD_LEFT) // Seconds |
|
| 78 | 78 | ); |
| 79 | 79 | } else if ($seconds > 60*60) { |
| 80 | 80 | // over an hour |
| 81 | 81 | return sprintf("%d:%s:%s", |
| 82 | - floor($seconds/60/60), // Hours |
|
| 82 | + floor($seconds/60/60), // Hours |
|
| 83 | 83 | str_pad(floor($seconds/60%60), 2, "0", STR_PAD_LEFT), // Minutes |
| 84 | - str_pad( $seconds%60, 2, "0", STR_PAD_LEFT) // Seconds |
|
| 84 | + str_pad($seconds%60, 2, "0", STR_PAD_LEFT) // Seconds |
|
| 85 | 85 | ); |
| 86 | 86 | } else { |
| 87 | 87 | // less than an hour |
| 88 | 88 | return sprintf("%d:%s", |
| 89 | - floor($seconds/60), // Minutes |
|
| 90 | - str_pad( $seconds%60, 2, "0", STR_PAD_LEFT) // Seconds |
|
| 89 | + floor($seconds/60), // Minutes |
|
| 90 | + str_pad($seconds%60, 2, "0", STR_PAD_LEFT) // Seconds |
|
| 91 | 91 | ); |
| 92 | 92 | } |
| 93 | 93 | } |