2004-02-11 23:20:38 +00:00
< ? php
// +-----------------------------------------------------------------------+
2011-01-18 00:02:52 +00:00
// | Piwigo - a PHP based photo gallery |
2008-04-04 22:57:23 +00:00
// +-----------------------------------------------------------------------+
2016-01-14 12:17:58 +01:00
// | Copyright(C) 2008-2016 Piwigo Team http://piwigo.org |
2008-04-04 22:57:23 +00:00
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
2004-02-11 23:20:38 +00:00
// | 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. |
// +-----------------------------------------------------------------------+
2003-07-01 09:27:20 +00:00
2004-09-19 22:26:41 +00:00
if ( ! defined ( " PHPWG_ROOT_PATH " ) )
2004-03-20 00:52:37 +00:00
{
2006-03-09 22:46:28 +00:00
die ( " Hacking attempt! " );
2004-03-20 00:52:37 +00:00
}
2004-09-19 22:26:41 +00:00
2006-03-09 22:46:28 +00:00
include_once ( PHPWG_ROOT_PATH . 'admin/include/functions.php' );
2012-01-12 21:37:28 +00:00
include_once ( PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php' );
2008-02-28 23:41:47 +00:00
include_once ( PHPWG_ROOT_PATH . 'admin/include/tabsheet.class.php' );
2006-03-09 22:46:28 +00:00
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
// +-----------------------------------------------------------------------+
check_status ( ACCESS_ADMINISTRATOR );
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
//-------------------------------------------------------- sections definitions
2012-04-07 21:02:56 +00:00
check_input_parameter ( 'section' , $_GET , false , '/^[a-z]+$/i' );
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
if ( ! isset ( $_GET [ 'section' ]))
{
2007-03-11 23:02:13 +00:00
$page [ 'section' ] = 'main' ;
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
}
else
{
$page [ 'section' ] = $_GET [ 'section' ];
}
2006-11-22 04:41:25 +00:00
2007-03-11 23:02:13 +00:00
$main_checkboxes = array (
2007-06-10 22:01:18 +00:00
'allow_user_registration' ,
'obligatory_user_mail_address' ,
2007-03-26 19:15:52 +00:00
'rate' ,
'rate_anonymous' ,
2006-12-13 01:05:38 +00:00
'email_admin_on_new_user' ,
2010-03-24 23:24:01 +00:00
'allow_user_customization' ,
2012-01-31 15:19:09 +00:00
'log' ,
'history_admin' ,
'history_guest' ,
2006-11-22 04:41:25 +00:00
);
2012-01-12 21:37:28 +00:00
$sizes_checkboxes = array (
'original_resize' ,
);
2006-11-22 04:41:25 +00:00
$comments_checkboxes = array (
2012-01-14 22:29:10 +00:00
'activate_comments' ,
2006-11-22 04:41:25 +00:00
'comments_forall' ,
'comments_validation' ,
'email_admin_on_comment' ,
'email_admin_on_comment_validation' ,
2009-06-23 13:44:58 +00:00
'user_can_delete_comment' ,
'user_can_edit_comment' ,
'email_admin_on_comment_edition' ,
2012-09-23 09:34:30 +00:00
'email_admin_on_comment_deletion' ,
'comments_author_mandatory' ,
'comments_email_mandatory' ,
2014-06-22 11:41:47 +00:00
'comments_enable_website' ,
2006-11-22 04:41:25 +00:00
);
2010-03-23 21:19:55 +00:00
$display_checkboxes = array (
'menubar_filter_icon' ,
'index_sort_order_input' ,
'index_flat_icon' ,
'index_posted_date_icon' ,
'index_created_date_icon' ,
'index_slideshow_icon' ,
2011-06-09 20:34:48 +00:00
'index_new_icon' ,
2010-03-23 21:19:55 +00:00
'picture_metadata_icon' ,
'picture_slideshow_icon' ,
'picture_favorite_icon' ,
2010-04-03 21:49:41 +00:00
'picture_download_icon' ,
2010-03-23 21:19:55 +00:00
'picture_navigation_icons' ,
'picture_navigation_thumb' ,
2011-05-07 15:55:10 +00:00
'picture_menu' ,
2010-03-23 21:19:55 +00:00
);
2010-03-24 00:39:34 +00:00
$display_info_checkboxes = array (
'author' ,
'created_on' ,
'posted_on' ,
'dimensions' ,
'file' ,
'filesize' ,
'tags' ,
'categories' ,
'visits' ,
2011-08-02 19:20:50 +00:00
'rating_score' ,
2010-04-08 20:21:17 +00:00
'privacy_level' ,
2010-03-24 00:39:34 +00:00
);
2012-08-01 19:03:17 +00:00
2011-07-01 13:19:35 +00:00
// image order management
$sort_fields = array (
2012-02-10 21:41:08 +00:00
'' => '' ,
2013-07-06 18:31:14 +00:00
'file ASC' => l10n ( 'File name, A → Z' ),
2012-03-31 10:27:25 +00:00
'file DESC' => l10n ( 'File name, Z → A' ),
2013-07-06 18:31:14 +00:00
'name ASC' => l10n ( 'Photo title, A → Z' ),
2012-03-31 10:27:25 +00:00
'name DESC' => l10n ( 'Photo title, Z → A' ),
'date_creation DESC' => l10n ( 'Date created, new → old' ),
2013-07-06 18:31:14 +00:00
'date_creation ASC' => l10n ( 'Date created, old → new' ),
2012-03-31 10:27:25 +00:00
'date_available DESC' => l10n ( 'Date posted, new → old' ),
2013-07-06 18:31:14 +00:00
'date_available ASC' => l10n ( 'Date posted, old → new' ),
2012-03-31 10:27:25 +00:00
'rating_score DESC' => l10n ( 'Rating score, high → low' ),
2013-07-06 18:31:14 +00:00
'rating_score ASC' => l10n ( 'Rating score, low → high' ),
2012-03-31 10:27:25 +00:00
'hit DESC' => l10n ( 'Visits, high → low' ),
2013-07-06 18:31:14 +00:00
'hit ASC' => l10n ( 'Visits, low → high' ),
'id ASC' => l10n ( 'Numeric identifier, 1 → 9' ),
2012-03-31 10:27:25 +00:00
'id DESC' => l10n ( 'Numeric identifier, 9 → 1' ),
2013-07-06 18:31:14 +00:00
'rank ASC' => l10n ( 'Manual sort order' ),
2011-06-09 14:32:20 +00:00
);
2012-08-01 19:03:17 +00:00
2012-02-17 19:30:52 +00:00
$comments_order = array (
'ASC' => l10n ( 'Show oldest comments first' ),
2012-02-17 19:44:01 +00:00
'DESC' => l10n ( 'Show latest comments first' ),
2012-02-17 19:30:52 +00:00
);
2013-11-07 15:30:59 +00:00
$mail_themes = array (
'clear' => 'Clear' ,
'dark' => 'Dark' ,
);
2010-03-24 00:39:34 +00:00
2003-05-09 12:42:42 +00:00
//------------------------------ verification and registration of modifications
2010-12-14 13:47:24 +00:00
if ( isset ( $_POST [ 'submit' ]))
2003-05-09 12:42:42 +00:00
{
2003-07-01 09:27:20 +00:00
$int_pattern = '/^\d+$/' ;
2007-03-28 19:57:00 +00:00
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
switch ( $page [ 'section' ])
2003-05-09 12:42:42 +00:00
{
2007-03-11 23:02:13 +00:00
case 'main' :
2012-08-01 19:03:17 +00:00
{
2011-07-01 13:19:35 +00:00
if ( ! isset ( $conf [ 'order_by_custom' ]) and ! isset ( $conf [ 'order_by_inside_category_custom' ]) )
2011-06-09 14:32:20 +00:00
{
2012-02-10 21:41:08 +00:00
if ( ! empty ( $_POST [ 'order_by' ]) )
2012-06-22 21:41:07 +00:00
{
2013-11-15 15:41:11 +00:00
$used = array ();
2012-06-22 21:41:07 +00:00
foreach ( $_POST [ 'order_by' ] as $i => $val )
{
2013-11-15 15:41:11 +00:00
if ( empty ( $val ) or isset ( $used [ $val ]))
{
unset ( $_POST [ 'order_by' ][ $i ]);
}
else
{
$used [ $val ] = true ;
}
2012-06-22 21:41:07 +00:00
}
if ( ! count ( $_POST [ 'order_by' ]) )
{
2013-10-19 17:43:04 +00:00
$page [ 'errors' ][] = l10n ( 'No order field selected' );
2012-06-22 21:41:07 +00:00
}
else
2012-01-10 20:50:25 +00:00
{
2012-06-22 21:41:07 +00:00
// limit to the number of available parameters
$order_by = $order_by_inside_category = array_slice ( $_POST [ 'order_by' ], 0 , ceil ( count ( $sort_fields ) / 2 ));
2012-08-01 19:03:17 +00:00
2012-06-22 21:41:07 +00:00
// there is no rank outside categories
2013-07-06 18:31:14 +00:00
if ( ( $i = array_search ( 'rank ASC' , $order_by )) !== false )
2012-06-22 21:41:07 +00:00
{
unset ( $order_by [ $i ]);
}
2012-08-01 19:03:17 +00:00
2012-06-22 21:41:07 +00:00
// must define a default order_by if user want to order by rank only
if ( count ( $order_by ) == 0 )
{
2013-07-06 18:31:14 +00:00
$order_by = array ( 'id ASC' );
2012-06-22 21:41:07 +00:00
}
2012-08-01 19:03:17 +00:00
2013-07-06 18:31:14 +00:00
$_POST [ 'order_by' ] = 'ORDER BY ' . implode ( ', ' , $order_by );
$_POST [ 'order_by_inside_category' ] = 'ORDER BY ' . implode ( ', ' , $order_by_inside_category );
2012-01-10 20:50:25 +00:00
}
2012-02-10 21:41:08 +00:00
}
else
{
2013-10-19 17:43:04 +00:00
$page [ 'errors' ][] = l10n ( 'No order field selected' );
2011-06-09 14:32:20 +00:00
}
}
2012-08-01 19:03:17 +00:00
2007-03-11 23:02:13 +00:00
foreach ( $main_checkboxes as $checkbox )
2006-11-22 04:41:25 +00:00
{
$_POST [ $checkbox ] = empty ( $_POST [ $checkbox ]) ? 'false' : 'true' ;
}
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
break ;
}
2012-04-29 07:34:44 +00:00
case 'watermark' :
{
2012-08-01 19:03:17 +00:00
include ( PHPWG_ROOT_PATH . 'admin/include/configuration_watermark_process.inc.php' );
2012-04-29 07:34:44 +00:00
break ;
}
2012-01-12 21:37:28 +00:00
case 'sizes' :
{
2012-08-01 19:03:17 +00:00
include ( PHPWG_ROOT_PATH . 'admin/include/configuration_sizes_process.inc.php' );
2012-01-12 21:37:28 +00:00
break ;
}
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
case 'comments' :
{
// the number of comments per page must be an integer between 5 and 50
// included
if ( ! preg_match ( $int_pattern , $_POST [ 'nb_comment_page' ])
or $_POST [ 'nb_comment_page' ] < 5
or $_POST [ 'nb_comment_page' ] > 50 )
{
2013-10-19 17:43:04 +00:00
$page [ 'errors' ][] = l10n ( 'The number of comments a page must be between 5 and 50 included.' );
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
}
2006-11-22 04:41:25 +00:00
foreach ( $comments_checkboxes as $checkbox )
{
$_POST [ $checkbox ] = empty ( $_POST [ $checkbox ]) ? 'false' : 'true' ;
}
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
break ;
}
case 'default' :
{
2007-03-28 19:57:00 +00:00
// Never go here
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
break ;
}
2010-03-23 21:19:55 +00:00
case 'display' :
{
2012-09-23 11:19:26 +00:00
if ( ! preg_match ( $int_pattern , $_POST [ 'nb_categories_page' ])
or $_POST [ 'nb_categories_page' ] < 4 )
{
2013-10-19 17:43:04 +00:00
$page [ 'errors' ][] = l10n ( 'The number of albums a page must be above 4.' );
2012-09-23 11:19:26 +00:00
}
2010-03-23 21:19:55 +00:00
foreach ( $display_checkboxes as $checkbox )
{
$_POST [ $checkbox ] = empty ( $_POST [ $checkbox ]) ? 'false' : 'true' ;
}
2010-03-24 00:39:34 +00:00
foreach ( $display_info_checkboxes as $checkbox )
{
$_POST [ 'picture_informations' ][ $checkbox ] =
empty ( $_POST [ 'picture_informations' ][ $checkbox ]) ? false : true ;
}
$_POST [ 'picture_informations' ] = addslashes ( serialize ( $_POST [ 'picture_informations' ]));
2010-03-23 21:19:55 +00:00
break ;
}
2003-05-09 12:42:42 +00:00
}
2006-03-09 01:57:13 +00:00
2004-09-20 20:08:15 +00:00
// updating configuration if no error found
2012-04-29 11:41:34 +00:00
if ( ! in_array ( $page [ 'section' ], array ( 'sizes' , 'watermark' )) and count ( $page [ 'errors' ]) == 0 )
2003-05-09 12:42:42 +00:00
{
2006-10-19 00:41:07 +00:00
//echo '<pre>'; print_r($_POST); echo '</pre>';
2007-01-23 22:03:06 +00:00
$result = pwg_query ( 'SELECT param FROM ' . CONFIG_TABLE );
2009-11-20 14:17:04 +00:00
while ( $row = pwg_db_fetch_assoc ( $result ))
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
{
if ( isset ( $_POST [ $row [ 'param' ]]))
{
2005-10-07 23:25:42 +00:00
$value = $_POST [ $row [ 'param' ]];
2006-03-09 01:57:13 +00:00
if ( 'gallery_title' == $row [ 'param' ])
2005-10-07 23:25:42 +00:00
{
if ( ! $conf [ 'allow_html_descriptions' ])
{
$value = strip_tags ( $value );
}
}
2006-03-09 01:57:13 +00:00
2004-09-20 20:08:15 +00:00
$query = '
UPDATE '.CONFIG_TABLE.'
2007-03-28 19:57:00 +00:00
SET value = \ '' . str_replace ( " \ ' " , " '' " , $value ) . ' \ '
WHERE param = \ '' . $row [ 'param' ] . ' \ '
2004-09-20 20:08:15 +00:00
; ' ;
2004-10-30 15:42:29 +00:00
pwg_query ( $query );
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
}
}
2013-10-19 17:43:04 +00:00
$page [ 'infos' ][] = l10n ( 'Information data registered in database' );
2003-05-09 12:42:42 +00:00
}
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
2007-01-23 22:03:06 +00:00
//------------------------------------------------------ $conf reinitialization
load_conf_from_db ();
2006-10-19 00:41:07 +00:00
}
2012-04-21 10:56:51 +00:00
// restore default derivatives settings
if ( 'sizes' == $page [ 'section' ] and isset ( $_GET [ 'action' ]) and 'restore_settings' == $_GET [ 'action' ])
2012-04-19 20:49:43 +00:00
{
ImageStdParams :: set_and_save ( ImageStdParams :: get_default_sizes () );
pwg_query ( 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param = \'disabled_derivatives\'' );
clear_derivative_cache ();
2012-04-21 10:56:51 +00:00
2013-10-19 17:43:04 +00:00
$page [ 'infos' ][] = l10n ( 'Your configuration settings are saved' );
2012-04-19 20:49:43 +00:00
}
2006-10-19 00:41:07 +00:00
2004-09-19 22:26:41 +00:00
//----------------------------------------------------- template initialization
2014-09-15 15:19:43 +00:00
$template -> set_filename ( 'config' , 'configuration_' . $page [ 'section' ] . '.tpl' );
2007-03-08 22:14:14 +00:00
2008-02-28 23:41:47 +00:00
// TabSheet
$tabsheet = new tabsheet ();
2012-07-23 10:03:14 +00:00
$tabsheet -> set_id ( 'configuration' );
2008-02-28 23:41:47 +00:00
$tabsheet -> select ( $page [ 'section' ]);
$tabsheet -> assign ();
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions)
- admin/configuration.php and its template have been higly simplificated by
making things more generic : for example, for each configuration
parameter, its name must correspond to the name we find in the config
table and belongs to a section, in the lang array we find :
- $lang['conf_<section>_<param>']
- $lang['conf_<section>_<param>_info']
- $lang['conf_<section>_<param>_error'] optionnaly
- more described message when connection to database server is impossible
- redefinitions of get_languages and get_templates functions
- deletion of configuration parameters : webmaster, session_keyword
- rename of configuration parameters :
- default_lang => default_language
- default_style => default_template
git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
2004-09-03 15:01:05 +00:00
2008-03-05 01:50:08 +00:00
$action = get_root_url () . 'admin.php?page=configuration' ;
2004-09-20 20:08:15 +00:00
$action .= '&section=' . $page [ 'section' ];
2008-03-21 01:01:25 +00:00
$template -> assign (
2004-09-20 20:08:15 +00:00
array (
2010-04-18 18:59:37 +00:00
'U_HELP' => get_root_url () . 'admin/popuphelp.php?page=configuration' ,
2006-01-15 13:45:42 +00:00
'F_ACTION' => $action
2004-09-20 20:08:15 +00:00
));
2003-07-01 09:27:20 +00:00
2004-09-19 22:26:41 +00:00
switch ( $page [ 'section' ])
2004-09-20 20:08:15 +00:00
{
2007-03-11 23:02:13 +00:00
case 'main' :
2012-08-01 19:03:17 +00:00
{
2011-07-01 13:19:35 +00:00
function order_by_is_local ()
2011-06-09 14:32:20 +00:00
{
2011-07-01 13:19:35 +00:00
@ include ( PHPWG_ROOT_PATH . 'local/config/config.inc.php' );
if ( isset ( $conf [ 'local_dir_site' ]))
{
@ include ( PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'config/config.inc.php' );
}
2012-08-01 19:03:17 +00:00
2011-07-01 13:19:35 +00:00
return isset ( $conf [ 'order_by' ]) or isset ( $conf [ 'order_by_inside_category' ]);
2011-06-09 14:32:20 +00:00
}
2012-08-01 19:03:17 +00:00
2011-07-01 13:19:35 +00:00
if ( order_by_is_local ())
2011-06-09 14:32:20 +00:00
{
2013-10-19 17:43:04 +00:00
$page [ 'warnings' ][] = l10n ( 'You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !' );
2011-06-09 14:32:20 +00:00
}
2012-08-01 19:03:17 +00:00
2011-07-01 13:19:35 +00:00
if ( isset ( $conf [ 'order_by_custom' ]) or isset ( $conf [ 'order_by_inside_category_custom' ]) )
2011-06-09 14:32:20 +00:00
{
2012-02-10 21:41:08 +00:00
$order_by = array ( '' );
2011-07-01 13:19:35 +00:00
$template -> assign ( 'ORDER_BY_IS_CUSTOM' , true );
2011-06-09 14:32:20 +00:00
}
else
{
2013-07-06 18:31:14 +00:00
$out = array ();
2011-07-01 13:19:35 +00:00
$order_by = trim ( $conf [ 'order_by_inside_category' ]);
$order_by = str_replace ( 'ORDER BY ' , null , $order_by );
2013-07-06 18:31:14 +00:00
$order_by = explode ( ', ' , $order_by );
2011-06-09 14:32:20 +00:00
}
2012-08-01 19:03:17 +00:00
2008-03-05 01:50:08 +00:00
$template -> assign (
2007-03-11 23:02:13 +00:00
'main' ,
2004-09-20 20:08:15 +00:00
array (
2007-05-18 23:36:55 +00:00
'CONF_GALLERY_TITLE' => htmlspecialchars ( $conf [ 'gallery_title' ]),
'CONF_PAGE_BANNER' => htmlspecialchars ( $conf [ 'page_banner' ]),
2011-01-12 13:41:55 +00:00
'week_starts_on_options' => array (
'sunday' => $lang [ 'day' ][ 0 ],
'monday' => $lang [ 'day' ][ 1 ],
),
'week_starts_on_options_selected' => $conf [ 'week_starts_on' ],
2013-11-07 15:30:59 +00:00
'mail_theme' => $conf [ 'mail_theme' ],
'mail_theme_options' => $mail_themes ,
2011-07-01 13:19:35 +00:00
'order_by' => $order_by ,
2012-02-10 21:41:08 +00:00
'order_by_options' => $sort_fields ,
2011-07-01 13:19:35 +00:00
)
);
2006-11-22 04:41:25 +00:00
2008-05-02 21:56:21 +00:00
foreach ( $main_checkboxes as $checkbox )
2006-11-22 04:41:25 +00:00
{
2008-03-05 01:50:08 +00:00
$template -> append (
2007-03-11 23:02:13 +00:00
'main' ,
2006-11-22 04:41:25 +00:00
array (
2008-03-05 01:50:08 +00:00
$checkbox => $conf [ $checkbox ]
),
true
2006-11-22 04:41:25 +00:00
);
}
2004-09-20 20:08:15 +00:00
break ;
}
case 'comments' :
{
2008-03-05 01:50:08 +00:00
$template -> assign (
2004-09-20 20:08:15 +00:00
'comments' ,
array (
'NB_COMMENTS_PAGE' => $conf [ 'nb_comment_page' ],
2012-01-15 17:05:30 +00:00
'comments_order' => $conf [ 'comments_order' ],
2012-02-17 19:30:52 +00:00
'comments_order_options' => $comments_order
2012-01-15 17:05:30 +00:00
)
);
2006-11-22 04:41:25 +00:00
2008-05-02 21:56:21 +00:00
foreach ( $comments_checkboxes as $checkbox )
2006-11-22 04:41:25 +00:00
{
2008-03-05 01:50:08 +00:00
$template -> append (
2006-11-22 04:41:25 +00:00
'comments' ,
array (
2008-03-05 01:50:08 +00:00
$checkbox => $conf [ $checkbox ]
),
true
2006-11-22 04:41:25 +00:00
);
}
2004-09-20 20:08:15 +00:00
break ;
}
case 'default' :
{
2010-04-29 12:55:46 +00:00
$edit_user = build_user ( $conf [ 'guest_id' ], false );
2007-03-28 19:57:00 +00:00
include_once ( PHPWG_ROOT_PATH . 'profile.php' );
2006-03-09 01:57:13 +00:00
2007-03-28 19:57:00 +00:00
$errors = array ();
2010-12-14 13:47:24 +00:00
if ( save_profile_from_post ( $edit_user , $errors ))
2005-09-03 16:36:05 +00:00
{
2010-12-14 13:47:24 +00:00
// Reload user
$edit_user = build_user ( $conf [ 'guest_id' ], false );
2013-10-19 17:43:04 +00:00
$page [ 'infos' ][] = l10n ( 'Information data registered in database' );
2005-09-03 16:36:05 +00:00
}
2007-03-28 19:57:00 +00:00
$page [ 'errors' ] = array_merge ( $page [ 'errors' ], $errors );
load_profile_in_template (
$action ,
'' ,
2014-08-15 16:14:43 +00:00
$edit_user ,
'GUEST_'
2007-03-28 19:57:00 +00:00
);
2008-03-05 01:50:08 +00:00
$template -> assign ( 'default' , array ());
2004-09-20 20:08:15 +00:00
break ;
}
2010-03-23 21:19:55 +00:00
case 'display' :
{
foreach ( $display_checkboxes as $checkbox )
{
$template -> append (
'display' ,
array (
$checkbox => $conf [ $checkbox ]
),
true
);
}
2010-03-24 00:39:34 +00:00
$template -> append (
'display' ,
array (
2012-09-23 11:19:26 +00:00
'picture_informations' => unserialize ( $conf [ 'picture_informations' ]),
'NB_CATEGORIES_PAGE' => $conf [ 'nb_categories_page' ],
2010-03-24 00:39:34 +00:00
),
true
);
2010-03-23 21:19:55 +00:00
break ;
}
2012-01-12 21:37:28 +00:00
case 'sizes' :
{
2012-04-19 14:43:30 +00:00
// we only load the derivatives if it was not already loaded: it occurs
// when submitting the form and an error remains
if ( ! isset ( $page [ 'sizes_loaded_in_tpl' ]))
2012-01-12 21:37:28 +00:00
{
2013-06-28 20:12:49 +00:00
$is_gd = ( pwg_image :: get_library () == 'gd' ) ? true : false ;
$template -> assign ( 'is_gd' , $is_gd );
2012-04-19 14:43:30 +00:00
$template -> assign (
2012-01-12 21:37:28 +00:00
'sizes' ,
array (
2012-04-19 14:43:30 +00:00
'original_resize_maxwidth' => $conf [ 'original_resize_maxwidth' ],
'original_resize_maxheight' => $conf [ 'original_resize_maxheight' ],
'original_resize_quality' => $conf [ 'original_resize_quality' ],
)
2012-01-12 21:37:28 +00:00
);
2012-08-01 19:03:17 +00:00
2012-04-19 14:43:30 +00:00
foreach ( $sizes_checkboxes as $checkbox )
2012-04-03 21:01:40 +00:00
{
2012-04-19 14:43:30 +00:00
$template -> append (
'sizes' ,
array (
$checkbox => $conf [ $checkbox ]
),
true
);
2012-04-03 21:01:40 +00:00
}
2012-08-01 19:03:17 +00:00
2012-04-19 14:43:30 +00:00
// derivatives = multiple size
$enabled = ImageStdParams :: get_defined_type_map ();
$disabled = @ unserialize ( @ $conf [ 'disabled_derivatives' ]);
if ( $disabled === false )
2012-04-03 21:01:40 +00:00
{
2012-04-19 14:43:30 +00:00
$disabled = array ();
2012-04-03 21:01:40 +00:00
}
2012-04-19 14:43:30 +00:00
$tpl_vars = array ();
foreach ( ImageStdParams :: get_all_types () as $type )
2012-04-03 21:01:40 +00:00
{
2012-04-19 14:43:30 +00:00
$tpl_var = array ();
2012-08-01 19:03:17 +00:00
2012-04-19 14:43:30 +00:00
$tpl_var [ 'must_square' ] = ( $type == IMG_SQUARE ? true : false );
2014-08-15 15:29:56 +00:00
$tpl_var [ 'must_enable' ] = ( $type == IMG_SQUARE || $type == IMG_THUMB || $type == $conf [ 'derivative_default_size' ]) ? true : false ;
2012-08-01 19:03:17 +00:00
2012-04-19 14:43:30 +00:00
if ( $params = @ $enabled [ $type ])
2012-04-03 21:01:40 +00:00
{
2012-04-19 14:43:30 +00:00
$tpl_var [ 'enabled' ] = true ;
2012-04-03 21:01:40 +00:00
}
else
{
2012-04-19 14:43:30 +00:00
$tpl_var [ 'enabled' ] = false ;
$params =@ $disabled [ $type ];
}
2012-08-01 19:03:17 +00:00
2012-04-19 14:43:30 +00:00
if ( $params )
{
list ( $tpl_var [ 'w' ], $tpl_var [ 'h' ]) = $params -> sizing -> ideal_size ;
if ( ( $tpl_var [ 'crop' ] = round ( 100 * $params -> sizing -> max_crop )) > 0 )
{
list ( $tpl_var [ 'minw' ], $tpl_var [ 'minh' ]) = $params -> sizing -> min_size ;
}
else
{
$tpl_var [ 'minw' ] = $tpl_var [ 'minh' ] = " " ;
}
$tpl_var [ 'sharpen' ] = $params -> sharpen ;
2012-04-03 21:01:40 +00:00
}
2012-04-19 14:43:30 +00:00
$tpl_vars [ $type ] = $tpl_var ;
2012-04-03 21:01:40 +00:00
}
2012-04-19 14:43:30 +00:00
$template -> assign ( 'derivatives' , $tpl_vars );
2012-05-02 04:29:56 +00:00
$template -> assign ( 'resize_quality' , ImageStdParams :: $quality );
2012-08-01 19:03:17 +00:00
$tpl_vars = array ();
$now = time ();
foreach ( ImageStdParams :: $custom as $custom => $time )
{
$tpl_vars [ $custom ] = ( $now - $time <= 24 * 3600 ) ? l10n ( 'today' ) : time_since ( $time , 'day' );
}
$template -> assign ( 'custom_derivatives' , $tpl_vars );
2012-04-03 21:01:40 +00:00
}
2012-01-12 21:37:28 +00:00
break ;
}
2012-04-29 07:34:44 +00:00
case 'watermark' :
{
$watermark_files = array ();
foreach ( glob ( PHPWG_ROOT_PATH . 'themes/default/watermarks/*.png' ) as $file )
{
$watermark_files [] = substr ( $file , strlen ( PHPWG_ROOT_PATH ));
}
2012-06-29 04:25:02 +00:00
if ( ( $glob = glob ( PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'watermarks/*.png' )) !== false )
2012-04-29 07:34:44 +00:00
{
2012-06-29 04:25:02 +00:00
foreach ( $glob as $file )
{
$watermark_files [] = substr ( $file , strlen ( PHPWG_ROOT_PATH ));
}
2012-04-29 07:34:44 +00:00
}
$watermark_filemap = array ( '' => '---' );
foreach ( $watermark_files as $file )
{
$display = basename ( $file );
$watermark_filemap [ $file ] = $display ;
}
$template -> assign ( 'watermark_files' , $watermark_filemap );
2012-04-29 11:41:34 +00:00
if ( $template -> get_template_vars ( 'watermark' ) === null )
2012-04-29 07:34:44 +00:00
{
2012-04-29 11:41:34 +00:00
$wm = ImageStdParams :: get_watermark ();
2012-04-29 07:34:44 +00:00
$position = 'custom' ;
2012-04-29 11:41:34 +00:00
if ( $wm -> xpos == 0 and $wm -> ypos == 0 )
{
$position = 'topleft' ;
}
if ( $wm -> xpos == 100 and $wm -> ypos == 0 )
{
$position = 'topright' ;
}
if ( $wm -> xpos == 50 and $wm -> ypos == 50 )
{
$position = 'middle' ;
}
if ( $wm -> xpos == 0 and $wm -> ypos == 100 )
{
$position = 'bottomleft' ;
}
if ( $wm -> xpos == 100 and $wm -> ypos == 100 )
{
$position = 'bottomright' ;
}
2012-08-01 19:03:17 +00:00
2015-10-15 22:05:20 +02:00
if ( $wm -> xrepeat != 0 || $wm -> yrepeat != 0 )
2012-04-29 11:41:34 +00:00
{
$position = 'custom' ;
}
2012-08-01 19:03:17 +00:00
2012-04-29 11:41:34 +00:00
$template -> assign (
'watermark' ,
array (
'file' => $wm -> file ,
'minw' => $wm -> min_size [ 0 ],
'minh' => $wm -> min_size [ 1 ],
'xpos' => $wm -> xpos ,
'ypos' => $wm -> ypos ,
'xrepeat' => $wm -> xrepeat ,
2015-10-15 22:05:20 +02:00
'yrepeat' => $wm -> yrepeat ,
2012-04-29 11:41:34 +00:00
'opacity' => $wm -> opacity ,
'position' => $position ,
)
);
2012-04-29 07:34:44 +00:00
}
2012-08-01 19:03:17 +00:00
2012-04-29 07:34:44 +00:00
break ;
}
2004-09-20 20:08:15 +00:00
}
2007-03-28 19:57:00 +00:00
2003-05-09 12:42:42 +00:00
//----------------------------------------------------------- sending html code
2004-03-20 00:52:37 +00:00
$template -> assign_var_from_handle ( 'ADMIN_CONTENT' , 'config' );
2004-02-11 23:20:38 +00:00
?>