Alles kla dann schreib ich die anderen beiden Dateien auch noch hier rein^^
include/contents/faqsys.php:
<?php
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: FAQ';
$hmenu = 'FAQ';
$design = new design ( $title , $hmenu );
$design->header();
$tpl = new tpl('faq');
//Templatekopf ausgeben
$tpl->out(0);
switch($menu->get(1)) {
case 'faqcat':
$faqcatID= $menu->getA(2) == 'c' ? $menu->getE(2) : 1;
$catname = db_query("SELECT faqcatname FROM prefix_faq_categories WHERE faqcatID=".$faqcatID."");
$sql = db_query("SELECT question,faqID,sort FROM prefix_faq WHERE faqcatID='$faqcatID' ORDER BY sort");
if (db_num_rows($sql)) {
$tpl->set_out('backlink','<a href="index.php?faq-faqcat-c'.$faqcatID.'">'.@db_result($catname,0).'</a>',1);
while ($row = db_fetch_assoc($sql)) {
$class = $class == 'Cmite' ? 'Cnorm' : 'Cmite';
$row['class'] = $class;
$tpl->set_ar_out($row,2);
}
$tpl->out(3);
}
break;
case 'faq';
$faqID= $menu->getA(2) == 'f' ? $menu->getE(2) : 0;
$cat = db_query("SELECT faqcatID FROM prefix_faq WHERE faqID='$faqID'");
$question = db_query("SELECT question FROM prefix_faq WHERE faqID='$faqID'");
$catname = db_query("SELECT faqcatname FROM prefix_faq_categories WHERE faqcatID=".@db_result($cat,0)."");
if (db_num_rows($cat)) {
$tpl->set_out('backlink','<a href="index.php?faq-faqcat-c'.@db_result($cat,0).'">'.@db_result($catname,0).'</a> » <a href="index.php?faq-faq-f'.$faqID.'">'.@db_result($question,0).'</a>',4);
$cat = db_query("SELECT faqcatID,question,answer FROM prefix_faq WHERE faqID='$faqID'");
while ($da = db_fetch_assoc($cat)) {
$da['answer'] = bbcode($da['answer']);
$da['question'] = bbcode($da['question']);
$tpl->set_ar_out($da,5);
}
$tpl->out(3);
} else {
echo 'keine FAQ mit dieser ID verfügbar.<br><br>[ <a href="index.php?faq">zurück</a> ]';
}
break;
default:
$faqcat = db_query("SELECT * FROM prefix_faq_categories ORDER BY sort");
if (db_num_rows($faqcat)) {
$tpl->set('anzcats',db_num_rows(db_query("SELECT faqcatID FROM prefix_faq_categories")));
$tpl->out(6);
while ($row = db_fetch_assoc($faqcat)) {
$row['anzfaqs'] = db_num_rows(db_query("SELECT faqID FROM prefix_faq WHERE faqcatID='".$row['faqcatID']."'"));
$row['description'] = bbcode($row['description']);
$class = $class == 'Cmite' ? 'Cnorm' : 'Cmite';
$row['class'] = $class;
$tpl->set_ar_out($row,7);
}
$tpl->out(3);
} else {
echo 'Keine Kategorien vorhanden';
}
break;
}
$design->footer();
?>
include/admin/faq.php
<?php
# Copyright by: Manuel Staechele
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
defined ('admin') or die ( 'only admin access' );
$design = new design ( 'Admins Area', 'Admins Area', 2 );
$design->header();
if ($menu->get(1) == 'del') {
$faqID = $menu->getE(2);
db_query(" DELETE FROM prefix_faq WHERE faqID='$faqID'");
} elseif ($menu->get(1) == 'delcat') {
$faqcatID = $menu->getE(2);
db_query("DELETE FROM prefix_faq WHERE faqcatID='$faqcatID'");
db_query("DELETE FROM prefix_faq_categories WHERE faqcatID='$faqcatID'");
} elseif ($_POST['sortieren']) {
$sortfaqcat = $_POST['sortfaqcat'];
$sortfaq = $_POST['sortfaq'];
if(is_array($sortfaqcat)) {
foreach($sortfaqcat as $sortstring) {
$sorter=explode("-", $sortstring);
db_query("UPDATE prefix_faq_categories SET sort='$sorter[1]' WHERE faqcatID='$sorter[0]' ");
}
}
if(is_array($sortfaq)) {
foreach($sortfaq as $sortstring) {
$sorter=explode("-", $sortstring);
db_query("UPDATE prefix_faq SET sort='$sorter[1]' WHERE faqID='$sorter[0]' ");
}
}
} elseif ($_POST['save']) {
$faqcat = $_POST['faqcat'];
$question = $_POST['question'];
$answer = $_POST['answer'];
if($faqcat=="") $faqcat=0;
db_query("INSERT INTO prefix_faq ( faqcatID, question, answer, sort )
values( '$faqcat', '$question', '$answer', '1' )");
} elseif ($_POST['savecat']) {
$faqcatname = $_POST['faqcatname'];
$description = $_POST['description'];
db_query("INSERT INTO prefix_faq_categories ( faqcatname, description, sort )
values( '$faqcatname', '$description', '1' )");
} elseif ($_POST['saveedit']) {
$faqcat = $_POST['faqcat'];
$question = $_POST['question'];
$answer = $_POST['answer'];
$faqID = $_POST['faqID'];
db_query("UPDATE prefix_faq SET faqcatID='$faqcat', question='$question', answer='$answer' WHERE faqID='$faqID' ");
} elseif ($_POST['saveeditcat']) {
$faqcatname = $_POST['faqcatname'];
$description = $_POST['description'];
$faqcatID = $_POST['faqcatID'];
db_query("UPDATE prefix_faq_categories SET faqcatname='$faqcatname', description='$description' WHERE faqcatID='$faqcatID' ");
}
switch ($menu->get(1)) {
case 'add':
$ergebnis = db_query("SELECT * FROM prefix_faq_categories ORDER BY sort");
$faqcats='<select name="faqcat">';
while($ds=mysql_fetch_array($ergebnis)) {
$faqcats.='<option value="'.$ds[faqcatID].'">'.$ds[faqcatname].'</option>';
}
$faqcats.='</select>';
echo '<form method="post" action="admin.php?faq"><table cellpadding="4" cellspacing="0"><tr> <td>Kategorie:</td> <td>'.$faqcats.'</td></tr><tr> <td>FAQ:</td> <td><input type="text" name="question" size="91" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td></tr><tr> <td>Antwort:</td> <td><textarea cols="90" rows="10" name="answer" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></textarea></td></tr><tr> <td> </td> <td><input type="submit" name="save" value="Senden"></td></tr></table></form>';
break;
case 'edit':
$faqID = $menu->getE(2);
$ergebnis=db_query("SELECT * FROM prefix_faq WHERE faqID='$faqID'");
$ds=mysql_fetch_array($ergebnis);
$faqcategory=db_query("SELECT * FROM prefix_faq_categories ORDER BY sort");
$faqcats='<select name="faqcat">';
while($dc=mysql_fetch_array($faqcategory)) {
if ($dc[faqcatID] == $ds[faqcatID])
{
$faqcats.='<option value="'.$dc[faqcatID].'">'.$dc[faqcatname].'</option>';
}
}
$faqcategory=db_query("SELECT * FROM prefix_faq_categories ORDER BY sort");
while($dc=mysql_fetch_array($faqcategory)) {
if ($dc[faqcatID] != $ds[faqcatID])
{
$faqcats.='<option value="'.$dc[faqcatID].'">'.$dc[faqcatname].'</option>';
}
}
$faqcats.='</select>';
echo '<form method="post" action="admin.php?faq"><table cellpadding="4" cellspacing="0"><tr> <td>Kategorie:</td> <td>'.$faqcats.'</td></tr><tr> <td>FAQ:</td> <td><input type="text" name="question" value="'.$ds[question].'" size="91" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td></tr>';
echo '<tr> <td>Antwort:</td> <td><textarea cols="90" rows="10" name="answer" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'">'.$ds[answer].'</textarea></td></tr><tr> <td><input type="hidden" name="faqID" value="'.$faqID.'"></td> <td><input type="submit" name="saveedit" value="Update"></td></tr></table></form>';
break;
case 'addcat':
echo '<form method="post" action="admin.php?faq" enctype="multipart/form-data"><table cellpadding="4" cellspacing="0"><tr> <td>Kategorie Name:</td> <td><input type="text" name="faqcatname" size="61" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td></tr><tr> <td>Beschreibung:</td> <td><textarea cols="60" rows="6" name="description" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></textarea></td></tr><tr> <td> </td> <td><input type="submit" name="savecat" value="Senden"></td></tr></table></form>';
break;
case 'editcat':
$faqID = $menu->getE(2);
$ergebnis=db_query("SELECT * FROM prefix_faq_categories WHERE faqcatID='$faqID'");
$ds=mysql_fetch_array($ergebnis);
echo '<form method="post" action="admin.php?faq"><table cellpadding="4" cellspacing="0"><tr> <td>Kategorie Name:</td> <td><input type="text" name="faqcatname" value="'.$ds[faqcatname].'" size="61" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'"></td></tr><tr> <td>Beschreibung:</td> <td><textarea cols="60" rows="6" name="description" class="form_off" onFocus="this.className=\'form_on\'" onBlur="this.className=\'form_off\'">'.$ds[description].'</textarea></td></tr><tr> <td><input type="hidden" name="faqcatID" value="'.$faqID.'"></td> <td><input type="submit" name="saveeditcat" value="update"></td></tr></table></form>';
break;
default:
echo '<a href="admin.php?faq-add">Neuen FAQ Eintrag</a> <a href="admin.php?faq-addcat">Neue Kategorie</a><br><br>';
echo '<form method="post" action="admin.php?faq"><table width="100%" cellpadding="4" cellspacing="1" bgcolor="#999999"><tr bgcolor="#CCCCCC"> <td class="Chead"><b><font color="#FFFFFF">FAQ</font></b></td> <td class="Chead" width="70" align="center"><b><font color="#FFFFFF">Aktion</font></b></td> <td class="Chead" width="80" align="center"><b><font color="#FFFFFF">Sortieren</font></b></td></tr>';
$ergebnis=db_query("SELECT * FROM prefix_faq_categories ORDER BY sort");
$anz=db_query("SELECT count(faqcatID) FROM prefix_faq_categories");
$anz=mysql_result($anz, 0);
while($ds=mysql_fetch_array($ergebnis)) {
if ($ds['sort'] == '1')
{
} else {
echo '<tr><td colspan="3" class="Cdark"></td></tr>';
}
echo '<tr class="Cnorm"><td width="470"><b>• '.$ds[faqcatname].'</b><br>'.$ds[description].'</td> <td align="center"><a href="admin.php?faq-editcat-c'.$ds[faqcatID].'"><img src="include/images/icons/edit.gif"></a> <a href="admin.php?faq-delcat-c'.$ds[faqcatID].'"><img src="include/images/icons/del.gif"></a></td> <td align="left" style="padding-left:30px;"><select name="sortfaqcat[]">';
for($n=1; $n<=$anz; $n++) {
if($ds[sort] == $n) {
echo'<option value="'.$ds[faqcatID].'-'.$n.'" selected>'.$n.'</option>';
} else {
echo'<option value="'.$ds[faqcatID].'-'.$n.'">'.$n.'</option>';
}
}
echo '</select></td></tr>';
$faq=db_query("SELECT * FROM prefix_faq WHERE faqcatID='$ds[faqcatID]' ORDER BY sort");
$anzfaq=db_query("SELECT count(faqID) FROM prefix_faq WHERE faqcatID='$ds[faqcatID]'");
$anzfaq=mysql_result($anzfaq, 0);
while($db=mysql_fetch_array($faq)) {
echo '<tr> <td class="Cmite" width="470" style="padding-left:30px;"><b>- '.$db[question].'</b><br>'.$db[answer].'</td> <td class="Cmite" align="center"> <a href="admin.php?faq-edit-i'.$db[faqID].'"><img src="include/images/icons/edit.gif"></a> <a href="admin.php?faq-del-i'.$db[faqID].'"><img src="include/images/icons/del.gif"></a></td><td class="Cmite" align="left" style="padding-left:60px;"><select name="sortfaq[]">';
for($j=1; $j<=$anzfaq; $j++) {
if($db[sort] == $j) {
echo'<option value="'.$db[faqID].'-'.$j.'" selected>'.$j.'</option>';
} else {
echo'<option value="'.$db[faqID].'-'.$j.'">'.$j.'</option>';
}
}
echo '</select></td></tr>';
}
}
echo '<tr class="Chead"> <td> </td> <td colspan="3" align="right" style="padding-right:40px;"><input type="submit" name="sortieren" value="Sortieren"></td></tr></table></form>';
break;
}
$design->footer();
?>