Пример #1
0
 echo "</tr>\n<tr>\n<td valign='top' class='tbl2' style='width:140px'>\n";
 if ($data['user_avatar'] && file_exists(IMAGES . "avatars/" . $data['user_avatar'])) {
     echo "<img src='" . IMAGES . "avatars/" . $data['user_avatar'] . "' alt='" . $locale['567'] . "' /><br /><br />\n";
 }
 echo "<span class='small'>";
 if ($data['user_level'] >= 102) {
     echo $settings['forum_ranks'] ? show_forum_rank($data['user_posts'], $data['user_level']) : getuserlevel($data['user_level']);
 } else {
     $is_mod = false;
     foreach ($mod_groups as $mod_group) {
         if (!$is_mod && preg_match("(^\\.{$mod_group}\$|\\.{$mod_group}\\.|\\.{$mod_group}\$)", $data['user_groups'])) {
             $is_mod = true;
         }
     }
     if ($settings['forum_ranks']) {
         echo $is_mod ? show_forum_rank($data['user_posts'], 104) : show_forum_rank($data['user_posts'], $data['user_level']);
     } else {
         echo $is_mod ? $locale['user1'] : getuserlevel($data['user_level']);
     }
 }
 echo "</span><br /><br />\n";
 echo "<!--forum_thread_user_info--><span class='small'><strong>" . $locale['502'] . "</strong> " . $data['user_posts'] . "</span><br />\n";
 echo "<span class='small'><strong>" . $locale['504'] . "</strong> " . showdate("%d.%m.%y", $data['user_joined']) . "</span><br />\n";
 echo "<br /></td>\n<td valign='top' class='tbl1'>\n";
 if (iMOD) {
     echo "<div style='float:right'><input type='checkbox' name='delete_post[]' value='" . $data['post_id'] . "' /></div>\n";
 }
 echo nl2br(parseubb($message));
 echo "<!--sub_forum_post_message-->";
 if ($data['attach_id']) {
     if (in_array($data['attach_ext'], $imagetypes) && @getimagesize(FORUM . "attachments/" . $data['attach_name'])) {
Пример #2
0
 /**
  * Get thread posts info
  */
 private function get_thread_post()
 {
     global $forum_settings, $locale, $userdata;
     $user_sig_module = \PHPFusion\UserFields::check_user_field('user_sig');
     $user_web_module = \PHPFusion\UserFields::check_user_field('user_web');
     $userid = isset($userdata['user_id']) ? (int) $userdata['user_id'] : 0;
     switch ($this->thread_info['section']) {
         case 'oldest':
             $sortCol = 'post_datestamp ASC';
             break;
         case 'latest':
             $sortCol = 'post_datestamp DESC';
             break;
         case 'high':
             $sortCol = 'vote_points DESC';
             break;
         default:
             $sortCol = 'post_datestamp ASC';
     }
     // @todo: where to calculate has voted without doing it in while loop?
     require_once INCLUDES . "mimetypes_include.php";
     $result = dbquery("\n\t\t\t\t\tSELECT p.*,\n\t\t\t\t\tt.thread_id,\n\t\t\t\t\tu.user_id, u.user_name, u.user_status, u.user_avatar, u.user_level, u.user_posts, u.user_groups, u.user_joined, u.user_lastvisit, u.user_ip,\n\t\t\t\t\t" . ($user_sig_module ? " u.user_sig," : "") . ($user_web_module ? " u.user_web," : "") . "\n\t\t\t\t\tu2.user_name AS edit_name, u2.user_status AS edit_status,\n\t\t\t\t\tcount(a1.attach_id) 'attach_image_count',\n\t\t\t\t\tcount(a2.attach_id) 'attach_files_count',\n\t\t\t\t\tSUM(v.vote_points) as vote_points, count(v2.thread_id) as has_voted\n\t\t\t\t\tFROM " . DB_FORUM_POSTS . " p\n\t\t\t\t\tINNER JOIN " . DB_FORUM_THREADS . " t ON t.thread_id = p.thread_id\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v ON v.post_id = p.post_id\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_VOTES . " v2 on v2.thread_id = p.thread_id AND v2.vote_user = '******'\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " u ON p.post_author = u.user_id\n\t\t\t\t\tLEFT JOIN " . DB_USERS . " u2 ON p.post_edituser = u2.user_id AND post_edituser > '0'\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a1 on a1.post_id = p.post_id AND a1.attach_mime IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\tLEFT JOIN " . DB_FORUM_ATTACHMENTS . " a2 on a2.post_id = p.post_id AND a2.attach_mime NOT IN ('" . implode(",", img_mimeTypes()) . "')\n\t\t\t\t\tWHERE p.thread_id='" . intval($_GET['thread_id']) . "' AND post_hidden='0'\n\t\t\t\t\t" . ($this->thread_info['thread']['forum_type'] == '4' ? "OR p.post_id='" . intval($this->thread_info['post_firstpost']) . "'" : '') . "\n\t\t\t\t\tGROUP by p.post_id\n\t\t\t\t\tORDER BY {$sortCol} LIMIT " . intval($_GET['rowstart']) . ", " . intval($forum_settings['posts_per_page']));
     $this->thread_info['post_rows'] = dbrows($result);
     if ($this->thread_info['post_rows'] > 0) {
         /* Set Threads Navigation */
         $this->thread_info['thread_posts'] = format_word($this->thread_info['post_rows'], $locale['fmt_post']);
         $this->thread_info['page_nav'] = '';
         if ($this->thread_info['max_post_items'] > $this->thread_info['posts_per_page']) {
             $this->thread_info['page_nav'] = "<div class='pull-right'>" . makepagenav($_GET['rowstart'], $this->thread_info['posts_per_page'], $this->thread_info['max_post_items'], 3, INFUSIONS . "forum/viewthread.php?thread_id=" . $this->thread_info['thread']['thread_id'] . (isset($_GET['highlight']) ? "&amp;highlight=" . urlencode($_GET['highlight']) : '') . "&amp;") . "</div>";
         }
         $i = 1;
         while ($pdata = dbarray($result)) {
             // Format Post Message
             $post_message = $pdata['post_smileys'] ? parsesmileys($pdata['post_message']) : $pdata['post_message'];
             $post_message = nl2br(parseubb($post_message));
             if (isset($_GET['highlight'])) {
                 $post_message = "<div class='search_result'>" . $post_message . "</div>\n";
             }
             // Marker
             $marker = array('link' => "#post_" . $pdata['post_id'], "title" => "#" . ($i + $_GET['rowstart']), 'id' => "post_" . $pdata['post_id']);
             $post_marker = "<a class='marker' href='" . $marker['link'] . "' id='" . $marker['id'] . "'>" . $marker['title'] . "</a>";
             $post_marker .= "<a title='" . $locale['forum_0241'] . "' href='#top'><i class='entypo up-open'></i></a>\n";
             // Post Attachments
             $post_attachments = "";
             if ($pdata['attach_files_count'] || $pdata['attach_image_count']) {
                 if ($this->getThreadPermission("can_download_attach")) {
                     $attachResult = dbquery("SELECT * FROM " . DB_FORUM_ATTACHMENTS . " WHERE post_id='" . intval($pdata['post_id']) . "'");
                     if (dbrows($attachResult) > 0) {
                         $aImage = "";
                         $aFiles = "";
                         while ($attachData = dbarray($attachResult)) {
                             if (in_array($attachData['attach_mime'], img_mimeTypes())) {
                                 $aImage .= display_image_attach($attachData['attach_name'], "50", "50", $pdata['post_id']) . "\n";
                             } else {
                                 $aFiles .= "<div class='display-inline-block'><i class='entypo attach'></i><a href='" . FUSION_SELF . "?thread_id=" . $pdata['thread_id'] . "&amp;getfile=" . $attachData['attach_id'] . "'>" . $attachData['attach_name'] . "</a>&nbsp;";
                                 $aFiles .= "[<span class='small'>" . parsebytesize(filesize(INFUSIONS . "forum/attachments/" . $attachData['attach_name'])) . " / " . $attachData['attach_count'] . $locale['forum_0162'] . "</span>]</div>\n";
                             }
                         }
                         if (!empty($aFiles)) {
                             $post_attachments .= "<div class='emulated-fieldset'>\n";
                             $post_attachments .= "<span class='emulated-legend'>" . profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']) . $locale['forum_0154'] . ($pdata['attach_files_count'] > 1 ? $locale['forum_0158'] : $locale['forum_0157']) . "</span>\n";
                             $post_attachments .= "<div class='attachments-list m-t-10'>" . $aFiles . "</div>\n";
                             $post_attachments .= "</div>\n";
                         }
                         if (!empty($aImage)) {
                             $post_attachments .= "<div class='emulated-fieldset'>\n";
                             $post_attachments .= "<span class='emulated-legend'>" . profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']) . $locale['forum_0154'] . ($pdata['attach_image_count'] > 1 ? $locale['forum_0156'] : $locale['forum_0155']) . "</span>\n";
                             $post_attachments .= "<div class='attachments-list'>" . $aImage . "</div>\n";
                             $post_attachments .= "</div>\n";
                             if (!defined('COLORBOX')) {
                                 define('COLORBOX', TRUE);
                                 add_to_head("<link rel='stylesheet' href='" . INCLUDES . "jquery/colorbox/colorbox.css' type='text/css' media='screen' />");
                                 add_to_head("<script type='text/javascript' src='" . INCLUDES . "jquery/colorbox/jquery.colorbox.js'></script>");
                                 add_to_jquery("\$('a[rel^=\"attach\"]').colorbox({ current: '" . $locale['forum_0159'] . " {current} " . $locale['forum_0160'] . " {total}',width:'80%',height:'80%'});");
                             }
                         }
                     } else {
                         $post_attachments = "Failed to fetch the attachment";
                     }
                 } else {
                     $post_attachments = "<small><i class='fa fa-clipboard'></i> " . $locale['forum_0184'] . "</small>\n";
                 }
             }
             $pdata += array("user_online" => $pdata['user_lastvisit'] >= time() - 3600 ? TRUE : FALSE, "is_first_post" => $pdata['post_id'] == $this->thread_info['post_firstpost'] ? TRUE : FALSE, "is_last_post" => $pdata['post_id'] == $this->thread_info['post_lastpost'] ? TRUE : FALSE, "user_profile_link" => profile_link($pdata['user_id'], $pdata['user_name'], $pdata['user_status']), "user_avatar_image" => display_avatar($pdata, '40px', FALSE, FALSE, 'img-rounded'), "user_ip" => $forum_settings['forum_ips'] && iMOD ? $locale['forum_0268'] . ' ' . $pdata['post_ip'] : '', "user_post_count" => format_word($pdata['user_posts'], $locale['fmt_post']), "print" => array('link' => BASEDIR . "print.php?type=F&amp;item_id=" . $_GET['thread_id'] . "&amp;post=" . $pdata['post_id'] . "&amp;nr=" . ($i + $_GET['rowstart']), 'title' => $locale['forum_0179']), "post_marker" => $post_marker, "marker" => $marker, "post_attachments" => $post_attachments);
             $pdata['post_message'] = $post_message;
             /**
              * User Stuffs, Sig, User Message, Web
              */
             // Quote & Edit Link
             if ($this->getThreadPermission("can_reply")) {
                 if (!$this->thread_info['thread']['thread_locked']) {
                     $pdata['post_quote'] = array('link' => INFUSIONS . "forum/viewthread.php?action=reply&amp;forum_id=" . $pdata['forum_id'] . "&amp;thread_id=" . $pdata['thread_id'] . "&amp;post_id=" . $pdata['post_id'] . "&amp;quote=" . $pdata['post_id'], 'title' => $locale['forum_0266']);
                     if (iMOD || ($forum_settings['forum_edit_lock'] == TRUE && $pdata['is_last_post'] || $forum_settings['forum_edit_lock'] == FALSE) && $userdata['user_id'] == $pdata['post_author'] && ($forum_settings['forum_edit_timelimit'] <= 0 || time() - $forum_settings['forum_edit_timelimit'] * 60 < $pdata['post_datestamp'])) {
                         $pdata['post_edit'] = array('link' => INFUSIONS . "forum/viewthread.php?action=edit&amp;forum_id=" . $pdata['forum_id'] . "&amp;thread_id=" . $pdata['thread_id'] . "&amp;post_id=" . $pdata['post_id'], 'title' => $locale['forum_0265']);
                     }
                     $pdata['post_reply'] = array('link' => INFUSIONS . "forum/viewthread.php?action=reply&amp;forum_id=" . $pdata['forum_id'] . "&amp;thread_id=" . $pdata['thread_id'] . "&amp;post_id=" . $pdata['post_id'], 'title' => $locale['forum_0509']);
                 } elseif (iMOD) {
                     $pdata['post_edit'] = array('link' => INFUSIONS . "forum/viewthread.php?action=edit&amp;forum_id=" . $pdata['forum_id'] . "&amp;thread_id=" . $pdata['thread_id'] . "&amp;post_id=" . $pdata['post_id'], 'title' => $locale['forum_0265']);
                 }
             }
             // rank img
             if ($pdata['user_level'] <= USER_LEVEL_ADMIN) {
                 if ($forum_settings['forum_ranks']) {
                     $pdata['user_rank'] = show_forum_rank($pdata['user_posts'], $pdata['user_level'], $pdata['user_groups']);
                     // in fact now is get forum rank
                 } else {
                     $pdata['user_rank'] = getuserlevel($pdata['user_level']);
                 }
             } else {
                 if ($forum_settings['forum_ranks']) {
                     $pdata['user_rank'] = iMOD ? show_forum_rank($pdata['user_posts'], 104, $pdata['user_groups']) : show_forum_rank($pdata['user_posts'], $pdata['user_level'], $pdata['user_groups']);
                 } else {
                     $pdata['user_rank'] = iMOD ? $locale['userf1'] : getuserlevel($pdata['user_level']);
                 }
             }
             // Website
             if ($pdata['user_web'] && (iADMIN || $pdata['user_status'] != 6 && $pdata['user_status'] != 5)) {
                 $user_web_url_prefix = !preg_match("@^http(s)?\\:\\/\\/@i", $pdata['user_web']) ? "http://" . $pdata['user_web'] : $pdata['user_web'];
                 $pdata['user_web'] = array('link' => $user_web_url_prefix . $pdata['user_web'], 'title' => $locale['forum_0364']);
             } else {
                 $pdata['user_web'] = array('link' => '', 'title' => '');
             }
             // PM link
             $pdata['user_message'] = array('link' => '', 'title' => '');
             if (iMEMBER && $pdata['user_id'] != $userdata['user_id'] && (iADMIN || $pdata['user_status'] != 6 && $pdata['user_status'] != 5)) {
                 $pdata['user_message'] = array('link' => BASEDIR . 'messages.php?msg_send=' . $pdata['user_id'], "title" => $locale['send_message']);
             }
             // User Sig
             if ($pdata['user_sig'] && isset($pdata['post_showsig']) && $pdata['user_status'] != 6 && $pdata['user_status'] != 5) {
                 $pdata['user_sig'] = nl2br(parseubb(parsesmileys(stripslashes($pdata['user_sig'])), "b|i|u||center|small|url|mail|img|color"));
             } else {
                 $pdata['user_sig'] = "";
             }
             // Voting - need up or down link - accessible to author also the vote
             // answered and on going questions.
             // Answer rating
             $pdata['vote_message'] = '';
             //echo $data['forum_type'] == 4 ? "<br/>\n".(number_format($data['thread_postcount']-1)).$locale['forum_0365']."" : ''; // answers
             // form components
             $pdata['post_checkbox'] = iMOD ? "<input type='checkbox' name='delete_post[]' value='" . $pdata['post_id'] . "'/>" : '';
             $pdata['post_votebox'] = '';
             if ($this->thread_info['thread']['forum_type'] == 4) {
                 if ($this->getThreadPermission("can_rate")) {
                     // can vote.
                     $pdata['vote_up'] = array('link' => INFUSIONS . "forum/postify.php?post=voteup&amp;forum_id=" . $pdata['forum_id'] . "&amp;thread_id=" . $pdata['thread_id'] . "&amp;post_id=" . $pdata['post_id'], "title" => $locale['forum_0265']);
                     $pdata['vote_down'] = array('link' => INFUSIONS . "forum/postify.php?post=votedown&amp;forum_id=" . $pdata['forum_id'] . "&amp;thread_id=" . $pdata['thread_id'] . "&amp;post_id=" . $pdata['post_id'], "title" => $locale['forum_0265']);
                     $pdata['post_votebox'] = "<div class='text-center'>\n";
                     $pdata['post_votebox'] .= "<a href='" . $pdata['vote_up']['link'] . "' class='btn btn-default btn-xs m-b-5 p-5' title='" . $locale['forum_0265'] . "'>\n<i class='entypo up-dir icon-xs'></i></a>";
                     $pdata['post_votebox'] .= "<h3 class='m-0'>" . (!empty($pdata['vote_points']) ? $pdata['vote_points'] : 0) . "</h3>\n";
                     $pdata['post_votebox'] .= "<a href='" . $pdata['vote_down']['link'] . "' class='btn btn-default btn-xs m-t-5 p-5' title='" . $locale['forum_0265'] . "'>\n<i class='entypo down-dir icon-xs'></i></a>";
                     $pdata['post_votebox'] .= "</div>\n";
                 } else {
                     $pdata['post_votebox'] = "<div class='text-center'>\n";
                     $pdata['post_votebox'] .= "<h3 class='m-0'>" . (!empty($pdata['vote_points']) ? $pdata['vote_points'] : 0) . "</h3>\n";
                     $pdata['post_votebox'] .= "</div>\n";
                 }
             }
             // Edit Reason - NOT WORKING?
             $pdata['post_edit_reason'] = '';
             if ($pdata['post_edittime']) {
                 $edit_reason = "<div class='edit_reason m-t-10'><small>" . $locale['forum_0164'] . profile_link($pdata['post_edituser'], $pdata['edit_name'], $pdata['edit_status']) . $locale['forum_0167'] . showdate("forumdate", $pdata['post_edittime']) . "</small>\n";
                 if ($pdata['post_editreason'] && iMEMBER) {
                     $edit_reason .= "<br /><a id='reason_pid_" . $pdata['post_id'] . "' rel='" . $pdata['post_id'] . "' class='reason_button small' data-target='reason_div_pid_" . $pdata['post_id'] . "'>";
                     $edit_reason .= "<strong>" . $locale['forum_0165'] . "</strong>";
                     $edit_reason .= "</a>\n";
                     $edit_reason .= "<div id='reason_div_pid_" . $pdata['post_id'] . "' class='reason_div small'>" . $pdata['post_editreason'] . "</div>\n";
                 }
                 $edit_reason .= "</div>\n";
                 $pdata['post_edit_reason'] = $edit_reason;
                 $this->edit_reason = TRUE;
             }
             // Custom Post Message Link/Buttons
             $pdata['post_links'] = '';
             $pdata['post_links'] .= !empty($pdata['post_quote']) ? "<a class='btn btn-xs btn-default' title='" . $pdata['post_quote']["title"] . "' href='" . $pdata['post_quote']['link'] . "'>" . $pdata['post_quote']['title'] . "</a>\n" : '';
             $pdata['post_links'] .= !empty($pdata['post_edit']) ? "<a class='btn btn-xs btn-default' title='" . $pdata['post_edit']["title"] . "' href='" . $pdata['post_edit']['link'] . "'>" . $pdata['post_edit']['title'] . "</a>\n" : '';
             $pdata['post_links'] .= !empty($pdata['print']) ? "<a class='btn btn-xs btn-default' title='" . $pdata['print']["title"] . "' href='" . $pdata['print']['link'] . "'>" . $pdata['print']['title'] . "</a>\n" : '';
             $pdata['post_links'] .= !empty($pdata['user_web']) ? "<a class='btn btn-xs btn-default' class='forum_user_actions' href='" . $pdata['user_web']['link'] . "' target='_blank'>" . $pdata['user_web']['title'] . "</a>\n" : '';
             $pdata['post_links'] .= !empty($pdata['user_message']) ? "<a class='btn btn-xs btn-default' href='" . $pdata['user_message']['link'] . "' target='_blank'>" . $pdata['user_message']['title'] . "</a>\n" : '';
             // Post Date
             $pdata['post_date'] = $locale['forum_0524'] . " " . timer($pdata['post_datestamp']) . " - " . showdate('forumdate', $pdata['post_datestamp']);
             $pdata['post_shortdate'] = $locale['forum_0524'] . " " . timer($pdata['post_datestamp']);
             $pdata['post_longdate'] = $locale['forum_0524'] . " " . showdate('forumdate', $pdata['post_datestamp']);
             $this->thread_info['post_items'][$pdata['post_id']] = $pdata;
             $i++;
         }
     }
 }
Пример #3
0
     echo $data['user_trank'] . "<br />\n";
 }
 echo "<span class='small'>";
 if (in_array($data['user_status'], $banned)) {
     echo "<strong><span style='color:#FF0000;font-size:15px;'>" . $locale['414'] . "</span></strong>";
 } elseif ($data['user_level'] >= nMODERATOR) {
     echo $settings['forum_ranks'] ? show_forum_rank($data['user_posts'], $data['user_level']) : getuserlevel($data['user_level']);
 } else {
     $is_mod = false;
     foreach ($mod_groups as $mod_group) {
         if (!$is_mod && preg_match("(^\\.{$mod_group}\$|\\.{$mod_group}\\.|\\.{$mod_group}\$)", $data['user_groups'])) {
             $is_mod = true;
         }
     }
     if ($settings['forum_ranks']) {
         echo $is_mod ? show_forum_rank($data['user_posts'], nMODERATOR) : show_forum_rank($data['user_posts'], $data['user_level'], $data['user_groups']);
         // Pimped: Group Ranks
     } else {
         echo $is_mod ? $locale['userf1'] : getuserlevel($data['user_level']);
     }
 }
 echo "</span><br /><br />\n";
 echo "<!--forum_thread_user_info-->";
 echo "<span class='small'><strong>" . $locale['502'] . "</strong> " . $data['user_posts'] . "</span><br />\n";
 echo "<span class='small'><strong>" . $locale['504'] . "</strong> " . showdate("%d.%m.%y", $data['user_joined']) . "</span><br />\n";
 if (array_key_exists("user_location", $data) && $data['user_location'] != "") {
     echo "<span class='small'><strong>" . $locale['503'] . "</strong>  " . $data['user_location'] . "</span><br />\n";
 }
 if (array_key_exists("user_sex", $data) && $data['user_sex'] != "" && $data['user_sex'] >= 1) {
     echo "<span class='small'><strong>" . $locale['503e'] . "</strong>  " . ($data['user_sex'] == 1 ? $locale['503g'] : $locale['503f']) . "</span><br />\n";
 }
Пример #4
0
 function renderMods($image = 1, $text = 1)
 {
     global $data, $mod_groups, $settings;
     if ($data['user_level'] >= 102) {
         echo $settings['forum_ranks'] ? show_forum_rank($data['user_posts'], $data['user_level'], $image, $text) : getuserlevel($data['user_level']);
     } else {
         foreach ($mod_groups as $mod_group) {
             $is_mod = false;
             if (!$is_mod && preg_match("(^\\.{$mod_group}\$|\\.{$mod_group}\\.|\\.{$mod_group}\$)", $data['user_groups'])) {
                 $is_mod = true;
             }
         }
         if ($settings['forum_ranks']) {
             echo $is_mod ? show_forum_rank($data['user_posts'], 104, $image, $text) : show_forum_rank($data['user_posts'], $data['user_level'], $image, $text);
         } else {
             echo $is_mod ? $locale['user1'] : getuserlevel($data['user_level']);
         }
     }
 }