Skip to content
Permalink
Browse files

prevent accidential creation of 'Danish' cache descriptions; updates …

…#804
  • Loading branch information...
following5 committed Aug 28, 2015
1 parent 00a96c7 commit d3417dbd31e063df89c6a2e876f99632dcd4a6e3

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -262,7 +262,7 @@ function toggleAttr(id)
<img src="lang/de/ocstyle/images/description/22x22-description.png" width="22" height="22" align="middle" border="0" />
{t}Descriptions{/t}&nbsp;&nbsp;
<img src="lang/de/ocstyle/images/action/16x16-adddesc.png" width="16" height="16" align="middle" border="0" alt="{t}Create a new description{/t}" title="{t}Create a new description{/t}">
<span style="font-weight: 400;font-size: small;">[<a href="newdesc.php?cacheid={cacheid_urlencode}">{t}Add an additional description{/t}</a>]</span>
<span style="font-weight: 400;font-size: small;">[<a href="newdesc.php?cacheid={cacheid_urlencode}">{t}Add description in another language{/t}</a>]</span>
</p>
</div>
</td>
@@ -19,5 +19,6 @@
$default_lang = t('EN');
$lang_message = '<br/><span class="errormsg">' . t('There already exists a description in this language') . '</span>';
$error_no_lang_selected = '&nbsp;<span class="errormsg">' . t('Please select a language.') . "</span>";
$show_all_langs_submit = '&nbsp;<input type="submit" name="show_all_langs_submit" value="' . t('Show all') . '" class="formbutton" onclick="submitbutton(\'show_all_langs_submit\')" />';
?>
@@ -42,6 +42,7 @@
<td>{t}Language:{/t}</td>
<td>
<select name="desc_lang">
<option value="0" {nolangselected}>{t}-- Please select --{/t}</option>
{langoptions}
</select>
{show_all_langs_submit} {lang_message}
@@ -102,7 +102,7 @@
$desc_lang_exists = false;
//save to db?
if (isset($_POST['submitform'])) // Ocprop
if (isset($_POST['submitform']) && $sel_lang != '0') // Ocprop
{
//check if the entered language already exists
$desc_rs = sql("SELECT `id` FROM `cache_desc` WHERE `cache_id`='&1' AND `language`='&2'", $cache_id, $sel_lang);
@@ -158,6 +158,7 @@
//build langslist
$langoptions = '';
$selected = false;
$rsLanguages = sql("SELECT `short`, IFNULL(`sys_trans_text`.`text`, `languages`.`name`) AS `name`
FROM `languages`
LEFT JOIN `languages_list_default` ON `languages`.`short`=`languages_list_default`.`show` AND `languages_list_default`.`lang`='&1'
@@ -172,6 +173,7 @@
while ($rLanguage = sql_fetch_assoc($rsLanguages))
{
$sSelected = ($rLanguage['short'] == $sel_lang) ? ' selected="selected"' : '';
if ($sSelected != '') $selected = true;
$langoptions .= '<option value="' . htmlspecialchars($rLanguage['short'], ENT_COMPAT, 'UTF-8') . '"' . $sSelected . '>' . htmlspecialchars($rLanguage['name'], ENT_COMPAT, 'UTF-8') . '</option>' . "\n";
}
sql_free_result($rsLanguages);
@@ -183,12 +185,14 @@
}
tpl_set_var('langoptions', $langoptions);
tpl_set_var('nolangselected', $selected ? '' : 'selected="selected"');
//here we set the template vars
tpl_set_var('name', htmlspecialchars($cache_record['name'], ENT_COMPAT, 'UTF-8'));
tpl_set_var('cacheid', htmlspecialchars($cache_id, ENT_COMPAT, 'UTF-8'));
tpl_set_var('lang_message', $desc_lang_exists ? $lang_message : '');
tpl_set_var('lang_message', $desc_lang_exists ? $lang_message :
(isset($_POST['submitform']) && $sel_lang == '0' ? $error_no_lang_selected : ''));
tpl_set_var('show_all_langs', $show_all_langs);
tpl_set_var('show_all_langs_submit', ($show_all_langs == 0) ? $show_all_langs_submit : '');
@@ -51,7 +51,7 @@
<tr>
<td colspan="2">{t}Reason:{/t}
<select name="reason">
<option value="0" {if $reason==0}selected="selected"{/if}>{t}=== Please select ==={/t}</option>
<option value="0" {if $reason==0}selected="selected"{/if}>{t}-- Please select --{/t}</option>
{foreach from=$reasons item=reasonItem}
<option value="{$reasonItem.id}" {if $reason==$reasonItem.id}selected="selected"{/if}>{$reasonItem.name|escape}</option>
{foreachelse}

0 comments on commit d3417db

Please sign in to comment.
You can’t perform that action at this time.