Example #1
0
        if ($attachment = $page->getAttachments()) {
            do {
                $writer->write('<attachment' . ' mime="' . htmlspecialchars($attachment->mime) . '"' . ' size="' . $attachment->size . '"' . ' width="' . $attachment->width . '"' . ' height="' . $attachment->height . '"' . '>' . '<name>' . htmlspecialchars($attachment->name) . '</name>' . '<label>' . htmlspecialchars($attachment->label) . '</label>' . '<enclosure>' . ($attachment->enclosure ? 1 : 0) . '</enclosure>' . '<attached>' . $attachment->attached . '</attached>' . '<downloads>' . $attachment->downloads . '</downloads>');
                if ($includeFileContents && file_exists(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$attachment->name}")) {
                    $writer->write('<content>');
                    Base64Stream::encode(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$attachment->name}", $writer);
                    $writer->write('</content>');
                }
                $writer->write('</attachment>');
                $writer->write(CRLF);
            } while ($attachment->shift());
            $attachment->close();
        }
        $writer->write('</page>');
        $writer->write(CRLF);
    } while ($page->shift());
    $page->close();
}
$notice = new Notice();
if ($notice->open()) {
    do {
        $writer->write('<notice' . ' slogan="' . htmlspecialchars($notice->slogan) . '"' . $newlineStyle . '>' . '<id>' . $notice->id . '</id>' . '<visibility>' . $notice->visibility . '</visibility>' . '<starred>' . $notice->starred . '</starred>' . '<title>' . htmlspecialchars(Utils_Unicode::correct($notice->title)) . '</title>' . '<content formatter="' . htmlspecialchars($notice->contentformatter) . '" editor="' . htmlspecialchars($notice->contenteditor) . '">' . htmlspecialchars(Utils_Unicode::correct($notice->content)) . '</content>' . '<published>' . $notice->published . '</published>' . '<created>' . $notice->created . '</created>' . '<modified>' . $notice->modified . '</modified>');
        $writer->write(CRLF);
        if ($attachment = $notice->getAttachments()) {
            do {
                $writer->write('<attachment' . ' mime="' . htmlspecialchars($attachment->mime) . '"' . ' size="' . $attachment->size . '"' . ' width="' . $attachment->width . '"' . ' height="' . $attachment->height . '"' . '>' . '<name>' . htmlspecialchars($attachment->name) . '</name>' . '<label>' . htmlspecialchars($attachment->label) . '</label>' . '<enclosure>' . ($attachment->enclosure ? 1 : 0) . '</enclosure>' . '<attached>' . $attachment->attached . '</attached>' . '<downloads>' . $attachment->downloads . '</downloads>');
                if ($includeFileContents && file_exists(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$attachment->name}")) {
                    $writer->write('<content>');
                    Base64Stream::encode(__TEXTCUBE_ATTACH_DIR__ . "/{$blogid}/{$attachment->name}", $writer);
                    $writer->write('</content>');
                }