+//@register_shutdown_function("session_write_close");
+//header("Set-Cookie: PHPSESSID=" . session_id() . "; path=".$cbasedir);
+if(!in_array("ini_set", $disfunc)) {
+// Set user agent if we can use ini_set and have to do any http requests. :P
+$iverstring = "FR 0.0.0 ".$VER2[2]." 0";
+if($Settings['hideverinfohttp']=="off") {
+ $iverstring = $VER2[1]." ".$VER1[0].".".$VER1[1].".".$VER1[2]." ".$VER2[2]." ".$SubVerN; }
+if($Settings['hideverinfohttp']=="on") {
+ $iverstring = "FR 0.0.0 ".$VER2[2]." 0"; }
+$qstrtest = htmlentities($Settings['qstr'], ENT_QUOTES, $Settings['charset']);
+$qseptest = htmlentities($Settings['qsep'], ENT_QUOTES, $Settings['charset']);
+$isiteurl = $Settings['idburl'].url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']);
+@ini_set("user_agent", "Mozilla/5.0 (compatible; ".$UserAgentName."/".$iverstring."; +".$isiteurl.")");
+if (function_exists("stream_context_create")) {
+$iopts = array(
+ 'http' => array(
+ 'method' => "GET",
+ 'header' => "Accept-Language: *\r\n".
+ "User-Agent: Mozilla/5.0 (compatible; ".$UserAgentName."/".$iverstring."; +".$isiteurl.")\r\n".
+ "Accept: */*\r\n".
+ "Connection: keep-alive\r\n".
+ "Referer: ".$isiteurl."\r\n".
+ "From: ".$isiteurl."\r\n".
+ "Via: ".$_SERVER['REMOTE_ADDR']."\r\n".
+ "Forwarded: ".$_SERVER['REMOTE_ADDR']."\r\n".
+ "X-Real-IP: ".$_SERVER['REMOTE_ADDR']."\r\n".
+ "X-Forwarded-For: ".$_SERVER['REMOTE_ADDR']."\r\n".
+ "X-Forwarded-Host: ".$URLsTest['host']."\r\n".
+ "X-Forwarded-Proto: ".$URLsTest['scheme']."\r\n".
+ "Board-Unique-ID: ".$Settings['BoardUUID']."\r\n".
+ "Client-IP: ".$_SERVER['REMOTE_ADDR']."\r\n"
+ )
+);
+$icontext = stream_context_create($iopts);
+function file_get_contents_alt($filename,$use_include_path=null,$offset=-1,$maxlen=null) {
+global $icontext;
+if($maxlen!==null) {
+return file_get_contents($filename,$use_include_path,$icontext,$offset,$maxlen); }
+if($maxlen===null) {
+return file_get_contents($filename,$use_include_path,$icontext,$offset); } } } }
+$iDBVerName = $VerCheckName."|".$VER2[1]."|".$VER1[0].".".$VER1[1].".".$VER1[2]."|".$VER2[2]."|".$SubVerN;
+/*
+This way checks iDB version by sending the iDBVerName to the iDB Version Checker.
+$Settings['vercheck'] = 1;
+This way checks iDB version by sending the board url to the iDB Version Checker.
+$Settings['vercheck'] = 2;
+*/
+if(!isset($Settings['vercheck'])) {
+ $Settings['vercheck'] = 2; }
+if($Settings['vercheck']!=1&&
+ $Settings['vercheck']!=2) {
+ $Settings['vercheck'] = 2; }
+if($Settings['vercheck']===2) {
+if($_GET['act']=="vercheckxsl") {
+if(stristr($_SERVER["HTTP_ACCEPT"],"application/xml") ) {
+header("Content-Type: application/xml; charset=".$Settings['charset']); }
+else { header("Content-Type: text/xml; charset=".$Settings['charset']); }
+xml_doc_start("1.0",$Settings['charset']);
+echo "\n"; ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="/">
+ <html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
+ <body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
+ <xsl:for-each select="versioninfo/version">
+ <div style="background-color:teal;color:white;padding:4px">
+ <span style="font-weight:bold"><xsl:value-of select="vname"/></span>
+ </div>
+ <div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
+ <span style="font-style:italic">
+ Board Name: <a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>"><xsl:value-of select="title"/></a></span>
+ </div>
+ </xsl:for-each>
+ </body>
+ </html>
+</xsl:template>
+
+</xsl:stylesheet>
+<?php gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
+if($_GET['act']=="versioninfo") {
+if(stristr($_SERVER["HTTP_ACCEPT"],"application/xml") ) {
+header("Content-Type: application/xml; charset=".$Settings['charset']); }
+else { header("Content-Type: text/xml; charset=".$Settings['charset']); }
+xml_doc_start("1.0",$Settings['charset']);
+echo '<?xml-stylesheet type="text/xsl" href="'.url_maker($exfile['index'],$Settings['file_ext'],"act=vercheckxsl",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']).'"?>'."\n"; ?>
+
+<!DOCTYPE versioninfo [
+<!ELEMENT versioninfo (version*)>
+<!ELEMENT version (charset,title,name,vname)>
+<!ELEMENT charset (#PCDATA)>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT vname (#PCDATA)>
+]>
+
+<versioninfo>
+
+<version>
+ <charset><?php echo $Settings['charset']; ?></charset>
+ <title><?php echo $Settings['board_name']; ?></title>
+ <?php echo "<name>".$iDBVerName."</name>\n"; ?>
+ <vname><?php echo $VerCheckName; ?> Version Checker</vname>
+</version>
+
+</versioninfo>
+<?php gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
+if($Settings['vercheck']===1) {
+if($_GET['act']=="versioninfo") { header("Content-Type: text/plain; charset=UTF-8");
+header("Location: ".$VerCheckURL."&name=".urlencode($iDBVerName)); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
+if($_GET['act']=="homepage") { header("Content-Type: text/plain; charset=UTF-8");
+header("Location: ".$Settings['weburl']); $urlstatus = 302;
+gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }