@@ -19,8 +19,9 @@ discard block |
||
| 19 | 19 | * @version 2.1 Beta 3 |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | -if (!defined('SMF')) |
|
| 22 | +if (!defined('SMF')) { |
|
| 23 | 23 | die('No direct access...'); |
| 24 | +} |
|
| 24 | 25 | |
| 25 | 26 | /** |
| 26 | 27 | * Class gif_lzw_compression |
@@ -52,13 +53,15 @@ discard block |
||
| 52 | 53 | |
| 53 | 54 | $this->LZWCommand($data, true); |
| 54 | 55 | |
| 55 | - while (($iIndex = $this->LZWCommand($data, false)) >= 0) |
|
| 56 | - $ret .= chr($iIndex); |
|
| 56 | + while (($iIndex = $this->LZWCommand($data, false)) >= 0) { |
|
| 57 | + $ret .= chr($iIndex); |
|
| 58 | + } |
|
| 57 | 59 | |
| 58 | 60 | $datLen = $stLen - strlen($data); |
| 59 | 61 | |
| 60 | - if ($iIndex != -2) |
|
| 61 | - return false; |
|
| 62 | + if ($iIndex != -2) { |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 62 | 65 | |
| 63 | 66 | return $ret; |
| 64 | 67 | } |
@@ -140,8 +143,9 @@ discard block |
||
| 140 | 143 | return $this->FirstCode; |
| 141 | 144 | } |
| 142 | 145 | |
| 143 | - if ($Code == $this->EndCode) |
|
| 144 | - return -2; |
|
| 146 | + if ($Code == $this->EndCode) { |
|
| 147 | + return -2; |
|
| 148 | + } |
|
| 145 | 149 | |
| 146 | 150 | $InCode = $Code; |
| 147 | 151 | if ($Code >= $this->MaxCode) |
@@ -156,8 +160,10 @@ discard block |
||
| 156 | 160 | $this->Stack[$this->sp] = $this->Vals[$Code]; |
| 157 | 161 | $this->sp++; |
| 158 | 162 | |
| 159 | - if ($Code == $this->Next[$Code]) // Circular table entry, big GIF Error! |
|
| 163 | + if ($Code == $this->Next[$Code]) { |
|
| 164 | + // Circular table entry, big GIF Error! |
|
| 160 | 165 | return -1; |
| 166 | + } |
|
| 161 | 167 | |
| 162 | 168 | $Code = $this->Next[$Code]; |
| 163 | 169 | } |
@@ -207,8 +213,9 @@ discard block |
||
| 207 | 213 | if ($this->Done) |
| 208 | 214 | { |
| 209 | 215 | // Ran off the end of my bits... |
| 210 | - if ($this->CurBit >= $this->LastBit) |
|
| 211 | - return 0; |
|
| 216 | + if ($this->CurBit >= $this->LastBit) { |
|
| 217 | + return 0; |
|
| 218 | + } |
|
| 212 | 219 | |
| 213 | 220 | return -1; |
| 214 | 221 | } |
@@ -221,13 +228,14 @@ discard block |
||
| 221 | 228 | |
| 222 | 229 | if ($count) |
| 223 | 230 | { |
| 224 | - for ($i = 0; $i < $count; $i++) |
|
| 225 | - $this->Buf[2 + $i] = ord($data{$i}); |
|
| 231 | + for ($i = 0; $i < $count; $i++) { |
|
| 232 | + $this->Buf[2 + $i] = ord($data{$i}); |
|
| 233 | + } |
|
| 226 | 234 | |
| 227 | 235 | $data = substr($data, $count); |
| 236 | + } else { |
|
| 237 | + $this->Done = 1; |
|
| 228 | 238 | } |
| 229 | - else |
|
| 230 | - $this->Done = 1; |
|
| 231 | 239 | |
| 232 | 240 | $this->LastByte = 2 + $count; |
| 233 | 241 | $this->CurBit = ($this->CurBit - $this->LastBit) + 16; |
@@ -235,8 +243,9 @@ discard block |
||
| 235 | 243 | } |
| 236 | 244 | |
| 237 | 245 | $iRet = 0; |
| 238 | - for ($i = $this->CurBit, $j = 0; $j < $this->CodeSize; $i++, $j++) |
|
| 239 | - $iRet |= (($this->Buf[intval($i / 8)] & (1 << ($i % 8))) != 0) << $j; |
|
| 246 | + for ($i = $this->CurBit, $j = 0; $j < $this->CodeSize; $i++, $j++) { |
|
| 247 | + $iRet |= (($this->Buf[intval($i / 8)] & (1 << ($i % 8))) != 0) << $j; |
|
| 248 | + } |
|
| 240 | 249 | |
| 241 | 250 | $this->CurBit += $this->CodeSize; |
| 242 | 251 | return $iRet; |
@@ -261,8 +270,9 @@ discard block |
||
| 261 | 270 | for ($i = 0; $i < $num; $i++) |
| 262 | 271 | { |
| 263 | 272 | $rgb = substr($lpData, $i * 3, 3); |
| 264 | - if (strlen($rgb) < 3) |
|
| 265 | - return false; |
|
| 273 | + if (strlen($rgb) < 3) { |
|
| 274 | + return false; |
|
| 275 | + } |
|
| 266 | 276 | |
| 267 | 277 | $this->m_arColors[] = (ord($rgb[2]) << 16) + (ord($rgb[1]) << 8) + ord($rgb[0]); |
| 268 | 278 | $this->m_nColors++; |
@@ -329,13 +339,15 @@ discard block |
||
| 329 | 339 | $hdrLen = 0; |
| 330 | 340 | |
| 331 | 341 | $this->m_lpVer = substr($lpData, 0, 6); |
| 332 | - if (($this->m_lpVer != 'GIF87a') && ($this->m_lpVer != 'GIF89a')) |
|
| 333 | - return false; |
|
| 342 | + if (($this->m_lpVer != 'GIF87a') && ($this->m_lpVer != 'GIF89a')) { |
|
| 343 | + return false; |
|
| 344 | + } |
|
| 334 | 345 | |
| 335 | 346 | list ($this->m_nWidth, $this->m_nHeight) = array_values(unpack('v2', substr($lpData, 6, 4))); |
| 336 | 347 | |
| 337 | - if (!$this->m_nWidth || !$this->m_nHeight) |
|
| 338 | - return false; |
|
| 348 | + if (!$this->m_nWidth || !$this->m_nHeight) { |
|
| 349 | + return false; |
|
| 350 | + } |
|
| 339 | 351 | |
| 340 | 352 | $b = ord(substr($lpData, 10, 1)); |
| 341 | 353 | $this->m_bGlobalClr = ($b & 0x80) ? true : false; |
@@ -349,8 +361,9 @@ discard block |
||
| 349 | 361 | if ($this->m_bGlobalClr) |
| 350 | 362 | { |
| 351 | 363 | $this->m_colorTable = new gif_color_table(); |
| 352 | - if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) |
|
| 353 | - return false; |
|
| 364 | + if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) { |
|
| 365 | + return false; |
|
| 366 | + } |
|
| 354 | 367 | |
| 355 | 368 | $hdrLen += 3 * $this->m_nTableSize; |
| 356 | 369 | } |
@@ -377,8 +390,9 @@ discard block |
||
| 377 | 390 | // Get the width/height/etc. from the header. |
| 378 | 391 | list ($this->m_nLeft, $this->m_nTop, $this->m_nWidth, $this->m_nHeight) = array_values(unpack('v4', substr($lpData, 0, 8))); |
| 379 | 392 | |
| 380 | - if (!$this->m_nWidth || !$this->m_nHeight) |
|
| 381 | - return false; |
|
| 393 | + if (!$this->m_nWidth || !$this->m_nHeight) { |
|
| 394 | + return false; |
|
| 395 | + } |
|
| 382 | 396 | |
| 383 | 397 | $b = ord($lpData[8]); |
| 384 | 398 | $this->m_bLocalClr = ($b & 0x80) ? true : false; |
@@ -390,8 +404,9 @@ discard block |
||
| 390 | 404 | if ($this->m_bLocalClr) |
| 391 | 405 | { |
| 392 | 406 | $this->m_colorTable = new gif_color_table(); |
| 393 | - if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) |
|
| 394 | - return false; |
|
| 407 | + if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) { |
|
| 408 | + return false; |
|
| 409 | + } |
|
| 395 | 410 | |
| 396 | 411 | $hdrLen += 3 * $this->m_nTableSize; |
| 397 | 412 | } |
@@ -427,8 +442,9 @@ discard block |
||
| 427 | 442 | // Extension... |
| 428 | 443 | case 0x21: |
| 429 | 444 | $len = 0; |
| 430 | - if (!$this->skipExt($data, $len)) |
|
| 431 | - return false; |
|
| 445 | + if (!$this->skipExt($data, $len)) { |
|
| 446 | + return false; |
|
| 447 | + } |
|
| 432 | 448 | |
| 433 | 449 | $datLen += $len; |
| 434 | 450 | break; |
@@ -437,21 +453,24 @@ discard block |
||
| 437 | 453 | case 0x2C: |
| 438 | 454 | // Load the header and color table. |
| 439 | 455 | $len = 0; |
| 440 | - if (!$this->m_gih->load($data, $len)) |
|
| 441 | - return false; |
|
| 456 | + if (!$this->m_gih->load($data, $len)) { |
|
| 457 | + return false; |
|
| 458 | + } |
|
| 442 | 459 | |
| 443 | 460 | $data = substr($data, $len); |
| 444 | 461 | $datLen += $len; |
| 445 | 462 | |
| 446 | 463 | // Decompress the data, and ride on home ;). |
| 447 | 464 | $len = 0; |
| 448 | - if (!($this->m_data = $this->m_lzw->decompress($data, $len))) |
|
| 449 | - return false; |
|
| 465 | + if (!($this->m_data = $this->m_lzw->decompress($data, $len))) { |
|
| 466 | + return false; |
|
| 467 | + } |
|
| 450 | 468 | |
| 451 | 469 | $datLen += $len; |
| 452 | 470 | |
| 453 | - if ($this->m_gih->m_bInterlace) |
|
| 454 | - $this->deInterlace(); |
|
| 471 | + if ($this->m_gih->m_bInterlace) { |
|
| 472 | + $this->deInterlace(); |
|
| 473 | + } |
|
| 455 | 474 | |
| 456 | 475 | return true; |
| 457 | 476 | |
@@ -571,17 +590,20 @@ discard block |
||
| 571 | 590 | |
| 572 | 591 | public function loadFile($filename, $iIndex) |
| 573 | 592 | { |
| 574 | - if ($iIndex < 0) |
|
| 575 | - return false; |
|
| 593 | + if ($iIndex < 0) { |
|
| 594 | + return false; |
|
| 595 | + } |
|
| 576 | 596 | |
| 577 | 597 | $this->data = @file_get_contents($filename); |
| 578 | - if ($this->data === false) |
|
| 579 | - return false; |
|
| 598 | + if ($this->data === false) { |
|
| 599 | + return false; |
|
| 600 | + } |
|
| 580 | 601 | |
| 581 | 602 | // Tell the header to load up.... |
| 582 | 603 | $len = 0; |
| 583 | - if (!$this->header->load($this->data, $len)) |
|
| 584 | - return false; |
|
| 604 | + if (!$this->header->load($this->data, $len)) { |
|
| 605 | + return false; |
|
| 606 | + } |
|
| 585 | 607 | |
| 586 | 608 | $this->data = substr($this->data, $len); |
| 587 | 609 | |
@@ -589,8 +611,9 @@ discard block |
||
| 589 | 611 | for ($j = 0; $j <= $iIndex; $j++) |
| 590 | 612 | { |
| 591 | 613 | $imgLen = 0; |
| 592 | - if (!$this->image->load($this->data, $imgLen)) |
|
| 593 | - return false; |
|
| 614 | + if (!$this->image->load($this->data, $imgLen)) { |
|
| 615 | + return false; |
|
| 616 | + } |
|
| 594 | 617 | |
| 595 | 618 | $this->data = substr($this->data, $imgLen); |
| 596 | 619 | } |
@@ -601,8 +624,9 @@ discard block |
||
| 601 | 624 | |
| 602 | 625 | public function get_png_data($background_color) |
| 603 | 626 | { |
| 604 | - if (!$this->loaded) |
|
| 605 | - return false; |
|
| 627 | + if (!$this->loaded) { |
|
| 628 | + return false; |
|
| 629 | + } |
|
| 606 | 630 | |
| 607 | 631 | // Prepare the color table. |
| 608 | 632 | if ($this->image->m_gih->m_bLocalClr) |
@@ -610,25 +634,26 @@ discard block |
||
| 610 | 634 | $colors = $this->image->m_gih->m_nTableSize; |
| 611 | 635 | $pal = $this->image->m_gih->m_colorTable->toString(); |
| 612 | 636 | |
| 613 | - if ($background_color != -1) |
|
| 614 | - $background_color = $this->image->m_gih->m_colorTable->colorIndex($background_color); |
|
| 615 | - } |
|
| 616 | - elseif ($this->header->m_bGlobalClr) |
|
| 637 | + if ($background_color != -1) { |
|
| 638 | + $background_color = $this->image->m_gih->m_colorTable->colorIndex($background_color); |
|
| 639 | + } |
|
| 640 | + } elseif ($this->header->m_bGlobalClr) |
|
| 617 | 641 | { |
| 618 | 642 | $colors = $this->header->m_nTableSize; |
| 619 | 643 | $pal = $this->header->m_colorTable->toString(); |
| 620 | 644 | |
| 621 | - if ($background_color != -1) |
|
| 622 | - $background_color = $this->header->m_colorTable->colorIndex($background_color); |
|
| 623 | - } |
|
| 624 | - else |
|
| 645 | + if ($background_color != -1) { |
|
| 646 | + $background_color = $this->header->m_colorTable->colorIndex($background_color); |
|
| 647 | + } |
|
| 648 | + } else |
|
| 625 | 649 | { |
| 626 | 650 | $colors = 0; |
| 627 | 651 | $background_color = -1; |
| 628 | 652 | } |
| 629 | 653 | |
| 630 | - if ($background_color == -1) |
|
| 631 | - $background_color = $this->header->m_nBgColor; |
|
| 654 | + if ($background_color == -1) { |
|
| 655 | + $background_color = $this->header->m_nBgColor; |
|
| 656 | + } |
|
| 632 | 657 | |
| 633 | 658 | $data = &$this->image->m_data; |
| 634 | 659 | $header = &$this->image->m_gih; |
@@ -644,11 +669,13 @@ discard block |
||
| 644 | 669 | for ($x = 0; $x < $this->header->m_nWidth; $x++, $i++) |
| 645 | 670 | { |
| 646 | 671 | // Is this in the proper range? If so, get the specific pixel data... |
| 647 | - if ($x >= $header->m_nLeft && $y >= $header->m_nTop && $x < ($header->m_nLeft + $header->m_nWidth) && $y < ($header->m_nTop + $header->m_nHeight)) |
|
| 648 | - $bmp .= $data{$i}; |
|
| 672 | + if ($x >= $header->m_nLeft && $y >= $header->m_nTop && $x < ($header->m_nLeft + $header->m_nWidth) && $y < ($header->m_nTop + $header->m_nHeight)) { |
|
| 673 | + $bmp .= $data{$i}; |
|
| 674 | + } |
|
| 649 | 675 | // Otherwise, this is background... |
| 650 | - else |
|
| 651 | - $bmp .= chr($background_color); |
|
| 676 | + else { |
|
| 677 | + $bmp .= chr($background_color); |
|
| 678 | + } |
|
| 652 | 679 | } |
| 653 | 680 | } |
| 654 | 681 | |
@@ -677,8 +704,9 @@ discard block |
||
| 677 | 704 | $tmp = 'tRNS'; |
| 678 | 705 | |
| 679 | 706 | // Stick each color on - full transparency or none. |
| 680 | - for ($i = 0; $i < $colors; $i++) |
|
| 681 | - $tmp .= $i == $this->image->m_nTrans ? "\x00" : "\xFF"; |
|
| 707 | + for ($i = 0; $i < $colors; $i++) { |
|
| 708 | + $tmp .= $i == $this->image->m_nTrans ? "\x00" : "\xFF"; |
|
| 709 | + } |
|
| 682 | 710 | |
| 683 | 711 | $out .= $tmp . pack('N', smf_crc32($tmp)); |
| 684 | 712 | } |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -1,9 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Try to handle it with the upper level index.php. (it should know what to do.) |
| 4 | -if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) |
|
| 4 | +if (file_exists(dirname(dirname(__FILE__)) . '/index.php')) { |
|
| 5 | 5 | include (dirname(dirname(__FILE__)) . '/index.php'); |
| 6 | -else |
|
| 6 | +} else { |
|
| 7 | 7 | exit; |
| 8 | +} |
|
| 8 | 9 | |
| 9 | 10 | ?> |
| 10 | 11 | \ No newline at end of file |
@@ -12,7 +12,8 @@ |
||
| 12 | 12 | header('Location: ' . $boardurl); |
| 13 | 13 | } |
| 14 | 14 | // Can't find it... just forget it. |
| 15 | -else |
|
| 15 | +else { |
|
| 16 | 16 | exit; |
| 17 | +} |
|
| 17 | 18 | |
| 18 | 19 | ?> |
| 19 | 20 | \ No newline at end of file |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 3 |
| 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 | * Creates a wave file that spells the letters of $word. |
@@ -32,8 +33,9 @@ discard block |
||
| 32 | 33 | global $settings, $user_info; |
| 33 | 34 | |
| 34 | 35 | // Allow max 2 requests per 20 seconds. |
| 35 | - if (($ip = cache_get_data('wave_file/' . $user_info['ip'], 20)) > 2 || ($ip2 = cache_get_data('wave_file/' . $user_info['ip2'], 20)) > 2) |
|
| 36 | - die(header('HTTP/1.1 400 Bad Request')); |
|
| 36 | + if (($ip = cache_get_data('wave_file/' . $user_info['ip'], 20)) > 2 || ($ip2 = cache_get_data('wave_file/' . $user_info['ip2'], 20)) > 2) { |
|
| 37 | + die(header('HTTP/1.1 400 Bad Request')); |
|
| 38 | + } |
|
| 37 | 39 | cache_put_data('wave_file/' . $user_info['ip'], $ip ? $ip + 1 : 1, 20); |
| 38 | 40 | cache_put_data('wave_file/' . $user_info['ip2'], $ip2 ? $ip2 + 1 : 1, 20); |
| 39 | 41 | |
@@ -42,16 +44,19 @@ discard block |
||
| 42 | 44 | mt_srand(end($tmp)); |
| 43 | 45 | |
| 44 | 46 | // Try to see if there's a sound font in the user's language. |
| 45 | - if (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.' . $user_info['language'] . '.wav')) |
|
| 46 | - $sound_language = $user_info['language']; |
|
| 47 | + if (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.' . $user_info['language'] . '.wav')) { |
|
| 48 | + $sound_language = $user_info['language']; |
|
| 49 | + } |
|
| 47 | 50 | |
| 48 | 51 | // English should be there. |
| 49 | - elseif (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.english.wav')) |
|
| 50 | - $sound_language = 'english'; |
|
| 52 | + elseif (file_exists($settings['default_theme_dir'] . '/fonts/sound/a.english.wav')) { |
|
| 53 | + $sound_language = 'english'; |
|
| 54 | + } |
|
| 51 | 55 | |
| 52 | 56 | // Guess not... |
| 53 | - else |
|
| 54 | - return false; |
|
| 57 | + else { |
|
| 58 | + return false; |
|
| 59 | + } |
|
| 55 | 60 | |
| 56 | 61 | // File names are in lower case so lets make sure that we are only using a lower case string |
| 57 | 62 | $word = strtolower($word); |
@@ -61,20 +66,25 @@ discard block |
||
| 61 | 66 | for ($i = 0; $i < strlen($word); $i++) |
| 62 | 67 | { |
| 63 | 68 | $sound_letter = implode('', file($settings['default_theme_dir'] . '/fonts/sound/' . $word{$i} . '.' . $sound_language . '.wav')); |
| 64 | - if (strpos($sound_letter, 'data') === false) |
|
| 65 | - return false; |
|
| 69 | + if (strpos($sound_letter, 'data') === false) { |
|
| 70 | + return false; |
|
| 71 | + } |
|
| 66 | 72 | |
| 67 | 73 | $sound_letter = substr($sound_letter, strpos($sound_letter, 'data') + 8); |
| 68 | 74 | switch ($word{$i} === 's' ? 0 : mt_rand(0, 2)) |
| 69 | 75 | { |
| 70 | - case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
|
| 71 | - for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) |
|
| 72 | - $sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF))); |
|
| 76 | + case 0 : for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) { |
|
| 77 | + for ($k = 0, $m = round(mt_rand(15, 25) / 10); |
|
| 78 | + } |
|
| 79 | + $k < $m; $k++) { |
|
| 80 | + $sound_word .= $word{$i} === 's' ? $sound_letter{$j} : chr(mt_rand(max(ord($sound_letter{$j}) - 1, 0x00), min(ord($sound_letter{$j}) + 1, 0xFF))); |
|
| 81 | + } |
|
| 73 | 82 | break; |
| 74 | 83 | |
| 75 | 84 | case 1: |
| 76 | - for ($j = 0, $n = strlen($sound_letter) - 1; $j < $n; $j += 2) |
|
| 77 | - $sound_word .= (mt_rand(0, 3) == 0 ? '' : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j + 1} : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j} : $sound_letter{$j + 1}) . $sound_letter{$j + 1} . (mt_rand(0, 3) == 0 ? $sound_letter{$j + 1} : ''); |
|
| 85 | + for ($j = 0, $n = strlen($sound_letter) - 1; $j < $n; $j += 2) { |
|
| 86 | + $sound_word .= (mt_rand(0, 3) == 0 ? '' : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j + 1} : $sound_letter{$j}) . (mt_rand(0, 3) === 0 ? $sound_letter{$j} : $sound_letter{$j + 1}) . $sound_letter{$j + 1} . (mt_rand(0, 3) == 0 ? $sound_letter{$j + 1} : ''); |
|
| 87 | + } |
|
| 78 | 88 | $sound_word .= str_repeat($sound_letter{$n}, 2); |
| 79 | 89 | break; |
| 80 | 90 | |
@@ -82,10 +92,12 @@ discard block |
||
| 82 | 92 | $shift = 0; |
| 83 | 93 | for ($j = 0, $n = strlen($sound_letter); $j < $n; $j++) |
| 84 | 94 | { |
| 85 | - if (mt_rand(0, 10) === 0) |
|
| 86 | - $shift += mt_rand(-3, 3); |
|
| 87 | - for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) |
|
| 88 | - $sound_word .= chr(min(max(ord($sound_letter{$j}) + $shift, 0x00), 0xFF)); |
|
| 95 | + if (mt_rand(0, 10) === 0) { |
|
| 96 | + $shift += mt_rand(-3, 3); |
|
| 97 | + } |
|
| 98 | + for ($k = 0, $m = round(mt_rand(15, 25) / 10); $k < $m; $k++) { |
|
| 99 | + $sound_word .= chr(min(max(ord($sound_letter{$j}) + $shift, 0x00), 0xFF)); |
|
| 100 | + } |
|
| 89 | 101 | } |
| 90 | 102 | break; |
| 91 | 103 | |
@@ -15,8 +15,9 @@ discard block |
||
| 15 | 15 | * @version 2.1 Beta 3 |
| 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 | * This defines every profile field known to man. |
@@ -29,8 +30,9 @@ discard block |
||
| 29 | 30 | global $sourcedir, $profile_vars; |
| 30 | 31 | |
| 31 | 32 | // Don't load this twice! |
| 32 | - if (!empty($profile_fields) && !$force_reload) |
|
| 33 | - return; |
|
| 33 | + if (!empty($profile_fields) && !$force_reload) { |
|
| 34 | + return; |
|
| 35 | + } |
|
| 34 | 36 | |
| 35 | 37 | /* This horrific array defines all the profile fields in the whole world! |
| 36 | 38 | In general each "field" has one array - the key of which is the database column name associated with said field. Each item |
@@ -103,13 +105,14 @@ discard block |
||
| 103 | 105 | if (isset($_POST['bday2'], $_POST['bday3']) && $value > 0 && $_POST['bday2'] > 0) |
| 104 | 106 | { |
| 105 | 107 | // Set to blank? |
| 106 | - if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) |
|
| 107 | - $value = '0001-01-01'; |
|
| 108 | - else |
|
| 109 | - $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 4 ? 4 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 4 ? 4 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '0001-01-01'; |
|
| 108 | + if ((int) $_POST['bday3'] == 1 && (int) $_POST['bday2'] == 1 && (int) $value == 1) { |
|
| 109 | + $value = '0001-01-01'; |
|
| 110 | + } else { |
|
| 111 | + $value = checkdate($value, $_POST['bday2'], $_POST['bday3'] < 4 ? 4 : $_POST['bday3']) ? sprintf('%04d-%02d-%02d', $_POST['bday3'] < 4 ? 4 : $_POST['bday3'], $_POST['bday1'], $_POST['bday2']) : '0001-01-01'; |
|
| 112 | + } |
|
| 113 | + } else { |
|
| 114 | + $value = '0001-01-01'; |
|
| 110 | 115 | } |
| 111 | - else |
|
| 112 | - $value = '0001-01-01'; |
|
| 113 | 116 | |
| 114 | 117 | $profile_vars['birthdate'] = $value; |
| 115 | 118 | $cur_profile['birthdate'] = $value; |
@@ -127,8 +130,7 @@ discard block |
||
| 127 | 130 | { |
| 128 | 131 | $value = checkdate($dates[2], $dates[3], $dates[1] < 4 ? 4 : $dates[1]) ? sprintf('%04d-%02d-%02d', $dates[1] < 4 ? 4 : $dates[1], $dates[2], $dates[3]) : '0001-01-01'; |
| 129 | 132 | return true; |
| 130 | - } |
|
| 131 | - else |
|
| 133 | + } else |
|
| 132 | 134 | { |
| 133 | 135 | $value = empty($cur_profile['birthdate']) ? '0001-01-01' : $cur_profile['birthdate']; |
| 134 | 136 | return false; |
@@ -150,10 +152,11 @@ discard block |
||
| 150 | 152 | return $txt['invalid_registration'] . ' ' . strftime('%d %b %Y ' . (strpos($user_info['time_format'], '%H') !== false ? '%I:%M:%S %p' : '%H:%M:%S'), forum_time(false)); |
| 151 | 153 | } |
| 152 | 154 | // As long as it doesn't equal "N/A"... |
| 153 | - elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) |
|
| 154 | - $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
| 155 | - else |
|
| 156 | - $value = $cur_profile['date_registered']; |
|
| 155 | + elseif ($value != $txt['not_applicable'] && $value != strtotime(strftime('%Y-%m-%d', $cur_profile['date_registered'] + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600))) { |
|
| 156 | + $value = $value - ($user_info['time_offset'] + $modSettings['time_offset']) * 3600; |
|
| 157 | + } else { |
|
| 158 | + $value = $cur_profile['date_registered']; |
|
| 159 | + } |
|
| 157 | 160 | |
| 158 | 161 | return true; |
| 159 | 162 | }, |
@@ -177,8 +180,9 @@ discard block |
||
| 177 | 180 | { |
| 178 | 181 | global $context, $old_profile, $profile_vars, $sourcedir, $modSettings; |
| 179 | 182 | |
| 180 | - if (strtolower($value) == strtolower($old_profile['email_address'])) |
|
| 181 | - return false; |
|
| 183 | + if (strtolower($value) == strtolower($old_profile['email_address'])) { |
|
| 184 | + return false; |
|
| 185 | + } |
|
| 182 | 186 | |
| 183 | 187 | $isValid = profileValidateEmail($value, $context['id_member']); |
| 184 | 188 | |
@@ -254,11 +258,11 @@ discard block |
||
| 254 | 258 | |
| 255 | 259 | if (isset($context['profile_languages'][$value])) |
| 256 | 260 | { |
| 257 | - if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) |
|
| 258 | - $_SESSION['language'] = $value; |
|
| 261 | + if ($context['user']['is_owner'] && empty($context['password_auth_failed'])) { |
|
| 262 | + $_SESSION['language'] = $value; |
|
| 263 | + } |
|
| 259 | 264 | return true; |
| 260 | - } |
|
| 261 | - else |
|
| 265 | + } else |
|
| 262 | 266 | { |
| 263 | 267 | $value = $cur_profile['lngfile']; |
| 264 | 268 | return false; |
@@ -282,13 +286,14 @@ discard block |
||
| 282 | 286 | |
| 283 | 287 | // Maybe they are trying to change their password as well? |
| 284 | 288 | $resetPassword = true; |
| 285 | - if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) |
|
| 286 | - $resetPassword = false; |
|
| 289 | + if (isset($_POST['passwrd1']) && $_POST['passwrd1'] != '' && isset($_POST['passwrd2']) && $_POST['passwrd1'] == $_POST['passwrd2'] && validatePassword($_POST['passwrd1'], $value, array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])) == null) { |
|
| 290 | + $resetPassword = false; |
|
| 291 | + } |
|
| 287 | 292 | |
| 288 | 293 | // Do the reset... this will send them an email too. |
| 289 | - if ($resetPassword) |
|
| 290 | - resetPassword($context['id_member'], $value); |
|
| 291 | - elseif ($value !== null) |
|
| 294 | + if ($resetPassword) { |
|
| 295 | + resetPassword($context['id_member'], $value); |
|
| 296 | + } elseif ($value !== null) |
|
| 292 | 297 | { |
| 293 | 298 | validateUsername($context['id_member'], trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value))); |
| 294 | 299 | updateMemberData($context['id_member'], array('member_name' => $value)); |
@@ -312,20 +317,23 @@ discard block |
||
| 312 | 317 | 'input_validate' => function(&$value) use ($sourcedir, $user_info, $smcFunc, $cur_profile) |
| 313 | 318 | { |
| 314 | 319 | // If we didn't try it then ignore it! |
| 315 | - if ($value == '') |
|
| 316 | - return false; |
|
| 320 | + if ($value == '') { |
|
| 321 | + return false; |
|
| 322 | + } |
|
| 317 | 323 | |
| 318 | 324 | // Do the two entries for the password even match? |
| 319 | - if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) |
|
| 320 | - return 'bad_new_password'; |
|
| 325 | + if (!isset($_POST['passwrd2']) || $value != $_POST['passwrd2']) { |
|
| 326 | + return 'bad_new_password'; |
|
| 327 | + } |
|
| 321 | 328 | |
| 322 | 329 | // Let's get the validation function into play... |
| 323 | 330 | require_once($sourcedir . '/Subs-Auth.php'); |
| 324 | 331 | $passwordErrors = validatePassword($value, $cur_profile['member_name'], array($cur_profile['real_name'], $user_info['username'], $user_info['name'], $user_info['email'])); |
| 325 | 332 | |
| 326 | 333 | // Were there errors? |
| 327 | - if ($passwordErrors != null) |
|
| 328 | - return 'password_' . $passwordErrors; |
|
| 334 | + if ($passwordErrors != null) { |
|
| 335 | + return 'password_' . $passwordErrors; |
|
| 336 | + } |
|
| 329 | 337 | |
| 330 | 338 | // Set up the new password variable... ready for storage. |
| 331 | 339 | $value = hash_password($cur_profile['member_name'], un_htmlspecialchars($value)); |
@@ -350,8 +358,9 @@ discard block |
||
| 350 | 358 | 'permission' => 'profile_blurb', |
| 351 | 359 | 'input_validate' => function(&$value) use ($smcFunc) |
| 352 | 360 | { |
| 353 | - if ($smcFunc['strlen']($value) > 50) |
|
| 354 | - return 'personal_text_too_long'; |
|
| 361 | + if ($smcFunc['strlen']($value) > 50) { |
|
| 362 | + return 'personal_text_too_long'; |
|
| 363 | + } |
|
| 355 | 364 | |
| 356 | 365 | return true; |
| 357 | 366 | }, |
@@ -386,10 +395,11 @@ discard block |
||
| 386 | 395 | 'permission' => 'moderate_forum', |
| 387 | 396 | 'input_validate' => function(&$value) |
| 388 | 397 | { |
| 389 | - if (!is_numeric($value)) |
|
| 390 | - return 'digits_only'; |
|
| 391 | - else |
|
| 392 | - $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
| 398 | + if (!is_numeric($value)) { |
|
| 399 | + return 'digits_only'; |
|
| 400 | + } else { |
|
| 401 | + $value = $value != '' ? strtr($value, array(',' => '', '.' => '', ' ' => '')) : 0; |
|
| 402 | + } |
|
| 393 | 403 | return true; |
| 394 | 404 | }, |
| 395 | 405 | ), |
@@ -405,15 +415,16 @@ discard block |
||
| 405 | 415 | { |
| 406 | 416 | $value = trim(preg_replace('~[\t\n\r \x0B\0' . ($context['utf8'] ? '\x{A0}\x{AD}\x{2000}-\x{200F}\x{201F}\x{202F}\x{3000}\x{FEFF}' : '\x00-\x08\x0B\x0C\x0E-\x19\xA0') . ']+~' . ($context['utf8'] ? 'u' : ''), ' ', $value)); |
| 407 | 417 | |
| 408 | - if (trim($value) == '') |
|
| 409 | - return 'no_name'; |
|
| 410 | - elseif ($smcFunc['strlen']($value) > 60) |
|
| 411 | - return 'name_too_long'; |
|
| 412 | - elseif ($cur_profile['real_name'] != $value) |
|
| 418 | + if (trim($value) == '') { |
|
| 419 | + return 'no_name'; |
|
| 420 | + } elseif ($smcFunc['strlen']($value) > 60) { |
|
| 421 | + return 'name_too_long'; |
|
| 422 | + } elseif ($cur_profile['real_name'] != $value) |
|
| 413 | 423 | { |
| 414 | 424 | require_once($sourcedir . '/Subs-Members.php'); |
| 415 | - if (isReservedName($value, $context['id_member'])) |
|
| 416 | - return 'name_taken'; |
|
| 425 | + if (isReservedName($value, $context['id_member'])) { |
|
| 426 | + return 'name_taken'; |
|
| 427 | + } |
|
| 417 | 428 | } |
| 418 | 429 | return true; |
| 419 | 430 | }, |
@@ -471,8 +482,9 @@ discard block |
||
| 471 | 482 | 'selected' => $set == $context['member']['smiley_set']['id'] |
| 472 | 483 | ); |
| 473 | 484 | |
| 474 | - if ($context['smiley_sets'][$i]['selected']) |
|
| 475 | - $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
| 485 | + if ($context['smiley_sets'][$i]['selected']) { |
|
| 486 | + $context['member']['smiley_set']['name'] = $set_names[$i]; |
|
| 487 | + } |
|
| 476 | 488 | } |
| 477 | 489 | return true; |
| 478 | 490 | }, |
@@ -481,8 +493,9 @@ discard block |
||
| 481 | 493 | global $modSettings; |
| 482 | 494 | |
| 483 | 495 | $smiley_sets = explode(',', $modSettings['smiley_sets_known']); |
| 484 | - if (!in_array($value, $smiley_sets) && $value != 'none') |
|
| 485 | - $value = ''; |
|
| 496 | + if (!in_array($value, $smiley_sets) && $value != 'none') { |
|
| 497 | + $value = ''; |
|
| 498 | + } |
|
| 486 | 499 | return true; |
| 487 | 500 | }, |
| 488 | 501 | ), |
@@ -497,8 +510,9 @@ discard block |
||
| 497 | 510 | loadLanguage('Settings'); |
| 498 | 511 | |
| 499 | 512 | $context['allow_no_censored'] = false; |
| 500 | - if ($user_info['is_admin'] || $context['user']['is_owner']) |
|
| 501 | - $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
| 513 | + if ($user_info['is_admin'] || $context['user']['is_owner']) { |
|
| 514 | + $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); |
|
| 515 | + } |
|
| 502 | 516 | |
| 503 | 517 | return true; |
| 504 | 518 | }, |
@@ -545,8 +559,9 @@ discard block |
||
| 545 | 559 | 'input_validate' => function($value) |
| 546 | 560 | { |
| 547 | 561 | $tz = smf_list_timezones(); |
| 548 | - if (!isset($tz[$value])) |
|
| 549 | - return 'bad_timezone'; |
|
| 562 | + if (!isset($tz[$value])) { |
|
| 563 | + return 'bad_timezone'; |
|
| 564 | + } |
|
| 550 | 565 | |
| 551 | 566 | return true; |
| 552 | 567 | }, |
@@ -561,8 +576,9 @@ discard block |
||
| 561 | 576 | 'enabled' => !empty($modSettings['titlesEnable']), |
| 562 | 577 | 'input_validate' => function(&$value) use ($smcFunc) |
| 563 | 578 | { |
| 564 | - if ($smcFunc['strlen']($value) > 50) |
|
| 565 | - return 'user_title_too_long'; |
|
| 579 | + if ($smcFunc['strlen']($value) > 50) { |
|
| 580 | + return 'user_title_too_long'; |
|
| 581 | + } |
|
| 566 | 582 | |
| 567 | 583 | return true; |
| 568 | 584 | }, |
@@ -584,10 +600,12 @@ discard block |
||
| 584 | 600 | // Fix the URL... |
| 585 | 601 | 'input_validate' => function(&$value) |
| 586 | 602 | { |
| 587 | - if (strlen(trim($value)) > 0 && strpos($value, '://') === false) |
|
| 588 | - $value = 'http://' . $value; |
|
| 589 | - if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) |
|
| 590 | - $value = ''; |
|
| 603 | + if (strlen(trim($value)) > 0 && strpos($value, '://') === false) { |
|
| 604 | + $value = 'http://' . $value; |
|
| 605 | + } |
|
| 606 | + if (strlen($value) < 8 || (substr($value, 0, 7) !== 'http://' && substr($value, 0, 8) !== 'https://')) { |
|
| 607 | + $value = ''; |
|
| 608 | + } |
|
| 591 | 609 | return true; |
| 592 | 610 | }, |
| 593 | 611 | 'link_with' => 'website', |
@@ -601,16 +619,19 @@ discard block |
||
| 601 | 619 | foreach ($profile_fields as $key => $field) |
| 602 | 620 | { |
| 603 | 621 | // Do we have permission to do this? |
| 604 | - if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) |
|
| 605 | - unset($profile_fields[$key]); |
|
| 622 | + if (isset($field['permission']) && !allowedTo(($context['user']['is_owner'] ? array($field['permission'] . '_own', $field['permission'] . '_any') : $field['permission'] . '_any')) && !allowedTo($field['permission'])) { |
|
| 623 | + unset($profile_fields[$key]); |
|
| 624 | + } |
|
| 606 | 625 | |
| 607 | 626 | // Is it enabled? |
| 608 | - if (isset($field['enabled']) && !$field['enabled']) |
|
| 609 | - unset($profile_fields[$key]); |
|
| 627 | + if (isset($field['enabled']) && !$field['enabled']) { |
|
| 628 | + unset($profile_fields[$key]); |
|
| 629 | + } |
|
| 610 | 630 | |
| 611 | 631 | // Is it specifically disabled? |
| 612 | - if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) |
|
| 613 | - unset($profile_fields[$key]); |
|
| 632 | + if (in_array($key, $disabled_fields) || (isset($field['link_with']) && in_array($field['link_with'], $disabled_fields))) { |
|
| 633 | + unset($profile_fields[$key]); |
|
| 634 | + } |
|
| 614 | 635 | } |
| 615 | 636 | } |
| 616 | 637 | |
@@ -635,9 +656,10 @@ discard block |
||
| 635 | 656 | loadProfileFields(true); |
| 636 | 657 | |
| 637 | 658 | // First check for any linked sets. |
| 638 | - foreach ($profile_fields as $key => $field) |
|
| 639 | - if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
| 659 | + foreach ($profile_fields as $key => $field) { |
|
| 660 | + if (isset($field['link_with']) && in_array($field['link_with'], $fields)) |
|
| 640 | 661 | $fields[] = $key; |
| 662 | + } |
|
| 641 | 663 | |
| 642 | 664 | $i = 0; |
| 643 | 665 | $last_type = ''; |
@@ -649,38 +671,46 @@ discard block |
||
| 649 | 671 | $cur_field = &$profile_fields[$field]; |
| 650 | 672 | |
| 651 | 673 | // Does it have a preload and does that preload succeed? |
| 652 | - if (isset($cur_field['preload']) && !$cur_field['preload']()) |
|
| 653 | - continue; |
|
| 674 | + if (isset($cur_field['preload']) && !$cur_field['preload']()) { |
|
| 675 | + continue; |
|
| 676 | + } |
|
| 654 | 677 | |
| 655 | 678 | // If this is anything but complex we need to do more cleaning! |
| 656 | 679 | if ($cur_field['type'] != 'callback' && $cur_field['type'] != 'hidden') |
| 657 | 680 | { |
| 658 | - if (!isset($cur_field['label'])) |
|
| 659 | - $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
| 681 | + if (!isset($cur_field['label'])) { |
|
| 682 | + $cur_field['label'] = isset($txt[$field]) ? $txt[$field] : $field; |
|
| 683 | + } |
|
| 660 | 684 | |
| 661 | 685 | // Everything has a value! |
| 662 | - if (!isset($cur_field['value'])) |
|
| 663 | - $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
| 686 | + if (!isset($cur_field['value'])) { |
|
| 687 | + $cur_field['value'] = isset($cur_profile[$field]) ? $cur_profile[$field] : ''; |
|
| 688 | + } |
|
| 664 | 689 | |
| 665 | 690 | // Any input attributes? |
| 666 | 691 | $cur_field['input_attr'] = !empty($cur_field['input_attr']) ? implode(',', $cur_field['input_attr']) : ''; |
| 667 | 692 | } |
| 668 | 693 | |
| 669 | 694 | // Was there an error with this field on posting? |
| 670 | - if (isset($context['profile_errors'][$field])) |
|
| 671 | - $cur_field['is_error'] = true; |
|
| 695 | + if (isset($context['profile_errors'][$field])) { |
|
| 696 | + $cur_field['is_error'] = true; |
|
| 697 | + } |
|
| 672 | 698 | |
| 673 | 699 | // Any javascript stuff? |
| 674 | - if (!empty($cur_field['js_submit'])) |
|
| 675 | - $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
| 676 | - if (!empty($cur_field['js'])) |
|
| 677 | - $context['profile_javascript'] .= $cur_field['js']; |
|
| 700 | + if (!empty($cur_field['js_submit'])) { |
|
| 701 | + $context['profile_onsubmit_javascript'] .= $cur_field['js_submit']; |
|
| 702 | + } |
|
| 703 | + if (!empty($cur_field['js'])) { |
|
| 704 | + $context['profile_javascript'] .= $cur_field['js']; |
|
| 705 | + } |
|
| 678 | 706 | |
| 679 | 707 | // Any template stuff? |
| 680 | - if (!empty($cur_field['prehtml'])) |
|
| 681 | - $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
| 682 | - if (!empty($cur_field['posthtml'])) |
|
| 683 | - $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
| 708 | + if (!empty($cur_field['prehtml'])) { |
|
| 709 | + $context['profile_prehtml'] .= $cur_field['prehtml']; |
|
| 710 | + } |
|
| 711 | + if (!empty($cur_field['posthtml'])) { |
|
| 712 | + $context['profile_posthtml'] .= $cur_field['posthtml']; |
|
| 713 | + } |
|
| 684 | 714 | |
| 685 | 715 | // Finally put it into context? |
| 686 | 716 | if ($cur_field['type'] != 'hidden') |
@@ -713,12 +743,14 @@ discard block |
||
| 713 | 743 | }, false);' : ''), true); |
| 714 | 744 | |
| 715 | 745 | // Any onsubmit javascript? |
| 716 | - if (!empty($context['profile_onsubmit_javascript'])) |
|
| 717 | - addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
| 746 | + if (!empty($context['profile_onsubmit_javascript'])) { |
|
| 747 | + addInlineJavaScript($context['profile_onsubmit_javascript'], true); |
|
| 748 | + } |
|
| 718 | 749 | |
| 719 | 750 | // Any totally custom stuff? |
| 720 | - if (!empty($context['profile_javascript'])) |
|
| 721 | - addInlineJavaScript($context['profile_javascript'], true); |
|
| 751 | + if (!empty($context['profile_javascript'])) { |
|
| 752 | + addInlineJavaScript($context['profile_javascript'], true); |
|
| 753 | + } |
|
| 722 | 754 | |
| 723 | 755 | // Free up some memory. |
| 724 | 756 | unset($profile_fields); |
@@ -739,8 +771,9 @@ discard block |
||
| 739 | 771 | |
| 740 | 772 | // This allows variables to call activities when they save - by default just to reload their settings |
| 741 | 773 | $context['profile_execute_on_save'] = array(); |
| 742 | - if ($context['user']['is_owner']) |
|
| 743 | - $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
| 774 | + if ($context['user']['is_owner']) { |
|
| 775 | + $context['profile_execute_on_save']['reload_user'] = 'profileReloadUser'; |
|
| 776 | + } |
|
| 744 | 777 | |
| 745 | 778 | // Assume we log nothing. |
| 746 | 779 | $context['log_changes'] = array(); |
@@ -748,8 +781,9 @@ discard block |
||
| 748 | 781 | // Cycle through the profile fields working out what to do! |
| 749 | 782 | foreach ($profile_fields as $key => $field) |
| 750 | 783 | { |
| 751 | - if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) |
|
| 752 | - continue; |
|
| 784 | + if (!isset($_POST[$key]) || !empty($field['is_dummy']) || (isset($_POST['preview_signature']) && $key == 'signature')) { |
|
| 785 | + continue; |
|
| 786 | + } |
|
| 753 | 787 | |
| 754 | 788 | // What gets updated? |
| 755 | 789 | $db_key = isset($field['save_key']) ? $field['save_key'] : $key; |
@@ -777,12 +811,13 @@ discard block |
||
| 777 | 811 | $field['cast_type'] = empty($field['cast_type']) ? $field['type'] : $field['cast_type']; |
| 778 | 812 | |
| 779 | 813 | // Finally, clean up certain types. |
| 780 | - if ($field['cast_type'] == 'int') |
|
| 781 | - $_POST[$key] = (int) $_POST[$key]; |
|
| 782 | - elseif ($field['cast_type'] == 'float') |
|
| 783 | - $_POST[$key] = (float) $_POST[$key]; |
|
| 784 | - elseif ($field['cast_type'] == 'check') |
|
| 785 | - $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
| 814 | + if ($field['cast_type'] == 'int') { |
|
| 815 | + $_POST[$key] = (int) $_POST[$key]; |
|
| 816 | + } elseif ($field['cast_type'] == 'float') { |
|
| 817 | + $_POST[$key] = (float) $_POST[$key]; |
|
| 818 | + } elseif ($field['cast_type'] == 'check') { |
|
| 819 | + $_POST[$key] = !empty($_POST[$key]) ? 1 : 0; |
|
| 820 | + } |
|
| 786 | 821 | |
| 787 | 822 | // If we got here we're doing OK. |
| 788 | 823 | if ($field['type'] != 'hidden' && (!isset($old_profile[$key]) || $_POST[$key] != $old_profile[$key])) |
@@ -793,11 +828,12 @@ discard block |
||
| 793 | 828 | $cur_profile[$key] = $_POST[$key]; |
| 794 | 829 | |
| 795 | 830 | // Are we logging it? |
| 796 | - if (!empty($field['log_change']) && isset($old_profile[$key])) |
|
| 797 | - $context['log_changes'][$key] = array( |
|
| 831 | + if (!empty($field['log_change']) && isset($old_profile[$key])) { |
|
| 832 | + $context['log_changes'][$key] = array( |
|
| 798 | 833 | 'previous' => $old_profile[$key], |
| 799 | 834 | 'new' => $_POST[$key], |
| 800 | 835 | ); |
| 836 | + } |
|
| 801 | 837 | } |
| 802 | 838 | |
| 803 | 839 | // Logging group changes are a bit different... |
@@ -830,10 +866,11 @@ discard block |
||
| 830 | 866 | { |
| 831 | 867 | foreach ($groups as $id => $group) |
| 832 | 868 | { |
| 833 | - if (isset($context['member_groups'][$group])) |
|
| 834 | - $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
| 835 | - else |
|
| 836 | - unset($additional_groups[$type][$id]); |
|
| 869 | + if (isset($context['member_groups'][$group])) { |
|
| 870 | + $additional_groups[$type][$id] = $context['member_groups'][$group]['name']; |
|
| 871 | + } else { |
|
| 872 | + unset($additional_groups[$type][$id]); |
|
| 873 | + } |
|
| 837 | 874 | } |
| 838 | 875 | $additional_groups[$type] = implode(', ', $additional_groups[$type]); |
| 839 | 876 | } |
@@ -844,10 +881,11 @@ discard block |
||
| 844 | 881 | } |
| 845 | 882 | |
| 846 | 883 | // @todo Temporary |
| 847 | - if ($context['user']['is_owner']) |
|
| 848 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
| 849 | - else |
|
| 850 | - $changeOther = allowedTo('profile_extra_any'); |
|
| 884 | + if ($context['user']['is_owner']) { |
|
| 885 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own')); |
|
| 886 | + } else { |
|
| 887 | + $changeOther = allowedTo('profile_extra_any'); |
|
| 888 | + } |
|
| 851 | 889 | if ($changeOther && empty($post_errors)) |
| 852 | 890 | { |
| 853 | 891 | makeThemeChanges($context['id_member'], isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
@@ -855,8 +893,9 @@ discard block |
||
| 855 | 893 | { |
| 856 | 894 | $custom_fields_errors = makeCustomFieldChanges($context['id_member'], $_REQUEST['sa'], false, true); |
| 857 | 895 | |
| 858 | - if (!empty($custom_fields_errors)) |
|
| 859 | - $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
| 896 | + if (!empty($custom_fields_errors)) { |
|
| 897 | + $post_errors = array_merge($post_errors, $custom_fields_errors); |
|
| 898 | + } |
|
| 860 | 899 | } |
| 861 | 900 | } |
| 862 | 901 | |
@@ -882,9 +921,9 @@ discard block |
||
| 882 | 921 | if ($context['user']['is_owner']) |
| 883 | 922 | { |
| 884 | 923 | $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own', 'profile_website_any', 'profile_website_own', 'profile_signature_any', 'profile_signature_own')); |
| 924 | + } else { |
|
| 925 | + $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
| 885 | 926 | } |
| 886 | - else |
|
| 887 | - $changeOther = allowedTo(array('profile_extra_any', 'profile_website_any', 'profile_signature_any')); |
|
| 888 | 927 | |
| 889 | 928 | // Arrays of all the changes - makes things easier. |
| 890 | 929 | $profile_bools = array(); |
@@ -895,22 +934,25 @@ discard block |
||
| 895 | 934 | 'ignore_boards', |
| 896 | 935 | ); |
| 897 | 936 | |
| 898 | - if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) |
|
| 899 | - $_POST['ignore_brd'] = array(); |
|
| 937 | + if (isset($_POST['sa']) && $_POST['sa'] == 'ignoreboards' && empty($_POST['ignore_brd'])) { |
|
| 938 | + $_POST['ignore_brd'] = array(); |
|
| 939 | + } |
|
| 900 | 940 | |
| 901 | 941 | unset($_POST['ignore_boards']); // Whatever it is set to is a dirty filthy thing. Kinda like our minds. |
| 902 | 942 | if (isset($_POST['ignore_brd'])) |
| 903 | 943 | { |
| 904 | - if (!is_array($_POST['ignore_brd'])) |
|
| 905 | - $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
| 944 | + if (!is_array($_POST['ignore_brd'])) { |
|
| 945 | + $_POST['ignore_brd'] = array($_POST['ignore_brd']); |
|
| 946 | + } |
|
| 906 | 947 | |
| 907 | 948 | foreach ($_POST['ignore_brd'] as $k => $d) |
| 908 | 949 | { |
| 909 | 950 | $d = (int) $d; |
| 910 | - if ($d != 0) |
|
| 911 | - $_POST['ignore_brd'][$k] = $d; |
|
| 912 | - else |
|
| 913 | - unset($_POST['ignore_brd'][$k]); |
|
| 951 | + if ($d != 0) { |
|
| 952 | + $_POST['ignore_brd'][$k] = $d; |
|
| 953 | + } else { |
|
| 954 | + unset($_POST['ignore_brd'][$k]); |
|
| 955 | + } |
|
| 914 | 956 | } |
| 915 | 957 | $_POST['ignore_boards'] = implode(',', $_POST['ignore_brd']); |
| 916 | 958 | unset($_POST['ignore_brd']); |
@@ -923,21 +965,26 @@ discard block |
||
| 923 | 965 | makeThemeChanges($memID, isset($_POST['id_theme']) ? (int) $_POST['id_theme'] : $old_profile['id_theme']); |
| 924 | 966 | //makeAvatarChanges($memID, $post_errors); |
| 925 | 967 | |
| 926 | - if (!empty($_REQUEST['sa'])) |
|
| 927 | - makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
| 968 | + if (!empty($_REQUEST['sa'])) { |
|
| 969 | + makeCustomFieldChanges($memID, $_REQUEST['sa'], false); |
|
| 970 | + } |
|
| 928 | 971 | |
| 929 | - foreach ($profile_bools as $var) |
|
| 930 | - if (isset($_POST[$var])) |
|
| 972 | + foreach ($profile_bools as $var) { |
|
| 973 | + if (isset($_POST[$var])) |
|
| 931 | 974 | $profile_vars[$var] = empty($_POST[$var]) ? '0' : '1'; |
| 932 | - foreach ($profile_ints as $var) |
|
| 933 | - if (isset($_POST[$var])) |
|
| 975 | + } |
|
| 976 | + foreach ($profile_ints as $var) { |
|
| 977 | + if (isset($_POST[$var])) |
|
| 934 | 978 | $profile_vars[$var] = $_POST[$var] != '' ? (int) $_POST[$var] : ''; |
| 935 | - foreach ($profile_floats as $var) |
|
| 936 | - if (isset($_POST[$var])) |
|
| 979 | + } |
|
| 980 | + foreach ($profile_floats as $var) { |
|
| 981 | + if (isset($_POST[$var])) |
|
| 937 | 982 | $profile_vars[$var] = (float) $_POST[$var]; |
| 938 | - foreach ($profile_strings as $var) |
|
| 939 | - if (isset($_POST[$var])) |
|
| 983 | + } |
|
| 984 | + foreach ($profile_strings as $var) { |
|
| 985 | + if (isset($_POST[$var])) |
|
| 940 | 986 | $profile_vars[$var] = $_POST[$var]; |
| 987 | + } |
|
| 941 | 988 | } |
| 942 | 989 | } |
| 943 | 990 | |
@@ -971,8 +1018,9 @@ discard block |
||
| 971 | 1018 | ); |
| 972 | 1019 | |
| 973 | 1020 | // Can't change reserved vars. |
| 974 | - if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) |
|
| 975 | - fatal_lang_error('no_access', false); |
|
| 1021 | + if ((isset($_POST['options']) && count(array_intersect(array_keys($_POST['options']), $reservedVars)) != 0) || (isset($_POST['default_options']) && count(array_intersect(array_keys($_POST['default_options']), $reservedVars)) != 0)) { |
|
| 1022 | + fatal_lang_error('no_access', false); |
|
| 1023 | + } |
|
| 976 | 1024 | |
| 977 | 1025 | // Don't allow any overriding of custom fields with default or non-default options. |
| 978 | 1026 | $request = $smcFunc['db_query']('', ' |
@@ -984,8 +1032,9 @@ discard block |
||
| 984 | 1032 | ) |
| 985 | 1033 | ); |
| 986 | 1034 | $custom_fields = array(); |
| 987 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 988 | - $custom_fields[] = $row['col_name']; |
|
| 1035 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1036 | + $custom_fields[] = $row['col_name']; |
|
| 1037 | + } |
|
| 989 | 1038 | $smcFunc['db_free_result']($request); |
| 990 | 1039 | |
| 991 | 1040 | // These are the theme changes... |
@@ -994,33 +1043,39 @@ discard block |
||
| 994 | 1043 | { |
| 995 | 1044 | foreach ($_POST['options'] as $opt => $val) |
| 996 | 1045 | { |
| 997 | - if (in_array($opt, $custom_fields)) |
|
| 998 | - continue; |
|
| 1046 | + if (in_array($opt, $custom_fields)) { |
|
| 1047 | + continue; |
|
| 1048 | + } |
|
| 999 | 1049 | |
| 1000 | 1050 | // These need to be controlled. |
| 1001 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
| 1002 | - $val = max(0, min($val, 50)); |
|
| 1051 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
| 1052 | + $val = max(0, min($val, 50)); |
|
| 1053 | + } |
|
| 1003 | 1054 | // We don't set this per theme anymore. |
| 1004 | - elseif ($opt == 'allow_no_censored') |
|
| 1005 | - continue; |
|
| 1055 | + elseif ($opt == 'allow_no_censored') { |
|
| 1056 | + continue; |
|
| 1057 | + } |
|
| 1006 | 1058 | |
| 1007 | 1059 | $themeSetArray[] = array($memID, $id_theme, $opt, is_array($val) ? implode(',', $val) : $val); |
| 1008 | 1060 | } |
| 1009 | 1061 | } |
| 1010 | 1062 | |
| 1011 | 1063 | $erase_options = array(); |
| 1012 | - if (isset($_POST['default_options']) && is_array($_POST['default_options'])) |
|
| 1013 | - foreach ($_POST['default_options'] as $opt => $val) |
|
| 1064 | + if (isset($_POST['default_options']) && is_array($_POST['default_options'])) { |
|
| 1065 | + foreach ($_POST['default_options'] as $opt => $val) |
|
| 1014 | 1066 | { |
| 1015 | 1067 | if (in_array($opt, $custom_fields)) |
| 1016 | 1068 | continue; |
| 1069 | + } |
|
| 1017 | 1070 | |
| 1018 | 1071 | // These need to be controlled. |
| 1019 | - if ($opt == 'topics_per_page' || $opt == 'messages_per_page') |
|
| 1020 | - $val = max(0, min($val, 50)); |
|
| 1072 | + if ($opt == 'topics_per_page' || $opt == 'messages_per_page') { |
|
| 1073 | + $val = max(0, min($val, 50)); |
|
| 1074 | + } |
|
| 1021 | 1075 | // Only let admins and owners change the censor. |
| 1022 | - elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) |
|
| 1023 | - continue; |
|
| 1076 | + elseif ($opt == 'allow_no_censored' && !$user_info['is_admin'] && !$context['user']['is_owner']) { |
|
| 1077 | + continue; |
|
| 1078 | + } |
|
| 1024 | 1079 | |
| 1025 | 1080 | $themeSetArray[] = array($memID, 1, $opt, is_array($val) ? implode(',', $val) : $val); |
| 1026 | 1081 | $erase_options[] = $opt; |
@@ -1056,8 +1111,9 @@ discard block |
||
| 1056 | 1111 | |
| 1057 | 1112 | // Admins can choose any theme, even if it's not enabled... |
| 1058 | 1113 | $themes = allowedTo('admin_forum') ? explode(',', $modSettings['knownThemes']) : explode(',', $modSettings['enableThemes']); |
| 1059 | - foreach ($themes as $t) |
|
| 1060 | - cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
| 1114 | + foreach ($themes as $t) { |
|
| 1115 | + cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60); |
|
| 1116 | + } |
|
| 1061 | 1117 | } |
| 1062 | 1118 | } |
| 1063 | 1119 | |
@@ -1076,8 +1132,9 @@ discard block |
||
| 1076 | 1132 | if (isset($_POST['edit_notify_boards']) && !empty($_POST['notify_boards'])) |
| 1077 | 1133 | { |
| 1078 | 1134 | // Make sure only integers are deleted. |
| 1079 | - foreach ($_POST['notify_boards'] as $index => $id) |
|
| 1080 | - $_POST['notify_boards'][$index] = (int) $id; |
|
| 1135 | + foreach ($_POST['notify_boards'] as $index => $id) { |
|
| 1136 | + $_POST['notify_boards'][$index] = (int) $id; |
|
| 1137 | + } |
|
| 1081 | 1138 | |
| 1082 | 1139 | // id_board = 0 is reserved for topic notifications. |
| 1083 | 1140 | $_POST['notify_boards'] = array_diff($_POST['notify_boards'], array(0)); |
@@ -1096,8 +1153,9 @@ discard block |
||
| 1096 | 1153 | // We are editing topic notifications...... |
| 1097 | 1154 | elseif (isset($_POST['edit_notify_topics']) && !empty($_POST['notify_topics'])) |
| 1098 | 1155 | { |
| 1099 | - foreach ($_POST['notify_topics'] as $index => $id) |
|
| 1100 | - $_POST['notify_topics'][$index] = (int) $id; |
|
| 1156 | + foreach ($_POST['notify_topics'] as $index => $id) { |
|
| 1157 | + $_POST['notify_topics'][$index] = (int) $id; |
|
| 1158 | + } |
|
| 1101 | 1159 | |
| 1102 | 1160 | // Make sure there are no zeros left. |
| 1103 | 1161 | $_POST['notify_topics'] = array_diff($_POST['notify_topics'], array(0)); |
@@ -1111,16 +1169,18 @@ discard block |
||
| 1111 | 1169 | 'selected_member' => $memID, |
| 1112 | 1170 | ) |
| 1113 | 1171 | ); |
| 1114 | - foreach ($_POST['notify_topics'] as $topic) |
|
| 1115 | - setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
| 1172 | + foreach ($_POST['notify_topics'] as $topic) { |
|
| 1173 | + setNotifyPrefs($memID, array('topic_notify_' . $topic => 0)); |
|
| 1174 | + } |
|
| 1116 | 1175 | } |
| 1117 | 1176 | |
| 1118 | 1177 | // We are removing topic preferences |
| 1119 | 1178 | elseif (isset($_POST['remove_notify_topics']) && !empty($_POST['notify_topics'])) |
| 1120 | 1179 | { |
| 1121 | 1180 | $prefs = array(); |
| 1122 | - foreach ($_POST['notify_topics'] as $topic) |
|
| 1123 | - $prefs[] = 'topic_notify_' . $topic; |
|
| 1181 | + foreach ($_POST['notify_topics'] as $topic) { |
|
| 1182 | + $prefs[] = 'topic_notify_' . $topic; |
|
| 1183 | + } |
|
| 1124 | 1184 | deleteNotifyPrefs($memID, $prefs); |
| 1125 | 1185 | } |
| 1126 | 1186 | |
@@ -1128,8 +1188,9 @@ discard block |
||
| 1128 | 1188 | elseif (isset($_POST['remove_notify_board']) && !empty($_POST['notify_boards'])) |
| 1129 | 1189 | { |
| 1130 | 1190 | $prefs = array(); |
| 1131 | - foreach ($_POST['notify_boards'] as $board) |
|
| 1132 | - $prefs[] = 'board_notify_' . $board; |
|
| 1191 | + foreach ($_POST['notify_boards'] as $board) { |
|
| 1192 | + $prefs[] = 'board_notify_' . $board; |
|
| 1193 | + } |
|
| 1133 | 1194 | deleteNotifyPrefs($memID, $prefs); |
| 1134 | 1195 | } |
| 1135 | 1196 | } |
@@ -1150,8 +1211,9 @@ discard block |
||
| 1150 | 1211 | |
| 1151 | 1212 | $errors = array(); |
| 1152 | 1213 | |
| 1153 | - if ($sanitize && isset($_POST['customfield'])) |
|
| 1154 | - $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
| 1214 | + if ($sanitize && isset($_POST['customfield'])) { |
|
| 1215 | + $_POST['customfield'] = htmlspecialchars__recursive($_POST['customfield']); |
|
| 1216 | + } |
|
| 1155 | 1217 | |
| 1156 | 1218 | $where = $area == 'register' ? 'show_reg != 0' : 'show_profile = {string:area}'; |
| 1157 | 1219 | |
@@ -1176,48 +1238,49 @@ discard block |
||
| 1176 | 1238 | - The data is not invisible to users but editable by the owner (or if it is the user is not the owner) |
| 1177 | 1239 | - The area isn't registration, and if it is that the field is not supposed to be shown there. |
| 1178 | 1240 | */ |
| 1179 | - if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) |
|
| 1180 | - continue; |
|
| 1241 | + if ($row['private'] != 0 && !allowedTo('admin_forum') && ($memID != $user_info['id'] || $row['private'] != 2) && ($area != 'register' || $row['show_reg'] == 0)) { |
|
| 1242 | + continue; |
|
| 1243 | + } |
|
| 1181 | 1244 | |
| 1182 | 1245 | // Validate the user data. |
| 1183 | - if ($row['field_type'] == 'check') |
|
| 1184 | - $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
| 1185 | - elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
| 1246 | + if ($row['field_type'] == 'check') { |
|
| 1247 | + $value = isset($_POST['customfield'][$row['col_name']]) ? 1 : 0; |
|
| 1248 | + } elseif ($row['field_type'] == 'select' || $row['field_type'] == 'radio') |
|
| 1186 | 1249 | { |
| 1187 | 1250 | $value = $row['default_value']; |
| 1188 | - foreach (explode(',', $row['field_options']) as $k => $v) |
|
| 1189 | - if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
| 1251 | + foreach (explode(',', $row['field_options']) as $k => $v) { |
|
| 1252 | + if (isset($_POST['customfield'][$row['col_name']]) && $_POST['customfield'][$row['col_name']] == $k) |
|
| 1190 | 1253 | $value = $v; |
| 1254 | + } |
|
| 1191 | 1255 | } |
| 1192 | 1256 | // Otherwise some form of text! |
| 1193 | 1257 | else |
| 1194 | 1258 | { |
| 1195 | 1259 | $value = isset($_POST['customfield'][$row['col_name']]) ? $_POST['customfield'][$row['col_name']] : ''; |
| 1196 | - if ($row['field_length']) |
|
| 1197 | - $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
| 1260 | + if ($row['field_length']) { |
|
| 1261 | + $value = $smcFunc['substr']($value, 0, $row['field_length']); |
|
| 1262 | + } |
|
| 1198 | 1263 | |
| 1199 | 1264 | // Any masks? |
| 1200 | 1265 | if ($row['field_type'] == 'text' && !empty($row['mask']) && $row['mask'] != 'none') |
| 1201 | 1266 | { |
| 1202 | 1267 | if ($row['mask'] == 'email' && (!filter_var($value, FILTER_VALIDATE_EMAIL) || strlen($value) > 255)) |
| 1203 | 1268 | { |
| 1204 | - if ($returnErrors) |
|
| 1205 | - $errors[] = 'custom_field_mail_fail'; |
|
| 1206 | - |
|
| 1207 | - else |
|
| 1208 | - $value = ''; |
|
| 1209 | - } |
|
| 1210 | - elseif ($row['mask'] == 'number') |
|
| 1269 | + if ($returnErrors) { |
|
| 1270 | + $errors[] = 'custom_field_mail_fail'; |
|
| 1271 | + } else { |
|
| 1272 | + $value = ''; |
|
| 1273 | + } |
|
| 1274 | + } elseif ($row['mask'] == 'number') |
|
| 1211 | 1275 | { |
| 1212 | 1276 | $value = (int) $value; |
| 1213 | - } |
|
| 1214 | - elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
| 1277 | + } elseif (substr($row['mask'], 0, 5) == 'regex' && trim($value) != '' && preg_match(substr($row['mask'], 5), $value) === 0) |
|
| 1215 | 1278 | { |
| 1216 | - if ($returnErrors) |
|
| 1217 | - $errors[] = 'custom_field_regex_fail'; |
|
| 1218 | - |
|
| 1219 | - else |
|
| 1220 | - $value = ''; |
|
| 1279 | + if ($returnErrors) { |
|
| 1280 | + $errors[] = 'custom_field_regex_fail'; |
|
| 1281 | + } else { |
|
| 1282 | + $value = ''; |
|
| 1283 | + } |
|
| 1221 | 1284 | } |
| 1222 | 1285 | } |
| 1223 | 1286 | } |
@@ -1243,8 +1306,9 @@ discard block |
||
| 1243 | 1306 | |
| 1244 | 1307 | $hook_errors = call_integration_hook('integrate_save_custom_profile_fields', array(&$changes, &$log_changes, &$errors, $returnErrors, $memID, $area, $sanitize)); |
| 1245 | 1308 | |
| 1246 | - if (!empty($hook_errors) && is_array($hook_errors)) |
|
| 1247 | - $errors = array_merge($errors, $hook_errors); |
|
| 1309 | + if (!empty($hook_errors) && is_array($hook_errors)) { |
|
| 1310 | + $errors = array_merge($errors, $hook_errors); |
|
| 1311 | + } |
|
| 1248 | 1312 | |
| 1249 | 1313 | // Make those changes! |
| 1250 | 1314 | if (!empty($changes) && empty($context['password_auth_failed']) && empty($errors)) |
@@ -1262,9 +1326,10 @@ discard block |
||
| 1262 | 1326 | } |
| 1263 | 1327 | } |
| 1264 | 1328 | |
| 1265 | - if ($returnErrors) |
|
| 1266 | - return $errors; |
|
| 1267 | -} |
|
| 1329 | + if ($returnErrors) { |
|
| 1330 | + return $errors; |
|
| 1331 | + } |
|
| 1332 | + } |
|
| 1268 | 1333 | |
| 1269 | 1334 | /** |
| 1270 | 1335 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1276,8 +1341,9 @@ discard block |
||
| 1276 | 1341 | global $context, $txt, $modSettings; |
| 1277 | 1342 | |
| 1278 | 1343 | // Do a quick check to ensure people aren't getting here illegally! |
| 1279 | - if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) |
|
| 1280 | - fatal_lang_error('no_access', false); |
|
| 1344 | + if (!$context['user']['is_owner'] || empty($modSettings['enable_buddylist'])) { |
|
| 1345 | + fatal_lang_error('no_access', false); |
|
| 1346 | + } |
|
| 1281 | 1347 | |
| 1282 | 1348 | // Can we email the user direct? |
| 1283 | 1349 | $context['can_moderate_forum'] = allowedTo('moderate_forum'); |
@@ -1307,9 +1373,10 @@ discard block |
||
| 1307 | 1373 | $context['sub_template'] = $subActions[$context['list_area']][0]; |
| 1308 | 1374 | $call = call_helper($subActions[$context['list_area']][0], true); |
| 1309 | 1375 | |
| 1310 | - if (!empty($call)) |
|
| 1311 | - call_user_func($call, $memID); |
|
| 1312 | -} |
|
| 1376 | + if (!empty($call)) { |
|
| 1377 | + call_user_func($call, $memID); |
|
| 1378 | + } |
|
| 1379 | + } |
|
| 1313 | 1380 | |
| 1314 | 1381 | /** |
| 1315 | 1382 | * Show all the users buddies, as well as a add/delete interface. |
@@ -1323,9 +1390,10 @@ discard block |
||
| 1323 | 1390 | |
| 1324 | 1391 | // For making changes! |
| 1325 | 1392 | $buddiesArray = explode(',', $user_profile[$memID]['buddy_list']); |
| 1326 | - foreach ($buddiesArray as $k => $dummy) |
|
| 1327 | - if ($dummy == '') |
|
| 1393 | + foreach ($buddiesArray as $k => $dummy) { |
|
| 1394 | + if ($dummy == '') |
|
| 1328 | 1395 | unset($buddiesArray[$k]); |
| 1396 | + } |
|
| 1329 | 1397 | |
| 1330 | 1398 | // Removing a buddy? |
| 1331 | 1399 | if (isset($_GET['remove'])) |
@@ -1337,10 +1405,11 @@ discard block |
||
| 1337 | 1405 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
| 1338 | 1406 | |
| 1339 | 1407 | // Heh, I'm lazy, do it the easy way... |
| 1340 | - foreach ($buddiesArray as $key => $buddy) |
|
| 1341 | - if ($buddy == (int) $_GET['remove']) |
|
| 1408 | + foreach ($buddiesArray as $key => $buddy) { |
|
| 1409 | + if ($buddy == (int) $_GET['remove']) |
|
| 1342 | 1410 | { |
| 1343 | 1411 | unset($buddiesArray[$key]); |
| 1412 | + } |
|
| 1344 | 1413 | $_SESSION['prf-save'] = true; |
| 1345 | 1414 | } |
| 1346 | 1415 | |
@@ -1350,8 +1419,7 @@ discard block |
||
| 1350 | 1419 | |
| 1351 | 1420 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
| 1352 | 1421 | redirectexit('action=profile;area=lists;sa=buddies;u=' . $memID); |
| 1353 | - } |
|
| 1354 | - elseif (isset($_POST['new_buddy'])) |
|
| 1422 | + } elseif (isset($_POST['new_buddy'])) |
|
| 1355 | 1423 | { |
| 1356 | 1424 | checkSession(); |
| 1357 | 1425 | |
@@ -1364,8 +1432,9 @@ discard block |
||
| 1364 | 1432 | { |
| 1365 | 1433 | $new_buddies[$k] = strtr(trim($new_buddies[$k]), array('\'' => ''')); |
| 1366 | 1434 | |
| 1367 | - if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
| 1368 | - unset($new_buddies[$k]); |
|
| 1435 | + if (strlen($new_buddies[$k]) == 0 || in_array($new_buddies[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
| 1436 | + unset($new_buddies[$k]); |
|
| 1437 | + } |
|
| 1369 | 1438 | } |
| 1370 | 1439 | |
| 1371 | 1440 | call_integration_hook('integrate_add_buddies', array($memID, &$new_buddies)); |
@@ -1385,16 +1454,18 @@ discard block |
||
| 1385 | 1454 | ) |
| 1386 | 1455 | ); |
| 1387 | 1456 | |
| 1388 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1389 | - $_SESSION['prf-save'] = true; |
|
| 1457 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1458 | + $_SESSION['prf-save'] = true; |
|
| 1459 | + } |
|
| 1390 | 1460 | |
| 1391 | 1461 | // Add the new member to the buddies array. |
| 1392 | 1462 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1393 | 1463 | { |
| 1394 | - if (in_array($row['id_member'], $buddiesArray)) |
|
| 1395 | - continue; |
|
| 1396 | - else |
|
| 1397 | - $buddiesArray[] = (int) $row['id_member']; |
|
| 1464 | + if (in_array($row['id_member'], $buddiesArray)) { |
|
| 1465 | + continue; |
|
| 1466 | + } else { |
|
| 1467 | + $buddiesArray[] = (int) $row['id_member']; |
|
| 1468 | + } |
|
| 1398 | 1469 | } |
| 1399 | 1470 | $smcFunc['db_free_result']($request); |
| 1400 | 1471 | |
@@ -1424,18 +1495,20 @@ discard block |
||
| 1424 | 1495 | |
| 1425 | 1496 | $context['custom_pf'] = array(); |
| 1426 | 1497 | $disabled_fields = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array(); |
| 1427 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1428 | - if (!isset($disabled_fields[$row['col_name']])) |
|
| 1498 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1499 | + if (!isset($disabled_fields[$row['col_name']])) |
|
| 1429 | 1500 | $context['custom_pf'][$row['col_name']] = array( |
| 1430 | 1501 | 'label' => $row['field_name'], |
| 1431 | 1502 | 'type' => $row['field_type'], |
| 1432 | 1503 | 'bbc' => !empty($row['bbc']), |
| 1433 | 1504 | 'enclose' => $row['enclose'], |
| 1434 | 1505 | ); |
| 1506 | + } |
|
| 1435 | 1507 | |
| 1436 | 1508 | // Gotta disable the gender option. |
| 1437 | - if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'Disabled') |
|
| 1438 | - unset($context['custom_pf']['cust_gender']); |
|
| 1509 | + if (isset($context['custom_pf']['cust_gender']) && $context['custom_pf']['cust_gender'] == 'Disabled') { |
|
| 1510 | + unset($context['custom_pf']['cust_gender']); |
|
| 1511 | + } |
|
| 1439 | 1512 | |
| 1440 | 1513 | $smcFunc['db_free_result']($request); |
| 1441 | 1514 | |
@@ -1452,8 +1525,9 @@ discard block |
||
| 1452 | 1525 | 'buddy_list_count' => substr_count($user_profile[$memID]['buddy_list'], ',') + 1, |
| 1453 | 1526 | ) |
| 1454 | 1527 | ); |
| 1455 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1456 | - $buddies[] = $row['id_member']; |
|
| 1528 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1529 | + $buddies[] = $row['id_member']; |
|
| 1530 | + } |
|
| 1457 | 1531 | $smcFunc['db_free_result']($result); |
| 1458 | 1532 | } |
| 1459 | 1533 | |
@@ -1481,30 +1555,32 @@ discard block |
||
| 1481 | 1555 | continue; |
| 1482 | 1556 | } |
| 1483 | 1557 | |
| 1484 | - if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) |
|
| 1485 | - $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
| 1486 | - |
|
| 1487 | - elseif ($column['type'] == 'check') |
|
| 1488 | - $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
| 1558 | + if ($column['bbc'] && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
| 1559 | + $context['buddies'][$buddy]['options'][$key] = strip_tags(parse_bbc($context['buddies'][$buddy]['options'][$key])); |
|
| 1560 | + } elseif ($column['type'] == 'check') { |
|
| 1561 | + $context['buddies'][$buddy]['options'][$key] = $context['buddies'][$buddy]['options'][$key] == 0 ? $txt['no'] : $txt['yes']; |
|
| 1562 | + } |
|
| 1489 | 1563 | |
| 1490 | 1564 | // Enclosing the user input within some other text? |
| 1491 | - if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) |
|
| 1492 | - $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
| 1565 | + if (!empty($column['enclose']) && !empty($context['buddies'][$buddy]['options'][$key])) { |
|
| 1566 | + $context['buddies'][$buddy]['options'][$key] = strtr($column['enclose'], array( |
|
| 1493 | 1567 | '{SCRIPTURL}' => $scripturl, |
| 1494 | 1568 | '{IMAGES_URL}' => $settings['images_url'], |
| 1495 | 1569 | '{DEFAULT_IMAGES_URL}' => $settings['default_images_url'], |
| 1496 | 1570 | '{INPUT}' => $context['buddies'][$buddy]['options'][$key], |
| 1497 | 1571 | )); |
| 1572 | + } |
|
| 1498 | 1573 | } |
| 1499 | 1574 | } |
| 1500 | 1575 | } |
| 1501 | 1576 | |
| 1502 | 1577 | if (isset($_SESSION['prf-save'])) |
| 1503 | 1578 | { |
| 1504 | - if ($_SESSION['prf-save'] === true) |
|
| 1505 | - $context['saved_successful'] = true; |
|
| 1506 | - else |
|
| 1507 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1579 | + if ($_SESSION['prf-save'] === true) { |
|
| 1580 | + $context['saved_successful'] = true; |
|
| 1581 | + } else { |
|
| 1582 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1583 | + } |
|
| 1508 | 1584 | |
| 1509 | 1585 | unset($_SESSION['prf-save']); |
| 1510 | 1586 | } |
@@ -1524,9 +1600,10 @@ discard block |
||
| 1524 | 1600 | |
| 1525 | 1601 | // For making changes! |
| 1526 | 1602 | $ignoreArray = explode(',', $user_profile[$memID]['pm_ignore_list']); |
| 1527 | - foreach ($ignoreArray as $k => $dummy) |
|
| 1528 | - if ($dummy == '') |
|
| 1603 | + foreach ($ignoreArray as $k => $dummy) { |
|
| 1604 | + if ($dummy == '') |
|
| 1529 | 1605 | unset($ignoreArray[$k]); |
| 1606 | + } |
|
| 1530 | 1607 | |
| 1531 | 1608 | // Removing a member from the ignore list? |
| 1532 | 1609 | if (isset($_GET['remove'])) |
@@ -1536,10 +1613,11 @@ discard block |
||
| 1536 | 1613 | $_SESSION['prf-save'] = $txt['could_not_remove_person']; |
| 1537 | 1614 | |
| 1538 | 1615 | // Heh, I'm lazy, do it the easy way... |
| 1539 | - foreach ($ignoreArray as $key => $id_remove) |
|
| 1540 | - if ($id_remove == (int) $_GET['remove']) |
|
| 1616 | + foreach ($ignoreArray as $key => $id_remove) { |
|
| 1617 | + if ($id_remove == (int) $_GET['remove']) |
|
| 1541 | 1618 | { |
| 1542 | 1619 | unset($ignoreArray[$key]); |
| 1620 | + } |
|
| 1543 | 1621 | $_SESSION['prf-save'] = true; |
| 1544 | 1622 | } |
| 1545 | 1623 | |
@@ -1549,8 +1627,7 @@ discard block |
||
| 1549 | 1627 | |
| 1550 | 1628 | // Redirect off the page because we don't like all this ugly query stuff to stick in the history. |
| 1551 | 1629 | redirectexit('action=profile;area=lists;sa=ignore;u=' . $memID); |
| 1552 | - } |
|
| 1553 | - elseif (isset($_POST['new_ignore'])) |
|
| 1630 | + } elseif (isset($_POST['new_ignore'])) |
|
| 1554 | 1631 | { |
| 1555 | 1632 | checkSession(); |
| 1556 | 1633 | // Prepare the string for extraction... |
@@ -1562,8 +1639,9 @@ discard block |
||
| 1562 | 1639 | { |
| 1563 | 1640 | $new_entries[$k] = strtr(trim($new_entries[$k]), array('\'' => ''')); |
| 1564 | 1641 | |
| 1565 | - if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) |
|
| 1566 | - unset($new_entries[$k]); |
|
| 1642 | + if (strlen($new_entries[$k]) == 0 || in_array($new_entries[$k], array($user_profile[$memID]['member_name'], $user_profile[$memID]['real_name']))) { |
|
| 1643 | + unset($new_entries[$k]); |
|
| 1644 | + } |
|
| 1567 | 1645 | } |
| 1568 | 1646 | |
| 1569 | 1647 | $_SESSION['prf-save'] = $txt['could_not_add_person']; |
@@ -1581,16 +1659,18 @@ discard block |
||
| 1581 | 1659 | ) |
| 1582 | 1660 | ); |
| 1583 | 1661 | |
| 1584 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 1585 | - $_SESSION['prf-save'] = true; |
|
| 1662 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 1663 | + $_SESSION['prf-save'] = true; |
|
| 1664 | + } |
|
| 1586 | 1665 | |
| 1587 | 1666 | // Add the new member to the buddies array. |
| 1588 | 1667 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1589 | 1668 | { |
| 1590 | - if (in_array($row['id_member'], $ignoreArray)) |
|
| 1591 | - continue; |
|
| 1592 | - else |
|
| 1593 | - $ignoreArray[] = (int) $row['id_member']; |
|
| 1669 | + if (in_array($row['id_member'], $ignoreArray)) { |
|
| 1670 | + continue; |
|
| 1671 | + } else { |
|
| 1672 | + $ignoreArray[] = (int) $row['id_member']; |
|
| 1673 | + } |
|
| 1594 | 1674 | } |
| 1595 | 1675 | $smcFunc['db_free_result']($request); |
| 1596 | 1676 | |
@@ -1619,8 +1699,9 @@ discard block |
||
| 1619 | 1699 | 'ignore_list_count' => substr_count($user_profile[$memID]['pm_ignore_list'], ',') + 1, |
| 1620 | 1700 | ) |
| 1621 | 1701 | ); |
| 1622 | - while ($row = $smcFunc['db_fetch_assoc']($result)) |
|
| 1623 | - $ignored[] = $row['id_member']; |
|
| 1702 | + while ($row = $smcFunc['db_fetch_assoc']($result)) { |
|
| 1703 | + $ignored[] = $row['id_member']; |
|
| 1704 | + } |
|
| 1624 | 1705 | $smcFunc['db_free_result']($result); |
| 1625 | 1706 | } |
| 1626 | 1707 | |
@@ -1639,10 +1720,11 @@ discard block |
||
| 1639 | 1720 | |
| 1640 | 1721 | if (isset($_SESSION['prf-save'])) |
| 1641 | 1722 | { |
| 1642 | - if ($_SESSION['prf-save'] === true) |
|
| 1643 | - $context['saved_successful'] = true; |
|
| 1644 | - else |
|
| 1645 | - $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1723 | + if ($_SESSION['prf-save'] === true) { |
|
| 1724 | + $context['saved_successful'] = true; |
|
| 1725 | + } else { |
|
| 1726 | + $context['saved_failed'] = $_SESSION['prf-save']; |
|
| 1727 | + } |
|
| 1646 | 1728 | |
| 1647 | 1729 | unset($_SESSION['prf-save']); |
| 1648 | 1730 | } |
@@ -1658,8 +1740,9 @@ discard block |
||
| 1658 | 1740 | global $context, $txt; |
| 1659 | 1741 | |
| 1660 | 1742 | loadThemeOptions($memID); |
| 1661 | - if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) |
|
| 1662 | - loadCustomFields($memID, 'account'); |
|
| 1743 | + if (allowedTo(array('profile_identity_own', 'profile_identity_any', 'profile_password_own', 'profile_password_any'))) { |
|
| 1744 | + loadCustomFields($memID, 'account'); |
|
| 1745 | + } |
|
| 1663 | 1746 | |
| 1664 | 1747 | $context['sub_template'] = 'edit_options'; |
| 1665 | 1748 | $context['page_desc'] = $txt['account_info']; |
@@ -1686,8 +1769,9 @@ discard block |
||
| 1686 | 1769 | global $context, $txt; |
| 1687 | 1770 | |
| 1688 | 1771 | loadThemeOptions($memID); |
| 1689 | - if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) |
|
| 1690 | - loadCustomFields($memID, 'forumprofile'); |
|
| 1772 | + if (allowedTo(array('profile_forum_own', 'profile_forum_any'))) { |
|
| 1773 | + loadCustomFields($memID, 'forumprofile'); |
|
| 1774 | + } |
|
| 1691 | 1775 | |
| 1692 | 1776 | $context['sub_template'] = 'edit_options'; |
| 1693 | 1777 | $context['page_desc'] = $txt['forumProfile_info']; |
@@ -1720,18 +1804,21 @@ discard block |
||
| 1720 | 1804 | $dirs = array(); |
| 1721 | 1805 | $files = array(); |
| 1722 | 1806 | |
| 1723 | - if (!$dir) |
|
| 1724 | - return array(); |
|
| 1807 | + if (!$dir) { |
|
| 1808 | + return array(); |
|
| 1809 | + } |
|
| 1725 | 1810 | |
| 1726 | 1811 | while ($line = $dir->read()) |
| 1727 | 1812 | { |
| 1728 | - if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) |
|
| 1729 | - continue; |
|
| 1813 | + if (in_array($line, array('.', '..', 'blank.png', 'index.php'))) { |
|
| 1814 | + continue; |
|
| 1815 | + } |
|
| 1730 | 1816 | |
| 1731 | - if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) |
|
| 1732 | - $dirs[] = $line; |
|
| 1733 | - else |
|
| 1734 | - $files[] = $line; |
|
| 1817 | + if (is_dir($modSettings['avatar_directory'] . '/' . $directory . (!empty($directory) ? '/' : '') . $line)) { |
|
| 1818 | + $dirs[] = $line; |
|
| 1819 | + } else { |
|
| 1820 | + $files[] = $line; |
|
| 1821 | + } |
|
| 1735 | 1822 | } |
| 1736 | 1823 | $dir->close(); |
| 1737 | 1824 | |
@@ -1752,14 +1839,15 @@ discard block |
||
| 1752 | 1839 | foreach ($dirs as $line) |
| 1753 | 1840 | { |
| 1754 | 1841 | $tmp = getAvatars($directory . (!empty($directory) ? '/' : '') . $line, $level + 1); |
| 1755 | - if (!empty($tmp)) |
|
| 1756 | - $result[] = array( |
|
| 1842 | + if (!empty($tmp)) { |
|
| 1843 | + $result[] = array( |
|
| 1757 | 1844 | 'filename' => $smcFunc['htmlspecialchars']($line), |
| 1758 | 1845 | 'checked' => strpos($context['member']['avatar']['server_pic'], $line . '/') !== false, |
| 1759 | 1846 | 'name' => '[' . $smcFunc['htmlspecialchars'](str_replace('_', ' ', $line)) . ']', |
| 1760 | 1847 | 'is_dir' => true, |
| 1761 | 1848 | 'files' => $tmp |
| 1762 | 1849 | ); |
| 1850 | + } |
|
| 1763 | 1851 | unset($tmp); |
| 1764 | 1852 | } |
| 1765 | 1853 | |
@@ -1769,8 +1857,9 @@ discard block |
||
| 1769 | 1857 | $extension = substr(strrchr($line, '.'), 1); |
| 1770 | 1858 | |
| 1771 | 1859 | // Make sure it is an image. |
| 1772 | - if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) |
|
| 1773 | - continue; |
|
| 1860 | + if (strcasecmp($extension, 'gif') != 0 && strcasecmp($extension, 'jpg') != 0 && strcasecmp($extension, 'jpeg') != 0 && strcasecmp($extension, 'png') != 0 && strcasecmp($extension, 'bmp') != 0) { |
|
| 1861 | + continue; |
|
| 1862 | + } |
|
| 1774 | 1863 | |
| 1775 | 1864 | $result[] = array( |
| 1776 | 1865 | 'filename' => $smcFunc['htmlspecialchars']($line), |
@@ -1778,8 +1867,9 @@ discard block |
||
| 1778 | 1867 | 'name' => $smcFunc['htmlspecialchars'](str_replace('_', ' ', $filename)), |
| 1779 | 1868 | 'is_dir' => false |
| 1780 | 1869 | ); |
| 1781 | - if ($level == 1) |
|
| 1782 | - $context['avatar_list'][] = $directory . '/' . $line; |
|
| 1870 | + if ($level == 1) { |
|
| 1871 | + $context['avatar_list'][] = $directory . '/' . $line; |
|
| 1872 | + } |
|
| 1783 | 1873 | } |
| 1784 | 1874 | |
| 1785 | 1875 | return $result; |
@@ -1798,8 +1888,9 @@ discard block |
||
| 1798 | 1888 | loadSubTemplate('options'); |
| 1799 | 1889 | |
| 1800 | 1890 | loadThemeOptions($memID); |
| 1801 | - if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) |
|
| 1802 | - loadCustomFields($memID, 'theme'); |
|
| 1891 | + if (allowedTo(array('profile_extra_own', 'profile_extra_any'))) { |
|
| 1892 | + loadCustomFields($memID, 'theme'); |
|
| 1893 | + } |
|
| 1803 | 1894 | |
| 1804 | 1895 | $context['sub_template'] = 'edit_options'; |
| 1805 | 1896 | $context['page_desc'] = $txt['theme_info']; |
@@ -1853,16 +1944,19 @@ discard block |
||
| 1853 | 1944 | { |
| 1854 | 1945 | global $txt, $user_profile, $context, $modSettings, $smcFunc, $sourcedir; |
| 1855 | 1946 | |
| 1856 | - if (!isset($context['token_check'])) |
|
| 1857 | - $context['token_check'] = 'profile-nt' . $memID; |
|
| 1947 | + if (!isset($context['token_check'])) { |
|
| 1948 | + $context['token_check'] = 'profile-nt' . $memID; |
|
| 1949 | + } |
|
| 1858 | 1950 | |
| 1859 | 1951 | is_not_guest(); |
| 1860 | - if (!$context['user']['is_owner']) |
|
| 1861 | - isAllowedTo('profile_extra_any'); |
|
| 1952 | + if (!$context['user']['is_owner']) { |
|
| 1953 | + isAllowedTo('profile_extra_any'); |
|
| 1954 | + } |
|
| 1862 | 1955 | |
| 1863 | 1956 | // Set the post action if we're coming from the profile... |
| 1864 | - if (!isset($context['action'])) |
|
| 1865 | - $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
| 1957 | + if (!isset($context['action'])) { |
|
| 1958 | + $context['action'] = 'action=profile;area=notification;sa=alerts;u=' . $memID; |
|
| 1959 | + } |
|
| 1866 | 1960 | |
| 1867 | 1961 | // What options are set |
| 1868 | 1962 | loadThemeOptions($memID); |
@@ -1949,28 +2043,34 @@ discard block |
||
| 1949 | 2043 | ); |
| 1950 | 2044 | |
| 1951 | 2045 | // There are certain things that are disabled at the group level. |
| 1952 | - if (empty($modSettings['cal_enabled'])) |
|
| 1953 | - unset($alert_types['calendar']); |
|
| 2046 | + if (empty($modSettings['cal_enabled'])) { |
|
| 2047 | + unset($alert_types['calendar']); |
|
| 2048 | + } |
|
| 1954 | 2049 | |
| 1955 | 2050 | // Disable paid subscriptions at group level if they're disabled |
| 1956 | - if (empty($modSettings['paid_enabled'])) |
|
| 1957 | - unset($alert_types['paidsubs']); |
|
| 2051 | + if (empty($modSettings['paid_enabled'])) { |
|
| 2052 | + unset($alert_types['paidsubs']); |
|
| 2053 | + } |
|
| 1958 | 2054 | |
| 1959 | 2055 | // Disable membergroup requests at group level if they're disabled |
| 1960 | - if (empty($modSettings['show_group_membership'])) |
|
| 1961 | - unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
| 2056 | + if (empty($modSettings['show_group_membership'])) { |
|
| 2057 | + unset($alert_types['groupr'], $alert_types['members']['request_group']); |
|
| 2058 | + } |
|
| 1962 | 2059 | |
| 1963 | 2060 | // Disable mentions if they're disabled |
| 1964 | - if (empty($modSettings['enable_mentions'])) |
|
| 1965 | - unset($alert_types['msg']['msg_mention']); |
|
| 2061 | + if (empty($modSettings['enable_mentions'])) { |
|
| 2062 | + unset($alert_types['msg']['msg_mention']); |
|
| 2063 | + } |
|
| 1966 | 2064 | |
| 1967 | 2065 | // Disable likes if they're disabled |
| 1968 | - if (empty($modSettings['enable_likes'])) |
|
| 1969 | - unset($alert_types['msg']['msg_like']); |
|
| 2066 | + if (empty($modSettings['enable_likes'])) { |
|
| 2067 | + unset($alert_types['msg']['msg_like']); |
|
| 2068 | + } |
|
| 1970 | 2069 | |
| 1971 | 2070 | // Disable buddy requests if they're disabled |
| 1972 | - if (empty($modSettings['enable_buddylist'])) |
|
| 1973 | - unset($alert_types['members']['buddy_request']); |
|
| 2071 | + if (empty($modSettings['enable_buddylist'])) { |
|
| 2072 | + unset($alert_types['members']['buddy_request']); |
|
| 2073 | + } |
|
| 1974 | 2074 | |
| 1975 | 2075 | // Now, now, we could pass this through global but we should really get into the habit of |
| 1976 | 2076 | // passing content to hooks, not expecting hooks to splatter everything everywhere. |
@@ -1998,15 +2098,17 @@ discard block |
||
| 1998 | 2098 | $perms_cache['manage_membergroups'] = in_array($memID, $members); |
| 1999 | 2099 | } |
| 2000 | 2100 | |
| 2001 | - if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) |
|
| 2002 | - unset($alert_types['members']['request_group']); |
|
| 2101 | + if (!($perms_cache['manage_membergroups'] || $can_mod != 0)) { |
|
| 2102 | + unset($alert_types['members']['request_group']); |
|
| 2103 | + } |
|
| 2003 | 2104 | |
| 2004 | 2105 | foreach ($alert_types as $group => $items) |
| 2005 | 2106 | { |
| 2006 | 2107 | foreach ($items as $alert_key => $alert_value) |
| 2007 | 2108 | { |
| 2008 | - if (!isset($alert_value['permission'])) |
|
| 2009 | - continue; |
|
| 2109 | + if (!isset($alert_value['permission'])) { |
|
| 2110 | + continue; |
|
| 2111 | + } |
|
| 2010 | 2112 | if (!isset($perms_cache[$alert_value['permission']['name']])) |
| 2011 | 2113 | { |
| 2012 | 2114 | $in_board = !empty($alert_value['permission']['is_board']) ? 0 : null; |
@@ -2014,12 +2116,14 @@ discard block |
||
| 2014 | 2116 | $perms_cache[$alert_value['permission']['name']] = in_array($memID, $members); |
| 2015 | 2117 | } |
| 2016 | 2118 | |
| 2017 | - if (!$perms_cache[$alert_value['permission']['name']]) |
|
| 2018 | - unset ($alert_types[$group][$alert_key]); |
|
| 2119 | + if (!$perms_cache[$alert_value['permission']['name']]) { |
|
| 2120 | + unset ($alert_types[$group][$alert_key]); |
|
| 2121 | + } |
|
| 2019 | 2122 | } |
| 2020 | 2123 | |
| 2021 | - if (empty($alert_types[$group])) |
|
| 2022 | - unset ($alert_types[$group]); |
|
| 2124 | + if (empty($alert_types[$group])) { |
|
| 2125 | + unset ($alert_types[$group]); |
|
| 2126 | + } |
|
| 2023 | 2127 | } |
| 2024 | 2128 | } |
| 2025 | 2129 | |
@@ -2051,9 +2155,9 @@ discard block |
||
| 2051 | 2155 | $update_prefs[$this_option[1]] = !empty($_POST['opt_' . $this_option[1]]) ? 1 : 0; |
| 2052 | 2156 | break; |
| 2053 | 2157 | case 'select': |
| 2054 | - if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) |
|
| 2055 | - $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
| 2056 | - else |
|
| 2158 | + if (isset($_POST['opt_' . $this_option[1]], $this_option['opts'][$_POST['opt_' . $this_option[1]]])) { |
|
| 2159 | + $update_prefs[$this_option[1]] = $_POST['opt_' . $this_option[1]]; |
|
| 2160 | + } else |
|
| 2057 | 2161 | { |
| 2058 | 2162 | // We didn't have a sane value. Let's grab the first item from the possibles. |
| 2059 | 2163 | $keys = array_keys($this_option['opts']); |
@@ -2073,23 +2177,28 @@ discard block |
||
| 2073 | 2177 | $this_value = 0; |
| 2074 | 2178 | foreach ($context['alert_bits'] as $type => $bitvalue) |
| 2075 | 2179 | { |
| 2076 | - if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') |
|
| 2077 | - $this_value |= $bitvalue; |
|
| 2180 | + if ($this_options[$type] == 'yes' && !empty($_POST[$type . '_' . $item_key]) || $this_options[$type] == 'always') { |
|
| 2181 | + $this_value |= $bitvalue; |
|
| 2182 | + } |
|
| 2183 | + } |
|
| 2184 | + if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) { |
|
| 2185 | + $update_prefs[$item_key] = $this_value; |
|
| 2078 | 2186 | } |
| 2079 | - if (!isset($context['alert_prefs'][$item_key]) || $context['alert_prefs'][$item_key] != $this_value) |
|
| 2080 | - $update_prefs[$item_key] = $this_value; |
|
| 2081 | 2187 | } |
| 2082 | 2188 | } |
| 2083 | 2189 | |
| 2084 | - if (!empty($_POST['opt_alert_timeout'])) |
|
| 2085 | - $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
| 2190 | + if (!empty($_POST['opt_alert_timeout'])) { |
|
| 2191 | + $update_prefs['alert_timeout'] = $context['member']['alert_timeout'] = (int) $_POST['opt_alert_timeout']; |
|
| 2192 | + } |
|
| 2086 | 2193 | |
| 2087 | - if (!empty($_POST['notify_announcements'])) |
|
| 2088 | - $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
| 2194 | + if (!empty($_POST['notify_announcements'])) { |
|
| 2195 | + $update_prefs['announcements'] = $context['member']['notify_announcements'] = (int) $_POST['notify_announcements']; |
|
| 2196 | + } |
|
| 2089 | 2197 | |
| 2090 | 2198 | setNotifyPrefs((int) $memID, $update_prefs); |
| 2091 | - foreach ($update_prefs as $pref => $value) |
|
| 2092 | - $context['alert_prefs'][$pref] = $value; |
|
| 2199 | + foreach ($update_prefs as $pref => $value) { |
|
| 2200 | + $context['alert_prefs'][$pref] = $value; |
|
| 2201 | + } |
|
| 2093 | 2202 | |
| 2094 | 2203 | makeNotificationChanges($memID); |
| 2095 | 2204 | |
@@ -2119,8 +2228,9 @@ discard block |
||
| 2119 | 2228 | |
| 2120 | 2229 | // Now we're all set up. |
| 2121 | 2230 | is_not_guest(); |
| 2122 | - if (!$context['user']['is_owner']) |
|
| 2123 | - fatal_error('no_access'); |
|
| 2231 | + if (!$context['user']['is_owner']) { |
|
| 2232 | + fatal_error('no_access'); |
|
| 2233 | + } |
|
| 2124 | 2234 | |
| 2125 | 2235 | checkSession('get'); |
| 2126 | 2236 | |
@@ -2152,8 +2262,9 @@ discard block |
||
| 2152 | 2262 | { |
| 2153 | 2263 | global $smcFunc; |
| 2154 | 2264 | |
| 2155 | - if (empty($toMark) || empty($memID)) |
|
| 2156 | - return false; |
|
| 2265 | + if (empty($toMark) || empty($memID)) { |
|
| 2266 | + return false; |
|
| 2267 | + } |
|
| 2157 | 2268 | |
| 2158 | 2269 | $toMark = (array) $toMark; |
| 2159 | 2270 | |
@@ -2187,8 +2298,9 @@ discard block |
||
| 2187 | 2298 | { |
| 2188 | 2299 | global $smcFunc; |
| 2189 | 2300 | |
| 2190 | - if (empty($toDelete)) |
|
| 2191 | - return false; |
|
| 2301 | + if (empty($toDelete)) { |
|
| 2302 | + return false; |
|
| 2303 | + } |
|
| 2192 | 2304 | |
| 2193 | 2305 | $toDelete = (array) $toDelete; |
| 2194 | 2306 | |
@@ -2223,8 +2335,9 @@ discard block |
||
| 2223 | 2335 | { |
| 2224 | 2336 | global $smcFunc; |
| 2225 | 2337 | |
| 2226 | - if (empty($memID)) |
|
| 2227 | - return false; |
|
| 2338 | + if (empty($memID)) { |
|
| 2339 | + return false; |
|
| 2340 | + } |
|
| 2228 | 2341 | |
| 2229 | 2342 | $request = $smcFunc['db_query']('', ' |
| 2230 | 2343 | SELECT id_alert |
@@ -2301,8 +2414,9 @@ discard block |
||
| 2301 | 2414 | { |
| 2302 | 2415 | $link = $topic['link']; |
| 2303 | 2416 | |
| 2304 | - if ($topic['new']) |
|
| 2305 | - $link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2417 | + if ($topic['new']) { |
|
| 2418 | + $link .= ' <a href="' . $topic['new_href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2419 | + } |
|
| 2306 | 2420 | |
| 2307 | 2421 | $link .= '<br><span class="smalltext"><em>' . $txt['in'] . ' ' . $topic['board_link'] . '</em></span>'; |
| 2308 | 2422 | |
@@ -2453,8 +2567,9 @@ discard block |
||
| 2453 | 2567 | { |
| 2454 | 2568 | $link = $board['link']; |
| 2455 | 2569 | |
| 2456 | - if ($board['new']) |
|
| 2457 | - $link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2570 | + if ($board['new']) { |
|
| 2571 | + $link .= ' <a href="' . $board['href'] . '"><span class="new_posts">' . $txt['new'] . '</span></a>'; |
|
| 2572 | + } |
|
| 2458 | 2573 | |
| 2459 | 2574 | return $link; |
| 2460 | 2575 | }, |
@@ -2654,8 +2769,8 @@ discard block |
||
| 2654 | 2769 | ) |
| 2655 | 2770 | ); |
| 2656 | 2771 | $notification_boards = array(); |
| 2657 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 2658 | - $notification_boards[] = array( |
|
| 2772 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 2773 | + $notification_boards[] = array( |
|
| 2659 | 2774 | 'id' => $row['id_board'], |
| 2660 | 2775 | 'name' => $row['name'], |
| 2661 | 2776 | 'href' => $scripturl . '?board=' . $row['id_board'] . '.0', |
@@ -2663,6 +2778,7 @@ discard block |
||
| 2663 | 2778 | 'new' => $row['board_read'] < $row['id_msg_updated'], |
| 2664 | 2779 | 'notify_pref' => isset($prefs['board_notify_' . $row['id_board']]) ? $prefs['board_notify_' . $row['id_board']] : (!empty($prefs['board_notify']) ? $prefs['board_notify'] : 0), |
| 2665 | 2780 | ); |
| 2781 | + } |
|
| 2666 | 2782 | $smcFunc['db_free_result']($request); |
| 2667 | 2783 | |
| 2668 | 2784 | return $notification_boards; |
@@ -2677,17 +2793,18 @@ discard block |
||
| 2677 | 2793 | { |
| 2678 | 2794 | global $context, $options, $cur_profile, $smcFunc; |
| 2679 | 2795 | |
| 2680 | - if (isset($_POST['default_options'])) |
|
| 2681 | - $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
| 2796 | + if (isset($_POST['default_options'])) { |
|
| 2797 | + $_POST['options'] = isset($_POST['options']) ? $_POST['options'] + $_POST['default_options'] : $_POST['default_options']; |
|
| 2798 | + } |
|
| 2682 | 2799 | |
| 2683 | 2800 | if ($context['user']['is_owner']) |
| 2684 | 2801 | { |
| 2685 | 2802 | $context['member']['options'] = $options; |
| 2686 | - if (isset($_POST['options']) && is_array($_POST['options'])) |
|
| 2687 | - foreach ($_POST['options'] as $k => $v) |
|
| 2803 | + if (isset($_POST['options']) && is_array($_POST['options'])) { |
|
| 2804 | + foreach ($_POST['options'] as $k => $v) |
|
| 2688 | 2805 | $context['member']['options'][$k] = $v; |
| 2689 | - } |
|
| 2690 | - else |
|
| 2806 | + } |
|
| 2807 | + } else |
|
| 2691 | 2808 | { |
| 2692 | 2809 | $request = $smcFunc['db_query']('', ' |
| 2693 | 2810 | SELECT id_member, variable, value |
@@ -2708,8 +2825,9 @@ discard block |
||
| 2708 | 2825 | continue; |
| 2709 | 2826 | } |
| 2710 | 2827 | |
| 2711 | - if (isset($_POST['options'][$row['variable']])) |
|
| 2712 | - $row['value'] = $_POST['options'][$row['variable']]; |
|
| 2828 | + if (isset($_POST['options'][$row['variable']])) { |
|
| 2829 | + $row['value'] = $_POST['options'][$row['variable']]; |
|
| 2830 | + } |
|
| 2713 | 2831 | $context['member']['options'][$row['variable']] = $row['value']; |
| 2714 | 2832 | } |
| 2715 | 2833 | $smcFunc['db_free_result']($request); |
@@ -2717,8 +2835,9 @@ discard block |
||
| 2717 | 2835 | // Load up the default theme options for any missing. |
| 2718 | 2836 | foreach ($temp as $k => $v) |
| 2719 | 2837 | { |
| 2720 | - if (!isset($context['member']['options'][$k])) |
|
| 2721 | - $context['member']['options'][$k] = $v; |
|
| 2838 | + if (!isset($context['member']['options'][$k])) { |
|
| 2839 | + $context['member']['options'][$k] = $v; |
|
| 2840 | + } |
|
| 2722 | 2841 | } |
| 2723 | 2842 | } |
| 2724 | 2843 | } |
@@ -2733,8 +2852,9 @@ discard block |
||
| 2733 | 2852 | global $context, $modSettings, $smcFunc, $cur_profile, $sourcedir; |
| 2734 | 2853 | |
| 2735 | 2854 | // Have the admins enabled this option? |
| 2736 | - if (empty($modSettings['allow_ignore_boards'])) |
|
| 2737 | - fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
| 2855 | + if (empty($modSettings['allow_ignore_boards'])) { |
|
| 2856 | + fatal_lang_error('ignoreboards_disallowed', 'user'); |
|
| 2857 | + } |
|
| 2738 | 2858 | |
| 2739 | 2859 | // Find all the boards this user is allowed to see. |
| 2740 | 2860 | $request = $smcFunc['db_query']('order_by_board_order', ' |
@@ -2754,12 +2874,13 @@ discard block |
||
| 2754 | 2874 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2755 | 2875 | { |
| 2756 | 2876 | // This category hasn't been set up yet.. |
| 2757 | - if (!isset($context['categories'][$row['id_cat']])) |
|
| 2758 | - $context['categories'][$row['id_cat']] = array( |
|
| 2877 | + if (!isset($context['categories'][$row['id_cat']])) { |
|
| 2878 | + $context['categories'][$row['id_cat']] = array( |
|
| 2759 | 2879 | 'id' => $row['id_cat'], |
| 2760 | 2880 | 'name' => $row['cat_name'], |
| 2761 | 2881 | 'boards' => array() |
| 2762 | 2882 | ); |
| 2883 | + } |
|
| 2763 | 2884 | |
| 2764 | 2885 | // Set this board up, and let the template know when it's a child. (indent them..) |
| 2765 | 2886 | $context['categories'][$row['id_cat']]['boards'][$row['id_board']] = array( |
@@ -2789,18 +2910,20 @@ discard block |
||
| 2789 | 2910 | } |
| 2790 | 2911 | |
| 2791 | 2912 | $max_boards = ceil(count($temp_boards) / 2); |
| 2792 | - if ($max_boards == 1) |
|
| 2793 | - $max_boards = 2; |
|
| 2913 | + if ($max_boards == 1) { |
|
| 2914 | + $max_boards = 2; |
|
| 2915 | + } |
|
| 2794 | 2916 | |
| 2795 | 2917 | // Now, alternate them so they can be shown left and right ;). |
| 2796 | 2918 | $context['board_columns'] = array(); |
| 2797 | 2919 | for ($i = 0; $i < $max_boards; $i++) |
| 2798 | 2920 | { |
| 2799 | 2921 | $context['board_columns'][] = $temp_boards[$i]; |
| 2800 | - if (isset($temp_boards[$i + $max_boards])) |
|
| 2801 | - $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
| 2802 | - else |
|
| 2803 | - $context['board_columns'][] = array(); |
|
| 2922 | + if (isset($temp_boards[$i + $max_boards])) { |
|
| 2923 | + $context['board_columns'][] = $temp_boards[$i + $max_boards]; |
|
| 2924 | + } else { |
|
| 2925 | + $context['board_columns'][] = array(); |
|
| 2926 | + } |
|
| 2804 | 2927 | } |
| 2805 | 2928 | |
| 2806 | 2929 | loadThemeOptions($memID); |
@@ -2869,8 +2992,9 @@ discard block |
||
| 2869 | 2992 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 2870 | 2993 | { |
| 2871 | 2994 | // We should skip the administrator group if they don't have the admin_forum permission! |
| 2872 | - if ($row['id_group'] == 1 && !allowedTo('admin_forum')) |
|
| 2873 | - continue; |
|
| 2995 | + if ($row['id_group'] == 1 && !allowedTo('admin_forum')) { |
|
| 2996 | + continue; |
|
| 2997 | + } |
|
| 2874 | 2998 | |
| 2875 | 2999 | $context['member_groups'][$row['id_group']] = array( |
| 2876 | 3000 | 'id' => $row['id_group'], |
@@ -2916,16 +3040,17 @@ discard block |
||
| 2916 | 3040 | $context['max_signature_length'] = $context['signature_limits']['max_length']; |
| 2917 | 3041 | // Warning message for signature image limits? |
| 2918 | 3042 | $context['signature_warning'] = ''; |
| 2919 | - if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) |
|
| 2920 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
| 2921 | - elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) |
|
| 2922 | - $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
| 3043 | + if ($context['signature_limits']['max_image_width'] && $context['signature_limits']['max_image_height']) { |
|
| 3044 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_size'], $context['signature_limits']['max_image_width'], $context['signature_limits']['max_image_height']); |
|
| 3045 | + } elseif ($context['signature_limits']['max_image_width'] || $context['signature_limits']['max_image_height']) { |
|
| 3046 | + $context['signature_warning'] = sprintf($txt['profile_error_signature_max_image_' . ($context['signature_limits']['max_image_width'] ? 'width' : 'height')], $context['signature_limits'][$context['signature_limits']['max_image_width'] ? 'max_image_width' : 'max_image_height']); |
|
| 3047 | + } |
|
| 2923 | 3048 | |
| 2924 | 3049 | $context['show_spellchecking'] = !empty($modSettings['enableSpellChecking']) && (function_exists('pspell_new') || (function_exists('enchant_broker_init') && ($txt['lang_charset'] == 'UTF-8' || function_exists('iconv')))); |
| 2925 | 3050 | |
| 2926 | - if (empty($context['do_preview'])) |
|
| 2927 | - $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
| 2928 | - else |
|
| 3051 | + if (empty($context['do_preview'])) { |
|
| 3052 | + $context['member']['signature'] = empty($cur_profile['signature']) ? '' : str_replace(array('<br>', '<', '>', '"', '\''), array("\n", '<', '>', '"', '''), $cur_profile['signature']); |
|
| 3053 | + } else |
|
| 2929 | 3054 | { |
| 2930 | 3055 | $signature = !empty($_POST['signature']) ? $_POST['signature'] : ''; |
| 2931 | 3056 | $validation = profileValidateSignature($signature); |
@@ -2935,8 +3060,9 @@ discard block |
||
| 2935 | 3060 | $context['post_errors'] = array(); |
| 2936 | 3061 | } |
| 2937 | 3062 | $context['post_errors'][] = 'signature_not_yet_saved'; |
| 2938 | - if ($validation !== true && $validation !== false) |
|
| 2939 | - $context['post_errors'][] = $validation; |
|
| 3063 | + if ($validation !== true && $validation !== false) { |
|
| 3064 | + $context['post_errors'][] = $validation; |
|
| 3065 | + } |
|
| 2940 | 3066 | |
| 2941 | 3067 | censorText($context['member']['signature']); |
| 2942 | 3068 | $context['member']['current_signature'] = $context['member']['signature']; |
@@ -2946,8 +3072,9 @@ discard block |
||
| 2946 | 3072 | } |
| 2947 | 3073 | |
| 2948 | 3074 | // Load the spell checker? |
| 2949 | - if ($context['show_spellchecking']) |
|
| 2950 | - loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
| 3075 | + if ($context['show_spellchecking']) { |
|
| 3076 | + loadJavaScriptFile('spellcheck.js', array('defer' => false), 'smf_spellcheck'); |
|
| 3077 | + } |
|
| 2951 | 3078 | |
| 2952 | 3079 | return true; |
| 2953 | 3080 | } |
@@ -2981,8 +3108,7 @@ discard block |
||
| 2981 | 3108 | 'external' => $cur_profile['avatar'] == 'gravatar://' || empty($modSettings['gravatarAllowExtraEmail']) || !empty($modSettings['gravatarOverride']) ? $cur_profile['email_address'] : substr($cur_profile['avatar'], 11) |
| 2982 | 3109 | ); |
| 2983 | 3110 | $context['member']['avatar']['href'] = get_gravatar_url($context['member']['avatar']['external']); |
| 2984 | - } |
|
| 2985 | - elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
| 3111 | + } elseif ($cur_profile['avatar'] == '' && $cur_profile['id_attach'] > 0 && $context['member']['avatar']['allow_upload']) |
|
| 2986 | 3112 | { |
| 2987 | 3113 | $context['member']['avatar'] += array( |
| 2988 | 3114 | 'choice' => 'upload', |
@@ -2992,33 +3118,34 @@ discard block |
||
| 2992 | 3118 | $context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename']; |
| 2993 | 3119 | } |
| 2994 | 3120 | // Use "avatar_original" here so we show what the user entered even if the image proxy is enabled |
| 2995 | - elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) |
|
| 2996 | - $context['member']['avatar'] += array( |
|
| 3121 | + elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external']) { |
|
| 3122 | + $context['member']['avatar'] += array( |
|
| 2997 | 3123 | 'choice' => 'external', |
| 2998 | 3124 | 'server_pic' => 'blank.png', |
| 2999 | 3125 | 'external' => $cur_profile['avatar_original'] |
| 3000 | 3126 | ); |
| 3001 | - elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) |
|
| 3002 | - $context['member']['avatar'] += array( |
|
| 3127 | + } elseif ($cur_profile['avatar'] != '' && file_exists($modSettings['avatar_directory'] . '/' . $cur_profile['avatar']) && $context['member']['avatar']['allow_server_stored']) { |
|
| 3128 | + $context['member']['avatar'] += array( |
|
| 3003 | 3129 | 'choice' => 'server_stored', |
| 3004 | 3130 | 'server_pic' => $cur_profile['avatar'] == '' ? 'blank.png' : $cur_profile['avatar'], |
| 3005 | 3131 | 'external' => 'http://' |
| 3006 | 3132 | ); |
| 3007 | - else |
|
| 3008 | - $context['member']['avatar'] += array( |
|
| 3133 | + } else { |
|
| 3134 | + $context['member']['avatar'] += array( |
|
| 3009 | 3135 | 'choice' => 'none', |
| 3010 | 3136 | 'server_pic' => 'blank.png', |
| 3011 | 3137 | 'external' => 'http://' |
| 3012 | 3138 | ); |
| 3139 | + } |
|
| 3013 | 3140 | |
| 3014 | 3141 | // Get a list of all the avatars. |
| 3015 | 3142 | if ($context['member']['avatar']['allow_server_stored']) |
| 3016 | 3143 | { |
| 3017 | 3144 | $context['avatar_list'] = array(); |
| 3018 | 3145 | $context['avatars'] = is_dir($modSettings['avatar_directory']) ? getAvatars('', 0) : array(); |
| 3146 | + } else { |
|
| 3147 | + $context['avatars'] = array(); |
|
| 3019 | 3148 | } |
| 3020 | - else |
|
| 3021 | - $context['avatars'] = array(); |
|
| 3022 | 3149 | |
| 3023 | 3150 | // Second level selected avatar... |
| 3024 | 3151 | $context['avatar_selected'] = substr(strrchr($context['member']['avatar']['server_pic'], '/'), 1); |
@@ -3047,19 +3174,22 @@ discard block |
||
| 3047 | 3174 | ) |
| 3048 | 3175 | ); |
| 3049 | 3176 | $protected_groups = array(1); |
| 3050 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 3051 | - $protected_groups[] = $row['id_group']; |
|
| 3177 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 3178 | + $protected_groups[] = $row['id_group']; |
|
| 3179 | + } |
|
| 3052 | 3180 | $smcFunc['db_free_result']($request); |
| 3053 | 3181 | |
| 3054 | 3182 | $protected_groups = array_unique($protected_groups); |
| 3055 | 3183 | } |
| 3056 | 3184 | |
| 3057 | 3185 | // The account page allows the change of your id_group - but not to a protected group! |
| 3058 | - if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) |
|
| 3059 | - $value = (int) $value; |
|
| 3186 | + if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) { |
|
| 3187 | + $value = (int) $value; |
|
| 3188 | + } |
|
| 3060 | 3189 | // ... otherwise it's the old group sir. |
| 3061 | - else |
|
| 3062 | - $value = $old_profile['id_group']; |
|
| 3190 | + else { |
|
| 3191 | + $value = $old_profile['id_group']; |
|
| 3192 | + } |
|
| 3063 | 3193 | |
| 3064 | 3194 | // Find the additional membergroups (if any) |
| 3065 | 3195 | if (isset($_POST['additional_groups']) && is_array($_POST['additional_groups'])) |
@@ -3068,16 +3198,18 @@ discard block |
||
| 3068 | 3198 | foreach ($_POST['additional_groups'] as $group_id) |
| 3069 | 3199 | { |
| 3070 | 3200 | $group_id = (int) $group_id; |
| 3071 | - if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) |
|
| 3072 | - $additional_groups[] = $group_id; |
|
| 3201 | + if (!empty($group_id) && (empty($protected_groups) || !in_array($group_id, $protected_groups))) { |
|
| 3202 | + $additional_groups[] = $group_id; |
|
| 3203 | + } |
|
| 3073 | 3204 | } |
| 3074 | 3205 | |
| 3075 | 3206 | // Put the protected groups back in there if you don't have permission to take them away. |
| 3076 | 3207 | $old_additional_groups = explode(',', $old_profile['additional_groups']); |
| 3077 | 3208 | foreach ($old_additional_groups as $group_id) |
| 3078 | 3209 | { |
| 3079 | - if (!empty($protected_groups) && in_array($group_id, $protected_groups)) |
|
| 3080 | - $additional_groups[] = $group_id; |
|
| 3210 | + if (!empty($protected_groups) && in_array($group_id, $protected_groups)) { |
|
| 3211 | + $additional_groups[] = $group_id; |
|
| 3212 | + } |
|
| 3081 | 3213 | } |
| 3082 | 3214 | |
| 3083 | 3215 | if (implode(',', $additional_groups) !== $old_profile['additional_groups']) |
@@ -3109,18 +3241,20 @@ discard block |
||
| 3109 | 3241 | list ($another) = $smcFunc['db_fetch_row']($request); |
| 3110 | 3242 | $smcFunc['db_free_result']($request); |
| 3111 | 3243 | |
| 3112 | - if (empty($another)) |
|
| 3113 | - fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 3244 | + if (empty($another)) { |
|
| 3245 | + fatal_lang_error('at_least_one_admin', 'critical'); |
|
| 3246 | + } |
|
| 3114 | 3247 | } |
| 3115 | 3248 | } |
| 3116 | 3249 | |
| 3117 | 3250 | // If we are changing group status, update permission cache as necessary. |
| 3118 | 3251 | if ($value != $old_profile['id_group'] || isset($profile_vars['additional_groups'])) |
| 3119 | 3252 | { |
| 3120 | - if ($context['user']['is_owner']) |
|
| 3121 | - $_SESSION['mc']['time'] = 0; |
|
| 3122 | - else |
|
| 3123 | - updateSettings(array('settings_updated' => time())); |
|
| 3253 | + if ($context['user']['is_owner']) { |
|
| 3254 | + $_SESSION['mc']['time'] = 0; |
|
| 3255 | + } else { |
|
| 3256 | + updateSettings(array('settings_updated' => time())); |
|
| 3257 | + } |
|
| 3124 | 3258 | } |
| 3125 | 3259 | |
| 3126 | 3260 | // Announce to any hooks that we have changed groups, but don't allow them to change it. |
@@ -3141,8 +3275,9 @@ discard block |
||
| 3141 | 3275 | global $modSettings, $sourcedir, $smcFunc, $profile_vars, $cur_profile, $context; |
| 3142 | 3276 | |
| 3143 | 3277 | $memID = $context['id_member']; |
| 3144 | - if (empty($memID) && !empty($context['password_auth_failed'])) |
|
| 3145 | - return false; |
|
| 3278 | + if (empty($memID) && !empty($context['password_auth_failed'])) { |
|
| 3279 | + return false; |
|
| 3280 | + } |
|
| 3146 | 3281 | |
| 3147 | 3282 | require_once($sourcedir . '/ManageAttachments.php'); |
| 3148 | 3283 | |
@@ -3153,8 +3288,9 @@ discard block |
||
| 3153 | 3288 | $downloadedExternalAvatar = false; |
| 3154 | 3289 | if ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && strlen($_POST['userpicpersonal']) > 7 && !empty($modSettings['avatar_download_external'])) |
| 3155 | 3290 | { |
| 3156 | - if (!is_writable($uploadDir)) |
|
| 3157 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3291 | + if (!is_writable($uploadDir)) { |
|
| 3292 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3293 | + } |
|
| 3158 | 3294 | |
| 3159 | 3295 | require_once($sourcedir . '/Subs-Package.php'); |
| 3160 | 3296 | |
@@ -3198,19 +3334,18 @@ discard block |
||
| 3198 | 3334 | |
| 3199 | 3335 | // Get rid of their old avatar. (if uploaded.) |
| 3200 | 3336 | removeAttachments(array('id_member' => $memID)); |
| 3201 | - } |
|
| 3202 | - elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
| 3337 | + } elseif ($value == 'gravatar' && !empty($modSettings['gravatarEnabled'])) |
|
| 3203 | 3338 | { |
| 3204 | 3339 | // One wasn't specified, or it's not allowed to use extra email addresses, or it's not a valid one, reset to default Gravatar. |
| 3205 | - if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) |
|
| 3206 | - $profile_vars['avatar'] = 'gravatar://'; |
|
| 3207 | - else |
|
| 3208 | - $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
| 3340 | + if (empty($_POST['gravatarEmail']) || empty($modSettings['gravatarAllowExtraEmail']) || !filter_var($_POST['gravatarEmail'], FILTER_VALIDATE_EMAIL)) { |
|
| 3341 | + $profile_vars['avatar'] = 'gravatar://'; |
|
| 3342 | + } else { |
|
| 3343 | + $profile_vars['avatar'] = 'gravatar://' . ($_POST['gravatarEmail'] != $cur_profile['email_address'] ? $_POST['gravatarEmail'] : ''); |
|
| 3344 | + } |
|
| 3209 | 3345 | |
| 3210 | 3346 | // Get rid of their old avatar. (if uploaded.) |
| 3211 | 3347 | removeAttachments(array('id_member' => $memID)); |
| 3212 | - } |
|
| 3213 | - elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
| 3348 | + } elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external'])) |
|
| 3214 | 3349 | { |
| 3215 | 3350 | // We need these clean... |
| 3216 | 3351 | $cur_profile['id_attach'] = 0; |
@@ -3222,11 +3357,13 @@ discard block |
||
| 3222 | 3357 | |
| 3223 | 3358 | $profile_vars['avatar'] = str_replace(' ', '%20', preg_replace('~action(?:=|%3d)(?!dlattach)~i', 'action-', $_POST['userpicpersonal'])); |
| 3224 | 3359 | |
| 3225 | - if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') |
|
| 3226 | - $profile_vars['avatar'] = ''; |
|
| 3360 | + if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///') { |
|
| 3361 | + $profile_vars['avatar'] = ''; |
|
| 3362 | + } |
|
| 3227 | 3363 | // Trying to make us do something we'll regret? |
| 3228 | - elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') |
|
| 3229 | - return 'bad_avatar_invalid_url'; |
|
| 3364 | + elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://') { |
|
| 3365 | + return 'bad_avatar_invalid_url'; |
|
| 3366 | + } |
|
| 3230 | 3367 | // Should we check dimensions? |
| 3231 | 3368 | elseif (!empty($modSettings['avatar_max_height_external']) || !empty($modSettings['avatar_max_width_external'])) |
| 3232 | 3369 | { |
@@ -3236,9 +3373,9 @@ discard block |
||
| 3236 | 3373 | if (is_array($sizes) && (($sizes[0] > $modSettings['avatar_max_width_external'] && !empty($modSettings['avatar_max_width_external'])) || ($sizes[1] > $modSettings['avatar_max_height_external'] && !empty($modSettings['avatar_max_height_external'])))) |
| 3237 | 3374 | { |
| 3238 | 3375 | // Houston, we have a problem. The avatar is too large!! |
| 3239 | - if ($modSettings['avatar_action_too_large'] == 'option_refuse') |
|
| 3240 | - return 'bad_avatar_too_large'; |
|
| 3241 | - elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
| 3376 | + if ($modSettings['avatar_action_too_large'] == 'option_refuse') { |
|
| 3377 | + return 'bad_avatar_too_large'; |
|
| 3378 | + } elseif ($modSettings['avatar_action_too_large'] == 'option_download_and_resize') |
|
| 3242 | 3379 | { |
| 3243 | 3380 | // @todo remove this if appropriate |
| 3244 | 3381 | require_once($sourcedir . '/Subs-Graphics.php'); |
@@ -3248,26 +3385,27 @@ discard block |
||
| 3248 | 3385 | $cur_profile['id_attach'] = $modSettings['new_avatar_data']['id']; |
| 3249 | 3386 | $cur_profile['filename'] = $modSettings['new_avatar_data']['filename']; |
| 3250 | 3387 | $cur_profile['attachment_type'] = $modSettings['new_avatar_data']['type']; |
| 3388 | + } else { |
|
| 3389 | + return 'bad_avatar'; |
|
| 3251 | 3390 | } |
| 3252 | - else |
|
| 3253 | - return 'bad_avatar'; |
|
| 3254 | 3391 | } |
| 3255 | 3392 | } |
| 3256 | 3393 | } |
| 3257 | - } |
|
| 3258 | - elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
| 3394 | + } elseif (($value == 'upload' && allowedTo('profile_upload_avatar')) || $downloadedExternalAvatar) |
|
| 3259 | 3395 | { |
| 3260 | 3396 | if ((isset($_FILES['attachment']['name']) && $_FILES['attachment']['name'] != '') || $downloadedExternalAvatar) |
| 3261 | 3397 | { |
| 3262 | 3398 | // Get the dimensions of the image. |
| 3263 | 3399 | if (!$downloadedExternalAvatar) |
| 3264 | 3400 | { |
| 3265 | - if (!is_writable($uploadDir)) |
|
| 3266 | - fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3401 | + if (!is_writable($uploadDir)) { |
|
| 3402 | + fatal_lang_error('attachments_no_write', 'critical'); |
|
| 3403 | + } |
|
| 3267 | 3404 | |
| 3268 | 3405 | $new_filename = $uploadDir . '/' . getAttachmentFilename('avatar_tmp_' . $memID, false, null, true); |
| 3269 | - if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) |
|
| 3270 | - fatal_lang_error('attach_timeout', 'critical'); |
|
| 3406 | + if (!move_uploaded_file($_FILES['attachment']['tmp_name'], $new_filename)) { |
|
| 3407 | + fatal_lang_error('attach_timeout', 'critical'); |
|
| 3408 | + } |
|
| 3271 | 3409 | |
| 3272 | 3410 | $_FILES['attachment']['tmp_name'] = $new_filename; |
| 3273 | 3411 | } |
@@ -3380,17 +3518,19 @@ discard block |
||
| 3380 | 3518 | $profile_vars['avatar'] = ''; |
| 3381 | 3519 | |
| 3382 | 3520 | // Delete any temporary file. |
| 3383 | - if (file_exists($_FILES['attachment']['tmp_name'])) |
|
| 3384 | - @unlink($_FILES['attachment']['tmp_name']); |
|
| 3521 | + if (file_exists($_FILES['attachment']['tmp_name'])) { |
|
| 3522 | + @unlink($_FILES['attachment']['tmp_name']); |
|
| 3523 | + } |
|
| 3385 | 3524 | } |
| 3386 | 3525 | // Selected the upload avatar option and had one already uploaded before or didn't upload one. |
| 3387 | - else |
|
| 3526 | + else { |
|
| 3527 | + $profile_vars['avatar'] = ''; |
|
| 3528 | + } |
|
| 3529 | + } elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) { |
|
| 3530 | + $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
| 3531 | + } else { |
|
| 3388 | 3532 | $profile_vars['avatar'] = ''; |
| 3389 | 3533 | } |
| 3390 | - elseif ($value == 'gravatar' && allowedTo('profile_gravatar_avatar')) |
|
| 3391 | - $profile_vars['avatar'] = 'gravatar://www.gravatar.com/avatar/' . md5(strtolower(trim($cur_profile['email_address']))); |
|
| 3392 | - else |
|
| 3393 | - $profile_vars['avatar'] = ''; |
|
| 3394 | 3534 | |
| 3395 | 3535 | // Setup the profile variables so it shows things right on display! |
| 3396 | 3536 | $cur_profile['avatar'] = $profile_vars['avatar']; |
@@ -3438,9 +3578,9 @@ discard block |
||
| 3438 | 3578 | $smiley_parsed = $unparsed_signature; |
| 3439 | 3579 | parsesmileys($smiley_parsed); |
| 3440 | 3580 | $smiley_count = substr_count(strtolower($smiley_parsed), '<img') - substr_count(strtolower($unparsed_signature), '<img'); |
| 3441 | - if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) |
|
| 3442 | - return 'signature_allow_smileys'; |
|
| 3443 | - elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
| 3581 | + if (!empty($sig_limits[4]) && $sig_limits[4] == -1 && $smiley_count > 0) { |
|
| 3582 | + return 'signature_allow_smileys'; |
|
| 3583 | + } elseif (!empty($sig_limits[4]) && $sig_limits[4] > 0 && $smiley_count > $sig_limits[4]) |
|
| 3444 | 3584 | { |
| 3445 | 3585 | $txt['profile_error_signature_max_smileys'] = sprintf($txt['profile_error_signature_max_smileys'], $sig_limits[4]); |
| 3446 | 3586 | return 'signature_max_smileys'; |
@@ -3453,14 +3593,15 @@ discard block |
||
| 3453 | 3593 | { |
| 3454 | 3594 | $limit_broke = 0; |
| 3455 | 3595 | // Attempt to allow all sizes of abuse, so to speak. |
| 3456 | - if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) |
|
| 3457 | - $limit_broke = $sig_limits[7] . 'px'; |
|
| 3458 | - elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) |
|
| 3459 | - $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 3460 | - elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) |
|
| 3461 | - $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 3462 | - elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) |
|
| 3463 | - $limit_broke = 'large'; |
|
| 3596 | + if ($matches[2][$ind] == 'px' && $size > $sig_limits[7]) { |
|
| 3597 | + $limit_broke = $sig_limits[7] . 'px'; |
|
| 3598 | + } elseif ($matches[2][$ind] == 'pt' && $size > ($sig_limits[7] * 0.75)) { |
|
| 3599 | + $limit_broke = ((int) $sig_limits[7] * 0.75) . 'pt'; |
|
| 3600 | + } elseif ($matches[2][$ind] == 'em' && $size > ((float) $sig_limits[7] / 16)) { |
|
| 3601 | + $limit_broke = ((float) $sig_limits[7] / 16) . 'em'; |
|
| 3602 | + } elseif ($matches[2][$ind] != 'px' && $matches[2][$ind] != 'pt' && $matches[2][$ind] != 'em' && $sig_limits[7] < 18) { |
|
| 3603 | + $limit_broke = 'large'; |
|
| 3604 | + } |
|
| 3464 | 3605 | |
| 3465 | 3606 | if ($limit_broke) |
| 3466 | 3607 | { |
@@ -3502,24 +3643,26 @@ discard block |
||
| 3502 | 3643 | $width = -1; $height = -1; |
| 3503 | 3644 | |
| 3504 | 3645 | // Does it have predefined restraints? Width first. |
| 3505 | - if ($matches[6][$key]) |
|
| 3506 | - $matches[2][$key] = $matches[6][$key]; |
|
| 3646 | + if ($matches[6][$key]) { |
|
| 3647 | + $matches[2][$key] = $matches[6][$key]; |
|
| 3648 | + } |
|
| 3507 | 3649 | if ($matches[2][$key] && $sig_limits[5] && $matches[2][$key] > $sig_limits[5]) |
| 3508 | 3650 | { |
| 3509 | 3651 | $width = $sig_limits[5]; |
| 3510 | 3652 | $matches[4][$key] = $matches[4][$key] * ($width / $matches[2][$key]); |
| 3653 | + } elseif ($matches[2][$key]) { |
|
| 3654 | + $width = $matches[2][$key]; |
|
| 3511 | 3655 | } |
| 3512 | - elseif ($matches[2][$key]) |
|
| 3513 | - $width = $matches[2][$key]; |
|
| 3514 | 3656 | // ... and height. |
| 3515 | 3657 | if ($matches[4][$key] && $sig_limits[6] && $matches[4][$key] > $sig_limits[6]) |
| 3516 | 3658 | { |
| 3517 | 3659 | $height = $sig_limits[6]; |
| 3518 | - if ($width != -1) |
|
| 3519 | - $width = $width * ($height / $matches[4][$key]); |
|
| 3660 | + if ($width != -1) { |
|
| 3661 | + $width = $width * ($height / $matches[4][$key]); |
|
| 3662 | + } |
|
| 3663 | + } elseif ($matches[4][$key]) { |
|
| 3664 | + $height = $matches[4][$key]; |
|
| 3520 | 3665 | } |
| 3521 | - elseif ($matches[4][$key]) |
|
| 3522 | - $height = $matches[4][$key]; |
|
| 3523 | 3666 | |
| 3524 | 3667 | // If the dimensions are still not fixed - we need to check the actual image. |
| 3525 | 3668 | if (($width == -1 && $sig_limits[5]) || ($height == -1 && $sig_limits[6])) |
@@ -3537,21 +3680,24 @@ discard block |
||
| 3537 | 3680 | if ($sizes[1] > $sig_limits[6] && $sig_limits[6]) |
| 3538 | 3681 | { |
| 3539 | 3682 | $height = $sig_limits[6]; |
| 3540 | - if ($width == -1) |
|
| 3541 | - $width = $sizes[0]; |
|
| 3683 | + if ($width == -1) { |
|
| 3684 | + $width = $sizes[0]; |
|
| 3685 | + } |
|
| 3542 | 3686 | $width = $width * ($height / $sizes[1]); |
| 3687 | + } elseif ($width != -1) { |
|
| 3688 | + $height = $sizes[1]; |
|
| 3543 | 3689 | } |
| 3544 | - elseif ($width != -1) |
|
| 3545 | - $height = $sizes[1]; |
|
| 3546 | 3690 | } |
| 3547 | 3691 | } |
| 3548 | 3692 | |
| 3549 | 3693 | // Did we come up with some changes? If so remake the string. |
| 3550 | - if ($width != -1 || $height != -1) |
|
| 3551 | - $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
| 3694 | + if ($width != -1 || $height != -1) { |
|
| 3695 | + $replaces[$image] = '[img' . ($width != -1 ? ' width=' . round($width) : '') . ($height != -1 ? ' height=' . round($height) : '') . ']' . $matches[7][$key] . '[/img]'; |
|
| 3696 | + } |
|
| 3697 | + } |
|
| 3698 | + if (!empty($replaces)) { |
|
| 3699 | + $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
| 3552 | 3700 | } |
| 3553 | - if (!empty($replaces)) |
|
| 3554 | - $value = str_replace(array_keys($replaces), array_values($replaces), $value); |
|
| 3555 | 3701 | } |
| 3556 | 3702 | } |
| 3557 | 3703 | |
@@ -3595,10 +3741,12 @@ discard block |
||
| 3595 | 3741 | $email = strtr($email, array(''' => '\'')); |
| 3596 | 3742 | |
| 3597 | 3743 | // Check the name and email for validity. |
| 3598 | - if (trim($email) == '') |
|
| 3599 | - return 'no_email'; |
|
| 3600 | - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) |
|
| 3601 | - return 'bad_email'; |
|
| 3744 | + if (trim($email) == '') { |
|
| 3745 | + return 'no_email'; |
|
| 3746 | + } |
|
| 3747 | + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
|
| 3748 | + return 'bad_email'; |
|
| 3749 | + } |
|
| 3602 | 3750 | |
| 3603 | 3751 | // Email addresses should be and stay unique. |
| 3604 | 3752 | $request = $smcFunc['db_query']('', ' |
@@ -3613,8 +3761,9 @@ discard block |
||
| 3613 | 3761 | ) |
| 3614 | 3762 | ); |
| 3615 | 3763 | |
| 3616 | - if ($smcFunc['db_num_rows']($request) > 0) |
|
| 3617 | - return 'email_taken'; |
|
| 3764 | + if ($smcFunc['db_num_rows']($request) > 0) { |
|
| 3765 | + return 'email_taken'; |
|
| 3766 | + } |
|
| 3618 | 3767 | $smcFunc['db_free_result']($request); |
| 3619 | 3768 | |
| 3620 | 3769 | return true; |
@@ -3627,8 +3776,9 @@ discard block |
||
| 3627 | 3776 | { |
| 3628 | 3777 | global $modSettings, $context, $cur_profile; |
| 3629 | 3778 | |
| 3630 | - if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') |
|
| 3631 | - setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
| 3779 | + if (isset($_POST['passwrd2']) && $_POST['passwrd2'] != '') { |
|
| 3780 | + setLoginCookie(60 * $modSettings['cookieTime'], $context['id_member'], hash_salt($_POST['passwrd1'], $cur_profile['password_salt'])); |
|
| 3781 | + } |
|
| 3632 | 3782 | |
| 3633 | 3783 | loadUserSettings(); |
| 3634 | 3784 | writeLog(); |
@@ -3644,8 +3794,9 @@ discard block |
||
| 3644 | 3794 | require_once($sourcedir . '/Subs-Post.php'); |
| 3645 | 3795 | |
| 3646 | 3796 | // Shouldn't happen but just in case. |
| 3647 | - if (empty($profile_vars['email_address'])) |
|
| 3648 | - return; |
|
| 3797 | + if (empty($profile_vars['email_address'])) { |
|
| 3798 | + return; |
|
| 3799 | + } |
|
| 3649 | 3800 | |
| 3650 | 3801 | $replacements = array( |
| 3651 | 3802 | 'ACTIVATIONLINK' => $scripturl . '?action=activate;u=' . $context['id_member'] . ';code=' . $profile_vars['validation_code'], |
@@ -3668,8 +3819,9 @@ discard block |
||
| 3668 | 3819 | $_SESSION['log_time'] = 0; |
| 3669 | 3820 | $_SESSION['login_' . $cookiename] = json_encode(array(0, '', 0)); |
| 3670 | 3821 | |
| 3671 | - if (isset($_COOKIE[$cookiename])) |
|
| 3672 | - $_COOKIE[$cookiename] = ''; |
|
| 3822 | + if (isset($_COOKIE[$cookiename])) { |
|
| 3823 | + $_COOKIE[$cookiename] = ''; |
|
| 3824 | + } |
|
| 3673 | 3825 | |
| 3674 | 3826 | loadUserSettings(); |
| 3675 | 3827 | |
@@ -3702,11 +3854,13 @@ discard block |
||
| 3702 | 3854 | $groups[] = $curMember['id_group']; |
| 3703 | 3855 | |
| 3704 | 3856 | // Ensure the query doesn't croak! |
| 3705 | - if (empty($groups)) |
|
| 3706 | - $groups = array(0); |
|
| 3857 | + if (empty($groups)) { |
|
| 3858 | + $groups = array(0); |
|
| 3859 | + } |
|
| 3707 | 3860 | // Just to be sure... |
| 3708 | - foreach ($groups as $k => $v) |
|
| 3709 | - $groups[$k] = (int) $v; |
|
| 3861 | + foreach ($groups as $k => $v) { |
|
| 3862 | + $groups[$k] = (int) $v; |
|
| 3863 | + } |
|
| 3710 | 3864 | |
| 3711 | 3865 | // Get all the membergroups they can join. |
| 3712 | 3866 | $request = $smcFunc['db_query']('', ' |
@@ -3736,12 +3890,14 @@ discard block |
||
| 3736 | 3890 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 3737 | 3891 | { |
| 3738 | 3892 | // Can they edit their primary group? |
| 3739 | - if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) |
|
| 3740 | - $context['can_edit_primary'] = true; |
|
| 3893 | + if (($row['id_group'] == $context['primary_group'] && $row['group_type'] > 1) || ($row['hidden'] != 2 && $context['primary_group'] == 0 && in_array($row['id_group'], $groups))) { |
|
| 3894 | + $context['can_edit_primary'] = true; |
|
| 3895 | + } |
|
| 3741 | 3896 | |
| 3742 | 3897 | // If they can't manage (protected) groups, and it's not publically joinable or already assigned, they can't see it. |
| 3743 | - if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) |
|
| 3744 | - continue; |
|
| 3898 | + if (((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) && $row['id_group'] != $context['primary_group']) { |
|
| 3899 | + continue; |
|
| 3900 | + } |
|
| 3745 | 3901 | |
| 3746 | 3902 | $context['groups'][in_array($row['id_group'], $groups) ? 'member' : 'available'][$row['id_group']] = array( |
| 3747 | 3903 | 'id' => $row['id_group'], |
@@ -3770,13 +3926,15 @@ discard block |
||
| 3770 | 3926 | ); |
| 3771 | 3927 | |
| 3772 | 3928 | // No changing primary one unless you have enough groups! |
| 3773 | - if (count($context['groups']['member']) < 2) |
|
| 3774 | - $context['can_edit_primary'] = false; |
|
| 3929 | + if (count($context['groups']['member']) < 2) { |
|
| 3930 | + $context['can_edit_primary'] = false; |
|
| 3931 | + } |
|
| 3775 | 3932 | |
| 3776 | 3933 | // In the special case that someone is requesting membership of a group, setup some special context vars. |
| 3777 | - if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) |
|
| 3778 | - $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
| 3779 | -} |
|
| 3934 | + if (isset($_REQUEST['request']) && isset($context['groups']['available'][(int) $_REQUEST['request']]) && $context['groups']['available'][(int) $_REQUEST['request']]['type'] == 2) { |
|
| 3935 | + $context['group_request'] = $context['groups']['available'][(int) $_REQUEST['request']]; |
|
| 3936 | + } |
|
| 3937 | + } |
|
| 3780 | 3938 | |
| 3781 | 3939 | /** |
| 3782 | 3940 | * This function actually makes all the group changes |
@@ -3791,10 +3949,12 @@ discard block |
||
| 3791 | 3949 | global $user_info, $context, $user_profile, $modSettings, $smcFunc; |
| 3792 | 3950 | |
| 3793 | 3951 | // Let's be extra cautious... |
| 3794 | - if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) |
|
| 3795 | - isAllowedTo('manage_membergroups'); |
|
| 3796 | - if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) |
|
| 3797 | - fatal_lang_error('no_access', false); |
|
| 3952 | + if (!$context['user']['is_owner'] || empty($modSettings['show_group_membership'])) { |
|
| 3953 | + isAllowedTo('manage_membergroups'); |
|
| 3954 | + } |
|
| 3955 | + if (!isset($_REQUEST['gid']) && !isset($_POST['primary'])) { |
|
| 3956 | + fatal_lang_error('no_access', false); |
|
| 3957 | + } |
|
| 3798 | 3958 | |
| 3799 | 3959 | checkSession(isset($_GET['gid']) ? 'get' : 'post'); |
| 3800 | 3960 | |
@@ -3813,8 +3973,9 @@ discard block |
||
| 3813 | 3973 | $foundTarget = $changeType == 'primary' && $group_id == 0 ? true : false; |
| 3814 | 3974 | |
| 3815 | 3975 | // Sanity check!! |
| 3816 | - if ($group_id == 1) |
|
| 3817 | - isAllowedTo('admin_forum'); |
|
| 3976 | + if ($group_id == 1) { |
|
| 3977 | + isAllowedTo('admin_forum'); |
|
| 3978 | + } |
|
| 3818 | 3979 | // Protected groups too! |
| 3819 | 3980 | else |
| 3820 | 3981 | { |
@@ -3831,8 +3992,9 @@ discard block |
||
| 3831 | 3992 | list ($is_protected) = $smcFunc['db_fetch_row']($request); |
| 3832 | 3993 | $smcFunc['db_free_result']($request); |
| 3833 | 3994 | |
| 3834 | - if ($is_protected == 1) |
|
| 3835 | - isAllowedTo('admin_forum'); |
|
| 3995 | + if ($is_protected == 1) { |
|
| 3996 | + isAllowedTo('admin_forum'); |
|
| 3997 | + } |
|
| 3836 | 3998 | } |
| 3837 | 3999 | |
| 3838 | 4000 | // What ever we are doing, we need to determine if changing primary is possible! |
@@ -3854,36 +4016,43 @@ discard block |
||
| 3854 | 4016 | $group_name = $row['group_name']; |
| 3855 | 4017 | |
| 3856 | 4018 | // Does the group type match what we're doing - are we trying to request a non-requestable group? |
| 3857 | - if ($changeType == 'request' && $row['group_type'] != 2) |
|
| 3858 | - fatal_lang_error('no_access', false); |
|
| 4019 | + if ($changeType == 'request' && $row['group_type'] != 2) { |
|
| 4020 | + fatal_lang_error('no_access', false); |
|
| 4021 | + } |
|
| 3859 | 4022 | // What about leaving a requestable group we are not a member of? |
| 3860 | - elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) |
|
| 3861 | - fatal_lang_error('no_access', false); |
|
| 3862 | - elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) |
|
| 3863 | - fatal_lang_error('no_access', false); |
|
| 4023 | + elseif ($changeType == 'free' && $row['group_type'] == 2 && $old_profile['id_group'] != $row['id_group'] && !isset($addGroups[$row['id_group']])) { |
|
| 4024 | + fatal_lang_error('no_access', false); |
|
| 4025 | + } elseif ($changeType == 'free' && $row['group_type'] != 3 && $row['group_type'] != 2) { |
|
| 4026 | + fatal_lang_error('no_access', false); |
|
| 4027 | + } |
|
| 3864 | 4028 | |
| 3865 | 4029 | // We can't change the primary group if this is hidden! |
| 3866 | - if ($row['hidden'] == 2) |
|
| 3867 | - $canChangePrimary = false; |
|
| 4030 | + if ($row['hidden'] == 2) { |
|
| 4031 | + $canChangePrimary = false; |
|
| 4032 | + } |
|
| 3868 | 4033 | } |
| 3869 | 4034 | |
| 3870 | 4035 | // If this is their old primary, can we change it? |
| 3871 | - if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) |
|
| 3872 | - $canChangePrimary = 1; |
|
| 4036 | + if ($row['id_group'] == $old_profile['id_group'] && ($row['group_type'] > 1 || $context['can_manage_membergroups']) && $canChangePrimary !== false) { |
|
| 4037 | + $canChangePrimary = 1; |
|
| 4038 | + } |
|
| 3873 | 4039 | |
| 3874 | 4040 | // If we are not doing a force primary move, don't do it automatically if current primary is not 0. |
| 3875 | - if ($changeType != 'primary' && $old_profile['id_group'] != 0) |
|
| 3876 | - $canChangePrimary = false; |
|
| 4041 | + if ($changeType != 'primary' && $old_profile['id_group'] != 0) { |
|
| 4042 | + $canChangePrimary = false; |
|
| 4043 | + } |
|
| 3877 | 4044 | |
| 3878 | 4045 | // If this is the one we are acting on, can we even act? |
| 3879 | - if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) |
|
| 3880 | - $canChangePrimary = false; |
|
| 4046 | + if ((!$context['can_manage_protected'] && $row['group_type'] == 1) || (!$context['can_manage_membergroups'] && $row['group_type'] == 0)) { |
|
| 4047 | + $canChangePrimary = false; |
|
| 4048 | + } |
|
| 3881 | 4049 | } |
| 3882 | 4050 | $smcFunc['db_free_result']($request); |
| 3883 | 4051 | |
| 3884 | 4052 | // Didn't find the target? |
| 3885 | - if (!$foundTarget) |
|
| 3886 | - fatal_lang_error('no_access', false); |
|
| 4053 | + if (!$foundTarget) { |
|
| 4054 | + fatal_lang_error('no_access', false); |
|
| 4055 | + } |
|
| 3887 | 4056 | |
| 3888 | 4057 | // Final security check, don't allow users to promote themselves to admin. |
| 3889 | 4058 | if ($context['can_manage_membergroups'] && !allowedTo('admin_forum')) |
@@ -3903,8 +4072,9 @@ discard block |
||
| 3903 | 4072 | list ($disallow) = $smcFunc['db_fetch_row']($request); |
| 3904 | 4073 | $smcFunc['db_free_result']($request); |
| 3905 | 4074 | |
| 3906 | - if ($disallow) |
|
| 3907 | - isAllowedTo('admin_forum'); |
|
| 4075 | + if ($disallow) { |
|
| 4076 | + isAllowedTo('admin_forum'); |
|
| 4077 | + } |
|
| 3908 | 4078 | } |
| 3909 | 4079 | |
| 3910 | 4080 | // If we're requesting, add the note then return. |
@@ -3922,8 +4092,9 @@ discard block |
||
| 3922 | 4092 | 'status_open' => 0, |
| 3923 | 4093 | ) |
| 3924 | 4094 | ); |
| 3925 | - if ($smcFunc['db_num_rows']($request) != 0) |
|
| 3926 | - fatal_lang_error('profile_error_already_requested_group'); |
|
| 4095 | + if ($smcFunc['db_num_rows']($request) != 0) { |
|
| 4096 | + fatal_lang_error('profile_error_already_requested_group'); |
|
| 4097 | + } |
|
| 3927 | 4098 | $smcFunc['db_free_result']($request); |
| 3928 | 4099 | |
| 3929 | 4100 | // Log the request. |
@@ -3957,10 +4128,11 @@ discard block |
||
| 3957 | 4128 | // Are we leaving? |
| 3958 | 4129 | if ($old_profile['id_group'] == $group_id || isset($addGroups[$group_id])) |
| 3959 | 4130 | { |
| 3960 | - if ($old_profile['id_group'] == $group_id) |
|
| 3961 | - $newPrimary = 0; |
|
| 3962 | - else |
|
| 3963 | - unset($addGroups[$group_id]); |
|
| 4131 | + if ($old_profile['id_group'] == $group_id) { |
|
| 4132 | + $newPrimary = 0; |
|
| 4133 | + } else { |
|
| 4134 | + unset($addGroups[$group_id]); |
|
| 4135 | + } |
|
| 3964 | 4136 | } |
| 3965 | 4137 | // ... if not, must be joining. |
| 3966 | 4138 | else |
@@ -3968,36 +4140,42 @@ discard block |
||
| 3968 | 4140 | // Can we change the primary, and do we want to? |
| 3969 | 4141 | if ($canChangePrimary) |
| 3970 | 4142 | { |
| 3971 | - if ($old_profile['id_group'] != 0) |
|
| 3972 | - $addGroups[$old_profile['id_group']] = -1; |
|
| 4143 | + if ($old_profile['id_group'] != 0) { |
|
| 4144 | + $addGroups[$old_profile['id_group']] = -1; |
|
| 4145 | + } |
|
| 3973 | 4146 | $newPrimary = $group_id; |
| 3974 | 4147 | } |
| 3975 | 4148 | // Otherwise it's an additional group... |
| 3976 | - else |
|
| 3977 | - $addGroups[$group_id] = -1; |
|
| 4149 | + else { |
|
| 4150 | + $addGroups[$group_id] = -1; |
|
| 4151 | + } |
|
| 3978 | 4152 | } |
| 3979 | 4153 | } |
| 3980 | 4154 | // Finally, we must be setting the primary. |
| 3981 | 4155 | elseif ($canChangePrimary) |
| 3982 | 4156 | { |
| 3983 | - if ($old_profile['id_group'] != 0) |
|
| 3984 | - $addGroups[$old_profile['id_group']] = -1; |
|
| 3985 | - if (isset($addGroups[$group_id])) |
|
| 3986 | - unset($addGroups[$group_id]); |
|
| 4157 | + if ($old_profile['id_group'] != 0) { |
|
| 4158 | + $addGroups[$old_profile['id_group']] = -1; |
|
| 4159 | + } |
|
| 4160 | + if (isset($addGroups[$group_id])) { |
|
| 4161 | + unset($addGroups[$group_id]); |
|
| 4162 | + } |
|
| 3987 | 4163 | $newPrimary = $group_id; |
| 3988 | 4164 | } |
| 3989 | 4165 | |
| 3990 | 4166 | // Finally, we can make the changes! |
| 3991 | - foreach ($addGroups as $id => $dummy) |
|
| 3992 | - if (empty($id)) |
|
| 4167 | + foreach ($addGroups as $id => $dummy) { |
|
| 4168 | + if (empty($id)) |
|
| 3993 | 4169 | unset($addGroups[$id]); |
| 4170 | + } |
|
| 3994 | 4171 | $addGroups = implode(',', array_flip($addGroups)); |
| 3995 | 4172 | |
| 3996 | 4173 | // Ensure that we don't cache permissions if the group is changing. |
| 3997 | - if ($context['user']['is_owner']) |
|
| 3998 | - $_SESSION['mc']['time'] = 0; |
|
| 3999 | - else |
|
| 4000 | - updateSettings(array('settings_updated' => time())); |
|
| 4174 | + if ($context['user']['is_owner']) { |
|
| 4175 | + $_SESSION['mc']['time'] = 0; |
|
| 4176 | + } else { |
|
| 4177 | + updateSettings(array('settings_updated' => time())); |
|
| 4178 | + } |
|
| 4001 | 4179 | |
| 4002 | 4180 | updateMemberData($memID, array('id_group' => $newPrimary, 'additional_groups' => $addGroups)); |
| 4003 | 4181 | |
@@ -4020,8 +4198,9 @@ discard block |
||
| 4020 | 4198 | if (empty($user_settings['tfa_secret']) && $context['user']['is_owner']) |
| 4021 | 4199 | { |
| 4022 | 4200 | // Check to ensure we're forcing SSL for authentication |
| 4023 | - if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) |
|
| 4024 | - fatal_lang_error('login_ssl_required'); |
|
| 4201 | + if (!empty($modSettings['force_ssl']) && empty($maintenance) && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) { |
|
| 4202 | + fatal_lang_error('login_ssl_required'); |
|
| 4203 | + } |
|
| 4025 | 4204 | |
| 4026 | 4205 | // In some cases (forced 2FA or backup code) they would be forced to be redirected here, |
| 4027 | 4206 | // we do not want too much AJAX to confuse them. |
@@ -4058,8 +4237,7 @@ discard block |
||
| 4058 | 4237 | $context['sub_template'] = 'tfasetup_backup'; |
| 4059 | 4238 | |
| 4060 | 4239 | return; |
| 4061 | - } |
|
| 4062 | - else |
|
| 4240 | + } else |
|
| 4063 | 4241 | { |
| 4064 | 4242 | $context['tfa_secret'] = $_SESSION['tfa_secret']; |
| 4065 | 4243 | $context['tfa_error'] = !$valid_code; |
@@ -4067,8 +4245,7 @@ discard block |
||
| 4067 | 4245 | $context['tfa_pass_value'] = $_POST['passwd']; |
| 4068 | 4246 | $context['tfa_value'] = $_POST['tfa_code']; |
| 4069 | 4247 | } |
| 4070 | - } |
|
| 4071 | - else |
|
| 4248 | + } else |
|
| 4072 | 4249 | { |
| 4073 | 4250 | $totp = new \TOTP\Auth(); |
| 4074 | 4251 | $secret = $totp->generateCode(); |
@@ -4078,17 +4255,16 @@ discard block |
||
| 4078 | 4255 | } |
| 4079 | 4256 | |
| 4080 | 4257 | $context['tfa_qr_url'] = $totp->getQrCodeUrl($context['forum_name'] . ':' . $user_info['name'], $context['tfa_secret']); |
| 4081 | - } |
|
| 4082 | - elseif (isset($_REQUEST['disable'])) |
|
| 4258 | + } elseif (isset($_REQUEST['disable'])) |
|
| 4083 | 4259 | { |
| 4084 | 4260 | updateMemberData($memID, array( |
| 4085 | 4261 | 'tfa_secret' => '', |
| 4086 | 4262 | 'tfa_backup' => '', |
| 4087 | 4263 | )); |
| 4088 | 4264 | redirectexit('action=profile;area=account;u=' . $memID); |
| 4265 | + } else { |
|
| 4266 | + redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4267 | + } |
|
| 4089 | 4268 | } |
| 4090 | - else |
|
| 4091 | - redirectexit('action=profile;area=account;u=' . $memID); |
|
| 4092 | -} |
|
| 4093 | 4269 | |
| 4094 | 4270 | ?> |
| 4095 | 4271 | \ No newline at end of file |
@@ -30,8 +30,9 @@ discard block |
||
| 30 | 30 | * @version 2.1 Beta 3 |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | -if (!defined('SMF')) |
|
| 33 | +if (!defined('SMF')) { |
|
| 34 | 34 | die('No direct access...'); |
| 35 | +} |
|
| 35 | 36 | |
| 36 | 37 | /** |
| 37 | 38 | * Subaction handler - manages the action and delegates control to the proper |
@@ -103,12 +104,12 @@ discard block |
||
| 103 | 104 | cache_put_data('minimized_css', null); |
| 104 | 105 | |
| 105 | 106 | // Follow the sa or just go to administration. |
| 106 | - if (isset($_GET['sa']) && !empty($subActions[$_GET['sa']])) |
|
| 107 | - call_helper($subActions[$_GET['sa']]); |
|
| 108 | - |
|
| 109 | - else |
|
| 110 | - call_helper($subActions['admin']); |
|
| 111 | -} |
|
| 107 | + if (isset($_GET['sa']) && !empty($subActions[$_GET['sa']])) { |
|
| 108 | + call_helper($subActions[$_GET['sa']]); |
|
| 109 | + } else { |
|
| 110 | + call_helper($subActions['admin']); |
|
| 111 | + } |
|
| 112 | + } |
|
| 112 | 113 | |
| 113 | 114 | /** |
| 114 | 115 | * This function allows administration of themes and their settings, |
@@ -130,15 +131,16 @@ discard block |
||
| 130 | 131 | checkSession(); |
| 131 | 132 | validateToken('admin-tm'); |
| 132 | 133 | |
| 133 | - if (isset($_POST['options']['known_themes'])) |
|
| 134 | - foreach ($_POST['options']['known_themes'] as $key => $id) |
|
| 134 | + if (isset($_POST['options']['known_themes'])) { |
|
| 135 | + foreach ($_POST['options']['known_themes'] as $key => $id) |
|
| 135 | 136 | $_POST['options']['known_themes'][$key] = (int) $id; |
| 137 | + } else { |
|
| 138 | + fatal_lang_error('themes_none_selectable', false); |
|
| 139 | + } |
|
| 136 | 140 | |
| 137 | - else |
|
| 138 | - fatal_lang_error('themes_none_selectable', false); |
|
| 139 | - |
|
| 140 | - if (!in_array($_POST['options']['theme_guests'], $_POST['options']['known_themes'])) |
|
| 141 | - fatal_lang_error('themes_default_selectable', false); |
|
| 141 | + if (!in_array($_POST['options']['theme_guests'], $_POST['options']['known_themes'])) { |
|
| 142 | + fatal_lang_error('themes_default_selectable', false); |
|
| 143 | + } |
|
| 142 | 144 | |
| 143 | 145 | // Commit the new settings. |
| 144 | 146 | updateSettings(array( |
@@ -146,8 +148,9 @@ discard block |
||
| 146 | 148 | 'theme_guests' => $_POST['options']['theme_guests'], |
| 147 | 149 | 'knownThemes' => implode(',', $_POST['options']['known_themes']), |
| 148 | 150 | )); |
| 149 | - if ((int) $_POST['theme_reset'] == 0 || in_array($_POST['theme_reset'], $_POST['options']['known_themes'])) |
|
| 150 | - updateMemberData(null, array('id_theme' => (int) $_POST['theme_reset'])); |
|
| 151 | + if ((int) $_POST['theme_reset'] == 0 || in_array($_POST['theme_reset'], $_POST['options']['known_themes'])) { |
|
| 152 | + updateMemberData(null, array('id_theme' => (int) $_POST['theme_reset'])); |
|
| 153 | + } |
|
| 151 | 154 | |
| 152 | 155 | redirectexit('action=admin;area=theme;' . $context['session_var'] . '=' . $context['session_id'] . ';sa=admin'); |
| 153 | 156 | } |
@@ -166,8 +169,9 @@ discard block |
||
| 166 | 169 | // Look for a non existent theme directory. (ie theme87.) |
| 167 | 170 | $theme_dir = $boarddir . '/Themes/theme'; |
| 168 | 171 | $i = 1; |
| 169 | - while (file_exists($theme_dir . $i)) |
|
| 170 | - $i++; |
|
| 172 | + while (file_exists($theme_dir . $i)) { |
|
| 173 | + $i++; |
|
| 174 | + } |
|
| 171 | 175 | |
| 172 | 176 | $context['new_theme_name'] = 'theme' . $i; |
| 173 | 177 | |
@@ -189,8 +193,9 @@ discard block |
||
| 189 | 193 | loadLanguage('Admin'); |
| 190 | 194 | isAllowedTo('admin_forum'); |
| 191 | 195 | |
| 192 | - if (isset($_REQUEST['th'])) |
|
| 193 | - return SetThemeSettings(); |
|
| 196 | + if (isset($_REQUEST['th'])) { |
|
| 197 | + return SetThemeSettings(); |
|
| 198 | + } |
|
| 194 | 199 | |
| 195 | 200 | if (isset($_POST['save'])) |
| 196 | 201 | { |
@@ -274,12 +279,13 @@ discard block |
||
| 274 | 279 | $context['themes'] = array(); |
| 275 | 280 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 276 | 281 | { |
| 277 | - if (!isset($context['themes'][$row['id_theme']])) |
|
| 278 | - $context['themes'][$row['id_theme']] = array( |
|
| 282 | + if (!isset($context['themes'][$row['id_theme']])) { |
|
| 283 | + $context['themes'][$row['id_theme']] = array( |
|
| 279 | 284 | 'id' => $row['id_theme'], |
| 280 | 285 | 'num_default_options' => 0, |
| 281 | 286 | 'num_members' => 0, |
| 282 | 287 | ); |
| 288 | + } |
|
| 283 | 289 | $context['themes'][$row['id_theme']][$row['variable']] = $row['value']; |
| 284 | 290 | } |
| 285 | 291 | $smcFunc['db_free_result']($request); |
@@ -293,8 +299,9 @@ discard block |
||
| 293 | 299 | 'guest_member' => -1, |
| 294 | 300 | ) |
| 295 | 301 | ); |
| 296 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 297 | - $context['themes'][$row['id_theme']]['num_default_options'] = $row['value']; |
|
| 302 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 303 | + $context['themes'][$row['id_theme']]['num_default_options'] = $row['value']; |
|
| 304 | + } |
|
| 298 | 305 | $smcFunc['db_free_result']($request); |
| 299 | 306 | |
| 300 | 307 | // Need to make sure we don't do custom fields. |
@@ -305,8 +312,9 @@ discard block |
||
| 305 | 312 | ) |
| 306 | 313 | ); |
| 307 | 314 | $customFields = array(); |
| 308 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 309 | - $customFields[] = $row['col_name']; |
|
| 315 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 316 | + $customFields[] = $row['col_name']; |
|
| 317 | + } |
|
| 310 | 318 | $smcFunc['db_free_result']($request); |
| 311 | 319 | $customFieldsQuery = empty($customFields) ? '' : ('AND variable NOT IN ({array_string:custom_fields})'); |
| 312 | 320 | |
@@ -321,14 +329,16 @@ discard block |
||
| 321 | 329 | 'custom_fields' => empty($customFields) ? array() : $customFields, |
| 322 | 330 | ) |
| 323 | 331 | ); |
| 324 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 325 | - $context['themes'][$row['id_theme']]['num_members'] = $row['value']; |
|
| 332 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 333 | + $context['themes'][$row['id_theme']]['num_members'] = $row['value']; |
|
| 334 | + } |
|
| 326 | 335 | $smcFunc['db_free_result']($request); |
| 327 | 336 | |
| 328 | 337 | // There has to be a Settings template! |
| 329 | - foreach ($context['themes'] as $k => $v) |
|
| 330 | - if (empty($v['theme_dir']) || (!file_exists($v['theme_dir'] . '/Settings.template.php') && empty($v['num_members']))) |
|
| 338 | + foreach ($context['themes'] as $k => $v) { |
|
| 339 | + if (empty($v['theme_dir']) || (!file_exists($v['theme_dir'] . '/Settings.template.php') && empty($v['num_members']))) |
|
| 331 | 340 | unset($context['themes'][$k]); |
| 341 | + } |
|
| 332 | 342 | |
| 333 | 343 | loadTemplate('Themes'); |
| 334 | 344 | $context['sub_template'] = 'reset_list'; |
@@ -343,16 +353,19 @@ discard block |
||
| 343 | 353 | checkSession(); |
| 344 | 354 | validateToken('admin-sto'); |
| 345 | 355 | |
| 346 | - if (empty($_POST['options'])) |
|
| 347 | - $_POST['options'] = array(); |
|
| 348 | - if (empty($_POST['default_options'])) |
|
| 349 | - $_POST['default_options'] = array(); |
|
| 356 | + if (empty($_POST['options'])) { |
|
| 357 | + $_POST['options'] = array(); |
|
| 358 | + } |
|
| 359 | + if (empty($_POST['default_options'])) { |
|
| 360 | + $_POST['default_options'] = array(); |
|
| 361 | + } |
|
| 350 | 362 | |
| 351 | 363 | // Set up the sql query. |
| 352 | 364 | $setValues = array(); |
| 353 | 365 | |
| 354 | - foreach ($_POST['options'] as $opt => $val) |
|
| 355 | - $setValues[] = array(-1, $_GET['th'], $opt, is_array($val) ? implode(',', $val) : $val); |
|
| 366 | + foreach ($_POST['options'] as $opt => $val) { |
|
| 367 | + $setValues[] = array(-1, $_GET['th'], $opt, is_array($val) ? implode(',', $val) : $val); |
|
| 368 | + } |
|
| 356 | 369 | |
| 357 | 370 | $old_settings = array(); |
| 358 | 371 | foreach ($_POST['default_options'] as $opt => $val) |
@@ -366,8 +379,8 @@ discard block |
||
| 366 | 379 | if (!empty($setValues)) |
| 367 | 380 | { |
| 368 | 381 | // Are there options in non-default themes set that should be cleared? |
| 369 | - if (!empty($old_settings)) |
|
| 370 | - $smcFunc['db_query']('', ' |
|
| 382 | + if (!empty($old_settings)) { |
|
| 383 | + $smcFunc['db_query']('', ' |
|
| 371 | 384 | DELETE FROM {db_prefix}themes |
| 372 | 385 | WHERE id_theme != {int:default_theme} |
| 373 | 386 | AND id_member = {int:guest_member} |
@@ -378,6 +391,7 @@ discard block |
||
| 378 | 391 | 'old_settings' => $old_settings, |
| 379 | 392 | ) |
| 380 | 393 | ); |
| 394 | + } |
|
| 381 | 395 | |
| 382 | 396 | $smcFunc['db_insert']('replace', |
| 383 | 397 | '{db_prefix}themes', |
@@ -391,8 +405,7 @@ discard block |
||
| 391 | 405 | cache_put_data('theme_settings-1', null, 90); |
| 392 | 406 | |
| 393 | 407 | redirectexit('action=admin;area=theme;' . $context['session_var'] . '=' . $context['session_id'] . ';sa=reset'); |
| 394 | - } |
|
| 395 | - elseif (isset($_POST['submit']) && $_POST['who'] == 1) |
|
| 408 | + } elseif (isset($_POST['submit']) && $_POST['who'] == 1) |
|
| 396 | 409 | { |
| 397 | 410 | checkSession(); |
| 398 | 411 | validateToken('admin-sto'); |
@@ -405,9 +418,9 @@ discard block |
||
| 405 | 418 | $old_settings = array(); |
| 406 | 419 | foreach ($_POST['default_options'] as $opt => $val) |
| 407 | 420 | { |
| 408 | - if ($_POST['default_options_master'][$opt] == 0) |
|
| 409 | - continue; |
|
| 410 | - elseif ($_POST['default_options_master'][$opt] == 1) |
|
| 421 | + if ($_POST['default_options_master'][$opt] == 0) { |
|
| 422 | + continue; |
|
| 423 | + } elseif ($_POST['default_options_master'][$opt] == 1) |
|
| 411 | 424 | { |
| 412 | 425 | // Delete then insert for ease of database compatibility! |
| 413 | 426 | $smcFunc['db_query']('substring', ' |
@@ -433,8 +446,7 @@ discard block |
||
| 433 | 446 | ); |
| 434 | 447 | |
| 435 | 448 | $old_settings[] = $opt; |
| 436 | - } |
|
| 437 | - elseif ($_POST['default_options_master'][$opt] == 2) |
|
| 449 | + } elseif ($_POST['default_options_master'][$opt] == 2) |
|
| 438 | 450 | { |
| 439 | 451 | $smcFunc['db_query']('', ' |
| 440 | 452 | DELETE FROM {db_prefix}themes |
@@ -449,8 +461,8 @@ discard block |
||
| 449 | 461 | } |
| 450 | 462 | |
| 451 | 463 | // Delete options from other themes. |
| 452 | - if (!empty($old_settings)) |
|
| 453 | - $smcFunc['db_query']('', ' |
|
| 464 | + if (!empty($old_settings)) { |
|
| 465 | + $smcFunc['db_query']('', ' |
|
| 454 | 466 | DELETE FROM {db_prefix}themes |
| 455 | 467 | WHERE id_theme != {int:default_theme} |
| 456 | 468 | AND id_member > {int:no_member} |
@@ -461,12 +473,13 @@ discard block |
||
| 461 | 473 | 'old_settings' => $old_settings, |
| 462 | 474 | ) |
| 463 | 475 | ); |
| 476 | + } |
|
| 464 | 477 | |
| 465 | 478 | foreach ($_POST['options'] as $opt => $val) |
| 466 | 479 | { |
| 467 | - if ($_POST['options_master'][$opt] == 0) |
|
| 468 | - continue; |
|
| 469 | - elseif ($_POST['options_master'][$opt] == 1) |
|
| 480 | + if ($_POST['options_master'][$opt] == 0) { |
|
| 481 | + continue; |
|
| 482 | + } elseif ($_POST['options_master'][$opt] == 1) |
|
| 470 | 483 | { |
| 471 | 484 | // Delete then insert for ease of database compatibility - again! |
| 472 | 485 | $smcFunc['db_query']('substring', ' |
@@ -491,8 +504,7 @@ discard block |
||
| 491 | 504 | 'value' => (is_array($val) ? implode(',', $val) : $val), |
| 492 | 505 | ) |
| 493 | 506 | ); |
| 494 | - } |
|
| 495 | - elseif ($_POST['options_master'][$opt] == 2) |
|
| 507 | + } elseif ($_POST['options_master'][$opt] == 2) |
|
| 496 | 508 | { |
| 497 | 509 | $smcFunc['db_query']('', ' |
| 498 | 510 | DELETE FROM {db_prefix}themes |
@@ -509,8 +521,7 @@ discard block |
||
| 509 | 521 | } |
| 510 | 522 | |
| 511 | 523 | redirectexit('action=admin;area=theme;' . $context['session_var'] . '=' . $context['session_id'] . ';sa=reset'); |
| 512 | - } |
|
| 513 | - elseif (!empty($_GET['who']) && $_GET['who'] == 2) |
|
| 524 | + } elseif (!empty($_GET['who']) && $_GET['who'] == 2) |
|
| 514 | 525 | { |
| 515 | 526 | checkSession('get'); |
| 516 | 527 | validateToken('admin-stor', 'request'); |
@@ -525,8 +536,9 @@ discard block |
||
| 525 | 536 | ) |
| 526 | 537 | ); |
| 527 | 538 | $customFields = array(); |
| 528 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 529 | - $customFields[] = $row['col_name']; |
|
| 539 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 540 | + $customFields[] = $row['col_name']; |
|
| 541 | + } |
|
| 530 | 542 | $smcFunc['db_free_result']($request); |
| 531 | 543 | } |
| 532 | 544 | $customFieldsQuery = empty($customFields) ? '' : ('AND variable NOT IN ({array_string:custom_fields})'); |
@@ -578,13 +590,13 @@ discard block |
||
| 578 | 590 | ) |
| 579 | 591 | ); |
| 580 | 592 | $context['theme_options'] = array(); |
| 581 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 582 | - $context['theme_options'][$row['variable']] = $row['value']; |
|
| 593 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 594 | + $context['theme_options'][$row['variable']] = $row['value']; |
|
| 595 | + } |
|
| 583 | 596 | $smcFunc['db_free_result']($request); |
| 584 | 597 | |
| 585 | 598 | $context['theme_options_reset'] = false; |
| 586 | - } |
|
| 587 | - else |
|
| 599 | + } else |
|
| 588 | 600 | { |
| 589 | 601 | $context['theme_options'] = array(); |
| 590 | 602 | $context['theme_options_reset'] = true; |
@@ -593,30 +605,32 @@ discard block |
||
| 593 | 605 | foreach ($context['options'] as $i => $setting) |
| 594 | 606 | { |
| 595 | 607 | // Just skip separators |
| 596 | - if (!is_array($setting)) |
|
| 597 | - continue; |
|
| 608 | + if (!is_array($setting)) { |
|
| 609 | + continue; |
|
| 610 | + } |
|
| 598 | 611 | |
| 599 | 612 | // Is this disabled? |
| 600 | 613 | if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
| 601 | 614 | { |
| 602 | 615 | unset($context['options'][$i]); |
| 603 | 616 | continue; |
| 604 | - } |
|
| 605 | - elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
| 617 | + } elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
| 606 | 618 | { |
| 607 | 619 | unset($context['options'][$i]); |
| 608 | 620 | continue; |
| 609 | 621 | } |
| 610 | 622 | |
| 611 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
| 612 | - $context['options'][$i]['type'] = 'checkbox'; |
|
| 613 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
| 614 | - $context['options'][$i]['type'] = 'number'; |
|
| 615 | - elseif ($setting['type'] == 'string') |
|
| 616 | - $context['options'][$i]['type'] = 'text'; |
|
| 623 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
| 624 | + $context['options'][$i]['type'] = 'checkbox'; |
|
| 625 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
| 626 | + $context['options'][$i]['type'] = 'number'; |
|
| 627 | + } elseif ($setting['type'] == 'string') { |
|
| 628 | + $context['options'][$i]['type'] = 'text'; |
|
| 629 | + } |
|
| 617 | 630 | |
| 618 | - if (isset($setting['options'])) |
|
| 619 | - $context['options'][$i]['type'] = 'list'; |
|
| 631 | + if (isset($setting['options'])) { |
|
| 632 | + $context['options'][$i]['type'] = 'list'; |
|
| 633 | + } |
|
| 620 | 634 | |
| 621 | 635 | $context['options'][$i]['value'] = !isset($context['theme_options'][$setting['id']]) ? '' : $context['theme_options'][$setting['id']]; |
| 622 | 636 | } |
@@ -641,8 +655,9 @@ discard block |
||
| 641 | 655 | { |
| 642 | 656 | global $txt, $context, $settings, $modSettings, $smcFunc; |
| 643 | 657 | |
| 644 | - if (empty($_GET['th']) && empty($_GET['id'])) |
|
| 645 | - return ThemeAdmin(); |
|
| 658 | + if (empty($_GET['th']) && empty($_GET['id'])) { |
|
| 659 | + return ThemeAdmin(); |
|
| 660 | + } |
|
| 646 | 661 | |
| 647 | 662 | $_GET['th'] = isset($_GET['th']) ? (int) $_GET['th'] : (int) $_GET['id']; |
| 648 | 663 | |
@@ -653,8 +668,9 @@ discard block |
||
| 653 | 668 | isAllowedTo('admin_forum'); |
| 654 | 669 | |
| 655 | 670 | // Validate inputs/user. |
| 656 | - if (empty($_GET['th'])) |
|
| 657 | - fatal_lang_error('no_theme', false); |
|
| 671 | + if (empty($_GET['th'])) { |
|
| 672 | + fatal_lang_error('no_theme', false); |
|
| 673 | + } |
|
| 658 | 674 | |
| 659 | 675 | // Fetch the smiley sets... |
| 660 | 676 | $sets = explode(',', 'none,' . $modSettings['smiley_sets_known']); |
@@ -662,8 +678,9 @@ discard block |
||
| 662 | 678 | $context['smiley_sets'] = array( |
| 663 | 679 | '' => $txt['smileys_no_default'] |
| 664 | 680 | ); |
| 665 | - foreach ($sets as $i => $set) |
|
| 666 | - $context['smiley_sets'][$set] = $smcFunc['htmlspecialchars']($set_names[$i]); |
|
| 681 | + foreach ($sets as $i => $set) { |
|
| 682 | + $context['smiley_sets'][$set] = $smcFunc['htmlspecialchars']($set_names[$i]); |
|
| 683 | + } |
|
| 667 | 684 | |
| 668 | 685 | $old_id = $settings['theme_id']; |
| 669 | 686 | $old_settings = $settings; |
@@ -688,8 +705,9 @@ discard block |
||
| 688 | 705 | if (file_exists($settings['theme_dir'] . '/index.template.php')) |
| 689 | 706 | { |
| 690 | 707 | $file_contents = implode('', file($settings['theme_dir'] . '/index.template.php')); |
| 691 | - if (preg_match('~\$settings\[\'theme_variants\'\]\s*=(.+?);~', $file_contents, $matches)) |
|
| 692 | - eval('global $settings;' . $matches[0]); |
|
| 708 | + if (preg_match('~\$settings\[\'theme_variants\'\]\s*=(.+?);~', $file_contents, $matches)) { |
|
| 709 | + eval('global $settings;' . $matches[0]); |
|
| 710 | + } |
|
| 693 | 711 | } |
| 694 | 712 | |
| 695 | 713 | // Submitting! |
@@ -698,37 +716,45 @@ discard block |
||
| 698 | 716 | checkSession(); |
| 699 | 717 | validateToken('admin-sts'); |
| 700 | 718 | |
| 701 | - if (empty($_POST['options'])) |
|
| 702 | - $_POST['options'] = array(); |
|
| 703 | - if (empty($_POST['default_options'])) |
|
| 704 | - $_POST['default_options'] = array(); |
|
| 719 | + if (empty($_POST['options'])) { |
|
| 720 | + $_POST['options'] = array(); |
|
| 721 | + } |
|
| 722 | + if (empty($_POST['default_options'])) { |
|
| 723 | + $_POST['default_options'] = array(); |
|
| 724 | + } |
|
| 705 | 725 | |
| 706 | 726 | // Make sure items are cast correctly. |
| 707 | 727 | foreach ($context['theme_settings'] as $item) |
| 708 | 728 | { |
| 709 | 729 | // Disregard this item if this is just a separator. |
| 710 | - if (!is_array($item)) |
|
| 711 | - continue; |
|
| 730 | + if (!is_array($item)) { |
|
| 731 | + continue; |
|
| 732 | + } |
|
| 712 | 733 | |
| 713 | 734 | foreach (array('options', 'default_options') as $option) |
| 714 | 735 | { |
| 715 | - if (!isset($_POST[$option][$item['id']])) |
|
| 716 | - continue; |
|
| 736 | + if (!isset($_POST[$option][$item['id']])) { |
|
| 737 | + continue; |
|
| 738 | + } |
|
| 717 | 739 | // Checkbox. |
| 718 | - elseif (empty($item['type'])) |
|
| 719 | - $_POST[$option][$item['id']] = $_POST[$option][$item['id']] ? 1 : 0; |
|
| 740 | + elseif (empty($item['type'])) { |
|
| 741 | + $_POST[$option][$item['id']] = $_POST[$option][$item['id']] ? 1 : 0; |
|
| 742 | + } |
|
| 720 | 743 | // Number |
| 721 | - elseif ($item['type'] == 'number') |
|
| 722 | - $_POST[$option][$item['id']] = (int) $_POST[$option][$item['id']]; |
|
| 744 | + elseif ($item['type'] == 'number') { |
|
| 745 | + $_POST[$option][$item['id']] = (int) $_POST[$option][$item['id']]; |
|
| 746 | + } |
|
| 723 | 747 | } |
| 724 | 748 | } |
| 725 | 749 | |
| 726 | 750 | // Set up the sql query. |
| 727 | 751 | $inserts = array(); |
| 728 | - foreach ($_POST['options'] as $opt => $val) |
|
| 729 | - $inserts[] = array(0, $_GET['th'], $opt, is_array($val) ? implode(',', $val) : $val); |
|
| 730 | - foreach ($_POST['default_options'] as $opt => $val) |
|
| 731 | - $inserts[] = array(0, 1, $opt, is_array($val) ? implode(',', $val) : $val); |
|
| 752 | + foreach ($_POST['options'] as $opt => $val) { |
|
| 753 | + $inserts[] = array(0, $_GET['th'], $opt, is_array($val) ? implode(',', $val) : $val); |
|
| 754 | + } |
|
| 755 | + foreach ($_POST['default_options'] as $opt => $val) { |
|
| 756 | + $inserts[] = array(0, 1, $opt, is_array($val) ? implode(',', $val) : $val); |
|
| 757 | + } |
|
| 732 | 758 | // If we're actually inserting something.. |
| 733 | 759 | if (!empty($inserts)) |
| 734 | 760 | { |
@@ -754,8 +780,9 @@ discard block |
||
| 754 | 780 | |
| 755 | 781 | foreach ($settings as $setting => $dummy) |
| 756 | 782 | { |
| 757 | - if (!in_array($setting, array('theme_url', 'theme_dir', 'images_url', 'template_dirs'))) |
|
| 758 | - $settings[$setting] = htmlspecialchars__recursive($settings[$setting]); |
|
| 783 | + if (!in_array($setting, array('theme_url', 'theme_dir', 'images_url', 'template_dirs'))) { |
|
| 784 | + $settings[$setting] = htmlspecialchars__recursive($settings[$setting]); |
|
| 785 | + } |
|
| 759 | 786 | } |
| 760 | 787 | |
| 761 | 788 | $context['settings'] = $context['theme_settings']; |
@@ -764,18 +791,21 @@ discard block |
||
| 764 | 791 | foreach ($context['settings'] as $i => $setting) |
| 765 | 792 | { |
| 766 | 793 | // Separators are dummies, so leave them alone. |
| 767 | - if (!is_array($setting)) |
|
| 768 | - continue; |
|
| 794 | + if (!is_array($setting)) { |
|
| 795 | + continue; |
|
| 796 | + } |
|
| 769 | 797 | |
| 770 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
| 771 | - $context['settings'][$i]['type'] = 'checkbox'; |
|
| 772 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
| 773 | - $context['settings'][$i]['type'] = 'number'; |
|
| 774 | - elseif ($setting['type'] == 'string') |
|
| 775 | - $context['settings'][$i]['type'] = 'text'; |
|
| 798 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
| 799 | + $context['settings'][$i]['type'] = 'checkbox'; |
|
| 800 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
| 801 | + $context['settings'][$i]['type'] = 'number'; |
|
| 802 | + } elseif ($setting['type'] == 'string') { |
|
| 803 | + $context['settings'][$i]['type'] = 'text'; |
|
| 804 | + } |
|
| 776 | 805 | |
| 777 | - if (isset($setting['options'])) |
|
| 778 | - $context['settings'][$i]['type'] = 'list'; |
|
| 806 | + if (isset($setting['options'])) { |
|
| 807 | + $context['settings'][$i]['type'] = 'list'; |
|
| 808 | + } |
|
| 779 | 809 | |
| 780 | 810 | $context['settings'][$i]['value'] = !isset($settings[$setting['id']]) ? '' : $settings[$setting['id']]; |
| 781 | 811 | } |
@@ -828,8 +858,9 @@ discard block |
||
| 828 | 858 | $themeID = isset($_GET['th']) ? (int) $_GET['th'] : (int) $_GET['id']; |
| 829 | 859 | |
| 830 | 860 | // You can't delete the default theme! |
| 831 | - if ($themeID == 1) |
|
| 832 | - fatal_lang_error('no_access', false); |
|
| 861 | + if ($themeID == 1) { |
|
| 862 | + fatal_lang_error('no_access', false); |
|
| 863 | + } |
|
| 833 | 864 | |
| 834 | 865 | $theme_info = get_single_theme($themeID); |
| 835 | 866 | |
@@ -837,8 +868,9 @@ discard block |
||
| 837 | 868 | remove_theme($themeID); |
| 838 | 869 | |
| 839 | 870 | // And remove all its files and folders too. |
| 840 | - if (!empty($theme_info) && !empty($theme_info['theme_dir'])) |
|
| 841 | - remove_dir($theme_info['theme_dir']); |
|
| 871 | + if (!empty($theme_info) && !empty($theme_info['theme_dir'])) { |
|
| 872 | + remove_dir($theme_info['theme_dir']); |
|
| 873 | + } |
|
| 842 | 874 | |
| 843 | 875 | // Go back to the list page. |
| 844 | 876 | redirectexit('action=admin;area=theme;sa=list;' . $context['session_var'] . '=' . $context['session_id'] . ';done=removing'); |
@@ -863,12 +895,14 @@ discard block |
||
| 863 | 895 | $enableThemes = explode(',', $modSettings['enableThemes']); |
| 864 | 896 | |
| 865 | 897 | // Are we disabling it? |
| 866 | - if (isset($_GET['disabled'])) |
|
| 867 | - $enableThemes = array_diff($enableThemes, array($themeID)); |
|
| 898 | + if (isset($_GET['disabled'])) { |
|
| 899 | + $enableThemes = array_diff($enableThemes, array($themeID)); |
|
| 900 | + } |
|
| 868 | 901 | |
| 869 | 902 | // Nope? then enable it! |
| 870 | - else |
|
| 871 | - $enableThemes[] = (string) $themeID; |
|
| 903 | + else { |
|
| 904 | + $enableThemes[] = (string) $themeID; |
|
| 905 | + } |
|
| 872 | 906 | |
| 873 | 907 | // Update the setting. |
| 874 | 908 | $enableThemes = strtr(implode(',', $enableThemes), array(',,' => ',')); |
@@ -903,18 +937,21 @@ discard block |
||
| 903 | 937 | |
| 904 | 938 | $_SESSION['id_theme'] = 0; |
| 905 | 939 | |
| 906 | - if (isset($_GET['id'])) |
|
| 907 | - $_GET['th'] = $_GET['id']; |
|
| 940 | + if (isset($_GET['id'])) { |
|
| 941 | + $_GET['th'] = $_GET['id']; |
|
| 942 | + } |
|
| 908 | 943 | |
| 909 | 944 | // Saving a variant cause JS doesn't work - pretend it did ;) |
| 910 | 945 | if (isset($_POST['save'])) |
| 911 | 946 | { |
| 912 | 947 | // Which theme? |
| 913 | - foreach ($_POST['save'] as $k => $v) |
|
| 914 | - $_GET['th'] = (int) $k; |
|
| 948 | + foreach ($_POST['save'] as $k => $v) { |
|
| 949 | + $_GET['th'] = (int) $k; |
|
| 950 | + } |
|
| 915 | 951 | |
| 916 | - if (isset($_POST['vrt'][$k])) |
|
| 917 | - $_GET['vrt'] = $_POST['vrt'][$k]; |
|
| 952 | + if (isset($_POST['vrt'][$k])) { |
|
| 953 | + $_GET['vrt'] = $_POST['vrt'][$k]; |
|
| 954 | + } |
|
| 918 | 955 | } |
| 919 | 956 | |
| 920 | 957 | // Have we made a decision, or are we just browsing? |
@@ -992,8 +1029,9 @@ discard block |
||
| 992 | 1029 | else |
| 993 | 1030 | { |
| 994 | 1031 | // The forum's default theme is always 0 and we |
| 995 | - if (isset($_GET['th']) && $_GET['th'] == 0) |
|
| 996 | - $_GET['th'] = $modSettings['theme_guests']; |
|
| 1032 | + if (isset($_GET['th']) && $_GET['th'] == 0) { |
|
| 1033 | + $_GET['th'] = $modSettings['theme_guests']; |
|
| 1034 | + } |
|
| 997 | 1035 | |
| 998 | 1036 | updateMemberData((int) $_REQUEST['u'], array('id_theme' => (int) $_GET['th'])); |
| 999 | 1037 | |
@@ -1007,8 +1045,9 @@ discard block |
||
| 1007 | 1045 | ); |
| 1008 | 1046 | cache_put_data('theme_settings-' . $_GET['th'] . ':' . (int) $_REQUEST['u'], null, 90); |
| 1009 | 1047 | |
| 1010 | - if ($user_info['id'] == $_REQUEST['u']) |
|
| 1011 | - $_SESSION['id_variant'] = 0; |
|
| 1048 | + if ($user_info['id'] == $_REQUEST['u']) { |
|
| 1049 | + $_SESSION['id_variant'] = 0; |
|
| 1050 | + } |
|
| 1012 | 1051 | } |
| 1013 | 1052 | |
| 1014 | 1053 | redirectexit('action=profile;u=' . (int) $_REQUEST['u'] . ';area=theme'); |
@@ -1077,12 +1116,13 @@ discard block |
||
| 1077 | 1116 | ); |
| 1078 | 1117 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1079 | 1118 | { |
| 1080 | - if (!isset($context['available_themes'][$row['id_theme']])) |
|
| 1081 | - $context['available_themes'][$row['id_theme']] = array( |
|
| 1119 | + if (!isset($context['available_themes'][$row['id_theme']])) { |
|
| 1120 | + $context['available_themes'][$row['id_theme']] = array( |
|
| 1082 | 1121 | 'id' => $row['id_theme'], |
| 1083 | 1122 | 'selected' => $context['current_theme'] == $row['id_theme'], |
| 1084 | 1123 | 'num_users' => 0 |
| 1085 | 1124 | ); |
| 1125 | + } |
|
| 1086 | 1126 | $context['available_themes'][$row['id_theme']][$row['variable']] = $row['value']; |
| 1087 | 1127 | } |
| 1088 | 1128 | $smcFunc['db_free_result']($request); |
@@ -1095,9 +1135,9 @@ discard block |
||
| 1095 | 1135 | 'num_users' => 0 |
| 1096 | 1136 | ); |
| 1097 | 1137 | $guest_theme = 0; |
| 1138 | + } else { |
|
| 1139 | + $guest_theme = $modSettings['theme_guests']; |
|
| 1098 | 1140 | } |
| 1099 | - else |
|
| 1100 | - $guest_theme = $modSettings['theme_guests']; |
|
| 1101 | 1141 | |
| 1102 | 1142 | $request = $smcFunc['db_query']('', ' |
| 1103 | 1143 | SELECT id_theme, COUNT(*) AS the_count |
@@ -1110,15 +1150,17 @@ discard block |
||
| 1110 | 1150 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1111 | 1151 | { |
| 1112 | 1152 | // Figure out which theme it is they are REALLY using. |
| 1113 | - if (!empty($modSettings['knownThemes']) && !in_array($row['id_theme'], explode(',', $modSettings['knownThemes']))) |
|
| 1114 | - $row['id_theme'] = $guest_theme; |
|
| 1115 | - elseif (empty($modSettings['theme_allow'])) |
|
| 1116 | - $row['id_theme'] = $guest_theme; |
|
| 1153 | + if (!empty($modSettings['knownThemes']) && !in_array($row['id_theme'], explode(',', $modSettings['knownThemes']))) { |
|
| 1154 | + $row['id_theme'] = $guest_theme; |
|
| 1155 | + } elseif (empty($modSettings['theme_allow'])) { |
|
| 1156 | + $row['id_theme'] = $guest_theme; |
|
| 1157 | + } |
|
| 1117 | 1158 | |
| 1118 | - if (isset($context['available_themes'][$row['id_theme']])) |
|
| 1119 | - $context['available_themes'][$row['id_theme']]['num_users'] += $row['the_count']; |
|
| 1120 | - else |
|
| 1121 | - $context['available_themes'][$guest_theme]['num_users'] += $row['the_count']; |
|
| 1159 | + if (isset($context['available_themes'][$row['id_theme']])) { |
|
| 1160 | + $context['available_themes'][$row['id_theme']]['num_users'] += $row['the_count']; |
|
| 1161 | + } else { |
|
| 1162 | + $context['available_themes'][$guest_theme]['num_users'] += $row['the_count']; |
|
| 1163 | + } |
|
| 1122 | 1164 | } |
| 1123 | 1165 | $smcFunc['db_free_result']($request); |
| 1124 | 1166 | |
@@ -1137,8 +1179,9 @@ discard block |
||
| 1137 | 1179 | 'id_member' => isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? array(-1, $context['current_member']) : array(-1), |
| 1138 | 1180 | ) |
| 1139 | 1181 | ); |
| 1140 | - while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 1141 | - $variant_preferences[$row['id_theme']] = $row['value']; |
|
| 1182 | + while ($row = $smcFunc['db_fetch_assoc']($request)) { |
|
| 1183 | + $variant_preferences[$row['id_theme']] = $row['value']; |
|
| 1184 | + } |
|
| 1142 | 1185 | $smcFunc['db_free_result']($request); |
| 1143 | 1186 | } |
| 1144 | 1187 | |
@@ -1149,17 +1192,18 @@ discard block |
||
| 1149 | 1192 | foreach ($context['available_themes'] as $id_theme => $theme_data) |
| 1150 | 1193 | { |
| 1151 | 1194 | // Don't try to load the forum or board default theme's data... it doesn't have any! |
| 1152 | - if ($id_theme == 0) |
|
| 1153 | - continue; |
|
| 1195 | + if ($id_theme == 0) { |
|
| 1196 | + continue; |
|
| 1197 | + } |
|
| 1154 | 1198 | |
| 1155 | 1199 | // The thumbnail needs the correct path. |
| 1156 | 1200 | $settings['images_url'] = &$theme_data['images_url']; |
| 1157 | 1201 | |
| 1158 | - if (file_exists($theme_data['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php')) |
|
| 1159 | - include($theme_data['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php'); |
|
| 1160 | - elseif (file_exists($theme_data['theme_dir'] . '/languages/Settings.' . $language . '.php')) |
|
| 1161 | - include($theme_data['theme_dir'] . '/languages/Settings.' . $language . '.php'); |
|
| 1162 | - else |
|
| 1202 | + if (file_exists($theme_data['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php')) { |
|
| 1203 | + include($theme_data['theme_dir'] . '/languages/Settings.' . $user_info['language'] . '.php'); |
|
| 1204 | + } elseif (file_exists($theme_data['theme_dir'] . '/languages/Settings.' . $language . '.php')) { |
|
| 1205 | + include($theme_data['theme_dir'] . '/languages/Settings.' . $language . '.php'); |
|
| 1206 | + } else |
|
| 1163 | 1207 | { |
| 1164 | 1208 | $txt['theme_thumbnail_href'] = $theme_data['images_url'] . '/thumbnail.png'; |
| 1165 | 1209 | $txt['theme_description'] = ''; |
@@ -1184,15 +1228,17 @@ discard block |
||
| 1184 | 1228 | loadLanguage('Settings'); |
| 1185 | 1229 | |
| 1186 | 1230 | $context['available_themes'][$id_theme]['variants'] = array(); |
| 1187 | - foreach ($settings['theme_variants'] as $variant) |
|
| 1188 | - $context['available_themes'][$id_theme]['variants'][$variant] = array( |
|
| 1231 | + foreach ($settings['theme_variants'] as $variant) { |
|
| 1232 | + $context['available_themes'][$id_theme]['variants'][$variant] = array( |
|
| 1189 | 1233 | 'label' => isset($txt['variant_' . $variant]) ? $txt['variant_' . $variant] : $variant, |
| 1190 | 1234 | 'thumbnail' => !file_exists($theme_data['theme_dir'] . '/images/thumbnail.png') || file_exists($theme_data['theme_dir'] . '/images/thumbnail_' . $variant . '.png') ? $theme_data['images_url'] . '/thumbnail_' . $variant . '.png' : ($theme_data['images_url'] . '/thumbnail.png'), |
| 1191 | 1235 | ); |
| 1236 | + } |
|
| 1192 | 1237 | |
| 1193 | 1238 | $context['available_themes'][$id_theme]['selected_variant'] = isset($_GET['vrt']) ? $_GET['vrt'] : (!empty($variant_preferences[$id_theme]) ? $variant_preferences[$id_theme] : (!empty($settings['default_variant']) ? $settings['default_variant'] : $settings['theme_variants'][0])); |
| 1194 | - if (!isset($context['available_themes'][$id_theme]['variants'][$context['available_themes'][$id_theme]['selected_variant']]['thumbnail'])) |
|
| 1195 | - $context['available_themes'][$id_theme]['selected_variant'] = $settings['theme_variants'][0]; |
|
| 1239 | + if (!isset($context['available_themes'][$id_theme]['variants'][$context['available_themes'][$id_theme]['selected_variant']]['thumbnail'])) { |
|
| 1240 | + $context['available_themes'][$id_theme]['selected_variant'] = $settings['theme_variants'][0]; |
|
| 1241 | + } |
|
| 1196 | 1242 | |
| 1197 | 1243 | $context['available_themes'][$id_theme]['thumbnail_href'] = $context['available_themes'][$id_theme]['variants'][$context['available_themes'][$id_theme]['selected_variant']]['thumbnail']; |
| 1198 | 1244 | // Allow themes to override the text. |
@@ -1208,8 +1254,9 @@ discard block |
||
| 1208 | 1254 | // As long as we're not doing the default theme... |
| 1209 | 1255 | if (!isset($_REQUEST['u']) || $_REQUEST['u'] >= 0) |
| 1210 | 1256 | { |
| 1211 | - if ($guest_theme != 0) |
|
| 1212 | - $context['available_themes'][0] = $context['available_themes'][$guest_theme]; |
|
| 1257 | + if ($guest_theme != 0) { |
|
| 1258 | + $context['available_themes'][0] = $context['available_themes'][$guest_theme]; |
|
| 1259 | + } |
|
| 1213 | 1260 | |
| 1214 | 1261 | $context['available_themes'][0]['id'] = 0; |
| 1215 | 1262 | $context['available_themes'][0]['name'] = $txt['theme_forum_default']; |
@@ -1258,14 +1305,16 @@ discard block |
||
| 1258 | 1305 | $action = $smcFunc['htmlspecialchars'](trim($_GET['do'])); |
| 1259 | 1306 | |
| 1260 | 1307 | // Got any info from the specific form? |
| 1261 | - if (!isset($_POST['save_' . $action])) |
|
| 1262 | - fatal_lang_error('theme_install_no_action', false); |
|
| 1308 | + if (!isset($_POST['save_' . $action])) { |
|
| 1309 | + fatal_lang_error('theme_install_no_action', false); |
|
| 1310 | + } |
|
| 1263 | 1311 | |
| 1264 | 1312 | validateToken('admin-t-' . $action); |
| 1265 | 1313 | |
| 1266 | 1314 | // Hopefully the themes directory is writable, or we might have a problem. |
| 1267 | - if (!is_writable($themedir)) |
|
| 1268 | - fatal_lang_error('theme_install_write_error', 'critical'); |
|
| 1315 | + if (!is_writable($themedir)) { |
|
| 1316 | + fatal_lang_error('theme_install_write_error', 'critical'); |
|
| 1317 | + } |
|
| 1269 | 1318 | |
| 1270 | 1319 | // Call the function and handle the result. |
| 1271 | 1320 | $result = $subActions[$action](); |
@@ -1280,9 +1329,10 @@ discard block |
||
| 1280 | 1329 | } |
| 1281 | 1330 | |
| 1282 | 1331 | // Nope, show a nice error. |
| 1283 | - else |
|
| 1284 | - fatal_lang_error('theme_install_no_action', false); |
|
| 1285 | -} |
|
| 1332 | + else { |
|
| 1333 | + fatal_lang_error('theme_install_no_action', false); |
|
| 1334 | + } |
|
| 1335 | + } |
|
| 1286 | 1336 | |
| 1287 | 1337 | /** |
| 1288 | 1338 | * Installs a theme from a theme package. |
@@ -1298,8 +1348,9 @@ discard block |
||
| 1298 | 1348 | $dirtemp = $themedir . '/temp'; |
| 1299 | 1349 | |
| 1300 | 1350 | // Make sure the temp dir doesn't already exist |
| 1301 | - if (file_exists($dirtemp)) |
|
| 1302 | - remove_dir($dirtemp); |
|
| 1351 | + if (file_exists($dirtemp)) { |
|
| 1352 | + remove_dir($dirtemp); |
|
| 1353 | + } |
|
| 1303 | 1354 | |
| 1304 | 1355 | // Create the temp dir. |
| 1305 | 1356 | mkdir($dirtemp, 0777); |
@@ -1311,17 +1362,20 @@ discard block |
||
| 1311 | 1362 | smf_chmod($dirtemp, '0755'); |
| 1312 | 1363 | |
| 1313 | 1364 | // How about now? |
| 1314 | - if (!is_writable($dirtemp)) |
|
| 1315 | - fatal_lang_error('theme_install_write_error', 'critical'); |
|
| 1365 | + if (!is_writable($dirtemp)) { |
|
| 1366 | + fatal_lang_error('theme_install_write_error', 'critical'); |
|
| 1367 | + } |
|
| 1316 | 1368 | } |
| 1317 | 1369 | |
| 1318 | 1370 | // This happens when the admin session is gone and the user has to login again. |
| 1319 | - if (!isset($_FILES) || !isset($_FILES['theme_gz']) || empty($_FILES['theme_gz'])) |
|
| 1320 | - redirectexit('action=admin;area=theme;sa=admin;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 1371 | + if (!isset($_FILES) || !isset($_FILES['theme_gz']) || empty($_FILES['theme_gz'])) { |
|
| 1372 | + redirectexit('action=admin;area=theme;sa=admin;' . $context['session_var'] . '=' . $context['session_id']); |
|
| 1373 | + } |
|
| 1321 | 1374 | |
| 1322 | 1375 | // Another error check layer, something went wrong with the upload. |
| 1323 | - if (isset($_FILES['theme_gz']['error']) && $_FILES['theme_gz']['error'] != 0) |
|
| 1324 | - fatal_lang_error('theme_install_error_file_' . $_FILES['theme_gz']['error'], false); |
|
| 1376 | + if (isset($_FILES['theme_gz']['error']) && $_FILES['theme_gz']['error'] != 0) { |
|
| 1377 | + fatal_lang_error('theme_install_error_file_' . $_FILES['theme_gz']['error'], false); |
|
| 1378 | + } |
|
| 1325 | 1379 | |
| 1326 | 1380 | // Get the theme's name. |
| 1327 | 1381 | $name = pathinfo($_FILES['theme_gz']['name'], PATHINFO_FILENAME); |
@@ -1352,11 +1406,10 @@ discard block |
||
| 1352 | 1406 | |
| 1353 | 1407 | // return all the info. |
| 1354 | 1408 | return $context['to_install']; |
| 1409 | + } else { |
|
| 1410 | + fatal_lang_error('theme_install_error_title', false); |
|
| 1411 | + } |
|
| 1355 | 1412 | } |
| 1356 | - |
|
| 1357 | - else |
|
| 1358 | - fatal_lang_error('theme_install_error_title', false); |
|
| 1359 | -} |
|
| 1360 | 1413 | |
| 1361 | 1414 | /** |
| 1362 | 1415 | * Makes a copy from the default theme, assigns a name for it and installs it. |
@@ -1370,15 +1423,17 @@ discard block |
||
| 1370 | 1423 | global $forum_version; |
| 1371 | 1424 | |
| 1372 | 1425 | // There's gotta be something to work with. |
| 1373 | - if (!isset($_REQUEST['copy']) || empty($_REQUEST['copy'])) |
|
| 1374 | - fatal_lang_error('theme_install_error_title', false); |
|
| 1426 | + if (!isset($_REQUEST['copy']) || empty($_REQUEST['copy'])) { |
|
| 1427 | + fatal_lang_error('theme_install_error_title', false); |
|
| 1428 | + } |
|
| 1375 | 1429 | |
| 1376 | 1430 | // Get a cleaner version. |
| 1377 | 1431 | $name = preg_replace('~[^A-Za-z0-9_\- ]~', '', $_REQUEST['copy']); |
| 1378 | 1432 | |
| 1379 | 1433 | // Is there a theme already named like this? |
| 1380 | - if (file_exists($themedir . '/' . $name)) |
|
| 1381 | - fatal_lang_error('theme_install_already_dir', false); |
|
| 1434 | + if (file_exists($themedir . '/' . $name)) { |
|
| 1435 | + fatal_lang_error('theme_install_already_dir', false); |
|
| 1436 | + } |
|
| 1382 | 1437 | |
| 1383 | 1438 | // This is a brand new theme so set all possible values. |
| 1384 | 1439 | $context['to_install'] = array( |
@@ -1398,8 +1453,9 @@ discard block |
||
| 1398 | 1453 | |
| 1399 | 1454 | // Buy some time. |
| 1400 | 1455 | @set_time_limit(600); |
| 1401 | - if (function_exists('apache_reset_timeout')) |
|
| 1402 | - @apache_reset_timeout(); |
|
| 1456 | + if (function_exists('apache_reset_timeout')) { |
|
| 1457 | + @apache_reset_timeout(); |
|
| 1458 | + } |
|
| 1403 | 1459 | |
| 1404 | 1460 | // Create subdirectories for css and javascript files. |
| 1405 | 1461 | mkdir($context['to_install']['theme_dir'] . '/css', 0777); |
@@ -1435,12 +1491,13 @@ discard block |
||
| 1435 | 1491 | |
| 1436 | 1492 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
| 1437 | 1493 | { |
| 1438 | - if ($row['variable'] == 'theme_templates') |
|
| 1439 | - $theme_templates = $row['value']; |
|
| 1440 | - elseif ($row['variable'] == 'theme_layers') |
|
| 1441 | - $theme_layers = $row['value']; |
|
| 1442 | - else |
|
| 1443 | - continue; |
|
| 1494 | + if ($row['variable'] == 'theme_templates') { |
|
| 1495 | + $theme_templates = $row['value']; |
|
| 1496 | + } elseif ($row['variable'] == 'theme_layers') { |
|
| 1497 | + $theme_layers = $row['value']; |
|
| 1498 | + } else { |
|
| 1499 | + continue; |
|
| 1500 | + } |
|
| 1444 | 1501 | } |
| 1445 | 1502 | |
| 1446 | 1503 | $smcFunc['db_free_result']($request); |
@@ -1499,12 +1556,14 @@ discard block |
||
| 1499 | 1556 | global $themedir, $themeurl, $context; |
| 1500 | 1557 | |
| 1501 | 1558 | // Cannot use the theme dir as a theme dir. |
| 1502 | - if (!isset($_REQUEST['theme_dir']) || empty($_REQUEST['theme_dir']) || rtrim(realpath($_REQUEST['theme_dir']), '/\\') == realpath($themedir)) |
|
| 1503 | - fatal_lang_error('theme_install_invalid_dir', false); |
|
| 1559 | + if (!isset($_REQUEST['theme_dir']) || empty($_REQUEST['theme_dir']) || rtrim(realpath($_REQUEST['theme_dir']), '/\\') == realpath($themedir)) { |
|
| 1560 | + fatal_lang_error('theme_install_invalid_dir', false); |
|
| 1561 | + } |
|
| 1504 | 1562 | |
| 1505 | 1563 | // Check is there is "something" on the dir. |
| 1506 | - elseif (!is_dir($_REQUEST['theme_dir']) || !file_exists($_REQUEST['theme_dir'] . '/theme_info.xml')) |
|
| 1507 | - fatal_lang_error('theme_install_error', false); |
|
| 1564 | + elseif (!is_dir($_REQUEST['theme_dir']) || !file_exists($_REQUEST['theme_dir'] . '/theme_info.xml')) { |
|
| 1565 | + fatal_lang_error('theme_install_error', false); |
|
| 1566 | + } |
|
| 1508 | 1567 | |
| 1509 | 1568 | $name = basename($_REQUEST['theme_dir']); |
| 1510 | 1569 | $name = preg_replace(array('/\s/', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $name); |
@@ -1548,24 +1607,27 @@ discard block |
||
| 1548 | 1607 | } |
| 1549 | 1608 | |
| 1550 | 1609 | // Any special layers? |
| 1551 | - if (isset($settings['catch_action']['layers'])) |
|
| 1552 | - $context['template_layers'] = $settings['catch_action']['layers']; |
|
| 1610 | + if (isset($settings['catch_action']['layers'])) { |
|
| 1611 | + $context['template_layers'] = $settings['catch_action']['layers']; |
|
| 1612 | + } |
|
| 1553 | 1613 | |
| 1554 | 1614 | // Any function to call? |
| 1555 | 1615 | if (isset($settings['catch_action']['function'])) |
| 1556 | 1616 | { |
| 1557 | 1617 | $hook = $settings['catch_action']['function']; |
| 1558 | 1618 | |
| 1559 | - if (!isset($settings['catch_action']['filename'])) |
|
| 1560 | - $settings['catch_action']['filename'] = ''; |
|
| 1619 | + if (!isset($settings['catch_action']['filename'])) { |
|
| 1620 | + $settings['catch_action']['filename'] = ''; |
|
| 1621 | + } |
|
| 1561 | 1622 | |
| 1562 | 1623 | add_integration_function('integrate_wrap_action', $hook, false, $settings['catch_action']['filename'], false); |
| 1563 | 1624 | call_integration_hook('integrate_wrap_action'); |
| 1564 | 1625 | } |
| 1565 | 1626 | // And finally, the main sub template ;). |
| 1566 | - if (isset($settings['catch_action']['sub_template'])) |
|
| 1567 | - $context['sub_template'] = $settings['catch_action']['sub_template']; |
|
| 1568 | -} |
|
| 1627 | + if (isset($settings['catch_action']['sub_template'])) { |
|
| 1628 | + $context['sub_template'] = $settings['catch_action']['sub_template']; |
|
| 1629 | + } |
|
| 1630 | + } |
|
| 1569 | 1631 | |
| 1570 | 1632 | /** |
| 1571 | 1633 | * Set an option via javascript. |
@@ -1584,12 +1646,14 @@ discard block |
||
| 1584 | 1646 | checkSession('get'); |
| 1585 | 1647 | |
| 1586 | 1648 | // This good-for-nothing pixel is being used to keep the session alive. |
| 1587 | - if (empty($_GET['var']) || !isset($_GET['val'])) |
|
| 1588 | - redirectexit($settings['images_url'] . '/blank.png'); |
|
| 1649 | + if (empty($_GET['var']) || !isset($_GET['val'])) { |
|
| 1650 | + redirectexit($settings['images_url'] . '/blank.png'); |
|
| 1651 | + } |
|
| 1589 | 1652 | |
| 1590 | 1653 | // Sorry, guests can't go any further than this. |
| 1591 | - if ($user_info['is_guest'] || $user_info['id'] == 0) |
|
| 1592 | - obExit(false); |
|
| 1654 | + if ($user_info['is_guest'] || $user_info['id'] == 0) { |
|
| 1655 | + obExit(false); |
|
| 1656 | + } |
|
| 1593 | 1657 | |
| 1594 | 1658 | $reservedVars = array( |
| 1595 | 1659 | 'actual_theme_url', |
@@ -1612,8 +1676,9 @@ discard block |
||
| 1612 | 1676 | ); |
| 1613 | 1677 | |
| 1614 | 1678 | // Can't change reserved vars. |
| 1615 | - if (in_array(strtolower($_GET['var']), $reservedVars)) |
|
| 1616 | - redirectexit($settings['images_url'] . '/blank.png'); |
|
| 1679 | + if (in_array(strtolower($_GET['var']), $reservedVars)) { |
|
| 1680 | + redirectexit($settings['images_url'] . '/blank.png'); |
|
| 1681 | + } |
|
| 1617 | 1682 | |
| 1618 | 1683 | // Use a specific theme? |
| 1619 | 1684 | if (isset($_GET['th']) || isset($_GET['id'])) |
@@ -1629,8 +1694,9 @@ discard block |
||
| 1629 | 1694 | { |
| 1630 | 1695 | $options['admin_preferences'] = !empty($options['admin_preferences']) ? smf_json_decode($options['admin_preferences'], true) : array(); |
| 1631 | 1696 | // New thingy... |
| 1632 | - if (isset($_GET['admin_key']) && strlen($_GET['admin_key']) < 5) |
|
| 1633 | - $options['admin_preferences'][$_GET['admin_key']] = $_GET['val']; |
|
| 1697 | + if (isset($_GET['admin_key']) && strlen($_GET['admin_key']) < 5) { |
|
| 1698 | + $options['admin_preferences'][$_GET['admin_key']] = $_GET['val']; |
|
| 1699 | + } |
|
| 1634 | 1700 | |
| 1635 | 1701 | // Change the value to be something nice, |
| 1636 | 1702 | $_GET['val'] = json_encode($options['admin_preferences']); |
@@ -1660,8 +1726,9 @@ discard block |
||
| 1660 | 1726 | global $context, $scripturl, $boarddir, $smcFunc, $txt; |
| 1661 | 1727 | |
| 1662 | 1728 | // @todo Should this be removed? |
| 1663 | - if (isset($_REQUEST['preview'])) |
|
| 1664 | - die('die() with fire'); |
|
| 1729 | + if (isset($_REQUEST['preview'])) { |
|
| 1730 | + die('die() with fire'); |
|
| 1731 | + } |
|
| 1665 | 1732 | |
| 1666 | 1733 | isAllowedTo('admin_forum'); |
| 1667 | 1734 | loadTemplate('Themes'); |
@@ -1675,11 +1742,11 @@ discard block |
||
| 1675 | 1742 | foreach ($context['themes'] as $key => $theme) |
| 1676 | 1743 | { |
| 1677 | 1744 | // There has to be a Settings template! |
| 1678 | - if (!file_exists($theme['theme_dir'] . '/index.template.php') && !file_exists($theme['theme_dir'] . '/css/index.css')) |
|
| 1679 | - unset($context['themes'][$key]); |
|
| 1680 | - |
|
| 1681 | - else |
|
| 1682 | - $context['themes'][$key]['can_edit_style'] = file_exists($theme['theme_dir'] . '/css/index.css'); |
|
| 1745 | + if (!file_exists($theme['theme_dir'] . '/index.template.php') && !file_exists($theme['theme_dir'] . '/css/index.css')) { |
|
| 1746 | + unset($context['themes'][$key]); |
|
| 1747 | + } else { |
|
| 1748 | + $context['themes'][$key]['can_edit_style'] = file_exists($theme['theme_dir'] . '/css/index.css'); |
|
| 1749 | + } |
|
| 1683 | 1750 | } |
| 1684 | 1751 | |
| 1685 | 1752 | $context['sub_template'] = 'edit_list'; |
@@ -1694,22 +1761,24 @@ discard block |
||
| 1694 | 1761 | $context['theme_id'] = $currentTheme['id']; |
| 1695 | 1762 | $context['browse_title'] = sprintf($txt['themeadmin_browsing_theme'], $currentTheme['name']); |
| 1696 | 1763 | |
| 1697 | - if (!file_exists($currentTheme['theme_dir'] . '/index.template.php') && !file_exists($currentTheme['theme_dir'] . '/css/index.css')) |
|
| 1698 | - fatal_lang_error('theme_edit_missing', false); |
|
| 1764 | + if (!file_exists($currentTheme['theme_dir'] . '/index.template.php') && !file_exists($currentTheme['theme_dir'] . '/css/index.css')) { |
|
| 1765 | + fatal_lang_error('theme_edit_missing', false); |
|
| 1766 | + } |
|
| 1699 | 1767 | |
| 1700 | 1768 | if (!isset($_REQUEST['filename'])) |
| 1701 | 1769 | { |
| 1702 | 1770 | if (isset($_GET['directory'])) |
| 1703 | 1771 | { |
| 1704 | - if (substr($_GET['directory'], 0, 1) == '.') |
|
| 1705 | - $_GET['directory'] = ''; |
|
| 1706 | - else |
|
| 1772 | + if (substr($_GET['directory'], 0, 1) == '.') { |
|
| 1773 | + $_GET['directory'] = ''; |
|
| 1774 | + } else |
|
| 1707 | 1775 | { |
| 1708 | 1776 | $_GET['directory'] = preg_replace(array('~^[\./\\:\0\n\r]+~', '~[\\\\]~', '~/[\./]+~'), array('', '/', '/'), $_GET['directory']); |
| 1709 | 1777 | |
| 1710 | 1778 | $temp = realpath($currentTheme['theme_dir'] . '/' . $_GET['directory']); |
| 1711 | - if (empty($temp) || substr($temp, 0, strlen(realpath($currentTheme['theme_dir']))) != realpath($currentTheme['theme_dir'])) |
|
| 1712 | - $_GET['directory'] = ''; |
|
| 1779 | + if (empty($temp) || substr($temp, 0, strlen(realpath($currentTheme['theme_dir']))) != realpath($currentTheme['theme_dir'])) { |
|
| 1780 | + $_GET['directory'] = ''; |
|
| 1781 | + } |
|
| 1713 | 1782 | } |
| 1714 | 1783 | } |
| 1715 | 1784 | |
@@ -1728,37 +1797,39 @@ discard block |
||
| 1728 | 1797 | 'href' => $scripturl . '?action=admin;area=theme;th=' . $_GET['th'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=edit;directory=' . $temp, |
| 1729 | 1798 | 'size' => '', |
| 1730 | 1799 | )); |
| 1800 | + } else { |
|
| 1801 | + $context['theme_files'] = get_file_listing($currentTheme['theme_dir'], ''); |
|
| 1731 | 1802 | } |
| 1732 | - else |
|
| 1733 | - $context['theme_files'] = get_file_listing($currentTheme['theme_dir'], ''); |
|
| 1734 | 1803 | |
| 1735 | 1804 | $context['sub_template'] = 'edit_browse'; |
| 1736 | 1805 | |
| 1737 | 1806 | return; |
| 1738 | - } |
|
| 1739 | - else |
|
| 1807 | + } else |
|
| 1740 | 1808 | { |
| 1741 | - if (substr($_REQUEST['filename'], 0, 1) == '.') |
|
| 1742 | - $_REQUEST['filename'] = ''; |
|
| 1743 | - else |
|
| 1809 | + if (substr($_REQUEST['filename'], 0, 1) == '.') { |
|
| 1810 | + $_REQUEST['filename'] = ''; |
|
| 1811 | + } else |
|
| 1744 | 1812 | { |
| 1745 | 1813 | $_REQUEST['filename'] = preg_replace(array('~^[\./\\:\0\n\r]+~', '~[\\\\]~', '~/[\./]+~'), array('', '/', '/'), $_REQUEST['filename']); |
| 1746 | 1814 | |
| 1747 | 1815 | $temp = realpath($currentTheme['theme_dir'] . '/' . $_REQUEST['filename']); |
| 1748 | - if (empty($temp) || substr($temp, 0, strlen(realpath($currentTheme['theme_dir']))) != realpath($currentTheme['theme_dir'])) |
|
| 1749 | - $_REQUEST['filename'] = ''; |
|
| 1816 | + if (empty($temp) || substr($temp, 0, strlen(realpath($currentTheme['theme_dir']))) != realpath($currentTheme['theme_dir'])) { |
|
| 1817 | + $_REQUEST['filename'] = ''; |
|
| 1818 | + } |
|
| 1750 | 1819 | } |
| 1751 | 1820 | |
| 1752 | - if (empty($_REQUEST['filename'])) |
|
| 1753 | - fatal_lang_error('theme_edit_missing', false); |
|
| 1821 | + if (empty($_REQUEST['filename'])) { |
|
| 1822 | + fatal_lang_error('theme_edit_missing', false); |
|
| 1823 | + } |
|
| 1754 | 1824 | } |
| 1755 | 1825 | |
| 1756 | 1826 | if (isset($_POST['save'])) |
| 1757 | 1827 | { |
| 1758 | 1828 | if (checkSession('post', '', false) == '' && validateToken('admin-te-' . md5($_GET['th'] . '-' . $_REQUEST['filename']), 'post', false) == true) |
| 1759 | 1829 | { |
| 1760 | - if (is_array($_POST['entire_file'])) |
|
| 1761 | - $_POST['entire_file'] = implode("\n", $_POST['entire_file']); |
|
| 1830 | + if (is_array($_POST['entire_file'])) { |
|
| 1831 | + $_POST['entire_file'] = implode("\n", $_POST['entire_file']); |
|
| 1832 | + } |
|
| 1762 | 1833 | |
| 1763 | 1834 | $_POST['entire_file'] = rtrim(strtr($_POST['entire_file'], array("\r" => '', ' ' => "\t"))); |
| 1764 | 1835 | |
@@ -1770,10 +1841,11 @@ discard block |
||
| 1770 | 1841 | fclose($fp); |
| 1771 | 1842 | |
| 1772 | 1843 | $error = @file_get_contents($currentTheme['theme_url'] . '/tmp_' . session_id() . '.php'); |
| 1773 | - if (preg_match('~ <b>(\d+)</b><br( /)?' . '>$~i', $error) != 0) |
|
| 1774 | - $error_file = $currentTheme['theme_dir'] . '/tmp_' . session_id() . '.php'; |
|
| 1775 | - else |
|
| 1776 | - unlink($currentTheme['theme_dir'] . '/tmp_' . session_id() . '.php'); |
|
| 1844 | + if (preg_match('~ <b>(\d+)</b><br( /)?' . '>$~i', $error) != 0) { |
|
| 1845 | + $error_file = $currentTheme['theme_dir'] . '/tmp_' . session_id() . '.php'; |
|
| 1846 | + } else { |
|
| 1847 | + unlink($currentTheme['theme_dir'] . '/tmp_' . session_id() . '.php'); |
|
| 1848 | + } |
|
| 1777 | 1849 | } |
| 1778 | 1850 | |
| 1779 | 1851 | if (!isset($error_file)) |
@@ -1794,10 +1866,11 @@ discard block |
||
| 1794 | 1866 | $context['sub_template'] = 'edit_file'; |
| 1795 | 1867 | |
| 1796 | 1868 | // Recycle the submitted data. |
| 1797 | - if (is_array($_POST['entire_file'])) |
|
| 1798 | - $context['entire_file'] = $smcFunc['htmlspecialchars'](implode("\n", $_POST['entire_file'])); |
|
| 1799 | - else |
|
| 1800 | - $context['entire_file'] = $smcFunc['htmlspecialchars']($_POST['entire_file']); |
|
| 1869 | + if (is_array($_POST['entire_file'])) { |
|
| 1870 | + $context['entire_file'] = $smcFunc['htmlspecialchars'](implode("\n", $_POST['entire_file'])); |
|
| 1871 | + } else { |
|
| 1872 | + $context['entire_file'] = $smcFunc['htmlspecialchars']($_POST['entire_file']); |
|
| 1873 | + } |
|
| 1801 | 1874 | |
| 1802 | 1875 | $context['edit_filename'] = $smcFunc['htmlspecialchars']($_POST['filename']); |
| 1803 | 1876 | |
@@ -1820,17 +1893,17 @@ discard block |
||
| 1820 | 1893 | $context['sub_template'] = 'edit_style'; |
| 1821 | 1894 | |
| 1822 | 1895 | $context['entire_file'] = $smcFunc['htmlspecialchars'](strtr(file_get_contents($currentTheme['theme_dir'] . '/' . $_REQUEST['filename']), array("\t" => ' '))); |
| 1823 | - } |
|
| 1824 | - elseif (substr($_REQUEST['filename'], -13) == '.template.php') |
|
| 1896 | + } elseif (substr($_REQUEST['filename'], -13) == '.template.php') |
|
| 1825 | 1897 | { |
| 1826 | 1898 | $context['sub_template'] = 'edit_template'; |
| 1827 | 1899 | |
| 1828 | - if (!isset($error_file)) |
|
| 1829 | - $file_data = file($currentTheme['theme_dir'] . '/' . $_REQUEST['filename']); |
|
| 1830 | - else |
|
| 1900 | + if (!isset($error_file)) { |
|
| 1901 | + $file_data = file($currentTheme['theme_dir'] . '/' . $_REQUEST['filename']); |
|
| 1902 | + } else |
|
| 1831 | 1903 | { |
| 1832 | - if (preg_match('~(<b>.+?</b>:.+?<b>).+?(</b>.+?<b>\d+</b>)<br( /)?' . '>$~i', $error, $match) != 0) |
|
| 1833 | - $context['parse_error'] = $match[1] . $_REQUEST['filename'] . $match[2]; |
|
| 1904 | + if (preg_match('~(<b>.+?</b>:.+?<b>).+?(</b>.+?<b>\d+</b>)<br( /)?' . '>$~i', $error, $match) != 0) { |
|
| 1905 | + $context['parse_error'] = $match[1] . $_REQUEST['filename'] . $match[2]; |
|
| 1906 | + } |
|
| 1834 | 1907 | $file_data = file($error_file); |
| 1835 | 1908 | unlink($error_file); |
| 1836 | 1909 | } |
@@ -1844,8 +1917,9 @@ discard block |
||
| 1844 | 1917 | // Try to format the functions a little nicer... |
| 1845 | 1918 | $context['file_parts'][$j]['data'] = trim($context['file_parts'][$j]['data']) . "\n"; |
| 1846 | 1919 | |
| 1847 | - if (empty($context['file_parts'][$j]['lines'])) |
|
| 1848 | - unset($context['file_parts'][$j]); |
|
| 1920 | + if (empty($context['file_parts'][$j]['lines'])) { |
|
| 1921 | + unset($context['file_parts'][$j]); |
|
| 1922 | + } |
|
| 1849 | 1923 | $context['file_parts'][++$j] = array('lines' => 0, 'line' => $i + 1, 'data' => ''); |
| 1850 | 1924 | } |
| 1851 | 1925 | |
@@ -1854,8 +1928,7 @@ discard block |
||
| 1854 | 1928 | } |
| 1855 | 1929 | |
| 1856 | 1930 | $context['entire_file'] = $smcFunc['htmlspecialchars'](strtr(implode('', $file_data), array("\t" => ' '))); |
| 1857 | - } |
|
| 1858 | - else |
|
| 1931 | + } else |
|
| 1859 | 1932 | { |
| 1860 | 1933 | $context['sub_template'] = 'edit_file'; |
| 1861 | 1934 | |
@@ -1881,8 +1954,9 @@ discard block |
||
| 1881 | 1954 | |
| 1882 | 1955 | $_GET['th'] = isset($_GET['th']) ? (int) $_GET['th'] : (int) $_GET['id']; |
| 1883 | 1956 | |
| 1884 | - if (empty($_GET['th'])) |
|
| 1885 | - fatal_lang_error('theme_install_invalid_id'); |
|
| 1957 | + if (empty($_GET['th'])) { |
|
| 1958 | + fatal_lang_error('theme_install_invalid_id'); |
|
| 1959 | + } |
|
| 1886 | 1960 | |
| 1887 | 1961 | // Get the theme info. |
| 1888 | 1962 | $theme = get_single_theme($_GET['th']); |
@@ -1890,25 +1964,24 @@ discard block |
||
| 1890 | 1964 | |
| 1891 | 1965 | if (isset($_REQUEST['template']) && preg_match('~[\./\\\\:\0]~', $_REQUEST['template']) == 0) |
| 1892 | 1966 | { |
| 1893 | - if (file_exists($settings['default_theme_dir'] . '/' . $_REQUEST['template'] . '.template.php')) |
|
| 1894 | - $filename = $settings['default_theme_dir'] . '/' . $_REQUEST['template'] . '.template.php'; |
|
| 1895 | - |
|
| 1896 | - else |
|
| 1897 | - fatal_lang_error('no_access', false); |
|
| 1967 | + if (file_exists($settings['default_theme_dir'] . '/' . $_REQUEST['template'] . '.template.php')) { |
|
| 1968 | + $filename = $settings['default_theme_dir'] . '/' . $_REQUEST['template'] . '.template.php'; |
|
| 1969 | + } else { |
|
| 1970 | + fatal_lang_error('no_access', false); |
|
| 1971 | + } |
|
| 1898 | 1972 | |
| 1899 | 1973 | $fp = fopen($theme['theme_dir'] . '/' . $_REQUEST['template'] . '.template.php', 'w'); |
| 1900 | 1974 | fwrite($fp, file_get_contents($filename)); |
| 1901 | 1975 | fclose($fp); |
| 1902 | 1976 | |
| 1903 | 1977 | redirectexit('action=admin;area=theme;th=' . $context['theme_id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';sa=copy'); |
| 1904 | - } |
|
| 1905 | - elseif (isset($_REQUEST['lang_file']) && preg_match('~^[^\./\\\\:\0]\.[^\./\\\\:\0]$~', $_REQUEST['lang_file']) != 0) |
|
| 1978 | + } elseif (isset($_REQUEST['lang_file']) && preg_match('~^[^\./\\\\:\0]\.[^\./\\\\:\0]$~', $_REQUEST['lang_file']) != 0) |
|
| 1906 | 1979 | { |
| 1907 | - if (file_exists($settings['default_theme_dir'] . '/languages/' . $_REQUEST['template'] . '.php')) |
|
| 1908 | - $filename = $settings['default_theme_dir'] . '/languages/' . $_REQUEST['template'] . '.php'; |
|
| 1909 | - |
|
| 1910 | - else |
|
| 1911 | - fatal_lang_error('no_access', false); |
|
| 1980 | + if (file_exists($settings['default_theme_dir'] . '/languages/' . $_REQUEST['template'] . '.php')) { |
|
| 1981 | + $filename = $settings['default_theme_dir'] . '/languages/' . $_REQUEST['template'] . '.php'; |
|
| 1982 | + } else { |
|
| 1983 | + fatal_lang_error('no_access', false); |
|
| 1984 | + } |
|
| 1912 | 1985 | |
| 1913 | 1986 | $fp = fopen($theme['theme_dir'] . '/languages/' . $_REQUEST['lang_file'] . '.php', 'w'); |
| 1914 | 1987 | fwrite($fp, file_get_contents($filename)); |
@@ -1923,16 +1996,18 @@ discard block |
||
| 1923 | 1996 | $dir = dir($settings['default_theme_dir']); |
| 1924 | 1997 | while ($entry = $dir->read()) |
| 1925 | 1998 | { |
| 1926 | - if (substr($entry, -13) == '.template.php') |
|
| 1927 | - $templates[] = substr($entry, 0, -13); |
|
| 1999 | + if (substr($entry, -13) == '.template.php') { |
|
| 2000 | + $templates[] = substr($entry, 0, -13); |
|
| 2001 | + } |
|
| 1928 | 2002 | } |
| 1929 | 2003 | $dir->close(); |
| 1930 | 2004 | |
| 1931 | 2005 | $dir = dir($settings['default_theme_dir'] . '/languages'); |
| 1932 | 2006 | while ($entry = $dir->read()) |
| 1933 | 2007 | { |
| 1934 | - if (preg_match('~^([^\.]+\.[^\.]+)\.php$~', $entry, $matches)) |
|
| 1935 | - $lang_files[] = $matches[1]; |
|
| 2008 | + if (preg_match('~^([^\.]+\.[^\.]+)\.php$~', $entry, $matches)) { |
|
| 2009 | + $lang_files[] = $matches[1]; |
|
| 2010 | + } |
|
| 1936 | 2011 | } |
| 1937 | 2012 | $dir->close(); |
| 1938 | 2013 | |
@@ -1940,21 +2015,23 @@ discard block |
||
| 1940 | 2015 | natcasesort($lang_files); |
| 1941 | 2016 | |
| 1942 | 2017 | $context['available_templates'] = array(); |
| 1943 | - foreach ($templates as $template) |
|
| 1944 | - $context['available_templates'][$template] = array( |
|
| 2018 | + foreach ($templates as $template) { |
|
| 2019 | + $context['available_templates'][$template] = array( |
|
| 1945 | 2020 | 'filename' => $template . '.template.php', |
| 1946 | 2021 | 'value' => $template, |
| 1947 | 2022 | 'already_exists' => false, |
| 1948 | 2023 | 'can_copy' => is_writable($theme['theme_dir']), |
| 1949 | 2024 | ); |
| 2025 | + } |
|
| 1950 | 2026 | $context['available_language_files'] = array(); |
| 1951 | - foreach ($lang_files as $file) |
|
| 1952 | - $context['available_language_files'][$file] = array( |
|
| 2027 | + foreach ($lang_files as $file) { |
|
| 2028 | + $context['available_language_files'][$file] = array( |
|
| 1953 | 2029 | 'filename' => $file . '.php', |
| 1954 | 2030 | 'value' => $file, |
| 1955 | 2031 | 'already_exists' => false, |
| 1956 | 2032 | 'can_copy' => file_exists($theme['theme_dir'] . '/languages') ? is_writable($theme['theme_dir'] . '/languages') : is_writable($theme['theme_dir']), |
| 1957 | 2033 | ); |
| 2034 | + } |
|
| 1958 | 2035 | |
| 1959 | 2036 | $dir = dir($theme['theme_dir']); |
| 1960 | 2037 | while ($entry = $dir->read()) |
@@ -18,23 +18,25 @@ discard block |
||
| 18 | 18 | global $context; |
| 19 | 19 | |
| 20 | 20 | // Prevent Chrome from auto completing fields when viewing/editing other members profiles |
| 21 | - if (isBrowser('is_chrome') && !$context['user']['is_owner']) |
|
| 22 | - echo ' |
|
| 21 | + if (isBrowser('is_chrome') && !$context['user']['is_owner']) { |
|
| 22 | + echo ' |
|
| 23 | 23 | <script> |
| 24 | 24 | disableAutoComplete(); |
| 25 | 25 | </script>'; |
| 26 | + } |
|
| 26 | 27 | |
| 27 | 28 | // If an error occurred while trying to save previously, give the user a clue! |
| 28 | 29 | echo ' |
| 29 | 30 | ', template_error_message(); |
| 30 | 31 | |
| 31 | 32 | // If the profile was update successfully, let the user know this. |
| 32 | - if (!empty($context['profile_updated'])) |
|
| 33 | - echo ' |
|
| 33 | + if (!empty($context['profile_updated'])) { |
|
| 34 | + echo ' |
|
| 34 | 35 | <div class="infobox"> |
| 35 | 36 | ', $context['profile_updated'], ' |
| 36 | 37 | </div>'; |
| 37 | -} |
|
| 38 | + } |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | /** |
| 40 | 42 | * Template for any HTML needed below the profile (closing off divs/tables, etc.) |
@@ -102,8 +104,7 @@ discard block |
||
| 102 | 104 | if (empty($context['unread_alerts'])) |
| 103 | 105 | { |
| 104 | 106 | template_alerts_all_read(); |
| 105 | - } |
|
| 106 | - else |
|
| 107 | + } else |
|
| 107 | 108 | { |
| 108 | 109 | foreach ($context['unread_alerts'] as $id_alert => $details) |
| 109 | 110 | { |
@@ -164,10 +165,11 @@ discard block |
||
| 164 | 165 | <div class="custom_fields_above_name"> |
| 165 | 166 | <ul >'; |
| 166 | 167 | |
| 167 | - foreach ($context['print_custom_fields']['above_member'] as $field) |
|
| 168 | - if (!empty($field['output_html'])) |
|
| 168 | + foreach ($context['print_custom_fields']['above_member'] as $field) { |
|
| 169 | + if (!empty($field['output_html'])) |
|
| 169 | 170 | echo ' |
| 170 | 171 | <li>', $field['output_html'], '</li>'; |
| 172 | + } |
|
| 171 | 173 | |
| 172 | 174 | echo ' |
| 173 | 175 | </ul> |
@@ -188,10 +190,11 @@ discard block |
||
| 188 | 190 | <div class="custom_fields_below_avatar"> |
| 189 | 191 | <ul >'; |
| 190 | 192 | |
| 191 | - foreach ($context['print_custom_fields']['below_avatar'] as $field) |
|
| 192 | - if (!empty($field['output_html'])) |
|
| 193 | + foreach ($context['print_custom_fields']['below_avatar'] as $field) { |
|
| 194 | + if (!empty($field['output_html'])) |
|
| 193 | 195 | echo ' |
| 194 | 196 | <li>', $field['output_html'], '</li>'; |
| 197 | + } |
|
| 195 | 198 | |
| 196 | 199 | echo ' |
| 197 | 200 | </ul> |
@@ -202,22 +205,25 @@ discard block |
||
| 202 | 205 | echo ' |
| 203 | 206 | <ul class="clear">'; |
| 204 | 207 | // Email is only visible if it's your profile or you have the moderate_forum permission |
| 205 | - if ($context['member']['show_email']) |
|
| 206 | - echo ' |
|
| 208 | + if ($context['member']['show_email']) { |
|
| 209 | + echo ' |
|
| 207 | 210 | <li><a href="mailto:', $context['member']['email'], '" title="', $context['member']['email'], '" rel="nofollow"><span class="generic_icons mail" title="' . $txt['email'] . '"></span></a></li>'; |
| 211 | + } |
|
| 208 | 212 | |
| 209 | 213 | // Don't show an icon if they haven't specified a website. |
| 210 | - if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) |
|
| 211 | - echo ' |
|
| 214 | + if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website'])) { |
|
| 215 | + echo ' |
|
| 212 | 216 | <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<span class="generic_icons www" title="' . $context['member']['website']['title'] . '"></span>' : $txt['www']), '</a></li>'; |
| 217 | + } |
|
| 213 | 218 | |
| 214 | 219 | // Are there any custom profile fields as icons? |
| 215 | 220 | if (!empty($context['print_custom_fields']['icons'])) |
| 216 | 221 | { |
| 217 | - foreach ($context['print_custom_fields']['icons'] as $field) |
|
| 218 | - if (!empty($field['output_html'])) |
|
| 222 | + foreach ($context['print_custom_fields']['icons'] as $field) { |
|
| 223 | + if (!empty($field['output_html'])) |
|
| 219 | 224 | echo ' |
| 220 | 225 | <li class="custom_field">', $field['output_html'], '</li>'; |
| 226 | + } |
|
| 221 | 227 | } |
| 222 | 228 | |
| 223 | 229 | echo ' |
@@ -225,23 +231,26 @@ discard block |
||
| 225 | 231 | <span id="userstatus">', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['text'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<span class="' . ($context['member']['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $context['member']['online']['text'] . '"></span>' : $context['member']['online']['label'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['label'] . '</span>' : ''; |
| 226 | 232 | |
| 227 | 233 | // Can they add this member as a buddy? |
| 228 | - if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) |
|
| 229 | - echo ' |
|
| 234 | + if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) { |
|
| 235 | + echo ' |
|
| 230 | 236 | <br><a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>'; |
| 237 | + } |
|
| 231 | 238 | |
| 232 | 239 | echo ' |
| 233 | 240 | </span>'; |
| 234 | 241 | |
| 235 | - if (!$context['user']['is_owner'] && $context['can_send_pm']) |
|
| 236 | - echo ' |
|
| 242 | + if (!$context['user']['is_owner'] && $context['can_send_pm']) { |
|
| 243 | + echo ' |
|
| 237 | 244 | <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '" class="infolinks">', $txt['profile_sendpm_short'], '</a>'; |
| 245 | + } |
|
| 238 | 246 | |
| 239 | 247 | echo ' |
| 240 | 248 | <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '" class="infolinks">', $txt['showPosts'], '</a>'; |
| 241 | 249 | |
| 242 | - if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) |
|
| 243 | - echo ' |
|
| 250 | + if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) { |
|
| 251 | + echo ' |
|
| 244 | 252 | <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '" class="infolinks">', $txt['drafts_show'], '</a>'; |
| 253 | + } |
|
| 245 | 254 | |
| 246 | 255 | echo ' |
| 247 | 256 | <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '" class="infolinks">', $txt['statPanel'], '</a>'; |
@@ -253,10 +262,11 @@ discard block |
||
| 253 | 262 | <div class="custom_fields_bottom"> |
| 254 | 263 | <ul class="nolist">'; |
| 255 | 264 | |
| 256 | - foreach ($context['print_custom_fields']['bottom_poster'] as $field) |
|
| 257 | - if (!empty($field['output_html'])) |
|
| 265 | + foreach ($context['print_custom_fields']['bottom_poster'] as $field) { |
|
| 266 | + if (!empty($field['output_html'])) |
|
| 258 | 267 | echo ' |
| 259 | 268 | <li>', $field['output_html'], '</li>'; |
| 269 | + } |
|
| 260 | 270 | |
| 261 | 271 | echo ' |
| 262 | 272 | </ul> |
@@ -270,15 +280,17 @@ discard block |
||
| 270 | 280 | <div id="detailedinfo"> |
| 271 | 281 | <dl class="settings">'; |
| 272 | 282 | |
| 273 | - if ($context['user']['is_owner'] || $context['user']['is_admin']) |
|
| 274 | - echo ' |
|
| 283 | + if ($context['user']['is_owner'] || $context['user']['is_admin']) { |
|
| 284 | + echo ' |
|
| 275 | 285 | <dt>', $txt['username'], ': </dt> |
| 276 | 286 | <dd>', $context['member']['username'], '</dd>'; |
| 287 | + } |
|
| 277 | 288 | |
| 278 | - if (!isset($context['disabled_fields']['posts'])) |
|
| 279 | - echo ' |
|
| 289 | + if (!isset($context['disabled_fields']['posts'])) { |
|
| 290 | + echo ' |
|
| 280 | 291 | <dt>', $txt['profile_posts'], ': </dt> |
| 281 | 292 | <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>'; |
| 293 | + } |
|
| 282 | 294 | |
| 283 | 295 | if ($context['member']['show_email']) |
| 284 | 296 | { |
@@ -287,15 +299,17 @@ discard block |
||
| 287 | 299 | <dd><a href="mailto:', $context['member']['email'], '">', $context['member']['email'], '</a></dd>'; |
| 288 | 300 | } |
| 289 | 301 | |
| 290 | - if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) |
|
| 291 | - echo ' |
|
| 302 | + if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) { |
|
| 303 | + echo ' |
|
| 292 | 304 | <dt>', $txt['custom_title'], ': </dt> |
| 293 | 305 | <dd>', $context['member']['title'], '</dd>'; |
| 306 | + } |
|
| 294 | 307 | |
| 295 | - if (!empty($context['member']['blurb'])) |
|
| 296 | - echo ' |
|
| 308 | + if (!empty($context['member']['blurb'])) { |
|
| 309 | + echo ' |
|
| 297 | 310 | <dt>', $txt['personal_text'], ': </dt> |
| 298 | 311 | <dd>', $context['member']['blurb'], '</dd>'; |
| 312 | + } |
|
| 299 | 313 | |
| 300 | 314 | echo ' |
| 301 | 315 | <dt>', $txt['age'], ':</dt> |
@@ -310,11 +324,12 @@ discard block |
||
| 310 | 324 | echo ' |
| 311 | 325 | <dl class="settings">'; |
| 312 | 326 | |
| 313 | - foreach ($context['print_custom_fields']['standard'] as $field) |
|
| 314 | - if (!empty($field['output_html'])) |
|
| 327 | + foreach ($context['print_custom_fields']['standard'] as $field) { |
|
| 328 | + if (!empty($field['output_html'])) |
|
| 315 | 329 | echo ' |
| 316 | 330 | <dt>', $field['name'], ':</dt> |
| 317 | 331 | <dd>', $field['output_html'], '</dd>'; |
| 332 | + } |
|
| 318 | 333 | |
| 319 | 334 | echo ' |
| 320 | 335 | </dl>'; |
@@ -332,9 +347,10 @@ discard block |
||
| 332 | 347 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', ($context['can_issue_warning'] && !$context['user']['is_owner'] ? 'issuewarning' : 'viewwarning'), '">', $context['member']['warning'], '%</a>'; |
| 333 | 348 | |
| 334 | 349 | // Can we provide information on what this means? |
| 335 | - if (!empty($context['warning_status'])) |
|
| 336 | - echo ' |
|
| 350 | + if (!empty($context['warning_status'])) { |
|
| 351 | + echo ' |
|
| 337 | 352 | <span class="smalltext">(', $context['warning_status'], ')</span>'; |
| 353 | + } |
|
| 338 | 354 | |
| 339 | 355 | echo ' |
| 340 | 356 | </dd>'; |
@@ -345,9 +361,10 @@ discard block |
||
| 345 | 361 | { |
| 346 | 362 | |
| 347 | 363 | // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. |
| 348 | - if (!empty($context['activate_message'])) |
|
| 349 | - echo ' |
|
| 364 | + if (!empty($context['activate_message'])) { |
|
| 365 | + echo ' |
|
| 350 | 366 | <dt class="clear"><span class="alert">', $context['activate_message'], '</span> (<a href="', $context['activate_link'], '"', ($context['activate_type'] == 4 ? ' class="you_sure" data-confirm="' . $txt['profileConfirm'] . '"' : ''), '>', $context['activate_link_text'], '</a>)</dt>'; |
| 367 | + } |
|
| 351 | 368 | |
| 352 | 369 | // If the current member is banned, show a message and possibly a link to the ban. |
| 353 | 370 | if (!empty($context['member']['bans'])) |
@@ -357,9 +374,10 @@ discard block |
||
| 357 | 374 | <dt class="clear" id="ban_info" style="display: none;"> |
| 358 | 375 | <strong>', $txt['user_banned_by_following'], ':</strong>'; |
| 359 | 376 | |
| 360 | - foreach ($context['member']['bans'] as $ban) |
|
| 361 | - echo ' |
|
| 377 | + foreach ($context['member']['bans'] as $ban) { |
|
| 378 | + echo ' |
|
| 362 | 379 | <br><span class="smalltext">', $ban['explanation'], '</span>'; |
| 380 | + } |
|
| 363 | 381 | |
| 364 | 382 | echo ' |
| 365 | 383 | </dt>'; |
@@ -373,30 +391,34 @@ discard block |
||
| 373 | 391 | // If the person looking is allowed, they can check the members IP address and hostname. |
| 374 | 392 | if ($context['can_see_ip']) |
| 375 | 393 | { |
| 376 | - if (!empty($context['member']['ip'])) |
|
| 377 | - echo ' |
|
| 394 | + if (!empty($context['member']['ip'])) { |
|
| 395 | + echo ' |
|
| 378 | 396 | <dt>', $txt['ip'], ': </dt> |
| 379 | 397 | <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>'; |
| 398 | + } |
|
| 380 | 399 | |
| 381 | - if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) |
|
| 382 | - echo ' |
|
| 400 | + if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) { |
|
| 401 | + echo ' |
|
| 383 | 402 | <dt>', $txt['hostname'], ': </dt> |
| 384 | 403 | <dd>', $context['member']['hostname'], '</dd>'; |
| 404 | + } |
|
| 385 | 405 | } |
| 386 | 406 | |
| 387 | 407 | echo ' |
| 388 | 408 | <dt>', $txt['local_time'], ':</dt> |
| 389 | 409 | <dd>', $context['member']['local_time'], '</dd>'; |
| 390 | 410 | |
| 391 | - if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) |
|
| 392 | - echo ' |
|
| 411 | + if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) { |
|
| 412 | + echo ' |
|
| 393 | 413 | <dt>', $txt['language'], ':</dt> |
| 394 | 414 | <dd>', $context['member']['language'], '</dd>'; |
| 415 | + } |
|
| 395 | 416 | |
| 396 | - if ($context['member']['show_last_login']) |
|
| 397 | - echo ' |
|
| 417 | + if ($context['member']['show_last_login']) { |
|
| 418 | + echo ' |
|
| 398 | 419 | <dt>', $txt['lastLoggedIn'], ': </dt> |
| 399 | 420 | <dd>', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '</dd>'; |
| 421 | + } |
|
| 400 | 422 | |
| 401 | 423 | echo ' |
| 402 | 424 | </dl>'; |
@@ -408,10 +430,11 @@ discard block |
||
| 408 | 430 | <div class="custom_fields_above_signature"> |
| 409 | 431 | <ul class="nolist">'; |
| 410 | 432 | |
| 411 | - foreach ($context['print_custom_fields']['above_signature'] as $field) |
|
| 412 | - if (!empty($field['output_html'])) |
|
| 433 | + foreach ($context['print_custom_fields']['above_signature'] as $field) { |
|
| 434 | + if (!empty($field['output_html'])) |
|
| 413 | 435 | echo ' |
| 414 | 436 | <li>', $field['output_html'], '</li>'; |
| 437 | + } |
|
| 415 | 438 | |
| 416 | 439 | echo ' |
| 417 | 440 | </ul> |
@@ -419,12 +442,13 @@ discard block |
||
| 419 | 442 | } |
| 420 | 443 | |
| 421 | 444 | // Show the users signature. |
| 422 | - if ($context['signature_enabled'] && !empty($context['member']['signature'])) |
|
| 423 | - echo ' |
|
| 445 | + if ($context['signature_enabled'] && !empty($context['member']['signature'])) { |
|
| 446 | + echo ' |
|
| 424 | 447 | <div class="signature"> |
| 425 | 448 | <h5>', $txt['signature'], ':</h5> |
| 426 | 449 | ', $context['member']['signature'], ' |
| 427 | 450 | </div>'; |
| 451 | + } |
|
| 428 | 452 | |
| 429 | 453 | // Are there any custom profile fields for below the signature? |
| 430 | 454 | if (!empty($context['print_custom_fields']['below_signature'])) |
@@ -433,10 +457,11 @@ discard block |
||
| 433 | 457 | <div class="custom_fields_below_signature"> |
| 434 | 458 | <ul class="nolist">'; |
| 435 | 459 | |
| 436 | - foreach ($context['print_custom_fields']['below_signature'] as $field) |
|
| 437 | - if (!empty($field['output_html'])) |
|
| 460 | + foreach ($context['print_custom_fields']['below_signature'] as $field) { |
|
| 461 | + if (!empty($field['output_html'])) |
|
| 438 | 462 | echo ' |
| 439 | 463 | <li>', $field['output_html'], '</li>'; |
| 464 | + } |
|
| 440 | 465 | |
| 441 | 466 | echo ' |
| 442 | 467 | </ul> |
@@ -481,62 +506,70 @@ discard block |
||
| 481 | 506 | </div> |
| 482 | 507 | <div class="list_posts">'; |
| 483 | 508 | |
| 484 | - if (!$post['approved']) |
|
| 485 | - echo ' |
|
| 509 | + if (!$post['approved']) { |
|
| 510 | + echo ' |
|
| 486 | 511 | <div class="approve_post"> |
| 487 | 512 | <em>', $txt['post_awaiting_approval'], '</em> |
| 488 | 513 | </div>'; |
| 514 | + } |
|
| 489 | 515 | |
| 490 | 516 | echo ' |
| 491 | 517 | ', $post['body'], ' |
| 492 | 518 | </div>'; |
| 493 | 519 | |
| 494 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 495 | - echo ' |
|
| 520 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 521 | + echo ' |
|
| 496 | 522 | <div class="floatright"> |
| 497 | 523 | <ul class="quickbuttons">'; |
| 524 | + } |
|
| 498 | 525 | |
| 499 | 526 | // If they *can* reply? |
| 500 | - if ($post['can_reply']) |
|
| 501 | - echo ' |
|
| 527 | + if ($post['can_reply']) { |
|
| 528 | + echo ' |
|
| 502 | 529 | <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span class="generic_icons reply_button"></span>', $txt['reply'], '</a></li>'; |
| 530 | + } |
|
| 503 | 531 | |
| 504 | 532 | // If they *can* quote? |
| 505 | - if ($post['can_quote']) |
|
| 506 | - echo ' |
|
| 533 | + if ($post['can_quote']) { |
|
| 534 | + echo ' |
|
| 507 | 535 | <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span class="generic_icons quote"></span>', $txt['quote_action'], '</a></li>'; |
| 536 | + } |
|
| 508 | 537 | |
| 509 | 538 | // How about... even... remove it entirely?! |
| 510 | - if ($post['can_delete']) |
|
| 511 | - echo ' |
|
| 539 | + if ($post['can_delete']) { |
|
| 540 | + echo ' |
|
| 512 | 541 | <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" data-confirm="', $txt['remove_message'], '" class="you_sure"><span class="generic_icons remove_button"></span>', $txt['remove'], '</a></li>'; |
| 542 | + } |
|
| 513 | 543 | |
| 514 | - if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) |
|
| 515 | - echo ' |
|
| 544 | + if ($post['can_reply'] || $post['can_quote'] || $post['can_delete']) { |
|
| 545 | + echo ' |
|
| 516 | 546 | </ul> |
| 517 | 547 | </div>'; |
| 548 | + } |
|
| 518 | 549 | |
| 519 | 550 | echo ' |
| 520 | 551 | </div>'; |
| 521 | 552 | } |
| 553 | + } else { |
|
| 554 | + template_show_list('attachments'); |
|
| 522 | 555 | } |
| 523 | - else |
|
| 524 | - template_show_list('attachments'); |
|
| 525 | 556 | |
| 526 | 557 | // No posts? Just end with a informative message. |
| 527 | - if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) |
|
| 528 | - echo ' |
|
| 558 | + if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) { |
|
| 559 | + echo ' |
|
| 529 | 560 | <div class="windowbg2"> |
| 530 | 561 | ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), ' |
| 531 | 562 | </div>'; |
| 563 | + } |
|
| 532 | 564 | |
| 533 | 565 | // Show more page numbers. |
| 534 | - if (!empty($context['page_index'])) |
|
| 535 | - echo ' |
|
| 566 | + if (!empty($context['page_index'])) { |
|
| 567 | + echo ' |
|
| 536 | 568 | <div class="pagesection"> |
| 537 | 569 | <div class="pagelinks">', $context['page_index'], '</div> |
| 538 | 570 | </div>'; |
| 539 | -} |
|
| 571 | + } |
|
| 572 | + } |
|
| 540 | 573 | |
| 541 | 574 | /** |
| 542 | 575 | * Template for showing alerts within the alerts popup |
@@ -546,11 +579,12 @@ discard block |
||
| 546 | 579 | global $context, $txt, $scripturl; |
| 547 | 580 | |
| 548 | 581 | // Do we have an update message? |
| 549 | - if (!empty($context['update_message'])) |
|
| 550 | - echo ' |
|
| 582 | + if (!empty($context['update_message'])) { |
|
| 583 | + echo ' |
|
| 551 | 584 | <div class="infobox"> |
| 552 | 585 | ', $context['update_message'], '. |
| 553 | 586 | </div>'; |
| 587 | + } |
|
| 554 | 588 | |
| 555 | 589 | echo ' |
| 556 | 590 | <div class="cat_bar"> |
@@ -559,13 +593,12 @@ discard block |
||
| 559 | 593 | </h3> |
| 560 | 594 | </div>'; |
| 561 | 595 | |
| 562 | - if (empty($context['alerts'])) |
|
| 563 | - echo ' |
|
| 596 | + if (empty($context['alerts'])) { |
|
| 597 | + echo ' |
|
| 564 | 598 | <div class="information"> |
| 565 | 599 | ', $txt['alerts_none'], ' |
| 566 | 600 | </div>'; |
| 567 | - |
|
| 568 | - else |
|
| 601 | + } else |
|
| 569 | 602 | { |
| 570 | 603 | // Start the form. |
| 571 | 604 | echo ' |
@@ -627,12 +660,12 @@ discard block |
||
| 627 | 660 | </div>' : ''; |
| 628 | 661 | |
| 629 | 662 | // No drafts? Just show an informative message. |
| 630 | - if (empty($context['drafts'])) |
|
| 631 | - echo ' |
|
| 663 | + if (empty($context['drafts'])) { |
|
| 664 | + echo ' |
|
| 632 | 665 | <div class="windowbg2 centertext"> |
| 633 | 666 | ', $txt['draft_none'], ' |
| 634 | 667 | </div>'; |
| 635 | - else |
|
| 668 | + } else |
|
| 636 | 669 | { |
| 637 | 670 | // For every draft to be displayed, give it its own div, and show the important details of the draft. |
| 638 | 671 | foreach ($context['drafts'] as $draft) |
@@ -643,11 +676,13 @@ discard block |
||
| 643 | 676 | <div class="topic_details"> |
| 644 | 677 | <h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong> '; |
| 645 | 678 | |
| 646 | - if (!empty($draft['sticky'])) |
|
| 647 | - echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
|
| 679 | + if (!empty($draft['sticky'])) { |
|
| 680 | + echo '<span class="generic_icons sticky" title="', $txt['sticky_topic'], '"></span>'; |
|
| 681 | + } |
|
| 648 | 682 | |
| 649 | - if (!empty($draft['locked'])) |
|
| 650 | - echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
|
| 683 | + if (!empty($draft['locked'])) { |
|
| 684 | + echo '<span class="generic_icons lock" title="', $txt['locked_topic'], '"></span>'; |
|
| 685 | + } |
|
| 651 | 686 | |
| 652 | 687 | echo ' |
| 653 | 688 | </h5> |
@@ -680,12 +715,13 @@ discard block |
||
| 680 | 715 | { |
| 681 | 716 | global $context, $scripturl, $txt; |
| 682 | 717 | |
| 683 | - if (!empty($context['saved_successful'])) |
|
| 684 | - echo ' |
|
| 718 | + if (!empty($context['saved_successful'])) { |
|
| 719 | + echo ' |
|
| 685 | 720 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 686 | - elseif (!empty($context['saved_failed'])) |
|
| 687 | - echo ' |
|
| 721 | + } elseif (!empty($context['saved_failed'])) { |
|
| 722 | + echo ' |
|
| 688 | 723 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 724 | + } |
|
| 689 | 725 | |
| 690 | 726 | echo ' |
| 691 | 727 | <div id="edit_buddies"> |
@@ -699,24 +735,27 @@ discard block |
||
| 699 | 735 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
| 700 | 736 | <th scope="col">', $txt['status'], '</th>'; |
| 701 | 737 | |
| 702 | - if (allowedTo('moderate_forum')) |
|
| 703 | - echo ' |
|
| 738 | + if (allowedTo('moderate_forum')) { |
|
| 739 | + echo ' |
|
| 704 | 740 | <th scope="col">', $txt['email'], '</th>'; |
| 741 | + } |
|
| 705 | 742 | |
| 706 | - if (!empty($context['custom_pf'])) |
|
| 707 | - foreach ($context['custom_pf'] as $column) |
|
| 743 | + if (!empty($context['custom_pf'])) { |
|
| 744 | + foreach ($context['custom_pf'] as $column) |
|
| 708 | 745 | echo '<th scope="col">', $column['label'], '</th>'; |
| 746 | + } |
|
| 709 | 747 | |
| 710 | 748 | echo ' |
| 711 | 749 | <th scope="col">', $txt['remove'], '</th> |
| 712 | 750 | </tr>'; |
| 713 | 751 | |
| 714 | 752 | // If they don't have any buddies don't list them! |
| 715 | - if (empty($context['buddies'])) |
|
| 716 | - echo ' |
|
| 753 | + if (empty($context['buddies'])) { |
|
| 754 | + echo ' |
|
| 717 | 755 | <tr class="windowbg"> |
| 718 | 756 | <td colspan="', allowedTo('moderate_forum') ? '10' : '9', '"><strong>', $txt['no_buddies'], '</strong></td> |
| 719 | 757 | </tr>'; |
| 758 | + } |
|
| 720 | 759 | |
| 721 | 760 | // Now loop through each buddy showing info on each. |
| 722 | 761 | else |
@@ -728,15 +767,17 @@ discard block |
||
| 728 | 767 | <td>', $buddy['link'], '</td> |
| 729 | 768 | <td><a href="', $buddy['online']['href'], '"><span class="' . ($buddy['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $buddy['online']['text'] . '"></span></a></td>'; |
| 730 | 769 | |
| 731 | - if ($buddy['show_email']) |
|
| 732 | - echo ' |
|
| 770 | + if ($buddy['show_email']) { |
|
| 771 | + echo ' |
|
| 733 | 772 | <td><a href="mailto:' . $buddy['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $buddy['name'] . '"></span></a></td>'; |
| 773 | + } |
|
| 734 | 774 | |
| 735 | 775 | // Show the custom profile fields for this user. |
| 736 | - if (!empty($context['custom_pf'])) |
|
| 737 | - foreach ($context['custom_pf'] as $key => $column) |
|
| 776 | + if (!empty($context['custom_pf'])) { |
|
| 777 | + foreach ($context['custom_pf'] as $key => $column) |
|
| 738 | 778 | echo ' |
| 739 | 779 | <td class="lefttext">', $buddy['options'][$key], '</td>'; |
| 780 | + } |
|
| 740 | 781 | |
| 741 | 782 | echo ' |
| 742 | 783 | <td><a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['buddy_remove'], '"></span></a></td> |
@@ -766,9 +807,10 @@ discard block |
||
| 766 | 807 | </dl> |
| 767 | 808 | </div>'; |
| 768 | 809 | |
| 769 | - if (!empty($context['token_check'])) |
|
| 770 | - echo ' |
|
| 810 | + if (!empty($context['token_check'])) { |
|
| 811 | + echo ' |
|
| 771 | 812 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 813 | + } |
|
| 772 | 814 | |
| 773 | 815 | echo ' |
| 774 | 816 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -794,12 +836,13 @@ discard block |
||
| 794 | 836 | { |
| 795 | 837 | global $context, $scripturl, $txt; |
| 796 | 838 | |
| 797 | - if (!empty($context['saved_successful'])) |
|
| 798 | - echo ' |
|
| 839 | + if (!empty($context['saved_successful'])) { |
|
| 840 | + echo ' |
|
| 799 | 841 | <div class="infobox">', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '</div>'; |
| 800 | - elseif (!empty($context['saved_failed'])) |
|
| 801 | - echo ' |
|
| 842 | + } elseif (!empty($context['saved_failed'])) { |
|
| 843 | + echo ' |
|
| 802 | 844 | <div class="errorbox">', $context['saved_failed'], '</div>'; |
| 845 | + } |
|
| 803 | 846 | |
| 804 | 847 | echo ' |
| 805 | 848 | <div id="edit_buddies"> |
@@ -813,20 +856,22 @@ discard block |
||
| 813 | 856 | <th scope="col" class="quarter_table">', $txt['name'], '</th> |
| 814 | 857 | <th scope="col">', $txt['status'], '</th>'; |
| 815 | 858 | |
| 816 | - if (allowedTo('moderate_forum')) |
|
| 817 | - echo ' |
|
| 859 | + if (allowedTo('moderate_forum')) { |
|
| 860 | + echo ' |
|
| 818 | 861 | <th scope="col">', $txt['email'], '</th>'; |
| 862 | + } |
|
| 819 | 863 | |
| 820 | 864 | echo ' |
| 821 | 865 | <th scope="col">', $txt['ignore_remove'], '</th> |
| 822 | 866 | </tr>'; |
| 823 | 867 | |
| 824 | 868 | // If they don't have anyone on their ignore list, don't list it! |
| 825 | - if (empty($context['ignore_list'])) |
|
| 826 | - echo ' |
|
| 869 | + if (empty($context['ignore_list'])) { |
|
| 870 | + echo ' |
|
| 827 | 871 | <tr class="windowbg"> |
| 828 | 872 | <td colspan="', allowedTo('moderate_forum') ? '4' : '3', '"><strong>', $txt['no_ignore'], '</strong></td> |
| 829 | 873 | </tr>'; |
| 874 | + } |
|
| 830 | 875 | |
| 831 | 876 | // Now loop through each buddy showing info on each. |
| 832 | 877 | foreach ($context['ignore_list'] as $member) |
@@ -836,9 +881,10 @@ discard block |
||
| 836 | 881 | <td>', $member['link'], '</td> |
| 837 | 882 | <td><a href="', $member['online']['href'], '"><span class="' . ($member['online']['is_online'] == 1 ? 'on' : 'off') . '" title="' . $member['online']['text'] . '"></span></a></td>'; |
| 838 | 883 | |
| 839 | - if ($member['show_email']) |
|
| 840 | - echo ' |
|
| 884 | + if ($member['show_email']) { |
|
| 885 | + echo ' |
|
| 841 | 886 | <td><a href="mailto:' . $member['email'] . '" rel="nofollow"><span class="generic_icons mail icon" title="' . $txt['email'] . ' ' . $member['name'] . '"></span></a></td>'; |
| 887 | + } |
|
| 842 | 888 | echo ' |
| 843 | 889 | <td><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="generic_icons delete" title="', $txt['ignore_remove'], '"></span></a></td> |
| 844 | 890 | </tr>'; |
@@ -865,9 +911,10 @@ discard block |
||
| 865 | 911 | </dl> |
| 866 | 912 | </div>'; |
| 867 | 913 | |
| 868 | - if (!empty($context['token_check'])) |
|
| 869 | - echo ' |
|
| 914 | + if (!empty($context['token_check'])) { |
|
| 915 | + echo ' |
|
| 870 | 916 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 917 | + } |
|
| 871 | 918 | |
| 872 | 919 | echo ' |
| 873 | 920 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -912,9 +959,10 @@ discard block |
||
| 912 | 959 | <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>'; |
| 913 | 960 | |
| 914 | 961 | // Second address detected? |
| 915 | - if (!empty($context['last_ip2'])) |
|
| 916 | - echo ' |
|
| 962 | + if (!empty($context['last_ip2'])) { |
|
| 963 | + echo ' |
|
| 917 | 964 | , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>'; |
| 965 | + } |
|
| 918 | 966 | |
| 919 | 967 | echo ' |
| 920 | 968 | </dd>'; |
@@ -979,9 +1027,10 @@ discard block |
||
| 979 | 1027 | <h3 class="catbg">', $txt['whois_title'], ' ', $context['ip'], '</h3> |
| 980 | 1028 | </div> |
| 981 | 1029 | <div class="windowbg2 noup">'; |
| 982 | - foreach ($context['whois_servers'] as $server) |
|
| 983 | - echo ' |
|
| 1030 | + foreach ($context['whois_servers'] as $server) { |
|
| 1031 | + echo ' |
|
| 984 | 1032 | <a href="', $server['url'], '" target="_blank" class="new_win"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br>'; |
| 1033 | + } |
|
| 985 | 1034 | echo ' |
| 986 | 1035 | </div> |
| 987 | 1036 | <br>'; |
@@ -992,10 +1041,10 @@ discard block |
||
| 992 | 1041 | <div class="cat_bar"> |
| 993 | 1042 | <h3 class="catbg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3> |
| 994 | 1043 | </div>'; |
| 995 | - if (empty($context['ips'])) |
|
| 996 | - echo ' |
|
| 1044 | + if (empty($context['ips'])) { |
|
| 1045 | + echo ' |
|
| 997 | 1046 | <p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>'; |
| 998 | - else |
|
| 1047 | + } else |
|
| 999 | 1048 | { |
| 1000 | 1049 | echo ' |
| 1001 | 1050 | <table class="table_grid"> |
@@ -1008,12 +1057,13 @@ discard block |
||
| 1008 | 1057 | <tbody>'; |
| 1009 | 1058 | |
| 1010 | 1059 | // Loop through each of the members and display them. |
| 1011 | - foreach ($context['ips'] as $ip => $memberlist) |
|
| 1012 | - echo ' |
|
| 1060 | + foreach ($context['ips'] as $ip => $memberlist) { |
|
| 1061 | + echo ' |
|
| 1013 | 1062 | <tr class="windowbg"> |
| 1014 | 1063 | <td><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td> |
| 1015 | 1064 | <td>', implode(', ', $memberlist), '</td> |
| 1016 | 1065 | </tr>'; |
| 1066 | + } |
|
| 1017 | 1067 | |
| 1018 | 1068 | echo ' |
| 1019 | 1069 | </tbody> |
@@ -1059,8 +1109,7 @@ discard block |
||
| 1059 | 1109 | { |
| 1060 | 1110 | echo ' |
| 1061 | 1111 | <div class="information">', $txt['showPermissions_all'], '</div>'; |
| 1062 | - } |
|
| 1063 | - else |
|
| 1112 | + } else |
|
| 1064 | 1113 | { |
| 1065 | 1114 | echo ' |
| 1066 | 1115 | <div class="information">',$txt['showPermissions_help'], '</div> |
@@ -1074,9 +1123,10 @@ discard block |
||
| 1074 | 1123 | </div> |
| 1075 | 1124 | <div class="windowbg smalltext"> |
| 1076 | 1125 | ', $txt['showPermissions_restricted_boards_desc'], ':<br>'; |
| 1077 | - foreach ($context['no_access_boards'] as $no_access_board) |
|
| 1078 | - echo ' |
|
| 1126 | + foreach ($context['no_access_boards'] as $no_access_board) { |
|
| 1127 | + echo ' |
|
| 1079 | 1128 | <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', '; |
| 1129 | + } |
|
| 1080 | 1130 | echo ' |
| 1081 | 1131 | </div>'; |
| 1082 | 1132 | } |
@@ -1108,12 +1158,13 @@ discard block |
||
| 1108 | 1158 | </td> |
| 1109 | 1159 | <td class="smalltext">'; |
| 1110 | 1160 | |
| 1111 | - if ($permission['is_denied']) |
|
| 1112 | - echo ' |
|
| 1161 | + if ($permission['is_denied']) { |
|
| 1162 | + echo ' |
|
| 1113 | 1163 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1114 | - else |
|
| 1115 | - echo ' |
|
| 1164 | + } else { |
|
| 1165 | + echo ' |
|
| 1116 | 1166 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
| 1167 | + } |
|
| 1117 | 1168 | |
| 1118 | 1169 | echo ' |
| 1119 | 1170 | </td> |
@@ -1123,10 +1174,10 @@ discard block |
||
| 1123 | 1174 | </tbody> |
| 1124 | 1175 | </table> |
| 1125 | 1176 | </div><br>'; |
| 1126 | - } |
|
| 1127 | - else |
|
| 1128 | - echo ' |
|
| 1177 | + } else { |
|
| 1178 | + echo ' |
|
| 1129 | 1179 | <p class="windowbg2">', $txt['showPermissions_none_general'], '</p>'; |
| 1180 | + } |
|
| 1130 | 1181 | |
| 1131 | 1182 | // Board permission section. |
| 1132 | 1183 | echo ' |
@@ -1136,14 +1187,16 @@ discard block |
||
| 1136 | 1187 | <a id="board_permissions"></a>', $txt['showPermissions_select'], ': |
| 1137 | 1188 | <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();"> |
| 1138 | 1189 | <option value="0"', $context['board'] == 0 ? ' selected' : '', '>', $txt['showPermissions_global'], ' </option>'; |
| 1139 | - if (!empty($context['boards'])) |
|
| 1140 | - echo ' |
|
| 1190 | + if (!empty($context['boards'])) { |
|
| 1191 | + echo ' |
|
| 1141 | 1192 | <option value="" disabled>---------------------------</option>'; |
| 1193 | + } |
|
| 1142 | 1194 | |
| 1143 | 1195 | // Fill the box with any local permission boards. |
| 1144 | - foreach ($context['boards'] as $board) |
|
| 1145 | - echo ' |
|
| 1196 | + foreach ($context['boards'] as $board) { |
|
| 1197 | + echo ' |
|
| 1146 | 1198 | <option value="', $board['id'], '"', $board['selected'] ? ' selected' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>'; |
| 1199 | + } |
|
| 1147 | 1200 | |
| 1148 | 1201 | echo ' |
| 1149 | 1202 | </select> |
@@ -1174,8 +1227,7 @@ discard block |
||
| 1174 | 1227 | { |
| 1175 | 1228 | echo ' |
| 1176 | 1229 | <span class="alert">', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), '</span>'; |
| 1177 | - } |
|
| 1178 | - else |
|
| 1230 | + } else |
|
| 1179 | 1231 | { |
| 1180 | 1232 | echo ' |
| 1181 | 1233 | ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); |
@@ -1187,10 +1239,10 @@ discard block |
||
| 1187 | 1239 | echo ' |
| 1188 | 1240 | </tbody> |
| 1189 | 1241 | </table>'; |
| 1190 | - } |
|
| 1191 | - else |
|
| 1192 | - echo ' |
|
| 1242 | + } else { |
|
| 1243 | + echo ' |
|
| 1193 | 1244 | <p class="windowbg2">', $txt['showPermissions_none_board'], '</p>'; |
| 1245 | + } |
|
| 1194 | 1246 | echo ' |
| 1195 | 1247 | </div> |
| 1196 | 1248 | </div>'; |
@@ -1232,9 +1284,10 @@ discard block |
||
| 1232 | 1284 | </div>'; |
| 1233 | 1285 | |
| 1234 | 1286 | // If they haven't post at all, don't draw the graph. |
| 1235 | - if (empty($context['posts_by_time'])) |
|
| 1236 | - echo ' |
|
| 1287 | + if (empty($context['posts_by_time'])) { |
|
| 1288 | + echo ' |
|
| 1237 | 1289 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1290 | + } |
|
| 1238 | 1291 | // Otherwise do! |
| 1239 | 1292 | else |
| 1240 | 1293 | { |
@@ -1273,11 +1326,10 @@ discard block |
||
| 1273 | 1326 | </h3> |
| 1274 | 1327 | </div>'; |
| 1275 | 1328 | |
| 1276 | - if (empty($context['popular_boards'])) |
|
| 1277 | - echo ' |
|
| 1329 | + if (empty($context['popular_boards'])) { |
|
| 1330 | + echo ' |
|
| 1278 | 1331 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1279 | - |
|
| 1280 | - else |
|
| 1332 | + } else |
|
| 1281 | 1333 | { |
| 1282 | 1334 | echo ' |
| 1283 | 1335 | <dl class="stats">'; |
@@ -1308,10 +1360,10 @@ discard block |
||
| 1308 | 1360 | </h3> |
| 1309 | 1361 | </div>'; |
| 1310 | 1362 | |
| 1311 | - if (empty($context['board_activity'])) |
|
| 1312 | - echo ' |
|
| 1363 | + if (empty($context['board_activity'])) { |
|
| 1364 | + echo ' |
|
| 1313 | 1365 | <p class="centertext padding">', $txt['statPanel_noPosts'], '</p>'; |
| 1314 | - else |
|
| 1366 | + } else |
|
| 1315 | 1367 | { |
| 1316 | 1368 | echo ' |
| 1317 | 1369 | <dl class="stats">'; |
@@ -1359,41 +1411,46 @@ discard block |
||
| 1359 | 1411 | <h3 class="catbg profile_hd">'; |
| 1360 | 1412 | |
| 1361 | 1413 | // Don't say "Profile" if this isn't the profile... |
| 1362 | - if (!empty($context['profile_header_text'])) |
|
| 1363 | - echo ' |
|
| 1414 | + if (!empty($context['profile_header_text'])) { |
|
| 1415 | + echo ' |
|
| 1364 | 1416 | ', $context['profile_header_text']; |
| 1365 | - else |
|
| 1366 | - echo ' |
|
| 1417 | + } else { |
|
| 1418 | + echo ' |
|
| 1367 | 1419 | ', $txt['profile']; |
| 1420 | + } |
|
| 1368 | 1421 | |
| 1369 | 1422 | echo ' |
| 1370 | 1423 | </h3> |
| 1371 | 1424 | </div>'; |
| 1372 | 1425 | |
| 1373 | 1426 | // Have we some description? |
| 1374 | - if ($context['page_desc']) |
|
| 1375 | - echo ' |
|
| 1427 | + if ($context['page_desc']) { |
|
| 1428 | + echo ' |
|
| 1376 | 1429 | <p class="information">', $context['page_desc'], '</p>'; |
| 1430 | + } |
|
| 1377 | 1431 | |
| 1378 | 1432 | echo ' |
| 1379 | 1433 | <div class="roundframe">'; |
| 1380 | 1434 | |
| 1381 | 1435 | // Any bits at the start? |
| 1382 | - if (!empty($context['profile_prehtml'])) |
|
| 1383 | - echo ' |
|
| 1436 | + if (!empty($context['profile_prehtml'])) { |
|
| 1437 | + echo ' |
|
| 1384 | 1438 | <div>', $context['profile_prehtml'], '</div>'; |
| 1439 | + } |
|
| 1385 | 1440 | |
| 1386 | - if (!empty($context['profile_fields'])) |
|
| 1387 | - echo ' |
|
| 1441 | + if (!empty($context['profile_fields'])) { |
|
| 1442 | + echo ' |
|
| 1388 | 1443 | <dl class="settings">'; |
| 1444 | + } |
|
| 1389 | 1445 | |
| 1390 | 1446 | // Start the big old loop 'of love. |
| 1391 | 1447 | $lastItem = 'hr'; |
| 1392 | 1448 | foreach ($context['profile_fields'] as $key => $field) |
| 1393 | 1449 | { |
| 1394 | 1450 | // We add a little hack to be sure we never get more than one hr in a row! |
| 1395 | - if ($lastItem == 'hr' && $field['type'] == 'hr') |
|
| 1396 | - continue; |
|
| 1451 | + if ($lastItem == 'hr' && $field['type'] == 'hr') { |
|
| 1452 | + continue; |
|
| 1453 | + } |
|
| 1397 | 1454 | |
| 1398 | 1455 | $lastItem = $field['type']; |
| 1399 | 1456 | if ($field['type'] == 'hr') |
@@ -1402,48 +1459,50 @@ discard block |
||
| 1402 | 1459 | </dl> |
| 1403 | 1460 | <hr> |
| 1404 | 1461 | <dl class="settings">'; |
| 1405 | - } |
|
| 1406 | - elseif ($field['type'] == 'callback') |
|
| 1462 | + } elseif ($field['type'] == 'callback') |
|
| 1407 | 1463 | { |
| 1408 | 1464 | if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) |
| 1409 | 1465 | { |
| 1410 | 1466 | $callback_func = 'template_profile_' . $field['callback_func']; |
| 1411 | 1467 | $callback_func(); |
| 1412 | 1468 | } |
| 1413 | - } |
|
| 1414 | - else |
|
| 1469 | + } else |
|
| 1415 | 1470 | { |
| 1416 | 1471 | echo ' |
| 1417 | 1472 | <dt> |
| 1418 | 1473 | <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>'; |
| 1419 | 1474 | |
| 1420 | 1475 | // Does it have any subtext to show? |
| 1421 | - if (!empty($field['subtext'])) |
|
| 1422 | - echo ' |
|
| 1476 | + if (!empty($field['subtext'])) { |
|
| 1477 | + echo ' |
|
| 1423 | 1478 | <br> |
| 1424 | 1479 | <span class="smalltext">', $field['subtext'], '</span>'; |
| 1480 | + } |
|
| 1425 | 1481 | |
| 1426 | 1482 | echo ' |
| 1427 | 1483 | </dt> |
| 1428 | 1484 | <dd>'; |
| 1429 | 1485 | |
| 1430 | 1486 | // Want to put something infront of the box? |
| 1431 | - if (!empty($field['preinput'])) |
|
| 1432 | - echo ' |
|
| 1487 | + if (!empty($field['preinput'])) { |
|
| 1488 | + echo ' |
|
| 1433 | 1489 | ', $field['preinput']; |
| 1490 | + } |
|
| 1434 | 1491 | |
| 1435 | 1492 | // What type of data are we showing? |
| 1436 | - if ($field['type'] == 'label') |
|
| 1437 | - echo ' |
|
| 1493 | + if ($field['type'] == 'label') { |
|
| 1494 | + echo ' |
|
| 1438 | 1495 | ', $field['value']; |
| 1496 | + } |
|
| 1439 | 1497 | |
| 1440 | 1498 | // Maybe it's a text box - very likely! |
| 1441 | 1499 | elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) |
| 1442 | 1500 | { |
| 1443 | - if ($field['type'] == 'int' || $field['type'] == 'float') |
|
| 1444 | - $type = 'number'; |
|
| 1445 | - else |
|
| 1446 | - $type = $field['type']; |
|
| 1501 | + if ($field['type'] == 'int' || $field['type'] == 'float') { |
|
| 1502 | + $type = 'number'; |
|
| 1503 | + } else { |
|
| 1504 | + $type = $field['type']; |
|
| 1505 | + } |
|
| 1447 | 1506 | $step = $field['type'] == 'float' ? ' step="0.1"' : ''; |
| 1448 | 1507 | |
| 1449 | 1508 | |
@@ -1451,9 +1510,10 @@ discard block |
||
| 1451 | 1510 | <input type="', $type, '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '"', $step, '>'; |
| 1452 | 1511 | } |
| 1453 | 1512 | // You "checking" me out? ;) |
| 1454 | - elseif ($field['type'] == 'check') |
|
| 1455 | - echo ' |
|
| 1513 | + elseif ($field['type'] == 'check') { |
|
| 1514 | + echo ' |
|
| 1456 | 1515 | <input type="hidden" name="', $key, '" value="0"><input type="checkbox" name="', $key, '" id="', $key, '"', !empty($field['value']) ? ' checked' : '', ' value="1" class="input_check" ', $field['input_attr'], '>'; |
| 1516 | + } |
|
| 1457 | 1517 | |
| 1458 | 1518 | // Always fun - select boxes! |
| 1459 | 1519 | elseif ($field['type'] == 'select') |
@@ -1464,13 +1524,15 @@ discard block |
||
| 1464 | 1524 | if (isset($field['options'])) |
| 1465 | 1525 | { |
| 1466 | 1526 | // Is this some code to generate the options? |
| 1467 | - if (!is_array($field['options'])) |
|
| 1468 | - $field['options'] = $field['options'](); |
|
| 1527 | + if (!is_array($field['options'])) { |
|
| 1528 | + $field['options'] = $field['options'](); |
|
| 1529 | + } |
|
| 1469 | 1530 | // Assuming we now have some! |
| 1470 | - if (is_array($field['options'])) |
|
| 1471 | - foreach ($field['options'] as $value => $name) |
|
| 1531 | + if (is_array($field['options'])) { |
|
| 1532 | + foreach ($field['options'] as $value => $name) |
|
| 1472 | 1533 | echo ' |
| 1473 | 1534 | <option value="', $value, '"', $value == $field['value'] ? ' selected' : '', '>', $name, '</option>'; |
| 1535 | + } |
|
| 1474 | 1536 | } |
| 1475 | 1537 | |
| 1476 | 1538 | echo ' |
@@ -1478,25 +1540,28 @@ discard block |
||
| 1478 | 1540 | } |
| 1479 | 1541 | |
| 1480 | 1542 | // Something to end with? |
| 1481 | - if (!empty($field['postinput'])) |
|
| 1482 | - echo ' |
|
| 1543 | + if (!empty($field['postinput'])) { |
|
| 1544 | + echo ' |
|
| 1483 | 1545 | ', $field['postinput']; |
| 1546 | + } |
|
| 1484 | 1547 | |
| 1485 | 1548 | echo ' |
| 1486 | 1549 | </dd>'; |
| 1487 | 1550 | } |
| 1488 | 1551 | } |
| 1489 | 1552 | |
| 1490 | - if (!empty($context['profile_fields'])) |
|
| 1491 | - echo ' |
|
| 1553 | + if (!empty($context['profile_fields'])) { |
|
| 1554 | + echo ' |
|
| 1492 | 1555 | </dl>'; |
| 1556 | + } |
|
| 1493 | 1557 | |
| 1494 | 1558 | // Are there any custom profile fields - if so print them! |
| 1495 | 1559 | if (!empty($context['custom_fields'])) |
| 1496 | 1560 | { |
| 1497 | - if ($lastItem != 'hr') |
|
| 1498 | - echo ' |
|
| 1561 | + if ($lastItem != 'hr') { |
|
| 1562 | + echo ' |
|
| 1499 | 1563 | <hr>'; |
| 1564 | + } |
|
| 1500 | 1565 | |
| 1501 | 1566 | echo ' |
| 1502 | 1567 | <dl class="settings">'; |
@@ -1519,13 +1584,14 @@ discard block |
||
| 1519 | 1584 | } |
| 1520 | 1585 | |
| 1521 | 1586 | // Any closing HTML? |
| 1522 | - if (!empty($context['profile_posthtml'])) |
|
| 1523 | - echo ' |
|
| 1587 | + if (!empty($context['profile_posthtml'])) { |
|
| 1588 | + echo ' |
|
| 1524 | 1589 | <div>', $context['profile_posthtml'], '</div>'; |
| 1590 | + } |
|
| 1525 | 1591 | |
| 1526 | 1592 | // Only show the password box if it's actually needed. |
| 1527 | - if ($context['require_password']) |
|
| 1528 | - echo ' |
|
| 1593 | + if ($context['require_password']) { |
|
| 1594 | + echo ' |
|
| 1529 | 1595 | <dl class="settings"> |
| 1530 | 1596 | <dt> |
| 1531 | 1597 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br> |
@@ -1535,18 +1601,21 @@ discard block |
||
| 1535 | 1601 | <input type="password" name="oldpasswrd" id="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password"> |
| 1536 | 1602 | </dd> |
| 1537 | 1603 | </dl>'; |
| 1604 | + } |
|
| 1538 | 1605 | |
| 1539 | 1606 | // The button shouldn't say "Change profile" unless we're changing the profile... |
| 1540 | - if (!empty($context['submit_button_text'])) |
|
| 1541 | - echo ' |
|
| 1607 | + if (!empty($context['submit_button_text'])) { |
|
| 1608 | + echo ' |
|
| 1542 | 1609 | <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button_submit">'; |
| 1543 | - else |
|
| 1544 | - echo ' |
|
| 1610 | + } else { |
|
| 1611 | + echo ' |
|
| 1545 | 1612 | <input type="submit" name="save" value="', $txt['change_profile'], '" class="button_submit">'; |
| 1613 | + } |
|
| 1546 | 1614 | |
| 1547 | - if (!empty($context['token_check'])) |
|
| 1548 | - echo ' |
|
| 1615 | + if (!empty($context['token_check'])) { |
|
| 1616 | + echo ' |
|
| 1549 | 1617 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 1618 | + } |
|
| 1550 | 1619 | |
| 1551 | 1620 | echo ' |
| 1552 | 1621 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -1556,10 +1625,11 @@ discard block |
||
| 1556 | 1625 | </form>'; |
| 1557 | 1626 | |
| 1558 | 1627 | // Any final spellchecking stuff? |
| 1559 | - if (!empty($context['show_spellchecking'])) |
|
| 1560 | - echo ' |
|
| 1628 | + if (!empty($context['show_spellchecking'])) { |
|
| 1629 | + echo ' |
|
| 1561 | 1630 | <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value=""></form>'; |
| 1562 | -} |
|
| 1631 | + } |
|
| 1632 | + } |
|
| 1563 | 1633 | |
| 1564 | 1634 | /** |
| 1565 | 1635 | * Personal Message settings. |
@@ -1596,10 +1666,11 @@ discard block |
||
| 1596 | 1666 | <select name="pm_receive_from" id="pm_receive_from"> |
| 1597 | 1667 | <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>'; |
| 1598 | 1668 | |
| 1599 | - if (!empty($modSettings['enable_buddylist'])) |
|
| 1600 | - echo ' |
|
| 1669 | + if (!empty($modSettings['enable_buddylist'])) { |
|
| 1670 | + echo ' |
|
| 1601 | 1671 | <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option> |
| 1602 | 1672 | <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>'; |
| 1673 | + } |
|
| 1603 | 1674 | |
| 1604 | 1675 | echo ' |
| 1605 | 1676 | <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option> |
@@ -1641,11 +1712,12 @@ discard block |
||
| 1641 | 1712 | if (empty($setting) || !is_array($setting)) |
| 1642 | 1713 | { |
| 1643 | 1714 | // Insert a separator (unless this is the first item in the list) |
| 1644 | - if ($i !== $first_option_key) |
|
| 1645 | - echo ' |
|
| 1715 | + if ($i !== $first_option_key) { |
|
| 1716 | + echo ' |
|
| 1646 | 1717 | </dl> |
| 1647 | 1718 | <hr> |
| 1648 | 1719 | <dl class="settings">'; |
| 1720 | + } |
|
| 1649 | 1721 | |
| 1650 | 1722 | // Should we give a name to this section? |
| 1651 | 1723 | if (is_string($setting) && !empty($setting)) |
@@ -1653,48 +1725,52 @@ discard block |
||
| 1653 | 1725 | $titled_section = true; |
| 1654 | 1726 | echo ' |
| 1655 | 1727 | <dt><b>' . $setting . '</b></dt><dd></dd>'; |
| 1728 | + } else { |
|
| 1729 | + $titled_section = false; |
|
| 1656 | 1730 | } |
| 1657 | - else |
|
| 1658 | - $titled_section = false; |
|
| 1659 | 1731 | |
| 1660 | 1732 | continue; |
| 1661 | 1733 | } |
| 1662 | 1734 | |
| 1663 | 1735 | // Is this disabled? |
| 1664 | - if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) |
|
| 1665 | - continue; |
|
| 1666 | - elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) |
|
| 1667 | - continue; |
|
| 1668 | - elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) |
|
| 1669 | - continue; |
|
| 1670 | - elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) |
|
| 1671 | - continue; |
|
| 1672 | - elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) |
|
| 1673 | - continue; |
|
| 1674 | - elseif ($setting['id'] == 'topics_per_page' && !empty($modSettings['disableCustomPerPage'])) |
|
| 1675 | - continue; |
|
| 1676 | - elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
| 1677 | - continue; |
|
| 1678 | - elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) |
|
| 1679 | - continue; |
|
| 1736 | + if ($setting['id'] == 'calendar_start_day' && empty($modSettings['cal_enabled'])) { |
|
| 1737 | + continue; |
|
| 1738 | + } elseif (($setting['id'] == 'topics_per_page' || $setting['id'] == 'messages_per_page') && !empty($modSettings['disableCustomPerPage'])) { |
|
| 1739 | + continue; |
|
| 1740 | + } elseif ($setting['id'] == 'show_no_censored' && empty($modSettings['allow_no_censored'])) { |
|
| 1741 | + continue; |
|
| 1742 | + } elseif ($setting['id'] == 'posts_apply_ignore_list' && empty($modSettings['enable_buddylist'])) { |
|
| 1743 | + continue; |
|
| 1744 | + } elseif ($setting['id'] == 'wysiwyg_default' && !empty($modSettings['disable_wysiwyg'])) { |
|
| 1745 | + continue; |
|
| 1746 | + } elseif ($setting['id'] == 'topics_per_page' && !empty($modSettings['disableCustomPerPage'])) { |
|
| 1747 | + continue; |
|
| 1748 | + } elseif ($setting['id'] == 'drafts_autosave_enabled' && (empty($modSettings['drafts_autosave_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
| 1749 | + continue; |
|
| 1750 | + } elseif ($setting['id'] == 'drafts_show_saved_enabled' && (empty($modSettings['drafts_show_saved_enabled']) || (empty($modSettings['drafts_post_enabled']) && empty($modSettings['drafts_pm_enabled'])))) { |
|
| 1751 | + continue; |
|
| 1752 | + } |
|
| 1680 | 1753 | |
| 1681 | - if (!isset($setting['type']) || $setting['type'] == 'bool') |
|
| 1682 | - $setting['type'] = 'checkbox'; |
|
| 1683 | - elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') |
|
| 1684 | - $setting['type'] = 'number'; |
|
| 1685 | - elseif ($setting['type'] == 'string') |
|
| 1686 | - $setting['type'] = 'text'; |
|
| 1754 | + if (!isset($setting['type']) || $setting['type'] == 'bool') { |
|
| 1755 | + $setting['type'] = 'checkbox'; |
|
| 1756 | + } elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') { |
|
| 1757 | + $setting['type'] = 'number'; |
|
| 1758 | + } elseif ($setting['type'] == 'string') { |
|
| 1759 | + $setting['type'] = 'text'; |
|
| 1760 | + } |
|
| 1687 | 1761 | |
| 1688 | - if (isset($setting['options'])) |
|
| 1689 | - $setting['type'] = 'list'; |
|
| 1762 | + if (isset($setting['options'])) { |
|
| 1763 | + $setting['type'] = 'list'; |
|
| 1764 | + } |
|
| 1690 | 1765 | |
| 1691 | 1766 | echo ' |
| 1692 | 1767 | <dt> |
| 1693 | 1768 | <label for="', $setting['id'], '">', !$titled_section ? '<b>' : '', $setting['label'], !$titled_section ? '</b>' : '', '</label>'; |
| 1694 | 1769 | |
| 1695 | - if (isset($setting['description'])) |
|
| 1696 | - echo ' |
|
| 1770 | + if (isset($setting['description'])) { |
|
| 1771 | + echo ' |
|
| 1697 | 1772 | <br><span class="smalltext">', $setting['description'], '</span>'; |
| 1773 | + } |
|
| 1698 | 1774 | echo ' |
| 1699 | 1775 | </dt> |
| 1700 | 1776 | <dd>'; |
@@ -1732,13 +1808,11 @@ discard block |
||
| 1732 | 1808 | |
| 1733 | 1809 | echo ' |
| 1734 | 1810 | <input type="number"', $min . $max . $step; |
| 1735 | - } |
|
| 1736 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 1811 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 1737 | 1812 | { |
| 1738 | 1813 | echo' |
| 1739 | 1814 | <input type="url"'; |
| 1740 | - } |
|
| 1741 | - else |
|
| 1815 | + } else |
|
| 1742 | 1816 | { |
| 1743 | 1817 | echo ' |
| 1744 | 1818 | <input type="text"'; |
@@ -1777,8 +1851,8 @@ discard block |
||
| 1777 | 1851 | <dl class="settings">'; |
| 1778 | 1852 | |
| 1779 | 1853 | // Allow notification on announcements to be disabled? |
| 1780 | - if (!empty($modSettings['allow_disableAnnounce'])) |
|
| 1781 | - echo ' |
|
| 1854 | + if (!empty($modSettings['allow_disableAnnounce'])) { |
|
| 1855 | + echo ' |
|
| 1782 | 1856 | <dt> |
| 1783 | 1857 | <label for="notify_announcements">', $txt['notify_important_email'], '</label> |
| 1784 | 1858 | </dt> |
@@ -1786,9 +1860,10 @@ discard block |
||
| 1786 | 1860 | <input type="hidden" name="notify_announcements" value="0"> |
| 1787 | 1861 | <input type="checkbox" id="notify_announcements" name="notify_announcements" value="1"', !empty($context['member']['notify_announcements']) ? ' checked' : '', ' class="input_check"> |
| 1788 | 1862 | </dd>'; |
| 1863 | + } |
|
| 1789 | 1864 | |
| 1790 | - if (!empty($modSettings['enable_ajax_alerts'])) |
|
| 1791 | - echo ' |
|
| 1865 | + if (!empty($modSettings['enable_ajax_alerts'])) { |
|
| 1866 | + echo ' |
|
| 1792 | 1867 | <dt> |
| 1793 | 1868 | <label for="notify_send_body">', $txt['notify_alert_timeout'], '</label> |
| 1794 | 1869 | </dt> |
@@ -1796,6 +1871,7 @@ discard block |
||
| 1796 | 1871 | <input type="number" size="4" id="notify_alert_timeout" name="opt_alert_timeout" min="0" value="', $context['member']['alert_timeout'], '" class="input_text"> |
| 1797 | 1872 | </dd> |
| 1798 | 1873 | '; |
| 1874 | + } |
|
| 1799 | 1875 | |
| 1800 | 1876 | echo ' |
| 1801 | 1877 | </dl> |
@@ -1825,9 +1901,10 @@ discard block |
||
| 1825 | 1901 | <td colspan="3">'; |
| 1826 | 1902 | $label = $txt['alert_opt_' . $opts[1]]; |
| 1827 | 1903 | $label_pos = isset($opts['label']) ? $opts['label'] : ''; |
| 1828 | - if ($label_pos == 'before') |
|
| 1829 | - echo ' |
|
| 1904 | + if ($label_pos == 'before') { |
|
| 1905 | + echo ' |
|
| 1830 | 1906 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 1907 | + } |
|
| 1831 | 1908 | |
| 1832 | 1909 | $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; |
| 1833 | 1910 | switch ($opts[0]) |
@@ -1839,17 +1916,19 @@ discard block |
||
| 1839 | 1916 | case 'select': |
| 1840 | 1917 | echo ' |
| 1841 | 1918 | <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">'; |
| 1842 | - foreach ($opts['opts'] as $k => $v) |
|
| 1843 | - echo ' |
|
| 1919 | + foreach ($opts['opts'] as $k => $v) { |
|
| 1920 | + echo ' |
|
| 1844 | 1921 | <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>'; |
| 1922 | + } |
|
| 1845 | 1923 | echo ' |
| 1846 | 1924 | </select>'; |
| 1847 | 1925 | break; |
| 1848 | 1926 | } |
| 1849 | 1927 | |
| 1850 | - if ($label_pos == 'after') |
|
| 1851 | - echo ' |
|
| 1928 | + if ($label_pos == 'after') { |
|
| 1929 | + echo ' |
|
| 1852 | 1930 | <label for="opt_', $opts[1], '">', $label, '</label>'; |
| 1931 | + } |
|
| 1853 | 1932 | |
| 1854 | 1933 | echo ' |
| 1855 | 1934 | </td> |
@@ -1963,11 +2042,12 @@ discard block |
||
| 1963 | 2042 | <p class="information">', $txt['groupMembership_info'], '</p>'; |
| 1964 | 2043 | |
| 1965 | 2044 | // Do we have an update message? |
| 1966 | - if (!empty($context['update_message'])) |
|
| 1967 | - echo ' |
|
| 2045 | + if (!empty($context['update_message'])) { |
|
| 2046 | + echo ' |
|
| 1968 | 2047 | <div class="infobox"> |
| 1969 | 2048 | ', $context['update_message'], '. |
| 1970 | 2049 | </div>'; |
| 2050 | + } |
|
| 1971 | 2051 | |
| 1972 | 2052 | echo ' |
| 1973 | 2053 | <div id="groups">'; |
@@ -1989,8 +2069,7 @@ discard block |
||
| 1989 | 2069 | </div> |
| 1990 | 2070 | </div> |
| 1991 | 2071 | </div>'; |
| 1992 | - } |
|
| 1993 | - else |
|
| 2072 | + } else |
|
| 1994 | 2073 | { |
| 1995 | 2074 | echo ' |
| 1996 | 2075 | <div class="title_bar"> |
@@ -2002,27 +2081,30 @@ discard block |
||
| 2002 | 2081 | echo ' |
| 2003 | 2082 | <div class="windowbg" id="primdiv_', $group['id'], '">'; |
| 2004 | 2083 | |
| 2005 | - if ($context['can_edit_primary']) |
|
| 2006 | - echo ' |
|
| 2084 | + if ($context['can_edit_primary']) { |
|
| 2085 | + echo ' |
|
| 2007 | 2086 | <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '"', $group['is_primary'] ? ' checked' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');"', $group['can_be_primary'] ? '' : ' disabled', ' class="input_radio">'; |
| 2087 | + } |
|
| 2008 | 2088 | |
| 2009 | 2089 | echo ' |
| 2010 | 2090 | <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>'; |
| 2011 | 2091 | |
| 2012 | 2092 | // Can they leave their group? |
| 2013 | - if ($group['can_leave']) |
|
| 2014 | - echo ' |
|
| 2093 | + if ($group['can_leave']) { |
|
| 2094 | + echo ' |
|
| 2015 | 2095 | <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>'; |
| 2096 | + } |
|
| 2016 | 2097 | |
| 2017 | 2098 | echo ' |
| 2018 | 2099 | </div>'; |
| 2019 | 2100 | } |
| 2020 | 2101 | |
| 2021 | - if ($context['can_edit_primary']) |
|
| 2022 | - echo ' |
|
| 2102 | + if ($context['can_edit_primary']) { |
|
| 2103 | + echo ' |
|
| 2023 | 2104 | <div class="padding righttext"> |
| 2024 | 2105 | <input type="submit" value="', $txt['make_primary'], '" class="button_submit"> |
| 2025 | 2106 | </div>'; |
| 2107 | + } |
|
| 2026 | 2108 | |
| 2027 | 2109 | // Any groups they can join? |
| 2028 | 2110 | if (!empty($context['groups']['available'])) |
@@ -2038,15 +2120,16 @@ discard block |
||
| 2038 | 2120 | <div class="windowbg"> |
| 2039 | 2121 | <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br><span class="smalltext">' . $group['desc'] . '</span>' : ''), ''; |
| 2040 | 2122 | |
| 2041 | - if ($group['type'] == 3) |
|
| 2042 | - echo ' |
|
| 2123 | + if ($group['type'] == 3) { |
|
| 2124 | + echo ' |
|
| 2043 | 2125 | <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '" class="button floatright">', $txt['join_group'], '</a>'; |
| 2044 | - elseif ($group['type'] == 2 && $group['pending']) |
|
| 2045 | - echo ' |
|
| 2126 | + } elseif ($group['type'] == 2 && $group['pending']) { |
|
| 2127 | + echo ' |
|
| 2046 | 2128 | <span class="floatright">', $txt['approval_pending'], '</span>'; |
| 2047 | - elseif ($group['type'] == 2) |
|
| 2048 | - echo ' |
|
| 2129 | + } elseif ($group['type'] == 2) { |
|
| 2130 | + echo ' |
|
| 2049 | 2131 | <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '" class="button floatright">', $txt['request_group'], '</a>'; |
| 2132 | + } |
|
| 2050 | 2133 | |
| 2051 | 2134 | echo ' |
| 2052 | 2135 | </div>'; |
@@ -2069,9 +2152,10 @@ discard block |
||
| 2069 | 2152 | |
| 2070 | 2153 | prevDiv.className = "windowbg"; |
| 2071 | 2154 | }'; |
| 2072 | - if (isset($context['groups']['member'][$context['primary_group']])) |
|
| 2073 | - echo ' |
|
| 2155 | + if (isset($context['groups']['member'][$context['primary_group']])) { |
|
| 2156 | + echo ' |
|
| 2074 | 2157 | highlightSelected("primdiv_' . $context['primary_group'] . '");'; |
| 2158 | + } |
|
| 2075 | 2159 | echo ' |
| 2076 | 2160 | </script>'; |
| 2077 | 2161 | } |
@@ -2079,9 +2163,10 @@ discard block |
||
| 2079 | 2163 | echo ' |
| 2080 | 2164 | </div>'; |
| 2081 | 2165 | |
| 2082 | - if (!empty($context['token_check'])) |
|
| 2083 | - echo ' |
|
| 2166 | + if (!empty($context['token_check'])) { |
|
| 2167 | + echo ' |
|
| 2084 | 2168 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2169 | + } |
|
| 2085 | 2170 | |
| 2086 | 2171 | echo ' |
| 2087 | 2172 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2128,14 +2213,15 @@ discard block |
||
| 2128 | 2213 | |
| 2129 | 2214 | foreach ($category['boards'] as $board) |
| 2130 | 2215 | { |
| 2131 | - if ($i == $limit) |
|
| 2132 | - echo ' |
|
| 2216 | + if ($i == $limit) { |
|
| 2217 | + echo ' |
|
| 2133 | 2218 | </ul> |
| 2134 | 2219 | </li> |
| 2135 | 2220 | </ul> |
| 2136 | 2221 | <ul class="ignoreboards floatright"> |
| 2137 | 2222 | <li class="category"> |
| 2138 | 2223 | <ul>'; |
| 2224 | + } |
|
| 2139 | 2225 | |
| 2140 | 2226 | echo ' |
| 2141 | 2227 | <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;"> |
@@ -2181,10 +2267,11 @@ discard block |
||
| 2181 | 2267 | |
| 2182 | 2268 | // Work out the starting color. |
| 2183 | 2269 | $context['current_color'] = $context['colors'][0]; |
| 2184 | - foreach ($context['colors'] as $limit => $color) |
|
| 2185 | - if ($context['member']['warning'] >= $limit) |
|
| 2270 | + foreach ($context['colors'] as $limit => $color) { |
|
| 2271 | + if ($context['member']['warning'] >= $limit) |
|
| 2186 | 2272 | $context['current_color'] = $color; |
| 2187 | -} |
|
| 2273 | + } |
|
| 2274 | + } |
|
| 2188 | 2275 | |
| 2189 | 2276 | // Show all warnings of a user? |
| 2190 | 2277 | function template_viewWarning() |
@@ -2223,14 +2310,15 @@ discard block |
||
| 2223 | 2310 | </dd>'; |
| 2224 | 2311 | |
| 2225 | 2312 | // There's some impact of this? |
| 2226 | - if (!empty($context['level_effects'][$context['current_level']])) |
|
| 2227 | - echo ' |
|
| 2313 | + if (!empty($context['level_effects'][$context['current_level']])) { |
|
| 2314 | + echo ' |
|
| 2228 | 2315 | <dt> |
| 2229 | 2316 | <strong>', $txt['profile_viewwarning_impact'], ':</strong> |
| 2230 | 2317 | </dt> |
| 2231 | 2318 | <dd> |
| 2232 | 2319 | ', $context['level_effects'][$context['current_level']], ' |
| 2233 | 2320 | </dd>'; |
| 2321 | + } |
|
| 2234 | 2322 | |
| 2235 | 2323 | echo ' |
| 2236 | 2324 | </dl> |
@@ -2268,10 +2356,11 @@ discard block |
||
| 2268 | 2356 | |
| 2269 | 2357 | // Otherwise see what we can do...'; |
| 2270 | 2358 | |
| 2271 | - foreach ($context['notification_templates'] as $k => $type) |
|
| 2272 | - echo ' |
|
| 2359 | + foreach ($context['notification_templates'] as $k => $type) { |
|
| 2360 | + echo ' |
|
| 2273 | 2361 | if (index == ', $k, ') |
| 2274 | 2362 | document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";'; |
| 2363 | + } |
|
| 2275 | 2364 | |
| 2276 | 2365 | echo ' |
| 2277 | 2366 | } |
@@ -2281,10 +2370,11 @@ discard block |
||
| 2281 | 2370 | // Also set the right effect. |
| 2282 | 2371 | effectText = "";'; |
| 2283 | 2372 | |
| 2284 | - foreach ($context['level_effects'] as $limit => $text) |
|
| 2285 | - echo ' |
|
| 2373 | + foreach ($context['level_effects'] as $limit => $text) { |
|
| 2374 | + echo ' |
|
| 2286 | 2375 | if (slideAmount >= ', $limit, ') |
| 2287 | 2376 | effectText = "', $text, '";'; |
| 2377 | + } |
|
| 2288 | 2378 | |
| 2289 | 2379 | echo ' |
| 2290 | 2380 | setInnerHTML(document.getElementById(\'cur_level_div\'), slideAmount + \'% (\' + effectText + \')\'); |
@@ -2299,31 +2389,34 @@ discard block |
||
| 2299 | 2389 | </h3> |
| 2300 | 2390 | </div>'; |
| 2301 | 2391 | |
| 2302 | - if (!$context['user']['is_owner']) |
|
| 2303 | - echo ' |
|
| 2392 | + if (!$context['user']['is_owner']) { |
|
| 2393 | + echo ' |
|
| 2304 | 2394 | <p class="information">', $txt['profile_warning_desc'], '</p>'; |
| 2395 | + } |
|
| 2305 | 2396 | |
| 2306 | 2397 | echo ' |
| 2307 | 2398 | <div class="windowbg"> |
| 2308 | 2399 | <dl class="settings">'; |
| 2309 | 2400 | |
| 2310 | - if (!$context['user']['is_owner']) |
|
| 2311 | - echo ' |
|
| 2401 | + if (!$context['user']['is_owner']) { |
|
| 2402 | + echo ' |
|
| 2312 | 2403 | <dt> |
| 2313 | 2404 | <strong>', $txt['profile_warning_name'], ':</strong> |
| 2314 | 2405 | </dt> |
| 2315 | 2406 | <dd> |
| 2316 | 2407 | <strong>', $context['member']['name'], '</strong> |
| 2317 | 2408 | </dd>'; |
| 2409 | + } |
|
| 2318 | 2410 | |
| 2319 | 2411 | echo ' |
| 2320 | 2412 | <dt> |
| 2321 | 2413 | <strong>', $txt['profile_warning_level'], ':</strong>'; |
| 2322 | 2414 | |
| 2323 | 2415 | // Is there only so much they can apply? |
| 2324 | - if ($context['warning_limit']) |
|
| 2325 | - echo ' |
|
| 2416 | + if ($context['warning_limit']) { |
|
| 2417 | + echo ' |
|
| 2326 | 2418 | <br><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>'; |
| 2419 | + } |
|
| 2327 | 2420 | |
| 2328 | 2421 | echo ' |
| 2329 | 2422 | </dt> |
@@ -2376,9 +2469,10 @@ discard block |
||
| 2376 | 2469 | <option value="-1">', $txt['profile_warning_notify_template'], '</option> |
| 2377 | 2470 | <option value="-1" disabled>------------------------------</option>'; |
| 2378 | 2471 | |
| 2379 | - foreach ($context['notification_templates'] as $id_template => $template) |
|
| 2380 | - echo ' |
|
| 2472 | + foreach ($context['notification_templates'] as $id_template => $template) { |
|
| 2473 | + echo ' |
|
| 2381 | 2474 | <option value="', $id_template, '">', $template['title'], '</option>'; |
| 2475 | + } |
|
| 2382 | 2476 | |
| 2383 | 2477 | echo ' |
| 2384 | 2478 | </select> |
@@ -2390,9 +2484,10 @@ discard block |
||
| 2390 | 2484 | </dl> |
| 2391 | 2485 | <div class="righttext">'; |
| 2392 | 2486 | |
| 2393 | - if (!empty($context['token_check'])) |
|
| 2394 | - echo ' |
|
| 2487 | + if (!empty($context['token_check'])) { |
|
| 2488 | + echo ' |
|
| 2395 | 2489 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2490 | + } |
|
| 2396 | 2491 | |
| 2397 | 2492 | echo ' |
| 2398 | 2493 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2408,8 +2503,8 @@ discard block |
||
| 2408 | 2503 | echo ' |
| 2409 | 2504 | <script>'; |
| 2410 | 2505 | |
| 2411 | - if (!$context['user']['is_owner']) |
|
| 2412 | - echo ' |
|
| 2506 | + if (!$context['user']['is_owner']) { |
|
| 2507 | + echo ' |
|
| 2413 | 2508 | modifyWarnNotify(); |
| 2414 | 2509 | $(document).ready(function() { |
| 2415 | 2510 | $("#preview_button").click(function() { |
@@ -2448,6 +2543,7 @@ discard block |
||
| 2448 | 2543 | }); |
| 2449 | 2544 | return false; |
| 2450 | 2545 | }'; |
| 2546 | + } |
|
| 2451 | 2547 | |
| 2452 | 2548 | echo ' |
| 2453 | 2549 | </script>'; |
@@ -2470,16 +2566,18 @@ discard block |
||
| 2470 | 2566 | </div>'; |
| 2471 | 2567 | |
| 2472 | 2568 | // If deleting another account give them a lovely info box. |
| 2473 | - if (!$context['user']['is_owner']) |
|
| 2474 | - echo ' |
|
| 2569 | + if (!$context['user']['is_owner']) { |
|
| 2570 | + echo ' |
|
| 2475 | 2571 | <p class="information">', $txt['deleteAccount_desc'], '</p>'; |
| 2572 | + } |
|
| 2476 | 2573 | echo ' |
| 2477 | 2574 | <div class="windowbg2">'; |
| 2478 | 2575 | |
| 2479 | 2576 | // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) |
| 2480 | - if ($context['needs_approval']) |
|
| 2481 | - echo ' |
|
| 2577 | + if ($context['needs_approval']) { |
|
| 2578 | + echo ' |
|
| 2482 | 2579 | <div class="errorbox">', $txt['deleteAccount_approval'], '</div>'; |
| 2580 | + } |
|
| 2483 | 2581 | |
| 2484 | 2582 | // If the user is deleting their own account warn them first - and require a password! |
| 2485 | 2583 | if ($context['user']['is_owner']) |
@@ -2491,9 +2589,10 @@ discard block |
||
| 2491 | 2589 | <input type="password" name="oldpasswrd" size="20" class="input_password"> |
| 2492 | 2590 | <input type="submit" value="', $txt['yes'], '" class="button_submit">'; |
| 2493 | 2591 | |
| 2494 | - if (!empty($context['token_check'])) |
|
| 2495 | - echo ' |
|
| 2592 | + if (!empty($context['token_check'])) { |
|
| 2593 | + echo ' |
|
| 2496 | 2594 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2595 | + } |
|
| 2497 | 2596 | |
| 2498 | 2597 | echo ' |
| 2499 | 2598 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2519,9 +2618,10 @@ discard block |
||
| 2519 | 2618 | <option value="topics">', $txt['deleteAccount_topics'], '</option> |
| 2520 | 2619 | </select>'; |
| 2521 | 2620 | |
| 2522 | - if ($context['show_perma_delete']) |
|
| 2523 | - echo ' |
|
| 2621 | + if ($context['show_perma_delete']) { |
|
| 2622 | + echo ' |
|
| 2524 | 2623 | <br><label for="perma_delete"><input type="checkbox" name="perma_delete" id="perma_delete" value="1" class="input_check">', $txt['deleteAccount_permanent'], ':</label>'; |
| 2624 | + } |
|
| 2525 | 2625 | |
| 2526 | 2626 | echo ' |
| 2527 | 2627 | </div>'; |
@@ -2534,9 +2634,10 @@ discard block |
||
| 2534 | 2634 | <div> |
| 2535 | 2635 | <input type="submit" value="', $txt['delete'], '" class="button_submit">'; |
| 2536 | 2636 | |
| 2537 | - if (!empty($context['token_check'])) |
|
| 2538 | - echo ' |
|
| 2637 | + if (!empty($context['token_check'])) { |
|
| 2638 | + echo ' |
|
| 2539 | 2639 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2640 | + } |
|
| 2540 | 2641 | |
| 2541 | 2642 | echo ' |
| 2542 | 2643 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '"> |
@@ -2562,8 +2663,8 @@ discard block |
||
| 2562 | 2663 | <hr>'; |
| 2563 | 2664 | |
| 2564 | 2665 | // Only show the password box if it's actually needed. |
| 2565 | - if ($context['require_password']) |
|
| 2566 | - echo ' |
|
| 2666 | + if ($context['require_password']) { |
|
| 2667 | + echo ' |
|
| 2567 | 2668 | <dl class="settings"> |
| 2568 | 2669 | <dt> |
| 2569 | 2670 | <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br> |
@@ -2573,13 +2674,15 @@ discard block |
||
| 2573 | 2674 | <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password"> |
| 2574 | 2675 | </dd> |
| 2575 | 2676 | </dl>'; |
| 2677 | + } |
|
| 2576 | 2678 | |
| 2577 | 2679 | echo ' |
| 2578 | 2680 | <div class="righttext">'; |
| 2579 | 2681 | |
| 2580 | - if (!empty($context['token_check'])) |
|
| 2581 | - echo ' |
|
| 2682 | + if (!empty($context['token_check'])) { |
|
| 2683 | + echo ' |
|
| 2582 | 2684 | <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">'; |
| 2685 | + } |
|
| 2583 | 2686 | |
| 2584 | 2687 | echo ' |
| 2585 | 2688 | <input type="submit" value="', $txt['change_profile'], '" class="button_submit"> |
@@ -2606,9 +2709,10 @@ discard block |
||
| 2606 | 2709 | <ul id="list_errors">'; |
| 2607 | 2710 | |
| 2608 | 2711 | // Cycle through each error and display an error message. |
| 2609 | - foreach ($context['post_errors'] as $error) |
|
| 2610 | - echo ' |
|
| 2712 | + foreach ($context['post_errors'] as $error) { |
|
| 2713 | + echo ' |
|
| 2611 | 2714 | <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>'; |
| 2715 | + } |
|
| 2612 | 2716 | |
| 2613 | 2717 | echo ' |
| 2614 | 2718 | </ul>'; |
@@ -2634,12 +2738,13 @@ discard block |
||
| 2634 | 2738 | <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 && !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>'; |
| 2635 | 2739 | |
| 2636 | 2740 | // Fill the select box with all primary member groups that can be assigned to a member. |
| 2637 | - foreach ($context['member_groups'] as $member_group) |
|
| 2638 | - if (!empty($member_group['can_be_primary'])) |
|
| 2741 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2742 | + if (!empty($member_group['can_be_primary'])) |
|
| 2639 | 2743 | echo ' |
| 2640 | 2744 | <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '> |
| 2641 | 2745 | ', $member_group['name'], ' |
| 2642 | 2746 | </option>'; |
| 2747 | + } |
|
| 2643 | 2748 | echo ' |
| 2644 | 2749 | </select> |
| 2645 | 2750 | </dd> |
@@ -2651,10 +2756,11 @@ discard block |
||
| 2651 | 2756 | <input type="hidden" name="additional_groups[]" value="0">'; |
| 2652 | 2757 | |
| 2653 | 2758 | // For each membergroup show a checkbox so members can be assigned to more than one group. |
| 2654 | - foreach ($context['member_groups'] as $member_group) |
|
| 2655 | - if ($member_group['can_be_additional']) |
|
| 2759 | + foreach ($context['member_groups'] as $member_group) { |
|
| 2760 | + if ($member_group['can_be_additional']) |
|
| 2656 | 2761 | echo ' |
| 2657 | 2762 | <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked' : '', ' class="input_check"> ', $member_group['name'], '</label><br>'; |
| 2763 | + } |
|
| 2658 | 2764 | echo ' |
| 2659 | 2765 | </span> |
| 2660 | 2766 | <a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;" class="toggle_down">', $txt['additional_membergroups_show'], '</a> |
@@ -2714,9 +2820,10 @@ discard block |
||
| 2714 | 2820 | <span class="smalltext">', $txt['sig_info'], '</span><br> |
| 2715 | 2821 | <br>'; |
| 2716 | 2822 | |
| 2717 | - if ($context['show_spellchecking']) |
|
| 2718 | - echo ' |
|
| 2823 | + if ($context['show_spellchecking']) { |
|
| 2824 | + echo ' |
|
| 2719 | 2825 | <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button_submit">'; |
| 2826 | + } |
|
| 2720 | 2827 | |
| 2721 | 2828 | echo ' |
| 2722 | 2829 | </dt> |
@@ -2724,17 +2831,20 @@ discard block |
||
| 2724 | 2831 | <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50" style="min-width: 50%; max-width: 99%;">', $context['member']['signature'], '</textarea><br>'; |
| 2725 | 2832 | |
| 2726 | 2833 | // If there is a limit at all! |
| 2727 | - if (!empty($context['signature_limits']['max_length'])) |
|
| 2728 | - echo ' |
|
| 2834 | + if (!empty($context['signature_limits']['max_length'])) { |
|
| 2835 | + echo ' |
|
| 2729 | 2836 | <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>'; |
| 2837 | + } |
|
| 2730 | 2838 | |
| 2731 | - if (!empty($context['show_preview_button'])) |
|
| 2732 | - echo ' |
|
| 2839 | + if (!empty($context['show_preview_button'])) { |
|
| 2840 | + echo ' |
|
| 2733 | 2841 | <input type="button" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button_submit">'; |
| 2842 | + } |
|
| 2734 | 2843 | |
| 2735 | - if ($context['signature_warning']) |
|
| 2736 | - echo ' |
|
| 2844 | + if ($context['signature_warning']) { |
|
| 2845 | + echo ' |
|
| 2737 | 2846 | <span class="smalltext">', $context['signature_warning'], '</span>'; |
| 2847 | + } |
|
| 2738 | 2848 | |
| 2739 | 2849 | // Some javascript used to count how many characters have been used so far in the signature. |
| 2740 | 2850 | echo ' |
@@ -2778,9 +2888,10 @@ discard block |
||
| 2778 | 2888 | <div> |
| 2779 | 2889 | <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">'; |
| 2780 | 2890 | // This lists all the file categories. |
| 2781 | - foreach ($context['avatars'] as $avatar) |
|
| 2782 | - echo ' |
|
| 2891 | + foreach ($context['avatars'] as $avatar) { |
|
| 2892 | + echo ' |
|
| 2783 | 2893 | <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>'; |
| 2894 | + } |
|
| 2784 | 2895 | echo ' |
| 2785 | 2896 | </select> |
| 2786 | 2897 | </div> |
@@ -2835,16 +2946,17 @@ discard block |
||
| 2835 | 2946 | <div id="avatar_gravatar"> |
| 2836 | 2947 | <img src="' . $context['member']['avatar']['href'] . '" alt="" />'; |
| 2837 | 2948 | |
| 2838 | - if (empty($modSettings['gravatarAllowExtraEmail'])) |
|
| 2839 | - echo ' |
|
| 2949 | + if (empty($modSettings['gravatarAllowExtraEmail'])) { |
|
| 2950 | + echo ' |
|
| 2840 | 2951 | <div class="smalltext">', $txt['gravatar_noAlternateEmail'], '</div>'; |
| 2841 | - else |
|
| 2952 | + } else |
|
| 2842 | 2953 | { |
| 2843 | 2954 | // Depending on other stuff, the stored value here might have some odd things in it from other areas. |
| 2844 | - if ($context['member']['avatar']['external'] == $context['member']['email']) |
|
| 2845 | - $textbox_value = ''; |
|
| 2846 | - else |
|
| 2847 | - $textbox_value = $context['member']['avatar']['external']; |
|
| 2955 | + if ($context['member']['avatar']['external'] == $context['member']['email']) { |
|
| 2956 | + $textbox_value = ''; |
|
| 2957 | + } else { |
|
| 2958 | + $textbox_value = $context['member']['avatar']['external']; |
|
| 2959 | + } |
|
| 2848 | 2960 | |
| 2849 | 2961 | echo ' |
| 2850 | 2962 | <div class="smalltext">', $txt['gravatar_alternateEmail'], '</div> |
@@ -2916,8 +3028,9 @@ discard block |
||
| 2916 | 3028 | $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; |
| 2917 | 3029 | |
| 2918 | 3030 | $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); |
| 2919 | - if (empty($suffix)) |
|
| 2920 | - return; |
|
| 3031 | + if (empty($suffix)) { |
|
| 3032 | + return; |
|
| 3033 | + } |
|
| 2921 | 3034 | |
| 2922 | 3035 | echo ' |
| 2923 | 3036 | <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>'; |
@@ -2939,9 +3052,10 @@ discard block |
||
| 2939 | 3052 | <dd> |
| 2940 | 3053 | <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">'; |
| 2941 | 3054 | // Help the user by showing a list of common time formats. |
| 2942 | - foreach ($context['easy_timeformats'] as $time_format) |
|
| 2943 | - echo ' |
|
| 3055 | + foreach ($context['easy_timeformats'] as $time_format) { |
|
| 3056 | + echo ' |
|
| 2944 | 3057 | <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>'; |
| 3058 | + } |
|
| 2945 | 3059 | echo ' |
| 2946 | 3060 | </select><br> |
| 2947 | 3061 | <input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30" class="input_text"> |
@@ -2977,9 +3091,10 @@ discard block |
||
| 2977 | 3091 | </dt> |
| 2978 | 3092 | <dd> |
| 2979 | 3093 | <select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">'; |
| 2980 | - foreach ($context['smiley_sets'] as $set) |
|
| 2981 | - echo ' |
|
| 3094 | + foreach ($context['smiley_sets'] as $set) { |
|
| 3095 | + echo ' |
|
| 2982 | 3096 | <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>'; |
| 3097 | + } |
|
| 2983 | 3098 | echo ' |
| 2984 | 3099 | </select> <img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.gif' : $settings['images_url'] . '/blank.png', '" alt=":)" style="padding-left: 20px;"> |
| 2985 | 3100 | </dd>'; |
@@ -3030,10 +3145,11 @@ discard block |
||
| 3030 | 3145 | </div> |
| 3031 | 3146 | <div class="clear"></div>'; |
| 3032 | 3147 | |
| 3033 | - if (!empty($context['from_ajax'])) |
|
| 3034 | - echo ' |
|
| 3148 | + if (!empty($context['from_ajax'])) { |
|
| 3149 | + echo ' |
|
| 3035 | 3150 | <br> |
| 3036 | 3151 | <a href="javascript:self.close();"></a>'; |
| 3152 | + } |
|
| 3037 | 3153 | |
| 3038 | 3154 | echo ' |
| 3039 | 3155 | </div> |
@@ -3072,15 +3188,16 @@ discard block |
||
| 3072 | 3188 | <br /><div class="smalltext">', $txt['tfa_profile_desc'], '</div> |
| 3073 | 3189 | </dt> |
| 3074 | 3190 | <dd>'; |
| 3075 | - if (!$context['tfa_enabled'] && $context['user']['is_owner']) |
|
| 3076 | - echo ' |
|
| 3191 | + if (!$context['tfa_enabled'] && $context['user']['is_owner']) { |
|
| 3192 | + echo ' |
|
| 3077 | 3193 | <a href="', !empty($modSettings['force_ssl']) && $modSettings['force_ssl'] < 2 ? strtr($scripturl, array('http://' => 'https://')) : $scripturl, '?action=profile;area=tfasetup" id="enable_tfa">', $txt['tfa_profile_enable'], '</a>'; |
| 3078 | - elseif (!$context['tfa_enabled']) |
|
| 3079 | - echo ' |
|
| 3194 | + } elseif (!$context['tfa_enabled']) { |
|
| 3195 | + echo ' |
|
| 3080 | 3196 | ', $txt['tfa_profile_disabled']; |
| 3081 | - else |
|
| 3082 | - echo ' |
|
| 3197 | + } else { |
|
| 3198 | + echo ' |
|
| 3083 | 3199 | ', sprintf($txt['tfa_profile_enabled'], $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=tfasetup;disable'); |
| 3200 | + } |
|
| 3084 | 3201 | echo ' |
| 3085 | 3202 | </dd>'; |
| 3086 | 3203 | } |
@@ -54,9 +54,10 @@ discard block |
||
| 54 | 54 | <dd> |
| 55 | 55 | <div id="known_themes_list">'; |
| 56 | 56 | |
| 57 | - foreach ($context['themes'] as $theme) |
|
| 58 | - echo ' |
|
| 57 | + foreach ($context['themes'] as $theme) { |
|
| 58 | + echo ' |
|
| 59 | 59 | <label for="options-known_themes_', $theme['id'], '"><input type="checkbox" name="options[known_themes][]" id="options-known_themes_', $theme['id'], '" value="', $theme['id'], '"', $theme['known'] ? ' checked' : '', ' class="input_check"> ', $theme['name'], '</label><br>'; |
| 60 | + } |
|
| 60 | 61 | |
| 61 | 62 | echo ' |
| 62 | 63 | </div> |
@@ -73,9 +74,10 @@ discard block |
||
| 73 | 74 | <select name="options[theme_guests]" id="theme_guests">'; |
| 74 | 75 | |
| 75 | 76 | // Put an option for each theme in the select box. |
| 76 | - foreach ($context['themes'] as $theme) |
|
| 77 | - echo ' |
|
| 77 | + foreach ($context['themes'] as $theme) { |
|
| 78 | + echo ' |
|
| 78 | 79 | <option value="', $theme['id'], '"', $modSettings['theme_guests'] == $theme['id'] ? ' selected' : '', '>', $theme['name'], '</option>'; |
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | echo ' |
| 81 | 83 | </select> |
@@ -90,9 +92,10 @@ discard block |
||
| 90 | 92 | <option value="0">', $txt['theme_forum_default'], '</option>'; |
| 91 | 93 | |
| 92 | 94 | // Same thing, this time for changing the theme of everyone. |
| 93 | - foreach ($context['themes'] as $theme) |
|
| 94 | - echo ' |
|
| 95 | + foreach ($context['themes'] as $theme) { |
|
| 96 | + echo ' |
|
| 95 | 97 | <option value="', $theme['id'], '">', $theme['name'], '</option>'; |
| 98 | + } |
|
| 96 | 99 | |
| 97 | 100 | echo ' |
| 98 | 101 | </select> |
@@ -189,11 +192,12 @@ discard block |
||
| 189 | 192 | global $context, $scripturl, $txt; |
| 190 | 193 | |
| 191 | 194 | // Show a nice confirmation message. |
| 192 | - if (isset($_GET['done'])) |
|
| 193 | - echo ' |
|
| 195 | + if (isset($_GET['done'])) { |
|
| 196 | + echo ' |
|
| 194 | 197 | <div class="infobox"> |
| 195 | 198 | ', $txt['theme_confirmed_' . $_GET['done']], ' |
| 196 | 199 | </div>'; |
| 200 | + } |
|
| 197 | 201 | |
| 198 | 202 | echo ' |
| 199 | 203 | <div id="admincenter">'; |
@@ -356,11 +360,12 @@ discard block |
||
| 356 | 360 | if (empty($setting) || !is_array($setting)) |
| 357 | 361 | { |
| 358 | 362 | // Insert a separator (unless this is the first item in the list) |
| 359 | - if ($i !== $first_option_key) |
|
| 360 | - echo ' |
|
| 363 | + if ($i !== $first_option_key) { |
|
| 364 | + echo ' |
|
| 361 | 365 | </dl> |
| 362 | 366 | <hr> |
| 363 | 367 | <dl class="settings">'; |
| 368 | + } |
|
| 364 | 369 | |
| 365 | 370 | // Should we give a name to this section? |
| 366 | 371 | if (is_string($setting) && !empty($setting)) |
@@ -368,9 +373,9 @@ discard block |
||
| 368 | 373 | $titled_section = true; |
| 369 | 374 | echo ' |
| 370 | 375 | <dt><b>' . $setting . '</b></dt><dd></dd>'; |
| 376 | + } else { |
|
| 377 | + $titled_section = false; |
|
| 371 | 378 | } |
| 372 | - else |
|
| 373 | - $titled_section = false; |
|
| 374 | 379 | |
| 375 | 380 | continue; |
| 376 | 381 | } |
@@ -379,19 +384,21 @@ discard block |
||
| 379 | 384 | <dt ', $context['theme_options_reset'] ? 'style="width:50%"' : '', '>'; |
| 380 | 385 | |
| 381 | 386 | // Show the change option box ? |
| 382 | - if ($context['theme_options_reset']) |
|
| 383 | - echo ' |
|
| 387 | + if ($context['theme_options_reset']) { |
|
| 388 | + echo ' |
|
| 384 | 389 | <span class="floatleft"><select name="', !empty($setting['default']) ? 'default_' : '', 'options_master[', $setting['id'], ']" onchange="this.form.options_', $setting['id'], '.disabled = this.selectedIndex != 1;"> |
| 385 | 390 | <option value="0" selected>', $txt['themeadmin_reset_options_none'], '</option> |
| 386 | 391 | <option value="1">', $txt['themeadmin_reset_options_change'], '</option> |
| 387 | 392 | <option value="2">', $txt['themeadmin_reset_options_default'], '</option> |
| 388 | 393 | </select> </span>'; |
| 394 | + } |
|
| 389 | 395 | |
| 390 | 396 | echo ' |
| 391 | 397 | <label for="options_', $setting['id'], '">', !$titled_section ? '<b>' : '', $setting['label'], !$titled_section ? '</b>' : '', '</label>'; |
| 392 | - if (isset($setting['description'])) |
|
| 393 | - echo ' |
|
| 398 | + if (isset($setting['description'])) { |
|
| 399 | + echo ' |
|
| 394 | 400 | <br><span class="smalltext">', $setting['description'], '</span>'; |
| 401 | + } |
|
| 395 | 402 | echo ' |
| 396 | 403 | </dt>'; |
| 397 | 404 | |
@@ -433,13 +440,11 @@ discard block |
||
| 433 | 440 | |
| 434 | 441 | echo ' |
| 435 | 442 | <input type="number"', $min . $max . $step; |
| 436 | - } |
|
| 437 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 443 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 438 | 444 | { |
| 439 | 445 | echo' |
| 440 | 446 | <input type="url"'; |
| 441 | - } |
|
| 442 | - else |
|
| 447 | + } else |
|
| 443 | 448 | { |
| 444 | 449 | echo ' |
| 445 | 450 | <input type="text"'; |
@@ -483,8 +488,8 @@ discard block |
||
| 483 | 488 | <br>'; |
| 484 | 489 | |
| 485 | 490 | // @todo Why can't I edit the default theme popup. |
| 486 | - if ($context['theme_settings']['theme_id'] != 1) |
|
| 487 | - echo ' |
|
| 491 | + if ($context['theme_settings']['theme_id'] != 1) { |
|
| 492 | + echo ' |
|
| 488 | 493 | <div class="cat_bar"> |
| 489 | 494 | <h3 class="catbg config_hd"> |
| 490 | 495 | ', $txt['theme_edit'], ' |
@@ -500,6 +505,7 @@ discard block |
||
| 500 | 505 | </li> |
| 501 | 506 | </ul> |
| 502 | 507 | </div>'; |
| 508 | + } |
|
| 503 | 509 | |
| 504 | 510 | echo ' |
| 505 | 511 | <div class="cat_bar"> |
@@ -553,9 +559,10 @@ discard block |
||
| 553 | 559 | <dd> |
| 554 | 560 | <select id="variant" name="options[default_variant]" onchange="changeVariant(this.value)">'; |
| 555 | 561 | |
| 556 | - foreach ($context['theme_variants'] as $key => $variant) |
|
| 557 | - echo ' |
|
| 562 | + foreach ($context['theme_variants'] as $key => $variant) { |
|
| 563 | + echo ' |
|
| 558 | 564 | <option value="', $key, '"', $context['default_variant'] == $key ? ' selected' : '', '>', $variant['label'], '</option>'; |
| 565 | + } |
|
| 559 | 566 | |
| 560 | 567 | echo ' |
| 561 | 568 | </select> |
@@ -590,11 +597,12 @@ discard block |
||
| 590 | 597 | if (empty($setting) || !is_array($setting)) |
| 591 | 598 | { |
| 592 | 599 | // We don't need a separator before the first list element |
| 593 | - if ($i !== $first_setting_key) |
|
| 594 | - echo ' |
|
| 600 | + if ($i !== $first_setting_key) { |
|
| 601 | + echo ' |
|
| 595 | 602 | </dl> |
| 596 | 603 | <hr> |
| 597 | 604 | <dl class="settings">'; |
| 605 | + } |
|
| 598 | 606 | |
| 599 | 607 | // Add a fake heading? |
| 600 | 608 | if (is_string($setting) && !empty($setting)) |
@@ -602,9 +610,9 @@ discard block |
||
| 602 | 610 | $titled_section = true; |
| 603 | 611 | echo ' |
| 604 | 612 | <dt><b>' . $setting . '</b></dt><dd></dd>'; |
| 613 | + } else { |
|
| 614 | + $titled_section = false; |
|
| 605 | 615 | } |
| 606 | - else |
|
| 607 | - $titled_section = false; |
|
| 608 | 616 | |
| 609 | 617 | continue; |
| 610 | 618 | } |
@@ -613,9 +621,10 @@ discard block |
||
| 613 | 621 | <dt> |
| 614 | 622 | <label for="', $setting['id'], '">', !$titled_section ? '<b>' : '', $setting['label'], !$titled_section ? '</b>' : '', '</label>:'; |
| 615 | 623 | |
| 616 | - if (isset($setting['description'])) |
|
| 617 | - echo '<br> |
|
| 624 | + if (isset($setting['description'])) { |
|
| 625 | + echo '<br> |
|
| 618 | 626 | <span class="smalltext">', $setting['description'], '</span>'; |
| 627 | + } |
|
| 619 | 628 | |
| 620 | 629 | echo ' |
| 621 | 630 | </dt>'; |
@@ -636,9 +645,10 @@ discard block |
||
| 636 | 645 | <dd> |
| 637 | 646 | <select name="', !empty($setting['default']) ? 'default_' : '', 'options[', $setting['id'], ']" id="', $setting['id'], '">'; |
| 638 | 647 | |
| 639 | - foreach ($setting['options'] as $value => $label) |
|
| 640 | - echo ' |
|
| 648 | + foreach ($setting['options'] as $value => $label) { |
|
| 649 | + echo ' |
|
| 641 | 650 | <option value="', $value, '"', $value == $setting['value'] ? ' selected' : '', '>', $label, '</option>'; |
| 651 | + } |
|
| 642 | 652 | |
| 643 | 653 | echo ' |
| 644 | 654 | </select> |
@@ -667,13 +677,11 @@ discard block |
||
| 667 | 677 | |
| 668 | 678 | echo ' |
| 669 | 679 | <input type="number"', $min . $max . $step; |
| 670 | - } |
|
| 671 | - else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 680 | + } else if (isset($setting['type']) && $setting['type'] == 'url') |
|
| 672 | 681 | { |
| 673 | 682 | echo' |
| 674 | 683 | <input type="url"'; |
| 675 | - } |
|
| 676 | - else |
|
| 684 | + } else |
|
| 677 | 685 | { |
| 678 | 686 | echo ' |
| 679 | 687 | <input type="text"'; |
@@ -826,21 +834,23 @@ discard block |
||
| 826 | 834 | <div class="windowbg">'; |
| 827 | 835 | |
| 828 | 836 | // Oops! there was an error :( |
| 829 | - if (!empty($context['error_message'])) |
|
| 830 | - echo ' |
|
| 837 | + if (!empty($context['error_message'])) { |
|
| 838 | + echo ' |
|
| 831 | 839 | <p> |
| 832 | 840 | ', $context['error_message'], ' |
| 833 | 841 | </p>'; |
| 842 | + } |
|
| 834 | 843 | |
| 835 | 844 | // Not much to show except a link back... |
| 836 | - else |
|
| 837 | - echo ' |
|
| 845 | + else { |
|
| 846 | + echo ' |
|
| 838 | 847 | <p> |
| 839 | 848 | <a href="', $scripturl, '?action=admin;area=theme;sa=list;th=', $context['installed_theme']['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $context['installed_theme']['name'], '</a> ', $txt['theme_' . (isset($context['installed_theme']['updated']) ? 'updated' : 'installed') . '_message'], ' |
| 840 | 849 | </p> |
| 841 | 850 | <p> |
| 842 | 851 | <a href="', $scripturl, '?action=admin;area=theme;sa=admin;', $context['session_var'], '=', $context['session_id'], '">', $txt['back'], '</a> |
| 843 | 852 | </p>'; |
| 853 | + } |
|
| 844 | 854 | |
| 845 | 855 | echo ' |
| 846 | 856 | </div> |
@@ -907,10 +917,11 @@ discard block |
||
| 907 | 917 | <span class="floatleft">', $template['filename'], $template['already_exists'] ? ' <span class="error">(' . $txt['themeadmin_edit_exists'] . ')</span>' : '', '</span> |
| 908 | 918 | <span class="floatright">'; |
| 909 | 919 | |
| 910 | - if ($template['can_copy']) |
|
| 911 | - echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
|
| 912 | - else |
|
| 913 | - echo $txt['themeadmin_edit_no_copy']; |
|
| 920 | + if ($template['can_copy']) { |
|
| 921 | + echo '<a href="', $scripturl, '?action=admin;area=theme;th=', $context['theme_id'], ';', $context['session_var'], '=', $context['session_id'], ';sa=copy;template=', $template['value'], '" data-confirm="', $template['already_exists'] ? $txt['themeadmin_edit_overwrite_confirm'] : $txt['themeadmin_edit_copy_confirm'], '" class="you_sure">', $txt['themeadmin_edit_do_copy'], '</a>'; |
|
| 922 | + } else { |
|
| 923 | + echo $txt['themeadmin_edit_no_copy']; |
|
| 924 | + } |
|
| 914 | 925 | |
| 915 | 926 | echo ' |
| 916 | 927 | </span> |
@@ -933,11 +944,12 @@ discard block |
||
| 933 | 944 | echo ' |
| 934 | 945 | <div id="admincenter">'; |
| 935 | 946 | |
| 936 | - if (!empty($context['browse_title'])) |
|
| 937 | - echo ' |
|
| 947 | + if (!empty($context['browse_title'])) { |
|
| 948 | + echo ' |
|
| 938 | 949 | <div class="cat_bar"> |
| 939 | 950 | <h3 class="catbg">', $context['browse_title'], '</h3> |
| 940 | 951 | </div>'; |
| 952 | + } |
|
| 941 | 953 | |
| 942 | 954 | echo ' |
| 943 | 955 | <table class="table_grid tborder"> |
@@ -957,14 +969,13 @@ discard block |
||
| 957 | 969 | <tr class="windowbg"> |
| 958 | 970 | <td>'; |
| 959 | 971 | |
| 960 | - if ($file['is_editable']) |
|
| 961 | - echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 962 | - |
|
| 963 | - elseif ($file['is_directory']) |
|
| 964 | - echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 965 | - |
|
| 966 | - else |
|
| 967 | - echo $file['filename']; |
|
| 972 | + if ($file['is_editable']) { |
|
| 973 | + echo '<a href="', $file['href'], '"', $file['is_template'] ? ' style="font-weight: bold;"' : '', '>', $file['filename'], '</a>'; |
|
| 974 | + } elseif ($file['is_directory']) { |
|
| 975 | + echo '<a href="', $file['href'], '" class="is_directory"><span class="generic_icons folder"></span>', $file['filename'], '</a>'; |
|
| 976 | + } else { |
|
| 977 | + echo $file['filename']; |
|
| 978 | + } |
|
| 968 | 979 | |
| 969 | 980 | echo ' |
| 970 | 981 | </td> |
@@ -986,11 +997,12 @@ discard block |
||
| 986 | 997 | { |
| 987 | 998 | global $context, $settings, $scripturl, $txt; |
| 988 | 999 | |
| 989 | - if ($context['session_error']) |
|
| 990 | - echo ' |
|
| 1000 | + if ($context['session_error']) { |
|
| 1001 | + echo ' |
|
| 991 | 1002 | <div class="errorbox"> |
| 992 | 1003 | ', $txt['error_session_timeout'], ' |
| 993 | 1004 | </div>'; |
| 1005 | + } |
|
| 994 | 1006 | |
| 995 | 1007 | // From now on no one can complain that editing css is difficult. If you disagree, go to www.w3schools.com. |
| 996 | 1008 | echo ' |
@@ -1053,17 +1065,18 @@ discard block |
||
| 1053 | 1065 | try |
| 1054 | 1066 | { |
| 1055 | 1067 | '; |
| 1056 | - if (isBrowser('is_ie')) |
|
| 1057 | - echo ' |
|
| 1068 | + if (isBrowser('is_ie')) { |
|
| 1069 | + echo ' |
|
| 1058 | 1070 | var sheets = frames["css_preview_box"].document.styleSheets; |
| 1059 | 1071 | for (var j = 0; j < sheets.length; j++) |
| 1060 | 1072 | { |
| 1061 | 1073 | if (sheets[j].id == "css_preview_box") |
| 1062 | 1074 | sheets[j].cssText = document.forms.stylesheetForm.entire_file.value; |
| 1063 | 1075 | }'; |
| 1064 | - else |
|
| 1065 | - echo ' |
|
| 1076 | + } else { |
|
| 1077 | + echo ' |
|
| 1066 | 1078 | setInnerHTML(frames["css_preview_box"].document.getElementById("css_preview_sheet"), document.forms.stylesheetForm.entire_file.value);'; |
| 1079 | + } |
|
| 1067 | 1080 | echo ' |
| 1068 | 1081 | } |
| 1069 | 1082 | catch (e) |
@@ -1115,9 +1128,10 @@ discard block |
||
| 1115 | 1128 | </div> |
| 1116 | 1129 | <div class="windowbg">'; |
| 1117 | 1130 | |
| 1118 | - if (!$context['allow_save']) |
|
| 1119 | - echo ' |
|
| 1131 | + if (!$context['allow_save']) { |
|
| 1132 | + echo ' |
|
| 1120 | 1133 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1134 | + } |
|
| 1121 | 1135 | |
| 1122 | 1136 | echo ' |
| 1123 | 1137 | <textarea name="entire_file" cols="80" rows="20" style="width: 96%; font-family: monospace; margin-top: 1ex; white-space: pre;" onkeyup="setPreviewTimeout();" onchange="refreshPreview(true);">', $context['entire_file'], '</textarea><br> |
@@ -1130,9 +1144,10 @@ discard block |
||
| 1130 | 1144 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1131 | 1145 | |
| 1132 | 1146 | // Hopefully it exists. |
| 1133 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1134 | - echo ' |
|
| 1147 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1148 | + echo ' |
|
| 1135 | 1149 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1150 | + } |
|
| 1136 | 1151 | |
| 1137 | 1152 | echo ' |
| 1138 | 1153 | </form> |
@@ -1146,18 +1161,20 @@ discard block |
||
| 1146 | 1161 | { |
| 1147 | 1162 | global $context, $scripturl, $txt; |
| 1148 | 1163 | |
| 1149 | - if ($context['session_error']) |
|
| 1150 | - echo ' |
|
| 1164 | + if ($context['session_error']) { |
|
| 1165 | + echo ' |
|
| 1151 | 1166 | <div class="errorbox"> |
| 1152 | 1167 | ', $txt['error_session_timeout'], ' |
| 1153 | 1168 | </div>'; |
| 1169 | + } |
|
| 1154 | 1170 | |
| 1155 | - if (isset($context['parse_error'])) |
|
| 1156 | - echo ' |
|
| 1171 | + if (isset($context['parse_error'])) { |
|
| 1172 | + echo ' |
|
| 1157 | 1173 | <div class="errorbox"> |
| 1158 | 1174 | ', $txt['themeadmin_edit_error'], ' |
| 1159 | 1175 | <div><pre>', $context['parse_error'], '</pre></div> |
| 1160 | 1176 | </div>'; |
| 1177 | + } |
|
| 1161 | 1178 | |
| 1162 | 1179 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1163 | 1180 | echo ' |
@@ -1168,16 +1185,18 @@ discard block |
||
| 1168 | 1185 | </div> |
| 1169 | 1186 | <div class="windowbg">'; |
| 1170 | 1187 | |
| 1171 | - if (!$context['allow_save']) |
|
| 1172 | - echo ' |
|
| 1188 | + if (!$context['allow_save']) { |
|
| 1189 | + echo ' |
|
| 1173 | 1190 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], '<br>'; |
| 1191 | + } |
|
| 1174 | 1192 | |
| 1175 | - foreach ($context['file_parts'] as $part) |
|
| 1176 | - echo ' |
|
| 1193 | + foreach ($context['file_parts'] as $part) { |
|
| 1194 | + echo ' |
|
| 1177 | 1195 | <label for="on_line', $part['line'], '">', $txt['themeadmin_edit_on_line'], ' ', $part['line'], '</label>:<br> |
| 1178 | 1196 | <div class="centertext"> |
| 1179 | 1197 | <textarea id="on_line', $part['line'], '" name="entire_file[]" cols="80" rows="', $part['lines'] > 14 ? '14' : $part['lines'], '" class="edit_file">', $part['data'], '</textarea> |
| 1180 | 1198 | </div>'; |
| 1199 | + } |
|
| 1181 | 1200 | |
| 1182 | 1201 | echo ' |
| 1183 | 1202 | <div class="padding righttext"> |
@@ -1186,9 +1205,10 @@ discard block |
||
| 1186 | 1205 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1187 | 1206 | |
| 1188 | 1207 | // Hopefully it exists. |
| 1189 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1190 | - echo ' |
|
| 1208 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1209 | + echo ' |
|
| 1191 | 1210 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1211 | + } |
|
| 1192 | 1212 | |
| 1193 | 1213 | echo ' |
| 1194 | 1214 | </div> |
@@ -1204,18 +1224,20 @@ discard block |
||
| 1204 | 1224 | { |
| 1205 | 1225 | global $context, $scripturl, $txt; |
| 1206 | 1226 | |
| 1207 | - if ($context['session_error']) |
|
| 1208 | - echo ' |
|
| 1227 | + if ($context['session_error']) { |
|
| 1228 | + echo ' |
|
| 1209 | 1229 | <div class="errorbox"> |
| 1210 | 1230 | ', $txt['error_session_timeout'], ' |
| 1211 | 1231 | </div>'; |
| 1232 | + } |
|
| 1212 | 1233 | |
| 1213 | 1234 | //Is this file writeable? |
| 1214 | - if (!$context['allow_save']) |
|
| 1215 | - echo ' |
|
| 1235 | + if (!$context['allow_save']) { |
|
| 1236 | + echo ' |
|
| 1216 | 1237 | <div class="errorbox"> |
| 1217 | 1238 | ', $txt['theme_edit_no_save'], ': ', $context['allow_save_filename'], ' |
| 1218 | 1239 | </div>'; |
| 1240 | + } |
|
| 1219 | 1241 | |
| 1220 | 1242 | // Just show a big box.... gray out the Save button if it's not saveable... (ie. not 777.) |
| 1221 | 1243 | echo ' |
@@ -1231,9 +1253,10 @@ discard block |
||
| 1231 | 1253 | <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">'; |
| 1232 | 1254 | |
| 1233 | 1255 | // Hopefully it exists. |
| 1234 | - if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) |
|
| 1235 | - echo ' |
|
| 1256 | + if (isset($context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'])) { |
|
| 1257 | + echo ' |
|
| 1236 | 1258 | <input type="hidden" name="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token_var'], '" value="', $context['admin-te-' . md5($context['theme_id'] . '-' . $context['edit_filename']) . '_token'], '">'; |
| 1259 | + } |
|
| 1237 | 1260 | |
| 1238 | 1261 | echo ' |
| 1239 | 1262 | </div> |