Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #1  
Old 07-10-2005, 05:40 AM
riken Offline
pp veteran
 
Join Date: Apr 2005
Location: In VB Hell!
Posts: 87
Add error page

Pixelpost displays the image_template.html file if the user tries to go to any page not on the site (by going to http://www.site.com/index.php?x=foo for example).

I've modified pixelpost so now if a user tries to go to an unknown url an error page can be displayed.

This hack applies to pixelpost 1.4.1. Change this code:
Code:
// You can now add any template you want by just adding the template and a link to it.  For example,
// ?x=about will load the template about_template.html
if( $_GET['x'] == "ref" )
{
    // Maintain backwards compatibility with the referer template
    $_GET['x'] = "referer";
}

if( file_exists( "templates/".$cfgrow['template']."/".$_GET['x']."_template.html" ) )
{
    $tpl = file_get_contents("templates/".$cfgrow['template']."/".$_GET['x']."_template.html");
}
else
{

    if (!file_exists("templates/".$cfgrow['template']."/image_template.html"))
    {
        echo '<b>Error:</b><br />No template folder exists by the name of <b>"' .$cfgrow['template'] .'"</b> or the file <b>image_template.html</b> is missing in that folder.<br />Make sure that you have uploaded all necessary files with the exact same names as mentioned here.';
        exit;
    }

    $tpl = file_get_contents("templates/".$cfgrow['template']."/image_template.html");
}

if($_GET['popup'] == "comment")
{
    $tpl = file_get_contents("templates/".$cfgrow['template']."/comment_template.html");
}

// Added ability to use header and footers for templates.  They are not needed but used if included in the template
$tpl = $header . $tpl . $footer;
To this:
Code:
// You can now add any template you want by just adding the template and a link to it.  For example,
// ?x=about will load the template about_template.html
if( $_GET['x'] == "ref" ) 
{
	// Maintain backwards compatibility with the referer template
	$_GET['x'] = "referer";
}

if (isset($_GET['x']))
{
    $filename = "templates/".$cfgrow['template']."/".$_GET['x']."_template.html";
    if (!file_exists($filename))
    {
        $error_filename = "templates/".$cfgrow['template']."/error_template.html";
        if (file_exists($error_filename))
        {
            $filename = $error_filename;
        }
    }
}
if (!isset($filename))
{
    $filename = "templates/".$cfgrow['template']."/image_template.html";
	if (!file_exists($filename))
	{
		echo '<b>Error:</b><br />No template folder exists by the name of <b>"' .$cfgrow['template'] .'"</b> or the file <b>image_template.html</b> is missing in that folder.<br />Make sure that you have uploaded all necessary files with the exact same names as mentioned here.';
        exit;
    }
}

if($_GET['popup'] == "comment") {
    $filename = "templates/".$cfgrow['template']."/comment_template.html";
}
$tpl = file_get_contents($filename);

// Added ability to use header and footers for templates.  They are not needed but used if included in the template
$tpl = $header . $tpl . $footer;
__________________
Riken
Photoblog: Distant Imagery
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 05:02 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs