示例#1
0
文件: sync.php 项目: shazvi/CloudSync
function parsedavfolder($url)
{
    $prop = davPROP($url, DAVUSERNAME, DAVPASS);
    $status = $prop["info"]["http_code"];
    if ($status < 400) {
        if (strpos($prop["result"], '<?xml') !== false) {
            $xml = xmlstr_to_array(strstr($prop["result"], '<?xml'));
            $xml = $xml['d:response'];
            foreach ($xml as $row) {
                $array[] = array("folder" => isset($row['d:propstat']['d:prop']['d:isFolder']) ? "t" : "f", "name" => $row['d:propstat']['d:prop']['d:displayname'], "size" => isset($row['d:propstat']['d:prop']['d:getcontentlength']) ? $row['d:propstat']['d:prop']['d:getcontentlength'] : "f", "modified" => strtotime($row['d:propstat']['d:prop']['d:getlastmodified']) + LOCALTIME, "href" => $row['d:href']);
            }
            array_shift($array);
            return $array;
        } else {
            print "No xml data returned.";
        }
    } else {
        print "Error {$status} - An unexpected error occurred.";
    }
    return false;
}
示例#2
0
文件: a.php 项目: shazvi/CloudSync
<?php

require "../includes/config.php";
$prop = davPROP($url, DAVUSERNAME, DAVPASS);
$status = $prop["info"]["http_code"];
if ($status < 400) {
    if (strpos($prop["result"], '<?xml') !== false) {
        $xml = xmlstr_to_array(strstr($prop["result"], '<?xml'));
        $xml = $xml['d:response'];
        foreach ($xml as $row) {
            $array[] = array("folder" => isset($row['d:propstat']['d:prop']['d:isFolder']) ? "t" : "f", "name" => $row['d:propstat']['d:prop']['d:displayname'], "size" => isset($row['d:propstat']['d:prop']['d:getcontentlength']) ? $row['d:propstat']['d:prop']['d:getcontentlength'] : "f", "modified" => strtotime($row['d:propstat']['d:prop']['d:getlastmodified']) + LOCALTIME, "href" => $row['d:href']);
        }
        array_shift($array);
        return $array;
    } else {
        print "No xml data returned.";
    }
} else {
    print "Error {$status} - An unexpected error occurred.";
}
示例#3
0
 public function getSpeedyAccountFullResponse($nospeedy)
 {
     $url = "http://" . $this->ip_addr2 . "/TelkomSystem/Radius/Services/ProxyService/getSpeedyAccount?wsdl";
     $client = new SoapClient($url, array('trace' => 1));
     $client->__setLocation($url);
     $param2 = array("in0" => $nospeedy, "in1" => 'telkom.net', "in2" => $nospeedy);
     $result = $client->__call("getSpeedyAccountFull", array('parameters' => $param2));
     $tmp = $client->__getLastResponse();
     $a = xmlstr_to_array($tmp);
     $out = $a['soap:Body']['ns1:getSpeedyAccountFullResponse']['ns1:out'];
     if ($_REQUEST['debug'] == 'api') {
         var_dump($a, $result, $tmp, $client, $out, $out['status']);
     }
     return $out;
 }
示例#4
0
function getReviewfromYahooLocal($name, $lat, $long)
{
    //$url="http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=".YAHOO_APP_ID."&query=".urlencode('Oreganos Wood Fired Pizza')."&latitude=37.401704&longitude=-122.114907";
    $url = "http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=" . YAHOO_APP_ID . "&query=" . urlencode($name) . "&latitude=" . $lat . "&longitude=" . $long;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $xml = curl_exec($ch);
    curl_close($ch);
    return xmlstr_to_array($xml);
}
示例#5
0
 function registerSpeedy()
 {
     Doo::loadClass('SDPAPI');
     $sdpapi = new SDPAPI();
     $tm = time();
     $password = substr($tm, strlen($tm) - 5, 5);
     $email = trim($_GET['email']);
     if (!$email) {
         $out = array('rs' => false);
         echo json_encode($out);
         exit;
     }
     if ($_GET['password']) {
         $password = $_GET['password'];
     }
     $fullname = $_GET['fullname'];
     if (!$fullname) {
         $fullname = $email;
     }
     $param = array('telkomId' => $email, 'email' => $email, 'password' => $password);
     $outCrt = $sdpapi->createUserProfile($param);
     $outActive = $sdpapi->activeUser($param);
     //$url = "http://118.98.96.53/system/createuser?userAccount=".trim($_GET['email'])."&username="******"&password={$password}&userType=1&email={$param['email']}";
     $url = "http://www.useetv.com/api/createuser?userAccount=" . $email . "&username="******"&password={$password}&userType=1&email={$param['email']}";
     $rs = file_get_contents($url);
     $output_rs = xmlstr_to_array($rs);
     $subject = "Selamat datang di UseeTV";
     $text = "Anda telah registrasi di useetv.com.<br/>\n\t\t   Login anda <b>{$email}</b> dan password <b>{$password}</b>, anda dapat mengganti password melalui website \n\t\t   <a href='http://www.useetv.com'>useetv.com</a><br/><br/>\n\t\t \n\t\t Terimakasih,<br/><br/>\n\t\t \n\t\t UseeTV Team\n\t\t ";
     $rs_acid = explode(';', $outCrt['return']->Result->ResultMessage);
     if ($rs_acid[1] || $output_rs['Response']['@attributes']['resultCode'] == 1) {
         $this->sendMailSwift($email, $subject, $text, 3);
     }
     $out = array('rs' => true, 'p' => $password, 'acid' => $rs_acid[1], 'output_rs' => $output_rs);
     echo json_encode($out);
     exit;
 }
示例#6
0
function curl_soap($xml, $api_url, $soap_action, $timeout = 60)
{
    $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $api_url);
    // set url to post to
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // return variable
    curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
    // connection timeout
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
    $header[] = "SOAPAction: " . $soap_action;
    $header[] = "MIME-Version: 1.0";
    $header[] = "Content-type: text/xml; charset=utf-8";
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    $xml = curl_exec($ch);
    // run the whole process
    if (curl_errno($ch)) {
        $error['curl_error'] = 'Connection Error : ' . curl_error($ch);
        return $error;
    } else {
        curl_close($ch);
        $xml = str_replace('<s:', '<', $xml);
        // Remove the XML namespace closing tags
        $xml = str_replace('</s:', '</', $xml);
        $xml = str_replace('<a:', '<', $xml);
        // Remove the XML namespace closing tags
        $xml = str_replace('</a:', '</', $xml);
        $arr = xmlstr_to_array($xml);
        return $arr;
    }
}
示例#7
0
 
 	Once we have the Vcards, we save them to disk as a file per VCard
 	which we can then search through when a lookup is required.
 
 	We cache the lookup results in memory for the running session
 	to avoid too many file searches.
 */
 // download the list of address book objects
 // (we just grab the IDs and date modified here)
 try {
     $address_list_xml = @$carddav->get(false, false);
 } catch (Exception $e) {
     $log->error("[contacts] Error from CardDAV: {$e->getMessage()}");
     $log->error_fatal("[contacts] A fatal error occured whilst attempting to fetch contacts from CardDAV server");
 }
 $address_list_array = xmlstr_to_array($address_list_xml);
 $address_list_update = array();
 $address_list_all = array();
 // run through the list and see which ones need updating
 foreach ($address_list_array["element"] as $address_list_entry) {
     $timestamp = null;
     if (preg_match("/^([0-9]*)-([0-9]*)-([0-9]*)T([0-9]*):([0-9]*):([0-9]*)/", $address_list_entry["etag"], $matches)) {
         $timestamp = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
     }
     $filename = $config["SMStoXMPP"]["contacts_store"] . "/" . $address_list_entry["id"] . ".vcf";
     if (file_exists($filename)) {
         if (filemtime($filename) < $timestamp) {
             $log->debug("[contacts] VCard {$filename} is outdated and the latest VCard needs to be fetched");
             $address_list_update[] = $address_list_entry["id"];
         }
     } else {
示例#8
0
                     return $AjaxForm->success($send_result['message']);
                 } elseif ($send_result['status'] == 'error') {
                     return $AjaxForm->error($send_result['message']);
                 } else {
                     return $AjaxForm->error('Статус отправки Емайл неопределен.');
                 }
             }
         }
     }
     break;
 case 'send_phone_confirmation':
     $r = json_decode($modx->runSnippet('send_phone_confirmation', array('phone' => $params['blogger_phone'], 'key' => $params['key'])), true);
     if (empty($r)) {
         return $AjaxForm->error('Некорректный телефон: ' . $params['blogger_phone'], array('name' => $err));
     }
     $sms_result = xmlstr_to_array($r['result']);
     if (count($sms_result['errors']) == 0) {
         return $AjaxForm->success('На номер ' . $r['phone'] . ' отправлен проверочный код.<br>' . $r['result']);
     } else {
         $err = implode("<br> ", array_values($sms_result['errors']));
         return $AjaxForm->error('Ошибка: ' . $err, array('name' => $err));
     }
     break;
 case 'confirm_phone':
     $r = json_decode($modx->runSnippet('confirm_phone', array('phone' => $params['blogger_phone'], 'confirm_code' => $params['blogger_confirmcode'], 'key' => $params['key'])), true);
     if ($r == '1') {
         return $AjaxForm->success('Ваш телефон ' . $params['blogger_phone'] . ' подтвержден.');
     } else {
         return $AjaxForm->error('Ошибка. Телефон не подтвержден.', array('name' => 'Телефон не подтвержден.'));
     }
     break;