aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2008-08-20 00:35:22 +0000
committerrvelices <rv-github@modusoptimus.com>2008-08-20 00:35:22 +0000
commit5a6298548b194e0987cdccc8a11b04efa8c9fd61 (patch)
treea9cb03ff5870e6ed5a3e36d6ceead1391afa8587
parentdcbaefafdfb955f61c9b83eb8d2e15eea2880694 (diff)
- local.lang is loaded without fallback on default language or PHPWG_DEFAULT_LANGUAGE (needed to change the signature of load_language which became a little too big)
- move a function from functions.inc.php to functions_picture.inc.php (included only when necessary) - removed some css (not as much as I wanted) git-svn-id: http://piwigo.org/svn/trunk@2479 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--about.php2
-rw-r--r--admin/help.php2
-rw-r--r--include/common.inc.php2
-rw-r--r--include/functions.inc.php96
-rw-r--r--include/functions_mail.inc.php6
-rw-r--r--include/functions_picture.inc.php56
-rw-r--r--install.php6
-rw-r--r--nbm.php2
-rw-r--r--plugins/add_index/main.normal.inc.php2
-rw-r--r--plugins/language_switch/language_switch.inc.php6
-rw-r--r--popuphelp.php2
-rw-r--r--template-extension/distributed/samples/my-picture.tpl8
-rw-r--r--template/yoga/default-layout.css24
-rw-r--r--template/yoga/picture.css33
-rw-r--r--template/yoga/picture.tpl8
15 files changed, 131 insertions, 124 deletions
diff --git a/about.php b/about.php
index c44520f45..78bd20d96 100644
--- a/about.php
+++ b/about.php
@@ -63,7 +63,7 @@ if ( isset($lang['Theme: '.$user['theme']]) )
);
}
-$template->assign('ABOUT_MESSAGE', load_language('about.html','','',true) );
+$template->assign('ABOUT_MESSAGE', load_language('about.html','', array('return'=>true)) );
$template->pparse('about');
include(PHPWG_ROOT_PATH.'include/page_tail.php');
diff --git a/admin/help.php b/admin/help.php
index 051a10073..d42652a2e 100644
--- a/admin/help.php
+++ b/admin/help.php
@@ -28,5 +28,5 @@ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
// +-----------------------------------------------------------------------+
check_status(ACCESS_ADMINISTRATOR);
-$template->assign('ADMIN_CONTENT', load_language('help.html','','',true) );
+$template->assign('ADMIN_CONTENT', load_language('help.html','',array('return'=>true)) );
?>
diff --git a/include/common.inc.php b/include/common.inc.php
index d87b8728a..2e3d27ee3 100644
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -177,7 +177,7 @@ if ( is_admin() || (defined('IN_ADMIN') and IN_ADMIN) )
load_language('admin.lang');
}
trigger_action('loading_lang');
-load_language('local.lang');
+load_language('local.lang', '', array('no_fallback'=>true) );
// only now we can set the localized username of the guest user (and not in
// include/user.inc.php)
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 29a973466..3902bb890 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -239,62 +239,6 @@ function mkget_thumbnail_dir($dirname, &$errors)
return $tndir;
}
-// The get_picture_size function return an array containing :
-// - $picture_size[0] : final width
-// - $picture_size[1] : final height
-// The final dimensions are calculated thanks to the original dimensions and
-// the maximum dimensions given in parameters. get_picture_size respects
-// the width/height ratio
-function get_picture_size( $original_width, $original_height,
- $max_width, $max_height )
-{
- $width = $original_width;
- $height = $original_height;
- $is_original_size = true;
-
- if ( $max_width != "" )
- {
- if ( $original_width > $max_width )
- {
- $width = $max_width;
- $height = floor( ( $width * $original_height ) / $original_width );
- }
- }
- if ( $max_height != "" )
- {
- if ( $original_height > $max_height )
- {
- $height = $max_height;
- $width = floor( ( $height * $original_width ) / $original_height );
- $is_original_size = false;
- }
- }
- if ( is_numeric( $max_width ) and is_numeric( $max_height )
- and $max_width != 0 and $max_height != 0 )
- {
- $ratioWidth = $original_width / $max_width;
- $ratioHeight = $original_height / $max_height;
- if ( ( $ratioWidth > 1 ) or ( $ratioHeight > 1 ) )
- {
- if ( $ratioWidth < $ratioHeight )
- {
- $width = floor( $original_width / $ratioHeight );
- $height = $max_height;
- }
- else
- {
- $width = $max_width;
- $height = floor( $original_height / $ratioWidth );
- }
- $is_original_size = false;
- }
- }
- $picture_size = array();
- $picture_size[0] = $width;
- $picture_size[1] = $height;
- return $picture_size;
-}
-
/* Returns true if the string appears to be encoded in UTF-8. (from wordpress)
* @param string Str
*/
@@ -752,7 +696,7 @@ function redirect_html( $url , $msg = '', $refresh_time = 0)
$user = build_user( $conf['guest_id'], true);
load_language('common.lang');
trigger_action('loading_lang');
- load_language('local.lang');
+ load_language('local.lang', '', array('no_fallback'=>true) );
list($tmpl, $thm) = explode('/', get_default_template());
$template = new Template(PHPWG_ROOT_PATH.'template/'.$tmpl, $thm);
}
@@ -1394,17 +1338,19 @@ function get_pwg_charset()
*
* @param string filename
* @param string dirname
- * @param string language
- * @param bool return_content - if true the file content is returned otherwise
- * the file is evaluated as php
- * @return boolean success status or a string if return_content is true
+ * @param mixed options can contain
+ * language - language to load (if empty uses user language)
+ * return - if true the file content is returned otherwise the file is evaluated as php
+ * target_charset -
+ * no_fallback - the language must be respected
+ * @return boolean success status or a string if options['return'] is true
*/
-function load_language($filename, $dirname = '', $language = '',
- $return_content=false, $target_charset=null)
+function load_language($filename, $dirname = '',
+ $options = array() )
{
global $user;
- if (!$return_content)
+ if (! @$options['return'] )
{
$filename .= '.php'; //MAYBE to do .. load .po and .mo localization files
}
@@ -1415,25 +1361,33 @@ function load_language($filename, $dirname = '', $language = '',
$dirname .= 'language/';
$languages = array();
- if ( !empty($language) )
+ if ( !empty($options['language']) )
{
- $languages[] = $language;
+ $languages[] = $options['language'];
}
if ( !empty($user['language']) )
{
$languages[] = $user['language'];
}
- if ( defined('PHPWG_INSTALLED') )
+ if ( ! @$options['no_fallback'] )
{
- $languages[] = get_default_language();
+ if ( defined('PHPWG_INSTALLED') )
+ {
+ $languages[] = get_default_language();
+ }
+ $languages[] = PHPWG_DEFAULT_LANGUAGE;
}
- $languages[] = PHPWG_DEFAULT_LANGUAGE;
+
$languages = array_unique($languages);
- if ( empty($target_charset) )
+ if ( empty($options['target_charset']) )
{
$target_charset = get_pwg_charset();
}
+ else
+ {
+ $target_charset = $options['target_charset'];
+ }
$target_charset = strtolower($target_charset);
$source_charset = '';
$source_file = '';
@@ -1472,7 +1426,7 @@ function load_language($filename, $dirname = '', $language = '',
if ( !empty($source_file) )
{
- if (!$return_content)
+ if (! @$options['return'] )
{
@include($source_file);
$load_lang = @$lang;
diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php
index 9e7f9024d..d965fc8c5 100644
--- a/include/functions_mail.inc.php
+++ b/include/functions_mail.inc.php
@@ -246,12 +246,12 @@ function switch_lang_to($language)
$lang = array();
// language files
- load_language('common.lang', '', $language);
+ load_language('common.lang', '', array('language'=>$language) );
// No test admin because script is checked admin (user selected no)
// Translations are in admin file too
- load_language('admin.lang', '', $language);
+ load_language('admin.lang', '', array('language'=>$language) );
trigger_action('loading_lang');
- load_language('local.lang', '', $language);
+ load_language('local.lang', '', array('language'=>$language, 'no_fallback'=>true));
$switch_lang[$language]['lang_info'] = $lang_info;
$switch_lang[$language]['lang'] = $lang;
diff --git a/include/functions_picture.inc.php b/include/functions_picture.inc.php
index 1b6403ff3..d1c430fde 100644
--- a/include/functions_picture.inc.php
+++ b/include/functions_picture.inc.php
@@ -327,4 +327,60 @@ function encode_slideshow_params($decode_params = array())
return $result;
}
+// The get_picture_size function return an array containing :
+// - $picture_size[0] : final width
+// - $picture_size[1] : final height
+// The final dimensions are calculated thanks to the original dimensions and
+// the maximum dimensions given in parameters. get_picture_size respects
+// the width/height ratio
+function get_picture_size( $original_width, $original_height,
+ $max_width, $max_height )
+{
+ $width = $original_width;
+ $height = $original_height;
+ $is_original_size = true;
+
+ if ( $max_width != "" )
+ {
+ if ( $original_width > $max_width )
+ {
+ $width = $max_width;
+ $height = floor( ( $width * $original_height ) / $original_width );
+ }
+ }
+ if ( $max_height != "" )
+ {
+ if ( $original_height > $max_height )
+ {
+ $height = $max_height;
+ $width = floor( ( $height * $original_width ) / $original_height );
+ $is_original_size = false;
+ }
+ }
+ if ( is_numeric( $max_width ) and is_numeric( $max_height )
+ and $max_width != 0 and $max_height != 0 )
+ {
+ $ratioWidth = $original_width / $max_width;
+ $ratioHeight = $original_height / $max_height;
+ if ( ( $ratioWidth > 1 ) or ( $ratioHeight > 1 ) )
+ {
+ if ( $ratioWidth < $ratioHeight )
+ {
+ $width = floor( $original_width / $ratioHeight );
+ $height = $max_height;
+ }
+ else
+ {
+ $width = $max_width;
+ $height = floor( $original_height / $ratioWidth );
+ }
+ $is_original_size = false;
+ }
+ }
+ $picture_size = array();
+ $picture_size[0] = $width;
+ $picture_size[1] = $height;
+ return $picture_size;
+}
+
?>
diff --git a/install.php b/install.php
index a1c737c56..c83035522 100644
--- a/install.php
+++ b/install.php
@@ -206,9 +206,9 @@ else
}
}
-load_language( 'common.lang', '', $language, false, 'utf-8' );
-load_language( 'admin.lang', '', $language, false, 'utf-8' );
-load_language( 'install.lang', '', $language, false, 'utf-8' );
+load_language( 'common.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
+load_language( 'admin.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
+load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8') );
//----------------------------------------------------- template initialization
$template=new Template(PHPWG_ROOT_PATH.'template/yoga', 'clear');
diff --git a/nbm.php b/nbm.php
index b183bcb20..7e8008575 100644
--- a/nbm.php
+++ b/nbm.php
@@ -34,7 +34,7 @@ include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.p
load_language('admin.lang');
// Need to update a second time
trigger_action('loading_lang');
-load_language('local.lang');
+load_language('local.lang', '', array('no_fallback'=>true) );
diff --git a/plugins/add_index/main.normal.inc.php b/plugins/add_index/main.normal.inc.php
index 6f43c6e40..3a0592b92 100644
--- a/plugins/add_index/main.normal.inc.php
+++ b/plugins/add_index/main.normal.inc.php
@@ -33,7 +33,7 @@ class NormalAddIndex extends AddIndex
if (in_array($page, array('advanced_feature', 'site_manager')))
{
$help_content =
- load_language('help/'.$page.'.html', $this->path, '', true);
+ load_language('help/'.$page.'.html', $this->path, array('return'=>true) );
}
else
{
diff --git a/plugins/language_switch/language_switch.inc.php b/plugins/language_switch/language_switch.inc.php
index baaa0375a..d69db1c5e 100644
--- a/plugins/language_switch/language_switch.inc.php
+++ b/plugins/language_switch/language_switch.inc.php
@@ -57,11 +57,11 @@ function language_switch()
// Reload language only if it isn't the same one
if ( $same !== $user['language'])
{
- load_language('common.lang', '', $user['language']);
- load_language('local.lang', '', $user['language']);
+ load_language('common.lang', '', array('language'=>$user['language']) );
+ load_language('local.lang', '', array('language'=>$user['language'], 'no_fallback'=>true) );
if (defined('IN_ADMIN') and IN_ADMIN)
{
- load_language('admin.lang', '', $user['language']);
+ load_language('admin.lang', '', array('language'=>$user['language']) );
}
}
}
diff --git a/popuphelp.php b/popuphelp.php
index b452eadcf..1775d7b54 100644
--- a/popuphelp.php
+++ b/popuphelp.php
@@ -46,7 +46,7 @@ if
)
{
$help_content =
- load_language('help/'.$_GET['page'].'.html', '', '', true);
+ load_language('help/'.$_GET['page'].'.html', '', array('return'=>true) );
if ($help_content == false)
{
diff --git a/template-extension/distributed/samples/my-picture.tpl b/template-extension/distributed/samples/my-picture.tpl
index 4e81ff696..1f2f6f13d 100644
--- a/template-extension/distributed/samples/my-picture.tpl
+++ b/template-extension/distributed/samples/my-picture.tpl
@@ -22,13 +22,13 @@
</div>
{if isset($previous) }
-<a class="navThumb" id="thumbPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
- <img src="{$previous.THUMB_SRC}" class="thumbLink" id="linkPrev" alt="{$previous.TITLE}">
+<a class="navThumb" id="linkPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
+ <img src="{$previous.THUMB_SRC}" alt="{$previous.TITLE}">
</a>
{/if}
{if isset($next) }
-<a class="navThumb" id="thumbNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
- <img src="{$next.THUMB_SRC}" class="thumbLink" id="linkNext" alt="{$next.TITLE}">
+<a class="navThumb" id="linkNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
+ <img src="{$next.THUMB_SRC}" alt="{$next.TITLE}">
</a>
{/if}
diff --git a/template/yoga/default-layout.css b/template/yoga/default-layout.css
index 4e96abe5a..c8b77d12e 100644
--- a/template/yoga/default-layout.css
+++ b/template/yoga/default-layout.css
@@ -163,25 +163,25 @@ FORM.filter FIELDSET LABEL SPAN SELECT {
FORM.filter FIELDSET P
{
- clear: left;
- display: block;
+ clear: left;
+ display: block;
}
FORM.filter INPUT[type="submit"] {
- margin-top: 1em;
+ margin-top: 1em;
}
-FORM.properties UL, FORM#update UL {
- list-style-type: none;
- margin: 0;
- padding: 0;
+FORM.properties UL {
+ list-style-type: none;
+ margin: 0;
+ padding: 0;
}
-FORM.properties LI, FORM#update UL {
- margin-bottom: 0.5em;
- padding: 0;
- line-height: 1.8em;
- clear: left;
+FORM.properties LI {
+ margin-bottom: 0.5em;
+ padding: 0;
+ line-height: 1.8em;
+ clear: left;
}
FORM.properties SPAN.property {
diff --git a/template/yoga/picture.css b/template/yoga/picture.css
index 839760053..945d729a4 100644
--- a/template/yoga/picture.css
+++ b/template/yoga/picture.css
@@ -58,25 +58,22 @@
border-style: solid;
}
-.navThumb {
- margin-top: 2px;
-}
-#thumbPrev {
- float: left;
+#linkPrev {
+ float: left;
}
-#thumbNext {
- float: right;
+#linkNext {
+ float: right;
}
-#linkPrev {
- margin-right: 10px;
- margin-left: 5px;
+#linkPrev IMG {
+ margin-right: 10px;
+ margin-left: 5px;
}
-#linkNext {
- margin-right: 5px;
- margin-left: 10px;
+#linkNext IMG {
+ margin-right: 5px;
+ margin-left: 10px;
}
TABLE.infoTable .value {
@@ -96,17 +93,17 @@ TABLE.infoTable TD.value UL {
}
.rateButton, .rateButtonSelected, .rateButtonStarFull, .rateButtonStarEmpty {
- padding:0;
- border:0;
+ padding:0;
+ border:0;
}
.rateButton, .rateButtonStarFull, .rateButtonStarEmpty {
- cursor: pointer;
+ cursor: pointer;
}
.rateButtonSelected {
- font-weight:bold;
- font-size:120%;
+ font-weight:bold;
+ font-size:120%;
}
.rateButtonStarFull {
diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl
index aec446bd6..a807eb728 100644
--- a/template/yoga/picture.tpl
+++ b/template/yoga/picture.tpl
@@ -93,13 +93,13 @@ y.callService(
</div>
{if isset($previous) }
-<a class="navThumb" id="thumbPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
- <img src="{$previous.THUMB_SRC}" class="thumbLink" id="linkPrev" alt="{$previous.TITLE}">
+<a class="navThumb" id="linkPrev" href="{$previous.U_IMG}" title="{'previous_page'|@translate} : {$previous.TITLE}" rel="prev">
+ <img src="{$previous.THUMB_SRC}" alt="{$previous.TITLE}">
</a>
{/if}
{if isset($next) }
-<a class="navThumb" id="thumbNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
- <img src="{$next.THUMB_SRC}" class="thumbLink" id="linkNext" alt="{$next.TITLE}">
+<a class="navThumb" id="linkNext" href="{$next.U_IMG}" title="{'next_page'|@translate} : {$next.TITLE}" rel="next">
+ <img src="{$next.THUMB_SRC}" alt="{$next.TITLE}">
</a>
{/if}