@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Class Likes |
@@ -106,8 +107,9 @@ discard block |
||
| 106 | 107 | $this->_extra = isset($_GET['extra']) ? $_GET['extra'] : false; |
| 107 | 108 | |
| 108 | 109 | // We do not want to output debug information here. |
| 109 | - if ($this->_js) |
|
| 110 | - $db_show_debug = false; |
|
| 110 | + if ($this->_js) { |
|
| 111 | + $db_show_debug = false; |
|
| 112 | + } |
|
| 111 | 113 | } |
| 112 | 114 | |
| 113 | 115 | /** |
@@ -141,8 +143,9 @@ discard block |
||
| 141 | 143 | $call = $this->_sa; |
| 142 | 144 | |
| 143 | 145 | // Guest can only view likes. |
| 144 | - if ($call != 'view') |
|
| 145 | - is_not_guest(); |
|
| 146 | + if ($call != 'view') { |
|
| 147 | + is_not_guest(); |
|
| 148 | + } |
|
| 146 | 149 | |
| 147 | 150 | checkSession('get'); |
| 148 | 151 | |
@@ -180,15 +183,17 @@ discard block |
||
| 180 | 183 | global $smcFunc, $modSettings; |
| 181 | 184 | |
| 182 | 185 | // This feature is currently disable. |
| 183 | - if (empty($modSettings['enable_likes'])) |
|
| 184 | - return $this->_error = 'like_disable'; |
|
| 186 | + if (empty($modSettings['enable_likes'])) { |
|
| 187 | + return $this->_error = 'like_disable'; |
|
| 188 | + } |
|
| 185 | 189 | |
| 186 | 190 | // Zerothly, they did indicate some kind of content to like, right? |
| 187 | 191 | preg_match('~^([a-z0-9\-\_]{1,6})~i', $this->_type, $matches); |
| 188 | 192 | $this->_type = isset($matches[1]) ? $matches[1] : ''; |
| 189 | 193 | |
| 190 | - if ($this->_type == '' || $this->_content <= 0) |
|
| 191 | - return $this->_error = 'cannot_'; |
|
| 194 | + if ($this->_type == '' || $this->_content <= 0) { |
|
| 195 | + return $this->_error = 'cannot_'; |
|
| 196 | + } |
|
| 192 | 197 | |
| 193 | 198 | // First we need to verify if the user can see the type of content or not. This is set up to be extensible, |
| 194 | 199 | // so we'll check for the one type we do know about, and if it's not that, we'll defer to any hooks. |
@@ -207,12 +212,14 @@ discard block |
||
| 207 | 212 | 'msg' => $this->_content, |
| 208 | 213 | ) |
| 209 | 214 | ); |
| 210 | - if ($smcFunc['db_num_rows']($request) == 1) |
|
| 211 | - list ($this->_idTopic, $topicOwner) = $smcFunc['db_fetch_row']($request); |
|
| 215 | + if ($smcFunc['db_num_rows']($request) == 1) { |
|
| 216 | + list ($this->_idTopic, $topicOwner) = $smcFunc['db_fetch_row']($request); |
|
| 217 | + } |
|
| 212 | 218 | |
| 213 | 219 | $smcFunc['db_free_result']($request); |
| 214 | - if (empty($this->_idTopic)) |
|
| 215 | - return $this->_error = 'cannot_'; |
|
| 220 | + if (empty($this->_idTopic)) { |
|
| 221 | + return $this->_error = 'cannot_'; |
|
| 222 | + } |
|
| 216 | 223 | |
| 217 | 224 | // So we know what topic it's in and more importantly we know the user can see it. |
| 218 | 225 | // If we're not viewing, we need some info set up. |
@@ -221,9 +228,7 @@ discard block |
||
| 221 | 228 | $this->_validLikes['redirect'] = 'topic=' . $this->_idTopic . '.msg' . $this->_content . '#msg' . $this->_content; |
| 222 | 229 | |
| 223 | 230 | $this->_validLikes['can_like'] = ($this->_user['id'] == $topicOwner ? 'cannot_like_content' : (allowedTo('likes_like') ? true : 'cannot_like_content')); |
| 224 | - } |
|
| 225 | - |
|
| 226 | - else |
|
| 231 | + } else |
|
| 227 | 232 | { |
| 228 | 233 | // Modders: This will give you whatever the user offers up in terms of liking, e.g. $this->_type=msg, $this->_content=1 |
| 229 | 234 | // When you hook this, check $this->_type first. If it is not something your mod worries about, return false. |
@@ -241,8 +246,9 @@ discard block |
||
| 241 | 246 | if ($result !== false) |
| 242 | 247 | { |
| 243 | 248 | // Match the type with what we already have. |
| 244 | - if (!isset($result['type']) || $result['type'] != $this->_type) |
|
| 245 | - return $this->_error = 'not_valid_like_type'; |
|
| 249 | + if (!isset($result['type']) || $result['type'] != $this->_type) { |
|
| 250 | + return $this->_error = 'not_valid_like_type'; |
|
| 251 | + } |
|
| 246 | 252 | |
| 247 | 253 | // Fill out the rest. |
| 248 | 254 | $this->_type = $result['type']; |
@@ -253,13 +259,15 @@ discard block |
||
| 253 | 259 | } |
| 254 | 260 | } |
| 255 | 261 | |
| 256 | - if (!$found) |
|
| 257 | - return $this->_error = 'cannot_'; |
|
| 262 | + if (!$found) { |
|
| 263 | + return $this->_error = 'cannot_'; |
|
| 264 | + } |
|
| 258 | 265 | } |
| 259 | 266 | |
| 260 | 267 | // Does the user can like this? Viewing a list of likes doesn't require this permission. |
| 261 | - if ($this->_sa != 'view' && isset($this->_validLikes['can_like']) && is_string($this->_validLikes['can_like'])) |
|
| 262 | - return $this->_error = $this->_validLikes['can_like']; |
|
| 268 | + if ($this->_sa != 'view' && isset($this->_validLikes['can_like']) && is_string($this->_validLikes['can_like'])) { |
|
| 269 | + return $this->_error = $this->_validLikes['can_like']; |
|
| 270 | + } |
|
| 263 | 271 | } |
| 264 | 272 | |
| 265 | 273 | /** |
@@ -284,8 +292,9 @@ discard block |
||
| 284 | 292 | ); |
| 285 | 293 | |
| 286 | 294 | // Are we calling this directly? if so, set a proper data for the response. Do note that __METHOD__ returns both the class name and the function name. |
| 287 | - if ($this->_sa == __FUNCTION__) |
|
| 288 | - $this->_data = __FUNCTION__; |
|
| 295 | + if ($this->_sa == __FUNCTION__) { |
|
| 296 | + $this->_data = __FUNCTION__; |
|
| 297 | + } |
|
| 289 | 298 | } |
| 290 | 299 | |
| 291 | 300 | /** |
@@ -315,8 +324,8 @@ discard block |
||
| 315 | 324 | |
| 316 | 325 | // Add a background task to process sending alerts. |
| 317 | 326 | // Mod author, you can add your own background task for your own custom like event using the "integrate_issue_like" hook or your callback, both are immediately called after this. |
| 318 | - if ($this->_type == 'msg') |
|
| 319 | - $smcFunc['db_insert']('insert', |
|
| 327 | + if ($this->_type == 'msg') { |
|
| 328 | + $smcFunc['db_insert']('insert', |
|
| 320 | 329 | '{db_prefix}background_tasks', |
| 321 | 330 | array('task_file' => 'string', 'task_class' => 'string', 'task_data' => 'string', 'claimed_time' => 'int'), |
| 322 | 331 | array('$sourcedir/tasks/Likes-Notify.php', 'Likes_Notify_Background', $smcFunc['json_encode'](array( |
@@ -328,10 +337,12 @@ discard block |
||
| 328 | 337 | )), 0), |
| 329 | 338 | array('id_task') |
| 330 | 339 | ); |
| 340 | + } |
|
| 331 | 341 | |
| 332 | 342 | // Are we calling this directly? if so, set a proper data for the response. Do note that __METHOD__ returns both the class name and the function name. |
| 333 | - if ($this->_sa == __FUNCTION__) |
|
| 334 | - $this->_data = __FUNCTION__; |
|
| 343 | + if ($this->_sa == __FUNCTION__) { |
|
| 344 | + $this->_data = __FUNCTION__; |
|
| 345 | + } |
|
| 335 | 346 | } |
| 336 | 347 | |
| 337 | 348 | /** |
@@ -357,8 +368,9 @@ discard block |
||
| 357 | 368 | $smcFunc['db_free_result']($request); |
| 358 | 369 | |
| 359 | 370 | // If you want to call this directly, fill out _data property too. |
| 360 | - if ($this->_sa == __FUNCTION__) |
|
| 361 | - $this->_data = $this->_numLikes; |
|
| 371 | + if ($this->_sa == __FUNCTION__) { |
|
| 372 | + $this->_data = $this->_numLikes; |
|
| 373 | + } |
|
| 362 | 374 | } |
| 363 | 375 | |
| 364 | 376 | /** |
@@ -371,8 +383,9 @@ discard block |
||
| 371 | 383 | global $smcFunc; |
| 372 | 384 | |
| 373 | 385 | // Safety first! |
| 374 | - if (empty($this->_type) || empty($this->_content)) |
|
| 375 | - return $this->_error = 'cannot_'; |
|
| 386 | + if (empty($this->_type) || empty($this->_content)) { |
|
| 387 | + return $this->_error = 'cannot_'; |
|
| 388 | + } |
|
| 376 | 389 | |
| 377 | 390 | // Do we already like this? |
| 378 | 391 | $request = $smcFunc['db_query']('', ' |
@@ -390,26 +403,28 @@ discard block |
||
| 390 | 403 | $this->_alreadyLiked = (bool) $smcFunc['db_num_rows']($request) != 0; |
| 391 | 404 | $smcFunc['db_free_result']($request); |
| 392 | 405 | |
| 393 | - if ($this->_alreadyLiked) |
|
| 394 | - $this->delete(); |
|
| 395 | - |
|
| 396 | - else |
|
| 397 | - $this->insert(); |
|
| 406 | + if ($this->_alreadyLiked) { |
|
| 407 | + $this->delete(); |
|
| 408 | + } else { |
|
| 409 | + $this->insert(); |
|
| 410 | + } |
|
| 398 | 411 | |
| 399 | 412 | // Now, how many people like this content now? We *could* just +1 / -1 the relevant container but that has proven to become unstable. |
| 400 | 413 | $this->_count(); |
| 401 | 414 | |
| 402 | 415 | // Update the likes count for messages. |
| 403 | - if ($this->_type == 'msg') |
|
| 404 | - $this->msgIssueLike(); |
|
| 416 | + if ($this->_type == 'msg') { |
|
| 417 | + $this->msgIssueLike(); |
|
| 418 | + } |
|
| 405 | 419 | |
| 406 | 420 | // Any callbacks? |
| 407 | 421 | elseif (!empty($this->_validLikes['callback'])) |
| 408 | 422 | { |
| 409 | 423 | $call = call_helper($this->_validLikes['callback'], true); |
| 410 | 424 | |
| 411 | - if (!empty($call)) |
|
| 412 | - call_user_func_array($call, array($this)); |
|
| 425 | + if (!empty($call)) { |
|
| 426 | + call_user_func_array($call, array($this)); |
|
| 427 | + } |
|
| 413 | 428 | } |
| 414 | 429 | |
| 415 | 430 | // Sometimes there might be other things that need updating after we do this like. |
@@ -418,8 +433,9 @@ discard block |
||
| 418 | 433 | // Now some clean up. This is provided here for any like handlers that want to do any cache flushing. |
| 419 | 434 | // This way a like handler doesn't need to explicitly declare anything in integrate_issue_like, but do so |
| 420 | 435 | // in integrate_valid_likes where it absolutely has to exist. |
| 421 | - if (!empty($this->_validLikes['flush_cache'])) |
|
| 422 | - cache_put_data($this->_validLikes['flush_cache'], null); |
|
| 436 | + if (!empty($this->_validLikes['flush_cache'])) { |
|
| 437 | + cache_put_data($this->_validLikes['flush_cache'], null); |
|
| 438 | + } |
|
| 423 | 439 | |
| 424 | 440 | // All done, start building the data to pass as response. |
| 425 | 441 | $this->_data = array( |
@@ -442,8 +458,9 @@ discard block |
||
| 442 | 458 | { |
| 443 | 459 | global $smcFunc; |
| 444 | 460 | |
| 445 | - if ($this->_type !== 'msg') |
|
| 446 | - return; |
|
| 461 | + if ($this->_type !== 'msg') { |
|
| 462 | + return; |
|
| 463 | + } |
|
| 447 | 464 | |
| 448 | 465 | $smcFunc['db_query']('', ' |
| 449 | 466 | UPDATE {db_prefix}messages |
@@ -484,8 +501,9 @@ discard block |
||
| 484 | 501 | 'like_type' => $this->_type, |
| 485 | 502 | ) |
| 486 | 503 | ); |
| 487 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 488 | - $context['likers'][$row['id_member']] = array('timestamp' => $row['like_time']); |
|
| 504 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 505 | + $context['likers'][$row['id_member']] = array('timestamp' => $row['like_time']); |
|
| 506 | + } |
|
| 489 | 507 | |
| 490 | 508 | // Now to get member data, including avatars and so on. |
| 491 | 509 | $members = array_keys($context['likers']); |
@@ -493,8 +511,9 @@ discard block |
||
| 493 | 511 | if (count($loaded) != count($members)) |
| 494 | 512 | { |
| 495 | 513 | $members = array_diff($members, $loaded); |
| 496 | - foreach ($members as $not_loaded) |
|
| 497 | - unset ($context['likers'][$not_loaded]); |
|
| 514 | + foreach ($members as $not_loaded) { |
|
| 515 | + unset ($context['likers'][$not_loaded]); |
|
| 516 | + } |
|
| 498 | 517 | } |
| 499 | 518 | |
| 500 | 519 | foreach ($context['likers'] as $liker => $dummy) |
@@ -536,12 +555,14 @@ discard block |
||
| 536 | 555 | global $context, $txt; |
| 537 | 556 | |
| 538 | 557 | // Don't do anything if someone else has already take care of the response. |
| 539 | - if (!$this->_setResponse) |
|
| 540 | - return; |
|
| 558 | + if (!$this->_setResponse) { |
|
| 559 | + return; |
|
| 560 | + } |
|
| 541 | 561 | |
| 542 | 562 | // Want a json response huh? |
| 543 | - if ($this->_validLikes['json']) |
|
| 544 | - return $this->jsonResponse(); |
|
| 563 | + if ($this->_validLikes['json']) { |
|
| 564 | + return $this->jsonResponse(); |
|
| 565 | + } |
|
| 545 | 566 | |
| 546 | 567 | // Set everything up for display. |
| 547 | 568 | loadTemplate('Likes'); |
@@ -551,8 +572,9 @@ discard block |
||
| 551 | 572 | if ($this->_error) |
| 552 | 573 | { |
| 553 | 574 | // If this is a generic error, set it up good. |
| 554 | - if ($this->_error == 'cannot_') |
|
| 555 | - $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
| 575 | + if ($this->_error == 'cannot_') { |
|
| 576 | + $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
| 577 | + } |
|
| 556 | 578 | |
| 557 | 579 | // Is this request coming from an ajax call? |
| 558 | 580 | if ($this->_js) |
@@ -562,8 +584,9 @@ discard block |
||
| 562 | 584 | } |
| 563 | 585 | |
| 564 | 586 | // Nope? then just do a redirect to whatever URL was provided. |
| 565 | - else |
|
| 566 | - redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] . ';error=' . $this->_error : ''); |
|
| 587 | + else { |
|
| 588 | + redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] . ';error=' . $this->_error : ''); |
|
| 589 | + } |
|
| 567 | 590 | |
| 568 | 591 | return; |
| 569 | 592 | } |
@@ -572,8 +595,9 @@ discard block |
||
| 572 | 595 | else |
| 573 | 596 | { |
| 574 | 597 | // Not an ajax request so send the user back to the previous location or the main page. |
| 575 | - if (!$this->_js) |
|
| 576 | - redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] : ''); |
|
| 598 | + if (!$this->_js) { |
|
| 599 | + redirectexit(!empty($this->_validLikes['redirect']) ? $this->_validLikes['redirect'] : ''); |
|
| 600 | + } |
|
| 577 | 601 | |
| 578 | 602 | // These fine gentlemen all share the same template. |
| 579 | 603 | $generic = array('delete', 'insert', '_count'); |
@@ -606,8 +630,9 @@ discard block |
||
| 606 | 630 | // If there is an error, send it. |
| 607 | 631 | if ($this->_error) |
| 608 | 632 | { |
| 609 | - if ($this->_error == 'cannot_') |
|
| 610 | - $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
| 633 | + if ($this->_error == 'cannot_') { |
|
| 634 | + $this->_error = $this->_sa == 'view' ? 'cannot_view_likes' : 'cannot_like_content'; |
|
| 635 | + } |
|
| 611 | 636 | |
| 612 | 637 | $print['error'] = $this->_error; |
| 613 | 638 | } |
@@ -643,33 +668,36 @@ discard block |
||
| 643 | 668 | <body style="background-color: #444455; color: white; font-style: italic; font-family: serif;"> |
| 644 | 669 | <div style="margin-top: 12%; font-size: 1.1em; line-height: 1.4; text-align: center;">'; |
| 645 | 670 | |
| 646 | - if (!isset($_GET['verse']) || ($_GET['verse'] != '2:18' && $_GET['verse'] != '22:1-2')) |
|
| 647 | - $_GET['verse'] = '4:16'; |
|
| 671 | + if (!isset($_GET['verse']) || ($_GET['verse'] != '2:18' && $_GET['verse'] != '22:1-2')) { |
|
| 672 | + $_GET['verse'] = '4:16'; |
|
| 673 | + } |
|
| 648 | 674 | |
| 649 | - if ($_GET['verse'] == '2:18') |
|
| 650 | - echo ' |
|
| 675 | + if ($_GET['verse'] == '2:18') { |
|
| 676 | + echo ' |
|
| 651 | 677 | Woe, it was that his name wasn\'t <em>known</em>, that he came in mystery, and was recognized by none. And it became to be in those days <em>something</em>. Something not yet <em id="unknown" name="[Unknown]">unknown</em> to mankind. And thus what was to be known the <em>secret project</em> began into its existence. Henceforth the opposition was only <em>weary</em> and <em>fearful</em>, for now their match was at arms against them.'; |
| 652 | - elseif ($_GET['verse'] == '4:16') |
|
| 653 | - echo ' |
|
| 678 | + } elseif ($_GET['verse'] == '4:16') { |
|
| 679 | + echo ' |
|
| 654 | 680 | And it came to pass that the <em>unbelievers</em> dwindled in number and saw rise of many <em>proselytizers</em>, and the opposition found fear in the face of the <em>x</em> and the <em>j</em> while those who stood with the <em>something</em> grew stronger and came together. Still, this was only the <em>beginning</em>, and what lay in the future was <em id="unknown" name="[Unknown]">unknown</em> to all, even those on the right side.'; |
| 655 | - elseif ($_GET['verse'] == '22:1-2') |
|
| 656 | - echo ' |
|
| 681 | + } elseif ($_GET['verse'] == '22:1-2') { |
|
| 682 | + echo ' |
|
| 657 | 683 | <p>Now <em>behold</em>, that which was once the secret project was <em id="unknown" name="[Unknown]">unknown</em> no longer. Alas, it needed more than <em>only one</em>, but yet even thought otherwise. It became that the opposition <em>rumored</em> and lied, but still to no avail. Their match, though not <em>perfect</em>, had them outdone.</p> |
| 658 | 684 | <p style="margin: 2ex 1ex 0 1ex; font-size: 1.05em; line-height: 1.5; text-align: center;">Let it continue. <em>The end</em>.</p>'; |
| 685 | + } |
|
| 659 | 686 | |
| 660 | 687 | echo ' |
| 661 | 688 | </div> |
| 662 | 689 | <div style="margin-top: 2ex; font-size: 2em; text-align: right;">'; |
| 663 | 690 | |
| 664 | - if ($_GET['verse'] == '2:18') |
|
| 665 | - echo ' |
|
| 691 | + if ($_GET['verse'] == '2:18') { |
|
| 692 | + echo ' |
|
| 666 | 693 | from <span style="font-family: Georgia, serif;"><strong><a href="', $scripturl, '?action=about:unknown;verse=4:16" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>'; |
| 667 | - elseif ($_GET['verse'] == '4:16') |
|
| 668 | - echo ' |
|
| 694 | + } elseif ($_GET['verse'] == '4:16') { |
|
| 695 | + echo ' |
|
| 669 | 696 | from <span style="font-family: Georgia, serif;"><strong><a href="', $scripturl, '?action=about:unknown;verse=22:1-2" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>'; |
| 670 | - elseif ($_GET['verse'] == '22:1-2') |
|
| 671 | - echo ' |
|
| 697 | + } elseif ($_GET['verse'] == '22:1-2') { |
|
| 698 | + echo ' |
|
| 672 | 699 | from <span style="font-family: Georgia, serif;"><strong>The Book of Unknown</strong>, 22:1-2</span>'; |
| 700 | + } |
|
| 673 | 701 | |
| 674 | 702 | echo ' |
| 675 | 703 | </div> |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | * @version 2.1 Beta 4 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -if (!defined('SMF')) |
|
| 14 | +if (!defined('SMF')) { |
|
| 15 | 15 | die('Hacking attempt...'); |
| 16 | +} |
|
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * Interface cache_api_interface |
@@ -182,8 +183,9 @@ discard block |
||
| 182 | 183 | { |
| 183 | 184 | global $cache_enable; |
| 184 | 185 | |
| 185 | - if ($test) |
|
| 186 | - return true; |
|
| 186 | + if ($test) { |
|
| 187 | + return true; |
|
| 188 | + } |
|
| 187 | 189 | return !empty($cache_enable); |
| 188 | 190 | } |
| 189 | 191 | |
@@ -202,18 +204,20 @@ discard block |
||
| 202 | 204 | global $boardurl, $cachedir; |
| 203 | 205 | |
| 204 | 206 | // Find a valid good file to do mtime checks on. |
| 205 | - if (file_exists($cachedir . '/' . 'index.php')) |
|
| 206 | - $filemtime = $cachedir . '/' . 'index.php'; |
|
| 207 | - elseif (is_dir($cachedir . '/')) |
|
| 208 | - $filemtime = $cachedir . '/'; |
|
| 209 | - else |
|
| 210 | - $filemtime = $boardurl . '/index.php'; |
|
| 207 | + if (file_exists($cachedir . '/' . 'index.php')) { |
|
| 208 | + $filemtime = $cachedir . '/' . 'index.php'; |
|
| 209 | + } elseif (is_dir($cachedir . '/')) { |
|
| 210 | + $filemtime = $cachedir . '/'; |
|
| 211 | + } else { |
|
| 212 | + $filemtime = $boardurl . '/index.php'; |
|
| 213 | + } |
|
| 211 | 214 | |
| 212 | 215 | // Set the default if no prefix was specified. |
| 213 | - if (empty($prefix)) |
|
| 214 | - $this->prefix = md5($boardurl . filemtime($filemtime)) . '-SMF-'; |
|
| 215 | - else |
|
| 216 | - $this->prefix = $prefix; |
|
| 216 | + if (empty($prefix)) { |
|
| 217 | + $this->prefix = md5($boardurl . filemtime($filemtime)) . '-SMF-'; |
|
| 218 | + } else { |
|
| 219 | + $this->prefix = $prefix; |
|
| 220 | + } |
|
| 217 | 221 | |
| 218 | 222 | return true; |
| 219 | 223 | } |
@@ -276,8 +280,9 @@ discard block |
||
| 276 | 280 | |
| 277 | 281 | // Invalidate cache, to be sure! |
| 278 | 282 | // ... as long as index.php can be modified, anyway. |
| 279 | - if (is_writable($cachedir . '/' . 'index.php')) |
|
| 280 | - @touch($cachedir . '/' . 'index.php'); |
|
| 283 | + if (is_writable($cachedir . '/' . 'index.php')) { |
|
| 284 | + @touch($cachedir . '/' . 'index.php'); |
|
| 285 | + } |
|
| 281 | 286 | |
| 282 | 287 | return true; |
| 283 | 288 | } |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Retrieve a list and several other statistics of the users currently online. |
@@ -45,8 +46,9 @@ discard block |
||
| 45 | 46 | } |
| 46 | 47 | |
| 47 | 48 | // Not allowed sort method? Bang! Error! |
| 48 | - elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options)) |
|
| 49 | - trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE); |
|
| 49 | + elseif (!in_array($membersOnlineOptions['sort'], $allowed_sort_options)) { |
|
| 50 | + trigger_error('Sort method for getMembersOnlineStats() function is not allowed', E_USER_NOTICE); |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | // Initialize the array that'll be returned later on. |
| 52 | 54 | $membersOnlineStats = array( |
@@ -63,8 +65,9 @@ discard block |
||
| 63 | 65 | // Get any spiders if enabled. |
| 64 | 66 | $spiders = array(); |
| 65 | 67 | $spider_finds = array(); |
| 66 | - if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) |
|
| 67 | - $spiders = $smcFunc['json_decode']($modSettings['spider_name_cache'], true); |
|
| 68 | + if (!empty($modSettings['show_spider_online']) && ($modSettings['show_spider_online'] < 3 || allowedTo('admin_forum')) && !empty($modSettings['spider_name_cache'])) { |
|
| 69 | + $spiders = $smcFunc['json_decode']($modSettings['spider_name_cache'], true); |
|
| 70 | + } |
|
| 68 | 71 | |
| 69 | 72 | // Load the users online right now. |
| 70 | 73 | $request = $smcFunc['db_query']('', ' |
@@ -92,9 +95,7 @@ discard block |
||
| 92 | 95 | $membersOnlineStats['num_guests']++; |
| 93 | 96 | |
| 94 | 97 | continue; |
| 95 | - } |
|
| 96 | - |
|
| 97 | - elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
|
| 98 | + } elseif (empty($row['show_online']) && empty($membersOnlineOptions['show_hidden'])) |
|
| 98 | 99 | { |
| 99 | 100 | // Just increase the stats and don't add this hidden user to any list. |
| 100 | 101 | $membersOnlineStats['num_users_hidden']++; |
@@ -102,10 +103,11 @@ discard block |
||
| 102 | 103 | } |
| 103 | 104 | |
| 104 | 105 | // Some basic color coding... |
| 105 | - if (!empty($row['online_color'])) |
|
| 106 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
| 107 | - else |
|
| 108 | - $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 106 | + if (!empty($row['online_color'])) { |
|
| 107 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '" style="color: ' . $row['online_color'] . ';">' . $row['real_name'] . '</a>'; |
|
| 108 | + } else { |
|
| 109 | + $link = '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>'; |
|
| 110 | + } |
|
| 109 | 111 | |
| 110 | 112 | // Buddies get counted and highlighted. |
| 111 | 113 | $is_buddy = in_array($row['id_member'], $user_info['buddies']); |
@@ -132,8 +134,8 @@ discard block |
||
| 132 | 134 | $membersOnlineStats['list_users_online'][$row[$membersOnlineOptions['sort']] . '_' . $row['member_name']] = empty($row['show_online']) ? '<em>' . $link . '</em>' : $link; |
| 133 | 135 | |
| 134 | 136 | // Store all distinct (primary) membergroups that are shown. |
| 135 | - if (!isset($membersOnlineStats['online_groups'][$row['id_group']])) |
|
| 136 | - $membersOnlineStats['online_groups'][$row['id_group']] = array( |
|
| 137 | + if (!isset($membersOnlineStats['online_groups'][$row['id_group']])) { |
|
| 138 | + $membersOnlineStats['online_groups'][$row['id_group']] = array( |
|
| 137 | 139 | 'id' => $row['id_group'], |
| 138 | 140 | 'name' => $row['group_name'], |
| 139 | 141 | 'color' => $row['online_color'], |
@@ -141,6 +143,7 @@ discard block |
||
| 141 | 143 | 'type' => $row['group_type'], |
| 142 | 144 | 'parent' => $row['id_parent'], |
| 143 | 145 | ); |
| 146 | + } |
|
| 144 | 147 | } |
| 145 | 148 | $smcFunc['db_free_result']($request); |
| 146 | 149 | |
@@ -201,11 +204,12 @@ discard block |
||
| 201 | 204 | $settingsToUpdate = array(); |
| 202 | 205 | |
| 203 | 206 | // More members on now than ever were? Update it! |
| 204 | - if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline']) |
|
| 205 | - $settingsToUpdate = array( |
|
| 207 | + if (!isset($modSettings['mostOnline']) || $total_users_online >= $modSettings['mostOnline']) { |
|
| 208 | + $settingsToUpdate = array( |
|
| 206 | 209 | 'mostOnline' => $total_users_online, |
| 207 | 210 | 'mostDate' => time() |
| 208 | 211 | ); |
| 212 | + } |
|
| 209 | 213 | |
| 210 | 214 | $date = strftime('%Y-%m-%d', forum_time(false)); |
| 211 | 215 | |
@@ -237,8 +241,9 @@ discard block |
||
| 237 | 241 | { |
| 238 | 242 | list ($modSettings['mostOnlineToday']) = $smcFunc['db_fetch_row']($request); |
| 239 | 243 | |
| 240 | - if ($total_users_online > $modSettings['mostOnlineToday']) |
|
| 241 | - trackStats(array('most_on' => $total_users_online)); |
|
| 244 | + if ($total_users_online > $modSettings['mostOnlineToday']) { |
|
| 245 | + trackStats(array('most_on' => $total_users_online)); |
|
| 246 | + } |
|
| 242 | 247 | |
| 243 | 248 | $total_users_online = max($total_users_online, $modSettings['mostOnlineToday']); |
| 244 | 249 | } |
@@ -255,8 +260,9 @@ discard block |
||
| 255 | 260 | $settingsToUpdate['mostOnlineToday'] = $total_users_online; |
| 256 | 261 | } |
| 257 | 262 | |
| 258 | - if (!empty($settingsToUpdate)) |
|
| 259 | - updateSettings($settingsToUpdate); |
|
| 260 | -} |
|
| 263 | + if (!empty($settingsToUpdate)) { |
|
| 264 | + updateSettings($settingsToUpdate); |
|
| 265 | + } |
|
| 266 | + } |
|
| 261 | 267 | |
| 262 | 268 | ?> |
| 263 | 269 | \ No newline at end of file |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | echo ' |
| 74 | 74 | <div class="main_container"> |
| 75 | - <div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '','" id="category_', $category['id'], '"> |
|
| 75 | + <div class="cat_bar ', $category['is_collapsed'] ? 'collapsed' : '', '" id="category_', $category['id'], '"> |
|
| 76 | 76 | <h3 class="catbg">'; |
| 77 | 77 | |
| 78 | 78 | // If this category even can collapse, show a link to collapse it. |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | foreach ($board['children'] as $child) |
| 248 | 248 | { |
| 249 | 249 | if (!$child['is_redirect']) |
| 250 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
| 250 | + $child['link'] = '' . ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
| 251 | 251 | else |
| 252 | 252 | $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
| 253 | 253 | |
@@ -31,9 +31,10 @@ discard block |
||
| 31 | 31 | echo ' |
| 32 | 32 | <ul id="smf_slider" class="roundframe">'; |
| 33 | 33 | |
| 34 | - foreach ($context['news_lines'] as $news) |
|
| 35 | - echo ' |
|
| 34 | + foreach ($context['news_lines'] as $news) { |
|
| 35 | + echo ' |
|
| 36 | 36 | <li>', $news, '</li>'; |
| 37 | + } |
|
| 37 | 38 | |
| 38 | 39 | echo ' |
| 39 | 40 | </ul> |
@@ -65,8 +66,9 @@ discard block |
||
| 65 | 66 | foreach ($context['categories'] as $category) |
| 66 | 67 | { |
| 67 | 68 | // If theres no parent boards we can see, avoid showing an empty category (unless its collapsed) |
| 68 | - if (empty($category['boards']) && !$category['is_collapsed']) |
|
| 69 | - continue; |
|
| 69 | + if (empty($category['boards']) && !$category['is_collapsed']) { |
|
| 70 | + continue; |
|
| 71 | + } |
|
| 70 | 72 | |
| 71 | 73 | echo ' |
| 72 | 74 | <div class="main_container"> |
@@ -74,9 +76,10 @@ discard block |
||
| 74 | 76 | <h3 class="catbg">'; |
| 75 | 77 | |
| 76 | 78 | // If this category even can collapse, show a link to collapse it. |
| 77 | - if ($category['can_collapse']) |
|
| 78 | - echo ' |
|
| 79 | + if ($category['can_collapse']) { |
|
| 80 | + echo ' |
|
| 79 | 81 | <span id="category_', $category['id'], '_upshrink" class="', $category['is_collapsed'] ? 'toggle_down' : 'toggle_up', ' floatright" data-collapsed="', (int) $category['is_collapsed'], '" title="', !$category['is_collapsed'] ? $txt['hide_category'] : $txt['show_category'], '" style="display: none;"></span>'; |
| 82 | + } |
|
| 80 | 83 | |
| 81 | 84 | echo ' |
| 82 | 85 | ', $category['link'], ' |
@@ -106,10 +109,11 @@ discard block |
||
| 106 | 109 | </div>'; |
| 107 | 110 | |
| 108 | 111 | // Won't somebody think of the children! |
| 109 | - if (function_exists('template_bi_' . $board['type'] . '_children')) |
|
| 110 | - call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
| 111 | - else |
|
| 112 | - template_bi_board_children($board); |
|
| 112 | + if (function_exists('template_bi_' . $board['type'] . '_children')) { |
|
| 113 | + call_user_func('template_bi_' . $board['type'] . '_children', $board); |
|
| 114 | + } else { |
|
| 115 | + template_bi_board_children($board); |
|
| 116 | + } |
|
| 113 | 117 | |
| 114 | 118 | echo ' |
| 115 | 119 | </div><!-- #board_[id] -->'; |
@@ -124,12 +128,13 @@ discard block |
||
| 124 | 128 | </div><!-- #boardindex_table -->'; |
| 125 | 129 | |
| 126 | 130 | // Show the mark all as read button? |
| 127 | - if ($context['user']['is_logged'] && !empty($context['categories'])) |
|
| 128 | - echo ' |
|
| 131 | + if ($context['user']['is_logged'] && !empty($context['categories'])) { |
|
| 132 | + echo ' |
|
| 129 | 133 | <div class="mark_read"> |
| 130 | 134 | ', template_button_strip($context['mark_read_button'], 'right'), ' |
| 131 | 135 | </div>'; |
| 132 | -} |
|
| 136 | + } |
|
| 137 | + } |
|
| 133 | 138 | |
| 134 | 139 | /** |
| 135 | 140 | * Outputs the board icon for a standard board. |
@@ -173,18 +178,20 @@ discard block |
||
| 173 | 178 | </a>'; |
| 174 | 179 | |
| 175 | 180 | // Has it outstanding posts for approval? |
| 176 | - if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) |
|
| 177 | - echo ' |
|
| 181 | + if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics'])) { |
|
| 182 | + echo ' |
|
| 178 | 183 | <a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>'; |
| 184 | + } |
|
| 179 | 185 | |
| 180 | 186 | echo ' |
| 181 | 187 | <p class="board_description">', $board['description'], '</p>'; |
| 182 | 188 | |
| 183 | 189 | // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.) |
| 184 | - if (!empty($board['link_moderators'])) |
|
| 185 | - echo ' |
|
| 190 | + if (!empty($board['link_moderators'])) { |
|
| 191 | + echo ' |
|
| 186 | 192 | <p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>'; |
| 187 | -} |
|
| 193 | + } |
|
| 194 | + } |
|
| 188 | 195 | |
| 189 | 196 | /** |
| 190 | 197 | * Outputs the board stats for a standard board. |
@@ -225,10 +232,11 @@ discard block |
||
| 225 | 232 | */ |
| 226 | 233 | function template_bi_board_lastpost($board) |
| 227 | 234 | { |
| 228 | - if (!empty($board['last_post']['id'])) |
|
| 229 | - echo ' |
|
| 235 | + if (!empty($board['last_post']['id'])) { |
|
| 236 | + echo ' |
|
| 230 | 237 | <p>', $board['last_post']['last_post_message'], '</p>'; |
| 231 | -} |
|
| 238 | + } |
|
| 239 | + } |
|
| 232 | 240 | |
| 233 | 241 | /** |
| 234 | 242 | * Outputs the board children for a standard board. |
@@ -248,14 +256,16 @@ discard block |
||
| 248 | 256 | id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */ |
| 249 | 257 | foreach ($board['children'] as $child) |
| 250 | 258 | { |
| 251 | - if (!$child['is_redirect']) |
|
| 252 | - $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
| 253 | - else |
|
| 254 | - $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
| 259 | + if (!$child['is_redirect']) { |
|
| 260 | + $child['link'] = ''. ($child['new'] ? '<a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span></a>' : '') . '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . '</a>'; |
|
| 261 | + } else { |
|
| 262 | + $child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>'; |
|
| 263 | + } |
|
| 255 | 264 | |
| 256 | 265 | // Has it posts awaiting approval? |
| 257 | - if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) |
|
| 258 | - $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
| 266 | + if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics'])) { |
|
| 267 | + $child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>'; |
|
| 268 | + } |
|
| 259 | 269 | |
| 260 | 270 | $children[] = $child['new'] ? '<span class="strong">' . $child['link'] . '</span>' : '<span>' . $child['link'] . '</span>'; |
| 261 | 271 | } |
@@ -282,8 +292,9 @@ discard block |
||
| 282 | 292 | { |
| 283 | 293 | global $context, $options, $txt; |
| 284 | 294 | |
| 285 | - if (empty($context['info_center'])) |
|
| 286 | - return; |
|
| 295 | + if (empty($context['info_center'])) { |
|
| 296 | + return; |
|
| 297 | + } |
|
| 287 | 298 | |
| 288 | 299 | // Here's where the "Info Center" starts... |
| 289 | 300 | echo ' |
@@ -383,14 +394,15 @@ discard block |
||
| 383 | 394 | /* Each post in latest_posts has: |
| 384 | 395 | board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.), |
| 385 | 396 | subject, short_subject (shortened with...), time, link, and href. */ |
| 386 | - foreach ($context['latest_posts'] as $post) |
|
| 387 | - echo ' |
|
| 397 | + foreach ($context['latest_posts'] as $post) { |
|
| 398 | + echo ' |
|
| 388 | 399 | <tr class="windowbg"> |
| 389 | 400 | <td class="recentpost"><strong>', $post['link'], '</strong></td> |
| 390 | 401 | <td class="recentposter">', $post['poster']['link'], '</td> |
| 391 | 402 | <td class="recentboard">', $post['board']['link'], '</td> |
| 392 | 403 | <td class="recenttime">', $post['time'], '</td> |
| 393 | 404 | </tr>'; |
| 405 | + } |
|
| 394 | 406 | echo ' |
| 395 | 407 | </table>'; |
| 396 | 408 | } |
@@ -414,11 +426,12 @@ discard block |
||
| 414 | 426 | </div>'; |
| 415 | 427 | |
| 416 | 428 | // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P |
| 417 | - if (!empty($context['calendar_holidays'])) |
|
| 418 | - echo ' |
|
| 429 | + if (!empty($context['calendar_holidays'])) { |
|
| 430 | + echo ' |
|
| 419 | 431 | <p class="inline holiday"> |
| 420 | 432 | <span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), ' |
| 421 | 433 | </p>'; |
| 434 | + } |
|
| 422 | 435 | |
| 423 | 436 | // People's birthdays. Like mine. And yours, I guess. Kidding. |
| 424 | 437 | if (!empty($context['calendar_birthdays'])) |
@@ -428,9 +441,10 @@ discard block |
||
| 428 | 441 | <span class="birthday">', $context['calendar_only_today'] ? $txt['birthdays'] : $txt['birthdays_upcoming'], '</span>'; |
| 429 | 442 | |
| 430 | 443 | // Each member in calendar_birthdays has: id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) |
| 431 | - foreach ($context['calendar_birthdays'] as $member) |
|
| 432 | - echo ' |
|
| 444 | + foreach ($context['calendar_birthdays'] as $member) { |
|
| 445 | + echo ' |
|
| 433 | 446 | <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<strong class="fix_rtl_names">' : '', $member['name'], $member['is_today'] ? '</strong>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', '; |
| 447 | + } |
|
| 434 | 448 | |
| 435 | 449 | echo ' |
| 436 | 450 | </p>'; |
@@ -445,9 +459,10 @@ discard block |
||
| 445 | 459 | |
| 446 | 460 | // Each event in calendar_events should have: |
| 447 | 461 | // title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. |
| 448 | - foreach ($context['calendar_events'] as $event) |
|
| 449 | - echo ' |
|
| 462 | + foreach ($context['calendar_events'] as $event) { |
|
| 463 | + echo ' |
|
| 450 | 464 | ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" title="' . $txt['calendar_edit'] . '"><span class="generic_icons calendar_modify"></span></a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<strong>' . $event['title'] . '</strong>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br>' : ', '; |
| 465 | + } |
|
| 451 | 466 | echo ' |
| 452 | 467 | </p>'; |
| 453 | 468 | } |
@@ -493,17 +508,21 @@ discard block |
||
| 493 | 508 | // Handle hidden users and buddies. |
| 494 | 509 | $bracketList = array(); |
| 495 | 510 | |
| 496 | - if ($context['show_buddies']) |
|
| 497 | - $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 511 | + if ($context['show_buddies']) { |
|
| 512 | + $bracketList[] = comma_format($context['num_buddies']) . ' ' . ($context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies']); |
|
| 513 | + } |
|
| 498 | 514 | |
| 499 | - if (!empty($context['num_spiders'])) |
|
| 500 | - $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 515 | + if (!empty($context['num_spiders'])) { |
|
| 516 | + $bracketList[] = comma_format($context['num_spiders']) . ' ' . ($context['num_spiders'] == 1 ? $txt['spider'] : $txt['spiders']); |
|
| 517 | + } |
|
| 501 | 518 | |
| 502 | - if (!empty($context['num_users_hidden'])) |
|
| 503 | - $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
| 519 | + if (!empty($context['num_users_hidden'])) { |
|
| 520 | + $bracketList[] = comma_format($context['num_users_hidden']) . ' ' . ($context['num_spiders'] == 1 ? $txt['hidden'] : $txt['hidden_s']); |
|
| 521 | + } |
|
| 504 | 522 | |
| 505 | - if (!empty($bracketList)) |
|
| 506 | - echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 523 | + if (!empty($bracketList)) { |
|
| 524 | + echo ' (' . implode(', ', $bracketList) . ')'; |
|
| 525 | + } |
|
| 507 | 526 | |
| 508 | 527 | echo $context['show_who'] ? '</a>' : '', ' |
| 509 | 528 | |
@@ -517,9 +536,10 @@ discard block |
||
| 517 | 536 | ', sprintf($txt['users_active'], $modSettings['lastActive']), ': ', implode(', ', $context['list_users_online']); |
| 518 | 537 | |
| 519 | 538 | // Showing membergroups? |
| 520 | - if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) |
|
| 521 | - echo ' |
|
| 539 | + if (!empty($settings['show_group_key']) && !empty($context['membergroups'])) { |
|
| 540 | + echo ' |
|
| 522 | 541 | <span class="membergroups">' . implode(', ', $context['membergroups']) . '</span>'; |
| 542 | + } |
|
| 523 | 543 | } |
| 524 | 544 | |
| 525 | 545 | echo ' |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 4 |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if (!defined('SMF')) |
|
| 18 | +if (!defined('SMF')) { |
|
| 19 | 19 | die('No direct access...'); |
| 20 | +} |
|
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * Main dispatcher. This function checks permissions and passes control through to the relevant section. |
@@ -245,8 +246,9 @@ discard block |
||
| 245 | 246 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 246 | 247 | { |
| 247 | 248 | // Private PM/email subjects and similar shouldn't be shown in the mailbox area. |
| 248 | - if (!empty($row['private'])) |
|
| 249 | - $row['subject'] = $txt['personal_message']; |
|
| 249 | + if (!empty($row['private'])) { |
|
| 250 | + $row['subject'] = $txt['personal_message']; |
|
| 251 | + } |
|
| 250 | 252 | |
| 251 | 253 | $mails[] = $row; |
| 252 | 254 | } |
@@ -300,8 +302,9 @@ discard block |
||
| 300 | 302 | $element = substr($key, strrpos($key, '_') + 1); |
| 301 | 303 | $processedBirthdayEmails[$index][$element] = $value; |
| 302 | 304 | } |
| 303 | - foreach ($processedBirthdayEmails as $index => $dummy) |
|
| 304 | - $emails[$index] = $index; |
|
| 305 | + foreach ($processedBirthdayEmails as $index => $dummy) { |
|
| 306 | + $emails[$index] = $index; |
|
| 307 | + } |
|
| 305 | 308 | |
| 306 | 309 | $config_vars = array( |
| 307 | 310 | // Mail queue stuff, this rocks ;) |
@@ -322,8 +325,9 @@ discard block |
||
| 322 | 325 | |
| 323 | 326 | call_integration_hook('integrate_modify_mail_settings', array(&$config_vars)); |
| 324 | 327 | |
| 325 | - if ($return_config) |
|
| 326 | - return $config_vars; |
|
| 328 | + if ($return_config) { |
|
| 329 | + return $config_vars; |
|
| 330 | + } |
|
| 327 | 331 | |
| 328 | 332 | // Saving? |
| 329 | 333 | if (isset($_GET['save'])) |
@@ -398,9 +402,9 @@ discard block |
||
| 398 | 402 | ); |
| 399 | 403 | list ($_GET['te']) = $smcFunc['db_fetch_row']($request); |
| 400 | 404 | $smcFunc['db_free_result']($request); |
| 405 | + } else { |
|
| 406 | + $_GET['te'] = (int) $_GET['te']; |
|
| 401 | 407 | } |
| 402 | - else |
|
| 403 | - $_GET['te'] = (int) $_GET['te']; |
|
| 404 | 408 | |
| 405 | 409 | $_GET['sent'] = isset($_GET['sent']) ? (int) $_GET['sent'] : 0; |
| 406 | 410 | |
@@ -424,12 +428,14 @@ discard block |
||
| 424 | 428 | |
| 425 | 429 | // Try get more time... |
| 426 | 430 | @set_time_limit(600); |
| 427 | - if (function_exists('apache_reset_timeout')) |
|
| 428 | - @apache_reset_timeout(); |
|
| 431 | + if (function_exists('apache_reset_timeout')) { |
|
| 432 | + @apache_reset_timeout(); |
|
| 433 | + } |
|
| 429 | 434 | |
| 430 | 435 | // Have we already used our maximum time? |
| 431 | - if ((time() - $time_start) < 5) |
|
| 432 | - return; |
|
| 436 | + if ((time() - $time_start) < 5) { |
|
| 437 | + return; |
|
| 438 | + } |
|
| 433 | 439 | |
| 434 | 440 | $context['continue_get_data'] = '?action=admin;area=mailqueue;sa=clear;te=' . $_GET['te'] . ';sent=' . $_GET['sent'] . ';' . $context['session_var'] . '=' . $context['session_id']; |
| 435 | 441 | $context['page_title'] = $txt['not_done_title']; |
@@ -459,8 +465,9 @@ discard block |
||
| 459 | 465 | { |
| 460 | 466 | global $txt; |
| 461 | 467 | |
| 462 | - if ($time_diff < 0) |
|
| 463 | - $time_diff = 0; |
|
| 468 | + if ($time_diff < 0) { |
|
| 469 | + $time_diff = 0; |
|
| 470 | + } |
|
| 464 | 471 | |
| 465 | 472 | // Just do a bit of an if fest... |
| 466 | 473 | if ($time_diff > 86400) |
@@ -481,8 +488,9 @@ discard block |
||
| 481 | 488 | return sprintf($minutes == 1 ? $txt['mq_minute'] : $txt['mq_minutes'], $minutes); |
| 482 | 489 | } |
| 483 | 490 | // Otherwise must be second |
| 484 | - else |
|
| 485 | - return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
| 486 | -} |
|
| 491 | + else { |
|
| 492 | + return sprintf($time_diff == 1 ? $txt['mq_second'] : $txt['mq_seconds'], $time_diff); |
|
| 493 | + } |
|
| 494 | + } |
|
| 487 | 495 | |
| 488 | 496 | ?> |
| 489 | 497 | \ No newline at end of file |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $table = str_replace('{db_prefix}', $db_prefix, $table); |
| 93 | 93 | |
| 94 | - $pg_tables = array('pg_catalog','information_schema'); |
|
| 94 | + $pg_tables = array('pg_catalog', 'information_schema'); |
|
| 95 | 95 | |
| 96 | 96 | $request = $smcFunc['db_query']('', ' |
| 97 | 97 | SELECT pg_relation_size(C.oid) AS "size" |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | global $db_connection; |
| 291 | 291 | static $ver; |
| 292 | 292 | |
| 293 | - if(!empty($ver)) |
|
| 293 | + if (!empty($ver)) |
|
| 294 | 294 | return $ver; |
| 295 | 295 | |
| 296 | 296 | $ver = pg_version($db_connection)['server']; |
@@ -13,8 +13,9 @@ discard block |
||
| 13 | 13 | * @version 2.1 Beta 4 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -if (!defined('SMF')) |
|
| 16 | +if (!defined('SMF')) { |
|
| 17 | 17 | die('No direct access...'); |
| 18 | +} |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Add the functions implemented in this file to the $smcFunc array. |
@@ -23,8 +24,8 @@ discard block |
||
| 23 | 24 | { |
| 24 | 25 | global $smcFunc; |
| 25 | 26 | |
| 26 | - if (!isset($smcFunc['db_backup_table']) || $smcFunc['db_backup_table'] != 'smf_db_backup_table') |
|
| 27 | - $smcFunc += array( |
|
| 27 | + if (!isset($smcFunc['db_backup_table']) || $smcFunc['db_backup_table'] != 'smf_db_backup_table') { |
|
| 28 | + $smcFunc += array( |
|
| 28 | 29 | 'db_backup_table' => 'smf_db_backup_table', |
| 29 | 30 | 'db_optimize_table' => 'smf_db_optimize_table', |
| 30 | 31 | 'db_table_sql' => 'smf_db_table_sql', |
@@ -33,7 +34,8 @@ discard block |
||
| 33 | 34 | 'db_get_vendor' => 'smf_db_get_vendor', |
| 34 | 35 | 'db_allow_persistent' => 'smf_db_allow_persistent', |
| 35 | 36 | ); |
| 36 | -} |
|
| 37 | + } |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | /** |
| 39 | 41 | * Backup $table to $backup_table. |
@@ -49,13 +51,14 @@ discard block |
||
| 49 | 51 | |
| 50 | 52 | // Do we need to drop it first? |
| 51 | 53 | $tables = smf_db_list_tables(false, $backup_table); |
| 52 | - if (!empty($tables)) |
|
| 53 | - $smcFunc['db_query']('', ' |
|
| 54 | + if (!empty($tables)) { |
|
| 55 | + $smcFunc['db_query']('', ' |
|
| 54 | 56 | DROP TABLE {raw:backup_table}', |
| 55 | 57 | array( |
| 56 | 58 | 'backup_table' => $backup_table, |
| 57 | 59 | ) |
| 58 | 60 | ); |
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | /** |
| 61 | 64 | * @todo Should we create backups of sequences as well? |
@@ -118,8 +121,9 @@ discard block |
||
| 118 | 121 | ) |
| 119 | 122 | ); |
| 120 | 123 | |
| 121 | - if (!$request) |
|
| 122 | - return -1; |
|
| 124 | + if (!$request) { |
|
| 125 | + return -1; |
|
| 126 | + } |
|
| 123 | 127 | |
| 124 | 128 | $request = $smcFunc['db_query']('', ' |
| 125 | 129 | SELECT pg_relation_size(C.oid) AS "size" |
@@ -137,11 +141,12 @@ discard block |
||
| 137 | 141 | $row = $smcFunc['db_fetch_assoc']($request); |
| 138 | 142 | $smcFunc['db_free_result']($request); |
| 139 | 143 | |
| 140 | - if (isset($row['size'])) |
|
| 141 | - return ($old_size - $row['size']) / 1024; |
|
| 142 | - else |
|
| 143 | - return 0; |
|
| 144 | -} |
|
| 144 | + if (isset($row['size'])) { |
|
| 145 | + return ($old_size - $row['size']) / 1024; |
|
| 146 | + } else { |
|
| 147 | + return 0; |
|
| 148 | + } |
|
| 149 | + } |
|
| 145 | 150 | |
| 146 | 151 | /** |
| 147 | 152 | * This function lists all tables in the database. |
@@ -168,8 +173,9 @@ discard block |
||
| 168 | 173 | ); |
| 169 | 174 | |
| 170 | 175 | $tables = array(); |
| 171 | - while ($row = $smcFunc['db_fetch_row']($request)) |
|
| 172 | - $tables[] = $row[0]; |
|
| 176 | + while ($row = $smcFunc['db_fetch_row']($request)) { |
|
| 177 | + $tables[] = $row[0]; |
|
| 178 | + } |
|
| 173 | 179 | $smcFunc['db_free_result']($request); |
| 174 | 180 | |
| 175 | 181 | return $tables; |
@@ -210,12 +216,14 @@ discard block |
||
| 210 | 216 | ); |
| 211 | 217 | while ($row = $smcFunc['db_fetch_assoc']($result)) |
| 212 | 218 | { |
| 213 | - if ($row['data_type'] == 'character varying') |
|
| 214 | - $row['data_type'] = 'varchar'; |
|
| 215 | - elseif ($row['data_type'] == 'character') |
|
| 216 | - $row['data_type'] = 'char'; |
|
| 217 | - if ($row['character_maximum_length']) |
|
| 218 | - $row['data_type'] .= '(' . $row['character_maximum_length'] . ')'; |
|
| 219 | + if ($row['data_type'] == 'character varying') { |
|
| 220 | + $row['data_type'] = 'varchar'; |
|
| 221 | + } elseif ($row['data_type'] == 'character') { |
|
| 222 | + $row['data_type'] = 'char'; |
|
| 223 | + } |
|
| 224 | + if ($row['character_maximum_length']) { |
|
| 225 | + $row['data_type'] .= '(' . $row['character_maximum_length'] . ')'; |
|
| 226 | + } |
|
| 219 | 227 | |
| 220 | 228 | // Make the CREATE for this column. |
| 221 | 229 | $schema_create .= ' "' . $row['column_name'] . '" ' . $row['data_type'] . ($row['is_nullable'] != 'YES' ? ' NOT NULL' : ''); |
@@ -266,13 +274,14 @@ discard block |
||
| 266 | 274 | { |
| 267 | 275 | if ($row['is_primary']) |
| 268 | 276 | { |
| 269 | - if (preg_match('~\(([^\)]+?)\)~i', $row['inddef'], $matches) == 0) |
|
| 270 | - continue; |
|
| 277 | + if (preg_match('~\(([^\)]+?)\)~i', $row['inddef'], $matches) == 0) { |
|
| 278 | + continue; |
|
| 279 | + } |
|
| 271 | 280 | |
| 272 | 281 | $index_create .= $crlf . 'ALTER TABLE ' . $tableName . ' ADD PRIMARY KEY ("' . $matches[1] . '");'; |
| 282 | + } else { |
|
| 283 | + $index_create .= $crlf . $row['inddef'] . ';'; |
|
| 273 | 284 | } |
| 274 | - else |
|
| 275 | - $index_create .= $crlf . $row['inddef'] . ';'; |
|
| 276 | 285 | } |
| 277 | 286 | $smcFunc['db_free_result']($result); |
| 278 | 287 | |
@@ -291,8 +300,9 @@ discard block |
||
| 291 | 300 | global $db_connection; |
| 292 | 301 | static $ver; |
| 293 | 302 | |
| 294 | - if(!empty($ver)) |
|
| 295 | - return $ver; |
|
| 303 | + if(!empty($ver)) { |
|
| 304 | + return $ver; |
|
| 305 | + } |
|
| 296 | 306 | |
| 297 | 307 | $ver = pg_version($db_connection)['server']; |
| 298 | 308 | |
@@ -317,10 +327,11 @@ discard block |
||
| 317 | 327 | function smf_db_allow_persistent() |
| 318 | 328 | { |
| 319 | 329 | $value = ini_get('pgsql.allow_persistent'); |
| 320 | - if (strtolower($value) == 'on' || strtolower($value) == 'true' || $value == '1') |
|
| 321 | - return true; |
|
| 322 | - else |
|
| 323 | - return false; |
|
| 324 | -} |
|
| 330 | + if (strtolower($value) == 'on' || strtolower($value) == 'true' || $value == '1') { |
|
| 331 | + return true; |
|
| 332 | + } else { |
|
| 333 | + return false; |
|
| 334 | + } |
|
| 335 | + } |
|
| 325 | 336 | |
| 326 | 337 | ?> |
| 327 | 338 | \ No newline at end of file |
@@ -18,9 +18,10 @@ discard block |
||
| 18 | 18 | global $context, $txt, $scripturl; |
| 19 | 19 | |
| 20 | 20 | // Are we done sending the newsletter? |
| 21 | - if (!empty($context['newsletter_sent'])) |
|
| 22 | - echo ' |
|
| 21 | + if (!empty($context['newsletter_sent'])) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <div class="infobox">', $txt['admin_news_newsletter_' . $context['newsletter_sent']], '</div>'; |
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | echo ' |
| 26 | 27 | <div id="admincenter"> |
@@ -39,9 +40,10 @@ discard block |
||
| 39 | 40 | </dt> |
| 40 | 41 | <dd>'; |
| 41 | 42 | |
| 42 | - foreach ($context['groups'] as $group) |
|
| 43 | - echo ' |
|
| 43 | + foreach ($context['groups'] as $group) { |
|
| 44 | + echo ' |
|
| 44 | 45 | <label for="groups_', $group['id'], '"><input type="checkbox" name="groups[', $group['id'], ']" id="groups_', $group['id'], '" value="', $group['id'], '" checked> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | echo ' |
| 47 | 49 | <br> |
@@ -82,9 +84,10 @@ discard block |
||
| 82 | 84 | </dt> |
| 83 | 85 | <dd>'; |
| 84 | 86 | |
| 85 | - foreach ($context['groups'] as $group) |
|
| 86 | - echo ' |
|
| 87 | + foreach ($context['groups'] as $group) { |
|
| 88 | + echo ' |
|
| 87 | 89 | <label for="exclude_groups_', $group['id'], '"><input type="checkbox" name="exclude_groups[', $group['id'], ']" id="exclude_groups_', $group['id'], '" value="', $group['id'], '"> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em><br>'; |
| 90 | + } |
|
| 88 | 91 | |
| 89 | 92 | echo ' |
| 90 | 93 | <br> |
@@ -230,9 +233,10 @@ discard block |
||
| 230 | 233 | <div id="bbcBox_message"></div>'; |
| 231 | 234 | |
| 232 | 235 | // What about smileys? |
| 233 | - if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) |
|
| 234 | - echo ' |
|
| 236 | + if (!empty($context['smileys']['postform']) || !empty($context['smileys']['popup'])) { |
|
| 237 | + echo ' |
|
| 235 | 238 | <div id="smileyBox_message"></div>'; |
| 239 | + } |
|
| 236 | 240 | |
| 237 | 241 | // Show BBC buttons, smileys and textbox. |
| 238 | 242 | echo ' |
@@ -253,9 +257,10 @@ discard block |
||
| 253 | 257 | <input type="hidden" name="email_force" value="', $context['email_force'], '"> |
| 254 | 258 | <input type="hidden" name="total_emails" value="', $context['total_emails'], '">'; |
| 255 | 259 | |
| 256 | - foreach ($context['recipients'] as $key => $values) |
|
| 257 | - echo ' |
|
| 260 | + foreach ($context['recipients'] as $key => $values) { |
|
| 261 | + echo ' |
|
| 258 | 262 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
| 263 | + } |
|
| 259 | 264 | |
| 260 | 265 | echo ' |
| 261 | 266 | <script>'; |
@@ -411,9 +416,10 @@ discard block |
||
| 411 | 416 | <input type="hidden" name="parse_html" value="', $context['parse_html'], '">'; |
| 412 | 417 | |
| 413 | 418 | // All the things we must remember! |
| 414 | - foreach ($context['recipients'] as $key => $values) |
|
| 415 | - echo ' |
|
| 419 | + foreach ($context['recipients'] as $key => $values) { |
|
| 420 | + echo ' |
|
| 416 | 421 | <input type="hidden" name="', $key, '" value="', implode(($key == 'emails' ? ';' : ','), $values), '">'; |
| 422 | + } |
|
| 417 | 423 | |
| 418 | 424 | echo ' |
| 419 | 425 | </div><!-- .windowbg --> |
@@ -446,9 +452,10 @@ discard block |
||
| 446 | 452 | { |
| 447 | 453 | global $context, $txt; |
| 448 | 454 | |
| 449 | - if (!empty($context['saved_successful'])) |
|
| 450 | - echo ' |
|
| 455 | + if (!empty($context['saved_successful'])) { |
|
| 456 | + echo ' |
|
| 451 | 457 | <div class="infobox">', $txt['settings_saved'], '</div>'; |
| 458 | + } |
|
| 452 | 459 | |
| 453 | 460 | template_show_list('news_lists'); |
| 454 | 461 | } |
@@ -44,10 +44,11 @@ discard block |
||
| 44 | 44 | <dt>', $txt['users_online_today'], ':</dt> |
| 45 | 45 | <dd>', $context['online_today'], '</dd>'; |
| 46 | 46 | |
| 47 | - if (!empty($modSettings['hitStats'])) |
|
| 48 | - echo ' |
|
| 47 | + if (!empty($modSettings['hitStats'])) { |
|
| 48 | + echo ' |
|
| 49 | 49 | <dt>', $txt['num_hits'], ':</dt> |
| 50 | 50 | <dd>', $context['num_hits'], '</dd>'; |
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | echo ' |
| 53 | 54 | </dl> |
@@ -71,17 +72,19 @@ discard block |
||
| 71 | 72 | <dt>', $txt['gender_stats'], ':</dt> |
| 72 | 73 | <dd>'; |
| 73 | 74 | |
| 74 | - foreach ($context['gender'] as $g => $n) |
|
| 75 | - echo $g, ': ', $n, '<br>'; |
|
| 75 | + foreach ($context['gender'] as $g => $n) { |
|
| 76 | + echo $g, ': ', $n, '<br>'; |
|
| 77 | + } |
|
| 76 | 78 | |
| 77 | 79 | echo ' |
| 78 | 80 | </dd>'; |
| 79 | 81 | } |
| 80 | 82 | |
| 81 | - if (!empty($modSettings['hitStats'])) |
|
| 82 | - echo ' |
|
| 83 | + if (!empty($modSettings['hitStats'])) { |
|
| 84 | + echo ' |
|
| 83 | 85 | <dt>', $txt['average_hits'], ':</dt> |
| 84 | 86 | <dd>', $context['average_hits'], '</dd>'; |
| 87 | + } |
|
| 85 | 88 | |
| 86 | 89 | echo ' |
| 87 | 90 | </dl>'; |
@@ -105,14 +108,15 @@ discard block |
||
| 105 | 108 | </dt> |
| 106 | 109 | <dd class="statsbar">'; |
| 107 | 110 | |
| 108 | - if (!empty($item['percent'])) |
|
| 109 | - echo ' |
|
| 111 | + if (!empty($item['percent'])) { |
|
| 112 | + echo ' |
|
| 110 | 113 | <div class="bar" style="width: ', $item['percent'], '%;"> |
| 111 | 114 | <span class="righttext">', $item['num'], '</span> |
| 112 | 115 | </div>'; |
| 113 | - else |
|
| 114 | - echo ' |
|
| 116 | + } else { |
|
| 117 | + echo ' |
|
| 115 | 118 | <div class="bar empty"><span class="righttext">', $item['num'], '</span></div>'; |
| 119 | + } |
|
| 116 | 120 | |
| 117 | 121 | echo ' |
| 118 | 122 | </dd>'; |
@@ -144,9 +148,10 @@ discard block |
||
| 144 | 148 | <th>', $txt['stats_new_members'], '</th> |
| 145 | 149 | <th>', $txt['most_online'], '</th>'; |
| 146 | 150 | |
| 147 | - if (!empty($modSettings['hitStats'])) |
|
| 148 | - echo ' |
|
| 151 | + if (!empty($modSettings['hitStats'])) { |
|
| 152 | + echo ' |
|
| 149 | 153 | <th>', $txt['page_views'], '</th>'; |
| 154 | + } |
|
| 150 | 155 | |
| 151 | 156 | echo ' |
| 152 | 157 | </tr> |
@@ -165,9 +170,10 @@ discard block |
||
| 165 | 170 | <th>', $year['new_members'], '</th> |
| 166 | 171 | <th>', $year['most_members_online'], '</th>'; |
| 167 | 172 | |
| 168 | - if (!empty($modSettings['hitStats'])) |
|
| 169 | - echo ' |
|
| 173 | + if (!empty($modSettings['hitStats'])) { |
|
| 174 | + echo ' |
|
| 170 | 175 | <th>', $year['hits'], '</th>'; |
| 176 | + } |
|
| 171 | 177 | |
| 172 | 178 | echo ' |
| 173 | 179 | </tr>'; |
@@ -184,9 +190,10 @@ discard block |
||
| 184 | 190 | <th>', $month['new_members'], '</th> |
| 185 | 191 | <th>', $month['most_members_online'], '</th>'; |
| 186 | 192 | |
| 187 | - if (!empty($modSettings['hitStats'])) |
|
| 188 | - echo ' |
|
| 193 | + if (!empty($modSettings['hitStats'])) { |
|
| 194 | + echo ' |
|
| 189 | 195 | <th>', $month['hits'], '</th>'; |
| 196 | + } |
|
| 190 | 197 | |
| 191 | 198 | echo ' |
| 192 | 199 | </tr>'; |
@@ -203,9 +210,10 @@ discard block |
||
| 203 | 210 | <td>', $day['new_members'], '</td> |
| 204 | 211 | <td>', $day['most_members_online'], '</td>'; |
| 205 | 212 | |
| 206 | - if (!empty($modSettings['hitStats'])) |
|
| 207 | - echo ' |
|
| 213 | + if (!empty($modSettings['hitStats'])) { |
|
| 214 | + echo ' |
|
| 208 | 215 | <td>', $day['hits'], '</td>'; |
| 216 | + } |
|
| 209 | 217 | |
| 210 | 218 | echo ' |
| 211 | 219 | </tr>'; |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | <h3 class="catbg">', $context['page_title'], '</h3> |
| 47 | 47 | </div>'; |
| 48 | 48 | |
| 49 | - if (!empty($context['poll_error']['messages'])) |
|
| 50 | - echo ' |
|
| 49 | + if (!empty($context['poll_error']['messages'])) { |
|
| 50 | + echo ' |
|
| 51 | 51 | <div class="errorbox"> |
| 52 | 52 | <dl class="poll_error"> |
| 53 | 53 | <dt> |
@@ -58,6 +58,7 @@ discard block |
||
| 58 | 58 | </dt> |
| 59 | 59 | </dl> |
| 60 | 60 | </div>'; |
| 61 | + } |
|
| 61 | 62 | |
| 62 | 63 | echo ' |
| 63 | 64 | <div> |
@@ -79,8 +80,9 @@ discard block |
||
| 79 | 80 | <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" size="80" maxlength="255">'; |
| 80 | 81 | |
| 81 | 82 | // Does this option have a vote count yet, or is it new? |
| 82 | - if ($choice['votes'] != -1) |
|
| 83 | - echo ' (', $choice['votes'], ' ', $txt['votes'], ')'; |
|
| 83 | + if ($choice['votes'] != -1) { |
|
| 84 | + echo ' (', $choice['votes'], ' ', $txt['votes'], ')'; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | 87 | echo ' |
| 86 | 88 | </dd>'; |
@@ -118,14 +120,15 @@ discard block |
||
| 118 | 120 | <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked' : '', '> |
| 119 | 121 | </dd>'; |
| 120 | 122 | |
| 121 | - if ($context['poll']['guest_vote_allowed']) |
|
| 122 | - echo ' |
|
| 123 | + if ($context['poll']['guest_vote_allowed']) { |
|
| 124 | + echo ' |
|
| 123 | 125 | <dt> |
| 124 | 126 | <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label> |
| 125 | 127 | </dt> |
| 126 | 128 | <dd> |
| 127 | 129 | <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll']['guest_vote']) ? ' checked' : '', '> |
| 128 | 130 | </dd>'; |
| 131 | + } |
|
| 129 | 132 | } |
| 130 | 133 | |
| 131 | 134 | echo ' |
@@ -141,12 +144,13 @@ discard block |
||
| 141 | 144 | </fieldset>'; |
| 142 | 145 | |
| 143 | 146 | // If this is an edit, we can allow them to reset the vote counts. |
| 144 | - if ($context['is_edit']) |
|
| 145 | - echo ' |
|
| 147 | + if ($context['is_edit']) { |
|
| 148 | + echo ' |
|
| 146 | 149 | <fieldset id="poll_reset"> |
| 147 | 150 | <legend>', $txt['reset_votes'], '</legend> |
| 148 | 151 | <input type="checkbox" name="resetVoteCount" value="on"> ' . $txt['reset_votes_check'] . ' |
| 149 | 152 | </fieldset>'; |
| 153 | + } |
|
| 150 | 154 | echo ' |
| 151 | 155 | <input type="submit" name="post" value="', $txt['save'], '" onclick="return submitThisOnce(this);" accesskey="s" class="button"> |
| 152 | 156 | </div><!-- .roundframe --> |