aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/configuration.php69
-rw-r--r--comments.php28
-rw-r--r--include/config_default.inc.php3
-rw-r--r--include/picture_comment.inc.php25
-rw-r--r--install/config.sql3
-rw-r--r--install/db/35-database.php62
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php3
-rw-r--r--language/fr_FR.iso-8859-1/admin.lang.php3
-rw-r--r--template/yoga/admin/configuration.tpl40
9 files changed, 190 insertions, 46 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index d92435cdf..50c001820 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -46,6 +46,22 @@ else
{
$page['section'] = $_GET['section'];
}
+
+$general_checkboxes = array(
+ 'log',
+ 'history_admin',
+ 'history_guest',
+ 'login_history',
+ 'email_admin_on_new_user'
+ );
+
+$comments_checkboxes = array(
+ 'comments_forall',
+ 'comments_validation',
+ 'email_admin_on_comment',
+ 'email_admin_on_comment_validation',
+ );
+
//------------------------------ verification and registration of modifications
if (isset($_POST['submit']) and !is_adviser())
{
@@ -58,10 +74,10 @@ if (isset($_POST['submit']) and !is_adviser())
{
array_push($page['errors'], $lang['conf_gallery_url_error']);
}
- $_POST['log'] = empty($_POST['log'])?'false':'true';
- $_POST['history_admin'] = empty($_POST['history_admin'])?'false':'true';
- $_POST['history_guest'] = empty($_POST['history_guest'])?'false':'true';
- $_POST['login_history'] = empty($_POST['login_history'])?'false':'true';
+ foreach( $general_checkboxes as $checkbox)
+ {
+ $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
+ }
break;
}
case 'comments' :
@@ -74,6 +90,10 @@ if (isset($_POST['submit']) and !is_adviser())
{
array_push($page['errors'], $lang['conf_nb_comment_page_error']);
}
+ foreach( $comments_checkboxes as $checkbox)
+ {
+ $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true';
+ }
break;
}
case 'default' :
@@ -160,26 +180,18 @@ $template->assign_vars(
'F_ACTION'=>$action
));
+$html_check='checked="checked"';
+
switch ($page['section'])
{
case 'general' :
{
- $html_check='checked="checked"';
-
$lock_yes = ($conf['gallery_locked']=='true')?'checked="checked"':'';
$lock_no = ($conf['gallery_locked']=='false')?'checked="checked"':'';
- $history_users = ($conf['log']=='true')?$html_check:'';
- $history_admin = ($conf['history_admin']=='true')?$html_check:'';
- $history_guest = ($conf['history_guest']=='true')?$html_check:'';
- $login_history = ($conf['login_history']=='true')?$html_check:'';
$template->assign_block_vars(
'general',
array(
- 'HISTORY_USERS'=>$history_users,
- 'HISTORY_ADMIN'=>$history_admin,
- 'HISTORY_GUEST'=>$history_guest,
- 'LOGIN_HISTORY'=>$login_history,
'GALLERY_LOCKED_YES'=>$lock_yes,
'GALLERY_LOCKED_NO'=>$lock_no,
($conf['rate']=='true'?'RATE_YES':'RATE_NO')=>$html_check,
@@ -189,24 +201,35 @@ switch ($page['section'])
'CONF_PAGE_BANNER' => $conf['page_banner'],
'CONF_GALLERY_URL' => $conf['gallery_url'],
));
+
+ foreach( $general_checkboxes as $checkbox)
+ {
+ $template->merge_block_vars(
+ 'general',
+ array(
+ strtoupper($checkbox) => ($conf[$checkbox]=='true')?$html_check:''
+ )
+ );
+ }
break;
}
case 'comments' :
{
- $all_yes = ($conf['comments_forall']=='true')?'checked="checked"':'';
- $all_no = ($conf['comments_forall']=='false')?'checked="checked"':'';
- $validate_yes = ($conf['comments_validation']=='true')?'checked="checked"':'';
- $validate_no = ($conf['comments_validation']=='false')?'checked="checked"':'';
-
$template->assign_block_vars(
'comments',
array(
'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'],
- 'COMMENTS_ALL_YES'=>$all_yes,
- 'COMMENTS_ALL_NO'=>$all_no,
- 'VALIDATE_YES'=>$validate_yes,
- 'VALIDATE_NO'=>$validate_no
));
+
+ foreach( $comments_checkboxes as $checkbox)
+ {
+ $template->merge_block_vars(
+ 'comments',
+ array(
+ strtoupper($checkbox) => ($conf[$checkbox]=='true')?$html_check:''
+ )
+ );
+ }
break;
}
case 'default' :
diff --git a/comments.php b/comments.php
index 8786605ef..4d9ca26db 100644
--- a/comments.php
+++ b/comments.php
@@ -155,28 +155,30 @@ else
// +-----------------------------------------------------------------------+
// | comments management |
// +-----------------------------------------------------------------------+
-if (is_admin() and !is_adviser() )
-{
- if (isset($_GET['delete']) and is_numeric($_GET['delete']) )
- {// comments deletion
- $query = '
+if (isset($_GET['delete']) and is_numeric($_GET['delete'])
+ and !is_adviser() )
+{// comments deletion
+ check_status(ACCESS_ADMINISTRATOR);
+ $query = '
DELETE FROM '.COMMENTS_TABLE.'
WHERE id='.$_GET['delete'].'
;';
- pwg_query($query);
- }
+ pwg_query($query);
+}
- if (isset($_GET['validate']) and is_numeric($_GET['validate']) )
- { // comments validation
- $query = '
+if (isset($_GET['validate']) and is_numeric($_GET['validate'])
+ and !is_adviser() )
+{ // comments validation
+ check_status(ACCESS_ADMINISTRATOR);
+ $query = '
UPDATE '.COMMENTS_TABLE.'
SET validated = \'true\'
- , validation_date = NOW()
+ , validation_date = NOW()
WHERE id='.$_GET['validate'].'
;';
- pwg_query($query);
- }
+ pwg_query($query);
}
+
// +-----------------------------------------------------------------------+
// | page header and options |
// +-----------------------------------------------------------------------+
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index d43323a4b..a8a439a9c 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -515,9 +515,6 @@ $conf['nbm_max_treatment_timeout_percent'] = 0.8;
// nbm_treatment_timeout_default is used by default
$conf['nbm_treatment_timeout_default'] = 20;
-// Send an email to the webmaster when a new user registers
-$conf['email_admin_on_new_user']=false;
-
// +-----------------------------------------------------------------------+
// | Set default admin layout |
// +-----------------------------------------------------------------------+
diff --git a/include/picture_comment.inc.php b/include/picture_comment.inc.php
index ed8818ff4..38c91c167 100644
--- a/include/picture_comment.inc.php
+++ b/include/picture_comment.inc.php
@@ -193,6 +193,31 @@ if ( $page['show_comments'] and isset( $_POST['content'] ) )
}
$template->assign_block_vars('information',
array('INFORMATION'=>$message));
+ if ( ($comment_action=='validate' and $conf['email_admin_on_comment'])
+ or $conf['email_admin_on_comment_validation'] )
+ {
+ include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+
+ $del_url = get_host_url().cookie_path()
+ .'comments.php?delete='.$comm['id'];
+
+ $content =
+ 'Author: '.$comm['author']."\n"
+ .'Comment: '.$comm['content']."\n"
+ .'IP: '.$comm['ip']."\n"
+ .'Browser: '.$comm['agent']."\n\n"
+ .'Delete: '.$del_url."\n";
+ if ($comment_action!='validate')
+ {
+ $content .=
+ 'Validate: '.get_host_url().cookie_path()
+ .'comments.php?validate='.$comm['id'];
+ }
+ pwg_mail( get_webmaster_mail_address(), '',
+ 'PWG comment by '.$comm['author'],
+ $content
+ );
+ }
}
else
{
diff --git a/install/config.sql b/install/config.sql
index 22fcd428d..e68887ac9 100644
--- a/install/config.sql
+++ b/install/config.sql
@@ -26,3 +26,6 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('login_history','
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_mail_as','','Send mail as param value for notification by mail');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_send_detailed_content','true','Send detailed content for notification by mail');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nbm_complementary_mail_content','','Complementary mail content for notification by mail');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to the admin when a user registers');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the admin when a valid comment is entered');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the admin when a comment requires validation'); \ No newline at end of file
diff --git a/install/db/35-database.php b/install/db/35-database.php
new file mode 100644
index 000000000..1041df459
--- /dev/null
+++ b/install/db/35-database.php
@@ -0,0 +1,62 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | 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 |
+// +-----------------------------------------------------------------------+
+// | branch : BSF (Best So Far)
+// | file : $RCSfile$
+// | last update : $Date: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $
+// | last modifier : $Author: plg $
+// | revision : $Revision: 870 $
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'Add email_admin_on_new_user, email_admin_on_comment, email_admin_on_comment_validation';
+
+include_once(PHPWG_ROOT_PATH.'include/constants.php');
+
+// +-----------------------------------------------------------------------+
+// | Upgrade content |
+// +-----------------------------------------------------------------------+
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_new_user','false','Send an email to the admin when a user registers');
+";
+pwg_query($query);
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_comment','false','Send an email to the admin when a valid comment is entered');
+";
+pwg_query($query);
+
+$query = "
+INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the admin when a comment requires validation');
+";
+pwg_query($query);
+
+echo
+"\n"
+.'"'.$upgrade_description.'"'.' ended'
+."\n"
+;
+
+?>
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index e42980f03..d439cbe51 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -81,6 +81,9 @@ $lang['Edit all picture informations'] = 'Edit all picture informations';
$lang['Edit selected tags'] = 'Edit selected tags';
$lang['Edit tags'] = 'Edit tags';
$lang['Elements'] = 'Elements';
+$lang['Email admin when a new user registers'] = 'Email admin when a new user registers';
+$lang['Email admin when a valid comment is entered'] = 'Email admin when a valid comment is entered';
+$lang['Email admin when a comment requires validation'] = 'Email admin when a comment requires validation';
$lang['Empty caddie'] = 'Empty caddie';
$lang['Environment'] = 'Environment';
$lang['Expand all categories'] = 'Expand all categories';
diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php
index 09fe8a129..98dd8d3d6 100644
--- a/language/fr_FR.iso-8859-1/admin.lang.php
+++ b/language/fr_FR.iso-8859-1/admin.lang.php
@@ -81,6 +81,9 @@ $lang['Edit all picture informations'] = 'Modifier toutes les informations liées
$lang['Edit selected tags'] = 'Editer les tags sélectionnés';
$lang['Edit tags'] = 'Editer les tags';
$lang['Elements'] = 'Éléments';
+$lang['Email admin when a new user registers'] = 'Notifier le webmestre lors de l\'inscription d\'un utilisateur';
+$lang['Email admin when a valid comment is entered'] = 'Notifier le webmestre quand un commentaire est enregistré';
+$lang['Email admin when a comment requires validation'] = 'Notifier le webmestre quand un commentaire requiert sa validation';
$lang['Empty caddie'] = 'Vider le panier';
$lang['Environment'] = 'Environnement';
$lang['Expand all categories'] = 'Développer toutes les catégories';
diff --git a/template/yoga/admin/configuration.tpl b/template/yoga/admin/configuration.tpl
index 99a034cf4..7f86f6e1b 100644
--- a/template/yoga/admin/configuration.tpl
+++ b/template/yoga/admin/configuration.tpl
@@ -53,11 +53,19 @@
</li>
<li>
+ <label>
+ <span class="property">{lang:Email admin when a new user registers}</span>
+ <input type="checkbox" name="email_admin_on_new_user" {general.EMAIL_ADMIN_ON_NEW_USER} />
+ </label>
+ </li>
+
+ <br/>
+ <li>
<fieldset>
<legend>{lang:History}</legend>
<ul>
<li>
- <label><span class="property">{lang:Users}</span><input type="checkbox" name="log" {general.HISTORY_USERS} /></label>
+ <label><span class="property">{lang:Users}</span><input type="checkbox" name="log" {general.LOG} /></label>
</li>
<li>
@@ -84,9 +92,10 @@
<ul>
<li>
- <span class="property">{lang:Comments for all}</span>
- <label><input type="radio" class="radio" name="comments_forall" value="true" {comments.COMMENTS_ALL_YES} />{lang:Yes}</label>
- <label><input type="radio" class="radio" name="comments_forall" value="false" {comments.COMMENTS_ALL_NO} />{lang:No}</label>
+ <label>
+ <span class="property">{lang:Comments for all}</span>
+ <input type="checkbox" name="comments_forall" {comments.COMMENTS_FORALL} />
+ </label>
</li>
<li>
@@ -97,10 +106,27 @@
</li>
<li>
- <span class="property">{lang:Validation}</span>
- <label><input type="radio" class="radio" name="comments_validation" value="true" {comments.VALIDATE_YES} />{lang:Yes}</label>
- <label><input type="radio" class="radio" name="comments_validation" value="false" {comments.VALIDATE_NO} />{lang:No}</label>
+ <label>
+ <span class="property">{lang:Validation}</span>
+ <input type="checkbox" name="comments_validation" {comments.COMMENTS_VALIDATION} />
+ </label>
</li>
+
+
+ <li>
+ <label>
+ <span class="property">{lang:Email admin when a valid comment is entered}</span>
+ <input type="checkbox" name="email_admin_on_comment" {comments.EMAIL_ADMIN_ON_COMMENT} />
+ </label>
+ </li>
+
+ <li>
+ <label>
+ <span class="property">{lang:Email admin when a comment requires validation}</span>
+ <input type="checkbox" name="email_admin_on_comment_validation" {comments.EMAIL_ADMIN_ON_COMMENT_VALIDATION} />
+ </label>
+ </li>
+
</ul>
</fieldset>
<!-- END comments -->