Skip to content

Commit

Permalink
prevent accidential creation of 'Danish' cache descriptions; updates #…
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Aug 28, 2015
1 parent 00a96c7 commit d3417db
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
28 changes: 16 additions & 12 deletions htdocs/doc/sql/static-data/data.sql

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion htdocs/lang/de/ocstyle/editcache.tpl.php
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions htdocs/lang/de/ocstyle/newdesc.inc.php
Expand Up @@ -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\')" />';
?>
1 change: 1 addition & 0 deletions htdocs/lang/de/ocstyle/newdesc.tpl.php
Expand Up @@ -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}
Expand Down
8 changes: 6 additions & 2 deletions htdocs/newdesc.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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'
Expand All @@ -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);
Expand All @@ -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 : '');
Expand Down
2 changes: 1 addition & 1 deletion htdocs/templates2/ocstyle/reportcache.tpl
Expand Up @@ -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}
Expand Down

0 comments on commit d3417db

Please sign in to comment.