Compilation time added, some compileCode() calles removed, ADMIN_WHAT_404 added
[mailer.git] / inc / modules / frametester.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    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  * Needs to be in all Files and every File needs "svn propset           *
18  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
19  * -------------------------------------------------------------------- *
20  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
21  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // Some security stuff...
40 if (!defined('__SECURITY')) {
41         die();
42 } // END - if
43
44 $mode = 'guest';
45
46 if (isGetRequestElementSet('order')) {
47         // Order number placed, is he also logged in?
48         if (isMember()) {
49                 // Ok, test passed... :)
50                 $result = SQL_QUERY_ESC("SELECT `subject`, `url` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s AND `sender`=%s AND `data_type`='TEMP' LIMIT 1",
51                         array(bigintval(getRequestElement('order')), getUserId()), __FILE__, __LINE__);
52
53                 // Finally is the entry valid?
54                 if (SQL_NUMROWS($result) == 1) {
55                         // Load subject and URL (but forwhat do we need the subject line here???
56                         list($sub, $url) = SQL_FETCHROW($result);
57
58                         // This fixes a white page
59                         setRequestPostElement('url', $url);
60
61                         // Mode is member
62                         $mode = 'member';
63                 } else {
64                         // Matching line not found!
65                         redirectToUrl('modules.php?module=index&amp;what=login');
66                 }
67
68                 // Free memory
69                 SQL_FREERESULT($result);
70         } else {
71                 // He is no longer logged in
72                 redirectToUrl('modules.php?module=index&amp;what=login');
73         }
74 } // END - if
75
76 if ((isPostRequestElementSet('url')) || (isGetRequestElementSet('url')) || (isGetRequestElementSet('frame'))) {
77         // Default URL is ours
78         $url = getConfig('URL');
79
80         // Use URL from POST or GET data if set
81         if (isPostRequestElementSet('url')) {
82                 // POST data comes first
83                 $url = postRequestElement('url');
84         } elseif (isGetRequestElementSet('url')) {
85                 // Then GET data
86                 $url = decodeString(str_replace(' ', '+', compileUriCode(urldecode(getRequestElement('url')))));
87         }
88
89         // Add missing element
90         $frame = '';
91         if (isGetRequestElementSet('frame')) $frame = getRequestElement('frame');
92         switch ($frame) {
93                 case '':
94                         switch ($mode) {
95                                 case 'member':
96                                         // Build frameset
97                                         $content['order'] = bigintval(getRequestElement('order'));
98                                         $content['url']   = generateDerefererUrl($url);
99                                         loadTemplate('member_order_frametester', false, $content);
100                                         break;
101
102                                 case 'guest':
103                                         $content['url']   = generateDerefererUrl($url);
104                                         loadTemplate('guest_frametester', false, $content);
105                                         break;
106                         } // END - switch
107                         break;
108
109                 case 'test_top':
110                         loadTemplate('admin_settings_saved', false, '<div class="guest_done">{--GUEST_FRAMETESTER_TOP--}</span>');
111                         break;
112
113                 case 'back': // Back buttom
114                         loadTemplate('member_order_back', false, getRequestElement('order'));
115                         break;
116
117                 case 'send': // Send mail away
118                         loadTemplate('member_order_send', false, getRequestElement('order'));
119                         break;
120         } // END - switch
121 } else {
122         // Go away...
123         redirectToUrl('modules.php?module=login');
124 }
125
126 // [EOF]
127 ?>