Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
spopp8 committed Apr 28, 2015
2 parents 7a56032 + c0fc573 commit e61a263
Show file tree
Hide file tree
Showing 619 changed files with 71,715 additions and 6,413 deletions.
4 changes: 2 additions & 2 deletions framework/ActiveSync/composer.json
Expand Up @@ -11,8 +11,8 @@
"role": "lead"
}
],
"version": "2.27.0",
"time": "2015-04-02",
"version": "2.27.1",
"time": "2015-04-28",
"repositories": [
{
"type": "pear",
Expand Down
13 changes: 6 additions & 7 deletions framework/ActiveSync/lib/Horde/ActiveSync.php
@@ -1,7 +1,5 @@
<?php
/**
* Horde_ActiveSync::
*
* @license http://www.horde.org/licenses/gpl GPLv2
* NOTE: According to sec. 8 of the GENERAL PUBLIC LICENSE (GPL),
* Version 2, the distribution of the Horde_ActiveSync module in or
Expand All @@ -11,9 +9,10 @@
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package ActiveSync
*/

/**
* Horde_ActiveSync:: The Horde ActiveSync server. Entry point for performing
* all ActiveSync operations.
* The Horde ActiveSync server. Entry point for performing all ActiveSync
* operations.
*
* @license http://www.horde.org/licenses/gpl GPLv2
* NOTE: According to sec. 8 of the GENERAL PUBLIC LICENSE (GPL),
Expand Down Expand Up @@ -677,9 +676,9 @@ public function handleRequest($cmd, $devId)
$cmd = $get['Cmd'];
}
if (empty($devId)) {
$devId = !empty($get['DeviceId']) ? strtoupper($get['DeviceId']) : null;
$devId = !empty($get['DeviceId']) ? Horde_String::upper($get['DeviceId']) : null;
} else {
$devId = strtoupper($devId);
$devId = Horde_String::upper($devId);
}
$this->_setLogger($get);

Expand Down Expand Up @@ -712,7 +711,7 @@ public function handleRequest($cmd, $devId)
self::$_logger->info(sprintf(
'[%s] %s request received for user %s',
$this->_procid,
strtoupper($cmd),
Horde_String::upper($cmd),
$this->_driver->getUser())
);

Expand Down
10 changes: 5 additions & 5 deletions framework/ActiveSync/lib/Horde/ActiveSync/Device.php
Expand Up @@ -375,7 +375,7 @@ public function save($all = true)
*/
public function getMajorVersion()
{
switch (strtolower($this->clientType)) {
switch (Horde_String::lower($this->clientType)) {
case self::TYPE_BLACKBERRY:
if (preg_match('/(.+)\/(.+)/', $this->userAgent, $matches)) {
return $matches[2];
Expand Down Expand Up @@ -425,7 +425,7 @@ public function getMajorVersion()
*/
public function getMinorVersion()
{
switch (strtolower($this->clientType)) {
switch (Horde_String::lower($this->clientType)) {
case self::TYPE_BLACKBERRY:
if (preg_match('/(.+)\/(.+)/', $this->userAgent, $matches)) {
return $matches[2];
Expand Down Expand Up @@ -535,7 +535,7 @@ public function getMinorVersion()
*/
public function normalizePoomContactsDates($date, $toEas = false)
{
switch (strtolower($this->clientType)) {
switch (Horde_String::lower($this->clientType)) {
case self::TYPE_WP:
case 'wp8': // Legacy. Remove in H6.
case 'wp': // Legacy. Remove in H6.
Expand Down Expand Up @@ -622,7 +622,7 @@ protected function _getClientType()
// Differentiate between the deviceType and the client app.
if ((!empty($this->properties[self::OS]) &&
stripos($this->properties[self::OS], 'Android') !== false) ||
strtolower($this->deviceType) == self::TYPE_ANDROID) {
Horde_String::lower($this->deviceType) == self::TYPE_ANDROID) {

// We can detect native Android, TouchDown, and Nine.
// Moxier does not distinguish itself, so we can't sniff it.
Expand Down Expand Up @@ -663,7 +663,7 @@ protected function _isNine()
*/
protected function _sniffMultiplex()
{
$clientType = strtolower($this->clientType);
$clientType = Horde_String::lower($this->clientType);
if (strpos($this->userAgent, 'iOS') === 0 || in_array($clientType, array(self::TYPE_IPAD, self::TYPE_IPOD, self::TYPE_IPHONE))) {
// iOS seems to support multiple collections for everything except Notes.
$this->_properties['properties'][self::MULTIPLEX] = Horde_ActiveSync_Device::MULTIPLEX_NOTES;
Expand Down
2 changes: 1 addition & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Driver/Base.php
Expand Up @@ -128,7 +128,7 @@ public function __construct($params = array())
$this->_logger = $params['logger'];
unset($params['logger']);
} else {
$this->_logger = new Horde_Support_Stub;
$this->_logger = new Horde_Log_Logger(new Horde_Log_Handler_Null());
}

$this->_state = $params['state'];
Expand Down
19 changes: 9 additions & 10 deletions framework/ActiveSync/lib/Horde/ActiveSync/Imap/Adapter.php
@@ -1,7 +1,5 @@
<?php
/**
* Horde_ActiveSync_Imap_Adapter::
*
* @license http://www.horde.org/licenses/gpl GPLv2
* NOTE: According to sec. 8 of the GENERAL PUBLIC LICENSE (GPL),
* Version 2, the distribution of the Horde_ActiveSync module in or
Expand All @@ -11,8 +9,9 @@
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package ActiveSync
*/

/**
* Horde_ActiveSync_Imap_Adapter:: Contains methods for communicating with
* Horde_ActiveSync_Imap_Adapter contains methods for communicating with
* Horde's Horde_Imap_Client library.
*
* @license http://www.horde.org/licenses/gpl GPLv2
Expand Down Expand Up @@ -61,7 +60,7 @@ public function __construct(array $params = array())
Horde_Mime_Part::$defaultCharset = 'UTF-8';
Horde_Mime_Headers::$defaultCharset = 'UTF-8';
$this->_procid = getmypid();
$this->_logger = new Horde_Support_Stub();
$this->_logger = new Horde_Log_Logger(new Horde_Log_Handler_Null());
}

/**
Expand Down Expand Up @@ -600,8 +599,8 @@ protected function _buildModSeqChanges(
if ($options['protocolversion'] > Horde_ActiveSync::VERSION_TWELVEONE) {
$categories[$uid] = array();
foreach ($data->getFlags() as $flag) {
if (!empty($msgFlags[strtolower($flag)])) {
$categories[$uid][] = $msgFlags[strtolower($flag)];
if (!empty($msgFlags[Horde_String::lower($flag)])) {
$categories[$uid][] = $msgFlags[Horde_String::lower($flag)];
}
}
}
Expand Down Expand Up @@ -912,7 +911,7 @@ public function categoriesToFlags($mailbox, $categories, $uid)
foreach ($categories as $category) {
// Do our best to make sure the imap flag is a RFC 3501 compliant.
$atom = new Horde_Imap_Client_Data_Format_Atom(strtr(Horde_String_Transliterate::toAscii($category), ' ', '_'));
$imapflag = strtolower($atom->stripNonAtomCharacters());
$imapflag = Horde_String::lower($atom->stripNonAtomCharacters());
if (!empty($msgFlags[$imapflag])) {
$options['add'][] = $imapflag;
unset($msgFlags[$imapflag]);
Expand Down Expand Up @@ -1221,8 +1220,8 @@ protected function _buildMailMessage(
$flags = array();
$msgFlags = $this->_getMsgFlags();
foreach ($imap_message->getFlags() as $flag) {
if (!empty($msgFlags[strtolower($flag)])) {
$flags[] = $msgFlags[strtolower($flag)];
if (!empty($msgFlags[Horde_String::lower($flag)])) {
$flags[] = $msgFlags[Horde_String::lower($flag)];
}
}
$eas_message->categories = $flags;
Expand Down Expand Up @@ -1569,7 +1568,7 @@ protected function _doQuery(array $query)
*/
protected function _getEASImportance($importance)
{
switch (strtolower($importance)) {
switch (Horde_String::lower($importance)) {
case '1':
case 'high':
return 2;
Expand Down
3 changes: 1 addition & 2 deletions framework/ActiveSync/lib/Horde/ActiveSync/Imap/Message.php
@@ -1,7 +1,5 @@
<?php
/**
* Horde_ActiveSync_Imap_Message::
*
* @license http://www.horde.org/licenses/gpl GPLv2
* NOTE: According to sec. 8 of the GENERAL PUBLIC LICENSE (GPL),
* Version 2, the distribution of the Horde_ActiveSync module in or
Expand All @@ -11,6 +9,7 @@
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package ActiveSync
*/

/**
* This class provides all functionality related to parsing and working with
* a single IMAP email message when using Horde_Imap_Client.
Expand Down
2 changes: 1 addition & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Message/Base.php
Expand Up @@ -126,7 +126,7 @@ public function __construct(array $options = array())
if (!empty($options['logger'])) {
$this->_logger = $options['logger'];
} else {
$this->_logger = new Horde_Support_Stub();
$this->_logger = new Horde_Log_Logger(new Horde_Log_Handler_Null());
}
if (!empty($options['protocolversion'])) {
$this->_version = $options['protocolversion'];
Expand Down
Expand Up @@ -9,7 +9,7 @@
*
* Created : 01.10.2007
*
* Zarafa Deutschland GmbH, www.zarafaserver.de
* © Zarafa Deutschland GmbH, www.zarafaserver.de
* This file is distributed under GPL-2.0.
* Consult COPYING file for details
*
Expand Down Expand Up @@ -208,7 +208,7 @@ protected function _handle()
foreach($itemoperations as $value) {
switch($value['type']) {
case 'fetch' :
switch(strtolower($value['store'])) {
switch(Horde_String::lower($value['store'])) {
case 'mailbox' :
$this->_encoder->startTag(self::ITEMOPERATIONS_FETCH);
if (isset($value['airsyncbasefilereference'])) {
Expand Down
8 changes: 4 additions & 4 deletions framework/ActiveSync/lib/Horde/ActiveSync/Request/Search.php
Expand Up @@ -9,7 +9,7 @@
*
* Created : 01.10.2007
*
* Zarafa Deutschland GmbH, www.zarafaserver.de
* © Zarafa Deutschland GmbH, www.zarafaserver.de
* This file is distributed under GPL-2.0.
* Consult COPYING file for details
*
Expand Down Expand Up @@ -126,7 +126,7 @@ protected function _handle()
$store_status = self::STORE_STATUS_PROTERR;
}
$search_query = array();
switch (strtolower($search_name)) {
switch (Horde_String::lower($search_name)) {
case 'documentlibrary':
$search_query['query'] = $this->_parseQuery();
break;
Expand Down Expand Up @@ -241,7 +241,7 @@ protected function _handle()
}

$search_query['range'] = empty($search_query['range']) ? '0-99' : $search_query['range'];
switch(strtolower($search_name)) {
switch(Horde_String::lower($search_name)) {
case 'mailbox':
$search_query['rebuildresults'] = !empty($search_query['rebuildresults']);
$search_query['deeptraversal'] = !empty($search_query['deeptraversal']);
Expand Down Expand Up @@ -277,7 +277,7 @@ protected function _handle()
$count = 0;
foreach ($search_result['rows'] as $u) {
$count++;
switch (strtolower($search_name)) {
switch (Horde_String::lower($search_name)) {
case 'documentlibrary':
$this->_encoder->startTag(self::SEARCH_RESULT);

Expand Down
2 changes: 1 addition & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Request/Sync.php
Expand Up @@ -59,7 +59,7 @@ class Horde_ActiveSync_Request_Sync extends Horde_ActiveSync_Request_SyncBase
const MAX_HEARTBEAT = 3540;

/**
* Collection of all collection arrays for the current SYNC request.
* Collections manager.
*
* @var Horde_ActiveSync_Collections
*/
Expand Down
38 changes: 20 additions & 18 deletions framework/ActiveSync/lib/Horde/ActiveSync/State/Base.php
Expand Up @@ -135,7 +135,7 @@ public function __construct(array $params = array())
{
$this->_params = $params;
if (empty($params['logger'])) {
$this->_logger = new Horde_Support_Stub();
$this->_logger = new Horde_Log_Logger(new Horde_Log_Handler_Null());
} else {
$this->_logger = $params['logger'];
}
Expand Down Expand Up @@ -460,8 +460,9 @@ public function getChanges(array $options = array())
Horde_ActiveSync::CHANGE_TYPE_DELETE => 'deletion',
Horde_ActiveSync::CHANGE_TYPE_CHANGE => 'move'
);
foreach ($changes as $change) {
if (!empty($mailmap[$change['id']][$change['type']])) {
$cnt = count($changes);
for ($i = 0; $i <= $cnt; $i++) {
if (!empty($mailmap[$changes[$i]['id']][$changes[$i]['type']])) {
// @todo For 3.0, create a Changes and
// ChangeFilter classes to abstract out a bunch of
// this stuff. (Needs BC breaking changes in
Expand All @@ -471,46 +472,47 @@ public function getChanges(array $options = array())
// email during MOVEITEMS requests (instead it
// reassigns the existing email the new UID). Don't
// send the ADD command for these changes.
if ($change['type'] == Horde_ActiveSync::CHANGE_TYPE_CHANGE &&
$change['flags'] == Horde_ActiveSync::FLAG_NEWMESSAGE &&
if ($changes[$i]['type'] == Horde_ActiveSync::CHANGE_TYPE_CHANGE &&
$changes[$i]['flags'] == Horde_ActiveSync::FLAG_NEWMESSAGE &&
$this->_deviceInfo->deviceType != 'WindowsOutlook15') {
$this->_changes[] = $change;
$this->_changes[] = $changes[$i];
continue;
}
$this->_logger->info(sprintf(
'[%s] Ignoring client initiated %s for %s',
$this->_procid,
$flag_map[$change['type']],
$change['id']));
$change['ignore'] = true;
$flag_map[$changes[$i]['type']],
$changes[$i]['id']));
$changes[$i]['ignore'] = true;
}
$this->_changes[] = $change;
$this->_changes[] = $changes[$i];
}
break;

default:
$client_timestamps = $this->_getPIMChangeTS($changes);
foreach ($changes as $change) {
if (empty($client_timestamps[$change['id']])) {
$this->_changes[] = $change;
$cnt = count($changes);
for ($i = 0; $i <= $cnt; $i++) {
if (empty($client_timestamps[$changes[$i]['id']])) {
$this->_changes[] = $changes[$i];
continue;
}
if ($change['type'] == Horde_ActiveSync::CHANGE_TYPE_DELETE) {
if ($changes[$i]['type'] == Horde_ActiveSync::CHANGE_TYPE_DELETE) {
// If we have a delete, don't bother stating the message,
// the entry should already be deleted on the client.
$stat['mod'] = 0;
} else {
// stat only returns MODIFY times, not deletion times,
// so will return (int)0 for ADD or DELETE.
$stat = $this->_backend->statMessage($this->_folder->serverid(), $change['id']);
$stat = $this->_backend->statMessage($this->_folder->serverid(), $changes[$i]['id']);
}
if ($client_timestamps[$change['id']] >= $stat['mod']) {
if ($client_timestamps[$changes[$i]['id']] >= $stat['mod']) {
$this->_logger->info(sprintf(
'[%s] Ignoring client initiated change for %s (client TS: %s Stat TS: %s)',
$this->_procid,
$change['id'], $client_timestamps[$change['id']], $stat['mod']));
$changes[$i]['id'], $client_timestamps[$changes[$i]['id']], $stat['mod']));
} else {
$this->_changes[] = $change;
$this->_changes[] = $changes[$i];
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions framework/ActiveSync/lib/Horde/ActiveSync/SyncCache.php
Expand Up @@ -96,6 +96,7 @@ class Horde_ActiveSync_SyncCache
* @param Horde_ActiveSync_State_Base $state The state driver
* @param string $devid The device id
* @param string $user The username
* @param Horde_Log_Logger $logger The logger object
*
* @return Horde_ActiveSync_SyncCache
*/
Expand All @@ -111,6 +112,15 @@ public function __construct(
$this->_logger = $logger;
$this->loadCacheFromStorage();
$this->_procid = getmypid();

$this->_logger = empty($logger)
? new Horde_Log_Logger(new Horde_Log_Handler_Null())
: $logger;

$this->_logger->info(sprintf(
'[%s] Creating new Horde_ActiveSync_SyncCache.',
$this->_procid)
);
}

public function __get($property)
Expand Down
2 changes: 1 addition & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Wbxml.php
Expand Up @@ -874,7 +874,7 @@ class Horde_ActiveSync_Wbxml
public function __construct($stream, $log_level = self::LOG_PROTOCOL)
{
$this->_stream = new Horde_Stream_Existing(array('stream' => $stream));
$this->_logger = new Horde_Support_Stub();
$this->_logger = new Horde_Log_Logger(new Horde_Log_Handler_Null());
$this->_procid = getmypid();
$this->_logLevel = $log_level;
}
Expand Down

0 comments on commit e61a263

Please sign in to comment.