Example #1
0
    $channel = $GLOBALS['injector']->getInstance('Jonah_Driver')->getChannel($channel_id);
    if (empty($channel['channel_story_url'])) {
        $story_url = Horde::url('stories/view.php', true)->add(array('channel_id' => '%c', 'id' => '%s'));
    } else {
        $story_url = $channel['channel_story_url'];
    }
    $story_url = str_replace(array('%25c', '%25s'), array('%c', '%s'), $story_url);
    $story_url = str_replace(array('%c', '%s', '&'), array($channel_id, $story['id'], '&'), $story_url);
    if ($info['include'] == 0) {
        require_once 'Horde/MIME/Part.php';
        /* TODO: Create a "URL link" MIME part instead. */
        $message_part = new MIME_Part('text/plain');
        $message_part->setContents($message_part->replaceEOL($story_url));
        $message_part->setDescription(_("Story Link"));
    } else {
        $message_part = Jonah::getStoryAsMessage($story);
    }
    $result = _mail($message_part, $info['from'], $info['recipients'], $info['subject'], $info['message']);
    if (is_a($result, 'PEAR_Error')) {
        $notification->push(sprintf(_("Unable to send story: %s"), $result->getMessage()), 'horde.error');
    } else {
        $notification->push(_("The story was sent successfully."), 'horde.success');
        header('Location: ' . $story_url);
        exit;
    }
}
$page_output->topbar = $page_output->sidebar = false;
$page_output->header(array('title' => $title));
$notification->notify(array('listeners' => 'status'));
$form->renderActive(null, $vars, Horde::url('stories/share.php'), 'post');
$page_output->footer();