bug 965: Also adjust the links to the replaced pages
[cacert-devel.git] / includes / general_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 if(!function_exists("showheader"))
20 {
21 function showbodycontent($title = "CAcert.org", $title2 = "")
22 {
23 ?> <div id="pagecell1">
24 <div id="pageName"><br>
25 <div id="pageLogo"><a href="http://<?=$_SESSION['_config']['normalhostname']?>"><img src="/images/cacert4.png" border="0" alt="CAcert.org logo"></a></div>
26 <div id="googlead"><? if(!array_key_exists('HTTPS',$_SERVER) || $_SERVER['HTTPS'] != "on") { ?><script type="text/javascript">
27 <!--
28 google_ad_client = "pub-0959373285729680";
29 google_alternate_ad_url = "http://www.cacert.org/";
30 google_ad_width = 468;
31 google_ad_height = 60;
32 google_ad_format = "468x60_as";
33 google_color_link = "000000";
34 google_color_url = "000000";
35 google_color_text = "000000";
36 google_color_border = "FFFFFF";
37 //-->
38 </script>
39 <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><? } else {
40 ?><h2><?=_("Free digital certificates!")?></h2><? } ?></div>
41 </div>
42 <div id="pageNav">
43 <div class="relatedLinks">
44 <h3><?=_("Join CAcert.org")?></h3>
45 <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
46 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=1"><?=_("Join")?></a>
47 <? } ?>
48 <a href="/policy/CAcertCommunityAgreement.php"><?=_("Community Agreement")?></a>
49 <a href="/index.php?id=3"><?=_("Root Certificate")?></a>
50 </div>
51 <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
52 <div class="relatedLinks">
53 <h3 class="pointer"><?=_("My Account")?></h3>
54 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=4"><?=_("Password Login")?></a>
55 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=5"><?=_("Lost Password")?></a>
56 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=4&amp;noauto=1"><?=_("Net Cafe Login")?></a>
57 <a href="https://<?=$_SESSION['_config']['securehostname']?>/index.php?id=4"><?=_("Certificate Login")?></a>
58 </div>
59 <? } ?>
60 <? include("about_menu.php"); ?>
61 <div class="relatedLinks">
62 <h3 class="pointer" onclick="explode('trans')">+ <?=_("Translations")?></h3>
63 <ul class="menu" id="trans"><? foreach($_SESSION['_config']['translations'] as $key => $val) { ?><li><a href="<?=$_SERVER['SCRIPT_NAME']?>?id=<?=intval(array_key_exists('id',$_REQUEST)?$_REQUEST['id']:0)?>&amp;lang=<?=$key?>"><?=$val?></a></li><? } ?></ul>
64 </div>
65 <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
66 <div class="relatedLinks">
67 <h3 class="pointer" onclick="explode('recom')"><?=_("Advertising")?></h3>
68 <ul class="menu" id="recom"><?
69 $query = "select * from `advertising` where `expires`>NOW() and `active`=1";
70 $res = mysql_query($query);
71 while($row = mysql_fetch_assoc($res))
72 echo "<li><a href='$row[link]' target='_blank'>$row[title]</a></li>";
73 ?></ul>
74 </div>
75 <? } ?>
76 </div>
77 <div id="content">
78 <div class="story">
79 <? if($title2!="") echo "<h3>$title2</h3>"; ?>
80 <? if($_SESSION['_config']['errmsg'] != "") { ?>
81 <p><font color="#ff0000" size="+2"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?> </font></p>
82 <? } ?>
83 <?
84
85 }
86
87 function showheader($title = "CAcert.org", $title2 = "")
88 {
89 global $id;
90
91 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
92 <html>
93 <head>
94 <title><?=$title?></title>
95 <? if(array_key_exists("header",$_SESSION['_config']) && $_SESSION['_config']['header'] != "") { ?><?=$_SESSION['_config']['header']?><? } ?>
96 <link rel="stylesheet" href="/styles/default.css" type="text/css">
97 <link href="http://blog.CAcert.org/feed/" rel="alternate" type="application/rss+xml" title="rss">
98 <script language="JavaScript" type="text/javascript">
99 function explode(e) {
100 if (document.getElementById(e).style.display == 'none') {
101 document.getElementById(e).style.display = 'block';
102 } else {
103 document.getElementById(e).style.display = 'none';
104 }
105 }
106
107 function hideall() {
108 var Nodes = document.getElementsByTagName('ul')
109 var max = Nodes.length
110 for(var i = 0;i < max;i++) {
111 var nodeObj = Nodes.item(i)
112 if (nodeObj.className == "menu" && nodeObj.id != "recom") {
113 nodeObj.style.display = 'none';
114 }
115 }
116 }
117 </script>
118 </head>
119 <body onload="hideall();">
120 <?
121 showbodycontent($title,$title2);
122 }
123 }
124
125 if(!function_exists("showfooter"))
126 {
127 function showfooter()
128 {
129 ?>
130 </div>
131 </div>
132 <? include("sponsorinfo.php") ?>
133 <div id="siteInfo">
134 <a href="//wiki.cacert.org/FAQ/AboutUs"><?=_("About Us")?></a> | <a href="/index.php?id=13"><?=_("Donations")?></a> | <a href="http://wiki.cacert.org/wiki/CAcertIncorporated"><?=_("Association Membership")?></a> |
135 <a href="/policy/PrivacyPolicy.html"><?=_("Privacy Policy")?></a> |
136 <a href="/index.php?id=51"><?=_("Mission Statement")?></a> | <a href="/index.php?id=11"><?=_("Contact Us")?></a> |
137 &copy;2002-<?=date("Y")?> <?=_("by CAcert")?></div>
138 </div>
139 </body>
140 </html><?
141 }
142 }
143 ?>