aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2010-03-20 08:59:54 +0000
committerrvelices <rv-github@modusoptimus.com>2010-03-20 08:59:54 +0000
commita02bf8952b73943249eb7a3c8afdcafee6a88fdc (patch)
tree1b0ed5d5f4a331502e6a7aaad3b1bb67818ca4ba
parent55e78ab8d211a443eff524b9d582fe2bfbc3e646 (diff)
- added a js confirmation before deletign a theme
- fix link to css - simplified language loading (a couple of years ago during utf8 migration I left the possibility to have languages defined in another charsets - this is useless) git-svn-id: http://piwigo.org/svn/trunk@5200 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/themes/default/template/include/datepicker.inc.tpl2
-rw-r--r--admin/themes/default/template/themes_installed.tpl2
-rw-r--r--include/functions.inc.php84
3 files changed, 20 insertions, 68 deletions
diff --git a/admin/themes/default/template/include/datepicker.inc.tpl b/admin/themes/default/template/include/datepicker.inc.tpl
index f010febcf..d85706903 100644
--- a/admin/themes/default/template/include/datepicker.inc.tpl
+++ b/admin/themes/default/template/include/datepicker.inc.tpl
@@ -11,7 +11,7 @@
{/if}
{html_head}
-<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/default/js/ui/themes/ui.datepicker.css">
+<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/default/js/ui/theme/ui.datepicker.css">
{/html_head}
<script type="text/javascript">
diff --git a/admin/themes/default/template/themes_installed.tpl b/admin/themes/default/template/themes_installed.tpl
index 8c0fca6fa..a231f39ff 100644
--- a/admin/themes/default/template/themes_installed.tpl
+++ b/admin/themes/default/template/themes_installed.tpl
@@ -31,7 +31,7 @@
<div class="themeShot"><img src="{$theme.screenshot}"></div>
<div class="themeActions">
<a href="{$activate_baseurl}{$theme.id}" title="{'Make this theme available to users'|@translate}">{'Activate'|@translate}</a>
- | <a href="{$delete_baseurl}{$theme.id}" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a>
+ | <a href="{$delete_baseurl}{$theme.id}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a>
</div>
</div>
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 45744e1f2..72bd807d0 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -32,14 +32,14 @@ include_once( PHPWG_ROOT_PATH .'include/functions_url.inc.php' );
include_once( PHPWG_ROOT_PATH .'include/functions_plugins.inc.php' );
//----------------------------------------------------------- generic functions
-function get_extra_fields($order_by_fields)
+function get_extra_fields($order_by_fields)
{
- $fields = str_ireplace(array(' order by ', ' desc', ' asc'),
+ $fields = str_ireplace(array(' order by ', ' desc', ' asc'),
array('', '', ''),
$order_by_fields
);
if (!empty($fields))
- {
+ {
$fields = ','.$fields;
}
return $fields;
@@ -414,33 +414,7 @@ function get_languages($target_charset = null)
{
list($language_name) = @file($path.'/iso.txt');
- $langdef = explode('.',$file);
- if (count($langdef)>1) // (langCode,encoding)
- {
- $langdef[1] = strtolower($langdef[1]);
-
- if (
- $target_charset==$langdef[1]
- or
- ($target_charset=='utf-8' and $langdef[1]=='iso-8859-1')
- or
- ($target_charset=='iso-8859-1' and
- in_array( substr($langdef[0],2), array('en','fr','de','es','it','nl')))
- )
- {
- $language_name = convert_charset($language_name,
- $langdef[1], $target_charset);
- $languages[ $langdef[0] ] = $language_name;
- }
- else
- continue; // the language encoding is not compatible with our charset
- }
- else
- { // UTF-8
- $language_name = convert_charset($language_name,
- 'utf-8', $target_charset);
- $languages[$file] = $language_name;
- }
+ $languages[$file] = convert_charset($language_name, $target_charset);
}
}
closedir($dir);
@@ -729,7 +703,7 @@ SELECT
// plugins want remove some themes based on user status maybe?
$themes = trigger_event('get_pwg_themes', $themes);
-
+
return $themes;
}
@@ -1240,28 +1214,12 @@ function load_language($filename, $dirname = '',
$target_charset = $options['target_charset'];
}
$target_charset = strtolower($target_charset);
- $source_charset = '';
$source_file = '';
foreach ($languages as $language)
{
- $dir = $dirname.$language;
-
- if ($target_charset!='utf-8')
- {
- // exact charset match - no conversion required
- $f = $dir.'.'.$target_charset.'/'.$filename;
- if (file_exists($f))
- {
- $source_file = $f;
- break;
- }
- }
-
- // UTF-8 ?
- $f = $dir.'/'.$filename;
+ $f = $dirname.$language.'/'.$filename;
if (file_exists($f))
{
- $source_charset = 'utf-8';
$source_file = $f;
break;
}
@@ -1279,7 +1237,7 @@ function load_language($filename, $dirname = '',
if ( !isset($lang) ) $lang=array();
if ( !isset($lang_info) ) $lang_info=array();
- if ( !empty($source_charset) and $source_charset!=$target_charset)
+ if ( 'utf-8'!=$target_charset)
{
if ( is_array($load_lang) )
{
@@ -1287,18 +1245,18 @@ function load_language($filename, $dirname = '',
{
if ( is_array($v) )
{
- $func = create_function('$v', 'return convert_charset($v, "'.$source_charset.'","'.$target_charset.'");' );
+ $func = create_function('$v', 'return convert_charset($v, "'.$target_charset.'");' );
$lang[$k] = array_map($func, $v);
}
else
- $lang[$k] = convert_charset($v, $source_charset, $target_charset);
+ $lang[$k] = convert_charset($v, $target_charset);
}
}
if ( is_array($load_lang_info) )
{
foreach ($load_lang_info as $k => $v)
{
- $lang_info[$k] = convert_charset($v, $source_charset, $target_charset);
+ $lang_info[$k] = convert_charset($v, $target_charset);
}
}
}
@@ -1312,10 +1270,7 @@ function load_language($filename, $dirname = '',
else
{
$content = @file_get_contents($source_file);
- if ( !empty($source_charset) and $source_charset!=$target_charset)
- {
- $content = convert_charset($content, $source_charset, $target_charset);
- }
+ $content = convert_charset($content, $target_charset);
return $content;
}
}
@@ -1323,30 +1278,27 @@ function load_language($filename, $dirname = '',
}
/**
- * converts a string from a character set to another character set
+ * converts a string from utf-8 character set to another character set
* @param string str the string to be converted
- * @param string source_charset the character set in which the string is encoded
* @param string dest_charset the destination character set
*/
-function convert_charset($str, $source_charset, $dest_charset)
+function convert_charset($str, $dest_charset)
{
- if ($source_charset==$dest_charset)
- return $str;
- if ($source_charset=='iso-8859-1' and $dest_charset=='utf-8')
+ if ($dest_charset=='utf-8')
{
- return utf8_encode($str);
+ return $str;
}
- if ($source_charset=='utf-8' and $dest_charset=='iso-8859-1')
+ if ($dest_charset=='iso-8859-1')
{
return utf8_decode($str);
}
if (function_exists('iconv'))
{
- return iconv($source_charset, $dest_charset, $str);
+ return iconv('utf-8', $dest_charset, $str);
}
if (function_exists('mb_convert_encoding'))
{
- return mb_convert_encoding( $str, $dest_charset, $source_charset );
+ return mb_convert_encoding( $str, $dest_charset, 'utf-8' );
}
return $str; //???
}