Skip to content

Commit

Permalink
bug 255: parameter values in #config limited to 255 chars (value beco…
Browse files Browse the repository at this point in the history
…mes text)

feature 303: page banner moved from combination of gallery_title, 
gallery_description and template to database (simplifies user customization)


git-svn-id: http://piwigo.org/svn/trunk@1071 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
rvelices committed Mar 9, 2006
1 parent b263f0c commit 316d89a
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 52 deletions.
2 changes: 1 addition & 1 deletion admin.php
Expand Up @@ -57,7 +57,7 @@
$opt_link = $link_start.'cat_options&section=';
//----------------------------------------------------- template initialization
$title = l10n('PhpWebGallery Administration'); // for include/page_header.php
$page['gallery_title'] = l10n('PhpWebGallery Administration');
$page['page_banner'] = '<h1>'.l10n('PhpWebGallery Administration').'</h1>';
$page['body_id'] = 'theAdminPage';
include(PHPWG_ROOT_PATH.'include/page_header.php');

Expand Down
37 changes: 20 additions & 17 deletions admin/configuration.php
Expand Up @@ -50,8 +50,12 @@
if (isset($_POST[$row['param']]))
{
$conf[$row['param']] = $_POST[$row['param']];
if ( 'page_banner'==$row['param'] )
{ // should we do it for all ?
$conf[$row['param']] = stripslashes( $conf[$row['param']] );
}
}
}
}
//------------------------------ verification and registration of modifications
if (isset($_POST['submit']))
{
Expand Down Expand Up @@ -105,7 +109,7 @@
break;
}
}

// updating configuration if no error found
if (count($page['errors']) == 0)
{
Expand All @@ -116,16 +120,15 @@
if (isset($_POST[$row['param']]))
{
$value = $_POST[$row['param']];

if ('gallery_title' == $row['param']
or 'gallery_description' == $row['param'])

if ('gallery_title' == $row['param'])
{
if (!$conf['allow_html_descriptions'])
{
$value = strip_tags($value);
}
}

$query = '
UPDATE '.CONFIG_TABLE.'
SET value = \''. str_replace("\'", "''", $value).'\'
Expand All @@ -152,7 +155,7 @@
'L_RESET'=>$lang['reset'],

'U_HELP' => PHPWG_ROOT_PATH.'/popuphelp.php?page=configuration',

'F_ACTION'=>$action
));

Expand All @@ -161,12 +164,12 @@
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"':'';
$lock_no = ($conf['gallery_locked']=='false')?'checked="checked"':'';

$template->assign_block_vars(
'general',
array(
Expand All @@ -178,7 +181,7 @@
($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_PAGE_BANNER' => $conf['page_banner'],
'CONF_GALLERY_URL' => $conf['gallery_url'],
));
break;
Expand All @@ -189,7 +192,7 @@
$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(
Expand All @@ -207,7 +210,7 @@
$show_no = ($conf['show_nb_comments']=='false')?'checked="checked"':'';
$expand_yes = ($conf['auto_expand']=='true')?'checked="checked"':'';
$expand_no = ($conf['auto_expand']=='false')?'checked="checked"':'';

$template->assign_block_vars(
'default',
array(
Expand All @@ -222,9 +225,9 @@
'SHOW_COMMENTS_YES'=>$show_yes,
'SHOW_COMMENTS_NO'=>$show_no
));

$blockname = 'default.language_option';

foreach (get_languages() as $language_code => $language_name)
{
if (isset($_POST['submit']))
Expand All @@ -241,7 +244,7 @@
{
$selected = '';
}

$template->assign_block_vars(
$blockname,
array(
Expand Down Expand Up @@ -269,7 +272,7 @@
{
$selected = '';
}

$template->assign_block_vars(
$blockname,
array(
Expand All @@ -280,7 +283,7 @@
);
}


break;
}
}
Expand Down
16 changes: 8 additions & 8 deletions include/page_header.php
Expand Up @@ -24,7 +24,7 @@
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+

//
// Start output of page
//
Expand All @@ -38,20 +38,20 @@
'GALLERY_TITLE' =>
isset($page['gallery_title']) ?
$page['gallery_title'] : $conf['gallery_title'],
'GALLERY_DESCRIPTION' =>
isset($page['gallery_description']) ?
$page['gallery_description'] : $conf['gallery_description'],

'PAGE_BANNER' =>
isset($page['page_banner']) ?
$page['page_banner'] : $conf['page_banner'],

'BODY_ID' =>
isset($page['body_id']) ?
$page['body_id'] : '',

'CONTENT_ENCODING' => $lang_info['charset'],
'PAGE_TITLE' => $title,
'LANG'=>$lang_info['code'],
'DIR'=>$lang_info['direction'],

'T_STYLE' => $css
));

Expand Down
2 changes: 1 addition & 1 deletion install/config.sql
Expand Up @@ -15,8 +15,8 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('auto_expand','fa
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_nb_comments','false','Show the number of comments under the thumbnails');
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');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('page_banner','<div id=\"theHeader\"><h1>PhpWebGallery demonstration site</h1><p>My photos web site</p></div>','html displayed on the top each page of your gallery');

73 changes: 73 additions & 0 deletions install/db/13-database.php
@@ -0,0 +1,73 @@
<?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 = '#config (gallery_description out page_banner in)';

$query = "
ALTER TABLE ".PREFIX_TABLE."config MODIFY COLUMN `value` TEXT;";
pwg_query($query);


$query = '
SELECT value
FROM '.PREFIX_TABLE.'config
WHERE param=\'gallery_title\'
;';
list($t) = array_from_query($query, 'value');

$query = '
SELECT value
FROM '.PREFIX_TABLE.'config
WHERE param=\'gallery_description\'
;';
list($d) = array_from_query($query, 'value');

$page_banner='<div id="theHeader"><h1>'.$t.'</h1><p>'.$d.'</p></div>';
$page_banner=addslashes($page_banner);
$query = '
INSERT INTO '.PREFIX_TABLE.'config (param,value,comment) VALUES (' .
"'page_banner','$page_banner','html displayed on the top each page of your gallery');";
pwg_query($query);

$query = '
DELETE FROM '.PREFIX_TABLE.'config
WHERE param=\'gallery_description\'
;';
pwg_query($query);


echo
"\n"
.'Table '.PREFIX_TABLE.'config updated'
."\n"
;
?>
2 changes: 1 addition & 1 deletion install/phpwebgallery_structure.sql
Expand Up @@ -78,7 +78,7 @@ CREATE TABLE `phpwebgallery_comments` (
DROP TABLE IF EXISTS `phpwebgallery_config`;
CREATE TABLE `phpwebgallery_config` (
`param` varchar(40) NOT NULL default '',
`value` varchar(255) default NULL,
`value` text,
`comment` varchar(255) default NULL,
PRIMARY KEY (`param`)
) TYPE=MyISAM COMMENT='configuration table';
Expand Down
1 change: 1 addition & 0 deletions language/en_UK.iso-8859-1/admin.lang.php
Expand Up @@ -118,6 +118,7 @@
$lang['Permission granted'] = 'Permission granted';
$lang['PhpWebGallery Administration'] = 'PhpWebGallery Administration';
$lang['PhpWebGallery version'] = 'PhpWebGallery version';
$lang['Page banner'] = 'Page banner';
$lang['Picture informations updated'] = 'Picture informations updated';
$lang['Position'] = 'Position';
$lang['Preferences'] = 'Preferences';
Expand Down
10 changes: 5 additions & 5 deletions language/en_UK.iso-8859-1/help/configuration.html
Expand Up @@ -13,11 +13,11 @@ <h3>General</h3>

<ul>

<li><strong>Gallery title</strong>: displayed on top of each public
page.</li>
<li><strong>Gallery title</strong>: used in RSS feed and notifications by
email.</li>

<li><strong>Gallery description</strong>: displayed under gallery
title.</li>
<li><strong>Page banner</strong>: displayed on top of each public
page.</li>

<li><strong>Gallery URL</strong>: used for the RSS feed.</li>

Expand All @@ -33,7 +33,7 @@ <h3>General</h3>

<li><strong>Rating</strong>: Picture rating feature is enabled.</li>

<li><strong>Rating by guests</strong>: Even non registered users can
<li><strong>Rating by guests</strong>: Even non registered users can
rate images.</li>

</ul>
Expand Down
1 change: 1 addition & 0 deletions language/fr_FR.iso-8859-1/admin.lang.php
Expand Up @@ -111,6 +111,7 @@
$lang['Order alphanumerically'] = 'Ordonner alphabético-numériquement';
$lang['Order by'] = 'Trier selon';
$lang['Other private categories'] = 'Autres catégories privées';
$lang['Page banner'] = 'Bannière des pages';
$lang['Parent category'] = 'Catégorie parente';
$lang['Path'] = 'Chemin';
$lang['Permission denied'] = 'Accès interdit';
Expand Down
10 changes: 5 additions & 5 deletions language/fr_FR.iso-8859-1/help/configuration.html
Expand Up @@ -13,11 +13,11 @@ <h2>Configuration</h2>

<ul>

<li><strong>Titre de la galerie</strong>: affiché en haut de chaque page
de la partie publique.</li>
<li><strong>Titre de la galerie</strong>: utilisé pour le flux RSS et
la notification par email.</li>

<li><strong>Description de la galerie</strong>: affiché en dessous du
titre de la galerie.</li>
<li><strong>Bannière des pages</strong>: code html affiché en haut des
pages.</li>

<li><strong>URL de la galerie</strong>: utilisé pour le flux RSS.</li>

Expand All @@ -33,7 +33,7 @@ <h2>Configuration</h2>

<li><strong>Notation</strong>: La notation des photos est possible.</li>

<li><strong>Notation par les visiteurs</strong>: Même les utilisateurs
<li><strong>Notation par les visiteurs</strong>: Même les utilisateurs
non enregistrés peuvent noter les images.</li>

</ul>
Expand Down
3 changes: 2 additions & 1 deletion popuphelp.php
Expand Up @@ -33,7 +33,8 @@
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );

$page['body_id'] = 'thePopuphelpPage';
$page['gallery_title'] = $title = l10n('PhpWebGallery Help');
$title = l10n('PhpWebGallery Help');
$page['page_banner'] = '<h1>'.$title.'</h1>';
include(PHPWG_ROOT_PATH.'include/page_header.php');

$template->set_filenames(
Expand Down
9 changes: 5 additions & 4 deletions search_rules.php
Expand Up @@ -45,7 +45,8 @@ function inc_exc_str($is_included)
include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );

$page['body_id'] = 'thePopuphelpPage';
$page['gallery_title'] = $title = l10n('PhpWebGallery Help');
$title = l10n('PhpWebGallery Help');
$page['page_banner'] = '<h1>'.$title.'</h1>';
include(PHPWG_ROOT_PATH.'include/page_header.php');

$template->set_filenames(array('search_rules' => 'search_rules.tpl'));
Expand Down Expand Up @@ -194,7 +195,7 @@ function inc_exc_str($is_included)
array(
'CONTENT' => sprintf(
l10n($lang_items['period']),

format_date($search['fields'][ $keys['after'] ]['date']),
inc_exc_str($search['fields'][ $keys['after'] ]['inc']),

Expand All @@ -211,7 +212,7 @@ function inc_exc_str($is_included)
array(
'CONTENT' => sprintf(
l10n($lang_items['before']),

format_date($search['fields'][ $keys['before'] ]['date']),
inc_exc_str($search['fields'][ $keys['before'] ]['inc'])
),
Expand All @@ -225,7 +226,7 @@ function inc_exc_str($is_included)
array(
'CONTENT' => sprintf(
l10n($lang_items['after']),

format_date($search['fields'][ $keys['after'] ]['date']),
inc_exc_str($search['fields'][ $keys['after'] ]['inc'])
)
Expand Down

0 comments on commit 316d89a

Please sign in to comment.