source: trunk/www/includes/common.inc @ 28649

Last change on this file since 28649 was 28649, checked in by sfiera@…, 13 years ago

New clothes!

  • Applies style of my mockup to /trunk/www, at jmpp@'s request
  • Use php long-tags (mostly)
  • Valid XHTML 1.1 (mostly)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1<?php
2
3# $Id: common.inc 28649 2007-09-06 07:04:17Z sfiera@macports.org $
4# Copyright (c) 2003, OpenDarwin
5
6
7######################################################################
8
9# Ports database connection parameters:
10$portsdb = 'macports_ports';
11$portsdb_host = 'localhost';
12$portsdb_user = 'www';
13$portsdb_passwd = '';
14$portsdb_connect = mysql_connect($portsdb_host, $portsdb_user, $portsdb_passwd) or die("Can't connect to the ports database!");
15
16
17######################################################################
18
19# print the current MacPorts version
20$mp_version = "1.5.2";
21$mp_version_dmg = "1.5.0";
22
23######################################################################
24
25# print the page header
26function print_header($title, $encoding) {
27  global $DOCUMENT_ROOT;
28?>
29<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
30                      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
31<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
32  <head>
33    <title><?php echo("$title"); ?></title>
34    <meta http-equiv="Content-type" content="text/html; charset=<?php echo("$encoding"); ?>" />
35    <meta name="author" content="Jim Mock (mij@macports.org)" />
36    <meta name="author" content="Juan Manuel Palacios (jmpp@macports.org)" />
37    <meta name="author" content="Chris Pickel (sfiera@macports.org)" />
38    <meta name="copyright" content="2003, OpenDarwin" />
39    <meta name="copyright" content="2007, MacPorts Team" />
40    <meta name="robots" content="all" />
41    <link rel="stylesheet" type="text/css" href="/macports/mp.css" />
42    <link rel="alternate" type="application/rss+xml" href="/macports/macports_news.xml" />
43    <script type="text/javascript" src="mootools.v1.11.js"></script>
44    <script type="text/javascript" src="language.js"></script>
45  </head>
46  <body>
47  <?php
48    include("$DOCUMENT_ROOT/macports/includes/header.inc");
49    check_referer();
50}
51
52######################################################################
53
54# print the page footer
55function print_footer() {
56  global $DOCUMENT_ROOT;
57
58  include("$DOCUMENT_ROOT/macports/includes/footer.inc");
59
60  echo "  </body>\n";
61  echo "</html>\n";
62}
63
64######################################################################
65
66# Print a total count of currently available ports:
67function ports_count() {
68         global $portsdb;
69
70         $result = mysql_query("SELECT count(*) FROM $portsdb.portfiles") or die("Error: " . mysql_error());
71         if ($result) {
72           $row = mysql_fetch_array($result);
73           $count = $row[0];
74         } else {
75           $count = 0;
76         }
77         return $count;
78}
79
80######################################################################
81
82# Warn against darwinports.com leach!
83function check_referer() {
84        global $_SERVER;
85        if (preg_match("/darwinports.com/", $_SERVER['HTTP_REFERER'])) {
86?>
87        <div class="warning">
88                <p>You have arrived at the <b>Official MacPorts Web Site</b> from <i>darwinports.com</i>.</p>
89                <p><i>darwinports.com</i> <b>is not the official MacPorts Web Site</b>, nor is it a mirror of
90                the <i>Official MacPorts Web Site</i>.  There is <b>no relationship</b> between the <i>MacPorts
91                Project</i> and <i>darwinports.com</i>.</p>
92
93                <p>The information you may have been presented with on <i>darwinports.com</i> may be incorrect
94                or outdated and is not endorsed in any way by the <i>MacPorts Project</i>. For the most accurate
95                information about MacPorts, please bookmark this site, <a href="http://www.macports.org">http://www.macports.org</a>.</p>
96        </div>
97
98<?php
99        }
100}       
101?>
Note: See TracBrowser for help on using the repository browser.