Esempio n. 1
0
/**
 * This function removes or rebuilds HTML tags (depending the need).
 * If $verse is "true" (default) HTML tags are restored
 * If $verse is "false" HTML tags are converted from "<" and ">" to "[" and "]"
 * It returns false if it fail gather folder caption
 * NOTE: This function returns a string
 */
function clean_folder_caption($dir, $verse = true)
{
    if (!($xml_caption = get_folder_caption($dir))) {
        return false;
    }
    if ($verse) {
        $xml_caption = str_replace('"', '\'', $xml_caption);
        $xml_caption = str_replace('[', '<', $xml_caption);
        $xml_caption = str_replace(']', '>', $xml_caption);
    } else {
        $xml_caption = str_replace('"', '\'', $xml_caption);
        $xml_caption = str_replace('<', '[', $xml_caption);
        $xml_caption = str_replace('>', ']', $xml_caption);
    }
    return utf8_decode($xml_caption);
}
Esempio n. 2
0
function describe_folder($mbox, $server, $folder)
{
    $mboxinf = imap_status($mbox, $server . $folder, SA_ALL);
    $msg_total = $mboxinf->messages;
    $msg_unread = $mboxinf->unseen;
    return sprintf("{'type': 'mbox', 'caption': '%s', 'name': '%s', 'total': %d, 'unread': %d},\n", get_folder_caption($folder), $folder, $msg_total, $msg_unread);
}