Rewrote 'we' word a little, rewrote mail order to use SQL_INSERTID() instead of anoth...
[mailer.git] / inc / modules / frametester.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 10/24/2003 *
4  * ===================                          Last change: 06/30/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : frametester.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Test your website against frame killers          *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Testet die Mitgliedsseite gegen Frame-Killer     *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
17  * -------------------------------------------------------------------- *
18  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
19  * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
20  * For more information visit: http://mxchange.org                      *
21  *                                                                      *
22  * This program is free software; you can redistribute it and/or modify *
23  * it under the terms of the GNU General Public License as published by *
24  * the Free Software Foundation; either version 2 of the License, or    *
25  * (at your option) any later version.                                  *
26  *                                                                      *
27  * This program is distributed in the hope that it will be useful,      *
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
30  * GNU General Public License for more details.                         *
31  *                                                                      *
32  * You should have received a copy of the GNU General Public License    *
33  * along with this program; if not, write to the Free Software          *
34  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         exit();
41 } // END - if
42
43 $mode = 'guest';
44
45 if (isGetRequestElementSet('order')) {
46         // Order number placed, is he also logged in?
47         if (isMember()) {
48                 // Ok, test passed... :)
49                 $result = SQL_QUERY_ESC("SELECT `subject`,`url` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s AND `sender`=%s AND `data_type`='TEMP' LIMIT 1",
50                         array(bigintval(getRequestElement('order')), getMemberId()), __FILE__, __LINE__);
51
52                 // Finally is the entry valid?
53                 if (SQL_NUMROWS($result) == 1) {
54                         // Load subject and URL (but forwhat do we need the subject line here???
55                         list($sub, $url) = SQL_FETCHROW($result);
56
57                         // This fixes a white page
58                         setPostRequestElement('url', $url);
59
60                         // Mode is member
61                         $mode = 'member';
62                 } else {
63                         // Matching line not found
64                         redirectToUrl('modules.php?module=index&amp;what=login');
65                 }
66
67                 // Free memory
68                 SQL_FREERESULT($result);
69         } else {
70                 // He is no longer logged in
71                 redirectToUrl('modules.php?module=index&amp;what=login');
72         }
73 } // END - if
74
75 if ((isPostRequestElementSet('url')) || (isGetRequestElementSet('url')) || (!isFullPage())) {
76         // Default URL is ours
77         $url = getUrl();
78
79         // Use URL from POST or GET data if set
80         if (isPostRequestElementSet('url')) {
81                 // POST data comes first
82                 $url = postRequestElement('url');
83         } elseif (isGetRequestElementSet('url')) {
84                 // Then GET data
85                 $url = decodeString(str_replace(' ', '+', compileUriCode(urldecode(getRequestElement('url')))));
86         }
87
88         // Add missing element
89         $frame = '';
90         if (!isFullPage()) {
91                 $frame = getRequestElement('frame');
92         } // END - if
93
94         // Switch on 'frame'
95         // @TODO Rewrite this somehow
96         switch ($frame) {
97                 case '':
98                         switch ($mode) {
99                                 case 'member':
100                                         // Build frameset
101                                         $content['order'] = bigintval(getRequestElement('order'));
102                                         $content['url']   = generateDerefererUrl($url);
103                                         loadTemplate('member_order_frametester', false, $content);
104                                         break;
105
106                                 case 'guest':
107                                         $content['url']   = generateDerefererUrl($url);
108                                         loadTemplate('guest_frametester', false, $content);
109                                         break;
110                         } // END - switch
111                         break;
112
113                 case 'test_top':
114                         displayMessage('{--GUEST_FRAMETESTER_TOP--}');
115                         break;
116
117                 case 'back': // Back buttom
118                         loadTemplate('member_order_back', false, getRequestElement('order'));
119                         break;
120
121                 case 'send': // Send mail away
122                         loadTemplate('member_order_send', false, getRequestElement('order'));
123                         break;
124         } // END - switch
125 } else {
126         // Go away...
127         redirectToUrl('modules.php?module=login');
128 }
129
130 // [EOF]
131 ?>