示例#1
0
                 thread_set_closed($t_tid, false);
             }
             if (isset($t_sticky) && $t_sticky == "Y") {
                 thread_set_sticky($t_tid, true);
             } else {
                 thread_set_sticky($t_tid, false);
             }
         }
     }
     if ($t_tid > 0) {
         if ($allow_sig == true && strlen(trim($t_sig)) > 0) {
             $t_content .= "<div class=\"sig\">{$t_sig}</div>";
         }
         $new_pid = post_create($t_fid, $t_tid, $t_rpid, $uid, $t_to_uid, $t_content);
         if ($new_pid > -1) {
             $user_rel = user_get_relationship($t_to_uid, $uid);
             if ($high_interest == "Y") {
                 thread_set_high_interest($t_tid);
             }
             if (!session::check_perm(USER_PERM_WORMED, 0) && !($user_rel & USER_IGNORED_COMPLETELY)) {
                 $exclude_user_array = array($t_to_uid, $uid);
                 $thread_modified = isset($thread_data['MODIFIED']) && is_numeric($thread_data['MODIFIED']) ? $thread_data['MODIFIED'] : 0;
                 email_sendnotification($t_to_uid, $uid, $t_tid, $new_pid);
                 email_send_folder_subscription($uid, $t_fid, $t_tid, $new_pid, $thread_modified, $exclude_user_array);
                 email_send_thread_subscription($uid, $t_tid, $new_pid, $thread_modified, $exclude_user_array);
             }
             post_save_attachment_id($t_tid, $new_pid, $aid);
         }
     }
 } else {
     $new_pid = 0;
示例#2
0
function poll_display($tid, $msg_count, $first_msg, $folder_fid, $in_list = true, $closed = false, $limit_text = true, $show_sigs = true, $is_preview = false, $highlight_array = array())
{
    $webtag = get_webtag();
    $total_votes = 0;
    $user_votes = 0;
    $guest_votes = 0;
    $poll_data = poll_get($tid);
    $poll_results = poll_get_votes($tid);
    $user_poll_votes_array = poll_get_user_votes($tid);
    poll_get_total_votes($tid, $total_votes, $user_votes, $guest_votes);
    $request_uri = get_request_uri();
    $poll_display = "<br />\n";
    $poll_display .= "<div align=\"center\">\n";
    $poll_display .= "  <table class=\"box\" cellpadding=\"0\" cellspacing=\"0\" width=\"580\">\n";
    $poll_display .= "    <tr>\n";
    $poll_display .= "      <td align=\"center\">\n";
    $poll_display .= "        <form accept-charset=\"utf-8\" method=\"post\" action=\"{$request_uri}\" target=\"_self\">\n";
    $poll_display .= "          " . form_input_hidden("webtag", htmlentities_array($webtag)) . "\n";
    $poll_display .= "          " . form_input_hidden('tid', htmlentities_array($tid)) . "\n";
    $poll_display .= "          <table width=\"560\">\n";
    if ((!is_array($user_poll_votes_array) || $poll_data['CHANGEVOTE'] == POLL_VOTE_MULTI) && (session::get_value('UID') > 0 || $poll_data['ALLOWGUESTS'] == POLL_GUEST_ALLOWED && forum_get_setting('poll_allow_guests', 'Y')) && ($poll_data['CLOSES'] == 0 || $poll_data['CLOSES'] > time()) && !$is_preview) {
        foreach ($poll_results as $question_id => $poll_question) {
            $poll_display .= "          <tr>\n";
            $poll_display .= "            <td align=\"left\"><h2>" . word_filter_add_ob_tags($poll_question['QUESTION'], true) . "</h2></td>\n";
            $poll_display .= "          </tr>\n";
            $poll_display .= "          <tr>\n";
            $poll_display .= "            <td align=\"left\">\n";
            $poll_display .= "              <table width=\"100%\">\n";
            if ($poll_data['OPTIONTYPE'] == POLL_OPTIONS_DROPDOWN) {
                $dropdown_options_array = array_map('poll_dropdown_options_callback', $poll_question['OPTIONS_ARRAY']);
                $poll_display .= "                <tr>\n";
                $poll_display .= "                  <td align=\"left\" class=\"postbody\" valign=\"top\">" . form_dropdown_array("pollvote[{$question_id}]", $dropdown_options_array) . "</td>\n";
                $poll_display .= "                </tr>\n";
            } else {
                foreach ($poll_question['OPTIONS_ARRAY'] as $option_id => $option) {
                    if (sizeof($poll_question['OPTIONS_ARRAY']) == 1 || $poll_question['ALLOW_MULTI'] == 'Y') {
                        $poll_display .= "                <tr>\n";
                        $poll_display .= "                  <td align=\"left\" class=\"postbody\" valign=\"top\" width=\"1%\">" . form_checkbox("pollvote[{$question_id}][{$option_id}]", 'Y', word_filter_add_ob_tags($option['OPTION_NAME']), false) . "</td>\n";
                        $poll_display .= "                </tr>\n";
                    } else {
                        $poll_display .= "                <tr>\n";
                        $poll_display .= "                  <td align=\"left\" class=\"postbody\" valign=\"top\" width=\"1%\">" . form_radio("pollvote[{$question_id}]", $option_id, word_filter_add_ob_tags($option['OPTION_NAME']), false) . "</td>\n";
                        $poll_display .= "                </tr>\n";
                    }
                }
            }
            $poll_display .= "              </table>\n";
            $poll_display .= "            </td>\n";
            $poll_display .= "          </tr>\n";
        }
    } else {
        if ($poll_data['SHOWRESULTS'] == POLL_SHOW_RESULTS || $poll_data['CLOSES'] > 0 && $poll_data['CLOSES'] < time()) {
            if ($poll_data['POLLTYPE'] == POLL_TABLE_GRAPH && $poll_data['VOTETYPE'] != POLL_VOTE_PUBLIC) {
                $poll_display .= "            <tr>\n";
                $poll_display .= "              <td align=\"left\" colspan=\"2\">" . poll_table_graph($poll_results, $total_votes) . "</td>\n";
                $poll_display .= "             </tr>\n";
            } else {
                foreach ($poll_results as $question_id => $poll_question) {
                    $poll_display .= "           <tr>\n";
                    $poll_display .= "               <td align=\"left\"><h2>" . word_filter_add_ob_tags($poll_question['QUESTION'], true) . "</h2></td>\n";
                    $poll_display .= "            </tr>\n";
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td align=\"left\">\n";
                    $poll_display .= "                <table width=\"100%\">\n";
                    if ($poll_data['POLLTYPE'] == POLL_HORIZONTAL_GRAPH || $poll_data['VOTETYPE'] == POLL_VOTE_PUBLIC) {
                        $poll_display .= "                  <tr>\n";
                        $poll_display .= "                    <td align=\"left\" colspan=\"2\">" . poll_horizontal_graph($poll_question['OPTIONS_ARRAY'], $poll_data, $total_votes) . "</td>\n";
                        $poll_display .= "                   </tr>\n";
                    } else {
                        $poll_display .= "                  <tr>\n";
                        $poll_display .= "                    <td align=\"left\" colspan=\"2\">" . poll_vertical_graph($poll_question['OPTIONS_ARRAY'], $total_votes) . "</td>\n";
                        $poll_display .= "                  </tr>\n";
                    }
                    $poll_display .= "                </table>\n";
                    $poll_display .= "              </td>\n";
                    $poll_display .= "            </tr>\n";
                }
            }
        } else {
            foreach ($poll_results as $question_id => $poll_question) {
                $poll_display .= "            <tr>\n";
                $poll_display .= "              <td align=\"left\"><h2>" . word_filter_add_ob_tags($poll_question['QUESTION'], true) . "</h2></td>\n";
                $poll_display .= "            </tr>\n";
                $poll_display .= "            <tr>\n";
                $poll_display .= "              <td align=\"left\">\n";
                $poll_display .= "                <table width=\"100%\">\n";
                foreach ($poll_question['OPTIONS_ARRAY'] as $option_id => $option) {
                    $poll_display .= "                  <tr>\n";
                    $poll_display .= "                    <td align=\"left\" class=\"postbody\">" . word_filter_add_ob_tags($option['OPTION_NAME']) . "</td>\n";
                    $poll_display .= "                  </tr>\n";
                }
                $poll_display .= "                </table>\n";
                $poll_display .= "              </td>\n";
                $poll_display .= "            </tr>\n";
            }
        }
    }
    if (!$is_preview) {
        $poll_display .= "            <tr>\n";
        $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
        $poll_display .= "            </tr>\n";
        $poll_display .= "            <tr>\n";
        $poll_display .= "              <td align=\"left\" colspan=\"2\" class=\"postbody\">" . poll_format_vote_counts($poll_data, $user_votes, $guest_votes) . "</td>\n";
        $poll_display .= "            </tr>\n";
        $poll_display .= "            <tr>\n";
        $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
        $poll_display .= "            </tr>\n";
        if ($poll_data['CLOSES'] <= time() && $poll_data['CLOSES'] != 0) {
            $poll_display .= "            <tr>\n";
            $poll_display .= "              <td align=\"left\" colspan=\"2\" class=\"postbody\">" . gettext("Poll has ended.") . "</td>\n";
            $poll_display .= "            </tr>\n";
            if ($poll_data['VOTETYPE'] == POLL_VOTE_PUBLIC && $poll_data['CHANGEVOTE'] < POLL_VOTE_MULTI && $poll_data['POLLTYPE'] != POLL_TABLE_GRAPH) {
                $poll_display .= "            <tr>\n";
                $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>";
                $poll_display .= "            </tr>\n";
                $poll_display .= "            <tr>\n";
                $poll_display .= "              <td colspan=\"2\" align=\"center\"><a href=\"poll_results.php?webtag={$webtag}&amp;tid={$tid}\" class=\"button popup 800x600\"><span>" . gettext("Results") . "</span></a></td>\n";
                $poll_display .= "            </tr>\n";
                $poll_display .= "            <tr>\n";
                $poll_display .= "             <td align=\"left\" colspan=\"2\">&nbsp;</td>";
                $poll_display .= "             </tr>\n";
            }
            if (is_array($user_poll_votes_array) && sizeof($user_poll_votes_array) > 0) {
                $poll_display .= poll_display_user_votes($user_poll_votes_array);
            }
        } else {
            if (is_array($user_poll_votes_array) && sizeof($user_poll_votes_array) > 0) {
                $poll_display .= poll_display_user_votes($user_poll_votes_array);
                $poll_display .= "            <tr>\n";
                $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
                $poll_display .= "            </tr>\n";
                if ($poll_data['CHANGEVOTE'] == POLL_VOTE_MULTI) {
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td colspan=\"2\" align=\"center\">" . form_submit('pollsubmit', gettext("Vote")) . "</td>\n";
                    $poll_display .= "            </tr>\n";
                }
                $poll_display .= "            <tr>\n";
                $poll_display .= "              <td colspan=\"2\" align=\"center\">";
                if ($poll_data['SHOWRESULTS'] == POLL_SHOW_RESULTS && $total_votes > 0 || session::get_value('UID') == $poll_data['FROM_UID'] || session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_fid)) {
                    $poll_display .= "<a href=\"poll_results.php?webtag={$webtag}&amp;tid={$tid}\" class=\"button popup 800x600\"><span>" . gettext("Results") . "</span></a>";
                }
                if (session::get_value('UID') == $poll_data['FROM_UID'] || session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_fid)) {
                    $poll_display .= "&nbsp;<a href=\"close_poll.php?webtag={$webtag}&msg={$tid}.1\" class=\"button\" target=\"_parent\">" . gettext("End Poll") . "</a>";
                }
                $poll_display .= "              </td>\n";
                $poll_display .= "            </tr>\n";
                if ($poll_data['CHANGEVOTE'] != POLL_VOTE_CANNOT_CHANGE) {
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td colspan=\"2\" align=\"center\">" . form_submit('pollchangevote', gettext("Change vote")) . "</td>\n";
                    $poll_display .= "            </tr>\n";
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td colspan=\"2\" align=\"center\">&nbsp;</td>\n";
                    $poll_display .= "            </tr>\n";
                }
                if ($poll_data['VOTETYPE'] == POLL_VOTE_PUBLIC && $poll_data['CHANGEVOTE'] < POLL_VOTE_MULTI && $poll_data['POLLTYPE'] != POLL_TABLE_GRAPH) {
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td colspan=\"2\" align=\"center\" class=\"postbody\">" . gettext("<b>Warning</b>: This is a public ballot. Your name will be visible next to the option you vote for.") . "</td>\n";
                    $poll_display .= "            </tr>\n";
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td colspan=\"2\" align=\"center\">&nbsp;</td>\n";
                    $poll_display .= "            </tr>\n";
                }
            } else {
                if (session::get_value('UID') > 0 || $poll_data['ALLOWGUESTS'] == POLL_GUEST_ALLOWED && forum_get_setting('poll_allow_guests', 'Y')) {
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td colspan=\"2\" align=\"center\">" . form_submit('pollsubmit', gettext("Vote")) . "</td>\n";
                    $poll_display .= "            </tr>\n";
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td colspan=\"2\" align=\"center\">";
                    if ($poll_data['SHOWRESULTS'] == POLL_SHOW_RESULTS && $total_votes > 0 || session::get_value('UID') == $poll_data['FROM_UID'] || session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_fid)) {
                        $poll_display .= "<a href=\"poll_results.php?webtag={$webtag}&amp;tid={$tid}\" class=\"button popup 800x600\"><span>" . gettext("Results") . "</span></a>";
                    }
                    if (session::get_value('UID') == $poll_data['FROM_UID'] || session::check_perm(USER_PERM_FOLDER_MODERATE, $folder_fid)) {
                        $poll_display .= "&nbsp;<a href=\"close_poll.php?webtag={$webtag}&msg={$tid}.1\" class=\"button\" target=\"_parent\">" . gettext("End Poll") . "</a>";
                    }
                    $poll_display .= "              </td>\n";
                    $poll_display .= "            </tr>\n";
                    $poll_display .= "            <tr>\n";
                    $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>";
                    $poll_display .= "            </tr>\n";
                    if ($poll_data['VOTETYPE'] == POLL_VOTE_PUBLIC && $poll_data['CHANGEVOTE'] < POLL_VOTE_MULTI && $poll_data['POLLTYPE'] != POLL_TABLE_GRAPH) {
                        $poll_display .= "            <tr>\n";
                        $poll_display .= "              <td colspan=\"2\" align=\"center\" class=\"postbody\">" . gettext("<b>Warning</b>: This is a public ballot. Your name will be visible next to the option you vote for.") . "</td>\n";
                        $poll_display .= "            </tr>\n";
                        $poll_display .= "            <tr>\n";
                        $poll_display .= "              <td colspan=\"2\" align=\"center\">&nbsp;</td>\n";
                        $poll_display .= "            </tr>\n";
                    }
                }
            }
        }
    } else {
        if (is_array($user_poll_votes_array) && sizeof($user_poll_votes_array) > 0) {
            $poll_display .= "            <tr>\n";
            $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
            $poll_display .= "            </tr>\n";
            $poll_display .= "            <tr>\n";
            $poll_display .= "              <td align=\"left\" colspan=\"2\" class=\"postbody\">" . poll_format_vote_counts($poll_data, $user_votes, $guest_votes) . "</td>\n";
            $poll_display .= "            </tr>\n";
            $poll_display .= "            <tr>\n";
            $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
            $poll_display .= "            </tr>\n";
            $poll_display .= poll_display_user_votes($user_poll_votes_array);
            $poll_display .= "            <tr>\n";
            $poll_display .= "              <td align=\"left\" colspan=\"2\">&nbsp;</td>\n";
            $poll_display .= "            </tr>\n";
        }
    }
    $poll_display .= "          </table>\n";
    $poll_display .= "        </form>\n";
    $poll_display .= "      </td>\n";
    $poll_display .= "    </tr>\n";
    $poll_display .= "  </table>\n";
    $poll_display .= "</div>\n";
    $poll_display .= "<br />\n";
    $poll_data['CONTENT'] = $poll_display;
    $poll_data['FROM_RELATIONSHIP'] = user_get_relationship(session::get_value('UID'), $poll_data['FROM_UID']);
    message_display($tid, $poll_data, $msg_count, $first_msg, $folder_fid, $in_list, $closed, $limit_text, true, $show_sigs, $is_preview, $highlight_array);
}
示例#3
0
    if (user_rel_update($_SESSION['UID'], $peer_uid, $peer_relationship, $peer_nickname)) {
        header_redirect("{$ret}&relupdated=true");
        exit;
    } else {
        $error_msg_array[] = gettext("Relationship updated failed!");
        $valid = false;
    }
}
if (isset($_POST['reset_nickname_x']) || isset($_POST['reset_nickname_y'])) {
    $peer_nickname = user_get_nickname($peer_uid);
    $peer_relationship = user_get_peer_relationship($_SESSION['UID'], $peer_uid);
    user_rel_update($_SESSION['UID'], $peer_uid, $peer_relationship, $peer_nickname);
}
$peer_user_display = format_user_name($user_peer['LOGON'], $user_peer['NICKNAME']);
html_draw_top(array('title' => sprintf(gettext('User Relationship - %s'), $peer_user_display), 'class' => 'window_title'));
$peer_relationship = user_get_relationship($_SESSION['UID'], $peer_uid);
$peer_nickname = user_get_peer_nickname($_SESSION['UID'], $peer_uid);
echo "<h1>", gettext("User Relationship"), html_style_image('separator'), "<a href=\"user_profile.php?webtag={$webtag}&amp;uid={$peer_uid}\" target=\"_blank\" class=\"popup 650x500\">", word_filter_add_ob_tags($peer_user_display, true), "</a></h1>\n";
if (isset($error_msg_array) && sizeof($error_msg_array) > 0) {
    html_display_error_array($error_msg_array, '600', 'left');
} else {
    if ($peer_perms & USER_PERM_FOLDER_MODERATE && !session::check_perm(USER_PERM_CAN_IGNORE_ADMIN, 0)) {
        html_display_warning_msg(gettext("You cannot ignore this user, as they are a moderator."), '600', 'left');
    }
}
if (isset($_POST['preview_signature'])) {
    if (($t_sig_content = user_get_sig($peer_uid)) !== false) {
        $preview_message['RECIPIENTS'] = array();
        $preview_from_user = user_get($peer_uid);
        $preview_message['FROM_LOGON'] = $preview_from_user['LOGON'];
        $preview_message['FROM_NICKNAME'] = $preview_from_user['NICKNAME'];
示例#4
0
function email_send_pm_notification($tuid, $mid, $fuid)
{
    // Validate function arguments
    if (!is_numeric($tuid)) {
        return false;
    }
    if (!is_numeric($mid)) {
        return false;
    }
    if (!is_numeric($fuid)) {
        return false;
    }
    // Check the PM exists.
    if (!($pm_subject = pm_get_subject($mid, $tuid))) {
        return false;
    }
    // Get the Swift Mailer Transport
    if (!($transport = Swift_TransportFactory::get())) {
        return false;
    }
    //Create the Mailer using the returned Transport
    $mailer = Swift_Mailer::newInstance($transport);
    // Create a new message
    $message = Swift_MessageBeehive::newInstance();
    // Get Forum webtag
    $webtag = get_webtag();
    // Get the to user details
    if (!($to_user = user_get($tuid))) {
        return false;
    }
    // Get the from user details
    if (!($from_user = user_get($fuid))) {
        return false;
    }
    // Get the to user preferences
    if (!($to_user_prefs = user_get_prefs($tuid))) {
        return false;
    }
    // Get the relationship between the to and from user
    $user_rel = user_get_relationship($to_user['UID'], $from_user['UID']);
    // If the recipient is ignoring the sender bail out.
    if ($user_rel & USER_IGNORED_COMPLETELY) {
        return false;
    }
    // Validate the email address before we continue.
    if (!email_address_valid($to_user['EMAIL'])) {
        return false;
    }
    // Does the recipient want to receive email notifcations?
    if (!isset($to_user_prefs['PM_NOTIFY_EMAIL']) | $to_user_prefs['PM_NOTIFY_EMAIL'] != 'Y') {
        return false;
    }
    // Get the forum name, subject, recipient, author, thread title and generate
    // the messages link. Pass all of them through the recipient's word filter.
    $forum_name = word_filter_apply(forum_get_setting('forum_name', null, 'A Beehive Forum'), $tuid, true);
    $subject = word_filter_apply(sprintf(gettext("PM Notification from %s"), $forum_name), $tuid, true);
    $recipient = word_filter_apply(format_user_name($to_user['LOGON'], $to_user['NICKNAME']), $tuid, true);
    $message_author = word_filter_apply(format_user_name($from_user['LOGON'], $from_user['NICKNAME']), $tuid, true);
    $message_subject = word_filter_apply($pm_subject, $tuid, true);
    // Generate link to the forum itself
    $forum_link = html_get_forum_uri("index.php?webtag={$webtag}");
    // Generate the message link.
    $message_link = html_get_forum_uri("index.php?webtag={$webtag}&pmid={$mid}");
    // Generate the message body.
    $message_body = wordwrap(sprintf(gettext("Hello %s,\r\n\r\n%s posted a PM to you on %s.\r\n\r\nThe subject is: %s.\r\n\r\nTo read the message go to:\r\n%s\r\n\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nNote: If you do not wish to receive email notifications of new PM messages posted to you, go to: %s click My Controls then Email and Privacy, unselect the PM Notification checkbox and press Submit."), $recipient, $message_author, $forum_name, $message_subject, $message_link, $forum_link));
    // Add the recipient
    $message->setTo($to_user['EMAIL'], $recipient);
    // Set the subject
    $message->setSubject($subject);
    // Set the message body
    $message->setBody($message_body);
    // Send the email
    return $mailer->send($message) > 0;
}
示例#5
0
    if (isset($_GET['logon']) && strlen(trim($_GET['logon'])) > 0) {
        $logon = trim($_GET['logon']);
        if (($user_array = user_get_by_logon($logon)) !== false) {
            $uid = $user_array['UID'];
        }
    }
}
if (!isset($uid)) {
    html_draw_error(gettext("No user specified."));
}
// Get the Profile Sections.
$profile_sections = profile_sections_get();
// Get the user's profile data.
$user_profile = user_get_profile($uid);
// User relationship.
$peer_relationship = user_get_relationship($uid, $_SESSION['UID']);
// Popup title.
$page_title = format_user_name($user_profile['LOGON'], $user_profile['NICKNAME']);
html_draw_top(array('title' => $page_title, 'js' => array('js/user_profile.js'), 'base_target' => '_blank', 'pm_popup_disabled' => true, 'class' => 'window_title'));
echo "<div align=\"center\">\n";
echo "  <table width=\"600\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"center\" class=\"posthead\">\n";
echo "              <table class=\"profile_header\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "                <tr>\n";
echo "                  <td align=\"center\" width=\"95%\">\n";
echo "                    <table width=\"95%\">\n";
echo "                      <tr>\n";
示例#6
0
    if (isset($_GET['logon']) && strlen(trim($_GET['logon'])) > 0) {
        $logon = trim($_GET['logon']);
        if ($user_array = user_get_by_logon($logon)) {
            $uid = $user_array['UID'];
        }
    }
}
if (!isset($uid)) {
    html_draw_error(gettext("No user specified."));
}
// Get the Profile Sections.
$profile_sections = profile_sections_get();
// Get the user's profile data.
$user_profile = user_get_profile($uid);
// User relationship.
$peer_relationship = user_get_relationship($uid, session::get_value('UID'));
// Popup title.
$page_title = format_user_name($user_profile['LOGON'], $user_profile['NICKNAME']);
html_draw_top("title={$page_title}", "user_profile.js", "basetarget=_blank", 'pm_popup_disabled', 'class=window_title');
echo "<div align=\"center\">\n";
echo "  <table width=\"600\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "    <tr>\n";
echo "      <td align=\"left\">\n";
echo "        <table class=\"box\" width=\"100%\">\n";
echo "          <tr>\n";
echo "            <td align=\"center\" class=\"posthead\">\n";
echo "              <table class=\"profile_header\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo "                <tr>\n";
echo "                  <td align=\"center\" width=\"95%\">\n";
echo "                    <table width=\"95%\">\n";
echo "                      <tr>\n";
function user_get_profile_entries($uid)
{
    if (!($db = db::get())) {
        return false;
    }
    if (!is_numeric($uid)) {
        return false;
    }
    if (!($table_prefix = get_table_prefix())) {
        return false;
    }
    $user_profile_array = array();
    $session_uid = session::get_value('UID');
    $peer_relationship = user_get_relationship($uid, $session_uid);
    $user_friend = USER_FRIEND;
    $sql = "SELECT PROFILE_SECTION.PSID, PROFILE_ITEM.PIID, PROFILE_ITEM.NAME, ";
    $sql .= "PROFILE_ITEM.TYPE, PROFILE_ITEM.OPTIONS, USER_PROFILE.ENTRY, USER_PROFILE.PRIVACY ";
    $sql .= "FROM `{$table_prefix}PROFILE_SECTION` PROFILE_SECTION ";
    $sql .= "LEFT JOIN `{$table_prefix}PROFILE_ITEM` PROFILE_ITEM ";
    $sql .= "ON (PROFILE_ITEM.PSID = PROFILE_SECTION.PSID) ";
    $sql .= "LEFT JOIN `{$table_prefix}USER_PROFILE` USER_PROFILE ";
    $sql .= "ON (USER_PROFILE.PIID = PROFILE_ITEM.PIID AND USER_PROFILE.UID = '{$uid}' ";
    $sql .= "AND (USER_PROFILE.PRIVACY = 0 OR USER_PROFILE.UID = '{$session_uid}' ";
    $sql .= "OR (USER_PROFILE.PRIVACY = 1 AND ({$peer_relationship} & {$user_friend} > 0)))) ";
    $sql .= "WHERE USER_PROFILE.ENTRY IS NOT NULL ORDER BY PROFILE_SECTION.POSITION, ";
    $sql .= "PROFILE_ITEM.POSITION, PROFILE_ITEM.PIID";
    if (!($result = $db->query($sql))) {
        return false;
    }
    if ($result->num_rows == 0) {
        return false;
    }
    while ($user_profile_data = $result->fetch_assoc()) {
        if (strlen(trim($user_profile_data['ENTRY'])) > 0) {
            if ($user_profile_data['TYPE'] == PROFILE_ITEM_RADIO || $user_profile_data['TYPE'] == PROFILE_ITEM_DROPDOWN) {
                $profile_item_options_array = explode("\n", $user_profile_data['OPTIONS']);
                if (isset($profile_item_options_array[$user_profile_data['ENTRY']])) {
                    $user_profile_array[$user_profile_data['PSID']][$user_profile_data['PIID']] = $user_profile_data;
                }
            } else {
                $user_profile_array[$user_profile_data['PSID']][$user_profile_data['PIID']] = $user_profile_data;
            }
        }
    }
    return sizeof($user_profile_array) > 0 ? $user_profile_array : false;
}
示例#8
0
function light_poll_display($tid, $msg_count, $folder_fid, $in_list = true, $closed = false, $limit_text = true, $is_preview = false)
{
    $webtag = get_webtag();
    $total_votes = 0;
    $user_votes = 0;
    $guest_votes = 0;
    $poll_data = poll_get($tid);
    $poll_results = poll_get_votes($tid);
    $user_poll_votes_array = poll_get_user_votes($tid);
    poll_get_total_votes($tid, $total_votes, $user_votes, $guest_votes);
    $request_uri = get_request_uri();
    $poll_display = "<div class=\"poll\">\n";
    $poll_display .= "<form accept-charset=\"utf-8\" method=\"post\" action=\"{$request_uri}\" target=\"_self\">\n";
    $poll_display .= form_input_hidden('webtag', htmlentities_array($webtag));
    $poll_display .= form_input_hidden('tid', htmlentities_array($tid));
    if ((!is_array($user_poll_votes_array) || $poll_data['CHANGEVOTE'] == POLL_VOTE_MULTI) && (session::get_value('UID') > 0 || $poll_data['ALLOWGUESTS'] == POLL_GUEST_ALLOWED && forum_get_setting('poll_allow_guests', 'Y')) && ($poll_data['CLOSES'] == 0 || $poll_data['CLOSES'] > time()) && !$is_preview) {
        foreach ($poll_results as $question_id => $poll_question) {
            $poll_display .= "<h3>" . word_filter_add_ob_tags($poll_question['QUESTION'], true) . "</h3>\n";
            if ($poll_data['OPTIONTYPE'] == POLL_OPTIONS_DROPDOWN) {
                $dropdown_options_array = array_map('poll_dropdown_options_callback', $poll_question['OPTIONS_ARRAY']);
                $poll_display .= light_form_dropdown_array("pollvote[{$question_id}]", $dropdown_options_array);
            } else {
                foreach ($poll_question['OPTIONS_ARRAY'] as $option_id => $option) {
                    if (sizeof($poll_question['OPTIONS_ARRAY']) == 1 || $poll_question['ALLOW_MULTI'] == 'Y') {
                        $poll_display .= light_form_checkbox("pollvote[{$question_id}][{$option_id}]", 'Y', word_filter_add_ob_tags($option['OPTION_NAME']), false);
                    } else {
                        $poll_display .= light_form_radio("pollvote[{$question_id}]", $option_id, word_filter_add_ob_tags($option['OPTION_NAME']), false);
                    }
                }
            }
        }
    } else {
        if ($poll_data['SHOWRESULTS'] == POLL_SHOW_RESULTS || $poll_data['CLOSES'] > 0 && $poll_data['CLOSES'] < time()) {
            $poll_display .= "<div class=\"poll_results\">\n";
            foreach ($poll_results as $question_id => $poll_question) {
                $poll_display .= "<h3>" . word_filter_add_ob_tags($poll_question['QUESTION'], true) . "</h3>\n";
                $poll_display .= light_poll_graph_display($poll_question['OPTIONS_ARRAY']);
            }
            $poll_display .= "</div>\n";
        } else {
            $poll_display .= "<div class=\"poll_results\">\n";
            foreach ($poll_results as $question_id => $poll_question) {
                $poll_display .= "<h3>" . word_filter_add_ob_tags($poll_question['QUESTION'], true) . "</h3>\n";
                foreach ($poll_question['OPTIONS_ARRAY'] as $option_id => $option) {
                    $poll_display .= word_filter_add_ob_tags($option['OPTION_NAME']);
                }
            }
            $poll_display .= "</div>\n";
        }
    }
    if (!$is_preview) {
        $poll_display .= "<div class=\"poll_vote_counts\">" . poll_format_vote_counts($poll_data, $user_votes, $guest_votes) . "</div>\n";
        if ($poll_data['CLOSES'] <= time() && $poll_data['CLOSES'] != 0) {
            $poll_display .= "<div class=\"poll_vote_closed\">" . gettext("Poll has ended") . "</div>\n";
            if (is_array($user_poll_votes_array) && sizeof($user_poll_votes_array) > 0) {
                $poll_display .= poll_display_user_votes($user_poll_votes_array);
            }
        } else {
            if (is_array($user_poll_votes_array) && sizeof($user_poll_votes_array) > 0) {
                $poll_display .= poll_display_user_votes($user_poll_votes_array);
                if ($poll_data['CHANGEVOTE'] == POLL_VOTE_MULTI) {
                    $poll_display .= "<div class=\"poll_buttons\">" . light_form_submit('pollsubmit', gettext("Vote")) . "</div>";
                }
                if ($poll_data['CHANGEVOTE'] != POLL_VOTE_CANNOT_CHANGE) {
                    $poll_display .= "<div class=\"poll_buttons\">" . light_form_submit('pollchangevote', gettext("Change vote")) . "</div>\n";
                }
                if ($poll_data['VOTETYPE'] == POLL_VOTE_PUBLIC && $poll_data['CHANGEVOTE'] < POLL_VOTE_MULTI && $poll_data['POLLTYPE'] != POLL_TABLE_GRAPH) {
                    $poll_display .= "<div class=\"poll_type_warning\">" . gettext("<b>Warning</b>: This is a public ballot. Your name will be visible next to the option you vote for.") . "</div>\n";
                }
            } else {
                if (session::get_value('UID') > 0 || $poll_data['ALLOWGUESTS'] == POLL_GUEST_ALLOWED && forum_get_setting('poll_allow_guests', 'Y')) {
                    $poll_display .= "<div class=\"poll_buttons\">" . light_form_submit('pollsubmit', gettext("Vote")) . "</div>";
                    if ($poll_data['VOTETYPE'] == POLL_VOTE_PUBLIC && $poll_data['CHANGEVOTE'] < POLL_VOTE_MULTI && $poll_data['POLLTYPE'] != POLL_TABLE_GRAPH) {
                        $poll_display .= "<div class=\"poll_type_warning\">" . gettext("<b>Warning</b>: This is a public ballot. Your name will be visible next to the option you vote for.") . "</div>\n";
                    }
                }
            }
        }
    }
    $poll_display .= "</form>\n";
    $poll_display .= "</div>\n";
    $poll_data['CONTENT'] = $poll_display;
    $poll_data['FROM_RELATIONSHIP'] = user_get_relationship(session::get_value('UID'), $poll_data['FROM_UID']);
    light_message_display($tid, $poll_data, $msg_count, 1, $folder_fid, $in_list, $closed, $limit_text, true, $is_preview);
}