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

Last change on this file since 29367 was 29105, checked in by jmpp@…, 13 years ago

Per advice from Ryan: echo is a language construct, not a function, so use it as such.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1<?php
2
3# $Id: common.inc 29105 2007-09-15 06:09:00Z jmpp@macports.org $
4# Copyright (c) 2003, OpenDarwin
5# Copyright (c) 2003-2007, MacPorts Team.
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_major = '1.5.0';
21$mp_version_latest = '1.5.2';
22
23
24######################################################################
25
26# Some useful URL abstractions:
27$trac_url = 'http://trac.macports.org/projects/macports/';
28$svn_url = 'http://svn.macports.org/repository/macports/';
29$downloads = $svn_url . 'downloads/MacPorts-' . $mp_version_major . '/';
30$tiger_dmg = $downloads . 'MacPorts-' . $mp_version_major .'-10.4.dmg';
31$panther_dmg = $downloads . 'MacPorts-' . $mp_version_major .'-10.3.dmg';
32$bz2_tarball = $downloads . 'MacPorts-' . $mp_version_major . '.tar.bz2';
33$gz_tarball = $downloads . 'MacPorts-' . $mp_version_major . '.tar.gz';
34$checksums = $downloads .  'MacPorts-' . $mp_version_major . '.chk.txt';
35$guide_url = 'http://geeklair.net/new_macports_guide/';
36
37
38######################################################################
39
40# print the page header
41function print_header($title, $encoding) {
42    global $MPWEB;
43?>
44<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
45                      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
46<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
47    <head>
48        <title><?php echo("$title"); ?></title>
49        <meta http-equiv="Content-type" content="application/xhtml+xml; charset=<?php echo $encoding; ?>" />
50        <meta name="author" content="Jim Mock (mij@macports.org)" />
51        <meta name="author" content="Juan Manuel Palacios (jmpp@macports.org)" />
52        <meta name="author" content="Chris Pickel (sfiera@macports.org)" />
53        <meta name="copyright" content="2003, OpenDarwin" />
54        <meta name="copyright" content="2007, MacPorts Team" />
55        <meta name="robots" content="all" />
56        <link rel="stylesheet" type="text/css" href="macports.css" />
57        <link rel="alternate" type="application/rss+xml" href="macports_news.xml" />
58        <script type="text/javascript" src="mootools.v1.11.js"></script>
59        <script type="text/javascript" src="language.js"></script>
60    </head>
61<body>
62<?php
63    include("$MPWEB/includes/header.inc");
64    check_referer();
65}
66
67######################################################################
68
69# print the page footer
70function print_footer() {
71    global $MPWEB;
72
73    include("$MPWEB/includes/footer.inc");
74
75    echo "  </body>\n";
76    echo "</html>\n";
77}
78
79######################################################################
80
81# Print a total count of currently available ports:
82function ports_count() {
83    global $portsdb;
84
85    $result = mysql_query("SELECT count(*) FROM $portsdb.portfiles") or die("Error: " . mysql_error());
86    if ($result) {
87        $row = mysql_fetch_array($result);
88        $count = $row[0];
89    } else {
90        $count = 0;
91    }
92    return $count;
93}
94
95######################################################################
96
97# Warn against darwinports.com leach!
98function check_referer() {
99    global $_SERVER;
100
101    if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'darwinports.com') !== false) {
102?>
103        <div class="warning">
104            <p>You have arrived at the <b>Official MacPorts Web Site</b> from <i>darwinports.com</i>.</p>
105            <p><i>darwinports.com</i> <b>is not the official MacPorts Web Site</b>, nor is it a mirror of
106            the <i>Official MacPorts Web Site</i>.  There is <b>no relationship</b> between the <i>MacPorts
107            Project</i> and <i>darwinports.com</i>.</p>
108
109            <p>The information you may have been presented with on <i>darwinports.com</i> may be incorrect
110            or outdated and is not endorsed in any way by the <i>MacPorts Project</i>. For the most accurate
111            information about MacPorts, please bookmark this site, <a href="http://www.macports.org">http://www.macports.org</a>.</p>
112        </div>
113<?php
114    }
115}
116?>
Note: See TracBrowser for help on using the repository browser.