bug 1138: Properly compare against datetime strings
[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 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://<?=$_SESSION['_config']['normalhostname']?>"><img src="/images/cacert4.png" border="0" alt="CAcert.org logo"></a></div>
28 <div id="googlead"><? 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><? } else {
42 ?><h2><?=_("Free digital certificates!")?></h2><? } ?></div>
43 </div>
44 <div id="pageNav">
45 <div class="relatedLinks">
46 <h3><?=_("Join CAcert.org")?></h3>
47 <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
48 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=1"><?=_("Join")?></a>
49 <? } ?>
50 <a href="/policy/CAcertCommunityAgreement.php"><?=_("Community Agreement")?></a>
51 <a href="/index.php?id=3"><?=_("Root Certificate")?></a>
52 </div>
53 <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
54 <div class="relatedLinks">
55 <h3 class="pointer"><?=_("My Account")?></h3>
56 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=4"><?=_("Password Login")?></a>
57 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=5"><?=_("Lost Password")?></a>
58 <a href="https://<?=$_SESSION['_config']['normalhostname']?>/index.php?id=4&amp;noauto=1"><?=_("Net Cafe Login")?></a>
59 <a href="https://<?=$_SESSION['_config']['securehostname']?>/index.php?id=4"><?=_("Certificate Login")?></a>
60 </div>
61 <? } ?>
62 <? include("about_menu.php"); ?>
63 <div class="relatedLinks">
64 <h3 class="pointer" onclick="explode('trans')">+ <?=_("Translations")?></h3>
65 <ul class="menu" id="trans"><? foreach(L10n::$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>
66 </div>
67 <? if(array_key_exists('mconn',$_SESSION) && $_SESSION['mconn']) { ?>
68 <div class="relatedLinks">
69 <h3 class="pointer" onclick="explode('recom')"><?=_("Advertising")?></h3>
70 <ul class="menu" id="recom"><?
71 $query = "select * from `advertising` where `expires`>NOW() and `active`=1";
72 $res = mysql_query($query);
73 while($row = mysql_fetch_assoc($res))
74 echo "<li><a href='$row[link]' target='_blank'>$row[title]</a></li>";
75 ?></ul>
76 </div>
77 <? } ?>
78 </div>
79 <div id="content">
80 <div class="story">
81 <? if($title2!="") echo "<h3>$title2</h3>"; ?>
82 <? if($_SESSION['_config']['errmsg'] != "") { ?>
83 <p><font color="#ff0000" size="+2"><? echo $_SESSION['_config']['errmsg']; $_SESSION['_config']['errmsg'] = ""; ?> </font></p>
84 <? } ?>
85 <?
86
87 }
88
89 function showheader($title = "CAcert.org", $title2 = "")
90 {
91 global $id;
92
93 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
94 <html>
95 <head>
96 <title><?=$title?></title>
97 <? if(array_key_exists("header",$_SESSION['_config']) && $_SESSION['_config']['header'] != "") { ?><?=$_SESSION['_config']['header']?><? } ?>
98 <link rel="stylesheet" href="/styles/default.css" type="text/css">
99 <link href="http://blog.CAcert.org/feed/" rel="alternate" type="application/rss+xml" title="rss">
100 <script language="JavaScript" type="text/javascript">
101 function explode(e) {
102 if (document.getElementById(e).style.display == 'none') {
103 document.getElementById(e).style.display = 'block';
104 } else {
105 document.getElementById(e).style.display = 'none';
106 }
107 }
108
109 function hideall() {
110 var Nodes = document.getElementsByTagName('ul')
111 var max = Nodes.length
112 for(var i = 0;i < max;i++) {
113 var nodeObj = Nodes.item(i)
114 if (nodeObj.className == "menu" && nodeObj.id != "recom") {
115 nodeObj.style.display = 'none';
116 }
117 }
118 }
119 </script>
120 </head>
121 <body onload="hideall();">
122 <?
123 showbodycontent($title,$title2);
124 }
125 }
126
127 if(!function_exists("showfooter"))
128 {
129 function showfooter()
130 {
131 ?>
132 </div>
133 </div>
134 <? include("sponsorinfo.php") ?>
135 <div id="siteInfo">
136 <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> |
137 <a href="/policy/PrivacyPolicy.html"><?=_("Privacy Policy")?></a> |
138 <a href="/index.php?id=51"><?=_("Mission Statement")?></a> | <a href="/index.php?id=11"><?=_("Contact Us")?></a> |
139 &copy;2002-<?=date("Y")?> <?=_("by CAcert")?></div>
140 </div>
141 </body>
142 </html><?
143 }
144 }
145 ?>