示例#1
0
文件: select.php 项目: rair/yacs
}
// an anchor is mandatory
if (!is_object($anchor)) {
    Logger::error(i18n::s('No anchor has been found.'));
} elseif (!$permitted) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // list all watchers
} elseif ($permitted == 'watchers') {
    // page title
    $context['page_title'] = sprintf(i18n::s('Watchers of %s'), $anchor->get_title());
    // watchers of a page
    if (!strncmp($anchor->get_reference(), 'article:', 8)) {
        $users = Articles::list_watchers_by_name($anchor->item, 0, 5 * USERS_LIST_SIZE, 'raw');
    } elseif (!strncmp($anchor->get_reference(), 'section:', 8)) {
        $users = Sections::list_watchers_by_name($anchor->item, 0, 5 * USERS_LIST_SIZE, 'raw');
    } else {
        $anchors = array($anchor->get_reference());
        $handle = $anchor->get_parent();
        while ($handle && ($parent = Anchors::get($handle))) {
            $anchors[] = $handle;
            $handle = $parent->get_parent();
        }
        // authorized users
        $restricted = NULL;
        if ($anchor->is_hidden() && ($editors =& Members::list_anchors_for_member($anchors))) {
            foreach ($editors as $editor) {
                if (strpos($editor, 'user:'******'user:'));
                }
            }
示例#2
0
文件: mail.php 项目: rair/yacs
            $actual_names[] = htmlspecialchars($recipient);
        }
    }
    Mailer::close();
    // display the list of actual recipients
    if ($actual_names) {
        $context['text'] .= '<div>' . sprintf(i18n::s('Your message is being transmitted to %s'), Skin::finalize_list($actual_names, 'compact')) . '</div>';
    } else {
        $context['text'] .= '<p>' . i18n::s('No message has been sent') . '</p>';
    }
    // back to the section page
    $menu = array();
    $menu[] = Skin::build_link(Sections::get_permalink($item), i18n::s('Done'), 'button');
    $context['text'] .= Skin::finalize_list($menu, 'assistant_bar');
    // recipients are watchers of this section (including parent sections)
} elseif (!($recipients = Sections::list_watchers_by_name($item, 0, 1000, 'mail'))) {
    Logger::error(i18n::s('No recipient has been found.'));
    // display the form
} else {
    // the form to send a message
    $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" onsubmit="return validateDocumentPost(this)" id="main_form"><div>';
    // build a nice list of recipients
    $label = i18n::s('Message recipients');
    $input = Skin::build_box(i18n::s('Select recipients'), $recipients, 'folded');
    $fields[] = array($label, $input);
    // the subject
    $label = i18n::s('Message title');
    $title = sprintf(i18n::c('Notification: %s'), $item['title']);
    $input = '<input type="text" name="subject" id="subject" size="70" value="' . encode_field($title) . '" />';
    $fields[] = array($label, $input);
    // default message content