diff --git a/main/admin/configure_homepage.php b/main/admin/configure_homepage.php index 61c847305f..324deadfd3 100644 --- a/main/admin/configure_homepage.php +++ b/main/admin/configure_homepage.php @@ -25,6 +25,7 @@ global $_configuration; $action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null; $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY); $tool_name = get_lang('ConfigureHomePage'); +$_languages = api_get_languages(); $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); @@ -170,6 +171,18 @@ if (!empty($action)) { $fp = fopen($homep.$topf.'_'.$lang.$ext, 'w'); fputs($fp, $home_top); fclose($fp); + if ($_POST['all_langs']) { + foreach ($_languages['name'] as $key => $value) { + $lang_name = $_languages['folder'][$key]; + if (file_exists($homep.$topf.'_'.$lang_name.$ext)) { + if (is_writable($homep.$topf.'_'.$lang_name.$ext)) { + $fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w'); + fputs($fp, $home_top); + fclose($fp); + } + } + } + } } else { $errorMsg = get_lang('HomePageFilesNotWritable'); } @@ -178,7 +191,18 @@ if (!empty($action)) { $fp = fopen($homep.$topf.'_'.$lang.$ext, 'w'); fputs($fp, $home_top); fclose($fp); - } + if ($_POST['all_langs']) { + foreach ($_languages['name'] as $key => $value) { + $lang_name = $_languages['folder'][$key]; + if (file_exists($homep.$topf.'_'.$lang_name.$ext)) { + $fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w'); + fputs($fp, $home_top); + fclose($fp); + + } + } + } + } if (EventsMail::check_if_using_class('portal_homepage_edited')) { EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id())); @@ -198,9 +222,33 @@ if (!empty($action)) { $fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w'); if ($errorMsg == '') { fputs($fp, "$notice_title
\n$notice_text"); + if ($_POST['all_langs']) { + foreach ($_languages['name'] as $key => $value) { + $lang_name = $_languages['folder'][$key]; + if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) { + if (is_writable($homep.$noticef.'_'.$lang_name.$ext)) { + $fp = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w'); + fputs($fp, "$notice_title
\n$notice_text"); + fclose($fp); + } + } + } + } + } else { fputs($fp, ''); - } + if ($_POST['all_langs']) { + foreach ($_languages['name'] as $key => $value) { + $lang_name = $_languages['folder'][$key]; + if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) { + $fp1 = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w'); + fputs($fp1, ''); + fclose($fp1); + + } + } + } + } fclose($fp); } else { $errorMsg .= "
\n".get_lang('HomePageFilesNotWritable'); @@ -239,7 +287,6 @@ if (!empty($action)) { } } else { // We update all the news file - $_languages = api_get_languages(); foreach ($_languages['name'] as $key => $value) { $english_name = $_languages['folder'][$key]; if (file_exists($homep.$newsf.'_'.$english_name.$ext)) { @@ -379,6 +426,18 @@ if (!empty($action)) { $fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w'); fputs($fp, $home_menu); fclose($fp); + if ($_POST['all_langs']) { + foreach ($_languages['name'] as $key => $value) { + $lang_name = $_languages['folder'][$key]; + if (file_exists($homep.$menuf.'_'.$lang_name.$ext)) { + if (is_writable($homep.$menuf.'_'.$lang_name.$ext)) { + $fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w'); + fputs($fp, $home_menu); + fclose($fp); + } + } + } + } if (file_exists($homep.$menuf.$ext)) { if (is_writable($homep.$menuf.$ext)) { $fpo = fopen($homep.$menuf.$ext, 'w'); @@ -394,7 +453,18 @@ if (!empty($action)) { $fp = fopen($homep.$menuf.'_'.$lang.$ext, 'w'); fputs($fp, $home_menu); fclose($fp); - } + if ($_POST['all_langs']) { + foreach ($_languages['name'] as $key => $value) { + $lang_name = $_languages['folder'][$key]; + if (file_exists($homep.$menuf.'_'.$lang_name.$ext)) { + $fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w'); + fputs($fp, $home_menu); + fclose($fp); + + } + } + } + } } event_system(LOG_HOMEPAGE_CHANGED, $action, cut($link_name.':'.$link_url, 254), api_get_utc_datetime(), api_get_user_id()); break; @@ -654,6 +724,9 @@ switch ($action) { : + + +   @@ -730,6 +803,7 @@ switch ($action) { $form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400')); } } + $form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), 1); $form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); } @@ -765,7 +839,7 @@ switch ($action) { $_languages = api_get_languages(); $html = ''.get_lang('ChooseNewsLanguage').' : '; $html .= '