Esempio n. 1
0
function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$pm, &$email, &$www, &$user_time, &$avatar)
{
    global $lang, $images, $bb_cfg;
    $from = !empty($row['user_from']) ? $row['user_from'] : '';
    $joined = bb_date($row['user_regdate']);
    $user_time = !empty($row['user_time']) ? bb_date($row['user_time']) : $lang['NONE'];
    $posts = $row['user_posts'] ? $row['user_posts'] : 0;
    $pm = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
    $avatar = get_avatar($row['user_id'], $row['avatar_ext_id'], !bf($row['user_opt'], 'user_opt', 'dis_avatar'), '', 50, 50);
    if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || $group_mod) {
        $email_uri = $bb_cfg['board_email_form'] ? "profile.php?mode=email&amp;" . POST_USERS_URL . "=" . $row['user_id'] : 'mailto:' . $row['user_email'];
        $email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
    } else {
        $email = '';
    }
    if ($row['user_website']) {
        $www = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . $row['user_website'] . '"  target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
    } else {
        $www = '';
    }
    return;
}
Esempio n. 2
0
    }
    if (!$topic_rows) {
        bb_die($lang['NO_SEARCH_MATCH']);
    }
    // Output page
    foreach ($items_display as $row_num => $item_id) {
        if (empty($topic_rows[$item_id])) {
            continue;
            // if topic was deleted but still remain in search results
        }
        $topic = $topic_rows[$item_id];
        $topic_id = $topic['topic_id'];
        $forum_id = $topic['forum_id'];
        $is_unread = is_unread($topic['topic_last_post_time'], $topic_id, $forum_id);
        $moved = $topic['topic_status'] == TOPIC_MOVED;
        $template->assign_block_vars('t', array('ROW_NUM' => $row_num, 'FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_name_html[$forum_id], 'TOPIC_ID' => $topic_id, 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'], 'TOPIC_TITLE' => wbr($topic['topic_title']), 'IS_UNREAD' => $is_unread, 'TOPIC_ICON' => get_topic_icon($topic, $is_unread), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']), 'REPLIES' => $topic['topic_replies'], 'ATTACH' => $topic['topic_attachment'], 'STATUS' => $topic['topic_status'], 'TYPE' => $topic['topic_type'], 'DL' => $topic['topic_dl_type'] == TOPIC_DL_TYPE_DL, 'POLL' => $topic['topic_vote'], 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'TOPIC_AUTHOR' => profile_url(array('username' => $topic['first_username'], 'user_id' => $topic['first_user_id'], 'user_rank' => $topic['first_user_rank'])), 'LAST_POSTER' => profile_url(array('username' => $topic['last_username'], 'user_id' => $topic['last_user_id'], 'user_rank' => $topic['last_user_rank'])), 'LAST_POST_TIME' => bb_date($topic['topic_last_post_time']), 'LAST_POST_ID' => $topic['topic_last_post_id']));
    }
}
if ($items_display) {
    $items_count = count($items_found);
    $pages = !$items_count ? 1 : ceil($items_count / $per_page);
    $url = $search_id ? url_arg($url, 'id', $search_id) : $url;
    generate_pagination($url, $items_count, $per_page, $start);
    $template->assign_vars(array('PAGE_TITLE' => $lang['SEARCH'], 'SEARCH_MATCHES' => $items_count ? sprintf($lang['FOUND_SEARCH_MATCHES'], $items_count) : '', 'DISPLAY_AS_POSTS' => $post_mode, 'DL_CONTROLS' => $dl_search && $dl_user_id_val == $user_id, 'DL_ACTION' => 'dl_list.php', 'MY_POSTS' => !$post_mode && $my_posts && $user->id == $poster_id_val));
    print_page('search_results.tpl');
}
redirect(basename(__FILE__));
// ----------------------------------------------------------- //
// Functions
//
function fetch_search_ids($sql, $search_type = SEARCH_TYPE_POST)
Esempio n. 3
0
function create_atom($file_path, $mode, $id, $title, $topics)
{
    global $bb_cfg;
    $dir = dirname($file_path);
    if (!file_exists($dir)) {
        if (!bb_mkdir($dir)) {
            return false;
        }
    }
    foreach ($topics as $topic) {
        $last_time = $topic['topic_last_post_time'];
        if ($topic['topic_last_post_edit_time']) {
            $last_time = $topic['topic_last_post_edit_time'];
        }
        $date = bb_date($last_time, 'Y-m-d', 0);
        $time = bb_date($last_time, 'H:i:s', 0);
        break;
    }
    $atom = "";
    $atom .= "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
    $atom .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xml:base=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\">\n";
    $atom .= "<title>{$title}</title>\n";
    $atom .= "<updated>" . $date . "T{$time}+00:00</updated>\n";
    $atom .= "<id>tag:rto.feed,2000:/{$mode}/{$id}</id>\n";
    $atom .= "<link href=\"http://" . $bb_cfg['server_name'] . $bb_cfg['script_path'] . "\" />\n";
    foreach ($topics as $topic) {
        $topic_id = $topic['topic_id'];
        $tor_size = '';
        if (isset($topic['tor_size'])) {
            $tor_size = str_replace('&nbsp;', ' ', ' [' . humn_size($topic['tor_size']) . ']');
        }
        $topic_title = $topic['topic_title'];
        $orig_word = array();
        $replacement_word = array();
        obtain_word_list($orig_word, $replacement_word);
        if (count($orig_word)) {
            $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
        }
        $topic_title = wbr($topic_title);
        $author_name = $topic['first_username'] ? wbr($topic['first_username']) : 'Гость';
        $last_time = $topic['topic_last_post_time'];
        if ($topic['topic_last_post_edit_time']) {
            $last_time = $topic['topic_last_post_edit_time'];
        }
        $date = bb_date($last_time, 'Y-m-d', 0);
        $time = bb_date($last_time, 'H:i:s', 0);
        $updated = '';
        $checktime = TIMENOW - 604800;
        // неделя (week)
        if ($topic['topic_first_post_edit_time'] && $topic['topic_first_post_edit_time'] > $checktime) {
            $updated = '[Обновлено] ';
        }
        $atom .= "<entry>\n";
        $atom .= "\t<title type=\"html\"><![CDATA[{$updated}{$topic_title}{$tor_size}]]></title>\n";
        $atom .= "\t<author>\n";
        $atom .= "\t\t<name>{$author_name}</name>\n";
        $atom .= "\t</author>\n";
        $atom .= "\t<updated>" . $date . "T{$time}+00:00</updated>\n";
        $atom .= "\t<id>tag:rto.feed," . $date . ":/t/{$topic_id}</id>\n";
        $atom .= "\t<link href=\"viewtopic.php?t={$topic_id}\" />\n";
        $atom .= "</entry>\n";
    }
    $atom .= "</feed>";
    @unlink($file_path);
    $fp = fopen($file_path, "w");
    fwrite($fp, $atom);
    fclose($fp);
    return true;
}
Esempio n. 4
0
     }
     $this->response['new_value'] = $this->request['value'];
     break;
 case 'user_from':
 case 'user_occ':
 case 'user_interests':
     $value = htmlCHR($value);
     $this->response['new_value'] = $value;
     break;
 case 'user_regdate':
 case 'user_lastvisit':
     $tz = TIMENOW + 3600 * $bb_cfg['board_timezone'];
     if (($value = strtotime($value, $tz)) < $bb_cfg['board_startdate'] or $value > TIMENOW) {
         $this->ajax_die($lang['INVALID_DATE'] . $this->request['value']);
     }
     $this->response['new_value'] = bb_date($value, 'Y-m-d H:i', false);
     break;
 case 'u_up_total':
 case 'u_down_total':
 case 'u_up_release':
 case 'u_up_bonus':
     if (!IS_ADMIN) {
         $this->ajax_die($lang['NOT_ADMIN']);
     }
     $table = BB_BT_USERS;
     $value = (double) str_replace(',', '.', $this->request['value']);
     foreach (array('KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4) as $s => $m) {
         if (strpos($this->request['value'], $s) !== false) {
             $value *= pow(1024, $m);
             break;
         }
Esempio n. 5
0
        // сохранение изменений
    // сохранение изменений
    case 'save':
        if ($tpl_data['tpl_last_edit_tm'] > $this->request['tpl_l_ed_tst'] && $tpl_data['tpl_last_edit_by'] != $userdata['user_id']) {
            $last_edit_by_username = get_username(intval($tpl_data['tpl_last_edit_by']));
            $msg = "Изменения не были сохранены!\n\n";
            $msg .= 'Шаблон был отредактирован: ' . html_entity_decode($last_edit_by_username) . ', ' . delta_time($tpl_data['tpl_last_edit_tm']) . " назад\n\n";
            $this->ajax_die($msg);
        }
        $sql = "UPDATE " . BB_TOPIC_TPL . " SET " . DB()->build_array('UPDATE', $sql_args) . " WHERE tpl_id = {$tpl_id} LIMIT 1";
        if (!@DB()->query($sql)) {
            $sql_error = DB()->sql_error();
        }
        $this->response['tpl_id'] = $tpl_id;
        $this->response['tpl_name'] = $tpl_name;
        $this->response['html']['tpl-last-edit-time'] = bb_date(TIMENOW, 'd-M-y H:i');
        $this->response['html']['tpl-last-edit-by'] = $userdata['username'];
        break;
        // создание нового шаблона
    // создание нового шаблона
    case 'new':
        $sql = "INSERT INTO " . BB_TOPIC_TPL . DB()->build_array('INSERT', $sql_args);
        if (!@DB()->query($sql)) {
            $sql_error = DB()->sql_error();
        }
        break;
        // ошибочный $mode
    // ошибочный $mode
    default:
        $this->ajax_die("invalid mode: {$mode}");
}
    create_percent_box('session', create_percent_color($session_percent), $session_percent);
    create_percent_box('total', create_percent_color($total_percent), $total_percent);
    $template->assign_vars(array('L_NEXT' => $next_button, 'L_TIME_LAST_POSTS_ADMIN' => sprintf($lang['TIME_LAST_POSTS'], $num_rows), 'PROCESSING_POSTS' => sprintf($lang['PROCESSED_POST_IDS'], $start_post_id, $end_post_id), 'PROCESSING_MESSAGES' => $processing_messages, 'PROGRESS_BAR_IMG' => $progress_bar_img, 'SESSION_DETAILS' => sprintf($lang['PROCESS_DETAILS'], $session_posts_processed - $num_rows + 1, $session_posts_processed, $session_posts_processing), 'SESSION_PERCENT' => sprintf($lang['PERCENT_COMPLETED'], round($session_percent, 2)), 'TOTAL_DETAILS' => sprintf($lang['PROCESS_DETAILS'], $total_posts_processed - $num_rows + 1, $total_posts_processed, $total_posts), 'TOTAL_PERCENT' => sprintf($lang['PERCENT_COMPLETED'], round($total_percent, 2)), 'LAST_CYCLE_TIME' => delta_time(TIMENOW), 'SESSION_TIME' => delta_time($last_session_data['start_time']), 'SESSION_AVERAGE_CYCLE_TIME' => delta_time($session_average_cycle_time, 0), 'SESSION_ESTIMATED_TIME' => delta_time($session_estimated_time, 0), 'SEARCH_TABLES_SIZE' => humn_size($search_tables_size), 'FINAL_SEARCH_TABLES_SIZE' => humn_size($final_search_tables_size), 'SEARCH_DATA_SIZE' => humn_size($search_data_size), 'SEARCH_INDEX_SIZE' => humn_size($search_index_size), 'START_POST' => $last_session_data['start_post_id'], 'POST_LIMIT' => $num_rows, 'TIME_LIMIT' => $time_limit, 'REFRESH_RATE' => $refresh_rate, 'S_REBUILD_SEARCH_ACTION' => $form_action));
} else {
    // create the page
    // used only with the select input
    $post_limit_hidden = $def_post_limit > $total_posts ? $total_posts : $def_post_limit;
    $s_hidden_fields = '<input type="hidden" name="post_limit_stored" value="' . $post_limit_hidden . '" />';
    $s_hidden_fields .= '<input type="hidden" name="total_posts_stored" value="' . $total_posts . '" />';
    $next_start_post_id = 0;
    $last_saved_processing = '';
    $clear_search_disabled = '';
    if ($last_session_data['rebuild_session_id']) {
        $last_saved_post_id = $last_session_data['end_post_id'];
        $next_start_post_id = $last_saved_post_id + 1;
        $last_saved_date = bb_date($last_session_data['end_time']);
        // check our last status
        if ($last_session_data['rebuild_session_status'] == REBUILD_SEARCH_PROCESSED) {
            $last_saved_processing = sprintf($lang['INFO_PROCESSING_STOPPED'], $last_saved_post_id, $total_posts_processed, $last_saved_date);
            $clear_search_disabled = 'disabled="disabled"';
            $template->assign_block_vars("start_select_input", array());
        } elseif ($last_session_data['rebuild_session_status'] == REBUILD_SEARCH_ABORTED) {
            $last_saved_processing = sprintf($lang['INFO_PROCESSING_ABORTED'], $last_saved_post_id, $total_posts_processed, $last_saved_date);
            // check if the interrupted cycle has finished
            if (TIMENOW - $last_session_data['end_time'] < $last_session_data['last_cycle_time']) {
                $last_saved_processing .= '<br />' . $lang['INFO_PROCESSING_ABORTED_SOON'];
            }
            $clear_search_disabled = 'disabled="disabled"';
            $template->assign_block_vars("start_select_input", array());
        } else {
            if ($last_session_data['end_post_id'] < $max_post_id) {
Esempio n. 7
0
function topic_review($topic_id)
{
    global $bb_cfg, $template;
    // Fetch posts data
    $review_posts = DB()->fetch_rowset("\n\t\tSELECT\n\t\t\tp.*, h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,\n\t\t\tIF(p.poster_id = " . GUEST_UID . ", p.post_username, u.username) AS username, u.user_rank\n\t\tFROM      " . BB_POSTS . " p\n\t\tLEFT JOIN " . BB_USERS . " u  ON(u.user_id = p.poster_id)\n\t\tLEFT JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id)\n\t\tLEFT JOIN " . BB_POSTS_HTML . " h  ON(h.post_id = p.post_id)\n\t\tWHERE p.topic_id = " . (int) $topic_id . "\n\t\tORDER BY p.post_time DESC\n\t\tLIMIT " . $bb_cfg['posts_per_page'] . "\n\t");
    // Topic posts block
    foreach ($review_posts as $i => $post) {
        $template->assign_block_vars('review', array('ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'POSTER' => profile_url($post), 'POSTER_NAME_JS' => addslashes($post['username']), 'POST_DATE' => bb_date($post['post_time'], $bb_cfg['post_date_format']), 'MESSAGE' => get_parsed_post($post)));
    }
    $template->assign_vars(array('TPL_TOPIC_REVIEW' => (bool) $review_posts));
}
Esempio n. 8
0
         }
         if ($row = DB()->sql_fetchrow($result)) {
             $i = 0;
             do {
                 $privmsg_id = $row['privmsgs_id'];
                 $flag = $row['privmsgs_type'];
                 $icon_flag = $flag == PRIVMSGS_NEW_MAIL || $flag == PRIVMSGS_UNREAD_MAIL ? $images['pm_unreadmsg'] : $images['pm_readmsg'];
                 $icon_flag_alt = $flag == PRIVMSGS_NEW_MAIL || $flag == PRIVMSGS_UNREAD_MAIL ? $lang['UNREAD_MESSAGE'] : $lang['READ_MESSAGE'];
                 $msg_userid = $row['user_id'];
                 $msg_user = profile_url($row);
                 $msg_subject = $row['privmsgs_subject'];
                 if (count($orig_word)) {
                     $msg_subject = preg_replace($orig_word, $replacement_word, $msg_subject);
                 }
                 $u_subject = PM_URL . "?folder={$folder}&amp;mode=read&amp;" . POST_POST_URL . "={$privmsg_id}";
                 $msg_date = bb_date($row['privmsgs_date']);
                 if ($flag == PRIVMSGS_NEW_MAIL && $folder == 'inbox') {
                     $msg_subject = '<b>' . $msg_subject . '</b>';
                     $msg_date = '<b>' . $msg_date . '</b>';
                     $msg_user = '******' . $msg_user . '</b>';
                 }
                 $row_class = !($i & 1) ? 'row1' : 'row2';
                 $i++;
                 $template->assign_block_vars('listrow', array('ROW_CLASS' => $row_class, 'FROM' => $msg_user, 'SUBJECT' => htmlCHR($msg_subject), 'DATE' => $msg_date, 'PRIVMSG_FOLDER_IMG' => $icon_flag, 'L_PRIVMSG_FOLDER_ALT' => $icon_flag_alt, 'S_MARK_ID' => $privmsg_id, 'U_READ' => $u_subject));
             } while ($row = DB()->sql_fetchrow($result));
             generate_pagination(PM_URL . "?folder={$folder}", $pm_total, $bb_cfg['topics_per_page'], $start);
         } else {
             $template->assign_block_vars("switch_no_messages", array());
         }
     }
 }
Esempio n. 9
0
     $msg = $result ? $lang['DELETE_POSTS_SUCCESFULLY'] : 'No posts were removed';
     bb_die(return_msg_mcp($msg));
 } else {
     $sql = "SELECT u.username, p.*, pt.post_text, p.post_username\n\t\t\t\tFROM " . BB_POSTS . " p, " . BB_USERS . " u, " . BB_POSTS_TEXT . " pt\n\t\t\t\tWHERE p.topic_id = {$topic_id}\n\t\t\t\t\tAND p.poster_id = u.user_id\n\t\t\t\t\tAND p.post_id = pt.post_id\n\t\t\t\tORDER BY p.post_time ASC";
     if (!($result = DB()->sql_query($sql))) {
         bb_die('Could not get topic / post information');
     }
     $s_hidden_fields = '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" /><input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '" /><input type="hidden" name="' . POST_TOPIC_URL . '" value="' . $topic_id . '" /><input type="hidden" name="mode" value="split" />';
     if (($total_posts = DB()->num_rows($result)) > 0) {
         $postrow = DB()->sql_fetchrowset($result);
         $template->assign_vars(array('FORUM_NAME' => htmlCHR($forum_name), 'U_VIEW_FORUM' => FORUM_URL . $forum_id, 'S_SPLIT_ACTION' => 'modcp.php', 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_FORUM_SELECT' => get_forum_select('admin', 'new_forum_id', $forum_id)));
         for ($i = 0; $i < $total_posts; $i++) {
             $post_id = $postrow[$i]['post_id'];
             $poster_id = $postrow[$i]['poster_id'];
             $poster = $postrow[$i]['username'];
             $post_date = bb_date($postrow[$i]['post_time']);
             $message = $postrow[$i]['post_text'];
             //
             // If the board has HTML off but the post has HTML
             // on then we process it, else leave it alone
             //
             $message = bbcode2html($message);
             $row_class = !($i % 2) ? 'row1' : 'row2';
             $template->assign_block_vars('postrow', array('ROW_CLASS' => $row_class, 'POSTER_NAME' => wbr($poster), 'POST_DATE' => $post_date, 'MESSAGE' => $message, 'CHECKBOX' => defined('BEGIN_CHECKBOX') ? TRUE : FALSE, 'POST_ID' => $post_id, 'ROW_ID' => $i, 'CB_ID' => 'cb_' . $i));
             if ($post_id == $topic_first_post_id) {
                 define('BEGIN_CHECKBOX', TRUE);
             }
         }
     }
 }
 $template->set_filenames(array('body' => 'modcp_split.tpl'));
Esempio n. 10
0
<?php

if (!defined('IN_AJAX')) {
    die(basename(__FILE__));
}
global $bb_cfg, $lang;
$mode = (string) $this->request['mode'];
$map = new sitemap();
$html = '';
switch ($mode) {
    case 'create':
        $map->create();
        if (@file_exists(SITEMAP_DIR . 'sitemap.xml')) {
            $html .= $lang['SITEMAP_CREATED'] . ': <b>' . bb_date(TIMENOW, $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap.xml') . '" target="_blank">' . make_url('sitemap.xml') . '</a>';
        } else {
            $html .= $lang['SITEMAP_NOT_CREATED'];
        }
        break;
    case 'search_update':
        if (!@file_exists(SITEMAP_DIR . 'sitemap.xml')) {
            $map->create();
        }
        $map_link = make_url(SITEMAP_DIR . 'sitemap.xml');
        if (strpos($map->send_url("http://google.com/webmasters/sitemaps/ping?sitemap=", $map_link), "successfully added") !== false) {
            $html .= '<br />' . $lang['SITEMAP_NOTIFY_SEARCH'] . ' Google: <font style="color: green;">' . $lang['SITEMAP_SENT'] . '</font>';
        } else {
            $html .= '<br />' . $lang['SITEMAP_NOTIFY_SEARCH'] . ' Google: <font style="color: red;">' . $lang['SITEMAP_ERROR'] . '</font> URL: <a href="http://google.com/webmasters/sitemaps/ping?sitemap=' . urlencode($map_link) . '" target="_blank">http://google.com/webmasters/sitemaps/ping?sitemap=' . $map_link . '</a>';
        }
        if (strpos($map->send_url("http://ping.blogs.yandex.ru/ping?sitemap=", $map_link), "OK") !== false) {
            $html .= '<br />' . $lang['SITEMAP_NOTIFY_SEARCH'] . ' Yandex: <font style="color: green;">' . $lang['SITEMAP_SENT'] . '</font>';
        } else {
Esempio n. 11
0
			';
            $return_message = $locked_warn . $return_message;
        }
        bb_die($return_message);
    }
}
if ($refresh || $error_msg || $submit && $topic_has_new_posts) {
    $username = !empty($_POST['username']) ? clean_username($_POST['username']) : '';
    $subject = !empty($_POST['subject']) ? clean_title($_POST['subject']) : '';
    $message = !empty($_POST['message']) ? prepare_message($_POST['message']) : '';
    if ($preview) {
        $preview_subject = $subject;
        $preview_username = $username;
        $preview_message = htmlCHR($message, false, ENT_NOQUOTES);
        $preview_message = bbcode2html($preview_message);
        $template->assign_vars(array('TPL_PREVIEW_POST' => true, 'TOPIC_TITLE' => wbr($preview_subject), 'POST_SUBJECT' => $preview_subject, 'POSTER_NAME' => $preview_username, 'POST_DATE' => bb_date(TIMENOW), 'PREVIEW_MSG' => $preview_message));
    }
} else {
    // User default entry point
    if ($mode == 'newtopic') {
        $username = $userdata['session_logged_in'] ? $userdata['username'] : '';
        $subject = $message = '';
    } elseif ($mode == 'reply') {
        $username = $userdata['session_logged_in'] ? $userdata['username'] : '';
        $subject = $message = '';
    } elseif ($mode == 'quote' || $mode == 'editpost') {
        $subject = $post_data['first_post'] ? $post_info['topic_title'] : '';
        $message = $post_info['post_text'];
        if ($mode == 'quote') {
            if (!defined('WORD_LIST_OBTAINED')) {
                $orig_word = array();
Esempio n. 12
0
    if (!($result = DB()->sql_query($sql))) {
        bb_die('Could not delete topic watch information #1');
    }
}
$template->assign_vars(array('PAGE_TITLE' => $lang['WATCHED_TOPICS'], 'S_FORM_ACTION' => BB_ROOT . 'profile.php?mode=watch'));
$sql = "SELECT COUNT(topic_id) as watch_count FROM " . BB_TOPICS_WATCH . " WHERE user_id = {$user_id}";
if (!($result = DB()->sql_query($sql))) {
    bb_die('Could not obtain watch topic information #2');
}
$row = DB()->sql_fetchrow($result);
$watch_count = $row['watch_count'] ? $row['watch_count'] : 0;
DB()->sql_freeresult($result);
if ($watch_count > 0) {
    $sql = "SELECT w.*, t.*, f.*, u.*, u2.username as last_username, u2.user_id as last_user_id,\n\t\tu2.user_level as last_user_level, u2.user_rank as last_user_rank\n\tFROM " . BB_TOPICS_WATCH . " w, " . BB_TOPICS . " t, " . BB_USERS . " u, " . BB_FORUMS . " f, " . BB_POSTS . " p, " . BB_USERS . " u2\n\tWHERE w.topic_id = t.topic_id\n\t\tAND t.forum_id = f.forum_id\n\t\tAND p.post_id = t.topic_last_post_id\n\t\tAND p.poster_id = u2.user_id\n\t\tAND t.topic_poster = u.user_id\n\t\tAND w.user_id = {$user_id}\n\tGROUP BY t.topic_last_post_time DESC\n\tLIMIT {$start}, {$per_page}";
    if (!($result = DB()->sql_query($sql))) {
        bb_die('Could not obtain watch topic information #3');
    }
    $watch = DB()->sql_fetchrowset($result);
    if ($watch) {
        for ($i = 0; $i < count($watch); $i++) {
            $is_unread = is_unread($watch[$i]['topic_last_post_time'], $watch[$i]['topic_id'], $watch[$i]['forum_id']);
            $template->assign_block_vars('watch', array('ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'POST_ID' => $watch[$i]['topic_first_post_id'], 'TOPIC_ID' => $watch[$i]['topic_id'], 'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)), 'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']), 'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'], 'FORUM_TITLE' => wbr($watch[$i]['forum_name']), 'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'], 'REPLIES' => $watch[$i]['topic_replies'], 'AUTHOR' => profile_url($watch[$i]), 'LAST_POST' => bb_date($watch[$i]['topic_last_post_time']) . '<br />' . profile_url(array('user_id' => $watch[$i]['last_user_id'], 'username' => $watch[$i]['last_username'], 'user_rank' => $watch[$i]['last_user_rank'])), 'LAST_POST_ID' => $watch[$i]['topic_last_post_id'], 'IS_UNREAD' => $is_unread, 'TOPIC_ICON' => get_topic_icon($watch[$i], $is_unread), 'PAGINATION' => $watch[$i]['topic_status'] == TOPIC_MOVED ? '' : build_topic_pagination(TOPIC_URL . $watch[$i]['topic_id'], $watch[$i]['topic_replies'], $bb_cfg['posts_per_page'])));
        }
        $template->assign_vars(array('MATCHES' => count($watch) == 1 ? sprintf($lang['FOUND_SEARCH_MATCH'], count($watch)) : sprintf($lang['FOUND_SEARCH_MATCHES'], count($watch)), 'PAGINATION' => generate_pagination(BB_ROOT . 'profile.php?mode=watch', $watch_count, $per_page, $start), 'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], floor($start / $per_page) + 1, ceil($watch_count / $per_page)), 'U_PER_PAGE' => BB_ROOT . 'profile.php?mode=watch', 'PER_PAGE' => $per_page));
    }
    DB()->sql_freeresult($result);
} else {
    meta_refresh('index.php', 3);
    bb_die($lang['NO_WATCHED_TOPICS']);
}
print_page('usercp_topic_watch.tpl');
Esempio n. 13
0
        $latest_news = $datastore->get('latest_news');
    }
    $template->assign_vars(array('SHOW_LATEST_NEWS' => true));
    foreach ($latest_news as $news) {
        $template->assign_block_vars('news', array('NEWS_TOPIC_ID' => $news['topic_id'], 'NEWS_TITLE' => str_short($news['topic_title'], $bb_cfg['max_news_title']), 'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false), 'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id'])));
    }
}
// Network news
if ($bb_cfg['show_network_news']) {
    if (!($network_news = $datastore->get('network_news'))) {
        $datastore->update('network_news');
        $network_news = $datastore->get('network_news');
    }
    $template->assign_vars(array('SHOW_NETWORK_NEWS' => true));
    foreach ($network_news as $net) {
        $template->assign_block_vars('net', array('NEWS_TOPIC_ID' => $net['topic_id'], 'NEWS_TITLE' => str_short($net['topic_title'], $bb_cfg['max_net_title']), 'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false), 'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id'])));
    }
}
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
    $week_list = $today_list = array();
    $week_all = $today_all = false;
    if ($stats['birthday_week_list']) {
        shuffle($stats['birthday_week_list']);
        foreach ($stats['birthday_week_list'] as $i => $week) {
            if ($i >= 5) {
                $week_all = true;
                continue;
            }
            $week_list[] = profile_url($week) . ' <span class="small">(' . birthday_age($week['user_birthday'] - 1) . ')</span>';
        }
        $week_all = $week_all ? '&nbsp;<a class="txtb" href="#" onclick="ajax.exec({action: \'index_data\', mode: \'birthday_week\'}); return false;" title="' . $lang['ALL'] . '">...</a>' : '';
Esempio n. 14
0
         }
         // forum_name
         if ($fid =& $row['log_forum_id']) {
             $forum_name = ($fname =& $f_data[$fid]['forum_name']) ? $fname : 'id:' . $row['log_forum_id'];
         }
         // forum_name_new
         if ($fid =& $row['log_forum_id_new']) {
             $forum_name_new = ($fname =& $f_data[$fid]['forum_name']) ? $fname : 'id:' . $row['log_forum_id'];
         }
         break;
 }
 $msg .= " {$row['log_msg']}";
 $row_class = !($row_num & 1) ? $row_class_1 : $row_class_2;
 $datetime_href_s = url_arg($url, $datetime_key, date($dt_format, $row['log_time']));
 $datetime_href_s = url_arg($datetime_href_s, $daysback_key, 1);
 $template->assign_block_vars('log', array('ACTION_DESC' => $lang['LOG_ACTION']['LOG_TYPE'][$log_type_flip[$row['log_type_id']]], 'ACTION_HREF_S' => url_arg($url, $type_key, $row['log_type_id']), 'USER_ID' => $row['log_user_id'], 'USERNAME' => $row['log_username'], 'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']), 'USER_IP' => decode_ip($row['log_user_ip']), 'FORUM_ID' => $row['log_forum_id'], 'FORUM_HREF' => BB_ROOT . FORUM_URL . $row['log_forum_id'], 'FORUM_HREF_S' => url_arg($url, $forum_key, $row['log_forum_id']), 'FORUM_NAME' => htmlCHR($forum_name), 'FORUM_ID_NEW' => $row['log_forum_id_new'], 'FORUM_HREF_NEW' => BB_ROOT . FORUM_URL . $row['log_forum_id_new'], 'FORUM_HREF_NEW_S' => url_arg($url, $forum_key, $row['log_forum_id_new']), 'FORUM_NAME_NEW' => htmlCHR($forum_name_new), 'TOPIC_ID' => $row['log_topic_id'], 'TOPIC_HREF' => !$topic_deleted ? BB_ROOT . TOPIC_URL . $row['log_topic_id'] : '', 'TOPIC_HREF_S' => url_arg($url, $topic_key, $row['log_topic_id']), 'TOPIC_TITLE' => $topic_title, 'TOPIC_ID_NEW' => $row['log_topic_id_new'], 'TOPIC_HREF_NEW' => BB_ROOT . TOPIC_URL . $row['log_topic_id_new'], 'TOPIC_HREF_NEW_S' => url_arg($url, $topic_key, $row['log_topic_id_new']), 'TOPIC_TITLE_NEW' => $topic_title_new, 'DATE' => bb_date($row['log_time'], 'j-M'), 'TIME' => bb_date($row['log_time'], 'H:i'), 'DATETIME_HREF_S' => $datetime_href_s, 'MSG' => $msg, 'ROW_CLASS' => $row_class));
 // Topics
 if ($topic_csv && empty($filter['topics'][$row['log_topic_title']])) {
     $template->assign_block_vars('topics', array('TOPIC_TITLE' => $row['log_topic_title']));
     $filter['topics'][$row['log_topic_title']] = true;
 }
 // Forums
 if ($forum_csv && empty($filter['forums'][$forum_name])) {
     $template->assign_block_vars('forums', array('FORUM_NAME' => htmlCHR($forum_name)));
     $filter['forums'][$forum_name] = true;
 }
 // Users
 if ($user_csv && empty($filter['users'][$row['log_username']])) {
     $template->assign_block_vars('users', array('USERNAME' => $row['log_username']));
     $filter['users'][$row['log_username']] = true;
 }
Esempio n. 15
0
<?php

define('IN_FORUM', true);
define('BB_ROOT', './');
require BB_ROOT . 'common.php';
$user->session_start();
set_die_append_msg();
if (!IS_SUPER_ADMIN) {
    bb_die($lang['ONLY_FOR_SUPER_ADMIN']);
}
$confirm = request_var('confirm', '');
if ($confirm) {
    DB()->query("ALTER TABLE " . BB_USERS . " CHANGE COLUMN user_birthday user_birthday_old int(11) NOT NULL DEFAULT 0 AFTER user_gender");
    DB()->query("ALTER TABLE " . BB_USERS . " ADD user_birthday date NOT NULL DEFAULT '0000-00-00' AFTER user_gender");
    $sql = "SELECT user_id, user_birthday_old FROM " . BB_USERS . " WHERE user_birthday_old != 0 AND user_id NOT IN ('" . EXCLUDED_USERS_CSV . "')";
    foreach (DB()->fetch_rowset($sql) as $row) {
        $birthday = bb_date($row['user_birthday_old'] * 86400 + 1, 'Y-m-d', 0);
        DB()->query("UPDATE " . BB_USERS . " SET user_birthday = '" . $birthday . "' WHERE user_id = " . $row['user_id'] . "");
    }
    DB()->query("ALTER TABLE " . BB_USERS . " DROP user_birthday_old");
    bb_die('<h1 style="color: green">База данных обновлена</h1>');
} else {
    $msg = '<form method="POST">';
    $msg .= '<h1 style="color: red">!!! Перед тем как нажать на кнопку, сделайте бекап базы данных !!!</h1><br />';
    $msg .= '<input type="submit" name="confirm" value="Начать обновление Базы Данных (R496)" style="height: 30px; font:bold 14px Arial, Helvetica, sans-serif;" />';
    $msg .= '</form>';
    bb_die($msg);
}
Esempio n. 16
0
        // synch unread pm count
        if (defined('IN_PM')) {
            $row = DB()->fetch_row("\n\t\t\t\tSELECT COUNT(*) AS pm_count\n\t\t\t\tFROM " . BB_PRIVMSGS . "\n\t\t\t\tWHERE privmsgs_to_userid = " . $userdata['user_id'] . "\n\t\t\t\t\tAND privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . "\n\t\t\t\tGROUP BY privmsgs_to_userid\n\t\t\t");
            $real_unread_pm_count = (int) $row['pm_count'];
            if ($userdata['user_unread_privmsg'] != $real_unread_pm_count) {
                $userdata['user_unread_privmsg'] = $real_unread_pm_count;
                db_update_userdata($userdata, array('user_unread_privmsg' => $real_unread_pm_count));
            }
        }
        $pm_info = declension($userdata['user_unread_privmsg'], $lang['UNREAD_PMS_DECLENSION'], $lang['UNREAD_PMS_FORMAT']);
        $have_unread_pm = true;
    }
}
$template->assign_vars(array('HAVE_NEW_PM' => $have_new_pm, 'HAVE_UNREAD_PM' => $have_unread_pm));
// The following assigns all _common_ variables that may be used at any point in a template
$template->assign_vars(array('SIMPLE_HEADER' => !empty($gen_simple_header), 'CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'], 'IN_ADMIN' => defined('IN_ADMIN'), 'SHOW_ADS' => !$logged_in || isset($bb_cfg['show_ads_users'][$user->id]) || !IS_AM && $user->show_ads, 'USER_HIDE_CAT' => BB_SCRIPT == 'index', 'USER_LANG' => $userdata['user_lang'], 'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']), 'USER_OPTIONS_JS' => IS_GUEST ? '{}' : Zend\Json\Json::encode($user->opt_js), 'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']), 'SITENAME' => $bb_cfg['sitename'], 'U_INDEX' => BB_ROOT . "index.php", 'T_INDEX' => sprintf($lang['FORUM_INDEX'], $bb_cfg['sitename']), 'IS_GUEST' => IS_GUEST, 'IS_USER' => IS_USER, 'IS_ADMIN' => IS_ADMIN, 'IS_MOD' => IS_MOD, 'IS_AM' => IS_AM, 'FORUM_PATH' => FORUM_PATH, 'FULL_URL' => FULL_URL, 'CURRENT_TIME' => sprintf($lang['CURRENT_TIME'], bb_date(TIMENOW, $bb_cfg['last_visit_date_format'], false)), 'S_TIMEZONE' => preg_replace('/\\(.*?\\)/', '', sprintf($lang['ALL_TIMES'], $lang['TZ'][str_replace(',', '.', floatval($bb_cfg['board_timezone']))])), 'BOARD_TIMEZONE' => $bb_cfg['board_timezone'], 'PM_INFO' => $pm_info, 'PRIVMSG_IMG' => $icon_pm, 'LOGGED_IN' => $logged_in, 'SESSION_USER_ID' => $userdata['user_id'], 'POINTS' => $userdata['user_points'], 'THIS_USER' => profile_url($userdata), 'THIS_AVATAR' => get_avatar($userdata['user_id'], $userdata['avatar_ext_id'], !bf($userdata['user_opt'], 'user_opt', 'dis_avatar')), 'SHOW_LOGIN_LINK' => !defined('IN_LOGIN'), 'AUTOLOGIN_DISABLED' => !$bb_cfg['allow_autologin'], 'S_LOGIN_ACTION' => LOGIN_URL, 'U_CUR_DOWNLOADS' => PROFILE_URL . $userdata['user_id'], 'U_FORUM' => "viewforum.php", 'U_GROUPS' => "group.php", 'U_LOGIN_LOGOUT' => $u_login_logout, 'U_MEMBERLIST' => "memberlist.php", 'U_MODCP' => "modcp.php", 'U_OPTIONS' => "profile.php?mode=editprofile", 'U_PRIVATEMSGS' => PM_URL . "?folder=inbox", 'U_PROFILE' => PROFILE_URL . $userdata['user_id'], 'U_READ_PM' => PM_URL . "?folder=inbox" . ($userdata['user_newest_pm_id'] && $userdata['user_new_privmsg'] == 1 ? "&mode=read&p={$userdata['user_newest_pm_id']}" : ''), 'U_REGISTER' => "profile.php?mode=register", 'U_SEARCH' => "search.php", 'U_SEND_PASSWORD' => "profile.php?mode=sendpassword", 'U_TERMS' => $bb_cfg['terms_and_conditions_url'], 'U_TRACKER' => "tracker.php", 'SHOW_SIDEBAR1' => !empty($page_cfg['show_sidebar1'][BB_SCRIPT]) || $bb_cfg['show_sidebar1_on_every_page'], 'SHOW_SIDEBAR2' => !empty($page_cfg['show_sidebar2'][BB_SCRIPT]) || $bb_cfg['show_sidebar2_on_every_page'], 'HTML_AGREEMENT' => LANG_DIR . 'html/user_agreement.html', 'HTML_COPYRIGHT' => LANG_DIR . 'html/copyright_holders.html', 'HTML_ADVERT' => LANG_DIR . 'html/advert.html', 'HTML_SIDEBAR_1' => LANG_DIR . 'html/sidebar1.html', 'HTML_SIDEBAR_2' => LANG_DIR . 'html/sidebar2.html', 'AVATARS_URL' => 'data/avatars', 'CAT_URL' => BB_ROOT . CAT_URL, 'DOWNLOAD_URL' => BB_ROOT . DOWNLOAD_URL, 'FORUM_URL' => BB_ROOT . FORUM_URL, 'GROUP_URL' => BB_ROOT . GROUP_URL, 'LOGIN_URL' => $bb_cfg['login_url'], 'NEWEST_URL' => '&amp;view=newest#newest', 'PM_URL' => $bb_cfg['pm_url'], 'POST_URL' => BB_ROOT . POST_URL, 'POSTING_URL' => $bb_cfg['posting_url'], 'PROFILE_URL' => BB_ROOT . PROFILE_URL, 'TOPIC_URL' => BB_ROOT . TOPIC_URL, 'AJAX_HTML_DIR' => AJAX_HTML_DIR, 'ONLY_NEW_POSTS' => ONLY_NEW_POSTS, 'ONLY_NEW_TOPICS' => ONLY_NEW_TOPICS, 'BOT_UID' => BOT_UID, 'COOKIE_MARK' => COOKIE_MARK, 'SID' => $userdata['session_id'], 'SID_HIDDEN' => '<input type="hidden" name="sid" value="' . $userdata['session_id'] . '" />', 'CHECKED' => HTML_CHECKED, 'DISABLED' => HTML_DISABLED, 'READONLY' => HTML_READONLY, 'SELECTED' => HTML_SELECTED, 'U_SEARCH_SELF_BY_LAST' => "search.php?uid={$userdata['user_id']}&amp;o=5", 'U_WATCHED_TOPICS' => "profile.php?mode=watch"));
if (!empty($page_cfg['show_torhelp'][BB_SCRIPT]) && !empty($userdata['torhelp'])) {
    $ignore_time = !empty($_COOKIE['torhelp']) ? (int) $_COOKIE['torhelp'] : 0;
    if (TIMENOW > $ignore_time) {
        if ($ignore_time) {
            bb_setcookie('torhelp', '', COOKIE_EXPIRED);
        }
        $sql = "\n\t\t\tSELECT topic_id, topic_title\n\t\t\tFROM " . BB_TOPICS . "\n\t\t\tWHERE topic_id IN(" . $userdata['torhelp'] . ")\n\t\t\tLIMIT 8\n\t\t";
        $torhelp_topics = array();
        foreach (DB()->fetch_rowset($sql) as $row) {
            $torhelp_topics[] = '<a href="viewtopic.php?t=' . $row['topic_id'] . '">' . $row['topic_title'] . '</a>';
        }
        $template->assign_vars(array('TORHELP_TOPICS' => join("</li>\n<li>", $torhelp_topics)));
    }
}
// Ads
Esempio n. 17
0
    $t_type = $topic['topic_type'];
    $separator = '';
    $is_unread = is_unread($topic['topic_last_post_time'], $topic_id, $forum_id);
    if ($t_type == POST_ANNOUNCE && !defined('ANNOUNCE_SEP')) {
        define('ANNOUNCE_SEP', true);
        $separator = $lang['TOPICS_ANNOUNCEMENT'];
    } elseif ($t_type == POST_STICKY && !defined('STICKY_SEP')) {
        define('STICKY_SEP', true);
        $separator = $lang['TOPICS_STICKY'];
    } elseif ($t_type == POST_NORMAL && !defined('NORMAL_SEP')) {
        if (defined('ANNOUNCE_SEP') || defined('STICKY_SEP')) {
            define('NORMAL_SEP', true);
            $separator = $lang['TOPICS_NORMAL'];
        }
    }
    $template->assign_block_vars('t', array('FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'], 'TOPIC_TITLE' => wbr($topic['topic_title']), 'TOPICS_SEPARATOR' => $separator, 'IS_UNREAD' => $is_unread, 'TOPIC_ICON' => get_topic_icon($topic, $is_unread), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $replies, $bb_cfg['posts_per_page']), 'REPLIES' => $replies, 'VIEWS' => $topic['topic_views'], 'TOR_STALED' => $forum_data['allow_reg_tracker'] && !($t_type == POST_ANNOUNCE || $t_type == POST_STICKY || $topic['tor_size']), 'TOR_FROZEN' => isset($topic['tor_status']) ? !IS_AM ? isset($bb_cfg['tor_frozen'][$topic['tor_status']]) : '' : '', 'TOR_TYPE' => isset($topic['tor_type']) ? is_gold($topic['tor_type']) : '', 'TOR_STATUS_ICON' => isset($topic['tor_status']) ? $bb_cfg['tor_icons'][$topic['tor_status']] : '', 'TOR_STATUS_TEXT' => isset($topic['tor_status']) ? $lang['TOR_STATUS_NAME'][$topic['tor_status']] : '', 'ATTACH' => $topic['topic_attachment'], 'STATUS' => $topic['topic_status'], 'TYPE' => $topic['topic_type'], 'DL' => $topic['topic_dl_type'] == TOPIC_DL_TYPE_DL && !$forum_data['allow_reg_tracker'], 'POLL' => $topic['topic_vote'], 'DL_CLASS' => isset($topic['dl_status']) ? $dl_link_css[$topic['dl_status']] : '', 'TOPIC_AUTHOR' => profile_url(array('username' => str_short($topic['first_username'], 15), 'user_id' => $topic['first_user_id'], 'user_rank' => $topic['first_user_rank'])), 'LAST_POSTER' => profile_url(array('username' => str_short($topic['last_username'], 15), 'user_id' => $topic['last_user_id'], 'user_rank' => $topic['last_user_rank'])), 'LAST_POST_TIME' => bb_date($topic['topic_last_post_time']), 'LAST_POST_ID' => $topic['topic_last_post_id']));
    if (isset($topic['tor_size'])) {
        $tor_magnet = create_magnet($topic['info_hash'], $topic['auth_key'], $userdata['session_logged_in']);
        $template->assign_block_vars('t.tor', array('SEEDERS' => (int) $topic['seeders'], 'LEECHERS' => (int) $topic['leechers'], 'TOR_SIZE' => humn_size($topic['tor_size']), 'COMPL_CNT' => (int) $topic['complete_count'], 'ATTACH_ID' => $topic['attach_id'], 'MAGNET' => $tor_magnet));
    }
    $found_topics++;
}
unset($topic_rowset);
$pg_url = FORUM_URL . $forum_id;
$pg_url .= $sort_value ? "&sort={$sort_value}" : '';
$pg_url .= $order_value ? "&order={$order_value}" : '';
$template->assign_var('MOD_URL', $pg_url);
$pg_url = FORUM_URL . $forum_id;
$pg_url .= $topic_days ? "&amp;topicdays={$topic_days}" : '';
$pg_url .= $sort_value ? "&amp;sort={$sort_value}" : '';
$pg_url .= $order_value ? "&amp;order={$order_value}" : '';
Esempio n. 18
0
if (!empty($setmodules)) {
    $module['MODS']['SITEMAP'] = basename(__FILE__);
    return;
}
require './pagestart.php';
require INC_DIR . 'functions_selects.php';
$sql = "SELECT * FROM " . BB_CONFIG;
if (!($result = DB()->sql_query($sql))) {
    bb_die('Could not query config information in admin_sitemap');
} else {
    $new_params = array();
    while ($row = DB()->sql_fetchrow($result)) {
        $config_name = $row['config_name'];
        $config_value = $row['config_value'];
        $default_config[$config_name] = $config_value;
        $new[$config_name] = isset($_POST[$config_name]) ? $_POST[$config_name] : $default_config[$config_name];
        if (isset($_POST['submit']) && $row['config_value'] != $new[$config_name]) {
            $new_params[$config_name] = $new[$config_name];
        }
    }
    if (isset($_POST['submit'])) {
        if (!empty($new_params)) {
            bb_update_config($new_params);
        }
    }
}
$s_mess = $lang['SITEMAP_CREATED'] . ': <b>' . bb_date($new['sitemap_time'], $bb_cfg['post_date_format']) . '</b> ' . $lang['SITEMAP_AVAILABLE'] . ': <a href="' . make_url('sitemap.xml') . '" target="_blank">' . make_url('sitemap.xml') . '</a>';
$message = @file_exists(BB_ROOT . "/internal_data/sitemap/sitemap.xml") ? $s_mess : $lang['SITEMAP_NOT_CREATED'];
$template->assign_vars(array('STATIC_SITEMAP' => $new['static_sitemap'], 'MESSAGE' => $message));
print_page('admin_sitemap.tpl', 'admin');
Esempio n. 19
0
                    }
                    $row_class = 'row1';
                    $reg_ip = decode_ip($onlinerow_reg[$i]['session_ip']);
                    $template->assign_block_vars('reg_user_row', array('ROW_CLASS' => $row_class, 'USER' => profile_url($onlinerow_reg[$i]), 'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', false), 'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', false), 'IP_ADDRESS' => $reg_ip, 'U_WHOIS_IP' => $bb_cfg['whois_info'] . $reg_ip));
                }
            }
        }
        // Guest users
        if (count($onlinerow_guest)) {
            $guest_users = 0;
            for ($i = 0; $i < count($onlinerow_guest); $i++) {
                $guest_userip_ary[] = $onlinerow_guest[$i]['session_ip'];
                $guest_users++;
                $row_class = 'row2';
                $guest_ip = decode_ip($onlinerow_guest[$i]['session_ip']);
                $template->assign_block_vars('guest_user_row', array('ROW_CLASS' => $row_class, 'STARTED' => bb_date($onlinerow_guest[$i]['session_start'], 'H:i', false), 'LASTUPDATE' => bb_date($onlinerow_guest[$i]['session_time'], 'H:i', false), 'IP_ADDRESS' => $guest_ip, 'U_WHOIS_IP' => $bb_cfg['whois_info'] . $guest_ip));
            }
        }
    } else {
        $template->assign_vars(array('USERS_ONLINE_HREF' => 'index.php?pane=right&users_online=1'));
    }
} else {
    // Generate frameset
    $template->assign_vars(array('CONTENT_ENCODING' => $bb_cfg['lang'][$userdata['user_lang']]['encoding'], 'TPL_ADMIN_FRAMESET' => true));
    send_no_cache_headers();
    print_page('index.tpl', 'admin', 'no_header');
}
print_page('index.tpl', 'admin');
// Functions
function inarray($needle, $haystack)
{
Esempio n. 20
0
 }
 // Replace naughty words
 if (count($orig_word)) {
     if ($user_sig) {
         $user_sig = str_replace('\\"', '"', substr(@preg_replace('#(\\>(((?>([^><]+|(?R)))*)\\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
     }
     $message = str_replace('\\"', '"', substr(@preg_replace('#(\\>(((?>([^><]+|(?R)))*)\\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
 }
 // Replace newlines (we use this rather than nl2br because till recently it wasn't XHTML compliant)
 if ($user_sig) {
     $user_sig = $bb_cfg['user_signature_start'] . $user_sig . $bb_cfg['user_signature_end'];
 }
 // Editing information
 if ($postrow[$i]['post_edit_count']) {
     $l_edit_time_total = $postrow[$i]['post_edit_count'] == 1 ? $lang['EDITED_TIME_TOTAL'] : $lang['EDITED_TIMES_TOTAL'];
     $l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, bb_date($postrow[$i]['post_edit_time']), $postrow[$i]['post_edit_count']);
 } else {
     $l_edited_by = '';
 }
 // Again this will be handled by the templating code at some point
 $pg_row_class = !($i % 2) ? 'row2' : 'row1';
 // Mod comment
 switch ($mc_type) {
     case 1:
         // Комментарий
         $mc_class = 'success';
         break;
     case 2:
         // Информация
         $mc_class = 'info';
         break;
Esempio n. 21
0
    $data['speed'] = $row['speed'];
}
// gender stat
if ($bb_cfg['gender']) {
    $male = DB()->fetch_row("SELECT COUNT(user_id) AS male FROM " . BB_USERS . " WHERE user_gender = " . MALE . " AND user_id NOT IN(" . EXCLUDED_USERS_CSV . ")");
    $female = DB()->fetch_row("SELECT COUNT(user_id) AS female FROM " . BB_USERS . " WHERE user_gender = " . FEMALE . " AND user_id NOT IN(" . EXCLUDED_USERS_CSV . ")");
    $unselect = DB()->fetch_row("SELECT COUNT(user_id) AS unselect FROM " . BB_USERS . " WHERE user_gender = 0 AND user_id NOT IN(" . EXCLUDED_USERS_CSV . ")");
    $data['male'] = $male['male'];
    $data['female'] = $female['female'];
    $data['unselect'] = $unselect['unselect'];
}
// birthday stat
if ($bb_cfg['birthday_check_day'] && $bb_cfg['birthday_enabled']) {
    $sql = DB()->fetch_rowset("SELECT user_id, username, user_rank , user_birthday\n\t\tFROM " . BB_USERS . "\n\t\tWHERE user_id NOT IN(" . EXCLUDED_USERS_CSV . ")\n\t\t\tAND user_birthday != '0000-00-00'\n\t\t\tAND user_active = 1\n\t\tORDER BY user_level DESC, username\n\t");
    $date_today = bb_date(TIMENOW, 'md', false);
    $date_forward = bb_date(TIMENOW + $bb_cfg['birthday_check_day'] * 86400, 'md', false);
    $birthday_today_list = $birthday_week_list = array();
    foreach ($sql as $row) {
        $user_birthday = date('md', strtotime($row['user_birthday']));
        if ($user_birthday > $date_today && $user_birthday <= $date_forward) {
            // user are having birthday within the next days
            $birthday_week_list[] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_rank' => $row['user_rank'], 'user_birthday' => $row['user_birthday']);
        } elseif ($user_birthday == $date_today) {
            //user have birthday today
            $birthday_today_list[] = array('user_id' => $row['user_id'], 'username' => $row['username'], 'user_rank' => $row['user_rank'], 'user_birthday' => $row['user_birthday']);
        }
    }
    $data['birthday_today_list'] = $birthday_today_list;
    $data['birthday_week_list'] = $birthday_week_list;
}
$this->store('stats', $data);
Esempio n. 22
0
     /**
      *  Возраст (edit)
      */
 /**
  *  Возраст (edit)
  */
 case 'user_birthday':
     $user_birthday = isset($_POST['user_birthday']) ? (string) $_POST['user_birthday'] : $pr_data['user_birthday'];
     if ($submit && $user_birthday != $pr_data['user_birthday']) {
         $birthday_date = date_parse($user_birthday);
         if (!empty($birthday_date['year'])) {
             if (strtotime($user_birthday) >= TIMENOW) {
                 $errors[] = $lang['WRONG_BIRTHDAY_FORMAT'];
             } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] > $bb_cfg['birthday_max_age']) {
                 $errors[] = sprintf($lang['BIRTHDAY_TO_HIGH'], $bb_cfg['birthday_max_age']);
             } elseif (bb_date(TIMENOW, 'Y', false) - $birthday_date['year'] < $bb_cfg['birthday_min_age']) {
                 $errors[] = sprintf($lang['BIRTHDAY_TO_LOW'], $bb_cfg['birthday_min_age']);
             }
         }
         $pr_data['user_birthday'] = $user_birthday;
         $db_data['user_birthday'] = $user_birthday;
     }
     $tp_data['USER_BIRTHDAY'] = $pr_data['user_birthday'];
     break;
     /**
      *  opt (edit)
      */
 /**
  *  opt (edit)
  */
 case 'user_opt':
Esempio n. 23
0
             }
         }
         $compl_size = $peer['remain'] && $tor_size && $tor_size > $peer['remain'] ? $tor_size - $peer['remain'] : 0;
         $compl_perc = $compl_size ? floor($compl_size * 100 / $tor_size) : 0;
     }
     $rel_sign = !$guest && $peer['releaser'] ? '&nbsp;<b><sup>&reg;</sup></b>' : '';
     $name = profile_url($peer) . $rel_sign;
     $up_tot = $p_max_up ? humn_size($p_max_up) : '-';
     $down_tot = $p_max_down ? humn_size($p_max_down) : '-';
     $up_ratio = $p_max_down ? round($p_max_up / $p_max_down, 2) : '';
     $sp_up = $peer['speed_up'] ? humn_size($peer['speed_up'], 0, 'KB') . '/s' : '-';
     $sp_down = $peer['speed_down'] ? humn_size($peer['speed_down'], 0, 'KB') . '/s' : '-';
     $bgr_class = !($tr[$x] % 2) ? $bgr_class_1 : $bgr_class_2;
     $row_bgr = $change_peers_bgr_over ? " class=\"{$bgr_class}\" onmouseover=\"this.className='{$bgr_class_over}';\" onmouseout=\"this.className='{$bgr_class}';\"" : '';
     $tr[$x]++;
     $template->assign_block_vars("{$x_full}.{$x_row}", array('ROW_BGR' => $row_bgr, 'NAME' => $peer['update_time'] ? $name : "<s>{$name}</s>", 'COMPL_PRC' => $compl_perc, 'UP_TOTAL' => $max_up_id[$x] == $pid ? "<b>{$up_tot}</b>" : $up_tot, 'DOWN_TOTAL' => $max_down_id[$x] == $pid ? "<b>{$down_tot}</b>" : $down_tot, 'SPEED_UP' => $max_sp_up_id[$x] == $pid ? "<b>{$sp_up}</b>" : $sp_up, 'SPEED_DOWN' => $max_sp_down_id[$x] == $pid ? "<b>{$sp_down}</b>" : $sp_down, 'UP_TOTAL_RAW' => $peer['uploaded'], 'DOWN_TOTAL_RAW' => $peer['downloaded'], 'SPEED_UP_RAW' => $peer['speed_up'], 'SPEED_DOWN_RAW' => $peer['speed_down'], 'UPD_EXP_TIME' => $peer['update_time'] ? $lang['DL_UPD'] . bb_date($peer['update_time'], 'd-M-y H:i') . ' &middot; ' . delta_time($peer['update_time']) . $lang['TOR_BACK'] : $lang['DL_STOPPED'], 'TOR_RATIO' => $up_ratio ? $lang['USER_RATIO'] . "UL/DL: {$up_ratio}" : ''));
     if ($ip) {
         $template->assign_block_vars("{$x_full}.{$x_row}.ip", array('IP' => $ip));
     }
     if ($port !== false) {
         $template->assign_block_vars("{$x_full}.{$x_row}.port", array('PORT' => $port));
     }
 } else {
     if ($peer['seeder']) {
         $seeders .= '<nobr><a href="' . $u_prof_href . '" class="seedmed">' . $peer['username'] . '</a>,</nobr> ';
         $seed_count = $peer['username'];
     } else {
         $compl_size = @$peer['remain'] && $tor_size && $tor_size > $peer['remain'] ? $tor_size - $peer['remain'] : 0;
         $compl_perc = $compl_size ? floor($compl_size * 100 / $tor_size) : 0;
         $leechers .= '<nobr><a href="' . $u_prof_href . '" class="leechmed">' . $peer['username'] . '</a>';
         $leechers .= $s_mode == 'names' ? ' [' . $compl_perc . '%]' : '';
Esempio n. 24
0
// Generate page
//
$profile_user_id = $profiledata['user_id'] == $userdata['user_id'];
$signature = $bb_cfg['allow_sig'] && $profiledata['user_sig'] ? $profiledata['user_sig'] : '';
if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
    if ($profile_user_id) {
        $signature = $lang['SIGNATURE_DISABLE'];
    } else {
        $signature = '';
    }
} else {
    if ($signature) {
        $signature = bbcode2html($signature);
    }
}
$template->assign_vars(array('PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']), 'USERNAME' => $profiledata['username'], 'PROFILE_USER_ID' => $profiledata['user_id'], 'PROFILE_USER' => $profile_user_id, 'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false), 'POSTER_RANK' => $poster_rank ? "<span class=\"{$rank_style}\">" . $poster_rank . "</span>" : $lang['USER'], 'RANK_IMAGE' => $rank_image, 'RANK_SELECT' => $rank_select, 'POSTS' => $profiledata['user_posts'], 'PM' => '<a href="' . PM_URL . '?mode=post&amp;' . POST_USERS_URL . '=' . $profiledata['user_id'] . '">' . $lang['SEND_PRIVATE_MESSAGE'] . '</a>', 'EMAIL' => $email, 'WWW' => $profiledata['user_website'], 'ICQ' => $profiledata['user_icq'], 'LAST_VISIT_TIME' => $profiledata['user_lastvisit'] ? bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_lastvisit'], 'Y-m-d H:i', false) : $lang['NEVER'], 'LAST_ACTIVITY_TIME' => $profiledata['user_session_time'] ? bf($profiledata['user_opt'], 'user_opt', 'user_viewonline') && !IS_ADMIN ? $lang['HIDDEN_USER'] : bb_date($profiledata['user_session_time'], 'Y-m-d H:i', false) : $lang['NEVER'], 'USER_ACTIVE' => $profiledata['user_active'], 'LOCATION' => $profiledata['user_from'], 'OCCUPATION' => $profiledata['user_occ'], 'INTERESTS' => $profiledata['user_interests'], 'SKYPE' => $profiledata['user_skype'], 'TWITTER' => $profiledata['user_twitter'], 'USER_POINTS' => $profiledata['user_points'], 'GENDER' => $bb_cfg['gender'] ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '', 'BIRTHDAY' => $bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00' ? $profiledata['user_birthday'] : '', 'AGE' => $bb_cfg['birthday_enabled'] && $profiledata['user_birthday'] != '0000-00-00' ? birthday_age($profiledata['user_birthday']) : '', 'L_VIEWING_PROFILE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']), 'L_MY_PROFILE' => sprintf($lang['VIEWING_MY_PROFILE'], 'profile.php?mode=editprofile'), 'U_SEARCH_USER' => "search.php?search_author=1&amp;uid={$profiledata['user_id']}", 'U_SEARCH_TOPICS' => "search.php?uid={$profiledata['user_id']}&amp;myt=1", 'U_SEARCH_RELEASES' => "tracker.php?rid={$profiledata['user_id']}#results", 'AVATAR_IMG' => get_avatar($profiledata['user_id'], $profiledata['avatar_ext_id'], !bf($profiledata['user_opt'], 'user_opt', 'dis_avatar')), 'SIGNATURE' => $signature, 'SHOW_PASSKEY' => IS_ADMIN || $profile_user_id, 'SHOW_ROLE' => IS_AM || $profile_user_id || $profiledata['user_active'], 'GROUP_MEMBERSHIP' => false, 'TRAF_STATS' => !(IS_AM || $profile_user_id)));
if (IS_ADMIN) {
    $group_membership = array();
    $sql = "\n\t\tSELECT COUNT(g.group_id) AS groups_cnt, g.group_single_user, ug.user_pending\n\t\tFROM " . BB_USER_GROUP . " ug\n\t\tLEFT JOIN " . BB_GROUPS . " g USING(group_id)\n\t\tWHERE ug.user_id = {$profiledata['user_id']}\n\t\tGROUP BY ug.user_id, g.group_single_user, ug.user_pending\n\t\tORDER BY NULL\n\t";
    if ($rowset = DB()->fetch_rowset($sql)) {
        $member = $pending = $single = 0;
        foreach ($rowset as $row) {
            if (!$row['group_single_user'] && !$row['user_pending']) {
                $member = $row['groups_cnt'];
            } else {
                if (!$row['group_single_user'] && $row['user_pending']) {
                    $pending = $row['groups_cnt'];
                } else {
                    if ($row['group_single_user']) {
                        $single = $row['groups_cnt'];
                    }
Esempio n. 25
0
            $seeds = $tor['seeders'];
            $leechs = $tor['leechers'];
            $s_last = $tor['seeder_last_seen'];
            $att_id = $tor['attach_id'];
            $size = $tor['size'];
            $tor_magnet = create_magnet($tor['info_hash'], $passkey['auth_key'], $userdata['session_logged_in']);
            $compl = $tor['complete_count'];
            $dl_sp = $dl ? humn_size($dl, 0, 'KB') . '/s' : '0 KB/s';
            $ul_sp = $ul ? humn_size($ul, 0, 'KB') . '/s' : '0 KB/s';
            $dl_class = isset($tor['dl_status']) ? $dl_link_css[$tor['dl_status']] : 'genmed';
            $row_class = !($row_num & 1) ? $row_class_1 : $row_class_2;
            $row_num++;
            $cat_id = !$hide_cat && isset($tor['cat_id']) ? $tor['cat_id'] : '';
            $forum_id = !$hide_forum && isset($tor['forum_id']) ? $tor['forum_id'] : '';
            $poster_id = !$hide_author && isset($tor['poster_id']) ? $tor['poster_id'] : '';
            $template->assign_block_vars('tor', array('CAT_ID' => $cat_id, 'CAT_TITLE' => $cat_id ? $cat_title_html[$cat_id] : '', 'FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_id ? $forum_name_html[$forum_id] : '', 'TOPIC_ID' => $tor['topic_id'], 'TOPIC_TITLE' => wbr($tor['topic_title']), 'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') . ' <b>&middot;</b> ' . delta_time($tor['topic_time']), 'POST_ID' => $tor['post_id'], 'POSTER_ID' => $poster_id, 'USERNAME' => $hide_author ? '' : profile_url(array('username' => $tor['username'], 'user_rank' => $tor['user_rank'])), 'ROW_CLASS' => $row_class, 'ROW_NUM' => $row_num, 'DL_CLASS' => $dl_class, 'IS_NEW' => !IS_GUEST && $tor['reg_time'] > $lastvisit, 'USER_AUTHOR' => !IS_GUEST && $poster_id == $user_id, 'ATTACH_ID' => $att_id, 'MAGNET' => $tor_magnet, 'TOR_TYPE' => is_gold($tor['tor_type']), 'TOR_FROZEN' => !IS_AM ? isset($bb_cfg['tor_frozen'][$tor['tor_status']]) : '', 'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor['tor_status']], 'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor['tor_status']], 'TOR_SIZE_RAW' => $size, 'TOR_SIZE' => humn_size($size), 'UL_SPEED' => $ul_sp, 'DL_SPEED' => $dl_sp, 'SEEDS' => $seeds ? $seeds : 0, 'SEEDS_TITLE' => $seeds ? $lang['SEEDERS'] : $lang['SEED_NOT_SEEN'] . ":\n " . ($s_last ? bb_date($s_last, $date_format) : $lang['NEVER']), 'LEECHS' => $leechs ? $leechs : 0, 'COMPLETED' => $compl ? $compl : 0, 'REPLIES' => $tor['topic_replies'], 'VIEWS' => $tor['topic_views'], 'ADDED_RAW' => $tor['reg_time'], 'ADDED_TIME' => bb_date($tor['reg_time'], $time_format), 'ADDED_DATE' => bb_date($tor['reg_time'], $date_format, false)));
        }
    }
} else {
    $template->assign_vars(array('TOR_NOT_FOUND' => true, 'NO_MATCH_MSG' => $lang['BT_NO_SEARCHABLE_FORUMS']));
}
// Pagination
if ($tor_count) {
    $base_url = "{$tracker_url}?search_id={$search_id}";
    $search_matches = $tor_count == 1 ? sprintf($lang['FOUND_SEARCH_MATCH'], $tor_count) : sprintf($lang['FOUND_SEARCH_MATCHES'], $tor_count);
    $search_max = "(max: {$tor_search_limit})";
    generate_pagination($base_url, $tor_count, $per_page, $start);
    $template->assign_vars(array('MATCHES' => $search_matches, 'SERACH_MAX' => $search_max));
}
if (empty($cat_forum)) {
    bb_die($lang['BT_NO_SEARCHABLE_FORUMS']);
Esempio n. 26
0
    }
    if ($page < $num_pages) {
        $pagination .= $pagination == '' ? '<a href="' . $base_url . '&sort=' . $sort . '&order=' . $order . '&page=' . ($page + 1) . '">' . $lang['NEXT'] . '</a>' : ' | <a href="' . $base_url . '&sort=' . $sort . '&order=' . $order . '&page=' . ($page + 1) . '">' . $lang['NEXT'] . '</a>';
    }
    if ($num_pages > 2) {
        $pagination .= '&nbsp;&nbsp;<input type="text" name="page" maxlength="5" size="2" class="post" />&nbsp;<input type="submit" name="submit" value="' . $lang['GO'] . '" class="post" />';
    }
    $template->assign_vars(array('TPL_ADMIN_USER_SEARCH_RESULTS' => true, 'PAGE_NUMBER' => sprintf($lang['PAGE_OF'], $page, $num_pages), 'PAGINATION' => $pagination, 'NEW_SEARCH' => sprintf($lang['SEARCH_USERS_NEW'], $text, $total_pages['total'], 'admin_user_search.php'), 'U_USERNAME' => $sort == 'username' ? "{$base_url}&sort={$sort}&order={$o_order}" : "{$base_url}&sort=username&order={$order}", 'U_EMAIL' => $sort == 'user_email' ? "{$base_url}&sort={$sort}&order={$o_order}" : "{$base_url}&sort=user_email&order={$order}", 'U_POSTS' => $sort == 'posts' ? "{$base_url}&sort={$sort}&order={$o_order}" : "{$base_url}&sort=posts&order={$order}", 'U_JOINDATE' => $sort == 'regdate' ? "{$base_url}&sort={$sort}&order={$o_order}" : "{$base_url}&sort=regdate&order={$order}", 'U_LASTVISIT' => $sort == 'lastvisit' ? "{$base_url}&sort={$sort}&order={$o_order}" : "{$base_url}&sort=lastvisit&order={$order}", 'S_POST_ACTION' => "{$base_url}&sort={$sort}&order={$order}"));
    if (!($result = DB()->sql_query($select_sql))) {
        bb_die('Could not select user data');
    }
    $rowset = DB()->sql_fetchrowset($result);
    $users_sql = '';
    foreach ($rowset as $array) {
        $users_sql .= $users_sql == '' ? $array['user_id'] : ', ' . $array['user_id'];
    }
    $sql = "SELECT ban_userid AS user_id FROM " . BB_BANLIST . " WHERE ban_userid IN ({$users_sql})";
    if (!($result = DB()->sql_query($sql))) {
        bb_die('Could not select banned data');
    }
    unset($banned);
    $banned = array();
    while ($row = DB()->sql_fetchrow($result)) {
        $banned[$row['user_id']] = true;
    }
    for ($i = 0; $i < count($rowset); $i++) {
        $row_class = !($i % 2) ? 'row1' : 'row2';
        $template->assign_block_vars('userrow', array('ROW_CLASS' => $row_class, 'USER' => profile_url($rowset[$i]), 'EMAIL' => $rowset[$i]['user_email'], 'JOINDATE' => bb_date($rowset[$i]['user_regdate']), 'LASTVISIT' => bb_date($rowset[$i]['user_lastvisit']), 'POSTS' => $rowset[$i]['user_posts'], 'BAN' => !isset($banned[$rowset[$i]['user_id']]) ? $lang['NOT_BANNED'] : $lang['BANNED'], 'ABLED' => $rowset[$i]['user_active'] ? $lang['ENABLED'] : $lang['DISABLED'], 'U_VIEWPOSTS' => "../search.php?search_author=1&amp;uid={$rowset[$i]['user_id']}", 'U_MANAGE' => '../profile.php?mode=editprofile&' . POST_USERS_URL . '=' . $rowset[$i]['user_id'] . '&admin=1', 'U_PERMISSIONS' => 'admin_ug_auth.php?mode=user&' . POST_USERS_URL . '=' . $rowset[$i]['user_id']));
    }
}
print_page('admin_user_search.tpl', 'admin');
Esempio n. 27
0
$select_letter .= ':&nbsp;';
$select_letter .= $by_letter == 'all' ? '<b>' . $lang['ALL'] . '</b>' : '<a class="genmed" href="' . "memberlist.php?letter=all&amp;mode={$mode}&amp;order={$sort_order}" . '">' . $lang['ALL'] . '</a>';
$template->assign_vars(array('S_LETTER_SELECT' => $select_letter, 'S_LETTER_HIDDEN' => '<input type="hidden" name="letter" value="' . $by_letter . '">'));
// per-letter selection end
$sql = "SELECT username, user_id, user_rank, user_opt, user_posts, user_regdate, user_from, user_website, user_email FROM " . BB_USERS . " WHERE user_id NOT IN(" . EXCLUDED_USERS_CSV . ")";
if ($username) {
    $username = preg_replace('/\\*/', '%', clean_username($username));
    $letter_sql = "username LIKE '" . DB()->escape($username) . "'";
}
$sql .= $letter_sql ? " AND {$letter_sql}" : '';
$sql .= " ORDER BY {$order_by}";
if ($result = DB()->fetch_rowset($sql)) {
    foreach ($result as $i => $row) {
        $user_id = $row['user_id'];
        $from = $row['user_from'];
        $joined = bb_date($row['user_regdate'], $bb_cfg['date_format']);
        $posts = $row['user_posts'];
        $pm = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "={$user_id}") . '">' . $lang['SEND_PM_TXTB'] . '</a>' : '<a href="' . (PM_URL . "?mode=post&amp;" . POST_USERS_URL . "={$user_id}") . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['SEND_PRIVATE_MESSAGE'] . '" title="' . $lang['SEND_PRIVATE_MESSAGE'] . '" border="0" /></a>';
        if (bf($row['user_opt'], 'user_opt', 'user_viewemail') || IS_ADMIN) {
            $email_uri = $bb_cfg['board_email_form'] ? "profile.php?mode=email&amp;" . POST_USERS_URL . "={$user_id}" : 'mailto:' . $row['user_email'];
            $email = '<a class="editable" href="' . $email_uri . '">' . $row['user_email'] . '</a>';
        } else {
            $email = '';
        }
        if ($row['user_website']) {
            $www = $bb_cfg['text_buttons'] ? '<a class="txtb" href="' . $row['user_website'] . '"  target="_userwww">' . $lang['VISIT_WEBSITE_TXTB'] . '</a>' : '<a class="txtb" href="' . $row['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['VISIT_WEBSITE'] . '" title="' . $lang['VISIT_WEBSITE'] . '" border="0" /></a>';
        } else {
            $www = '';
        }
        $row_class = !($i % 2) ? 'row1' : 'row2';
        $template->assign_block_vars('memberrow', array('ROW_NUMBER' => $i + ($start + 1), 'ROW_CLASS' => $row_class, 'USER' => profile_url($row), 'FROM' => $from, 'JOINED_RAW' => $row['user_regdate'], 'JOINED' => $joined, 'POSTS' => $posts, 'PM' => $pm, 'EMAIL' => $email, 'WWW' => $www, 'U_VIEWPROFILE' => PROFILE_URL . $user_id));
Esempio n. 28
0
$sql = "SELECT forum_name, allow_reg_tracker, forum_tpl_id FROM " . BB_FORUMS . " WHERE forum_id = {$forum_id} LIMIT 1";
if (!$forum_id or !($f_data = DB()->fetch_row($sql))) {
    bb_die($lang['FORUM_NOT_EXIST']);
}
// tpl_data
$tpl_data = array();
$sql = "SELECT * FROM " . BB_TOPIC_TPL . " WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1";
if (!$f_data['forum_tpl_id'] or !($tpl_data = DB()->fetch_row($sql))) {
    if (!$edit_tpl_mode) {
        redirect(POSTING_URL . "?mode=newtopic&f={$forum_id}");
    }
}
$template->assign_vars(array('PAGE_TITLE' => $lang['NEW_RELEASE'], 'FORUM_NAME' => $f_data['forum_name'], 'FORUM_ID' => $forum_id, 'TPL_FORM_ACTION' => POSTING_URL . "?mode=newtopic&amp;f={$forum_id}", 'REGULAR_TOPIC_HREF' => POSTING_URL . "?mode=newtopic&amp;f={$forum_id}", 'TOR_REQUIRED' => $f_data['allow_reg_tracker'], 'EDIT_TPL' => $edit_tpl_mode, 'CAN_EDIT_TPL' => $can_edit_tpl, 'EDIT_TPL_URL' => POSTING_URL . "?mode=new_rel&amp;f={$forum_id}&amp;edit_tpl=1"));
if ($tpl_data) {
    // tpl_rules_html
    $tpl_rules_html = '';
    if ($tpl_data['tpl_rules_post_id']) {
        if (!($tpl_rules_html = bbcode2html(DB()->fetch_row("SELECT post_text FROM " . BB_POSTS_TEXT . " WHERE post_id = " . $tpl_data['tpl_rules_post_id'], 'post_text')))) {
            $tpl_data['tpl_rules_post_id'] = 0;
            DB()->query("UPDATE " . BB_TOPIC_TPL . " SET tpl_rules_post_id = 0 WHERE tpl_id = {$f_data['forum_tpl_id']} LIMIT 1");
        }
    }
    $template->assign_vars(array('TPL_ID' => $tpl_data['tpl_id'], 'TPL_NAME' => $tpl_data['tpl_name'], 'TPL_SRC_FORM_VAL' => $tpl_data['tpl_src_form'], 'TPL_SRC_TITLE_VAL' => $tpl_data['tpl_src_title'], 'TPL_SRC_MSG_VAL' => $tpl_data['tpl_src_msg'], 'TPL_RULES_HTML' => $tpl_rules_html));
}
if ($edit_tpl_mode) {
    $template->assign_vars(array('NO_TPL_ASSIGNED' => !$f_data['forum_tpl_id'], 'TPL_SELECT' => get_select('forum_tpl', $f_data['forum_tpl_id'])));
    if ($tpl_data) {
        $template->assign_vars(array('TPL_COMMENT' => $tpl_data['tpl_comment'], 'TPL_RULES_POST_ID' => $tpl_data['tpl_rules_post_id'], 'TPL_LAST_EDIT_TIME' => bb_date($tpl_data['tpl_last_edit_tm'], 'd-M-y H:i'), 'TPL_LAST_EDIT_USER' => get_username(intval($tpl_data['tpl_last_edit_by'])), 'TPL_LAST_EDIT_TIMESTAMP' => $tpl_data['tpl_last_edit_tm']));
    }
}
print_page(TEMPLATES_DIR . 'posting_tpl.tpl');
Esempio n. 29
0
                    }
                    $row = DB()->sql_fetchrow($result);
                    DB()->sql_freeresult($result);
                    $post_title = $row['topic_title'];
                    if (strlen($post_title) > 32) {
                        $post_title = str_short($post_title, 30);
                    }
                    $view_topic = BB_ROOT . 'viewtopic.php?' . POST_POST_URL . '=' . $ids[$j]['post_id'] . '#' . $ids[$j]['post_id'];
                    $post_titles[] = '<a href="' . $view_topic . '" class="gen" target="_blank">' . $post_title . '</a>';
                } else {
                    $post_titles[] = $lang['PRIVATE_MESSAGE'];
                }
            }
            $post_titles = implode('<br />', $post_titles);
            $hidden_field = '<input type="hidden" name="attach_id_list[]" value="' . intval($attachments[$i]['attach_id']) . '" />';
            $template->assign_block_vars('attachrow', array('ROW_NUMBER' => $i + (@$_GET['start'] + 1), 'ROW_CLASS' => $row_class, 'FILENAME' => htmlspecialchars($attachments[$i]['real_filename']), 'COMMENT' => htmlspecialchars($attachments[$i]['comment']), 'EXTENSION' => $attachments[$i]['extension'], 'SIZE' => round($attachments[$i]['filesize'] / 1024, 2), 'DOWNLOAD_COUNT' => $attachments[$i]['download_count'], 'POST_TIME' => bb_date($attachments[$i]['filetime']), 'POST_TITLE' => $post_titles, 'S_DELETE_BOX' => $delete_box, 'S_HIDDEN' => $hidden_field, 'U_VIEW_ATTACHMENT' => BB_ROOT . DOWNLOAD_URL . $attachments[$i]['attach_id']));
        }
    }
    if (!$search_based && !$user_based) {
        if ($total_attachments == 0) {
            $sql = "SELECT attach_id FROM " . BB_ATTACHMENTS_DESC;
            if (!($result = DB()->sql_query($sql))) {
                bb_die('Could not query attachment description table');
            }
            $total_rows = DB()->num_rows($result);
            DB()->sql_freeresult($result);
        }
    }
}
// Generate Pagination
if ($do_pagination && $total_rows > $bb_cfg['topics_per_page']) {