@@ -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 | } |
@@ -58,10 +58,14 @@ |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | if(!isset($cLang)) { |
61 | - if (!$full) $string = array_slice($string, 0, 1); |
|
61 | + if (!$full) { |
|
62 | + $string = array_slice($string, 0, 1); |
|
63 | + } |
|
62 | 64 | return $string ? implode(', ', $string) . ' ago' : 'just now'; |
63 | 65 | } else { |
64 | - if (!$full) $string = array_slice($string, 0, 1); |
|
66 | + if (!$full) { |
|
67 | + $string = array_slice($string, 0, 1); |
|
68 | + } |
|
65 | 69 | return $string ? implode($cLang['agoLeft'], $string) . " " . " " . $cLang['agoRight'] : $cLang['justNow']; |
66 | 70 | } |
67 | 71 | } |
@@ -10,9 +10,9 @@ |
||
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 | 18 | $stmt = $this->__db->prepare("UPDATE videos SET ".$rowName." = :new WHERE rid = :rid"); |
@@ -10,12 +10,12 @@ |
||
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,9 +24,9 @@ |
||
24 | 24 | shell_exec($fullcmd); |
25 | 25 | } |
26 | 26 | |
27 | - public function __construct($conn){ |
|
27 | + public function __construct($conn){ |
|
28 | 28 | $this->__db = $conn; |
29 | - } |
|
29 | + } |
|
30 | 30 | |
31 | 31 | function fetch_video_views(string $id) { |
32 | 32 | $stmt = $this->__db->prepare("SELECT * FROM views WHERE videoid = :id"); |
@@ -12,19 +12,19 @@ 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 | } |
26 | 26 | |
27 | - public function __construct($conn){ |
|
27 | + public function __construct($conn) { |
|
28 | 28 | $this->__db = $conn; |
29 | 29 | } |
30 | 30 | |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | |
47 | 47 | function shorten_description(string $description, int $limit, bool $newlines = false) { |
48 | 48 | $description = trim($description); |
49 | - if(strlen($description) >= $limit) { |
|
49 | + if (strlen($description) >= $limit) { |
|
50 | 50 | $description = substr($description, 0, $limit) . "..."; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $description = htmlspecialchars($description); |
54 | - if($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); } |
|
54 | + if ($newlines) { $description = str_replace(PHP_EOL, "<br>", $description); } |
|
55 | 55 | return $description; |
56 | 56 | } |
57 | 57 |
@@ -12,14 +12,22 @@ |
||
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 | } |
@@ -10,13 +10,13 @@ |
||
10 | 10 | * |
11 | 11 | **/ |
12 | 12 | class db_helper { |
13 | - public function __construct(){ |
|
13 | + public function __construct(){ |
|
14 | 14 | |
15 | - } |
|
15 | + } |
|
16 | 16 | |
17 | - function fetch(string $table, array $where, string $extra) { |
|
17 | + function fetch(string $table, array $where, string $extra) { |
|
18 | 18 | |
19 | - } |
|
19 | + } |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | ?> |
23 | 23 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * |
11 | 11 | **/ |
12 | 12 | class db_helper { |
13 | - public function __construct(){ |
|
13 | + public function __construct() { |
|
14 | 14 | |
15 | 15 | } |
16 | 16 |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | <!--<button class="yt-uix-button yt-uix-button-default" id="av-uplod">Select File</button>--> |
185 | 185 | </div><br><br> |
186 | 186 | <img src="/dynamic/pfp/<?php echo $_user['pfp']; ?>" style="width:100px;height:100px;"><br> |
187 | - <?php if($_user['pfp'] != "default.png") { ?> |
|
187 | + <?php if ($_user['pfp'] != "default.png") { ?> |
|
188 | 188 | <a href="/get/remove_profile_pic">Remove Profile Picture</a><br> |
189 | 189 | <?php } ?> |
190 | 190 | <br><hr class="thin-line-darker" style="width:unset;"> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | <input style="width: 169px;position: relative;top: 10px;" type="file" name="videopagebanner" id="avatar-upload"> |
194 | 194 | <!--<button class="yt-uix-button yt-uix-button-default" id="av-uplod">Select File</button>--> |
195 | 195 | </div><br> |
196 | - <?php if(!empty($_user['subbutton'])) { ?> |
|
196 | + <?php if (!empty($_user['subbutton'])) { ?> |
|
197 | 197 | <a href="/get/remove_watch_banner">Remove Watch Page Banner</a><br> |
198 | 198 | <?php } ?><br><hr class="thin-line-darker" style="width:unset;"> |
199 | 199 | |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | |
214 | 214 | <b>Featured Vid</b> |
215 | 215 | <div class="customization-module" id="featuredvid" action="/d/channel_update" enctype="multipart/form-data" style="display: inline-block;float:right;position: relative;bottom: 6px;"> |
216 | - <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"> |
|
216 | + <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"> |
|
217 | 217 | </div><br><br><hr class="thin-line-darker" style="width:unset;"> |
218 | 218 | |
219 | 219 | <b>Website</b> |
220 | 220 | <div class="customization-module" id="featuredvid" action="/d/channel_update" enctype="multipart/form-data" style="float: right;position: relative;top: -7px;"> |
221 | - <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"> |
|
221 | + <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"> |
|
222 | 222 | |
223 | 223 | </div><br><br><hr class="thin-line-darker" style="width:unset;"> |
224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | <span style="font-size: 11px;" class="grey-text">This will show what type of channel you are to other users.</span> |
228 | 228 | <div class="customization-module" id="channellayout" action="/d/channel_update" enctype="multipart/form-data" style="float: right;position: relative;top: -19px;"> |
229 | 229 | <select class="yt-uix-button yt-uix-button-default" style="position:relative;top:6px;" name="genre"> |
230 | - <?php foreach($categories as $category) { ?> |
|
230 | + <?php foreach ($categories as $category) { ?> |
|
231 | 231 | <option value="<?php echo $category; ?>"><?php echo $category; ?></option> |
232 | 232 | <?php } ?> |
233 | 233 | </select> |
@@ -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($_SERVER['REQUEST_URI'] != $_tab->url) |
|
42 | + <?php foreach ($__tabs as $_tab) { |
|
43 | + if ($_SERVER['REQUEST_URI'] != $_tab->url) |
|
44 | 44 | $_tab->selected = true; |
45 | 45 | ?> |
46 | 46 | <li class="menu-item"> |
@@ -40,8 +40,9 @@ |
||
40 | 40 | <div id="browse-side-column" class="ytg-2col ytg-last"> |
41 | 41 | <ol class="navigation-menu"> |
42 | 42 | <?php foreach($__tabs as $_tab) { |
43 | - if($_SERVER['REQUEST_URI'] != $_tab->url) |
|
44 | - $_tab->selected = true; |
|
43 | + if($_SERVER['REQUEST_URI'] != $_tab->url) { |
|
44 | + $_tab->selected = true; |
|
45 | + } |
|
45 | 46 | ?> |
46 | 47 | <li class="menu-item"> |
47 | 48 | <a class="<?php echo $_tab->selected ? true : "selected"; ?>" href="<?php echo $_tab->url; ?>"> |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | <a id="logo-container" href="/" title="YouTube home"> |
6 | 6 | <img id="logo" src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="YouTube home"> |
7 | 7 | </a> |
8 | - <?php if(!isset($_SESSION['siteusername'])) { ?> |
|
8 | + <?php if (!isset($_SESSION['siteusername'])) { ?> |
|
9 | 9 | <div id="yt-masthead-signin"> |
10 | 10 | <a style="color: white; text-decoration: none;" href="/sign_in"> |
11 | 11 | <button type="button" class=" yt-uix-button yt-uix-button-primary yt-uix-button-size-default" href="/sign_up" role="button"> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | <span id="yt-masthead-user-displayname" dir="ltr" class="yt-valign-container" onclick="yt.www.masthead.toggleExpandedMasthead();"> |
21 | 21 | <?php echo htmlspecialchars($_SESSION['siteusername']); ?> |
22 | 22 | </span> |
23 | - <?php if($__user_h->fetch_unread_pms($_SESSION['siteusername']) != 0) { ?> |
|
23 | + <?php if ($__user_h->fetch_unread_pms($_SESSION['siteusername']) != 0) { ?> |
|
24 | 24 | <a style="position:relative;top:1px;color: white;text-decoration: none;background-color: #d54343;padding: 7px;padding-left: 10px;margin-right: 12px;display: inline;" href="/inbox/"> |
25 | 25 | <?php echo $__user_h->fetch_unread_pms($_SESSION['siteusername']); ?> |
26 | 26 | </a> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | </div> |
58 | 58 | </div> |
59 | 59 | </div> |
60 | -<?php if(isset($_SESSION['siteusername'])) { ?> |
|
60 | +<?php if (isset($_SESSION['siteusername'])) { ?> |
|
61 | 61 | <div id="masthead-expanded" class="hid" style="display: none;"> |
62 | 62 | <div id="masthead-expanded-container" class="with-sandbar"> |
63 | 63 | <div id="masthead-expanded-menus-container"> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | <?php } ?> |
180 | 180 | </div> |
181 | 181 | <div id="alerts"> |
182 | - <?php if(isset($error['status'])) { ?> |
|
182 | + <?php if (isset($error['status'])) { ?> |
|
183 | 183 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error yt-alert-player"> <div class="yt-alert-icon"> |
184 | 184 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
185 | 185 | </div> |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | </div> |
190 | 190 | </div></div></div> |
191 | 191 | <?php } ?> |
192 | - <?php if(isset($_GET['error'])) { ?> |
|
192 | + <?php if (isset($_GET['error'])) { ?> |
|
193 | 193 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error "> <div class="yt-alert-icon"> |
194 | 194 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
195 | 195 | </div> |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | </div> |
200 | 200 | </div></div></div> |
201 | 201 | <?php } ?> |
202 | - <?php if(isset($_SESSION['error'])) { ?> |
|
202 | + <?php if (isset($_SESSION['error'])) { ?> |
|
203 | 203 | <div id="masthead_child_div"><div class="yt-alert yt-alert-default yt-alert-error"> <div class="yt-alert-icon"> |
204 | 204 | <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" class="icon master-sprite" alt="Alert icon"> |
205 | 205 | </div> |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $video = $_video_fetch_utils->fetch_video_rid($video_response['toid']); |
19 | 19 | ?> |
20 | 20 | <?php |
21 | -if($video['author'] == $_SESSION['siteusername']) { |
|
21 | +if ($video['author'] == $_SESSION['siteusername']) { |
|
22 | 22 | $stmt = $conn->prepare("DELETE FROM video_response WHERE id = ?"); |
23 | 23 | $stmt->bind_param("s", $_GET['id']); |
24 | 24 | $stmt->execute(); |
@@ -20,13 +20,13 @@ |
||
20 | 20 | $name = $friend['reciever']; |
21 | 21 | $sender = $friend['sender']; |
22 | 22 | |
23 | -if($name != $_SESSION['siteusername']) { |
|
23 | +if ($name != $_SESSION['siteusername']) { |
|
24 | 24 | $doesnotown = true; |
25 | -} else if($sender != $_SESSION['siteusername']) { |
|
25 | +} else if ($sender != $_SESSION['siteusername']) { |
|
26 | 26 | $doesnotown2 = true; |
27 | 27 | } |
28 | 28 | |
29 | -if(!isset($_GET['id'])) { |
|
29 | +if (!isset($_GET['id'])) { |
|
30 | 30 | die("ID is not set"); |
31 | 31 | } |
32 | 32 |