Zawartość books.php
require_once "../../maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
// LOKALE SPRACHDATEI PRÜFEN
if (file_exists(INFUSIONS."book_panel/locale/".$settings['locale'].".php")) {
include INFUSIONS."book_panel/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."book_panel/locale/Polish.php";
}
// Inhalt für Übersicht kürzen
function trimcontent($text, $length) {
$enc = array(""", "'", "\", """, "'", "<", ">");
$text = str_replace($enc, $dec, $text);
if (strlen($text) > $length) $text = substr($text, 0, ($length-3))."...";
$text = str_replace($dec, $enc, $text);
return stripslash(nl2br($text));
}
// +++++++++++++++++++++
// Zugriffsrechte prüfen
// +++++++++++++++++++++
$get_settings = dbquery("SELECT * FROM ".$db_prefix."atbook_settings WHERE id='1'");
$panel_settings = dbarray($get_settings);
if ($userdata['user_level'] >= $panel_settings['access_global']){
// ++++++++++++++++++++
// Anzeige eines Buches
// ++++++++++++++++++++
if (isset($bookid))
{
opentable($panel_settings['title']);
// Treffer für die Lesung eines Eintrages um 1 erhöhen
$hits_update = dbquery("UPDATE ".$db_prefix."atbooks SET book_hits=book_hits+1 WHERE book_id='$bookid'");
$result = dbquery("SELECT * FROM ".$db_prefix."atbooks WHERE book_id='$bookid'");
$data = dbarray($result);
$get_cat_name = dbarray(dbquery("SELECT * FROM ".$db_prefix."atbook_cats WHERE book_cat_id='".$data['book_cat_id']."'"));
if ($data['book_datestamp']+604800 > time()+($settings['timeoffset']*3600))
{$new = "<img src='".INFUSIONS."images/new.gif'>";}
else {$new = "";}
// Titel
$title = $data['book_title'];
// Empfehlung
if ($data['book_tipp'] == "1")
{$tipp = "<img src='".INFUSIONS."book_panel/images/tipp.gif' title='".$locale['ab_011']." ".$settings['sitename']."!' align='right'>";}
else {$tipp = "";}
// Cover
if ($data['book_image'] == "1")
{$image = $locale['ab_012'];}
else {$image = "<a href='".INFUSIONS."book_panel/images/books/".$data['book_image']."' target=_blank><img src='".INFUSIONS."book_panel/images/books/".$data['book_image']."' height='".$data['book_image_h']."' width='".$data['book_image_w']."' title='".$locale['ab_013']."'></a><br>".$locale['ab_014']."";}
// Autor
if ($data['book_autor'] == ""){$autor = "-";}
else{$autor = $data['book_autor'];}
// Sprache (Text)
$language = $data['book_language'];
// Sprache (Flagge)
if ($data['book_language_flag'] != "1"){$flag = " <img src='".INFUSIONS."book_panel/images/flags/".$data['book_language_flag']."'>";}
else{$flag = "";}
// Auflage
if ($data['book_auflage'] == ""){$auflage = $locale['ab_015'];}
else {$auflage = $data['book_auflage'];}
// Veröffentlicht
$published = $data['book_published'];
if ($data['book_published'] == ""){$published = $locale['ab_015'];}
else {$published = $data['book_published'];}
// Inhalt
$content = nl2br(stripslashes($data['book_content']));
// Anmerkung
$comment = nl2br(stripslashes($data['book_comment']));
// Verlag
$publisher = $data['book_publisher'];
// Verlagslogo mit Verlagsname
if ($data['book_publisher_logo'] != "1")
{$publisher_and_logo = "<center><img src='".INFUSIONS."book_panel/images/verlag/".$data['book_publisher_logo']."' height='".$data['book_publisher_logo_h']."' width='".$data['book_publisher_logo_w']."'><br>$publisher</center>";}
else {$publisher_and_logo = "$publisher";}
// ISBN-Nummer
$isbn = $data['book_isbn'];
// Link
$link = $data['book_link'];
$date = date("d.m.Y", $data['book_datestamp']);
// Anzahl der Kommentare einlesen
$count_comments = dbquery("SELECT * FROM ".$db_prefix."atbook_comments WHERE comment_book_id=$bookid");
$rows = dbrows($count_comments);
if ($rows == "1")
{$count_comments = "$rows Komentarz";}
else {$count_comments = "$rows Komentarze";}
// Zugriffsrechte auf Kategorie prüfen
if ($userdata['user_level'] >= $get_cat_name['book_cat_access']){
echo "<table width='100%' class='tbl-border' cellpadding='0' cellspacing='1'>";
echo "<tr><td class='tbl2' align='center'>
<a href='".FUSION_SELF."?&catid=".$get_cat_name['book_cat_id']."' target=_self>".$locale['ab_016']."</a></td></tr>";
echo "</table>";
echo "<table align='left' width='100%' class='tbl-border' cellpadding='0' cellspacing='1'>";
echo "<tr>";
echo "<td width='40%' align='center' valign='top' width='10%' class='tbl1'>
<span class='textbox'><b><font size=2>$count_comments</font></b></span><p>$image</td>";
echo "<td>";
echo "<table width='100%' class='tbl' cellpadding='0' cellspacing='1'>";
echo "<tr>";
echo "<td colspan='2' align='center' class='tbl2'>$tipp<font size=2><b>$title</b></font><br>
<small>[ ".$locale['ab_017']." ".$get_cat_name['book_cat_name']." · ".$data['book_hits']." ".$locale['ab_018']." ·
$count_comments ]</small></td>";
echo "</tr>";
echo "<tr>";
echo "<td class='tbl2'>".$locale['ab_019']."</td>";
echo "<td colspan='2' class='tbl1'>$date</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='40%' class='tbl2'>".$locale['ab_020']."</td>";
echo "<td colspan='2' class='tbl1'>$autor</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='40%' class='tbl2'>".$locale['ab_021']."</td>";
echo "<td colspan='2' class='tbl1'>$language$flag</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='40%' class='tbl2'>".$locale['ab_022']."</td>";
echo "<td colspan='2' class='tbl1'>$published</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='40%' class='tbl2'>".$locale['ab_023']."</td>";
echo "<td colspan='2' class='tbl1'>$auflage</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='center' colspan='3' class='tbl2'>".$locale['ab_024']."</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='justify' colspan='3' class='tbl1'>$content</td>";
echo "</tr>";
if ($data['book_comment'] != "")
{
echo "<tr>";
echo "<td align='center' colspan='3' class='tbl2'>".$locale['ab_025']."</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='justify' colspan='3' class='tbl1'>$comment</td>";
echo "</tr>";
}
if ($data['book_isbn'] != "")
{
echo "<tr>";
echo "<td width='40%' class='tbl2'>".$locale['ab_026']."</td>";
echo "<td colspan='2' class='tbl1'>$isbn</td>";
echo "</tr>";
}
if ($publisher_and_logo != "")
{
echo "<tr>";
echo "<td width='40%' class='tbl2'>".$locale['ab_027']."</td>";
echo "<td colspan='2' class='tbl1'>$publisher_and_logo</td>";
echo "</tr>";
}
if ($data['book_link'] != "")
{
echo "<tr>";
echo "<td width='40%' colspan='3' align='center' class='tbl2'><a href='$link' target=_blank>".$locale['ab_028']."</a></td>";
echo "</tr>";
}
echo "</table>";
echo "</tr></td>";
echo "<tr><td colspan='3'>";
echo "<table width='100%' class='tbl-border' cellpadding='0' cellspacing='1'>";
echo "<tr><td class='tbl2' align='center'><a href='".FUSION_SELF."?&catid=".$get_cat_name['book_cat_id']."' target=_self>".$locale['ab_016']."</a></td></tr>";
echo "</table>";
echo "</td></tr>";
echo "</table>";
// Ende if-Anweisung Zugriffsrechte auf Kategorie
}
else{fallback("error2.php");}
closetable();
tablebreak();
// Kommentare einbinden
include "comments.php";
}
// +++++++++++++++++++++++++++++++++++
// Anzeige des Inhalts einer Kategorie
// +++++++++++++++++++++++++++++++++++
elseif (isset($catid))
{
opentable($panel_settings['title']);
$items_per_page = 10;
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
$result = dbquery("SELECT * FROM ".$db_prefix."atbooks WHERE book_cat_id='$catid' ORDER BY book_title ASC LIMIT $rowstart,$items_per_page");
$cat_name = dbarray(dbquery("SELECT * FROM ".$db_prefix."atbook_cats WHERE book_cat_id='$catid'"));
$topcat_name = dbarray(dbquery("SELECT * FROM ".$db_prefix."atbook_cats WHERE book_cat_id='".$cat_name['book_top_cat']."'"));
$entries = dbrows($result);
$rows_entries = dbcount("(book_id)", "atbooks WHERE book_cat_id='$catid'");
$get_childcats = dbquery("SELECT * FROM ".$db_prefix."atbook_cats WHERE book_top_cat='$catid'");
$count_entries = dbrows($get_childcats);
// Zugriffsrechte auf Kategorie prüfen
if ($userdata['user_level'] >= $cat_name['book_cat_access']){
echo "<table width='100%' class='textbox' cellpadding='0' cellspacing='0'>";
echo "<tr><td colspan='4' align='center' class='tbl2'>";
echo "<b>Kategorie:</b> ".$cat_name['book_cat_name']."";
echo "</td></tr>";
echo "</table>";
tablebreak();
echo "<table width='100%' class='textbox' cellpadding='0' cellspacing='0'>";
echo "<tr><td valign='top' width='30%' class='tbl1'>";
echo "<a href='".INFUSIONS."book_panel/books.php' target=_self>".$locale['ab_029']."</a><br>";
if ($topcat_name['book_cat_name'] != "")
{echo "<a href='".INFUSIONS."book_panel/books.php?&catid=".$topcat_name['book_cat_id']."' target=_self title='".$locale['ab_030']." ".$cat_name['book_cat_name']."'><b>".$topcat_name['book_cat_name']."</b></a><br>";}
echo "» <b>".$cat_name['book_cat_name']."</b><br>";
while ($childcats = dbarray($get_childcats))
{
echo " <img src='".THEME."images/bullet.gif'><a href='".FUSION_SELF."?&catid=".$childcats['book_cat_id']."' target=_self title='".$locale['ab_031']." ".$cat_name['book_cat_name']."'>".$childcats['book_cat_name']."</a><br>";
}
echo "</td><td>";
echo "<table width='100%' class='textbox' cellpadding='0' cellspacing='0'>";
if ($entries == "0")
{echo "<tr><td align='center' colspan='3' class='tbl1'>".$locale['ab_032']."</td></tr>";}
echo "<tr><td>";
while ($data = dbarray($result))
{
if ($data['book_tipp'] == "1")
{$tipp = "<img src='".INFUSIONS."book_panel/images/tipp.gif' title='Empfehlung von ".$settings['sitename']."!'>";}
else {$tipp = "";}
// Anzahl der Kommentare einlesen
$count_comments = dbquery("SELECT * FROM ".$db_prefix."atbook_comments WHERE comment_book_id=".$data['book_id']."");
$rows = dbrows($count_comments);
if ($rows == "1")
{$count_comments = "$rows Komentarz";}
else {$count_comments = "$rows Komentarze";}
$trim_content = trimcontent($data['book_content'], 100);
if ($data['book_datestamp']+604800 > time()+($settings['timeoffset']*3600))
{$new = "<img src='".INFUSIONS."book_panel/images/new.gif'><br>";}
else {$new = "";}
echo "<table width='100%' class='tbl' cellpadding='0' cellspacing='0'>";
echo "<tr>";
if ($data['book_image'] != "1"){
$imgext = strrchr($data['book_image'], ".");
$thumb = $data['book_image']."_t1".$imgext;
echo "<td width='20%' align='center' class='tbl2'><img src='".INFUSIONS."book_panel/images/books/thumbs/$thumb' title='".$data['book_title']."'></td>";
} else {
echo "<td width='20%' align='center' class='tbl2'><img src='".INFUSIONS."book_panel/images/nocover.gif' title='".$locale['ab_033']."'></td>";
}
echo "<td width='25%' align='center' class='tbl2'><a href='".FUSION_SELF."?&bookid=".$data['book_id']."'><b>".$data['book_title']."</b></a></td>";
echo "<td width='45%' align='justify' class='tbl1'>$trim_content</td>";
echo "<td width='10%' align='center' class='tbl1'>$new$tipp</td>";
echo "</tr>";
echo "<tr><td class='tbl2' colspan='4' align='center'><small><i>[ ".$data['book_hits']." ".$locale['ab_018']." · $count_comments · ".$locale['ab_034']." ".showdate("shortdate", $data['book_datestamp'])."]</small></i></td></tr>";
echo "</table>";
tablebreak();
}
echo "</td></tr>";
echo "</table>";
echo "</td></tr>";
echo "</table>";
tablebreak();
// Navigation
if ($rows_entries > $items_per_page) echo"<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,$items_per_page,$rows_entries,3,"?&catid=$catid&")."\n</div>\n";
// Ende if-Anweisung Zugriffsrechte auf Kategorie
}
else{fallback("error.php");}
closetable();
}
// ++++++++++++++++++++++++
// Anzeige aller Kategorien
// ++++++++++++++++++++++++
else
{
$get_cats = dbquery("SELECT * FROM ".$db_prefix."atbook_cats WHERE book_top_cat='0' ORDER BY book_cat_name ASC");
opentable($panel_settings['title']);
echo "<table width='100%' class='tbl-border' cellpadding='0' cellspacing='1'>";
echo "<form action='".INFUSIONS."book_panel/search.php' method='post' name='searchform'>";
echo "<tr><td align='center' class='tbl2' colspan='2'><b>Szybkie szukanie:</b> ";
echo "<input type='text' name='volltext' maxlength='250' class='textbox' style='width:80%'></td>";
echo "<td width='20%' class='tbl2' align='center'><input type='submit' class='button' name ='select2' value='".$locale['ab_035']."'></td>";
echo "</tr>";
echo "</form>";
echo "</table>";
tablebreak();
echo "<table width='100%' class='tbl-border' cellpadding='0' cellspacing='1'>";
while ($cats = dbarray($get_cats))
{
$get_childcats = dbquery("SELECT * FROM ".$db_prefix."atbook_cats WHERE book_top_cat='".$cats['book_cat_id']."'");
$get_books = dbquery("SELECT * FROM ".$db_prefix."atbooks WHERE book_cat_id='".$cats['book_cat_id']."'");
$rows = dbrows($get_books);
$get_newest = dbarray(dbquery("SELECT book_datestamp FROM ".$db_prefix."atbooks WHERE book_cat_id='".$cats['book_cat_id']."' ORDER BY book_datestamp DESC"));
if ($get_newest['book_datestamp']+604800 > time()+($settings['timeoffset']*3600))
{$new_entry = " »".$locale['ab_036']."«";}
else {$new_entry = "";}
echo "<tr>";
echo "<td class='tbl2'><a href='".FUSION_SELF."?&catid=".$cats['book_cat_id']."' target=_self title='".$cats['book_cat_name']."'><b>".$cats['book_cat_name']."</b></a> $new_entry";
if ($rows != "0")
{
if ($rows == "1"){echo "<td width='15%' align='center' class='tbl2'>$rows ".$locale['ab_048']."</td>";}
else{echo "<td width='15%' align='center' class='tbl2'>$rows ".$locale['ab_049']."</td>";}
}
else
{
echo "<td width='15%' align='center' class='tbl2'>-</td>";
}
if ($childcats['book_top_cat'] != "0")
{
while ($childcats = dbarray($get_childcats))
{
$sel_books = dbquery("SELECT * FROM ".$db_prefix."atbooks WHERE book_cat_id='".$childcats['book_cat_id']."'");
$books = dbrows($sel_books);
$get_newest = dbarray(dbquery("SELECT book_datestamp FROM ".$db_prefix."atbooks WHERE book_cat_id='".$childcats['book_cat_id']."' ORDER BY book_datestamp DESC"));
if ($get_newest['book_datestamp']+604800 > time()+($settings['timeoffset']*3600))
{$new_entry = " »".$locale['ab_036']."«";}
else {$new_entry = "";}
echo "<tr>";
echo "<td class='tbl1'> <img src='".THEME."images/bullet.gif'> <a href='".FUSION_SELF."?&catid=".$childcats['book_cat_id']."' target=_self title='".$childcats['book_cat_name']." [".$cats['book_cat_name']."]'>".$childcats['book_cat_name']."</a> $new_entry</td>";
if ($books != "0")
{
if ($books == "1"){echo "<td width='15%' align='center' class='tbl1'>$books ".$locale['ab_048']."</td>";}
else{echo "<td width='15%' align='center' class='tbl1'>$books ".$locale['ab_049']."</td>";}
}
else
{
echo "<td width='15%' align='center' class='tbl1'>-</td>";
}
echo "</tr>";
}
}
echo "</td>";
echo "</tr>";
}
echo "</table>";
tablebreak();
$all_books = dbquery("SELECT * FROM ".$db_prefix."atbooks");
$newest_books = dbquery("SELECT * FROM ".$db_prefix."atbooks ORDER BY book_datestamp DESC LIMIT 0,5");
$popular_books = dbquery("SELECT * FROM ".$db_prefix."atbooks ORDER BY book_hits DESC LIMIT 0,5");
$count_books = dbrows($all_books);
echo "<table width='100%' class='tbl-border' cellpadding='0' cellspacing='1'>";
echo "<tr>";
echo "<td width='35%' align='center' class='tbl2'>".$locale['ab_037']."<hr>";
while ($newest = dbarray($newest_books))
{
echo "<a href='".INFUSIONS."book_panel/books.php?&bookid=".$newest['book_id']."' title='".$newest['book_title']."' target=_self>".$newest['book_title']."</a><br>";
}
echo "</td>";
echo "<td width='35%' align='center' class='tbl2'>".$locale['ab_038']."<hr>";
while ($popular = dbarray($popular_books))
{
echo "<a href='".INFUSIONS."book_panel/books.php?&bookid=".$popular['book_id']."' title='".$popular['book_title']."' target=_self>".$popular['book_title']."</a><br>";
}
echo "</td>";
echo "<td align='right' class='tbl2'><b>".$locale['ab_039']." $count_books ".$locale['ab_040']."</b><hr>";
echo "<img src='".INFUSIONS."book_panel/images/new.gif'><br>".$locale['ab_041']."<br>";
echo "<img src='".INFUSIONS."book_panel/images/tipp.gif'><br>".$locale['ab_042']."";
echo "</td>";
echo "</tr>";
echo "</table>";
tablebreak();
$get_comments = dbquery("SELECT * FROM ".$db_prefix."atbook_comments ORDER BY comment_datestamp DESC LIMIT 0,3");
echo "<table width='100%' class='tbl-border' cellpadding='0' cellspacing='1'>";
echo "<tr>";
echo "<td colspan='3' align='center' class='tbl2'><font size=2>".$locale['ab_043']."</font></td>";
echo "</tr>";
echo "<tr>";
echo "<td width='50%' class='tbl2'>".$locale['ab_044']." ".$locale['ab_045']."</td>";
echo "<td width='20%' class='tbl2'>".$locale['ab_046']."</td>";
echo "<td align='center' class='tbl2'>".$locale['ab_047']."</td>";
echo "</tr>";
while ($last_comments = dbarray($get_comments))
{
$commented_books = dbarray(dbquery("SELECT * FROM ".$db_prefix."atbooks WHERE book_id='".$last_comments['comment_book_id']."'"));
$comment_date = date("d.m.Y - G:i:s", $last_comments['comment_datestamp']);
$comment_book_title = trimlink($commented_books['book_title'], 50);
$comment_username = trimlink($last_comments['comment_user_name'], 30);
echo "<tr>";
echo "<td width='50%' class='tbl1'><a href='".FUSION_SELF."?&bookid=".$commented_books['book_id']."' title='".$commented_books['book_title']."'>$comment_book_title</a></td>";
echo "<td width='20%' class='tbl1'>$comment_username</td>";
echo "<td align='center' class='tbl1'>$comment_date</td>";
echo "</tr>";
}
echo "</table>";
tablebreak();
closetable();
}
// Ende der If-Anweisung für den Zugriff
}
else{fallback("error.php");}
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>
Edytowane przez Pieka dnia 12.11.2007 11:55:28
|