Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 146 lines (122 sloc) 4.277 kb
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
1 <?php
2 /**
3 *
4 * @package Icy Phoenix
5 * @version $Id$
6 * @copyright (c) 2008 Icy Phoenix
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 *
9 */
10
11 define('CT_SECLEVEL', 'MEDIUM');
12 $ct_ignoregvar = array('');
b7a59d9 Luca Libralato New poll system and minor bug fixes.
authored
13 define('IN_ICYPHOENIX', true);
06ce0f8 Luca Libralato Brand new version...
authored
14 if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
15 if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
16 include(IP_ROOT_PATH . 'common.' . PHP_EXT);
dbcd6a4 Luca Libralato Added a function to generate topics pagination and integrated where need...
authored
17 include_once(IP_ROOT_PATH . 'includes/functions_post.' . PHP_EXT);
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
18
4094590 Luca Libralato Update to RC version
authored
19 // Start session management
09f38bc Luca Libralato Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
20 $user->session_begin();
d164727 Luca Libralato First implementation of the new permissions system in CMS.
authored
21 $auth->acl($user->data);
09f38bc Luca Libralato Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
22 $user->setup();
4094590 Luca Libralato Update to RC version
authored
23 // End session management
24
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
25 $topic_title = request_var('topic_title', '', true);
9dea0d4 Luca Libralato New Icy Phoenix structure.
authored
26 $topic_id = request_var('topic_id', 0);
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
27 $friendname = request_var('friendname', '', true);
28 $message = request_var('message', '', true);
dc92d29 Luca Libralato Some bugs fixed:
authored
29 $PHP_SELF = $_SERVER['SCRIPT_NAME'];
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
30
09f38bc Luca Libralato Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
31 if (!$user->data['session_logged_in'])
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
32 {
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
33 redirect(append_sid(CMS_PAGE_LOGIN . '?redirect=' . 'tellafriend.' . PHP_EXT . '&topic_title=' . urlencode($topic_title) . '&topic_id=' . $topic_id, true));
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
34 }
35
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
36 if (($config['url_rw'] == true) || ($config['url_rw_guests'] == true))
9dea0d4 Luca Libralato New Icy Phoenix structure.
authored
37 {
38 $topic_link = create_server_url() . make_url_friendly($topic_title) . '-vt' . $topic_id . '.html';
39 }
40 else
41 {
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
42 $topic_link = create_server_url() . CMS_PAGE_VIEWTOPIC . '?' . POST_TOPIC_URL . '=' . $topic_id;
9dea0d4 Luca Libralato New Icy Phoenix structure.
authored
43 }
44
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
45 $mail_body = str_replace("{TOPIC}", htmlspecialchars_decode($topic_title), $lang['TELL_FRIEND_BODY']);
9dea0d4 Luca Libralato New Icy Phoenix structure.
authored
46 $mail_body = str_replace("{LINK}", $topic_link, $mail_body);
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
47 $mail_body = str_replace("{SITENAME}", $config['sitename'], $mail_body);
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
48
49 $template->assign_vars(array(
50 'SUBMIT_ACTION' => append_sid($PHP_SELF, true),
51 'L_SUBMIT' => $lang['Send_email'],
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
52 'SITENAME' => $config['sitename'],
4094590 Luca Libralato Update to RC version
authored
53
09f38bc Luca Libralato Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
54 'SENDER_NAME' => $user->data['username'],
55 'SENDER_MAIL' => $user->data['user_email'],
4094590 Luca Libralato Update to RC version
authored
56
57 'L_TELL_FRIEND_BODY' => $mail_body,
58
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
59 'TOPIC_TITLE' => $topic_title,
4094590 Luca Libralato Update to RC version
authored
60 'TOPIC_ID' => $topic_id,
61 'TOPIC_LINK' => $topic_link,
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
62 )
63 );
64
65 /**************/
4094590 Luca Libralato Update to RC version
authored
66 if (isset($_POST['submit']))
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
67 {
68 $error = false;
69
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
70 $friendemail = request_var('friendemail', '', true);
71 $friendname = request_var('friendname', '', true);
acc8dec Luca Libralato Improved classes for managing files and images, fixed a couple of bugs i...
authored
72 $topic_title = request_var('topic_title', '', true);
73 $message = request_var('message', '', true);
74 // We need to check if HTML emails are enabled so we can correctly escape content and linebreaks
75 if (!empty($config['html_email']))
76 {
77 $message = nl2br(str_replace($topic_link, ('<a href="' . $topic_link . '">' . $topic_link . '</a>'), $message));
78 }
79 else
80 {
81 $message = htmlspecialchars_decode($message, ENT_COMPAT);
82 }
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
83
84 if (!empty($friendemail) && (strpos($friendemail, '@') > 0))
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
85 {
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
86 if (empty($friendname))
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
87 {
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
88 $friendname = substr($friendemail, 0, strpos($friendemail, '@'));
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
89 }
90 }
91 else
92 {
93 $error = true;
94 $error_msg = $lang['Tell_Friend_Wrong_Email'];
95 }
96
4094590 Luca Libralato Update to RC version
authored
97 if (!$error)
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
98 {
06ce0f8 Luca Libralato Brand new version...
authored
99 include(IP_ROOT_PATH . 'includes/emailer.' . PHP_EXT);
43b6f20 Luca Libralato Other bugs fixed about UTF-8:
authored
100 $emailer = new emailer();
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
101
43b6f20 Luca Libralato Other bugs fixed about UTF-8:
authored
102 $emailer->headers('X-AntiAbuse: Board servername - ' . trim($config['server_name']));
09f38bc Luca Libralato Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
103 $emailer->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
104 $emailer->headers('X-AntiAbuse: Username - ' . $user->data['username']);
105 $emailer->headers('X-AntiAbuse: User IP - ' . $user_ip);
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
106
107 $emailer->use_template('tellafriend_email', $user_lang);
43b6f20 Luca Libralato Other bugs fixed about UTF-8:
authored
108 $emailer->to($friendemail, $friendname);
09f38bc Luca Libralato Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
109 $emailer->from($user->data['user_email']);
110 $emailer->replyto($user->data['user_email']);
a4ea299 Luca Libralato First commit with UTF-8 modifications, almost all files have been edited...
authored
111 $emailer->set_subject($topic_title);
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
112
113 $emailer->assign_vars(array(
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
114 'SITENAME' => $config['sitename'],
115 'BOARD_EMAIL' => $config['board_email'],
09f38bc Luca Libralato Another milestone almost achieved for new Icy Phoenix version: user/sess...
authored
116 'FROM_USERNAME' => $user->data['username'],
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
117 'TO_USERNAME' => $friendname,
118 'MESSAGE' => $message
119 )
120 );
121 $emailer->send();
122 $emailer->reset();
123
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
124 $redirect_url = append_sid(CMS_PAGE_FORUM);
9dea0d4 Luca Libralato New Icy Phoenix structure.
authored
125 meta_refresh(5, $redirect_url);
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
126
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
127 $message = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid(CMS_PAGE_FORUM) . '">', '</a>');
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
128
129 message_die(GENERAL_MESSAGE, $message);
130 }
131
132 if ($error)
133 {
134 $template->set_filenames(array('reg_header' => 'error_body.tpl'));
135 $template->assign_vars(array(
136 'ERROR_MESSAGE' => $error_msg
137 )
138 );
139 $template->assign_var_from_handle('ERROR_BOX', 'reg_header');
140 }
141
142 }
143
2d81429 Luca Libralato New Icy Phoenix version based on some new core functions.php
authored
144 full_page_generation('tellafriend_body.tpl', '', '', '');
d07f25e Luca Libralato git-svn-id: http://svn.assembla.com/svn/icy_phoenix/ip/trunk@29 e0e46c49...
authored
145
146 ?>
Something went wrong with that request. Please try again.