function parse_viewheader($imapConnection, $id, $passed_ent_id)
{
    $header_output = array();
    $second = array();
    $first = array();
    if (!$passed_ent_id) {
        $read = sqimap_run_command($imapConnection, "FETCH {$id} BODY[HEADER]", true, $a, $b, TRUE);
    } else {
        $query = "FETCH {$id} BODY[" . $passed_ent_id . '.HEADER]';
        $read = sqimap_run_command($imapConnection, $query, true, $a, $b, TRUE);
    }
    $cnum = 0;
    for ($i = 1; $i < count($read); $i++) {
        $line = sm_encode_html_special_chars($read[$i]);
        switch (true) {
            case preg_match('/^&gt;/i', $line):
                $second[$i] = $line;
                $first[$i] = '&nbsp;';
                $cnum++;
                break;
                // FIXME: is the pipe character below a mistake?  I think the original author might have thought it carried special meaning in the character class, which it does not... but then again, I am not currently trying to understand what this code actually does
            // FIXME: is the pipe character below a mistake?  I think the original author might have thought it carried special meaning in the character class, which it does not... but then again, I am not currently trying to understand what this code actually does
            case preg_match('/^[ |\\t]/', $line):
                $second[$i] = $line;
                $first[$i] = '';
                break;
            case preg_match('/^([^:]+):(.+)/', $line, $regs):
                $first[$i] = $regs[1] . ':';
                $second[$i] = $regs[2];
                $cnum++;
                break;
            default:
                $second[$i] = trim($line);
                $first[$i] = '';
                break;
        }
    }
    for ($i = 0; $i < count($second); $i = $j) {
        $f = isset($first[$i]) ? $first[$i] : '';
        $s = isset($second[$i]) ? nl2br($second[$i]) : '';
        $j = $i + 1;
        while ($first[$j] == '' && $j < count($first)) {
            $s .= '&nbsp;&nbsp;&nbsp;&nbsp;' . nl2br($second[$j]);
            $j++;
        }
        $lowf = strtolower($f);
        /* do not mark these headers as emailaddresses */
        if ($lowf != 'message-id:' && $lowf != 'in-reply-to:' && $lowf != 'references:') {
            parseEmail($s);
        }
        if ($f) {
            $header_output[] = array($f, $s);
        }
    }
    sqimap_logout($imapConnection);
    return $header_output;
}
Exemple #2
0
/**
 * Print the IMAP response to options.php
 *
 * @param array $response results of imap command
 * @access private
 */
function print_response($response)
{
    foreach ($response as $value) {
        if (is_array($value)) {
            print_response($value);
        } else {
            print sm_encode_html_special_chars($value) . "<br />\n";
        }
    }
}
/**
 * Format the address book into a format that is easy for template authors
 * to use
 * 
 * @param array $addresses all contacts as given by calling $abook->list_addr()
 * @return array
 * @author Steve Brown
 * @since 1.5.2
 */
function formatAddressList($addresses)
{
    if (!is_array($addresses) || count($addresses) == 0) {
        return array();
    }
    $contacts = array();
    while (list($undef, $row) = each($addresses)) {
        $contact = array('FirstName' => sm_encode_html_special_chars($row['firstname']), 'LastName' => sm_encode_html_special_chars($row['lastname']), 'FullName' => sm_encode_html_special_chars($row['name']), 'NickName' => sm_encode_html_special_chars($row['nickname']), 'Email' => sm_encode_html_special_chars($row['email']), 'FullAddress' => sm_encode_html_special_chars(AddressBook::full_address($row)), 'RawFullAddress' => AddressBook::full_address($row), 'Info' => sm_encode_html_special_chars($row['label']), 'Extra' => isset($row['extra']) ? $row['extra'] : NULL, 'Source' => sm_encode_html_special_chars($row['source']), 'JSEmail' => sm_encode_html_special_chars(addcslashes(AddressBook::full_address($row), "'"), ENT_QUOTES));
        $contacts[] = $contact;
    }
    return $contacts;
}
Exemple #4
0
/**
 * main logic for month view of calendar
 * @return void
 * @access private
 */
function drawmonthview()
{
    global $year, $month, $color, $calendardata, $todayis;
    $aday = 1 - date('w', mktime(0, 0, 0, $month, 1, $year));
    $days_in_month = date('t', mktime(0, 0, 0, $month, 1, $year));
    while ($aday <= $days_in_month) {
        echo html_tag('tr');
        for ($j = 1; $j <= 7; $j++) {
            $cdate = "{$month}";
            $aday < 10 ? $cdate = $cdate . "0{$aday}" : ($cdate = $cdate . "{$aday}");
            $cdate = $cdate . "{$year}";
            if ($aday <= $days_in_month && $aday > 0) {
                echo html_tag('td', '', 'left', $color[4], 'height="50" valign="top"') . "\n" . html_tag('div', '', 'right');
                echo $cdate == $todayis ? '<font size="-1" color="' . $color[1] . '">[ ' . _("TODAY") . " ] " : '<font size="-1">';
                echo "<a href=day.php?year={$year}&amp;month={$month}&amp;day=";
                echo $aday < 10 ? "0" : "";
                echo "{$aday}>{$aday}</a></font></div>";
            } else {
                echo html_tag('td', '', 'left', $color[0]) . "\n" . "&nbsp;";
            }
            if (isset($calendardata[$cdate])) {
                $i = 0;
                while ($calfoo = each($calendardata[$cdate])) {
                    $calbar = $calendardata[$cdate][$calfoo['key']];
                    // FIXME: how to display multiline task
                    $title = '[' . $calfoo['key'] . '] ' . str_replace(array("\r", "\n"), array(' ', ' '), sm_encode_html_special_chars($calbar['message']));
                    // FIXME: link to nowhere
                    echo "<a href=\"#\" style=\"text-decoration:none; color: " . ($calbar['priority'] == 1 ? $color[1] : $color[6]) . "\" title=\"{$title}\">" . sm_encode_html_special_chars($calbar['title']) . "</a><br />\n";
                    $i = $i + 1;
                    if ($i == 2) {
                        break;
                    }
                }
            }
            echo "\n</td>\n";
            $aday++;
        }
        echo '</tr>';
    }
}
Exemple #5
0
/**
 * Show fortune
 * @access private
 * @since 1.5.1
 */
function fortune_function()
{
    global $oTemplate, $fortune_visible, $color, $fortune_command;
    if (!$fortune_visible) {
        return;
    }
    /* open handle and get all command output*/
    $handle = popen($fortune_command, 'r');
    $fortune = '';
    while ($read = fread($handle, 1024)) {
        $fortune .= $read;
    }
    /* if pclose return != 0, popen command failed. Yes, I know that it is broken when --enable-sigchild is used */
    if (pclose($handle)) {
        // i18n: %s shows executed fortune cookie command.
        $fortune = sprintf(_("Unable to execute \"%s\"."), $fortune_command);
    }
    $oTemplate->assign('color', $color);
    $oTemplate->assign('fortune', sm_encode_html_special_chars($fortune));
    $output = $oTemplate->fetch('plugins/fortune/mailbox_index_before.tpl');
    return array('mailbox_index_before' => $output);
}
/**
 * Presents a confirmation dialog to the user asking whether they're
 * sure they want to delete this folder.
 */
function folders_delete_ask($imapConnection, $folder_name)
{
    global $color, $default_folder_prefix, $oTemplate;
    if ($folder_name == '') {
        plain_error_message(_("You have not selected a folder to delete. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color);
        sqimap_logout($imapConnection);
        $oTemplate->display('footer.tpl');
        exit;
    }
    // hide default folder prefix (INBOX., mail/ or other)
    $visible_folder_name = imap_utf7_decode_local($folder_name);
    $quoted_prefix = preg_quote($default_folder_prefix, '/');
    $prefix_length = preg_match("/^{$quoted_prefix}/", $visible_folder_name) ? strlen($default_folder_prefix) : 0;
    $visible_folder_name = substr($visible_folder_name, $prefix_length);
    sqimap_logout($imapConnection);
    $oTemplate->assign('dialog_type', 'delete');
    $oTemplate->assign('folder_name', sm_encode_html_special_chars($folder_name));
    $oTemplate->assign('visible_folder_name', sm_encode_html_special_chars($visible_folder_name));
    $oTemplate->display('folder_manip_dialog.tpl');
    $oTemplate->display('footer.tpl');
    exit;
}
 /**
  * Applies the template and returns the resultant content string.
  *
  * @param string $file The template file to use
  *
  * @return string The template contents after applying the given template
  *
  */
 function fetch($file)
 {
     // get right template file
     //
     $template = $this->get_template_file_path($file);
     // special case stylesheet.tpl falls back to SquirrelMail's
     // own default stylesheet
     //
     if (empty($template) && $file == 'css/stylesheet.tpl') {
         $template = SM_PATH . 'css/default.css';
     }
     if (empty($template)) {
         trigger_error('The template "' . sm_encode_html_special_chars($file) . '" could not be fetched!', E_USER_ERROR);
     } else {
         $aPluginOutput = array();
         $temp = array(&$aPluginOutput, &$this);
         $aPluginOutput = concat_hook_function('template_construct_' . $file, $temp, TRUE);
         $this->assign('plugin_output', $aPluginOutput);
         //$output = $this->apply_template($template);
         $rendering_engine = $this->get_rendering_template_engine_object($file);
         $output = $rendering_engine->apply_template($template);
         // CAUTION: USE OF THIS HOOK IS HIGHLY DISCOURAGED AND CAN
         // RESULT IN NOTICABLE PERFORMANCE DEGREDATION.  Plugins
         // using this hook will probably be rejected by the
         // SquirrelMail team.
         //
         do_hook('template_output', $output);
         return $output;
     }
 }
Exemple #8
0
    echo '<input type="submit" name="send1" value="' . _("Send Spam Report") . "\" />\n";
} else {
    $spam_message = mime_fetch_body($imap_stream, $passed_id, $passed_ent_id, 50000);
    if (strlen($spam_message) == 50000) {
        $Warning = "\n[truncated by SpamCop]\n";
        $spam_message = substr($spam_message, 0, 50000 - strlen($Warning)) . $Warning;
    }
    $action_url = "http://members.spamcop.net/sc";
    if (isset($js_web) && $js_web) {
        echo "<form method=\"post\" action=\"{$action_url}\" name=\"submitspam\"" . " enctype=\"multipart/form-data\">\n";
    } else {
        echo "<form method=\"post\" action=\"{$action_url}\" name=\"submitspam\"" . " enctype=\"multipart/form-data\" target=\"_blank\">\n";
    }
    ?>
  <input type="hidden" name="action" value="submit" />
  <input type="hidden" name="oldverbose" value="1" />
  <input type="hidden" name="spam" value="<?php 
    echo sm_encode_html_special_chars($spam_message);
    ?>
" />
    <?php 
    echo '<input type="submit" name="x1" value="' . _("Send Spam Report") . "\" />\n";
}
?>
  </form>
</td>
</tr>
</table>
</body>
</html>
Exemple #9
0
/**
 * Function to create a selectlist from an array.
 * @param string  $sName     Field name
 * @param array   $aValues   Field values array(key => value) results in:
 *                           <option value="key">value</option>, 
 *                           although if $bUsekeys is FALSE, then it changes to:
 *                           <option value="value">value</option>
 * @param mixed   $default   The key(s) that will be selected (it is OK to pass 
 *                           in an array here in the case of multiple select lists)
 * @param boolean $bUsekeys  Use the keys of the array as option value or not
 * @param array   $aAttribs  (since 1.5.1) Extra attributes
 * @param boolean $bMultiple When TRUE, a multiple select list will be shown
 *                           (OPTIONAL; default is FALSE (single select list))
 * @param int     $iSize     Desired height of multiple select boxes
 *                           (OPTIONAL; default is SMOPT_SIZE_NORMAL)
 *                           (only applicable when $bMultiple is TRUE)
 *
 * @return string html formated selection box
 * @todo add attributes argument for option tags and default css
 */
function addSelect($sName, $aValues, $default = null, $bUsekeys = false, $aAttribs = array(), $bMultiple = FALSE, $iSize = SMOPT_SIZE_NORMAL)
{
    // only one element
    if (!$bMultiple && count($aValues) == 1) {
        $k = key($aValues);
        $v = array_pop($aValues);
        return addHidden($sName, $bUsekeys ? $k : $v, $aAttribs) . sm_encode_html_special_chars($v);
    }
    if (!isset($aAttribs['id'])) {
        $aAttribs['id'] = $sName;
    }
    // make sure $default is an array, since multiple select lists
    // need the chance to have more than one default...
    //
    if (!is_array($default)) {
        $default = array($default);
    }
    global $oTemplate;
    //FIXME: all the values in the $aAttribs list and $sName and both the keys and values in $aValues used to go thru sm_encode_html_special_chars()... I would propose that most everything that is assigned to the template should go thru that *in the template class* on its way between here and the actual template file.  Otherwise we have to do something like:  foreach ($aAttribs as $key => $value) $aAttribs[$key] = sm_encode_html_special_chars($value); $sName = sm_encode_html_special_chars($sName); $aNewValues = array(); foreach ($aValues as $key => $value) $aNewValues[sm_encode_html_special_chars($key)] = sm_encode_html_special_chars($value); $aValues = $aNewValues;   And probably this too because it has to be matched to a value that has already been sanitized: $default = sm_encode_html_special_chars($default);  (oops, watch out for when $default is an array! (multiple select lists))
    $oTemplate->assign('aAttribs', $aAttribs);
    $oTemplate->assign('aValues', $aValues);
    $oTemplate->assign('bUsekeys', $bUsekeys);
    $oTemplate->assign('default', $default);
    $oTemplate->assign('name', $sName);
    $oTemplate->assign('multiple', $bMultiple);
    $oTemplate->assign('size', $iSize);
    return $oTemplate->fetch('select.tpl');
}
/**
 * Displays error message and URL to message listing
 *
 * Fifth argument ($color array) is removed in 1.5.2.
 * @param string $message error message
 * @param string $mailbox mailbox name
 * @param integer $sort sort order
 * @param integer $startMessage first message
 * @since 1.0
 */
function error_message($message, $mailbox, $sort, $startMessage)
{
    $urlMailbox = urlencode($mailbox);
    $link = array('URL' => sqm_baseuri() . "src/right_main.php?sort={$sort}&amp;startMessage={$startMessage}&amp;mailbox={$urlMailbox}", 'TEXT' => sprintf(_("Click here to return to %s"), strtoupper($mailbox) == 'INBOX' ? _("INBOX") : sm_encode_html_special_chars(imap_utf7_decode_local($mailbox))));
    error_box($message, $link);
}
Exemple #11
0
//
if (!sqgetGlobalVar('just_logged_in', $just_logged_in, SQ_SESSION)) {
    $just_logged_in = false;
}
$temp_just_logged_in = $just_logged_in;
$just_logged_in = false;
sqsession_register($just_logged_in, 'just_logged_in');
// now we're done with the PHP session, can send output to browser
//
displayPageHeader($color, $mailbox, $onload);
/* display a message to the user that their mail has been sent */
if (isset($mail_sent) && $mail_sent == 'yes') {
    $note = _("Your mail has been sent.");
}
if (isset($note)) {
    $oTemplate->assign('note', sm_encode_html_special_chars($note));
    $oTemplate->display('note.tpl');
}
if ($temp_just_logged_in || $show_motd) {
    $motd = trim($motd);
    if ($show_motd || strlen($motd) > 0) {
        $oTemplate->assign('motd', $motd);
        $oTemplate->display('motd.tpl');
    }
}
if ($aMailbox['EXISTS'] > 0) {
    $aTemplateVars = showMessagesForMailbox($imapConnection, $aMailbox, $aProps, $iError);
    if ($iError) {
    }
    foreach ($aTemplateVars as $k => $v) {
        $oTemplate->assign($k, $v);
/**
 * Prepares the message headers for display inside a template. The links are calculated,
 * color for row highlighting is calculated and optionally the strings are truncated.
 *
 * @param array    $aMailbox (reference) mailbox retrieved from sqm_api_mailbox_select
 * @param array    $aProps properties
 * @return array   $aFormattedMessages array with message headers and format info
 * @since 1.5.1
 * @author Marc Groot Koerkamp
 */
function prepareMessageList(&$aMailbox, $aProps)
{
    /* Globalize link attributes so plugins can share in modifying them */
    global $link, $title, $target, $onclick, $link_extra, $preselected;
    /* retrieve the properties */
    $my_email_address = isset($aProps['email']) ? $aProps['email'] : false;
    $highlight_list = isset($aProps['config']['highlight_list']) ? $aProps['config']['highlight_list'] : false;
    $aColumnDesc = isset($aProps['columns']) ? $aProps['columns'] : false;
    $aExtraColumns = isset($aProps['extra_columns']) ? $aProps['extra_columns'] : array();
    $iAccount = isset($aProps['account']) ? (int) $aProps['account'] : 0;
    $sMailbox = isset($aProps['mailbox']) ? $aProps['mailbox'] : false;
    $sTargetModule = isset($aProps['module']) ? $aProps['module'] : 'read_body';
    /*
     * TODO 1, retrieve array with identity email addresses in order to match against to,cc and set a flag
     * $aFormattedMessages[$iUid]['match_identity'] = true
     * The template can show some image if there is a match.
     * TODO 2, makes sure the matching is done fast by doing a strpos call on the returned $value
     */
    /**
     * Only retrieve values for displayable columns
     */
    foreach ($aColumnDesc as $k => $v) {
        switch ($k) {
            case SQM_COL_FROM:
                $aCol[SQM_COL_FROM] = 'from';
                break;
            case SQM_COL_DATE:
                $aCol[SQM_COL_DATE] = 'date';
                break;
            case SQM_COL_SUBJ:
                $aCol[SQM_COL_SUBJ] = 'subject';
                break;
            case SQM_COL_FLAGS:
                $aCol[SQM_COL_FLAGS] = 'FLAGS';
                break;
            case SQM_COL_SIZE:
                $aCol[SQM_COL_SIZE] = 'SIZE';
                break;
            case SQM_COL_PRIO:
                $aCol[SQM_COL_PRIO] = 'x-priority';
                break;
            case SQM_COL_ATTACHMENT:
                $aCol[SQM_COL_ATTACHMENT] = 'content-type';
                break;
            case SQM_COL_INT_DATE:
                $aCol[SQM_COL_INT_DATE] = 'INTERNALDATE';
                break;
            case SQM_COL_TO:
                $aCol[SQM_COL_TO] = 'to';
                break;
            case SQM_COL_CC:
                $aCol[SQM_COL_CC] = 'cc';
                break;
            case SQM_COL_BCC:
                $aCol[SQM_COL_BCC] = 'bcc';
                break;
            default:
                break;
        }
    }
    $aExtraHighLightColumns = array();
    foreach ($aExtraColumns as $v) {
        switch ($v) {
            case SQM_COL_FROM:
                $aExtraHighLightColumns[] = 'from';
                break;
            case SQM_COL_SUBJ:
                $aExtraHighLightColumns[] = 'subject';
                break;
            case SQM_COL_TO:
                $aExtraHighLightColumns[] = 'to';
                break;
            case SQM_COL_CC:
                $aExtraHighLightColumns[] = 'cc';
                break;
            case SQM_COL_BCC:
                $aExtraHighLightColumns[] = 'bcc';
                break;
            default:
                break;
        }
    }
    $aFormattedMessages = array();
    $iSetIndx = $aMailbox['SETINDEX'];
    $aId = $aMailbox['UIDSET'][$iSetIndx];
    $aHeaders =& $aMailbox['MSG_HEADERS'];
    /* use a reference to avoid a copy.
       MSG_HEADERS can contain large amounts of data */
    $iOffset = $aMailbox['OFFSET'];
    $sort = $aMailbox['SORT'];
    $iPageOffset = $aMailbox['PAGEOFFSET'];
    $sMailbox = $aMailbox['NAME'];
    $sSearch = isset($aMailbox['SEARCH'][$aMailbox['SETINDEX']]) && $aMailbox['SEARCH'][$aMailbox['SETINDEX']] != 'ALL' ? $aMailbox['SEARCH'][$aMailbox['SETINDEX']] : false;
    $aSearch = $sSearch ? array('search.php', $aMailbox['SETINDEX']) : null;
    /* avoid improper usage */
    if ($sMailbox && isset($iAccount) && $sTargetModule) {
        $aInitQuery = array("account={$iAccount}", 'mailbox=' . urlencode($sMailbox));
    } else {
        $aInitQuery = false;
    }
    if ($aMailbox['SORT'] & SQSORT_THREAD) {
        $aIndentArray =& $aMailbox['THREAD_INDENT'][$aMailbox['SETINDEX']];
        $bThread = true;
    } else {
        $bThread = false;
    }
    /*
     * Retrieve value for checkbox column
     */
    if (!sqgetGlobalVar('checkall', $checkall, SQ_GET)) {
        $checkall = false;
    }
    /*
     * Loop through and display the info for each message.
     */
    $iEnd = $aMailbox['SHOWALL'][$iSetIndx] ? $aMailbox['EXISTS'] : $iOffset + $aMailbox['LIMIT'];
    for ($i = $iOffset, $t = 0; $i < $iEnd; ++$i) {
        if (isset($aId[$i])) {
            $bHighLight = false;
            $value = $title = $link = $target = $onclick = $link_extra = '';
            $aQuery = $aInitQuery !== false ? $aInitQuery : false;
            $aMsg = $aHeaders[$aId[$i]];
            if (isset($aSearch) && count($aSearch) > 1 && $aQuery) {
                $aQuery[] = "where=" . $aSearch[0];
                $aQuery[] = "what=" . $aSearch[1];
            }
            $iUid = isset($aMsg['UID']) ? $aMsg['UID'] : $aId[$i];
            if ($aQuery) {
                $aQuery[] = "passed_id={$aId[$i]}";
                $aQuery[] = "startMessage={$iPageOffset}";
            }
            foreach ($aCol as $k => $v) {
                $title = $link = $target = $onclick = $link_extra = '';
                $aColumns[$k] = array();
                $value = isset($aMsg[$v]) ? $aMsg[$v] : '';
                $sUnknown = _("Unknown recipient");
                switch ($k) {
                    case SQM_COL_FROM:
                        $sUnknown = _("Unknown sender");
                    case SQM_COL_TO:
                    case SQM_COL_CC:
                    case SQM_COL_BCC:
                        $sTmp = false;
                        if ($value) {
                            if ($highlight_list && !$bHighLight) {
                                $bHighLight = highlightMessage($aCol[$k], $value, $highlight_list, $aFormattedMessages[$iUid]);
                            }
                            $aAddressList = parseRFC822Address($value);
                            $sTmp = getAddressString($aAddressList, array('best' => true));
                            $title = $title_maybe = '';
                            foreach ($aAddressList as $aAddr) {
                                $sPersonal = isset($aAddr[SQM_ADDR_PERSONAL]) ? $aAddr[SQM_ADDR_PERSONAL] : '';
                                $sMailbox = isset($aAddr[SQM_ADDR_MAILBOX]) ? $aAddr[SQM_ADDR_MAILBOX] : '';
                                $sHost = isset($aAddr[SQM_ADDR_HOST]) ? $aAddr[SQM_ADDR_HOST] : '';
                                if ($sPersonal) {
                                    $title .= sm_encode_html_special_chars($sMailbox . '@' . $sHost) . ', ';
                                } else {
                                    // if $value gets truncated we need to add the addresses with no
                                    // personal name as well
                                    $title_maybe .= sm_encode_html_special_chars($sMailbox . '@' . $sHost) . ', ';
                                }
                            }
                            if ($title) {
                                $title = substr($title, 0, -2);
                                // strip ', ';
                            }
                            $sTmp = decodeHeader($sTmp);
                            if (isset($aColumnDesc[$k]['truncate']) && $aColumnDesc[$k]['truncate']) {
                                $sTrunc = sm_truncate_string($sTmp, $aColumnDesc[$k]['truncate'], '...', TRUE);
                                if ($sTrunc != $sTmp) {
                                    if (!$title) {
                                        $title = $sTmp;
                                    } else {
                                        if ($title_maybe) {
                                            $title = $title . ', ' . $title_maybe;
                                            $title = substr($title, 0, -2);
                                            // strip ', ';
                                        }
                                    }
                                }
                                $sTmp = $sTrunc;
                            }
                        }
                        $value = $sTmp ? substr($sTmp, 0, 6) == '&quot;' && substr($sTmp, -6) == '&quot;' ? substr(substr($sTmp, 0, -6), 6) : $sTmp : $sUnknown;
                        break;
                    case SQM_COL_SUBJ:
                        // subject is mime encoded, decode it.
                        // value is sanitized in decoding function.
                        // TODO, verify if it should be done before or after the highlighting
                        $value = decodeHeader($value);
                        if ($highlight_list && !$bHighLight) {
                            $bHighLight = highlightMessage('SUBJECT', $value, $highlight_list, $aFormattedMessages[$iUid]);
                        }
                        $iIndent = isset($aIndentArray[$aId[$i]]) ? $aIndentArray[$aId[$i]] : 0;
                        // FIXME: don't break 8bit symbols and html entities during truncation
                        if (isset($aColumnDesc[$k]['truncate']) && $aColumnDesc[$k]['truncate']) {
                            $sTmp = sm_truncate_string($value, $aColumnDesc[$k]['truncate'] - $iIndent, '...', TRUE);
                            // drop any double spaces since these will be displayed in the title
                            // Nah, it's nice to always have a roll-over
                            //$title = ($sTmp != $value) ? preg_replace('/\s{2,}/', ' ', $value) : '';
                            $title = preg_replace('/\\s{2,}/', ' ', $value);
                            $value = $sTmp;
                        }
                        /* generate the link to the message */
                        if ($aQuery) {
                            // TODO, $sTargetModule should be a query parameter so that we can use a single entrypoint
                            $link = $sTargetModule . '.php?' . implode('&amp;', $aQuery);
                            // see top of this function for which attributes are available
                            // in the global scope for plugin use (like $link, $target,
                            // $onclick, $link_extra, $title, and so forth)
                            // plugins are responsible for sharing nicely (such as for
                            // setting the target, etc)
                            $temp = array(&$iPageOffset, &$sSearch, &$aSearch, $aMsg);
                            do_hook('subject_link', $temp);
                        }
                        $value = trim($value) ? $value : _("(no subject)");
                        /* add thread indentation */
                        $aColumns[$k]['indent'] = $iIndent;
                        break;
                    case SQM_COL_SIZE:
                        $value = show_readable_size($value);
                        break;
                    case SQM_COL_DATE:
                    case SQM_COL_INT_DATE:
                        $value = getTimeStamp(explode(' ', trim($value)));
                        $title = getDateString($value, TRUE);
                        $value = getDateString($value);
                        break;
                    case SQM_COL_FLAGS:
                        $aFlagColumn = array('seen' => false, 'deleted' => false, 'answered' => false, 'forwarded' => false, 'flagged' => false, 'draft' => false);
                        if (!is_array($value)) {
                            $value = array();
                        }
                        foreach ($value as $sFlag => $v) {
                            switch ($sFlag) {
                                case '\\seen':
                                    $aFlagColumn['seen'] = true;
                                    break;
                                case '\\deleted':
                                    $aFlagColumn['deleted'] = true;
                                    break;
                                case '\\answered':
                                    $aFlagColumn['answered'] = true;
                                    break;
                                case '$forwarded':
                                    $aFlagColumn['forwarded'] = true;
                                    break;
                                case '\\flagged':
                                    $aFlagColumn['flagged'] = true;
                                    break;
                                case '\\draft':
                                    $aFlagColumn['draft'] = true;
                                    break;
                                default:
                                    break;
                            }
                        }
                        $value = $aFlagColumn;
                        break;
                    case SQM_COL_PRIO:
                        $value = $value ? (int) $value : 3;
                        break;
                    case SQM_COL_ATTACHMENT:
                        $value = is_array($value) && $value[0] == 'multipart' && $value[1] == 'mixed' ? true : false;
                        break;
                    case SQM_COL_CHECK:
                        $value = $checkall || in_array($iUid, $preselected);
                        break;
                    default:
                        break;
                }
                if ($title) {
                    $aColumns[$k]['title'] = $title;
                }
                if ($link) {
                    $aColumns[$k]['link'] = $link;
                }
                if ($link_extra) {
                    $aColumns[$k]['link_extra'] = $link_extra;
                }
                if ($onclick) {
                    $aColumns[$k]['onclick'] = $onclick;
                }
                if ($target) {
                    $aColumns[$k]['target'] = $target;
                }
                $aColumns[$k]['value'] = $value;
            }
            /* columns which will not be displayed but should be inspected
               because the highlight list contains rules with those columns */
            foreach ($aExtraHighLightColumns as $v) {
                if ($highlight_list && !$bHighLight && isset($aMsg[$v])) {
                    $bHighLight = highlightMessage($v, $aMsg[$v], $highlight_list, $aFormattedMessages[$iUid]);
                }
            }
            $aFormattedMessages[$iUid]['columns'] = $aColumns;
        } else {
            break;
        }
    }
    return $aFormattedMessages;
}
/**
 * Displays form that allows to enter different password for dictionary decryption.
 * If language is not set, function provides form to handle older dictionary files.
 * @param string $lang language
 * @since 1.5.1 (sqspell 0.5)
 */
function sqspell_handle_crypt_panic($lang = false)
{
    if (!sqgetGlobalVar('SCRIPT_NAME', $SCRIPT_NAME, SQ_SERVER)) {
        $SCRIPT_NAME = '';
    }
    /**
     * AAAAAAAAAAAH!!!!! OK, ok, breathe!
     * Let's hope the decryption failed because the user changed his
     * password. Bring up the option to key in the old password
     * or wipe the file and start over if everything else fails.
     *
     * The _("SquirrelSpell...) line has to be on one line, otherwise
     * gettext will bork. ;(
     */
    $msg = html_tag('p', "\n" . '<strong>' . _("ATTENTION:") . '</strong><br />' . _("SquirrelSpell was unable to decrypt your personal dictionary. This is most likely due to the fact that you have changed your mailbox password. In order to proceed, you will have to supply your old password so that SquirrelSpell can decrypt your personal dictionary. It will be re-encrypted with your new password after this. If you haven't encrypted your dictionary, then it got mangled and is no longer valid. You will have to delete it and start anew. This is also true if you don't remember your old password -- without it, the encrypted data is no longer accessible."), 'left') . "\n" . ($lang ? html_tag('p', sprintf(_("Your %s dictionary is encrypted with password that differs from your current password."), sm_encode_html_special_chars($lang)), 'left') : '') . '<blockquote>' . "\n" . '<form method="post" onsubmit="return AYS()">' . "\n" . '<input type="hidden" name="MOD" value="crypto_badkey" />' . "\n" . ($lang ? '<input type="hidden" name="dict_lang" value="' . sm_encode_html_special_chars($lang) . '" />' : '<input type="hidden" name="old_setup" value="yes" />') . html_tag('p', "\n" . '<input type="checkbox" name="delete_words" value="ON" id="delete_words" />' . '<label for="delete_words">' . _("Delete my dictionary and start a new one") . '</label><br /><label for="old_key">' . _("Decrypt my dictionary with my old password:"******"text" name="old_key" id="old_key" size="10" />', 'left') . "\n" . '</blockquote>' . "\n" . html_tag('p', "\n" . '<input type="submit" value="' . _("Proceed") . ' &gt;&gt;" />', 'center') . "\n" . '</form>' . "\n";
    /**
     * Add some string vars so they can be i18n'd.
     */
    $msg .= "<script type=\"text/javascript\"><!--\n" . "var ui_choice = \"" . _("You must make a choice") . "\";\n" . "var ui_candel = \"" . _("You can either delete your dictionary or type in the old password. Not both.") . "\";\n" . "var ui_willdel = \"" . _("This will delete your personal dictionary file. Proceed?") . "\";\n" . "//--></script>\n";
    /**
     * See if this happened in the pop-up window or when accessing
     * the SpellChecker options page.
     * This is a dirty solution, I agree.
     * TODO: make this prettier.
     */
    if (strstr($SCRIPT_NAME, "sqspell_options")) {
        sqspell_makePage(_("Error Decrypting Dictionary"), "decrypt_error.js", $msg);
    } else {
        sqspell_makeWindow(null, _("Error Decrypting Dictionary"), "decrypt_error.js", $msg);
    }
    exit;
}
Exemple #14
0
if ($show_only_subscribed_folders && !$no_list_for_subscribe) {
    // FIXME: fix subscription options when top folder is not subscribed and sub folder is subscribed
    // TODO: use checkboxes instead of select options.
    // DONE Steve Brown 2006-08-08
    /** SUBSCRIBE TO FOLDERS **/
    $boxes_all = sqimap_mailbox_list_all($imapConnection);
    // here we filter out all boxes we're already subscribed to,
    // so we keep only the unsubscribed ones.
    foreach ($boxes_all as $box_a) {
        $use_folder = true;
        foreach ($boxes as $box) {
            if ($box_a['unformatted'] == $box['unformatted'] || $box_a['unformatted-dm'] == $folder_prefix) {
                $use_folder = false;
            }
        }
        if ($use_folder) {
            $box_enc = sm_encode_html_special_chars($box_a['unformatted-dm']);
            $box_disp = sm_encode_html_special_chars(imap_utf7_decode_local($box_a['unformatted-disp']));
            $subbox_option_list[] = array('Value' => $box_enc, 'Display' => $box_disp);
        }
    }
}
sqimap_logout($imapConnection);
$oTemplate->assign('show_subfolders_option', $show_contain_subfolders_option);
$oTemplate->assign('show_only_subscribed_folders', $show_only_subscribed_folders == 1);
$oTemplate->assign('no_list_for_subscribe', $no_list_for_subscribe);
$oTemplate->assign('mbx_option_list', $mbx_option_list);
$oTemplate->assign('rendel_folder_list', $rendel_folder_list);
$oTemplate->assign('subbox_option_list', $subbox_option_list);
$oTemplate->display('folder_manip.tpl');
$oTemplate->display('footer.tpl');
Exemple #15
0
/**
 * Encode password
 * @param string $password plain text password
 * @param string $crypto used crypto
 * @param array $msgs error messages
 * @param string $forced_salt old password used to create password hash for verification
 * @return string hashed password. false, if hashing fails
 */
function cpw_peardb_passwd_hash($password, $crypto, &$msgs, $forced_salt = '')
{
    global $username;
    $crypto = strtolower($crypto);
    $ret = false;
    $salt = '';
    // extra symbols used for random string in crypt salt
    // squirrelmail GenerateRandomString() adds alphanumerics with third argument = 7.
    $extra_salt_chars = './';
    switch ($crypto) {
        case 'plain-md5':
            $ret = '{PLAIN-MD5}' . md5($password);
            break;
        case 'digest-md5':
            // split username into user and domain parts
            if (preg_match("/(.*)@(.*)/", $username, $match)) {
                $ret = '{DIGEST-MD5}' . md5($match[1] . ':' . $match[2] . ':' . $password);
            } else {
                array_push($msgs, _("Unable to use digest-md5 crypto."));
            }
            break;
        case 'tagged_crypt':
        case 'crypt':
            if (!defined('CRYPT_STD_DES') || CRYPT_STD_DES == 0) {
                array_push($msgs, sprintf(_("Unsupported crypto: %s"), 'crypt'));
                break;
            }
            if ($forced_salt == '') {
                $salt = GenerateRandomString(2, $extra_salt_chars, 7);
            } else {
                $salt = $forced_salt;
            }
            $ret = $crypto == 'tagged_crypt' ? '{crypt}' : '';
            $ret .= crypt($password, $salt);
            break;
        case 'tagged_md5crypt':
        case 'md5crypt':
            if (!defined('CRYPT_MD5') || CRYPT_MD5 == 0) {
                array_push($msgs, sprintf(_("Unsupported crypto: %s"), 'md5crypt'));
                break;
            }
            if ($forced_salt == '') {
                $salt = '$1$' . GenerateRandomString(9, $extra_salt_chars, 7);
            } else {
                $salt = $forced_salt;
            }
            $ret = $crypto == 'tagged_md5crypt' ? '{crypt}' : '';
            $ret .= crypt($password, $salt);
            break;
        case 'tagged_extcrypt':
        case 'extcrypt':
            if (!defined('CRYPT_EXT_DES') || CRYPT_EXT_DES == 0) {
                array_push($msgs, sprintf(_("Unsupported crypto: %s"), 'extcrypt'));
                break;
            }
            if ($forced_salt == '') {
                $salt = '_' . GenerateRandomString(8, $extra_salt_chars, 7);
            } else {
                $salt = $forced_salt;
            }
            $ret = $crypto == 'tagged_extcrypt' ? '{crypt}' : '';
            $ret .= crypt($password, $salt);
            break;
        case 'tagged_blowfish':
        case 'blowfish':
            if (!defined('CRYPT_BLOWFISH') || CRYPT_BLOWFISH == 0) {
                array_push($msgs, sprintf(_("Unsupported crypto: %s"), 'blowfish'));
                break;
            }
            if ($forced_salt == '') {
                $salt = '$2a$12$' . GenerateRandomString(13, $extra_salt_chars, 7);
            } else {
                $salt = $forced_salt;
            }
            $ret = $crypto == 'tagged_blowfish' ? '{crypt}' : '';
            $ret .= crypt($password, $salt);
            break;
        case 'plain':
        case 'plaintext':
            $ret = $password;
            break;
        default:
            array_push($msgs, sprintf(_("Unsupported crypto: %s"), sm_encode_html_special_chars($crypto)));
    }
    return $ret;
}
Exemple #16
0
/**
 * Create and initialize an addressbook object.
 * @param boolean $showerr display any address book init errors. html page header
 * must be created before calling addressbook_init() with $showerr enabled.
 * @param boolean $onlylocal enable only local address book backends. Should 
 *  be used when code does not need access to remote backends. Backends
 *  that provide read only address books with limited listing options can be
 *  tagged as remote.
 * @return object address book object.
 */
function addressbook_init($showerr = true, $onlylocal = false)
{
    global $data_dir, $username, $ldap_server, $address_book_global_filename;
    global $addrbook_dsn, $addrbook_table;
    global $abook_global_file, $abook_global_file_writeable, $abook_global_file_listing;
    global $addrbook_global_dsn, $addrbook_global_table, $addrbook_global_writeable, $addrbook_global_listing;
    global $abook_file_line_length;
    /* Create a new addressbook object */
    $abook = new AddressBook();
    /* Create empty error message */
    $abook_init_error = '';
    /*
        Always add a local backend. We use *either* file-based *or* a
        database addressbook. If $addrbook_dsn is set, the database
        backend is used. If not, addressbooks are stores in files.
    */
    if (isset($addrbook_dsn) && !empty($addrbook_dsn)) {
        /* Database */
        if (!isset($addrbook_table) || empty($addrbook_table)) {
            $addrbook_table = 'address';
        }
        $r = $abook->add_backend('database', array('dsn' => $addrbook_dsn, 'owner' => $username, 'table' => $addrbook_table));
        if (!$r && $showerr) {
            $abook_init_error .= _("Error initializing address book database.") . "\n" . $abook->error;
        }
    } else {
        /* File */
        $filename = getHashedFile($username, $data_dir, "{$username}.abook");
        $r = $abook->add_backend('local_file', array('filename' => $filename, 'umask' => 077, 'line_length' => $abook_file_line_length, 'create' => true));
        if (!$r && $showerr) {
            // no need to use $abook->error, because message explains error.
            $abook_init_error .= sprintf(_("Error opening file %s"), $filename);
        }
    }
    /* Global file based addressbook */
    if (isset($abook_global_file) && isset($abook_global_file_writeable) && isset($abook_global_file_listing) && trim($abook_global_file) != '') {
        // Detect place of address book
        if (!preg_match("/[\\/\\\\]/", $abook_global_file)) {
            /* no path chars, address book stored in data directory
             * make sure that there is a slash between data directory
             * and address book file name
             */
            $abook_global_filename = $data_dir . (substr($data_dir, -1) != '/' ? '/' : '') . $abook_global_file;
        } elseif (preg_match("/^\\/|\\w:/", $abook_global_file)) {
            // full path is set in options (starts with slash or x:)
            $abook_global_filename = $abook_global_file;
        } else {
            $abook_global_filename = SM_PATH . $abook_global_file;
        }
        $r = $abook->add_backend('local_file', array('filename' => $abook_global_filename, 'name' => _("Global Address Book"), 'detect_writeable' => false, 'line_length' => $abook_file_line_length, 'writeable' => $abook_global_file_writeable, 'listing' => $abook_global_file_listing));
        /* global abook init error is not fatal. add error message and continue */
        if (!$r && $showerr) {
            if ($abook_init_error != '') {
                $abook_init_error .= "\n";
            }
            $abook_init_error .= _("Error initializing global address book.") . "\n" . $abook->error;
        }
    }
    /* Load global addressbook from SQL if configured */
    if (isset($addrbook_global_dsn) && !empty($addrbook_global_dsn)) {
        /* Database configured */
        if (!isset($addrbook_global_table) || empty($addrbook_global_table)) {
            $addrbook_global_table = 'global_abook';
        }
        $r = $abook->add_backend('database', array('dsn' => $addrbook_global_dsn, 'owner' => 'global', 'name' => _("Global Address Book"), 'writeable' => $addrbook_global_writeable, 'listing' => $addrbook_global_listing, 'table' => $addrbook_global_table));
        /* global abook init error is not fatal. add error message and continue */
        if (!$r && $showerr) {
            if ($abook_init_error != '') {
                $abook_init_error .= "\n";
            }
            $abook_init_error .= _("Error initializing global address book.") . "\n" . $abook->error;
        }
    }
    /*
     * hook allows to include different address book backends.
     * plugins should extract $abook and $r from arguments
     * and use same add_backend commands as above functions.
     * Since 1.5.2 hook sends third ($onlylocal) argument to address book
     * plugins in order to allow detection of local address book init.
     * @since 1.5.1 and 1.4.5
     * Since 1.5.2, the plugin arguments are passed inside an array
     * and by reference, so plugins hooking in here need to accept arguments
     * in an array and change those values as needed instead of returning
     * the changed values.
     */
    $temp = array(&$abook, &$r, &$onlylocal);
    do_hook('abook_init', $temp);
    if (!$r && $showerr) {
        if ($abook_init_error != '') {
            $abook_init_error .= "\n";
        }
        $abook_init_error .= _("Error initializing other address books.") . "\n" . $abook->error;
    }
    /* Load configured LDAP servers (if PHP has LDAP support) */
    if (isset($ldap_server) && is_array($ldap_server)) {
        reset($ldap_server);
        while (list($undef, $param) = each($ldap_server)) {
            if (!is_array($param)) {
                continue;
            }
            /* if onlylocal is true, we only add writeable ldap servers */
            if ($onlylocal && (!isset($param['writeable']) || $param['writeable'] != true)) {
                continue;
            }
            $r = $abook->add_backend('ldap_server', $param);
            if (!$r && $showerr) {
                if ($abook_init_error != '') {
                    $abook_init_error .= "\n";
                }
                $abook_init_error .= sprintf(_("Error initializing LDAP server %s:"), $param['host']) . "\n";
                $abook_init_error .= $abook->error;
            }
        }
    }
    // end of ldap server init
    /**
     * display address book init errors.
     */
    if ($abook_init_error != '' && $showerr) {
        error_box(nl2br(sm_encode_html_special_chars($abook_init_error)));
    }
    /* Return the initialized object */
    return $abook;
}
Exemple #17
0
echo sprintf('	      <option value="web_form"%s>%s</option>', $selected, _("Web-based form"));
?>
            </select>
            <input type="hidden" name="action" value="meth" />
            <?php 
echo '<input type="submit" value="' . _("Save Method") . "\" />\n";
?>
          </form></td>
        </tr>
        <tr>
          <?php 
echo html_tag('td', _("Your SpamCop authorization code:") . "<br />" . '<small>(' . _("see below") . ')</small>', 'right', '', 'valign="top"');
?>
          <td valign="top"><form method="post" action="options.php">
            <input type="text" size="30" name="ID" value="<?php 
echo sm_encode_html_special_chars($spamcop_id);
?>
" />
            <input type="hidden" name="action" value="save_id" />
            <?php 
echo '<input type="submit" value="' . _("Save ID") . "\" />\n";
?>
          </form></td>
        </tr>
      </table>
<?php 
echo '<p><b>' . _("About SpamCop") . '</b><br />';
echo _("SpamCop is a free service that greatly assists in finding the true source of the spam and helps in letting the proper people know about the abuse.");
echo "</p>\n";
echo '<p>';
printf(_("To use it, you must get a SpamCop authorization code. There is a free %ssign up page%s so you can use SpamCop."), '<a href="http://spamcop.net/anonsignup.shtml">', '</a>');
/**
 * Include the SquirrelMail initialization file.
 */
require '../include/init.php';
/* SquirrelMail required files. */
require_once SM_PATH . 'functions/forms.php';
/* get globals */
if (sqgetGlobalVar('num', $num, SQ_GET)) {
    $num = (int) $num;
} else {
    $num = false;
}
if (!sqgetGlobalVar('method', $method)) {
    $method = '';
} else {
    $method = sm_encode_html_special_chars($method);
}
if (!sqgetGlobalVar('positions', $pos, SQ_GET)) {
    $pos = 0;
} else {
    $pos = (int) $pos;
}
if (!sqgetGlobalVar('account', $account, SQ_GET)) {
    $iAccount = 0;
} else {
    $iAccount = (int) $account;
}
if (sqgetGlobalVar('mailbox', $mailbox, SQ_GET)) {
    $aMailboxPrefs = unserialize(getPref($data_dir, $username, "pref_" . $iAccount . '_' . $mailbox));
    if (isset($aMailboxPrefs[MBX_PREF_COLUMNS])) {
        $index_order = $aMailboxPrefs[MBX_PREF_COLUMNS];
Exemple #19
0
/**
 * @param array $mailfetch
 */
function Mail_Fetch_Select_Server($mailfetch)
{
    global $PHP_SELF;
    echo '<font size="-5"><br /></font>' . '<form action="' . $PHP_SELF . '" method="post" target="_self">' . html_tag('table', '', 'center', '', 'width="70%" cols="2"') . html_tag('tr') . html_tag('td', _("Select Server:") . ' &nbsp; &nbsp;', 'right') . html_tag('td', '', 'left') . '<select name="server_to_fetch" size="1">' . '<option value="all" selected="selected">..' . _("All") . "...\n";
    for ($i = 0; $i < $mailfetch['server_number']; $i++) {
        echo "<option value=\"{$i}\">" . sm_encode_html_special_chars($mailfetch[$i]['alias']) . '</option>' . "\n";
    }
    echo '</select>' . '</td>' . '</tr>';
    //if password not set, ask for it
    for ($i = 0; $i < $mailfetch['server_number']; $i++) {
        if ($mailfetch[$i]['pass'] == '') {
            echo html_tag('tr', html_tag('td', _("Password for") . ' <b>' . sm_encode_html_special_chars($mailfetch[$i]['alias']) . '</b>: &nbsp; &nbsp; ', 'right') . html_tag('td', '<input type="password" name="pass_' . $i . '" />', 'left'));
        }
    }
    echo html_tag('tr', html_tag('td', '&nbsp;') . html_tag('td', '<input type="submit" name="submit_mailfetch" value="' . _("Fetch Mail") . '" />', 'left')) . '</table></form>';
}
Exemple #20
0
    $a['BackendID'] = $backend->bnum;
    $a['BackendSource'] = $backend->sname;
    $a['BackendWritable'] = $backend->writeable;
    $a['Addresses'] = array();
    // don't do address lookup if we are not viewing that backend
    //
    if ($backend->bnum == $current_backend) {
        $alist = $abook->list_addr($backend->bnum);
        /* check return (array with data or boolean false) */
        if (is_array($alist)) {
            usort($alist, 'alistcmp');
            $a['Addresses'] = formatAddressList($alist);
            $addresses[$backend->bnum] = $a;
        } else {
            // list_addr() returns boolean
            plain_error_message(nl2br(sm_encode_html_special_chars($abook->error)));
        }
    } else {
        $addresses[$backend->bnum] = $a;
    }
}
$current_page_args = array('abook_sort_order' => $abook_sort_order, 'new_bnum' => $current_backend, 'page_number' => $page_number);
// note that plugins can add to $current_page_args as well as
// filter the address list
//
$temp = array(&$addresses, &$current_backend, &$page_number, &$current_page_args);
do_hook('abook_list_filter', $temp);
// NOTE to address book backend authors and plugin authors: if a backend does
//      pagination (which might be more efficient), it needs to place a key
//      in every address listing it returns called "paginated", whose value
//      should evaluate to boolean TRUE.  However, if a plugin will also be
Exemple #21
0
/**
 * Confirms event update
 * @return void
 * @access private
 */
function confirm_update()
{
    global $calself, $year, $month, $day, $hour, $minute, $calendardata, $color, $event_year, $event_month, $event_day, $event_hour, $event_minute, $event_length, $event_priority, $event_title, $event_text;
    $tmparray = $calendardata["{$month}{$day}{$year}"]["{$hour}{$minute}"];
    $tab = '    ';
    echo html_tag('table', html_tag('tr', html_tag('th', _("Do you really want to change this event from:") . "<br />\n", '', $color[4], 'colspan="2"') . "\n") . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($hour, $minute, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Priority:"), 'right', $color[4]) . "\n" . html_tag('td', $tmparray['priority'], 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($tmparray['title']), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($tmparray['message'])), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('th', _("to:") . "<br />\n", '', $color[4], 'colspan="2"') . "\n") . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $event_month, $event_day, $event_year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($event_hour, $event_minute, 0, $event_month, $event_day, $event_year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Priority:"), 'right', $color[4]) . "\n" . html_tag('td', $event_priority, 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($event_title), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($event_text)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', "<form name=\"updateevent\" method=\"post\" action=\"{$calself}\">\n" . $tab . addHidden('year', $year) . $tab . addHidden('month', $month) . $tab . addHidden('day', $day) . $tab . addHidden('hour', $hour) . $tab . addHidden('minute', $minute) . $tab . addHidden('event_year', $event_year) . $tab . addHidden('event_month', $event_month) . $tab . addHidden('event_day', $event_day) . $tab . addHidden('event_hour', $event_hour) . $tab . addHidden('event_minute', $event_minute) . $tab . addHidden('event_priority', $event_priority) . $tab . addHidden('event_length', $event_length) . $tab . addHidden('event_title', $event_title) . $tab . addHidden('event_text', $event_text) . $tab . addHidden('updated', 'yes') . $tab . addHidden('confirmed', 'yes') . $tab . addSubmit(_("Yes")) . "</form>\n", 'right', $color[4]) . "\n" . html_tag('td', "<form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n" . $tab . addHidden('year', $year) . $tab . addHidden('month', $month) . $tab . addHidden('day', $day) . $tab . addSubmit(_("No")) . "</form>\n", 'left', $color[4]) . "\n"), '', $color[0], 'border="0" cellpadding="2" cellspacing="1"');
}
Exemple #22
0
/**
 * This function builds an array with all the information about
 * the options available to the user, and returns it. The options
 * are grouped by the groups in which they are displayed.
 * For each option, the following information is stored:
 * - name: the internal (variable) name
 * - caption: the description of the option in the UI
 * - type: one of SMOPT_TYPE_*
 * - refresh: one of SMOPT_REFRESH_*
 * - size: one of SMOPT_SIZE_*
 * - save: the name of a function to call when saving this option
 * @return array all option information
 */
function load_optpage_data_personal()
{
    global $data_dir, $username, $edit_identity, $edit_name, $edit_reply_to, $full_name, $reply_to, $email_address, $signature, $tzChangeAllowed, $timeZone, $domain;
    /* Set the values of some global variables. */
    $full_name = getPref($data_dir, $username, 'full_name');
    $reply_to = getPref($data_dir, $username, 'reply_to');
    $email_address = getPref($data_dir, $username, 'email_address', SMPREF_NONE);
    $signature = getSig($data_dir, $username, 'g');
    // set email_address to default value, if it is not set in user's preferences
    if ($email_address == SMPREF_NONE) {
        if (preg_match("/(.+)@(.+)/", $username)) {
            $email_address = $username;
        } else {
            $email_address = $username . '@' . $domain;
        }
    }
    /* Build a simple array into which we will build options. */
    $optgrps = array();
    $optvals = array();
    /******************************************************/
    /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
    /******************************************************/
    /*** Load the Contact Information Options into the array ***/
    $optgrps[SMOPT_GRP_CONTACT] = _("Name and Address Options");
    $optvals[SMOPT_GRP_CONTACT] = array();
    /* Build a simple array into which we will build options. */
    $optvals = array();
    if (!isset($edit_identity)) {
        $edit_identity = TRUE;
    }
    if ($edit_identity || $edit_name) {
        $optvals[SMOPT_GRP_CONTACT][] = array('name' => 'full_name', 'caption' => _("Full Name"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_HUGE);
    } else {
        $optvals[SMOPT_GRP_CONTACT][] = array('name' => 'full_name', 'caption' => _("Full Name"), 'type' => SMOPT_TYPE_COMMENT, 'refresh' => SMOPT_REFRESH_NONE, 'comment' => $full_name);
    }
    if ($edit_identity) {
        $optvals[SMOPT_GRP_CONTACT][] = array('name' => 'email_address', 'caption' => _("E-mail Address"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_HUGE);
    } else {
        $optvals[SMOPT_GRP_CONTACT][] = array('name' => 'email_address', 'caption' => _("E-mail Address"), 'type' => SMOPT_TYPE_COMMENT, 'refresh' => SMOPT_REFRESH_NONE, 'comment' => sm_encode_html_special_chars($email_address));
    }
    if ($edit_identity || $edit_reply_to) {
        $optvals[SMOPT_GRP_CONTACT][] = array('name' => 'reply_to', 'caption' => _("Reply To"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_HUGE);
    } else {
        //TODO: For many users, this is redundant to the email address above, especially if not editable -- so here instead of a comment, we could just hide it... in fact, that's what we'll do, but keep this code for posterity in case someone decides we shouldn't do this
        /*
                $optvals[SMOPT_GRP_CONTACT][] = array(
                    'name'    => 'reply_to',
                    'caption' => _("Reply To"),
                    'type'    => SMOPT_TYPE_COMMENT,
                    'refresh' => SMOPT_REFRESH_NONE,
                    'comment' => sm_encode_html_special_chars($reply_to),
                );
        */
    }
    $optvals[SMOPT_GRP_CONTACT][] = array('name' => 'signature', 'caption' => _("Signature"), 'type' => SMOPT_TYPE_TEXTAREA, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_MEDIUM, 'save' => 'save_option_signature');
    if ($edit_identity) {
        $identities_link_value = '<a href="options_identities.php">' . _("Edit Advanced Identities") . '</a> ' . _("(discards changes made on this form so far)");
        $optvals[SMOPT_GRP_CONTACT][] = array('name' => 'identities_link', 'caption' => _("Multiple Identities"), 'type' => SMOPT_TYPE_COMMENT, 'refresh' => SMOPT_REFRESH_NONE, 'comment' => $identities_link_value);
    }
    if ($tzChangeAllowed || function_exists('date_default_timezone_set')) {
        $TZ_ARRAY[SMPREF_NONE] = _("Same as server");
        $aTimeZones = sq_get_tz_array();
        unset($message);
        if (!empty($aTimeZones)) {
            // check if current timezone is linked to other TZ and update it
            if ($timeZone != SMPREF_NONE && $timeZone != "" && isset($aTimeZones[$timeZone]['LINK'])) {
                $timeZone = $aTimeZones[$timeZone]['LINK'];
                // TODO: recheck setting of $timeZone
                // setPref($data_dir,$username,'timezone',$timeZone);
            }
            // sort time zones by name. sq_get_tz_array() returns sorted by key.
            // asort($aTimeZones);
            // add all 'TZ' entries to TZ_ARRAY
            foreach ($aTimeZones as $TzKey => $TzData) {
                if (!isset($TzData['LINK'])) {
                    // Old display format
                    $TZ_ARRAY[$TzKey] = $TzKey;
                    // US Eastern standard time (America/New_York) - needs asort($aTimeZones)
                    //$TZ_ARRAY[$TzKey] = (isset($TzData['NAME']) ? $TzData['NAME']." ($TzKey)" : "($TzKey)");
                    // US Eastern standard time if NAME is present or America/New_York if NAME not present
                    // needs sorting after all data is added or uasort()
                    //$TZ_ARRAY[$TzKey] = (isset($TzData['NAME']) ? $TzData['NAME'] : $TzKey);
                    // (America/New_Your) US Eastern standard time
                    //$TZ_ARRAY[$TzKey] = "($TzKey)" . (isset($TzData['NAME']) ? ' '.$TzData['NAME'] : '');
                }
            }
        } else {
            $message = _("Error opening timezone config, contact administrator.");
        }
        // TODO: make error user friendly
        if (isset($message)) {
            plain_error_message($message);
            exit;
        }
        $optgrps[SMOPT_GRP_TZ] = _("Timezone Options");
        $optvals[SMOPT_GRP_TZ] = array();
        $optvals[SMOPT_GRP_TZ][] = array('name' => 'timezone', 'caption' => _("Your current timezone"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, 'posvals' => $TZ_ARRAY);
    }
    /*** Load the Reply Citation Options into the array ***/
    $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options");
    $optvals[SMOPT_GRP_REPLY] = array();
    $optvals[SMOPT_GRP_REPLY][] = array('name' => 'reply_citation_style', 'caption' => _("Reply Citation Style"), 'type' => SMOPT_TYPE_STRLIST, 'refresh' => SMOPT_REFRESH_NONE, 'posvals' => array(SMPREF_NONE => _("No Citation"), 'author_said' => _("AUTHOR Wrote"), 'date_time_author' => _("On DATE, AUTHOR Wrote"), 'quote_who' => _("Quote Who XML"), 'user-defined' => _("User-Defined")));
    $optvals[SMOPT_GRP_REPLY][] = array('name' => 'reply_citation_start', 'caption' => _("User-Defined Citation Start"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_MEDIUM);
    $optvals[SMOPT_GRP_REPLY][] = array('name' => 'reply_citation_end', 'caption' => _("User-Defined Citation End"), 'type' => SMOPT_TYPE_STRING, 'refresh' => SMOPT_REFRESH_NONE, 'size' => SMOPT_SIZE_MEDIUM);
    /*** Load the Signature Options into the array ***/
    $optgrps[SMOPT_GRP_SIG] = _("Signature Options");
    $optvals[SMOPT_GRP_SIG] = array();
    $optvals[SMOPT_GRP_SIG][] = array('name' => 'use_signature', 'caption' => _("Use Signature"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE);
    $optvals[SMOPT_GRP_SIG][] = array('name' => 'prefix_sig', 'caption' => _("Prefix Signature with '-- ' Line"), 'type' => SMOPT_TYPE_BOOLEAN, 'refresh' => SMOPT_REFRESH_NONE);
    /* Assemble all this together and return it as our result. */
    $result = array('grps' => $optgrps, 'vals' => $optvals);
    return $result;
}
            $message_highlight_list[] = array('name' => $identname, 'color' => $newcolor, 'value' => $value, 'match_type' => $match_type);
        }
        setPref($data_dir, $username, 'hililist', serialize($message_highlight_list));
    }
}
displayPageHeader($color);
/**
 * Display the current rule list
 */
$rules = array();
foreach ($message_highlight_list as $index => $rule) {
    $a = array();
    $a['Name'] = sm_encode_html_special_chars($rule['name']);
    $a['Color'] = $rule['color'];
    $a['MatchField'] = '';
    $a['MatchValue'] = sm_encode_html_special_chars($rule['value']);
    switch ($rule['match_type']) {
        case 'from':
            $a['MatchField'] = _("From");
            break;
        case 'to':
            $a['MatchField'] = _("To");
            break;
        case 'cc':
            $a['MatchField'] = _("Cc");
            break;
        case 'to_cc':
            $a['MatchField'] = _("To or Cc");
            break;
        case 'subject':
            $a['MatchField'] = _("subject");
Exemple #24
0
/**
 * Sanitize a value using sm_encode_html_special_chars() or similar, but also
 * recursively run sm_encode_html_special_chars() (or similar) on array keys
 * and values.
 *
 * If $value is not a string or an array with strings in it,
 * the value is returned as is.
 *
 * @param mixed $value       The value to be sanitized.
 * @param mixed $quote_style Either boolean or an integer.  If it
 *                           is an integer, it must be the PHP
 *                           constant indicating if/how to escape
 *                           quotes: ENT_QUOTES, ENT_COMPAT, or
 *                           ENT_NOQUOTES.  If it is a boolean value,
 *                           it must be TRUE and thus indicates
 *                           that the only sanitizing to be done
 *                           herein is to replace single and double
 *                           quotes with &#039; and &quot;, no other
 *                           changes are made to $value.  If it is
 *                           boolean and FALSE, behavior reverts
 *                           to same as if the value was ENT_QUOTES
 *                           (OPTIONAL; default is ENT_QUOTES).
 *
 * @return mixed The sanitized value.
 *
 * @since 1.5.2
 *
 **/
function sq_htmlspecialchars($value, $quote_style = ENT_QUOTES)
{
    if ($quote_style === FALSE) {
        $quote_style = ENT_QUOTES;
    }
    // array?  go recursive...
    //
    if (is_array($value)) {
        $return_array = array();
        foreach ($value as $key => $val) {
            $return_array[sq_htmlspecialchars($key, $quote_style)] = sq_htmlspecialchars($val, $quote_style);
        }
        return $return_array;
        // sanitize strings only
        //
    } else {
        if (is_string($value)) {
            if ($quote_style === TRUE) {
                return str_replace(array('\'', '"'), array('&#039;', '&quot;'), $value);
            } else {
                return sm_encode_html_special_chars($value, $quote_style);
            }
        }
    }
    // anything else gets returned with no changes
    //
    return $value;
}
Exemple #25
0
<br />
<table align="center" cellpadding="2" cellspacing="2" border="0">
<tr><td bgcolor="<?php 
echo $color[0];
?>
">
   <div style="text-align: center;"><b><?php 
echo _("Change Password");
?>
</b></div>
</td><?php 
if (isset($Messages) && count($Messages) > 0) {
    echo "<tr><td>\n";
    foreach ($Messages as $line) {
        echo sm_encode_html_special_chars($line) . "<br />\n";
    }
    echo "</td></tr>\n";
}
?>
<tr><td>
    <?php 
echo addForm($_SERVER['PHP_SELF'], 'post');
?>
    <input type="hidden" name="smtoken" value="<?php 
echo sm_generate_security_token();
?>
" />
    <table>
      <tr>
        <th align="right"><?php 
/**
 * Creates html formated table row with textarea field
 * @param string $title Name displayed next to textarea field
 * @param string $name Name of textarea field
 * @param string $data Default value of textarea field  (data is sanitized with sm_encode_html_special_chars)
 * @param string $bgcolor html attributes added to row element (tr)
 * @return string html formated table row with textarea
 * @since 1.2.5 (arguments differ since 1.4.5/1.5.1)
 * @todo check right-to-left language issues
 * @access private
 */
function sti_textarea($title, $name, $data, $bgcolor)
{
    //FIXME: NO HTML IN THE CORE
    $str = '';
    $str .= '<tr' . $bgcolor . ">\n";
    $str .= '  <td style="white-space: nowrap;text-align:right;">' . $title . ' </td>' . "\n";
    $str .= '  <td> <textarea name="' . $name . '" cols="50" rows="5">' . sm_encode_html_special_chars($data) . '</textarea> </td>' . "\n";
    $str .= '</tr>';
    return $str;
}
Exemple #27
0
            for ($i = 0; $i < $mailfetch_server_number; $i++) {
                echo "<option value=\"{$i}\">" . sm_encode_html_special_chars($mailfetch_alias_[$i] == '' ? $mailfetch_server_[$i] : $mailfetch_alias_[$i]) . "</option>";
            }
            echo '</select>' . '&nbsp;&nbsp;<input type="submit" name="mf_action_mod" value="' . _("Modify") . '" />' . '&nbsp;&nbsp;<input type="submit" name="mf_action_del" value="' . _("Delete") . '" />' . '</form>';
        } else {
            echo _("No servers known.");
        }
        echo '</td></tr></table>';
        break;
    case 'Delete':
        //erase confirmation about a server
        echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Confirm Deletion of a Server") . '</b>', 'center', $color[9])) . html_tag('tr', html_tag('td', "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_delete" />' . '<br />' . _("Selected Server:") . " <b>" . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . "</b><br />" . _("Confirm delete of selected server?") . '<br /><br />' . '<input type="submit" name="submit_mailfetch" value="' . _("Confirm Delete") . '" />' . '<br /></form>', 'center', $color[9])), 'center', '', 'width="70%" cellpadding="5" cellspacing="1"');
        break;
        //modify a server
    //modify a server
    case 'Modify':
        echo html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%" cellpadding="5" cellspacing="1"') . '<br />' . html_tag('table', '', 'center', '', 'width="70%" cellpadding="5" cellspacing="1"') . html_tag('tr', html_tag('td', '<b>' . _("Modify Server") . '</b>', 'center', $color[9])) . html_tag('tr') . html_tag('td', '', 'center', $color[0]) . "<input type=\"hidden\" name=\"mf_sn\" value=\"{$mf_sn}\" />" . '<input type="hidden" name="mf_action" value="confirm_modify" />' . html_tag('table') . html_tag('tr', html_tag('th', _("Server:"), 'right') . html_tag('td', '<input type="text" name="mf_server" value="' . sm_encode_html_special_chars($mailfetch_server_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Port:"), 'right') . html_tag('td', '<input type="text" name="mf_port" value="' . sm_encode_html_special_chars($mailfetch_port_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Alias:"), 'right') . html_tag('td', '<input type="text" name="mf_alias" value="' . sm_encode_html_special_chars($mailfetch_alias_[$mf_sn]) . '" size="40" />', 'left')) . html_tag('tr', html_tag('th', _("Username:"******"text" name="mf_user" value="' . sm_encode_html_special_chars($mailfetch_user_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Password:"******"password" name="mf_pass" value="' . sm_encode_html_special_chars($mailfetch_pass_[$mf_sn]) . '" size="20" />', 'left')) . html_tag('tr', html_tag('th', _("Authentication type:"), 'right') . html_tag('td', addSelect('mf_auth', array(MAIL_FETCH_AUTH_USER => _("USER"), MAIL_FETCH_AUTH_APOP => _("APOP"), MAIL_FETCH_AUTH_RFC1939 => _("APOP or USER")), $mailfetch_auth_[$mf_sn], true), 'left')) . html_tag('tr', html_tag('th', _("Connection type:"), 'right') . html_tag('td', addSelect('mf_type', array(MAIL_FETCH_USE_PLAIN => _("Plain text"), MAIL_FETCH_USE_TLS => _("Use TLS"), MAIL_FETCH_USE_STLS => _("Use StartTLS")), $mailfetch_type_[$mf_sn], true), 'left')) . html_tag('tr') . html_tag('th', _("Store in Folder:"), 'right') . html_tag('td', '', 'left');
        $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
        $boxes = sqimap_mailbox_list($imapConnection);
        echo '<select name="mf_subfolder">';
        $selected = 0;
        if (isset($mailfetch_subfolder_[$mf_sn])) {
            $selected = array(strtolower($mailfetch_subfolder_[$mf_sn]));
        }
        echo sqimap_mailbox_option_list($imapConnection, $selected) . '</select></td></tr>' . html_tag('tr', html_tag('th', '&nbsp;', 'right') . html_tag('td', '<input type="checkbox" name="mf_lmos" ' . ($mailfetch_lmos_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Leave Mail on Server"), 'left')) . html_tag('tr', html_tag('th', '&nbsp;', 'right') . html_tag('td', '<input type="checkbox" name="mf_login" ' . ($mailfetch_login_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at login"), 'left')) . html_tag('tr', html_tag('th', '&nbsp;', 'right') . html_tag('td', '<input type="checkbox" name="mf_fref" ' . ($mailfetch_fref_[$mf_sn] == 'on' ? 'checked="checked"' : '') . ' />' . _("Check mail at folder refresh"), 'left')) . html_tag('tr', html_tag('td', '<input type="submit" name="submit_mailfetch" value="' . _("Modify Server") . '" />', 'center', '', 'colspan="2"')) . '</table></form></td></tr></table>';
        break;
    default:
        //unsupported action
        echo '</form>' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Fetching Servers") . '</b>', 'center', $color[0])), 'center', '', 'width="95%"') . '<br />' . html_tag('table', html_tag('tr', html_tag('td', '<b>' . _("Undefined Function") . '</b>', 'center', $color[9]) . html_tag('td', '<b>' . _("The function you requested is unknown.") . '</b>', 'center', $color[0])), 'center', '', 'width="70%"');
}
$oTemplate->display('footer.tpl');
if (!isset($month) || $month <= 0) {
    $month = date('m');
}
if (!isset($year) || $year <= 0) {
    $year = date('Y');
}
if (!isset($day) || $day <= 0) {
    $day = date('d');
}
if (!isset($hour) || $hour <= 0) {
    $hour = '08';
}
$calself = basename($PHP_SELF);
displayPageHeader($color);
//load calendar menu
calendar_header();
echo html_tag('tr', '', '', $color[0]) . html_tag('td', '', 'left') . html_tag('table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"') . html_tag('tr', html_tag('td', date_intl(_("l, F j Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', '', 'colspan="2"'));
//if form has not been filled in
if (!isset($event_text)) {
    show_event_form();
} else {
    readcalendardata();
    $calendardata["{$month}{$day}{$year}"]["{$event_hour}{$event_minute}"] = array('length' => $event_length, 'priority' => $event_priority, 'title' => $event_title, 'message' => $event_text, 'reminder' => '');
    //save
    writecalendardata();
    echo html_tag('table', html_tag('tr', html_tag('th', _("Event Has been added!") . "<br />\n", '', $color[4], 'colspan="2"')) . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . "\n" . html_tag('td', date_intl(_("H:i"), mktime($event_hour, $event_minute, 0, $month, $day, $year)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . "\n" . html_tag('td', sm_encode_html_special_chars($event_title, ENT_NOQUOTES), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . "\n" . html_tag('td', nl2br(sm_encode_html_special_chars($event_text, ENT_NOQUOTES)), 'left', $color[4]) . "\n") . html_tag('tr', html_tag('td', "<a href=\"day.php?year={$year}&amp;month={$month}&amp;day={$day}\">" . _("Day View") . "</a>\n", 'left', $color[4], 'colspan="2"') . "\n"), '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"') . "\n";
}
?>
</table></td></tr></table>
</body></html>
Exemple #29
0
/**
 * Return a string representing the priority of a message
 */
function priorityStr($p)
{
    return sm_encode_html_special_chars(getPriorityStr($p));
}
Exemple #30
0
// in case not defined in config
$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options);
$caps_array = get_caps($imap_stream);
$list = array('TEST_0', 'TEST_1', 'TEST_2', 'TEST_3', 'TEST_4', 'TEST_5', 'TEST_6', 'TEST_7', 'TEST_8', 'TEST_9');
echo '<br /><div style="text-align: center;"><b>' . _("IMAP server information") . "</b></div><br />\n" . '<table bgcolor="' . $color[3] . '" width="100%" align="center" border="1" cellpadding="2">' . '<tr><td bgcolor="' . $color[3] . "\"><br />\n" . '<table width="95%" align="center" border="1" bgcolor="' . $color[3] . "\">\n" . '<tr><td bgcolor="' . $color[4] . '"><b>' . _("Server Capability response:") . "</b><br />\n";
foreach ($caps_array[0] as $value) {
    echo sm_encode_html_special_chars($value);
}
echo "</td></tr><tr><td>\n";
if (!isset($submit) || $submit == 'default') {
    echo '<br /><p><small><font color="' . $color[6] . '">' . _("Select the IMAP commands you would like to run. Most commands require a selected mailbox so the select command is already setup. You can clear all the commands and test your own IMAP command strings. The commands are executed in order. The default values are simple IMAP commands using your default_charset and folder_prefix from SquirrelMail when needed.") . "</font></small></p>\n" . '<p align="center"><small><b>' . _("NOTE: These commands are live, any changes made will effect your current email account.") . "</b></small></p><br />\n";
    if (!isset($submit)) {
        $submit = '';
    }
} else {
    echo 'folder_prefix = ' . sm_encode_html_special_chars($folder_prefix) . "<br />\n" . 'default_charset = ' . sm_encode_html_special_chars($default_charset) . "\n";
}
echo "<br /></td></tr></table><br />\n";
if ($submit == 'submit') {
    $type = array();
    for ($i = 0; $i < count($list); $i++) {
        $type[$list[$i]] = ${$list}[$i];
    }
} elseif ($submit == 'clear') {
    for ($i = 0; $i < count($list); $i++) {
        $type[$list[$i]] = '';
    }
} elseif (!$submit || $submit == 'default') {
    $type = array('TEST_0' => "SELECT {$mailbox}", 'TEST_1' => "STATUS {$mailbox} (MESSAGES RECENT)", 'TEST_2' => "EXAMINE {$mailbox}", 'TEST_3' => "SEARCH CHARSET \"{$default_charset}\" ALL *", 'TEST_4' => "THREAD REFERENCES {$default_charset} ALL", 'TEST_5' => "SORT (DATE) {$default_charset} ALL", 'TEST_6' => "FETCH 1:* (FLAGS BODY[HEADER.FIELDS (FROM DATE TO)])", 'TEST_7' => "LSUB \"{$folder_prefix}\" \"*%\"", 'TEST_8' => "LIST \"{$folder_prefix}\" \"*\"", 'TEST_9' => "");
}
echo "<form action=\"options.php\" method=\"post\">\n" . "<table border=\"1\" align=\"center\">\n" . '<tr><th>' . _("Select") . '</th><th>' . _("Test Name") . '</th><th>' . _("IMAP command string") . "</th></tr>\n" . '<tr><td>';