@@ -43,9 +43,9 @@ |
||
| 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 | |
| 50 | 50 | function fetch_video_views(string $id) { |
| 51 | 51 | $stmt = $this->__db->prepare("SELECT * FROM views WHERE videoid = :id"); |
@@ -12,14 +12,22 @@ 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) { |
|
| 16 | + $fullcmd .= " >> " . $outputfile; |
|
| 17 | + } |
|
| 18 | + if($mergestderror) { |
|
| 19 | + $fullcmd .= " 2>&1"; |
|
| 20 | + } |
|
| 17 | 21 | |
| 18 | 22 | if($bg) { |
| 19 | 23 | $fullcmd = "nohup " . $fullcmd . " &"; |
| 20 | - if(strlen($pidfile)) $fullcmd .= " echo $! > " . $pidfile; |
|
| 24 | + if(strlen($pidfile)) { |
|
| 25 | + $fullcmd .= " echo $! > " . $pidfile; |
|
| 26 | + } |
|
| 21 | 27 | } else { |
| 22 | - if(strlen($pidfile) > 0) $fullcmd .= "; echo $$ > " . $pidfile; |
|
| 28 | + if(strlen($pidfile) > 0) { |
|
| 29 | + $fullcmd .= "; echo $$ > " . $pidfile; |
|
| 30 | + } |
|
| 23 | 31 | } |
| 24 | 32 | shell_exec($fullcmd); |
| 25 | 33 | } |
@@ -34,8 +42,7 @@ discard block |
||
| 34 | 42 | } |
| 35 | 43 | |
| 36 | 44 | fclose($handle); |
| 37 | - } |
|
| 38 | - catch(Exception $e) { |
|
| 45 | + } catch(Exception $e) { |
|
| 39 | 46 | trigger_error("file_get_contents_chunked::" . $e->getMessage(),E_USER_NOTICE); |
| 40 | 47 | return false; |
| 41 | 48 | } |
@@ -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; |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | function shorten_description(string $description, int $limit, bool $newlines = false) { |
| 80 | 80 | $description = trim($description); |
| 81 | - if(strlen($description) >= $limit) { |
|
| 81 | + if (strlen($description) >= $limit) { |
|
| 82 | 82 | $description = substr($description, 0, $limit) . "..."; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $description = htmlspecialchars($description); |
| 86 | - if($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); } |
|
| 86 | + if ($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); } |
|
| 87 | 87 | return $description; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | function get_video_likes($reciever, $liked) { |
| 99 | - if($liked) { |
|
| 99 | + if ($liked) { |
|
| 100 | 100 | $stmt = $this->__db->prepare("SELECT `sender` FROM likes WHERE reciever = :reciever AND type = 'l'"); |
| 101 | 101 | $stmt->bindParam(":reciever", $reciever); |
| 102 | 102 | $stmt->execute(); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | function if_liked($user, $reciever, $liked) { |
| 115 | - if($liked) { |
|
| 115 | + if ($liked) { |
|
| 116 | 116 | $stmt = $this->__db->prepare("SELECT `sender` FROM likes WHERE sender = :sender AND reciever = :reciever AND type = 'l'"); |
| 117 | 117 | $stmt->bindParam(":sender", $user); |
| 118 | 118 | $stmt->bindParam(":reciever", $reciever); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | <!--<button class="yt-uix-button yt-uix-button-default" id="av-uplod">Select File</button>--> |
| 212 | 212 | </div><br><br> |
| 213 | 213 | <img src="/dynamic/pfp/<?php echo $_user['pfp']; ?>" style="width:100px;height:100px;"><br> |
| 214 | - <?php if($_user['pfp'] != "default.png") { ?> |
|
| 214 | + <?php if ($_user['pfp'] != "default.png") { ?> |
|
| 215 | 215 | <a href="/get/remove_profile_pic">Remove Profile Picture</a><br> |
| 216 | 216 | <?php } ?> |
| 217 | 217 | <br><hr class="thin-line-darker" style="width:unset;"> |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | <input style="width: 169px;position: relative;top: 10px;" type="file" name="videopagebanner" id="avatar-upload"> |
| 221 | 221 | <!--<button class="yt-uix-button yt-uix-button-default" id="av-uplod">Select File</button>--> |
| 222 | 222 | </div><br> |
| 223 | - <?php if(!empty($_user['subbutton'])) { ?> |
|
| 223 | + <?php if (!empty($_user['subbutton'])) { ?> |
|
| 224 | 224 | <a href="/get/remove_watch_banner">Remove Watch Page Banner</a><br> |
| 225 | 225 | <?php } ?><br><hr class="thin-line-darker" style="width:unset;"> |
| 226 | 226 | |
@@ -240,17 +240,17 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | <b>Featured Video</b> |
| 242 | 242 | <div class="customization-module" id="featuredvid" action="/d/channel_update" enctype="multipart/form-data" style="display: inline-block;float:right;position: relative;bottom: 6px;"> |
| 243 | - <input style="padding: 5px;background-color: white;border: 1px solid #999;width: 291px;height: 12px;" id="biomd" placeholder="Video ID" value="<?php echo htmlspecialchars($_user['featured']);?>" name="videoid"> |
|
| 243 | + <input style="padding: 5px;background-color: white;border: 1px solid #999;width: 291px;height: 12px;" id="biomd" placeholder="Video ID" value="<?php echo htmlspecialchars($_user['featured']); ?>" name="videoid"> |
|
| 244 | 244 | </div><br><br><hr class="thin-line-darker" style="width:unset;"> |
| 245 | 245 | |
| 246 | 246 | <b>Featured Channels</b> |
| 247 | 247 | <div class="customization-module" id="featuredvid" action="/d/channel_update" enctype="multipart/form-data" style="display: inline-block;float:right;position: relative;bottom: 6px;"> |
| 248 | - <input style="padding: 5px;background-color: white;border: 1px solid #999;width: 291px;height: 12px;" id="biomd" placeholder="Seperate by commas!" value="<?php echo htmlspecialchars($_user['featured_channels']);?>" name="featuredchannels"> |
|
| 248 | + <input style="padding: 5px;background-color: white;border: 1px solid #999;width: 291px;height: 12px;" id="biomd" placeholder="Seperate by commas!" value="<?php echo htmlspecialchars($_user['featured_channels']); ?>" name="featuredchannels"> |
|
| 249 | 249 | </div><br><br><hr class="thin-line-darker" style="width:unset;"> |
| 250 | 250 | |
| 251 | 251 | <b>Website</b> |
| 252 | 252 | <div class="customization-module" id="featuredvid" action="/d/channel_update" enctype="multipart/form-data" style="float: right;position: relative;top: -7px;"> |
| 253 | - <input style="padding: 5px;background-color: white;border: 1px solid #999;width: 291px;height: 12px;" id="biomd" placeholder="Website URL" value="<?php echo htmlspecialchars($_user['website']);?>" name="website"> |
|
| 253 | + <input style="padding: 5px;background-color: white;border: 1px solid #999;width: 291px;height: 12px;" id="biomd" placeholder="Website URL" value="<?php echo htmlspecialchars($_user['website']); ?>" name="website"> |
|
| 254 | 254 | |
| 255 | 255 | </div><br><br><hr class="thin-line-darker" style="width:unset;"> |
| 256 | 256 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | <span style="font-size: 11px;" class="grey-text">This will show what type of channel you are to other users.</span> |
| 260 | 260 | <div class="customization-module" id="channellayout" action="/d/channel_update" enctype="multipart/form-data" style="float: right;position: relative;top: -19px;"> |
| 261 | 261 | <select class="yt-uix-button yt-uix-button-default" style="position:relative;top:6px;" name="genre"> |
| 262 | - <?php foreach($categories as $category) { ?> |
|
| 262 | + <?php foreach ($categories as $category) { ?> |
|
| 263 | 263 | <option value="<?php echo $category; ?>"><?php echo $category; ?></option> |
| 264 | 264 | <?php } ?> |
| 265 | 265 | </select> |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
| 21 | 21 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 22 | 22 | $stmt->execute(array( |
| 23 | - ':username' => $_SESSION['siteusername'], |
|
| 24 | - ':reciever' => $name, |
|
| 23 | + ':username' => $_SESSION['siteusername'], |
|
| 24 | + ':reciever' => $name, |
|
| 25 | 25 | )); |
| 26 | 26 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
| 27 | 27 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
| 34 | 34 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 35 | 35 | $stmt->execute(array( |
| 36 | - ':username' => $_SESSION['siteusername'], |
|
| 37 | - ':reciever' => $name, |
|
| 36 | + ':username' => $_SESSION['siteusername'], |
|
| 37 | + ':reciever' => $name, |
|
| 38 | 38 | )); |
| 39 | 39 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
| 40 | 40 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
| 18 | 18 | $stmt->bindParam(":reciever", $name); |
| 19 | 19 | $stmt->execute(); |
| 20 | -while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 20 | +while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 21 | 21 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 22 | 22 | $stmt->execute(array( |
| 23 | 23 | ':username' => $_SESSION['siteusername'], |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
| 31 | 31 | $stmt->bindParam(":reciever", $name); |
| 32 | 32 | $stmt->execute(); |
| 33 | -while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 33 | +while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 34 | 34 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 35 | 35 | $stmt->execute(array( |
| 36 | 36 | ':username' => $_SESSION['siteusername'], |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | <?php |
| 14 | 14 | $name = $_GET['v']; |
| 15 | 15 | |
| 16 | -if(!isset($_SESSION['siteusername']) || !isset($_GET['v'])) { |
|
| 16 | +if (!isset($_SESSION['siteusername']) || !isset($_GET['v'])) { |
|
| 17 | 17 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
| 22 | 22 | $stmt->bindParam(":reciever", $name); |
| 23 | 23 | $stmt->execute(); |
| 24 | -while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 24 | +while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 25 | 25 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 26 | 26 | $stmt->execute(array( |
| 27 | 27 | ':username' => $_SESSION['siteusername'], |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $stmt->bindParam(":username", $_SESSION['siteusername']); |
| 35 | 35 | $stmt->bindParam(":reciever", $name); |
| 36 | 36 | $stmt->execute(); |
| 37 | -while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 37 | +while ($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 38 | 38 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 39 | 39 | $stmt->execute(array( |
| 40 | 40 | ':username' => $_SESSION['siteusername'], |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
| 21 | 21 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 22 | 22 | $stmt->execute(array( |
| 23 | - ':username' => $_SESSION['siteusername'], |
|
| 24 | - ':reciever' => $name, |
|
| 23 | + ':username' => $_SESSION['siteusername'], |
|
| 24 | + ':reciever' => $name, |
|
| 25 | 25 | )); |
| 26 | 26 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
| 27 | 27 | } |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | while($comment = $stmt->fetch(PDO::FETCH_ASSOC)) { |
| 34 | 34 | $stmt = $__db->prepare("DELETE FROM likes WHERE sender = :username AND reciever = :reciever"); |
| 35 | 35 | $stmt->execute(array( |
| 36 | - ':username' => $_SESSION['siteusername'], |
|
| 37 | - ':reciever' => $name, |
|
| 36 | + ':username' => $_SESSION['siteusername'], |
|
| 37 | + ':reciever' => $name, |
|
| 38 | 38 | )); |
| 39 | 39 | header('Location: ' . $_SERVER['HTTP_REFERER']); |
| 40 | 40 | } |
@@ -14,11 +14,11 @@ |
||
| 14 | 14 | <?php |
| 15 | 15 | |
| 16 | 16 | if($video['author'] == $_SESSION['siteusername']) { |
| 17 | - $stmt = $__db->prepare("DELETE FROM videos WHERE rid=:rid AND author=:author"); |
|
| 18 | - $stmt->execute(array( |
|
| 17 | + $stmt = $__db->prepare("DELETE FROM videos WHERE rid=:rid AND author=:author"); |
|
| 18 | + $stmt->execute(array( |
|
| 19 | 19 | ':author' => $video['author'], |
| 20 | 20 | ':rid' => $video['rid'], |
| 21 | - )); |
|
| 21 | + )); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | header('Location: /video_manager'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | <?php $video = $__video_h->fetch_video_rid($_GET['v']); ?> |
| 14 | 14 | <?php |
| 15 | 15 | |
| 16 | -if($video['author'] == $_SESSION['siteusername']) { |
|
| 16 | +if ($video['author'] == $_SESSION['siteusername']) { |
|
| 17 | 17 | $stmt = $__db->prepare("DELETE FROM videos WHERE rid=:rid AND author=:author"); |
| 18 | 18 | $stmt->execute(array( |
| 19 | 19 | ':author' => $video['author'], |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <?php $__time_h = new time_helper(); ?> |
| 13 | 13 | <?php $playlist = $__video_h->fetch_playlist_rid($_GET['id']); ?> |
| 14 | 14 | <?php |
| 15 | -if($playlist['author'] == $_SESSION['siteusername']) { |
|
| 15 | +if ($playlist['author'] == $_SESSION['siteusername']) { |
|
| 16 | 16 | $stmt = $__db->prepare("DELETE FROM playlists WHERE rid=:rid AND author=:author"); |
| 17 | 17 | $stmt->execute(array( |
| 18 | 18 | ':author' => $_SESSION['siteusername'], |
@@ -15,11 +15,13 @@ discard block |
||
| 15 | 15 | <?php $__db_h = new db_helper(); ?> |
| 16 | 16 | <?php $__time_h = new time_helper(); ?> |
| 17 | 17 | <?php |
| 18 | - if(isset($_SESSION['siteusername'])) |
|
| 19 | - $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']); |
|
| 18 | + if(isset($_SESSION['siteusername'])) { |
|
| 19 | + $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']); |
|
| 20 | + } |
|
| 20 | 21 | |
| 21 | - if(!$__user_h->user_exists($_GET['n'])) |
|
| 22 | - header("Location: /?userdoesntexist"); |
|
| 22 | + if(!$__user_h->user_exists($_GET['n'])) { |
|
| 23 | + header("Location: /?userdoesntexist"); |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | $_user = $__user_h->fetch_user_username($_GET['n']); |
| 25 | 27 | |
@@ -42,10 +44,11 @@ discard block |
||
| 42 | 44 | |
| 43 | 45 | if ( |
| 44 | 46 | ctype_xdigit($colorCode) && |
| 45 | - (strlen($colorCode) == 6 || strlen($colorCode) == 3)) |
|
| 46 | - return true; |
|
| 47 | - |
|
| 48 | - else return false; |
|
| 47 | + (strlen($colorCode) == 6 || strlen($colorCode) == 3)) { |
|
| 48 | + return true; |
|
| 49 | + } else { |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 49 | 52 | } |
| 50 | 53 | |
| 51 | 54 | $_user['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_user['username']); |
@@ -77,8 +80,9 @@ discard block |
||
| 77 | 80 | if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
| 78 | 81 | if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
| 79 | 82 | |
| 80 | - if(isset($_SESSION['siteusername'])) |
|
| 81 | - $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
| 83 | + if(isset($_SESSION['siteusername'])) { |
|
| 84 | + $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
| 85 | + } |
|
| 82 | 86 | |
| 83 | 87 | if($_SERVER['REQUEST_METHOD'] == 'POST') { |
| 84 | 88 | $error = array(); |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | <?php $__db_h = new db_helper(); ?> |
| 14 | 14 | <?php $__time_h = new time_helper(); ?> |
| 15 | 15 | <?php |
| 16 | - if(isset($_SESSION['siteusername'])) |
|
| 16 | + if (isset($_SESSION['siteusername'])) |
|
| 17 | 17 | $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']); |
| 18 | 18 | |
| 19 | - if(!$__user_h->user_exists($_GET['n'])) |
|
| 19 | + if (!$__user_h->user_exists($_GET['n'])) |
|
| 20 | 20 | header("Location: /?userdoesntexist"); |
| 21 | 21 | |
| 22 | 22 | $_user = $__user_h->fetch_user_username($_GET['n']); |
@@ -69,28 +69,28 @@ discard block |
||
| 69 | 69 | $_user['genre'] = strtolower($_user['genre']); |
| 70 | 70 | $_user['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_user['username']); |
| 71 | 71 | |
| 72 | - if(!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; } |
|
| 73 | - if(!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; } |
|
| 74 | - if(!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; } |
|
| 75 | - if(!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; } |
|
| 76 | - if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
|
| 77 | - if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
|
| 72 | + if (!check_valid_colorhex($_user['primary_color']) && strlen($_user['primary_color']) != 6) { $_user['primary_color'] = ""; } |
|
| 73 | + if (!check_valid_colorhex($_user['secondary_color']) && strlen($_user['secondary_color']) != 6) { $_user['secondary_color'] = ""; } |
|
| 74 | + if (!check_valid_colorhex($_user['third_color']) && strlen($_user['third_color']) != 6) { $_user['third_color'] = ""; } |
|
| 75 | + if (!check_valid_colorhex($_user['text_color']) && strlen($_user['text_color']) != 6) { $_user['text_color'] = ""; } |
|
| 76 | + if (!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
|
| 77 | + if (!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
|
| 78 | 78 | |
| 79 | - if(isset($_SESSION['siteusername'])) |
|
| 79 | + if (isset($_SESSION['siteusername'])) |
|
| 80 | 80 | $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
| 81 | 81 | |
| 82 | - if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 82 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 83 | 83 | $error = array(); |
| 84 | 84 | |
| 85 | - if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; } |
|
| 86 | - if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; } |
|
| 87 | - if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; } |
|
| 85 | + if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; } |
|
| 86 | + if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; } |
|
| 87 | + if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; } |
|
| 88 | 88 | //if(!isset($_POST['g-recaptcha-response'])){ $error['message'] = "captcha validation failed"; $error['status'] = true; } |
| 89 | 89 | //if(!$_user_insert_utils->validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error['message'] = "captcha validation failed"; $error['status'] = true; } |
| 90 | - 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; } |
|
| 90 | + 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; } |
|
| 91 | 91 | //if(ifBlocked(@$_SESSION['siteusername'], $user['username'], $__db)) { $error = "This user has blocked you!"; $error['status'] = true; } |
| 92 | 92 | |
| 93 | - if(!isset($error['message'])) { |
|
| 93 | + if (!isset($error['message'])) { |
|
| 94 | 94 | $text = $_POST['comment']; |
| 95 | 95 | $stmt = $__db->prepare("INSERT INTO profile_comments (toid, author, comment) VALUES (:id, :username, :comment)"); |
| 96 | 96 | $stmt->bindParam(":id", $_user['username']); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | $_user_update_utils->update_comment_cooldown_time($_SESSION['siteusername']); |
| 102 | 102 | |
| 103 | - if(@$_SESSION['siteusername'] != $_user['username']) { |
|
| 103 | + if (@$_SESSION['siteusername'] != $_user['username']) { |
|
| 104 | 104 | $_user_insert_utils->send_message($_user['username'], "New comment", 'I commented "' . $_POST['comment'] . '" on your profile!', $_SESSION['siteusername']); |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | <link rel="stylesheet" href="/yt/cssbin/www-extra.css"> |
| 127 | 127 | <style> |
| 128 | 128 | #content-container { |
| 129 | - background-color: <?php echo $_user['primary_color']; ?>; |
|
| 129 | + background-color: <?php echo $_user['primary_color']; ?>; |
|
| 130 | 130 | background-image: url(/dynamic/banners/<?php echo $_user['2009_bg']; ?>); |
| 131 | 131 | background-repeat: repeat; |
| 132 | 132 | background-position: center top; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | <div id="masthead-container"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/header.php"); ?></div> |
| 143 | 143 | <div id="content-container"> |
| 144 | 144 | <!-- begin content --> |
| 145 | - <?php if(isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?> |
|
| 145 | + <?php if (isset($_SESSION['siteusername']) && $_user['username'] == $_SESSION['siteusername']) { ?> |
|
| 146 | 146 | <div class="channel_customization"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/channel_customization.php"); ?></div> |
| 147 | 147 | <?php } ?> |
| 148 | 148 | <div id="content"> |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | <h1><?php echo htmlspecialchars($_user['username']); ?></h1> |
| 198 | 198 | </div> |
| 199 | 199 | <div class="upper-left-section enable-fancy-subscribe-button"> |
| 200 | - <?php if($_user['username'] != @$_SESSION['siteusername']) { ?> |
|
| 200 | + <?php if ($_user['username'] != @$_SESSION['siteusername']) { ?> |
|
| 201 | 201 | <div class="yt-subscription-button-hovercard yt-uix-hovercard"> |
| 202 | 202 | <button href="https://accounts.google.com/ServiceLogin?uilel=3&service=youtube&passive=true&continue=http%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26feature%3Dsubscribe%26nomobiletemp%3D1%26hl%3Den_US%26next%3D%252Fuser%252F<?php echo htmlspecialchars($_user['username']); ?>%253Ffeature%253Dg-logo-xit&hl=en_US&ltmpl=sso" onclick=";window.location.href=this.getAttribute('href');return false;" title="" type="button" class="yt-subscription-button subscription-button-with-recommended-channels yt-uix-button yt-uix-button-subscription yt-uix-tooltip" data-enable-hovercard="true" data-subscription-value="UCIwFjwMjI0y7PDBVEO9-bkQ" data-force-position="" data-position="" data-subscription-feature="channels3" data-subscription-type="channel" role="button"><span class="yt-uix-button-icon-wrapper"><img class="yt-uix-button-icon yt-uix-button-icon-subscribe" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt=""></span><span class="yt-uix-button-content"> <span class="subscribe-label">Subscribe</span> |
| 203 | 203 | <span class="subscribed-label">Subscribed</span> |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | </div> |
| 264 | 264 | </div> |
| 265 | 265 | </div> |
| 266 | - <?php if($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?> |
|
| 266 | + <?php if ($_user['featured'] != "None") { $video = $__video_h->fetch_video_rid($_user['featured']); } else { $_user['featured'] = false; } ?> |
|
| 267 | 267 | <div id="branded-page-body"> |
| 268 | 268 | <div class="channel-tab-content channel-layout-full-width"> |
| 269 | 269 | <div class="tab-content-body"> |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC"); |
| 298 | 298 | $stmt->bindParam(":username", $_user['username']); |
| 299 | 299 | $stmt->execute(); |
| 300 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 300 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 301 | 301 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 302 | 302 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 303 | 303 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -13,8 +13,8 @@ discard block |
||
| 13 | 13 | <?php $__db_h = new db_helper(); ?> |
| 14 | 14 | <?php $__time_h = new time_helper(); ?> |
| 15 | 15 | <?php |
| 16 | - if(isset($_SESSION['siteusername'])) |
|
| 17 | - $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']); |
|
| 16 | + if(isset($_SESSION['siteusername'])) |
|
| 17 | + $_user_hp = $__user_h->fetch_user_username($_SESSION['siteusername']); |
|
| 18 | 18 | |
| 19 | 19 | if(!$__user_h->user_exists($_GET['n'])) |
| 20 | 20 | header("Location: /?userdoesntexist"); |
@@ -27,21 +27,21 @@ discard block |
||
| 27 | 27 | return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - function addhttp($url) { |
|
| 31 | - if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { |
|
| 32 | - $url = "http://" . $url; |
|
| 33 | - } |
|
| 34 | - return $url; |
|
| 35 | - } |
|
| 30 | + function addhttp($url) { |
|
| 31 | + if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { |
|
| 32 | + $url = "http://" . $url; |
|
| 33 | + } |
|
| 34 | + return $url; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | function check_valid_colorhex($colorCode) { |
| 38 | 38 | // If user accidentally passed along the # sign, strip it off |
| 39 | 39 | $colorCode = ltrim($colorCode, '#'); |
| 40 | 40 | |
| 41 | 41 | if ( |
| 42 | - ctype_xdigit($colorCode) && |
|
| 42 | + ctype_xdigit($colorCode) && |
|
| 43 | 43 | (strlen($colorCode) == 6 || strlen($colorCode) == 3)) |
| 44 | - return true; |
|
| 44 | + return true; |
|
| 45 | 45 | |
| 46 | 46 | else return false; |
| 47 | 47 | } |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
| 77 | 77 | if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
| 78 | 78 | |
| 79 | - if(isset($_SESSION['siteusername'])) |
|
| 80 | - $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
| 79 | + if(isset($_SESSION['siteusername'])) |
|
| 80 | + $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
| 81 | 81 | |
| 82 | 82 | if($_SERVER['REQUEST_METHOD'] == 'POST') { |
| 83 | 83 | $error = array(); |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | //if(ifBlocked(@$_SESSION['siteusername'], $user['username'], $__db)) { $error = "This user has blocked you!"; $error['status'] = true; } |
| 92 | 92 | |
| 93 | 93 | if(!isset($error['message'])) { |
| 94 | - $text = $_POST['comment']; |
|
| 94 | + $text = $_POST['comment']; |
|
| 95 | 95 | $stmt = $__db->prepare("INSERT INTO profile_comments (toid, author, comment) VALUES (:id, :username, :comment)"); |
| 96 | - $stmt->bindParam(":id", $_user['username']); |
|
| 97 | - $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
| 98 | - $stmt->bindParam(":comment", $text); |
|
| 96 | + $stmt->bindParam(":id", $_user['username']); |
|
| 97 | + $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
| 98 | + $stmt->bindParam(":comment", $text); |
|
| 99 | 99 | $stmt->execute(); |
| 100 | 100 | |
| 101 | 101 | $_user_update_utils->update_comment_cooldown_time($_SESSION['siteusername']); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | - ?> |
|
| 108 | + ?> |
|
| 109 | 109 | <!DOCTYPE html> |
| 110 | 110 | <html dir="ltr" xmlns:og="http://opengraphprotocol.org/schema/" lang="en"> |
| 111 | 111 | <!-- machid: sNW5tN3Z2SWdXaDRqNGxuNEF5MFBxM1BxWXd0VGo0Rkg3UXNTTTNCUGRDWjR0WGpHR3R1YzFR --> |
@@ -294,17 +294,17 @@ discard block |
||
| 294 | 294 | <div class="channel-filtered-content"> |
| 295 | 295 | <ol class="channel-videos-list"> |
| 296 | 296 | <?php |
| 297 | - $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC"); |
|
| 298 | - $stmt->bindParam(":username", $_user['username']); |
|
| 299 | - $stmt->execute(); |
|
| 300 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 301 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 302 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 303 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 304 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 305 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 306 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 307 | - ?> |
|
| 297 | + $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC"); |
|
| 298 | + $stmt->bindParam(":username", $_user['username']); |
|
| 299 | + $stmt->execute(); |
|
| 300 | + while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 301 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 302 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 303 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 304 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 305 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 306 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 307 | + ?> |
|
| 308 | 308 | <li class="yt-c3-grid-item"> |
| 309 | 309 | <a href="/watch?v=<?php echo htmlspecialchars($video['rid']); ?>" class="ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto " data-sessionlink="feature=plcp&context=C4e80d7cVDvjVQa1PpcFPHxNkhfeSQg8_nJHnhVurQf82C2OenNiw%3D"><span class="video-thumb ux-thumb yt-thumb-default-234 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" alt="Thumbnail" onerror="this.onerror=null;this.src='/dynamic/thumbs/default.jpg';" width="234"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span> |
| 310 | 310 | <button onclick=";return false;" title="Watch Later" type="button" class="addto-button video-actions addto-watch-later-button-sign-in yt-uix-button yt-uix-button-default yt-uix-button-short yt-uix-tooltip" data-button-menu-id="shared-addto-watch-later-login" data-video-ids="yBlvNSfqAj0" role="button"><span class="yt-uix-button-content"> <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later"> |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $stmt = $__db->prepare("SELECT * FROM videos WHERE author = :username ORDER BY id DESC LIMIT 20"); |
| 40 | 40 | $stmt->bindParam(":username", $_video['author']); |
| 41 | 41 | $stmt->execute(); |
| 42 | - while($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 42 | + while ($video = $stmt->fetch(PDO::FETCH_ASSOC)) { |
|
| 43 | 43 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 44 | 44 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 45 | 45 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -26,14 +26,14 @@ |
||
| 26 | 26 | 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; } |
| 27 | 27 | |
| 28 | 28 | if(!isset($error['message'])) { |
| 29 | - $text = $_POST['comment']; |
|
| 29 | + $text = $_POST['comment']; |
|
| 30 | 30 | $stmt = $__db->prepare("INSERT INTO comments (toid, author, comment) VALUES (:v, :username, :comment)"); |
| 31 | 31 | $stmt->bindParam(":v", $_GET['v']); |
| 32 | - $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
| 33 | - $stmt->bindParam(":comment", $text); |
|
| 32 | + $stmt->bindParam(":username", $_SESSION['siteusername']); |
|
| 33 | + $stmt->bindParam(":comment", $text); |
|
| 34 | 34 | $stmt->execute(); |
| 35 | 35 | |
| 36 | - $__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment"); |
|
| 36 | + $__user_u->update_cooldown_time($_SESSION['siteusername'], "cooldown_comment"); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | die(json_encode($request)); |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | <?php $__user_u = new user_update($__db); ?> |
| 11 | 11 | <?php $__db_h = new db_helper(); ?> |
| 12 | 12 | <?php $__time_h = new time_helper(); ?> |
| 13 | -<?php if(!$__video_h->video_exists($_GET['v'])) { header("Location: /?error=This video doesn't exist!"); } ?> |
|
| 13 | +<?php if (!$__video_h->video_exists($_GET['v'])) { header("Location: /?error=This video doesn't exist!"); } ?> |
|
| 14 | 14 | <?php $_video = $__video_h->fetch_video_rid($_GET['v']); ?> |
| 15 | 15 | <?php $_video['comments'] = $__video_h->get_comments_from_video($_video['rid']); ?> |
| 16 | 16 | <?php |
| 17 | - if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 17 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 18 | 18 | $error = array(); |
| 19 | 19 | $request = (object) [ |
| 20 | 20 | "status" => "success" |
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | - if(!isset($_SESSION['siteusername'])){ $error['message'] = "you are not logged in"; $error['status'] = true; } |
|
| 24 | - if(!$_POST['comment']){ $error['message'] = "your comment cannot be blank"; $error['status'] = true; } |
|
| 25 | - if(strlen($_POST['comment']) > 1000){ $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; } |
|
| 26 | - 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; } |
|
| 23 | + if (!isset($_SESSION['siteusername'])) { $error['message'] = "you are not logged in"; $error['status'] = true; } |
|
| 24 | + if (!$_POST['comment']) { $error['message'] = "your comment cannot be blank"; $error['status'] = true; } |
|
| 25 | + if (strlen($_POST['comment']) > 1000) { $error['message'] = "your comment must be shorter than 1000 characters"; $error['status'] = true; } |
|
| 26 | + 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; } |
|
| 27 | 27 | |
| 28 | - if(!isset($error['message'])) { |
|
| 28 | + if (!isset($error['message'])) { |
|
| 29 | 29 | $text = $_POST['comment']; |
| 30 | 30 | $stmt = $__db->prepare("INSERT INTO comments (toid, author, comment) VALUES (:v, :username, :comment)"); |
| 31 | 31 | $stmt->bindParam(":v", $_GET['v']); |