global $conf;
$res = $GLOBALS['browser']->wasFileUploaded($name, _("attachment"));
- if (is_a($res, 'PEAR_Error')) {
+ if ($res instanceof PEAR_Error) {
throw new IMP_Compose_Exception($res);
}
$result = $vfs_file
? $vfs->write(self::VFS_ATTACH_PATH, $cacheID, $data, true)
: $vfs->writeData(self::VFS_ATTACH_PATH, $cacheID, $data, true);
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceof PEAR_Error) {
return $result;
}
$data = file_get_contents($att->getInformation('temp_filename'));
$res = $vfs->writeData($fullpath, escapeshellcmd($att->getName()), $data, true);
}
- if (is_a($res, 'PEAR_Error')) {
+ if ($res instanceof PEAR_Error) {
Horde::logMessage($res, __FILE__, __LINE__, PEAR_LOG_ERR);
return IMP_Compose_Exception($res);
}
$vfs = VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type']));
// TODO: Garbage collection?
$result = $vfs->writeData(self::VFS_DRAFTS_PATH, hash('md5', Horde_Util::getFormData('user')), $body, true);
- if (is_a($result, 'PEAR_Error')) {
+ if ($result instanceof PEAR_Error) {
return;
}
$vfs = VFS::singleton($GLOBALS['conf']['vfs']['type'], Horde::getDriverConfig('vfs', $GLOBALS['conf']['vfs']['type']));
if ($vfs->exists(self::VFS_DRAFTS_PATH, $filename)) {
$data = $vfs->read(self::VFS_DRAFTS_PATH, $filename);
- if (is_a($data, 'PEAR_Error')) {
+ if ($data instanceof PEAR_Error) {
return;
}
$vfs->deleteFile(self::VFS_DRAFTS_PATH, $filename);
// Get the method type.
$method = $vCal->getAttribute('METHOD');
- if (is_a($method, 'PEAR_Error')) {
+ if ($method instanceof PEAR_Error) {
$method = '';
}
// Get the organizer details.
$organizer = $vEvent->getAttribute('ORGANIZER');
- if (is_a($organizer, 'PEAR_Error')) {
+ if ($organizer instanceof PEAR_Error) {
break;
}
$organizer = parse_url($organizer);
$vEvent_reply = Horde_iCalendar::newComponent('vevent', $vCal);
$vEvent_reply->setAttribute('UID', $vEvent->getAttribute('UID'));
- if (!is_a($vEvent->getAttribute('SUMMARY'), 'PEAR_error')) {
+ if (!$vEvent->getAttribute('SUMMARY') instanceof PEAR_Error)) {
$vEvent_reply->setAttribute('SUMMARY', $vEvent->getAttribute('SUMMARY'));
}
- if (!is_a($vEvent->getAttribute('DESCRIPTION'), 'PEAR_error')) {
+ if (!$vEvent->getAttribute('DESCRIPTION') instanceof PEAR_Error) {
$vEvent_reply->setAttribute('DESCRIPTION', $vEvent->getAttribute('DESCRIPTION'));
}
$dtstart = $vEvent->getAttribute('DTSTART', true);
$vEvent_reply->setAttribute('DTSTART', $vEvent->getAttribute('DTSTART'), array_pop($dtstart));
- if (!is_a($vEvent->getAttribute('DTEND'), 'PEAR_error')) {
+ if (!($vEvent->getAttribute('DTEND') instanceof PEAR_Error)) {
$dtend = $vEvent->getAttribute('DTEND', true);
$vEvent_reply->setAttribute('DTEND', $vEvent->getAttribute('DTEND'), array_pop($dtend));
} else {
$duration = $vEvent->getAttribute('DURATION', true);
$vEvent_reply->setAttribute('DURATION', $vEvent->getAttribute('DURATION'), array_pop($duration));
}
- if (!is_a($vEvent->getAttribute('SEQUENCE'), 'PEAR_error')) {
+ if (!($vEvent->getAttribute('SEQUENCE') instanceof PEAR_Error)) {
$vEvent_reply->setAttribute('SEQUENCE', $vEvent->getAttribute('SEQUENCE'));
}
$vEvent_reply->setAttribute('ORGANIZER', $vEvent->getAttribute('ORGANIZER'), array_pop($organizer));
// Get the organizer details.
$organizer = $vFb->getAttribute('ORGANIZER');
- if (is_a($organizer, 'PEAR_Error')) {
+ if ($organizer instanceof PEAR_Error) {
break;
}
$organizer = parse_url($organizer);
$endStamp = $startStamp + (60 * 24 * 3600);
} else {
$startStamp = $vFb->getAttribute('DTSTART');
- if (is_a($startStamp, 'PEAR_Error')) {
+ if ($startStamp instanceof PEAR_Error) {
$startStamp = time();
}
$endStamp = $vFb->getAttribute('DTEND');
- if (is_a($endStamp, 'PEAR_Error')) {
+ if ($endStamp instanceof PEAR_Error) {
$duration = $vFb->getAttribute('DURATION');
- if (is_a($duration, 'PEAR_Error')) {
+ if ($duration instanceof PEAR_Error) {
$endStamp = $startStamp + (60 * 24 * 3600);
} else {
$endStamp = $startStamp + $duration;
}
$start = $vfb->getAttribute('DTSTART');
- if (!is_a($start, 'PEAR_Error')) {
+ if (!($start instanceof PEAR_Error)) {
if (is_array($start)) {
$html .= '<p><strong>' . _("Start:") . '</strong> ' . strftime($prefs->getValue('date_format'), mktime(0, 0, 0, $start['month'], $start['mday'], $start['year'])) . '</p>';
} else {
}
$end = $vfb->getAttribute('DTEND');
- if (!is_a($end, 'PEAR_Error')) {
+ if (!($end instanceof PEAR_Error)) {
if (is_array($end)) {
$html .= '<p><strong>' . _("End:") . '</strong> ' . strftime($prefs->getValue('date_format'), mktime(0, 0, 0, $end['month'], $end['mday'], $end['year'])) . '</p>';
} else {
$options = array();
$attendees = $vevent->getAttribute('ATTENDEE');
- if (!is_a($attendees, 'PEAR_Error') &&
+ if (!($attendees instanceof PEAR_Error) &&
!empty($attendees) &&
!is_array($attendees)) {
$attendees = array($attendees);
// Check that you are one of the attendees here.
$is_attendee = false;
- if (!is_a($attendees, 'PEAR_Error') && !empty($attendees)) {
+ if (!($attendees instanceof PEAR_Error) && !empty($attendees)) {
$identity = Identity::singleton(array('imp', 'imp'));
for ($i = 0, $c = count($attendees); $i < $c; ++$i) {
$attendee = parse_url($attendees[$i]);
break;
case 'CANCEL':
- if (is_a($instance = $vevent->getAttribute('RECURRENCE-ID'), 'PEAR_Error')) {
+ $instance = $vevent->getAttribute('RECURRENCE-ID');
+ if ($instance instanceof PEAR_Error) {
$desc = _("%s has cancelled \"%s\".");
if ($registry->hasMethod('calendar/delete')) {
$options[] = '<option value="delete">' . _("Delete from my calendar") . '</option>';
}
$summary = $vevent->getAttribute('SUMMARY');
- if (is_a($summary, 'PEAR_Error')) {
+ if ($summary instanceof PEAR_Error) {
$desc = sprintf($desc, htmlspecialchars($sender), _("Unknown Meeting"));
} else {
$desc = sprintf($desc, htmlspecialchars($sender), htmlspecialchars($summary));
}
$start = $vevent->getAttribute('DTSTART');
- if (!is_a($start, 'PEAR_Error')) {
+ if (!($start instanceof PEAR_Error)) {
if (is_array($start)) {
$html .= '<p><strong>' . _("Start:") . '</strong> ' . strftime($prefs->getValue('date_format'), mktime(0, 0, 0, $start['month'], $start['mday'], $start['year'])) . '</p>';
} else {
}
$end = $vevent->getAttribute('DTEND');
- if (!is_a($end, 'PEAR_Error')) {
+ if (!($end instanceof PEAR_Error)) {
if (is_array($end)) {
$html .= '<p><strong>' . _("End:") . '</strong> ' . strftime($prefs->getValue('date_format'), mktime(0, 0, 0, $end['month'], $end['mday'], $end['year'])) . '</p>';
} else {
}
$sum = $vevent->getAttribute('SUMMARY');
- if (!is_a($sum, 'PEAR_Error')) {
+ if (!($sum instanceof PEAR_Error)) {
$html .= '<p><strong>' . _("Summary") . ':</strong> ' . htmlspecialchars($sum) . '</p>';
} else {
$html .= '<p><strong>' . _("Summary") . ':</strong> <em>' . _("None") . '</em></p>';
}
$desc = $vevent->getAttribute('DESCRIPTION');
- if (!is_a($desc, 'PEAR_Error')) {
+ if (!($desc instanceof PEAR_Error)) {
$html .= '<p><strong>' . _("Description") . ':</strong> ' . nl2br(htmlspecialchars($desc)) . '</p>';
}
$loc = $vevent->getAttribute('LOCATION');
- if (!is_a($loc, 'PEAR_Error')) {
+ if (!($loc instanceof PEAR_Error)) {
$html .= '<p><strong>' . _("Location") . ':</strong> ' . htmlspecialchars($loc) . '</p>';
}
- if (!is_a($attendees, 'PEAR_Error') && !empty($attendees)) {
+ if (!($attendees instanceof PEAR_Error) && !empty($attendees)) {
$html .= '<h2 class="smallheader">' . _("Attendees") . '</h2>';
$html .= '<table><thead class="leftAlign"><tr><th>' . _("Name") . '</th><th>' . _("Role") . '</th><th>' . _("Status") . '</th></tr></thead><tbody>';
$options = array();
$organizer = $vtodo->getAttribute('ORGANIZER', true);
- if (is_a($organizer, 'PEAR_Error')) {
+ if ($organizer instanceof PEAR_Error) {
$sender = _("An unknown person");
} else {
if (isset($organizer[0]['CN'])) {
}
$summary = $vtodo->getAttribute('SUMMARY');
- if (is_a($summary, 'PEAR_Error')) {
+ if ($summary instanceof PEAR_Error) {
$desc = sprintf($desc, htmlspecialchars($sender), _("Unknown Task"));
} else {
$desc = sprintf($desc, htmlspecialchars($sender), htmlspecialchars($summary));
}
$priority = $vtodo->getAttribute('PRIORITY');
- if (!is_a($priority, 'PEAR_Error')) {
+ if (!($priority instanceof PEAR_Error)) {
$html .= '<p><strong>' . _("Priority") . ':</strong> ' . (int)$priority . '</p>';
}
$sum = $vtodo->getAttribute('SUMMARY');
- if (!is_a($sum, 'PEAR_Error')) {
+ if (!($sum instanceof PEAR_Error)) {
$html .= '<p><strong>' . _("Summary") . ':</strong> ' . htmlspecialchars($sum) . '</p>';
} else {
$html .= '<p><strong>' . _("Summary") . ':</strong> <em>' . _("None") . '</em></p>';
}
$desc = $vtodo->getAttribute('DESCRIPTION');
- if (!is_a($desc, 'PEAR_Error')) {
+ if (!($desc instanceof PEAR_Error)) {
$html .= '<p><strong>' . _("Description") . ':</strong> ' . nl2br(htmlspecialchars($desc)) . '</p>';
}
$attendees = $vtodo->getAttribute('ATTENDEE');
$params = $vtodo->getAttribute('ATTENDEE', true);
- if (!is_a($attendees, 'PEAR_Error') && !empty($attendees)) {
+ if (!($attendees instanceof PEAR_Error) && !empty($attendees)) {
$html .= '<h2 class="smallheader">' . _("Attendees") . '</h2>';
if (!is_array($attendees)) {
$attendees = array($attendees);