diff --git a/datas/config-sample.php b/datas/config-sample.php index df3fa560c..cf0b374fd 100644 --- a/datas/config-sample.php +++ b/datas/config-sample.php @@ -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. diff --git a/lang/en/admin.en.lang.php b/lang/en/admin.en.lang.php index 73079ea03..4eeaa911f 100644 --- a/lang/en/admin.en.lang.php +++ b/lang/en/admin.en.lang.php @@ -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']; @@ -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 @@ -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 @@ -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 @@ -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'); diff --git a/lang/en/main.en.lang.php b/lang/en/main.en.lang.php index 211b9dc6e..fa4822883 100644 --- a/lang/en/main.en.lang.php +++ b/lang/en/main.en.lang.php @@ -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'; diff --git a/lang/ru/admin.ru.lang.php b/lang/ru/admin.ru.lang.php index 6d36cdf1a..2448b02cc 100644 --- a/lang/ru/admin.ru.lang.php +++ b/lang/ru/admin.ru.lang.php @@ -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']; @@ -82,10 +82,12 @@ /** * Config Section - * Lang Subsection + * Locale Subsection */ $L['cfg_forcedefaultlang'] = array('Принудительная установка языка по умолчанию для всех пользователей', ' '); +$L['cfg_defaulttimezone'] = array('Часовой пояс по умолчанию', 'Для гостей и при регистрации, от -12 до +12'); + /** * Config Section @@ -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 @@ -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 @@ -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-код в подписях пользователей', 'По причине безопасности рекомендуется «Нет»!'); diff --git a/lang/ru/main.ru.lang.php b/lang/ru/main.ru.lang.php index d6b92835a..7d8a8f8ed 100644 --- a/lang/ru/main.ru.lang.php +++ b/lang/ru/main.ru.lang.php @@ -144,6 +144,7 @@ $L['Levels'] = 'Уровни'; $L['Link'] = 'Ссылка'; $L['Links'] = 'Ссылки'; +$L['Locale'] = 'Локализация'; $L['Location'] = 'Город'; $L['Lock'] = 'Блокировать'; $L['Locked'] = 'Заблокировано'; diff --git a/modules/page/inc/page.functions.php b/modules/page/inc/page.functions.php index 65b0548fa..fae77dcc7 100644 --- a/modules/page/inc/page.functions.php +++ b/modules/page/inc/page.functions.php @@ -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; diff --git a/setup/install.sql b/setup/install.sql index ef231bbc8..6466d0947 100644 --- a/setup/install.sql +++ b/setup/install.sql @@ -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','',''), @@ -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,'','','',''), @@ -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}','',''), @@ -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` ( diff --git a/setup/siena/sql_r1971.sql b/setup/siena/sql_r1971.sql new file mode 100644 index 000000000..c810ce842 --- /dev/null +++ b/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'; \ No newline at end of file diff --git a/system/common.php b/system/common.php index 6a3435162..9bf7f6992 100644 --- a/system/common.php +++ b/system/common.php @@ -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; @@ -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']; diff --git a/system/header.php b/system/header.php index 0c585615a..19ccd535f 100644 --- a/system/header.php +++ b/system/header.php @@ -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();