aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/page_tail.php20
-rw-r--r--include/picture_comment.inc.php69
-rw-r--r--include/picture_metadata.inc.php61
-rw-r--r--include/picture_rate.inc.php55
4 files changed, 63 insertions, 142 deletions
diff --git a/include/page_tail.php b/include/page_tail.php
index 57f884338..dcb9155a3 100644
--- a/include/page_tail.php
+++ b/include/page_tail.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -31,19 +31,14 @@ $template->assign_vars(
array(
'VERSION' => $conf['show_version'] ? PHPWG_VERSION : '',
'PHPWG_URL' => PHPWG_URL,
-
- 'L_TITLE_MAIL' => urlencode(l10n('title_send_mail')),
));
//--------------------------------------------------------------------- contact
if (!is_a_guest())
{
- $template->assign_block_vars(
- 'contact',
- array(
- 'MAIL' => get_webmaster_mail_address()
- )
+ $template->assign(
+ 'CONTACT_MAIL', get_webmaster_mail_address()
);
}
@@ -71,16 +66,11 @@ if ($conf['show_queries'])
$debug_vars = array_merge($debug_vars, array('QUERIES_LIST' => $debug) );
}
-if ( !empty($debug_vars) )
-{
- $template->assign_block_vars('debug',$debug_vars );
-}
+$template->assign('debug', $debug_vars );
trigger_action('loc_end_page_tail');
//
// Generate the page
//
-$template->parse('tail');
-
-$template->p();
+$template->pparse('tail');
?>
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index 1c6968e17..f966421c9 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -73,14 +73,10 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
trigger_error('Invalid comment action '.$comment_action, E_USER_WARNING);
}
- $block_var = ($comment_action=='reject') ? 'errors.error' : 'infos.info';
- foreach ($infos as $info)
- {
- $template->assign_block_vars(
- $block_var,
- array( 'TEXT'=>$info )
- );
- }
+ $template->assign(
+ ($comment_action=='reject') ? 'errors' : 'infos',
+ $infos
+ );
// allow plugins to notify what's going on
trigger_action( 'user_comment_insertion',
@@ -108,7 +104,7 @@ if ($page['show_comments'])
$page['start'] = 0;
}
- $page['navigation_bar'] = create_navigation_bar(
+ $navigation_bar = create_navigation_bar(
duplicate_picture_url(array(), array('start')),
$row['nb_comments'],
$page['start'],
@@ -116,11 +112,10 @@ if ($page['show_comments'])
true // We want a clean URL
);
- $template->assign_block_vars(
- 'comments',
+ $template->assign(
array(
- 'NB_COMMENT' => $row['nb_comments'],
- 'NAV_BAR' => $page['navigation_bar'],
+ 'COMMENT_COUNT' => $row['nb_comments'],
+ 'COMMENT_NAV_BAR' => $navigation_bar,
)
);
@@ -138,39 +133,33 @@ SELECT id,author,date,image_id,content
while ($row = mysql_fetch_array($result))
{
- $template->assign_block_vars(
- 'comments.comment',
+ $tpl_comment =
array(
- 'COMMENT_AUTHOR' => trigger_event('render_comment_author',
+ 'AUTHOR' => trigger_event('render_comment_author',
empty($row['author'])
? l10n('guest')
: $row['author']),
- 'COMMENT_DATE' => format_date(
+ 'DATE' => format_date(
$row['date'],
'mysql_datetime',
true),
- 'COMMENT' => trigger_event('render_comment_content',$row['content']),
- )
+ 'CONTENT' => trigger_event('render_comment_content',$row['content']),
);
if (is_admin())
{
- $template->assign_block_vars(
- 'comments.comment.delete',
- array(
- 'U_COMMENT_DELETE' =>
- add_url_params(
- $url_self,
- array(
- 'action'=>'delete_comment',
- 'comment_to_delete'=>$row['id']
- )
- )
- )
- );
+ $tpl_comment['U_DELETE'] =
+ add_url_params(
+ $url_self,
+ array(
+ 'action'=>'delete_comment',
+ 'comment_to_delete'=>$row['id']
+ )
+ );
}
+ $template->append('comments', $tpl_comment);
}
}
@@ -184,19 +173,13 @@ SELECT id,author,date,image_id,content
{
$content = htmlspecialchars($comm['content']);
}
- $template->assign_block_vars('comments.add_comment',
+ $template->assign('comment_add',
array(
+ 'F_ACTION' => $url_self,
'KEY' => $key,
- 'CONTENT' => $content
+ 'CONTENT' => $content,
+ 'SHOW_AUTHOR' => !is_classic_user()
));
-
- // display author field if the user status is guest or generic
- if (!is_classic_user())
- {
- $template->assign_block_vars(
- 'comments.add_comment.author_field', array()
- );
- }
}
}
diff --git a/include/picture_metadata.inc.php b/include/picture_metadata.inc.php
index 513ee55c5..861a1e2c5 100644
--- a/include/picture_metadata.inc.php
+++ b/include/picture_metadata.inc.php
@@ -2,10 +2,9 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -31,15 +30,15 @@
*/
include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
-$template->assign_block_vars('metadata', array());
if (($conf['show_exif']) and (function_exists('read_exif_data')))
{
if ($exif = @read_exif_data($picture['current']['image_path']))
{
$exif = trigger_event('format_exif_data', $exif, $picture['current'] );
- $template->assign_block_vars(
- 'metadata.headline',
- array('TITLE' => 'EXIF Metadata')
+
+ $tpl_meta = array(
+ 'TITLE' => 'EXIF Metadata',
+ 'lines' => array(),
);
foreach ($conf['show_exif_fields'] as $field)
@@ -53,14 +52,7 @@ if (($conf['show_exif']) and (function_exists('read_exif_data')))
{
$key = $lang['exif_field_'.$field];
}
-
- $template->assign_block_vars(
- 'metadata.line',
- array(
- 'KEY' => $key,
- 'VALUE' => $exif[$field]
- )
- );
+ $tpl_meta['lines'][$key] = $exif[$field];
}
}
else
@@ -73,19 +65,14 @@ if (($conf['show_exif']) and (function_exists('read_exif_data')))
{
$key = $lang['exif_field_'.$tokens[1]];
}
-
- $template->assign_block_vars(
- 'metadata.line',
- array(
- 'KEY' => $key,
- 'VALUE' => $exif[$tokens[0]][$tokens[1]]
- )
- );
+ $tpl_meta['lines'][$key] = $exif[$tokens[0]][$tokens[1]];
}
}
}
+ $template->append('metadata', $tpl_meta);
}
}
+
if ($conf['show_iptc'])
{
$iptc = get_iptc_data($picture['current']['image_path'],
@@ -93,27 +80,21 @@ if ($conf['show_iptc'])
if (count($iptc) > 0)
{
- $template->assign_block_vars(
- 'metadata.headline',
- array('TITLE' => 'IPTC Metadata')
+ $tpl_meta = array(
+ 'TITLE' => 'IPTC Metadata',
+ 'lines' => array(),
);
- }
- foreach ($iptc as $field => $value)
- {
- $key = $field;
- if (isset($lang[$field]))
+ foreach ($iptc as $field => $value)
{
- $key = $lang[$field];
+ $key = $field;
+ if (isset($lang[$field]))
+ {
+ $key = $lang[$field];
+ }
+ $tpl_meta['lines'][$key] = $value;
}
-
- $template->assign_block_vars(
- 'metadata.line',
- array(
- 'KEY' => $key,
- 'VALUE' => $value
- )
- );
+ $template->append('metadata', $tpl_meta);
}
}
diff --git a/include/picture_rate.inc.php b/include/picture_rate.inc.php
index 331cb41b0..4ffd0c8c1 100644
--- a/include/picture_rate.inc.php
+++ b/include/picture_rate.inc.php
@@ -2,10 +2,9 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -35,24 +34,12 @@ if ($conf['rate'])
$query = '
SELECT COUNT(rate) AS count
, ROUND(AVG(rate),2) AS average
- , ROUND(STD(rate),2) AS STD
+ , ROUND(STD(rate),2) AS std
FROM '.RATE_TABLE.'
WHERE element_id = '.$picture['current']['id'].'
;';
$row = mysql_fetch_array(pwg_query($query));
- if ($row['count'] == 0)
- {
- $value = l10n('no_rate');
- }
- else
- {
- $value = sprintf(
- l10n('%.2f (rated %d times, standard deviation = %.2f)'),
- $row['average'],
- $row['count'],
- $row['STD']
- );
- }
+ $template->assign('rate_summary', $row);
$user_rate = null;
if ($conf['rate_anonymous'] or is_autorize_status(ACCESS_CLASSIC) )
@@ -83,37 +70,17 @@ SELECT COUNT(rate) AS count
}
}
- $template->assign_block_vars(
- 'rate',
- array(
- 'SENTENCE' =>isset($user_rate) ? l10n('update_rate') : l10n('new_rate'),
- 'F_ACTION' => add_url_params(
+ $template->assign(
+ 'rating',
+ array(
+ 'F_ACTION' => add_url_params(
$url_self,
array('action'=>'rate')
- )
+ ),
+ 'USER_RATE'=> $user_rate,
+ 'marks' => $conf['rate_items']
)
);
-
- $template->assign_block_vars('info_rate', array('CONTENT' => $value));
-
- foreach ($conf['rate_items'] as $num => $mark)
- {
- $template->assign_block_vars(
- 'rate.rate_option',
- array(
- 'OPTION' => $mark,
- 'SEPARATOR' => ($num > 0 ? '|' : ''),
- )
- );
- if (isset($user_rate) and $user_rate==$mark)
- {
- $template->assign_block_vars('rate.rate_option.my_rate', array() );
- }
- else
- {
- $template->assign_block_vars('rate.rate_option.not_my_rate', array() );
- }
- }
}
}