Skip to content

Commit

Permalink
Horde_Mapi_Utils -> Horde_Mapi
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jan 7, 2014
1 parent 7d1232c commit 02be36a
Show file tree
Hide file tree
Showing 17 changed files with 41 additions and 41 deletions.
Expand Up @@ -264,8 +264,8 @@ public function setTimezone($date)
}
$date = new Horde_Date(time(), $date);
}
$offsets = Horde_Mapi_Utils_Timezone::getOffsetsFromDate($date);
$tz = Horde_Mapi_Utils_Timezone::getSyncTZFromOffsets($offsets);
$offsets = Horde_Mapi_Timezone::getOffsetsFromDate($date);
$tz = Horde_Mapi_Timezone::getSyncTZFromOffsets($offsets);
$this->_properties['timezone'] = $tz;
}

Expand All @@ -276,7 +276,7 @@ public function setTimezone($date)
*/
public function getTimezone()
{
$parser = new Horde_Mapi_Utils_Timezone();
$parser = new Horde_Mapi_Timezone();
return $parser->getTimezone($this->timezone, date_default_timezone_get());
}

Expand Down
Expand Up @@ -134,7 +134,7 @@ public function fromvEvent($vCal)
}
}

$tz = new Horde_Mapi_Utils_Timezone();
$tz = new Horde_Mapi_Timezone();
$this->timezone = $tz->getSyncTZFromOffsets(
$tz->getOffsetsFromDate(new Horde_Date()));
$this->alldayevent = (int)$this->_isAllDay();
Expand Down Expand Up @@ -171,7 +171,7 @@ protected function _vEvent($vevent, $method = 'REQUEST')
} catch (Horde_Icalendar_Exception $e) {}

try {
$this->globalobjid = Horde_Mapi_Utils::createGoid($vevent->getAttribute('UID'));
$this->globalobjid = Horde_Mapi::createGoid($vevent->getAttribute('UID'));
$this->starttime = new Horde_Date($vevent->getAttribute('DTSTART'));
$this->endtime = new Horde_Date($vevent->getAttribute('DTEND'));
} catch (Horde_Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion framework/ActiveSync/lib/Horde/ActiveSync/Timezone.php
Expand Up @@ -30,7 +30,7 @@
* @copyright 2009-2013 Horde LLC (http://www.horde.org)
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package ActiveSync
* @deprecated To be removed for Horde 6. Use Horde_Mapi_Utils_Timezone::.
* @deprecated To be removed for Horde 6. Use Horde_Mapi_Timezone::.
*/
class Horde_ActiveSync_Timezone
{
Expand Down
4 changes: 2 additions & 2 deletions framework/ActiveSync/lib/Horde/ActiveSync/Utils.php
Expand Up @@ -139,7 +139,7 @@ static public function decodeBase64($uri)
* @param string $goid Base64 encoded Global Object Identifier.
*
* @return string The UID
* @deprecated Will be removed in H6. Use Horde_Mapi_Utils::getUidFromGoid
* @deprecated Will be removed in H6. Use Horde_Mapi::getUidFromGoid
*/
static public function getUidFromGoid($goid)
{
Expand Down Expand Up @@ -172,7 +172,7 @@ static public function getUidFromGoid($goid)
* @param string $uid The UID value to encode.
*
* @return string A Base64 encoded GOID
* @deprecated Will be removed in H6. Use Horde_Mapi_Utils::createGoid
* @deprecated Will be removed in H6. Use Horde_Mapi::createGoid
*/
static public function createGoid($uid, $options = array())
{
Expand Down
2 changes: 1 addition & 1 deletion framework/ActiveSync/package.xml
Expand Up @@ -292,7 +292,7 @@
<exclude>3.0.0alpha1</exclude>
</package>
<package>
<name>Horde_Mapi_Utils</name>
<name>Horde_Mapi</name>
<channel>pear.horde.org</channel>
<min>1.0.0</min>
<max>2.0.0alpha1</max>
Expand Down
10 changes: 5 additions & 5 deletions framework/Compress/lib/Horde/Compress/Tnef.php
Expand Up @@ -362,10 +362,10 @@ protected function _extractMapiAttributes($data, &$attachment_data)
break;
case self::MAPI_APPOINTMENT_START_WHOLE:
file_put_contents('/tmp/filetime', $value);
$attachment_data[0]['start_utc'] = new Horde_Date(Horde_Mapi_Utils::filetimeToUnixtime($value), 'UTC');
$attachment_data[0]['start_utc'] = new Horde_Date(Horde_Mapi::filetimeToUnixtime($value), 'UTC');
break;
case self::MAPI_APPOINTMENT_END_WHOLE:
$attachment_data[0]['end_utc'] = new Horde_Date(Horde_Mapi_Utils::filetimeToUnixtime($value), 'UTC');
$attachment_data[0]['end_utc'] = new Horde_Date(Horde_Mapi::filetimeToUnixtime($value), 'UTC');
break;
case self::MAPI_APPOINTMENT_DURATION:
$attachment_data[0]['duration'] = $value;
Expand All @@ -380,7 +380,7 @@ protected function _extractMapiAttributes($data, &$attachment_data)
$this->_lastModifier = $value;
break;
case self::MAPI_ENTRY_UID:
$attachment_data[0]['uid'] = Horde_Mapi_Utils::getUidFromGoid(bin2hex($value));
$attachment_data[0]['uid'] = Horde_Mapi::getUidFromGoid(bin2hex($value));
break;
case self::MAPI_APPOINTMENT_RECUR:
// Need to decode this to fully support recurring meeting
Expand Down Expand Up @@ -628,8 +628,8 @@ protected function _parseRecurrence($value)
}

// What Timezone are these in?
$startDate = new Horde_Date(Horde_Mapi_Utils::filetimeToUnixtime($this->_geti($value, 32)));
$endDate = new Horde_Date(Horde_Mapi_Utils::filetimeToUnixtime($this->_geti($value, 32)));
$startDate = new Horde_Date(Horde_Mapi::filetimeToUnixtime($this->_geti($value, 32)));
$endDate = new Horde_Date(Horde_Mapi::filetimeToUnixtime($this->_geti($value, 32)));

$rrule = new Horde_Date_Recurrence($startDate);
switch ($pattern) {
Expand Down
2 changes: 1 addition & 1 deletion framework/Compress/package.xml
Expand Up @@ -381,7 +381,7 @@
<exclude>3.0.0alpha1</exclude>
</package>
<package>
<name>Horde_Mapi_Utils</name>
<name>Horde_Mapi</name>
<channel>pear.horde.org</channel>
<min>1.0.0</min>
<max>2.0.0alpha1</max>
Expand Down
@@ -1,6 +1,6 @@
<?php
/**
* Horde_Mapi_Utils::
* Horde_Mapi::
*
* @license http://www.horde.org/licenses/gpl GPLv2
* NOTE: According to sec. 8 of the GENERAL PUBLIC LICENSE (GPL),
Expand Down Expand Up @@ -28,7 +28,7 @@
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package Mapi_Utils
*/
class Horde_Mapi_Utils
class Horde_Mapi
{
/**
* Determine if the current machine is little endian.
Expand Down
@@ -1,6 +1,6 @@
<?php
/**
* Base exception class for Horde_Mapi_Utils
* Base exception class for Horde_Mapi
*
* Copyright 2010-2013 Horde LLC (http://www.horde.org/)
*
Expand All @@ -10,7 +10,7 @@
* @package Mapi_Utils
*/
/**
* Base exception class for Horde_Mapi_Utils
* Base exception class for Horde_Mapi
*
* Copyright 2010-2013 Horde LLC (http://www.horde.org/)
*
Expand All @@ -19,6 +19,6 @@
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package Mapi_Utils
*/
class Horde_Mapi_Utils_Exception extends Horde_Exception_Wrapped
class Horde_Mapi_Exception extends Horde_Exception_Wrapped
{
}
Expand Up @@ -23,7 +23,7 @@
* @author Michael J Rubinsky <mrubinsk@horde.org>
* @package Mapi_Utils
*/
class Horde_Mapi_Utils_Timezone
class Horde_Mapi_Timezone
{
/**
* Date to use as start date when iterating through offsets looking for a
Expand Down Expand Up @@ -83,10 +83,10 @@ static public function getOffsetsFromSyncTZ($data)
$tz['timezone'] = $tz['bias'];
$tz['timezonedst'] = $tz['dstbias'];

if (!Horde_Mapi_Utils::isLittleEndian()) {
$tz['bias'] = Horde_Mapi_Utils::chbo($tz['bias']);
$tz['stdbias'] = Horde_Mapi_Utils::chbo($tz['stdbias']);
$tz['dstbias'] = Horde_Mapi_Utils::chbo($tz['dstbias']);
if (!Horde_Mapi::isLittleEndian()) {
$tz['bias'] = Horde_Mapi::chbo($tz['bias']);
$tz['stdbias'] = Horde_Mapi::chbo($tz['stdbias']);
$tz['dstbias'] = Horde_Mapi::chbo($tz['dstbias']);
}

return $tz;
Expand All @@ -102,10 +102,10 @@ static public function getOffsetsFromSyncTZ($data)
*/
static public function getSyncTZFromOffsets(array $offsets)
{
if (!Horde_Mapi_Utils::isLittleEndian()) {
$offsets['bias'] = Horde_Mapi_Utils::chbo($offsets['bias']);
$offsets['stdbias'] = Horde_Mapi_Utils::chbo($offsets['stdbias']);
$offsets['dstbias'] = Horde_Mapi_Utils::chbo($offsets['dstbias']);
if (!Horde_Mapi::isLittleEndian()) {
$offsets['bias'] = Horde_Mapi::chbo($offsets['bias']);
$offsets['stdbias'] = Horde_Mapi::chbo($offsets['stdbias']);
$offsets['dstbias'] = Horde_Mapi::chbo($offsets['dstbias']);
}

$packed = pack('la64vvvvvvvvla64vvvvvvvvl',
Expand Down Expand Up @@ -291,7 +291,7 @@ public function getListOfTimezones($offsets, $expectedTimezone = null)
}

if (empty($timezones)) {
throw new Horde_Mapi_Utils_Exception('No timezone found for the given offsets');
throw new Horde_Mapi_Exception('No timezone found for the given offsets');
}

return $timezones;
Expand Down
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.9.2" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>Horde_Mapi_Utils</name>
<name>Horde_Mapi</name>
<channel>pear.horde.org</channel>
<summary>MAPI utility library.</summary>
<description>Provides various utility classes for dealing with Microsoft MAPI structured data.</description>
Expand Down
Expand Up @@ -16,7 +16,7 @@
* @package Mapi_Utils
* @subpackage UnitTests
*/
class Horde_Mapi_Utils_MapiTest extends PHPUnit_Framework_TestCase
class Horde_Mapi_MapiTest extends PHPUnit_Framework_TestCase
{

public function testFiletimeToUnixTime()
Expand All @@ -25,7 +25,7 @@ public function testFiletimeToUnixTime()
$this->markTestSkipped("bcmath extension isn't loaded");
}
$data = file_get_contents(__DIR__ . '/fixtures/filetime');
$this->assertEquals(Horde_Mapi_Utils::filetimeToUnixtime($data), 1387818000);
$this->assertEquals(Horde_Mapi::filetimeToUnixtime($data), 1387818000);
}

/**
Expand All @@ -35,14 +35,14 @@ public function testParseGlobalObjectId()
{
// Outlook UID
$fixture = 'BAAAAIIA4AB0xbcQGoLgCAfUCRDgQMnBJoXEAQAAAAAAAAAAEAAAAAvw7UtuTulOnjnjhns3jvM=';
$uid = Horde_Mapi_Utils::getUidFromGoid($fixture);
$uid = Horde_Mapi::getUidFromGoid($fixture);
$this->assertEquals(
'040000008200E00074C5B7101A82E00800000000E040C9C12685C4010000000000000000100000000BF0ED4B6E4EE94E9E39E3867B378EF3',
$uid);

// vCal
$fixture = 'BAAAAIIA4AB0xbcQGoLgCAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAAHZDYWwtVWlkAQAAAHs4MTQxMkQzQy0yQTI0LTRFOUQtQjIwRS0xMUY3QkJFOTI3OTl9AA==';
$uid = Horde_Mapi_Utils::getUidFromGoid($fixture);
$uid = Horde_Mapi::getUidFromGoid($fixture);
$this->assertEquals('{81412D3C-2A24-4E9D-B20E-11F7BBE92799}', $uid);
}

Expand Down
@@ -1,12 +1,12 @@
<?php
/*
* Unit tests for Horde_Mapi_Utils_Timezone utilities
* Unit tests for Horde_Mapi_Timezone utilities
*
* @author Michael J. Rubinsky <mrubinsk@horde.org>
* @category Horde
* @package Mapi_Utils
*/
class Horde_Mapi_Utils_TimezoneTest extends Horde_Test_Case
class Horde_Mapi_TimezoneTest extends Horde_Test_Case
{

protected $_offsets = array(
Expand Down Expand Up @@ -124,7 +124,7 @@ public function tearDown()
public function testOffsetsFromSyncTZ()
{
foreach ($this->_packed as $tz => $blob) {
$offsets = Horde_Mapi_Utils_Timezone::getOffsetsFromSyncTZ($blob);
$offsets = Horde_Mapi_Timezone::getOffsetsFromSyncTZ($blob);
foreach ($this->_offsets[$tz] as $key => $value) {
$this->assertEquals($value, $offsets[$key]);
}
Expand All @@ -140,7 +140,7 @@ public function testGetOffsetsFromDate()
// timezone that we are interested in.
foreach ($this->_offsets as $tz => $expected) {
$date = new Horde_Date('2011-07-01', $tz);
$offsets = Horde_Mapi_Utils_Timezone::getOffsetsFromDate($date);
$offsets = Horde_Mapi_Timezone::getOffsetsFromDate($date);
foreach ($offsets as $key => $value) {
$this->assertEquals($expected[$key], $value);
}
Expand All @@ -153,7 +153,7 @@ public function testGetOffsetsFromDate()
public function testGetSyncTZFromOffsets()
{
foreach ($this->_offsets as $tz => $offsets) {
$blob = Horde_Mapi_Utils_Timezone::getSyncTZFromOffsets($offsets);
$blob = Horde_Mapi_Timezone::getSyncTZFromOffsets($offsets);
$this->assertEquals($this->_packed[$tz], $blob);
}
}
Expand All @@ -164,7 +164,7 @@ public function testGetSyncTZFromOffsets()
*/
public function testGuessTimezoneFromOffsets()
{
$timezones = new Horde_Mapi_Utils_Timezone();
$timezones = new Horde_Mapi_Timezone();

// Test general functionality, with expected timezone.
foreach ($this->_packed as $tz => $blob) {
Expand Down

0 comments on commit 02be36a

Please sign in to comment.