Advertisement
Guest User

Untitled

a guest
Jan 5th, 2012
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 40.17 KB | None | 0 0
  1. <?php
  2.  
  3. // SVN file version:
  4. // $Id: index.php 511 2008-01-16 17:40:58Z d3designs $
  5.  
  6. /*
  7.  
  8. Pixelpost version 1.7
  9.  
  10. Pixelpost www: http://www.pixelpost.org/
  11.  
  12. Version 1.7:
  13. Development Team:
  14. Ramin Mehran, Will Duncan, Joseph Spurling,
  15. Piotr "GeoS" Galas, Dennis Mooibroek, Karin Uhlig, Jay Williams, David Kozikowski
  16.  
  17. Former members of the Development Team:
  18. Connie Mueller-Goedecke
  19. Version 1.1 to Version 1.3: Linus <http://www.shapestyle.se>
  20.  
  21.  
  22. IMPORTANT!!!
  23. Due to the nature of the characterset used in this file it is important to save this
  24. file with an UTF-8 encoding.
  25.  
  26. Contact: thecrew (at) pixelpost (dot) org
  27. Copyright 2007 Pixelpost.org <http://www.pixelpost.org>
  28.  
  29. License: http://www.gnu.org/copyleft/gpl.html
  30.  
  31. This program is free software; you can redistribute it and/or
  32. modify it under the terms of the GNU General Public License
  33. as published by the Free Software Foundation; either version 2
  34. of the License, or (at your option) any later version.
  35.  
  36. This program is distributed in the hope that it will be useful,
  37. but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  39. GNU General Public License for more details.
  40.  
  41. You should have received a copy of the GNU General Public License
  42. along with this program; if not, write to the Free Software
  43. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  44.  
  45. */
  46. ini_set('arg_separator.output', '&amp;');
  47. error_reporting(0);
  48.  
  49. $PHP_SELF = "index.php";
  50.  
  51. define('PIXELPOST',true);
  52.  
  53. if(file_exists("includes/pixelpost.php")) { require("includes/pixelpost.php"); }
  54. require("includes/functions.php");
  55.  
  56. start_mysql('includes/pixelpost.php','front');
  57.  
  58. /**
  59.  * Load the $cfgrow configuration variable and set the upload directory
  60.  */
  61. // get config
  62. if($cfgrow = sql_array("SELECT * FROM ".$pixelpost_db_prefix."config"))
  63. {
  64.     $upload_dir = $cfgrow['imagepath'];
  65. }else{
  66.     $extra_message= "Coming Soon. Not Installed Yet. Cause #1";
  67.     show_splash($extra_message,"templates");
  68. }
  69.  
  70. // Frontpage addons begin
  71. $dir = "addons/"; // refresh the addons table
  72. refresh_addons_table($dir);
  73. $addon_front_functions = array(0 => array('function_name' => '','workspace' => '','menu_name' => '','submenu_name' => ''));
  74. $addon_admin_functions = array(0 => array('function_name' => '','workspace' => '','menu_name' => '','submenu_name' => ''));
  75. create_front_addon_array();
  76.  
  77. session_start();
  78.  
  79.  
  80. // Initialise workspace.
  81. eval_addon_front_workspace('frontpage_init');
  82.  
  83.  
  84. // Fix proposed by tomyeah on the forum
  85. header('Content-Type: text/html; charset=utf-8');
  86.  
  87.  
  88. // Set cookie for visitor counter, re-count a person after 60 mins
  89. setcookie("lastvisit","expires in 60 minutes",time() +60*60);
  90.  
  91.  
  92. // cleanup $_GET['x']
  93. if(isset($_GET['x'])){$_GET['x'] = eregi_replace('[^a-z0-9_-]', '', $_GET['x']);}
  94.  
  95.  
  96. // save user info if requested
  97. if(isset($_POST['vcookie'])) {
  98.     $vcookiename  = addslashes($_POST['name']);
  99.     $vcookieurl   = addslashes($_POST['url']);
  100.     $vcookieemail = clean($_POST['email']);
  101.  
  102.     setcookie("visitorinfo","$vcookiename%$vcookieurl%$vcookieemail",time() +60*60*24*30); // save cookie 30 days
  103. }
  104.  
  105. if (isset($_GET['errors']) && $_SESSION["pixelpost_admin"]){
  106.  
  107.     error_reporting(E_ALL ^ E_NOTICE);
  108.  
  109. }elseif(isset($_GET['errorsall']) && $_SESSION["pixelpost_admin"]){
  110.  
  111.     error_reporting(E_ALL);
  112. }
  113.  
  114. if(isset($_GET['showimage'])){ $_GET['showimage'] = (int) $_GET['showimage']; }
  115.  
  116. if ($cfgrow['markdown'] == 'T') {
  117.     require("includes/markdown.php");
  118. }
  119.  
  120. // added token support for use in forms only if it is set on
  121. if ($cfgrow['token'] == 'T') {
  122.     if (!isset($_SESSION['token'])) {
  123.         $_SESSION['token'] = md5($_SERVER["HTTP_USER_AGENT"].$_SERVER["HTTP_ACCEPT_LANGUAGE"].$_SERVER["HTTP_ACCEPT_ENCODING"].$_SERVER["HTTP_ACCEPT_CHARSET"].$_SERVER["HTTP_ACCEPT"].$_SERVER["SERVER_SOFTWARE"].session_id().uniqid(rand(), TRUE));
  124.     }
  125.     if(!isset($_GET['x'])&&$_GET['x'] !== "save_comment") {
  126.         $_SESSION['token_time'] = time();
  127.     }
  128. }
  129.  
  130. // book visitors
  131. if (strtolower($cfgrow['visitorbooking'])!='no') { book_visitor($pixelpost_db_prefix."visitors"); }
  132.  
  133.  
  134. if(isset($mod_rewrite)&&$mod_rewrite == "1") { $showprefix = ""; }else{ $showprefix = "./index.php?showimage="; }
  135.  
  136.  
  137. // refresh the addons table
  138. $dir = "addons/";
  139. refresh_addons_table($dir);
  140.  
  141.  
  142. $tz       = $cfgrow['timezone'];
  143. $datetime = gmdate("Y-m-d H:i:s",time()+(3600 * $tz)); // current date+time
  144. $cdate    = $datetime; // for future posting, current date+time
  145.  
  146.  
  147. // ##########################################################################################//
  148. // LANGUAGE SELECTION
  149. // ##########################################################################################//
  150. // Original idea by RobbieMc (http://forum.pixelpost.org/showthread.php?t=3668)
  151.  
  152. /**
  153.  * This is an array of all supported languages in PP. It contains the country abbreviation
  154.  * and the native word for the language spoken in that country. This is used to get all
  155.  * variables.
  156.  *
  157.  */
  158. $PP_supp_lang = array('dutch'=>array('NL','Nederlands'),
  159.                       'english'=>array('EN','English'),
  160.                       'french'=>array('FR','Français'),
  161.                       'german'=>array('DE','Deutsch'),
  162.                       'italian'=>array('IT','Italiano'),
  163.                       'norwegian'=>array('NO','Norsk'),
  164.                       'persian'=>array('FA','Farsi'),
  165.                       'polish'=>array('PL','Polskiego'),
  166.                       'portuguese'=>array('PT','Português'),
  167.                       'simplified_chinese'=>array('CN','Chinese'),
  168.                       'spanish'=>array('ES','Español'),
  169.                       'swedish'=>array('SE','Svenska'),
  170.                       'danish'=>array('DK','Dansk'),
  171.                       'japanese'=>array('JP','Japanese'),
  172.                       'hungarian'=>array('HU','Magyar'),
  173.                       'romanian'=>array('RO','Romana'),
  174.                       'russian'=>array('RU','Russian'),
  175.                       'czech'=>array('CS','Česky')
  176.                      );
  177.  
  178. /**
  179.  * The default language is the language the user has set in the adminpanel
  180.  * We have to find the abbreviation
  181.  */
  182. $default_language_abr = strtolower($PP_supp_lang[$cfgrow['langfile']][0]);
  183.  
  184. /**
  185.  * Try to find if another language was selected or not (different ways)
  186.  * Set a cookie to the GET arg 'lang' if it exists.
  187.  *
  188.  */
  189. if(isset($_GET['lang']))
  190. {
  191.     // cookie is saved for 30 days now
  192.     setcookie ('lang', substr($_GET['lang'],0,2), time() +60*60*24*30, '/', false, 0);
  193.     $language_abr = substr($_GET['lang'],0,2);
  194. }
  195.  
  196. /**
  197.  * Set the &language variable to session 'lang' - this variable is the one used below
  198.  *
  199.  */
  200. $language_abr = "";
  201. if (isset($_COOKIE['lang']))
  202. {
  203.     $language_abr = $_COOKIE['lang'];
  204. }
  205.  
  206. /**
  207.  * Use the default language if none of the previous steps captured a language preference
  208.  *
  209.  */
  210. if(empty($language_abr)) { $language_abr = $default_language_abr; }
  211.  
  212. /**
  213.  * Override the language if $_GET['lang'] is set.
  214.  *
  215.  */
  216. if(isset($_GET['lang'])) { $language_abr = substr($_GET['lang'],0,2); }
  217.  
  218. /**
  219.  * Convert the two letter $language variable to full name of language file
  220.  * (used in language file switch but not template switch (template uses abbreviation))
  221.  *
  222.  */
  223. foreach ($PP_supp_lang as $key => $row) {
  224.     foreach($row as $cell){
  225.         if ($cell == strtoupper($language_abr)) { $language_full = $key; }
  226.     }
  227. }
  228.  
  229. // ##########################################################################################//
  230. // GET LANGUAGE FILE BASED ON LANGUAGE SELECTION
  231. // ##########################################################################################//
  232.  
  233. /**
  234.  * Always include the default language file (English) if it exists.
  235.  * That way if we forget to update the variables in the alternative language files the English ones are shown.
  236.  *
  237.  */
  238.  
  239. if(file_exists("language/lang-english.php")){
  240.     if(!isset($_GET['x'])OR($_GET['x'] != "rss" & $_GET['x'] != "atom")) {
  241.         require("language/lang-english.php");
  242.     }
  243. }
  244.  
  245. // now replace the contents of the variables with the selected language.
  246. if(!empty($language_full)) {
  247.     // check if illegal characters are used
  248.     if (!ereg("^[A-Za-z]+([0-9]+)?$", $language_full)) {
  249.         echo '<b>Error:</b><br />Pixelpost cannot include this file. If you need assistance in resolving this error please visit the <a href="http://www.pixelpost.org/forum/">Pixelpost Forum</a>.';
  250.         setcookie ('lang', "", time() - 3600, '/', false, 0);
  251.         exit;
  252.     } else {
  253.         if(file_exists("language/lang-".$language_full.".php")) {
  254.             if( !isset($_GET['x'])OR($_GET['x'] != "rss" & $_GET['x'] != "atom")) {
  255.                 require("language/lang-".$language_full.".php");
  256.             }
  257.         }else{
  258.             echo '<b>Error:</b><br />No <b>language</b> folder exists or the file <b>"lang-' .$language_full.'.php"</b> is missing in that folder.<br />Make sure that you have uploaded all necessary files with the exact same names as mentioned here.';
  259.             setcookie ('lang', "", time() - 3600, '/', false, 0);
  260.             exit;
  261.         }
  262.     }
  263. }else{
  264.     echo '<b>Error:</b><br />Pixelpost has problem selecting a default language.<br />Make sure that you have chosen a default language in the adminpanel.';
  265.     setcookie ('lang', "", time() - 3600, '/', false, 0);
  266.     exit;
  267. }
  268.  
  269. // Double Quotes in <SITE_TITLE> break HTML Code
  270. $pixelpost_site_title = pullout($cfgrow['sitetitle']);
  271. $pixelpost_site_title = htmlspecialchars($pixelpost_site_title,ENT_NOQUOTES);
  272.  
  273. // Double Quotes in <SUB_TITLE> break HTML Code
  274. $pixelpost_sub_title = pullout($cfgrow['subtitle']);
  275. $pixelpost_sub_title = htmlspecialchars($pixelpost_sub_title,ENT_NOQUOTES);
  276.  
  277.  
  278. //  Added ability to use header and footers for templates.  They are not needed but used if included in the template
  279.  
  280. // Don't show header or footer if viewing comments in a popup:
  281. if(isset($_GET['popup']) && $_GET['popup'] != "comment" || !isset($_GET['popup'])){
  282.     if(file_exists("templates/".$cfgrow['template']."/header.html"))
  283.         $header = file_get_contents("templates/".$cfgrow['template']."/header.html");
  284.     if(file_exists("templates/".$cfgrow['template']."/footer.html"))
  285.         $footer = file_get_contents("templates/".$cfgrow['template']."/footer.html");
  286. }
  287.  
  288. /**
  289.  * You can now add any template you want by just adding the template and a link to it.  For example,
  290.  * ?x=about will load the template about_template.html
  291.  *
  292.  */
  293. if(isset($_GET['x'])&& $_GET['x'] == "ref") {
  294.  
  295.     // Maintain backwards compatibility with the referer template
  296.     $_GET['x'] = "referer";
  297. }
  298.  
  299. // Refererlog
  300. if(isset($_GET['x'])&&$_GET['x'] == "referer") {
  301.  
  302.     header("HTTP/1.0 404 Not Found");
  303.     header("Status: 404 File Not Found!");
  304.     echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><HTML><HEAD>\n<TITLE>404 Not Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nThe requested URL /index.php was not found on this server.<P>\n<P>Additionally, a 404 Not Found\nerror was encountered while trying to use an ErrorDocument to handle the request.\n</BODY></HTML>";
  305.     exit;
  306. }
  307.  
  308. // ##########################################################################################//
  309. // GET TEMPLATE FILE BASED ON LANGUAGE SELECTION
  310. // ##########################################################################################//
  311.  
  312. if($language_full==$cfgrow['langfile']) {
  313.  
  314.     // we have our default language from the PP installation, so we use our default templates
  315.  
  316.     if(isset($_GET['x']) && file_exists("templates/".$cfgrow['template']."/".$_GET['x']."_template.html")) {
  317.  
  318.         if(eregi("[.]",$_GET['x'])) { die("Come on! forget about it..."); }
  319.  
  320.         $tpl = file_get_contents("templates/".$cfgrow['template']."/".$_GET['x']."_template.html");
  321.  
  322.     }else{
  323.  
  324.         if (!file_exists("templates/".$cfgrow['template']."/image_template.html")) {
  325.  
  326.             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.';
  327.             exit;
  328.         }
  329.  
  330.         // if the x=foo does not exist prompt it! don't show the main page anymore!
  331.  
  332.         if(isset($_GET['x']) && $_GET['x'] != 'atom' && $_GET['x'] != 'comment_atom' && $_GET['x'] != 'rss' && $_GET['x'] != 'comment_rss' && $_GET['x'] != 'save_comment') {
  333.  
  334.             header("HTTP/1.0 404 Not Found");
  335.             header("Status: 404 File Not Found!");
  336.             echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><HTML><HEAD>\n<TITLE>404 Not Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nThe requested URL /index.php was not found on this server.<P>\n<P>Additionally, a 404 Not Found\nerror was encountered while trying to use an ErrorDocument to handle the request.\n</BODY></HTML>";
  337.             exit;
  338.         }
  339.  
  340.         $tpl = file_get_contents("templates/".$cfgrow['template']."/image_template.html");
  341.     }
  342.  
  343. }else{
  344.  
  345.     // we use our special designed language templates.
  346.     if(isset($_GET['x']) && file_exists("templates/".$cfgrow['template']."/".$_GET['x']."_".$language_abr."_template.html")) {
  347.  
  348.         if (eregi("[.]",$_GET['x'])) { die("Come on! forget about it..."); }
  349.  
  350.         $tpl = file_get_contents("templates/".$cfgrow['template']."/".$_GET['x']."_".$language_abr."_template.html");
  351.  
  352.     }else{
  353.  
  354.         if (!file_exists("templates/".$cfgrow['template']."/image_".$language_abr."_template.html")) {
  355.  
  356.             echo '<b>Error:</b><br />No template folder exists by the name of <b>"' .$cfgrow['template'] .'"</b> or the file <b>image_'.$language_abr .'_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.<br /><br /><a href="index.php?lang='.$default_language_abr.'" alt="return to default language">Click here to return to the default language.</a>';
  357.             exit;
  358.         }
  359.  
  360.         // if the x=foo does not exist prompt it! don't show the main page anymore!
  361.  
  362.         if(isset($_GET['x']) && $_GET['x'] != 'atom' && $_GET['x'] != 'comment_atom' && $_GET['x'] != 'rss' && $_GET['x'] != 'comment_rss' && $_GET['x'] != 'save_comment'){
  363.  
  364.             header("HTTP/1.0 404 Not Found");
  365.             header("Status: 404 File Not Found!");
  366.             echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><HTML><HEAD>\n<TITLE>404 Not Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nThe requested URL /index.php was not found on this server.<P>\n<P>Additionally, a 404 Not Found\nerror was encountered while trying to use an ErrorDocument to handle the request.\n</BODY></HTML>";
  367.             exit;
  368.         }
  369.  
  370.         $tpl = file_get_contents("templates/".$cfgrow['template']."/image_".$language_abr."_template.html");
  371.     }
  372.  
  373.     if($cfgrow['display_sort_by'] == 'headline') { $cfgrow['display_sort_by'] = 'alt_headline'; }
  374.     if($cfgrow['display_sort_by'] == 'body') {     $cfgrow['display_sort_by'] = 'alt_body'; }
  375. }
  376.  
  377. if(isset($_GET['popup'])&&$_GET['popup'] == "comment") {
  378.  
  379.     // additional language file for comment template
  380.     if(file_exists("templates/".$cfgrow['template']."/comment_".$language_abr."_template.html")) {
  381.  
  382.         $tpl = file_get_contents("templates/".$cfgrow['template']."/comment_".$language_abr."_template.html");
  383.  
  384.     }else{
  385.  
  386.         // if not existing or no additional language chosen, default template file is called without error
  387.         $tpl = file_get_contents("templates/".$cfgrow['template']."/comment_template.html");
  388.     }
  389. }
  390.  
  391. // if showimage=badstuff or email to hijack!
  392. if(isset($_GET['showimage']) && !is_numeric($_GET['showimage'])) {
  393.  
  394.     // show 404!
  395.     header("HTTP/1.0 404 Not Found");
  396.     header("Status: 404 File Not Found!");
  397.     echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><HTML><HEAD>\n<TITLE>404 Not Found</TITLE>\n</HEAD><BODY>\n<H1>Not Found</H1>\nDon't do that! go back to index.php! \n</BODY></HTML>";
  398.     exit;
  399. }
  400.  
  401. // Added ability to use header and footers for templates.  They are not needed but used if included in the template
  402.  
  403. if(isset($header)) { $tpl = $header . $tpl; }
  404. if(isset($footer)) { $tpl = $tpl. $footer;  }
  405.  
  406. // Get visitor count
  407. $visitors = sql_array("SELECT count(*) as `count` FROM `".$pixelpost_db_prefix."visitors`");
  408. $pixelpost_visitors = $visitors['count'];
  409.  
  410. // Get number of photos in database
  411. $photonumb = sql_array("SELECT count(*) as `count` FROM `".$pixelpost_db_prefix."pixelpost` WHERE `datetime`<='$datetime'");
  412. $pixelpost_photonumb = $photonumb['count'];
  413.  
  414.  
  415. // added for temp to create banlist table if it is not there TODO: THIS WILL GO INTO THE CREATE_TABLES
  416. create_banlist();
  417.  
  418. if($cfgrow['display_order'] == 'default') { $display_order = 'DESC'; }else{ $display_order = 'ASC'; }
  419.  
  420.  
  421. /**
  422.  * Images / Main site
  423.  *
  424.  */
  425. if(!isset($_GET['x'])) {
  426.  
  427.     // Get Current Image.
  428.     if(!isset($_SESSION["pixelpost_admin"])) {
  429.  
  430.         if(!isset($_GET['showimage']) || $_GET['showimage'] == "") {
  431.  
  432.             $row = sql_array("SELECT * FROM ".$pixelpost_db_prefix."pixelpost WHERE datetime<='$cdate' ORDER BY ".$cfgrow['display_sort_by']." ".$display_order." limit 0,1");
  433.  
  434.         }else{
  435.  
  436.             $row = sql_array("SELECT * FROM ".$pixelpost_db_prefix."pixelpost WHERE (id='".$_GET['showimage']."') AND datetime<='$cdate'");
  437.         }
  438.  
  439.         /**
  440.          * If the display_sort_by config option exists, try to load an image.
  441.          * Otherwise, just display the "Coming Soon!" message.
  442.          */
  443.         }else if (isset($cfgrow['display_sort_by'])){
  444.  
  445.         if(!isset($_GET['showimage']) || $_GET['showimage'] == "") {
  446.  
  447.             $row = sql_array("SELECT * FROM ".$pixelpost_db_prefix."pixelpost ORDER BY ".$cfgrow['display_sort_by']." ".$display_order." limit 0,1");
  448.  
  449.         }else{
  450.  
  451.             $row = sql_array("SELECT * FROM ".$pixelpost_db_prefix."pixelpost WHERE (id='".$_GET['showimage']."')");
  452.         }
  453.     }
  454.  
  455.     if(!$row['image']) {
  456.         echo "$lang_nothing_to_show";
  457.         exit;
  458.     }
  459.  
  460.     $image_name = $row['image'];
  461.  
  462.     if($language_abr == $default_language_abr) {
  463.  
  464.         $image_title  = pullout($row['headline']);
  465.         $image_notes  = ($cfgrow['markdown'] == 'T') ? markdown(pullout($row['body'])) : pullout($row['body']);
  466.  
  467.     }else{
  468.  
  469.         //if($row['alt_headline']=='') { $image_title = pullout($row['headline']); }else{ $image_title = pullout($row['alt_headline']); }
  470.  
  471.         $image_title  = ($row['alt_headline']=='') ? pullout($row['headline']) : pullout($row['alt_headline']);
  472.  
  473.         if($row['alt_body']=='') {
  474.  
  475.             $image_notes  = ($cfgrow['markdown'] == 'T') ? markdown(pullout($row['body'])) : pullout($row['body']);
  476.         }else{
  477.  
  478.             $image_notes  = ($cfgrow['markdown'] == 'T') ? markdown(pullout($row['alt_body'])) : pullout($row['alt_body']);
  479.         }
  480.     }
  481.  
  482.     $image_title              =   htmlspecialchars($image_title,ENT_NOQUOTES);
  483.     $image_id                 =   $row['id'];
  484.     $image_datetime           =   $row['datetime'];
  485.     $image_datetime_formatted =   strtotime($image_datetime);
  486.     $image_datetime_formatted =   date($cfgrow['dateformat'],$image_datetime_formatted);
  487.     $image_date               =   substr($row['datetime'],0,10);
  488.     $image_time               =   substr($row['datetime'],11,5);
  489.     $image_date_year_full     =   substr($row['datetime'],0,4);
  490.     $image_date_year          =   substr($row['datetime'],2,2);
  491.     $image_date_month         =   substr($row['datetime'],5,2);
  492.     $image_date_day           =   substr($row['datetime'],8,2);
  493.     $thumbnail_extra          =   getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_name);
  494.     $image_extra              =   getimagesize(ltrim($cfgrow['imagepath'], "./").$image_name);
  495.     $image_width              =   $image_extra['0'];
  496.     $image_height             =   $image_extra['1'];
  497.  
  498.     $tpl                      =   str_replace("<IMAGE_WIDTH>",$image_width,$tpl);
  499.     $tpl                      =   str_replace("<IMAGE_HEIGHT>",$image_height,$tpl);
  500.  
  501.     $local_width              =   $thumbnail_extra['0'];
  502.     $local_height             =   $thumbnail_extra['1'];
  503.     $image_exif               =   $row['exif_info'];
  504.  
  505.     $image_thumbnail          =   "<a href='$showprefix$image_id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_name."' alt='$image_title' title='$image_title' width='$local_width' height='$local_height' /></a>";
  506.  
  507.     // thumnail no link
  508.     $image_thumbnail_no_link  =   "<img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_name."' alt='$image_title' title='$image_title' width='$local_width' height='$local_height' />";
  509.  
  510.     $image_permalink          =   "<a href='$showprefix$image_id'>$lang_permalink</a>"; // permalink automated for fancy url/no fancy
  511.  
  512.     // get previous image id and name
  513.     if(!isset($_SESSION["pixelpost_admin"])) {
  514.  
  515.         //public
  516.         $previous_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime < '$image_datetime') and (datetime<='$cdate') ORDER BY datetime desc limit 0,1");
  517.     }else{
  518.  
  519.         //admin
  520.         $previous_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime < '$image_datetime')  ORDER BY datetime desc limit 0,1");
  521.     }
  522.  
  523.     $image_previous_name =  $previous_row['image'];
  524.     $image_previous_id   =  $previous_row['id'];
  525.  
  526.     if($language_abr == $default_language_abr) {
  527.  
  528.         $image_previous_title = pullout($previous_row['headline']);
  529.     }else{
  530.  
  531.         $image_previous_title = pullout($previous_row['alt_headline']);
  532.     }
  533.  
  534.     $image_previous_datetime =   $previous_row['datetime'];
  535.     $image_previous_link     =   "<a href='$showprefix$image_previous_id'>$lang_previous</a>";
  536.  
  537.     if(!empty($image_previous_name)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_previous_name); }
  538.  
  539.     //TEST echo ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_previous_name;
  540.  
  541.     $image_previous_thumbnail = "<a href='$showprefix$image_previous_id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_previous_name."' width='$local_width' height='$local_height' alt='$image_previous_title' title='$image_previous_title' /></a>";
  542.  
  543.     if($image_previous_id == "") {
  544.         $image_previous_id        =  $image_id;
  545.         $image_previous_title     =  "$lang_no_previous";
  546.         $image_previous_link      =  "";
  547.         $image_previous_thumbnail =  "";
  548.     }
  549.  
  550.     // get next image id and name
  551.     if(!isset($_SESSION["pixelpost_admin"])) {
  552.  
  553.         //public
  554.         $next_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime > '$image_datetime') and (datetime<='$cdate') ORDER BY datetime asc limit 0,1");
  555.     }else{
  556.  
  557.         //admin
  558.         $next_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime > '$image_datetime') ORDER BY datetime asc limit 0,1");
  559.     }
  560.  
  561.     $image_next_name =  $next_row['image'];
  562.     $image_next_id   =  $next_row['id'];
  563.  
  564.     if($language_abr == $default_language_abr) {
  565.  
  566.         $image_next_title = pullout($next_row['headline']);
  567.     }else{
  568.  
  569.         $image_next_title = pullout($next_row['alt_headline']);
  570.     }
  571.  
  572.     $image_next_datetime =  $next_row['datetime'];
  573.     $image_next_link     =  "<a href='$showprefix$image_next_id'>$lang_next</a>";
  574.  
  575.     if(!empty($image_next_name)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_next_name); }
  576.  
  577.     $image_next_thumbnail = "<a href='$showprefix$image_next_id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_next_name."' alt='$image_next_title' width='$local_width' height='$local_height' title='$image_next_title' /></a>";
  578.  
  579.     if($image_next_id == "") {
  580.         $image_next_id = $image_id;
  581.         $image_next_title = "$lang_no_next";
  582.         $image_next_link = "";
  583.         $image_next_thumbnail = "";
  584.     }
  585.  
  586.     // get first image
  587.     if(!isset($_SESSION["pixelpost_admin"])) {
  588.  
  589.         //public
  590.         $first_image_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime<='$cdate') ORDER BY datetime asc limit 0,1");
  591.     }else{
  592.  
  593.         //admin
  594.         $first_image_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost  ORDER BY datetime asc limit 0,1");
  595.     }
  596.  
  597.     $first_image_name =  $first_image_row['image'];
  598.     $first_image_id   =  $first_image_row['id'];
  599.  
  600.     if($language_abr == $default_language_abr) {
  601.  
  602.         $first_image_title = pullout($first_image_row['headline']);
  603.     }else{
  604.  
  605.         $first_image_title = pullout($first_image_row['alt_headline']);
  606.     }
  607.  
  608.     $first_image_datetime =  $first_image_row['datetime'];
  609.     $first_image_link     =  "<a href='$showprefix$first_image_id'>$lang_first</a>";
  610.  
  611.     if(!empty($first_image_name)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$first_image_name); }
  612.  
  613.     $first_image_thumbnail = "<a href='$showprefix$first_image_id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$first_image_name."' alt='$first_image_title' width='$local_width' height='$local_height' title='$first_image_title' /></a>";
  614.  
  615.     if($first_image_id == $image_id) {
  616.         $first_image_title = null;
  617.         $first_image_link = null;
  618.         $first_image_thumbnail = null;
  619.     }
  620.  
  621.     // get latest image
  622.     if(!isset($_SESSION["pixelpost_admin"])) {
  623.  
  624.         //public
  625.         $last_image_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime<='$cdate') ORDER BY datetime desc limit 0,1");
  626.     }else{
  627.  
  628.         //admin
  629.         $last_image_row = sql_array("SELECT id,headline,alt_headline,image,datetime FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime<='$cdate') ORDER BY datetime desc limit 0,1");
  630.     }
  631.  
  632.     $last_image_name =  $last_image_row['image'];
  633.     $last_image_id   =  $last_image_row['id'];
  634.  
  635.     if($language_abr == $default_language_abr) {
  636.  
  637.         $last_image_title = pullout($last_image_row['headline']);
  638.     }else{
  639.  
  640.         $last_image_title = pullout($last_image_row['alt_headline']);
  641.     }
  642.  
  643.     $last_image_datetime =  $last_image_row['datetime'];
  644.     $last_image_link     =  "<a href='$showprefix$last_image_id'>$lang_latest</a>";
  645.  
  646.     if(!empty($last_image_name)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$last_image_name); }
  647.  
  648.     $last_image_thumbnail = "<a href='$showprefix$last_image_id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$last_image_name."' alt='$last_image_title' width='$local_width' height='$local_height' title='$last_image_title' /></a>";
  649.  
  650.     if($last_image_id == $image_id) {
  651.         $last_image_title = null;
  652.         $last_image_link = null;
  653.         $last_image_thumbnail = null;
  654.     }
  655.  
  656.     if(function_exists('gd_info')) {
  657.  
  658.         $gd_info = gd_info();
  659.  
  660.         if($gd_info != ""){
  661.  
  662.             // check that gd is here before this
  663.             $aheadnumb   =  sql_array("SELECT count(*) as count FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime > '$image_datetime') and (datetime<='$cdate')");
  664.             $aheadnumb   =  $aheadnumb['count'];
  665.  
  666.             $behindnumb  =  sql_array("SELECT count(*) as count FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime < '$image_datetime') and (datetime<='$cdate')");
  667.             $behindnumb  =  $behindnumb['count'];
  668.  
  669.             $aheadlimit  =  round(($cfgrow['thumbnumber']-1)/2);
  670.             $behindlimit =  round(($cfgrow['thumbnumber']-1)/2);
  671.  
  672.             if($aheadnumb <= $aheadlimit) {
  673.                 $behindlimit = ($cfgrow['thumbnumber']-1)-$aheadnumb;
  674.                 $aheadlimit  = $aheadnumb;
  675.             }
  676.  
  677.             if($behindnumb <= $behindlimit) {
  678.                 $aheadlimit  = ($cfgrow['thumbnumber']-1)-$behindnumb;
  679.                 $behindlimit = $behindnumb;
  680.             }
  681.  
  682.             $totalthumbcounter    =   1;
  683.             $ahead_thumbs         =  "";
  684.             $ahead_thumbs_reverse =  "";
  685.  
  686.             $thumbs_ahead = mysql_query("SELECT id,headline,alt_headline,image FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime > '$image_datetime') and (datetime<='$cdate') ORDER BY datetime asc limit 0,$aheadlimit");
  687.  
  688.             while(list($id,$headline,$alt_headline,$image) = mysql_fetch_row($thumbs_ahead)) {
  689.  
  690.                 if($language_abr == $default_language_abr) {
  691.  
  692.                     $headline = pullout($headline);
  693.                 }else{
  694.  
  695.                     $headline = pullout($alt_headline);
  696.                 }
  697.  
  698.                 $headline = htmlspecialchars($headline,ENT_QUOTES);
  699.  
  700.                 if(!empty($image)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image); }
  701.  
  702.                 $ahead_thumbs         .=  "<a href='$showprefix$id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image."' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>";
  703.                 $ahead_thumbs_reverse  =  "<a href='$showprefix$id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image."' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>" .$ahead_thumbs_reverse ;
  704.  
  705.                 $totalthumbcounter++;
  706.             }
  707.  
  708.             $behind_thumbs         =  "";
  709.             $behind_thumbs_reverse =  "";
  710.  
  711.             $thumbs_behind = mysql_query("SELECT id,headline,alt_headline,image FROM ".$pixelpost_db_prefix."pixelpost WHERE (datetime < '$image_datetime') and (datetime<='$cdate') ORDER BY datetime desc limit 0,$behindlimit");
  712.  
  713.             while(list($id,$headline,$alt_headline,$image) = mysql_fetch_row($thumbs_behind)) {
  714.  
  715.                 if($language_abr == $default_language_abr) {
  716.  
  717.                     $headline = pullout($headline);
  718.                 }else{
  719.  
  720.                     $headline = pullout($alt_headline);
  721.                 }
  722.  
  723.                 $headline = htmlspecialchars($headline,ENT_QUOTES);
  724.  
  725.                 if(!empty($image)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image); }
  726.  
  727.                 $behind_thumbs          = "<a href='$showprefix$id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image."' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>$behind_thumbs";
  728.                 $behind_thumbs_reverse .= "<a href='$showprefix$id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image."' alt='$headline' title='$headline' class='thumbnails' width='$local_width' height='$local_height' /></a>";
  729.  
  730.                 $totalthumbcounter++;
  731.             }
  732.  
  733.             if(!empty($image_name)) { list($local_width,$local_height,$type,$attr) = getimagesize(ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_name); }
  734.  
  735.             $thumbnail_row         =  "$behind_thumbs<a href='$showprefix$image_id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_name."' alt='$image_title' title='$image_title' class='current-thumbnail' width='$local_width' height='$local_height' /></a>$ahead_thumbs";
  736.             $thumbnail_row_reverse =  "$ahead_thumbs_reverse<a href='$showprefix$image_id'><img src='".ltrim($cfgrow['thumbnailpath'], "./")."thumb_".$image_name."' alt='$image_title' title='$image_title' class='current-thumbnail' width='$local_width' height='$local_height' /></a>$behind_thumbs_reverse";
  737.  
  738.             $tpl  =  ereg_replace("<IMAGE_THUMBNAIL_ROW>",$thumbnail_row,$tpl);
  739.             $tpl  =  ereg_replace("<IMAGE_THUMBNAIL_ROW_REV>",$thumbnail_row_reverse,$tpl);
  740.  
  741.         }
  742.     }
  743.  
  744.     // Modified from Mark Lewin's hack for multiple categories
  745.     $querystr = "SELECT t1.cat_id,t2.name,t2.alt_name FROM ".$pixelpost_db_prefix."catassoc as t1 inner join ".$pixelpost_db_prefix."categories t2 on t1.cat_id = t2.id WHERE t1.image_id = '$image_id' ORDER BY t2.name ";
  746.     $query = mysql_query($querystr);
  747.     $image_category_number = 0;
  748.  
  749.     $image_category_all ="";
  750.     $image_category_all_paged = "";
  751.  
  752.     while(list($cat_id,$name,$alt_name) = mysql_fetch_row($query)) {
  753.  
  754.         if($language_abr == $default_language_abr) {
  755.  
  756.             $name = pullout($name);
  757.         }else{
  758.  
  759.             $name = pullout($alt_name);
  760.         }
  761.  
  762.         $image_category_all       .= "<a href='$PHP_SELF?x=browse&amp;category=$cat_id'>" .$cfgrow['catgluestart'] .$name .$cfgrow['catglueend']."</a> &nbsp;";
  763.         $image_category_all_paged .= "<a href='$PHP_SELF?x=browse&amp;category=$cat_id&amp;pagenum=1'>" .$cfgrow['catgluestart'] .$name .$cfgrow['catglueend']."</a> &nbsp;";
  764.  
  765.         $image_category_number     = $image_category_number +1;
  766.     }
  767.  
  768.     if($image_category_number >1) {
  769.  
  770.         $image_categoryword = "$lang_category_plural ";
  771.     }else{
  772.  
  773.         $image_categoryword = "$lang_category_singular ";
  774.     }
  775.  
  776.     $tpl = ereg_replace("<SITE_TITLE>",$pixelpost_site_title,$tpl);
  777.     $tpl = ereg_replace("<SUB_TITLE>",$pixelpost_sub_title,$tpl);
  778.     $tpl = ereg_replace("<SITE_URL>",$cfgrow['siteurl'],$tpl);
  779.     $tpl = ereg_replace("<IMAGE_CATEGORY>",$image_categoryword." ".$image_category_all,$tpl);
  780.  
  781.     // for paged_archive addon
  782.     $tpl = ereg_replace("<IMAGE_CATEGORY_PAGED>",$image_categoryword." ".$image_category_all_paged,$tpl);
  783.     $tpl = ereg_replace("<IMAGE_DATE_YEAR_FULL>",$image_date_year_full,$tpl);
  784.     $tpl = ereg_replace("<IMAGE_DATE_YEAR>",$image_date_year,$tpl);
  785.     $tpl = ereg_replace("<IMAGE_DATE_MONTH>",$image_date_month,$tpl);
  786.     $tpl = ereg_replace("<IMAGE_DATE_DAY>",$image_date_day,$tpl);
  787.     $tpl = ereg_replace("<IMAGE_THUMBNAIL>",$image_thumbnail,$tpl);
  788.  
  789.     // thumbnail no link
  790.     $tpl = ereg_replace("<IMAGE_THUMBNAIL_NO_LINK>",$image_thumbnail_no_link,$tpl);
  791.     $tpl = ereg_replace("<IMAGE_DATE>",$image_date,$tpl);
  792.     $tpl = ereg_replace("<IMAGE_TIME>",$image_time,$tpl);
  793.     $tpl = ereg_replace("<IMAGE_NAME>",$image_name,$tpl);
  794.     $tpl = ereg_replace("<IMAGE_TITLE>",$image_title,$tpl);
  795.     $tpl = ereg_replace("<IMAGE_DATETIME>",$image_datetime_formatted,$tpl);
  796.     $tpl = ereg_replace("<IMAGE_NOTES>",$image_notes,$tpl);
  797.  
  798.     // image notes without HTML tags and double quotes
  799.     $image_notes_clean = strip_tags($image_notes);
  800.     $image_notes_clean = htmlspecialchars($image_notes_clean,ENT_NOQUOTES);
  801.     $image_notes_clean = str_replace('"',"'",$image_notes_clean);
  802.     $tpl = ereg_replace("<IMAGE_NOTES_CLEAN>",$image_notes_clean,$tpl);
  803.  
  804.     $tpl = ereg_replace("<IMAGE_ID>",$image_id,$tpl);
  805.     $tpl = ereg_replace("<IMAGE_PERMALINK>",$image_permalink,$tpl);
  806.     $tpl = ereg_replace("<IMAGE_PREVIOUS_LINK>",$image_previous_link,$tpl);
  807.     $tpl = ereg_replace("<IMAGE_PREVIOUS_THUMBNAIL>",$image_previous_thumbnail,$tpl);
  808.     $tpl = ereg_replace("<IMAGE_PREVIOUS_ID>",$image_previous_id,$tpl);
  809.     $tpl = ereg_replace("<IMAGE_PREVIOUS_TITLE>",$image_previous_title,$tpl);
  810.     $tpl = ereg_replace("<IMAGE_NEXT_LINK>",$image_next_link,$tpl);
  811.     $tpl = ereg_replace("<IMAGE_NEXT_ID>",$image_next_id,$tpl);
  812.     $tpl = ereg_replace("<IMAGE_NEXT_TITLE>",$image_next_title,$tpl);
  813.     $tpl = ereg_replace("<IMAGE_NEXT_THUMBNAIL>",$image_next_thumbnail,$tpl);
  814.  
  815.     $tpl = ereg_replace("<IMAGE_LAST_LINK>",$last_image_link,$tpl);
  816.     $tpl = ereg_replace("<IMAGE_LAST_THUMBNAIL>",$last_image_thumbnail,$tpl);
  817.     $tpl = ereg_replace("<IMAGE_LAST_ID>",$last_image_id,$tpl);
  818.     $tpl = ereg_replace("<IMAGE_LAST_TITLE>",$last_image_title,$tpl);
  819.     $tpl = ereg_replace("<IMAGE_FIRST_LINK>",$first_image_link,$tpl);
  820.     $tpl = ereg_replace("<IMAGE_FIRST_ID>",$first_image_id,$tpl);
  821.     $tpl = ereg_replace("<IMAGE_FIRST_TITLE>",$first_image_title,$tpl);
  822.     $tpl = ereg_replace("<IMAGE_FIRST_THUMBNAIL>",$first_image_thumbnail,$tpl);
  823.  
  824.     // Added support for Thumbnail width and height
  825.     $tpl = str_replace("<THUMBNAIL_WIDTH>",$cfgrow['thumbwidth'],$tpl);
  826.     $tpl = str_replace("<THUMBNAIL_HEIGHT>",$cfgrow['thumbheight'],$tpl);
  827.  
  828.     // get number of comments
  829.     $cnumb_row             =  sql_array("SELECT count(*) as count FROM ".$pixelpost_db_prefix."comments WHERE parent_id='$image_id' and publish='yes'");
  830.     $image_comments_number =  $cnumb_row['count'];
  831.  
  832.     // get latest comment
  833.     $latest_comment      =  sql_array("SELECT parent_id FROM ".$pixelpost_db_prefix."comments WHERE  publish='yes' ORDER BY id desc limit 0,1");
  834.     $latest_comment      =  $latest_comment['parent_id'];
  835.  
  836.     $queryrow            =  sql_array("SELECT headline FROM ".$pixelpost_db_prefix."pixelpost WHERE id='$latest_comment'");
  837.     $latest_comment_name =  pullout($queryrow['headline']);
  838.  
  839.  
  840.     // ##########################################################################################//
  841.     // EXIF STUFF
  842.     // ##########################################################################################//
  843.  
  844.     if ($cfgrow['exif']=='T') {
  845.  
  846.         include_once('includes/functions_exif.php');
  847.  
  848.         if($image_exif!==null) {
  849.  
  850.             $tpl = replace_exif_tags ($language_full, $image_exif, $tpl);
  851.         }else{
  852.  
  853.             $tpl = replace_exif_tags_null($tpl);
  854.         }
  855.     }else{
  856.  
  857.         include_once('includes/functions_exif.php');
  858.         $tpl = replace_exif_tags_null($tpl);
  859.     }
  860.  
  861.  
  862.     /**
  863.      * Build a string with all comments.
  864.      * Only perform this code when the user has commenting enabled
  865.      *
  866.      */
  867.     if(isset($_GET['x']) && ($_GET['x'] == "") or (isset($_GET['popup']) && $_GET['popup'] == "comment")) {
  868.  
  869.         $comments_result = sql_array("SELECT comments FROM ".$pixelpost_db_prefix."pixelpost where id = '".intval($_POST['parent_id'])."'");
  870.         $cmnt_setting = pullout($comments_result['comments']);
  871.  
  872.         if($cmnt_setting == 'F') { die('Die you SPAMMER!!'); }
  873.     }
  874.  
  875.     // visitor information in comments
  876.     $vinfo_name  =  "";
  877.     $vinfo_url   =  "";
  878.     $vinfo_email =  "";
  879.  
  880.     if(isset($_COOKIE['visitorinfo'])) { list($vinfo_name,$vinfo_url,$vinfo_email) = split("%",$_COOKIE['visitorinfo']); }
  881.  
  882.     $tpl = ereg_replace("<VINFO_NAME>",$vinfo_name,$tpl);
  883.     $tpl = ereg_replace("<VINFO_URL>",$vinfo_url,$tpl);
  884.     $tpl = ereg_replace("<VINFO_EMAIL>",$vinfo_email,$tpl);
  885.  
  886.     if($cfgrow['token'] == 'T') {
  887.  
  888.         $tpl = ereg_replace("<TOKEN>","<input type='hidden' name='token' value='".$_SESSION['token']."' />",$tpl);
  889.     }else{
  890.  
  891.         $tpl = ereg_replace("<TOKEN>",null,$tpl);
  892.     }
  893.  
  894.     if(isset($_GET['showimage']) && $_GET['showimage'] != "") {
  895.  
  896.         $imageid = $_GET['showimage'];
  897.     }else{
  898.  
  899.         $imageid = $image_id;
  900.     }
  901.  
  902.     $image_comments = print_comments($imageid);
  903.     $tpl = ereg_replace("<IMAGE_COMMENTS>",$image_comments,$tpl);
  904.  
  905.     if((isset($_GET['popup']) && $_GET['popup'] == "comment") AND (!isset($_GET['x']) OR $_GET['x'] != "save_comment")) {
  906.  
  907.         include_once('includes/addons_lib.php');
  908.         echo $tpl;
  909.         exit;
  910.     }
  911. } // End Images / Main site
  912.  
  913. $tpl = ereg_replace("<SITE_TITLE>",$pixelpost_site_title,$tpl);
  914. $tpl = ereg_replace("<SUB_TITLE>",$pixelpost_sub_title,$tpl);
  915.  
  916. // ##########################################################################################//
  917. // BROWSE STUFF
  918. // ##########################################################################################//
  919.  
  920. require("includes/functions_browse.php");
  921.  
  922.  
  923. // ##########################################################################################//
  924. // FEED STUFF
  925. // ##########################################################################################//
  926.  
  927. require("includes/functions_feeds.php");
  928.  
  929. // ##########################################################################################//
  930. // Creating other tags
  931. // ########################################################################################
  932.  
  933. $tpl = ereg_replace("<SITE_BROWSELINK>","./index.php?x=browse",$tpl);
  934. $tpl = ereg_replace("<SITE_BROWSELINK_PAGED>","./index.php?x=browse&amp;pagenum=1",$tpl);
  935.  
  936.  
  937. if(!isset($_GET['x']) || isset($_GET['showimage'])){
  938.  
  939.     $tpl = ereg_replace("<SITE_VISITORNUMBER>",$pixelpost_visitors,$tpl);
  940.     $tpl = ereg_replace("<IMAGE_COMMENTS_NUMBER>",$image_comments_number,$tpl);
  941.     $tpl = ereg_replace("<LATEST_COMMENT_ID>",$latest_comment,$tpl);
  942.     $tpl = ereg_replace("<LATEST_COMMENT_NAME>",$latest_comment_name,$tpl);
  943.  
  944.     if($image_comments_number != 1) {
  945.  
  946.         $tpl = ereg_replace("<IMAGE_COMMENT_TEXT>",$lang_comment_plural,$tpl);
  947.     }else{
  948.  
  949.         $tpl = ereg_replace("<IMAGE_COMMENT_TEXT>",$lang_comment_single,$tpl);
  950.     }
  951.  
  952.     if ($row['comments'] == 'F'){
  953.  
  954.         $tpl = ereg_replace("<COMMENT_POPUP>","<a href='index.php?showimage=$image_id' onclick=\"alert('$lang_comment_popup_disabled');\">$lang_comment_popup</a>",$tpl);
  955.     }else{
  956.  
  957.         $tpl = ereg_replace("<COMMENT_POPUP>","<a href='index.php?showimage=$image_id' onclick=\"window.open('index.php?popup=comment&amp;showimage=$image_id','Comments','width=480,height=540,scrollbars=yes,resizable=yes');\">$lang_comment_popup</a>",$tpl);
  958.     }
  959. }
  960.  
  961. $tpl = ereg_replace("<BROWSE_CATEGORIES>",$browse_select,$tpl);
  962. $tpl = str_replace("<BASE_HREF>","<base href='".$cfgrow['siteurl']."' />",$tpl);
  963. $tpl = ereg_replace("<SITE_URL>",$cfgrow['siteurl'],$tpl);
  964. $tpl = ereg_replace("<SITE_PHOTONUMBER>",$pixelpost_photonumb,$tpl);
  965.  
  966. // ##########################################################################################//
  967. // COMMENT STUFF
  968. // ##########################################################################################//
  969.  
  970. require("includes/functions_comments.php");
  971.  
  972. // ##########################################################################################//
  973. // REPLACE LANGUAGE SPECIFIC TAGS
  974. // ##########################################################################################//
  975.  
  976. if($cfgrow['altlangfile'] != 'Off') {
  977.  
  978.     $tpl = replace_alt_lang_tags( $tpl, $language_abr, $PP_supp_lang, $cfgrow);
  979. }
  980.  
  981. // ##########################################################################################//
  982. // SUCK IN ADDONS
  983. // ##########################################################################################//
  984.  
  985. include_once('includes/addons_lib.php');
  986.  
  987. // ##########################################################################################//
  988. // END - ECHO TEMPLATE
  989. // ##########################################################################################//
  990.  
  991. if((isset($_GET['x']) && $_GET['x'] != "save_comment") || (!isset($_GET['x']))) { echo $tpl; }
  992.  
  993. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement