Resolved issue 0000792: Admin "intro" : Integrity control bypass

Some sentences must be re-write ;-)

git-svn-id: http://piwigo.org/svn/trunk@2208 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rub 2008-02-13 20:13:12 +00:00
parent 42b184eed3
commit ea960a5563
11 changed files with 373 additions and 109 deletions

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@ -32,30 +32,51 @@
*/
function check_integrity()
{
global $page, $header_notes;
global $page, $header_notes, $conf;
add_event_handler('get_check_integrity', 'c13y_exif');
add_event_handler('get_check_integrity', 'c13y_user');
// Ignore list
$conf_c13y_ignore = unserialize($conf['c13y_ignore']);
if (
is_array($conf_c13y_ignore) and
isset($conf_c13y_ignore['version']) and
($conf_c13y_ignore['version'] == PHPWG_VERSION) and
is_array($conf_c13y_ignore['list'])
)
{
$ignore_list_changed = false;
$page['check_integrity']['ignore_list'] = $conf_c13y_ignore['list'];
}
else
{
$ignore_list_changed = true;
$page['check_integrity']['ignore_list'] = array();
}
$page['check_integrity'] = array();
$page['check_integrity'] = trigger_event('get_check_integrity',
$page['check_integrity']);
// Retrieve list
$page['check_integrity']['list'] = array();
$page['check_integrity']['build_ignore_list'] = array();
if (count($page['check_integrity']) > 0)
add_event_handler('list_check_integrity', 'c13y_exif');
add_event_handler('list_check_integrity', 'c13y_user');
trigger_action('list_check_integrity');
// Information
if (count($page['check_integrity']['list']) > 0)
{
$header_notes[] =
l10n_dec('c13y_anomaly_count', 'c13y_anomalies_count',
count($page['check_integrity']));
count($page['check_integrity']['list']));
}
// Treatments
if (!is_adviser())
{
if (isset($_POST['c13y_submit']) and isset($_POST['c13y_selection']))
if (isset($_POST['c13y_submit_correction']) and isset($_POST['c13y_selection']))
{
$corrected_count = 0;
$not_corrected_count = 0;
foreach ($page['check_integrity'] as $i => $c13y)
foreach ($page['check_integrity']['list'] as $i => $c13y)
{
if (!empty($c13y['correction_fct']) and
$c13y['is_callable'] and
@ -74,9 +95,9 @@ function check_integrity()
{
$args = array();
}
$page['check_integrity'][$i]['corrected'] = call_user_func_array($c13y['correction_fct'], $args);
$page['check_integrity']['list'][$i]['corrected'] = call_user_func_array($c13y['correction_fct'], $args);
if ($page['check_integrity'][$i]['corrected'])
if ($page['check_integrity']['list'][$i]['corrected'])
{
$corrected_count += 1;
}
@ -100,6 +121,42 @@ function check_integrity()
$not_corrected_count);
}
}
else
{
if (isset($_POST['c13y_submit_ignore']) and isset($_POST['c13y_selection']))
{
$ignored_count = 0;
foreach ($page['check_integrity']['list'] as $i => $c13y)
{
if (in_array($c13y['id'], $_POST['c13y_selection']))
{
$page['check_integrity']['build_ignore_list'][] = $c13y['id'];
$page['check_integrity']['list'][$i]['ignored'] = true;
$ignored_count += 1;
}
}
if ($ignored_count > 0)
{
$page['infos'][] =
l10n_dec('c13y_anomaly_ignored_count', 'c13y_anomalies_ignored_count',
$ignored_count);
}
}
}
}
$ignore_list_changed =
(
($ignore_list_changed) or
(count(array_diff($page['check_integrity']['ignore_list'], $page['check_integrity']['build_ignore_list'])) > 0) or
(count(array_diff($page['check_integrity']['build_ignore_list'], $page['check_integrity']['ignore_list'])) > 0)
);
if ($ignore_list_changed)
{
c13y_update_conf($page['check_integrity']['build_ignore_list']);
}
}
@ -113,14 +170,18 @@ function display_check_integrity()
{
global $template, $page;
$show_submit = false;
$check_automatic_correction = false;
$submit_automatic_correction = false;
$submit_ignore = false;
if (isset($page['check_integrity']) and count($page['check_integrity']) > 0)
if (isset($page['check_integrity']['list']) and count($page['check_integrity']['list']) > 0)
{
$template->set_filenames(array('check_integrity' => 'admin/check_integrity.tpl'));
foreach ($page['check_integrity'] as $i => $c13y)
foreach ($page['check_integrity']['list'] as $i => $c13y)
{
$can_select = false;
$template->assign_block_vars('c13y',
array(
'CLASS' => ($i % 2 == 1) ? 'row2' : 'row1',
@ -128,48 +189,82 @@ function display_check_integrity()
'ANOMALY' => $c13y['anomaly']
));
if (!empty($c13y['correction_fct']))
if (isset($c13y['ignored']))
{
if (isset($c13y['corrected']))
if ($c13y['ignored'])
{
if ($c13y['corrected'])
{
$template->assign_block_vars('c13y.correction_success_fct', array());
}
else
{
$template->assign_block_vars('c13y.correction_error_fct',
array('WIKI_FOROM_LINKS' => get_htlm_links_more_info()));
}
}
else if ($c13y['is_callable'])
{
$template->assign_block_vars('c13y.correction_fct', array());
$show_submit = true;
$template->assign_block_vars('c13y.ignore_msg', array());
}
else
{
$template->assign_block_vars('c13y.correction_bad_fct', array());
die('$c13y[\'ignored\'] cannot be false');
}
}
else
{
if (!empty($c13y['correction_fct']))
{
if (isset($c13y['corrected']))
{
if ($c13y['corrected'])
{
$template->assign_block_vars('c13y.correction_success_fct', array());
}
else
{
$template->assign_block_vars('c13y.correction_error_fct',
array('WIKI_FOROM_LINKS' => get_htlm_links_more_info()));
}
}
else if ($c13y['is_callable'])
{
$template->assign_block_vars('c13y.correction_fct', array());
$template->assign_block_vars('c13y_link_check_automatic_correction.c13y_do_check', array('ID' => $c13y['id']));
$submit_automatic_correction = true;
$can_select = true;
}
else
{
$template->assign_block_vars('c13y.correction_bad_fct', array());
$can_select = true;
}
}
else
{
$can_select = true;
}
if (!empty($c13y['correction_fct']) and !empty($c13y['correction_msg']))
{
$template->assign_block_vars('c13y.br', array());
}
if (!empty($c13y['correction_msg']) and !isset($c13y['corrected']))
{
$template->assign_block_vars('c13y.correction_msg',
array(
'DATA' => nl2br($c13y['correction_msg'])
));
}
}
if (!empty($c13y['correction_fct']) and !empty($c13y['correction_msg']))
if ($can_select)
{
$template->assign_block_vars('c13y.br', array());
}
if (!empty($c13y['correction_msg']) and !isset($c13y['corrected']))
{
$template->assign_block_vars('c13y.correction_msg',
array(
'DATA' => nl2br($c13y['correction_msg'])
));
$template->assign_block_vars('c13y.can_select', array());
$submit_ignore = true;
}
}
if ($show_submit)
if ($submit_automatic_correction)
{
$template->assign_block_vars('c13y_submit', array());
$template->assign_block_vars('c13y_submit_automatic_correction', array());
}
if ($submit_ignore)
{
$template->assign_block_vars('c13y_link_check_uncheck', array());
$template->assign_block_vars('c13y_submit_ignore', array());
}
$template->concat_var_from_handle('ADMIN_CONTENT', 'check_integrity');
@ -182,16 +277,53 @@ function display_check_integrity()
* @param anomaly arguments
* @return c13y anomaly array
*/
function get_c13y($anomaly, $correction_fct = null, $correction_fct_args = null, $correction_msg = null)
function add_c13y($anomaly, $correction_fct = null, $correction_fct_args = null, $correction_msg = null)
{
return
array(
'id' => md5($anomaly.$correction_fct.serialize($correction_fct_args).$correction_msg),
'anomaly' => $anomaly,
'correction_fct' => $correction_fct,
'correction_fct_args' => $correction_fct_args,
'correction_msg' => $correction_msg,
'is_callable' => is_callable($correction_fct));
global $page;
$id = md5($anomaly.$correction_fct.serialize($correction_fct_args).$correction_msg);
if (in_array($id, $page['check_integrity']['ignore_list']))
{
$page['check_integrity']['build_ignore_list'][] = $id;
}
else
{
$page['check_integrity']['list'][] =
array(
'id' => $id,
'anomaly' => $anomaly,
'correction_fct' => $correction_fct,
'correction_fct_args' => $correction_fct_args,
'correction_msg' => $correction_msg,
'is_callable' => is_callable($correction_fct));
}
}
/**
* Update table config
*
* @param ignore list array
* @return void
*/
function c13y_update_conf($ignore_list = array())
{
$conf_c13y_ignore = array();
$conf_c13y_ignore['version'] = PHPWG_VERSION;
$conf_c13y_ignore['list'] = $ignore_list;
$query = 'update '.CONFIG_TABLE.' set value =\''.serialize($conf_c13y_ignore).'\'where param = \'c13y_ignore\';';
pwg_query($query);
}
/**
* Apply maintenance
*
* @param void
* @return void
*/
function c13y_maintenance()
{
c13y_update_conf();
}
/**
@ -216,10 +348,10 @@ function get_htlm_links_more_info()
/**
* Check exif
*
* @param c13y anomalies array
* @return c13y anomalies array
* @param void
* @return void
*/
function c13y_exif($c13y_array)
function c13y_exif()
{
global $conf;
@ -227,7 +359,7 @@ function c13y_exif($c13y_array)
{
if (($conf[$value]) and (!function_exists('read_exif_data')))
{
$c13y_array[] = get_c13y(
add_c13y(
sprintf(l10n('c13y_exif_anomaly'), '$conf[\''.$value.'\']'),
null,
null,
@ -236,17 +368,15 @@ function c13y_exif($c13y_array)
get_htlm_links_more_info());
}
}
return $c13y_array;
}
/**
* Check user
*
* @param c13y anomalies array
* @return c13y anomalies array
* @param void
* @return void
*/
function c13y_user($c13y_array)
function c13y_user()
{
global $conf;
@ -290,18 +420,16 @@ where
{
if (!array_key_exists($id, $status))
{
$c13y_array[] = get_c13y(l10n($data['l10n_non_existent']), 'c13y_correction_user',
add_c13y(l10n($data['l10n_non_existent']), 'c13y_correction_user',
array('id' => $id, 'action' => 'creation'));
}
else
if (!empty($data['status']) and $status[$id] != $data['status'])
{
$c13y_array[] = get_c13y(l10n($data['l10n_bad_status']), 'c13y_correction_user',
add_c13y(l10n($data['l10n_bad_status']), 'c13y_correction_user',
array('id' => $id, 'action' => 'status'));
}
}
return $c13y_array;
}
/**

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@ -97,6 +97,12 @@ DELETE
do_maintenance_all_tables();
break;
}
case 'c13y' :
{
include_once(PHPWG_ROOT_PATH.'admin/include/functions_check_integrity.inc.php');
c13y_maintenance();
break;
}
default :
{
break;
@ -120,6 +126,7 @@ $template->assign_vars(
'U_MAINT_SESSIONS' => $start_url.'sessions',
'U_MAINT_FEEDS' => $start_url.'feeds',
'U_MAINT_DATABASE' => $start_url.'database',
'U_MAINT_C13Y' => $start_url.'c13y',
'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=maintenance',
)
);

View file

@ -24,3 +24,4 @@ INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_c
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_comment_validation','false','Send an email to the administrators when a comment requires validation');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('email_admin_on_picture_uploaded','false','Send an email to the administrators when a picture is uploaded');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('obligatory_user_mail_address','false','Mail address is obligatory for users');
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('c13y_ignore',null,'List of ignored anomalies');

View file

@ -0,0 +1,51 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
// +-----------------------------------------------------------------------+
// | 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 c13y_ignore config';
include_once(PHPWG_ROOT_PATH.'include/constants.php');
// +-----------------------------------------------------------------------+
// | Upgrade content |
// +-----------------------------------------------------------------------+
$query = "
INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('c13y_ignore',null,'List of ignored anomalies');
";
pwg_query($query);
echo
"\n"
.'"'.$upgrade_description.'"'.' ended'
."\n"
;
?>

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@ -616,7 +616,6 @@ $lang['c13y_Automatic_correction'] = 'Automatic correction';
$lang['c13y_Impossible_automatic_correction'] = 'Impossible automatic correction';
$lang['c13y_Correction_applied_success'] = 'Correction applied with success';
$lang['c13y_Correction_applied_error'] = 'Correction applied with error';
$lang['c13y_Apply_selected_corrections'] = 'Apply selected corrections';
$lang['c13y_anomaly_count'] = '%d anomaly has been detected.';
$lang['c13y_anomalies_count'] = '%d anomalies has been detected.';
$lang['c13y_anomaly_corrected_count'] = '%d anomaly has been corrected.';
@ -648,4 +647,16 @@ $lang['Level 1'] = 'Contacts';
$lang['Level 2'] = 'Friends';
$lang['Level 4'] = 'Family';
$lang['Level 8'] = 'Admins';
$lang['c13y_maintenance'] = 'Reinitialize check integrity';
$lang['c13y_check_all'] = 'Check all';
$lang['c13y_uncheck_all'] = 'Uncheck all';
$lang['c13y_check_auto'] = 'Check automatic corrections';
$lang['c13y_submit_correction'] = 'Apply selected corrections';
$lang['c13y_submit_ignore'] = 'Ignore selected anomalies';
$lang['c13y_submit_refresh'] = 'Refresh';
$lang['c13y_ignore_msg1'] = 'The anomaly will be ignored until next application version';
$lang['c13y_ignore_msg2'] = 'Correction the anomaly will cancel the fact that it\'s ignored';
$lang['c13y_anomaly_ignored_count'] = '%d anomaly has been ignored.';
$lang['c13y_anomalies_ignored_count'] = '%d anomalies has been ignored.';
?>

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@ -621,7 +621,6 @@ $lang['c13y_Automatic_correction'] = 'Corrección automática';
$lang['c13y_Impossible_automatic_correction'] = 'Corrección automática imposible';
$lang['c13y_Correction_applied_success'] = 'Corrección lograda';
$lang['c13y_Correction_applied_error'] = 'Corrección erronea';
$lang['c13y_Apply_selected_corrections'] = 'Aplicar las correcciones seleccionadas';
$lang['c13y_anomaly_count'] = '%d anomalía ha sido detectada.';
$lang['c13y_anomalies_count'] = '%d anomalías han sido detectadas.';
$lang['c13y_anomaly_corrected_count'] = '%d anomalía ha sido corregida.';
@ -654,4 +653,16 @@ $lang['Level 1'] = 'Contactos';
$lang['Level 2'] = 'Amigos';
$lang['Level 4'] = 'Familia';
$lang['Level 8'] = 'Admins';
/* TODO */ $lang['c13y_maintenance'] = 'Reinitialize check integrity';
$lang['c13y_check_all'] = 'Todo verificado';
$lang['c13y_uncheck_all'] = 'Soltar todo';
/* TODO */ $lang['c13y_check_auto'] = 'Check automatic corrections';
$lang['c13y_submit_correction'] = 'Aplicar las correcciones seleccionadas';
/* TODO */ $lang['c13y_submit_ignore'] = 'Ignore selected anomalies';
/* TODO */ $lang['c13y_submit_refresh'] = 'Refresh';
/* TODO */ $lang['c13y_ignore_msg1'] = 'The anomaly will be ignored until next application version';
/* TODO */ $lang['c13y_ignore_msg2'] = 'Correction the anomaly will cancel the fact that it\'s ignored';
/* TODO */ $lang['c13y_anomaly_ignored_count'] = '%d anomaly has been ignored.';
/* TODO */ $lang['c13y_anomalies_ignored_count'] = '%d anomalies has been ignored.';
?>

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@ -617,7 +617,6 @@ $lang['c13y_Automatic_correction'] = 'Correction automatique';
$lang['c13y_Impossible_automatic_correction'] = 'Correction automatique impossible';
$lang['c13y_Correction_applied_success'] = 'Correction appliquée avec succés';
$lang['c13y_Correction_applied_error'] = 'Correction appliquée avec erreur';
$lang['c13y_Apply_selected_corrections'] = 'Appliquer les corrections sélectionnées';
$lang['c13y_anomaly_count'] = '%d anomalie a été détecté.';
$lang['c13y_anomalies_count'] = '%d anomalies ont été détectées.';
$lang['c13y_anomaly_corrected_count'] = '%d anomalie a été corrigée.';
@ -650,4 +649,16 @@ $lang['Level 1'] = 'Contacts';
$lang['Level 2'] = 'Amis';
$lang['Level 4'] = 'Famille';
$lang['Level 8'] = 'Admins';
$lang['c13y_maintenance'] = 'Réinitialiser les contrôles d\'intégrité';
$lang['c13y_check_all'] = 'Tout cocher';
$lang['c13y_uncheck_all'] = 'Tout décocher';
$lang['c13y_check_auto'] = 'Cocher les corrections automatiques';
$lang['c13y_submit_correction'] = 'Appliquer les corrections sélectionnées';
$lang['c13y_submit_ignore'] = 'Ignorer les anomalies sélectionnées';
$lang['c13y_submit_refresh'] = 'Rafraîchir';
$lang['c13y_ignore_msg1'] = 'L\'anomalie sera ignorée jusqu\'à la prochaine version de l\'application';
$lang['c13y_ignore_msg2'] = 'La correction de l\'anomalie annulera le fait qu\'elle soit ignorée';
$lang['c13y_anomaly_ignored_count'] = '%d anomalie a été ignorée.';
$lang['c13y_anomalies_ignored_count'] = '%d anomalies ont été ignorées.';
?>

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@ -622,7 +622,6 @@ $lang['c13y_Automatic_correction'] = 'Automatische correctie';
$lang['c13y_Impossible_automatic_correction'] = 'Onmogelijke automatische correctie';
$lang['c13y_Correction_applied_success'] = 'Correctie die met succes is toegepast';
$lang['c13y_Correction_applied_error'] = 'Correctie die met fout wordt toegepast';
$lang['c13y_Apply_selected_corrections'] = 'Pas geselecteerde correcties toe';
$lang['c13y_anomaly_count'] = '%d Onregelmatigheid ontdekt.';
$lang['c13y_anomalies_count'] = '%d Onregelmatigheden ontdekt.';
$lang['c13y_anomaly_corrected_count'] = '%d Onregelmatigheid is gecorrigeerd.';
@ -654,4 +653,16 @@ $lang['Level 1'] = 'Contacten';
$lang['Level 2'] = 'Vrienden';
$lang['Level 4'] = 'Familie';
$lang['Level 8'] = 'Admins';
/* TODO */ $lang['c13y_maintenance'] = 'Reinitialize check integrity';
$lang['c13y_check_all'] = 'Selecteer alles';
$lang['c13y_uncheck_all'] = 'Deselecteer alles';
/* TODO */ $lang['c13y_check_auto'] = 'Check automatic corrections';
$lang['c13y_submit_correction'] = 'Pas geselecteerde correcties toe';
/* TODO */ $lang['c13y_submit_ignore'] = 'Ignore selected anomalies';
/* TODO */ $lang['c13y_submit_refresh'] = 'Refresh';
/* TODO */ $lang['c13y_ignore_msg1'] = 'The anomaly will be ignored until next application version';
/* TODO */ $lang['c13y_ignore_msg2'] = 'Correction the anomaly will cancel the fact that it\'s ignored';
/* TODO */ $lang['c13y_anomaly_ignored_count'] = '%d anomaly has been ignored.';
/* TODO */ $lang['c13y_anomalies_ignored_count'] = '%d anomalies has been ignored.';
?>

View file

@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@ -29,15 +29,15 @@ if (!defined('PHPWG_ROOT_PATH'))
die('Hacking attempt!');
}
add_event_handler('get_check_integrity', 'c13y_upgrade');
add_event_handler('list_check_integrity', 'c13y_upgrade');
function c13y_upgrade($c13y_array)
function c13y_upgrade()
{
global $conf;
load_language('plugin.lang', dirname(__FILE__).'/');
$result = array();
$can_be_deactivate = true;
/* Check user with same e-mail */
$query = '
@ -51,7 +51,8 @@ limit 0,1
if (mysql_fetch_array(pwg_query($query)))
{
$result[] = get_c13y(
$can_be_deactivate = false;
add_c13y(
l10n('c13y_exif_dbl_email_user'),
null,
null,
@ -60,7 +61,7 @@ limit 0,1
/* Check if this plugin must deactivate */
if (count($result) === 0)
if ($can_be_deactivate)
{
$deactivate_msg_link =
'<a href="'.
@ -69,15 +70,13 @@ limit 0,1
'" onclick="window.open(this.href, \'\'); return false;">'.
l10n('c13y_upgrade_deactivate').'</a>';
$result[] = get_c13y(
add_c13y(
l10n('c13y_upgrade_no_anomaly'),
'c13y_upgrade_correction',
'deactivate_plugin',
$deactivate_msg_link
);
}
return array_merge($c13y_array, $result);
}
function c13y_upgrade_correction($action)

View file

@ -3,46 +3,76 @@
<dt>{lang:c13y_title}</dt>
<dd>
<ul>
<form method="post" name="preferences" action="{F_c13y_ACTION}">
<form method="post" name="c13y" id="c13y" action="{F_c13y_ACTION}">
<fieldset>
<table class="table2">
<tr class="throw">
<th></th>
<th>{lang:c13y_Anomaly}</th>
<th>{lang:c13y_Correction}</th>
</tr>
<!-- BEGIN c13y -->
<tr class="{c13y.CLASS}">
<td>
<!-- BEGIN can_select -->
<input type="checkbox" name="c13y_selection[]" value="{c13y.ID}" {c13y.CHECKED} id="c13y_selection-{c13y.ID}" /><label for="c13y_selection-{c13y.ID}"></label>
<!-- END can_select -->
</td>
<td><label for="c13y_selection-{c13y.ID}">{c13y.ANOMALY}</label></td>
<td>
<!-- BEGIN correction_fct -->
<input type="checkbox" name="c13y_selection[]" value="{c13y.ID}" {c13y.CHECKED} id="c13y_selection-{c13y.ID}" /><label for="c13y_selection-{c13y.ID}"> {lang:c13y_Automatic_correction}</label>
<!-- END correction_fct -->
<!-- BEGIN correction_bad_fct -->
{lang:c13y_Impossible_automatic_correction}
<!-- END correction_bad_fct -->
<!-- BEGIN correction_success_fct -->
{lang:c13y_Correction_applied_success}
<!-- END correction_success_fct -->
<!-- BEGIN correction_error_fct -->
{lang:c13y_Correction_applied_error}
<BR />
{c13y.correction_error_fct.WIKI_FOROM_LINKS}
<!-- END correction_error_fct -->
<!-- BEGIN br -->
<br />
<!-- END br -->
<!-- BEGIN correction_msg -->
{c13y.correction_msg.DATA}
<!-- END correction_msg -->
<label for="c13y_selection-{c13y.ID}">
<!-- BEGIN ignore_msg -->
{lang:c13y_ignore_msg1}
<br />
{lang:c13y_ignore_msg2}
<!-- END ignore_msg -->
<!-- BEGIN correction_fct -->
{lang:c13y_Automatic_correction}
<!-- END correction_fct -->
<!-- BEGIN correction_bad_fct -->
{lang:c13y_Impossible_automatic_correction}
<!-- END correction_bad_fct -->
<!-- BEGIN correction_success_fct -->
{lang:c13y_Correction_applied_success}
<!-- END correction_success_fct -->
<!-- BEGIN correction_error_fct -->
{lang:c13y_Correction_applied_error}
<BR />
{c13y.correction_error_fct.WIKI_FOROM_LINKS}
<!-- END correction_error_fct -->
<!-- BEGIN br -->
<br />
<!-- END br -->
<!-- BEGIN correction_msg -->
{c13y.correction_msg.DATA}
<!-- END correction_msg -->
</label>
</td>
</tr>
<!-- END c13y -->
</table>
<!-- BEGIN c13y_submit -->
<!-- BEGIN c13y_link_check_uncheck -->
<a href="#" onclick="SelectAll(document.getElementById('c13y')); return false;">{lang:c13y_check_all}</a>
/ <a href="#" onclick="DeselectAll(document.getElementById('c13y')); return false;">{lang:c13y_uncheck_all}</a>
<!-- END c13y_link_check_uncheck -->
<!-- BEGIN c13y_link_check_automatic_correction -->
/ <a href="#" onclick="DeselectAll(document.getElementById('c13y'));
<!-- BEGIN c13y_do_check -->
document.getElementById('c13y_selection-{c13y_link_check_automatic_correction.c13y_do_check.ID}').checked = true;
<!-- END c13y_do_check -->
return false;">{lang:c13y_check_auto}</a>
<!-- END c13y_link_check_automatic_correction -->
<p>
<input class="submit" type="submit" value="{lang:c13y_Apply_selected_corrections}" name="c13y_submit" {TAG_INPUT_ENABLED} />
<!-- BEGIN c13y_submit_automatic_correction -->
<input class="submit" type="submit" value="{lang:c13y_submit_correction}" name="c13y_submit_correction" {TAG_INPUT_ENABLED} />
<!-- END c13y_submit_automatic_correction -->
<!-- BEGIN c13y_submit_ignore -->
<input class="submit" type="submit" value="{lang:c13y_submit_ignore}" name="c13y_submit_ignore" {TAG_INPUT_ENABLED} />
<!-- END c13y_submit_ignore -->
<input class="submit" type="submit" value="{lang:c13y_submit_refresh}" name="c13y_submit_refresh" {TAG_INPUT_ENABLED} />
</p>
<!-- END c13y_submit -->
</fieldset>
</form>
</ul>

View file

@ -18,3 +18,7 @@
<li><a href="{U_MAINT_SESSIONS}" {TAG_INPUT_ENABLED}>{lang:purge sessions}</a></li>
<li><a href="{U_MAINT_FEEDS}" {TAG_INPUT_ENABLED}>{lang:purge never used notification feeds}</a></li>
</ul>
<ul>
<li><a href="{U_MAINT_C13Y}" {TAG_INPUT_ENABLED}>{lang:c13y_maintenance}</a></li>
</ul>