@@ -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 | } |
@@ -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(); |
@@ -26,8 +26,9 @@ |
||
26 | 26 | if(!isset($error['message'])) { |
27 | 27 | $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'; |
28 | 28 | $result = ''; |
29 | - for ($i = 0; $i < 11; $i++) |
|
30 | - $rid .= $characters[mt_rand(0, 63)]; |
|
29 | + for ($i = 0; $i < 11; $i++) { |
|
30 | + $rid .= $characters[mt_rand(0, 63)]; |
|
31 | + } |
|
31 | 32 | $stmt = $__db->prepare("INSERT INTO playlists (title, description, rid, author) VALUES (:title, :desc, :rid, :username)"); |
32 | 33 | $stmt->bindParam(":title", $_POST['title']); |
33 | 34 | $stmt->bindParam(":desc", $_POST['comment']); |
@@ -50,10 +50,11 @@ |
||
50 | 50 | $count = 0; |
51 | 51 | $url_encoded_fmt_stream_map; |
52 | 52 | foreach($fmt_stream_map as $stream) { |
53 | - if($count == 0) |
|
54 | - $url_encoded_fmt_stream_map = http_build_query($stream); |
|
55 | - else |
|
56 | - $url_encoded_fmt_stream_map = $url_encoded_fmt_stream_map . "," . http_build_query($stream); |
|
53 | + if($count == 0) { |
|
54 | + $url_encoded_fmt_stream_map = http_build_query($stream); |
|
55 | + } else { |
|
56 | + $url_encoded_fmt_stream_map = $url_encoded_fmt_stream_map . "," . http_build_query($stream); |
|
57 | + } |
|
57 | 58 | $count++; |
58 | 59 | } |
59 | 60 |
@@ -13,11 +13,13 @@ 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 | - header("Location: /?userdoesntexist"); |
|
20 | + if(!$__user_h->user_exists($_GET['n'])) { |
|
21 | + header("Location: /?userdoesntexist"); |
|
22 | + } |
|
21 | 23 | |
22 | 24 | $_user = $__user_h->fetch_user_username($_GET['n']); |
23 | 25 | |
@@ -40,10 +42,11 @@ discard block |
||
40 | 42 | |
41 | 43 | if ( |
42 | 44 | ctype_xdigit($colorCode) && |
43 | - (strlen($colorCode) == 6 || strlen($colorCode) == 3)) |
|
44 | - return true; |
|
45 | - |
|
46 | - else return false; |
|
45 | + (strlen($colorCode) == 6 || strlen($colorCode) == 3)) { |
|
46 | + return true; |
|
47 | + } else { |
|
48 | + return false; |
|
49 | + } |
|
47 | 50 | } |
48 | 51 | |
49 | 52 | $_user['subscribed'] = $__user_h->if_subscribed(@$_SESSION['siteusername'], $_user['username']); |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
77 | 80 | if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
78 | 81 | |
79 | - if(isset($_SESSION['siteusername'])) |
|
80 | - $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
82 | + if(isset($_SESSION['siteusername'])) { |
|
83 | + $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
84 | + } |
|
81 | 85 | |
82 | 86 | if($_SERVER['REQUEST_METHOD'] == 'POST') { |
83 | 87 | $error = array(); |
@@ -146,8 +150,9 @@ discard block |
||
146 | 150 | <div class="channel_customization"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/channel_customization.php"); ?></div> |
147 | 151 | <?php } ?> |
148 | 152 | <?php |
149 | - if(empty(trim($_user['bio']))) |
|
150 | - $_user['bio'] = "This user has no description."; |
|
153 | + if(empty(trim($_user['bio']))) { |
|
154 | + $_user['bio'] = "This user has no description."; |
|
155 | + } |
|
151 | 156 | ?> |
152 | 157 | <div id="content"> |
153 | 158 | <div class="subscription-menu-expandable subscription-menu-expandable-channels3 yt-rounded ytg-wide hid"> |
@@ -14,8 +14,9 @@ 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'])) |
|
18 | - header("Location: /?userdoesntexist"); |
|
17 | + if(!$__user_h->user_exists($_playlist['author'])) { |
|
18 | + header("Location: /?userdoesntexist"); |
|
19 | + } |
|
19 | 20 | |
20 | 21 | $_user = $__user_h->fetch_user_username($_playlist['author']); |
21 | 22 | |
@@ -38,10 +39,11 @@ discard block |
||
38 | 39 | |
39 | 40 | if ( |
40 | 41 | ctype_xdigit($colorCode) && |
41 | - (strlen($colorCode) == 6 || strlen($colorCode) == 3)) |
|
42 | - return true; |
|
43 | - |
|
44 | - else return false; |
|
42 | + (strlen($colorCode) == 6 || strlen($colorCode) == 3)) { |
|
43 | + return true; |
|
44 | + } else { |
|
45 | + return false; |
|
46 | + } |
|
45 | 47 | } |
46 | 48 | |
47 | 49 | $_user['subscribers'] = $__user_h->fetch_subs_count($_user['username']); |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | if(!check_valid_colorhex($_user['primary_color_text']) && strlen($_user['primary_color_text']) != 6) { $_user['primary_color_text'] = ""; } |
74 | 76 | if(!check_valid_colorhex($_user['2009_bgcolor']) && strlen($_user['2009_bgcolor']) != 6) { $_user['2009_bgcolor'] = ""; } |
75 | 77 | |
76 | - if(isset($_SESSION['siteusername'])) |
|
77 | - $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
78 | + if(isset($_SESSION['siteusername'])) { |
|
79 | + $__user_i->check_view_channel($_user['username'], @$_SESSION['siteusername']); |
|
80 | + } |
|
78 | 81 | |
79 | 82 | if($_SERVER['REQUEST_METHOD'] == 'POST') { |
80 | 83 | $error = array(); |
@@ -145,8 +148,9 @@ discard block |
||
145 | 148 | <div class="channel_customization"><?php require($_SERVER['DOCUMENT_ROOT'] . "/s/mod/channel_customization.php"); ?></div> |
146 | 149 | <?php } ?> |
147 | 150 | <?php |
148 | - if(empty(trim($_user['bio']))) |
|
149 | - $_user['bio'] = "This user has no description."; |
|
151 | + if(empty(trim($_user['bio']))) { |
|
152 | + $_user['bio'] = "This user has no description."; |
|
153 | + } |
|
150 | 154 | ?> |
151 | 155 | <div id="content"> |
152 | 156 | <div class="subscription-menu-expandable subscription-menu-expandable-channels3 yt-rounded ytg-wide hid"> |
@@ -38,8 +38,7 @@ |
||
38 | 38 | ] |
39 | 39 | ); |
40 | 40 | $__server->db_properties->db_connected = true; |
41 | - } |
|
42 | - catch(PDOException $e) |
|
41 | + } catch(PDOException $e) |
|
43 | 42 | { |
44 | 43 | die("An error occured connecting to the database: ".$e->getMessage()); |
45 | 44 | } |
@@ -313,14 +313,15 @@ |
||
313 | 313 | for($i = 0;$i <= $countryLength; $i++) |
314 | 314 | { |
315 | 315 | $c = $countries[$i]; |
316 | - if ($c == $_user['country']) |
|
317 | - //country is the same as in database |
|
316 | + if ($c == $_user['country']) { |
|
317 | + //country is the same as in database |
|
318 | 318 | { |
319 | 319 | ?> |
320 | - <option value="<?php echo $c; ?>" selected="selected"><?php echo $c; ?></option> |
|
321 | - <?php |
|
320 | + <option value="<?php echo $c; |
|
322 | 321 | } |
323 | - else |
|
322 | + ?>" selected="selected"><?php echo $c; ?></option> |
|
323 | + <?php |
|
324 | + } else |
|
324 | 325 | { |
325 | 326 | ?> |
326 | 327 | <option value="<?php echo $c;?>"><?php echo $c; ?></option> |
@@ -253,8 +253,9 @@ |
||
253 | 253 | </div> |
254 | 254 | </li> |
255 | 255 | <?php } ?> |
256 | - <?php if($request->search_amount == 0) |
|
256 | + <?php if($request->search_amount == 0) { |
|
257 | 257 | echo "Your search query has brought no results.<br><br>"; |
258 | +} |
|
258 | 259 | ?> |
259 | 260 | </ol> |
260 | 261 | </div> |