Ejemplo n.º 1
0
 public function updateClient()
 {
     global $whmcs;
     $exinfo = getClientsDetails($this->getID());
     if (defined("ADMINAREA")) {
         $updatefieldsarray = array();
     } else {
         $updatefieldsarray = array("firstname" => "First Name", "lastname" => "Last Name", "companyname" => "Company Name", "email" => "Email Address", "address1" => "Address 1", "address2" => "Address 2", "city" => "City", "state" => "State", "postcode" => "Postcode", "country" => "Country", "phonenumber" => "Phone Number", "billingcid" => "Billing Contact");
         if ($whmcs->get_config("AllowClientsEmailOptOut")) {
             $updatefieldsarray['emailoptout'] = "Newsletter Email Opt Out";
         }
     }
     $changelist = array();
     $updateqry = array();
     foreach ($updatefieldsarray as $field => $displayname) {
         if ($this->isEditableField($field)) {
             $value = $whmcs->get_req_var($field);
             if ($field == "emailoptout" && !$value) {
                 $value = "0";
             }
             $updateqry[$field] = $value;
             if ($value != $exinfo[$field]) {
                 $changelist[] = "" . $displayname . ": '" . $exinfo[$field] . "' to '" . $value . "'";
                 continue;
             }
             continue;
         }
     }
     update_query("tblclients", $updateqry, array("id" => $this->getID()));
     $old_customfieldsarray = getCustomFields("client", "", $this->getID(), "", "");
     $customfields = getCustomFields("client", "", $this->getID(), "", "");
     foreach ($customfields as $v) {
         $k = $v['id'];
         $customfieldsarray[$k] = $_POST['customfield'][$k];
     }
     saveCustomFields($this->getID(), $customfieldsarray);
     $paymentmethod = $whmcs->get_req_var("paymentmethod");
     clientChangeDefaultGateway($this->getID(), $paymentmethod);
     if ($paymentmethod != $exinfo['defaultgateway']) {
         $changelist[] = "Default Payment Method: '" . getGatewayName($exinfo['defaultgateway']) . "' to '" . getGatewayName($paymentmethod) . "'<br>\n";
     }
     run_hook("ClientEdit", array_merge(array("userid" => $this->getID(), "olddata" => $exinfo), $updateqry));
     if (!defined("ADMINAREA") && $whmcs->get_config("SendEmailNotificationonUserDetailsChange")) {
         foreach ($old_customfieldsarray as $values) {
             if ($values['value'] != $_POST['customfield'][$values['id']]) {
                 $changelist[] = $values['name'] . ": '" . $values['value'] . "' to '" . $_POST['customfield'][$values['id']] . "'";
                 continue;
             }
         }
         if (0 < count($changelist)) {
             $adminurl = $whmcs->get_config("SystemSSLURL") ? $whmcs->get_config("SystemSSLURL") : $whmcs->get_config("SystemURL");
             $adminurl .= "/" . $whmcs->get_admin_folder_name() . "/clientssummary.php?userid=" . $this->getID();
             sendAdminNotification("account", "WHMCS User Details Change", "<p>Client ID: <a href=\"" . $adminurl . "\">" . $this->getID() . " - " . $exinfo['firstname'] . " " . $exinfo['lastname'] . "</a> has requested to change his/her details as indicated below:<br><br>" . implode("<br />\n", $changelist) . "<br>If you are unhappy with any of the changes, you need to login and revert them - this is the only record of the old details.</p>");
             logActivity("Client Profile Modified - " . implode(", ", $changelist) . " - User ID: " . $this->getID());
         }
     }
     return true;
 }
Ejemplo n.º 2
0
        continue;
    }
}
if ($_POST['password2']) {
    $updatequery .= "password='******'password2']) . "',";
}
if ($_POST['securityqans']) {
    $updatequery .= "securityqans='" . encrypt($_POST['securityqans']) . "',";
}
if (isset($_POST['cardnum'])) {
    $updatequery .= "cardlastfour='" . db_escape_string(substr($_POST['cardnum'], 0 - 4)) . "',";
}
$cchash = md5($whmcs->get_hash() . $clientid);
$fieldsarray = array("cardnum", "expdate", "startdate", "issuenumber", "bankcode", "bankacct");
foreach ($fieldsarray as $fieldname) {
    if (isset($_POST[$fieldname])) {
        $updatequery .= "" . $fieldname . "=AES_ENCRYPT('" . db_escape_string($_POST[$fieldname]) . ("','" . $cchash . "'),");
        continue;
    }
}
$query = "UPDATE tblclients SET " . substr($updatequery, 0, 0 - 1) . " WHERE id=" . (int) $clientid;
$result = full_query($query);
if ($customfields) {
    $customfields = base64_decode($customfields);
    $customfields = unserialize($customfields);
    saveCustomFields($clientid, $customfields);
}
if ($paymentmethod) {
    clientChangeDefaultGateway($_POST['clientid'], $paymentmethod);
}
$apiresults = array("result" => "success", "clientid" => $_POST['clientid']);
Ejemplo n.º 3
0
        foreach ($updatefieldsarray as $field => $displayname) {
            if ($array[$field] != $oldclientsdetails[$field]) {
                $changelist[] = "" . $displayname . ": '" . $oldclientsdetails[$field] . "' to '" . $array[$field] . "'";
                continue;
            }
        }
        foreach ($updatedtickboxarray as $field => $displayname) {
            $oldfield = $oldclientsdetails[$field] ? "Enabled" : "Disabled";
            $newfield = $array[$field] ? "Enabled" : "Disabled";
            if ($oldfield != $newfield) {
                $changelist[] = "" . $displayname . ": '" . $oldfield . "' to '" . $newfield . "'";
                continue;
            }
        }
        saveCustomFields($userid, $customfieldsarray);
        clientChangeDefaultGateway($userid, $paymentmethod);
        if (!count($changelist)) {
            $changelist[] = "No Changes";
        }
        logActivity("Client Profile Modified - " . implode(", ", $changelist) . (" - User ID: " . $userid), $userid);
        run_hook("AdminClientProfileTabFieldsSave", $_REQUEST);
        run_hook("ClientEdit", array_merge(array("userid" => $userid, "olddata" => $oldclientsdetails), $array));
        redir("userid=" . $userid . "&success=true");
        exit;
    }
}
releaseSession();
ob_start();
if ($whmcs->get_req_var("emailexists")) {
    infoBox($aInt->lang("clients", "duplicateemail"), $aInt->lang("clients", "duplicateemailexp"), "error");
} else {