First commit of tag changes. bug-1444
[cacert-devel.git] / includes / general_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 require_once($_SESSION['_config']['filepath'].'/includes/lib/l10n.php');
20
21 if(!function_exists("showheader"))
22 {
23 function showbodycontent($title = "CAcert.org", $title2 = "")
24 {
25 ?> <div id="pagecell1">
26 <div id="pageName"><br>
27 <div id="pageLogo"><a href="http://<?php echo $_SESSION['_config']['normalhostname']?>"><img src="/images/cacert4.png" border="0" alt="CAcert.org logo"></a></div>
28 <div id="googlead"><?php if(!array_key_exists('HTTPS',$_SERVER) || $_SERVER['HTTPS'] != "on") { ?><script type="text/javascript">
29 <!--
30 google_ad_client = "pub-0959373285729680";
31 google_alternate_ad_url = "http://www.cacert.org/";
32 google_ad_width = 468;
33 google_ad_height = 60;
34 google_ad_format = "468x60_as";
35 google_color_link = "000000";
36 google_color_url = "000000";
37 google_color_text = "000000";
38 google_color_border = "FFFFFF";
39 //-->
40 </script>
41 <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><?php } else {
42 ?><h2><?php echo _("Free digital certificates!")?></h2><?php } ?></div>
43 </div>
44 <div id="pageNav">
45 <div class="relatedLinks">
46 <h3><?php echo _("Join CAcert.org")?></h3>
47 <?php if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
48 <a href="https://<?php echo $_SESSION['_config']['normalhostname']?>/index.php?id=1"><?php echo _("Join")?></a>
49 <?php } ?>
50 <a href="/policy/CAcertCommunityAgreement.html"><?php echo _("Community Agreement")?></a>
51 <a href="/index.php?id=3"><?php echo _("Root Certificate")?></a>
52 </div>
53 <?php if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
54 <div class="relatedLinks">
55 <h3 class="pointer"><?php echo _("My Account")?></h3>
56 <a href="https://<?php echo $_SESSION['_config']['normalhostname']?>/index.php?id=4"><?php echo _("Password Login")?></a>
57 <a href="https://<?php echo $_SESSION['_config']['normalhostname']?>/index.php?id=5"><?php echo _("Lost Password")?></a>
58 <a href="https://<?php echo $_SESSION['_config']['normalhostname']?>/index.php?id=4&amp;noauto=1"><?php echo _("Net Cafe Login")?></a>
59 <a href="https://<?php echo $_SESSION['_config']['securehostname']?>/index.php?id=4"><?php echo _("Certificate Login")?></a>
60 </div>
61 <?php } ?>
62 <?php include("about_menu.php"); ?>
63 <div class="relatedLinks">
64 <h3 class="pointer" onclick="explode('trans')">+ <?php echo _("Translations")?></h3>
65 <ul class="menu" id="trans"><?php foreach(L10n::$translations as $key => $val) { ?><li><a href="<?php echo $_SERVER['SCRIPT_NAME']?>?id=<?php echo intval(array_key_exists('id',$_REQUEST)?$_REQUEST['id']:0)?>&amp;lang=<?php echo $key?>"><?php echo $val?></a></li><?php } ?></ul>
66 </div>
67 <?php if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
68 <div class="relatedLinks">
69 <h3 class="pointer" onclick="explode('recom')"><?php echo _("Advertising")?></h3>
70 <ul class="menu" id="recom"><?php $query = "select * from `advertising` where `expires`>NOW() and `active`=1";
71 $res = mysql_query($query);
72 while($row = mysql_fetch_assoc($res))
73 echo "<li><a href='$row[link]' target='_blank'>$row[title]</a></li>";
74 ?></ul>
75 </div>
76 <?php } ?>
77 </div>
78 <div id="content">
79 <div class="story">
80 <?php if($title2!="") echo "<h3>$title2</h3>"; ?>
81 <?php if($_SESSION['_config']['errmsg'] != "") { ?>
82 <p><font color="#ff0000" size="+2"><?php echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?> </font></p>
83 <?php } ?>
84 <?php
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><?php echo $title?></title>
95 <?php if(array_key_exists("header",$_SESSION['_config']) && $_SESSION['_config']['header'] != "") { ?><?php echo $_SESSION['_config']['header']?><?php } ?>
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 <?php showbodycontent($title,$title2);
121 }
122 }
123
124 if(!function_exists("showfooter"))
125 {
126 function showfooter()
127 {
128 ?>
129 </div>
130 </div>
131 <?php include("sponsorinfo.php") ?>
132 <div id="siteInfo">
133 <a href="//wiki.cacert.org/FAQ/AboutUs"><?php echo _("About Us")?></a> | <a href="/index.php?id=13"><?php echo _("Donations")?></a> | <a href="http://wiki.cacert.org/wiki/CAcertIncorporated"><?php echo _("Association Membership")?></a> |
134 <a href="/policy/PrivacyPolicy.html"><?php echo _("Privacy Policy")?></a> |
135 <a href="/index.php?id=51"><?php echo _("Mission Statement")?></a> | <a href="/index.php?id=11"><?php echo _("Contact Us")?></a> |
136 &copy;2002-<?php echo date("Y")?> <?php echo _("by CAcert")?></div>
137 </div>
138 </body>
139 </html><?php }
140 }
141 ?>