aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-11-06 20:46:56 +0000
committerrvelices <rv-github@modusoptimus.com>2012-11-06 20:46:56 +0000
commit0251c5122ed92522577834566fc365449b5a7425 (patch)
treeb14b4b8e2b2520701c92c7b38cc964a00e176786
parent67748f5ccb5e8972076e479f41091b004b8e88ea (diff)
- fill add comment form fields only if the input comment has been rejected
- simplify templates git-svn-id: http://piwigo.org/svn/trunk@18950 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/picture_comment.inc.php44
-rw-r--r--themes/default/template/index.tpl6
-rw-r--r--themes/default/template/picture.tpl2
3 files changed, 29 insertions, 23 deletions
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index df823edbc..d7e8fbbcd 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -138,7 +138,7 @@ SELECT
'COMMENTS_ORDER_URL' => add_url_params( duplicate_picture_url(), array('comments_order'=> ($comments_order == 'ASC' ? 'DESC' : 'ASC') ) ),
'COMMENTS_ORDER_TITLE' => $comments_order == 'ASC' ? l10n('Show latest comments first') : l10n('Show oldest comments first'),
));
-
+
$query = '
SELECT
com.id,
@@ -167,13 +167,13 @@ SELECT
{
$row['author'] = l10n('guest');
}
-
+
$email = null;
if (!empty($row['user_email']))
{
$email = $row['user_email'];
}
- else if (!empty($row['email']))
+ elseif (!empty($row['email']))
{
$email = $row['email'];
}
@@ -220,7 +220,7 @@ SELECT
if (is_admin())
{
$tpl_comment['EMAIL'] = $email;
-
+
if ($row['validated'] != 'true')
{
$tpl_comment['U_VALIDATE'] = add_url_params(
@@ -250,20 +250,28 @@ SELECT
if ($show_add_comment_form)
{
$key = get_ephemeral_key(3, $page['image_id']);
-
- $template->assign('comment_add',
- array(
- 'F_ACTION' => $url_self,
- 'KEY' => $key,
- 'CONTENT' => stripslashes(@$_POST['content']),
- 'SHOW_AUTHOR' => !is_classic_user(),
- 'AUTHOR_MANDATORY' => $conf['comments_author_mandatory'],
- 'AUTHOR' => stripslashes(@$_POST['author']),
- 'WEBSITE_URL' => stripslashes(@$_POST['website_url']),
- 'SHOW_EMAIL' => !is_classic_user() or empty($user['email']),
- 'EMAIL_MANDATORY' => $conf['comments_email_mandatory'],
- 'EMAIL' => stripslashes(@$_POST['email']),
- ));
+
+ $tpl_var = array(
+ 'F_ACTION' => $url_self,
+ 'KEY' => $key,
+ 'CONTENT' => '',
+ 'SHOW_AUTHOR' => !is_classic_user(),
+ 'AUTHOR_MANDATORY' => $conf['comments_author_mandatory'],
+ 'AUTHOR' => '',
+ 'WEBSITE_URL' => '',
+ 'SHOW_EMAIL' => !is_classic_user() or empty($user['email']),
+ 'EMAIL_MANDATORY' => $conf['comments_email_mandatory'],
+ 'EMAIL' => '',
+ );
+
+ if ('reject'==@$comment_action)
+ {
+ foreach( array('content', 'author', 'website_url', 'email') as $k)
+ {
+ $tpl_var[strtoupper($k)] = htmlspecialchars( stripslashes(@$_POST[$k]) );
+ }
+ }
+ $template->assign('comment_add', $tpl_var);
}
}
diff --git a/themes/default/template/index.tpl b/themes/default/template/index.tpl
index 2f8e5c3aa..f9b286d5f 100644
--- a/themes/default/template/index.tpl
+++ b/themes/default/template/index.tpl
@@ -167,8 +167,7 @@ jQuery("#derivativeSwitchBox").on("mouseleave", function() {
{if !empty($CATEGORIES)}{$CATEGORIES}{/if}
{if !empty($cats_navbar)}
- {assign var=navbar value=$cats_navbar}
- {include file='navigation_bar.tpl'|@get_extent:'navbar'}
+ {include file='navigation_bar.tpl'|@get_extent:'navbar' navbar=$cats_navbar}
{/if}
{if !empty($THUMBNAILS)}
@@ -177,8 +176,7 @@ jQuery("#derivativeSwitchBox").on("mouseleave", function() {
</ul>
{/if}
{if !empty($thumb_navbar)}
- {assign var=navbar value=$thumb_navbar}
- {include file='navigation_bar.tpl'|@get_extent:'navbar'}
+ {include file='navigation_bar.tpl'|@get_extent:'navbar' navbar=$thumb_navbar}
{/if}
{if !empty($PLUGIN_INDEX_CONTENT_END)}{$PLUGIN_INDEX_CONTENT_END}{/if}
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index d393f5b89..7713c7555 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -2,7 +2,7 @@
{include file='include/autosize.inc.tpl'}
*}
{if isset($MENUBAR)}{$MENUBAR}{/if}
-<div id="content" {if isset($MENUBAR)}class="contentWithMenu"{/if}>
+<div id="content"{if isset($MENUBAR)} class="contentWithMenu"{/if}>
{if isset($errors) or not empty($infos)}
{include file='infos_errors.tpl'}
{/if}