function redirectToUrlIfNecessary()
{
    $pageCompleteName = stripslashesPmv($_GET['pagename']);
    if (isset($_GET['url']) && $_GET['url'] != "") {
        $pageUrl = stripslashesPmv($_GET['url']);
    } else {
        $pageUrl = null;
    }
    //	if(substr($pageCompleteName, 0, 5) == PREFIX_FILES)
    if (isPrefixTag($pageCompleteName)) {
        if (DEBUG) {
            printDebug("=====================<br>Header() to file to download<br>=====================");
        } else {
            if ($pageUrl != null) {
                if (defined(PMV_REWRITE_MODE) && PMV_REWRITE_MODE == 'PEAR_REQUEST') {
                    // Debut version PEAR
                    setIncludePath();
                    require_once INCLUDE_PATH . "/libs/Request/Request.php";
                    $a =& new HTTP_Request(str_replace("&amp;", "&", $pageUrl));
                    $a->sendRequest();
                    foreach ($a->getResponseHeader() as $key => $value) {
                        if ($key != "transfer-encoding") {
                            // IE does not support this parameter
                            header($key . ": " . $value);
                        }
                    }
                    $cookies = $a->getResponseCookies();
                    if ($cookies) {
                        foreach ($cookies as $value) {
                            setCookieFromPear($value);
                        }
                    }
                    print $a->getResponseBody();
                    exit;
                    // Fin version PEAR
                } else {
                    header('Location:' . str_replace("&amp;", "&", $pageUrl), false, 302);
                    exit;
                }
            } else {
                trigger_error("Error : There is no url to redirect", E_USER_ERROR);
            }
            exit;
        }
    }
}
 /**
  * Point d'entr�e de l'application
  *
  */
 function init()
 {
     $c =& PmvConfig::getInstance();
     $Lang =& Lang::getInstance();
     // id used for caching
     define('SMARTY_CACHE_ID', md5(@$_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] . serialize($_GET) . serialize($_POST) . (isset($_COOKIE[COOKIE_NAME_SESSION]) ? serialize($_COOKIE[COOKIE_NAME_SESSION]) : '') . $Lang->getFileName() . date("Y-m-d") . TIME_BEFORE_NEW_DAY_ARCHIVE . PHPMV_VERSION . INTERNAL_STATS));
     setIncludePath();
     $db =& Db::getInstance();
     if (defined('DB_HOST')) {
         $db->connect();
     }
     // try to set memory limit to MEMORY_LIMIT
     setMemoryLimit();
     $controller =& ApplicationController::getInstance();
     $controller->loadLang();
     $controller->parseRequest();
     $controller->loadModule();
     $controller->executeAction();
 }
Exemple #3
0
<?php

define('IN_QOOL', true);
error_reporting(E_ERROR);
//read the directory structure
require_once "simple_fn.php";
//check if the cms is installed
if (!($dirs = readDirFile())) {
    include "install/install.php";
    $installer = new QoolInstaller();
    $installer->start();
} else {
    setIncludePath($dirs);
    //d(get_include_path());
    require_once "Zend/Session.php";
    $namespace = new Zend_Session_Namespace('Qool');
    if ($namespace->isLocked()) {
        $namespace->unLock();
    }
    //get the folder if needed
    amiInAfolder($dirs);
    //if the user is not logged in we just set some typical rights
    givemeGuestRights();
    //set the include path
    //now read configuration
    require_once "Zend/Config/Xml.php";
    $config = new Zend_Config_Xml('config/config.xml');
    //just a simple definition to make things readable
    define('DIR_SEP', $config->host->separator);
    define('APPL_PATH', $config->host->absolute_path);
    $_SESSION['SITE_URL'] = $config->host->http . $config->host->subdomain . $config->host->domain . $config->host->folder;
Exemple #4
0
 private function connectDB()
 {
     $xml = readLangFile('config/config.xml');
     setIncludePath(array('special' => array('folder' => $xml->host->folder)));
     try {
         $dbconfig = array('host' => $xml->database->host, 'username' => $xml->database->username, 'password' => $xml->database->password, 'dbname' => $xml->database->db);
         //here we check for database type
         switch ($xml->database->type) {
             case "mysql":
                 require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
                 $db = new Zend_Db_Adapter_Pdo_Mysql($dbconfig);
                 $db->getConnection();
                 $db->setFetchMode(Zend_Db::FETCH_ASSOC);
                 $smt = $db->query("SET NAMES 'utf8'");
                 $smt->execute();
                 break;
             default:
                 require_once 'Zend/Db/Adapter/Pdo/Mysql.php';
                 $db = new Zend_Db_Adapter_Pdo_Mysql($dbconfig);
                 $db->getConnection();
                 $db->setFetchMode(Zend_Db::FETCH_ASSOC);
                 $smt = $db->query("SET NAMES 'utf8'");
                 $smt->execute();
         }
     } catch (Zend_Db_Adapter_Exception $e) {
         $this->triggerError($this->language['db_connect_error']);
     } catch (Zend_Exception $e) {
         $this->triggerError($this->language['db_factory_error']);
     }
     $this->db = $db;
 }