Example #1
0
# This file is part of Dotclear 2.
#
# Copyright (c) 2003-2009 Olivier Meunier and contributors
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK ------------------------------------
require dirname(__FILE__) . '/../inc/admin/prepend.php';
dcPage::checkSuper();
$is_writable = is_dir(DC_L10N_ROOT) && is_writable(DC_L10N_ROOT);
$iso_codes = l10n::getISOCodes();
# Get languages list on Dotclear.net
$dc_langs = false;
$feed_reader = new feedReader();
$feed_reader->setCacheDir(DC_TPL_CACHE);
$feed_reader->setTimeout(5);
$feed_reader->setUserAgent('Dotclear - http://www.dotclear.org/');
try {
    $dc_langs = $feed_reader->parse(sprintf(DC_L10N_UPDATE_URL, DC_VERSION));
    if ($dc_langs !== false) {
        $dc_langs = $dc_langs->items;
    }
} catch (Exception $e) {
}
# Delete a language pack
if ($is_writable && !empty($_POST['delete']) && !empty($_POST['locale_id'])) {
    try {
        $locale_id = $_POST['locale_id'];
        if (!isset($iso_codes[$locale_id]) || !is_dir(DC_L10N_ROOT . '/' . $locale_id)) {
            throw new Exception(__('No such installed language'));