Ejemplo n.º 1
0
 function qtrans_join($texts)
 {
     return ppqtrans_join($texts);
 }
Ejemplo n.º 2
0
function qs_UpdateOrder($order_id)
{
    global $wpdb;
    $orders = get_option('qs_orders');
    if (!is_array($orders)) {
        return false;
    }
    foreach ($orders as $key => $order) {
        // search for wanted order
        if ($order['order']['order_id'] != $order_id) {
            continue;
        }
        // query server for updates
        $order['order']['order_url'] = get_option('home');
        $result = qs_queryQS(QS_RETRIEVE_TRANSLATION, $order['order']);
        if (isset($result['order_comment'])) {
            $orders[$key]['status'] = $result['order_comment'];
        }
        // update db if post is updated
        if (isset($result['order_status']) && $result['order_status'] == QS_STATE_CLOSED) {
            $order['post_id'] = intval($order['post_id']);
            $post =& get_post($order['post_id']);
            $title = ppqtrans_split($post->post_title);
            $content = ppqtrans_split($post->post_content);
            $title[$order['target_language']] = $result['order_translated_title'];
            $content[$order['target_language']] = $result['order_translated_text'];
            $post->post_title = ppqtrans_join($title);
            $post->post_content = ppqtrans_join($content);
            $wpdb->show_errors();
            $wpdb->query('UPDATE ' . $wpdb->posts . ' SET post_title="' . mysql_escape_string($post->post_title) . '", post_content = "' . mysql_escape_string($post->post_content) . '" WHERE ID = "' . $post->ID . '"');
            wp_cache_add($post->ID, $post, 'posts');
            unset($orders[$key]);
        }
        update_option('qs_orders', $orders);
        return true;
    }
    return false;
}
function ppqtranslate_conf()
{
    global $q_config, $wpdb;
    // do redirection for dashboard
    if (isset($_GET['godashboard'])) {
        echo '<h2>' . __('Switching Language', 'qtranslate') . '</h2>' . sprintf(__('Switching language to %1$s... If the Dashboard isn\'t loading, use this <a href="%2$s" title="Dashboard">link</a>.', 'qtranslate'), $q_config['language_name'][ppqtrans_getLanguage()], admin_url()) . '<script type="text/javascript">document.location="' . admin_url() . '";</script>';
        exit;
    }
    // init some needed variables
    $error = '';
    $original_lang = '';
    $language_code = '';
    $language_name = '';
    $language_locale = '';
    $language_date_format = '';
    $language_time_format = '';
    $language_na_message = '';
    $language_flag = '';
    $language_default = '';
    $altered_table = false;
    $message = apply_filters('ppqtranslate_configuration_pre', '');
    // check for action
    if (isset($_POST['ppqtranslate_reset']) && isset($_POST['ppqtranslate_reset2'])) {
        $message = __('qTranslate has been reset.', 'qtranslate');
    } elseif (isset($_POST['default_language'])) {
        // save settings
        ppqtrans_checkSetting('default_language', true, QT_LANGUAGE);
        ppqtrans_checkSetting('flag_location', true, QT_URL);
        ppqtrans_checkSetting('ignore_file_types', true, QT_STRING);
        ppqtrans_checkSetting('detect_browser_language', true, QT_BOOLEAN);
        ppqtrans_checkSetting('hide_untranslated', true, QT_BOOLEAN);
        ppqtrans_checkSetting('use_strftime', true, QT_INTEGER);
        ppqtrans_checkSetting('url_mode', true, QT_INTEGER);
        ppqtrans_checkSetting('auto_update_mo', true, QT_BOOLEAN);
        ppqtrans_checkSetting('hide_default_language', true, QT_BOOLEAN);
        if (isset($_POST['update_mo_now']) && $_POST['update_mo_now'] == '1' && ppqtrans_updateGettextDatabases(true)) {
            $message = __('Gettext databases updated.', 'qtranslate');
        }
    }
    if (isset($_POST['original_lang'])) {
        // validate form input
        if ($_POST['language_na_message'] == '') {
            $error = __('The Language must have a Not-Available Message!', 'qtranslate');
        }
        if (strlen($_POST['language_locale']) < 2) {
            $error = __('The Language must have a Locale!', 'qtranslate');
        }
        if ($_POST['language_name'] == '') {
            $error = __('The Language must have a name!', 'qtranslate');
        }
        if (strlen($_POST['language_code']) != 2) {
            $error = __('Language Code has to be 2 characters long!', 'qtranslate');
        }
        if ($_POST['original_lang'] == '' && $error == '') {
            // new language
            if (isset($q_config['language_name'][$_POST['language_code']])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            }
        }
        if ($_POST['original_lang'] != '' && $error == '') {
            // language update
            if ($_POST['language_code'] != $_POST['original_lang'] && isset($q_config['language_name'][$_POST['language_code']])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            } else {
                // remove old language
                unset($q_config['language_name'][$_POST['original_lang']]);
                unset($q_config['flag'][$_POST['original_lang']]);
                unset($q_config['locale'][$_POST['original_lang']]);
                unset($q_config['date_format'][$_POST['original_lang']]);
                unset($q_config['time_format'][$_POST['original_lang']]);
                unset($q_config['not_available'][$_POST['original_lang']]);
                if (in_array($_POST['original_lang'], $q_config['enabled_languages'])) {
                    // was enabled, so set modified one to enabled too
                    for ($i = 0; $i < sizeof($q_config['enabled_languages']); $i++) {
                        if ($q_config['enabled_languages'][$i] == $_POST['original_lang']) {
                            $q_config['enabled_languages'][$i] = $_POST['language_code'];
                        }
                    }
                }
                if ($_POST['original_lang'] == $q_config['default_language']) {
                    // was default, so set modified the default
                    $q_config['default_language'] = $_POST['language_code'];
                }
            }
        }
        if (get_magic_quotes_gpc()) {
            if (isset($_POST['language_date_format'])) {
                $_POST['language_date_format'] = stripslashes($_POST['language_date_format']);
            }
            if (isset($_POST['language_time_format'])) {
                $_POST['language_time_format'] = stripslashes($_POST['language_time_format']);
            }
        }
        if ($error == '') {
            // everything is fine, insert language
            $q_config['language_name'][$_POST['language_code']] = $_POST['language_name'];
            $q_config['flag'][$_POST['language_code']] = $_POST['language_flag'];
            $q_config['locale'][$_POST['language_code']] = $_POST['language_locale'];
            $q_config['date_format'][$_POST['language_code']] = $_POST['language_date_format'];
            $q_config['time_format'][$_POST['language_code']] = $_POST['language_time_format'];
            $q_config['not_available'][$_POST['language_code']] = $_POST['language_na_message'];
        }
        if ($error != '' || isset($_GET['edit'])) {
            // get old values in the form
            $original_lang = $_POST['original_lang'];
            $language_code = $_POST['language_code'];
            $language_name = $_POST['language_name'];
            $language_locale = $_POST['language_locale'];
            $language_date_format = $_POST['language_date_format'];
            $language_time_format = $_POST['language_time_format'];
            $language_na_message = $_POST['language_na_message'];
            $language_flag = $_POST['language_flag'];
            $language_default = $_POST['language_default'];
        }
    } elseif (isset($_GET['convert'])) {
        // update language tags
        global $wpdb;
        $wpdb->show_errors();
        foreach ($q_config['enabled_languages'] as $lang) {
            $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[lang_' . $lang . ']","<!--:' . $lang . '-->")');
            $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[/lang_' . $lang . ']","<!--:-->")');
            $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_content = REPLACE(post_content, "[lang_' . $lang . ']","<!--:' . $lang . '-->")');
            $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_content = REPLACE(post_content, "[/lang_' . $lang . ']","<!--:-->")');
        }
        $message = "Database Update successful!";
    } elseif (isset($_GET['markdefault'])) {
        // update language tags
        global $wpdb;
        $wpdb->show_errors();
        $result = $wpdb->get_results('SELECT ID, post_title, post_content FROM ' . $wpdb->posts . ' WHERE NOT (post_content LIKE "%<!--:-->%" OR post_title LIKE "%<!--:-->%")');
        foreach ($result as $post) {
            $content = ppqtrans_split($post->post_content);
            $title = ppqtrans_split($post->post_title);
            foreach ($q_config['enabled_languages'] as $language) {
                if ($language != $q_config['default_language']) {
                    $content[$language] = "";
                    $title[$language] = "";
                }
            }
            $content = ppqtrans_join($content);
            $title = ppqtrans_join($title);
            $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_content = "' . mysql_escape_string($content) . '", post_title = "' . mysql_escape_string($title) . '" WHERE ID=' . $post->ID);
        }
        $message = "All Posts marked as default language!";
    } elseif (isset($_GET['edit'])) {
        $original_lang = $_GET['edit'];
        $language_code = $_GET['edit'];
        $language_name = $q_config['language_name'][$_GET['edit']];
        $language_locale = $q_config['locale'][$_GET['edit']];
        $language_date_format = $q_config['date_format'][$_GET['edit']];
        $language_time_format = $q_config['time_format'][$_GET['edit']];
        $language_na_message = $q_config['not_available'][$_GET['edit']];
        $language_flag = $q_config['flag'][$_GET['edit']];
    } elseif (isset($_GET['delete'])) {
        // validate delete (protect code)
        if ($q_config['default_language'] == $_GET['delete']) {
            $error = 'Cannot delete Default Language!';
        }
        if (!isset($q_config['language_name'][$_GET['delete']]) || strtolower($_GET['delete']) == 'code') {
            $error = 'No such language!';
        }
        if ($error == '') {
            // everything seems fine, delete language
            ppqtrans_disableLanguage($_GET['delete']);
            unset($q_config['language_name'][$_GET['delete']]);
            unset($q_config['flag'][$_GET['delete']]);
            unset($q_config['locale'][$_GET['delete']]);
            unset($q_config['date_format'][$_GET['delete']]);
            unset($q_config['time_format'][$_GET['delete']]);
            unset($q_config['not_available'][$_GET['delete']]);
        }
    } elseif (isset($_GET['enable'])) {
        // enable validate
        if (!ppqtrans_enableLanguage($_GET['enable'])) {
            $error = __('Language is already enabled or invalid!', 'qtranslate');
        }
    } elseif (isset($_GET['disable'])) {
        // enable validate
        if ($_GET['disable'] == $q_config['default_language']) {
            $error = __('Cannot disable Default Language!', 'qtranslate');
        }
        if (!ppqtrans_isEnabled($_GET['disable'])) {
            if (!isset($q_config['language_name'][$_GET['disable']])) {
                $error = __('No such language!', 'qtranslate');
            }
        }
        // everything seems fine, disable language
        if ($error == '' && !ppqtrans_disableLanguage($_GET['disable'])) {
            $error = __('Language is already disabled!', 'qtranslate');
        }
    } elseif (isset($_GET['moveup'])) {
        $languages = ppqtrans_getSortedLanguages();
        $message = __('No such language!', 'qtranslate');
        foreach ($languages as $key => $language) {
            if ($language == $_GET['moveup']) {
                if ($key == 0) {
                    $message = __('Language is already first!', 'qtranslate');
                    break;
                }
                $languages[$key] = $languages[$key - 1];
                $languages[$key - 1] = $language;
                $q_config['enabled_languages'] = $languages;
                $message = __('New order saved.', 'qtranslate');
                break;
            }
        }
    } elseif (isset($_GET['movedown'])) {
        $languages = ppqtrans_getSortedLanguages();
        $message = __('No such language!', 'qtranslate');
        foreach ($languages as $key => $language) {
            if ($language == $_GET['movedown']) {
                if ($key == sizeof($languages) - 1) {
                    $message = __('Language is already last!', 'qtranslate');
                    break;
                }
                $languages[$key] = $languages[$key + 1];
                $languages[$key + 1] = $language;
                $q_config['enabled_languages'] = $languages;
                $message = __('New order saved.', 'qtranslate');
                break;
            }
        }
    }
    $everything_fine = (isset($_POST['submit']) || isset($_GET['delete']) || isset($_GET['enable']) || isset($_GET['disable']) || isset($_GET['moveup']) || isset($_GET['movedown'])) && $error == '';
    if ($everything_fine) {
        // settings might have changed, so save
        ppqtrans_saveConfig();
        if (empty($message)) {
            $message = __('Options saved.', 'qtranslate');
        }
    }
    if ($q_config['auto_update_mo']) {
        if (!is_dir(WP_LANG_DIR) || !($ll = @fopen(trailingslashit(WP_LANG_DIR) . 'qtranslate.test', 'a'))) {
            $error = sprintf(__('Could not write to "%s", Gettext Databases could not be downloaded!', 'qtranslate'), WP_LANG_DIR);
        } else {
            @fclose($ll);
            @unlink(trailingslashit(WP_LANG_DIR) . 'qtranslate.test');
        }
    }
    // don't accidently delete/enable/disable twice
    $clean_uri = preg_replace("/&(delete|enable|disable|convert|markdefault|moveup|movedown)=[^&#]*/i", "", $_SERVER['REQUEST_URI']);
    $clean_uri = apply_filters('ppqtranslate_clean_uri', $clean_uri);
    // Generate XHTML
    if ($message) {
        ?>
<div id="message" class="updated fade"><p><strong><?php 
        echo $message;
        ?>
</strong></p></div>
<?php 
    }
    if ($error != '') {
        ?>
<div id="message" class="error fade"><p><strong><?php 
        echo $error;
        ?>
</strong></p></div>
<?php 
    }
    ?>

<?php 
    if (isset($_GET['edit'])) {
        ?>
<div class="wrap">
<h2><?php 
        _e('Edit Language', 'qtranslate');
        ?>
</h2>
<form action="" method="post" id="qtranslate-edit-language">
<?php 
        ppqtranslate_language_form($language_code, $language_code, $language_name, $language_locale, $language_date_format, $language_time_format, $language_flag, $language_na_message, $language_default, $original_lang);
        ?>
<p class="submit"><input type="submit" name="submit" value="<?php 
        _e('Save Changes &raquo;', 'qtranslate');
        ?>
" /></p>
</form>
</div>
<?php 
    } else {
        ?>
<div class="wrap">
<h2><?php 
        _e('Language Management (qTranslate Configuration)', 'qtranslate');
        ?>
</h2> 
<div class="tablenav"><?php 
        printf(__('For help on how to configure qTranslate correctly, take a look at the <a href="%1$s">qTranslate FAQ</a> and the <a href="%2$s">Support Forum</a>.', 'qtranslate'), 'http://www.qianqin.de/qtranslate/faq/', 'http://www.qianqin.de/qtranslate/forum/viewforum.php?f=3');
        ?>
</div>
	<form action="<?php 
        echo $clean_uri;
        ?>
" method="post">
		<h3><?php 
        _e('General Settings', 'qtranslate');
        ?>
</h3>
		<table class="form-table">
			<tr>
				<th scope="row"><?php 
        _e('Default Language / Order', 'qtranslate');
        ?>
</th>
				<td>
					<fieldset><legend class="hidden"><?php 
        _e('Default Language', 'qtranslate');
        ?>
</legend>
				<?php 
        foreach (ppqtrans_getSortedLanguages() as $key => $language) {
            echo "\t<label title='" . $q_config['language_name'][$language] . "'><input type='radio' name='default_language' value='" . $language . "'";
            if ($language == $q_config['default_language']) {
                echo " checked='checked'";
            }
            echo ' />';
            echo ' <a href="' . add_query_arg('moveup', $language, $clean_uri) . '"><img src="' . WP_PLUGIN_URL . '/' . basename(__DIR__) . '/arrowup.png" alt="up" /></a>';
            echo ' <a href="' . add_query_arg('movedown', $language, $clean_uri) . '"><img src="' . WP_PLUGIN_URL . '/' . basename(__DIR__) . '/arrowdown.png" alt="down" /></a>';
            echo ' <img src="' . trailingslashit(WP_CONTENT_URL) . $q_config['flag_location'] . $q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
            echo ' ' . $q_config['language_name'][$language] . "</label><br />\n";
        }
        ?>
					</br>
					<?php 
        printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), get_bloginfo('url'));
        ?>
					</fieldset>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Hide Untranslated Content', 'qtranslate');
        ?>
</th>
				<td>
					<label for="hide_untranslated"><input type="checkbox" name="hide_untranslated" id="hide_untranslated" value="1"<?php 
        echo $q_config['hide_untranslated'] ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Hide Content which is not available for the selected language.', 'qtranslate');
        ?>
</label>
					<br/>
					<?php 
        _e('When checked, posts will be hidden if the content is not available for the selected language. If unchecked, a message will appear showing all the languages the content is available in.', 'qtranslate');
        ?>
					<?php 
        _e('This function will not work correctly if you installed qTranslate on a blog with existing entries. In this case you will need to take a look at "Convert Database" under "Advanced Settings".', 'qtranslate');
        ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Detect Browser Language', 'qtranslate');
        ?>
</th>
				<td>
					<label for="detect_browser_language"><input type="checkbox" name="detect_browser_language" id="detect_browser_language" value="1"<?php 
        echo $q_config['detect_browser_language'] ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Detect the language of the browser and redirect accordingly.', 'qtranslate');
        ?>
</label>
					<br/>
					<?php 
        _e('When the frontpage is visited via bookmark/external link/type-in, the visitor will be forwarded to the correct URL for the language specified by his browser.', 'qtranslate');
        ?>
				</td>
			</tr>
		</table>
		<h3><?php 
        _e('Advanced Settings', 'qtranslate');
        ?>
<span id="qtranslate-show-advanced" style="display:none"> (<a name="advanced_settings" href="#advanced_settings" onclick="showAdvanced();"><?php 
        _e('Show', 'qtranslate');
        ?>
</a>)</span></h3>
		<table class="form-table" id="qtranslate-advanced">
			<tr>
				<th scope="row"><?php 
        _e('URL Modification Mode', 'qtranslate');
        ?>
</th>
				<td>
					<fieldset><legend class="hidden"><?php 
        _e('URL Modification Mode', 'qtranslate');
        ?>
</legend>
						<label title="Query Mode"><input type="radio" name="url_mode" value="<?php 
        echo QT_URL_QUERY;
        ?>
" <?php 
        echo $q_config['url_mode'] == QT_URL_QUERY ? "checked=\"checked\"" : "";
        ?>
 /> <?php 
        _e('Use Query Mode (?lang=en)', 'qtranslate');
        ?>
</label><br />
						<label title="Pre-Path Mode"><input type="radio" name="url_mode" value="<?php 
        echo QT_URL_PATH;
        ?>
" <?php 
        echo $q_config['url_mode'] == QT_URL_PATH ? "checked=\"checked\"" : "";
        ?>
 /> <?php 
        _e('Use Pre-Path Mode (Default, puts /en/ in front of URL)', 'qtranslate');
        ?>
</label><br />
						<label title="Pre-Domain Mode"><input type="radio" name="url_mode" value="<?php 
        echo QT_URL_DOMAIN;
        ?>
" <?php 
        echo $q_config['url_mode'] == QT_URL_DOMAIN ? "checked=\"checked\"" : "";
        ?>
 /> <?php 
        _e('Use Pre-Domain Mode (uses http://en.yoursite.com)', 'qtranslate');
        ?>
</label><br />
					</fieldset><br/>
					<?php 
        _e('Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode!', 'qtranslate');
        ?>
<br/>
					<label for="hide_default_language"><input type="checkbox" name="hide_default_language" id="hide_default_language" value="1"<?php 
        echo $q_config['hide_default_language'] ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Hide URL language information for default language.', 'qtranslate');
        ?>
</label>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Flag Image Path', 'qtranslate');
        ?>
</th>
				<td>
					<?php 
        echo trailingslashit(WP_CONTENT_URL);
        ?>
<input type="text" name="flag_location" id="flag_location" value="<?php 
        echo $q_config['flag_location'];
        ?>
" style="width:50%"/>
					<br/>
					<?php 
        _e('Path to the flag images under wp-content, with trailing slash. (Default: plugins/qtranslate/flags/)', 'qtranslate');
        ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Ignore Links', 'qtranslate');
        ?>
</th>
				<td>
					<input type="text" name="ignore_file_types" id="ignore_file_types" value="<?php 
        echo $q_config['ignore_file_types'];
        ?>
" style="width:100%"/>
					<br/>
					<?php 
        _e('Don\'t convert Links to files of the given file types. (Default: gif,jpg,jpeg,png,pdf,swf,tif,rar,zip,7z,mpg,divx,mpeg,avi,css,js)', 'qtranslate');
        ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Update Gettext Databases', 'qtranslate');
        ?>
</th>
				<td>
					<label for="auto_update_mo"><input type="checkbox" name="auto_update_mo" id="auto_update_mo" value="1"<?php 
        echo $q_config['auto_update_mo'] ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Automatically check for .mo-Database Updates of installed languages.', 'qtranslate');
        ?>
</label>
					<br/>
					<label for="update_mo_now"><input type="checkbox" name="update_mo_now" id="update_mo_now" value="1" /> <?php 
        _e('Update Gettext databases now.', 'qtranslate');
        ?>
</label>
					<br/>
					<?php 
        _e('qTranslate will query the Wordpress Localisation Repository every week and download the latest Gettext Databases (.mo Files).', 'qtranslate');
        ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Date / Time Conversion', 'qtranslate');
        ?>
</th>
				<td>
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QT_DATE;
        ?>
" <?php 
        echo $q_config['use_strftime'] == QT_DATE ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Use emulated date function.', 'qtranslate');
        ?>
</label><br />
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QT_DATE_OVERRIDE;
        ?>
" <?php 
        echo $q_config['use_strftime'] == QT_DATE_OVERRIDE ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Use emulated date function and replace formats with the predefined formats for each language.', 'qtranslate');
        ?>
</label><br />
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QT_STRFTIME;
        ?>
" <?php 
        echo $q_config['use_strftime'] == QT_STRFTIME ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Use strftime instead of date.', 'qtranslate');
        ?>
</label><br />
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QT_STRFTIME_OVERRIDE;
        ?>
" <?php 
        echo $q_config['use_strftime'] == QT_STRFTIME_OVERRIDE ? ' checked="checked"' : '';
        ?>
/> <?php 
        _e('Use strftime instead of date and replace formats with the predefined formats for each language.', 'qtranslate');
        ?>
</label><br />
					<?php 
        _e('Depending on the mode selected, additional customizations of the theme may be needed.', 'qtranslate');
        ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Reset qTranslate', 'qtranslate');
        ?>
</th>
				<td>
					<label for="ppqtranslate_reset"><input type="checkbox" name="ppqtranslate_reset" id="ppqtranslate_reset" value="1"/> <?php 
        _e('Check this box and click Save Changes to reset all qTranslate settings.', 'qtranslate');
        ?>
</label>
					<br/>
					<label for="ppqtranslate_reset2"><input type="checkbox" name="ppqtranslate_reset2" id="ppqtranslate_reset2" value="1"/> <?php 
        _e('Yes, I really want to reset qTranslate.', 'qtranslate');
        ?>
</label>
					<br/>
					<label for="ppqtranslate_reset3"><input type="checkbox" name="ppqtranslate_reset3" id="ppqtranslate_reset3" value="1"/> <?php 
        _e('Also delete Translations for Categories/Tags/Link Categories.', 'qtranslate');
        ?>
</label>
					<br/>
					<?php 
        _e('If something isn\'t working correctly, you can always try to reset all qTranslate settings. A Reset won\'t delete any posts but will remove all settings (including all languages added).', 'qtranslate');
        ?>
				</td>
			</tr>
			<tr>
				<th scope="row"><?php 
        _e('Convert Database', 'qtranslate');
        ?>
</th>
				<td>
					<?php 
        printf(__('If you are updating from qTranslate 1.x or Polyglot, <a href="%s">click here</a> to convert posts to the new language tag format.', 'qtranslate'), $clean_uri . '&convert=true');
        ?>
					<?php 
        printf(__('If you have installed qTranslate for the first time on a Wordpress with existing posts, you can either go through all your posts manually and save them in the correct language or <a href="%s">click here</a> to mark all existing posts as written in the default language.', 'qtranslate'), $clean_uri . '&markdefault=true');
        ?>
					<?php 
        _e('Both processes are <b>irreversible</b>! Be sure to make a full database backup before clicking one of the links.', 'qtranslate');
        ?>
				</td>
			</tr>
			<tr>
				<th scope="row"><?php 
        _e('Debugging Information', 'qtranslate');
        ?>
</th>
				<td>
					<p><?php 
        printf(__('If you encounter any problems and you are unable to solve them yourself, you can visit the <a href="%s">Support Forum</a>. Posting the following Content will help other detect any misconfigurations.', 'qtranslate'), 'http://www.qianqin.de/qtranslate/forum/');
        ?>
</p>
					<textarea readonly="readonly" id="ppqtranslate_debug"><?php 
        $q_config_copy = $q_config;
        // remove information to keep data anonymous and other not needed things
        unset($q_config_copy['url_info']);
        unset($q_config_copy['js']);
        unset($q_config_copy['windows_locale']);
        unset($q_config_copy['pre_domain']);
        unset($q_config_copy['term_name']);
        echo htmlspecialchars(print_r($q_config_copy, true));
        ?>
</textarea>
				</td>
			</tr>
		</table>
		<script type="text/javascript">
		// <![CDATA[
			function showAdvanced() {
				document.getElementById('qtranslate-advanced').style.display='block';
				document.getElementById('qtranslate-show-advanced').style.display='none';
				return false;
			}
			
			if(location.hash!='#advanced_settings') {
					document.getElementById('qtranslate-show-advanced').style.display='inline';
					document.getElementById('qtranslate-advanced').style.display='none';
			}
		// ]]>
		</script>
<?php 
        do_action('ppqtranslate_configuration', $clean_uri);
        ?>
		<p class="submit">
			<input type="submit" name="submit" class="button-primary" value="<?php 
        _e('Save Changes', 'qtranslate');
        ?>
" />
		</p>
	</form>

</div>
<div class="wrap">

<h2><?php 
        _e('Languages', 'qtranslate');
        ?>
</h2>
<div id="col-container">

<div id="col-right">
<div class="col-wrap">

<table class="widefat">
	<thead>
	<tr>
<?php 
        print_column_headers('language');
        ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
        print_column_headers('language', false);
        ?>
	</tr>
	</tfoot>

	<tbody id="the-list" class="list:cat">
<?php 
        foreach ($q_config['language_name'] as $lang => $language) {
            if ($lang != 'code') {
                ?>
	<tr>
		<td><img src="<?php 
                echo trailingslashit(WP_CONTENT_URL) . $q_config['flag_location'] . $q_config['flag'][$lang];
                ?>
" alt="<?php 
                echo $language;
                ?>
 Flag"></td>
		<td><?php 
                echo $language;
                ?>
</td>
		<td><?php 
                if (in_array($lang, $q_config['enabled_languages'])) {
                    ?>
<a class="edit" href="<?php 
                    echo $clean_uri;
                    ?>
&disable=<?php 
                    echo $lang;
                    ?>
"><?php 
                    _e('Disable', 'qtranslate');
                    ?>
</a><?php 
                } else {
                    ?>
<a class="edit" href="<?php 
                    echo $clean_uri;
                    ?>
&enable=<?php 
                    echo $lang;
                    ?>
"><?php 
                    _e('Enable', 'qtranslate');
                    ?>
</a><?php 
                }
                ?>
</td>
		<td><a class="edit" href="<?php 
                echo $clean_uri;
                ?>
&edit=<?php 
                echo $lang;
                ?>
"><?php 
                _e('Edit', 'qtranslate');
                ?>
</a></td>
		<td><?php 
                if ($q_config['default_language'] == $lang) {
                    _e('Default', 'qtranslate');
                } else {
                    ?>
<a class="delete" href="<?php 
                    echo $clean_uri;
                    ?>
&delete=<?php 
                    echo $lang;
                    ?>
"><?php 
                    _e('Delete', 'qtranslate');
                    ?>
</a><?php 
                }
                ?>
</td>
	</tr>
<?php 
            }
        }
        ?>
	</tbody>
</table>
<p><?php 
        _e('Enabling a language will cause qTranslate to update the Gettext-Database for the language, which can take a while depending on your server\'s connection speed.', 'qtranslate');
        ?>
</p>
</div>
</div><!-- /col-right -->

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php 
        _e('Add Language', 'qtranslate');
        ?>
</h3>
<form name="addcat" id="addcat" method="post" class="add:the-list: validate">
<?php 
        ppqtranslate_language_form($language_code, $language_code, $language_name, $language_locale, $language_date_format, $language_time_format, $language_flag, $language_default, $language_na_message);
        ?>
<p class="submit"><input type="submit" name="submit" value="<?php 
        _e('Add Language &raquo;', 'qtranslate');
        ?>
" /></p>
</form></div>
</div>
</div><!-- /col-left -->

</div><!-- /col-container -->
<?php 
    }
}