Exemple #1
0
 * This script is distributed in the hope that it will be useful, but     *
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
 * General Public License for more details.                               *
 *                                                                        *
 * You should have received a copy of the GNU Lesser General Public       *
 * License along with the script.                                         *
 * If not, see http://www.gnu.org/licenses/lgpl.html                      *
 *                                                                        *
 * The TYPO3 project - inspiring people to share!                         *
 *                                                                        */
// Those are needed before the autoloader is active
require __DIR__ . '/../Utility/Files.php';
require __DIR__ . '/../Package/PackageInterface.php';
require __DIR__ . '/../Package/Package.php';
BootStrap::defineConstants();
/**
 * General purpose central core hyper FLOW3 bootstrap class
 *
 * @version $Id: Bootstrap.php 3548 2009-12-21 16:21:30Z robert $
 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
 * @api
 */
final class Bootstrap
{
    /**
     * FLOW3's Subversion revision
     */
    const REVISION = '$Revision: 3548 $';
    /**
     * Required PHP version
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; under version 2
 * of the License (non-upgradable).
 * 
 * This program 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.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2);
 *               2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER);
 *               2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV);
 * 
 */
/**
 * RAW Bootstraping
 * 
 * @author CRP Henri Tudor - TAO Team - {@link http://www.tao.lu}
 * @license GPLv2  http://www.opensource.org/licenses/gpl-2.0.php
 */
if (PHP_SAPI == 'cli') {
    $_SERVER['HTTP_HOST'] = 'http://localhost';
    $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__) . '/../../..';
}
require_once dirname(__FILE__) . '/../../tao/includes/class.Bootstrap.php';
$bootStrap = new BootStrap('taoTests');
$bootStrap->start();
 /**
  * Creates the application.
  *
  * @return Application
  */
 public function createApplication()
 {
     $restMock = $this->getRestServiceMock();
     $app = \BootStrap::getApplication(FALSE);
     $app['rest_service'] = $app->share(function () use($restMock) {
         return $restMock;
     });
     $app->mount('/', $app['rest_controller']);
     $app->boot();
     return $app;
 }
<?php

/*  
 * This program 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; under version 2
 * of the License (non-upgradable).
 * 
 * This program 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.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * 
 * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg (under the project TAO & TAO2);
 *               2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung (under the project TAO-TRANSFER);
 *               2009-2012 (update and modification) Public Research Centre Henri Tudor (under the project TAO-SUSTAIN & TAO-DEV);
 * 
 */
/*
 * @author CRP Henri Tudor - TAO Team - {@link http://www.tao.lu}
 * @license GPLv2  http://www.opensource.org/licenses/gpl-2.0.php
 */
require_once dirname(__FILE__) . '/../tao/includes/class.Bootstrap.php';
$bootStrap = new BootStrap('taoResults');
$bootStrap->start();
$bootStrap->dispatch();
 private function bootApp($script)
 {
     global $app, $pa_page_render_start;
     $pa_page_render_start = microtime(TRUE);
     /* timing */
     if (!defined("PA_DISABLE_BUFFERING")) {
         ob_start("pa_end_of_page_ob_filter");
     }
     PA::$config = new PA();
     PA::$project_dir = PA_PROJECT_PROJECT_DIR;
     PA::$core_dir = PA_PROJECT_CORE_DIR;
     $app = new BootStrap(PA_PROJECT_ROOT_DIR, $this->current_route, $this->route_query_str);
     $GLOBALS['app'] = $app;
     // make $app object available in global scope
     $app->loadConfigFile(APPLICATION_CONFIG_FILE);
     if (PA::$config->pa_installed) {
         $app->detectDBSettings();
     }
     $app->autoLoadFiles($this->auto_load_list);
     $app->loadLanguageFiles();
     default_exception();
     // register default exception handler
     if (PA::$ssl_force_https_urls) {
         $this->routing_scheme = 'https';
     }
     if (PA::$ssl_security_on) {
         if ($this->dispatcher_scheme != $this->routing_scheme) {
             $this->restoreServerData();
             header("Location: " . $this->routing_scheme . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
             // "$path_pref/$file_name" . $path_info . $guery_str);
             exit;
         }
     }
     if (PA::$profiler) {
         register_shutdown_function("show_profiler_statistic");
     }
     PA::$path = PA_INSTALL_DIR;
     PA::$url = PA_BASE_URL;
     PA::$remote_ip = $app->remote_addr;
     if (PA::$config->pa_installed) {
         $app->detectNetwork();
         $app->getCurrentUser();
         if ($script != 'web/dologin.php' && PA::$login_uid != SUPER_USER_ID && SITE_UNDER_MAINTAINENCE == 1) {
             $script = "web/maintenance.php";
         }
     } else {
         $script = DEFAULT_INSTALL_SCRIPT;
     }
     ob_get_clean();
     return $script;
 }