Merge branch 'bug-1394' into testserver-stable
[cacert-devel.git] / includes / account_stuff.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 $id = 0; if(array_key_exists("id",$_REQUEST)) $id=intval($_REQUEST['id']);
20 $expand="";
21
22 function showheader($title = "CAcert.org", $title2 = "")
23 {
24 global $id, $PHP_SELF;
25 $PHP_SELF = &$_SERVER['PHP_SELF'];
26 $expand="";
27 $tmpid = $id;
28 if($PHP_SELF == "/wot.php")
29 $tmpid = $id + 500;
30 if($PHP_SELF == "/gpg.php")
31 $tmpid = $id + 1000;
32 if($PHP_SELF == "/disputes.php")
33 $tmpid = $id + 1500;
34 if($PHP_SELF == "/advertising.php")
35 $tmpid = $id + 2000;
36
37 switch($tmpid)
38 {
39 case 1: // Add email address
40 case 2: $expand = " explode('emailacc');"; break; // View email addresses
41 case 3: // Add Client certificate
42 case 4: // Confirm Client Certificate Request
43 case 5: // View Client Certificates
44 case 6: $expand = " explode('clicerts');"; break; // Client Certificate page
45 case 7: // Add new domain
46 case 8: // Confirm Domain page
47 case 9: $expand = " explode('domains');"; break; // View Domains
48 case 10: // Add Server Certifiacte
49 case 11: // Confirm Server Certificate Rewust
50 case 12: // View Server Cerificate
51 case 15: $expand = " explode('servercert');"; break; // Server Certificate page
52 case 13: // ViewEdit
53 case 14: // Change password
54 case 36: // My Alert settings
55 case 41: // Language Settings
56 case 55: // Trainings
57 case 59: // Account History
58 case 507:
59 case 508: // My Listing
60 case 510: // Old points calculation
61 case 515: // New points calculation
62 case 513: $expand = " explode('mydetails');"; break; // My Location
63 case 16: // Add Org Client Cert
64 case 17: // Confirm Org Client Certificate Request
65 case 18: // View Org Client Certificate
66 case 19: $expand = " explode('clientorg');"; break; // Org Cleint Cert page
67 case 20: // Add Org Server Cert
68 case 21: // Conform Org Server Cert Request
69 case 22: // View Org Server Certs
70 case 23: $expand = " explode('serverorg');"; break; // Org Server Certificate page
71 case 24: // Add new Organisation
72 case 25: // View Organisation List
73 case 26: // View Organisation Domains
74 case 27: // Edit Org Account
75 case 28: // View Add Org Domain
76 case 29: // Edit Org Domain
77 case 30: // Delete Org Domain
78 case 31:
79 case 32: // View Org Admin
80 case 33: // Add Org Admin
81 case 34: // Delete Org Admin
82 case 60: // View Organisation Account History
83 case 35: $expand = " explode('orgadmin');"; break; // View Org Admin Organisation List
84 case 42:
85 case 43:
86 case 44:
87 case 45:
88 case 46:
89 case 47:
90 case 48:
91 case 49:
92 case 50:
93 case 54:
94 case 53: $expand = " explode('sysadmin');"; break;
95 case 500: // CAcert Web of Trust
96 case 501:
97 case 502: // Become an Assurer
98 case 503: // CAcert Web of Trust Roles
99 case 504: // TTP
100 case 505: // Assurer Some one
101 case 506:
102 case 509:
103 case 511:
104 case 512: // Find Assurer
105 case 516: // TTP form
106 case 517: $expand = " explode('WoT');"; break; // Assurer check
107 case 1000:
108 case 1001:
109 case 1002: // View GPG key
110 case 1003:
111 case 1004:
112 case 1005:
113 case 1006:
114 case 1007:
115 case 1008:
116 case 1009:
117 case 1010: $expand = " explode('gpg');"; break;
118 case 1500: // Dipute
119 case 1501: // Dispute Email Request
120 case 1502: // ViewEdit
121 case 1503:
122 case 1504:
123 case 1505:
124 case 1506:
125 case 1507:
126 case 1508:
127 case 1509:
128 case 1510: $expand = " explode('disputes');"; break;
129 case 2000:
130 case 2001:
131 case 2002:
132 case 2003:
133 case 2004:
134 case 2005:
135 case 2006:
136 case 2007:
137 case 2008:
138 case 2009: $expand = " explode('advertising');"; break;
139 }
140
141 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
142 <html>
143 <head>
144 <title><?=$title?></title>
145 <? if(array_key_exists('header',$_SESSION) && $_SESSION['_config']['header'] != "") { ?><?=$_SESSION['_config']['header']?><? } ?>
146 <link rel="stylesheet" href="/styles/default.css" type="text/css" />
147 <script language="JavaScript" type="text/javascript">
148 function explode(e) {
149 if (document.getElementById(e).style.display == 'none') {
150 document.getElementById(e).style.display = 'block';
151 } else {
152 document.getElementById(e).style.display = 'none';
153 }
154 }
155
156 function hideall() {
157 var Nodes = document.getElementsByTagName('ul')
158 var max = Nodes.length
159 for(var i = 0;i < max;i++) {
160 var nodeObj = Nodes.item(i)
161 if (nodeObj.className == "menu") {
162 nodeObj.style.display = 'none';
163 }
164 }
165 }
166 </script>
167 </head>
168 <body onload="hideall(); explode('home');<?=$expand?>">
169 <div id="pagecell1">
170 <div id="pageName"><br>
171 <div id="pageLogo"><a href="http://<?=$_SESSION['_config']['normalhostname']?>"><img src="/images/cacert4.png" border="0" alt="CAcert.org logo"></a></div>
172 <div id="googlead"><h2><?=_("Free digital certificates!")?></h2></div>
173 </div>
174 <div id="pageNav">
175 <div class="relatedLinks">
176 <h3>CAcert.org</h3>
177 <ul class="menu" id="home"><li><a href="/index.php"><?=_("Go Home")?></a></li><li><a href="account.php?id=logout"><?=_("Logout")?></a></li></ul>
178 </div>
179 <div class="relatedLinks">
180 <h3 class="pointer" onclick="explode('mydetails')">+ <?=_("My Details")?></h3>
181 <ul class="menu" id="mydetails"><li><a href="account.php?id=13"><?=_("View/Edit")?></a></li><li><a href="account.php?id=14"><?=_("Change Password")?></a></li><li><a href="account.php?id=41"><?=_("Default Language")?></a></li><li><a href="wot.php?id=8"><?=_("My Listing")?></a></li><li><a href="wot.php?id=13"><?=_("My Location")?></a></li><li><a href="account.php?id=36"><?=_("My Alert Settings")?></a></li><li><a href="account.php?id=55"><?=_("My Trainings")?></a></li><li><a href="wot.php?id=10"><?=_("My Points")?></a></li>
182 </ul>
183 </div>
184 <div class="relatedLinks">
185 <h3 class="pointer" onclick="explode('emailacc')">+ <?=_("Email Accounts")?></h3>
186 <ul class="menu" id="emailacc"><li><a href="account.php?id=1"><?=_("Add")?></a></li><li><a href="account.php?id=2"><?=_("View")?></a></li></ul>
187 </div>
188 <div class="relatedLinks">
189 <h3 class="pointer" onclick="explode('clicerts')">+ <?=_("Client Certificates")?></h3>
190 <ul class="menu" id="clicerts"><li><a href="account.php?id=3"><?=_("New")?></a></li><li><a href="account.php?id=5"><?=_("View")?></a></li></ul>
191 </div>
192 <? if($_SESSION['profile']['points'] >= 50) { ?>
193 <div class="relatedLinks">
194 <h3 class="pointer" onclick="explode('gpg')">+ <?=_("GPG/PGP Keys")?></h3>
195 <ul class="menu" id="gpg"><li><a href="gpg.php?id=0"><?=_("New")?></a></li><li><a href="gpg.php?id=2"><?=_("View")?></a></li></ul>
196 </div>
197 <? } ?>
198 <div class="relatedLinks">
199 <h3 class="pointer" onclick="explode('domains')">+ <?=_("Domains")?></h3>
200 <ul class="menu" id="domains"><li><a href="account.php?id=7"><?=_("Add")?></a></li><li><a href="account.php?id=9"><?=_("View")?></a></li></ul>
201 </div>
202 <div class="relatedLinks">
203 <h3 class="pointer" onclick="explode('servercert')">+ <?=_("Server Certificates")?></h3>
204 <ul class="menu" id="servercert"><li><a href="account.php?id=10"><?=_("New")?></a></li><li><a href="account.php?id=12"><?=_("View")?></a></li></ul>
205 </div>
206 <? if(mysql_num_rows(mysql_query("select * from `org` where `memid`='".intval($_SESSION['profile']['id'])."'")) > 0 || $_SESSION['profile']['orgadmin'] == 1) { ?>
207 <div class="relatedLinks">
208 <h3 class="pointer" onclick="explode('clientorg')">+ <?=_("Org Client Certs")?></h3>
209 <ul class="menu" id="clientorg"><li><a href="account.php?id=16"><?=_("New")?></a></li><li><a href="account.php?id=18"><?=_("View")?></a></li></ul>
210 </div>
211 <div class="relatedLinks">
212 <h3 class="pointer" onclick="explode('serverorg')">+ <?=_("Org Server Certs")?></h3>
213 <ul class="menu" id="serverorg"><li><a href="account.php?id=20"><?=_("New")?></a></li><li><a href="account.php?id=22"><?=_("View")?></a></li></ul>
214 </div>
215 <? } ?>
216 <? if(mysql_num_rows(mysql_query("select * from `org` where `memid`='".intval($_SESSION['profile']['id'])."'")) > 0 || $_SESSION['profile']['orgadmin'] == 1) { ?>
217 <div class="relatedLinks">
218 <h3 class="pointer" onclick="explode('orgadmin')">+ <?=_("Org Admin")?></h3>
219 <ul class="menu" id="orgadmin"><? if($_SESSION['profile']['orgadmin'] == 1) { ?><li><a href="account.php?id=24"><?=_("New Organisation")?></a></li><li><a href="account.php?id=25"><?=_("View Organisations")?></a></li><? } ?><li><a href="account.php?id=35"><?=_("View")?></a></li></ul>
220 </div>
221 <? } ?>
222 <div class="relatedLinks">
223 <h3 class="pointer" onclick="explode('WoT')">+ <?=_("CAcert Web of Trust")?></h3>
224 <ul class="menu" id="WoT"><li><a href="wot.php?id=0"><?=_("About")?></a></li><li><a href="wot.php?id=12"><?=_("Find an Assurer")?></a></li><li><a href="wot.php?id=3"><?=_("Rules")?></a></li><li><a href="wot.php?id=17"><?=_("Check Assurer Status")?></a></li><li><? if($_SESSION['profile']['assurer'] != 1) { ?><a href="wot.php?id=2"><?=_("Becoming an Assurer")?></a><? } else { ?><a href="wot.php?id=5"><?=_("Assure Someone")?></a><? } ?></li><li><a href="wot.php?id=4"><?=_("Trusted ThirdParties")?></a></li><? if($_SESSION['profile']['points'] >= 500) { ?><li><a href="wot.php?id=11"><div style="white-space:nowrap"><?=_("Organisation Assurance")?></div></a></li><? } ?><li><a href="account.php?id=55"><?=_("Training")?></a></li></ul>
225 </div>
226 <div class="relatedLinks">
227 <h3 class="pointer" onclick="explode('WoTForms')">+ <?=_("CAP Forms")?></h3><?
228 $name = $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname']." ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix'];
229 while(strstr($name, " "))
230 $name = str_replace(" ", " ", $name);
231 $extra = "?name=".urlencode($name);
232 $extra .= "&amp;dob=".urlencode($_SESSION['profile']['dob']);
233 $extra .= "&amp;email=".urlencode($_SESSION['profile']['email']);
234
235 $extra2 = "?assurer=".urlencode($name)."&amp;date=now&amp;maxpoints=".maxpoints();
236 ?>
237 <ul class="menu" id="WoTForms">
238 <li><a href="/cap.php<?=$extra?>">A4 - <?=_("WoT Form")?></a></li>
239 <li><a href="/cap.php<?=$extra?>&amp;format=letter">US - <?=_("WoT Form")?></a></li>
240 <? /* <li><div style="white-space:nowrap"><a href="/ttp.php<?=$extra?>">A4 - <?=_("TTP Form")?></a></div></li>
241 <li><div style="white-space:nowrap"><a href="/ttp.php<?=$extra?>&amp;format=letter">US - <?=_("TTP Form")?></a></div></li> */
242 ?>
243 <? if($_SESSION['profile']['points'] > 100) { ?><li><div style="white-space:nowrap"><a href="/cap.php<?=$extra2?>">A4 - <?=_("Assurance Form")?></a></div></li>
244 <li><div style="white-space:nowrap"><a href="/cap.php<?=$extra2?>&amp;format=letter">US - <?=_("Assurance Form")?></a></div></li>
245 <? } ?>
246 <? /*
247 <li><div style="white-space:nowrap"><a href="/ttp.php">A4 - <?=_("Blank TTP Form")?></a></div></li>
248 <li><div style="white-space:nowrap"><a href="/ttp.php?&amp;format=letter">US - <?=_("Blank TTP Form")?></a></div></li>
249 */ ?>
250 <li><div style="white-space:nowrap"><a href="/cap.php">A4 - <?=_("Blank CAP Form")?></a></div></li>
251 <li><div style="white-space:nowrap"><a href="/cap.php?&amp;format=letter">US - <?=_("Blank CAP Form")?></a></div></li></ul>
252 </div>
253 <? if($_SESSION['profile']['admin'] == 1 || $_SESSION['profile']['locadmin'] == 1) { ?>
254 <div class="relatedLinks">
255 <h3 class="pointer" onclick="explode('sysadmin')">+ <?=_("System Admin")?></h3>
256 <ul class="menu" id="sysadmin"><? if($_SESSION['profile']['admin'] == 1) { ?><li><a href="account.php?id=42"><?=_("Find User")?></a></li><li><a href="account.php?id=48"><?=_("Find Domain")?></a></li><? } if($_SESSION['profile']['locadmin'] == 1) { ?><li><a href="account.php?id=53"><?=_("Location DB")?></a></li><? } ?></ul>
257 </div>
258 <? } ?>
259 <div class="relatedLinks">
260 <h3 class="pointer" onclick="explode('disputes')">+ <?=_("Disputes/Abuses")?></h3>
261 <ul class="menu" id="disputes"><li><a href="disputes.php?id=0"><?=_("More Information")?></a></li><li><a href="disputes.php?id=1"><?=_("Email Dispute")?></a></li><li><a href="disputes.php?id=2"><?=_("Domain Dispute")?></a></li><? if($_SESSION['profile']['admin'] == 1) { ?><li><a href="disputes.php?id=3"><?=_("Abuses")?></a></li><? } ?></ul>
262 </div>
263 <? if($_SESSION['profile']['adadmin'] >= 1) { ?>
264 <div class="relatedLinks">
265 <h3 class="pointer" onclick="explode('advertising')">+ <?=_("Advertising")?></h3>
266 <ul class="menu" id="advertising"><li><a href="advertising.php?id=1"><?=_("New Ad")?></a></li><li><a href="advertising.php?id=0"><?=_("View Ads")?></a></li></ul>
267 </div>
268 <? } ?>
269 <? include("about_menu.php"); ?>
270 </div>
271 <div id="content">
272 <div class="story">
273 <h3><?=$title2?></h3>
274 <? if($_SESSION['_config']['errmsg'] != "") { ?>
275 <p class="error_fatal"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?></p>
276 <? } ?>
277 <?
278 }
279
280 function showfooter()
281 {
282 ?>
283 </div>
284 </div>
285 <div id="siteInfo"><a href="//wiki.cacert.org/FAQ/AboutUs"><?=_("About Us")?></a> | <a href="account.php?id=38"><?=_("Donations")?></a> | <a href="http://wiki.cacert.org/wiki/CAcertIncorporated"><?=_("Association Membership")?></a> |
286 <a href="/policy/PrivacyPolicy.html"><?=_("Privacy Policy")?></a> | <a href="account.php?id=40"><?=_("Contact Us")?></a>
287 | &copy;2002-<?=date("Y")?> <?=_("by CAcert")?></div>
288 </div>
289 </body>
290 </html><?
291 }