forked from jakop345/s42transfer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajax_sendlinks.php
executable file
·159 lines (112 loc) · 8.25 KB
/
ajax_sendlinks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
//@error_reporting(0);
define ('JIRAFEAU_ROOT', dirname (__FILE__) . '/');
require (JIRAFEAU_ROOT . 'lib/config.original.php');
require (JIRAFEAU_ROOT . 'lib/config.local.php');
require (JIRAFEAU_ROOT . 'lib/settings.php');
require (JIRAFEAU_ROOT . 'lib/functions.php');
require (JIRAFEAU_ROOT . 'lib/lang.php');
If(!isset($cfg)){
global $cfg;
$cfg['main_color']="#134953";
$cfg['main_color_light']="#01cefe";
}
if($cfg['typekit_fontreplacement']==1){
$typekit_normal = $cfg['typekit_normal'];
$typekit_bold = $cfg['typekit_bold'];
$typekit_optional = $cfg['typekit_optional'];
}else{
$cfg['typekit_normal']="Arial";
$cfg['typekit_bold']="Arial";
$cfg['typekit_optional']="Arial";
$typekit_normal = $cfg['typekit_normal'];
$typekit_bold = $cfg['typekit_bold'];
$typekit_optional = $cfg['typekit_optional'];
}
$friend_Emails = $_POST['friend_Emails'];
$your_Email = $_POST['your_Email'];
$snd_msg = $_POST['snd_msg'];
$file_links = $_POST['file_links'];
$h = $_POST['web_root'].'f.php?h='.$_POST['file_links'].'&d=1';
// SEND generate_number with Email link
$generate_number = $_POST['generate_number'];
//$direct_Dwnload_url = get_tiny_url($h);
$direct_Dwnload_url = $_POST['web_root'].'f.php?h='.$generate_number.'&mail=1';
//$del_url = $_POST['web_root'].'f.php?h='.$_POST['file_links'].'&del=1';
$del_url = $_POST['web_root'].'f.php?h='.$generate_number.'&del=1';
$send_lnk="";
$files_html = "";
$totals = 0;
$link_nameArr = explode("@",$file_links);
foreach($link_nameArr as $link_name){
$links = jirafeau_get_link ($link_name);
$files_html .='<div style="width:100%;float:left;margin:0 0 1% 0;" class="links_innner"><span style="width:82%;word-break:break-all;color:'.$cfg['main_color'].';float:left;font-family:'.$typekit_optional.';">'.$links['file_name'].'</span> <span style="width:18%;text-align:right;color:'.$cfg['main_color_light'].';float:right;font-family:'.$typekit_optional.';">'.jirafeau_human_size($links['file_size']).'</span></div>';
$totals += $links['file_size'];
}
//echo $files_html;
//echo jirafeau_human_size($totals);
$send_lnk .= '<html><head><title>Send Links</title></head>'.
'<body style="float:left">'.
'<div style="width:100%;float:left">'.
'<div style="float:left;padding:2%;width:96%">'.
'<p style="width:100%;margin:0px;padding-bottom:0px;color:'.$cfg['main_color_light'].'!important;font-size: 32px;text-decoration:none;font-family:'.$typekit_normal.';">'.$your_Email.'</p>'.
'<p style="width:100%;margin:0px;font-family:'.$typekit_normal.';color:'.$cfg['main_color'].'; font-size: 32px;">sent you some files </p>'.
'<p style="width:100%;color:'.$cfg['main_color'].';font-family:'.$typekit_normal.';font-size: 17px;">'.$snd_msg.'</p>'.
'<p><a style="margin:0px;width:40%;text-align:center;background:'.$cfg['main_color'].';color:'.$cfg['main_color_light'].';padding:10px;text-decoration:none;font-weight:bold;font-size:17px;float:left;font-family:'.$typekit_bold.';cursor:pointer;" href="'.$direct_Dwnload_url.'">Download</a></p>'.
'</div>';
$send_lnk1 = "";
$send_lnk1 .= '<div style="width:96%;float:left;padding:0 2%;">'.
'<p style="color:'.$cfg['main_color'].';font-weight:bold;float:left;width:100%;text-align:right;border-bottom:1px solid '.$cfg['main_color_light'].';padding-bottom: 5px;margin-top:0px;font-family:'.$typekit_bold.';">'.count($link_nameArr).' Files (Total: '.formatSizeUnits($totals).') </p>'.
'<p>'.$files_html.'</p>'.
'</div>'.
'<div style="width:96%;float:left;border-top:1px solid '.$cfg['main_color'].';padding-top:1%;margin:4% 2%;">
<abbr style="color:'.$cfg['main_color'].';float:left;text-decoration:none;cursor:default;font-family:'.$typekit_optional.';" title="s42.transfer">s42.transfer</abbr>
<a style="color:'.$cfg['main_color'].';font-family:'.$typekit_optional.';text-decoration:none;float:right;" href="'.rtrim($cfg['web_root'], '/') . '/tos.php">'.t(" | Terms").'</a><a style="color:'.$cfg['main_color'].';text-decoration:none;float:right;font-family:'.$typekit_optional.';" href="https://www.gnu.org/licenses/agpl.html"><abbr style="text-decoration:none;" title="Affero General Public License">AGPL</abbr>v3</a>
</div>
</div>
</body></html>';
$send_lnks = $send_lnk.$send_lnk1;
/************************** SENDER MAIL TEXT ******************/
/************************** SENDER MAIL TEXT ******************/
$send_lnk_sender .= '<html><head><title>Send Links</title></head>'.
'<body style="float:left">'.
'<div style="width:100%;float:left">'.
'<div style="float:left;padding:2%;width:96%">'.
'<p style="width:100%;margin:0px;font-family:'.$typekit_normal.';color:'.$cfg['main_color'].'; font-size: 32px;">Files successfully sent to </p>'.
'<p style="width:100%;margin:0px;padding-bottom:0px;color:'.$cfg['main_color_light'].'!important;font-size: 32px;text-decoration:none;font-family:'.$typekit_normal.';">'.$friend_Emails.'</p>'.
'<p style="width:100%;color:'.$cfg['main_color'].';font-family:'.$typekit_normal.';font-size: 17px;">'.$snd_msg.'</p>'.
'<p style="width:100%; float:left;"><a style="margin:0px;width:40%;text-align:center;background:'.$cfg['main_color'].';color:'.$cfg['main_color_light'].';padding:10px;text-decoration:none;font-weight:bold;font-size:17px;float:left;font-family:'.$typekit_bold.';cursor:pointer;" href="'.$direct_Dwnload_url.'">Download</a></p>'.
'<p style="width:100%;"><a style="margin:0px;width:40%;text-align:center;background:'.$cfg['main_color'].';color:'.$cfg['main_color_light'].';padding:10px;text-decoration:none;font-weight:bold;font-size:17px;float:left;font-family:'.$typekit_bold.';cursor:pointer;" href="'.$del_url.'">DELETE File(s)</a></p>'.
'</div>';
$send_lnk1_sender = "";
$send_lnk1_sender .= '<div style="width:96%;float:left;padding:0 2%;">'.
'<p style="color:'.$cfg['main_color'].';font-weight:bold;float:left;width:100%;text-align:right;border-bottom:1px solid '.$cfg['main_color_light'].';padding-bottom: 5px;margin-top:0px;font-family:'.$typekit_bold.';">'.count($link_nameArr).' Files (Total: '.formatSizeUnits($totals).') </p>'.
'<p>'.$files_html.'</p>'.
'</div>'.
'<div style="width:96%;float:left;border-top:1px solid '.$cfg['main_color'].';padding-top:1%;margin:4% 2%;">
<abbr style="color:'.$cfg['main_color'].';float:left;text-decoration:none;cursor:default;font-family:'.$typekit_optional.';" title="s42.transfer">s42.transfer</abbr>
<a style="color:'.$cfg['main_color'].';font-family:'.$typekit_optional.';text-decoration:none;float:right;" href="'.rtrim($cfg['web_root'], '/') . '/tos.php">'.t(" | Terms").'</a><a style="color:'.$cfg['main_color'].';text-decoration:none;float:right;font-family:'.$typekit_optional.';" href="https://www.gnu.org/licenses/agpl.html"><abbr style="text-decoration:none;" title="Affero General Public License">AGPL</abbr>v3</a>
</div>
</div>
</body></html>';
$send_lnks_sender = $send_lnk_sender.$send_lnk1_sender;
/************************** SENDER MAIL TEXT ******************/
/************************** SENDER MAIL TEXT ******************/
$to =$friend_Emails;
$subject = $your_Email .' has sent you file(s) via s42.transfer';
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: '.$cfg['sender_name'].'<'.$your_Email.'>' . "\r\n";
//$headers = "From: $name <$email>\r\n"
$results = mail($to,$subject,$send_lnks,$headers);
/************************** Send Mail to sender*/
$subject_sender = 'Thanks for using s42.transfer - file sent to '. $to;
$results_sender = mail($your_Email,$subject_sender,$send_lnks_sender,$headers);
/************************** Send Mail to sender*/
if($results){
echo 1;
}else{
echo 0;
}
?>