summaryrefslogtreecommitdiffstats
path: root/wp-inst/pages
blob: 500ecc575a71f1e28575b0a69f4e47fd8e3f5521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php /* Don't remove these lines, they call the b2 function files ! */

/* $Id: pages,v 1.1.1.1 2004/10/14 12:07:23 donncha Exp $ */

$blog = 1;
if( is_file( "wp-config.php" ) == false )
{
  $nosetup = true;
  include( "../index.php" );
  die();
}
require_once('wp-blog-header.php');
// not on by default: require_once(ABSPATH.'wp-links/links.weblogs.com.php');

define( 'NODISPLAY', false );

$siteurl = get_settings( 'siteurl' );
$wpsmarty->assign( 'siteurl', $siteurl );
$wpsmarty->assign( 'wp_version', $wp_version );
$wpsmarty->assign( 'wpblog', $wpblog );

get_currentuserinfo();

// Required for caching single posts - useful to put it here anyway
// as this code would be run multiple times including each wp-comments.php
$comment_author = (isset($_COOKIE['comment_author_'.$cookiehash])) ? trim($_COOKIE['comment_author_'.$cookiehash]) : '';
$comment_author_email = (isset($_COOKIE['comment_author_email_'.$cookiehash])) ? trim($_COOKIE['comment_author_email_'.$cookiehash]) : '';
$comment_author_url = (isset($_COOKIE['comment_author_url_'.$cookiehash])) ? trim($_COOKIE['comment_author_url_'.$cookiehash]) : '';

if( count( $posts ) == 1 )
{
    $smartyKey = md5( $comment_author_url.$comment_author.$comment_author_email.$user_login.$_SERVER[ 'REQUEST_URI' ] );
}
else
{
    $smartyKey = md5( $user_login.$_SERVER[ 'REQUEST_URI' ] );
}

if( $wpsmarty->is_cached( "index.html", $smartyKey ) == false )
{
    $uri = split( '/', $_SERVER[ 'REQUEST_URI' ] );
    $tpl = $uri[ count( $uri ) - 2 ];
    $results = $wpdb->get_results( "select * from ".$wpdb->posts." where post_name='".$tpl."'", ARRAY_A );
    if( is_array( $results ) )
    {
        $content = $results[0]['post_content'];
    }
    else
    {
        $content = "Page Does Not Exist.";
    }
    $wpsmarty->assign( 'content', $content );
}

$wpsmarty->display( 'index.html', $smartyKey );

?>