@@ -2,79 +2,79 @@ |
||
2 | 2 | |
3 | 3 | class RemindersController extends Controller { |
4 | 4 | |
5 | - /** |
|
6 | - * Display the password reminder view. |
|
7 | - * |
|
8 | - * @return Response |
|
9 | - */ |
|
10 | - public function getRemind() |
|
11 | - { |
|
12 | - return View::make('templates/password_reset/remind'); |
|
13 | - } |
|
5 | + /** |
|
6 | + * Display the password reminder view. |
|
7 | + * |
|
8 | + * @return Response |
|
9 | + */ |
|
10 | + public function getRemind() |
|
11 | + { |
|
12 | + return View::make('templates/password_reset/remind'); |
|
13 | + } |
|
14 | 14 | |
15 | - /** |
|
16 | - * Handle a POST request to remind a user of their password. |
|
17 | - * |
|
18 | - * @return Response |
|
19 | - */ |
|
20 | - public function postRemind() |
|
21 | - { |
|
15 | + /** |
|
16 | + * Handle a POST request to remind a user of their password. |
|
17 | + * |
|
18 | + * @return Response |
|
19 | + */ |
|
20 | + public function postRemind() |
|
21 | + { |
|
22 | 22 | $response = Password::remind(Input::only('email'), function($message) |
23 | 23 | { |
24 | 24 | $message->subject('Password Reset'); |
25 | 25 | }); |
26 | 26 | |
27 | - switch ($response) |
|
28 | - { |
|
29 | - case Password::INVALID_USER: |
|
30 | - return Redirect::back()->withErrors(['error']); |
|
27 | + switch ($response) |
|
28 | + { |
|
29 | + case Password::INVALID_USER: |
|
30 | + return Redirect::back()->withErrors(['error']); |
|
31 | 31 | |
32 | - case Password::REMINDER_SENT: |
|
33 | - return Redirect::back()->withErrors(['success']); |
|
34 | - } |
|
35 | - } |
|
32 | + case Password::REMINDER_SENT: |
|
33 | + return Redirect::back()->withErrors(['success']); |
|
34 | + } |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Display the password reset view for the given token. |
|
39 | - * |
|
40 | - * @param string $token |
|
41 | - * @return Response |
|
42 | - */ |
|
43 | - public function getReset($token = null) |
|
44 | - { |
|
45 | - if (is_null($token)) App::abort(404); |
|
37 | + /** |
|
38 | + * Display the password reset view for the given token. |
|
39 | + * |
|
40 | + * @param string $token |
|
41 | + * @return Response |
|
42 | + */ |
|
43 | + public function getReset($token = null) |
|
44 | + { |
|
45 | + if (is_null($token)) App::abort(404); |
|
46 | 46 | |
47 | - return View::make('templates/password_reset/reset')->with('token', $token); |
|
48 | - } |
|
47 | + return View::make('templates/password_reset/reset')->with('token', $token); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * Handle a POST request to reset a user's password. |
|
52 | - * |
|
53 | - * @return Response |
|
54 | - */ |
|
55 | - public function postReset() |
|
56 | - { |
|
57 | - $credentials = Input::only( |
|
58 | - 'email', 'password', 'password_confirmation', 'token' |
|
59 | - ); |
|
50 | + /** |
|
51 | + * Handle a POST request to reset a user's password. |
|
52 | + * |
|
53 | + * @return Response |
|
54 | + */ |
|
55 | + public function postReset() |
|
56 | + { |
|
57 | + $credentials = Input::only( |
|
58 | + 'email', 'password', 'password_confirmation', 'token' |
|
59 | + ); |
|
60 | 60 | |
61 | - $response = Password::reset($credentials, function($user, $password) |
|
62 | - { |
|
63 | - $user->password = Hash::make($password); |
|
61 | + $response = Password::reset($credentials, function($user, $password) |
|
62 | + { |
|
63 | + $user->password = Hash::make($password); |
|
64 | 64 | |
65 | - $user->save(); |
|
66 | - }); |
|
65 | + $user->save(); |
|
66 | + }); |
|
67 | 67 | |
68 | - switch ($response) |
|
69 | - { |
|
70 | - case Password::INVALID_PASSWORD: |
|
71 | - case Password::INVALID_TOKEN: |
|
72 | - case Password::INVALID_USER: |
|
73 | - return Redirect::back()->withErrors(Lang::get($response) ); |
|
68 | + switch ($response) |
|
69 | + { |
|
70 | + case Password::INVALID_PASSWORD: |
|
71 | + case Password::INVALID_TOKEN: |
|
72 | + case Password::INVALID_USER: |
|
73 | + return Redirect::back()->withErrors(Lang::get($response) ); |
|
74 | 74 | |
75 | - case Password::PASSWORD_RESET: |
|
76 | - return Redirect::back()->withErrors("Password has been reset! <a class='btn btn-default' href='/'>Click here to login</a>"); |
|
77 | - } |
|
78 | - } |
|
75 | + case Password::PASSWORD_RESET: |
|
76 | + return Redirect::back()->withErrors("Password has been reset! <a class='btn btn-default' href='/'>Click here to login</a>"); |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | case Password::INVALID_PASSWORD: |
71 | 71 | case Password::INVALID_TOKEN: |
72 | 72 | case Password::INVALID_USER: |
73 | - return Redirect::back()->withErrors(Lang::get($response) ); |
|
73 | + return Redirect::back()->withErrors(Lang::get($response)); |
|
74 | 74 | |
75 | 75 | case Password::PASSWORD_RESET: |
76 | 76 | return Redirect::back()->withErrors("Password has been reset! <a class='btn btn-default' href='/'>Click here to login</a>"); |
@@ -42,7 +42,9 @@ |
||
42 | 42 | */ |
43 | 43 | public function getReset($token = null) |
44 | 44 | { |
45 | - if (is_null($token)) App::abort(404); |
|
45 | + if (is_null($token)) { |
|
46 | + App::abort(404); |
|
47 | + } |
|
46 | 48 | |
47 | 49 | return View::make('templates/password_reset/reset')->with('token', $token); |
48 | 50 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | public function showWelcome() |
19 | 19 | { |
20 | 20 | |
21 | - if (Auth::user()) { |
|
21 | + if (Auth::user()) { |
|
22 | 22 | |
23 | 23 | // $email = Auth::user()->email; |
24 | 24 | $userDetails = DB::table('users')->select('*')->where('id', Auth::user()->id)->get(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $userDetailsArray = array(); |
27 | 27 | $userDetailsArray = $value; |
28 | 28 | } |
29 | - // print_r($userDetailsArray); |
|
29 | + // print_r($userDetailsArray); |
|
30 | 30 | |
31 | 31 | // $data['userDetailsArray']=$userDetailsArray; |
32 | 32 | |
@@ -34,30 +34,30 @@ discard block |
||
34 | 34 | /* |
35 | 35 | * get notofications,task notifications,global notifications ... |
36 | 36 | */ |
37 | - $countUnreadMessages = DB::table('personal_conversations') |
|
37 | + $countUnreadMessages = DB::table('personal_conversations') |
|
38 | 38 | ->select(DB::raw('count(read_status) as unread_count')) |
39 | 39 | |
40 | 40 | ->where('read_status','=',1) |
41 | - ->where('to_user_id','=',Auth::user()->id)->first(); |
|
41 | + ->where('to_user_id','=',Auth::user()->id)->first(); |
|
42 | 42 | |
43 | - $countUnreadGeneralMessages = DB::table('team_conversations_read_status') |
|
43 | + $countUnreadGeneralMessages = DB::table('team_conversations_read_status') |
|
44 | 44 | ->select(DB::raw('count(read_status) as unread_count')) |
45 | 45 | |
46 | 46 | ->where('read_status','=',1) |
47 | - ->where('user_id','=',Auth::user()->id)->first(); |
|
47 | + ->where('user_id','=',Auth::user()->id)->first(); |
|
48 | 48 | |
49 | - $countUnreadJoinMessages = DB::table('invitation_notification') |
|
49 | + $countUnreadJoinMessages = DB::table('invitation_notification') |
|
50 | 50 | ->select(DB::raw('count(read_status) as unread_count')) |
51 | 51 | |
52 | 52 | ->where('read_status','=',1) |
53 | 53 | |
54 | - ->where('invitation_notification.new_user', '!=', Auth::user()->id) |
|
55 | - ->where('team_user','=',Auth::user()->id)->first(); |
|
56 | - /* |
|
54 | + ->where('invitation_notification.new_user', '!=', Auth::user()->id) |
|
55 | + ->where('team_user','=',Auth::user()->id)->first(); |
|
56 | + /* |
|
57 | 57 | * pass each notifcation count in array |
58 | 58 | */ |
59 | 59 | |
60 | - $data=array( |
|
60 | + $data=array( |
|
61 | 61 | |
62 | 62 | "unreadMessageCount"=>$countUnreadMessages["unread_count"], |
63 | 63 | "userDetailsArray"=>$userDetailsArray, |
@@ -37,27 +37,27 @@ discard block |
||
37 | 37 | $countUnreadMessages = DB::table('personal_conversations') |
38 | 38 | ->select(DB::raw('count(read_status) as unread_count')) |
39 | 39 | |
40 | - ->where('read_status','=',1) |
|
41 | - ->where('to_user_id','=',Auth::user()->id)->first(); |
|
40 | + ->where('read_status', '=', 1) |
|
41 | + ->where('to_user_id', '=', Auth::user()->id)->first(); |
|
42 | 42 | |
43 | 43 | $countUnreadGeneralMessages = DB::table('team_conversations_read_status') |
44 | 44 | ->select(DB::raw('count(read_status) as unread_count')) |
45 | 45 | |
46 | - ->where('read_status','=',1) |
|
47 | - ->where('user_id','=',Auth::user()->id)->first(); |
|
46 | + ->where('read_status', '=', 1) |
|
47 | + ->where('user_id', '=', Auth::user()->id)->first(); |
|
48 | 48 | |
49 | 49 | $countUnreadJoinMessages = DB::table('invitation_notification') |
50 | 50 | ->select(DB::raw('count(read_status) as unread_count')) |
51 | 51 | |
52 | - ->where('read_status','=',1) |
|
52 | + ->where('read_status', '=', 1) |
|
53 | 53 | |
54 | 54 | ->where('invitation_notification.new_user', '!=', Auth::user()->id) |
55 | - ->where('team_user','=',Auth::user()->id)->first(); |
|
55 | + ->where('team_user', '=', Auth::user()->id)->first(); |
|
56 | 56 | /* |
57 | 57 | * pass each notifcation count in array |
58 | 58 | */ |
59 | 59 | |
60 | - $data=array( |
|
60 | + $data = array( |
|
61 | 61 | |
62 | 62 | "unreadMessageCount"=>$countUnreadMessages["unread_count"], |
63 | 63 | "userDetailsArray"=>$userDetailsArray, |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | "unreadJoinMessageCount"=>$countUnreadJoinMessages["unread_count"], |
66 | 66 | |
67 | 67 | ); |
68 | - return View::make('templates/home')->with("data",$data); |
|
68 | + return View::make('templates/home')->with("data", $data); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | } |
@@ -46,34 +46,34 @@ discard block |
||
46 | 46 | * |
47 | 47 | * Get the id of the last inserted message |
48 | 48 | */ |
49 | - if (strpos(Input::get('body'), '<img') !== false) { |
|
50 | - $lastId= DB::table('messages')->insertGetId( |
|
49 | + if (strpos(Input::get('body'), '<img') !== false) { |
|
50 | + $lastId= DB::table('messages')->insertGetId( |
|
51 | 51 | ['message' => strip_tags( Input::get('body'),'<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
52 | 52 | ); |
53 | - } |
|
54 | - else{ |
|
55 | - $lastId= DB::table('messages')->insertGetId( |
|
53 | + } |
|
54 | + else{ |
|
55 | + $lastId= DB::table('messages')->insertGetId( |
|
56 | 56 | ['message' => strip_tags(preg_replace("/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i",'<$1$2>', Input::get('body')),'<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
57 | 57 | );} |
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * if personal flag is set to true insert into personal conversations |
|
62 | - * |
|
63 | - */ |
|
64 | - if($isPersonalSet){ |
|
65 | - $teamChannelId=explode("_",Input::get('channelId')); |
|
60 | + /** |
|
61 | + * if personal flag is set to true insert into personal conversations |
|
62 | + * |
|
63 | + */ |
|
64 | + if($isPersonalSet){ |
|
65 | + $teamChannelId=explode("_",Input::get('channelId')); |
|
66 | 66 | |
67 | - DB::table('personal_conversations')->insert( |
|
68 | - ['team_channel_id' => $teamChannelId[1], 'to_user_id' => Input::get('toUserId'),'from_user_id' => Auth::user()->id,'message_id' => $lastId,'read_status'=>1] |
|
69 | - ); |
|
70 | - } |
|
71 | - else{ |
|
67 | + DB::table('personal_conversations')->insert( |
|
68 | + ['team_channel_id' => $teamChannelId[1], 'to_user_id' => Input::get('toUserId'),'from_user_id' => Auth::user()->id,'message_id' => $lastId,'read_status'=>1] |
|
69 | + ); |
|
70 | + } |
|
71 | + else{ |
|
72 | 72 | DB::table('team_conversations')->insert( |
73 | - ['team_channel_id' => Input::get('channelId'), 'user_id' => Input::get('userId'),'message_id' => $lastId] |
|
74 | - ); |
|
75 | - $this->insertIntoTeamConversationReadStatus(Input::get('channelId'),$lastId); |
|
76 | - } |
|
73 | + ['team_channel_id' => Input::get('channelId'), 'user_id' => Input::get('userId'),'message_id' => $lastId] |
|
74 | + ); |
|
75 | + $this->insertIntoTeamConversationReadStatus(Input::get('channelId'),$lastId); |
|
76 | + } |
|
77 | 77 | // Publish Data To Redis |
78 | 78 | |
79 | 79 | if($isPersonalSet){ |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | ]); |
98 | 98 | } |
99 | 99 | |
100 | - function insertIntoTeamConversationReadStatus($channelId,$messageId){ |
|
100 | + function insertIntoTeamConversationReadStatus($channelId,$messageId){ |
|
101 | 101 | |
102 | - $teamId = DB::table('team_channels') |
|
102 | + $teamId = DB::table('team_channels') |
|
103 | 103 | ->select('id') |
104 | 104 | |
105 | 105 | ->where('team_channel_id', '=', $channelId)->first(); |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | |
115 | 115 | if ($memeber['id'] != Session::get('userId')) |
116 | 116 | DB::table('team_conversations_read_status')->insert( |
117 | - ['team_channel_id' => $teamId['id'], 'message_id' => $messageId,'user_id' => $memeber['id']] |
|
118 | - ); |
|
117 | + ['team_channel_id' => $teamId['id'], 'message_id' => $messageId,'user_id' => $memeber['id']] |
|
118 | + ); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | public function index() { |
11 | 11 | |
12 | 12 | $conversation = Conversation::where('name', Input::get('conversation'))->first(); |
13 | - $messages = Message::where('conversation_id', $conversation->id)->orderBy('created_at')->get(); |
|
13 | + $messages = Message::where('conversation_id', $conversation->id)->orderBy('created_at')->get(); |
|
14 | 14 | |
15 | 15 | return View::make('templates/messages')->with('messages', $messages)->render(); |
16 | 16 | } |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * @return Response |
22 | 22 | */ |
23 | 23 | public function send_message() { |
24 | - $isPersonalSet=Input::get('isPersonalFlag'); |
|
24 | + $isPersonalSet = Input::get('isPersonalFlag'); |
|
25 | 25 | $rules = array('body' => 'required'); |
26 | 26 | $validator = Validator::make(Input::all(), $rules); |
27 | 27 | |
28 | - if($validator->fails()) { |
|
28 | + if ($validator->fails()) { |
|
29 | 29 | return Response::json([ |
30 | 30 | 'success' => false, |
31 | 31 | 'result' => $validator->messages() |
@@ -47,46 +47,46 @@ discard block |
||
47 | 47 | * Get the id of the last inserted message |
48 | 48 | */ |
49 | 49 | if (strpos(Input::get('body'), '<img') !== false) { |
50 | - $lastId= DB::table('messages')->insertGetId( |
|
51 | - ['message' => strip_tags( Input::get('body'),'<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
|
50 | + $lastId = DB::table('messages')->insertGetId( |
|
51 | + ['message' => strip_tags(Input::get('body'), '<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
|
52 | 52 | ); |
53 | 53 | } |
54 | - else{ |
|
55 | - $lastId= DB::table('messages')->insertGetId( |
|
56 | - ['message' => strip_tags(preg_replace("/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i",'<$1$2>', Input::get('body')),'<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
|
57 | - );} |
|
54 | + else { |
|
55 | + $lastId = DB::table('messages')->insertGetId( |
|
56 | + ['message' => strip_tags(preg_replace("/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i", '<$1$2>', Input::get('body')), '<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
|
57 | + ); } |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * if personal flag is set to true insert into personal conversations |
62 | 62 | * |
63 | 63 | */ |
64 | - if($isPersonalSet){ |
|
65 | - $teamChannelId=explode("_",Input::get('channelId')); |
|
64 | + if ($isPersonalSet) { |
|
65 | + $teamChannelId = explode("_", Input::get('channelId')); |
|
66 | 66 | |
67 | 67 | DB::table('personal_conversations')->insert( |
68 | - ['team_channel_id' => $teamChannelId[1], 'to_user_id' => Input::get('toUserId'),'from_user_id' => Auth::user()->id,'message_id' => $lastId,'read_status'=>1] |
|
68 | + ['team_channel_id' => $teamChannelId[1], 'to_user_id' => Input::get('toUserId'), 'from_user_id' => Auth::user()->id, 'message_id' => $lastId, 'read_status'=>1] |
|
69 | 69 | ); |
70 | 70 | } |
71 | - else{ |
|
71 | + else { |
|
72 | 72 | DB::table('team_conversations')->insert( |
73 | - ['team_channel_id' => Input::get('channelId'), 'user_id' => Input::get('userId'),'message_id' => $lastId] |
|
73 | + ['team_channel_id' => Input::get('channelId'), 'user_id' => Input::get('userId'), 'message_id' => $lastId] |
|
74 | 74 | ); |
75 | - $this->insertIntoTeamConversationReadStatus(Input::get('channelId'),$lastId); |
|
75 | + $this->insertIntoTeamConversationReadStatus(Input::get('channelId'), $lastId); |
|
76 | 76 | } |
77 | 77 | // Publish Data To Redis |
78 | 78 | |
79 | - if($isPersonalSet){ |
|
79 | + if ($isPersonalSet) { |
|
80 | 80 | $data = array( |
81 | 81 | 'room' => Input::get('channelId'), |
82 | - 'message' => array( 'body' => Input::get('body'),'to_channel_id'=>Auth::user()->id."_".$teamChannelId[1], 'user_id' => Auth::user()->id,'first_name'=> Session::get('firstName'),'last_name'=> Session::get('lastName'),'profile_pic'=> Session::get('profilePic'),'message_id'=>$lastId ,'to_user_id'=>Input::get('toUserId')) |
|
82 | + 'message' => array('body' => Input::get('body'), 'to_channel_id'=>Auth::user()->id."_".$teamChannelId[1], 'user_id' => Auth::user()->id, 'first_name'=> Session::get('firstName'), 'last_name'=> Session::get('lastName'), 'profile_pic'=> Session::get('profilePic'), 'message_id'=>$lastId, 'to_user_id'=>Input::get('toUserId')) |
|
83 | 83 | ); |
84 | 84 | Event::fire(ChatMessagesEventHandler::EVENT, array(json_encode($data))); |
85 | 85 | } |
86 | - else{ |
|
86 | + else { |
|
87 | 87 | $data = array( |
88 | 88 | 'room' => Input::get('channelId'), |
89 | - 'message' => array( 'body' => Input::get('body'), 'user_id' => Input::get('userId'),'first_name'=> Session::get('firstName'),'last_name'=> Session::get('lastName'),'profile_pic'=> Session::get('profilePic'),'team_encoded_id'=> Input::get('channelId'),'team_decoded_id'=> $team_decoded_id['id'],'message_id'=>$lastId) |
|
89 | + 'message' => array('body' => Input::get('body'), 'user_id' => Input::get('userId'), 'first_name'=> Session::get('firstName'), 'last_name'=> Session::get('lastName'), 'profile_pic'=> Session::get('profilePic'), 'team_encoded_id'=> Input::get('channelId'), 'team_decoded_id'=> $team_decoded_id['id'], 'message_id'=>$lastId) |
|
90 | 90 | ); |
91 | 91 | Event::fire(ChatConversationsEventHandler::EVENT, array(json_encode($data))); |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ]); |
98 | 98 | } |
99 | 99 | |
100 | - function insertIntoTeamConversationReadStatus($channelId,$messageId){ |
|
100 | + function insertIntoTeamConversationReadStatus($channelId, $messageId) { |
|
101 | 101 | |
102 | 102 | $teamId = DB::table('team_channels') |
103 | 103 | ->select('id') |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | if ($memeber['id'] != Session::get('userId')) |
116 | 116 | DB::table('team_conversations_read_status')->insert( |
117 | - ['team_channel_id' => $teamId['id'], 'message_id' => $messageId,'user_id' => $memeber['id']] |
|
117 | + ['team_channel_id' => $teamId['id'], 'message_id' => $messageId, 'user_id' => $memeber['id']] |
|
118 | 118 | ); |
119 | 119 | } |
120 | 120 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | $lastId= DB::table('messages')->insertGetId( |
51 | 51 | ['message' => strip_tags( Input::get('body'),'<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
52 | 52 | ); |
53 | - } |
|
54 | - else{ |
|
53 | + } else{ |
|
55 | 54 | $lastId= DB::table('messages')->insertGetId( |
56 | 55 | ['message' => strip_tags(preg_replace("/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i",'<$1$2>', Input::get('body')),'<img></img><img /><p></p><br/><br><span></span></code><code><table><td></td><tr></tr><a></a>')] |
57 | 56 | );} |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | DB::table('personal_conversations')->insert( |
68 | 67 | ['team_channel_id' => $teamChannelId[1], 'to_user_id' => Input::get('toUserId'),'from_user_id' => Auth::user()->id,'message_id' => $lastId,'read_status'=>1] |
69 | 68 | ); |
70 | - } |
|
71 | - else{ |
|
69 | + } else{ |
|
72 | 70 | DB::table('team_conversations')->insert( |
73 | 71 | ['team_channel_id' => Input::get('channelId'), 'user_id' => Input::get('userId'),'message_id' => $lastId] |
74 | 72 | ); |
@@ -82,8 +80,7 @@ discard block |
||
82 | 80 | 'message' => array( 'body' => Input::get('body'),'to_channel_id'=>Auth::user()->id."_".$teamChannelId[1], 'user_id' => Auth::user()->id,'first_name'=> Session::get('firstName'),'last_name'=> Session::get('lastName'),'profile_pic'=> Session::get('profilePic'),'message_id'=>$lastId ,'to_user_id'=>Input::get('toUserId')) |
83 | 81 | ); |
84 | 82 | Event::fire(ChatMessagesEventHandler::EVENT, array(json_encode($data))); |
85 | - } |
|
86 | - else{ |
|
83 | + } else{ |
|
87 | 84 | $data = array( |
88 | 85 | 'room' => Input::get('channelId'), |
89 | 86 | 'message' => array( 'body' => Input::get('body'), 'user_id' => Input::get('userId'),'first_name'=> Session::get('firstName'),'last_name'=> Session::get('lastName'),'profile_pic'=> Session::get('profilePic'),'team_encoded_id'=> Input::get('channelId'),'team_decoded_id'=> $team_decoded_id['id'],'message_id'=>$lastId) |
@@ -112,10 +109,11 @@ discard block |
||
112 | 109 | foreach ($teamMembers as $memeber) { |
113 | 110 | |
114 | 111 | |
115 | - if ($memeber['id'] != Session::get('userId')) |
|
116 | - DB::table('team_conversations_read_status')->insert( |
|
112 | + if ($memeber['id'] != Session::get('userId')) { |
|
113 | + DB::table('team_conversations_read_status')->insert( |
|
117 | 114 | ['team_channel_id' => $teamId['id'], 'message_id' => $messageId,'user_id' => $memeber['id']] |
118 | 115 | ); |
116 | + } |
|
119 | 117 | } |
120 | 118 | } |
121 | 119 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | use LaravelRealtimeChat\Repositories\Team\TeamRepository; |
3 | 3 | use LaravelRealtimeChat\Repositories\Task\TaskRepository; |
4 | 4 | class FileUploadController extends AuthController { |
5 | - private $taskRepository; |
|
5 | + private $taskRepository; |
|
6 | 6 | |
7 | 7 | public function __construct(TeamRepository $teamRepository, TaskRepository $taskRepository) { |
8 | 8 | $this->teamRepository = $teamRepository; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | - function validateAndUpload($folderName,$dbSave) { |
|
25 | + function validateAndUpload($folderName,$dbSave) { |
|
26 | 26 | $successStatus; |
27 | 27 | $fileErr; |
28 | 28 | // Build the input for our validation |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | // Within the ruleset, make sure we let the validator know that this |
31 | 31 | // file should be an image |
32 | 32 | $rules = array( |
33 | - 'file' => 'max:100000000', |
|
33 | + 'file' => 'max:100000000', |
|
34 | 34 | ); |
35 | 35 | $validation = Validator::make($input, $rules); |
36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | if ($upload_success) { |
49 | 49 | if($dbSave){ |
50 | - $this->taskRepository->saveTaskFiles($imgPath); |
|
50 | + $this->taskRepository->saveTaskFiles($imgPath); |
|
51 | 51 | } |
52 | 52 | $fileErr = false; |
53 | 53 | } |
@@ -12,17 +12,17 @@ discard block |
||
12 | 12 | |
13 | 13 | switch ($name) { |
14 | 14 | case "chat":$folderName = "userUploads"; |
15 | - $this->validateAndUpload($folderName,false);//set true for db operations,else false |
|
15 | + $this->validateAndUpload($folderName, false); //set true for db operations,else false |
|
16 | 16 | break; |
17 | 17 | |
18 | 18 | case "task":$folderName = "userTaskFiles"; |
19 | - $this->validateAndUpload($folderName,true); |
|
19 | + $this->validateAndUpload($folderName, true); |
|
20 | 20 | break; |
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | - function validateAndUpload($folderName,$dbSave) { |
|
25 | + function validateAndUpload($folderName, $dbSave) { |
|
26 | 26 | $successStatus; |
27 | 27 | $fileErr; |
28 | 28 | // Build the input for our validation |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | $file = Input::file('file'); |
42 | 42 | foreach ($file as $files) { |
43 | 43 | |
44 | - $upload_success = $files->move('fusionmate/public/plugins/' . $folderName . '', $files->getClientOriginalName()); |
|
44 | + $upload_success = $files->move('fusionmate/public/plugins/'.$folderName.'', $files->getClientOriginalName()); |
|
45 | 45 | |
46 | 46 | $imgPath = $files->getClientOriginalName(); |
47 | 47 | |
48 | 48 | if ($upload_success) { |
49 | - if($dbSave){ |
|
49 | + if ($dbSave) { |
|
50 | 50 | $this->taskRepository->saveTaskFiles($imgPath); |
51 | 51 | } |
52 | 52 | $fileErr = false; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $fileErr = true; |
56 | 56 | } |
57 | 57 | } |
58 | - if (!$fileErr) { |
|
58 | + if ( ! $fileErr) { |
|
59 | 59 | |
60 | 60 | $successStatus = Response::json('success', 200); |
61 | 61 | } |
@@ -50,16 +50,14 @@ |
||
50 | 50 | $this->taskRepository->saveTaskFiles($imgPath); |
51 | 51 | } |
52 | 52 | $fileErr = false; |
53 | - } |
|
54 | - else { |
|
53 | + } else { |
|
55 | 54 | $fileErr = true; |
56 | 55 | } |
57 | 56 | } |
58 | 57 | if (!$fileErr) { |
59 | 58 | |
60 | 59 | $successStatus = Response::json('success', 200); |
61 | - } |
|
62 | - else { |
|
60 | + } else { |
|
63 | 61 | $successStatus = Response::json('error', 400); |
64 | 62 | } |
65 | 63 | return $successStatus; |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | use LaravelRealtimeChat\Repositories\Team\TeamRepository; |
3 | 3 | use LaravelRealtimeChat\Repositories\Task\TaskRepository; |
4 | 4 | class TeamController extends \BaseController { |
5 | - /** |
|
6 | - * @var LaravelRealtimeChat\Repositories\TeamRepository |
|
7 | - */ |
|
5 | + /** |
|
6 | + * @var LaravelRealtimeChat\Repositories\TeamRepository |
|
7 | + */ |
|
8 | 8 | private $teamRepository; |
9 | 9 | /** |
10 | 10 | * @var LaravelRealtimeChat\Repositories\TaskRepository |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ); |
40 | 40 | |
41 | 41 | //Make admin as default team head |
42 | - \DB::table('team_heads')->insertGetId( |
|
42 | + \DB::table('team_heads')->insertGetId( |
|
43 | 43 | [ "team_id" => $id, 'author_id' => \Session::get("userId"), "user_id" =>\Session::get("userId")] |
44 | 44 | ); |
45 | 45 | $data = array("create_team" => true, "message" => "Team Created Succesfully.", "teamId" => $id); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | // } |
188 | 188 | } |
189 | 189 | } |
190 | - // echo $this->db->last_query(); exit; |
|
190 | + // echo $this->db->last_query(); exit; |
|
191 | 191 | // print_r($teamArr); |
192 | 192 | return json_encode($teamArr); |
193 | 193 | } |
@@ -195,7 +195,6 @@ discard block |
||
195 | 195 | /** |
196 | 196 | @function gets team members |
197 | 197 | @param team id - id of team to list its members |
198 | - |
|
199 | 198 | */ |
200 | 199 | function getTeamMembers() { |
201 | 200 | $teamId = Input::get('teamId'); |
@@ -240,28 +239,28 @@ discard block |
||
240 | 239 | return "your not authorized to access this page"; |
241 | 240 | } |
242 | 241 | function deleteTeam(){ |
243 | - $enTeamId=Input::get("teamId"); |
|
242 | + $enTeamId=Input::get("teamId"); |
|
244 | 243 | $teamId=$this->teamRepository->getTeamDecodedId($enTeamId); |
245 | 244 | DB::table('team_conversations_read_status')->where('team_channel_id', $teamId)->delete(); |
246 | - DB::table('team_conversations')->where('team_channel_id', $teamId)->delete(); |
|
245 | + DB::table('team_conversations')->where('team_channel_id', $teamId)->delete(); |
|
247 | 246 | DB::table('team_channel_users')->where('team_channel_name_id', $teamId)->delete(); |
248 | 247 | $status= DB::table('team_channels')->where('id', $teamId)->delete(); |
249 | 248 | return json_encode($status); |
250 | 249 | } |
251 | 250 | |
252 | - public function list_teams_memebers() { |
|
251 | + public function list_teams_memebers() { |
|
253 | 252 | |
254 | - $offlineSort=array(); |
|
253 | + $offlineSort=array(); |
|
255 | 254 | $onlineSort=array(); |
256 | - /** |
|
257 | - * |
|
258 | - * Get all team details where the user is a memeber |
|
259 | - * |
|
260 | - * |
|
261 | - * |
|
262 | - */ |
|
255 | + /** |
|
256 | + * |
|
257 | + * Get all team details where the user is a memeber |
|
258 | + * |
|
259 | + * |
|
260 | + * |
|
261 | + */ |
|
263 | 262 | $teamArr = array(); |
264 | - $data = array(); |
|
263 | + $data = array(); |
|
265 | 264 | $teamName = DB::table('team_channels') |
266 | 265 | ->select('team_channels.channel_view_name', 'team_channels.team_channel_id', 'team_channels.id') |
267 | 266 | ->leftJoin('team_channel_users', 'team_channel_users.team_channel_name_id', '=', 'team_channels.id') |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | //Make admin as default team head |
42 | 42 | \DB::table('team_heads')->insertGetId( |
43 | - [ "team_id" => $id, 'author_id' => \Session::get("userId"), "user_id" =>\Session::get("userId")] |
|
43 | + ["team_id" => $id, 'author_id' => \Session::get("userId"), "user_id" =>\Session::get("userId")] |
|
44 | 44 | ); |
45 | 45 | $data = array("create_team" => true, "message" => "Team Created Succesfully.", "teamId" => $id); |
46 | 46 | return View::make('templates/greeting')->with('data', $data); |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | $channelId = Input::get('channelId'); |
54 | 54 | if (Session::get("role") == 1) { |
55 | 55 | $teams = DB::table('channels') |
56 | - ->select('team_channels.id','team_channels.team_channel_id', 'channels.channel_name', 'team_channels.channel_view_name', 'channels.author_id', "team_channels.created_at",'team_heads.author_id','team_heads.user_id as team_head_id') |
|
56 | + ->select('team_channels.id', 'team_channels.team_channel_id', 'channels.channel_name', 'team_channels.channel_view_name', 'channels.author_id', "team_channels.created_at", 'team_heads.author_id', 'team_heads.user_id as team_head_id') |
|
57 | 57 | ->leftJoin('team_channels', 'channels.id', '=', 'team_channels.channel_name_id') |
58 | 58 | ->leftJoin('team_heads', 'team_heads.team_id', '=', 'team_channels.id') |
59 | 59 | ->where('team_channels.id', '!=', '') |
60 | 60 | ->where('channels.id', '=', $channelId)->distinct()->get(); |
61 | 61 | } else { |
62 | 62 | $teams = DB::table('team_channels') |
63 | - ->select('team_channels.channel_view_name', 'team_channels.team_channel_id', 'team_channels.id', 'team_channels.created_at','team_heads.author_id','team_heads.user_id as team_head_id') |
|
63 | + ->select('team_channels.channel_view_name', 'team_channels.team_channel_id', 'team_channels.id', 'team_channels.created_at', 'team_heads.author_id', 'team_heads.user_id as team_head_id') |
|
64 | 64 | ->leftJoin('team_channel_users', 'team_channel_users.team_channel_name_id', '=', 'team_channels.id') |
65 | 65 | ->leftJoin('team_heads', 'team_heads.team_id', '=', 'team_channels.id') |
66 | 66 | ->where('team_channel_users.user_id', '=', Auth::user()->id)->distinct()->get(); |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | ['team_channel_name_id' => $teamId, 'user_id' => $userId['id']] |
104 | 104 | ); |
105 | 105 | |
106 | - $this->teamRepository->updateNewMemberJoinNotification($teamId,$userId['id']); |
|
106 | + $this->teamRepository->updateNewMemberJoinNotification($teamId, $userId['id']); |
|
107 | 107 | } else { |
108 | 108 | $failCheck = true; |
109 | - $failedEmail.=$email; |
|
109 | + $failedEmail .= $email; |
|
110 | 110 | } |
111 | 111 | } else { |
112 | 112 | /* new user,trigger email |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | $token = Crypt::encrypt(time()); |
118 | 118 | ; |
119 | - $url = Config::get('constants.constants_list.BASE_URL') . "invitation/" . $token; |
|
119 | + $url = Config::get('constants.constants_list.BASE_URL')."invitation/".$token; |
|
120 | 120 | $data = array("teamId" => $teamId, "email" => $email, "url" => $url, "token" => $token); |
121 | 121 | |
122 | 122 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | return "There was an error in sending email to one of the recipients"; |
130 | 130 | } else { |
131 | 131 | DB::table('invitation_token')->insert( |
132 | - ['token' => $data['token'],'team_id'=>$data['teamId'],'email'=>$data['email']] |
|
132 | + ['token' => $data['token'], 'team_id'=>$data['teamId'], 'email'=>$data['email']] |
|
133 | 133 | ); |
134 | 134 | } |
135 | 135 | }); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ($failCheck != true) |
140 | 140 | return View::make('templates/greeting')->with('message', "Invited Successfully!"); |
141 | 141 | else |
142 | - return View::make('templates/greeting')->with('danger', "Email already exists." . ":" . $failedEmail); |
|
142 | + return View::make('templates/greeting')->with('danger', "Email already exists.".":".$failedEmail); |
|
143 | 143 | // Create a random 'pass' and send invitation via mail |
144 | 144 | // $id = DB::table('users')->insertGetId( |
145 | 145 | // ['first_name' => Input::get('email'),'last_name' => Input::get('email'),'email' => Input::get('email'), 'password' => Hash::make(Input::get('email'))] |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * |
184 | 184 | */ |
185 | 185 | $status = DB::table('login_status')->select('status')->where('user_id', $memeber["id"])->first(); |
186 | - $teamArr[$values["channel_view_name"] . "_" . $values["team_channel_id"]."_".$values["id"]][] = $memeber["first_name"] . "_" . $memeber["id"] . "_" . $status['status']; |
|
186 | + $teamArr[$values["channel_view_name"]."_".$values["team_channel_id"]."_".$values["id"]][] = $memeber["first_name"]."_".$memeber["id"]."_".$status['status']; |
|
187 | 187 | // } |
188 | 188 | } |
189 | 189 | } |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | */ |
214 | 214 | $status = DB::table('login_status')->select('status')->where('user_id', $memeber["id"])->first(); |
215 | 215 | if ($memeber['id'] != Session::get('userId')) |
216 | - $teamArr[] = $memeber["first_name"] . "_" . $memeber["last_name"] . "_" . $memeber["id"] . "_" . $status['status']; |
|
216 | + $teamArr[] = $memeber["first_name"]."_".$memeber["last_name"]."_".$memeber["id"]."_".$status['status']; |
|
217 | 217 | } |
218 | 218 | return View::make('templates/list_members')->with('members', $teamArr); |
219 | 219 | } |
220 | 220 | |
221 | - function activate_invited_member( $token) { |
|
221 | + function activate_invited_member($token) { |
|
222 | 222 | //Validate token for security reasons |
223 | 223 | $isValidToken = DB::table('invitation_token') |
224 | 224 | ->select('token') |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | //Team Name |
227 | 227 | |
228 | 228 | if (count($isValidToken) > 0) { |
229 | - $invitationDetails= DB::table('invitation_token') |
|
230 | - ->select('team_id','email') |
|
229 | + $invitationDetails = DB::table('invitation_token') |
|
230 | + ->select('team_id', 'email') |
|
231 | 231 | ->where('token', '=', $token)->first(); |
232 | 232 | |
233 | 233 | $teamName = DB::table('team_channels') |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | else |
240 | 240 | return "your not authorized to access this page"; |
241 | 241 | } |
242 | -function deleteTeam(){ |
|
243 | - $enTeamId=Input::get("teamId"); |
|
244 | - $teamId=$this->teamRepository->getTeamDecodedId($enTeamId); |
|
242 | +function deleteTeam() { |
|
243 | + $enTeamId = Input::get("teamId"); |
|
244 | + $teamId = $this->teamRepository->getTeamDecodedId($enTeamId); |
|
245 | 245 | DB::table('team_conversations_read_status')->where('team_channel_id', $teamId)->delete(); |
246 | 246 | DB::table('team_conversations')->where('team_channel_id', $teamId)->delete(); |
247 | 247 | DB::table('team_channel_users')->where('team_channel_name_id', $teamId)->delete(); |
248 | - $status= DB::table('team_channels')->where('id', $teamId)->delete(); |
|
248 | + $status = DB::table('team_channels')->where('id', $teamId)->delete(); |
|
249 | 249 | return json_encode($status); |
250 | 250 | } |
251 | 251 | |
252 | 252 | public function list_teams_memebers() { |
253 | 253 | |
254 | - $offlineSort=array(); |
|
255 | - $onlineSort=array(); |
|
254 | + $offlineSort = array(); |
|
255 | + $onlineSort = array(); |
|
256 | 256 | /** |
257 | 257 | * |
258 | 258 | * Get all team details where the user is a memeber |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | foreach ($teamName as $values) { |
275 | 275 | |
276 | 276 | $teamMembers = DB::table('users') |
277 | - ->select('users.first_name','users.last_name', 'users.id','users.profile_pic','team_channels.channel_view_name','team_channels.id as team_id') |
|
277 | + ->select('users.first_name', 'users.last_name', 'users.id', 'users.profile_pic', 'team_channels.channel_view_name', 'team_channels.id as team_id') |
|
278 | 278 | ->leftJoin('team_channel_users', 'team_channel_users.user_id', '=', 'users.id') |
279 | 279 | ->leftJoin('team_channels', 'team_channels.id', '=', 'team_channel_users.team_channel_name_id') |
280 | 280 | ->where('team_channel_users.team_channel_name_id', '=', $values["id"])->get(); |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | * left join `team_channels` on `team_channels`.`id` = `team_channel_users`.`team_channel_name_id` |
286 | 286 | */ |
287 | 287 | $status = DB::table('login_status')->select('status')->where('user_id', $memeber["id"])->first(); |
288 | - $memeber['status']=$status; |
|
289 | - if($status['status']=="offline") |
|
290 | - $offlineSort[]=$memeber; |
|
288 | + $memeber['status'] = $status; |
|
289 | + if ($status['status'] == "offline") |
|
290 | + $offlineSort[] = $memeber; |
|
291 | 291 | else |
292 | - $onlineSort[]=$memeber; |
|
292 | + $onlineSort[] = $memeber; |
|
293 | 293 | |
294 | - if(count($onlineSort)==0)//if there are no online users do not merge |
|
295 | - $data[]=$memeber; |
|
294 | + if (count($onlineSort) == 0)//if there are no online users do not merge |
|
295 | + $data[] = $memeber; |
|
296 | 296 | |
297 | 297 | } |
298 | 298 | |
@@ -301,31 +301,31 @@ discard block |
||
301 | 301 | } |
302 | 302 | |
303 | 303 | |
304 | - if(count($onlineSort)>0){// if online users are there pass merged data else pass non merged data |
|
304 | + if (count($onlineSort) > 0) {// if online users are there pass merged data else pass non merged data |
|
305 | 305 | |
306 | - return View::make('templates/team_members')->with('data', array_merge($onlineSort,$offlineSort)); |
|
306 | + return View::make('templates/team_members')->with('data', array_merge($onlineSort, $offlineSort)); |
|
307 | 307 | } |
308 | 308 | else |
309 | - return View::make('templates/team_members')->with('data',$data ); |
|
309 | + return View::make('templates/team_members')->with('data', $data); |
|
310 | 310 | } |
311 | 311 | |
312 | - public function get_team_name(){ |
|
313 | - $enTeamId=Input::get("teamId"); |
|
314 | - $teamId=$this->teamRepository->getTeamDecodedId($enTeamId); |
|
312 | + public function get_team_name() { |
|
313 | + $enTeamId = Input::get("teamId"); |
|
314 | + $teamId = $this->teamRepository->getTeamDecodedId($enTeamId); |
|
315 | 315 | $data = $this->teamRepository->getTeamName($teamId); |
316 | 316 | return $data; |
317 | 317 | } |
318 | 318 | |
319 | - public function update_team_name(){ |
|
320 | - $enTeamId=Input::get("teamId"); |
|
321 | - $teamId=$this->teamRepository->getTeamDecodedId($enTeamId); |
|
319 | + public function update_team_name() { |
|
320 | + $enTeamId = Input::get("teamId"); |
|
321 | + $teamId = $this->teamRepository->getTeamDecodedId($enTeamId); |
|
322 | 322 | $data = $this->teamRepository->updateTeamName($teamId); |
323 | 323 | return $data; |
324 | 324 | } |
325 | 325 | |
326 | - public function update_team_head(){ |
|
327 | - $enTeamId=Input::get("teamId"); |
|
328 | - $teamId=$this->teamRepository->getTeamDecodedId($enTeamId); |
|
326 | + public function update_team_head() { |
|
327 | + $enTeamId = Input::get("teamId"); |
|
328 | + $teamId = $this->teamRepository->getTeamDecodedId($enTeamId); |
|
329 | 329 | $data = $this->teamRepository->updateTeamHead($teamId); |
330 | 330 | return $data; |
331 | 331 | } |
@@ -21,9 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function create_team_channels() { |
23 | 23 | $teamName = Input::get('name'); |
24 | - if ($teamName == '') |
|
25 | - return View::make('templates/greeting')->with('danger', "Please provide a team name!"); |
|
26 | -//Check for duplicates |
|
24 | + if ($teamName == '') { |
|
25 | + return View::make('templates/greeting')->with('danger', "Please provide a team name!"); |
|
26 | + } |
|
27 | + //Check for duplicates |
|
27 | 28 | $exists = DB::table('team_channels') |
28 | 29 | ->select('channel_view_name') |
29 | 30 | ->where('channel_view_name', '=', $teamName) |
@@ -136,11 +137,12 @@ discard block |
||
136 | 137 | } |
137 | 138 | } |
138 | 139 | |
139 | - if ($failCheck != true) |
|
140 | - return View::make('templates/greeting')->with('message', "Invited Successfully!"); |
|
141 | - else |
|
142 | - return View::make('templates/greeting')->with('danger', "Email already exists." . ":" . $failedEmail); |
|
143 | -// Create a random 'pass' and send invitation via mail |
|
140 | + if ($failCheck != true) { |
|
141 | + return View::make('templates/greeting')->with('message', "Invited Successfully!"); |
|
142 | + } else { |
|
143 | + return View::make('templates/greeting')->with('danger', "Email already exists." . ":" . $failedEmail); |
|
144 | + } |
|
145 | + // Create a random 'pass' and send invitation via mail |
|
144 | 146 | // $id = DB::table('users')->insertGetId( |
145 | 147 | // ['first_name' => Input::get('email'),'last_name' => Input::get('email'),'email' => Input::get('email'), 'password' => Hash::make(Input::get('email'))] |
146 | 148 | // ); |
@@ -212,8 +214,9 @@ discard block |
||
212 | 214 | * |
213 | 215 | */ |
214 | 216 | $status = DB::table('login_status')->select('status')->where('user_id', $memeber["id"])->first(); |
215 | - if ($memeber['id'] != Session::get('userId')) |
|
216 | - $teamArr[] = $memeber["first_name"] . "_" . $memeber["last_name"] . "_" . $memeber["id"] . "_" . $status['status']; |
|
217 | + if ($memeber['id'] != Session::get('userId')) { |
|
218 | + $teamArr[] = $memeber["first_name"] . "_" . $memeber["last_name"] . "_" . $memeber["id"] . "_" . $status['status']; |
|
219 | + } |
|
217 | 220 | } |
218 | 221 | return View::make('templates/list_members')->with('members', $teamArr); |
219 | 222 | } |
@@ -235,9 +238,9 @@ discard block |
||
235 | 238 | ->where('id', '=', $invitationDetails['team_id'])->first(); |
236 | 239 | $data = array("teamName" => $teamName['channel_view_name'], "email" => $invitationDetails['email'], "token" => $token, "teamId" => $invitationDetails['team_id']); |
237 | 240 | return View::make('layouts/invitation_view')->with('data', $data); |
241 | + } else { |
|
242 | + return "your not authorized to access this page"; |
|
238 | 243 | } |
239 | - else |
|
240 | - return "your not authorized to access this page"; |
|
241 | 244 | } |
242 | 245 | function deleteTeam(){ |
243 | 246 | $enTeamId=Input::get("teamId"); |
@@ -286,13 +289,16 @@ discard block |
||
286 | 289 | */ |
287 | 290 | $status = DB::table('login_status')->select('status')->where('user_id', $memeber["id"])->first(); |
288 | 291 | $memeber['status']=$status; |
289 | - if($status['status']=="offline") |
|
290 | - $offlineSort[]=$memeber; |
|
291 | - else |
|
292 | - $onlineSort[]=$memeber; |
|
292 | + if($status['status']=="offline") { |
|
293 | + $offlineSort[]=$memeber; |
|
294 | + } else { |
|
295 | + $onlineSort[]=$memeber; |
|
296 | + } |
|
293 | 297 | |
294 | - if(count($onlineSort)==0)//if there are no online users do not merge |
|
298 | + if(count($onlineSort)==0) { |
|
299 | + //if there are no online users do not merge |
|
295 | 300 | $data[]=$memeber; |
301 | + } |
|
296 | 302 | |
297 | 303 | } |
298 | 304 | |
@@ -304,9 +310,9 @@ discard block |
||
304 | 310 | if(count($onlineSort)>0){// if online users are there pass merged data else pass non merged data |
305 | 311 | |
306 | 312 | return View::make('templates/team_members')->with('data', array_merge($onlineSort,$offlineSort)); |
313 | + } else { |
|
314 | + return View::make('templates/team_members')->with('data',$data ); |
|
307 | 315 | } |
308 | - else |
|
309 | - return View::make('templates/team_members')->with('data',$data ); |
|
310 | 316 | } |
311 | 317 | |
312 | 318 | public function get_team_name(){ |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | */ |
10 | 10 | public function drive() |
11 | 11 | { |
12 | - $output= exec("ls -l"); |
|
13 | - echo $output; |
|
14 | - exit; |
|
12 | + $output= exec("ls -l"); |
|
13 | + echo $output; |
|
14 | + exit; |
|
15 | 15 | $url_array = explode('?', 'http://'.$_SERVER ['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
16 | 16 | $url = $url_array[0]; |
17 | 17 | echo $url; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $file->setTitle($file_name); |
57 | 57 | $file->setDescription('This is a '.$mime_type.' document'); |
58 | 58 | $file->setMimeType($mime_type); |
59 | - $a= $service->files->insert( |
|
59 | + $a= $service->files->insert( |
|
60 | 60 | $file, |
61 | 61 | array( |
62 | 62 | 'data' => file_get_contents($file_path), |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | ); |
66 | 66 | } |
67 | 67 | finfo_close($finfo); |
68 | - print_r($a); |
|
69 | - // header('location:'.$url);exit; |
|
68 | + print_r($a); |
|
69 | + // header('location:'.$url);exit; |
|
70 | 70 | |
71 | 71 | //include 'fusionmate/index.phtml'; |
72 | 72 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | public function drive() |
11 | 11 | { |
12 | - $output= exec("ls -l"); |
|
12 | + $output = exec("ls -l"); |
|
13 | 13 | echo $output; |
14 | 14 | exit; |
15 | 15 | $url_array = explode('?', 'http://'.$_SERVER ['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | //echo Session::get('code'); |
28 | 28 | //exit; |
29 | 29 | |
30 | -if (Session::get('code')!='') { |
|
30 | +if (Session::get('code') != '') { |
|
31 | 31 | $_SESSION['accessToken'] = $client->authenticate($_GET['code']); |
32 | 32 | header('location:'.$url); |
33 | -} elseif (Session::get('accessToken')!='') { |
|
33 | +} elseif (Session::get('accessToken') != '') { |
|
34 | 34 | $client->authenticate(); |
35 | 35 | |
36 | 36 | |
37 | 37 | } |
38 | 38 | //echo Session::get('accessToken'); |
39 | 39 | // exit; |
40 | -$files= array(); |
|
40 | +$files = array(); |
|
41 | 41 | $dir = dir('fusionmate/files'); |
42 | 42 | while ($file = $dir->read()) { |
43 | 43 | if ($file != '.' && $file != '..') { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $file->setTitle($file_name); |
57 | 57 | $file->setDescription('This is a '.$mime_type.' document'); |
58 | 58 | $file->setMimeType($mime_type); |
59 | - $a= $service->files->insert( |
|
59 | + $a = $service->files->insert( |
|
60 | 60 | $file, |
61 | 61 | array( |
62 | 62 | 'data' => file_get_contents($file_path), |
@@ -24,18 +24,18 @@ |
||
24 | 24 | */ |
25 | 25 | $teamRepository = new DbTeamRepository(); |
26 | 26 | $teamId= \Input::get("teamId"); |
27 | - $id = $teamRepository->getTeamDecodedId($teamId); |
|
28 | - $teamId=$id; |
|
27 | + $id = $teamRepository->getTeamDecodedId($teamId); |
|
28 | + $teamId=$id; |
|
29 | 29 | $projectId=\Input::get("projectId"); |
30 | 30 | $user_id = \DB::table('team_heads') |
31 | 31 | ->select('user_id') |
32 | 32 | ->where('team_heads.team_id', '=', $teamId) |
33 | - ->where('team_heads.project_id', '=', $projectId) |
|
34 | - ->first(); |
|
33 | + ->where('team_heads.project_id', '=', $projectId) |
|
34 | + ->first(); |
|
35 | 35 | if($user_id['user_id']==\Session::get('userId')) |
36 | 36 | return "allowed"; |
37 | 37 | else |
38 | - return "notAllowed"; |
|
38 | + return "notAllowed"; |
|
39 | 39 | } |
40 | 40 | else |
41 | 41 | return "notAllowed"; |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | use LaravelRealtimeChat\Repositories\Team\DbTeamRepository; |
8 | -class SecurityHelper { |
|
8 | +class SecurityHelper { |
|
9 | 9 | |
10 | 10 | |
11 | 11 | public static function authorizeWrite($type) { |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | * Cross check |
24 | 24 | */ |
25 | 25 | $teamRepository = new DbTeamRepository(); |
26 | - $teamId= \Input::get("teamId"); |
|
26 | + $teamId = \Input::get("teamId"); |
|
27 | 27 | $id = $teamRepository->getTeamDecodedId($teamId); |
28 | - $teamId=$id; |
|
29 | - $projectId=\Input::get("projectId"); |
|
28 | + $teamId = $id; |
|
29 | + $projectId = \Input::get("projectId"); |
|
30 | 30 | $user_id = \DB::table('team_heads') |
31 | 31 | ->select('user_id') |
32 | 32 | ->where('team_heads.team_id', '=', $teamId) |
33 | 33 | ->where('team_heads.project_id', '=', $projectId) |
34 | 34 | ->first(); |
35 | - if($user_id['user_id']==\Session::get('userId')) |
|
35 | + if ($user_id['user_id'] == \Session::get('userId')) |
|
36 | 36 | return "allowed"; |
37 | 37 | else |
38 | 38 | return "notAllowed"; |
@@ -11,10 +11,11 @@ discard block |
||
11 | 11 | public static function authorizeWrite($type) { |
12 | 12 | switch ($type) { |
13 | 13 | case "create_project": |
14 | - if (Session::get('role')) |
|
15 | - return "allowed"; |
|
16 | - else |
|
17 | - return "notAllowed"; |
|
14 | + if (Session::get('role')) { |
|
15 | + return "allowed"; |
|
16 | + } else { |
|
17 | + return "notAllowed"; |
|
18 | + } |
|
18 | 19 | break; |
19 | 20 | case "create_task": |
20 | 21 | if (Session::get('role')) |
@@ -32,13 +33,14 @@ discard block |
||
32 | 33 | ->where('team_heads.team_id', '=', $teamId) |
33 | 34 | ->where('team_heads.project_id', '=', $projectId) |
34 | 35 | ->first(); |
35 | - if($user_id['user_id']==\Session::get('userId')) |
|
36 | - return "allowed"; |
|
37 | - else |
|
38 | - return "notAllowed"; |
|
36 | + if($user_id['user_id']==\Session::get('userId')) { |
|
37 | + return "allowed"; |
|
38 | + } else { |
|
39 | + return "notAllowed"; |
|
40 | + } |
|
41 | + } else { |
|
42 | + return "notAllowed"; |
|
39 | 43 | } |
40 | - else |
|
41 | - return "notAllowed"; |
|
42 | 44 | break; |
43 | 45 | } |
44 | 46 | } |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | $tz = new DateTimeZone(trim($tzName)); |
29 | 29 | |
30 | 30 | $date = new DateTime($timesTamp); |
31 | - $date->setTimezone($tz); |
|
31 | + $date->setTimezone($tz); |
|
32 | 32 | $dateTime=$date->format('F jS, Y h:m:s A'); |
33 | 33 | return $dateTime; |
34 | 34 | } |
35 | 35 | else{ |
36 | - $date = new DateTime($timesTamp); |
|
36 | + $date = new DateTime($timesTamp); |
|
37 | 37 | $dateTime= $date->format('F jS, Y h:m:s A'); |
38 | 38 | return $dateTime; |
39 | 39 | } |
@@ -42,7 +42,6 @@ discard block |
||
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | - |
|
46 | 45 | * @function generates a unique ID |
47 | 46 | * @return string unique id |
48 | 47 | */ |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | function toDateTime($timesTamp) { |
25 | 25 | |
26 | 26 | $tzName = Session::get('tzName'); |
27 | - if($tzName!='Asia/Kolkata'){ |
|
27 | + if ($tzName != 'Asia/Kolkata') { |
|
28 | 28 | $tz = new DateTimeZone(trim($tzName)); |
29 | 29 | |
30 | 30 | $date = new DateTime($timesTamp); |
31 | 31 | $date->setTimezone($tz); |
32 | - $dateTime=$date->format('F jS, Y h:m:s A'); |
|
32 | + $dateTime = $date->format('F jS, Y h:m:s A'); |
|
33 | 33 | return $dateTime; |
34 | 34 | } |
35 | - else{ |
|
35 | + else { |
|
36 | 36 | $date = new DateTime($timesTamp); |
37 | - $dateTime= $date->format('F jS, Y h:m:s A'); |
|
37 | + $dateTime = $date->format('F jS, Y h:m:s A'); |
|
38 | 38 | return $dateTime; |
39 | 39 | } |
40 | 40 | |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * @return string unique id |
48 | 48 | */ |
49 | 49 | |
50 | -function generateId(){ |
|
50 | +function generateId() { |
|
51 | 51 | $date = date_create(); |
52 | - $id=md5(date_timestamp_get($date)); |
|
52 | + $id = md5(date_timestamp_get($date)); |
|
53 | 53 | return $id; |
54 | 54 | |
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -31,8 +31,7 @@ |
||
31 | 31 | $date->setTimezone($tz); |
32 | 32 | $dateTime=$date->format('F jS, Y h:m:s A'); |
33 | 33 | return $dateTime; |
34 | - } |
|
35 | - else{ |
|
34 | + } else{ |
|
36 | 35 | $date = new DateTime($timesTamp); |
37 | 36 | $dateTime= $date->format('F jS, Y h:m:s A'); |
38 | 37 | return $dateTime; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php namespace LaravelRealtimeChat\Repositories\Task; |
2 | 2 | |
3 | -interface TaskRepository { |
|
3 | +interface TaskRepository { |
|
4 | 4 | |
5 | 5 | |
6 | 6 | public function createProject(); |