Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cSetupLanguageChooser
  • cSetupNotInstallable
  • cSetupTypeChooser

Functions

  • checkAndInclude
  • checkExistingPlugin
  • findSimilarText
  • getContenidoVersion
  • getSystemDirectories
  • listClients
  • stripLastSlash
  • updateClientPath
  • updateContenidoVersion
  • updateSysadminPassword
  • updateSystemProperties
  • Overview
  • Package
  • Function
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: /**
  3:  * Main CONTENIDO setup bootstrap file.
  4:  *
  5:  * @package    Setup
  6:  * @subpackage Setup
  7:  * @version    SVN Revision $Rev:$
  8:  *
  9:  * @author     Murat Purc <murat@purc.de>
 10:  * @copyright  four for business AG <www.4fb.de>
 11:  * @license    http://www.contenido.org/license/LIZENZ.txt
 12:  * @link       http://www.4fb.de
 13:  * @link       http://www.contenido.org
 14:  */
 15: 
 16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
 17: 
 18: // Don't display errors
 19: @ini_set('display_errors', false);
 20: 
 21: // Report all errors except warnings
 22: error_reporting(E_ALL ^E_NOTICE);
 23: 
 24: 
 25: header('Content-Type: text/html; charset=ISO-8859-1');
 26: 
 27: // Check version in the 'first' line, as class.security.php uses
 28: // PHP5 object syntax not compatible with PHP < 5
 29: if (version_compare(PHP_VERSION, '5.0.0', '<')) {
 30:     die("You need PHP >= 5.0.0 for CONTENIDO. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n");
 31: }
 32: 
 33: // Check version
 34: //PHP >= 5.0.0 and < 6.0.0
 35: if (version_compare(PHP_VERSION, '6.0.0', '>=')) {
 36:     die("You need PHP >= 5.0.0  < 6.0.0 for CONTENIDO. Sorry, even the setup doesn't work otherwise. Your version: " . PHP_VERSION . "\n");
 37: }
 38: 
 39: /*
 40:  * Do not edit this value!
 41:  *
 42:  * If you want to set a different enviroment value please define it in your .htaccess file
 43:  * or in the server configuration.
 44:  *
 45:  * SetEnv CONTENIDO_ENVIRONMENT development
 46:  */
 47: if (!defined('CON_ENVIRONMENT')) {
 48:     if (getenv('CONTENIDO_ENVIRONMENT')) {
 49:         $sEnvironment = getenv('CONTENIDO_ENVIRONMENT');
 50:     } else if (getenv('CON_ENVIRONMENT')) {
 51:         $sEnvironment = getenv('CON_ENVIRONMENT');
 52:     } else {
 53:         // @TODO: provide a possibility to set the environment value via file
 54:         $sEnvironment = 'production';
 55:     }
 56: 
 57:     define('CON_ENVIRONMENT', $sEnvironment);
 58: }
 59: 
 60: /**
 61:  * Setup file inclusion
 62:  *
 63:  * @param  string  $filename
 64:  */
 65: function checkAndInclude($filename) {
 66:     if (file_exists($filename) && is_readable($filename)) {
 67:         include_once($filename);
 68:     } else {
 69:         echo "<pre>";
 70:         echo "Setup was unable to include neccessary files. The file $filename was not found. Solutions:\n\n";
 71:         echo "- Make sure that all files are correctly uploaded to the server.\n";
 72:         echo "- Make sure that include_path is set to '.' (of course, it can contain also other directories). Your include path is: " . ini_get("include_path") . "\n";
 73:         echo "</pre>";
 74:     }
 75: }
 76: 
 77: // Include security class and check request variables
 78: checkAndInclude(CON_FRONTEND_PATH . '/contenido/classes/class.filehandler.php');
 79: checkAndInclude(CON_FRONTEND_PATH . '/contenido/classes/class.requestvalidator.php');
 80: try {
 81:     $requestValidator = cRequestValidator::getInstance();
 82:     $requestValidator->checkParams();
 83: } catch (cFileNotFoundException $e) {
 84:     die($e->getMessage());
 85: }
 86: 
 87: session_start();
 88: 
 89: if (is_array($_REQUEST)) {
 90:     foreach ($_REQUEST as $key => $value) {
 91:         if ($key == 'c') {
 92:             // c = setup controller to process
 93:             continue;
 94:         }
 95:         if (($value != '' && $key != 'dbpass' && $key != 'adminpass' && $key != 'adminpassrepeat') || ($key == 'dbpass' && $_REQUEST['dbpass_changed'] == 'true') || ($key == 'adminpass' && $_REQUEST['adminpass_changed'] == 'true') || ($key == 'adminpassrepeat' && $_REQUEST['adminpassrepeat_changed'] == 'true')) {
 96:             $_SESSION[$key] = $value;
 97:         }
 98:     }
 99: }
100: 
101: 
102: // set max_execution_time
103: if(ini_get('max_execution_time') < 60){
104:     ini_set(max_execution_time, 60);
105: }
106: 
107: // Some basic configuration
108: global $cfg;
109: 
110: $cfg['path']['frontend'] = CON_FRONTEND_PATH;
111: $cfg['path']['contenido'] = $cfg['path']['frontend'] . '/contenido/';
112: $cfg['path']['contenido_config'] = CON_FRONTEND_PATH . '/data/config/' . CON_ENVIRONMENT . '/';
113: 
114: // DB related settings
115: $cfg['sql']['sqlprefix'] = (isset($_SESSION['dbprefix'])) ? $_SESSION['dbprefix'] : 'con';
116: $cfg['db'] = array(
117:     'connection' => array(
118:         'host' => (isset($_SESSION['dbhost'])) ? $_SESSION['dbhost'] : '',
119:         'database' => (isset($_SESSION['dbname'])) ? $_SESSION['dbname'] : '',
120:         'user' => (isset($_SESSION['dbuser'])) ? $_SESSION['dbuser'] : '',
121:         'password' => (isset($_SESSION['dbpass'])) ? $_SESSION['dbpass'] : '',
122:         'charset' => (isset($_SESSION['dbcharset'])) ? $_SESSION['dbcharset'] : ''
123:     ),
124:     'haltBehavior' => 'report',
125:     'haltMsgPrefix' => (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] . ' ' : '',
126:     'enableProfiling' => false,
127: );
128: 
129: checkAndInclude($cfg['path']['contenido_config'] . 'config.path.php');
130: checkAndInclude($cfg['path']['contenido_config'] . 'config.misc.php');
131: checkAndInclude($cfg['path']['contenido_config'] . 'cfg_sql.inc.php');
132: 
133: // Takeover configured PHP settings
134: if ($cfg['php_settings'] && is_array($cfg['php_settings'])) {
135:     foreach ($cfg['php_settings'] as $settingName => $value) {
136:         // date.timezone is handled separately
137:         if ($settingName !== 'date.timezone') {
138:             @ini_set($settingName, $value);
139:         }
140:     }
141: }
142: error_reporting($cfg['php_error_reporting']);
143: 
144: // force date.timezone setting
145: $timezoneCfg = $cfg['php_settings']['date.timezone'];
146: if (!empty($timezoneCfg) && ini_get('date.timezone') !== $timezoneCfg) {
147:     // if the timezone setting from the cfg differs from the php.ini setting, set timezone from CFG
148:     date_default_timezone_set($timezoneCfg);
149: } else if (empty($timezoneCfg) && (ini_get('date.timezone') === '' || ini_get('date.timezone') === false)) {
150:     // if there are no timezone settings, set UTC timezone
151:     date_default_timezone_set('UTC');
152: }
153: 
154: // Initialization of autoloader
155: checkAndInclude($cfg['path']['contenido'] . $cfg['path']['classes'] . 'class.autoload.php');
156: cAutoload::initialize($cfg);
157: 
158: // Set generateXHTML property of cHTML class to prevent db query, especially at
159: // the beginning of an new installation where we have no db
160: cHTML::setGenerateXHTML(false);
161: 
162: // Common includes
163: checkAndInclude(CON_SETUP_PATH . '/lib/defines.php');
164: checkAndInclude($cfg['path']['contenido'] . 'includes/functions.php54.php');
165: checkAndInclude($cfg['path']['contenido'] . 'includes/functions.i18n.php');
166: checkAndInclude($cfg['path']['contenido'] . 'includes/api/functions.api.general.php');
167: checkAndInclude($cfg['path']['contenido'] . 'includes/functions.general.php');
168: checkAndInclude($cfg['path']['contenido'] . 'classes/class.template.php');
169: checkAndInclude(CON_SETUP_PATH . '/lib/class.setupcontrols.php');
170: checkAndInclude(CON_SETUP_PATH . '/lib/functions.filesystem.php');
171: checkAndInclude(CON_SETUP_PATH . '/lib/functions.environment.php');
172: checkAndInclude(CON_SETUP_PATH . '/lib/functions.safe_mode.php');
173: checkAndInclude(CON_SETUP_PATH . '/lib/functions.mysql.php');
174: checkAndInclude(CON_SETUP_PATH . '/lib/functions.phpinfo.php');
175: checkAndInclude(CON_SETUP_PATH . '/lib/functions.libraries.php');
176: checkAndInclude(CON_SETUP_PATH . '/lib/functions.system.php');
177: checkAndInclude(CON_SETUP_PATH . '/lib/functions.sql.php');
178: checkAndInclude(CON_SETUP_PATH . '/lib/functions.setup.php');
179: checkAndInclude(CON_SETUP_PATH . '/lib/class.setupmask.php');
180: 
181: // PHP verion check
182: if (phpversion() < CON_SETUP_MIN_PHP_VERSION) {
183:     $sNotInstallableReason = 'php_version';
184:     checkAndInclude(CON_SETUP_PATH . '/steps/notinstallable.php');
185: }
186: 
187: // PHP ini session check
188: if (getPHPIniSetting('session.use_cookies') == 0) {
189:     $sNotInstallableReason = 'session_use_cookies';
190:     checkAndInclude(CON_SETUP_PATH . '/steps/notinstallable.php');
191: }
192: 
193: // PHP database extension check
194: $extension = getMySQLDatabaseExtension();
195: if (!is_null($extension)) {
196:     $cfg['database_extension'] = $extension;
197: } else {
198:     $sNotInstallableReason = 'database_extension';
199:     checkAndInclude(CON_SETUP_PATH . '/steps/notinstallable.php');
200: }
201: 
202: if (isset($_SESSION['language'])) {
203:     i18nInit('locale/', $_SESSION['language'], 'setup');
204: }
205: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0