Exemple #1
0
function top_users_init(&$api)
{
    $api->register_action('top_posters', 'top_users_on_show');
    $url = new FreechURL('', _('Top Users'));
    $url->set_var('action', 'top_posters');
    $api->links('forum')->add_link($url);
}
Exemple #2
0
function message_on_run(&$api)
{
    $forum_id = $api->forum() ? $api->forum()->get_id() : NULL;
    // go away in the absence of write permission
    if (!$api->group()->may('write')) {
        return;
    }
    // 'panic' switch in config file was set
    if (cfg('set_read_only')) {
        $api->group()->permissions['write'] = FALSE;
        $api->unregister_action('write');
        $api->unregister_action('respond');
        $api->unregister_action('edit');
        return;
    }
    // permission to write on read only forums?
    // moderator actions are still permitted
    if (isset($forum_id) && $api->forum()->is_readonly() && !$api->group()->may('write_ro')) {
        $api->group()->permissions['write'] = FALSE;
        $api->unregister_action('write');
        $api->unregister_action('respond');
        $api->unregister_action('edit');
        return;
    }
    // Add 'new message' button to the index bar.
    $url = new FreechURL('', _('Start a New Topic'));
    $url->set_var('forum_id', $forum_id);
    $url->set_var('action', 'write');
    $api->links('page')->add_link($url, 200);
}
Exemple #3
0
function poll_on_run(&$api)
{
    $forum_id = $api->forum() ? $api->forum()->get_id() : NULL;
    // go away in the absence of write permission
    if (!$api->group()->may('write')) {
        return;
    }
    // 'panic' switch in config file was set
    if (cfg('set_read_only')) {
        $api->group()->permissions['write'] = FALSE;
        $api->unregister_action('poll_add');
        $api->unregister_action('poll_on_submit');
        $api->unregister_action('poll_vote');
        return;
    }
    // permission to add a poll on read only forums
    // actions 'poll_vote' and 'poll_on_submit' are still permitted
    if (isset($forum_id) && $api->forum()->is_readonly() && !$api->group()->may('write_ro')) {
        $api->unregister_action('poll_add');
        return;
    }
    // Add a link to the poll button in the index bar.
    $url = new FreechURL('', _('Start a Poll'));
    $url->set_var('forum_id', $forum_id);
    $url->set_var('action', 'poll_add');
    $api->links('page')->add_link($url, 400);
}
Exemple #4
0
 function IndexBarByThread(&$_args)
 {
     $this->Menu();
     // Prints the index (pagination).
     $url = new FreechURL();
     $url->set_var('forum_id', $_args['forum_id']);
     $this->add_index($url, $_args['n_threads'], $_args['n_threads_per_page'], $_args['n_pages_per_index'], $_args['n_offset']);
     // Prepare thread state links.
     $fold = $_args['thread_state']->get_default();
     $swap = $_args['thread_state']->get_string_swap();
     $url->set_var('hs', $_args['n_offset']);
     $url->set_var('refer_to', $_SERVER['REQUEST_URI']);
     // "Unfold all" link.
     $this->add_separator();
     if ($fold != THREAD_STATE_UNFOLDED || $swap != '') {
         $url = clone $url;
         $url->set_var('fold', THREAD_STATE_UNFOLDED);
         $url->set_label(_('Unfold All'));
         $this->add_link($url);
     } else {
         $this->add_text(_('Unfold All'));
     }
     // "Fold all" link.
     $this->add_separator();
     if ($fold != THREAD_STATE_FOLDED || $swap != '') {
         $url = clone $url;
         $url->set_var('fold', THREAD_STATE_FOLDED);
         $url->set_label(_('Fold All'));
         $this->add_link($url);
     } else {
         $this->add_text(_('Fold All'));
     }
 }
Exemple #5
0
function statistics_init(&$api)
{
    $api->register_action('statistics', 'statistics_on_show');
    $url = new FreechURL('', _('Statistics'));
    $url->set_var('action', 'statistics');
    $api->links('forum')->add_link($url);
}
Exemple #6
0
 function IndexBarBBView(&$_args)
 {
     $this->Menu();
     // Prints the index (pagination).
     $url = new FreechURL();
     $url->set_var('forum_id', $_args['forum_id']);
     $this->add_index($url, $_args['n_threads'], $_args['n_threads_per_page'], $_args['n_pages_per_index'], $_args['n_offset']);
 }
 function show_password_forgotten(&$_user)
 {
     $url = new FreechURL();
     $url->set_var('action', 'password_mail_submit');
     $this->clear_all_assign();
     $this->assign_by_ref('user', $_user);
     $this->assign('action', $url->get_string());
     $this->render_php('password_forgotten.php.tmpl');
 }
 function IndexBarGroupProfile($_args)
 {
     $this->Menu();
     // Prints the index (pagination).
     $url = new FreechURL();
     $url->set_var('action', 'group_profile');
     $url->set_var('groupname', $_args[group]->get_name());
     $this->add_index($url, $_args[n_users], $_args[n_users_per_page], $_args[n_pages_per_index], $_args[n_offset]);
 }
 function IndexBarSearchResult(&$_args)
 {
     $this->Menu();
     // Prints the index (pagination).
     $url = new FreechURL();
     $url->set_var('action', 'search');
     $url->set_var('q', $_args[query]);
     $url->set_var('forum_id', $_args[forum_id]);
     $this->add_index($url, $_args[n_postings], $_args[n_postings_per_page], $_args[n_pages_per_index], $_args[n_offset]);
 }
 function show(&$_forum = NULL)
 {
     $url = new FreechURL();
     $url->set_var('action', 'forum_submit');
     // Render the template.
     $this->clear_all_assign();
     $this->assign('action', $url->get_string());
     $this->assign_by_ref('forum', $_forum);
     $this->assign('status_list', $_forum->get_status_names());
     $this->render_php('forum_editor.php.tmpl');
 }
 function get_poll(&$_poll)
 {
     $url = new FreechURL();
     $url->set_var('action', 'poll_vote');
     $url->set_var('forum_id', $_poll->get_forum_id());
     $result_url = $_poll->get_url();
     $result_url->set_var('result', 1);
     $this->clear_all_assign();
     $this->assign('action', $url->get_string());
     $this->assign('result_url', $result_url->get_string());
     $this->assign_by_ref('poll', $_poll);
     $result = $this->fetch_php(dirname(__FILE__) . '/poll.php.tmpl');
     return $result;
 }
 function show(&$_user)
 {
     $url = new FreechURL();
     $url->set_var('action', 'account_create');
     $this->clear_all_assign();
     $this->assign('onsubmit_js', $this->api->get_js('onsubmit'));
     $this->assign('form_html', $this->api->get_html('form'));
     $this->assign('action', $url->get_string());
     $this->assign_by_ref('user', $_user);
     $this->assign_by_ref('password', $_POST['password']);
     $this->assign_by_ref('password2', $_POST['password2']);
     $this->render_php(dirname(__FILE__) . '/registration.php.tmpl');
     $this->api->set_title(_('User Registration'));
 }
 function show_preview(&$_message, $_parent_id, $_may_quote)
 {
     $url = new FreechURL();
     $url->set_var('forum_id', $this->api->forum()->get_id());
     $url->set_var('parent_id', $_parent_id);
     $this->clear_all_assign();
     $this->assign('parent_id', (int) $_parent_id);
     $this->assign('onsubmit_js', $this->api->get_js('onsubmit'));
     $this->assign('form_html', $this->api->get_html('form'));
     $this->assign('may_quote', $_may_quote);
     $this->assign('pagetitle', _('Preview'));
     $this->assign('action', $url->get_string());
     $this->assign_by_ref('message', $_message);
     $this->render_php(dirname(__FILE__) . '/preview.php.tmpl');
     $this->api->set_title($_message->get_subject());
 }
 function ThreadViewIndexBarReadPosting(&$_posting, $_prev_posting_id, $_next_posting_id, $_prev_thread_id, $_next_thread_id)
 {
     $this->Menu();
     if (!$_posting) {
         $this->add_separator();
         return;
     }
     $url = new FreechURL();
     $url->set_var('action', 'read');
     $url->set_var('msg_id', 1);
     $url->set_var('forum_id', $_posting->get_forum_id());
     // "Previous/Next Posting" buttons.
     if ($_prev_posting_id) {
         $url->set_var('msg_id', $_prev_posting_id);
         $url->set_label('<<');
         $this->add_link($url);
     } else {
         $this->add_text('<<');
     }
     $this->add_text(_('Message'));
     if ($_next_posting_id) {
         $url = clone $url;
         $url->set_var('msg_id', $_next_posting_id);
         $url->set_label('>>');
         $this->add_link($url);
     } else {
         $this->add_text('>>');
     }
     // "Previous Thread" button.
     $this->add_separator();
     if (cfg('thread_arrow_reverse')) {
         $prev_id = $_next_thread_id;
     } else {
         $prev_id = $_prev_thread_id;
     }
     if ($prev_id) {
         $url = clone $url;
         $url->set_var('msg_id', $prev_id);
         $url->set_label('<<');
         $this->add_link($url);
     } else {
         $this->add_text('<<');
     }
     // "Next Thread" button.
     $this->add_text(_('Thread'));
     $url = clone $url;
     if (cfg('thread_arrow_reverse')) {
         $next_id = $_prev_thread_id;
     } else {
         $next_id = $_next_thread_id;
     }
     if ($next_id) {
         $url = clone $url;
         $url->set_var('msg_id', $next_id);
         $url->set_label('>>');
         $this->add_link($url);
     } else {
         $this->add_text('>>');
     }
 }
 function ListViewIndexBarReadPosting(&$_posting, $_prev_posting_id, $_next_posting_id)
 {
     $this->Menu();
     if (!$_posting) {
         $this->add_separator();
         return;
     }
     $url = new FreechURL();
     $url->set_var('action', 'read');
     $url->set_var('msg_id', 1);
     $url->set_var('forum_id', $_posting->get_forum_id());
     // "Previous/Next Posting" buttons.
     if ($_prev_posting_id) {
         $url->set_var('msg_id', $_prev_posting_id);
         $url->set_label('<<');
         $this->add_link($url);
     } else {
         $this->add_text('<<');
     }
     $this->add_text(_('Message'));
     if ($_next_posting_id) {
         $url = clone $url;
         $url->set_var('msg_id', $_next_posting_id);
         $url->set_label('>>');
         $this->add_link($url);
     } else {
         $this->add_text('>>');
     }
 }
 function show_thread_move(&$_posting)
 {
     $url = new FreechURL();
     $url->set_var('action', 'thread_move_submit');
     $url->set_var('msg_id', $_posting->get_id());
     $forums = $this->forumdb->get_forums(FORUM_STATUS_ACTIVE);
     $forum_map = array();
     foreach ($forums as $forum) {
         if ($forum->get_id() != $_posting->get_forum_id()) {
             $forum_map[$forum->get_id()] = $forum->get_name();
         }
     }
     ksort($forum_map);
     $this->clear_all_assign();
     $this->assign('action', $url->get_string());
     $this->assign_by_ref('posting', $_posting);
     $this->assign_by_ref('forums', $forum_map);
     $this->render_php('thread_move.php.tmpl');
 }
Exemple #17
0
function search_on_search_result(&$api)
{
    if (!$_GET['q'] || trim($_GET['q']) == '') {
        return search_on_search_form($api);
    }
    $forum_id = $api->forum() ? $api->forum()->get_id() : NULL;
    $url = new FreechURL('', _('Find'));
    $url->set_var('action', 'search');
    $url->set_var('forum_id', $forum_id);
    $api->breadcrumbs()->add_link($url);
    $api->breadcrumbs()->add_text($_GET['q']);
    // Search for postings or users.
    $controller = new SearchController($api);
    if ($_GET['user_search']) {
        $controller->show_users($_GET['q'], $_GET['hs']);
    } else {
        $controller->show_postings($forum_id, $_GET['q'], $_GET['hs']);
    }
}
 function show($_forum_id)
 {
     $url = new FreechURL('http://code.google.com/p/freech/', 'Powered by Freech ' . FREECH_VERSION);
     $this->api->links('footer')->add_link($url, 100);
     if (cfg('rss_enabled')) {
         $url = new FreechURL('rss.php', _('RSS feed'));
         $url->set_var('forum_id', (int) $_forum_id);
         $html = '<span id="rss">' . '<a href="' . $url->get_string(TRUE) . '">' . '<img src="themes/' . cfg('theme') . '/img/rss.png" alt="RSS 2.0" />' . '</a>' . '&nbsp;' . $url->get_html() . '</span>';
         $this->api->links('footer')->add_html($html, 200);
     }
     if (cfg('goto_top_enabled')) {
         $top_link = "<a id='goto_top' href='#top'>" . esc(_('Go to top')) . "</a>";
         $this->api->links('footer')->add_html($top_link, 300);
     }
     // Render the resulting template.
     $this->clear_all_assign();
     $this->assign_by_ref('view_links', $this->api->links('view'));
     $this->assign_by_ref('footer_links', $this->api->links('footer'));
     $this->render_php('footer.php.tmpl');
 }
 function show()
 {
     // Get a list of forums.
     $group = $this->api->group();
     $may_edit = $group->may('administer');
     $add_forum_url = new FreechURL('', _('Add a New Forum'));
     $add_forum_url->set_var('action', 'forum_add');
     // Collect status information regarding each forum.
     if ($may_edit) {
         $forums = $this->forumdb->get_forums();
     } else {
         // do not show inactive forums
         $forums = $this->forumdb->get_not_forums(FORUM_STATUS_INACTIVE);
     }
     if (!cfg('disable_posting_counter')) {
         foreach ($forums as $forum) {
             $search = array('forum_id' => $forum->get_id());
             $n_postings = $this->forumdb->get_n_postings($search);
             $start = time() - cfg('new_post_time');
             $n_new = $this->forumdb->get_n_postings($search, $start);
             $text = sprintf(_('%d postings, %d new'), $n_postings, $n_new);
             $forum->set_status_text($text);
         }
     }
     // Get a list of the most recent postings.
     $db = $this->forumdb;
     $n = $db->foreach_latest_posting(NULL, 0, cfg('homepage_n_entries'), FALSE, FALSE, array($this, '_append_posting'), '');
     // Get other page info.
     $new_users = $this->userdb->get_newest_users(cfg('homepage_n_entries'));
     // Render the template.
     $this->clear_all_assign();
     $this->assign('title', cfg('site_title'));
     $this->assign('may_edit', $may_edit);
     $this->assign('add_forum_url', $add_forum_url);
     $this->assign('forums', $forums);
     $this->assign('forum_links', $this->api->links('forum'));
     $this->assign('postings', $this->postings);
     $this->assign('new_users', $new_users);
     $this->render_php('home.php.tmpl');
 }
Exemple #20
0
function linkify_on_read(&$api, &$message)
{
    $message->signal_connect('on_format_after_html', 'linkify_on_format');
    // Make sure that the link is not added twice on pages where
    // this method is called multiple times.
    foreach ($api->links('view')->get_items() as $item) {
        if (!$item->is_link()) {
            continue;
        }
        if ($item->get_url()->get_var('action') == 'linkify_hide_videos' || $item->get_url()->get_var('action') == 'linkify_show_videos') {
            return;
        }
    }
    // Add a link to the bottom of the page.
    if ($_COOKIE['linkify_show_videos']) {
        $url = new FreechURL('', _('Hide Videos'));
        $url->set_var('action', 'linkify_hide_videos');
    } else {
        $url = new FreechURL('', _('Show Videos'));
        $url->set_var('action', 'linkify_show_videos');
    }
    $url->set_var('refer_to', $_SERVER['REQUEST_URI']);
    $api->links('view')->add_link($url);
}
Exemple #21
0
function registration_on_confirm(&$api)
{
    $userdb = $api->userdb();
    $user = $userdb->get_user_from_name($_GET['username']);
    assert_user_confirmation_hash_is_valid($user);
    // See if the user still needs to set a password.
    if (!$user->get_password_hash()) {
        $url = new FreechURL(cfg('site_url'));
        $url->set_var('action', 'password_change');
        $url->set_var('username', $user->get_name());
        $url->set_var('hash', $_GET['hash']);
        $api->refer_to($url->get_string());
    }
    // Make the user active.
    $user->set_status(USER_STATUS_ACTIVE);
    $ret = $userdb->save_user($user);
    if ($ret < 0) {
        die('User activation failed');
    }
    // Done.
    include dirname(__FILE__) . '/registration_controller.class.php';
    $registration = new RegistrationController($api);
    $registration->show_done($user);
}
Exemple #22
0
function _init_rating_body($_msg)
{
    $types = array(RATING_TYPE_PLUS_PLUS => array('css' => 'positive_rating', 'text' => '++'), RATING_TYPE_PLUS => array('css' => 'positive_rating', 'text' => '+'), RATING_TYPE_MINUS => array('css' => 'negative_rating', 'text' => '-'), RATING_TYPE_MINUS_MINUS => array('css' => 'negative_rating', 'text' => '--'));
    $url = new FreechURL('', 'set rating');
    $url->set_var('action', 'set_rating');
    $url->set_var('thread_id', $_msg->get_thread_id());
    $url->set_var('msg_id', 'ID');
    $url->set_var('rating', 'TYPE');
    $url_proto = $url->get_string();
    $rating_body = array();
    foreach ($types as $key => $type) {
        $vote = str_replace('TYPE', (int) $key, $url_proto);
        $text = $type['text'];
        $css = $type['css'];
        $rating_body[] = "<a class='{$css}' href='" . esc($vote) . "'>{$text}</a>";
    }
    return array(implode("&nbsp;", $rating_body), $types);
}
Exemple #23
0
 function show_posting(&$_posting)
 {
     trace('enter');
     $user = $this->api->user();
     $group = $this->api->group();
     $db = $this->forumdb;
     $prev_posting_id = $db->get_prev_posting_id_in_thread($_posting);
     $next_posting_id = $db->get_next_posting_id_in_thread($_posting);
     trace('previous/next postings found');
     $prev_thread_id = $db->get_prev_thread_id($_posting);
     $next_thread_id = $db->get_next_thread_id($_posting);
     trace('previous/next threads found');
     $posting_uid = $_posting ? $_posting->get_user_id() : -1;
     $may_write = $group->may('write');
     $may_edit = $may_write && cfg('postings_editable') && !$user->is_anonymous() && $user->get_id() === $posting_uid && $_posting->is_editable();
     $showthread = $_posting && $_posting->has_thread() && $_COOKIE[thread] != 'hide';
     include dirname(__FILE__) . '/indexbar_read_posting.class.php';
     $indexbar = new ThreadViewIndexBarReadPosting($_posting, $prev_posting_id, $next_posting_id, $prev_thread_id, $next_thread_id);
     trace('indexbar built');
     // Add the 'respond' button.
     if ($may_write) {
         $url = $_posting->get_respond_url();
         if ($_posting->is_active() && $_posting->get_allow_answer()) {
             $this->api->links('page')->add_link($url, 250);
         } else {
             $this->api->links('page')->add_text($url->get_label(), 200);
         }
     }
     // Add the 'edit' button.
     if ($may_edit) {
         $url = $_posting->get_edit_url();
         $this->api->links('page')->add_link($url, 300);
     }
     // Add 'show/hide thread' buttons.
     $url = new FreechURL();
     $url->set_var('action', 'read');
     $url->set_var('forum_id', $_posting->get_forum_id());
     $url->set_var('msg_id', $_posting->get_id());
     $url->set_var('refer_to', $_SERVER['REQUEST_URI']);
     if ($_posting->has_thread()) {
         if ($_COOKIE[thread] === 'hide') {
             $url->set_var('showthread', 1);
             $url->set_label(_('Show Thread'));
         } else {
             $url->set_var('showthread', -1);
             $url->set_label(_('Hide Thread'));
         }
         $this->api->links('view')->add_link($url);
     }
     trace('links updated');
     // Load the thread.
     $this->clear_all_assign();
     $this->assign_by_ref('showthread', $showthread);
     if ($showthread) {
         trace('loading thread');
         $state = new ThreadState(THREAD_STATE_UNFOLDED, '');
         $func = array(&$this, '_format_posting');
         $thread_ids = array($_posting->get_thread_id());
         $threads = $this->forumdb->get_threads_from_id($thread_ids, TRUE);
         trace('thread loaded');
         $threads[0]->foreach_posting($func);
         trace('thread formatted');
         $this->assign('n_rows', 1);
         $this->assign_by_ref('threads', $threads);
     }
     // Render.
     $this->assign_by_ref('indexbar', $indexbar);
     $this->assign_by_ref('posting', $_posting);
     $this->assign('max_usernamelength', cfg('max_usernamelength'));
     $this->assign('max_subjectlength', cfg('max_subjectlength'));
     $this->render_php(dirname(__FILE__) . '/threadview_read_posting.php.tmpl');
     $this->api->set_title($_posting->get_subject());
     trace('leave');
 }
Exemple #24
0
 function show_posting(&$_posting)
 {
     $user = $this->api->user();
     $group = $this->api->group();
     $db = $this->forumdb;
     $msg_uid = $_posting ? $_posting->get_user_id() : -1;
     $showlist = $_posting && $_COOKIE['thread'] != 'hide';
     //FIXME: rename "thread" cookie
     $may_write = $group->may('write');
     $may_edit = $may_write && cfg('postings_editable') && !$user->is_anonymous() && $user->get_id() === $msg_uid && $_posting->is_editable();
     // Add the 'respond' button.
     if ($may_write) {
         $url = $_posting->get_respond_url();
         if ($_posting->is_active() && $_posting->get_allow_answer()) {
             $this->api->links('page')->add_link($url, 250);
         } else {
             $this->api->links('page')->add_text($url->get_label(), 200);
         }
     }
     // Add the 'edit' button.
     if ($may_edit) {
         $url = $_posting->get_edit_url();
         $this->api->links('page')->add_link($url, 300);
     }
     // Add 'show/hide thread' buttons.
     $url = new FreechURL();
     $url->set_var('action', 'read');
     $url->set_var('forum_id', $_posting->get_forum_id());
     $url->set_var('msg_id', $_posting->get_id());
     $url->set_var('refer_to', $_SERVER['REQUEST_URI']);
     if ($_posting->has_thread()) {
         if ($_COOKIE[thread] === 'hide') {
             $url->set_var('showthread', 1);
             $url->set_label(_('Show Posting List'));
         } else {
             $url->set_var('showthread', -1);
             $url->set_label(_('Hide Posting List'));
         }
         $this->api->links('view')->add_link($url);
     }
     // Create the indexbar.
     if (cfg('posting_arrow_reverse')) {
         $prev_posting_id = $db->get_next_posting_id_in_forum($_posting);
         $next_posting_id = $db->get_prev_posting_id_in_forum($_posting);
     } else {
         $prev_posting_id = $db->get_prev_posting_id_in_forum($_posting);
         $next_posting_id = $db->get_next_posting_id_in_forum($_posting);
     }
     include dirname(__FILE__) . '/indexbar_read_posting.class.php';
     $indexbar = new ListViewIndexBarReadPosting($_posting, $prev_posting_id, $next_posting_id);
     $this->clear_all_assign();
     $this->assign_by_ref('showlist', $showlist);
     if ($showlist) {
         $current_id = (int) $_GET['msg_id'];
         $func = array(&$this, '_append_posting');
         $_posting->set_selected($_posting->get_id() == $current_id);
         $this->posting_map[$_posting->get_id()] = $_posting;
         $db->foreach_prev_posting($_posting, cfg('epp') / 2, $func);
         $db->foreach_next_posting($_posting, cfg('epp') / 2, $func);
         krsort($this->posting_map);
         $this->assign('n_rows', count($this->posting_map));
         $this->assign('postings', array_values($this->posting_map));
     }
     $this->assign_by_ref('indexbar', $indexbar);
     $this->assign_by_ref('posting', $_posting);
     $this->assign('max_usernamelength', cfg('max_usernamelength'));
     $this->assign('max_subjectlength', cfg('max_subjectlength'));
     $this->render_php(dirname(__FILE__) . '/listview_read_posting.php.tmpl');
     $this->api->set_title($_posting->get_subject());
 }
Exemple #25
0
 function get_html()
 {
     // This entire method is an evil hack.
     $post_url = new FreechURL('', $this->get_attribute('subject'));
     $post_url->set_var('action', 'read');
     $post_url->set_var('msg_id', $this->get_attribute('id'));
     $post_url->set_var('forum_id', $this->get_attribute('forum_id'));
     $moderator_url = new FreechURL('', $this->get_moderator_name());
     $moderator_url->set_var('action', 'user_profile');
     $moderator_url->set_var('username', $this->get_moderator_name());
     $mod_icon = htmlentities($this->get_moderator_icon());
     $mod_groupname = htmlentities($this->get_moderator_group_name());
     $mod_icon_html = "<img src='{$mod_icon}'" . " title='{$mod_groupname}' alt='{$mod_groupname}' />";
     $mod_html = $moderator_url->get_html() . $mod_icon_html;
     $user_url = new FreechURL('', $this->get_attribute('username'));
     $user_url->set_var('action', 'user_profile');
     $user_url->set_var('username', $this->get_attribute('username'));
     $user_name = htmlentities($this->get_attribute('username'));
     $user_icon = htmlentities($this->get_attribute('user_icon'));
     $user_groupname = htmlentities($this->get_attribute('user_groupname'));
     $user_icon_html = "<img src='{$user_icon}'" . " title='{$user_groupname}' alt='{$user_groupname}' />";
     if ($this->get_attribute('user_groupname') == 'anonymous') {
         $user_html = $user_name . $user_icon_html;
     } else {
         $user_html = $user_url->get_html() . $user_icon_html;
     }
     $args = array('moderator_link' => $mod_html, 'posting_link' => $post_url->get_html(), 'posting_url' => $post_url->get_string(TRUE), 'user_link' => $user_html);
     $args = array_merge($args, $this->attributes);
     switch ($this->get_action()) {
         case 'lock_user':
             $text = _('[MODERATOR_LINK] has locked the account of "[USERNAME]".');
             break;
         case 'unlock_user':
             $text = _('[MODERATOR_LINK] has unlocked the account of "[USERNAME]".');
             break;
         case 'lock_posting':
             $text = _('[MODERATOR_LINK] has locked a' . ' <a href="[POSTING_URL]">posting</a> by [USER_LINK].');
             break;
         case 'unlock_posting':
             $text = _('[MODERATOR_LINK] has unlocked the posting' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'set_sticky':
             $text = _('[MODERATOR_LINK] has made the posting' . ' [POSTING_LINK] by [USER_LINK] sticky.');
             break;
         case 'remove_sticky':
             $text = _('[MODERATOR_LINK] has removed the sticky from' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'stub_posting':
             $text = _('[MODERATOR_LINK] has disabled responses to the posting' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'unstub_posting':
             $text = _('[MODERATOR_LINK] has enabled responses to the posting' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         case 'move_thread':
             $text = _('[MODERATOR_LINK] has moved the thread' . ' [POSTING_LINK] by [USER_LINK].');
             break;
         default:
             die('Unknown modlog action.');
     }
     return replace_vars($text, $args);
 }
 function show_group_editor(&$_group)
 {
     $url = new FreechURL();
     $url->set_var('action', 'group_submit');
     // Render the template.
     $this->clear_all_assign();
     $this->assign_by_ref('group', $_group);
     $this->assign('action', $url->get_string());
     $this->render_php('group_editor.php.tmpl');
     $this->api->set_title($_group->get_name());
 }
Exemple #27
0
 function get_user_profile_url()
 {
     if (isset($this->fields['current_username'])) {
         $username = $this->fields['current_username'];
     } else {
         $username = $this->get_username();
     }
     $profile_url = new FreechURL('', $this->get_username());
     $profile_url->set_var('action', 'user_profile');
     $profile_url->set_var('username', $username);
     return $profile_url;
 }
Exemple #28
0
 function &get_editor_url()
 {
     $url = new FreechURL('', '[' . _('Edit') . ']');
     $url->set_var('action', 'forum_edit');
     $url->set_var('forum_id', $this->get_id());
     return $url;
 }
Exemple #29
0
 function get_editor_url()
 {
     $url = new FreechURL('', '[' . _('Edit') . ']');
     $url->set_var('action', 'group_editor');
     $url->set_var('groupname', $this->get_name());
     return $url;
 }
 function register_view($_name, $_view, $_caption, $_priority)
 {
     $this->views[$_name] = $_view;
     if ($this->get_current_action() != 'list' && $this->get_current_action() != 'read') {
         return;
     }
     if ($this->_get_current_view_name() === $_name) {
         return $this->links('view')->add_text($_caption, $_priority);
     }
     $refer_url = new FreechURL();
     $refer_url->set_var('action', $_GET['action']);
     $refer_url->set_var('msg_id', $_GET['msg_id']);
     $refer_url->set_var('forum_id', $_GET['forum_id']);
     $url = new FreechURL('', $_caption);
     $url->set_var('forum_id', $this->get_current_forum_id());
     $url->set_var('changeview', $_name);
     $url->set_var('refer_to', $refer_url->get_string());
     $this->links('view')->add_link($url, $_priority);
 }