当前位置: 首页>>代码示例>>PHP>>正文


PHP w2u函数代码示例

本文整理汇总了PHP中w2u函数的典型用法代码示例。如果您正苦于以下问题:PHP w2u函数的具体用法?PHP w2u怎么用?PHP w2u使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了w2u函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: KolabReadTask

 private function KolabReadTask($message, $id, $disableAlarm = false, $with_uid = false)
 {
     $task = NULL;
     if (isset($message->parts)) {
         foreach ($message->parts as $part) {
             if (isset($part->disposition) && ($part->disposition == "attachment" || $part->disposition == "inline")) {
                 $type = $part->headers;
                 //kolab contact attachment ?
                 $ctype = explode(";", $type["content-type"]);
                 if ($ctype[0] == " application/x-vnd.kolab.task") {
                     $format = Horde_Kolab_Format::factory('XML', 'task');
                     $body = $part->body;
                     $ktask = $format->load($body);
                     unset($format);
                     if ($ktask instanceof PEAR_Error) {
                         //parsing error
                         debugLog("ERROR " . $ktask->message);
                         debugLog("Xml kolab :     {$body}");
                         $this->Log("ERROR " . $ktask->message);
                         $this->Log("XML : {$body}");
                         unset($ktask);
                         return "";
                     }
                     //mappage
                     $task = new SyncTask();
                     if ($with_uid != 0) {
                         $task->uid = hex2bin($ktask['uid']);
                     }
                     $task->subject = w2u($ktask['name']);
                     if ($ktask['start']) {
                         $offset = date('Z', $ktask['start']);
                         $task->utcstartdate = $kstart['start'];
                         $task->startdate = $ktask['start'] + $offset;
                     }
                     if ($ktask['due']) {
                         $offset = date('Z', $ktask['due']);
                         $task->utcduedate = $ktask['due'];
                         $task->duedate = $ktask['due'] + $offset;
                     }
                     $task->complete = $ktask['completed'];
                     if (isset($ktask['completed_date'])) {
                         $task->datecompleted = $ktask['completed_date'];
                     }
                     //categories
                     if (isset($ktask['categories'])) {
                         $cat = split(',', w2u($ktask['categories']));
                         $task->categories = $cat;
                     }
                     switch ($ktask['priority']) {
                         case 1:
                             $task->importance = 2;
                             break;
                         case 2:
                         case 3:
                         case 4:
                             $task->importance = 1;
                             break;
                         case 5:
                             $task->importance = 0;
                     }
                     switch (strtolower($ktask['sensitivity'])) {
                         case "public":
                             $task->sensitivity = 0;
                             break;
                         case "private":
                             $task->sensitivity = 2;
                             break;
                         case "confidential":
                             $task->sensitivity = 3;
                     }
                     //bug #9 Alarm mus not be shown for all folders
                     if ($disableAlarm == false) {
                         if ($ktask['alarm'] > 0) {
                             $task->remindertime = $ktask["start"] + $ktask['alarm'] * 60;
                             $task->reminderset = 1;
                         }
                     } else {
                         $task->reminderset = NULL;
                         $task->remindertime = NULL;
                     }
                     $task->body = w2u($ktask['body']);
                     //timezone must be fixed
                     $task->bodytruncated = 0;
                     //reccurence process
                     if (isset($ktask["recurrence"])) {
                         $task->reccurence = $this->kolabReadRecurrence($ktask, 1);
                     }
                     return $task;
                 }
                 $n++;
             }
         }
     }
     return "";
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:95,代码来源:kolab.php

示例2: getSearchResults

 function getSearchResults($searchquery, $searchrange)
 {
     // only return users from who the displayName or the username starts with $name
     //TODO: use PR_ANR for this restriction instead of PR_DISPLAY_NAME and PR_ACCOUNT
     $addrbook = mapi_openaddressbook($this->_session);
     $ab_entryid = mapi_ab_getdefaultdir($addrbook);
     $ab_dir = mapi_ab_openentry($addrbook, $ab_entryid);
     $table = mapi_folder_getcontentstable($ab_dir);
     $restriction = $this->_getSearchRestriction(u2w($searchquery));
     mapi_table_restrict($table, $restriction);
     mapi_table_sort($table, array(PR_DISPLAY_NAME => TABLE_SORT_ASCEND));
     //range for the search results, default symbian range end is 50, wm 99,
     //so we'll use that of nokia
     $rangestart = 0;
     $rangeend = 50;
     if ($searchrange != '0') {
         $pos = strpos($searchrange, '-');
         $rangestart = substr($searchrange, 0, $pos);
         $rangeend = substr($searchrange, $pos + 1);
     }
     $items = array();
     $querycnt = mapi_table_getrowcount($table);
     //do not return more results as requested in range
     $querylimit = $rangeend + 1 < $querycnt ? $rangeend + 1 : $querycnt;
     $items['range'] = $rangestart . '-' . ($querylimit - 1);
     $abentries = mapi_table_queryrows($table, array(PR_ACCOUNT, PR_DISPLAY_NAME, PR_SMTP_ADDRESS, PR_BUSINESS_TELEPHONE_NUMBER), $rangestart, $querylimit);
     for ($i = 0; $i < $querylimit; $i++) {
         $items[$i]["username"] = w2u($abentries[$i][PR_ACCOUNT]);
         $items[$i]["fullname"] = w2u($abentries[$i][PR_DISPLAY_NAME]);
         if (strlen(trim($items[$i]["fullname"])) == 0) {
             $items[$i]["fullname"] = $items[$i]["username"];
         }
         $items[$i]["emailaddress"] = w2u($abentries[$i][PR_SMTP_ADDRESS]);
         $items[$i]["nameid"] = $searchquery;
         //check if an user has a business phone or it might produce warnings in the log
         $items[$i]["businessphone"] = isset($abentries[$i][PR_BUSINESS_TELEPHONE_NUMBER]) ? w2u($abentries[$i][PR_BUSINESS_TELEPHONE_NUMBER]) : "";
     }
     return $items;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:39,代码来源:ics.php

示例3: getSearchResultsGAL

 function getSearchResultsGAL($searchquery)
 {
     // only return users from who the displayName or the username starts with $name
     //TODO: use PR_ANR for this restriction instead of PR_DISPLAY_NAME and PR_ACCOUNT
     $addrbook = mapi_openaddressbook($this->_session);
     $ab_entryid = mapi_ab_getdefaultdir($addrbook);
     $ab_dir = mapi_ab_openentry($addrbook, $ab_entryid);
     $table = mapi_folder_getcontentstable($ab_dir);
     $restriction = $this->_getSearchRestriction(u2w($searchquery));
     mapi_table_restrict($table, $restriction);
     mapi_table_sort($table, array(PR_DISPLAY_NAME => TABLE_SORT_ASCEND));
     // CHANGED dw2412 AS V12.0 Support (to menetain single return way...
     $items['rows'] = array();
     for ($i = 0; $i < mapi_table_getrowcount($table); $i++) {
         $user_data = mapi_table_queryrows($table, array(PR_ACCOUNT, PR_DISPLAY_NAME, PR_SMTP_ADDRESS, PR_BUSINESS_TELEPHONE_NUMBER), $i, 1);
         $item = array();
         $item["username"] = w2u($user_data[0][PR_ACCOUNT]);
         $item["fullname"] = w2u($user_data[0][PR_DISPLAY_NAME]);
         if (strlen(trim($item["fullname"])) == 0) {
             $item["fullname"] = $item["username"];
         }
         $item["emailaddress"] = w2u($user_data[0][PR_SMTP_ADDRESS]);
         $item["nameid"] = $searchquery;
         $item["businessphone"] = isset($user_data[0][PR_BUSINESS_TELEPHONE_NUMBER]) ? w2u($user_data[0][PR_BUSINESS_TELEPHONE_NUMBER]) : "";
         //do not return users without email
         if (strlen(trim($item["emailaddress"])) == 0) {
             continue;
         }
         // CHANGED dw2412 AS V12.0 Support (to menetain single return way...
         array_push($items['rows'], $item);
     }
     $items['status'] = 1;
     return $items;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:34,代码来源:ics.php

示例4: getSettings

 function getSettings($request, $devid)
 {
     if (isset($request["userinformation"])) {
         $response["userinformation"]["status"] = true;
         $response["userinformation"]["emailaddresses"][] = $userdetails["emailaddress"];
     }
     if (isset($request["oof"])) {
         if ($props != false) {
             $response["oof"]["status"] = 1;
             // return oof messsage and where it should apply here
             $response["oof"]["oofstate"] = 0;
             $oofmsg["appliesto"] = SYNC_SETTINGS_APPLIESTOINTERNAL;
             $oofmsg["replymessage"] = w2u("");
             $oofmsg["enabled"] = 0;
             $oofmsg["bodytype"] = $request["oof"]["bodytype"];
             $response["oof"]["oofmsgs"][] = $oofmsg;
             // $this->settings["outofoffice"]["subject"] = windows1252_to_utf8(isset($props[PR_EC_OUTOFOFFICE_SUBJECT]) ? $props[PR_EC_OUTOFOFFICE_SUBJECT] : "");
         } else {
             $response["oof"]["status"] = 0;
         }
     }
     return $response;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:23,代码来源:combined.php

示例5: getSearchResults

 function getSearchResults($searchquery, $searchrange)
 {
     // only return users from who the displayName or the username starts with $name
     //TODO: use PR_ANR for this restriction instead of PR_DISPLAY_NAME and PR_ACCOUNT
     $addrbook = mapi_openaddressbook($this->_session);
     $ab_entryid = mapi_ab_getdefaultdir($addrbook);
     $ab_dir = mapi_ab_openentry($addrbook, $ab_entryid);
     $table = mapi_folder_getcontentstable($ab_dir);
     $restriction = $this->_getSearchRestriction(u2w($searchquery));
     mapi_table_restrict($table, $restriction);
     mapi_table_sort($table, array(PR_DISPLAY_NAME => TABLE_SORT_ASCEND));
     //range for the search results, default symbian range end is 50, wm 99,
     //so we'll use that of nokia
     $rangestart = 0;
     $rangeend = 50;
     if ($searchrange != '0') {
         $pos = strpos($searchrange, '-');
         $rangestart = substr($searchrange, 0, $pos);
         $rangeend = substr($searchrange, $pos + 1);
     }
     $items = array();
     $querycnt = mapi_table_getrowcount($table);
     //do not return more results as requested in range
     $querylimit = $rangeend + 1 < $querycnt ? $rangeend + 1 : $querycnt;
     $items['range'] = $rangestart . '-' . ($querylimit - 1);
     $items['searchtotal'] = $querycnt;
     if ($querycnt > 0) {
         $abentries = mapi_table_queryrows($table, array(PR_ACCOUNT, PR_DISPLAY_NAME, PR_SMTP_ADDRESS, PR_BUSINESS_TELEPHONE_NUMBER, PR_GIVEN_NAME, PR_SURNAME, PR_MOBILE_TELEPHONE_NUMBER, PR_HOME_TELEPHONE_NUMBER, PR_TITLE, PR_COMPANY_NAME, PR_OFFICE_LOCATION), $rangestart, $querylimit);
     }
     for ($i = 0; $i < $querylimit; $i++) {
         $items[$i][SYNC_GAL_DISPLAYNAME] = w2u($abentries[$i][PR_DISPLAY_NAME]);
         if (strlen(trim($items[$i][SYNC_GAL_DISPLAYNAME])) == 0) {
             $items[$i][SYNC_GAL_DISPLAYNAME] = w2u($abentries[$i][PR_ACCOUNT]);
         }
         $items[$i][SYNC_GAL_ALIAS] = w2u($abentries[$i][PR_ACCOUNT]);
         //it's not possible not get first and last name of an user
         //from the gab and user functions, so we just set lastname
         //to displayname and leave firstname unset
         //this was changed in Zarafa 6.40, so we try to get first and
         //last name and fall back to the old behaviour if these values are not set
         if (isset($abentries[$i][PR_GIVEN_NAME])) {
             $items[$i][SYNC_GAL_FIRSTNAME] = w2u($abentries[$i][PR_GIVEN_NAME]);
         }
         if (isset($abentries[$i][PR_SURNAME])) {
             $items[$i][SYNC_GAL_LASTNAME] = w2u($abentries[$i][PR_SURNAME]);
         }
         if (!isset($items[$i][SYNC_GAL_LASTNAME])) {
             $items[$i][SYNC_GAL_LASTNAME] = $items[$i][SYNC_GAL_DISPLAYNAME];
         }
         $items[$i][SYNC_GAL_EMAILADDRESS] = w2u($abentries[$i][PR_SMTP_ADDRESS]);
         //check if an user has an office number or it might produce warnings in the log
         if (isset($abentries[$i][PR_BUSINESS_TELEPHONE_NUMBER])) {
             $items[$i][SYNC_GAL_PHONE] = w2u($abentries[$i][PR_BUSINESS_TELEPHONE_NUMBER]);
         }
         //check if an user has a mobile number or it might produce warnings in the log
         if (isset($abentries[$i][PR_MOBILE_TELEPHONE_NUMBER])) {
             $items[$i][SYNC_GAL_MOBILEPHONE] = w2u($abentries[$i][PR_MOBILE_TELEPHONE_NUMBER]);
         }
         //check if an user has a home number or it might produce warnings in the log
         if (isset($abentries[$i][PR_HOME_TELEPHONE_NUMBER])) {
             $items[$i][SYNC_GAL_HOMEPHONE] = w2u($abentries[$i][PR_HOME_TELEPHONE_NUMBER]);
         }
         if (isset($abentries[$i][PR_COMPANY_NAME])) {
             $items[$i][SYNC_GAL_COMPANY] = w2u($abentries[$i][PR_COMPANY_NAME]);
         }
         if (isset($abentries[$i][PR_TITLE])) {
             $items[$i][SYNC_GAL_TITLE] = w2u($abentries[$i][PR_TITLE]);
         }
         if (isset($abentries[$i][PR_OFFICE_LOCATION])) {
             $items[$i][SYNC_GAL_OFFICE] = w2u($abentries[$i][PR_OFFICE_LOCATION]);
         }
     }
     return $items;
 }
开发者ID:nnaannoo,项目名称:paskot,代码行数:74,代码来源:ics.php

示例6: GetMessage

 /**
  * Returns the actual SyncXXX object type.
  *
  * @param string            $folderid           id of the parent folder
  * @param string            $id                 id of the message
  * @param ContentParameters $contentparameters  parameters of the requested message (truncation, mimesupport etc)
  *
  * @access public
  * @return object/false     false if the message could not be retrieved
  */
 public function GetMessage($folderid, $id, $truncsize, $mimesupport = 0)
 {
     if ($folderid != 'root') {
         return false;
     }
     $fn = $this->findMessage($id);
     // Get flags, etc
     $stat = $this->StatMessage($folderid, $id);
     // Parse e-mail
     $rfc822 = file_get_contents($this->getPath() . "/" . $fn);
     $message = Mail_mimeDecode::decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $rfc822, 'crlf' => "\n", 'charset' => 'utf-8'));
     $output = new SyncMail();
     $output->body = str_replace("\n", "\r\n", $this->getBody($message));
     $output->bodysize = strlen($output->body);
     $output->bodytruncated = 0;
     // We don't implement truncation in this backend
     $output->datereceived = $this->parseReceivedDate($message->headers["received"][0]);
     $output->messageclass = "IPM.Note";
     $output->subject = $message->headers["subject"];
     $output->read = $stat["flags"];
     $output->from = $message->headers["from"];
     $Mail_RFC822 = new Mail_RFC822();
     $toaddr = $ccaddr = $replytoaddr = array();
     if (isset($message->headers["to"])) {
         $toaddr = $Mail_RFC822->parseAddressList($message->headers["to"]);
     }
     if (isset($message->headers["cc"])) {
         $ccaddr = $Mail_RFC822->parseAddressList($message->headers["cc"]);
     }
     if (isset($message->headers["reply_to"])) {
         $replytoaddr = $Mail_RFC822->parseAddressList($message->headers["reply_to"]);
     }
     $output->to = array();
     $output->cc = array();
     $output->reply_to = array();
     foreach (array("to" => $toaddr, "cc" => $ccaddr, "reply_to" => $replytoaddr) as $type => $addrlist) {
         foreach ($addrlist as $addr) {
             $address = $addr->mailbox . "@" . $addr->host;
             $name = $addr->personal;
             if (!isset($output->displayto) && $name != "") {
                 $output->displayto = $name;
             }
             if ($name == "" || $name == $address) {
                 $fulladdr = w2u($address);
             } else {
                 if (substr($name, 0, 1) != '"' && substr($name, -1) != '"') {
                     $fulladdr = "\"" . w2u($name) . "\" <" . w2u($address) . ">";
                 } else {
                     $fulladdr = w2u($name) . " <" . w2u($address) . ">";
                 }
             }
             array_push($output->{$type}, $fulladdr);
         }
     }
     // convert mime-importance to AS-importance
     if (isset($message->headers["x-priority"])) {
         $mimeImportance = preg_replace("/\\D+/", "", $message->headers["x-priority"]);
         if ($mimeImportance > 3) {
             $output->importance = 0;
         }
         if ($mimeImportance == 3) {
             $output->importance = 1;
         }
         if ($mimeImportance < 3) {
             $output->importance = 2;
         }
     }
     // Attachments are only searched in the top-level part
     $n = 0;
     if (isset($message->parts)) {
         foreach ($message->parts as $part) {
             if ($part->ctype_primary == "application") {
                 $attachment = new SyncAttachment();
                 $attachment->attsize = strlen($part->body);
                 if (isset($part->d_parameters['filename'])) {
                     $attname = $part->d_parameters['filename'];
                 } else {
                     if (isset($part->ctype_parameters['name'])) {
                         $attname = $part->ctype_parameters['name'];
                     } else {
                         if (isset($part->headers['content-description'])) {
                             $attname = $part->headers['content-description'];
                         } else {
                             $attname = "unknown attachment";
                         }
                     }
                 }
                 $attachment->displayname = $attname;
                 $attachment->attname = $id . ":" . $n;
                 $attachment->attmethod = 1;
//.........这里部分代码省略.........
开发者ID:karanikn,项目名称:php-addressbook,代码行数:101,代码来源:maildir.php

示例7: GetMessage

 function GetMessage($folderid, $id, $truncsize, $bodypreference = false, $optionbodypreference = false, $mimesupport = 0)
 {
     debugLog('iConDir::GetMessage(' . $folderid . ', ' . $this->_items[$id] . ', ..)');
     if ($folderid != "root") {
         return;
     }
     $types = array('dom' => 'type', 'intl' => 'type', 'postal' => 'type', 'parcel' => 'type', 'home' => 'type', 'work' => 'type', 'pref' => 'type', 'voice' => 'type', 'fax' => 'type', 'msg' => 'type', 'cell' => 'type', 'pager' => 'type', 'bbs' => 'type', 'modem' => 'type', 'car' => 'type', 'isdn' => 'type', 'video' => 'type', 'aol' => 'type', 'applelink' => 'type', 'attmail' => 'type', 'cis' => 'type', 'eworld' => 'type', 'internet' => 'type', 'ibmmail' => 'type', 'mcimail' => 'type', 'powershare' => 'type', 'prodigy' => 'type', 'tlx' => 'type', 'x400' => 'type', 'gif' => 'type', 'cgm' => 'type', 'wmf' => 'type', 'bmp' => 'type', 'met' => 'type', 'pmb' => 'type', 'dib' => 'type', 'pict' => 'type', 'tiff' => 'type', 'pdf' => 'type', 'ps' => 'type', 'jpeg' => 'type', 'qtime' => 'type', 'mpeg' => 'type', 'mpeg2' => 'type', 'avi' => 'type', 'wave' => 'type', 'aiff' => 'type', 'pcm' => 'type', 'x509' => 'type', 'pgp' => 'type', 'text' => 'value', 'inline' => 'value', 'url' => 'value', 'cid' => 'value', 'content-id' => 'value', '7bit' => 'encoding', '8bit' => 'encoding', 'quoted-printable' => 'encoding', 'base64' => 'encoding');
     // Parse the vcard
     $message = new SyncContact();
     $data = file_get_contents($this->_path . "/" . $this->_items[$id]);
     $data = str_replace("", '', $data);
     $data = str_replace("\r\n", "\n", $data);
     $data = str_replace("\r", "\n", $data);
     $data = preg_replace('/(\\n)([ \\t])/i', '', $data);
     $data = utf8_decode($data);
     $lines = explode("\n", $data);
     $vcard = array();
     foreach ($lines as $line) {
         if (trim($line) == '') {
             continue;
         }
         $pos = strpos($line, ':');
         if ($pos === false) {
             continue;
         }
         $field = trim(substr($line, 0, $pos));
         $value = trim(substr($line, $pos + 1));
         $fieldparts = preg_split('/(?<!\\\\)(\\;)/i', $field, -1, PREG_SPLIT_NO_EMPTY);
         $type = strtolower(array_shift($fieldparts));
         $fieldvalue = array();
         foreach ($fieldparts as $fieldpart) {
             if (preg_match('/([^=]+)=(.+)/', $fieldpart, $matches)) {
                 if (!in_array(strtolower($matches[1]), array('value', 'type', 'encoding', 'language'))) {
                     continue;
                 }
                 if (isset($fieldvalue[strtolower($matches[1])]) && is_array($fieldvalue[strtolower($matches[1])])) {
                     $fieldvalue[strtolower($matches[1])] = array_merge($fieldvalue[strtolower($matches[1])], preg_split('/(?<!\\\\)(\\,)/i', $matches[2], -1, PREG_SPLIT_NO_EMPTY));
                 } else {
                     $fieldvalue[strtolower($matches[1])] = preg_split('/(?<!\\\\)(\\,)/i', $matches[2], -1, PREG_SPLIT_NO_EMPTY);
                 }
             } else {
                 if (!isset($types[strtolower($fieldpart)])) {
                     continue;
                 }
                 $fieldvalue[$types[strtolower($fieldpart)]][] = $fieldpart;
             }
         }
         //
         switch ($type) {
             case 'categories':
                 //case 'nickname':
                 $val = preg_split('/(?<!\\\\)(\\,)/i', $value);
                 $val = array_map("w2ui", $val);
                 break;
             default:
                 $val = preg_split('/(?<!\\\\)(\\;)/i', $value);
                 break;
         }
         if (isset($fieldvalue['encoding'][0])) {
             switch (strtolower($fieldvalue['encoding'][0])) {
                 case 'q':
                 case 'quoted-printable':
                     foreach ($val as $i => $v) {
                         $val[$i] = quoted_printable_decode($v);
                     }
                     break;
                 case 'b':
                 case 'base64':
                     foreach ($val as $i => $v) {
                         $val[$i] = base64_decode($v);
                     }
                     break;
             }
         } else {
             foreach ($val as $i => $v) {
                 $val[$i] = $this->unescape($v);
             }
         }
         $fieldvalue['val'] = $val;
         $vcard[$type][] = $fieldvalue;
     }
     $fieldmapping = $this->_mapping;
     foreach ($fieldmapping as $k => $v) {
         switch ($v) {
             case 'body':
                 if ($bodypreference == false) {
                     $message->body = w2u(str_replace("\n", "\r\n", str_replace("\r", "", $vcard[$k][0]['val'][0])));
                     $message->bodysize = strlen($message->body);
                     $message->bodytruncated = 0;
                 } else {
                     $message->airsyncbasebody = new SyncAirSyncBaseBody();
                     debugLog("airsyncbasebody!");
                     $message->airsyncbasenativebodytype = 1;
                     if (isset($bodypreference[2])) {
                         debugLog("HTML Body");
                         // Send HTML if requested and native type was html
                         $message->airsyncbasebody->type = 2;
                         $html = '<html>' . '<head>' . '<meta name="Generator" content="Z-Push">' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . '</head>' . '<body>' . str_replace("\n", "<BR>", str_replace("\r", "<BR>", str_replace("\r\n", "<BR>", w2u($vcard[$k][0]['val'][0])))) . '</body>' . '</html>';
                         if (isset($bodypreference[2]["TruncationSize"]) && strlen($html) > $bodypreference[2]["TruncationSize"]) {
                             $html = utf8_truncate($html, $bodypreference[2]["TruncationSize"]);
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:activesync,代码行数:101,代码来源:icondir.php

示例8: GetMessage

 function GetMessage($folderid, $id, $truncsize, $bodypreference = false, $optionbodypreference = false, $mimesupport = 0)
 {
     debugLog('GContacts::GetMessage(' . $folderid . ', ' . $this->_items[$id] . ', ..)');
     if ($folderid != "root") {
         return;
     }
     debugLog("GContacts::GetMessage: (fid: '{$folderid}'  id: '{$id}' )");
     // Parse the vcard
     $message = new SyncContact();
     try {
         // perform query and get feed of all results
         $query = new Zend_Gdata_Query(GCONTACTS_URL . '/' . $id);
         $entry = $this->service->getEntry($query);
     } catch (Zend_Gdata_App_Exception $e) {
         debugLog("GContacts::GetMessage - ERROR! (" . $e->getMessage() . ")");
         return false;
     }
     // parse feed and extract contact information
     // into simpler objects
     try {
         $doc = new DOMDocument();
         $doc->formatOutput = true;
         //$obj = new stdClass;
         //$obj->edit = $entry->getEditLink()->href;
         $xmldata = $entry->getXML();
         $doc->loadXML($xmldata);
         //filter out real contact id without other garbage
         preg_match("/[_a-z0-9]+\$/", $entry->id, $matches);
         $contactid = $matches[0];
         $fh = fopen(STATE_DIR . '/xml-get/' . (string) $entry->title . '_' . (string) $contactid . '.xml', 'w');
         fwrite($fh, $doc->saveXML());
         $xml = simplexml_load_string($xmldata);
         fclose($fh);
         //Prefix:
         //givenName:	 ok
         //Middle:
         //familyName:		ok
         //nameSuffix:	ok
         //last
         //first
         //middlename
         //title
         //suffix
         if (!empty($xml->name->fullName)) {
             debugLog('GContacts::GetMessage - fullName: ' . (string) $xml->name->fullName);
             $message->fileas = w2ui($xml->name->fullName);
         }
         //    if (!empty($xml->name->namePrefix)){
         //	debugLog('GContacts::GetMessage - namePrefix: '.(string) $xml->name->namePrefix);
         //	$message->middlename = w2ui($xml->name->namePrefix);
         //    }
         if (!empty($xml->name->givenName)) {
             debugLog('GContacts::GetMessage - givenName: ' . (string) $xml->name->givenName);
             $message->firstname = w2ui($xml->name->givenName);
         }
         //if (!empty($xml->name->????)){
         //	debugLog('GContacts::GetMessage - familyName: '.(string) $xml->name->????);
         //	$message->title = w2ui($xml->name->^^^^);
         //    }
         if (!empty($xml->name->familyName)) {
             debugLog('GContacts::GetMessage - familyName: ' . (string) $xml->name->familyName);
             $message->lastname = w2ui($xml->name->familyName);
         }
         if (!empty($xml->name->nameSuffix)) {
             debugLog('GContacts::GetMessage - nameSuffix: ' . (string) $xml->name->nameSuffix);
             $message->suffix = w2ui($xml->name->nameSuffix);
         }
         if (!empty($xml->organization->orgName)) {
             debugLog('GContacts::GetMessage - orgName: ' . (string) $xml->organization->orgName);
             $message->companyname = w2ui($xml->organization->orgName);
         }
         if (!empty($xml->organization->orgTitle)) {
             debugLog('GContacts::GetMessage - orgName: ' . (string) $xml->organization->orgTitle);
             $message->jobtitle = w2ui($xml->organization->orgTitle);
         }
         if (!empty($xml->nickname)) {
             debugLog('GContacts::GetMessage - Nickname: ' . (string) $xml->nickname);
             $message->nickname = w2ui($xml->nickname);
         }
         foreach ($xml->email as $e) {
             debugLog('GContacts::GetMessage - email: ' . (string) $e['address']);
             if (empty($message->email1address)) {
                 $message->email1address = w2ui($e['address']);
             } elseif (empty($message->email2address)) {
                 $message->email2address = w2ui($e['address']);
             } elseif (empty($message->email3address)) {
                 $message->email3address = w2ui($e['address']);
             } else {
                 debugLog('GContacts::GetMessage - LOST email address: ' . (string) $e['address']);
             }
         }
         foreach ($xml->im as $i) {
             debugLog('GContacts::GetMessage - im: ' . (string) $i['address']);
             if (empty($message->imaddress)) {
                 $message->imaddress = w2ui($i['address']);
             } elseif (empty($message->im2address)) {
                 $message->imaddress2 = w2ui($i['address']);
             } elseif (empty($message->imaddress3)) {
                 $message->imaddress3 = w2ui($i['address']);
             } else {
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:activesync,代码行数:101,代码来源:gcontacts.php

示例9: resolveRecipientGAL

 /**
  * Resolves recipient from the GAL and gets his certificates.
  *
  * @param string $to
  * @return SyncResolveRecipient|boolean
  */
 private function resolveRecipientGAL($to)
 {
     $addrbook = $this->getAddressbook();
     $ab_entryid = mapi_ab_getdefaultdir($addrbook);
     if ($ab_entryid) {
         $ab_dir = mapi_ab_openentry($addrbook, $ab_entryid);
     }
     if ($ab_dir) {
         $table = mapi_folder_getcontentstable($ab_dir);
     }
     //         if (!$table)
     //             throw new StatusException(sprintf("ZarafaBackend->resolveRecipient(): could not open addressbook: 0x%X", mapi_last_hresult()), SYNC_RESOLVERECIPSSTATUS_RESPONSE_UNRESOLVEDRECIP);
     if (!$table) {
         ZLog::Write(LOGLEVEL_WARN, sprintf("Unable to open addressbook:0x%X", mapi_last_hresult()));
         return false;
     }
     $restriction = MAPIUtils::GetSearchRestriction(u2w($to));
     mapi_table_restrict($table, $restriction);
     $querycnt = mapi_table_getrowcount($table);
     if ($querycnt > 0) {
         $abentries = mapi_table_queryrows($table, array(PR_DISPLAY_NAME, PR_EMS_AB_TAGGED_X509_CERT), 0, 1);
         $certificates = isset($abentries[0][PR_EMS_AB_TAGGED_X509_CERT]) && is_array($abentries[0][PR_EMS_AB_TAGGED_X509_CERT]) && count($abentries[0][PR_EMS_AB_TAGGED_X509_CERT]) ? $this->getCertificates($abentries[0][PR_EMS_AB_TAGGED_X509_CERT], $querycnt) : false;
         if ($certificates === false) {
             // the recipient does not have a valid certificate, set the appropriate status
             ZLog::Write(LOGLEVEL_INFO, sprintf("No certificates found for '%s'", $to));
             $certificates = $this->getCertificates(false);
         }
         $recipient = $this->createResolveRecipient(SYNC_RESOLVERECIPIENTS_TYPE_GAL, w2u($abentries[0][PR_DISPLAY_NAME]), $to, $certificates);
         return $recipient;
     } else {
         ZLog::Write(LOGLEVEL_WARN, sprintf("No recipient found for: '%s'", $to));
         return SYNC_RESOLVERECIPSSTATUS_RESPONSE_UNRESOLVEDRECIP;
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:41,代码来源:zarafa.php

示例10: Convert

 function Convert()
 {
     $message = $this->_mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'rfc_822bodies' => true, 'include_bodies' => true, 'crlf' => "\n", 'charset' => BACKEND_CHARSET));
     $rawmessage = $this->_mobj->decode(array('decode_headers' => false, 'decode_bodies' => true, 'rfc_822bodies' => true, 'include_bodies' => true, 'crlf' => "\n", 'charset' => BACKEND_CHARSET));
     $body = "";
     foreach ($rawmessage->headers as $key => $value) {
         if ($key != "content-type" && $key != "mime-version" && $key != "content-transfer-encoding" && !is_array($value)) {
             $body .= $key . ":";
             // Split -> Explode replace
             $tokens = explode(" ", trim($value));
             $line = "";
             foreach ($tokens as $valu) {
                 if (strlen($line) + strlen($valu) + 2 > 60) {
                     $line .= "\n";
                     $body .= $line;
                     $line = " " . $valu;
                 } else {
                     $line .= " " . $valu;
                 }
             }
             $body .= $line . "\n";
         }
     }
     unset($rawmessage);
     $mimemsg = new Mail_mime(array('head_encoding' => 'quoted-printable', 'text_encoding' => 'quoted-printable', 'html_encoding' => 'base64', 'head_charset' => 'utf-8', 'text_charset' => 'utf-8', 'html_charset' => 'utf-8', 'eol' => "\n", 'delay_file_io' => false));
     $this->getAllAttachmentsRecursive($message, $mimemsg);
     if ($this->_nativebodytype == 1) {
         $this->getBodyRecursive($message, "plain", $plain);
         $this->getBodyRecursive($message, "html", $html);
         if ($html == "") {
             $this->getBodyRecursive($message, "plain", $html);
         }
         if ($html == "" && $plain == "" && strlen($this->_mobj->_body) != "") {
             $body .= "Content-Type:" . $message->headers['content-type'] . "\r\n";
             $body .= "Content-Transfer-Encoding:" . $message->headers['content-transfer-encoding'] . "\r\n";
             $body .= "\n\n" . $this->_mobj->_body;
             return $body;
         }
         $mimemsg->setTXTBody(str_replace("\n", "\r\n", str_replace("\r", "", w2u($plain))));
         $html = '<html>' . '<head>' . '<meta name="Generator" content="Z-Push">' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . '</head>' . '<body>' . str_replace("\n", "<BR>", str_replace("\r", "", str_replace("\r\n", "<BR>", w2u($html)))) . '</body>' . '</html>';
         $mimemsg->setHTMLBody(str_replace("\n", "\r\n", str_replace("\r", "", $html)));
     }
     if ($this->_nativebodytype == 2) {
         $this->getBodyRecursive($message, "plain", $plain);
         if ($plain == "") {
             $this->getBodyRecursive($message, "html", $plain);
             // remove css-style tags
             $plain = preg_replace("/<style.*?<\\/style>/is", "", $plain);
             // remove all other html
             $plain = preg_replace("/<br.*>/is", "<br>", $plain);
             $plain = preg_replace("/<br >/is", "<br>", $plain);
             $plain = preg_replace("/<br\\/>/is", "<br>", $plain);
             $plain = str_replace("<br>", "\r\n", $plain);
             $plain = strip_tags($plain);
         }
         $mimemsg->setTXTBody(str_replace("\n", "\r\n", str_replace("\r", "", w2u($plain))));
         $this->getBodyRecursive($message, "html", $html);
         $mimemsg->setHTMLBody(str_replace("\n", "\r\n", str_replace("\r", "", w2u($html))));
     }
     if (!isset($output->airsyncbasebody->data)) {
         $body = $body . $mimemsg->txtheaders() . "\n\n" . $mimemsg->get();
     }
     return $body;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:64,代码来源:z_mimehelper.php

示例11: getEmailAddress

 function getEmailAddress($str)
 {
     if (strrpos($str, " ") && $str[0] != "\"") {
         $str = "\"" . substr($str, 0, strrpos($str, " ")) . "\"" . substr($str, strrpos($str, " "));
     }
     $address = imap_rfc822_parse_adrlist($str, "domain.com");
     if ($address[0]) {
         $email = $address[0]->mailbox . "@" . (isset($address[0]->host) ? $address[0]->host : "localhost");
         $str = $email;
     }
     return w2u($str);
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:12,代码来源:imap.php

示例12: GetFolder

 function GetFolder($id)
 {
     $folder = new SyncFolder();
     $folder->serverid = $id;
     // get real imap id from cache
     $id = $this->_folders[$id];
     // explode hierarchy
     $fhir = explode(".", $id);
     // compare on lowercase strings
     $lid = strtolower($id);
     if ($lid == "inbox") {
         $folder->parentid = "0";
         // Root
         $folder->displayname = "Inbox";
         $folder->type = SYNC_FOLDER_TYPE_INBOX;
     } else {
         if ($lid == "drafts") {
             $folder->parentid = "0";
             $folder->displayname = "Drafts";
             $folder->type = SYNC_FOLDER_TYPE_DRAFTS;
         } else {
             if ($lid == "trash" || $lid == "deleted items") {
                 $folder->parentid = "0";
                 $folder->displayname = "Trash";
                 $folder->type = SYNC_FOLDER_TYPE_WASTEBASKET;
                 $this->_wasteID = $id;
             } else {
                 if ($lid == "sent" || $lid == "sent items" || $lid == IMAP_SENTFOLDER) {
                     $folder->parentid = "0";
                     $folder->displayname = "Sent";
                     $folder->type = SYNC_FOLDER_TYPE_SENTMAIL;
                     $this->_sentID = $id;
                 } else {
                     if ($lid == "outbox") {
                         $folder->parentid = "0";
                         // Root
                         $folder->displayname = "Outbox";
                         $folder->type = SYNC_FOLDER_TYPE_OUTBOX;
                     } else {
                         if ($lid == "inbox.drafts") {
                             $folder->parentid = $fhir[0];
                             $folder->displayname = "Drafts";
                             $folder->type = SYNC_FOLDER_TYPE_DRAFTS;
                         } else {
                             if ($lid == "inbox.trash") {
                                 $folder->parentid = $fhir[0];
                                 $folder->displayname = "Trash";
                                 $folder->type = SYNC_FOLDER_TYPE_WASTEBASKET;
                                 $this->_wasteID = $id;
                             } else {
                                 if ($lid == "inbox.sent") {
                                     $folder->parentid = $fhir[0];
                                     $folder->displayname = "Sent";
                                     $folder->type = SYNC_FOLDER_TYPE_SENTMAIL;
                                     $this->_sentID = $id;
                                 } else {
                                     if ($lid == "inbox.outbox") {
                                         $folder->parentid = "0";
                                         // Root
                                         $folder->displayname = "Outbox";
                                         $folder->type = SYNC_FOLDER_TYPE_OUTBOX;
                                     } else {
                                         if (count($fhir) > 1) {
                                             $folder->displayname = w2u(imap_utf7_decode(array_pop($fhir)));
                                             if (($folder->parentid = array_search(implode(".", $fhir), $this->_folders)) === false) {
                                                 $folder->parentid = $this->_folderid();
                                                 $this->_folders[$folder->parentid] = implode(".", $fhir);
                                             }
                                         } else {
                                             $folder->displayname = w2u(imap_utf7_decode($id));
                                             $folder->parentid = "0";
                                         }
                                         $folder->type = SYNC_FOLDER_TYPE_USER_MAIL;
                                         // Type Other is not displayed on i.e. Nokia
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     //advanced debugging
     //debugLog("IMAP-GetFolder(id: '$id') -> " . print_r($folder, 1));
     file_put_contents(STATE_DIR . '/imap_folders_' . $this->_user, serialize($this->_folders));
     return $folder;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:88,代码来源:imap.php

示例13: settingsOofGet

 /**
  * Gets the out of office settings
  *
  * @param SyncObject $oof
  *
  * @access private
  * @return void
  */
 private function settingsOofGet(&$oof)
 {
     $oofprops = mapi_getprops($this->defaultstore, array(PR_EC_OUTOFOFFICE, PR_EC_OUTOFOFFICE_MSG, PR_EC_OUTOFOFFICE_SUBJECT, PR_EC_OUTOFOFFICE_FROM, PR_EC_OUTOFOFFICE_UNTIL));
     $oof->oofstate = SYNC_SETTINGSOOF_DISABLED;
     $oof->Status = SYNC_SETTINGSSTATUS_SUCCESS;
     if ($oofprops != false) {
         $oof->oofstate = isset($oofprops[PR_EC_OUTOFOFFICE]) ? $oofprops[PR_EC_OUTOFOFFICE] ? SYNC_SETTINGSOOF_GLOBAL : SYNC_SETTINGSOOF_DISABLED : SYNC_SETTINGSOOF_DISABLED;
         //TODO external and external unknown
         $oofmessage = new SyncOOFMessage();
         $oofmessage->appliesToInternal = "";
         $oofmessage->enabled = $oof->oofstate;
         $oofmessage->replymessage = isset($oofprops[PR_EC_OUTOFOFFICE_MSG]) ? w2u($oofprops[PR_EC_OUTOFOFFICE_MSG]) : "";
         $oofmessage->bodytype = $oof->bodytype;
         unset($oofmessage->appliesToExternal, $oofmessage->appliesToExternalUnknown);
         $oof->oofmessage[] = $oofmessage;
         // check whether time based out of office is set
         if ($oof->oofstate == SYNC_SETTINGSOOF_GLOBAL && isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) && isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL])) {
             if ($oofprops[PR_EC_OUTOFOFFICE_FROM] < $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) {
                 $oof->oofstate = SYNC_SETTINGSOOF_TIMEBASED;
                 $oof->starttime = $oofprops[PR_EC_OUTOFOFFICE_FROM];
                 $oof->endtime = $oofprops[PR_EC_OUTOFOFFICE_UNTIL];
             } else {
                 ZLog::Write(LOGLEVEL_WARN, sprintf("BackendKopano->settingsOofGet(): Time based out of office set but end time ('%s') is before startime ('%s').", date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_FROM]), date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_UNTIL])));
                 $oof->Status = SYNC_SETTINGSSTATUS_PROTOCOLLERROR;
             }
         } elseif ($oof->oofstate == SYNC_SETTINGSOOF_GLOBAL && (isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) || isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL]))) {
             ZLog::Write(LOGLEVEL_WARN, sprintf("Kopano->settingsOofGet(): Time based out of office set but either start time ('%s') or end time ('%s') is missing.", isset($oofprops[PR_EC_OUTOFOFFICE_FROM]) ? date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_FROM]) : 'empty', isset($oofprops[PR_EC_OUTOFOFFICE_UNTIL]) ? date("Y-m-d H:i:s", $oofprops[PR_EC_OUTOFOFFICE_UNTIL]) : 'empty'));
             $oof->Status = SYNC_SETTINGSSTATUS_PROTOCOLLERROR;
         }
     } else {
         ZLog::Write(LOGLEVEL_WARN, "Unable to get out of office information");
     }
     //unset body type for oof in order not to stream it
     unset($oof->bodytype);
 }
开发者ID:EGroupware,项目名称:z-push,代码行数:43,代码来源:kopano.php

示例14: _getFolder

 function _getFolder($mapifolder)
 {
     $folder = new SyncFolder();
     $folderprops = mapi_getprops($mapifolder, array(PR_DISPLAY_NAME, PR_PARENT_ENTRYID, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_ENTRYID));
     $storeprops = mapi_getprops($this->_store, array(PR_IPM_SUBTREE_ENTRYID));
     if (!isset($folderprops[PR_DISPLAY_NAME]) || !isset($folderprops[PR_PARENT_ENTRYID]) || !isset($folderprops[PR_SOURCE_KEY]) || !isset($folderprops[PR_ENTRYID]) || !isset($folderprops[PR_PARENT_SOURCE_KEY]) || !isset($storeprops[PR_IPM_SUBTREE_ENTRYID])) {
         debugLog("Missing properties on folder");
         return false;
     }
     $folder->serverid = bin2hex($folderprops[PR_SOURCE_KEY]);
     if ($folderprops[PR_PARENT_ENTRYID] == $storeprops[PR_IPM_SUBTREE_ENTRYID]) {
         $folder->parentid = "0";
     } else {
         $folder->parentid = bin2hex($folderprops[PR_PARENT_SOURCE_KEY]);
     }
     $folder->displayname = w2u($folderprops[PR_DISPLAY_NAME]);
     $folder->type = $this->_getFolderType($folderprops[PR_ENTRYID]);
     return $folder;
 }
开发者ID:jkreska,项目名称:test1,代码行数:19,代码来源:ics.php

示例15: GetMessage

 function GetMessage($folderid, $id, $truncsize, $bodypreference = false, $optionbodypreference = false, $mimesupport = 0)
 {
     debugLog('iCalDir::GetMessage(' . $folderid . ', ' . $this->_items[$id] . ', ..)');
     if ($folderid != "root") {
         return;
     }
     $types = array('dom' => 'type', 'intl' => 'type', 'postal' => 'type', 'parcel' => 'type', 'home' => 'type', 'work' => 'type', 'pref' => 'type', 'voice' => 'type', 'fax' => 'type', 'msg' => 'type', 'cell' => 'type', 'pager' => 'type', 'bbs' => 'type', 'modem' => 'type', 'car' => 'type', 'isdn' => 'type', 'video' => 'type', 'aol' => 'type', 'applelink' => 'type', 'attmail' => 'type', 'cis' => 'type', 'eworld' => 'type', 'internet' => 'type', 'ibmmail' => 'type', 'mcimail' => 'type', 'powershare' => 'type', 'prodigy' => 'type', 'tlx' => 'type', 'x400' => 'type', 'gif' => 'type', 'cgm' => 'type', 'wmf' => 'type', 'bmp' => 'type', 'met' => 'type', 'pmb' => 'type', 'dib' => 'type', 'pict' => 'type', 'tiff' => 'type', 'pdf' => 'type', 'ps' => 'type', 'jpeg' => 'type', 'qtime' => 'type', 'mpeg' => 'type', 'mpeg2' => 'type', 'avi' => 'type', 'wave' => 'type', 'aiff' => 'type', 'pcm' => 'type', 'x509' => 'type', 'pgp' => 'type', 'text' => 'value', 'inline' => 'value', 'url' => 'value', 'cid' => 'value', 'content-id' => 'value', '7bit' => 'encoding', '8bit' => 'encoding', 'quoted-printable' => 'encoding', 'base64' => 'encoding', 'uid' => 'value');
     // Parse the vcard
     $message = new SyncAppointment();
     $data = file_get_contents($this->_path . "/" . $this->_items[$id]);
     $data = str_replace("", '', $data);
     $data = str_replace("\r\n", "\n", $data);
     $data = str_replace("\r", "\n", $data);
     $data = preg_replace('/(\\n)([ \\t])/i', '', $data);
     $data = utf8_decode($data);
     $lines = explode("\n", $data);
     $vcard = array();
     foreach ($lines as $line) {
         if (trim($line) == '') {
             continue;
         }
         $pos = strpos($line, ':');
         if ($pos === false) {
             continue;
         }
         $field = trim(substr($line, 0, $pos));
         $value = trim(substr($line, $pos + 1));
         $fieldparts = preg_split('/(?<!\\\\)(\\;)/i', $field, -1, PREG_SPLIT_NO_EMPTY);
         $type = strtolower(array_shift($fieldparts));
         $fieldvalue = array();
         foreach ($fieldparts as $fieldpart) {
             if (preg_match('/([^=]+)=(.+)/', $fieldpart, $matches)) {
                 if (!in_array(strtolower($matches[1]), array('value', 'type', 'encoding', 'language'))) {
                     continue;
                 }
                 if (isset($fieldvalue[strtolower($matches[1])]) && is_array($fieldvalue[strtolower($matches[1])])) {
                     $fieldvalue[strtolower($matches[1])] = array_merge($fieldvalue[strtolower($matches[1])], preg_split('/(?<!\\\\)(\\,)/i', $matches[2], -1, PREG_SPLIT_NO_EMPTY));
                 } else {
                     $fieldvalue[strtolower($matches[1])] = preg_split('/(?<!\\\\)(\\,)/i', $matches[2], -1, PREG_SPLIT_NO_EMPTY);
                 }
             } else {
                 if (!isset($types[strtolower($fieldpart)])) {
                     continue;
                 }
                 $fieldvalue[$types[strtolower($fieldpart)]][] = $fieldpart;
             }
         }
         //
         switch ($type) {
             case 'categories':
                 //case 'nickname':
                 $val = preg_split('/(?<!\\\\)(\\,)/i', $value);
                 $val = array_map("w2ui", $val);
                 break;
             default:
                 $val = preg_split('/(?<!\\\\)(\\;)/i', $value);
                 break;
         }
         if (isset($fieldvalue['encoding'][0])) {
             switch (strtolower($fieldvalue['encoding'][0])) {
                 case 'q':
                 case 'quoted-printable':
                     foreach ($val as $i => $v) {
                         $val[$i] = quoted_printable_decode($v);
                     }
                     break;
                 case 'b':
                 case 'base64':
                     foreach ($val as $i => $v) {
                         $val[$i] = base64_decode($v);
                     }
                     break;
             }
         } else {
             foreach ($val as $i => $v) {
                 $val[$i] = $this->unescape($v);
             }
         }
         $fieldvalue['val'] = $val;
         $vcard[$type][] = $fieldvalue;
     }
     // debugLog('iCalDir::LoadedMessage-source:' . print_r($vcard,1));
     //http://www.zachstronaut.com/posts/2009/02/09/careful-with-php-empty.html
     // We pass all times in GMT to device. Calculation to gmt takes place based on timezone definition in config.php
     $message->timezone = base64_encode($this->_getSyncBlobFromTZ(array("bias" => 0, "dstendmonth" => 0, "dstendday" => 0, "dstendweek" => 0, "dstendhour" => 0, "dstendminute" => 0, "dstendsecond" => 0, "dstendmillis" => 0, "stdbias" => 0, "dststartmonth" => 0, "dststartday" => 0, "dststartweek" => 0, "dststarthour" => 0, "dststartminute" => 0, "dststartsecond" => 0, "dststartmillis" => 0, "dstbias" => 0)));
     $fieldmapping = $this->_mapping;
     foreach ($fieldmapping as $k => $v) {
         switch ($v) {
             // these fields should be filled with 0
             case 'busystatus':
             case 'sensitivity':
             case 'meetingstatus':
             case 'alldayevent':
                 $message->{$fieldmapping}[$k] = !empty($vcard[$k][0]['val'][0]) ? w2u($vcard[$k][0]['val'][0]) : "0";
                 break;
             case 'starttime':
             case 'endtime':
             case 'dtstamp':
                 if (empty($vcard[$k][0]['val'][0])) {
                     $message->{$fieldmapping}[$k] = NULL;
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:activesync,代码行数:101,代码来源:icaldir.php


注:本文中的w2u函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。