aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2010-06-28 19:45:21 +0000
committerrvelices <rv-github@modusoptimus.com>2010-06-28 19:45:21 +0000
commit7125711f5958e81d66ef8a22eafddebc7fb9d5cd (patch)
treecafec267270321e0f58cf999e30c4646091ba696
parent3b946ffd160ef167c217d7f22517c052f1243f2a (diff)
merge r6414 from branch 2.1
favorite image icon is not taken from php but left to the theme git-svn-id: http://piwigo.org/svn/trunk@6615 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/section_init.inc.php4
-rw-r--r--picture.php68
-rw-r--r--themes/default/template/index.tpl2
-rw-r--r--themes/default/template/picture.tpl2
4 files changed, 27 insertions, 49 deletions
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 339c0ef5d..d0d815214 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -414,8 +414,6 @@ SELECT image_id
$template->assign(
'favorite',
array(
- 'FAVORITE_IMG' =>
- get_root_url().get_themeconf('icon_dir').'/del_all_favorites.png',
'U_FAVORITE' => add_url_params(
make_index_url( array('section'=>'favorites') ),
array('action'=>'remove_all_from_favorites')
@@ -632,4 +630,4 @@ if ( 'categories'==$page['section'] and isset($page['category']) )
}
trigger_action('loc_end_section_init');
-?>
+?> \ No newline at end of file
diff --git a/picture.php b/picture.php
index 9b94d8c73..2aa28f886 100644
--- a/picture.php
+++ b/picture.php
@@ -312,13 +312,13 @@ UPDATE '.CATEGORIES_TABLE.'
case 'edit_comment' :
{
check_pwg_token();
-
+
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
check_input_parameter('comment_to_edit', $_GET, false, PATTERN_ID);
$author_id = get_comment_author_id($_GET['comment_to_edit']);
-
+
if (can_manage_comment('edit', $author_id))
{
if (!empty($_POST['content']))
@@ -331,7 +331,7 @@ UPDATE '.CATEGORIES_TABLE.'
),
$_POST['key']
);
-
+
redirect($url_self);
}
else
@@ -344,35 +344,35 @@ UPDATE '.CATEGORIES_TABLE.'
case 'delete_comment' :
{
check_pwg_token();
-
+
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
-
+
check_input_parameter('comment_to_delete', $_GET, false, PATTERN_ID);
$author_id = get_comment_author_id($_GET['comment_to_delete']);
-
+
if (can_manage_comment('delete', $author_id))
{
delete_user_comment($_GET['comment_to_delete']);
}
-
+
redirect($url_self);
}
case 'validate_comment' :
{
check_pwg_token();
-
+
include_once(PHPWG_ROOT_PATH.'include/functions_comment.inc.php');
check_input_parameter('comment_to_validate', $_GET, false, PATTERN_ID);
-
+
$author_id = get_comment_author_id($_GET['comment_to_validate']);
-
+
if (can_manage_comment('validate', $author_id))
{
validate_user_comment($_GET['comment_to_validate']);
}
-
+
redirect($url_self);
}
@@ -796,39 +796,19 @@ SELECT COUNT(*) AS nb_fav
WHERE image_id = '.$page['image_id'].'
AND user_id = '.$user['id'].'
;';
- $result = pwg_query($query);
- $row = pwg_db_fetch_assoc($result);
+ $row = pwg_db_fetch_assoc( pwg_query($query) );
+ $is_favorite = $row['nb_fav'] != 0;
- if ($row['nb_fav'] == 0)
- {
- $template->assign(
- 'favorite',
- array(
- 'FAVORITE_IMG' =>
- get_root_url().get_themeconf('icon_dir').'/favorite.png',
- 'FAVORITE_HINT' => l10n('add this image to your favorites'),
- 'U_FAVORITE' => add_url_params(
- $url_self,
- array('action'=>'add_to_favorites')
- ),
- )
- );
- }
- else
- {
- $template->assign(
- 'favorite',
- array(
- 'FAVORITE_IMG' =>
- get_root_url().get_themeconf('icon_dir').'/del_favorite.png',
- 'FAVORITE_HINT' => l10n('delete this image from your favorites'),
- 'U_FAVORITE' => add_url_params(
- $url_self,
- array('action'=>'remove_from_favorites')
- ),
- )
- );
- }
+ $template->assign(
+ 'favorite',
+ array(
+ 'IS_FAVORITE' => $is_favorite,
+ 'U_FAVORITE' => add_url_params(
+ $url_self,
+ array('action'=> !$is_favorite ? 'add_to_favorites' : 'remove_from_favorites' )
+ ),
+ )
+ );
}
//--------------------------------------------------------- picture information
@@ -1017,4 +997,4 @@ else
//------------------------------------------------------------ log informations
pwg_log($picture['current']['id'], 'picture');
include(PHPWG_ROOT_PATH.'include/page_tail.php');
-?>
+?> \ No newline at end of file
diff --git a/themes/default/template/index.tpl b/themes/default/template/index.tpl
index 522113bc7..febc64abb 100644
--- a/themes/default/template/index.tpl
+++ b/themes/default/template/index.tpl
@@ -15,7 +15,7 @@
{/if}
{if isset($favorite) }
- <li><a href="{$favorite.U_FAVORITE}" title="{'delete all images from your favorites'|@translate}"><img src="{$favorite.FAVORITE_IMG}" class="button" alt="favorite" title="{'delete all images from your favorites'|@translate}"></a></li>
+ <li><a href="{$favorite.U_FAVORITE}" title="{'delete all images from your favorites'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/del_all_favorites.png" class="button" alt="favorite" title="{'delete all images from your favorites'|@translate}"></a></li>
{/if}
{if isset($U_CADDIE) }
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index 7e9a796ea..70eeb0fb8 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -50,7 +50,7 @@
{/if}
{if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}
{if isset($favorite) }
- <a href="{$favorite.U_FAVORITE}" title="{$favorite.FAVORITE_HINT}"><img src="{$favorite.FAVORITE_IMG}" class="button" alt="favorite" title="{$favorite.FAVORITE_HINT}"></a>
+ <a href="{$favorite.U_FAVORITE}" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/{if $favorite.IS_FAVORITE}del_favorite{else}favorite{/if}.png" class="button" alt="favorite" title="{if $favorite.IS_FAVORITE}{'delete this image from your favorites'|@translate}{else}{'add this image to your favorites'|@translate}{/if}"></a>
{/if}
{if !empty($U_SET_AS_REPRESENTATIVE) }
<a href="{$U_SET_AS_REPRESENTATIVE}" title="{'set as category representative'|@translate}"><img src="{$ROOT_URL}{$themeconf.icon_dir}/representative.png" class="button" alt="{'representative'|@translate}"></a>