Location: PHPKode > projects > PHPope - Online Publishing Engine > PHPope_1_0_0/public_html/index.php
<?php
/*   ********************************************************************   **
**                                                                          **
**   This script is part of the PHPope project. The PHPope                  **
**   project is free software; you can redistribute it and/or modify        **
**   it under the terms of the GNU General Public License as published by   **
**   the Free Software Foundation; either version 2 of the License, or      **
**   (at your option) any later version.                                    **
**                                                                          **
**   The GNU General Public License can be found at                         **
**   http://www.gnu.org/copyleft/gpl.html.                                  **
**   A copy is found in the textfile GPL and important notices to the       **
**   license from the team is found in the textfile LICENSE distributed     **
**   with these scripts.                                                    **
**                                                                          **
**   This script is distributed in the hope that it will be useful,         **
**   but WITHOUT ANY WARRANTY; without even the implied warranty of         **
**   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          **
**   GNU General Public License for more details.                           **
**                                                                          **
**   This copyright notice MUST APPEAR in all copies of the script!         **
**   ********************************************************************   */

/**
* Adjust argument output to make the site W3C conform
*/
ini_set("arg_separator.output","&amp;");

/**
* Set the default timeout to 1 seunde.
*
*
*/
ini_set("default_socket_timeout","1");

/**
* Start with time stamping
*/
/**
* Read the current time in microseconds
*
* @author Markus Graf <hide@address.com>
* @since 22.07.2002
* @return float time in microsecunds
*/
function getmicrotime(){
    list($usec, $sec) = explode(" ",microtime());
    return ((float)$usec + (float)$sec);
}

/**
* Get the Starttime
*/
$time_start = getmicrotime();

/**
 * Main configuration file.
 */
require_once("../includes/config.php");



/**
* make sure debugging is off to avoid it being set in the url
*/
global $debug_ok;
$debug_ok = 0;

/**
* determine if it's ok to throw errors to the screen
*
* usefull idea from John Starkey (staff_at_phpbuilder.com)
*/
if (in_array( $_SERVER['REMOTE_ADDR'], $config["debug"]["ips"]) && $_REQUEST["debug"] != 1){
    $debug_ok = 1;
}

/**
 * Set session name ...
 */
session_name("audience");

/**
 * some cookie settings
 */
session_set_cookie_params(time()+9999999, "/", $config["default"]["cookiedomain"]);

/**
* Some pdffix for IE
*/
session_cache_limiter('no_cache');

/**
 * Start session ...
 */
session_start();

/**
 * Start compression  ...
 */
global $compression;
$compression = $_REQUEST["compression"];

/**
 * If no compression parameter specified, get the default value
 */
if (!isset($compression)) {
    $compression = &$config["default"]["compression"];
}

if($compression == "enable"){
    ob_start("ob_gzhandler");
}

$lang_select = $_REQUEST["lang_select"];

if (isset($lang_select)) {

    /**
    * Extract the client language
    */
    $lana = explode("-", $lang_select);
    $lang_select = $lana[0];
    unset($lana);

    /**
    * ignore not installed languages
    */
    if(!is_array($_SESSION["user"])){$_SESSION["user"] = array();}
    if (in_array($lang_select,$config["default"]["baselang"])) {
        $_SESSION["user"]["lang"] = $lang_select;
    }
    unset($lang_select);
}

/**
* Select language if not selected
*/
if (!isset($_SESSION["user"]["lang"]) || !in_array($_SESSION["user"]["lang"],$config["default"]["baselang"])) {
    $languages = getenv('HTTP_ACCEPT_LANGUAGE');
    $languages = explode(",",$languages);
    $i = 0;
    foreach ($languages as $la) {

        $lan = explode("-", $la);
        $j = strpos($lan[0],";");
        if ($j > 0) {
            $lan[0] = substr($la,0,$j);
        }
        $mylan[$i] = $lan[0];
        $i++;
    }
    $counter = 0;
    while ($counter <= count($config["default"]["baselang"])) {
        while (list($a,$b) = each($config["default"]["baselang"])) {
            if ($b == trim($mylan[$counter])) {
                $mylang =$b;
                break 2;
            } else {
                continue;
            }
        }
        reset($config["default"]["baselang"]);
        $counter++;
    }
    if (!isset($mylang)) {
        $mylang = $config["default"]["lang"];
    }
} else {
    if (!isset($_SESSION["user"]["lang"])) {
        $mylang = $config["default"]["lang"];
    } else {
        $mylang = $_SESSION["user"]["lang"];
    }
}

/**
* check Catching
*/

if ($_REQUEST["nocache"] == FALSE && $nocache == FALSE && $config["default"]["cachetime"] > 0) {
    /**
     * Caching class
     */
    require_once($config["dir"]["classes"] . 'Cache_Lite.php');
    
    switch ($config["default"]["cachetype"]) {
        case "slow":
            // Set a id for this cache
            $request = $_REQUEST;
            $request["audience"] = "";
            $request = implode('',$request);
            $id = crc32($_SESSION["tplmap"] . $request . $mylang . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);

            // Set a few options (slow)
            $options = array(
                'cacheDir' => $config["dir"]["cache"],
                'lifeTime' => $config["default"]["cachetime"],
                'readControlType' => 'md5',
                'fileLocking' => true,
                'writeControl' => true,
                'readControl' => true
            );
            
        break;

        default:
            // Set a id for this cache
            $request = $_REQUEST;
            $request["audience"] = "";
            $request = implode('',$request);
            $id = crc32($_SESSION["tplmap"] . $request . $mylang . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);

            // Set a few options (fast)
            $options = array(
                'cacheDir' => $config["dir"]["cache"],
                'lifeTime' => $config["default"]["cachetime"],
                'readControlType' => 'strlen',
                'fileLocking' => false,
                'writeControl' => false,
                'readControl' => false
            );
        break;
    }
    
    $Cache_Lite = new Cache_Lite($options);
    $data = $Cache_Lite->get($id);
} else {
    $data = FALSE;
}

if ($data == FALSE or (strpos($_SERVER['HTTP_USER_AGENT'],"Gecko") !== false && !(isset($var["TPL"])))) {

    /**
     * Loading the Database Class
     */
    require_once("DB.php");


    /**
     * User handler
     */
    require_once($config["dir"]["classes"] . "userclass.php");

    /**
     * group handler
     */
    require_once($config["dir"]["classes"] . "groupclass.php");

    /**
     * Template class
     */
    require_once("HTML/Template/IT.php");

    /**
     * Permission functions
     */
    require_once($config["dir"]["functions"] . "permfunc.php");

    /**
     * Picture functions from module
     */
    require_once($config["dir"]["plugins"] . "picman/includes/functions.php");

    /**
     * Initialising TPL functions
     */
    require_once($config["dir"]["classes"] . "phpopeclass.php");
    require_once($config["dir"]["classes"] . "myTPLclass.php");//Template Factory from Urs Grob 22.07.03

    /**
    * Including the authentication system
    */
    require_once($config["dir"]["classes"] . "authclass.php");

    /**
    * initioal logging
    */
    require_once($config["dir"]["classes"] . "loggingclass.php");

    /**
    * Include Language class
    */
    require_once($config["dir"]["classes"] . "Lang.php");

    /**
     * Error handler
     */
    require_once($config["dir"]["classes"] . "errorclass.php");

    /**
     * If TPL is not set, use the default TPL
     */
    $TPL = $_REQUEST["TPL"];

    if( !isset($TPL) ){
        $TPL = &$config["default"]["TPL"];
    }

    $audience = $_REQUEST["audience"];

    /**
    * Generating a new PHPope System object
    */
    global $phpope;
    $phpope = new PHPope_main();

    /**
     * loading the system database object
     *
     * @var object $sys_db Default System Database
     */
    global $sys_db;
    $sys_db =  DB::connect($config["default"]["sysdb"], $config["default"]["sysdb_persistent"]);

    /**
    * Create the error handler
    */
    global $error;
    $error = new error($config["debug"]["logfile"],$config["debug"]["errorcode_table"]);

    /**
     * Check connection
     */
    if (DB::isError($sys_db)) {
          $error->record(2,"ERROR",__LINE__,__FILE__,$sys_db->getMessage());
    }else{
        $error->LoadCache();
    }

    /**
    * start logging
    */
    global $log;
    $log = new logging($config["logging"]["data"],$config["logging"]["actions"], $sys_db, $config["logging"]["expire"]);

    /**
    * Start the authentication system
    */
    global $auth;
    $auth = new auth($sys_db,$config["sec"]["Magic"]);

    /**
    * create the group handler
    */
    global $group;
    $group = new group($sys_db);

    /**
    * create the user handler
    */
    global $user;
    $user = new user($sys_db);
    
    /**
    * Spambot detection
    */
    if($config["sec"]["spambot"] == true){
        
        if (isset($_REQUEST["unblock"])) {
            $sql = "DELETE FROM spambots WHERE unblockstring='" . $_REQUEST["unblock"] . "'";
            $result=$sys_db->query($sql);
            if (DB::isError($result)) {
                $message = "SQL: " . $sql . " Reason: " . $result->getMessage();
                $GLOBALS["error"]->record(14,"ERROR",__LINE__,__FILE__,$message);
            }
        }
        // get ip adress
        $proxy='';
        $IP = '';
        if (isSet($_SERVER)) {
            if (isSet($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                $IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
                $proxy = $_SERVER['REMOTE_ADDR'];
            } elseif (isSet($_SERVER['HTTP_CLIENT_IP'])) {
                $IP = $_SERVER['HTTP_CLIENT_IP'];
            } else {
                $IP = $_SERVER['REMOTE_ADDR'];
            }
        } else {
            if ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
                $IP = getenv( 'HTTP_X_FORWARDED_FOR' );
                $proxy = getenv( 'REMOTE_ADDR' );
            } elseif ( getenv( 'HTTP_CLIENT_IP' ) ) {
                $IP = getenv( 'HTTP_CLIENT_IP' );
            } else {
                $IP = getenv( 'REMOTE_ADDR' );
            }
        }
        if ($_REQUEST["email"] == "all") {
            //Mark ip as spambot
           if (strstr($IP, ',')) {
             $ips = explode(',', $IP);
             $IP = $ips[0];
           }
           
            $sql = "SELECT * FROM spambots WHERE ip='" . $IP . "'";
            $result=$sys_db->query($sql);
            if (DB::isError($result)) {
                $message = "SQL: " . $sql . " Reason: " . $result->getMessage();
                $GLOBALS["error"]->record(14,"ERROR",__LINE__,__FILE__,$message);
            }
            if ($result->numrows() == 0) {
                $unblockstring = "";
                for ($i = 0; $i < 4; $i++) {
                    $unblockstring .= rand(0,4);
                }
                $sql = "INSERT INTO spambots (ip,proxy,time,user_agent,unblockstring) VALUES('" . $IP . "','" . $proxy . "','" . time() . "','" . $_SERVER['HTTP_USER_AGENT'] . "','" . $unblockstring . "')";
                $result=$sys_db->query($sql);
                if (DB::isError($result)) {
                    $message = "SQL: " . $sql . " Reason: " . $result->getMessage();
                    $GLOBALS["error"]->record(14,"ERROR",__LINE__,__FILE__,$message);
                }
            }
        }
        
        $sql = "SELECT * FROM spambots WHERE ip='" . $IP . "'";
        $result=$sys_db->query($sql);
        if (DB::isError($result)) {
            $message = "SQL: " . $sql . " Reason: " . $result->getMessage();
            $GLOBALS["error"]->record(14,"ERROR",__LINE__,__FILE__,$message);
        }
        if ($result->numrows() != 0) {
            $row = $result->fetchrow();
            $msg = "<html>\n<head>\n<title>Your ip is Blocked!</title>\n</head>\n<body>\n";
            $msg .= "<h1>Your ip adress ( " . $IP . " ) is blocked since " . date("H:i d.m.Y", $row[2]) . ", because you are marked as possible spambot!</h1><br><br>\n";
            $msg .= "To unblock this site, enter the following code.<br><font color=\"red\">" . $row[4] . "</font><br><br>\n";
            $msg .= "<form name=\"spambot\" action=\"index.php\" methode=\"POST\">\n";
            $msg .= "<input type=\"text\" name=\"unblock\" value=\"\">&nbsp;<input type=\"submit\" name=\"submit\" value=\"Submit\">\n";
            $msg .= "</form>\n</body>\n</html>";
            die($msg);
        }
    }
    /**
    * Logout: Kick me out Pope
    */
    if(isset($_REQUEST["logout"])){
        $log->action = "LOGOUT";
        $log->update_log();
        session_unset();
        $TPL = $config["default"]["TPL"];
        sleep(2);
        header("Location: index.php?TPL=" . $TPL);
    }

    /**
    * Add the id to the phpope object
    */
    $phpope->id = &$TPL;

    /**
     * Get all details of the specificatet TPL
     */
    $phpope->get_values();

    /**
     * Parse Parameters
     */
    parse_str($phpope->details["tpl_parameter"]);

    /**
     * Public or not public? That's here the question! ;-)
     */
    $public = &$phpope->details["tpl_is_public"];

    /**
     * loading the module database object for each language
     *
     * @var object $mod_db Default System Database
     */
    global $mod_db;
    $mod_db = DB::connect($config["default"]["moddb"] . "_" . $mylang, $config["default"]["moddb_persistent"]);

    foreach($config["default"]["baselang"] as $dblangs){
        if($mylang != $dblangs){
            global ${"mod_db_$dblangs"};
            ${"mod_db_$dblangs"} = DB::connect($config["default"]["moddb"] . "_" . $dblangs, $config["default"]["moddb_persistent"]);
        }else{
            global ${"mod_db_$dblangs"};
            ${"mod_db_$dblangs"} = &$mod_db;
        }

        /**
        * Check connection
        */
        if (DB::isError(${"mod_db_$dblangs"})) {
            $error->record(5,"ERROR",__LINE__,__FILE__,${"mod_db_$dblangs"}->getMessage());
        }
    }

    /**
     * Check connection
     */
    if (DB::isError($mod_db)) {
        $error->record(5,"ERROR",__LINE__,__FILE__,$mod_db->getMessage());
    }

    if($public != True){
        /**
        * Check the user Status
        */
        if(!$auth->is_auth() || (isset($_REQUEST["username"]) && isset($_REQUEST["password"]))){
            if(isset($_REQUEST["username"]) && isset($_REQUEST["password"])){

                /**
                 * Generating options for database query
                 */
                $option["table"] = "sys_user";
                $option["usercol"] = "name";
                $option["pwdcol"] = "pwd";
                $option["userid"] = "id";

                /**
                * Set a login timeout to protect the site for bruteforce attacks
                */
                sleep(1);

                /**
                 * Register user
                 */
                if($auth->login($_REQUEST["username"],$_REQUEST["password"],$option) == true){

                     /**
                     * Register some default values
                     * ============================
                     */

                     $log->action = "LOGIN";
                     $log->title = "Login as " . $_SESSION["user"]["name"];
                     $log->update_log();

                     $tmp_lang = $user->get_lang($_SESSION["user"]["id"]); // Language
                     if (in_array($tmp_lang, $config["default"]["baselang"])) {
                         $_SESSION["user"]["lang"] = $tmp_lang;
                     } else {
                         $_SESSION["user"]["lang"] = $config["default"]["lang"];
                     }
                     $_SESSION["user"]["ssplit"] = $user->get_split_small($_SESSION["user"]["id"]); // Smallsplit
                     $_SESSION["user"]["bsplit"] = $user->get_split_big($_SESSION["user"]["id"]); //Bigsplit
                     $_SESSION["user"]["sound"] = $user->get_sound($_SESSION["user"]["id"]); // Sound enabled
                     $_SESSION["user"]["fname"] = $user->get_first_name($_SESSION["user"]["id"]); //firstname
                     $_SESSION["user"]["lname"] = $user->get_last_name($_SESSION["user"]["id"]); //lastname
                     $_SESSION["user"]["email"] = $user->get_email($_SESSION["user"]["id"]);
                     $_SESSION["user"]["notes"] =  $user->get_notes($_SESSION["user"]["id"]); // notes to a user (Only for admins)
                     $_SESSION["user"]["date_long"] =  $user->get_ldate($_SESSION["user"]["id"]); // long date string to a user (Only for admins)
                     $_SESSION["user"]["date_short"] =  $user->get_sdate($_SESSION["user"]["id"]); // short date string to a user (Only for admins)
                     $_SESSION["user"]["groups"] =  $group->get_groups_for_user($_SESSION["user"]["id"]); // Groups for the user
                     $_SESSION["user"]["show_adminhead"] = true;                                          //set adminhead to visible
                } else {
                     /**
                     * something is wrong :-(
                     */
                     $log->action = "FAILED_LOGIN";
                     $log->title = "Login as " . $_REQUEST["username"] . " failed";
                     $log->update_log();
                     sleep(5);
                     header ("Location: " . $config["sec"]["loginform"]);
                     exit;
                }
            } else {
                header ("Location: " . $config["sec"]["loginform"]);
                exit;
            }
        }
    }

    /**
    * process the tplmapper
    */
    if (isset($_REQUEST["tplmap"])) {
        $_SESSION["tplmap"] = $_REQUEST["tplmap"];
    }

    include($config["dir"]["root"] . "includes/tplmap.php");
    if (isset($_SESSION["tplmap"]) && is_array($tplmap[$phpope->details["style"]])) {
       if (in_array($_SESSION["tplmap"], $tplmap[$phpope->details["style"]])) {
           $phpope->details["style"] = &$_SESSION["tplmap"];
       }
    }

    /**
     * formating language options
     */
    $opt['dsn'] = $config["default"]["sysdb"];
    $opt['sys_table'] = "lang_universal";
    $opt['mod_table'] = "lang_mod";
    $opt['lang'] = $mylang;
    $opt['cache'] = $config["dir"]["cache"];

    /**
     * Initiate the language object
     */
    global $lang;
    $lang = Lang::factory("DB",$opt);

    /**
     * Make somme variables usable in each module
     */
    global $var;
    foreach($_REQUEST as $key=>$param){
        //extract all underlines
        $key = explode("_",$key);
        if(count($key) == 2){
            if(substr($key[0],0,1) == "x" && intval(substr($key[0],1)) > 0){
                $var[substr($key[0],1)][$key[1]] = $param;
            } else {
                $_key = implode("_",$key);
                $var[$_key] = $param;
            }
        }elseif(count($key) > 2){
            if(substr($key[0],0,1) == "x" && intval(substr($key[0],1)) > 0){
                $_plugin_id = array_shift($key);
                $_plugin_id = substr($_plugin_id,1);
                $_key = implode("_",$key);
                $var[$_plugin_id][$_key] = $param;
            } else {
                $_key = implode("_",$key);
                $var[$_key] = $param;
            }
        } else {
            $_key = implode("_",$key);
            $var[$_key] = $param;
        }
    }

    //Show diffrent content to spiders
    if(strpos($_SERVER['HTTP_USER_AGENT'],"Googlebot") !== false && !(isset($var["TPL"]))){
        $content = '';
        $sql = "SELECT title, file FROM search_spider WHERE active=1";
        foreach($GLOBALS["config"]["default"]["baselang"] as $dblangs){
            //Query for the sysdb!
            $result = $GLOBALS["mod_db_" . $dblangs]->query($sql);
            //Die on error
            if (DB::isError($result)) {
                $message = "SQL: " . $sql . " Reason: " . $result->getMessage();
                $GLOBALS["error"]->record(14,"ERROR",__LINE__,__FILE__,$message);
            }
            if($result->numrows() > 0){
                while($row = $result->fetchrow()){
                    $content .= '<a href="' . $row[1] . '&amp;lang_sel=' . $dblangs . '">' . $row[0] . '</a><br>';
                }
            }
        }
        die($content);
    }


    if ($auth->is_auth()){
        /**
        * Get TPL permissions
        */
        $tplperms = $phpope->get_perms();
    }

    /**
    * formating the timestring
    */
    global $date_long;
    if (isset($_SESSION["user"]["date_long"]) && $_SESSION["user"]["date_long"] != "") {
        $date_long = $_SESSION["user"]["date_long"];
    } else {
        $date_long = $config["format"]["date_long"];
    }
    global $date_short;
    if (isset($_SESSION["user"]["date_short"]) && $_SESSION["user"]["date_short"] != "") {
        $date_short = $_SESSION["user"]["date_short"];
    } else {
        $date_short = $config["format"]["date_short"];
    }

    /**
     * Load the wished TPL
     */
    if(isset($tplperms["r"]) || $public == True){
        $phpope->dir = $config["dir"]["TPL"] . $phpope->details["style"] . "/";
        $phpope->mod_dir = $config["dir"]["plugins"];
        $phpope->load();
    }else{

        /**
        * oops something is wrong :-O
        */
        $phpope->content = '<center><font color="red"><h1>' . $lang->tr("You are not authrizied to view this page!") . "</h1><font></center>";
        $error->record(6,"NOTICE",__LINE__,__FILE__,$TPL);
    }

    /**
    * Get the title for logging
    */
    if ($log->title == "") {
        preg_match_all("/<title>([^<]*)<\/title>/i",$phpope->content, $title_var);
        $log->title = $title_var[1][0];
    }

    /**
    * Update logfiles
    */
    $log->update_log();

    /**
    * Kick out the Content for debug
    */
    if (($_REQUEST["source"] == "html" && $config["debug"]["html"]) || ($_REQUEST["source"] == "php" && $config["debug"]["php"])) {
        echo '<hr>HTML output <b>' . $log->title . '</b> (' . $_SERVER["REQUEST_URI"] . ')<hr>';
        highlight_string($phpope->content);
    } else {
        if (isset($_REQUEST["sound"]) && $_SESSION["user"]["sound"] == 1) {
            $phpope->content .= "\n<embed src=\"" . $_REQUEST["sound"] . "\" autostart=\"true\" height=\"0\" width=\"0\">\n";
        }
        if ($debug_ok == 1) {
            $phpope->content = eregi_replace("</body>","",$phpope->content);
            $phpope->content = eregi_replace("</html>","",$phpope->content);
        }

        /**
        * Dynamic language translation
        */
        preg_match_all("/\[tr:.+\]/",$phpope->content,$matches);
        foreach ($matches[0] as $match) {
            $word = str_replace('[tr:','',$match);
            $word = str_replace(']','',$word);
            //if (!eregi('<textarea.+>.+' . $match . '.+</textarea>',$phpope->content)) {
                $phpope->content = str_replace($match,$lang->tr($word),$phpope->content);
            //}
        }
        preg_match_all("/\[txt:.+\]/",$phpope->content,$matches);
        foreach ($matches[0] as $match) {
            $word = str_replace('[txt:','',$match);
            $word = str_replace(']','',$word);
            //if (!eregi('<textarea.+>.+' . $match . '.+</textarea>',$phpope->content)) {
                $phpope->content = str_replace($match,$lang->txt($word),$phpope->content);
            //}
        }
        echo $phpope->content;
    }
    /**
    * Close all open database connections
    */
    foreach($config["default"]["baselang"] as $dblangs){
        if($mylang != $dblangs){
            ${"mod_db_$dblangs"}->disconnect();
        }
    }

    $mod_db->disconnect();
    $sys_db->disconnect();
    /**
    * Save for caching
    */
    if ($_REQUEST["nocache"] == FALSE && $nocache == FALSE && $config["default"]["cachetime"] > 0) {
        $Cache_Lite->save($phpope->content, $id);
    }

} else {
    /**
    * Output cached data
    */
    echo $data;
    $GLOBALS["cached"] = true;
}

if (is_object($lang) && !$lang->counter) {
    $lang->counter = 0;
}
if ($GLOBALS["cached"] == true) {
    $cachetext = 'page is cached for ' . $config["default"]["cachetime"] . ' seconds <a href="' . $_SERVER["REQUEST_URI"] . '&nocache=true">No cache</a>';
} else {
    $cachetext = 'page is _not_ cached';
}

/**
 * Time ending of the script
 */
$time_end = getmicrotime();

/**
 * Calculate processing time.
 */
$proc_time = $time_end - $time_start;

/**
 * End compression ...
 */
if($pagedetail != "hidden" && $phpope->pagedetail != "hidden"){
     echo "\n<!-- processing time: " . $proc_time . " seconds; Translations: uncached " . $lang->counter . ", cached " . $lang->cachecounter . "; " . $cachetext . " Version:" .  $config["default"]["version"] . " -->";
     echo "\n<!-- " . (is_object($lang)?$lang->txt("This page was generated with the PHPope CMS http://www.phpope.org"):"This page was generated with the PHPope CMS http://www.phpope.org") . " -->\n";
     if ($debug_ok == 1) {
         echo '<script type="text/javascript">
         <!--
         function dbgonoff(){
             if (document.getElementById("debug").style.visibility == "visible") {
                 document.getElementById("debug").style.visibility = "hidden";
                 document.getElementById("debug").style.display = "none";
             } else {
                 document.getElementById("debug").style.visibility = "visible";
                 document.getElementById("debug").style.display = "inline";
             }
         }
         -->
         </script>';
         echo '<img src="images/buttons/debug.gif" alt="debug" style="position:absolute; top:10px; right:20px; z-index:5;" onclick="dbgonoff();">';
         echo "<div id=\"debug\" style=\"display:none; z-index:4; border-style: solid; border-width: 2px; border-color: #000000; padding: 2px; visibility: hidden; background: #FFFFFF; position:absolute; top:5px; right:5px;\"><font color=\"red\"><b> You are in developer mode on " . $_SERVER["SERVER_NAME"] . " with the IP " . $_SERVER['REMOTE_ADDR'] . "</b></font><br>";
         echo "<b>Time of request:</b> " . date("M d, Y G:i:s",time()) . "<br>";
         echo "<b>Processing time:</b> " . $proc_time . " seconds<br>";
         echo "<b>Lanuage:</b> " . $mylang . "<br>";
         echo "<b>PHPopeversion:</b> " . $config["default"]["version"]. "<br>";
         if($config["default"]["cachetime"] == 0){
            echo "<b>Translations:</b> uncached " . $lang->counter . ", cached " . $lang->cachecounter . "<br>";
            echo "<b>Useronline:</b> " . $log->useronline() . "<br>";
         }
         echo "<b>Cache:</b> " . $cachetext . "<br>";
         echo "<b>TPL:</b> " . $_REQUEST["TPL"] . "<br>";
         echo "<b>PLUGINs:</b> " . $phpope->kids . "<br>";
         echo "<b>\$_SESSION:</b> ";
         echo "<pre>";
         print_r($_SESSION);
         echo "</pre>";
         echo "<br>";
         echo "<b>\$_REQUEST:</b> ";
         if (isset($_REQUEST["password"])) {
             $_REQUEST["password"] = "Nothing to pick up :-P";
         }
         echo "<pre>";
         print_r($_REQUEST);
         echo "</pre>";
         echo "<br></div>";
         echo "\n</body>\n</html>";
     }
}

/**
* End the compression
*/
if($compression == "enable"){
    ob_end_flush ();
}
?>
Return current item: PHPope - Online Publishing Engine