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
RevLine 
[3981]1<?php
2
[19376]3# $Id: common.inc 28649 2007-09-06 07:04:17Z sfiera@macports.org $
[3981]4# Copyright (c) 2003, OpenDarwin
5
[28377]6
[3981]7######################################################################
8
[28377]9# Ports database connection parameters:
[28379]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!");
[28377]15
16
17######################################################################
18
[28303]19# print the current MacPorts version
20$mp_version = "1.5.2";
21$mp_version_dmg = "1.5.0";
[15628]22
23######################################################################
24
[3981]25# print the page header
26function print_header($title, $encoding) {
27  global $DOCUMENT_ROOT;
28?>
[28649]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">
[3981]32  <head>
33    <title><?php echo("$title"); ?></title>
34    <meta http-equiv="Content-type" content="text/html; charset=<?php echo("$encoding"); ?>" />
[28303]35    <meta name="author" content="Jim Mock (mij@macports.org)" />
[28649]36    <meta name="author" content="Juan Manuel Palacios (jmpp@macports.org)" />
37    <meta name="author" content="Chris Pickel (sfiera@macports.org)" />
[3981]38    <meta name="copyright" content="2003, OpenDarwin" />
[28303]39    <meta name="copyright" content="2007, MacPorts Team" />
[3981]40    <meta name="robots" content="all" />
[28303]41    <link rel="stylesheet" type="text/css" href="/macports/mp.css" />
[28382]42    <link rel="alternate" type="application/rss+xml" href="/macports/macports_news.xml" />
[28649]43    <script type="text/javascript" src="mootools.v1.11.js"></script>
44    <script type="text/javascript" src="language.js"></script>
[3981]45  </head>
46  <body>
[28649]47  <?php
48    include("$DOCUMENT_ROOT/macports/includes/header.inc");
49    check_referer();
[3981]50}
51
52######################################################################
53
54# print the page footer
55function print_footer() {
56  global $DOCUMENT_ROOT;
57
[28303]58  include("$DOCUMENT_ROOT/macports/includes/footer.inc");
[3981]59
60  echo "  </body>\n";
61  echo "</html>\n";
62}
[8963]63
[28303]64######################################################################
65
66# Print a total count of currently available ports:
67function ports_count() {
[28379]68         global $portsdb;
69
70         $result = mysql_query("SELECT count(*) FROM $portsdb.portfiles") or die("Error: " . mysql_error());
[28303]71         if ($result) {
72           $row = mysql_fetch_array($result);
73           $count = $row[0];
74         } else {
75           $count = 0;
76         }
77         return $count;
78}
79
[8963]80######################################################################
[28303]81
82# Warn against darwinports.com leach!
[8963]83function check_referer() {
84        global $_SERVER;
85        if (preg_match("/darwinports.com/", $_SERVER['HTTP_REFERER'])) {
[3981]86?>
[28649]87        <div class="warning">
[28303]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>
[8963]92
[28303]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>
[8963]96        </div>
97
98<?php
99        }
100}       
101?>
Note: See TracBrowser for help on using the repository browser.