Skip to content

Commit

Permalink
Config changes #622:
Browse files Browse the repository at this point in the history
* Removed obsolete time configuration (now controlled by locale or directly in templates).
* Corrected time calculation based on GMT.
* Merged language and time configuration into locale configuration.
* Added support for custom jQuery CDNs.
* Removed unused language strings.
  • Loading branch information
trustmaster committed Mar 29, 2011
1 parent d18fade commit 9898e8e
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 70 deletions.
8 changes: 0 additions & 8 deletions datas/config-sample.php
Expand Up @@ -54,14 +54,6 @@
$cfg['cache_page'] = FALSE; // Static page cache for guests on pages and categories
$cfg['cache_forums'] = FALSE; // Static page cache for guests on forums

// ========================
// Default built-in time zone settings
// See http://php.net/manual/en/timezones.php
// ========================

(function_exists('version_compare') && version_compare(PHP_VERSION, '5.1.0', '>=')) &&
date_default_timezone_set('GMT');

// ========================
// More settings
// Should work fine in most of cases.
Expand Down
29 changes: 5 additions & 24 deletions lang/en/admin.en.lang.php
Expand Up @@ -61,7 +61,7 @@
*/

$L['core_forums'] = &$L['Forums'];
$L['core_lang'] = &$L['Language'];
$L['core_locale'] = &$L['Locale'];
$L['core_main'] = 'Main Settings';
$L['core_menus'] = &$L['Menus'];
$L['core_page'] = &$L['Pages'];
Expand All @@ -82,10 +82,11 @@

/**
* Config Section
* Lang Subsection
* Locale Subsection
*/

$L['cfg_forcedefaultlang'] = array('Force the default language for all users', '');
$L['cfg_defaulttimezone'] = array('Default time zone', 'For guests and new members, from -12 to +12');

/**
* Config Section
Expand Down Expand Up @@ -148,15 +149,7 @@
$L['cfg_gzip'] = array('Gzip', 'Gzip compression of the HTML output');
$L['cfg_headrc_consolidate'] = array('Consolidate header and footer resources (JS/CSS)');
$L['cfg_headrc_minify'] = array('Minify consolidated JS/CSS');
$L['cfg_jquery_cdn'] = array('Use jQuery from Google Ajax APIs CDN');
$L['cfg_shared_drv'] = array('Shared memory cache driver', '(go to Other - Cache)');

/**
* Config Section
* Plugins Subsection
*/

$L['cfg_disable_plug'] = array('Disable the plugins', '');
$L['cfg_jquery_cdn'] = array('Use jQuery from this CDN URL', 'Example: https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js');

/**
* Config Section
Expand All @@ -174,19 +167,6 @@
$L['cfg_separator'] = array('Generic separator', '(used in breadcrumbs etc)');
$L['cfg_showsqlstats'] = array('Show SQL queries statistics', '(used in footer.tpl)');

/**
* Config Section
* Time Subsection
*/

$L['cfg_dateformat'] = array('Main date mask', 'Default: Y-m-d H:i');
$L['cfg_formatmonthday'] = array('Short date mask', 'Default: m-d');
$L['cfg_formatyearmonthday'] = array('Medium date mask', 'Default: Y-m-d');
$L['cfg_formatmonthdayhourmin'] = array('Forum date mask', 'Default: m-d H:i');
$L['cfg_servertimezone'] = array('Server time zone', 'Offset of the server from the GMT+00');
$L['cfg_defaulttimezone'] = array('Default time zone', 'For guests and new members, from -12 to +12');
$L['cfg_timedout'] = array('Idle delay, in seconds', 'After this delay, user is away');

/**
* Config Section
* Title Subsection
Expand Down Expand Up @@ -223,6 +203,7 @@
$L['cfg_maxusersperpage'] = array('Maximum lines in userlist', '');
$L['cfg_regnoactivation'] = array('Skip e-mail check for new users', '\'No\'recommended, for security reasons');
$L['cfg_regrequireadmin'] = array('Administrators must validate new accounts', '');
$L['cfg_timedout'] = array('Idle delay, in seconds', 'After this delay, user is away');
$L['cfg_user_email_noprotection'] = array('Disable password protection of e-mail change', '\'No\' recommended, for security reasons');
$L['cfg_useremailchange'] = array('Allow users to change their e-mail address', '\'No\' recommended, for security reasons');
$L['cfg_usertextimg'] = array('Allow images and HTML in user signature', '\'No\' recommended, for security reasons');
Expand Down
1 change: 1 addition & 0 deletions lang/en/main.en.lang.php
Expand Up @@ -144,6 +144,7 @@
$L['Levels'] = 'Levels';
$L['Link'] = 'Link';
$L['Links'] = 'Links';
$L['Locale'] = 'Locale';
$L['Location'] = 'Location';
$L['Lock'] = 'Lock';
$L['Locked'] = 'Locked';
Expand Down
30 changes: 6 additions & 24 deletions lang/ru/admin.ru.lang.php
Expand Up @@ -61,7 +61,7 @@
*/

$L['core_forums'] = &$L['Forums'];
$L['core_lang'] = &$L['Language'];
$L['core_locale'] = &$L['Locale'];
$L['core_main'] = 'Настройки сайта';
$L['core_menus'] = &$L['Menus'];
$L['core_page'] = &$L['Pages'];
Expand All @@ -82,10 +82,12 @@

/**
* Config Section
* Lang Subsection
* Locale Subsection
*/

$L['cfg_forcedefaultlang'] = array('Принудительная установка языка по умолчанию для всех пользователей', ' ');
$L['cfg_defaulttimezone'] = array('Часовой пояс по умолчанию', 'Для гостей и при регистрации, от -12 до +12');


/**
* Config Section
Expand Down Expand Up @@ -148,15 +150,7 @@
$L['cfg_gzip'] = array('Gzip', 'Gzip-сжатие для исходящего HTML-кода');
$L['cfg_headrc_consolidate'] = array('Объединять ресурсы header/footer (JS/CSS)');
$L['cfg_headrc_minify'] = array('Минифицировать объединённые JS/CSS');
$L['cfg_jquery_cdn'] = array('Использовать jQuery из Google Ajax APIs CDN');
$L['cfg_shared_drv'] = array('Драйвер кеша в ОЗУ', '(См. Модули - Внутренний кеш)');

/**
* Config Section
* Plugins Subsection
*/

$L['cfg_disable_plug'] = array('Отключить плагины', ' ');
$L['cfg_jquery_cdn'] = array('Использовать jQuery из CDN по этой ссылке', 'Пример: https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js');

/**
* Config Section
Expand All @@ -174,19 +168,6 @@
$L['cfg_separator'] = array('Разделитель', '(используется в навигационной цепочке и т .д.)');
$L['cfg_showsqlstats'] = array('Показывать статистику SQL-запросов', '(в footer.tpl)');

/**
* Config Section
* Time Subsection
*/

$L['cfg_dateformat'] = array('Полный формат даты', 'По умолчанию Y-m-d H:i');
$L['cfg_formatmonthday'] = array('Укороченный формат даты', 'По умолчанию m-d');
$L['cfg_formatyearmonthday'] = array('Обычный формат даты', 'По умолчанию Y-m-d');
$L['cfg_formatmonthdayhourmin'] = array('Формат даты для форумов', 'По умолчанию m-d H:i');
$L['cfg_servertimezone'] = array('Часовой пояс сервера', 'Относительно GMT+00');
$L['cfg_defaulttimezone'] = array('Часовой пояс по умолчанию', 'Для гостей и при регистрации, от -12 до +12');
$L['cfg_timedout'] = array('Задержка ожидания в секундах', 'По истечении данного срока пользователь считается покинувшим сайт');

/**
* Config Section
* Title Subsection
Expand Down Expand Up @@ -223,6 +204,7 @@
$L['cfg_maxusersperpage'] = array('Максимальное количество записей на страницу в списке пользователей', ' ');
$L['cfg_regnoactivation'] = array('Отменить проверку e-mail при регистрации', 'По причине безопасности рекомендуется «Нет»!');
$L['cfg_regrequireadmin'] = array('Утверждение новых учетных записей администратором', ' ');
$L['cfg_timedout'] = array('Задержка ожидания в секундах', 'По истечении данного срока пользователь считается покинувшим сайт');
$L['cfg_user_email_noprotection'] = array('Выключить защиту смены e-mail с паролем', 'По причине безопасности рекомендуется «Нет»!');
$L['cfg_useremailchange'] = array('Разрешить пользователям изменять свой e-mail', 'По причине безопасности рекомендуется «Нет»!');
$L['cfg_usertextimg'] = array('Разрешить изображения и HTML-код в подписях пользователей', 'По причине безопасности рекомендуется «Нет»!');
Expand Down
1 change: 1 addition & 0 deletions lang/ru/main.ru.lang.php
Expand Up @@ -144,6 +144,7 @@
$L['Levels'] = 'Уровни';
$L['Link'] = 'Ссылка';
$L['Links'] = 'Ссылки';
$L['Locale'] = 'Локализация';
$L['Location'] = 'Город';
$L['Lock'] = 'Блокировать';
$L['Locked'] = 'Заблокировано';
Expand Down
4 changes: 2 additions & 2 deletions modules/page/inc/page.functions.php
Expand Up @@ -110,11 +110,11 @@ function cot_selectbox_categories($check, $name, $subcat = '', $hideprivate = tr
* @param int $textlength Text truncate
* @param bool $admin_rights Page Admin Rights
* @param bool $date_format DateTime Format
* @param string $emptytitle Page title text if page is not exist
* @param string $emptytitle Page title text if page does not exist
* @param bool $cacheitem Cache tags
* @return array
*/
function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $dateformat = '', $emptytitle = '', $cacheitem = true)
function cot_generate_pagetags($page_data, $tag_prefix = '', $textlength = 0, $admin_rights = null, $date_format = '', $emptytitle = '', $cacheitem = true)
{
global $db, $cot_extrafields, $cfg, $L, $Ls, $R, $db_pages, $usr, $sys, $cot_yesno, $structure;

Expand Down
14 changes: 5 additions & 9 deletions setup/install.sql
Expand Up @@ -74,7 +74,9 @@ CREATE TABLE `cot_config` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

INSERT INTO `cot_config` (`config_owner`, `config_cat`, `config_order`, `config_name`, `config_type`, `config_value`, `config_default`, `config_variants`, `config_text`) VALUES
('core','lang','01','forcedefaultlang',3,'0','0','',''),
('core','locale','01','forcedefaultlang',3,'0','0','',''),
('core','locale','05','servertimezone',1,'0','0','',''),
('core','locale','06','defaulttimezone',1,'0','0','',''),
('core','main','01','adminemail',1,'admin@mysite.com','admin@mysite.com','',''),
('core','main','02','clustermode',3,'0','0','',''),
('core','main','03','hostip',1,'999.999.999.999','999.999.999.999','',''),
Expand Down Expand Up @@ -117,7 +119,7 @@ INSERT INTO `cot_config` (`config_owner`, `config_cat`, `config_order`, `config_
('core','performance','01','gzip',3,'1','1','',''),
('core','performance','02','headrc_consolidate',3,'0','0','',''),
('core','performance','03','headrc_minify',3,'1','1','',''),
('core','performance','04','jquery_cdn',3,'0','0','',''),
('core','performance','04','jquery_cdn',1,'','','',''),
('core','theme','01','forcedefaulttheme',3,'0','0','',''),
('core','theme','02','homebreadcrumb',3,'0','0','',''),
('core','theme','03','metakeywords',1,'','','',''),
Expand All @@ -126,13 +128,6 @@ INSERT INTO `cot_config` (`config_owner`, `config_cat`, `config_order`, `config_
('core','theme','06','keepcrbottom',3,'1','1','',''),
('core','theme','07','showsqlstats',3,'0','0','',''),
('core','theme','08','msg_separate',3,'0','0','','Show messages separately for each source'),
('core','time','01','dateformat',1,'Y-m-d H:i','Y-m-d H:i','',''),
('core','time','02','formatmonthday',1,'m-d','m-d','',''),
('core','time','03','formatyearmonthday',1,'Y-m-d','Y-m-d','',''),
('core','time','04','formatmonthdayhourmin',1,'m-d H:i','m-d H:i','',''),
('core','time','05','servertimezone',1,'0','0','',''),
('core','time','06','defaulttimezone',1,'0','0','',''),
('core','time','07','timedout',2,'1200','1200','30,60,120,300,600,900,1200,1800,2400,3600',''),
('core','title','01','maintitle',1,'Title of your site','Title of your site','',''),
('core','title','02','subtitle',1,'Subtitle','Subtitle','',''),
('core','title','03','title_forum_main',1,'{FORUM}','{FORUM}','',''),
Expand Down Expand Up @@ -162,6 +157,7 @@ INSERT INTO `cot_config` (`config_owner`, `config_cat`, `config_order`, `config_
('core','users','08','usertextimg',3,'0','0','',''),
('core','users','09','usertextmax',1,'300','300','',''),
('core','users','10','forcerememberme',3,'0','0','',''),
('core','users','11','timedout',2,'1200','1200','30,60,120,300,600,900,1200,1800,2400,3600',''),
('core','version','01','revision',0,'','','','');

CREATE TABLE `cot_core` (
Expand Down
6 changes: 6 additions & 0 deletions setup/siena/sql_r1971.sql
@@ -0,0 +1,6 @@
/* r1971 Configuration cleanup */
UPDATE `cot_config` SET `config_cat` = 'users' WHERE `config_owner` = 'core' AND `config_name` = 'timedout';
UPDATE `cot_config` SET `config_cat` = 'locale' WHERE `config_owner` = 'core' AND `config_name` IN ('forcedefaultlang', 'defaulttimezone');
DELETE FROM `cot_config` WHERE `config_owner` = 'core' AND `config_cat` IN ('lang', 'time');

UPDATE `cot_config` SET `config_type` = 1, `config_value` = '', `config_default` = '' WHERE `config_owner` = 'core' AND `config_name` = 'jquery_cdn';
5 changes: 3 additions & 2 deletions system/common.php
Expand Up @@ -42,8 +42,11 @@ function cot_disable_mqgpc(&$value, $key)

register_shutdown_function('cot_shutdown');

// Each user has his own timezone preference based on offset from GMT, so all dates are GMT by default
date_default_timezone_set('GMT');
$sys['day'] = @date('Y-m-d');
$sys['now'] = time();
$sys['now_offset'] = $sys['now'];
$site_id = 'ct'.substr(md5(empty($cfg['site_id']) ? $cfg['mainurl'] : $cfg['site_id']), 0, 16);
$sys['site_id'] = $site_id;

Expand Down Expand Up @@ -124,8 +127,6 @@ function cot_disable_mqgpc(&$value, $key)

/* ======== Extra settings (the other presets are in functions.php) ======== */

$sys['now_offset'] = $sys['now'] - $cfg['servertimezone']*3600;

if ($cfg['clustermode'])
{
if (isset($_SERVER['HTTP_X_CLUSTER_CLIENT_IP'])) $usr['ip'] = $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
Expand Down
2 changes: 1 addition & 1 deletion system/header.php
Expand Up @@ -57,7 +57,7 @@

if ($cfg['jquery'] && $cfg['jquery_cdn'])
{
cot_rc_link_file('https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js', true);
cot_rc_link_file($cfg['jquery_cdn'], true);
}
cot_rc_output();

Expand Down

0 comments on commit 9898e8e

Please sign in to comment.