if (in_array($user, $current_users)) {
continue;
}
- $new_user_field .= "\n" . '<option>' . htmlspecialchars($user)
- . '</option>';
+ $new_user_field .= "\n<option>" . htmlspecialchars($user) . '</option>';
}
$new_user_field .= "\n</select>";
}
}
$list_msg = new IMP_Views_ListMessages();
- $res = $list_msg->ListMessages($args);
+ $res = $list_msg->listMessages($args);
// TODO: This can potentially be optimized for arrival time sort - if the
// cache ID changes, we know the changes must occur at end of mailbox.
);
$show_msg = new IMP_Views_ShowMessage();
- $result = (object) $show_msg->showMessage($args);
+ $result = (object)$show_msg->showMessage($args);
break;
case 'Html2Text':
$expunge_count = count($expunged[$mbox]);
$display_folder = IMP::displayFolder($mbox);
if ($expunge_count == 1) {
- $notification->push(sprintf(_("1 message was purged from \"%s\"."), $display_folder), 'horde.success');
+ $notification->push(sprintf(_("1 message was purged from \"%s\"."), $display_folder), 'horde.success');
} else {
$notification->push(sprintf(_("%s messages were purged from \"%s\"."), $expunge_count, $display_folder), 'horde.success');
}
$imptree = IMP_Imap_Tree::singleton();
$result = new stdClass;
- $result->add = (bool) $add;
+ $result->add = (bool)$add;
$result->folder = $mbox;
if ($add) {
if ($info = $imptree->getElementInfo($mbox)) {
$result->poll = array($mbox => $info['unseen']);
}
- $notification->push(sprintf(_("\"%s\" mailbox now polled for new mail."), $display_folder), 'horde.success');
+ $notification->push(sprintf(_("\"%s\" mailbox now polled for new mail."), $display_folder), 'horde.success');
} else {
$imptree->removePollList($mbox);
- $notification->push(sprintf(_("\"%s\" mailbox no longer polled for new mail."), $display_folder), 'horde.success');
+ $notification->push(sprintf(_("\"%s\" mailbox no longer polled for new mail."), $display_folder), 'horde.success');
}
break;
} else {
/* Create a random identifier for this file. */
$id = uniqid(mt_rand());
- $res = $vfsroot->writeData($full_path, $file_name . '.notify' , $id, true);
+ $res = $vfsroot->writeData($full_path, $file_name . '.notify', $id, true);
if (is_a($res, 'PEAR_Error')) {
Horde::logMessage($res, __FILE__, __LINE__, PEAR_LOG_ERR);
} else {
if (Horde_Util::getFormData('resume_draft') &&
$prefs->getValue('auto_delete_drafts') &&
- ($thismailbox == IMP::folderPref($prefs->getValue('drafts_folder'), true))) {
+ ($thismailbox == IMP::folderPref($prefs->getValue('drafts_folder'), true))) {
$imp_message = IMP_Message::singleton();
$idx_array = array($index . IMP::IDX_SEP . $thismailbox);
if ($imp_message->delete($idx_array)) {
if (!empty($indices)) {
$msglist = unserialize(urldecode($indices));
$subject_header = $imp_compose->attachIMAPMessage($msglist);
- if ($subject_header === false) {
- // TODO: notification
- } else {
+ if ($subject_header !== false) {
$header['subject'] = $subject_header;
}
}
$entry['select_tabindex'] = ++$tabindex;
$entry['select_name'] = htmlspecialchars($to_item[0]);
$entry['select_to'] = array();
- for ($i = 1; $i < count($to_item); $i++) {
+ for ($i = 1, $items = count($to_item); $i < $items; ++$i) {
$entry['select_to'][] = array('val' => htmlspecialchars($to_item[$i]));
}
} else {
$entry['select_tabindex'] = ++$tabindex;
$entry['select_name'] = htmlspecialchars($item[0]);
$entry['select_arr'] = array();
- for ($i = 1; $i < count($item); $i++) {
+ for ($i = 1, $items = count($item); $i < $items; ++$i) {
$entry['select_arr'][] = array('val' => htmlspecialchars($item[$i]));
}
$entry['input_value'] = null;
$d_read = $prefs->getValue('disposition_request_read');
$t->set('rrr', $conf['compose']['allow_receipts'] && ($d_read != 'never'));
if ($t->get('rrr')) {
- $t->set('rrr_selected', ($d_read != 'ask') || (Horde_Util::getFormData('request_read_receipt') == 'on'));
- $t->set('rrr_label', Horde::label('rrr', _("Request a _Read Receipt")));
+ $t->set('rrr_selected', ($d_read != 'ask') || (Horde_Util::getFormData('request_read_receipt') == 'on'));
+ $t->set('rrr_label', Horde::label('rrr', _("Request a _Read Receipt")));
}
$t->set('compose_html', (!is_null($rtemode) && !$prefs->isLocked('compose_html')));
}
if (!function_exists('_imp_hook_display_folder')) {
- function _imp_hook_display_folder($mailbox) {
+ function _imp_hook_display_folder($mailbox)
+ {
$type = Kolab::getMailboxType($mailbox);
return empty($type) || ($type == 'mail');
}
$template->set('multiple_source', true);
$s_list = array();
foreach ($source_list as $key => $select) {
- $s_list[] = array('val' => $key, 'selected' => ($key == $source), 'label' => htmlspecialchars($select));
+ $s_list[] = array('val' => $key, 'selected' => ($key == $source), 'label' => htmlspecialchars($select));
}
$template->set('source_list', $s_list);
} else {
((strpos($save_attach, 'prompt') === 0) &&
empty($opts['save_attachments']))) {
$mime_message->buildMimeIds();
- for ($i = 2; ; ++$i) {
+ for ($i = 2;; ++$i) {
if (!($oldPart = $mime_message->getPart($i))) {
break;
}
" ---------\n" .
$this->_getMsgHeaders($h) . "\n\n";
- $msg_post = "\n\n" . '----- ' .
+ $msg_post = "\n\n----- " .
($from ? sprintf(_("End message from %s"), $from) : _("End message")) .
" -----\n";
} else {
$msg_post = '';
}
-
$compose_html = $GLOBALS['prefs']->getValue('compose_html');
$msg_text = $this->_getMessageText($contents, array(
if ($part->getPrimaryType() == 'multipart') {
$mixed_part = new Horde_Mime_Part();
$mixed_part->setType('multipart/mixed');
- $mixed_part->addPart(part);
+ $mixed_part->addPart($part);
$link_part = new Horde_Mime_Part();
$link_part->setType('text/plain');
/**
* Formats the address properly.
*
- * This method can be called statically, i.e.:
- * $ret = IMP_Compose::formatAddr();
- *
* @param string $addr The address to format.
*
* @return string The formatted address.
* any address that is either not valid or fails to expand. This function
* will not search if the address string is empty.
*
- * This method can be called statically, i.e.:
- * $ret = IMP_Compose::expandAddresses();
- *
* @param string $addrString The name(s) or address(es) to expand.
*
* @return array All matching addresses.
static public function expandAddresses($addrString)
{
return preg_match('|[^\s]|', $addrString)
- ? IMP_Compose::getAddressList(reset(array_filter(array_map('trim', Horde_Mime_Address::explode($addrString, ',;')))))
+ ? self::getAddressList(reset(array_filter(array_map('trim', Horde_Mime_Address::explode($addrString, ',;')))))
: '';
}
* Uses the Registry to expand names and return error information for
* any address that is either not valid or fails to expand.
*
- * This method can be called statically, i.e.:
- * $ret = IMP_Compose::expandAddresses();
- *
* @param string $search The term to search by.
*
* @return array All matching addresses.
*/
static public function getAddressList($search = '')
{
- $sparams = IMP_Compose::getAddressSearchParams();
+ $sparams = self::getAddressSearchParams();
try {
$res = $GLOBALS['registry']->call('contacts/search', array($search, $sparams['sources'], $sparams['fields'], true));
} catch (Horde_Exception $e) {
/**
* Determines parameters needed to do an address search
*
- * This method can be called statically, i.e.:
- * $ret = IMP_Compose::getAddressSearchParams();
- *
* @return array An array with two keys: 'sources' and 'fields'.
*/
static public function getAddressSearchParams()
{
$params = array(
'actionID' => 'save_attachment_public_key',
+ 'mailbox' => $mailbox,
'uid' => $uid,
'mime_id' => $id
);
{
$params = array(
'actionID' => 'save_attachment_public_key',
+ 'mailbox' => $mailbox,
'uid' => $uid,
'mime_id' => $id
);
header('Vary: Accept-Language');
}
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">' . "\n" .
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"DTD/xhtml1-transitional.dtd\">\n" .
(!empty($GLOBALS['language']) ? '<html lang="' . strtr($GLOBALS['language'], '_', '-') . '"' : '<html') . ">\n".
"<head>\n";
if (!empty($changes['a'])) {
$result['a'] = array();
foreach ($changes['a'] as $val) {
- $result['a'][] = DIMP::_createFolderElt(is_array($val) ? $val : $imptree->element($val));
+ $result['a'][] = self::_createFolderElt(is_array($val) ? $val : $imptree->element($val));
}
}
// Skip the base element, since any change there won't ever be
// updated on-screen.
if ($val != IMP_Imap_Tree::BASE_ELT) {
- $result['c'][] = DIMP::_createFolderElt($imptree->element($val));
+ $result['c'][] = self::_createFolderElt($imptree->element($val));
}
}
}
$ob = new stdClass;
if ($elt['children']) {
- $ob->ch = 1;
+ $ob->ch = 1;
}
$ob->m = $elt['value'];
if ($ob->m != $elt['name']) {
/**
* Returns a list of available drivers, with a description of each.
- * This function can be called statically:
- * $list = IMP_Fetchmail::listDrivers();
*
* @return array The list of available drivers, with the driver name as
* the key and the description as the value.
/**
* List the colors available for coloring fetched messages.
- * This function can be called statically:
- * $list = IMP_Fetchmail::listColors();
*
* @return array The list of available colors;
*/
/**
* Returns a description of the driver.
- * This function can be called statically:
- * $description = IMP_Fetchmail::description();
*
* @return string The description of the driver.
*/
/**
* Perform fetchmail on the list of accounts given. Outputs informaton
* to the global notification driver.
- * This function can be called statically.
*
* @param array $accounts The list of account identifiers to fetch mail
* for.
foreach ($accounts as $val) {
$params = $fm_account->getAllValues($val);
- $driver = IMP_Fetchmail::factory($params['driver'], $params);
+ $driver = self::factory($params['driver'], $params);
if ($driver === false) {
continue;
}
{
/* Check for missing params. */
$paramlist = $this->getParameterList();
- if (array_diff($paramlist, array_keys($params))) {
- // TODO: Error message here
- }
+ /* if (array_diff($paramlist, array_keys($params))) {
+ * TODO: Error message here
+ * } */
$this->_params = $params;
}
(!empty($GLOBALS['conf']['hooks']['permsdenied']) ||
(self::hasPermission('create_folders') &&
self::hasPermission('max_folders')))) {
- $text .= '<option value="" disabled="disabled">- - - - - - - -</option>' . "\n";
- $text .= '<option value="*new*">' . _("New Folder") . "</option>\n";
- $text .= '<option value="" disabled="disabled">- - - - - - - -</option>' . "\n";
+ $text .= "<option value=\"\" disabled=\"disabled\">- - - - - - - -</option>\n" .
+ '<option value="*new*">' . _("New Folder") . "</option>\n" .
+ "<option value=\"\" disabled=\"disabled\">- - - - - - - -</option>\n";
}
/* Add the list of mailboxes to the lists. */
try {
$notepads = $GLOBALS['registry']->call('notes/listNotepads', array(false, PERMS_EDIT));
if (count($notepads)) {
- $text .= '<option value="" disabled="disabled"> </option><option value="" disabled="disabled">- - ' . _("Notepads") . ' - -</option>' . "\n";
+ $text .= '<option value="" disabled="disabled"> </option><option value="" disabled="disabled">- - ' . _("Notepads") . " - -</option>\n";
foreach ($notepads as $id => $notepad) {
$text .= sprintf('<option value="%s">%s</option>%s',
}
}
- if (IMP::canCompose()) {
+ if (self::canCompose()) {
$menu->add(self::composeLink(array('mailbox' => $GLOBALS['imp_mbox']['mailbox'])), _("_New Message"), 'compose.png');
}
$js_params = array(
'dialog_load' => Horde::applicationUrl('ajax.php', true, -1) . '/FetchmailDialog'
);
- $menu->add('javascript:IMPDialog.display(\'' . IMP::escapeJSON($js_params) . '\')', _("Fetch Mail"), 'fetchmail.png');
+ $menu->add('javascript:IMPDialog.display(\'' . self::escapeJSON($js_params) . '\')', _("Fetch Mail"), 'fetchmail.png');
}
if ($prefs->getValue('filter_menuitem')) {
}
foreach ($enc_opts as $key => $val) {
- $output .= '<option value="' . $key . '"' . (($default == $key) ? ' selected="selected"' : '') . '>' . $val . '</option>' . "\n";
+ $output .= '<option value="' . $key . '"' . (($default == $key) ? ' selected="selected"' : '') . '>' . $val . "</option>\n";
}
return $output;
}
foreach (array_merge(array($js_url), $js_force) as $val) {
- echo '<script type="text/javascript" src="' . $val . '"></script>' . "\n";
+ echo '<script type="text/javascript" src="' . $val . "\"></script>\n";
}
}
}
foreach ($css_out as $file) {
- echo '<link href="' . $file['u'] . '" rel="stylesheet" type="text/css" />' . "\n";
+ echo '<link href="' . $file['u'] . "\" rel=\"stylesheet\" type=\"text/css\" />\n";
}
}
'cancel_text' => _("Cancel")
);
- return 'IMPDialog.display(\'' . IMP::escapeJSON($js_params) . '\')';
+ return 'IMPDialog.display(\'' . self::escapeJSON($js_params) . '\')';
}
/**
* Reads all the user's identities from the prefs object or builds
* a new identity from the standard values given in prefs.php.
*/
- function __construct()
+ public function __construct()
{
parent::__construct();
$this->_properties = array_merge(
/* Flags are named PREFIX{$i}. Keep incrementing until we find the
* next available flag. */
- for ($i = 0; ; ++$i) {
+ for ($i = 0;; ++$i) {
$curr = self::PREFIX . $i;
if (!isset($this->_flags[$curr])) {
$this->_flags[$curr] = array(
$this->_currkey = $old['k'] + 1;
$this->_currparent = $old['p'];
} while ((($curr = $this->current()) == false) &&
- count($this->_currstack));
+ !empty($this->_currstack));
}
}
*/
public function peek()
{
- for ($i = ($this->_currkey + 1); ; ++$i) {
+ for ($i = ($this->_currkey + 1);; ++$i) {
if (!isset($this->_parent[$this->_currparent][$i])) {
return false;
}
}
}
-
switch ($mailbox['v']) {
case 'INBOX':
$row['icon'] = 'folders/inbox.png';
foreach (array_keys($old_folders) as $k) {
foreach ($sent_mail_folders as $folder) {
if (preg_match('/^' . str_replace('/', '\/', $folder) . '-([^-]+)-([0-9]{4})$/i', $k, $regs)) {
- $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0,$regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), Horde_Nls::getCharset(), 'UTF7-IMAP');
+ $folder_array[$k] = Horde_String::convertCharset((is_numeric($regs[1])) ? mktime(0, 0, 0, $regs[1], 1, $regs[2]) : strtotime("$regs[1] 1, $regs[2]"), Horde_Nls::getCharset(), 'UTF7-IMAP');
}
}
}
/* For stripping all parts, it only makes sense to strip base
* parts. Stripping subparts may cause issues with display of the
* parent multipart type. */
- for ($i = 2; ; ++$i) {
+ for ($i = 2;; ++$i) {
$part = $contents->getMIMEPart($i, array('nocontents' => true));
if (!$part) {
break;
} else {
if ($event->end->compareDateTime($time_span_start) <= -1 ||
$event->start->compareDateTime($time_span_end) >= 1) {
- continue;
+ continue;
}
if ($event->end->compareDateTime($vevent_start) <= -1 ||
$event->start->compareDateTime($vevent_end) >= 1) {
return array(
$mime_id => array(
- 'data' => '<div class="fixed leftAlign">' . "\n" . $text . '</div>',
+ 'data' => "<div class=\"fixed leftAlign\">\n" . $text . '</div>',
'status' => array(),
'type' => $type
)
/**
* User-defined function callback for start elements.
*
- * @param object $parser Handle to the parser instance.
+ * @param object $parser Handle to the parser instance (not used).
* @param string $name The name of this XML element.
* @param array $attrs List of this element's attributes.
*/
$sig = hash('md5', serialize(array($driver, $params)));
if (!isset(self::$_instances[$sig])) {
- self::$_instances[$sig] = IMP_Quota::getInstance($driver, $params);
+ self::$_instances[$sig] = self::getInstance($driver, $params);
}
return self::$_instances[$sig];
'nolimit_short' => isset($this->_params['format']['nolimit_short'])
? $this->_params['format']['nolimit_short']
: _("%.0f %s")
- );
+ );
}
/**
$cmdline = $this->_params['quota_path'] . ' -u ' . $_SESSION['imp']['user'] . ' | ' . $this->_params['grep_path'] . ' ' . $search_string;
exec($cmdline, $quota_data, $return_code);
if (($return_code == 0) && (count($quota_data) == 1)) {
- $quota = split("[[:blank:]]+", trim($quota_data[0]));
- $blocksize = $this->_blockSize();
- return array('usage' => $quota[1] * $blocksize,
+ $quota = split("[[:blank:]]+", trim($quota_data[0]));
+ $blocksize = $this->_blockSize();
+ return array('usage' => $quota[1] * $blocksize,
'limit' => $quota[2] * $blocksize);
}
{
$contents = file_get_contents($path . '\imap.mrk');
+ $c_len = strlen($contents);
$pointer = 36;
$size = 0;
- while ($pointer < strlen($contents)) {
+
+ while ($pointer < $c_len) {
$details = unpack('a17Filename/a11Crap/VSize', substr($contents, $pointer, 36));
$size += $details['Size'];
$pointer += 36;
* 'id' -- The ID of the search query in use.
* </pre>
*/
- function __construct($params = array())
+ public function __construct($params = array())
{
if (!empty($params['id'])) {
$this->_id = $this->_strip($params['id']);
*/
public function createSearchID($id)
{
- return 'impsearch' . "\0" . $this->_strip($id);
+ return 'impsearch\0' . $this->_strip($id);
}
/**
$prog = str_replace(array('%u','%l', '%d'),
array(
escapeshellarg(Horde_Auth::getAuth()),
- escapeshellarg(Horde_Auth::getBareAuth()),
+ escapeshellarg(Horde_Auth::getBareAuth()),
escapeshellarg(Horde_Auth::getAuthDomain())
), $GLOBALS['conf'][$action]['program']);
$proc = proc_open($prog,
{
$fwd_msg = $imp_compose->forwardMessage($imp_contents);
$subject_header = $imp_compose->attachIMAPMessage(array($index), $fwd_msg['headers']);
- if ($subject_header === false) {
- // TODO: notification
- } else {
+ if ($subject_header !== false) {
$fwd_msg['headers']['subject'] = $subject_header;
}
$clean_to .= $val . (($val[Horde_String::length($val) - 1] == ';') ? ' ' : ', ');
}
if ($expand) {
- return $clean_to;
+ return $clean_to;
} else {
- return IMP_Compose::formatAddr($clean_to);
+ return IMP_Compose::formatAddr($clean_to);
}
}
*
* @return array TODO
*/
- public function ListMessages($args)
+ public function listMessages($args)
{
$mbox = $args['mbox'];
$is_search = false;
case 'fckeditor':
return array(
'data' =>
- 'FCKConfig.ToolbarSets["ImpToolbar"] = ' . $GLOBALS['prefs']->getValue('fckeditor_buttons') . ';' . "\n" .
+ 'FCKConfig.ToolbarSets["ImpToolbar"] = ' . $GLOBALS['prefs']->getValue('fckeditor_buttons') . ";\n" .
// To more closely match "normal" textarea behavior,
// send <BR> on enter instead of <P>.
- 'FCKConfig.EnterMode = \'br\';' . "\n" .
+ "FCKConfig.EnterMode = \'br\';\n" .
'FCKConfig.ShiftEnterMode = \'p\';',
'type' => 'text/javascript'
);
* @author Michael Slusarz <slusarz@horde.org>
*/
-function _outputSummaries($msgs, $mbox)
+function _outputSummaries($msgs)
{
static $template;
if ($search_mbox) {
if (empty($lastMbox) || ($ob['mailbox'] != $lastMbox)) {
if (!empty($lastMbox)) {
- _outputSummaries($msgs, $lastMbox);
+ _outputSummaries($msgs);
$msgs = array();
}
$folder_link = Horde::url(Horde_Util::addParameter('mailbox.php', 'mailbox', $ob['mailbox']));
$msgs[$ob['uid']] = $msg;
}
-_outputSummaries($msgs, $lastMbox);
+_outputSummaries($msgs);
/* Prepare the message footers template. */
$mf_template = new Horde_Template();
switch ($imp_ui->getXpriority($xpriority)) {
case 'high':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = '<div class="msgflags flagHighpriority" title="' . htmlspecialchars(_("High Priority")) . '"></div>' . ' ' . $xpriority;
+ $display_headers['priority'] = '<div class="msgflags flagHighpriority" title="' . htmlspecialchars(_("High Priority")) . '"></div> ' . $xpriority;
break;
case 'low':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = '<div class="msgflags flagLowpriority" title="' . htmlspecialchars(_("Low Priority")) . '"></div>' . ' ' . $xpriority;
+ $display_headers['priority'] = '<div class="msgflags flagLowpriority" title="' . htmlspecialchars(_("Low Priority")) . '"></div> ' . $xpriority;
break;
}
$t->set('personalkey-create-email-help', Horde_Help::link('imp', 'pgp-personalkey-create-email'));
$t->set('personalkey-create-keylength-help', Horde_Help::link('imp', 'pgp-personalkey-create-keylength'));
$t->set('personalkey-create-passphrase-help', Horde_Help::link('imp', 'pgp-personalkey-create-passphrase'));
- $t->set('keygen', addslashes(_("Key generation may take a long time to complete. Continue with key generation?")));
+ $t->set('keygen', addslashes(_("Key generation may take a long time to complete. Continue with key generation?")));
$t->set('personal_import_url', Horde_Util::addParameter($selfURL, 'actionID', 'import_personal_public_key'));
$t->set('personalkey-create-actions-help', Horde_Help::link('imp', 'pgp-personalkey-create-actions'));
}
function _errorMsg($e)
{
- echo '<span style="color:red">ERROR</span> - The server returned the following error message:' . "\n" .
+ echo "<span style="color:red">ERROR</span> - The server returned the following error message:\n" .
'<pre>' . $e->getMessage() . '</pre><p />';
}
case 'download_attach':
$mime = $contents->getMIMEPart($id);
if (!$name = $mime->getName(true)) {
- $name = _("unnamed");
+ $name = _("unnamed");
}
/* Compress output? */
$body = $render[$key]['data'];
$type = $render[$key]['type'];
if (!$name = $render[$key]['name']) {
- $name = _("unnamed");
+ $name = _("unnamed");
}
break;
}