'userid' rewritten to functions
[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:: 856                                                    $ *
14  * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author:: stelzi                                                   $ *
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 - 2008 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         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
42         require($INC);
43 }
44
45 $MODE = "guest";
46
47 if (REQUEST_ISSET_GET(('order'))) {
48         // Order number placed, is he also logged in?
49         if (IS_MEMBER()) {
50                 // Ok, test passed... :)
51                 $result = SQL_QUERY_ESC("SELECT subject, url FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s AND sender=%s AND data_type='TEMP' LIMIT 1",
52                  array(bigintval(REQUEST_GET('order')), getUserId()), __FILE__, __LINE__);
53
54                 // Finally is the entry valid?
55                 if (SQL_NUMROWS($result) == 1) {
56                         // Load subject and URL (but forwhat do we need the subject line here???
57                         list($sub, $url) = SQL_FETCHROW($result);
58
59                         // This fixes a white page
60                         REQUEST_SET_POST('url', $url);
61
62                         // Mode is member
63                         $MODE = "member";
64                 } else {
65                         // Matching line not found!
66                         LOAD_URL("modules.php?module=index&amp;what=login");
67                 }
68
69                 // Free memory
70                 SQL_FREERESULT($result);
71         } else {
72                 // He is no longer logged in
73                 LOAD_URL("modules.php?module=index&amp;what=login");
74         }
75 }
76
77 if ((REQUEST_ISSET_POST(('url'))) || (REQUEST_ISSET_GET(('url'))) || (REQUEST_ISSET_GET(('frame')))) {
78         // Default URL is ours
79         $url = constant('URL');
80
81         // Decode URL if set in GET parameters
82         if (REQUEST_ISSET_GET(('url')))  $url = decodeString(str_replace(" ", "+", compileUriCode(urldecode(REQUEST_GET('url')))));
83
84         // Use URL from POST data if set
85         if (REQUEST_ISSET_POST(('url'))) $url = REQUEST_POST('url');
86
87         // Add missing element
88         $frame = "";
89         if (REQUEST_ISSET_GET(('frame'))) $frame = REQUEST_GET(('frame'));
90         switch ($frame)
91         {
92         case "":
93                 switch ($MODE)
94                 {
95                 case "member":
96                         // Build frameset
97                         define('__ORDER_VALUE', bigintval(REQUEST_GET('order')));
98                         define('__URL_VALUE'  , DEREFERER($url));
99                         LOAD_TEMPLATE("member_order_frametester");
100                         break;
101
102                 case "guest":
103                         define('__URL_VALUE'  , DEREFERER($url));
104                         LOAD_TEMPLATE("guest_frametester");
105                         break;
106                 }
107                 break;
108
109         case "test_top":
110                 LOAD_TEMPLATE("admin_settings_saved", false, "<div class=\"guest_done\">{--GUEST_FRAMETESTER_TOP--}</span>");
111                 break;
112
113         case "back": // Back buttom
114                 LOAD_TEMPLATE("member_order_back", false, REQUEST_GET('order'));
115                 break;
116
117         case "send": // Send mail away
118                 LOAD_TEMPLATE("member_order_send", false, REQUEST_GET('order'));
119                 break;
120         }
121 } else {
122         // Go away...
123         LOAD_URL("modules.php?module=login");
124 }
125 //
126 ?>