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

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

Whitespace fix for output'd html.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1<?php
2
3# -*- coding: utf-8; mode: php; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=php:et:sw=4:ts=4:sts=4
4# $Id: common.inc 30159 2007-10-21 21:01:22Z jmpp@macports.org $
5# Copyright (c) 2004-2007, MacPorts Organization
6# Copyright (c) 2004, OpenDarwin
7
8
9#####################################################################
10
11# Ports database connection parameters:
12$portsdb = 'macports';
13$portsdb_host = 'localhost';
14$portsdb_user = 'www';
15$portsdb_passwd = '';
16$portsdb_connect = mysql_pconnect($portsdb_host, $portsdb_user, $portsdb_passwd) or die("Can't connect to the MacPorts database!");
17
18
19######################################################################
20
21# MacPorts version variables:
22$mp_version_major = '1.5.0';
23$mp_version_latest = '1.5.2';
24
25
26######################################################################
27
28# Some useful URL abstractions:
29$trac_url = 'http://trac.macports.org/projects/macports/';
30$svn_url = 'http://svn.macports.org/repository/macports/';
31$downloads = $svn_url . 'downloads/MacPorts-' . $mp_version_major . '/';
32$tiger_dmg = $downloads . 'MacPorts-' . $mp_version_major .'-10.4.dmg';
33$panther_dmg = $downloads . 'MacPorts-' . $mp_version_major .'-10.3.dmg';
34$bz2_tarball = $downloads . 'MacPorts-' . $mp_version_major . '.tar.bz2';
35$gz_tarball = $downloads . 'MacPorts-' . $mp_version_major . '.tar.gz';
36$checksums = $downloads .  'MacPorts-' . $mp_version_major . '.chk.txt';
37$guide_url = 'http://geeklair.net/new_macports_guide/';
38
39
40######################################################################
41
42# Page header
43function print_header($title, $encoding) {
44    global $MPWEB;
45?>
46<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
47<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
48    <head>
49        <title><?php echo $title; ?></title>
50        <meta http-equiv="Content-type" content="application/xhtml+xml; charset=<?php echo $encoding; ?>" />
51        <meta name="author" content="Jim Mock (mij@macports.org)" />
52        <meta name="author" content="Juan Manuel Palacios (jmpp@macports.org)" />
53        <meta name="author" content="Chris Pickel (sfiera@macports.org)" />
54        <meta name="copyright" content="2003, OpenDarwin" />
55        <meta name="copyright" content="2007, MacPorts Team" />
56        <meta name="robots" content="all" />
57        <link rel="stylesheet" type="text/css" href="macports.css" />
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
70# Page footer
71function print_footer() {
72    global $MPWEB;
73
74    include("$MPWEB/includes/footer.inc");
75
76    echo "    </body>\n";
77    echo "</html>\n";
78}
79
80
81######################################################################
82
83# Total count of currently available ports:
84function ports_count() {
85    global $portsdb;
86
87    $result = mysql_query("SELECT count(*) FROM $portsdb.portfiles") or die("Error: " . mysql_error());
88    if ($result) {
89        $row = mysql_fetch_array($result);
90        $count = $row[0];
91    } else {
92        $count = 0;
93    }
94    return $count;
95}
96
97
98######################################################################
99
100# Warning against darwinports.com leach!
101function check_referer() {
102    global $_SERVER;
103
104    if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'darwinports.com') !== false) {
105?>
106        <div class="warning">
107       
108            <p>You have arrived at the <b>Official MacPorts Web Site</b> from <i>darwinports.com</i>.</p>
109           
110            <p><i>darwinports.com</i> <b>is not the official MacPorts Web Site</b>, nor is it a mirror of
111            the <i>Official MacPorts Web Site</i>. There is <b>no relationship</b> between the <i>MacPorts
112            Project</i> and <i>darwinports.com</i>.</p>
113
114            <p>The information you may have been presented with on <i>darwinports.com</i> may be incorrect
115            or outdated and is not endorsed in any way by the <i>MacPorts Project</i>. For the most accurate
116            information about MacPorts, please bookmark this site, <a href="http://www.macports.org">http://www.macports.org</a>.</p>
117           
118        </div>
119<?php
120    }
121}
122?>
Note: See TracBrowser for help on using the repository browser.