Subversion Repositories portal2

Rev

Rev 695 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*  emg - Energy Monitoring & Graphing
*  Copyright (C) 2006-2012 Romain Lievin
*
*  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; either version 3 of the License, or
*  (at your option) any later version.
*
*  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

?>

<div id="page_form_groups_del_submit">
        <h1>
                <?php echo _('Delete data from group'); ?>
        </h1>
</div>

<?php
$ok = false;
$error = new Error();

if(!isset($_POST['form_group_key']))
{
        $error->push(_('One or more fields are missing.'));
}
elseif(strlen( $_POST['form_group_key']) > 64 || strlen($_POST['form_group_key']) < 4)
{
        $error->push(_('Name must have [4-64] characters.'));
}
else
if(!isset($_SESSION['groups']))
{
        $error->push(_('Operation problem. Missing groups array.'));
}
else
{
        // retrieve data name
        $groups     = $_SESSION['groups'];
        $group_name = filter_var($_POST['form_group_key'], FILTER_SANITIZE_STRING);

        $groups->delItem($group_name);

        $error->push(_('Group deleted.'));
        $ok         = true;
}

echo $error->display();

$id      = link_get_id_from_filename("form_data_add.php");
$refresh = $_SESSION['refresh_redirection'];
echo "<meta http-equiv=\"refresh\" content=\"$refresh; URL=index.php?id_page=$id\">";
?>