Esempio n. 1
0
 public function requireLogin()
 {
     global $whmcs;
     if ($this->isLoggedIn()) {
         if (WHMCS_Session::get("2fabackupcodenew")) {
             $this->setTemplate("logintwofa");
             $twofa = new WHMCS_2FA();
             if ($twofa->setClientID($this->getUserID())) {
                 $backupcode = $twofa->generateNewBackupCode();
                 $this->assign("newbackupcode", $backupcode);
                 WHMCS_Session::delete("2fabackupcodenew");
             } else {
                 $this->assign("newbackupcodeerror", true);
             }
             $this->output();
             exit;
         }
         return true;
     }
     $_SESSION['loginurlredirect'] = html_entity_decode($_SERVER['REQUEST_URI']);
     if (WHMCS_Session::get("2faverifyc")) {
         $this->setTemplate("logintwofa");
         if (WHMCS_Session::get("2fabackupcodenew")) {
             $this->assign("newbackupcode", true);
         } else {
             if ($whmcs->get_req_var("incorrect")) {
                 $this->assign("incorrect", true);
             }
         }
         $twofa = new WHMCS_2FA();
         if ($twofa->setClientID(WHMCS_Session::get("2faclientid"))) {
             if (!$twofa->isActiveClients() || !$twofa->isEnabled()) {
                 WHMCS_Session::destroy();
                 redir();
             }
             if ($whmcs->get_req_var("backupcode")) {
                 $this->assign("backupcode", true);
             } else {
                 $challenge = $twofa->moduleCall("challenge");
                 if ($challenge) {
                     $this->assign("challenge", $challenge);
                 } else {
                     $this->assign("error", "Bad 2 Factor Auth Module. Please contact support.");
                 }
             }
         } else {
             $this->assign("error", "An error occurred. Please try again.");
         }
     } else {
         $this->setTemplate("login");
         $this->assign("loginpage", true);
         $this->assign("formaction", "dologin.php");
         if ($whmcs->get_req_var("incorrect")) {
             $this->assign("incorrect", true);
         }
     }
     $this->output();
     exit;
 }
Esempio n. 2
0
                 $_SESSION['massmail']['attachments'][] = $filename;
                 continue;
             }
         }
     }
     $step = 0;
 }
 $mail_attachments = array();
 if (isset($_SESSION['massmail']['attachments'])) {
     foreach ($_SESSION['massmail']['attachments'] as $filename) {
         $mail_attachments[$attachments_dir . $filename] = $filename;
     }
 }
 if ($massmail && ($safeStoredQuery = $queryMgr->getQuery($queryMgr->getTokenValue()))) {
     $massmailquery = $safeStoredQuery;
     if ($emailoptout || WHMCS_Session::get("massmailemailoptout")) {
         WHMCS_Session::set("massmailemailoptout", true);
         $massmailquery .= " AND tblclients.emailoptout = '0'";
     }
     $sentids = $_SESSION['massmail']['sentids'];
     $massmailamount = (int) $_SESSION['massmail']['massmailamount'];
     $massmailinterval = (int) $_SESSION['massmail']['massmailinterval'];
     if (!$massmailamount) {
         $massmailamount = 25;
     }
     if (!$massmailinterval) {
         $massmailinterval = 30;
     }
     $result = full_query($massmailquery);
     $totalemails = mysql_num_rows($result);
     $totalsteps = ceil($totalemails / $massmailamount);
Esempio n. 3
0
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
define("ADMINAREA", true);
require "../init.php";
$aInt = new WHMCS_Admin("Configure Administrators");
$aInt->title = $aInt->lang("administrators", "title");
$aInt->sidebar = "config";
$aInt->icon = "admins";
$aInt->helplink = "Administrators";
$validate = new WHMCS_Validate();
if ($action == "save") {
    check_token("WHMCS.admin.default");
    $auth = new WHMCS_Auth();
    $auth->getInfobyID(WHMCS_Session::get("adminid"));
    if (!$auth->comparePassword($whmcs->get_req_var("confirmpassword"))) {
        $_ADMINLANG['administrators']['confirmexistingpw'] = "You must confirm your existing administrator password";
        $validate->addError(array("administrators", "confirmexistingpw"));
    } else {
        $validate->validate("required", "firstname", array("administrators", "namerequired"));
        if ($validate->validate("required", "email", array("administrators", "emailerror"))) {
            $validate->validate("email", "email", array("administrators", "emailinvalid"));
        }
        if ($validate->validate("required", "username", array("administrators", "usererror"))) {
            $existingid = get_query_val("tbladmins", "id", array("username" => $username));
            if (!$id && $existingid || $id && $existingid && $id != $existingid) {
                $validate->addError("administrators", "userexists");
            }
        }
        if (!$id) {
Esempio n. 4
0
 public function setFlagTo($adminid)
 {
     $adminid = (int) $adminid;
     $validadminids = $this->getFlaggableStaff();
     if ($adminid != 0 && !array_key_exists($adminid, $validadminids)) {
         return false;
     }
     if ($adminid == $this->getData("flag")) {
         return false;
     }
     if (0 < $adminid) {
         $data = get_query_vals("tbladmins", "id,firstname,lastname,username", array("id" => $adminid));
         if (!$data['id']) {
             return false;
         }
         $adminname = trim($data['firstname'] . " " . $data['lastname']);
         if (!$adminname) {
             $adminname = $data['username'];
         }
     } else {
         if ($adminid < 0) {
             $adminid = 0;
         }
     }
     if (!count($this->data)) {
         $this->getData();
     }
     update_query("tbltickets", array("flag" => $adminid), array("id" => $this->getData("id")));
     if (0 < $adminid) {
         $this->log("Assigned to Staff Member " . $adminname);
         if (WHMCS_Session::get("adminid") && $adminid != WHMCS_Session::get("adminid")) {
             $this->sendAdminEmail("Support Ticket Flagged", $adminid);
         }
     } else {
         $this->log("Staff Assignment Removed");
     }
     run_hook("TicketFlagged", array("ticketid" => $this->getData("id"), "adminid" => $adminid, "adminname" => $adminname));
     return true;
 }
$templatefile = "domaindocument";
$pageicon = "images/domains_big.gif";
initialiseClientArea($pagetitle, $pageicon, $breadcrumbnav);
$search = $whmcs->get_req_var("search");
$domain = $whmcs->get_req_var("domain");
$bulkdomains = $whmcs->get_req_var("bulkdomains");
$tld = $whmcs->get_req_var("tld");
$tlds = $whmcs->get_req_var("tlds");
$ext = $whmcs->get_req_var("ext");
$direct = $whmcs->get_req_var("direct");
$sld = "";
$invalidtld = "";
$availabilityresults = array();
$search_tlds = array();
$tldslist = array();
$client = new WHMCS_Client(WHMCS_Session::get("uid"));
$uid = $client->getID();
$currencyid = isset($_SESSION['currency']) ? $_SESSION['currency'] : "";
$currency = getCurrency($uid, $currencyid);
$smartyvalues['currency'] = $currency;
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : "";
$domain = isset($_REQUEST['domain']) ? $_REQUEST['domain'] : "";
$document_download = isset($_REQUEST['dl']) ? $_REQUEST['dl'] : "";
$search_domain = $_POST['search_domain'] != "Enter Domain to Find" ? $_POST['search_domain'] : "";
$current_date = date('Y-m-d');
$where = array("registrar" => "domainku");
if ($domain || $search_domain) {
    $where["domain"] = $domain ? $domain : $search_domain;
    $where_document = array("domain" => $domain);
}
$query = full_query("\n    SELECT  t.id, t.userid, t.type, t.domain, t.registrar, t.registrationdate, t.registrationperiod, t.status AS domstatus, i.status, o.nameservers, o.transfersecret,\n                m.domain AS coza_domain, m.domainid AS coza_domainid, m.userid AS coza_userid, m.id_doc_storage_name, m.id_doc_type, m.le_doc_storage_name, \n                m.le_doc_type, m.su_doc_storage_name, m.su_doc_type, m.domain_approval_date, m.domain_status,\n                c.firstname, c.lastname, c.companyname, c.email, c.address1, c.address2, c.city, c.state, c.postcode, c.country, c.phonenumber\n        FROM tbldomains t \n        LEFT JOIN mod_domaincloudregistrar m ON t.domain = m.domain \n        LEFT JOIN tblorders o ON t.orderid = o.id\n        LEFT JOIN tblinvoices i ON o.invoiceid = i.id\n        LEFT JOIN tblclients c ON t.userid = c.id\n        WHERE t.userid = " . $uid . " AND t.status <> 'Cancelled' AND t.status <> 'Expired' AND " . (!empty($domain) || !empty($search_domain) ? "t.domain LIKE '" . (!empty($domain) ? $domain : $search_domain) . "%'" : "t.domain LIKE '%.id'") . ";\n    ");
Esempio n. 6
0
 /**
  * retrieve from the backend storage based on key
  *
  * Note: if key cannot be referenced, an empty string is returned
  *
  * @param string $key
  *
  * @return string
  */
 private function getSessionValue($key)
 {
     $value = "";
     if (class_exists("WHMCS_Session")) {
         $value = WHMCS_Session::get($key);
     } else {
         if (!empty($_SESSION[$key])) {
             $value = $_SESSION[$key];
         }
     }
     return $value;
 }
Esempio n. 7
0
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
define("ADMINAREA", true);
require "../init.php";
session_regenerate_id();
$username = $whmcs->get_req_var("username");
$password = $whmcs->get_req_var("password");
$auth = new WHMCS_Auth();
$twofa = new WHMCS_2FA();
if ($twofa->isActiveAdmins() && isset($_SESSION['2faverify'])) {
    $twofa->setAdminID($_SESSION['2faadminid']);
    if (WHMCS_Session::get("2fabackupcodenew")) {
        WHMCS_Session::delete("2fabackupcodenew");
        WHMCS_Session::delete("2faverify");
        WHMCS_Session::delete("2faadminid");
        WHMCS_Session::delete("2farememberme");
        if (isset($_SESSION['admloginurlredirect'])) {
            $loginurlredirect = $_SESSION['admloginurlredirect'];
            unset($_SESSION['admloginurlredirect']);
            $urlparts = explode("?", $loginurlredirect, 2);
            $filename = !empty($urlparts[0]) ? $urlparts[0] : "";
            $qry_string = !empty($urlparts[1]) ? $urlparts[1] : "";
            redir($qry_string, $filename);
        } else {
            redir("", "index.php");
        }
        exit;
Esempio n. 8
0
         }
         redir("a=confproduct&i=" . $newprodnum . $ajax);
         exit;
     }
 } else {
     if ($aid) {
         $requestAddonID = (int) $whmcs->get_req_var("aid");
         $requestServiceID = (int) $whmcs->get_req_var("serviceid");
         $requestProductID = (int) $whmcs->get_req_var("productid");
         if (!$requestServiceID && $requestProductID) {
             $requestServiceID = $requestProductID;
         }
         if (!$requestAddonID || !$requestServiceID) {
             redir("gid=addons");
         }
         $data = get_query_vals("tblhosting", "id,packageid", array("id" => $requestServiceID, "userid" => WHMCS_Session::get("uid"), "domainstatus" => "Active"));
         $serviceid = $data['id'];
         $pid = $data['packageid'];
         if (!$serviceid) {
             redir("gid=addons");
         }
         $data = get_query_vals("tbladdons", "id,packages", array("id" => $requestAddonID));
         $aid = $data['id'];
         $packages = $data['packages'];
         if (!$aid) {
             redir("gid=addons");
         }
         $packages = explode(",", $packages);
         if (!in_array($pid, $packages)) {
             redir("gid=addons");
         }
Esempio n. 9
0
if (!defined("WHMCS")) {
    header("Location: clientarea.php");
    exit;
}
$_SESSION['loginurlredirect'] = html_entity_decode($_SERVER['REQUEST_URI']);
if (WHMCS_Session::get("2faverifyc")) {
    $templatefile = "logintwofa";
    if (WHMCS_Session::get("2fabackupcodenew")) {
        $smartyvalues['newbackupcode'] = true;
    } else {
        if ($whmcs->get_req_var("incorrect")) {
            $smartyvalues['incorrect'] = true;
        }
    }
    $twofa = new WHMCS_2FA();
    if ($twofa->setClientID(WHMCS_Session::get("2faclientid"))) {
        if (!$twofa->isActiveClients() || !$twofa->isEnabled()) {
            WHMCS_Session::destroy();
            redir();
        }
        if ($whmcs->get_req_var("backupcode")) {
            $smartyvalues['backupcode'] = true;
        } else {
            $challenge = $twofa->moduleCall("challenge");
            if ($challenge) {
                $smartyvalues['challenge'] = $challenge;
            } else {
                $smartyvalues['error'] = "Bad 2 Factor Auth Module. Please contact support.";
            }
        }
    } else {