@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | <?php |
| 15 | 15 | $_playlist = $__video_h->fetch_playlist_rid($_GET['v']); |
| 16 | 16 | |
| 17 | - if(!$__user_h->user_exists($_playlist['author'])) |
|
| 17 | + if (!$__user_h->user_exists($_playlist['author'])) |
|
| 18 | 18 | header("Location: /?userdoesntexist"); |
| 19 | 19 | |
| 20 | 20 | $_user = $__user_h->fetch_user_username($_playlist['author']); |
@@ -66,28 +66,28 @@ discard block |
||
| 66 | 66 | $_user['genre'] = strtolower($_user['genre']); |
| 67 | 67 | $_user['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_user['username']); |
| 68 | 68 | |
| 69 | - if(!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; } |
|
| 70 | - if(!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; } |
|
| 71 | - if(!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; } |
|
| 72 | - if(!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; } |
|
| 73 | - if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
|
| 74 | - if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
|
| 69 | + if (!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; } |
|
| 70 | + if (!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; } |
|
| 71 | + if (!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; } |
|
| 72 | + if (!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; } |
|
| 73 | + if (!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
|
| 74 | + if (!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
|
| 75 | 75 | |
| 76 | - if(isset($_SESSION['siteusername'])) |
|
| 76 | + if (isset($_SESSION['siteusername'])) |
|
| 77 | 77 | $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
| 78 | 78 | |
| 79 | - if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 79 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 80 | 80 | $error = array(); |
| 81 | 81 | |
| 82 | - if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; } |
|
| 83 | - if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; } |
|
| 84 | - if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; } |
|
| 82 | + if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; } |
|
| 83 | + if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; } |
|
| 84 | + if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; } |
|
| 85 | 85 | //if(!isset($_POST['g-recaptcha-response'])){ $error['message'] = "captcha validation failed"; $error['status'] = true; } |
| 86 | 86 | //if(!$_user_insert_utils->validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error['message'] = "captcha validation failed"; $error['status'] = true; } |
| 87 | - if($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before posting another comment."; $error['status'] = true; } |
|
| 87 | + if ($__user_h->if_cooldown($_SESSION['siteusername'])) { $error['message'] = "You are on a cooldown! Wait for a minute before posting another comment."; $error['status'] = true; } |
|
| 88 | 88 | //if(ifBlocked(@$_SESSION['siteusername'], $user['username'], $__db)) { $error = "This user has blocked you!"; $error['status'] = true; } |
| 89 | 89 | |
| 90 | - if(!isset($error['message'])) { |
|
| 90 | + if (!isset($error['message'])) { |
|
| 91 | 91 | $text = $_POST['comment']; |
| 92 | 92 | $stmt = $__db->prepare("INSERT INTO profile_comments (toid, author, comment) VALUES (:id, :username, :comment)"); |
| 93 | 93 | $stmt->bindParam(":id", $_user['username']); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | $_user_update_utils->update_comment_cooldown_time($_SESSION['siteusername']); |
| 99 | 99 | |
| 100 | - if(@$_SESSION['siteusername'] != $_user['username']) { |
|
| 100 | + if (@$_SESSION['siteusername'] != $_user['username']) { |
|
| 101 | 101 | $_user_insert_utils->send_message($_user['username'], "New comment", 'I commented "' . $_POST['comment'] . '" on your profile!', $_SESSION['siteusername']); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | <link rel="stylesheet" href="/yt/cssbin/www-extra.css"> |
| 132 | 132 | <style> |
| 133 | 133 | #content-container { |
| 134 | - background-color: <?php echo $_user['primary_color']; ?>; |
|
| 134 | + background-color: <?php echo $_user['primary_color']; ?>; |
|
| 135 | 135 | background-image: url(/dynamic/banners/<?php echo $_user['2009_bg']; ?>); |
| 136 | 136 | background-repeat: repeat; |
| 137 | 137 | background-position: center top; |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | <div id="masthead-container"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/header.php"); ?></div> |
| 148 | 148 | <div id="content-container"> |
| 149 | 149 | <!-- begin content --> |
| 150 | - <?php if(isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?> |
|
| 150 | + <?php if (isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?> |
|
| 151 | 151 | <div class="channel_customization"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/channel_customization.php"); ?></div> |
| 152 | 152 | <?php } ?> |
| 153 | 153 | <?php |
| 154 | - if(empty(trim($_user['bio']))) |
|
| 154 | + if (empty(trim($_user['bio']))) |
|
| 155 | 155 | $_user['bio'] = "This user has no description."; |
| 156 | 156 | ?> |
| 157 | 157 | <div id="content"> |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | </div> |
| 212 | 212 | </div> |
| 213 | 213 | <div class="upper-left-section enable-fancy-subscribe-button"> |
| 214 | - <?php if($_user['username'] != @$_SESSION['siteusername']) { ?> |
|
| 214 | + <?php if ($_user['username'] != @$_SESSION['siteusername']) { ?> |
|
| 215 | 215 | <div class="yt-subscription-button-hovercard yt-uix-hovercard"> |
| 216 | 216 | <button |
| 217 | 217 | href="#" |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | title="" |
| 220 | 220 | id="subscribe-button" |
| 221 | 221 | type="button" |
| 222 | - class="yt-subscription-button <?php if($_user['subscribed']) { echo "subscribed "; } ?> yt-uix-button yt-uix-button-subscription yt-uix-tooltip" |
|
| 222 | + class="yt-subscription-button <?php if ($_user['subscribed']) { echo "subscribed "; } ?> yt-uix-button yt-uix-button-subscription yt-uix-tooltip" |
|
| 223 | 223 | role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-subscribe" |
| 224 | 224 | src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></span><span class="yt-uix-button-content"> <span class="subscribe-label">Subscribe</span> |
| 225 | 225 | <span class="subscribed-label">Subscribed</span> |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | </div> |
| 254 | 254 | </div> |
| 255 | 255 | </div> |
| 256 | - <?php if($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?> |
|
| 256 | + <?php if ($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?> |
|
| 257 | 257 | <div id="branded-page-body"> |
| 258 | 258 | <div class="channel-tab-content channel-layout-two-column selected blogger-template"> |
| 259 | 259 | <div class="tab-content-body"> |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | <?php |
| 288 | 288 | $_playlist['videos'] = json_decode($_playlist['videos']); |
| 289 | 289 | $_playlist['count'] = 1; |
| 290 | - foreach($_playlist['videos'] as $video) { |
|
| 291 | - if($__video_h->video_exists($video)) { |
|
| 290 | + foreach ($_playlist['videos'] as $video) { |
|
| 291 | + if ($__video_h->video_exists($video)) { |
|
| 292 | 292 | $_video = $__video_h->fetch_video_rid($video); |
| 293 | 293 | $_video['video_responses'] = $__video_h->get_video_responses($_video['rid']); |
| 294 | 294 | $_video['age'] = $__time_h->time_elapsed_string($_video['publish']); |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | </li> |
| 337 | 337 | <?php $_playlist['count']++; ?> |
| 338 | 338 | <?php } } ?> |
| 339 | - <?php if(count($_playlist['videos']) == 0) { ?> |
|
| 339 | + <?php if (count($_playlist['videos']) == 0) { ?> |
|
| 340 | 340 | <h4>This playlist has no videos yet.</h4> |
| 341 | 341 | <?php } ?> |
| 342 | 342 | </ol> |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | </div> |
| 391 | 391 | <hr class="yt-horizontal-rule "> |
| 392 | 392 | </div> |
| 393 | - <?php if(!empty($_user['website'])) { ?> |
|
| 393 | + <?php if (!empty($_user['website'])) { ?> |
|
| 394 | 394 | <div class="user-profile-item"> |
| 395 | 395 | <div class="yt-c3-profile-custom-url field-container "> |
| 396 | 396 | <a href="<?php echo addhttp(htmlspecialchars($_user['website'])); ?>" rel="me nofollow" target="_blank" title="<?php echo htmlspecialchars($_user['website']); ?>" class="yt-uix-redirect-link"> |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | <h5>Country</h5> |
| 440 | 440 | <span class="value"><?php echo htmlspecialchars($_user['country']); ?></span> |
| 441 | 441 | </div> |
| 442 | - <?php if($_user['genre'] != "none") { ?> |
|
| 442 | + <?php if ($_user['genre'] != "none") { ?> |
|
| 443 | 443 | <div class="user-profile-item "> |
| 444 | 444 | <h5>Channel Genre</h5> |
| 445 | 445 | <span class="value"><?php echo htmlspecialchars($_user['genre']); ?></span> |
@@ -451,13 +451,13 @@ discard block |
||
| 451 | 451 | </div> |
| 452 | 452 | <div class="channel-module other-channels yt-uix-c3-module-container other-channels-compact"> |
| 453 | 453 | <?php $_user['featured_channels'] = explode(",", $_user['featured_channels']); ?> |
| 454 | - <?php if(count($_user['featured_channels']) != 0) { ?> |
|
| 454 | + <?php if (count($_user['featured_channels']) != 0) { ?> |
|
| 455 | 455 | <div class="module-view other-channels-view"> |
| 456 | 456 | <h2>Featured Channels</h2> |
| 457 | 457 | <ul class="channel-summary-list "> |
| 458 | 458 | <?php |
| 459 | - foreach($_user['featured_channels'] as $user) { |
|
| 460 | - if($__user_h->user_exists($user)) { |
|
| 459 | + foreach ($_user['featured_channels'] as $user) { |
|
| 460 | + if ($__user_h->user_exists($user)) { |
|
| 461 | 461 | ?> |
| 462 | 462 | <li class="yt-tile-visible yt-uix-tile"> |
| 463 | 463 | <div class="channel-summary clearfix channel-summary-compact"> |
@@ -486,13 +486,13 @@ discard block |
||
| 486 | 486 | $stmt->bindParam(":search", $_user['username']); |
| 487 | 487 | $stmt->execute(); |
| 488 | 488 | |
| 489 | - if($stmt->rowCount() != 0) { |
|
| 489 | + if ($stmt->rowCount() != 0) { |
|
| 490 | 490 | ?> |
| 491 | 491 | <div class="playlists-narrow channel-module yt-uix-c3-module-container"> |
| 492 | 492 | <div class="module-view gh-featured"> |
| 493 | 493 | <h2>Featured Playlists</h2> |
| 494 | 494 | <?php |
| 495 | - while($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 495 | + while ($playlist = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 496 | 496 | $playlist['videos'] = json_decode($playlist['videos']); |
| 497 | 497 | ?> |
| 498 | 498 | <div class="playlist yt-tile-visible yt-uix-tile"> |
@@ -39,8 +39,8 @@ |
||
| 39 | 39 | ?> |
| 40 | 40 | <div id="browse-side-column" class="ytg-2col ytg-last"> |
| 41 | 41 | <ol class="navigation-menu"> |
| 42 | - <?php foreach($__tabs as $_tab) { |
|
| 43 | - if(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) != $_tab->url) |
|
| 42 | + <?php foreach ($__tabs as $_tab) { |
|
| 43 | + if (parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH) != $_tab->url) |
|
| 44 | 44 | $_tab->selected = true; |
| 45 | 45 | ?> |
| 46 | 46 | <li class="menu-item"> |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | class video_updater { |
| 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 | function update_row($video, $rowName, $new) { |
| 18 | - $stmt = $this->__db->prepare("UPDATE videos SET ".$rowName." = :new WHERE rid = :rid"); |
|
| 18 | + $stmt = $this->__db->prepare("UPDATE videos SET " . $rowName . " = :new WHERE rid = :rid"); |
|
| 19 | 19 | $stmt->bindParam(":new", $new); |
| 20 | 20 | $stmt->bindParam(":rid", $video); |
| 21 | 21 | $stmt->execute(); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | function playlist_update_row($video, $rowName, $new) { |
| 27 | - $stmt = $this->__db->prepare("UPDATE playlists SET ".$rowName." = :new WHERE rid = :rid"); |
|
| 27 | + $stmt = $this->__db->prepare("UPDATE playlists SET " . $rowName . " = :new WHERE rid = :rid"); |
|
| 28 | 28 | $stmt->bindParam(":new", $new); |
| 29 | 29 | $stmt->bindParam(":rid", $video); |
| 30 | 30 | $stmt->execute(); |
@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function sh_exec(string $cmd, string $outputfile = "", string $pidfile = "", bool $mergestderror = true, bool $bg = false) { |
| 14 | 14 | $fullcmd = $cmd; |
| 15 | - if(strlen($outputfile) > 0) $fullcmd .= " >> " . $outputfile; |
|
| 16 | - if($mergestderror) $fullcmd .= " 2>&1"; |
|
| 15 | + if (strlen($outputfile) > 0) $fullcmd .= " >> " . $outputfile; |
|
| 16 | + if ($mergestderror) $fullcmd .= " 2>&1"; |
|
| 17 | 17 | |
| 18 | - if($bg) { |
|
| 18 | + if ($bg) { |
|
| 19 | 19 | $fullcmd = "nohup " . $fullcmd . " &"; |
| 20 | - if(strlen($pidfile)) $fullcmd .= " echo $! > " . $pidfile; |
|
| 20 | + if (strlen($pidfile)) $fullcmd .= " echo $! > " . $pidfile; |
|
| 21 | 21 | } else { |
| 22 | - if(strlen($pidfile) > 0) $fullcmd .= "; echo $$ > " . $pidfile; |
|
| 22 | + if (strlen($pidfile) > 0) $fullcmd .= "; echo $$ > " . $pidfile; |
|
| 23 | 23 | } |
| 24 | 24 | shell_exec($fullcmd); |
| 25 | 25 | } |
@@ -29,21 +29,21 @@ discard block |
||
| 29 | 29 | $handle = fopen($file, "r"); |
| 30 | 30 | $i = 0; |
| 31 | 31 | while (!feof($handle)) { |
| 32 | - call_user_func_array($callback,array(fread($handle,$chunk_size),&$handle,$i)); |
|
| 32 | + call_user_func_array($callback, array(fread($handle, $chunk_size), &$handle, $i)); |
|
| 33 | 33 | $i++; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | fclose($handle); |
| 37 | 37 | } |
| 38 | - catch(Exception $e) { |
|
| 39 | - trigger_error("file_get_contents_chunked::" . $e->getMessage(),E_USER_NOTICE); |
|
| 38 | + catch (Exception $e) { |
|
| 39 | + trigger_error("file_get_contents_chunked::" . $e->getMessage(), E_USER_NOTICE); |
|
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | return true; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function __construct($conn){ |
|
| 46 | + public function __construct($conn) { |
|
| 47 | 47 | $this->__db = $conn; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $stmt->execute(); |
| 62 | 62 | |
| 63 | 63 | $views = 0; |
| 64 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 64 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 65 | 65 | $views = $views + $this->fetch_video_views($video['rid']); |
| 66 | 66 | } |
| 67 | 67 | return $views; |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | for ($i = 0; $i < $timesc; $i++) { |
| 86 | 86 | $remaining = $timesc - $i - 1; |
| 87 | 87 | if ($i < $timesc - 1) { |
| 88 | - $final.=$times[$i].'*'.(60 ** $remaining).'+'; |
|
| 88 | + $final .= $times[$i] . '*' . (60 ** $remaining) . '+'; |
|
| 89 | 89 | } else { |
| 90 | - $final.=$times[$i]; |
|
| 90 | + $final .= $times[$i]; |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } else { |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | function shorten_description(string $description, int $limit, bool $newlines = false) { |
| 100 | 100 | $description = trim($description); |
| 101 | - if(strlen($description) >= $limit) { |
|
| 101 | + if (strlen($description) >= $limit) { |
|
| 102 | 102 | $description = substr($description, 0, $limit) . "..."; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $description = htmlspecialchars($description); |
| 106 | - if($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); } |
|
| 106 | + if ($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); } |
|
| 107 | 107 | $description = preg_replace("/@([a-zA-Z0-9-]+|\\+\\])/", "<a href='/user/$1'>@$1</a>", $description); |
| 108 | 108 | $description = preg_replace("/((\d{1,2}:)+\d{2})/", "<a onclick=\"yt.www.watch.player.seekTo('$1', false)\">$1</a>", $description); |
| 109 | 109 | return $description; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | function get_video_likes($reciever, $liked) { |
| 121 | - if($liked) { |
|
| 121 | + if ($liked) { |
|
| 122 | 122 | $stmt = $this->__db->prepare("SELECT `sender` FROM likes WHERE reciever = :reciever AND type = 'l'"); |
| 123 | 123 | $stmt->bindParam(":reciever", $reciever); |
| 124 | 124 | $stmt->execute(); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $stmt->bindParam(":viewer", $user); |
| 139 | 139 | $stmt->bindParam(":rid", $vidid); |
| 140 | 140 | $stmt->execute(); |
| 141 | - if($stmt->rowCount() === 0) { |
|
| 141 | + if ($stmt->rowCount() === 0) { |
|
| 142 | 142 | $this->add_view($vidid, $user); |
| 143 | 143 | } |
| 144 | 144 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | function get_comment_likes($reciever, $liked) { |
| 154 | - if($liked) { |
|
| 154 | + if ($liked) { |
|
| 155 | 155 | $stmt = $this->__db->prepare("SELECT `sender` FROM comment_likes WHERE reciever = :reciever AND type = 'l'"); |
| 156 | 156 | $stmt->bindParam(":reciever", $reciever); |
| 157 | 157 | $stmt->execute(); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | function if_liked($user, $reciever, $liked) { |
| 170 | - if($liked) { |
|
| 170 | + if ($liked) { |
|
| 171 | 171 | $stmt = $this->__db->prepare("SELECT `sender` FROM likes WHERE sender = :sender AND reciever = :reciever AND type = 'l'"); |
| 172 | 172 | $stmt->bindParam(":sender", $user); |
| 173 | 173 | $stmt->bindParam(":reciever", $reciever); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | function if_comment_liked($user, $reciever, $liked) { |
| 188 | - if($liked) { |
|
| 188 | + if ($liked) { |
|
| 189 | 189 | $stmt = $this->__db->prepare("SELECT `sender` FROM comment_likes WHERE sender = :sender AND reciever = :reciever AND type = 'l'"); |
| 190 | 190 | $stmt->bindParam(":sender", $user); |
| 191 | 191 | $stmt->bindParam(":reciever", $reciever); |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | <?php $__db_h = new db_helper(); ?> |
| 13 | 13 | <?php $__time_h = new time_helper(); ?> |
| 14 | 14 | <?php |
| 15 | - if(!$__video_h->video_exists($_GET['v'])) |
|
| 15 | + if (!$__video_h->video_exists($_GET['v'])) |
|
| 16 | 16 | header("Location: /?error=Your video has not processed correctly. Try reuploading it with a shorter title, description, or tag."); |
| 17 | 17 | |
| 18 | 18 | $_video = $__video_h->fetch_video_rid($_GET['v']); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $_video['title'] = htmlspecialchars($_video['title']); |
| 25 | 25 | $_video['description'] = $__video_h->shorten_description($_video['description'], 50); |
| 26 | 26 | |
| 27 | - if($_SESSION['siteusername'] != $_video['author']) |
|
| 27 | + if ($_SESSION['siteusername'] != $_video['author']) |
|
| 28 | 28 | header("Location: /"); |
| 29 | 29 | ?> |
| 30 | 30 | <?php |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | <?php $__db_h = new db_helper(); ?> |
| 9 | 9 | <?php $__time_h = new time_helper(); ?> |
| 10 | 10 | <?php |
| 11 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 11 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 12 | 12 | $request = (object) [ |
| 13 | 13 | "username" => $_POST['username'], |
| 14 | 14 | "password" => $_POST['password'], |
@@ -22,25 +22,25 @@ discard block |
||
| 22 | 22 | ]; |
| 23 | 23 | |
| 24 | 24 | if (!filter_var($request->email, FILTER_VALIDATE_EMAIL)) |
| 25 | - { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 26 | - if(strlen($request->username) > 21) |
|
| 25 | + { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 26 | + if (strlen($request->username) > 21) |
|
| 27 | 27 | { $request->error->message = "Your username must be shorter than 20 characters."; $request->error->status = ""; } |
| 28 | - if(strlen($request->password) < 8) |
|
| 28 | + if (strlen($request->password) < 8) |
|
| 29 | 29 | { $request->error->message = "Your password must at least be 8 characters long."; $request->error->status = ""; } |
| 30 | - if(!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 30 | + if (!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 31 | 31 | { $request->error->message = "Include numbers and letters in your password!"; $request->error->status = ""; } |
| 32 | - if(!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 32 | + if (!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 33 | 33 | { $request->error->message = "Your username cannot contain any special characters!"; $request->error->status = ""; } |
| 34 | - if(empty(trim($request->username))) |
|
| 34 | + if (empty(trim($request->username))) |
|
| 35 | 35 | { $request->error->message = "Your username cannot be empty!"; $request->error->status = ""; } |
| 36 | 36 | |
| 37 | 37 | $stmt = $__db->prepare("SELECT username FROM users WHERE username = :username"); |
| 38 | 38 | $stmt->bindParam(":username", $request->username); |
| 39 | 39 | $stmt->execute(); |
| 40 | - if($stmt->rowCount()) |
|
| 40 | + if ($stmt->rowCount()) |
|
| 41 | 41 | { $request->error->message = "There's already a user with that same username!"; $request->error->status = ""; } |
| 42 | 42 | |
| 43 | - if($request->error->status == "OK") { |
|
| 43 | + if ($request->error->status == "OK") { |
|
| 44 | 44 | $stmt = $__db->prepare("INSERT INTO users (username, email, password) VALUES (:username, :email, :password)"); |
| 45 | 45 | $stmt->bindParam(":username", $request->username); |
| 46 | 46 | $stmt->bindParam(":email", $request->email); |
@@ -20,10 +20,10 @@ |
||
| 20 | 20 | ] |
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | -if(empty(trim($request->comment))) { header("Location: /watch?v=" . $_GET['v']); } |
|
| 24 | -if(empty(trim($request->to_id ))) { header("Location: /"); } |
|
| 23 | +if (empty(trim($request->comment))) { header("Location: /watch?v=" . $_GET['v']); } |
|
| 24 | +if (empty(trim($request->to_id))) { header("Location: /"); } |
|
| 25 | 25 | |
| 26 | -if(isset($_SESSION['siteusername'])) { |
|
| 26 | +if (isset($_SESSION['siteusername'])) { |
|
| 27 | 27 | $stmt = $__db->prepare("INSERT INTO comment_reply (toid, author, comment) VALUES (:to_id, :author, :comment)"); |
| 28 | 28 | $stmt->bindParam(":to_id", $request->to_id); |
| 29 | 29 | $stmt->bindParam(":author", $request->sender); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | $__server->page_embeds->page_image = "/yt/imgbin/full-size-logo.png"; |
| 14 | 14 | $__server->page_embeds->page_url = "https://subrock.rocks/"; |
| 15 | 15 | ?> |
| 16 | -<?php if(!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?> |
|
| 16 | +<?php if (!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?> |
|
| 17 | 17 | <!DOCTYPE html> |
| 18 | 18 | <html dir="ltr"> |
| 19 | 19 | <head> |
@@ -166,15 +166,15 @@ discard block |
||
| 166 | 166 | $stmt->execute(); |
| 167 | 167 | |
| 168 | 168 | $number_of_result = $stmt->rowCount(); |
| 169 | - $number_of_page = ceil ($number_of_result / $results_per_page); |
|
| 169 | + $number_of_page = ceil($number_of_result/$results_per_page); |
|
| 170 | 170 | |
| 171 | - if (!isset ($_GET['page']) ) { |
|
| 171 | + if (!isset ($_GET['page'])) { |
|
| 172 | 172 | $page = 1; |
| 173 | 173 | } else { |
| 174 | - $page = (int)$_GET['page']; |
|
| 174 | + $page = (int) $_GET['page']; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $page_first_result = ($page - 1) * $results_per_page; |
|
| 177 | + $page_first_result = ($page - 1)*$results_per_page; |
|
| 178 | 178 | ?> |
| 179 | 179 | <?php |
| 180 | 180 | $stmt6 = $__db->prepare("SELECT * FROM videos WHERE author = :search ORDER BY id DESC LIMIT :pfirst, :pper"); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | </tr> |
| 200 | 200 | |
| 201 | 201 | <?php |
| 202 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 202 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 203 | 203 | $video['video_responses'] = $__video_h->get_video_responses($video['rid']); |
| 204 | 204 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 205 | 205 | $video['duration'] = $__time_h->timestamp($video['duration']); |
@@ -208,19 +208,19 @@ discard block |
||
| 208 | 208 | $video['title'] = htmlspecialchars($video['title']); |
| 209 | 209 | $video['description'] = $__video_h->shorten_description($video['description'], 50); |
| 210 | 210 | |
| 211 | - if($video['thumbnail'] == ".png" && $video['filename'] == ".mp4") { |
|
| 211 | + if ($video['thumbnail'] == ".png" && $video['filename'] == ".mp4") { |
|
| 212 | 212 | $status = "Corrupted"; |
| 213 | - } else if($video['visibility'] == "v") { |
|
| 213 | + } else if ($video['visibility'] == "v") { |
|
| 214 | 214 | $status = "Approved"; |
| 215 | - } else if($video['visibility'] == "n") { |
|
| 215 | + } else if ($video['visibility'] == "n") { |
|
| 216 | 216 | $status = "Approved"; |
| 217 | - } else if($video['visibility'] == "o") { |
|
| 217 | + } else if ($video['visibility'] == "o") { |
|
| 218 | 218 | $status = "Disapproved"; |
| 219 | 219 | } else { |
| 220 | 220 | $status = "Unknown"; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | - if($video['commenting'] == "a") |
|
| 223 | + if ($video['commenting'] == "a") |
|
| 224 | 224 | $video['commentstatus'] = "Commenting allowed"; |
| 225 | 225 | else |
| 226 | 226 | $video['commentstatus'] = "Commenting disallowed"; |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | </div> |
| 285 | 285 | </center> |
| 286 | 286 | |
| 287 | - <?php for($page = 1; $page<= $number_of_page; $page++) { ?> |
|
| 287 | + <?php for ($page = 1; $page <= $number_of_page; $page++) { ?> |
|
| 288 | 288 | <button class="yt-uix-button yt-uix-button-default" onclick="ajax_fetch_videomanager(<?php echo $page; ?>)"><?php echo $page; ?></button> |
| 289 | 289 | <?php } ?> |
| 290 | 290 | |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | </script> |
| 331 | 331 | |
| 332 | 332 | <?php |
| 333 | - if($stmt6->rowCount() == 0) { echo " |
|
| 333 | + if ($stmt6->rowCount() == 0) { echo " |
|
| 334 | 334 | <br>Welcome to your Video Manager! You can manage your uploaded videos here.<br> |
| 335 | 335 | <a href=\"upload_video\"> |
| 336 | 336 | <button type=\"button\" class=\" yt-uix-button yt-uix-button-default\" role=\"button\"> |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | <?php $__user_h = new user_helper($__db); ?> |
| 8 | 8 | <?php $__db_h = new db_helper(); ?> |
| 9 | 9 | <?php $__time_h = new time_helper(); error_reporting(E_ERROR | E_PARSE); ?> |
| 10 | -<?php if(!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?> |
|
| 10 | +<?php if (!isset($_SESSION['siteusername'])) { header("Location: /sign_in"); } ?> |
|
| 11 | 11 | <?php |
| 12 | 12 | $__server->page_embeds->page_title = "SubRocks - Favorite Videos"; |
| 13 | 13 | $__server->page_embeds->page_description = "SubRocks is a site dedicated to bring back the 2012 layout of YouTube."; |
@@ -166,15 +166,15 @@ discard block |
||
| 166 | 166 | $stmt->execute(); |
| 167 | 167 | |
| 168 | 168 | $number_of_result = $stmt->rowCount(); |
| 169 | - $number_of_page = ceil ($number_of_result / $results_per_page); |
|
| 169 | + $number_of_page = ceil($number_of_result/$results_per_page); |
|
| 170 | 170 | |
| 171 | - if (!isset ($_GET['page']) ) { |
|
| 171 | + if (!isset ($_GET['page'])) { |
|
| 172 | 172 | $page = 1; |
| 173 | 173 | } else { |
| 174 | - $page = (int)$_GET['page']; |
|
| 174 | + $page = (int) $_GET['page']; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - $page_first_result = ($page - 1) * $results_per_page; |
|
| 177 | + $page_first_result = ($page - 1)*$results_per_page; |
|
| 178 | 178 | ?> |
| 179 | 179 | <?php |
| 180 | 180 | $stmt6 = $__db->prepare("SELECT * FROM favorite_video WHERE sender = :search ORDER BY id DESC LIMIT :pfirst, :pper"); |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | </tr> |
| 195 | 195 | |
| 196 | 196 | <?php |
| 197 | - while($video = $stmt6->fetch(PDO::FETCH_ASSOC)) { |
|
| 198 | - if($__video_h->video_exists($video['reciever'])) { |
|
| 197 | + while ($video = $stmt6->fetch(PDO::FETCH_ASSOC)) { |
|
| 198 | + if ($__video_h->video_exists($video['reciever'])) { |
|
| 199 | 199 | $_video = $__video_h->fetch_video_rid($video['reciever']); |
| 200 | 200 | $_video['video_responses'] = $__video_h->get_video_responses($_video['rid']); |
| 201 | 201 | $_video['age'] = $__time_h->time_elapsed_string($_video['publish']); |
@@ -205,19 +205,19 @@ discard block |
||
| 205 | 205 | $_video['title'] = htmlspecialchars($_video['title']); |
| 206 | 206 | $_video['description'] = $__video_h->shorten_description($_video['description'], 50); |
| 207 | 207 | |
| 208 | - if($_video['thumbnail'] == ".png" && $_video['filename'] == ".mp4") { |
|
| 208 | + if ($_video['thumbnail'] == ".png" && $_video['filename'] == ".mp4") { |
|
| 209 | 209 | $status = "Corrupted"; |
| 210 | - } else if($_video['visibility'] == "v") { |
|
| 210 | + } else if ($_video['visibility'] == "v") { |
|
| 211 | 211 | $status = "Approved"; |
| 212 | - } else if($_video['visibility'] == "n") { |
|
| 212 | + } else if ($_video['visibility'] == "n") { |
|
| 213 | 213 | $status = "Approved"; |
| 214 | - } else if($_video['visibility'] == "o") { |
|
| 214 | + } else if ($_video['visibility'] == "o") { |
|
| 215 | 215 | $status = "Disapproved"; |
| 216 | 216 | } else { |
| 217 | 217 | $status = "Unknown"; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if($_video['commenting'] == "a") |
|
| 220 | + if ($_video['commenting'] == "a") |
|
| 221 | 221 | $_video['commentstatus'] = "Commenting allowed"; |
| 222 | 222 | else |
| 223 | 223 | $_video['commentstatus'] = "Commenting disallowed"; |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | </div> |
| 264 | 264 | </center> |
| 265 | 265 | |
| 266 | - <?php for($page = 1; $page<= $number_of_page; $page++) { ?> |
|
| 266 | + <?php for ($page = 1; $page <= $number_of_page; $page++) { ?> |
|
| 267 | 267 | <button class="yt-uix-button yt-uix-button-default" onclick="ajax_fetch_videomanager(<?php echo $page; ?>)"><?php echo $page; ?></button> |
| 268 | 268 | <?php } ?> |
| 269 | 269 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | </script> |
| 310 | 310 | |
| 311 | 311 | <?php |
| 312 | - if($stmt6->rowCount() == 0) { echo " |
|
| 312 | + if ($stmt6->rowCount() == 0) { echo " |
|
| 313 | 313 | <br>Welcome to your favorite videos page.<br> |
| 314 | 314 | You can add videos that you like and the video will be added here! |
| 315 | 315 | "; |