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 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 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 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;
 }
Exemple #5
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);
}
 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');
 }
 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');
 }
Exemple #8
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);
}
 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 #10
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 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);
 }
 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());
 }