aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-02-16 00:45:18 +0000
committerrvelices <rv-github@modusoptimus.com>2006-02-16 00:45:18 +0000
commitd22a07cee30b96f703ab2fa295a4c5f4407d0e00 (patch)
tree8c0545c3d30b38b18db20209fdd75b2587f29eb6
parent2a01c7472a31ef36435ac4ca6022bcdfda149802 (diff)
feature 264: gallery_url, rate and rate_anonymous from config file to database
git-svn-id: http://piwigo.org/svn/trunk@1044 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/configuration.php12
-rw-r--r--include/config_default.inc.php10
-rw-r--r--install/config.sql3
-rw-r--r--install/db/8-database.php88
-rw-r--r--language/en_UK.iso-8859-1/admin.lang.php6
-rw-r--r--language/en_UK.iso-8859-1/help/configuration.html7
-rw-r--r--language/fr_FR.iso-8859-1/admin.lang.php5
-rw-r--r--language/fr_FR.iso-8859-1/help/configuration.html7
-rw-r--r--template/yoga/admin/configuration.tpl19
9 files changed, 143 insertions, 14 deletions
diff --git a/admin/configuration.php b/admin/configuration.php
index 0d0ee4476..1a7850368 100644
--- a/admin/configuration.php
+++ b/admin/configuration.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | 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-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -60,6 +60,10 @@ if (isset($_POST['submit']))
{
case 'general' :
{
+ if ( !url_is_remote($_POST['gallery_url']) )
+ {
+ array_push($page['errors'], $lang['conf_gallery_url_error']);
+ }
break;
}
case 'comments' :
@@ -156,6 +160,8 @@ switch ($page['section'])
{
case 'general' :
{
+ $html_check='checked="checked"';
+
$history_yes = ($conf['log']=='true')?'checked="checked"':'';
$history_no = ($conf['log']=='false')?'checked="checked"':'';
$lock_yes = ($conf['gallery_locked']=='true')?'checked="checked"':'';
@@ -168,8 +174,12 @@ switch ($page['section'])
'HISTORY_NO'=>$history_no,
'GALLERY_LOCKED_YES'=>$lock_yes,
'GALLERY_LOCKED_NO'=>$lock_no,
+ ($conf['rate']=='true'?'RATE_YES':'RATE_NO')=>$html_check,
+ ($conf['rate_anonymous']=='true'
+ ? 'RATE_ANONYMOUS_YES' : 'RATE_ANONYMOUS_NO')=>$html_check,
'CONF_GALLERY_TITLE' => $conf['gallery_title'],
'CONF_GALLERY_DESCRIPTION' => $conf['gallery_description'],
+ 'CONF_GALLERY_URL' => $conf['gallery_url'],
));
break;
}
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 641cc190b..78121af0f 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -90,13 +90,6 @@ $conf['anti-flood_time'] = 60;
// catgory
$conf['calendar_datefield'] = 'date_creation';
-// rate : enable feature for rating elements
-$conf['rate'] = true;
-
-// rate_anonymous : visitors are able to rate pictures (requires
-// $conf['rate'] set to true)
-$conf['rate_anonymous'] = true;
-
// newcat_default_commentable : at creation, must a category be commentable
// or not ?
$conf['newcat_default_commentable'] = 'true';
@@ -171,9 +164,6 @@ $conf['allow_random_representative'] = false;
// category and element description.
$conf['allow_html_descriptions'] = true;
-// galery_url : URL given in RSS feed
-$conf['gallery_url'] = 'http://demo.phpwebgallery.net';
-
// prefix_thumbnail : string before filename. Thumbnail's prefix must only
// contain characters among : a to z (case insensitive), "-" or "_".
$conf['prefix_thumbnail'] = 'TN-';
diff --git a/install/config.sql b/install/config.sql
index 59ff1de28..4371d9fb2 100644
--- a/install/config.sql
+++ b/install/config.sql
@@ -16,4 +16,7 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_nb_comments
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('gallery_locked','false','Lock your gallery temporary for non admin users');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('gallery_title','PhpWebGallery demonstration site','Title at top of each page and for RSS feed');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('gallery_description','My photos web site','Short description displayed with gallery title');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('gallery_url','http://demo.phpwebgallery.net','URL given in RSS feed');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('rate','true','Rating pictures feature is enabled');
+INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('rate_anonymous','true','Rating pictures feature is also enabled for visitors');
diff --git a/install/db/8-database.php b/install/db/8-database.php
new file mode 100644
index 000000000..ecbc8bf5e
--- /dev/null
+++ b/install/db/8-database.php
@@ -0,0 +1,88 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | PhpWebGallery - a PHP based picture gallery |
+// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
+// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2006 Ruben ARNAUD - team@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 = 'Move rate, rate_anonymous and gallery_url from config file to database';
+
+$params = array(
+ 'gallery_url' => array('http://demo.phpwebgallery.net','URL given in RSS feed'),
+ 'rate' => array('true','Rating pictures feature is enabled') ,
+ 'rate_anonymous' => array('true','Rating pictures feature is also enabled for visitors')
+ );
+
+
+
+// +-Get real values from config file--------------------------------------+
+
+$conf_save = $conf;
+unset($conf);
+@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php');
+if ( isset($conf['gallery_url']) )
+{
+ $params['gallery_url'][0] = $conf['gallery_url'];
+}
+if ( isset($conf['rate']) and is_bool($conf['rate']) )
+{
+ $params['rate'][0] = $conf['rate'] ? 'true' : 'false';
+}
+if ( isset($conf['rate_anonymous']) and is_bool($conf['rate_anonymous']) )
+{
+ $params['rate_anonymous'][0] = $conf['rate_anonymous'] ? 'true' : 'false';
+}
+$conf = $conf_save;
+
+
+
+// +-Do I already have them in DB ?----------------------------------------+
+$query = 'SELECT param FROM '.PREFIX_TABLE.'config';
+$result = pwg_query($query);
+while ($row = mysql_fetch_array($result))
+{
+ unset( $params[ $row['param'] ] );
+}
+
+// +-Perform the insert query----------------------------------------------+
+foreach ($params as $param_key => $param_values)
+{
+ $query = '
+INSERT INTO '.PREFIX_TABLE.'config (param,value,comment) VALUES (' .
+"'$param_key','$param_values[0]','$param_values[1]');";
+ pwg_query($query);
+}
+
+
+echo
+"\n"
+.'Table '.PREFIX_TABLE.'config upgraded'
+."\n"
+;
+?>
diff --git a/language/en_UK.iso-8859-1/admin.lang.php b/language/en_UK.iso-8859-1/admin.lang.php
index 375695195..ed4a4d70d 100644
--- a/language/en_UK.iso-8859-1/admin.lang.php
+++ b/language/en_UK.iso-8859-1/admin.lang.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | 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-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -71,6 +71,7 @@ $lang['Empty caddie'] = 'Empty caddie';
$lang['Environment'] = 'Environment';
$lang['Expand all categories'] = 'Expand all categories';
$lang['Form'] = 'Form';
+$lang['Gallery URL'] = 'Gallery URL';
$lang['Gallery description'] = 'Gallery description';
$lang['Gallery title'] = 'Gallery title';
$lang['Grant selected groups'] = 'Grant selected groups';
@@ -120,6 +121,7 @@ $lang['Properties'] = 'Properties';
$lang['Random picture'] = 'Random picture';
$lang['Rate date'] = 'Rate date';
$lang['Rating'] = 'Rating';
+$lang['Rating by guests'] = 'Rating by guests';
$lang['Recent period'] = 'Recent period';
$lang['Registration date'] = 'Registration date';
$lang['Reject All'] = 'Reject All';
@@ -162,7 +164,6 @@ $lang['authorized'] = 'Authorized';
$lang['cat_add'] = 'Add a virtual category';
$lang['cat_comments_title'] = 'Authorize users to add comments on selected categories';
$lang['cat_error_name'] = 'The name of a category should not be empty';
-$lang['cat_image_info'] = 'Images info';
$lang['cat_lock_title'] = 'Lock categories';
$lang['cat_private'] = 'Private category';
$lang['cat_public'] = 'Public category';
@@ -178,6 +179,7 @@ $lang['conf_comments_title'] = 'Users comments';
$lang['conf_confirmation'] = 'Information data registered in database';
$lang['conf_default'] = 'Default display';
$lang['conf_default_title'] = 'Default display';
+$lang['conf_gallery_url_error'] = 'The gallery URL is not valid.';
$lang['conf_general_title'] = 'Main configuration';
$lang['conf_nb_comment_page_error'] = 'The number of comments a page must be between 5 and 50 included.';
$lang['config'] = 'Configuration';
diff --git a/language/en_UK.iso-8859-1/help/configuration.html b/language/en_UK.iso-8859-1/help/configuration.html
index 59da41881..4e6a73b5d 100644
--- a/language/en_UK.iso-8859-1/help/configuration.html
+++ b/language/en_UK.iso-8859-1/help/configuration.html
@@ -19,6 +19,8 @@ parameters by theme.</p>
<li><strong>Gallery description</strong>: displayed under gallery
title.</li>
+ <li><strong>Gallery URL</strong>: used for the RSS feed.</li>
+
<li><strong>History</strong>: visits on pages <span
class="pwgScreen">category.php</span> and <span
class="pwgScreen">picture.php</span> will be registered in
@@ -29,6 +31,11 @@ parameters by theme.</p>
maintenance. Only administrator users will be able to reach the
gallery.</li>
+ <li><strong>Rating</strong>: Picture rating feature is enabled.</li>
+
+ <li><strong>Rating by guests</strong>: Even non registered users can
+rate images.</li>
+
</ul>
diff --git a/language/fr_FR.iso-8859-1/admin.lang.php b/language/fr_FR.iso-8859-1/admin.lang.php
index c369d727f..a90bbdc11 100644
--- a/language/fr_FR.iso-8859-1/admin.lang.php
+++ b/language/fr_FR.iso-8859-1/admin.lang.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | 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-2006 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | branch : BSF (Best So Far)
// | file : $RCSfile$
@@ -71,6 +71,7 @@ $lang['Empty caddie'] = 'Vider le panier';
$lang['Environment'] = 'Environnement';
$lang['Expand all categories'] = 'Développer toutes les catégories';
$lang['Form'] = 'Formulaire';
+$lang['Gallery URL'] = 'URL de la galerie';
$lang['Gallery description'] = 'Description de la galerie';
$lang['Gallery title'] = 'Titre de la galerie';
$lang['Grant selected groups'] = 'Donner l\'accès aux groupes sélectionnés';
@@ -120,6 +121,7 @@ $lang['Properties'] = 'Propriétés';
$lang['Random picture'] = 'Au hasard';
$lang['Rate date'] = 'Date de notation';
$lang['Rating'] = 'Notation';
+$lang['Rating by guests'] = 'Notation par les visiteurs';
$lang['Recent period'] = 'Période récente';
$lang['Registration date'] = 'Date d\'enregistrement';
$lang['Reject All'] = 'Tout rejeter';
@@ -177,6 +179,7 @@ $lang['conf_comments_title'] = 'Commentaires utilisateur';
$lang['conf_confirmation'] = 'Informations enregistrées dans la base de données';
$lang['conf_default'] = 'Affichage par défaut';
$lang['conf_default_title'] = 'Affichage par défaut';
+$lang['conf_gallery_url_error'] = 'L\'adresse de la galerie n\'est pas valide.';
$lang['conf_general_title'] = 'Configuration principale';
$lang['conf_nb_comment_page_error'] = 'Le nombre de commentaires utilisateurs par page doit être compris entre 5 et 50.';
$lang['config'] = 'Configuration';
diff --git a/language/fr_FR.iso-8859-1/help/configuration.html b/language/fr_FR.iso-8859-1/help/configuration.html
index 5b35abd17..55b453e83 100644
--- a/language/fr_FR.iso-8859-1/help/configuration.html
+++ b/language/fr_FR.iso-8859-1/help/configuration.html
@@ -19,6 +19,8 @@ de la partie publique.</li>
<li><strong>Description de la galerie</strong>: affiché en dessous du
titre de la galerie.</li>
+ <li><strong>URL de la galerie</strong>: utilisé pour le flux RSS.</li>
+
<li><strong>Historique</strong>: visites des pages <span
class="pwgScreen">category.php</span> et <span
class="pwgScreen">picture.php</span> sont enregistrées dans la table
@@ -29,6 +31,11 @@ class="pwgScreen">Administration, Général, Historique</span>.</li>
galerie pour maintenance. Seul les administrateurs pourront accéder à la
galerie.</li>
+ <li><strong>Notation</strong>: La notation des photos est possible.</li>
+
+ <li><strong>Notation par les visiteurs</strong>: Même les utilisateurs
+non enregistrés peuvent noter les images.</li>
+
</ul>
diff --git a/template/yoga/admin/configuration.tpl b/template/yoga/admin/configuration.tpl
index 48fea4c1a..82982dfd4 100644
--- a/template/yoga/admin/configuration.tpl
+++ b/template/yoga/admin/configuration.tpl
@@ -24,6 +24,11 @@
</li>
<li>
+ <label for="gallery_title"><strong>{lang:Gallery URL}</strong></label>
+ <input type="text" maxlength="255" size="50" name="gallery_url" id="gallery_url" value="{general.CONF_GALLERY_URL}" />
+ </li>
+
+ <li>
<label><strong>{lang:History}</strong></label>
<input type="radio" class="radio" name="log" value="true" {general.HISTORY_YES} />{lang:Yes}
<input type="radio" class="radio" name="log" value="false" {general.HISTORY_NO} />{lang:No}
@@ -35,6 +40,20 @@
<input type="radio" class="radio" name="gallery_locked" value="false" {general.GALLERY_LOCKED_NO} />{lang:No}
</li>
</ul>
+
+ <ul>
+ <li>
+ <label><strong>{lang:Rating}</strong></label>
+ <input type="radio" class="radio" name="rate" value="true" {general.RATE_YES} />{lang:Yes}
+ <input type="radio" class="radio" name="rate" value="false" {general.RATE_NO} />{lang:No}
+ </li>
+
+ <li>
+ <label><strong>{lang:Rating by guests}</strong></label>
+ <input type="radio" class="radio" name="rate_anonymous" value="true" {general.RATE_ANONYMOUS_YES} />{lang:Yes}
+ <input type="radio" class="radio" name="rate_anonymous" value="false" {general.RATE_ANONYMOUS_NO} />{lang:No}
+ </li>
+ </ul>
<!-- END general -->
<!-- BEGIN comments -->