ljr/livejournal/htdocs/support/faq.bml

96 lines
3.1 KiB
Plaintext
Raw Normal View History

2019-02-05 21:49:12 +00:00
<?page
title=>FAQ
body<=
<?h1 Frequently Asked Questions h1?>
<?p
Below are some frequently asked questions, and answers, too! Oh boy. Try to read this before you ask a new question. If you know something we should add to this, let us know.
p?>
<?_code
use strict;
use vars qw(%GET);
LJ::set_active_crumb('faq');
my $curlang = BML::get_language();
my $deflang = BML::get_language_default();
my $altlang = $curlang ne $deflang;
my ($mll, $mld);
if ($altlang) {
$mll = LJ::Lang::get_lang($curlang);
$mld = LJ::Lang::get_dom("faq");
$altlang = 0 unless $mll && $mld;
}
my $dbr = LJ::get_db_reader(); my $sth;
my %faqcat; my %faqq;
my $ret = "";
if ($altlang) {
my $sql = "SELECT fc.faqcat, t.text AS 'faqcatname', fc.catorder FROM faqcat fc, ".
"ml_text t, ml_latest l, ml_items i WHERE ".
"t.dmid=$mld->{'dmid'} AND l.dmid=$mld->{'dmid'} AND i.dmid=$mld->{'dmid'} AND ".
"l.lnid=$mll->{'lnid'} AND l.itid=i.itid AND i.itcode=CONCAT('cat.', fc.faqcat) ".
"AND l.txtid=t.txtid AND fc.faqcat<>'int-abuse'";
$sth = $dbr->prepare($sql);
} else {
$sth = $dbr->prepare("SELECT faqcat, faqcatname, catorder FROM faqcat ".
"WHERE faqcat<>'int-abuse'");
}
$sth->execute;
while ($_ = $sth->fetchrow_hashref) {
$faqcat{$_->{'faqcat'}} = $_;
}
if ($altlang) {
my $sql = "SELECT f.faqid, t.text AS 'question', f.sortorder, ".
"f.faqcat, f.lastmodtime FROM faq f, ".
"ml_text t, ml_latest l, ml_items i WHERE ".
"t.dmid=$mld->{'dmid'} AND l.dmid=$mld->{'dmid'} AND i.dmid=$mld->{'dmid'} AND ".
"l.lnid=$mll->{'lnid'} AND l.itid=i.itid AND i.itcode=CONCAT(f.faqid, '.1question') ".
"AND l.txtid=t.txtid AND f.faqcat<>'int-abuse'";
$sth = $dbr->prepare($sql);
} else {
$sth = $dbr->prepare("SELECT faqid, question, sortorder, faqcat, lastmodtime ".
"FROM faq WHERE faqcat<>'int-abuse'");
}
$sth->execute;
while ($_ = $sth->fetchrow_hashref) {
$faqq{$_->{'faqid'}} = $_;
}
foreach my $faqcat (sort { $faqcat{$a}->{'catorder'} <=>
$faqcat{$b}->{'catorder'} } keys %faqcat)
{
next if $GET{'cat'} && $GET{'cat'} ne $faqcat;
$ret .= "<?h2 ";
$ret .= LJ::ehtml($faqcat{$faqcat}->{'faqcatname'});
$ret .= " (<a href='faqbrowse.bml?faqcat=$faqcat'>";
$ret .= "view all";
$ret .= "</a>) h2?>\n";
$ret .= "<ul>\n";
foreach my $faqid (sort { $faqq{$a}->{'sortorder'} <=> $faqq{$b}->{'sortorder'} } grep { $faqq{$_}->{'faqcat'} eq $faqcat } keys %faqq)
{
next unless ($faqq{$faqid}->{'question'});
BML::note_mod_time($faqq{$faqid}->{'lastmodtime'});
my $q = LJ::ehtml($faqq{$faqid}->{'question'});
$q =~ s/^\s+//; $q =~ s/\s+$//;
$q =~ s!\n!<br />!g;
$ret .= "<li><a href='faqbrowse.bml?faqid=$faqid'>$q</a></li>\n";
}
$ret .= "</ul>\n";
}
return $ret;
_code?>
<?hr?>
<p>Back to <a href="./">the support area</a>.</p>
<=body
page?><?_c <LJDEP>
link: htdocs/support/faqbrowse.bml, htdocs/support/index.bml
</LJDEP> _c?>