|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class EmailCallback extends SocialIntegrationControllerBaseClass implements SocialIntegrationAPIInterface |
|
|
|
|
|
|
4
|
|
|
{ |
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* make sure to return TRUE as response if the message is sent |
|
9
|
|
|
* successfully |
|
10
|
|
|
* Sends a message from the current user to someone else in the networkd |
|
11
|
|
|
* @param Int | String | Member $to - |
|
12
|
|
|
* @param String $message - Message you are sending |
|
13
|
|
|
* @param String $link - Link to send with message - NOT USED IN EMAIL |
|
14
|
|
|
* @param Array - other variables that we include |
|
15
|
|
|
* @return Boolean - return TRUE as success |
|
16
|
|
|
*/ |
|
17
|
|
|
public static function send_message($to, $message, $link = "", $otherVariables = array()) |
|
18
|
|
|
{ |
|
19
|
|
|
|
|
20
|
|
|
//FROM |
|
21
|
|
|
if (!empty($otherVariables["From"])) { |
|
22
|
|
|
$from = $otherVariables["From"]; |
|
23
|
|
|
} else { |
|
24
|
|
|
$from = Email::getAdminEmail(); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
//TO |
|
28
|
|
|
if ($to instanceof Member) { |
|
29
|
|
|
$to = $to->Email; |
|
30
|
|
|
} |
|
31
|
|
|
//SUBJECT |
|
32
|
|
View Code Duplication |
if (!empty($otherVariables["Subject"])) { |
|
|
|
|
|
|
33
|
|
|
$subject = $otherVariables["Subject"]; |
|
34
|
|
|
} else { |
|
35
|
|
|
$subject = substr($message, 0, 30); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
//BODY |
|
39
|
|
|
$body = $message; |
|
40
|
|
|
|
|
41
|
|
|
//CC |
|
42
|
|
|
if (!empty($otherVariables["CC"])) { |
|
43
|
|
|
$cc = $otherVariables["CC"]; |
|
44
|
|
|
} else { |
|
45
|
|
|
$cc = ""; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
//BCC |
|
49
|
|
|
$bcc = Email::getAdminEmail(); |
|
50
|
|
|
|
|
51
|
|
|
//SEND EMAIL |
|
52
|
|
|
$email = new Email( |
|
53
|
|
|
$from, |
|
54
|
|
|
$to, |
|
55
|
|
|
$subject, |
|
56
|
|
|
$body, |
|
57
|
|
|
$bounceHandlerURL = null, |
|
58
|
|
|
$cc, |
|
59
|
|
|
$bcc |
|
60
|
|
|
); |
|
61
|
|
|
return $email->send(); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public static function get_list_of_friends($limit = 12, $searchString = "") |
|
65
|
|
|
{ |
|
66
|
|
|
return array(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* |
|
71
|
|
|
* return Object | Null |
|
72
|
|
|
*/ |
|
73
|
|
|
public static function get_current_user() |
|
74
|
|
|
{ |
|
75
|
|
|
return Member::currentUser(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public static function is_valid_user($id) |
|
79
|
|
|
{ |
|
80
|
|
|
return filter_var($id, FILTER_VALIDATE_EMAIL); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Link to login form |
|
85
|
|
|
* @param String $returnURL |
|
86
|
|
|
* @return String |
|
87
|
|
|
*/ |
|
88
|
|
|
public static function connect_url($returnURL = "", $existingMember = false) |
|
89
|
|
|
{ |
|
90
|
|
|
$backURLString = ""; |
|
91
|
|
|
if ($returnURL) { |
|
92
|
|
|
$backURLString = 'BackURL='.urlencode($returnURL); |
|
93
|
|
|
} |
|
94
|
|
|
if ($existingMember) { |
|
95
|
|
|
$tab = 'EmailLoginForm_LoginForm_tab'; |
|
96
|
|
|
} else { |
|
97
|
|
|
$tab = "MemberLoginFormWithSignup_LoginForm_tab"; |
|
98
|
|
|
} |
|
99
|
|
|
//$backLink = urlencode($returnURL); |
|
|
|
|
|
|
100
|
|
|
//return "Security/login/".$backLink."#".$tab; |
|
|
|
|
|
|
101
|
|
|
return "Security/login/?email=1&".$backURLString."#".$tab; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function meondatabase() |
|
105
|
|
|
{ |
|
106
|
|
|
print_r(Member::currentUser()); |
|
107
|
|
|
} |
|
108
|
|
|
} |
|
109
|
|
|
|