Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F860097
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Apr 30, 8:51 AM
Size
14 KB
Mime Type
text/x-diff
Expires
Fri, May 2, 8:51 AM (10 h, 26 m)
Engine
blob
Format
Raw Data
Handle
611791
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/5.1.x/core/kernel/startup.php
===================================================================
--- branches/5.1.x/core/kernel/startup.php (revision 13928)
+++ branches/5.1.x/core/kernel/startup.php (revision 13929)
@@ -1,180 +1,183 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
define('KERNEL_PATH', FULL_PATH . '/core/kernel');
if (!function_exists('getmicrotime')) {
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
}
$globals_start = getmicrotime();
include_once(KERNEL_PATH . '/globals.php'); // non OOP functions used through kernel, e.g. print_pre
include_once(KERNEL_PATH . '/utility/multibyte.php'); // emulating multi-byte php extension
$globals_end = getmicrotime();
$vars = parse_portal_ini();
$admin_directory = isset($vars['AdminDirectory']) ? $vars['AdminDirectory'] : '/admin';
define('ADMIN_DIRECTORY', $admin_directory);
+ $admin_Presets_directory = isset($vars['AdminPresetsDirectory']) ? $vars['AdminPresetsDirectory'] : ADMIN_DIRECTORY;
+ define('ADMIN_PRESETS_DIRECTORY', $admin_Presets_directory);
+
# New path detection method: begin
if (defined('REL_PATH')) {
// location of index.php relatively to site base folder
$relative_path = preg_replace('/^[\/]{0,1}admin(.*)/', $admin_directory . '\\1', REL_PATH);
}
else {
// default index.php relative location is administrative console folder
define('REL_PATH', $admin_directory);
$relative_path = REL_PATH;
}
$ps = rtrim(preg_replace('/' . preg_quote(rtrim($relative_path, '/'), '/') . '$/', '', str_replace('\\', '/', dirname($_SERVER['PHP_SELF']))), '/');
safeDefine('BASE_PATH', $ps); // in case in-portal has defined it before
# New path detection method: end
if ( array_key_exists('HTTP_HOST', $_SERVER) ) {
// accessed from browser
define('SERVER_NAME', $_SERVER['HTTP_HOST']);
}
else {
// accessed from command line
define('SERVER_NAME', $vars['Domain']);
$_SERVER['HTTP_HOST'] = $vars['Domain'];
}
$https_mark = getArrayValue($_SERVER, 'HTTPS');
safeDefine('PROTOCOL', ($https_mark == 'on') || ($https_mark == '1') ? 'https://' : 'http://');
$port = array_key_exists('HTTP_PORT', $_SERVER) ? $_SERVER['HTTP_PORT'] : false;
if ($port && ((PROTOCOL == 'http://' && $port != '80') || (PROTOCOL == 'https://' && $port != '443'))) {
// if non-standard port is used, then define it
define('PORT', $_SERVER['HTTP_PORT']);
}
safeDefine('APPLICATION_CLASS', isset($vars['ApplicationClass']) ? $vars['ApplicationClass'] : 'kApplication');
safeDefine('APPLICATION_PATH', isset($vars['ApplicationPath']) ? $vars['ApplicationPath'] : '/core/kernel/application.php');
if (isset($vars['WriteablePath'])) {
define('WRITEABLE', FULL_PATH . $vars['WriteablePath']);
define('WRITEBALE_BASE', $vars['WriteablePath']);
}
if ($vars === false || count($vars) == 0) {
global $rootURL;
echo 'In-Portal is probably not installed, or configuration file is missing.<br>';
echo 'Please use the installation script to fix the problem.<br><br>';
echo '<a href="' . PROTOCOL . SERVER_NAME . rtrim(BASE_PATH, '/') . '/core/install.php">Go to installation script</a><br><br>';
flush();
exit;
}
define('SQL_TYPE', $vars['DBType']);
define('SQL_SERVER', $vars['DBHost']);
define('SQL_USER', $vars['DBUser']);
define('SQL_PASS', $vars['DBUserPassword']);
define('SQL_DB', $vars['DBName']);
if (isset($vars['DBCollation']) && isset($vars['DBCharset'])) {
define('SQL_COLLATION', $vars['DBCollation']);
define('SQL_CHARSET', $vars['DBCharset']);
}
define('TABLE_PREFIX', $vars['TablePrefix']);
define('DOMAIN', getArrayValue($vars, 'Domain'));
ini_set('memory_limit', '50M');
define('MODULES_PATH', FULL_PATH . DIRECTORY_SEPARATOR . 'modules');
define('EXPORT_BASE_PATH', WRITEBALE_BASE . '/export');
define('EXPORT_PATH', FULL_PATH . EXPORT_BASE_PATH);
define('GW_CLASS_PATH', MODULES_PATH . '/in-commerce/units/gateways/gw_classes'); // Payment Gateway Classes Path
define('SYNC_CLASS_PATH', FULL_PATH . '/sync'); // path for 3rd party user syncronization scripts
safeDefine('ENV_VAR_NAME','env');
define('IMAGES_PATH', WRITEBALE_BASE . '/images/');
define('IMAGES_PENDING_PATH', IMAGES_PATH . 'pending/');
safeDefine('MAX_UPLOAD_SIZE', min(ini_get('upload_max_filesize'), ini_get('post_max_size'))*1024*1024);
safeDefine('EDITOR_PATH', isset($vars['EditorPath']) ? $vars['EditorPath'] : '/core/editor/');
// caching types
define('CACHING_TYPE_NONE', 0);
define('CACHING_TYPE_MEMORY', 1);
define('CACHING_TYPE_TEMPORARY', 2);
if (ini_get('safe_mode')) {
// safe mode will be removed at all in PHP6
define('SAFE_MODE', 1);
}
if (file_exists(WRITEABLE . '/debug.php')) {
include_once(WRITEABLE . '/debug.php');
if (array_key_exists('DEBUG_MODE', $dbg_options) && $dbg_options['DEBUG_MODE']) {
$debugger_start = getmicrotime();
include_once(KERNEL_PATH . '/utility/debugger.php');
$debugger_end = getmicrotime();
if (isset($debugger) && constOn('DBG_PROFILE_INCLUDES')) {
$debugger->profileStart('inc_globals', KERNEL_PATH . '/globals.php', $globals_start);
$debugger->profileFinish('inc_globals', KERNEL_PATH . '/globals.php', $globals_end);
$debugger->profilerAddTotal('includes', 'inc_globals');
$debugger->profileStart('inc_debugger', KERNEL_PATH . '/utility/debugger.php', $debugger_start);
$debugger->profileFinish('inc_debugger', KERNEL_PATH . '/utility/debugger.php', $debugger_end);
$debugger->profilerAddTotal('includes', 'inc_debugger');
}
}
}
safeDefine('SILENT_LOG', 0);
$includes = Array(
KERNEL_PATH . '/application.php',
FULL_PATH . APPLICATION_PATH,
KERNEL_PATH . '/db/db_connection.php',
KERNEL_PATH . "/kbase.php",
KERNEL_PATH . '/utility/event.php',
KERNEL_PATH . "/utility/factory.php",
KERNEL_PATH . "/languages/phrases_cache.php",
KERNEL_PATH . "/db/dblist.php",
KERNEL_PATH . "/db/dbitem.php",
KERNEL_PATH . "/event_handler.php",
KERNEL_PATH . '/db/db_event_handler.php',
);
foreach ($includes as $a_file) {
k4_include_once($a_file);
}
if (defined('DEBUG_MODE') && DEBUG_MODE && isset($debugger)) {
$debugger->AttachToApplication();
}
if( !function_exists('adodb_mktime') ) {
include_once(KERNEL_PATH . '/utility/adodb-time.inc.php');
}
// system users
define('USER_ROOT', -1);
define('USER_GUEST', -2);
\ No newline at end of file
Index: branches/5.1.x/core/units/helpers/site_config_helper.php
===================================================================
--- branches/5.1.x/core/units/helpers/site_config_helper.php (revision 13928)
+++ branches/5.1.x/core/units/helpers/site_config_helper.php (revision 13929)
@@ -1,212 +1,212 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class SiteConfigHelper extends kHelper {
function SiteConfigHelper()
{
parent::kHelper();
$preset_name = $this->Application->ConfigValue('AdminConsoleInterface');
- define('SYSTEM_PRESET_PATH', FULL_PATH . ADMIN_DIRECTORY . DIRECTORY_SEPARATOR . 'system_presets' . DIRECTORY_SEPARATOR . $preset_name);
+ define('SYSTEM_PRESET_PATH', FULL_PATH . ADMIN_PRESETS_DIRECTORY . DIRECTORY_SEPARATOR . 'system_presets' . DIRECTORY_SEPARATOR . $preset_name);
}
/**
* Returns settings for current admin console preset
*
* @return Array
*/
function getSettings()
{
static $settings = null;
if (isset($settings)) {
return $settings;
}
$default_settings = $this->_getDefaultSettings();
$preset_name = $this->Application->ConfigValue('AdminConsoleInterface');
$base_path = FULL_PATH . ADMIN_DIRECTORY . '/system_presets/' . $preset_name;
if (file_exists($base_path . DIRECTORY_SEPARATOR . 'settings.php')) {
include_once $base_path . DIRECTORY_SEPARATOR . 'settings.php'; // will get $settings array
foreach ($default_settings as $setting_name => $setting_value) {
if (!array_key_exists($setting_name, $settings)) {
$settings[$setting_name] = $setting_value;
}
}
return $settings;
}
else {
$settings = $default_settings;
}
return $settings;
}
/**
* Returns default settings for admin console presets
*
* @return Array
*/
function _getDefaultSettings()
{
$settings = Array (
'default_editing_mode' => EDITING_MODE_BROWSE,
'visible_editing_modes' => Array (
EDITING_MODE_BROWSE,
EDITING_MODE_CONTENT,
EDITING_MODE_DESIGN,
),
);
return $settings;
}
/**
* Applies given changes to given prefix unit config
*
* @param string $prefix
* @param Array $changes
*/
function processConfigChanges($prefix, $changes)
{
extract($changes);
$section_adjustments = $this->Application->getUnitOption('core-sections', 'SectionAdjustments', Array ());
$title_presets = $this->Application->getUnitOption($prefix, 'TitlePresets', Array ());
$fields = $this->Application->getUnitOption($prefix, 'Fields', Array ());
$virtual_fields = $this->Application->getUnitOption($prefix, 'VirtualFields', Array ());
$edit_tab_presets = $this->Application->getUnitOption($prefix, 'EditTabPresets', Array ());
$grids = $this->Application->getUnitOption($prefix, 'Grids', Array ());
$field_names = array_keys($fields);
$virtual_field_names = array_keys($virtual_fields);
if (isset($remove_sections)) {
// process sections
foreach ($remove_sections as $remove_section) {
$section_adjustments[$remove_section]['show_mode'] = smHIDE;
}
}
if (isset($debug_only_sections)) {
// process sections
foreach ($debug_only_sections as $debug_only_section) {
$section_adjustments[$debug_only_section]['show_mode'] = smDEBUG;
}
}
if (isset($remove_buttons)) {
// process toolbar buttons
foreach ($remove_buttons as $title_preset => $toolbar_buttons) {
$title_presets[$title_preset]['toolbar_buttons'] = array_diff($title_presets[$title_preset]['toolbar_buttons'], $toolbar_buttons);
}
}
$reset_fields = true;
$reset_virtual_fields = true;
// process hidden fields
if (isset($hidden_fields)) {
$fields = $this->_setFieldOption($fields, $hidden_fields, 'show_mode', false, $reset_fields);
$reset_fields = false;
}
if (isset($virtual_hidden_fields)) {
$virtual_fields = $this->_setFieldOption($virtual_fields, $virtual_hidden_fields, 'show_mode', false, $reset_virtual_fields);
$reset_virtual_fields = false;
}
// process debug only fields
if (isset($debug_only_fields)) {
$fields = $this->_setFieldOption($fields, $debug_only_fields, 'show_mode', smDEBUG, $reset_fields);
$reset_fields = false;
}
if (isset($debug_only_virtual_fields)) {
$virtual_fields = $this->_setFieldOption($virtual_fields, $debug_only_virtual_fields, 'show_mode', smDEBUG, $reset_virtual_fields);
$reset_virtual_fields = false;
}
// process required fields
if (isset($required_fields)) {
$fields = $this->_setFieldOption($fields, $required_fields, 'required', 1);
}
if (isset($virtual_required_fields)) {
$virtual_fields = $this->_setFieldOption($virtual_fields, $virtual_required_fields, 'required', 1);
}
if (isset($hide_edit_tabs)) {
// hide edit tabs
foreach ($hide_edit_tabs as $preset_name => $edit_tabs) {
foreach ($edit_tabs as $edit_tab) {
unset($edit_tab_presets[$preset_name][$edit_tab]);
}
}
}
if (isset($hide_columns)) {
// hide columns in grids
foreach ($hide_columns as $grid_name => $columns) {
foreach ($columns as $column) {
unset($grids[$grid_name]['Fields'][$column]);
}
}
}
// save changes
$this->Application->setUnitOption('core-sections', 'SectionAdjustments', $section_adjustments);
$this->Application->setUnitOption($prefix, 'TitlePresets', $title_presets);
$this->Application->setUnitOption($prefix, 'Fields', $fields);
$this->Application->setUnitOption($prefix, 'VirtualFields', $virtual_fields);
$this->Application->setUnitOption($prefix, 'EditTabPresets', $edit_tab_presets);
$this->Application->setUnitOption($prefix, 'Grids', $grids);
}
/**
* Sets given option for given fields and unsets it for all other fields
*
* @param Array $fields
* @param Array $set_fields
* @param string $option_name
* @param mixed $option_value
* @param bool $reset
*/
function _setFieldOption($fields, $set_fields, $option_name, $option_value, $reset = true)
{
if ($reset) {
// unset given option for rest of fields (all except $set_fields)
$unset_fields = array_diff(array_keys($fields), $set_fields);
foreach ($unset_fields as $unset_field) {
if (array_key_exists($option_name, $fields[$unset_field])) {
unset($fields[$unset_field][$option_name]);
}
}
}
// set given option to given fields
foreach ($set_fields as $set_field) {
$fields[$set_field][$option_name] = $option_value;
}
return $fields;
}
}
\ No newline at end of file
Event Timeline
Log In to Comment