/**
* This lists all the current languages and allows editing of them.
*/
public function action_edit()
{
global $txt, $context, $scripturl, $language;
require_once(SUBSDIR . '/Language.subs.php');
// Setting a new default?
if (!empty($_POST['set_default']) && !empty($_POST['def_language']))
{
checkSession();
validateToken('admin-lang');
$lang_exists = false;
$available_langs = getLanguages();
foreach ($available_langs as $lang)
{
if ($_POST['def_language'] == $lang['filename'])
{
$lang_exists = true;
break;
}
}
if ($_POST['def_language'] != $language && $lang_exists)
{
require_once(SUBSDIR . '/SettingsForm.class.php');
Settings_Form::save_file(array('language' => '\'' . $_POST['def_language'] . '\''));
$language = $_POST['def_language'];
}
}
// Create another one time token here.
createToken('admin-lang');
$listOptions = array(
'id' => 'language_list',
'items_per_page' => 20,
'base_href' => $scripturl . '?action=admin;area=languages',
'title' => $txt['edit_languages'],
'data_check' => array(
'class' => create_function('$rowData', '
if ($rowData[\'default\'])
return \'highlight2\';
else
return \'\';
')
),
'get_items' => array(
'function' => 'list_getLanguages',
),
'get_count' => array(
'function' => 'list_getNumLanguages',
),
'columns' => array(
'default' => array(
'header' => array(
'value' => $txt['languages_default'],
'class' => 'centertext',
),
'data' => array(
'function' => create_function('$rowData', '
return \'<input type="radio" name="def_language" value="\' . $rowData[\'id\'] . \'" \' . ($rowData[\'default\'] ? \'checked="checked"\' : \'\') . \' class="input_radio" />\';
'),
'style' => 'width: 8%;',
'class' => 'centertext',
),
),
'name' => array(
'header' => array(
'value' => $txt['languages_lang_name'],
'class' => 'centertext',
),
'data' => array(
'class' => 'centertext',
'function' => create_function('$rowData', '
global $scripturl;
return sprintf(\'<a href="%1$s?action=admin;area=languages;sa=editlang;lid=%2$s">%3$s</a>\', $scripturl, $rowData[\'id\'], $rowData[\'name\']);
'),
),
),
'count' => array(
'header' => array(
'value' => $txt['languages_users'],
'class' => 'centertext',
),
'data' => array(
'db_htmlsafe' => 'count',
'class' => 'centertext',
),
),
'locale' => array(
'header' => array(
'value' => $txt['languages_locale'],
'class' => 'centertext',
),
'data' => array(
'db_htmlsafe' => 'locale',
'class' => 'centertext',
),
),
),
'form' => array(
'href' => $scripturl . '?action=admin;area=languages',
'token' => 'admin-lang',
),
'additional_rows' => array(
array(
'position' => 'bottom_of_list',
'value' => '
<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
<input type="submit" name="set_default" value="' . $txt['save'] . '"' . (is_writable(BOARDDIR . '/Settings.php') ? '' : ' disabled="disabled"') . ' class="right_submit" />',
),
),
// For highlighting the default.
'javascript' => '
initHighlightSelection(\'language_list\');
',
);
// Display a warning if we cannot edit the default setting.
if (!is_writable(BOARDDIR . '/Settings.php'))
$listOptions['additional_rows'][] = array(
'position' => 'after_title',
'value' => $txt['language_settings_writable'],
'class' => 'smalltext alert',
);
require_once(SUBSDIR . '/GenericList.class.php');
createList($listOptions);
$context['sub_template'] = 'show_list';
$context['default_list'] = 'language_list';
}
This is the only function in ManageLanguages.controller.php that I edited. Only added the 'class' => 'centertext' .
Also edited PackageServers.template.php and ProfileInfo.template.php but they are in the theme directory already. No idea about hooks to be honest. But I do appreciate the help and the lesson.
thanks