Esempio n. 1
0
$active_nav = 'groups';
$page_title = __('Add clients group', 'cftp_admin');
include 'header.php';
if ($_POST) {
    $new_group = new GroupActions();
    /**
     * Clean the posted form values to be used on the groups actions,
     * and again on the form if validation failed.
     */
    $add_group_data_name = encode_html($_POST['add_group_form_name']);
    $add_group_data_description = encode_html($_POST['add_group_form_description']);
    $add_group_data_members = $_POST['add_group_form_members'];
    /** Arguments used on validation and group creation. */
    $new_arguments = array('id' => '', 'name' => $add_group_data_name, 'description' => $add_group_data_description, 'members' => $add_group_data_members);
    /** Validate the information from the posted form. */
    $new_validate = $new_group->validate_group($new_arguments);
    /** Create the group if validation is correct. */
    if ($new_validate == 1) {
        $new_response = $new_group->create_group($new_arguments);
    }
}
?>

<div id="main">
	<h2><?php 
echo $page_title;
?>
</h2>
	
	<div class="whiteform whitebox">
		
}
if ($_POST) {
    /**
     * Clean the posted form values to be used on the groups actions,
     * and again on the form if validation failed.
     * Also, overwrites the values gotten from the database so if
     * validation failed, the new unsaved values are shown to avoid
     * having to type them again.
     */
    $add_group_data_name = mysql_real_escape_string($_POST['add_group_form_name']);
    $add_group_data_description = mysql_real_escape_string($_POST['add_group_form_description']);
    $add_group_data_members = !empty($_POST['add_group_form_members']) ? $_POST['add_group_form_members'] : '';
    /** Arguments used on validation and group creation. */
    $edit_arguments = array('id' => $group_id, 'name' => $add_group_data_name, 'description' => $add_group_data_description, 'members' => $add_group_data_members);
    /** Validate the information from the posted form. */
    $edit_validate = $edit_group->validate_group($edit_arguments);
    /** Create the group if validation is correct. */
    if ($edit_validate == 1) {
        $edit_response = $edit_group->edit_group($edit_arguments);
    }
}
?>

<div id="main">
	<h2><?php 
echo $page_title;
?>
</h2>
	
	<div class="whiteform whitebox">