Example #1
0
function getAttendanceData($start = 1441065600, $end = 1443657600, $loc = '')
{
    $lcode = '';
    switch ($loc) {
        case 'cmnh':
        case 'cmoa':
            $lcode = 'O';
            break;
        case 'csc':
            $lcode = 'S';
            break;
        case 'warhol':
            $lcode = 'A';
            break;
        default:
            $lcode = '';
            break;
    }
    $tstart = strtotime($start);
    $tend = strtotime($end);
    $q = getAttendQuery($lcode, $start, $end);
    $res = SOAPcall("select", $q);
    if (!isset($res)) {
        return array();
    }
    $data = parseResult($res);
    $intv = 24 * 60 * 60;
    //1 day;
    $data = toHighcharts($data, $tstart, $tend, $intv);
    return $data;
}
Example #2
0
 function findEmail($mode, $opt = array())
 {
     if (is_array($mode)) {
         $opt = $mode;
     } elseif (!empty($mode)) {
         $opt['mode'] = $mode;
     }
     if (empty($opt['mode'])) {
         $opt['mode'] = 'plain';
     }
     $opt = $this->emailQuery($opt);
     //debug($opt);
     $res = $this->EmailModel->find($opt['mode'] == 'plain' ? 'all' : $opt['mode'], $opt);
     if ($opt['mode'] == 'plain') {
         $res = parseResult($res);
     }
     return $res;
 }
Example #3
0
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "WHMCS Internet.bs Corp. Expiry Sync Robot");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$data = curl_exec($ch);
$curl_err = false;
if (curl_error($ch)) {
    $curl_err = 'CURL Error: ' . curl_errno($ch) . ' - ' . curl_error($ch);
    exit('CURL Error: ' . curl_errno($ch) . ' - ' . curl_error($ch));
}
curl_close($ch);
if ($curl_err) {
    $cronreport .= "Error connecting to API: {$curl_err}";
} else {
    $result = parseResult($data);
    if (!$result) {
        $cronreport .= "Error connecting to API:<br>" . nl2br($data) . "<br>";
    } else {
        $queryresult = select_query("tbldomains", "domain", "registrar='internetbs' AND (status='Pending Transfer' OR status='Active')");
        while ($data = mysql_fetch_array($queryresult)) {
            $domainname = trim(strtolower($data['domain']));
            if (isset($result[$domainname])) {
                if (!is_null($result[$domainname]["expiry"])) {
                    $expirydate = date("Y-m-d", $result[$domainname]["expiry"]);
                } else {
                    $expirydate = false;
                }
                $status = $result[$domainname]["status"];
                if ($status == 'ok') {
                    update_query("tbldomains", array("status" => "Active"), array("domain" => $domainname));
 if (!$dbresult || !mysql_num_rows($dbresult)) {
     $report .= "No domains with status 'Active' found\n";
 } else {
     $domains = array();
     try {
         $page = 1;
         $pageSize = 100;
         do {
             $request_params = array('ListType' => "ALL", 'Page' => $page, 'PageSize' => $pageSize, 'SortBy' => "NAME");
             if (!empty($params['PromotionCode'])) {
                 $request_params['PromotionCode'] = $params['PromotionCode'];
             }
             $api = new NamecheapApi($username, $password, $testmode);
             $response = $api->request("namecheap.domains.getList", $request_params);
             $result = $api->parseResponse($response);
             $domains += parseResult($result['DomainGetListResult']['Domain'], "Name");
             $totalItems = $result['Paging']['TotalItems'];
             $pageSize = $result['Paging']['PageSize'];
         } while ($pageSize * $page++ <= $totalItems);
     } catch (Exception $e) {
         $report .= $e->getMessage() . "\n";
     }
     if (!$domains) {
         $report .= "No registrar active domains found\n";
     } else {
         $count = 0;
         while (($row = mysql_fetch_assoc($dbresult)) !== false) {
             if (isset($domains[$row['domain']]) && "false" == $domains[$row['domain']]['IsExpired']) {
                 $expirydate = date("Y-m-d", strtotime($domains[$row['domain']]['Expires']));
                 if (!$expirydate) {
                     $report .= "Getting expirydate for domain " . $row['domain'] . " failed\n";