Request # head<= <=head bodyopts=>onLoad="check_replytype();updateFaqLink();" body<= '; $sort = 'ASC'; } my $spcatand = ''; if ($sp && ($find eq 'cnext' || $find eq 'cprev')) { my $spcatid = $sp->{_cat}->{'spcatid'} + 0; $spcatand = "AND spcatid=$spcatid"; } else { my @filter_cats = LJ::Support::filter_cats($remote, $cats); return "" unless @filter_cats; my $cats_in = join(",", map { $_->{'spcatid'} } @filter_cats); $spcatand = "AND spcatid IN ($cats_in)"; } my $clause = ""; $clause = "AND spid$op$spid" unless ($find eq 'first' || $find eq 'last'); my $dbr = LJ::get_db_reader(); my ($foundspid) = $dbr->selectrow_array("SELECT spid FROM support WHERE state='open' $spcatand $clause ". "ORDER BY spid $sort LIMIT 1"); if ($foundspid) { return BML::redirect("see_request.bml?id=$foundspid"); } else { my $goback = "Request #$spid p?>" if $sp; my $what = $find eq 'next' || $find eq 'cnext' ? 'next' : 'previous'; my $cat = "in the same category" if $find eq 'cnext' || $find eq 'cprev'; return "$goback"; } } unless ($sp) { return ""; } my $sth; my $auth = $FORM{'auth'}; my $email = $sp->{'reqemail'}; my $u = {}; my $clusterdown = 0; if ($sp->{'reqtype'} eq "user") { $u = LJ::load_userid($sp->{'requserid'}); # now do a check for a down cluster? my $dbr = LJ::get_cluster_reader($u); $clusterdown = 1 unless $dbr; $email = $u->{'email'}; LJ::load_user_props($u, "s1_lastn_style", "s1_calendar_style", "s1_day_style", "s1_friends_style", "stylesys", "s2_style", ) unless $clusterdown; } my $winner; # who closed it? if ($sp->{'state'} eq "closed") { my $dbr = LJ::get_db_reader(); $sth = $dbr->prepare("SELECT u.user, sp.points FROM useridmap u, supportpoints sp ". "WHERE u.userid=sp.userid AND sp.spid=?"); $sth->execute($spid); $winner = $sth->fetchrow_hashref; } # load category this request is in my $problemarea = $sp->{_cat}->{'catname'}; my $catkey = $sp->{_cat}->{'catkey'}; unless (LJ::Support::can_read($sp, $remote, $auth)) { return ""; } # helper variables for commonly called methods my $owner_mode = LJ::Support::can_close($sp, $remote, $auth) ? 1 : 0; my $helper_mode = LJ::Support::can_help($sp, $remote) ? 1 : 0; my $is_poster = LJ::Support::is_poster($sp, $remote, $auth) ? 1 : 0; # fix up the subject if needed eval { if ($sp->{'subject'} =~ /^=\?(utf-8)?/i) { my @subj_data; @subj_data = MIME::Words::decode_mimewords($sp->{'subject'}); if (scalar(@subj_data)) { if (!$1) { $sp->{'subject'} = Unicode::MapUTF8::to_utf8({-string=>$subj_data[0][0], -charset=>$subj_data[0][1]}); } else { $sp->{'subject'} = $subj_data[0][0]; } } } }; ### request info table my $ret = ""; $ret .= "
From: | "; if ($u->{'defaultpicid'} && $u->{'statusvis'} ne 'S') { my %pic; my $picid = $u->{'defaultpicid'}; LJ::load_userpics(\%pic, [ $u, $picid ]); $ret .= ""; $ret .= "{'height'}' align='absmiddle' hspace='3' border='0' alt='$u->{'user'}' />"; $ret .= ""; } # show requester name + email { my $visemail = $email; if ($sp->{_cat}->{'public_read'}) { $visemail =~ s/^.+\@/********\@/; } my $ename = $sp->{'reqtype'} eq 'user' ? LJ::ljuser($u) : LJ::ehtml($sp->{reqname}); # we show links to the history page if the user is a helper in this category or if it's a # private category and the person has supporthelp somewhere (which is the general rule of # thumb to use the history viewer) my $show_history = !$sp->{_cat}->{public_read} && LJ::check_priv($remote, 'supporthelp'); if ($helper_mode || $show_history) { $ret .= $sp->{reqtype} eq 'user' ? "$ename {user}\">$u->{name}" : "$ename"; $ret .= $owner_mode || $show_history ? " ($visemail)" : " ($visemail)"; } else { # default view $ret .= "$ename ($visemail)"; } } $ret .= " |
Uniq: | $uniq |
Account type: | "; $ret .= LJ::name_caps($u->{'caps'}) || "Unknown"; $ret .= " |
$LJ::SITENAMESHORT: | ";
if ($clusterdown) {
$ret .= "" .
"(unable to connect to cluster, some data temporarily unavailable) "; } # check isu because requests don't always come from users and sometimes we # fake the user hash if (LJ::isu($u) && $u->readonly) { $ret .= "" . "(this user is currently in read-only mode) "; } if ($u->{'userid'}) { $ret .= "username: {'user'} ljuserf?>"; $ret .= " style: "; if ($u->{'stylesys'} == 2) { $ret .= "(S2) "; if ($u->{'s2_style'}) { my $s2style = LJ::S2::load_style($u->{'s2_style'}); my $pub = LJ::S2::get_public_layers(); # cached foreach my $lay (sort { $a cmp $b } keys %{$s2style->{'layer'}}) { my $lid = $s2style->{'layer'}->{$lay}; $ret .= "$lay: "; $ret .= (defined $pub->{$lid} ? 'public' : 'user') . ", "; } } else { $ret .= "none"; } } else { $ret .= "(S1) "; foreach my $view (@LJ::views) { my $styid = $u->{"s1_${view}_style"}; my $viewuri = $view eq "lastn" ? "/users/$u->{'user'}/" : "/users/$u->{'user'}/$view"; if ($view eq "day") { my (undef,undef,undef,$dday,$dmon,$dyear) = localtime(time); $dyear+=1900; $dmon++; $dmon = $dmon <= 9 ? "0$dmon" : $dmon; $dday = $dday <= 9 ? "0$dday" : $dday; $viewuri = "/users/$u->{'user'}/$dyear/$dmon/$dday/"; } $ret .= "$view: $styid "; } if ($u->{'useoverrides'} eq 'Y') { $ret .= " overrides: view "; } } # if the user has siteadmin:users or siteadmin:* show them link to resend validation email? my $extraval = sub { return '' unless LJ::check_priv($remote, 'siteadmin', 'users') || LJ::check_priv($remote, 'siteadmin', '*'); return " (resend validation email)"; }; $ret .= " email validated? "; if ($u->{'status'} eq "A") { $ret .= "yes"; } if ($u->{'status'} eq "N") { $ret .= "no" . $extraval->(); } if ($u->{'status'} eq "T") { $ret .= "transitioning (used to be validated, but changed email addresses and hasn't reconfirmed)" . $extraval->(); } if ($u->{clusterid}) { $ret .= " cluster: " . LJ::get_cluster_description($u->{clusterid}, 1); } $ret .= " data version: $u->{dversion}"; $ret .= " underage? "; if ($clusterdown) { $ret .= "cluster unavailable"; } else { if ($u->underage) { $ret .= "yes because of "; $ret .= "birthday" if $u->underage_status eq 'Y'; $ret .= "unique cookie" if $u->underage_status eq 'O'; $ret .= "manual set" if $u->underage_status eq 'M'; $ret .= ""; } else { $ret .= "no"; if ($u->underage_status) { $ret .= "; was by "; $ret .= "birthday" if $u->underage_status eq 'Y'; $ret .= "unique cookie" if $u->underage_status eq 'O'; $ret .= "manual set" if $u->underage_status eq 'M'; } $ret .= ""; } } if (LJ::check_priv($remote, 'historyview')) { $ret .= " view: "; $ret .= "statushistory"; } } else { $ret .= "not a user"; } $ret .= " |
Support category: | "; if (LJ::Support::can_read_cat($sp->{_cat}, $remote)) { $ret .= "$problemarea"; $ret .= " [previous|"; $ret .= "next]"; } else { $ret .= $problemarea; } $ret .= " |
Time posted: | $timecreate ($age) |
Status: | $state"; if ($owner_mode) { $ret .= $sp->{'state'} eq "open" ? ", {'authcode'}'>close without credit" : ""; if ($sp->{state} eq 'closed') { my $permastatus = LJ::Support::is_locked($sp); $ret .= $sp->{'state'} eq "closed" && !$permastatus ? ", {'authcode'}'>reopen this request" : ""; if (LJ::Support::can_lock($sp, $remote)) { $ret .= $permastatus ? ", unlock request" : ", lock request"; } } } $ret .= " |
Summary: | " . LJ::ehtml($sp->{'subject'}) . " |
"; } $header .= " | " . LJ::ljuser($up->{'user'}, { 'full' => 1 }); if ($up->{'statusvis'} ne 'S') { $header .= " - " . LJ::ehtml($up->{'name'}); } $header .= " |
\n";
if ($le->{'faqid'}) {
# faq question
my $dbr = LJ::get_db_reader();
my $sth = $dbr->prepare("SELECT question FROM faq WHERE faqid=?");
$sth->execute($le->{'faqid'});
my $faqname = $sth->fetchrow_array;
$ret .= " \n";
# whitespace between these two DIVs is necessary for proper
# rendering in IE 5 for Mac OS < X
$ret .= " \n";
}
$ret .= "";
$ret .= "FAQ Reference: $faqname $message \n"; $ret .= " |
Post a comment or solution:
\n"; unless ($remote || $is_poster) { $ret .= "You must login to help people out.\n"; return $ret; } unless (LJ::Support::can_append($sp, $remote, $auth)) { $ret .= "Sorry, you do not have access to answer people's support requests in this category.\n"; return $ret; } my @ans_type = LJ::Support::get_answer_types($sp, $remote, $auth); my %ans_type = @ans_type; if ($ans_type{'answer'} || $ans_type{'screened'}) { $ret .= "Important Notes:"; $ret .= "