@@ -138,17 +138,17 @@ discard block |
||
| 138 | 138 | </div> |
| 139 | 139 | <div class="browse-item-row ytg-box"> |
| 140 | 140 | <?php |
| 141 | - $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 142 | - $stmt->execute(); |
|
| 143 | - $result = $stmt->get_result(); |
|
| 144 | - while($video = $result->fetch_assoc()) { |
|
| 145 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 146 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 147 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 148 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 149 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 150 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 151 | - ?> |
|
| 141 | + $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 142 | + $stmt->execute(); |
|
| 143 | + $result = $stmt->get_result(); |
|
| 144 | + while($video = $result->fetch_assoc()) { |
|
| 145 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 146 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 147 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 148 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 149 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 150 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 151 | + ?> |
|
| 152 | 152 | <div class="browse-item yt-tile-default "> |
| 153 | 153 | <a href="/watch?v=<?php echo $video['rid']; ?>" class="ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto " data-sessionlink="ei=CPjwu5ji3bICFS4RIQod9j-M-A%3D%3D&feature=b-mv"><span class="video-thumb ux-thumb yt-thumb-default-194 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Thumbnail" data-thumb="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" width="194"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span> |
| 154 | 154 | <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="rLHU-_OhT8g" role="button"><span class="yt-uix-button-content"> <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later"> |
@@ -174,17 +174,17 @@ discard block |
||
| 174 | 174 | </div> |
| 175 | 175 | <div class="browse-item-row ytg-box"> |
| 176 | 176 | <?php |
| 177 | - $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 178 | - $stmt->execute(); |
|
| 179 | - $result = $stmt->get_result(); |
|
| 180 | - while($video = $result->fetch_assoc()) { |
|
| 181 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 182 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 183 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 184 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 185 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 186 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 187 | - ?> |
|
| 177 | + $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 178 | + $stmt->execute(); |
|
| 179 | + $result = $stmt->get_result(); |
|
| 180 | + while($video = $result->fetch_assoc()) { |
|
| 181 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 182 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 183 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 184 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 185 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 186 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 187 | + ?> |
|
| 188 | 188 | <div class="browse-item yt-tile-default "> |
| 189 | 189 | <a href="/watch?v=<?php echo $video['rid']; ?>" class="ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto " data-sessionlink="ei=CPjwu5ji3bICFS4RIQod9j-M-A%3D%3D&feature=b-mv"><span class="video-thumb ux-thumb yt-thumb-default-194 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Thumbnail" data-thumb="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" width="194"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span> |
| 190 | 190 | <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="rLHU-_OhT8g" role="button"><span class="yt-uix-button-content"> <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later"> |
@@ -210,17 +210,17 @@ discard block |
||
| 210 | 210 | </div> |
| 211 | 211 | <div class="browse-item-row ytg-box"> |
| 212 | 212 | <?php |
| 213 | - $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 214 | - $stmt->execute(); |
|
| 215 | - $result = $stmt->get_result(); |
|
| 216 | - while($video = $result->fetch_assoc()) { |
|
| 217 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 218 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 219 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 220 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 221 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 222 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 223 | - ?> |
|
| 213 | + $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 214 | + $stmt->execute(); |
|
| 215 | + $result = $stmt->get_result(); |
|
| 216 | + while($video = $result->fetch_assoc()) { |
|
| 217 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 218 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 219 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 220 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 221 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 222 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 223 | + ?> |
|
| 224 | 224 | <div class="browse-item yt-tile-default "> |
| 225 | 225 | <a href="/watch?v=<?php echo $video['rid']; ?>" class="ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto " data-sessionlink="ei=CPjwu5ji3bICFS4RIQod9j-M-A%3D%3D&feature=b-mv"><span class="video-thumb ux-thumb yt-thumb-default-194 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Thumbnail" data-thumb="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" width="194"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span> |
| 226 | 226 | <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="rLHU-_OhT8g" role="button"><span class="yt-uix-button-content"> <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later"> |
@@ -246,17 +246,17 @@ discard block |
||
| 246 | 246 | </div> |
| 247 | 247 | <div class="browse-item-row ytg-box"> |
| 248 | 248 | <?php |
| 249 | - $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 250 | - $stmt->execute(); |
|
| 251 | - $result = $stmt->get_result(); |
|
| 252 | - while($video = $result->fetch_assoc()) { |
|
| 253 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 254 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 255 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 256 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 257 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 258 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 259 | - ?> |
|
| 249 | + $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 250 | + $stmt->execute(); |
|
| 251 | + $result = $stmt->get_result(); |
|
| 252 | + while($video = $result->fetch_assoc()) { |
|
| 253 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 254 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 255 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 256 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 257 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 258 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 259 | + ?> |
|
| 260 | 260 | <div class="browse-item yt-tile-default "> |
| 261 | 261 | <a href="/watch?v=<?php echo $video['rid']; ?>" class="ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto " data-sessionlink="ei=CPjwu5ji3bICFS4RIQod9j-M-A%3D%3D&feature=b-mv"><span class="video-thumb ux-thumb yt-thumb-default-194 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Thumbnail" data-thumb="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" width="194"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span> |
| 262 | 262 | <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="rLHU-_OhT8g" role="button"><span class="yt-uix-button-content"> <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later"> |
@@ -282,17 +282,17 @@ discard block |
||
| 282 | 282 | </div> |
| 283 | 283 | <div class="browse-item-row ytg-box"> |
| 284 | 284 | <?php |
| 285 | - $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 286 | - $stmt->execute(); |
|
| 287 | - $result = $stmt->get_result(); |
|
| 288 | - while($video = $result->fetch_assoc()) { |
|
| 289 | - $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 290 | - $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 291 | - $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 292 | - $video['author'] = htmlspecialchars($video['author']); |
|
| 293 | - $video['title'] = htmlspecialchars($video['title']); |
|
| 294 | - $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 295 | - ?> |
|
| 285 | + $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
|
| 286 | + $stmt->execute(); |
|
| 287 | + $result = $stmt->get_result(); |
|
| 288 | + while($video = $result->fetch_assoc()) { |
|
| 289 | + $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
|
| 290 | + $video['duration'] = $__time_h->timestamp($video['duration']); |
|
| 291 | + $video['views'] = $__video_h->fetch_video_views($video['rid']); |
|
| 292 | + $video['author'] = htmlspecialchars($video['author']); |
|
| 293 | + $video['title'] = htmlspecialchars($video['title']); |
|
| 294 | + $video['description'] = $__video_h->shorten_description($video['description'], 50); |
|
| 295 | + ?> |
|
| 296 | 296 | <div class="browse-item yt-tile-default "> |
| 297 | 297 | <a href="/watch?v=<?php echo $video['rid']; ?>" class="ux-thumb-wrap yt-uix-sessionlink yt-uix-contextlink contains-addto " data-sessionlink="ei=CPjwu5ji3bICFS4RIQod9j-M-A%3D%3D&feature=b-mv"><span class="video-thumb ux-thumb yt-thumb-default-194 "><span class="yt-thumb-clip"><span class="yt-thumb-clip-inner"><img src="http://s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Thumbnail" data-thumb="/dynamic/thumbs/<?php echo $video['thumbnail']; ?>" width="194"><span class="vertical-align"></span></span></span></span><span class="video-time"><?php echo $video['duration']; ?></span> |
| 298 | 298 | <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="rLHU-_OhT8g" role="button"><span class="yt-uix-button-content"> <img src="//s.ytimg.com/yt/img/pixel-vfl3z5WfW.gif" alt="Watch Later"> |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
| 142 | 142 | $stmt->execute(); |
| 143 | 143 | $result = $stmt->get_result(); |
| 144 | - while($video = $result->fetch_assoc()) { |
|
| 144 | + while ($video = $result->fetch_assoc()) { |
|
| 145 | 145 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 146 | 146 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 147 | 147 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
| 178 | 178 | $stmt->execute(); |
| 179 | 179 | $result = $stmt->get_result(); |
| 180 | - while($video = $result->fetch_assoc()) { |
|
| 180 | + while ($video = $result->fetch_assoc()) { |
|
| 181 | 181 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 182 | 182 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 183 | 183 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
| 214 | 214 | $stmt->execute(); |
| 215 | 215 | $result = $stmt->get_result(); |
| 216 | - while($video = $result->fetch_assoc()) { |
|
| 216 | + while ($video = $result->fetch_assoc()) { |
|
| 217 | 217 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 218 | 218 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 219 | 219 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
| 250 | 250 | $stmt->execute(); |
| 251 | 251 | $result = $stmt->get_result(); |
| 252 | - while($video = $result->fetch_assoc()) { |
|
| 252 | + while ($video = $result->fetch_assoc()) { |
|
| 253 | 253 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 254 | 254 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 255 | 255 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $stmt = $__db->prepare("SELECT * FROM videos WHERE category = 'Nonprofits & Activism' ORDER BY rand() LIMIT 4"); |
| 286 | 286 | $stmt->execute(); |
| 287 | 287 | $result = $stmt->get_result(); |
| 288 | - while($video = $result->fetch_assoc()) { |
|
| 288 | + while ($video = $result->fetch_assoc()) { |
|
| 289 | 289 | $video['age'] = $__time_h->time_elapsed_string($video['publish']); |
| 290 | 290 | $video['duration'] = $__time_h->timestamp($video['duration']); |
| 291 | 291 | $video['views'] = $__video_h->fetch_video_views($video['rid']); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | <?php $__db_h = new db_helper(); ?> |
| 10 | 10 | <?php $__time_h = new time_helper(); ?> |
| 11 | 11 | <?php |
| 12 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 12 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 13 | 13 | $request = (object) [ |
| 14 | 14 | "username" => $_POST['username'], |
| 15 | 15 | "password" => $_POST['password'], |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | $stmt->execute(); |
| 30 | 30 | $result = $stmt->get_result(); |
| 31 | 31 | |
| 32 | - if(!mysqli_num_rows($result)){ |
|
| 32 | + if (!mysqli_num_rows($result)) { |
|
| 33 | 33 | { $request->error->message = "Incorrect username or password!"; $request->error->status = ""; } } |
| 34 | 34 | |
| 35 | 35 | $row = $result->fetch_assoc(); |
| 36 | - if(!isset($row['password'])) |
|
| 36 | + if (!isset($row['password'])) |
|
| 37 | 37 | { $request->error->message = "Incorrect username or password!"; $request->error->status = ""; } |
| 38 | 38 | else |
| 39 | 39 | { $request->returned_password = $row['password']; } |
| 40 | 40 | |
| 41 | - if(!password_verify($request->password, $request->returned_password)) |
|
| 41 | + if (!password_verify($request->password, $request->returned_password)) |
|
| 42 | 42 | { $request->error->message = "Incorrect username or password!"; $request->error->status = ""; } |
| 43 | 43 | |
| 44 | - if($request->error->status == "OK") { |
|
| 44 | + if ($request->error->status == "OK") { |
|
| 45 | 45 | $_SESSION['siteusername'] = $request->username; |
| 46 | 46 | header("Location: /"); |
| 47 | 47 | } |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | $row = $result->fetch_assoc(); |
| 36 | 36 | if(!isset($row['password'])) |
| 37 | - { $request->error->message = "Incorrect username or password!"; $request->error->status = ""; } |
|
| 38 | - else |
|
| 37 | + { $request->error->message = "Incorrect username or password!"; $request->error->status = ""; } else |
|
| 39 | 38 | { $request->returned_password = $row['password']; } |
| 40 | 39 | |
| 41 | 40 | if(!password_verify($request->password, $request->returned_password)) |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | $_user_update_utils->initialize_db_var($conn); |
| 20 | 20 | |
| 21 | 21 | |
| 22 | - $_base_utils->initialize_page_compass("post/upload"); |
|
| 22 | + $_base_utils->initialize_page_compass("post/upload"); |
|
| 23 | 23 | ?> |
| 24 | 24 | <?php |
| 25 | 25 | $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | 'target_upload_name' => md5_file($_FILES["fileToUpload"]["tmp_name"]) . "." . strtolower(pathinfo($_FILES["fileToUpload"]["name"], PATHINFO_EXTENSION)) // use video_file_type plzs |
| 48 | 48 | ]; |
| 49 | 49 | |
| 50 | - if(move_uploaded_file( |
|
| 50 | + if (move_uploaded_file( |
|
| 51 | 51 | $_FILES['fileToUpload']['tmp_name'], |
| 52 | 52 | "dynamic/temp/" . $video_properties->video_rid . $video_validation->video_file_type |
| 53 | 53 | )) { |
@@ -23,8 +23,9 @@ |
||
| 23 | 23 | ?> |
| 24 | 24 | <?php |
| 25 | 25 | $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'; |
| 26 | - for ($i = 0; $i < 11; $i++) |
|
| 27 | - $rid .= $characters[mt_rand(0, 63)]; |
|
| 26 | + for ($i = 0; $i < 11; $i++) { |
|
| 27 | + $rid .= $characters[mt_rand(0, 63)]; |
|
| 28 | + } |
|
| 28 | 29 | |
| 29 | 30 | $video_properties = (object) [ |
| 30 | 31 | 'video_rid' => $rid, |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | <?php $__db_h = new db_helper(); ?> |
| 10 | 10 | <?php $__time_h = new time_helper(); ?> |
| 11 | 11 | <?php |
| 12 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 12 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 13 | 13 | $request = (object) [ |
| 14 | 14 | "username" => $_POST['username'], |
| 15 | 15 | "password" => $_POST['password'], |
@@ -23,28 +23,28 @@ discard block |
||
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | 25 | if (!filter_var($request->email, FILTER_VALIDATE_EMAIL)) |
| 26 | - { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 27 | - if(strlen($request->username) > 21) |
|
| 26 | + { $request->error->message = "Your email is invalid!"; $request->error->status = ""; } |
|
| 27 | + if (strlen($request->username) > 21) |
|
| 28 | 28 | { $request->error->message = "Your username must be shorter than 21 characters."; $request->error->status = ""; } |
| 29 | - if(strlen($request->password) < 8) |
|
| 29 | + if (strlen($request->password) < 8) |
|
| 30 | 30 | { $request->error->message = "Your password must at least be 8 characters long."; $request->error->status = ""; } |
| 31 | - if(!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 31 | + if (!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $request->password)) |
|
| 32 | 32 | { $request->error->message = "Include numbers and letters in your password!"; $request->error->status = ""; } |
| 33 | - if(!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 33 | + if (!preg_match('/^\S+\w\S{1,}/', $request->username)) |
|
| 34 | 34 | { $request->error->message = "Your username cannot contain any special characters!"; $request->error->status = ""; } |
| 35 | - if(empty(trim($request->username))) |
|
| 35 | + if (empty(trim($request->username))) |
|
| 36 | 36 | { $request->error->message = "Your username cannot be empty!"; $request->error->status = ""; } |
| 37 | 37 | |
| 38 | 38 | $stmt = $__db->prepare("SELECT username FROM users WHERE username = ?"); |
| 39 | 39 | $stmt->bind_param("s", $username); |
| 40 | 40 | $stmt->execute(); |
| 41 | 41 | $result = $stmt->get_result(); |
| 42 | - if($result->num_rows) |
|
| 42 | + if ($result->num_rows) |
|
| 43 | 43 | { $request->error->message = "There's already a user with that same username!"; $request->error->status = ""; } |
| 44 | 44 | |
| 45 | 45 | echo json_encode($request->error); |
| 46 | 46 | |
| 47 | - if($request->error->status == "OK") { |
|
| 47 | + if ($request->error->status == "OK") { |
|
| 48 | 48 | $stmt = $__db->prepare("INSERT INTO users (username, email, password) VALUES (?, ?, ?)"); |
| 49 | 49 | $stmt->bind_param("sss", $request->username, $request->email, $request->password_hash); |
| 50 | 50 | $stmt->execute(); |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | $stmt->execute(); |
| 35 | 35 | $stmt->close(); |
| 36 | 36 | |
| 37 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['pfpset']) { |
|
| 38 | - if(!empty($_FILES["pfpset"]["name"])) { |
|
| 37 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['pfpset']) { |
|
| 38 | + if (!empty($_FILES["pfpset"]["name"])) { |
|
| 39 | 39 | $target_dir = "../pfp/"; |
| 40 | 40 | $imageFileType = strtolower(pathinfo($_FILES["pfpset"]["name"], PATHINFO_EXTENSION)); |
| 41 | 41 | $target_name = md5_file($_FILES["pfpset"]["tmp_name"]) . "." . $imageFileType; |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | $uploadOk = true; |
| 46 | 46 | $movedFile = false; |
| 47 | 47 | |
| 48 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 49 | - && $imageFileType != "gif" ) { |
|
| 48 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 49 | + && $imageFileType != "gif") { |
|
| 50 | 50 | $fileerror = 'unsupported file type. must be jpg, png, jpeg, or gif'; |
| 51 | 51 | $uploadOk = false; |
| 52 | 52 | goto skip; |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - } else if($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['backgroundbgset']) { |
|
| 73 | - if(!empty($_FILES["backgroundbgset"]["name"])) { |
|
| 72 | + } else if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['backgroundbgset']) { |
|
| 73 | + if (!empty($_FILES["backgroundbgset"]["name"])) { |
|
| 74 | 74 | $target_dir = "../banners/"; |
| 75 | 75 | $imageFileType = strtolower(pathinfo($_FILES["backgroundbgset"]["name"], PATHINFO_EXTENSION)); |
| 76 | 76 | $target_name = md5_file($_FILES["backgroundbgset"]["tmp_name"]) . "." . $imageFileType; |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | $uploadOk = true; |
| 81 | 81 | $movedFile = false; |
| 82 | 82 | |
| 83 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 84 | - && $imageFileType != "gif" ) { |
|
| 83 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 84 | + && $imageFileType != "gif") { |
|
| 85 | 85 | $fileerror = 'unsupported file type. must be jpg, png, jpeg, or gif'; |
| 86 | 86 | $uploadOk = false; |
| 87 | 87 | goto skip; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if($uploadOk) { |
|
| 90 | + if ($uploadOk) { |
|
| 91 | 91 | if (file_exists($target_file)) { |
| 92 | 92 | $movedFile = true; |
| 93 | 93 | } else { |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | - } else if($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['bannerset']) { |
|
| 110 | - if(!empty($_FILES["file"]["name"])) { |
|
| 109 | + } else if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['bannerset']) { |
|
| 110 | + if (!empty($_FILES["file"]["name"])) { |
|
| 111 | 111 | $target_dir = "../banners/"; |
| 112 | 112 | $imageFileType = strtolower(pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION)); |
| 113 | 113 | $target_name = md5_file($_FILES["file"]["tmp_name"]) . "." . $imageFileType; |
@@ -117,14 +117,14 @@ discard block |
||
| 117 | 117 | $uploadOk = true; |
| 118 | 118 | $movedFile = false; |
| 119 | 119 | |
| 120 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 121 | - && $imageFileType != "gif" ) { |
|
| 120 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 121 | + && $imageFileType != "gif") { |
|
| 122 | 122 | $fileerror = 'unsupported file type. must be jpg, png, jpeg, or gif'; |
| 123 | 123 | $uploadOk = false; |
| 124 | 124 | goto skip; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if($uploadOk) { |
|
| 127 | + if ($uploadOk) { |
|
| 128 | 128 | if (file_exists($target_file)) { |
| 129 | 129 | $movedFile = true; |
| 130 | 130 | } else { |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | - } else if($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['videopagebanner']) { |
|
| 147 | - if(!empty($_FILES["videopagebanner"]["name"])) { |
|
| 146 | + } else if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_FILES['videopagebanner']) { |
|
| 147 | + if (!empty($_FILES["videopagebanner"]["name"])) { |
|
| 148 | 148 | $target_dir = "../subscribe/"; |
| 149 | 149 | $imageFileType = strtolower(pathinfo($_FILES["videopagebanner"]["name"], PATHINFO_EXTENSION)); |
| 150 | 150 | $target_name = md5_file($_FILES["videopagebanner"]["tmp_name"]) . "." . $imageFileType; |
@@ -154,14 +154,14 @@ discard block |
||
| 154 | 154 | $uploadOk = true; |
| 155 | 155 | $movedFile = false; |
| 156 | 156 | |
| 157 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 158 | - && $imageFileType != "gif" ) { |
|
| 157 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 158 | + && $imageFileType != "gif") { |
|
| 159 | 159 | $fileerror = 'unsupported file type. must be jpg, png, jpeg, or gif'; |
| 160 | 160 | $uploadOk = false; |
| 161 | 161 | goto skip; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if($uploadOk) { |
|
| 164 | + if ($uploadOk) { |
|
| 165 | 165 | if (file_exists($target_file)) { |
| 166 | 166 | $movedFile = true; |
| 167 | 167 | } else { |
@@ -182,126 +182,126 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if(!empty($_POST['bio'])) { |
|
| 185 | + if (!empty($_POST['bio'])) { |
|
| 186 | 186 | $__user_u->update_user_bio( |
| 187 | 187 | $_SESSION['siteusername'], |
| 188 | 188 | $_POST['bio'] |
| 189 | 189 | ); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if(!empty($_POST['videoid'])) { |
|
| 192 | + if (!empty($_POST['videoid'])) { |
|
| 193 | 193 | $__user_u->update_user_channels( |
| 194 | 194 | $_SESSION['siteusername'], |
| 195 | 195 | $_POST['videoid'] |
| 196 | 196 | ); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if(!empty($_POST['css'])) { |
|
| 199 | + if (!empty($_POST['css'])) { |
|
| 200 | 200 | $__user_u->update_user_css( |
| 201 | 201 | $_SESSION['siteusername'], |
| 202 | 202 | $_POST['css'] |
| 203 | 203 | ); |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - if(!empty($_POST['videoid'])) { |
|
| 206 | + if (!empty($_POST['videoid'])) { |
|
| 207 | 207 | $__user_u->update_user_featured_video( |
| 208 | 208 | $_SESSION['siteusername'], |
| 209 | 209 | $_POST['videoid'] |
| 210 | 210 | ); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if(!empty($_POST['solidcolor'])) { |
|
| 213 | + if (!empty($_POST['solidcolor'])) { |
|
| 214 | 214 | $__user_u->update_user_primary_color( |
| 215 | 215 | $_SESSION['siteusername'], |
| 216 | 216 | $_POST['solidcolor'] |
| 217 | 217 | ); |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - if(!empty($_POST['transparency'])) { |
|
| 220 | + if (!empty($_POST['transparency'])) { |
|
| 221 | 221 | $__user_u->update_user_transparency( |
| 222 | 222 | $_SESSION['siteusername'], |
| 223 | 223 | $_POST['transparency'] |
| 224 | 224 | ); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - if(!empty($_POST['genre'])) { |
|
| 227 | + if (!empty($_POST['genre'])) { |
|
| 228 | 228 | $__user_u->update_user_genre( |
| 229 | 229 | $_SESSION['siteusername'], |
| 230 | 230 | $_POST['genre'] |
| 231 | 231 | ); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if(!empty($_POST['bordercolor'])) { |
|
| 234 | + if (!empty($_POST['bordercolor'])) { |
|
| 235 | 235 | $__user_u->update_user_border_color( |
| 236 | 236 | $_SESSION['siteusername'], |
| 237 | 237 | $_POST['bordercolor'] |
| 238 | 238 | ); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if(!empty($_POST['country'])) { |
|
| 241 | + if (!empty($_POST['country'])) { |
|
| 242 | 242 | $__user_u->update_user_country( |
| 243 | 243 | $_SESSION['siteusername'], |
| 244 | 244 | $_POST['country'] |
| 245 | 245 | ); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if(!empty($_POST['header'])) { |
|
| 248 | + if (!empty($_POST['header'])) { |
|
| 249 | 249 | $__user_u->update_user_header( |
| 250 | 250 | $_SESSION['siteusername'], |
| 251 | 251 | $_POST['header'] |
| 252 | 252 | ); |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - if(!empty($_POST['channels'])) { |
|
| 255 | + if (!empty($_POST['channels'])) { |
|
| 256 | 256 | $__user_u->update_user_channels( |
| 257 | 257 | $_SESSION['siteusername'], |
| 258 | 258 | $_POST['channels'] |
| 259 | 259 | ); |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - if(!empty($_POST['customtext'])) { |
|
| 262 | + if (!empty($_POST['customtext'])) { |
|
| 263 | 263 | $__user_u->update_user_text( |
| 264 | 264 | $_SESSION['siteusername'], |
| 265 | 265 | $_POST['customtext'] |
| 266 | 266 | ); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | - if(!empty($_POST['country'])) { |
|
| 269 | + if (!empty($_POST['country'])) { |
|
| 270 | 270 | $__user_u->update_user_text( |
| 271 | 271 | $_SESSION['siteusername'], |
| 272 | 272 | $_POST['country'] |
| 273 | 273 | ); |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - if(!empty($_POST['website'])) { |
|
| 276 | + if (!empty($_POST['website'])) { |
|
| 277 | 277 | $__user_u->update_user_website( |
| 278 | 278 | $_SESSION['siteusername'], |
| 279 | 279 | $_POST['website'] |
| 280 | 280 | ); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - if(!empty($_POST['channelboxcolor'])) { |
|
| 283 | + if (!empty($_POST['channelboxcolor'])) { |
|
| 284 | 284 | $__user_u->update_user_secondary_color( |
| 285 | 285 | $_SESSION['siteusername'], |
| 286 | 286 | $_POST['channelboxcolor'] |
| 287 | 287 | ); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if(!empty($_POST['backgroundcolor'])) { |
|
| 290 | + if (!empty($_POST['backgroundcolor'])) { |
|
| 291 | 291 | $__user_u->update_user_third_color( |
| 292 | 292 | $_POST['backgroundcolor'], |
| 293 | 293 | $_SESSION['siteusername'] |
| 294 | 294 | ); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if(!empty($_POST['textmaincolor'])) { |
|
| 297 | + if (!empty($_POST['textmaincolor'])) { |
|
| 298 | 298 | $__user_u->update_user_primary_text_color( |
| 299 | 299 | $_SESSION['siteusername'], |
| 300 | 300 | $_POST['textmaincolor'] |
| 301 | 301 | ); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - if(!empty($_POST['bgoptionset'])) { |
|
| 304 | + if (!empty($_POST['bgoptionset'])) { |
|
| 305 | 305 | $bgoption = $_POST['bgoption']; |
| 306 | 306 | $bgcolor = $_POST['solidcolor']; |
| 307 | 307 | $default = "default.png"; |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $_SESSION['siteusername'] |
| 317 | 317 | ); |
| 318 | 318 | |
| 319 | - if($bgoption == "solid") { |
|
| 319 | + if ($bgoption == "solid") { |
|
| 320 | 320 | $__user_u->update_user_bg_color_09( |
| 321 | 321 | $bgcolor, |
| 322 | 322 | $_SESSION['siteusername'] |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | class user_insert { |
| 11 | 11 | public $__db; |
| 12 | 12 | |
| 13 | - public function __construct($conn){ |
|
| 13 | + public function __construct($conn){ |
|
| 14 | 14 | $this->__db = $conn; |
| 15 | - } |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | 17 | function check_view_channel($vidid, $user) { |
| 18 | 18 | $stmt = $this->__db->prepare("SELECT * FROM channel_views WHERE viewer = ? AND channel = ?"); |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class user_insert { |
| 11 | 11 | public $__db; |
| 12 | 12 | |
| 13 | - public function __construct($conn){ |
|
| 13 | + public function __construct($conn) { |
|
| 14 | 14 | $this->__db = $conn; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $stmt->bind_param("ss", $user, $vidid); |
| 20 | 20 | $stmt->execute(); |
| 21 | 21 | $result = $stmt->get_result(); |
| 22 | - if($result->num_rows === 0) { |
|
| 22 | + if ($result->num_rows === 0) { |
|
| 23 | 23 | $this->add_view_channel($vidid, $user); |
| 24 | 24 | } |
| 25 | 25 | $stmt->close(); |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | class user_update { |
| 11 | 11 | public $__db; |
| 12 | 12 | |
| 13 | - public function __construct($conn){ |
|
| 13 | + public function __construct($conn){ |
|
| 14 | 14 | $this->__db = $conn; |
| 15 | - } |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | 17 | function update_comment_cooldown_time($username) { |
| 18 | 18 | $stmt = $this->__db->prepare("UPDATE users SET cooldown_comment = now() WHERE username = ?"); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | class user_update { |
| 11 | 11 | public $__db; |
| 12 | 12 | |
| 13 | - public function __construct($conn){ |
|
| 13 | + public function __construct($conn) { |
|
| 14 | 14 | $this->__db = $conn; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -11,9 +11,9 @@ |
||
| 11 | 11 | class user_helper { |
| 12 | 12 | public $__db; |
| 13 | 13 | |
| 14 | - public function __construct($conn){ |
|
| 14 | + public function __construct($conn){ |
|
| 15 | 15 | $this->__db = $conn; |
| 16 | - } |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | 18 | function fetch_pfp($username) { |
| 19 | 19 | $stmt = $this->__db->prepare("SELECT pfp FROM users WHERE username = ?"); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | class user_helper { |
| 12 | 12 | public $__db; |
| 13 | 13 | |
| 14 | - public function __construct($conn){ |
|
| 14 | + public function __construct($conn) { |
|
| 15 | 15 | $this->__db = $conn; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -20,11 +20,11 @@ discard block |
||
| 20 | 20 | $stmt->bind_param("s", $username); |
| 21 | 21 | $stmt->execute(); |
| 22 | 22 | $result = $stmt->get_result(); |
| 23 | - while($row = $result->fetch_assoc()) { |
|
| 23 | + while ($row = $result->fetch_assoc()) { |
|
| 24 | 24 | $pfp = $row['pfp']; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if(!isset($pfp)) |
|
| 27 | + if (!isset($pfp)) |
|
| 28 | 28 | return "default.png"; |
| 29 | 29 | else |
| 30 | 30 | return $pfp; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $stmt->execute(); |
| 51 | 51 | $result = $stmt->get_result(); |
| 52 | 52 | $user = $result->fetch_assoc(); |
| 53 | - if($result->num_rows === 1) { return true; } else { return false; } |
|
| 53 | + if ($result->num_rows === 1) { return true; } else { return false; } |
|
| 54 | 54 | $stmt->close(); |
| 55 | 55 | |
| 56 | 56 | return $user; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $stmt->execute(); |
| 63 | 63 | $result = $stmt->get_result(); |
| 64 | 64 | $user = $result->fetch_assoc(); |
| 65 | - if($result->num_rows === 1) { return true; } else { return false; } |
|
| 65 | + if ($result->num_rows === 1) { return true; } else { return false; } |
|
| 66 | 66 | $stmt->close(); |
| 67 | 67 | |
| 68 | 68 | return $user; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $stmt->execute(); |
| 75 | 75 | $result = $stmt->get_result(); |
| 76 | 76 | $user = $result->fetch_assoc(); |
| 77 | - if($result->num_rows === 1) { return true; } else { return false; } |
|
| 77 | + if ($result->num_rows === 1) { return true; } else { return false; } |
|
| 78 | 78 | $stmt->close(); |
| 79 | 79 | |
| 80 | 80 | return $user; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $result = $stmt->get_result(); |
| 88 | 88 | $user = $result->fetch_assoc(); |
| 89 | 89 | |
| 90 | - if($result->num_rows === 0) |
|
| 90 | + if ($result->num_rows === 0) |
|
| 91 | 91 | return 0; |
| 92 | 92 | else |
| 93 | 93 | return $user; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $stmt->execute(); |
| 102 | 102 | $result = $stmt->get_result(); |
| 103 | 103 | $user = $result->fetch_assoc(); |
| 104 | - if($result->num_rows === 1) { return true; } else { return false; } |
|
| 104 | + if ($result->num_rows === 1) { return true; } else { return false; } |
|
| 105 | 105 | $stmt->close(); |
| 106 | 106 | |
| 107 | 107 | return $user; |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $stmt->execute(); |
| 114 | 114 | $result = $stmt->get_result(); |
| 115 | 115 | $user = $result->fetch_assoc(); |
| 116 | - if($result->num_rows === 1) { return true; } else { return false; } |
|
| 116 | + if ($result->num_rows === 1) { return true; } else { return false; } |
|
| 117 | 117 | $stmt->close(); |
| 118 | 118 | |
| 119 | 119 | return $user; |
@@ -24,10 +24,11 @@ discard block |
||
| 24 | 24 | $pfp = $row['pfp']; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if(!isset($pfp)) |
|
| 28 | - return "default.png"; |
|
| 29 | - else |
|
| 30 | - return $pfp; |
|
| 27 | + if(!isset($pfp)) { |
|
| 28 | + return "default.png"; |
|
| 29 | + } else { |
|
| 30 | + return $pfp; |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | $stmt->close(); |
| 33 | 34 | } |
@@ -87,10 +88,11 @@ discard block |
||
| 87 | 88 | $result = $stmt->get_result(); |
| 88 | 89 | $user = $result->fetch_assoc(); |
| 89 | 90 | |
| 90 | - if($result->num_rows === 0) |
|
| 91 | - return 0; |
|
| 92 | - else |
|
| 93 | - return $user; |
|
| 91 | + if($result->num_rows === 0) { |
|
| 92 | + return 0; |
|
| 93 | + } else { |
|
| 94 | + return $user; |
|
| 95 | + } |
|
| 94 | 96 | |
| 95 | 97 | $stmt->close(); |
| 96 | 98 | } |
@@ -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 | } |