@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | array( |
21 | 21 | 'module_basename' => '\florinp\messenger\ucp\ucp_friends_module', |
22 | 22 | 'module_class' => 'ucp_friends_module', |
23 | - 'modes' => array('friends','requests'), |
|
23 | + 'modes' => array('friends', 'requests'), |
|
24 | 24 | ), |
25 | 25 | ) |
26 | 26 | ), |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | array( |
37 | 37 | 'module_basename' => '\florinp\messenger\ucp\ucp_friends_module', |
38 | 38 | 'module_class' => 'ucp_friends_module', |
39 | - 'modes' => array('friends','requests'), |
|
39 | + 'modes' => array('friends', 'requests'), |
|
40 | 40 | ) |
41 | 41 | ) |
42 | 42 | ), |
@@ -63,12 +63,12 @@ |
||
63 | 63 | public function get_title() |
64 | 64 | { |
65 | 65 | $user_id = $this->user_loader->load_user_by_username($this->get_data('sender_username')); |
66 | - return $this->user->lang('FRIEND_REQUEST_FROM') .$this->user_loader->get_username($user_id, 'no_profile'); |
|
66 | + return $this->user->lang('FRIEND_REQUEST_FROM').$this->user_loader->get_username($user_id, 'no_profile'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | public function get_url() |
70 | 70 | { |
71 | - return append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext, "i=-florinp-messenger-ucp-ucp_friends_module&mode=requests"); |
|
71 | + return append_sid($this->phpbb_root_path.'ucp.'.$this->php_ext, "i=-florinp-messenger-ucp-ucp_friends_module&mode=requests"); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | public function get_avatar() |
@@ -17,22 +17,22 @@ discard block |
||
17 | 17 | |
18 | 18 | $this->tpl_name = 'friends'; |
19 | 19 | |
20 | - switch($mode) |
|
20 | + switch ($mode) |
|
21 | 21 | { |
22 | 22 | case 'friends': |
23 | 23 | |
24 | 24 | $action = $request->variable('action', ''); |
25 | - switch($action) |
|
25 | + switch ($action) |
|
26 | 26 | { |
27 | 27 | case 'add_friend': |
28 | 28 | $user_id = $request->variable('user_id', 0); |
29 | - if($user_id > 0) |
|
29 | + if ($user_id > 0) |
|
30 | 30 | { |
31 | - if(confirm_box(true)) |
|
31 | + if (confirm_box(true)) |
|
32 | 32 | { |
33 | 33 | $user_id = $request->variable('user_id', 0); |
34 | 34 | $redirect_url = $request->variable('redirect_url', ''); |
35 | - if($friends_controller->send_request($user_id)) |
|
35 | + if ($friends_controller->send_request($user_id)) |
|
36 | 36 | { |
37 | 37 | redirect($redirect_url); |
38 | 38 | } |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | } |
72 | 72 | break; |
73 | 73 | default: |
74 | - if($request->is_set_post('action')) |
|
74 | + if ($request->is_set_post('action')) |
|
75 | 75 | { |
76 | 76 | $action = $request->variable('action', ''); |
77 | - switch($action) |
|
77 | + switch ($action) |
|
78 | 78 | { |
79 | 79 | case 'remove': |
80 | - if(confirm_box(true)) |
|
80 | + if (confirm_box(true)) |
|
81 | 81 | { |
82 | 82 | $user_id = $request->variable('user_id', array(0)); |
83 | 83 | $redirect_url = $request->variable('redirect_url', ''); |
84 | - if($friends_controller->remove_friend($user_id)) |
|
84 | + if ($friends_controller->remove_friend($user_id)) |
|
85 | 85 | { |
86 | 86 | redirect($redirect_url); |
87 | 87 | } |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | |
107 | 107 | case 'requests': |
108 | 108 | |
109 | - if($request->is_set_post('action')) |
|
109 | + if ($request->is_set_post('action')) |
|
110 | 110 | { |
111 | 111 | $action = $request->variable('action', ''); |
112 | 112 | |
113 | - switch($action) |
|
113 | + switch ($action) |
|
114 | 114 | { |
115 | 115 | case 'delete': |
116 | 116 | |
117 | - if(confirm_box(true)) |
|
117 | + if (confirm_box(true)) |
|
118 | 118 | { |
119 | 119 | $requests_id = $request->variable('requests_id', array(0)); |
120 | 120 | $friends_controller->delete_request($requests_id); |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | $action = $request->variable('action', ''); |
141 | - switch($action) |
|
141 | + switch ($action) |
|
142 | 142 | { |
143 | 143 | case 'cancel_request': |
144 | - if(confirm_box(true)) |
|
144 | + if (confirm_box(true)) |
|
145 | 145 | { |
146 | 146 | $request_id = $request->variable('request_id', 0); |
147 | 147 | $redirect_url = $request->variable('redirect_url', ''); |
148 | - if($friends_controller->delete_request($request_id)) |
|
148 | + if ($friends_controller->delete_request($request_id)) |
|
149 | 149 | { |
150 | 150 | redirect($redirect_url); |
151 | 151 | } |
@@ -12,8 +12,8 @@ discard block |
||
12 | 12 | { |
13 | 13 | global $phpbb_root_path; |
14 | 14 | |
15 | - $database = $phpbb_root_path . 'store/messenger.db'; |
|
16 | - parent::__construct('sqlite:' . $database); |
|
15 | + $database = $phpbb_root_path.'store/messenger.db'; |
|
16 | + parent::__construct('sqlite:'.$database); |
|
17 | 17 | parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
18 | 18 | } |
19 | 19 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | //ksort($data); |
42 | 42 | |
43 | 43 | $fieldNames = implode('`, `', array_keys($data)); |
44 | - $fieldValues = ':' . implode(', :', array_keys($data)); |
|
44 | + $fieldValues = ':'.implode(', :', array_keys($data)); |
|
45 | 45 | |
46 | 46 | $sth = $this->prepare("INSERT INTO $table (`$fieldNames`) VALUES ($fieldValues)"); |
47 | 47 |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function __construct($phpbb_root_path) |
149 | 149 | { |
150 | - $phpbb_root_path = $phpbb_root_path . 'store/messenger/files'; |
|
150 | + $phpbb_root_path = $phpbb_root_path.'store/messenger/files'; |
|
151 | 151 | // set & create destination path |
152 | 152 | if (!$this->set_destination($phpbb_root_path)) { |
153 | - throw new Exception('Upload: Can\'t create destination. ' . $this->root . $this->destination); |
|
153 | + throw new Exception('Upload: Can\'t create destination. '.$this->root.$this->destination); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | //create finfo object |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | $this->file['filename'] = $this->filename; |
245 | 245 | |
246 | 246 | //set full path |
247 | - $this->file['full_path'] = $this->root . $this->destination . $this->filename; |
|
248 | - $this->file['path'] = $this->destination . $this->filename; |
|
247 | + $this->file['full_path'] = $this->root.$this->destination.$this->filename; |
|
248 | + $this->file['path'] = $this->destination.$this->filename; |
|
249 | 249 | |
250 | 250 | $status = move_uploaded_file($this->tmp_name, $this->file['full_path']); |
251 | 251 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | */ |
477 | 477 | protected function set_destination($destination) |
478 | 478 | { |
479 | - $this->destination = $destination . DIRECTORY_SEPARATOR; |
|
479 | + $this->destination = $destination.DIRECTORY_SEPARATOR; |
|
480 | 480 | return $this->destination_exist() ? TRUE : $this->create_destination(); |
481 | 481 | } |
482 | 482 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | */ |
488 | 488 | protected function destination_exist() |
489 | 489 | { |
490 | - return is_writable($this->root . $this->destination); |
|
490 | + return is_writable($this->root.$this->destination); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | */ |
498 | 498 | protected function create_destination() |
499 | 499 | { |
500 | - return mkdir($this->root . $this->destination, $this->default_permissions, true); |
|
500 | + return mkdir($this->root.$this->destination, $this->default_permissions, true); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | protected function create_new_filename() |
509 | 509 | { |
510 | - $filename = sha1(mt_rand(1, 9999) . $this->destination . uniqid()) . time() . '.' . $this->extension; |
|
510 | + $filename = sha1(mt_rand(1, 9999).$this->destination.uniqid()).time().'.'.$this->extension; |
|
511 | 511 | $this->set_filename($filename); |
512 | 512 | } |
513 | 513 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $phpbb_root_path phpBB root path |
34 | 34 | */ |
35 | 35 | public function __construct($phpbb_root_path) { |
36 | - $this->directory = $phpbb_root_path . 'store/messenger/files'; |
|
36 | + $this->directory = $phpbb_root_path.'store/messenger/files'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | * @throws InvalidArgumentException when the file not exist or is not readable |
44 | 44 | */ |
45 | 45 | public function setFile($filename) { |
46 | - $file_full_path = $this->directory . '/'. $filename; |
|
47 | - if(!is_file($file_full_path)) { |
|
46 | + $file_full_path = $this->directory.'/'.$filename; |
|
47 | + if (!is_file($file_full_path)) { |
|
48 | 48 | throw new InvalidArgumentException("File does not exist"); |
49 | - } else if(!is_readable($file_full_path)) { |
|
49 | + } else if (!is_readable($file_full_path)) { |
|
50 | 50 | throw new InvalidArgumentException("File to download is not readable."); |
51 | 51 | } |
52 | 52 | $this->filename = $filename; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param bool|true $forceDownload |
81 | 81 | */ |
82 | 82 | public function sendDownload($forceDownload = true) { |
83 | - if(headers_sent()) { |
|
83 | + if (headers_sent()) { |
|
84 | 84 | throw new \RuntimeException("Cannot send file to the browser, since the headers were already sent"); |
85 | 85 | } |
86 | 86 | $mimeType = $this->getMimeType(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | header("Cache-Control: private", false); |
96 | 96 | header("Content-Type: application/octet-stream"); |
97 | 97 | |
98 | - if($forceDownload) { |
|
98 | + if ($forceDownload) { |
|
99 | 99 | header("Content-Disposition: attachment; filename=\"{$this->filename}\";"); |
100 | 100 | } else { |
101 | 101 | header("Content-Disposition: filename=\"{$this->filename}\";"); |
@@ -219,7 +219,7 @@ |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | $friends = $this->model->getFriends(); |
222 | - $friends_online = array_filter($friends, function ($friend) { |
|
222 | + $friends_online = array_filter($friends, function($friend) { |
|
223 | 223 | return $friend['user_status'] != 0; |
224 | 224 | }); |
225 | 225 |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | ); |
34 | 34 | "); |
35 | 35 | |
36 | - $messengerDir = $phpbb_root_path . 'store/messenger'; |
|
36 | + $messengerDir = $phpbb_root_path.'store/messenger'; |
|
37 | 37 | if (!is_dir($messengerDir)) { |
38 | 38 | mkdir($messengerDir, 0777); |
39 | - $filesDir = $messengerDir . '/files'; |
|
39 | + $filesDir = $messengerDir.'/files'; |
|
40 | 40 | if (!is_dir($filesDir)) { |
41 | 41 | mkdir($filesDir, 0777); |
42 | 42 | } |
@@ -77,24 +77,24 @@ discard block |
||
77 | 77 | { |
78 | 78 | global $phpbb_root_path; |
79 | 79 | |
80 | - $database = $phpbb_root_path . 'store/messenger.db'; |
|
80 | + $database = $phpbb_root_path.'store/messenger.db'; |
|
81 | 81 | if (is_file($database)) { |
82 | 82 | unlink($database); |
83 | 83 | } |
84 | 84 | |
85 | - $messengerDir = $phpbb_root_path . 'store/messenger'; |
|
85 | + $messengerDir = $phpbb_root_path.'store/messenger'; |
|
86 | 86 | if (is_dir($messengerDir)) { |
87 | 87 | $objects = scandir($messengerDir); |
88 | 88 | foreach ($objects as $object) { |
89 | 89 | if ($object != '.' && $object != '..') { |
90 | - if (filetype($messengerDir . "/" . $object) == "dir") { |
|
91 | - $dir = $messengerDir . "/" . $object; |
|
90 | + if (filetype($messengerDir."/".$object) == "dir") { |
|
91 | + $dir = $messengerDir."/".$object; |
|
92 | 92 | $subObjects = scandir($dir); |
93 | - if(count($subObjects) > 0) { |
|
94 | - foreach($subObjects as $subObject) { |
|
95 | - if($subObject != '.' && $subObject != '..') { |
|
96 | - if(filetype($dir . '/' . $subObject) != 'dir') { |
|
97 | - unlink($dir . '/' . $subObject); |
|
93 | + if (count($subObjects) > 0) { |
|
94 | + foreach ($subObjects as $subObject) { |
|
95 | + if ($subObject != '.' && $subObject != '..') { |
|
96 | + if (filetype($dir.'/'.$subObject) != 'dir') { |
|
97 | + unlink($dir.'/'.$subObject); |
|
98 | 98 | } |
99 | 99 | } else { |
100 | 100 | continue; |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | } |
105 | - rmdir($messengerDir . "/" . $object); |
|
105 | + rmdir($messengerDir."/".$object); |
|
106 | 106 | } else { |
107 | - unlink($messengerDir . "/" . $object); |
|
107 | + unlink($messengerDir."/".$object); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | { |
68 | 68 | $context = new RequestContext(); |
69 | 69 | $context->fromRequest($this->symfony_request); |
70 | - $baseUrl = generate_board_url(true) . $context->getBaseUrl(); |
|
70 | + $baseUrl = generate_board_url(true).$context->getBaseUrl(); |
|
71 | 71 | |
72 | 72 | $scriptName = $this->symfony_request->getScriptName(); |
73 | 73 | $scriptName = substr($scriptName, -1, 1) == '/' ? '' : utf8_basename($scriptName); |
74 | 74 | |
75 | 75 | if ($scriptName != '') { |
76 | - $baseUrl = str_replace('/' . $scriptName, '', $baseUrl); |
|
76 | + $baseUrl = str_replace('/'.$scriptName, '', $baseUrl); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $friends = $this->model->getFriends(); |
80 | - $friends_online = array_filter($friends, function ($friend) { |
|
80 | + $friends_online = array_filter($friends, function($friend) { |
|
81 | 81 | return $friend['user_status'] != 0; |
82 | 82 | }); |
83 | 83 | $this->template->assign_var('S_COUNT_FRIENDS', count($friends_online)); |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | { |
119 | 119 | $context = new RequestContext(); |
120 | 120 | $context->fromRequest($this->symfony_request); |
121 | - $baseUrl = generate_board_url(true) . $context->getBaseUrl(); |
|
121 | + $baseUrl = generate_board_url(true).$context->getBaseUrl(); |
|
122 | 122 | |
123 | 123 | $scriptName = $this->symfony_request->getScriptName(); |
124 | 124 | $scriptName = substr($scriptName, -1, 1) == '/' ? '' : utf8_basename($scriptName); |
125 | 125 | |
126 | 126 | if ($scriptName != '') { |
127 | - $baseUrl = str_replace('/' . $scriptName, '', $baseUrl); |
|
127 | + $baseUrl = str_replace('/'.$scriptName, '', $baseUrl); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $user_id = $event['member']['user_id']; |