First commit of tag changes. bug-1444
[cacert-devel.git] / includes / account_stuff.php
1 <?php /*
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: $expand = " explode('WoT');"; break; // Find Assurer
105 case 1000:
106 case 1001:
107 case 1002: // View GPG key
108 case 1003:
109 case 1004:
110 case 1005:
111 case 1006:
112 case 1007:
113 case 1008:
114 case 1009:
115 case 1010: $expand = " explode('gpg');"; break;
116 case 1500: // Dipute
117 case 1501: // Dispute Email Request
118 case 1502: // ViewEdit
119 case 1503:
120 case 1504:
121 case 1505:
122 case 1506:
123 case 1507:
124 case 1508:
125 case 1509:
126 case 1510: $expand = " explode('disputes');"; break;
127 case 2000:
128 case 2001:
129 case 2002:
130 case 2003:
131 case 2004:
132 case 2005:
133 case 2006:
134 case 2007:
135 case 2008:
136 case 2009: $expand = " explode('advertising');"; break;
137 }
138
139 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
140 <html>
141 <head>
142 <title><?php echo $title?></title>
143 <?php if(array_key_exists('header',$_SESSION) && $_SESSION['_config']['header'] != "") { ?><?php echo $_SESSION['_config']['header']?><?php } ?>
144 <link rel="stylesheet" href="/styles/default.css" type="text/css" />
145 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
146 <script language="JavaScript" type="text/javascript">
147 function explode(e) {
148 if (document.getElementById(e).style.display == 'none') {
149 document.getElementById(e).style.display = 'block';
150 } else {
151 document.getElementById(e).style.display = 'none';
152 }
153 }
154
155 function hideall() {
156 var Nodes = document.getElementsByTagName('ul')
157 var max = Nodes.length
158 for(var i = 0;i < max;i++) {
159 var nodeObj = Nodes.item(i)
160 if (nodeObj.className == "menu") {
161 nodeObj.style.display = 'none';
162 }
163 }
164 }
165 </script>
166 </head>
167 <body onload="hideall(); explode('home');<?php echo $expand?>">
168 <div id="pagecell1">
169 <div id="pageName"><br>
170 <div id="pageLogo"><a href="http://<?php echo $_SESSION['_config']['normalhostname']?>"><img src="/images/cacert4.png" border="0" alt="CAcert.org logo"></a></div>
171 <div id="googlead"><h2><?php echo _("Free digital certificates!")?></h2></div>
172 </div>
173 <div id="pageNav">
174 <div class="relatedLinks">
175 <h3>CAcert.org</h3>
176 <ul class="menu" id="home"><li><a href="/index.php"><?php echo _("Go Home")?></a></li><li><a href="account.php?id=logout"><?php echo _("Logout")?></a></li></ul>
177 </div>
178 <div class="relatedLinks">
179 <h3 class="pointer" onclick="explode('mydetails')">+ <?php echo _("My Details")?></h3>
180 <ul class="menu" id="mydetails"><li><a href="account.php?id=13"><?php echo _("View/Edit")?></a></li><li><a href="account.php?id=14"><?php echo _("Change Password")?></a></li><li><a href="account.php?id=41"><?php echo _("Default Language")?></a></li><li><a href="wot.php?id=8"><?php echo _("My Listing")?></a></li><li><a href="wot.php?id=13"><?php echo _("My Location")?></a></li><li><a href="account.php?id=36"><?php echo _("My Alert Settings")?></a></li><li><a href="account.php?id=55"><?php echo _("My Trainings")?></a></li><li><a href="wot.php?id=10"><?php echo _("My Points")?></a></li><?php /* to delete
181 if($_SESSION['profile']['id'] == 1 || $_SESSION['profile']['id'] == 5897)
182 echo "<li><a href='sqldump.php'>SQL Dump</a></li>";
183 */
184 ?></ul>
185 </div>
186 <div class="relatedLinks">
187 <h3 class="pointer" onclick="explode('emailacc')">+ <?php echo _("Email Accounts")?></h3>
188 <ul class="menu" id="emailacc"><li><a href="account.php?id=1"><?php echo _("Add")?></a></li><li><a href="account.php?id=2"><?php echo _("View")?></a></li></ul>
189 </div>
190 <div class="relatedLinks">
191 <h3 class="pointer" onclick="explode('clicerts')">+ <?php echo _("Client Certificates")?></h3>
192 <ul class="menu" id="clicerts"><li><a href="account.php?id=3"><?php echo _("New")?></a></li><li><a href="account.php?id=5"><?php echo _("View")?></a></li></ul>
193 </div>
194 <?php if($_SESSION['profile']['points'] >= 50) { ?>
195 <div class="relatedLinks">
196 <h3 class="pointer" onclick="explode('gpg')">+ <?php echo _("GPG/PGP Keys")?></h3>
197 <ul class="menu" id="gpg"><li><a href="gpg.php?id=0"><?php echo _("New")?></a></li><li><a href="gpg.php?id=2"><?php echo _("View")?></a></li></ul>
198 </div>
199 <?php } ?>
200 <div class="relatedLinks">
201 <h3 class="pointer" onclick="explode('domains')">+ <?php echo _("Domains")?></h3>
202 <ul class="menu" id="domains"><li><a href="account.php?id=7"><?php echo _("Add")?></a></li><li><a href="account.php?id=9"><?php echo _("View")?></a></li></ul>
203 </div>
204 <div class="relatedLinks">
205 <h3 class="pointer" onclick="explode('servercert')">+ <?php echo _("Server Certificates")?></h3>
206 <ul class="menu" id="servercert"><li><a href="account.php?id=10"><?php echo _("New")?></a></li><li><a href="account.php?id=12"><?php echo _("View")?></a></li></ul>
207 </div>
208 <?php if(mysql_num_rows(mysql_query("select * from `org` where `memid`='".intval($_SESSION['profile']['id'])."'")) > 0 || $_SESSION['profile']['orgadmin'] == 1) { ?>
209 <div class="relatedLinks">
210 <h3 class="pointer" onclick="explode('clientorg')">+ <?php echo _("Org Client Certs")?></h3>
211 <ul class="menu" id="clientorg"><li><a href="account.php?id=16"><?php echo _("New")?></a></li><li><a href="account.php?id=18"><?php echo _("View")?></a></li></ul>
212 </div>
213 <div class="relatedLinks">
214 <h3 class="pointer" onclick="explode('serverorg')">+ <?php echo _("Org Server Certs")?></h3>
215 <ul class="menu" id="serverorg"><li><a href="account.php?id=20"><?php echo _("New")?></a></li><li><a href="account.php?id=22"><?php echo _("View")?></a></li></ul>
216 </div>
217 <?php } ?>
218 <?php if(mysql_num_rows(mysql_query("select * from `org` where `memid`='".intval($_SESSION['profile']['id'])."'")) > 0 || $_SESSION['profile']['orgadmin'] == 1) { ?>
219 <div class="relatedLinks">
220 <h3 class="pointer" onclick="explode('orgadmin')">+ <?php echo _("Org Admin")?></h3>
221 <ul class="menu" id="orgadmin"><?php if($_SESSION['profile']['orgadmin'] == 1) { ?><li><a href="account.php?id=24"><?php echo _("New Organisation")?></a></li><li><a href="account.php?id=25"><?php echo _("View Organisations")?></a></li><?php } ?><li><a href="account.php?id=35"><?php echo _("View")?></a></li></ul>
222 </div>
223 <?php } ?>
224 <div class="relatedLinks">
225 <h3 class="pointer" onclick="explode('WoT')">+ <?php echo _("CAcert Web of Trust")?></h3>
226 <ul class="menu" id="WoT"><li><a href="wot.php?id=0"><?php echo _("About")?></a></li><li><a href="wot.php?id=12"><?php echo _("Find an Assurer")?></a></li><li><a href="wot.php?id=3"><?php echo _("Rules")?></a></li><li><?php if($_SESSION['profile']['assurer'] != 1) { ?><a href="wot.php?id=2"><?php echo _("Becoming an Assurer")?></a><?php } else { ?><a href="wot.php?id=5"><?php echo _("Assure Someone")?></a><?php } ?></li><li><a href="wot.php?id=4"><?php echo _("Trusted ThirdParties")?></a></li><?php if($_SESSION['profile']['points'] >= 500) { ?><li><a href="wot.php?id=11"><div style="white-space:nowrap"><?php echo _("Organisation Assurance")?></div></a></li><?php } ?></ul>
227 </div>
228 <div class="relatedLinks">
229 <h3 class="pointer" onclick="explode('WoTForms')">+ <?php echo _("CAP Forms")?></h3><?php $name = $_SESSION['profile']['fname']." ".$_SESSION['profile']['mname']." ".$_SESSION['profile']['lname']." ".$_SESSION['profile']['suffix'];
230 while(strstr($name, " "))
231 $name = str_replace(" ", " ", $name);
232 $extra = "?name=".urlencode($name);
233 $extra .= "&amp;dob=".urlencode($_SESSION['profile']['dob']);
234 $extra .= "&amp;email=".urlencode($_SESSION['profile']['email']);
235
236 $extra2 = "?assurer=".urlencode($name)."&amp;date=now&amp;maxpoints=".maxpoints();
237 ?>
238 <ul class="menu" id="WoTForms">
239 <li><a href="/cap.php<?php echo $extra?>">A4 - <?php echo _("WoT Form")?></a></li>
240 <li><a href="/cap.php<?php echo $extra?>&amp;format=letter">US - <?php echo _("WoT Form")?></a></li>
241 <?php /* <li><div style="white-space:nowrap"><a href="/ttp.php<?php echo $extra?>">A4 - <?php echo _("TTP Form")?></a></div></li>
242 <li><div style="white-space:nowrap"><a href="/ttp.php<?php echo $extra?>&amp;format=letter">US - <?php echo _("TTP Form")?></a></div></li> */
243 ?>
244 <?php if($_SESSION['profile']['points'] > 100) { ?><li><div style="white-space:nowrap"><a href="/cap.php<?php echo $extra2?>">A4 - <?php echo _("Assurance Form")?></a></div></li>
245 <li><div style="white-space:nowrap"><a href="/cap.php<?php echo $extra2?>&amp;format=letter">US - <?php echo _("Assurance Form")?></a></div></li>
246 <?php } ?>
247 <?php /*
248 <li><div style="white-space:nowrap"><a href="/ttp.php">A4 - <?php echo _("Blank TTP Form")?></a></div></li>
249 <li><div style="white-space:nowrap"><a href="/ttp.php?&amp;format=letter">US - <?php echo _("Blank TTP Form")?></a></div></li>
250 */ ?>
251 <li><div style="white-space:nowrap"><a href="/cap.php">A4 - <?php echo _("Blank CAP Form")?></a></div></li>
252 <li><div style="white-space:nowrap"><a href="/cap.php?&amp;format=letter">US - <?php echo _("Blank CAP Form")?></a></div></li></ul>
253 </div>
254 <?php if($_SESSION['profile']['admin'] == 1 || $_SESSION['profile']['locadmin'] == 1) { ?>
255 <div class="relatedLinks">
256 <h3 class="pointer" onclick="explode('sysadmin')">+ <?php echo _("System Admin")?></h3>
257 <ul class="menu" id="sysadmin"><?php if($_SESSION['profile']['admin'] == 1) { ?><li><a href="account.php?id=42"><?php echo _("Find User")?></a></li><li><a href="account.php?id=48"><?php echo _("Find Domain")?></a></li><?php } if($_SESSION['profile']['locadmin'] == 1) { ?><li><a href="account.php?id=53"><?php echo _("Location DB")?></a></li><?php } ?></ul>
258 </div>
259 <?php } ?>
260 <div class="relatedLinks">
261 <h3 class="pointer" onclick="explode('disputes')">+ <?php echo _("Disputes/Abuses")?></h3>
262 <ul class="menu" id="disputes"><li><a href="disputes.php?id=0"><?php echo _("More Information")?></a></li><li><a href="disputes.php?id=1"><?php echo _("Email Dispute")?></a></li><li><a href="disputes.php?id=2"><?php echo _("Domain Dispute")?></a></li><?php if($_SESSION['profile']['admin'] == 1) { ?><li><a href="disputes.php?id=3"><?php echo _("Abuses")?></a></li><?php } ?></ul>
263 </div>
264 <?php if($_SESSION['profile']['adadmin'] >= 1) { ?>
265 <div class="relatedLinks">
266 <h3 class="pointer" onclick="explode('advertising')">+ <?php echo _("Advertising")?></h3>
267 <ul class="menu" id="advertising"><li><a href="advertising.php?id=1"><?php echo _("New Ad")?></a></li><li><a href="advertising.php?id=0"><?php echo _("View Ads")?></a></li></ul>
268 </div>
269 <?php } ?>
270 <?php include("about_menu.php"); ?>
271 </div>
272 <div id="content">
273 <div class="story">
274 <h3><?php echo $title2?></h3>
275 <?php if($_SESSION['_config']['errmsg'] != "") { ?>
276 <p><font color="#ff0000" size="+2"><?php echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?> </font></p>
277 <?php } ?>
278 <?php }
279
280 function showfooter()
281 {
282 ?>
283 </div>
284 </div>
285 <div id="siteInfo"><a href="//wiki.cacert.org/FAQ/AboutUs"><?php echo _("About Us")?></a> | <a href="account.php?id=38"><?php echo _("Donations")?></a> | <a href="http://wiki.cacert.org/wiki/CAcertIncorporated"><?php echo _("Association Membership")?></a> |
286 <a href="/policy/PrivacyPolicy.html"><?php echo _("Privacy Policy")?></a> | <a href="account.php?id=40"><?php echo _("Contact Us")?></a>
287 | &copy;2002-<?php echo date("Y")?> <?php echo _("by CAcert")?></div>
288 </div>
289 </body>
290 </html><?php }