aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/site_manager.php22
-rw-r--r--admin/site_update.php40
-rw-r--r--include/functions.inc.php22
3 files changed, 36 insertions, 48 deletions
diff --git a/admin/site_manager.php b/admin/site_manager.php
index 478041dbf..0f8ca7d41 100644
--- a/admin/site_manager.php
+++ b/admin/site_manager.php
@@ -63,7 +63,7 @@ function remote_output($url)
}
else
{
- array_push($page['errors'], get_lang('remote_site_file_not_found'));
+ array_push($page['errors'], l10n('remote_site_file_not_found'));
}
}
@@ -99,7 +99,7 @@ SELECT COUNT(id) AS count
if ($row['count'] > 0)
{
array_push($page['errors'],
- get_lang('remote_site_already_exists').' ['.$url.']');
+ l10n('remote_site_already_exists').' ['.$url.']');
}
if (count($page['errors']) == 0)
{
@@ -114,12 +114,12 @@ SELECT COUNT(id) AS count
if (!preg_match('/^PWG-INFO-2:/', $first_line))
{
array_push($page['errors'],
- get_lang('remote_site_error').' : '.$first_line);
+ l10n('remote_site_error').' : '.$first_line);
}
}
else
{
- array_push($page['errors'], get_lang('remote_site_file_not_found') );
+ array_push($page['errors'], l10n('remote_site_file_not_found') );
}
}
else
@@ -127,7 +127,7 @@ SELECT COUNT(id) AS count
if ( ! file_exists($url) )
{
array_push($page['errors'],
- get_lang('Directory does not exist').' ['.$url.']');
+ l10n('Directory does not exist').' ['.$url.']');
}
}
}
@@ -142,7 +142,7 @@ INSERT INTO '.SITES_TABLE.'
;';
pwg_query($query);
array_push($page['infos'],
- $url.' '.get_lang('remote_site_created'));
+ $url.' '.l10n('remote_site_created'));
}
}
@@ -165,21 +165,21 @@ SELECT galleries_url
{
case 'generate' :
{
- $title = $galleries_url.' : '.get_lang('remote_site_generate');
+ $title = $galleries_url.' : '.l10n('remote_site_generate');
$template->assign_vars(array('REMOTE_SITE_TITLE'=>$title));
remote_output($galleries_url.'create_listing_file.php?action=generate');
break;
}
case 'test' :
{
- $title = $galleries_url.' : '.get_lang('remote_site_test');
+ $title = $galleries_url.' : '.l10n('remote_site_test');
$template->assign_vars(array('REMOTE_SITE_TITLE'=>$title));
remote_output($galleries_url.'create_listing_file.php?action=test&version='.PHPWG_VERSION);
break;
}
case 'clean' :
{
- $title = $galleries_url.' : '.get_lang('remote_site_clean');
+ $title = $galleries_url.' : '.l10n('remote_site_clean');
$template->assign_vars(array('REMOTE_SITE_TITLE'=>$title));
remote_output($galleries_url.'create_listing_file.php?action=clean');
break;
@@ -188,7 +188,7 @@ SELECT galleries_url
{
delete_site($page['site']);
array_push($page['infos'],
- $galleries_url.' '.get_lang('remote_site_deleted'));
+ $galleries_url.' '.l10n('remote_site_deleted'));
break;
}
}
@@ -231,7 +231,7 @@ while ($row = mysql_fetch_array($result))
'sites.site',
array(
'NAME' => $row['galleries_url'],
- 'TYPE' => get_lang( $is_remote ? 'Remote' : 'Local' ),
+ 'TYPE' => l10n( $is_remote ? 'Remote' : 'Local' ),
'CATEGORIES' => $row['nb_categories'],
'IMAGES' => isset($row['nb_images']) ? $row['nb_images'] : 0,
'U_UPDATE' => $update_url
diff --git a/admin/site_update.php b/admin/site_update.php
index 5d37ed114..75e6ed9f7 100644
--- a/admin/site_update.php
+++ b/admin/site_update.php
@@ -50,17 +50,17 @@ list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
define('CURRENT_DATE', $dbnow);
$error_labels = array(
- 'PWG-UPDATE-1' => array( get_lang('update_wrong_dirname_short'),
- get_lang('update_wrong_dirname_info') ),
- 'PWG-UPDATE-2' => array( get_lang('update_missing_tn_short'),
- get_lang('update_missing_tn_info')
+ 'PWG-UPDATE-1' => array( l10n('update_wrong_dirname_short'),
+ l10n('update_wrong_dirname_info') ),
+ 'PWG-UPDATE-2' => array( l10n('update_missing_tn_short'),
+ l10n('update_missing_tn_info')
. implode(',', $conf['picture_ext']) ),
- 'PWG-ERROR-NO-FS' => array( get_lang('Does not exist'),
- get_lang('update_missing_file_or_dir_info')),
- 'PWG-ERROR-VERSION' => array( get_lang('Invalid PhpWebGalley version'),
- get_lang('update_pwg_version_differs_info')),
- 'PWG-ERROR-NOLISTING' => array( get_lang('remote_site_listing_not_found'),
- get_lang('remote_site_listing_not_found_info'))
+ 'PWG-ERROR-NO-FS' => array( l10n('Does not exist'),
+ l10n('update_missing_file_or_dir_info')),
+ 'PWG-ERROR-VERSION' => array( l10n('Invalid PhpWebGalley version'),
+ l10n('update_pwg_version_differs_info')),
+ 'PWG-ERROR-NOLISTING' => array( l10n('remote_site_listing_not_found'),
+ l10n('remote_site_listing_not_found_info'))
);
$errors = array();
$infos = array();
@@ -226,7 +226,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id
}
else
{
- $insert{'uploadable'} = false;
+ $insert{'uploadable'} = 'false';
}
$insert{'status'} = $conf{'newcat_default_status'};
$insert{'visible'} = $conf{'newcat_default_visible'};
@@ -259,7 +259,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id
array_push($inserts, $insert);
array_push($infos, array('path' => $fulldir,
- 'info' => get_lang('update_research_added')));
+ 'info' => l10n('update_research_added')));
// add the new category to $db_categories and $db_fulldirs array
$db_categories[$insert{'id'}] =
@@ -300,7 +300,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_id
array_push($to_delete, $db_fulldirs[$fulldir]);
unset($db_fulldirs[$fulldir]);
array_push($infos, array('path' => $fulldir,
- 'info' => get_lang('update_research_deleted')));
+ 'info' => l10n('update_research_deleted')));
}
if (count($to_delete) > 0)
{
@@ -416,7 +416,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
array('image_id' => $insert{'id'},
'category_id' => $insert{'storage_category_id'}));
array_push($infos, array('path' => $insert{'path'},
- 'info' => get_lang('update_research_added')));
+ 'info' => l10n('update_research_added')));
}
else
{
@@ -446,7 +446,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
array('image_id' => $insert{'id'},
'category_id' => $insert{'storage_category_id'}));
array_push($infos, array('path' => $insert{'path'},
- 'info' => get_lang('update_research_added')));
+ 'info' => l10n('update_research_added')));
}
}
@@ -474,7 +474,7 @@ SELECT IF(MAX(id)+1 IS NULL, 1, MAX(id)+1) AS next_element_id
{
array_push($to_delete_elements, array_search($path, $db_elements));
array_push($infos, array('path' => $path,
- 'info' => get_lang('update_research_deleted')));
+ 'info' => l10n('update_research_deleted')));
}
if (count($to_delete_elements) > 0)
{
@@ -663,7 +663,7 @@ $template->set_filenames(array('update'=>'admin/site_update.tpl'));
$result_title = '';
if (isset($simulate) and $simulate)
{
- $result_title.= get_lang('update_simulation_title').' ';
+ $result_title.= l10n('update_simulation_title').' ';
}
// used_metadata string is displayed to inform admin which metadata will be
@@ -671,15 +671,15 @@ if (isset($simulate) and $simulate)
$used_metadata = implode( ', ', $site_reader->get_update_attributes());
if ($site_is_remote and !isset($_POST['submit']) )
{
- $used_metadata.= ' + ' . get_lang('Aditionnal remote attributes');
+ $used_metadata.= ' + ' . l10n('Aditionnal remote attributes');
}
$template->assign_vars(
array(
'SITE_URL'=>$site_url,
'U_SITE_MANAGER'=> PHPWG_ROOT_PATH.'admin.php?page=site_manager',
- 'L_RESULT_UPDATE'=>$result_title.get_lang('update_part_research'),
- 'L_RESULT_METADATA'=>$result_title.get_lang('update_result_metadata'),
+ 'L_RESULT_UPDATE'=>$result_title.l10n('update_part_research'),
+ 'L_RESULT_METADATA'=>$result_title.l10n('update_result_metadata'),
'METADATA_LIST' => $used_metadata
));
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 49f1b44bd..b00d856ae 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -430,7 +430,7 @@ function format_date($date, $type = 'us', $show_time = false)
function pwg_query($query)
{
- global $conf,$page,$debug;
+ global $conf,$page,$debug,$t2;
$start = get_moment();
$result = mysql_query($query) or my_error($query."\n");
@@ -455,6 +455,8 @@ function pwg_query($query)
$output.= '<b>'.number_format($time, 3, '.', ' ').' s)</b>';
$output.= "\n".'(total SQL time : ';
$output.= number_format($page['queries_time'], 3, '.', ' ').' s)';
+ $output.= "\n".'(total time : ';
+ $output.= number_format( ($time+$start-$t2), 3, '.', ' ').' s)';
$output.= "</pre>\n";
$debug .= $output;
@@ -465,7 +467,7 @@ function pwg_query($query)
function pwg_debug( $string )
{
- global $debug,$t2,$count_queries;
+ global $debug,$t2,$page;
$now = explode( ' ', microtime() );
$now2 = explode( '.', $now[0] );
@@ -473,7 +475,7 @@ function pwg_debug( $string )
$time = number_format( $now2 - $t2, 3, '.', ' ').' s';
$debug .= '<p>';
$debug.= '['.$time.', ';
- $debug.= $count_queries.' queries] : '.$string;
+ $debug.= $page['count_queries'].' queries] : '.$string;
$debug.= "</p>\n";
}
@@ -974,20 +976,6 @@ SELECT '.$conf['user_fields']['email'].'
}
/**
- * returns the $str in current language if possible or $str enclosed
- * in special chars
- */
-function get_lang($str)
-{
- global $lang;
- if ( isset($lang[$str]) )
- {
- return $lang[$str];
- }
- return '@@'.$str.'@@';
-}
-
-/**
* which upgrades are available ?
*
* @return array