@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | protected $phpbb_db; |
| 11 | 11 | protected $user; |
| 12 | 12 | protected $db; |
| 13 | - protected $friends_request_table; |
|
| 13 | + protected $friends_request_table; |
|
| 14 | 14 | protected $user_friends_table; |
| 15 | - protected $emojione; |
|
| 15 | + protected $emojione; |
|
| 16 | 16 | |
| 17 | 17 | public function __construct(\phpbb\config\config $config, \phpbb\controller\helper $helper, \phpbb\db\driver\driver_interface $phpbb_db, \phpbb\user $user, \florinp\messenger\libs\database $db, \florinp\messenger\libs\emojione $emojione, $friends_request_table, $user_friends_table) |
| 18 | 18 | { |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | $this->phpbb_db = $phpbb_db; |
| 22 | 22 | $this->user = $user; |
| 23 | 23 | $this->db = $db; |
| 24 | - $this->emojione = $emojione; |
|
| 25 | - $this->friends_request_table = $friends_request_table; |
|
| 26 | - $this->user_friends_table = $user_friends_table; |
|
| 24 | + $this->emojione = $emojione; |
|
| 25 | + $this->friends_request_table = $friends_request_table; |
|
| 26 | + $this->user_friends_table = $user_friends_table; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'user_id' => $row['user_id'], |
| 56 | 56 | 'username' => $row['username_clean'], |
| 57 | 57 | 'user_colour' => $row['user_colour'], |
| 58 | - 'user_status' => ($row['session_time'] >= (time() - ($this->config['load_online_time'] * 60))) ? 1 : 0, |
|
| 58 | + 'user_status' => ($row['session_time'] >= (time() - ($this->config['load_online_time'] * 60))) ? 1 : 0, |
|
| 59 | 59 | 'inbox' => $this->getInboxFromId($row['user_id']) |
| 60 | 60 | ); |
| 61 | 61 | } |
@@ -40,16 +40,16 @@ discard block |
||
| 40 | 40 | u.user_colour, |
| 41 | 41 | s.session_id, |
| 42 | 42 | s.session_time |
| 43 | - FROM ". $this->user_friends_table ." |
|
| 44 | - LEFT JOIN ". USERS_TABLE ." AS u ON u.user_id = ". $this->user_friends_table .".friend_id |
|
| 45 | - LEFT JOIN ". SESSIONS_TABLE ." AS s ON s.session_user_id = u.user_id |
|
| 46 | - WHERE ". $this->user_friends_table .".user_id = ". (int)$this->user->data['user_id'] ." |
|
| 43 | + FROM ". $this->user_friends_table." |
|
| 44 | + LEFT JOIN ". USERS_TABLE." AS u ON u.user_id = ".$this->user_friends_table.".friend_id |
|
| 45 | + LEFT JOIN ". SESSIONS_TABLE." AS s ON s.session_user_id = u.user_id |
|
| 46 | + WHERE ". $this->user_friends_table.".user_id = ".(int)$this->user->data['user_id']." |
|
| 47 | 47 | GROUP BY u.user_id |
| 48 | 48 | "; |
| 49 | 49 | $result = $this->phpbb_db->sql_query($sql); |
| 50 | 50 | |
| 51 | 51 | $friends = array(); |
| 52 | - while($row = $this->phpbb_db->sql_fetchrow($result)) |
|
| 52 | + while ($row = $this->phpbb_db->sql_fetchrow($result)) |
|
| 53 | 53 | { |
| 54 | 54 | $friends[] = array( |
| 55 | 55 | 'user_id' => $row['user_id'], |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $sql = " |
| 73 | 73 | SELECT COUNT(zebra_id) as friend_count |
| 74 | - FROM ". ZEBRA_TABLE ." |
|
| 75 | - WHERE user_id = ". (int)$friend_id ." |
|
| 76 | - AND zebra_id = ". (int)$this->user->data['user_id'] ." |
|
| 74 | + FROM ". ZEBRA_TABLE." |
|
| 75 | + WHERE user_id = ". (int)$friend_id." |
|
| 76 | + AND zebra_id = ". (int)$this->user->data['user_id']." |
|
| 77 | 77 | AND friend = 1 |
| 78 | 78 | AND foe = 0 |
| 79 | 79 | "; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $friend_count = (int)$this->phpbb_db->sql_fetchfield('friend_count'); |
| 82 | 82 | $this->phpbb_db->sql_freeresult($result); |
| 83 | 83 | |
| 84 | - if($friend_count > 0) { |
|
| 84 | + if ($friend_count > 0) { |
|
| 85 | 85 | return true; |
| 86 | 86 | } else { |
| 87 | 87 | return false; |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | 'sentAt' => time() |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - if($this->db->insert('messages', $insert)) |
|
| 117 | + if ($this->db->insert('messages', $insert)) |
|
| 118 | 118 | return $this->db->lastInsertId(); |
| 119 | 119 | else |
| 120 | 120 | return false; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | 'sentAt' => time() |
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | - if($this->db->insert('files', $insert)) |
|
| 134 | + if ($this->db->insert('files', $insert)) |
|
| 135 | 135 | return $this->db->lastInsertId(); |
| 136 | 136 | else |
| 137 | 137 | return false; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | )); |
| 202 | 202 | |
| 203 | 203 | $sent = array(); |
| 204 | - foreach($sentMessages as $msg) |
|
| 204 | + foreach ($sentMessages as $msg) |
|
| 205 | 205 | { |
| 206 | 206 | $item = array(); |
| 207 | 207 | $item['id'] = $msg['id']; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $sent[] = $item; |
| 215 | 215 | } |
| 216 | 216 | $inbox = array(); |
| 217 | - foreach($getInbox as $msg) |
|
| 217 | + foreach ($getInbox as $msg) |
|
| 218 | 218 | { |
| 219 | 219 | $item = array(); |
| 220 | 220 | $item['id'] = $msg['id']; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $inbox[] = $item; |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - foreach($sentFiles as $file) { |
|
| 230 | + foreach ($sentFiles as $file) { |
|
| 231 | 231 | $item = array(); |
| 232 | 232 | $item['id'] = 'f_'.$file['id']; |
| 233 | 233 | $item['sender_id'] = $file['sender_id']; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $sent[] = $item; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - foreach($getFiles as $file) { |
|
| 243 | + foreach ($getFiles as $file) { |
|
| 244 | 244 | $item = array(); |
| 245 | 245 | $item['id'] = 'f_'.$file['id']; |
| 246 | 246 | $item['sender_id'] = $file['sender_id']; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | }); |
| 261 | 261 | |
| 262 | 262 | $sorted_messages = array(); |
| 263 | - foreach($unsorted_messages as $msg) |
|
| 263 | + foreach ($unsorted_messages as $msg) |
|
| 264 | 264 | { |
| 265 | 265 | $sorted_messages[] = $msg; |
| 266 | 266 | } |
@@ -114,10 +114,11 @@ discard block |
||
| 114 | 114 | 'sentAt' => time() |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - if($this->db->insert('messages', $insert)) |
|
| 118 | - return $this->db->lastInsertId(); |
|
| 119 | - else |
|
| 120 | - return false; |
|
| 117 | + if($this->db->insert('messages', $insert)) { |
|
| 118 | + return $this->db->lastInsertId(); |
|
| 119 | + } else { |
|
| 120 | + return false; |
|
| 121 | + } |
|
| 121 | 122 | } |
| 122 | 123 | |
| 123 | 124 | public function sendFile($data) |
@@ -131,10 +132,11 @@ discard block |
||
| 131 | 132 | 'sentAt' => time() |
| 132 | 133 | ); |
| 133 | 134 | |
| 134 | - if($this->db->insert('files', $insert)) |
|
| 135 | - return $this->db->lastInsertId(); |
|
| 136 | - else |
|
| 137 | - return false; |
|
| 135 | + if($this->db->insert('files', $insert)) { |
|
| 136 | + return $this->db->lastInsertId(); |
|
| 137 | + } else { |
|
| 138 | + return false; |
|
| 139 | + } |
|
| 138 | 140 | } |
| 139 | 141 | |
| 140 | 142 | public function getMessageById($id) |
@@ -7,99 +7,99 @@ |
||
| 7 | 7 | |
| 8 | 8 | public function get_type() |
| 9 | 9 | { |
| 10 | - return 'florinp.messenger.notification.type.friend_request'; |
|
| 10 | + return 'florinp.messenger.notification.type.friend_request'; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) |
| 14 | 14 | { |
| 15 | - $this->user_loader = $user_loader; |
|
| 16 | - $this->db = $db; |
|
| 17 | - $this->cache = $cache; |
|
| 18 | - $this->user = $user; |
|
| 19 | - $this->auth = $auth; |
|
| 20 | - $this->config = $config; |
|
| 21 | - $this->phpbb_root_path = $phpbb_root_path; |
|
| 22 | - $this->php_ext = $php_ext; |
|
| 23 | - $this->notification_types_table = $notification_types_table; |
|
| 24 | - $this->notifications_table = $notifications_table; |
|
| 25 | - $this->user_notifications_table = $user_notifications_table; |
|
| 15 | + $this->user_loader = $user_loader; |
|
| 16 | + $this->db = $db; |
|
| 17 | + $this->cache = $cache; |
|
| 18 | + $this->user = $user; |
|
| 19 | + $this->auth = $auth; |
|
| 20 | + $this->config = $config; |
|
| 21 | + $this->phpbb_root_path = $phpbb_root_path; |
|
| 22 | + $this->php_ext = $php_ext; |
|
| 23 | + $this->notification_types_table = $notification_types_table; |
|
| 24 | + $this->notifications_table = $notifications_table; |
|
| 25 | + $this->user_notifications_table = $user_notifications_table; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public static $notification_option = array( |
| 29 | - 'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS', |
|
| 29 | + 'group' => 'NOTIFICATION_GROUP_MISCELLANEOUS', |
|
| 30 | 30 | ); |
| 31 | 31 | |
| 32 | 32 | public function is_available() |
| 33 | 33 | { |
| 34 | - return true; |
|
| 34 | + return true; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public static function get_item_id($data) |
| 38 | 38 | { |
| 39 | - return (int)$data['request_id']; |
|
| 39 | + return (int)$data['request_id']; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public static function get_item_parent_id($data) |
| 43 | 43 | { |
| 44 | - return 0; |
|
| 44 | + return 0; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function users_to_query() |
| 48 | 48 | { |
| 49 | - return array(); |
|
| 49 | + return array(); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function find_users_for_notification($data, $options = array()) |
| 53 | 53 | { |
| 54 | - $options = array_merge(array( |
|
| 55 | - 'ignore_users' => array(), |
|
| 56 | - ), $options); |
|
| 54 | + $options = array_merge(array( |
|
| 55 | + 'ignore_users' => array(), |
|
| 56 | + ), $options); |
|
| 57 | 57 | |
| 58 | - $users = array($data['user_id']); |
|
| 58 | + $users = array($data['user_id']); |
|
| 59 | 59 | |
| 60 | - return $this->check_user_notification_options($users, $options); |
|
| 60 | + return $this->check_user_notification_options($users, $options); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function get_title() |
| 64 | 64 | { |
| 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'); |
|
| 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'); |
|
| 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() |
| 75 | 75 | { |
| 76 | - $user_id = $this->user_loader->load_user_by_username($this->get_data('sender_username')); |
|
| 77 | - return $this->user_loader->get_avatar($user_id); |
|
| 76 | + $user_id = $this->user_loader->load_user_by_username($this->get_data('sender_username')); |
|
| 77 | + return $this->user_loader->get_avatar($user_id); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function get_redirect_url() |
| 81 | 81 | { |
| 82 | - return $this->get_url(); |
|
| 82 | + return $this->get_url(); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function get_email_template() |
| 86 | 86 | { |
| 87 | - return false; |
|
| 87 | + return false; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function get_email_template_variables() |
| 91 | 91 | { |
| 92 | - return array(); |
|
| 92 | + return array(); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function create_insert_array($data, $pre_create_data = array()) |
| 96 | 96 | { |
| 97 | - $this->set_data('request_id', $data['request_id']); |
|
| 98 | - $this->set_data('sender_id', $data['sender_id']); |
|
| 99 | - $this->set_data('sender_username', $data['sender_username']); |
|
| 100 | - $this->set_data('user_id', $data['user_id']); |
|
| 97 | + $this->set_data('request_id', $data['request_id']); |
|
| 98 | + $this->set_data('sender_id', $data['sender_id']); |
|
| 99 | + $this->set_data('sender_username', $data['sender_username']); |
|
| 100 | + $this->set_data('user_id', $data['user_id']); |
|
| 101 | 101 | |
| 102 | - return parent::create_insert_array($data, $pre_create_data); |
|
| 102 | + return parent::create_insert_array($data, $pre_create_data); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -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() |
@@ -7,20 +7,20 @@ |
||
| 7 | 7 | |
| 8 | 8 | function module() |
| 9 | 9 | { |
| 10 | - return array( |
|
| 11 | - 'filename' => '\florinp\messenger\ucp\ucp_friends_module', |
|
| 12 | - 'title' => 'CHAT_BOX', |
|
| 13 | - 'modes' => array( |
|
| 14 | - 'friends' => array( |
|
| 15 | - 'title' => 'FRIENDS_LIST', |
|
| 16 | - 'auth' => 'ext_florinp/messenger && acl_u_access_messenger' |
|
| 17 | - ), |
|
| 18 | - 'requests' => array( |
|
| 19 | - 'title' => 'FRIENDS_REQUESTS', |
|
| 20 | - 'auth' => 'ext_florinp/messenger && acl_u_access_messenger', |
|
| 21 | - ), |
|
| 22 | - ) |
|
| 23 | - ); |
|
| 10 | + return array( |
|
| 11 | + 'filename' => '\florinp\messenger\ucp\ucp_friends_module', |
|
| 12 | + 'title' => 'CHAT_BOX', |
|
| 13 | + 'modes' => array( |
|
| 14 | + 'friends' => array( |
|
| 15 | + 'title' => 'FRIENDS_LIST', |
|
| 16 | + 'auth' => 'ext_florinp/messenger && acl_u_access_messenger' |
|
| 17 | + ), |
|
| 18 | + 'requests' => array( |
|
| 19 | + 'title' => 'FRIENDS_REQUESTS', |
|
| 20 | + 'auth' => 'ext_florinp/messenger && acl_u_access_messenger', |
|
| 21 | + ), |
|
| 22 | + ) |
|
| 23 | + ); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | } |
@@ -10,16 +10,16 @@ discard block |
||
| 10 | 10 | public function main($id, $mode) |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - global $phpbb_container, $request, $user; |
|
| 13 | + global $phpbb_container, $request, $user; |
|
| 14 | 14 | |
| 15 | - $friends_controller = $phpbb_container->get('florinp.messenger.friends.controller'); |
|
| 16 | - $friends_controller->set_page_url($this->u_action); |
|
| 15 | + $friends_controller = $phpbb_container->get('florinp.messenger.friends.controller'); |
|
| 16 | + $friends_controller->set_page_url($this->u_action); |
|
| 17 | 17 | |
| 18 | - $this->tpl_name = 'friends'; |
|
| 18 | + $this->tpl_name = 'friends'; |
|
| 19 | 19 | |
| 20 | - switch($mode) |
|
| 21 | - { |
|
| 22 | - case 'friends': |
|
| 20 | + switch($mode) |
|
| 21 | + { |
|
| 22 | + case 'friends': |
|
| 23 | 23 | |
| 24 | 24 | $action = $request->variable('action', ''); |
| 25 | 25 | switch($action) |
@@ -72,105 +72,105 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | break; |
| 75 | - default: |
|
| 76 | - if($request->is_set_post('action')) |
|
| 77 | - { |
|
| 78 | - $action = $request->variable('action', ''); |
|
| 79 | - switch($action) |
|
| 80 | - { |
|
| 81 | - case 'remove': |
|
| 82 | - if(confirm_box(true)) |
|
| 83 | - { |
|
| 84 | - $user_id = $request->variable('user_id', array(0)); |
|
| 85 | - $redirect_url = $request->variable('redirect_url', ''); |
|
| 86 | - if($friends_controller->remove_friend($user_id)) |
|
| 87 | - { |
|
| 88 | - redirect($redirect_url); |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - else |
|
| 92 | - { |
|
| 93 | - $user_id = $request->variable('user_id', array(0)); |
|
| 94 | - $redirect_url = $request->server('HTTP_REFERER'); |
|
| 95 | - confirm_box(false, $user->lang('CONFIRM_REMOVE_FRIEND'), build_hidden_fields(array( |
|
| 96 | - 'user_id' => $user_id, |
|
| 97 | - 'redirect_url' => $redirect_url, |
|
| 98 | - ))); |
|
| 99 | - } |
|
| 100 | - break; |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - $friends_controller->friends_list(); |
|
| 104 | - $this->tpl_name = 'friends'; |
|
| 105 | - break; |
|
| 75 | + default: |
|
| 76 | + if($request->is_set_post('action')) |
|
| 77 | + { |
|
| 78 | + $action = $request->variable('action', ''); |
|
| 79 | + switch($action) |
|
| 80 | + { |
|
| 81 | + case 'remove': |
|
| 82 | + if(confirm_box(true)) |
|
| 83 | + { |
|
| 84 | + $user_id = $request->variable('user_id', array(0)); |
|
| 85 | + $redirect_url = $request->variable('redirect_url', ''); |
|
| 86 | + if($friends_controller->remove_friend($user_id)) |
|
| 87 | + { |
|
| 88 | + redirect($redirect_url); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + else |
|
| 92 | + { |
|
| 93 | + $user_id = $request->variable('user_id', array(0)); |
|
| 94 | + $redirect_url = $request->server('HTTP_REFERER'); |
|
| 95 | + confirm_box(false, $user->lang('CONFIRM_REMOVE_FRIEND'), build_hidden_fields(array( |
|
| 96 | + 'user_id' => $user_id, |
|
| 97 | + 'redirect_url' => $redirect_url, |
|
| 98 | + ))); |
|
| 99 | + } |
|
| 100 | + break; |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + $friends_controller->friends_list(); |
|
| 104 | + $this->tpl_name = 'friends'; |
|
| 105 | + break; |
|
| 106 | + } |
|
| 107 | + break; |
|
| 108 | + |
|
| 109 | + case 'requests': |
|
| 110 | + |
|
| 111 | + if($request->is_set_post('action')) |
|
| 112 | + { |
|
| 113 | + $action = $request->variable('action', ''); |
|
| 114 | + |
|
| 115 | + switch($action) |
|
| 116 | + { |
|
| 117 | + case 'delete': |
|
| 118 | + |
|
| 119 | + if(confirm_box(true)) |
|
| 120 | + { |
|
| 121 | + $requests_id = $request->variable('requests_id', array(0)); |
|
| 122 | + $friends_controller->delete_request($requests_id); |
|
| 123 | + } |
|
| 124 | + else |
|
| 125 | + { |
|
| 126 | + $requests_id = $request->variable('requests_id', array(0)); |
|
| 127 | + confirm_box(false, $user->lang('CONFIRM_REMOVE_REQUESTS'), build_hidden_fields(array( |
|
| 128 | + 'requests_id' => $requests_id, |
|
| 129 | + 'action' => $action, |
|
| 130 | + 'mode' => $mode |
|
| 131 | + ))); |
|
| 132 | + } |
|
| 133 | + |
|
| 134 | + break; |
|
| 135 | + case 'approve': |
|
| 136 | + $requests_id = $request->variable('requests_id', array(0)); |
|
| 137 | + $friends_controller->approve_request($requests_id); |
|
| 138 | + break; |
|
| 139 | + } |
|
| 106 | 140 | } |
| 107 | - break; |
|
| 108 | - |
|
| 109 | - case 'requests': |
|
| 110 | - |
|
| 111 | - if($request->is_set_post('action')) |
|
| 112 | - { |
|
| 113 | - $action = $request->variable('action', ''); |
|
| 114 | - |
|
| 115 | - switch($action) |
|
| 116 | - { |
|
| 117 | - case 'delete': |
|
| 118 | - |
|
| 119 | - if(confirm_box(true)) |
|
| 120 | - { |
|
| 121 | - $requests_id = $request->variable('requests_id', array(0)); |
|
| 122 | - $friends_controller->delete_request($requests_id); |
|
| 123 | - } |
|
| 124 | - else |
|
| 125 | - { |
|
| 126 | - $requests_id = $request->variable('requests_id', array(0)); |
|
| 127 | - confirm_box(false, $user->lang('CONFIRM_REMOVE_REQUESTS'), build_hidden_fields(array( |
|
| 128 | - 'requests_id' => $requests_id, |
|
| 129 | - 'action' => $action, |
|
| 130 | - 'mode' => $mode |
|
| 131 | - ))); |
|
| 132 | - } |
|
| 133 | - |
|
| 134 | - break; |
|
| 135 | - case 'approve': |
|
| 136 | - $requests_id = $request->variable('requests_id', array(0)); |
|
| 137 | - $friends_controller->approve_request($requests_id); |
|
| 138 | - break; |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | 141 | |
| 142 | - $action = $request->variable('action', ''); |
|
| 143 | - switch($action) |
|
| 144 | - { |
|
| 145 | - case 'cancel_request': |
|
| 146 | - if(confirm_box(true)) |
|
| 147 | - { |
|
| 148 | - $request_id = $request->variable('request_id', 0); |
|
| 149 | - $redirect_url = $request->variable('redirect_url', ''); |
|
| 150 | - if($friends_controller->delete_request($request_id)) |
|
| 151 | - { |
|
| 152 | - redirect($redirect_url); |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - else |
|
| 156 | - { |
|
| 157 | - $request_id = $request->variable('request_id', 0); |
|
| 158 | - $redirect_url = $request->server('HTTP_REFERER'); |
|
| 159 | - confirm_box(false, $user->lang('CONFIRM_REMOVE_REQUESTS'), build_hidden_fields(array( |
|
| 160 | - 'request_id' => $request_id, |
|
| 161 | - 'action' => $action, |
|
| 162 | - 'mode' => $mode, |
|
| 163 | - 'redirect_url' => $redirect_url, |
|
| 164 | - ))); |
|
| 165 | - } |
|
| 166 | - break; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - $friends_controller->requests(); |
|
| 170 | - $this->tpl_name = 'ucp_friends_requests'; |
|
| 171 | - break; |
|
| 172 | - |
|
| 173 | - } |
|
| 142 | + $action = $request->variable('action', ''); |
|
| 143 | + switch($action) |
|
| 144 | + { |
|
| 145 | + case 'cancel_request': |
|
| 146 | + if(confirm_box(true)) |
|
| 147 | + { |
|
| 148 | + $request_id = $request->variable('request_id', 0); |
|
| 149 | + $redirect_url = $request->variable('redirect_url', ''); |
|
| 150 | + if($friends_controller->delete_request($request_id)) |
|
| 151 | + { |
|
| 152 | + redirect($redirect_url); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + else |
|
| 156 | + { |
|
| 157 | + $request_id = $request->variable('request_id', 0); |
|
| 158 | + $redirect_url = $request->server('HTTP_REFERER'); |
|
| 159 | + confirm_box(false, $user->lang('CONFIRM_REMOVE_REQUESTS'), build_hidden_fields(array( |
|
| 160 | + 'request_id' => $request_id, |
|
| 161 | + 'action' => $action, |
|
| 162 | + 'mode' => $mode, |
|
| 163 | + 'redirect_url' => $redirect_url, |
|
| 164 | + ))); |
|
| 165 | + } |
|
| 166 | + break; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + $friends_controller->requests(); |
|
| 170 | + $this->tpl_name = 'ucp_friends_requests'; |
|
| 171 | + break; |
|
| 172 | + |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | |
@@ -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 | } |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | break; |
| 51 | 51 | case 'remove_friend': |
| 52 | 52 | $user_id = $request->variable('user_id', 0); |
| 53 | - if($user_id > 0) |
|
| 53 | + if ($user_id > 0) |
|
| 54 | 54 | { |
| 55 | - if(confirm_box(true)) |
|
| 55 | + if (confirm_box(true)) |
|
| 56 | 56 | { |
| 57 | 57 | $user_id = $request->variable('user_id', 0); |
| 58 | 58 | $redirect_url = $request->variable('redirect_url', ''); |
| 59 | - if($friends_controller->remove_friend($user_id)) |
|
| 59 | + if ($friends_controller->remove_friend($user_id)) |
|
| 60 | 60 | { |
| 61 | 61 | redirect($redirect_url); |
| 62 | 62 | } |
@@ -73,17 +73,17 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | break; |
| 75 | 75 | default: |
| 76 | - if($request->is_set_post('action')) |
|
| 76 | + if ($request->is_set_post('action')) |
|
| 77 | 77 | { |
| 78 | 78 | $action = $request->variable('action', ''); |
| 79 | - switch($action) |
|
| 79 | + switch ($action) |
|
| 80 | 80 | { |
| 81 | 81 | case 'remove': |
| 82 | - if(confirm_box(true)) |
|
| 82 | + if (confirm_box(true)) |
|
| 83 | 83 | { |
| 84 | 84 | $user_id = $request->variable('user_id', array(0)); |
| 85 | 85 | $redirect_url = $request->variable('redirect_url', ''); |
| 86 | - if($friends_controller->remove_friend($user_id)) |
|
| 86 | + if ($friends_controller->remove_friend($user_id)) |
|
| 87 | 87 | { |
| 88 | 88 | redirect($redirect_url); |
| 89 | 89 | } |
@@ -108,15 +108,15 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | case 'requests': |
| 110 | 110 | |
| 111 | - if($request->is_set_post('action')) |
|
| 111 | + if ($request->is_set_post('action')) |
|
| 112 | 112 | { |
| 113 | 113 | $action = $request->variable('action', ''); |
| 114 | 114 | |
| 115 | - switch($action) |
|
| 115 | + switch ($action) |
|
| 116 | 116 | { |
| 117 | 117 | case 'delete': |
| 118 | 118 | |
| 119 | - if(confirm_box(true)) |
|
| 119 | + if (confirm_box(true)) |
|
| 120 | 120 | { |
| 121 | 121 | $requests_id = $request->variable('requests_id', array(0)); |
| 122 | 122 | $friends_controller->delete_request($requests_id); |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $action = $request->variable('action', ''); |
| 143 | - switch($action) |
|
| 143 | + switch ($action) |
|
| 144 | 144 | { |
| 145 | 145 | case 'cancel_request': |
| 146 | - if(confirm_box(true)) |
|
| 146 | + if (confirm_box(true)) |
|
| 147 | 147 | { |
| 148 | 148 | $request_id = $request->variable('request_id', 0); |
| 149 | 149 | $redirect_url = $request->variable('redirect_url', ''); |
| 150 | - if($friends_controller->delete_request($request_id)) |
|
| 150 | + if ($friends_controller->delete_request($request_id)) |
|
| 151 | 151 | { |
| 152 | 152 | redirect($redirect_url); |
| 153 | 153 | } |
@@ -36,8 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | redirect($redirect_url); |
| 38 | 38 | } |
| 39 | - } |
|
| 40 | - else |
|
| 39 | + } else |
|
| 41 | 40 | { |
| 42 | 41 | $user_id = $request->variable('user_id', 0); |
| 43 | 42 | $redirect_url = $request->server('HTTP_REFERER'); |
@@ -60,8 +59,7 @@ discard block |
||
| 60 | 59 | { |
| 61 | 60 | redirect($redirect_url); |
| 62 | 61 | } |
| 63 | - } |
|
| 64 | - else |
|
| 62 | + } else |
|
| 65 | 63 | { |
| 66 | 64 | $user_id = $request->variable('user_id', 0); |
| 67 | 65 | $redirect_url = $request->server('HTTP_REFERER'); |
@@ -87,8 +85,7 @@ discard block |
||
| 87 | 85 | { |
| 88 | 86 | redirect($redirect_url); |
| 89 | 87 | } |
| 90 | - } |
|
| 91 | - else |
|
| 88 | + } else |
|
| 92 | 89 | { |
| 93 | 90 | $user_id = $request->variable('user_id', array(0)); |
| 94 | 91 | $redirect_url = $request->server('HTTP_REFERER'); |
@@ -120,8 +117,7 @@ discard block |
||
| 120 | 117 | { |
| 121 | 118 | $requests_id = $request->variable('requests_id', array(0)); |
| 122 | 119 | $friends_controller->delete_request($requests_id); |
| 123 | - } |
|
| 124 | - else |
|
| 120 | + } else |
|
| 125 | 121 | { |
| 126 | 122 | $requests_id = $request->variable('requests_id', array(0)); |
| 127 | 123 | confirm_box(false, $user->lang('CONFIRM_REMOVE_REQUESTS'), build_hidden_fields(array( |
@@ -151,8 +147,7 @@ discard block |
||
| 151 | 147 | { |
| 152 | 148 | redirect($redirect_url); |
| 153 | 149 | } |
| 154 | - } |
|
| 155 | - else |
|
| 150 | + } else |
|
| 156 | 151 | { |
| 157 | 152 | $request_id = $request->variable('request_id', 0); |
| 158 | 153 | $redirect_url = $request->server('HTTP_REFERER'); |