@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return bool |
| 43 | 43 | * @package Attachments |
| 44 | 44 | */ |
| 45 | -function processAttachments($id_msg = null) |
|
| 45 | +function processAttachments ($id_msg = null) |
|
| 46 | 46 | { |
| 47 | 47 | global $context, $modSettings, $txt, $topic, $board; |
| 48 | 48 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @return array |
| 233 | 233 | * @package Attachments |
| 234 | 234 | */ |
| 235 | -function attachmentUploadChecks($attachID) |
|
| 235 | +function attachmentUploadChecks ($attachID) |
|
| 236 | 236 | { |
| 237 | 237 | global $modSettings, $txt; |
| 238 | 238 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * @return bool |
| 289 | 289 | * @package Attachments |
| 290 | 290 | */ |
| 291 | -function createAttachment(&$attachmentOptions) |
|
| 291 | +function createAttachment (&$attachmentOptions) |
|
| 292 | 292 | { |
| 293 | 293 | global $modSettings; |
| 294 | 294 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * @return array|bool |
| 459 | 459 | * @package Attachments |
| 460 | 460 | */ |
| 461 | -function isAttachmentImage($id_attach) |
|
| 461 | +function isAttachmentImage ($id_attach) |
|
| 462 | 462 | { |
| 463 | 463 | $db = database(); |
| 464 | 464 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | 'type' => 0, |
| 482 | 482 | ) |
| 483 | 483 | )->fetch_callback( |
| 484 | - function ($row) use (&$attachmentData) { |
|
| 484 | + function($row) use (&$attachmentData) { |
|
| 485 | 485 | $attachmentData = $row; |
| 486 | 486 | $attachmentData['is_image'] = substr($attachmentData['mime_type'], 0, 5) === 'image'; |
| 487 | 487 | $attachmentData['size'] = byte_format($attachmentData['size']); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * @return bool whether the download and resize was successful. |
| 509 | 509 | * @package Attachments |
| 510 | 510 | */ |
| 511 | -function saveAvatar($temporary_path, $memID, $max_width, $max_height) |
|
| 511 | +function saveAvatar ($temporary_path, $memID, $max_width, $max_height) |
|
| 512 | 512 | { |
| 513 | 513 | global $modSettings; |
| 514 | 514 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | * @return mixed[]|bool the image size as array(width, height), or false on failure |
| 616 | 616 | * @package Attachments |
| 617 | 617 | */ |
| 618 | -function url_image_size($url) |
|
| 618 | +function url_image_size ($url) |
|
| 619 | 619 | { |
| 620 | 620 | // Can we pull this from the cache... please please? |
| 621 | 621 | $temp = array(); |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | * @return array |
| 692 | 692 | * @package Attachments |
| 693 | 693 | */ |
| 694 | -function getAttachments($messages, $includeUnapproved = false, $filter = null, $all_posters = array()) |
|
| 694 | +function getAttachments ($messages, $includeUnapproved = false, $filter = null, $all_posters = array()) |
|
| 695 | 695 | { |
| 696 | 696 | global $modSettings; |
| 697 | 697 | |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | 'attachment_type' => 0, |
| 714 | 714 | ) |
| 715 | 715 | )->fetch_callback( |
| 716 | - function ($row) use ($includeUnapproved, $filter, $all_posters, &$attachments, &$temp) { |
|
| 716 | + function($row) use ($includeUnapproved, $filter, $all_posters, &$attachments, &$temp) { |
|
| 717 | 717 | if (!$row['approved'] && !$includeUnapproved |
| 718 | 718 | && (empty($filter) || !call_user_func($filter, $row, $all_posters))) |
| 719 | 719 | { |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | * @return array |
| 748 | 748 | * @package Attachments |
| 749 | 749 | */ |
| 750 | -function getServerStoredAvatars($directory) |
|
| 750 | +function getServerStoredAvatars ($directory) |
|
| 751 | 751 | { |
| 752 | 752 | global $context, $txt, $modSettings; |
| 753 | 753 | |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | * @return array The updated information |
| 837 | 837 | * @package Attachments |
| 838 | 838 | */ |
| 839 | -function updateAttachmentThumbnail($filename, $id_attach, $id_msg, $old_id_thumb = 0, $real_filename = '') |
|
| 839 | +function updateAttachmentThumbnail ($filename, $id_attach, $id_msg, $old_id_thumb = 0, $real_filename = '') |
|
| 840 | 840 | { |
| 841 | 841 | global $modSettings; |
| 842 | 842 | |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | * @package Attachments |
| 914 | 914 | * @return mixed |
| 915 | 915 | */ |
| 916 | -function attachmentsSizeForMessage($id_msg, $include_count = true) |
|
| 916 | +function attachmentsSizeForMessage ($id_msg, $include_count = true) |
|
| 917 | 917 | { |
| 918 | 918 | $db = database(); |
| 919 | 919 | |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | * |
| 966 | 966 | * @package Attachments |
| 967 | 967 | */ |
| 968 | -function loadAttachmentContext($id_msg) |
|
| 968 | +function loadAttachmentContext ($id_msg) |
|
| 969 | 969 | { |
| 970 | 970 | global $attachments, $modSettings, $scripturl, $topic; |
| 971 | 971 | |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | * @return null|string|string[] |
| 1101 | 1101 | * @package Attachments |
| 1102 | 1102 | */ |
| 1103 | -function getLegacyAttachmentFilename($filename, $attachment_id, $dir = null, $new = false) |
|
| 1103 | +function getLegacyAttachmentFilename ($filename, $attachment_id, $dir = null, $new = false) |
|
| 1104 | 1104 | { |
| 1105 | 1105 | global $modSettings; |
| 1106 | 1106 | |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | * @param int[] $attachment_ids |
| 1137 | 1137 | * @package Attachments |
| 1138 | 1138 | */ |
| 1139 | -function bindMessageAttachments($id_msg, $attachment_ids) |
|
| 1139 | +function bindMessageAttachments ($id_msg, $attachment_ids) |
|
| 1140 | 1140 | { |
| 1141 | 1141 | $db = database(); |
| 1142 | 1142 | |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | * @todo and of course everything relies on this behavior and work around it. :P. |
| 1171 | 1171 | * Converters included. |
| 1172 | 1172 | */ |
| 1173 | -function getAttachmentFilename($filename, $attachment_id, $dir = null, $new = false, $file_hash = '') |
|
| 1173 | +function getAttachmentFilename ($filename, $attachment_id, $dir = null, $new = false, $file_hash = '') |
|
| 1174 | 1174 | { |
| 1175 | 1175 | global $modSettings; |
| 1176 | 1176 | |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | * @return int[]|bool on fail else an array of id_board, id_topic |
| 1204 | 1204 | * @package Attachments |
| 1205 | 1205 | */ |
| 1206 | -function getAttachmentPosition($id_attach) |
|
| 1206 | +function getAttachmentPosition ($id_attach) |
|
| 1207 | 1207 | { |
| 1208 | 1208 | $db = database(); |
| 1209 | 1209 | |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | * |
| 1241 | 1241 | * @return array|bool |
| 1242 | 1242 | */ |
| 1243 | -function elk_getimagesize($file, $error = 'array') |
|
| 1243 | +function elk_getimagesize ($file, $error = 'array') |
|
| 1244 | 1244 | { |
| 1245 | 1245 | $sizes = @getimagesize($file); |
| 1246 | 1246 | |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | * |
| 1262 | 1262 | * @return bool|string |
| 1263 | 1263 | */ |
| 1264 | -function returnMimeThumb($file_ext, $url = false) |
|
| 1264 | +function returnMimeThumb ($file_ext, $url = false) |
|
| 1265 | 1265 | { |
| 1266 | 1266 | global $settings; |
| 1267 | 1267 | |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | * |
| 1313 | 1313 | * @return string |
| 1314 | 1314 | */ |
| 1315 | -function getValidMimeImageType($mime) |
|
| 1315 | +function getValidMimeImageType ($mime) |
|
| 1316 | 1316 | { |
| 1317 | 1317 | // These are the only valid image types. |
| 1318 | 1318 | $validImageTypes = array( |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | * @param string $filename |
| 1346 | 1346 | * @return string |
| 1347 | 1347 | */ |
| 1348 | -function getMimeType($filename) |
|
| 1348 | +function getMimeType ($filename) |
|
| 1349 | 1349 | { |
| 1350 | 1350 | $mimeType = ''; |
| 1351 | 1351 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @param string $id_attach String version of the attachment id |
| 44 | 44 | */ |
| 45 | - public function __construct($id_attach) |
|
| 45 | + public function __construct ($id_attach) |
|
| 46 | 46 | { |
| 47 | 47 | $this->string_attach = $id_attach; |
| 48 | 48 | // Non-temporary attachments shall have integer ids |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * Temporary attachments have special names, so need slightly special handling |
| 58 | 58 | */ |
| 59 | - public function isTemporary() |
|
| 59 | + public function isTemporary () |
|
| 60 | 60 | { |
| 61 | 61 | // Temporary attachment, special case... |
| 62 | 62 | return strpos($this->string_attach, 'post_tmp_' . User::$info->id . '_') !== false; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param null|int $id_topic |
| 70 | 70 | * @throws \ElkArte\Exceptions\Exception |
| 71 | 71 | */ |
| 72 | - public function validate($type, $id_topic = null) |
|
| 72 | + public function validate ($type, $id_topic = null) |
|
| 73 | 73 | { |
| 74 | 74 | if (empty($this->id_attach)) |
| 75 | 75 | { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | /** |
| 119 | 119 | * Same as validate, but for temporary attachments |
| 120 | 120 | */ |
| 121 | - protected function validateTemporary() |
|
| 121 | + protected function validateTemporary () |
|
| 122 | 122 | { |
| 123 | 123 | global $modSettings; |
| 124 | 124 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * @param bool $inline |
| 160 | 160 | * @param bool $use_compression |
| 161 | 161 | */ |
| 162 | - public function send($inline, $use_compression) |
|
| 162 | + public function send ($inline, $use_compression) |
|
| 163 | 163 | { |
| 164 | 164 | if (empty($this->id_attach) || empty($this->data['real_filename'])) |
| 165 | 165 | { |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $image = new Image($this->file_path); |
| 194 | 194 | |
| 195 | 195 | $this->file_path = $this->file_path . '_thumb'; |
| 196 | - $image->createThumbnail(100, 100, $this->file_path, '',false); |
|
| 196 | + $image->createThumbnail(100, 100, $this->file_path, '', false); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | return $this->send_file($use_compression && $this->isCompressible()); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | /** |
| 203 | 203 | * Is the atachment is approved or not |
| 204 | 204 | */ |
| 205 | - public function isApproved() |
|
| 205 | + public function isApproved () |
|
| 206 | 206 | { |
| 207 | 207 | return !empty($this->data['is_approved']); |
| 208 | 208 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | /** |
| 211 | 211 | * If the user requesting the attachment is its owner |
| 212 | 212 | */ |
| 213 | - public function isOwner() |
|
| 213 | + public function isOwner () |
|
| 214 | 214 | { |
| 215 | 215 | return (int) $this->data['id_member'] !== 0 && User::$info->id === (int) $this->data['id_member']; |
| 216 | 216 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | /** |
| 219 | 219 | * If the attachment is an avatar |
| 220 | 220 | */ |
| 221 | - public function isAvatar() |
|
| 221 | + public function isAvatar () |
|
| 222 | 222 | { |
| 223 | 223 | return $this->data['attachment_type'] == Attachment::DB_TYPE_AVATAR; |
| 224 | 224 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param null|string $text |
| 230 | 230 | * @throws \ElkArte\Exceptions\Exception |
| 231 | 231 | */ |
| 232 | - public function noAttach($text = null) |
|
| 232 | + public function noAttach ($text = null) |
|
| 233 | 233 | { |
| 234 | 234 | global $txt; |
| 235 | 235 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | * @param int $id_attach |
| 267 | 267 | * @package Attachments |
| 268 | 268 | */ |
| 269 | - public function increaseDownloadCounter() |
|
| 269 | + public function increaseDownloadCounter () |
|
| 270 | 270 | { |
| 271 | 271 | if (empty($this->id_attach) || $this->isAvatar()) |
| 272 | 272 | { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * Sends the requested file to the user. If the file is compressible e.g. |
| 288 | 288 | * has a mine type of text/??? may compress the file prior to sending. |
| 289 | 289 | */ |
| 290 | - protected function send_file($use_compression) |
|
| 290 | + protected function send_file ($use_compression) |
|
| 291 | 291 | { |
| 292 | 292 | $headers = Headers::instance(); |
| 293 | 293 | $body = file_get_contents($this->file_path); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * |
| 314 | 314 | * @return bool if we should compress the file |
| 315 | 315 | */ |
| 316 | - protected function isCompressible() |
|
| 316 | + protected function isCompressible () |
|
| 317 | 317 | { |
| 318 | 318 | // Not compressible, or not supported / requested by client |
| 319 | 319 | return (bool) preg_match('~^(?:text/|application/(?:json|xml|rss\+xml)$)~i', $this->data['mime_type']); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * @param bool $do_cache If send the a max-age header or not |
| 331 | 331 | * @param bool $check_filename When false, any check on $filename is skipped |
| 332 | 332 | */ |
| 333 | - protected function prepare_headers($filename, $eTag, $mime_type, $disposition, $real_filename, $do_cache, $check_filename = true) |
|
| 333 | + protected function prepare_headers ($filename, $eTag, $mime_type, $disposition, $real_filename, $do_cache, $check_filename = true) |
|
| 334 | 334 | { |
| 335 | 335 | global $txt; |
| 336 | 336 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | /** |
| 413 | 413 | * Some magic in case data are not available immediately |
| 414 | 414 | */ |
| 415 | - protected function rebuildData($id_topic) |
|
| 415 | + protected function rebuildData ($id_topic) |
|
| 416 | 416 | { |
| 417 | 417 | global $modSettings; |
| 418 | 418 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * @return array |
| 461 | 461 | * @package Attachments |
| 462 | 462 | */ |
| 463 | - protected function getAvatar() |
|
| 463 | + protected function getAvatar () |
|
| 464 | 464 | { |
| 465 | 465 | // Use our cache when possible |
| 466 | 466 | $cache = array(); |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | 'blank_id_member' => 0, |
| 484 | 484 | ) |
| 485 | 485 | )->fetch_callback( |
| 486 | - function ($row) use (&$avatarData) { |
|
| 486 | + function($row) use (&$avatarData) { |
|
| 487 | 487 | $avatarData = $row; |
| 488 | 488 | } |
| 489 | 489 | ); |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * @return array |
| 509 | 509 | * @package Attachments |
| 510 | 510 | */ |
| 511 | - protected function getFromTopic($id_topic) |
|
| 511 | + protected function getFromTopic ($id_topic) |
|
| 512 | 512 | { |
| 513 | 513 | // Make sure this attachment is on this board. |
| 514 | 514 | $attachmentData = array(); |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | * @return array |
| 551 | 551 | * @package Attachments |
| 552 | 552 | */ |
| 553 | - function getThumbFromTopic($id_topic) |
|
| 553 | + function getThumbFromTopic ($id_topic) |
|
| 554 | 554 | { |
| 555 | 555 | // Make sure this attachment is on this board. |
| 556 | 556 | $request = $this->db->fetchQuery(' |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * {@inheritdoc } |
| 44 | 44 | */ |
| 45 | - public function needTheme($action = '') |
|
| 45 | + public function needTheme ($action = '') |
|
| 46 | 46 | { |
| 47 | 47 | global $modSettings, $maintenance; |
| 48 | 48 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * {@inheritdoc } |
| 69 | 69 | */ |
| 70 | - public function trackStats($action = '') |
|
| 70 | + public function trackStats ($action = '') |
|
| 71 | 71 | { |
| 72 | 72 | return false; |
| 73 | 73 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * The default action is to download an attachment. |
| 77 | 77 | * This allows ?action=attachment to be forwarded to action_dlattach() |
| 78 | 78 | */ |
| 79 | - public function action_index() |
|
| 79 | + public function action_index () |
|
| 80 | 80 | { |
| 81 | 81 | // add a subaction array to act accordingly |
| 82 | 82 | $subActions = array( |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * - Pass the form data with session vars |
| 102 | 102 | * - Responds back with errors or file data |
| 103 | 103 | */ |
| 104 | - public function action_ulattach() |
|
| 104 | + public function action_ulattach () |
|
| 105 | 105 | { |
| 106 | 106 | global $context, $modSettings, $txt; |
| 107 | 107 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | * - Requires file name and file path |
| 190 | 190 | * - Responds back with success or error |
| 191 | 191 | */ |
| 192 | - public function action_rmattach() |
|
| 192 | + public function action_rmattach () |
|
| 193 | 193 | { |
| 194 | 194 | global $context, $txt; |
| 195 | 195 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * |
| 276 | 276 | * @throws \ElkArte\Exceptions\Exception |
| 277 | 277 | */ |
| 278 | - public function action_dlattach() |
|
| 278 | + public function action_dlattach () |
|
| 279 | 279 | { |
| 280 | 280 | global $modSettings, $context, $topic, $board; |
| 281 | 281 | |