Example #1
0
<?php

/**
 * Show the form to register a new account for yourself.
 *
 * @package		ProjectSend
 * @subpackage	Clients
 *
 */
$allowed_levels = array(9, 8, 7, 0);
require_once 'sys.includes.php';
$page_title = __('Register new account', 'cftp_admin');
include 'header-unlogged.php';
/** The form was submitted */
if ($_POST) {
    $new_client = new ClientActions();
    /**
     * Clean the posted form values to be used on the clients actions,
     * and again on the form if validation failed.
     */
    $add_client_data_name = encode_html($_POST['add_client_form_name']);
    $add_client_data_user = encode_html($_POST['add_client_form_user']);
    $add_client_data_email = encode_html($_POST['add_client_form_email']);
    /** Optional fields: Address, Phone, Internal Contact, Notify */
    $add_client_data_addr = isset($_POST["add_client_form_address"]) ? encode_html($_POST["add_client_form_address"]) : '';
    $add_client_data_phone = isset($_POST["add_client_form_phone"]) ? encode_html($_POST["add_client_form_phone"]) : '';
    $add_client_data_intcont = isset($_POST["add_client_form_intcont"]) ? encode_html($_POST["add_client_form_intcont"]) : '';
    $add_client_data_notity = isset($_POST["add_client_form_notify"]) ? 1 : 0;
    /** Arguments used on validation and client creation. */
    $new_arguments = array('id' => '', 'username' => $add_client_data_user, 'password' => $_POST['add_client_form_pass'], 'name' => $add_client_data_name, 'email' => $add_client_data_email, 'address' => $add_client_data_addr, 'phone' => $add_client_data_phone, 'contact' => $add_client_data_intcont, 'notify' => $add_client_data_notity, 'type' => 'new_client');
    if (CLIENTS_AUTO_APPROVE == 0) {
Example #2
0
         case 'deactivate':
             /**
              * Reverse of the previous action. Setting the value to 0 means
              * that the client is inactive.
              */
             foreach ($selected_clients as $work_client) {
                 $this_client = new ClientActions();
                 $hide_client = $this_client->change_client_active_status($work_client, '0');
             }
             $msg = __('The selected clients were marked as inactive.', 'cftp_admin');
             echo system_message('ok', $msg);
             $log_action_number = 20;
             break;
         case 'delete':
             foreach ($selected_clients as $client) {
                 $this_client = new ClientActions();
                 $delete_client = $this_client->delete_client($client);
             }
             $msg = __('The selected clients were deleted.', 'cftp_admin');
             echo system_message('ok', $msg);
             $log_action_number = 17;
             break;
     }
     /** Record the action log */
     foreach ($selected_clients as $client) {
         $new_log_action = new LogActions();
         $log_action_args = array('action' => $log_action_number, 'owner_id' => $global_id, 'affected_account_name' => $all_users[$client]);
         $new_record_action = $new_log_action->log_action_save($log_action_args);
     }
 } else {
     $msg = __('Please select at least one client.', 'cftp_admin');
Example #3
0
<?php

/**
 * Show the form to edit an existing client.
 *
 * @package		ProjectSend
 * @subpackage	Clients
 *
 */
$allowed_levels = array(9, 8, 0);
require_once 'sys.includes.php';
$active_nav = 'clients';
/** Create the object */
$edit_client = new ClientActions();
/** Check if the id parameter is on the URI. */
if (isset($_GET['id'])) {
    $client_id = $_GET['id'];
    $page_status = client_exists_id($client_id) ? 1 : 2;
} else {
    /**
     * Return 0 if the id is not set.
     */
    $page_status = 0;
}
/**
 * Get the clients information from the database to use on the form.
 */
if ($page_status === 1) {
    $editing = $dbh->prepare("SELECT * FROM " . TABLE_USERS . " WHERE id=:id");
    $editing->bindParam(':id', $client_id, PDO::PARAM_INT);
    $editing->execute();