@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | // @todo Tie in with bbc permissions ? |
| 41 | 41 | foreach (array('code', 'php', 'nobbc') as $code) |
| 42 | 42 | { |
| 43 | - if (strpos($text, '['. $code) !== false) |
|
| 43 | + if (strpos($text, '[' . $code) !== false) |
|
| 44 | 44 | { |
| 45 | 45 | $parts = preg_split('~(\[/' . $code . '\]|\[' . $code . '(?:=[^\]]+)?\])~i', $text, -1, PREG_SPLIT_DELIM_CAPTURE); |
| 46 | 46 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | // Parse unique ID's and disable javascript into the smileys - using the double space. |
| 78 | 78 | $i = 1; |
| 79 | 79 | $text = preg_replace_callback('~(?:\s| )?<(img\ssrc="' . preg_quote($modSettings['smileys_url'], '~') . '/[^<>]+?/([^<>]+?)"\s*)[^<>]*?class="smiley">~', |
| 80 | - function ($m) use (&$i) |
|
| 80 | + function($m) use (&$i) |
|
| 81 | 81 | { |
| 82 | 82 | return '<' . stripslashes($m[1]) . 'alt="" title="" onresizestart="return false;" id="smiley_' . $i++ . '_' . $m[2] . '" style="padding: 0 3px 0 3px;">'; |
| 83 | 83 | }, $text); |
@@ -605,10 +605,10 @@ discard block |
||
| 605 | 605 | // Inject closure for this list item first. |
| 606 | 606 | // The content of $parts[$i] is left as is! |
| 607 | 607 | array_splice($parts, $i + 1, 0, array( |
| 608 | - '', // $i + 1 |
|
| 609 | - '[/li]' . "\n", // $i + 2 |
|
| 610 | - '', // $i + 3 |
|
| 611 | - '', // $i + 4 |
|
| 608 | + '', // $i + 1 |
|
| 609 | + '[/li]' . "\n", // $i + 2 |
|
| 610 | + '', // $i + 3 |
|
| 611 | + '', // $i + 4 |
|
| 612 | 612 | )); |
| 613 | 613 | $numParts = count($parts) - 1; |
| 614 | 614 | |
@@ -726,167 +726,167 @@ discard block |
||
| 726 | 726 | |
| 727 | 727 | // The final bits are the easy ones - tags which map to tags which map to tags - etc etc. |
| 728 | 728 | $tags = array( |
| 729 | - '~<b(\s(.)*?)*?' . '>~i' => function () |
|
| 729 | + '~<b(\s(.)*?)*?' . '>~i' => function() |
|
| 730 | 730 | { |
| 731 | 731 | return '[b]'; |
| 732 | 732 | }, |
| 733 | - '~</b>~i' => function () |
|
| 733 | + '~</b>~i' => function() |
|
| 734 | 734 | { |
| 735 | 735 | return '[/b]'; |
| 736 | 736 | }, |
| 737 | - '~<i(\s(.)*?)*?' . '>~i' => function () |
|
| 737 | + '~<i(\s(.)*?)*?' . '>~i' => function() |
|
| 738 | 738 | { |
| 739 | 739 | return '[i]'; |
| 740 | 740 | }, |
| 741 | - '~</i>~i' => function () |
|
| 741 | + '~</i>~i' => function() |
|
| 742 | 742 | { |
| 743 | 743 | return '[/i]'; |
| 744 | 744 | }, |
| 745 | - '~<u(\s(.)*?)*?' . '>~i' => function () |
|
| 745 | + '~<u(\s(.)*?)*?' . '>~i' => function() |
|
| 746 | 746 | { |
| 747 | 747 | return '[u]'; |
| 748 | 748 | }, |
| 749 | - '~</u>~i' => function () |
|
| 749 | + '~</u>~i' => function() |
|
| 750 | 750 | { |
| 751 | 751 | return '[/u]'; |
| 752 | 752 | }, |
| 753 | - '~<strong(\s(.)*?)*?' . '>~i' => function () |
|
| 753 | + '~<strong(\s(.)*?)*?' . '>~i' => function() |
|
| 754 | 754 | { |
| 755 | 755 | return '[b]'; |
| 756 | 756 | }, |
| 757 | - '~</strong>~i' => function () |
|
| 757 | + '~</strong>~i' => function() |
|
| 758 | 758 | { |
| 759 | 759 | return '[/b]'; |
| 760 | 760 | }, |
| 761 | - '~<em(\s(.)*?)*?' . '>~i' => function () |
|
| 761 | + '~<em(\s(.)*?)*?' . '>~i' => function() |
|
| 762 | 762 | { |
| 763 | 763 | return '[i]'; |
| 764 | 764 | }, |
| 765 | - '~</em>~i' => function () |
|
| 765 | + '~</em>~i' => function() |
|
| 766 | 766 | { |
| 767 | 767 | return '[i]'; |
| 768 | 768 | }, |
| 769 | - '~<s(\s(.)*?)*?' . '>~i' => function () |
|
| 769 | + '~<s(\s(.)*?)*?' . '>~i' => function() |
|
| 770 | 770 | { |
| 771 | 771 | return "[s]"; |
| 772 | 772 | }, |
| 773 | - '~</s>~i' => function () |
|
| 773 | + '~</s>~i' => function() |
|
| 774 | 774 | { |
| 775 | 775 | return "[/s]"; |
| 776 | 776 | }, |
| 777 | - '~<strike(\s(.)*?)*?' . '>~i' => function () |
|
| 777 | + '~<strike(\s(.)*?)*?' . '>~i' => function() |
|
| 778 | 778 | { |
| 779 | 779 | return '[s]'; |
| 780 | 780 | }, |
| 781 | - '~</strike>~i' => function () |
|
| 781 | + '~</strike>~i' => function() |
|
| 782 | 782 | { |
| 783 | 783 | return '[/s]'; |
| 784 | 784 | }, |
| 785 | - '~<del(\s(.)*?)*?' . '>~i' => function () |
|
| 785 | + '~<del(\s(.)*?)*?' . '>~i' => function() |
|
| 786 | 786 | { |
| 787 | 787 | return '[s]'; |
| 788 | 788 | }, |
| 789 | - '~</del>~i' => function () |
|
| 789 | + '~</del>~i' => function() |
|
| 790 | 790 | { |
| 791 | 791 | return '[/s]'; |
| 792 | 792 | }, |
| 793 | - '~<center(\s(.)*?)*?' . '>~i' => function () |
|
| 793 | + '~<center(\s(.)*?)*?' . '>~i' => function() |
|
| 794 | 794 | { |
| 795 | 795 | return '[center]'; |
| 796 | 796 | }, |
| 797 | - '~</center>~i' => function () |
|
| 797 | + '~</center>~i' => function() |
|
| 798 | 798 | { |
| 799 | 799 | return '[/center]'; |
| 800 | 800 | }, |
| 801 | - '~<pre(\s(.)*?)*?' . '>~i' => function () |
|
| 801 | + '~<pre(\s(.)*?)*?' . '>~i' => function() |
|
| 802 | 802 | { |
| 803 | 803 | return '[pre]'; |
| 804 | 804 | }, |
| 805 | - '~</pre>~i' => function () |
|
| 805 | + '~</pre>~i' => function() |
|
| 806 | 806 | { |
| 807 | 807 | return '[/pre]'; |
| 808 | 808 | }, |
| 809 | - '~<sub(\s(.)*?)*?' . '>~i' => function () |
|
| 809 | + '~<sub(\s(.)*?)*?' . '>~i' => function() |
|
| 810 | 810 | { |
| 811 | 811 | return '[sub]'; |
| 812 | 812 | }, |
| 813 | - '~</sub>~i' => function () |
|
| 813 | + '~</sub>~i' => function() |
|
| 814 | 814 | { |
| 815 | 815 | return '[/sub]'; |
| 816 | 816 | }, |
| 817 | - '~<sup(\s(.)*?)*?' . '>~i' => function () |
|
| 817 | + '~<sup(\s(.)*?)*?' . '>~i' => function() |
|
| 818 | 818 | { |
| 819 | 819 | return '[sup]'; |
| 820 | 820 | }, |
| 821 | - '~</sup>~i' => function () |
|
| 821 | + '~</sup>~i' => function() |
|
| 822 | 822 | { |
| 823 | 823 | return '[/sup]'; |
| 824 | 824 | }, |
| 825 | - '~<tt(\s(.)*?)*?' . '>~i' => function () |
|
| 825 | + '~<tt(\s(.)*?)*?' . '>~i' => function() |
|
| 826 | 826 | { |
| 827 | 827 | return '[tt]'; |
| 828 | 828 | }, |
| 829 | - '~</tt>~i' => function () |
|
| 829 | + '~</tt>~i' => function() |
|
| 830 | 830 | { |
| 831 | 831 | return '[/tt]'; |
| 832 | 832 | }, |
| 833 | - '~<table(\s(.)*?)*?' . '>~i' => function () |
|
| 833 | + '~<table(\s(.)*?)*?' . '>~i' => function() |
|
| 834 | 834 | { |
| 835 | 835 | return '[table]'; |
| 836 | 836 | }, |
| 837 | - '~</table>~i' => function () |
|
| 837 | + '~</table>~i' => function() |
|
| 838 | 838 | { |
| 839 | 839 | return '[/table]'; |
| 840 | 840 | }, |
| 841 | - '~<tr(\s(.)*?)*?' . '>~i' => function () |
|
| 841 | + '~<tr(\s(.)*?)*?' . '>~i' => function() |
|
| 842 | 842 | { |
| 843 | 843 | return '[tr]'; |
| 844 | 844 | }, |
| 845 | - '~</tr>~i' => function () |
|
| 845 | + '~</tr>~i' => function() |
|
| 846 | 846 | { |
| 847 | 847 | return '[/tr]'; |
| 848 | 848 | }, |
| 849 | - '~<(td|th)\s[^<>]*?colspan="?(\d{1,2})"?.*?' . '>~i' => function ($matches) |
|
| 849 | + '~<(td|th)\s[^<>]*?colspan="?(\d{1,2})"?.*?' . '>~i' => function($matches) |
|
| 850 | 850 | { |
| 851 | 851 | return str_repeat('[td][/td]', $matches[2] - 1) . '[td]'; |
| 852 | 852 | }, |
| 853 | - '~<(td|th)(\s(.)*?)*?' . '>~i' => function () |
|
| 853 | + '~<(td|th)(\s(.)*?)*?' . '>~i' => function() |
|
| 854 | 854 | { |
| 855 | 855 | return '[td]'; |
| 856 | 856 | }, |
| 857 | - '~</(td|th)>~i' => function () |
|
| 857 | + '~</(td|th)>~i' => function() |
|
| 858 | 858 | { |
| 859 | 859 | return '[/td]'; |
| 860 | 860 | }, |
| 861 | - '~<br(?:\s[^<>]*?)?' . '>~i' => function () |
|
| 861 | + '~<br(?:\s[^<>]*?)?' . '>~i' => function() |
|
| 862 | 862 | { |
| 863 | 863 | return "\n"; |
| 864 | 864 | }, |
| 865 | - '~<hr[^<>]*>(\n)?~i' => function ($matches) |
|
| 865 | + '~<hr[^<>]*>(\n)?~i' => function($matches) |
|
| 866 | 866 | { |
| 867 | - return "[hr]\n". $matches[0]; |
|
| 867 | + return "[hr]\n" . $matches[0]; |
|
| 868 | 868 | }, |
| 869 | - '~(\n)?\\[hr\\]~i' => function () |
|
| 869 | + '~(\n)?\\[hr\\]~i' => function() |
|
| 870 | 870 | { |
| 871 | 871 | return "\n[hr]"; |
| 872 | 872 | }, |
| 873 | - '~^\n\\[hr\\]~i' => function () |
|
| 873 | + '~^\n\\[hr\\]~i' => function() |
|
| 874 | 874 | { |
| 875 | 875 | return "[hr]"; |
| 876 | 876 | }, |
| 877 | - '~<blockquote(\s(.)*?)*?' . '>~i' => function () |
|
| 877 | + '~<blockquote(\s(.)*?)*?' . '>~i' => function() |
|
| 878 | 878 | { |
| 879 | 879 | return "<blockquote>"; |
| 880 | 880 | }, |
| 881 | - '~</blockquote>~i' => function () |
|
| 881 | + '~</blockquote>~i' => function() |
|
| 882 | 882 | { |
| 883 | 883 | return "</blockquote>"; |
| 884 | 884 | }, |
| 885 | - '~<ins(\s(.)*?)*?' . '>~i' => function () |
|
| 885 | + '~<ins(\s(.)*?)*?' . '>~i' => function() |
|
| 886 | 886 | { |
| 887 | 887 | return "<ins>"; |
| 888 | 888 | }, |
| 889 | - '~</ins>~i' => function () |
|
| 889 | + '~</ins>~i' => function() |
|
| 890 | 890 | { |
| 891 | 891 | return "</ins>"; |
| 892 | 892 | }, |
@@ -2391,7 +2391,7 @@ discard block |
||
| 2391 | 2391 | array( |
| 2392 | 2392 | 'group_name' => $smcFunc['db_case_sensitive'] ? 'LOWER(group_name}' : 'group_name', |
| 2393 | 2393 | 'min_posts' => -1, |
| 2394 | - 'invalid_groups' => array(1,3), |
|
| 2394 | + 'invalid_groups' => array(1, 3), |
|
| 2395 | 2395 | 'hidden' => 2, |
| 2396 | 2396 | 'search' => $_REQUEST['search'], |
| 2397 | 2397 | ) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | else |
| 238 | 238 | { |
| 239 | 239 | $query_this_board = '{query_wanna_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? ' |
| 240 | - AND b.id_board != {int:recycle_board}' : ''). ' |
|
| 240 | + AND b.id_board != {int:recycle_board}' : '') . ' |
|
| 241 | 241 | AND m.id_msg >= {int:max_id_msg}'; |
| 242 | 242 | $query_parameters['max_id_msg'] = max(0, $modSettings['maxMsgID'] - 100 - $_REQUEST['start'] * 6); |
| 243 | 243 | $query_parameters['recycle_board'] = $modSettings['recycle_board']; |
@@ -1124,7 +1124,7 @@ discard block |
||
| 1124 | 1124 | ); |
| 1125 | 1125 | else |
| 1126 | 1126 | $request = $smcFunc['db_query']('', ' |
| 1127 | - SELECT DISTINCT t.id_topic,'.$_REQUEST['sort'].' |
|
| 1127 | + SELECT DISTINCT t.id_topic,'.$_REQUEST['sort'] . ' |
|
| 1128 | 1128 | FROM {db_prefix}topics AS t |
| 1129 | 1129 | INNER JOIN {db_prefix}messages AS m ON (m.id_topic = t.id_topic AND m.id_member = {int:current_member})' . (strpos($_REQUEST['sort'], 'ms.') === false ? '' : ' |
| 1130 | 1130 | INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)') . (strpos($_REQUEST['sort'], 'mems.') === false ? '' : ' |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | if ($is_topics) |
| 1392 | 1392 | { |
| 1393 | 1393 | $context['recent_buttons'] = array( |
| 1394 | - 'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.png', 'custom' => 'data-confirm="'. $txt['are_sure_mark_read'] .'"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1394 | + 'markread' => array('text' => !empty($context['no_board_limits']) ? 'mark_as_read' : 'mark_read_short', 'image' => 'markread.png', 'custom' => 'data-confirm="' . $txt['are_sure_mark_read'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=' . (!empty($context['no_board_limits']) ? 'all' : 'board' . $context['querystring_board_limits']) . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1395 | 1395 | ); |
| 1396 | 1396 | |
| 1397 | 1397 | if ($context['showCheckboxes']) |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | elseif (!$is_topics && isset($context['topics_to_mark'])) |
| 1408 | 1408 | { |
| 1409 | 1409 | $context['recent_buttons'] = array( |
| 1410 | - 'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'custom' => 'data-confirm="'. $txt['are_sure_mark_read'] .'"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1410 | + 'markread' => array('text' => 'mark_as_read', 'image' => 'markread.png', 'custom' => 'data-confirm="' . $txt['are_sure_mark_read'] . '"', 'class' => 'you_sure', 'url' => $scripturl . '?action=markasread;sa=unreadreplies;topics=' . $context['topics_to_mark'] . ';' . $context['session_var'] . '=' . $context['session_id']), |
|
| 1411 | 1411 | ); |
| 1412 | 1412 | |
| 1413 | 1413 | if ($context['showCheckboxes']) |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | 'height' => array('optional' => true, 'match' => '(\d+)'), |
| 1098 | 1098 | ), |
| 1099 | 1099 | 'content' => '$1', |
| 1100 | - 'validate' => function (&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1100 | + 'validate' => function(&$tag, &$data, $disabled, $params) use ($modSettings, $context, $sourcedir, $txt) |
|
| 1101 | 1101 | { |
| 1102 | 1102 | $returnContext = ''; |
| 1103 | 1103 | |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | |
| 1146 | 1146 | if ($currentAttachment['thumbnail']['has_thumb'] && empty($params['{width}']) && empty($params['{height}'])) |
| 1147 | 1147 | $returnContext .= ' |
| 1148 | - <a href="'. $currentAttachment['href']. ';image" id="link_'. $currentAttachment['id']. '" onclick="'. $currentAttachment['thumbnail']['javascript']. '"><img src="'. $currentAttachment['thumbnail']['href']. '" alt="' . $currentAttachment['name'] . '" id="thumb_'. $currentAttachment['id']. '"></a>'; |
|
| 1148 | + <a href="'. $currentAttachment['href'] . ';image" id="link_' . $currentAttachment['id'] . '" onclick="' . $currentAttachment['thumbnail']['javascript'] . '"><img src="' . $currentAttachment['thumbnail']['href'] . '" alt="' . $currentAttachment['name'] . '" id="thumb_' . $currentAttachment['id'] . '"></a>'; |
|
| 1149 | 1149 | else |
| 1150 | 1150 | $returnContext .= ' |
| 1151 | 1151 | <img src="' . $currentAttachment['href'] . ';image" alt="' . $currentAttachment['name'] . '"' . $width . $height . '/>'; |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | 'type' => 'unparsed_content', |
| 1176 | 1176 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
| 1177 | 1177 | // @todo Maybe this can be simplified? |
| 1178 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1178 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1179 | 1179 | { |
| 1180 | 1180 | if (!isset($disabled['code'])) |
| 1181 | 1181 | { |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | 'type' => 'unparsed_equals_content', |
| 1213 | 1213 | 'content' => '<div class="codeheader"><span class="code floatleft">' . $txt['code'] . '</span> ($2) <a class="codeoperation smf_select_text">' . $txt['code_select'] . '</a></div><code class="bbc_code">$1</code>', |
| 1214 | 1214 | // @todo Maybe this can be simplified? |
| 1215 | - 'validate' => isset($disabled['code']) ? null : function (&$tag, &$data, $disabled) use ($context) |
|
| 1215 | + 'validate' => isset($disabled['code']) ? null : function(&$tag, &$data, $disabled) use ($context) |
|
| 1216 | 1216 | { |
| 1217 | 1217 | if (!isset($disabled['code'])) |
| 1218 | 1218 | { |
@@ -1256,7 +1256,7 @@ discard block |
||
| 1256 | 1256 | 'type' => 'unparsed_content', |
| 1257 | 1257 | 'content' => '<a href="mailto:$1" class="bbc_email">$1</a>', |
| 1258 | 1258 | // @todo Should this respect guest_hideContacts? |
| 1259 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1259 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1260 | 1260 | { |
| 1261 | 1261 | $data = strtr($data, array('<br>' => '')); |
| 1262 | 1262 | }, |
@@ -1275,7 +1275,7 @@ discard block |
||
| 1275 | 1275 | 'type' => 'unparsed_commas_content', |
| 1276 | 1276 | 'test' => '\d+,\d+\]', |
| 1277 | 1277 | 'content' => '<embed type="application/x-shockwave-flash" src="$1" width="$2" height="$3" play="true" loop="true" quality="high" AllowScriptAccess="never">', |
| 1278 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1278 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1279 | 1279 | { |
| 1280 | 1280 | if (isset($disabled['url'])) |
| 1281 | 1281 | $tag['content'] = '$1'; |
@@ -1320,7 +1320,7 @@ discard block |
||
| 1320 | 1320 | 'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'), |
| 1321 | 1321 | ), |
| 1322 | 1322 | 'content' => '<img src="$1" alt="{alt}" title="{title}"{width}{height} class="bbc_img resized">', |
| 1323 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1323 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1324 | 1324 | { |
| 1325 | 1325 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
| 1326 | 1326 | |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | 'tag' => 'img', |
| 1344 | 1344 | 'type' => 'unparsed_content', |
| 1345 | 1345 | 'content' => '<img src="$1" alt="" class="bbc_img">', |
| 1346 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1346 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1347 | 1347 | { |
| 1348 | 1348 | global $image_proxy_enabled, $image_proxy_secret, $boardurl; |
| 1349 | 1349 | |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | 'tag' => 'iurl', |
| 1367 | 1367 | 'type' => 'unparsed_content', |
| 1368 | 1368 | 'content' => '<a href="$1" class="bbc_link">$1</a>', |
| 1369 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1369 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1370 | 1370 | { |
| 1371 | 1371 | $data = strtr($data, array('<br>' => '')); |
| 1372 | 1372 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1380,7 +1380,7 @@ discard block |
||
| 1380 | 1380 | 'quoted' => 'optional', |
| 1381 | 1381 | 'before' => '<a href="$1" class="bbc_link">', |
| 1382 | 1382 | 'after' => '</a>', |
| 1383 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1383 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1384 | 1384 | { |
| 1385 | 1385 | if (substr($data, 0, 1) == '#') |
| 1386 | 1386 | $data = '#post_' . substr($data, 1); |
@@ -1460,7 +1460,7 @@ discard block |
||
| 1460 | 1460 | 'tag' => 'php', |
| 1461 | 1461 | 'type' => 'unparsed_content', |
| 1462 | 1462 | 'content' => '<span class="phpcode">$1</span>', |
| 1463 | - 'validate' => isset($disabled['php']) ? null : function (&$tag, &$data, $disabled) |
|
| 1463 | + 'validate' => isset($disabled['php']) ? null : function(&$tag, &$data, $disabled) |
|
| 1464 | 1464 | { |
| 1465 | 1465 | if (!isset($disabled['php'])) |
| 1466 | 1466 | { |
@@ -1558,7 +1558,7 @@ discard block |
||
| 1558 | 1558 | 'test' => '[1-7]\]', |
| 1559 | 1559 | 'before' => '<span style="font-size: $1;" class="bbc_size">', |
| 1560 | 1560 | 'after' => '</span>', |
| 1561 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1561 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1562 | 1562 | { |
| 1563 | 1563 | $sizes = array(1 => 0.7, 2 => 1.0, 3 => 1.35, 4 => 1.45, 5 => 2.0, 6 => 2.65, 7 => 3.95); |
| 1564 | 1564 | $data = $sizes[$data] . 'em'; |
@@ -1596,7 +1596,7 @@ discard block |
||
| 1596 | 1596 | 'tag' => 'time', |
| 1597 | 1597 | 'type' => 'unparsed_content', |
| 1598 | 1598 | 'content' => '$1', |
| 1599 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1599 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1600 | 1600 | { |
| 1601 | 1601 | if (is_numeric($data)) |
| 1602 | 1602 | $data = timeformat($data); |
@@ -1624,7 +1624,7 @@ discard block |
||
| 1624 | 1624 | 'tag' => 'url', |
| 1625 | 1625 | 'type' => 'unparsed_content', |
| 1626 | 1626 | 'content' => '<a href="$1" class="bbc_link" target="_blank">$1</a>', |
| 1627 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1627 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1628 | 1628 | { |
| 1629 | 1629 | $data = strtr($data, array('<br>' => '')); |
| 1630 | 1630 | $scheme = parse_url($data, PHP_URL_SCHEME); |
@@ -1638,7 +1638,7 @@ discard block |
||
| 1638 | 1638 | 'quoted' => 'optional', |
| 1639 | 1639 | 'before' => '<a href="$1" class="bbc_link" target="_blank">', |
| 1640 | 1640 | 'after' => '</a>', |
| 1641 | - 'validate' => function (&$tag, &$data, $disabled) |
|
| 1641 | + 'validate' => function(&$tag, &$data, $disabled) |
|
| 1642 | 1642 | { |
| 1643 | 1643 | $scheme = parse_url($data, PHP_URL_SCHEME); |
| 1644 | 1644 | if (empty($scheme)) |
@@ -1664,7 +1664,7 @@ discard block |
||
| 1664 | 1664 | { |
| 1665 | 1665 | if (isset($temp_bbc)) |
| 1666 | 1666 | $bbc_codes = $temp_bbc; |
| 1667 | - usort($codes, function ($a, $b) { |
|
| 1667 | + usort($codes, function($a, $b) { |
|
| 1668 | 1668 | return strcmp($a['tag'], $b['tag']); |
| 1669 | 1669 | }); |
| 1670 | 1670 | return $codes; |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | # a run of Unicode domain name characters and a dot |
| 1905 | 1905 | [\p{L}\p{M}\p{N}\-.:@]+\. |
| 1906 | 1906 | # and then a TLD valid in the DNS or the reserved "local" TLD |
| 1907 | - (?:'. $modSettings['tld_regex'] .'|local) |
|
| 1907 | + (?:'. $modSettings['tld_regex'] . '|local) |
|
| 1908 | 1908 | ) |
| 1909 | 1909 | # followed by a non-domain character or end of line |
| 1910 | 1910 | (?=[^\p{L}\p{N}\-.]|$) |
@@ -1972,7 +1972,7 @@ discard block |
||
| 1972 | 1972 | )? |
| 1973 | 1973 | '; |
| 1974 | 1974 | |
| 1975 | - $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function ($matches) { |
|
| 1975 | + $data = preg_replace_callback('~' . $url_regex . '~xi' . ($context['utf8'] ? 'u' : ''), function($matches) { |
|
| 1976 | 1976 | $url = array_shift($matches); |
| 1977 | 1977 | |
| 1978 | 1978 | $scheme = parse_url($url, PHP_URL_SCHEME); |
@@ -2701,7 +2701,7 @@ discard block |
||
| 2701 | 2701 | for ($i = 0, $n = count($smileysfrom); $i < $n; $i++) |
| 2702 | 2702 | { |
| 2703 | 2703 | $specialChars = $smcFunc['htmlspecialchars']($smileysfrom[$i], ENT_QUOTES); |
| 2704 | - $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')). '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2704 | + $smileyCode = '<img src="' . $smileys_path . $smileysto[$i] . '" alt="' . strtr($specialChars, array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" title="' . strtr($smcFunc['htmlspecialchars']($smileysdescs[$i]), array(':' => ':', '(' => '(', ')' => ')', '$' => '$', '[' => '[')) . '" class="smiley">'; |
|
| 2705 | 2705 | |
| 2706 | 2706 | $smileyPregReplacements[$smileysfrom[$i]] = $smileyCode; |
| 2707 | 2707 | |
@@ -2718,7 +2718,7 @@ discard block |
||
| 2718 | 2718 | |
| 2719 | 2719 | // Replace away! |
| 2720 | 2720 | $message = preg_replace_callback($smileyPregSearch, |
| 2721 | - function ($matches) use ($smileyPregReplacements) |
|
| 2721 | + function($matches) use ($smileyPregReplacements) |
|
| 2722 | 2722 | { |
| 2723 | 2723 | return $smileyPregReplacements[$matches[1]]; |
| 2724 | 2724 | }, $message); |
@@ -2784,13 +2784,13 @@ discard block |
||
| 2784 | 2784 | { |
| 2785 | 2785 | if (defined('SID') && SID != '') |
| 2786 | 2786 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&))((?:board|topic)=[^#]+?)(#[^"]*?)?$~', |
| 2787 | - function ($m) use ($scripturl) |
|
| 2787 | + function($m) use ($scripturl) |
|
| 2788 | 2788 | { |
| 2789 | - return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID. (isset($m[2]) ? "$m[2]" : ""); |
|
| 2789 | + return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html?' . SID . (isset($m[2]) ? "$m[2]" : ""); |
|
| 2790 | 2790 | }, $setLocation); |
| 2791 | 2791 | else |
| 2792 | 2792 | $setLocation = preg_replace_callback('~^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$~', |
| 2793 | - function ($m) use ($scripturl) |
|
| 2793 | + function($m) use ($scripturl) |
|
| 2794 | 2794 | { |
| 2795 | 2795 | return $scripturl . '/' . strtr("$m[1]", '&;=', '//,') . '.html' . (isset($m[2]) ? "$m[2]" : ""); |
| 2796 | 2796 | }, $setLocation); |
@@ -3113,7 +3113,7 @@ discard block |
||
| 3113 | 3113 | |
| 3114 | 3114 | // Add a generic "Are you sure?" confirmation message. |
| 3115 | 3115 | addInlineJavaScript(' |
| 3116 | - var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) .';'); |
|
| 3116 | + var smf_you_sure =' . JavaScriptEscape($txt['quickmod_confirm']) . ';'); |
|
| 3117 | 3117 | |
| 3118 | 3118 | // Now add the capping code for avatars. |
| 3119 | 3119 | if (!empty($modSettings['avatar_max_width_external']) && !empty($modSettings['avatar_max_height_external']) && !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_css_resize') |
@@ -3477,7 +3477,7 @@ discard block |
||
| 3477 | 3477 | |
| 3478 | 3478 | else |
| 3479 | 3479 | echo ' |
| 3480 | - <script src="', $settings['theme_url'] ,'/scripts/minified', ($do_deferred ? '_deferred' : '') ,'.js', $minSeed ,'"></script>'; |
|
| 3480 | + <script src="', $settings['theme_url'], '/scripts/minified', ($do_deferred ? '_deferred' : ''), '.js', $minSeed, '"></script>'; |
|
| 3481 | 3481 | } |
| 3482 | 3482 | |
| 3483 | 3483 | // Inline JavaScript - Actually useful some times! |
@@ -3555,14 +3555,14 @@ discard block |
||
| 3555 | 3555 | |
| 3556 | 3556 | else |
| 3557 | 3557 | echo ' |
| 3558 | - <link rel="stylesheet" href="', $settings['theme_url'] ,'/css/minified.css', $minSeed ,'">'; |
|
| 3558 | + <link rel="stylesheet" href="', $settings['theme_url'], '/css/minified.css', $minSeed, '">'; |
|
| 3559 | 3559 | } |
| 3560 | 3560 | |
| 3561 | 3561 | // Print the rest after the minified files. |
| 3562 | 3562 | if (!empty($normal)) |
| 3563 | 3563 | foreach ($normal as $nf) |
| 3564 | 3564 | echo ' |
| 3565 | - <link rel="stylesheet" href="', $nf ,'">'; |
|
| 3565 | + <link rel="stylesheet" href="', $nf, '">'; |
|
| 3566 | 3566 | |
| 3567 | 3567 | if ($db_show_debug === true) |
| 3568 | 3568 | { |
@@ -3578,7 +3578,7 @@ discard block |
||
| 3578 | 3578 | <style>'; |
| 3579 | 3579 | |
| 3580 | 3580 | foreach ($context['css_header'] as $css) |
| 3581 | - echo $css .' |
|
| 3581 | + echo $css . ' |
|
| 3582 | 3582 | '; |
| 3583 | 3583 | |
| 3584 | 3584 | echo' |
@@ -3608,7 +3608,7 @@ discard block |
||
| 3608 | 3608 | return false; |
| 3609 | 3609 | |
| 3610 | 3610 | // Did we already did this? |
| 3611 | - $toCache = cache_get_data('minimized_'. $settings['theme_id'] .'_'. $type, 86400); |
|
| 3611 | + $toCache = cache_get_data('minimized_' . $settings['theme_id'] . '_' . $type, 86400); |
|
| 3612 | 3612 | |
| 3613 | 3613 | // Already done? |
| 3614 | 3614 | if (!empty($toCache)) |
@@ -3616,25 +3616,25 @@ discard block |
||
| 3616 | 3616 | |
| 3617 | 3617 | // Yep, need a bunch of files. |
| 3618 | 3618 | require_once($sourcedir . '/minify/src/Minify.php'); |
| 3619 | - require_once($sourcedir . '/minify/src/'. strtoupper($type) .'.php'); |
|
| 3619 | + require_once($sourcedir . '/minify/src/' . strtoupper($type) . '.php'); |
|
| 3620 | 3620 | require_once($sourcedir . '/minify/src/Exception.php'); |
| 3621 | 3621 | require_once($sourcedir . '/minify/src/Converter.php'); |
| 3622 | 3622 | |
| 3623 | 3623 | // No namespaces, sorry! |
| 3624 | - $classType = 'MatthiasMullie\\Minify\\'. strtoupper($type); |
|
| 3624 | + $classType = 'MatthiasMullie\\Minify\\' . strtoupper($type); |
|
| 3625 | 3625 | |
| 3626 | 3626 | // Temp path. |
| 3627 | - $cTempPath = $settings['theme_dir'] .'/'. ($type == 'css' ? 'css' : 'scripts') .'/'; |
|
| 3627 | + $cTempPath = $settings['theme_dir'] . '/' . ($type == 'css' ? 'css' : 'scripts') . '/'; |
|
| 3628 | 3628 | |
| 3629 | 3629 | // What kind of file are we going to create? |
| 3630 | - $toCreate = $cTempPath .'minified'. ($do_deferred ? '_deferred' : '') .'.'. $type; |
|
| 3630 | + $toCreate = $cTempPath . 'minified' . ($do_deferred ? '_deferred' : '') . '.' . $type; |
|
| 3631 | 3631 | |
| 3632 | 3632 | // File has to exists, if it isn't try to create it. |
| 3633 | 3633 | if ((!file_exists($toCreate) && @fopen($toCreate, 'w') === false) || !smf_chmod($toCreate)) |
| 3634 | 3634 | { |
| 3635 | 3635 | loadLanguage('Errors'); |
| 3636 | 3636 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3637 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3637 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3638 | 3638 | |
| 3639 | 3639 | // The process failed so roll back to print each individual file. |
| 3640 | 3640 | return $data; |
@@ -3669,14 +3669,14 @@ discard block |
||
| 3669 | 3669 | { |
| 3670 | 3670 | loadLanguage('Errors'); |
| 3671 | 3671 | log_error(sprintf($txt['file_not_created'], $toCreate), 'general'); |
| 3672 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, null); |
|
| 3672 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, null); |
|
| 3673 | 3673 | |
| 3674 | 3674 | // The process failed so roll back to print each individual file. |
| 3675 | 3675 | return $data; |
| 3676 | 3676 | } |
| 3677 | 3677 | |
| 3678 | 3678 | // And create a long lived cache entry. |
| 3679 | - cache_put_data('minimized_'. $settings['theme_id'] .'_'. $type, $toCreate, 86400); |
|
| 3679 | + cache_put_data('minimized_' . $settings['theme_id'] . '_' . $type, $toCreate, 86400); |
|
| 3680 | 3680 | |
| 3681 | 3681 | return true; |
| 3682 | 3682 | } |
@@ -3733,7 +3733,7 @@ discard block |
||
| 3733 | 3733 | else |
| 3734 | 3734 | $path = $modSettings['attachmentUploadDir']; |
| 3735 | 3735 | |
| 3736 | - return $path . '/' . $attachment_id . '_' . $file_hash .'.dat'; |
|
| 3736 | + return $path . '/' . $attachment_id . '_' . $file_hash . '.dat'; |
|
| 3737 | 3737 | } |
| 3738 | 3738 | |
| 3739 | 3739 | /** |
@@ -3777,10 +3777,10 @@ discard block |
||
| 3777 | 3777 | $valid_low = isValidIP($ip_parts[0]); |
| 3778 | 3778 | $valid_high = isValidIP($ip_parts[1]); |
| 3779 | 3779 | $count = 0; |
| 3780 | - $mode = (preg_match('/:/',$ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3780 | + $mode = (preg_match('/:/', $ip_parts[0]) > 0 ? ':' : '.'); |
|
| 3781 | 3781 | $max = ($mode == ':' ? 'ffff' : '255'); |
| 3782 | 3782 | $min = 0; |
| 3783 | - if(!$valid_low) |
|
| 3783 | + if (!$valid_low) |
|
| 3784 | 3784 | { |
| 3785 | 3785 | $ip_parts[0] = preg_replace('/\*/', '0', $ip_parts[0]); |
| 3786 | 3786 | $valid_low = isValidIP($ip_parts[0]); |
@@ -3794,7 +3794,7 @@ discard block |
||
| 3794 | 3794 | } |
| 3795 | 3795 | |
| 3796 | 3796 | $count = 0; |
| 3797 | - if(!$valid_high) |
|
| 3797 | + if (!$valid_high) |
|
| 3798 | 3798 | { |
| 3799 | 3799 | $ip_parts[1] = preg_replace('/\*/', $max, $ip_parts[1]); |
| 3800 | 3800 | $valid_high = isValidIP($ip_parts[1]); |
@@ -3807,7 +3807,7 @@ discard block |
||
| 3807 | 3807 | } |
| 3808 | 3808 | } |
| 3809 | 3809 | |
| 3810 | - if($valid_high && $valid_low) |
|
| 3810 | + if ($valid_high && $valid_low) |
|
| 3811 | 3811 | { |
| 3812 | 3812 | $ip_array['low'] = $ip_parts[0]; |
| 3813 | 3813 | $ip_array['high'] = $ip_parts[1]; |
@@ -4080,7 +4080,7 @@ discard block |
||
| 4080 | 4080 | addInlineJavaScript(' |
| 4081 | 4081 | var user_menus = new smc_PopupMenu(); |
| 4082 | 4082 | user_menus.add("profile", "' . $scripturl . '?action=profile;area=popup"); |
| 4083 | - user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u='. $context['user']['id'] .'");', true); |
|
| 4083 | + user_menus.add("alerts", "' . $scripturl . '?action=profile;area=alerts_popup;u=' . $context['user']['id'] . '");', true); |
|
| 4084 | 4084 | if ($context['allow_pm']) |
| 4085 | 4085 | addInlineJavaScript(' |
| 4086 | 4086 | user_menus.add("pm", "' . $scripturl . '?action=pm;sa=popup");', true); |
@@ -4708,7 +4708,7 @@ discard block |
||
| 4708 | 4708 | // No? try a fallback to $sourcedir |
| 4709 | 4709 | else |
| 4710 | 4710 | { |
| 4711 | - $absPath = $sourcedir .'/'. $file; |
|
| 4711 | + $absPath = $sourcedir . '/' . $file; |
|
| 4712 | 4712 | |
| 4713 | 4713 | if (file_exists($absPath)) |
| 4714 | 4714 | require_once($absPath); |
@@ -4789,15 +4789,15 @@ discard block |
||
| 4789 | 4789 | |
| 4790 | 4790 | // UTF-8 occurences of MS special characters |
| 4791 | 4791 | $findchars_utf8 = array( |
| 4792 | - "\xe2\80\x9a", // single low-9 quotation mark |
|
| 4793 | - "\xe2\80\x9e", // double low-9 quotation mark |
|
| 4794 | - "\xe2\80\xa6", // horizontal ellipsis |
|
| 4795 | - "\xe2\x80\x98", // left single curly quote |
|
| 4796 | - "\xe2\x80\x99", // right single curly quote |
|
| 4797 | - "\xe2\x80\x9c", // left double curly quote |
|
| 4798 | - "\xe2\x80\x9d", // right double curly quote |
|
| 4799 | - "\xe2\x80\x93", // en dash |
|
| 4800 | - "\xe2\x80\x94", // em dash |
|
| 4792 | + "\xe2\80\x9a", // single low-9 quotation mark |
|
| 4793 | + "\xe2\80\x9e", // double low-9 quotation mark |
|
| 4794 | + "\xe2\80\xa6", // horizontal ellipsis |
|
| 4795 | + "\xe2\x80\x98", // left single curly quote |
|
| 4796 | + "\xe2\x80\x99", // right single curly quote |
|
| 4797 | + "\xe2\x80\x9c", // left double curly quote |
|
| 4798 | + "\xe2\x80\x9d", // right double curly quote |
|
| 4799 | + "\xe2\x80\x93", // en dash |
|
| 4800 | + "\xe2\x80\x94", // em dash |
|
| 4801 | 4801 | ); |
| 4802 | 4802 | |
| 4803 | 4803 | // windows 1252 / iso equivalents |
@@ -4815,15 +4815,15 @@ discard block |
||
| 4815 | 4815 | |
| 4816 | 4816 | // safe replacements |
| 4817 | 4817 | $replacechars = array( |
| 4818 | - ',', // ‚ |
|
| 4819 | - ',,', // „ |
|
| 4820 | - '...', // … |
|
| 4821 | - "'", // ‘ |
|
| 4822 | - "'", // ’ |
|
| 4823 | - '"', // “ |
|
| 4824 | - '"', // ” |
|
| 4825 | - '-', // – |
|
| 4826 | - '--', // — |
|
| 4818 | + ',', // ‚ |
|
| 4819 | + ',,', // „ |
|
| 4820 | + '...', // … |
|
| 4821 | + "'", // ‘ |
|
| 4822 | + "'", // ’ |
|
| 4823 | + '"', // “ |
|
| 4824 | + '"', // ” |
|
| 4825 | + '-', // – |
|
| 4826 | + '--', // — |
|
| 4827 | 4827 | ); |
| 4828 | 4828 | |
| 4829 | 4829 | if ($context['utf8']) |
@@ -5109,7 +5109,7 @@ discard block |
||
| 5109 | 5109 | */ |
| 5110 | 5110 | function inet_dtop($bin) |
| 5111 | 5111 | { |
| 5112 | - if(empty($bin)) |
|
| 5112 | + if (empty($bin)) |
|
| 5113 | 5113 | return ''; |
| 5114 | 5114 | |
| 5115 | 5115 | global $db_type; |
@@ -5140,28 +5140,28 @@ discard block |
||
| 5140 | 5140 | */ |
| 5141 | 5141 | function _safe_serialize($value) |
| 5142 | 5142 | { |
| 5143 | - if(is_null($value)) |
|
| 5143 | + if (is_null($value)) |
|
| 5144 | 5144 | return 'N;'; |
| 5145 | 5145 | |
| 5146 | - if(is_bool($value)) |
|
| 5147 | - return 'b:'. (int) $value .';'; |
|
| 5146 | + if (is_bool($value)) |
|
| 5147 | + return 'b:' . (int) $value . ';'; |
|
| 5148 | 5148 | |
| 5149 | - if(is_int($value)) |
|
| 5150 | - return 'i:'. $value .';'; |
|
| 5149 | + if (is_int($value)) |
|
| 5150 | + return 'i:' . $value . ';'; |
|
| 5151 | 5151 | |
| 5152 | - if(is_float($value)) |
|
| 5153 | - return 'd:'. str_replace(',', '.', $value) .';'; |
|
| 5152 | + if (is_float($value)) |
|
| 5153 | + return 'd:' . str_replace(',', '.', $value) . ';'; |
|
| 5154 | 5154 | |
| 5155 | - if(is_string($value)) |
|
| 5156 | - return 's:'. strlen($value) .':"'. $value .'";'; |
|
| 5155 | + if (is_string($value)) |
|
| 5156 | + return 's:' . strlen($value) . ':"' . $value . '";'; |
|
| 5157 | 5157 | |
| 5158 | - if(is_array($value)) |
|
| 5158 | + if (is_array($value)) |
|
| 5159 | 5159 | { |
| 5160 | 5160 | $out = ''; |
| 5161 | - foreach($value as $k => $v) |
|
| 5161 | + foreach ($value as $k => $v) |
|
| 5162 | 5162 | $out .= _safe_serialize($k) . _safe_serialize($v); |
| 5163 | 5163 | |
| 5164 | - return 'a:'. count($value) .':{'. $out .'}'; |
|
| 5164 | + return 'a:' . count($value) . ':{' . $out . '}'; |
|
| 5165 | 5165 | } |
| 5166 | 5166 | |
| 5167 | 5167 | // safe_serialize cannot serialize resources or objects. |
@@ -5203,7 +5203,7 @@ discard block |
||
| 5203 | 5203 | function _safe_unserialize($str) |
| 5204 | 5204 | { |
| 5205 | 5205 | // Input is not a string. |
| 5206 | - if(empty($str) || !is_string($str)) |
|
| 5206 | + if (empty($str) || !is_string($str)) |
|
| 5207 | 5207 | return false; |
| 5208 | 5208 | |
| 5209 | 5209 | $stack = array(); |
@@ -5217,40 +5217,40 @@ discard block |
||
| 5217 | 5217 | * 3 - in array, expecting value or another array |
| 5218 | 5218 | */ |
| 5219 | 5219 | $state = 0; |
| 5220 | - while($state != 1) |
|
| 5220 | + while ($state != 1) |
|
| 5221 | 5221 | { |
| 5222 | 5222 | $type = isset($str[0]) ? $str[0] : ''; |
| 5223 | - if($type == '}') |
|
| 5223 | + if ($type == '}') |
|
| 5224 | 5224 | $str = substr($str, 1); |
| 5225 | 5225 | |
| 5226 | - else if($type == 'N' && $str[1] == ';') |
|
| 5226 | + else if ($type == 'N' && $str[1] == ';') |
|
| 5227 | 5227 | { |
| 5228 | 5228 | $value = null; |
| 5229 | 5229 | $str = substr($str, 2); |
| 5230 | 5230 | } |
| 5231 | - else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5231 | + else if ($type == 'b' && preg_match('/^b:([01]);/', $str, $matches)) |
|
| 5232 | 5232 | { |
| 5233 | 5233 | $value = $matches[1] == '1' ? true : false; |
| 5234 | 5234 | $str = substr($str, 4); |
| 5235 | 5235 | } |
| 5236 | - else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5236 | + else if ($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches)) |
|
| 5237 | 5237 | { |
| 5238 | - $value = (int)$matches[1]; |
|
| 5238 | + $value = (int) $matches[1]; |
|
| 5239 | 5239 | $str = $matches[2]; |
| 5240 | 5240 | } |
| 5241 | - else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5241 | + else if ($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches)) |
|
| 5242 | 5242 | { |
| 5243 | - $value = (float)$matches[1]; |
|
| 5243 | + $value = (float) $matches[1]; |
|
| 5244 | 5244 | $str = $matches[3]; |
| 5245 | 5245 | } |
| 5246 | - else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";') |
|
| 5246 | + else if ($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int) $matches[1], 2) == '";') |
|
| 5247 | 5247 | { |
| 5248 | - $value = substr($matches[2], 0, (int)$matches[1]); |
|
| 5249 | - $str = substr($matches[2], (int)$matches[1] + 2); |
|
| 5248 | + $value = substr($matches[2], 0, (int) $matches[1]); |
|
| 5249 | + $str = substr($matches[2], (int) $matches[1] + 2); |
|
| 5250 | 5250 | } |
| 5251 | - else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5251 | + else if ($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches)) |
|
| 5252 | 5252 | { |
| 5253 | - $expectedLength = (int)$matches[1]; |
|
| 5253 | + $expectedLength = (int) $matches[1]; |
|
| 5254 | 5254 | $str = $matches[2]; |
| 5255 | 5255 | } |
| 5256 | 5256 | |
@@ -5258,10 +5258,10 @@ discard block |
||
| 5258 | 5258 | else |
| 5259 | 5259 | return false; |
| 5260 | 5260 | |
| 5261 | - switch($state) |
|
| 5261 | + switch ($state) |
|
| 5262 | 5262 | { |
| 5263 | 5263 | case 3: // In array, expecting value or another array. |
| 5264 | - if($type == 'a') |
|
| 5264 | + if ($type == 'a') |
|
| 5265 | 5265 | { |
| 5266 | 5266 | $stack[] = &$list; |
| 5267 | 5267 | $list[$key] = array(); |
@@ -5270,7 +5270,7 @@ discard block |
||
| 5270 | 5270 | $state = 2; |
| 5271 | 5271 | break; |
| 5272 | 5272 | } |
| 5273 | - if($type != '}') |
|
| 5273 | + if ($type != '}') |
|
| 5274 | 5274 | { |
| 5275 | 5275 | $list[$key] = $value; |
| 5276 | 5276 | $state = 2; |
@@ -5281,29 +5281,29 @@ discard block |
||
| 5281 | 5281 | return false; |
| 5282 | 5282 | |
| 5283 | 5283 | case 2: // in array, expecting end of array or a key |
| 5284 | - if($type == '}') |
|
| 5284 | + if ($type == '}') |
|
| 5285 | 5285 | { |
| 5286 | 5286 | // Array size is less than expected. |
| 5287 | - if(count($list) < end($expected)) |
|
| 5287 | + if (count($list) < end($expected)) |
|
| 5288 | 5288 | return false; |
| 5289 | 5289 | |
| 5290 | 5290 | unset($list); |
| 5291 | - $list = &$stack[count($stack)-1]; |
|
| 5291 | + $list = &$stack[count($stack) - 1]; |
|
| 5292 | 5292 | array_pop($stack); |
| 5293 | 5293 | |
| 5294 | 5294 | // Go to terminal state if we're at the end of the root array. |
| 5295 | 5295 | array_pop($expected); |
| 5296 | 5296 | |
| 5297 | - if(count($expected) == 0) |
|
| 5297 | + if (count($expected) == 0) |
|
| 5298 | 5298 | $state = 1; |
| 5299 | 5299 | |
| 5300 | 5300 | break; |
| 5301 | 5301 | } |
| 5302 | 5302 | |
| 5303 | - if($type == 'i' || $type == 's') |
|
| 5303 | + if ($type == 'i' || $type == 's') |
|
| 5304 | 5304 | { |
| 5305 | 5305 | // Array size exceeds expected length. |
| 5306 | - if(count($list) >= end($expected)) |
|
| 5306 | + if (count($list) >= end($expected)) |
|
| 5307 | 5307 | return false; |
| 5308 | 5308 | |
| 5309 | 5309 | $key = $value; |
@@ -5316,7 +5316,7 @@ discard block |
||
| 5316 | 5316 | |
| 5317 | 5317 | // Expecting array or value. |
| 5318 | 5318 | case 0: |
| 5319 | - if($type == 'a') |
|
| 5319 | + if ($type == 'a') |
|
| 5320 | 5320 | { |
| 5321 | 5321 | $data = array(); |
| 5322 | 5322 | $list = &$data; |
@@ -5325,7 +5325,7 @@ discard block |
||
| 5325 | 5325 | break; |
| 5326 | 5326 | } |
| 5327 | 5327 | |
| 5328 | - if($type != '}') |
|
| 5328 | + if ($type != '}') |
|
| 5329 | 5329 | { |
| 5330 | 5330 | $data = $value; |
| 5331 | 5331 | $state = 1; |
@@ -5338,7 +5338,7 @@ discard block |
||
| 5338 | 5338 | } |
| 5339 | 5339 | |
| 5340 | 5340 | // Trailing data in input. |
| 5341 | - if(!empty($str)) |
|
| 5341 | + if (!empty($str)) |
|
| 5342 | 5342 | return false; |
| 5343 | 5343 | |
| 5344 | 5344 | return $data; |
@@ -5392,7 +5392,7 @@ discard block |
||
| 5392 | 5392 | // Set different modes. |
| 5393 | 5393 | $chmodValues = $isDir ? array(0750, 0755, 0775, 0777) : array(0644, 0664, 0666); |
| 5394 | 5394 | |
| 5395 | - foreach($chmodValues as $val) |
|
| 5395 | + foreach ($chmodValues as $val) |
|
| 5396 | 5396 | { |
| 5397 | 5397 | // If it's writable, break out of the loop. |
| 5398 | 5398 | if (is_writable($file)) |
@@ -5430,13 +5430,13 @@ discard block |
||
| 5430 | 5430 | $returnArray = @json_decode($json, $returnAsArray); |
| 5431 | 5431 | |
| 5432 | 5432 | // PHP 5.3 so no json_last_error_msg() |
| 5433 | - switch(json_last_error()) |
|
| 5433 | + switch (json_last_error()) |
|
| 5434 | 5434 | { |
| 5435 | 5435 | case JSON_ERROR_NONE: |
| 5436 | 5436 | $jsonError = false; |
| 5437 | 5437 | break; |
| 5438 | 5438 | case JSON_ERROR_DEPTH: |
| 5439 | - $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5439 | + $jsonError = 'JSON_ERROR_DEPTH'; |
|
| 5440 | 5440 | break; |
| 5441 | 5441 | case JSON_ERROR_STATE_MISMATCH: |
| 5442 | 5442 | $jsonError = 'JSON_ERROR_STATE_MISMATCH'; |
@@ -5464,10 +5464,10 @@ discard block |
||
| 5464 | 5464 | loadLanguage('Errors'); |
| 5465 | 5465 | |
| 5466 | 5466 | if (!empty($jsonDebug)) |
| 5467 | - log_error($txt['json_'. $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5467 | + log_error($txt['json_' . $jsonError], 'critical', $jsonDebug['file'], $jsonDebug['line']); |
|
| 5468 | 5468 | |
| 5469 | 5469 | else |
| 5470 | - log_error($txt['json_'. $jsonError], 'critical'); |
|
| 5470 | + log_error($txt['json_' . $jsonError], 'critical'); |
|
| 5471 | 5471 | |
| 5472 | 5472 | // Everyone expects an array. |
| 5473 | 5473 | return array(); |
@@ -5571,7 +5571,7 @@ discard block |
||
| 5571 | 5571 | }); |
| 5572 | 5572 | |
| 5573 | 5573 | // Convert Punycode to Unicode |
| 5574 | - $tlds = array_map(function ($input) { |
|
| 5574 | + $tlds = array_map(function($input) { |
|
| 5575 | 5575 | $prefix = 'xn--'; |
| 5576 | 5576 | $safe_char = 0xFFFC; |
| 5577 | 5577 | $base = 36; |
@@ -5587,7 +5587,7 @@ discard block |
||
| 5587 | 5587 | |
| 5588 | 5588 | foreach ($enco_parts as $encoded) |
| 5589 | 5589 | { |
| 5590 | - if (strpos($encoded,$prefix) !== 0 || strlen(trim(str_replace($prefix,'',$encoded))) == 0) |
|
| 5590 | + if (strpos($encoded, $prefix) !== 0 || strlen(trim(str_replace($prefix, '', $encoded))) == 0) |
|
| 5591 | 5591 | { |
| 5592 | 5592 | $output_parts[] = $encoded; |
| 5593 | 5593 | continue; |
@@ -5598,7 +5598,7 @@ discard block |
||
| 5598 | 5598 | $idx = 0; |
| 5599 | 5599 | $char = 0x80; |
| 5600 | 5600 | $decoded = array(); |
| 5601 | - $output=''; |
|
| 5601 | + $output = ''; |
|
| 5602 | 5602 | $delim_pos = strrpos($encoded, '-'); |
| 5603 | 5603 | |
| 5604 | 5604 | if ($delim_pos > strlen($prefix)) |
@@ -5614,7 +5614,7 @@ discard block |
||
| 5614 | 5614 | |
| 5615 | 5615 | for ($enco_idx = $delim_pos ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) |
| 5616 | 5616 | { |
| 5617 | - for ($old_idx = $idx, $w = 1, $k = $base; 1 ; $k += $base) |
|
| 5617 | + for ($old_idx = $idx, $w = 1, $k = $base; 1; $k += $base) |
|
| 5618 | 5618 | { |
| 5619 | 5619 | $cp = ord($encoded{$enco_idx++}); |
| 5620 | 5620 | $digit = ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $base)); |
@@ -5655,15 +5655,15 @@ discard block |
||
| 5655 | 5655 | |
| 5656 | 5656 | // 2 bytes |
| 5657 | 5657 | elseif ($v < (1 << 11)) |
| 5658 | - $output .= chr(192+($v >> 6)) . chr(128+($v & 63)); |
|
| 5658 | + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); |
|
| 5659 | 5659 | |
| 5660 | 5660 | // 3 bytes |
| 5661 | 5661 | elseif ($v < (1 << 16)) |
| 5662 | - $output .= chr(224+($v >> 12)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5662 | + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5663 | 5663 | |
| 5664 | 5664 | // 4 bytes |
| 5665 | 5665 | elseif ($v < (1 << 21)) |
| 5666 | - $output .= chr(240+($v >> 18)) . chr(128+(($v >> 12) & 63)) . chr(128+(($v >> 6) & 63)) . chr(128+($v & 63)); |
|
| 5666 | + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); |
|
| 5667 | 5667 | |
| 5668 | 5668 | // 'Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k |
| 5669 | 5669 | else |
@@ -5770,7 +5770,7 @@ discard block |
||
| 5770 | 5770 | } |
| 5771 | 5771 | |
| 5772 | 5772 | // This recursive function creates the index array from the strings |
| 5773 | - $add_string_to_index = function ($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5773 | + $add_string_to_index = function($string, $index) use (&$strlen, &$substr, &$add_string_to_index) |
|
| 5774 | 5774 | { |
| 5775 | 5775 | static $depth = 0; |
| 5776 | 5776 | $depth++; |
@@ -5797,7 +5797,7 @@ discard block |
||
| 5797 | 5797 | }; |
| 5798 | 5798 | |
| 5799 | 5799 | // This recursive function turns the index array into a regular expression |
| 5800 | - $index_to_regex = function (&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5800 | + $index_to_regex = function(&$index, $delim) use (&$strlen, &$index_to_regex) |
|
| 5801 | 5801 | { |
| 5802 | 5802 | static $depth = 0; |
| 5803 | 5803 | $depth++; |
@@ -5820,9 +5820,9 @@ discard block |
||
| 5820 | 5820 | $sub_regex = $index_to_regex($value, $delim); |
| 5821 | 5821 | |
| 5822 | 5822 | if (count(array_keys($value)) == 1) |
| 5823 | - $new_key .= explode('(?'.'>', $sub_regex)[0]; |
|
| 5823 | + $new_key .= explode('(?' . '>', $sub_regex)[0]; |
|
| 5824 | 5824 | else |
| 5825 | - $sub_regex = '(?'.'>' . $sub_regex . ')'; |
|
| 5825 | + $sub_regex = '(?' . '>' . $sub_regex . ')'; |
|
| 5826 | 5826 | } |
| 5827 | 5827 | |
| 5828 | 5828 | if ($depth > 1) |
@@ -5862,7 +5862,7 @@ discard block |
||
| 5862 | 5862 | $index = $add_string_to_index($string, $index); |
| 5863 | 5863 | |
| 5864 | 5864 | while (!empty($index)) |
| 5865 | - $regexes[] = '(?'.'>' . $index_to_regex($index, $delim) . ')'; |
|
| 5865 | + $regexes[] = '(?' . '>' . $index_to_regex($index, $delim) . ')'; |
|
| 5866 | 5866 | |
| 5867 | 5867 | // Restore PHP's internal character encoding to whatever it was originally |
| 5868 | 5868 | if (!empty($current_encoding)) |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | { |
| 799 | 799 | // It goes 0 = outside, 1 = begin tag, 2 = inside, 3 = close tag, repeat. |
| 800 | 800 | if ($i % 4 == 0) |
| 801 | - $parts[$i] = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function ($m) |
|
| 801 | + $parts[$i] = preg_replace_callback('~\[html\](.+?)\[/html\]~is', function($m) |
|
| 802 | 802 | { |
| 803 | 803 | return '[html]' . preg_replace('~<br\s?/?' . '>~i', '<br /><br>', "$m[1]") . '[/html]'; |
| 804 | 804 | }, $parts[$i]); |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | { |
| 896 | 896 | // Since, they don't belong here. Let's inform the user that they exist.. |
| 897 | 897 | if (!empty($topic)) |
| 898 | - $delete_url = $scripturl . '?action=post' .(!empty($_REQUEST['msg']) ? (';msg=' . $_REQUEST['msg']) : '') . (!empty($_REQUEST['last_msg']) ? (';last_msg=' . $_REQUEST['last_msg']) : '') . ';topic=' . $topic . ';delete_temp'; |
|
| 898 | + $delete_url = $scripturl . '?action=post' . (!empty($_REQUEST['msg']) ? (';msg=' . $_REQUEST['msg']) : '') . (!empty($_REQUEST['last_msg']) ? (';last_msg=' . $_REQUEST['last_msg']) : '') . ';topic=' . $topic . ';delete_temp'; |
|
| 899 | 899 | else |
| 900 | 900 | $delete_url = $scripturl . '?action=post;board=' . $board . ';delete_temp'; |
| 901 | 901 | |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | $file_list = array(); |
| 904 | 904 | foreach ($_SESSION['temp_attachments'] as $attachID => $attachment) |
| 905 | 905 | if (strpos($attachID, 'post_tmp_' . $user_info['id']) !== false) |
| 906 | - $file_list[] = $attachment['name']; |
|
| 906 | + $file_list[] = $attachment['name']; |
|
| 907 | 907 | |
| 908 | 908 | $_SESSION['temp_attachments']['post']['files'] = $file_list; |
| 909 | 909 | $file_list = '<div class="attachments">' . implode('<br>', $file_list) . '</div>'; |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | if (!empty($_SESSION['temp_attachments']['post']['msg'])) |
| 912 | 912 | { |
| 913 | 913 | // We have a message id, so we can link back to the old topic they were trying to edit.. |
| 914 | - $goback_url = $scripturl . '?action=post' .(!empty($_SESSION['temp_attachments']['post']['msg']) ? (';msg=' . $_SESSION['temp_attachments']['post']['msg']) : '') . (!empty($_SESSION['temp_attachments']['post']['last_msg']) ? (';last_msg=' . $_SESSION['temp_attachments']['post']['last_msg']) : '') . ';topic=' . $_SESSION['temp_attachments']['post']['topic'] . ';additionalOptions'; |
|
| 914 | + $goback_url = $scripturl . '?action=post' . (!empty($_SESSION['temp_attachments']['post']['msg']) ? (';msg=' . $_SESSION['temp_attachments']['post']['msg']) : '') . (!empty($_SESSION['temp_attachments']['post']['last_msg']) ? (';last_msg=' . $_SESSION['temp_attachments']['post']['last_msg']) : '') . ';topic=' . $_SESSION['temp_attachments']['post']['topic'] . ';additionalOptions'; |
|
| 915 | 915 | |
| 916 | 916 | $post_errors[] = array('temp_attachments_found', array($delete_url, $goback_url, $file_list)); |
| 917 | 917 | $context['ignore_temp_attachments'] = true; |
@@ -1198,55 +1198,55 @@ discard block |
||
| 1198 | 1198 | foreach ($context['current_attachments'] as $key => $mock) |
| 1199 | 1199 | addInlineJavaScript(' |
| 1200 | 1200 | current_attachments.push({ |
| 1201 | - name: '. JavaScriptEscape($mock['name']) .', |
|
| 1202 | - size: '. $mock['size'] .', |
|
| 1203 | - attachID: '. $mock['attachID'] .', |
|
| 1204 | - approved: '. $mock['approved'] .', |
|
| 1205 | - type: '. JavaScriptEscape(!empty($mock['mime_type']) ? $mock['mime_type'] : '') .', |
|
| 1206 | - thumbID: '. (!empty($mock['thumb']) ? $mock['thumb'] : 0) .' |
|
| 1201 | + name: '. JavaScriptEscape($mock['name']) . ', |
|
| 1202 | + size: '. $mock['size'] . ', |
|
| 1203 | + attachID: '. $mock['attachID'] . ', |
|
| 1204 | + approved: '. $mock['approved'] . ', |
|
| 1205 | + type: '. JavaScriptEscape(!empty($mock['mime_type']) ? $mock['mime_type'] : '') . ', |
|
| 1206 | + thumbID: '. (!empty($mock['thumb']) ? $mock['thumb'] : 0) . ' |
|
| 1207 | 1207 | });', true); |
| 1208 | 1208 | } |
| 1209 | 1209 | |
| 1210 | 1210 | // File Upload. |
| 1211 | 1211 | if ($context['can_post_attachment']) |
| 1212 | 1212 | { |
| 1213 | - $acceptedFiles = implode(',', array_map(function($val) use($smcFunc) { return '.'. $smcFunc['htmltrim']($val);} , explode(',', $context['allowed_extensions']))); |
|
| 1213 | + $acceptedFiles = implode(',', array_map(function($val) use($smcFunc) { return '.' . $smcFunc['htmltrim']($val); } , explode(',', $context['allowed_extensions']))); |
|
| 1214 | 1214 | |
| 1215 | 1215 | loadJavaScriptFile('dropzone.min.js', array('defer' => true), 'smf_dropzone'); |
| 1216 | 1216 | loadJavaScriptFile('smf_fileUpload.js', array('defer' => true), 'smf_fileUpload'); |
| 1217 | 1217 | addInlineJavaScript(' |
| 1218 | 1218 | $(function() { |
| 1219 | 1219 | smf_fileUpload({ |
| 1220 | - dictDefaultMessage : '. JavaScriptEscape($txt['attach_drop_zone']) .', |
|
| 1221 | - dictFallbackMessage : '. JavaScriptEscape($txt['attach_drop_zone_no']) .', |
|
| 1222 | - dictCancelUpload : '. JavaScriptEscape($txt['modify_cancel']) .', |
|
| 1223 | - genericError: '. JavaScriptEscape($txt['attach_php_error']) .', |
|
| 1224 | - text_attachLeft: '. JavaScriptEscape($txt['attached_attachedLeft']) .', |
|
| 1225 | - text_deleteAttach: '. JavaScriptEscape($txt['attached_file_delete']) .', |
|
| 1226 | - text_attachDeleted: '. JavaScriptEscape($txt['attached_file_deleted']) .', |
|
| 1227 | - text_insertBBC: '. JavaScriptEscape($txt['attached_insertBBC']) .', |
|
| 1228 | - text_attachUploaded: '. JavaScriptEscape($txt['attached_file_uploaded']) .', |
|
| 1229 | - text_attach_unlimited: '. JavaScriptEscape($txt['attach_drop_unlimited']) .', |
|
| 1230 | - dictMaxFilesExceeded: '. JavaScriptEscape($txt['more_attachments_error']) .', |
|
| 1231 | - dictInvalidFileType: '. JavaScriptEscape(sprintf($txt['cant_upload_type'], $context['allowed_extensions'])) .', |
|
| 1232 | - dictFileTooBig: '. JavaScriptEscape(sprintf($txt['file_too_big'], comma_format($modSettings['attachmentSizeLimit'], 0))) .', |
|
| 1233 | - maxTotalSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) .', |
|
| 1234 | - acceptedFiles: '. JavaScriptEscape($acceptedFiles) .', |
|
| 1235 | - maxFilesize: '. (!empty($modSettings['attachmentSizeLimit']) ? $modSettings['attachmentSizeLimit'] : 'null') .', |
|
| 1236 | - thumbnailWidth: '.(!empty($modSettings['attachmentThumbWidth']) ? $modSettings['attachmentThumbWidth'] : 'null') .', |
|
| 1237 | - thumbnailHeight: '.(!empty($modSettings['attachmentThumbHeight']) ? $modSettings['attachmentThumbHeight'] : 'null') .', |
|
| 1238 | - maxFiles: '. (!empty($context['num_allowed_attachments']) ? $context['num_allowed_attachments'] : 'null') .', |
|
| 1239 | - text_totalMaxSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) .', |
|
| 1240 | - text_max_size_progress: '. JavaScriptEscape($txt['attach_max_size_progress']) .', |
|
| 1241 | - limitMultiFileUploadSize:'. round(max($modSettings['attachmentPostLimit'] - ($context['attachments']['total_size'] / 1024), 0)) * 1024 .', |
|
| 1242 | - maxLimitReferenceUploadSize: '. $modSettings['attachmentPostLimit'] * 1024 .', |
|
| 1220 | + dictDefaultMessage : '. JavaScriptEscape($txt['attach_drop_zone']) . ', |
|
| 1221 | + dictFallbackMessage : '. JavaScriptEscape($txt['attach_drop_zone_no']) . ', |
|
| 1222 | + dictCancelUpload : '. JavaScriptEscape($txt['modify_cancel']) . ', |
|
| 1223 | + genericError: '. JavaScriptEscape($txt['attach_php_error']) . ', |
|
| 1224 | + text_attachLeft: '. JavaScriptEscape($txt['attached_attachedLeft']) . ', |
|
| 1225 | + text_deleteAttach: '. JavaScriptEscape($txt['attached_file_delete']) . ', |
|
| 1226 | + text_attachDeleted: '. JavaScriptEscape($txt['attached_file_deleted']) . ', |
|
| 1227 | + text_insertBBC: '. JavaScriptEscape($txt['attached_insertBBC']) . ', |
|
| 1228 | + text_attachUploaded: '. JavaScriptEscape($txt['attached_file_uploaded']) . ', |
|
| 1229 | + text_attach_unlimited: '. JavaScriptEscape($txt['attach_drop_unlimited']) . ', |
|
| 1230 | + dictMaxFilesExceeded: '. JavaScriptEscape($txt['more_attachments_error']) . ', |
|
| 1231 | + dictInvalidFileType: '. JavaScriptEscape(sprintf($txt['cant_upload_type'], $context['allowed_extensions'])) . ', |
|
| 1232 | + dictFileTooBig: '. JavaScriptEscape(sprintf($txt['file_too_big'], comma_format($modSettings['attachmentSizeLimit'], 0))) . ', |
|
| 1233 | + maxTotalSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) . ', |
|
| 1234 | + acceptedFiles: '. JavaScriptEscape($acceptedFiles) . ', |
|
| 1235 | + maxFilesize: '. (!empty($modSettings['attachmentSizeLimit']) ? $modSettings['attachmentSizeLimit'] : 'null') . ', |
|
| 1236 | + thumbnailWidth: '.(!empty($modSettings['attachmentThumbWidth']) ? $modSettings['attachmentThumbWidth'] : 'null') . ', |
|
| 1237 | + thumbnailHeight: '.(!empty($modSettings['attachmentThumbHeight']) ? $modSettings['attachmentThumbHeight'] : 'null') . ', |
|
| 1238 | + maxFiles: '. (!empty($context['num_allowed_attachments']) ? $context['num_allowed_attachments'] : 'null') . ', |
|
| 1239 | + text_totalMaxSize: '. JavaScriptEscape($txt['attach_max_total_file_size_current']) . ', |
|
| 1240 | + text_max_size_progress: '. JavaScriptEscape($txt['attach_max_size_progress']) . ', |
|
| 1241 | + limitMultiFileUploadSize:'. round(max($modSettings['attachmentPostLimit'] - ($context['attachments']['total_size'] / 1024), 0)) * 1024 . ', |
|
| 1242 | + maxLimitReferenceUploadSize: '. $modSettings['attachmentPostLimit'] * 1024 . ', |
|
| 1243 | 1243 | }); |
| 1244 | 1244 | });', true); |
| 1245 | 1245 | } |
| 1246 | 1246 | |
| 1247 | 1247 | // Knowing the current board ID might be handy. |
| 1248 | 1248 | addInlineJavaScript(' |
| 1249 | - var current_board = '. (empty($context['current_board']) ? 'null' : $context['current_board']) .';', false); |
|
| 1249 | + var current_board = '. (empty($context['current_board']) ? 'null' : $context['current_board']) . ';', false); |
|
| 1250 | 1250 | |
| 1251 | 1251 | // Finally, load the template. |
| 1252 | 1252 | if (!isset($_REQUEST['xml'])) |
@@ -1664,7 +1664,7 @@ discard block |
||
| 1664 | 1664 | } |
| 1665 | 1665 | |
| 1666 | 1666 | // Coming from the quickReply? |
| 1667 | - if(isset($_POST['quickReply'])) |
|
| 1667 | + if (isset($_POST['quickReply'])) |
|
| 1668 | 1668 | $_POST['message'] = $_POST['quickReply']; |
| 1669 | 1669 | |
| 1670 | 1670 | // Check the subject and message. |
@@ -2456,7 +2456,7 @@ discard block |
||
| 2456 | 2456 | FROM {db_prefix}messages AS m |
| 2457 | 2457 | LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member) |
| 2458 | 2458 | WHERE m.id_topic = {int:current_topic}' . (isset($_REQUEST['msg']) ? ' |
| 2459 | - AND m.id_msg < {int:id_msg}' : '') .(!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : ' |
|
| 2459 | + AND m.id_msg < {int:id_msg}' : '') . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : ' |
|
| 2460 | 2460 | AND m.approved = {int:approved}') . ' |
| 2461 | 2461 | ORDER BY m.id_msg DESC' . $limit, |
| 2462 | 2462 | array( |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_id_group} THEN mem.id_post_group ELSE mem.id_group END)' . |
| 511 | 511 | (empty($customJoin) ? '' : implode(' |
| 512 | 512 | ', $customJoin)) . ' |
| 513 | - WHERE (' . implode( ' ' . $query . ' OR ', $fields) . ' ' . $query . ') |
|
| 513 | + WHERE (' . implode(' ' . $query . ' OR ', $fields) . ' ' . $query . ') |
|
| 514 | 514 | AND mem.is_activated = {int:is_activated}', |
| 515 | 515 | $query_parameters |
| 516 | 516 | ); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | LEFT JOIN {db_prefix}membergroups AS mg ON (mg.id_group = CASE WHEN mem.id_group = {int:regular_id_group} THEN mem.id_post_group ELSE mem.id_group END)' . |
| 528 | 528 | (empty($customJoin) ? '' : implode(' |
| 529 | 529 | ', $customJoin)) . ' |
| 530 | - WHERE (' . implode( ' ' . $query . ' OR ', $fields) . ' ' . $query . ') |
|
| 530 | + WHERE (' . implode(' ' . $query . ' OR ', $fields) . ' ' . $query . ') |
|
| 531 | 531 | AND mem.is_activated = {int:is_activated} |
| 532 | 532 | ORDER BY {raw:sort} |
| 533 | 533 | LIMIT {int:start}, {int:max}', |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | 'up' => 't' . $row['col_name'] . '.value ASC' |
| 701 | 701 | ); |
| 702 | 702 | |
| 703 | - $cpf['join'][$row['col_name']] = 'LEFT JOIN {db_prefix}themes AS t' . $row['col_name'] . ' ON (t' . $row['col_name'] . '.variable = {literal:' . $row['col_name'] . '} AND t' . $row['col_name'] . '.id_theme = 1 AND t' . $row['col_name'] . '.id_member = mem.id_member)'; |
|
| 703 | + $cpf['join'][$row['col_name']] = 'LEFT JOIN {db_prefix}themes AS t' . $row['col_name'] . ' ON (t' . $row['col_name'] . '.variable = {literal:' . $row['col_name'] . '} AND t' . $row['col_name'] . '.id_theme = 1 AND t' . $row['col_name'] . '.id_member = mem.id_member)'; |
|
| 704 | 704 | } |
| 705 | 705 | $smcFunc['db_free_result']($request); |
| 706 | 706 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | ) |
| 232 | 232 | ); |
| 233 | 233 | |
| 234 | - $request = $smcFunc['db_query']('',' |
|
| 234 | + $request = $smcFunc['db_query']('', ' |
|
| 235 | 235 | SHOW default_text_search_config', |
| 236 | 236 | array() |
| 237 | 237 | ); |
@@ -426,8 +426,8 @@ discard block |
||
| 426 | 426 | WHERE t.schemaname= {string:schema} and ( |
| 427 | 427 | indexname = {string:messages_ftx} OR indexname = {string:log_search_words} )', |
| 428 | 428 | array( |
| 429 | - 'messages_ftx' => $db_prefix. 'messages_ftx', |
|
| 430 | - 'log_search_words' => $db_prefix. 'log_search_words', |
|
| 429 | + 'messages_ftx' => $db_prefix . 'messages_ftx', |
|
| 430 | + 'log_search_words' => $db_prefix . 'log_search_words', |
|
| 431 | 431 | 'schema' => 'public', |
| 432 | 432 | ) |
| 433 | 433 | ); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | $context['table_info']['index_length'] = (int) $row['index_size']; |
| 443 | 443 | $context['table_info']['fulltext_length'] = (int) $row['index_size']; |
| 444 | 444 | } |
| 445 | - elseif ($row['indexname'] == $db_prefix. 'log_search_words') |
|
| 445 | + elseif ($row['indexname'] == $db_prefix . 'log_search_words') |
|
| 446 | 446 | { |
| 447 | 447 | $context['table_info']['index_length'] = (int) $row['index_size']; |
| 448 | 448 | $context['table_info']['custom_index_length'] = (int) $row['index_size']; |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | // We need this for db_get_version |
| 800 | 800 | db_extend(); |
| 801 | 801 | |
| 802 | - if ($smcFunc['db_title'] == 'PostgreSQL'){ |
|
| 802 | + if ($smcFunc['db_title'] == 'PostgreSQL') { |
|
| 803 | 803 | $request = $smcFunc['db_query']('', ' |
| 804 | 804 | SELECT |
| 805 | 805 | indexname |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | WHERE t.schemaname= {string:schema} and indexname = {string:messages_ftx}', |
| 815 | 815 | array( |
| 816 | 816 | 'schema' => 'public', |
| 817 | - 'messages_ftx' => $db_prefix.'messages_ftx', |
|
| 817 | + 'messages_ftx' => $db_prefix . 'messages_ftx', |
|
| 818 | 818 | ) |
| 819 | 819 | ); |
| 820 | 820 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function setInitKey($key) |
| 116 | 116 | { |
| 117 | - if (preg_match('/^['.implode('', array_keys($this->getLookup())).']+$/', $key) == false) { |
|
| 117 | + if (preg_match('/^[' . implode('', array_keys($this->getLookup())) . ']+$/', $key) == false) { |
|
| 118 | 118 | throw new \InvalidArgumentException('Invalid base32 hash!'); |
| 119 | 119 | } |
| 120 | 120 | $this->initKey = $key; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $initKey = ($initKey == null) ? $this->getInitKey() : $initKey; |
| 248 | 248 | $timestamp = ($timestamp == null) ? $this->generateTimestamp() : $timestamp; |
| 249 | 249 | |
| 250 | - $hash = hash_hmac ( |
|
| 250 | + $hash = hash_hmac( |
|
| 251 | 251 | 'sha1', |
| 252 | 252 | pack('N*', 0) . pack('N*', $timestamp), |
| 253 | 253 | $initKey, |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $code = ''; |
| 271 | 271 | |
| 272 | 272 | for ($i = 0; $i < $length; $i++) { |
| 273 | - $code .= $lookup[mt_rand(0, strlen($lookup)-1)]; |
|
| 273 | + $code .= $lookup[mt_rand(0, strlen($lookup) - 1)]; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return $code; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function generateTimestamp() |
| 285 | 285 | { |
| 286 | - return floor(microtime(true)/$this->getRefresh()); |
|
| 286 | + return floor(microtime(true) / $this->getRefresh()); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | $offset = ord($hash[19]) & 0xf; |
| 298 | 298 | |
| 299 | 299 | return ( |
| 300 | - ((ord($hash[$offset+0]) & 0x7f) << 24 ) | |
|
| 301 | - ((ord($hash[$offset+1]) & 0xff) << 16 ) | |
|
| 302 | - ((ord($hash[$offset+2]) & 0xff) << 8 ) | |
|
| 303 | - (ord($hash[$offset+3]) & 0xff) |
|
| 300 | + ((ord($hash[$offset + 0]) & 0x7f) << 24) | |
|
| 301 | + ((ord($hash[$offset + 1]) & 0xff) << 16) | |
|
| 302 | + ((ord($hash[$offset + 2]) & 0xff) << 8) | |
|
| 303 | + (ord($hash[$offset + 3]) & 0xff) |
|
| 304 | 304 | ) % pow(10, $this->getCodeLength()); |
| 305 | 305 | } |
| 306 | 306 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | { |
| 316 | 316 | $lookup = $this->getLookup(); |
| 317 | 317 | |
| 318 | - if (preg_match('/^['.implode('', array_keys($lookup)).']+$/', $hash) == false) { |
|
| 318 | + if (preg_match('/^[' . implode('', array_keys($lookup)) . ']+$/', $hash) == false) { |
|
| 319 | 319 | throw new \InvalidArgumentException('Invalid base32 hash!'); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -555,7 +555,7 @@ |
||
| 555 | 555 | 'subject' => $row_liked_message['subject'], |
| 556 | 556 | 'num' => $row_liked_message['likes'], |
| 557 | 557 | 'href' => $scripturl . '?msg=' . $row_liked_message['id_msg'], |
| 558 | - 'link' => '<a href="' . $scripturl . '?msg=' . $row_liked_message['id_msg'] .'">' . $row_liked_message['subject'] . '</a>' |
|
| 558 | + 'link' => '<a href="' . $scripturl . '?msg=' . $row_liked_message['id_msg'] . '">' . $row_liked_message['subject'] . '</a>' |
|
| 559 | 559 | ); |
| 560 | 560 | |
| 561 | 561 | if ($max_liked_message < $row_liked_message['likes']) |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | 'class' => 'centercol', |
| 257 | 257 | ), |
| 258 | 258 | 'data' => array( |
| 259 | - 'function' => function ($entry) |
|
| 259 | + 'function' => function($entry) |
|
| 260 | 260 | { |
| 261 | 261 | return '<input type="checkbox" class="input_check" name="delete[]" value="' . $entry['id'] . '"' . ($entry['editable'] ? '' : ' disabled') . '>'; |
| 262 | 262 | }, |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | if (empty($entries[$k]['action_text'])) |
| 639 | 639 | $entries[$k]['action_text'] = isset($txt['modlog_ac_' . $entry['action']]) ? $txt['modlog_ac_' . $entry['action']] : $entry['action']; |
| 640 | 640 | $entries[$k]['action_text'] = preg_replace_callback('~\{([A-Za-z\d_]+)\}~i', |
| 641 | - function ($matches) use ($entries, $k) |
|
| 641 | + function($matches) use ($entries, $k) |
|
| 642 | 642 | { |
| 643 | 643 | return isset($entries[$k]['extra'][$matches[1]]) ? $entries[$k]['extra'][$matches[1]] : ''; |
| 644 | 644 | }, $entries[$k]['action_text']); |