2004-11-15 21:42:55 +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 |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | 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. |
|
|
|
|
// | |
|
2004-11-15 21:42:55 +00:00
|
|
|
// | 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!");
|
|
|
|
}
|
2006-03-09 22:46:28 +00:00
|
|
|
|
|
|
|
include_once(PHPWG_ROOT_PATH.'admin/include/functions.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);
|
2005-08-17 14:25:38 +00:00
|
|
|
|
2004-11-15 21:42:55 +00:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | modification registration |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2005-08-17 14:25:38 +00:00
|
|
|
|
2004-11-15 21:42:55 +00:00
|
|
|
// print '<pre>';
|
|
|
|
// print_r($_POST);
|
|
|
|
// print '</pre>';
|
2004-11-30 20:36:20 +00:00
|
|
|
if (isset($_POST['falsify'])
|
|
|
|
and isset($_POST['cat_true'])
|
|
|
|
and count($_POST['cat_true']) > 0)
|
2004-11-15 21:42:55 +00:00
|
|
|
{
|
|
|
|
switch ($_GET['section'])
|
|
|
|
{
|
2007-03-07 22:21:35 +00:00
|
|
|
case 'comments' :
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
UPDATE '.CATEGORIES_TABLE.'
|
|
|
|
SET commentable = \'false\'
|
|
|
|
WHERE id IN ('.implode(',', $_POST['cat_true']).')
|
2004-11-15 21:42:55 +00:00
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'visible' :
|
|
|
|
{
|
2004-12-04 12:10:17 +00:00
|
|
|
set_cat_visible($_POST['cat_true'], 'false');
|
2004-11-23 22:31:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'status' :
|
|
|
|
{
|
2004-12-04 12:10:17 +00:00
|
|
|
set_cat_status($_POST['cat_true'], 'private');
|
2004-11-23 22:31:24 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-08-13 23:09:54 +00:00
|
|
|
case 'representative' :
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
UPDATE '.CATEGORIES_TABLE.'
|
|
|
|
SET representative_picture_id = NULL
|
|
|
|
WHERE id IN ('.implode(',', $_POST['cat_true']).')
|
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
break;
|
|
|
|
}
|
2004-11-23 22:31:24 +00:00
|
|
|
}
|
|
|
|
}
|
2004-11-30 20:36:20 +00:00
|
|
|
else if (isset($_POST['trueify'])
|
|
|
|
and isset($_POST['cat_false'])
|
|
|
|
and count($_POST['cat_false']) > 0)
|
2004-11-23 22:31:24 +00:00
|
|
|
{
|
|
|
|
switch ($_GET['section'])
|
|
|
|
{
|
2007-03-07 22:21:35 +00:00
|
|
|
case 'comments' :
|
|
|
|
{
|
|
|
|
$query = '
|
|
|
|
UPDATE '.CATEGORIES_TABLE.'
|
|
|
|
SET commentable = \'true\'
|
|
|
|
WHERE id IN ('.implode(',', $_POST['cat_false']).')
|
2004-11-23 22:31:24 +00:00
|
|
|
;';
|
|
|
|
pwg_query($query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'visible' :
|
|
|
|
{
|
2004-12-04 12:10:17 +00:00
|
|
|
set_cat_visible($_POST['cat_false'], 'true');
|
2004-11-15 21:42:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'status' :
|
|
|
|
{
|
2004-12-04 12:10:17 +00:00
|
|
|
set_cat_status($_POST['cat_false'], 'public');
|
2004-11-15 21:42:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-08-13 23:09:54 +00:00
|
|
|
case 'representative' :
|
|
|
|
{
|
|
|
|
// theoretically, all categories in $_POST['cat_false'] contain at
|
2008-05-14 22:25:36 +00:00
|
|
|
// least one element, so Piwigo can find a representant.
|
2005-08-13 23:09:54 +00:00
|
|
|
set_random_representant($_POST['cat_false']);
|
|
|
|
break;
|
|
|
|
}
|
2004-11-15 21:42:55 +00:00
|
|
|
}
|
|
|
|
}
|
2005-08-17 14:25:38 +00:00
|
|
|
|
2004-11-15 21:42:55 +00:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | template init |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
2005-08-17 14:25:38 +00:00
|
|
|
$template->set_filenames(
|
|
|
|
array(
|
2008-09-14 07:16:15 +00:00
|
|
|
'cat_options' => 'cat_options.tpl',
|
|
|
|
'double_select' => 'double_select.tpl'
|
2005-08-17 14:25:38 +00:00
|
|
|
)
|
|
|
|
);
|
2004-11-15 21:42:55 +00:00
|
|
|
|
2008-02-28 02:41:48 +00:00
|
|
|
$page['section'] = isset($_GET['section']) ? $_GET['section'] : 'status';
|
2004-11-15 21:42:55 +00:00
|
|
|
$base_url = PHPWG_ROOT_PATH.'admin.php?page=cat_options&section=';
|
2005-08-17 14:25:38 +00:00
|
|
|
|
2008-02-28 02:41:48 +00:00
|
|
|
$template->assign(
|
2004-11-15 21:42:55 +00:00
|
|
|
array(
|
2010-04-18 18:59:37 +00:00
|
|
|
'U_HELP' => get_root_url().'admin/popuphelp.php?page=cat_options',
|
2006-01-15 13:45:42 +00:00
|
|
|
'F_ACTION'=>$base_url.$page['section']
|
2004-11-15 21:42:55 +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('cat_options');
|
2008-02-28 23:41:47 +00:00
|
|
|
$tabsheet->select($page['section']);
|
|
|
|
$tabsheet->assign();
|
2007-03-07 22:53:42 +00:00
|
|
|
|
2004-11-15 21:42:55 +00:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | form display |
|
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
|
|
|
|
// for each section, categories in the multiselect field can be :
|
|
|
|
//
|
2011-01-13 15:24:18 +00:00
|
|
|
// - true : commentable for comment section
|
|
|
|
// - false : un-commentable for comment section
|
2004-11-15 21:42:55 +00:00
|
|
|
// - NA : (not applicable) for virtual categories
|
|
|
|
//
|
|
|
|
// for true and false status, we associates an array of category ids,
|
|
|
|
// function display_select_categories will use the given CSS class for each
|
|
|
|
// option
|
|
|
|
$cats_true = array();
|
|
|
|
$cats_false = array();
|
|
|
|
switch ($page['section'])
|
|
|
|
{
|
2007-03-07 22:21:35 +00:00
|
|
|
case 'comments' :
|
|
|
|
{
|
|
|
|
$query_true = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE commentable = \'true\'
|
|
|
|
;';
|
|
|
|
$query_false = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE commentable = \'false\'
|
|
|
|
;';
|
2008-02-28 02:41:48 +00:00
|
|
|
$template->assign(
|
2007-03-07 22:21:35 +00:00
|
|
|
array(
|
2010-09-21 21:14:54 +00:00
|
|
|
'L_SECTION' => l10n('Authorize users to add comments on selected albums'),
|
2010-03-02 14:54:22 +00:00
|
|
|
'L_CAT_OPTIONS_TRUE' => l10n('Authorized'),
|
|
|
|
'L_CAT_OPTIONS_FALSE' => l10n('Forbidden'),
|
2007-03-07 22:21:35 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
}
|
2004-11-15 21:42:55 +00:00
|
|
|
case 'visible' :
|
|
|
|
{
|
2004-11-23 22:31:24 +00:00
|
|
|
$query_true = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
2004-11-15 21:42:55 +00:00
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE visible = \'true\'
|
|
|
|
;';
|
2004-11-23 22:31:24 +00:00
|
|
|
$query_false = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
2004-11-15 21:42:55 +00:00
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE visible = \'false\'
|
|
|
|
;';
|
2008-02-28 02:41:48 +00:00
|
|
|
$template->assign(
|
2004-11-23 22:31:24 +00:00
|
|
|
array(
|
2010-09-19 19:50:02 +00:00
|
|
|
'L_SECTION' => l10n('Lock albums'),
|
2010-03-02 14:54:22 +00:00
|
|
|
'L_CAT_OPTIONS_TRUE' => l10n('Unlocked'),
|
|
|
|
'L_CAT_OPTIONS_FALSE' => l10n('Locked'),
|
2004-11-23 22:31:24 +00:00
|
|
|
)
|
|
|
|
);
|
2004-11-15 21:42:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'status' :
|
|
|
|
{
|
2004-11-23 22:31:24 +00:00
|
|
|
$query_true = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
2004-11-15 21:42:55 +00:00
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE status = \'public\'
|
|
|
|
;';
|
2004-11-23 22:31:24 +00:00
|
|
|
$query_false = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
2004-11-15 21:42:55 +00:00
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE status = \'private\'
|
|
|
|
;';
|
2008-02-28 02:41:48 +00:00
|
|
|
$template->assign(
|
2004-11-23 22:31:24 +00:00
|
|
|
array(
|
2010-09-21 21:14:54 +00:00
|
|
|
'L_SECTION' => l10n('Manage authorizations for selected albums'),
|
2010-09-19 19:50:02 +00:00
|
|
|
'L_CAT_OPTIONS_TRUE' => l10n('Public'),
|
|
|
|
'L_CAT_OPTIONS_FALSE' => l10n('Private'),
|
2004-11-23 22:31:24 +00:00
|
|
|
)
|
|
|
|
);
|
2005-08-13 23:09:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'representative' :
|
|
|
|
{
|
|
|
|
$query_true = '
|
|
|
|
SELECT id,name,uppercats,global_rank
|
|
|
|
FROM '.CATEGORIES_TABLE.'
|
|
|
|
WHERE representative_picture_id IS NOT NULL
|
|
|
|
;';
|
|
|
|
$query_false = '
|
2008-05-01 01:12:34 +00:00
|
|
|
SELECT DISTINCT id,name,uppercats,global_rank
|
|
|
|
FROM '.CATEGORIES_TABLE.' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id=category_id
|
|
|
|
WHERE representative_picture_id IS NULL
|
2005-08-13 23:09:54 +00:00
|
|
|
;';
|
2008-02-28 02:41:48 +00:00
|
|
|
$template->assign(
|
2005-08-13 23:09:54 +00:00
|
|
|
array(
|
2005-08-17 14:25:38 +00:00
|
|
|
'L_SECTION' => l10n('Representative'),
|
2005-08-13 23:09:54 +00:00
|
|
|
'L_CAT_OPTIONS_TRUE' => l10n('singly represented'),
|
- improvement: long localized messages are in HTML files instead of $lang
array. This is the case of admin/help and about pages.
- deletion: of unused functions (ts_to_mysqldt, is_image, TN_exists,
check_date_format, date_convert, get_category_directories,
get_used_metadata_list, array_remove, pwg_write_debug,
get_group_restrictions, get_all_group_restrictions, is_group_allowed,
style_select, deprecated_getAttribute).
- new: many new contextual help pages to replace descriptions previously
included in pages.
- modification: reorganisation of language files. Deletion of unused
language keys, alphabetical sort. No faq.lang.php anymore (replaced by
help.html). Only done for en_UK.iso-8859-1.
git-svn-id: http://piwigo.org/svn/trunk@862 68402e56-0260-453c-a942-63ccdbb3a9ee
2005-09-14 21:57:05 +00:00
|
|
|
'L_CAT_OPTIONS_FALSE' => l10n('randomly represented')
|
2005-08-13 23:09:54 +00:00
|
|
|
)
|
|
|
|
);
|
2004-11-15 21:42:55 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-11-23 22:31:24 +00:00
|
|
|
display_select_cat_wrapper($query_true,array(),'category_option_true');
|
|
|
|
display_select_cat_wrapper($query_false,array(),'category_option_false');
|
2005-08-17 14:25:38 +00:00
|
|
|
|
2004-11-15 21:42:55 +00:00
|
|
|
// +-----------------------------------------------------------------------+
|
|
|
|
// | sending html code |
|
|
|
|
// +-----------------------------------------------------------------------+
|
2005-08-17 14:25:38 +00:00
|
|
|
|
|
|
|
$template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
|
2004-11-15 21:42:55 +00:00
|
|
|
$template->assign_var_from_handle('ADMIN_CONTENT', 'cat_options');
|
|
|
|
?>
|