<?php
$do = $_GET['do'];
$link = FUSION_SELF.$aidlink."&action=feed&do=";
echo "Beginn FEED Zweig <br> DO = ".$do."<br>
RSS_SAVE:".$_POST['rss_speichern']."<br>
RSSID :".$_GET['rssid']." <br>
Link : ".$link."<br><br>";
unset($tablekopf); // Wenn das leer bleibt, kein Editor-Formular anzeigen
if ($do == "rssdown") {
if(isset($_GET['rssid'])) {$id = stripinput($_GET['rssid']); } else { $id = ''; };
if(isset($_GET['order'])) {$order = stripinput($_GET['order']); } else { $order = ''; };
$data = dbarray(dbquery('SELECT * FROM '.$db_prefix.'hasrn_rss WHERE rss_order="'.$order.'"'));
$result = dbquery('UPDATE '.$db_prefix.'hasrn_rss SET rss_order=rss_order-1 WHERE rssid="'.$data['rssid'].'"');
$result = dbquery('UPDATE '.$db_prefix.'hasrn_rss SET rss_order=rss_order+1 WHERE rssid="'.$id.'"');
header("Location: hasrn_admin.php?action=feed");
}
else if ($do == "rssup") {
if(isset($_GET['rssid'])) {$id = stripinput($_GET['rssid']); } else { $id = ''; };
if(isset($_GET['order'])) {$order = stripinput($_GET['order']); } else { $order = ''; };
$data = dbarray(dbquery('SELECT * FROM '.$db_prefix.'hasrn_rss WHERE rss_order="'.$order.'"'));
$result = dbquery('UPDATE '.$db_prefix.'hasrn_rss SET rss_order=rss_order+1 WHERE rssid="'.$data['rssid'].'"');
$result = dbquery('UPDATE '.$db_prefix.'hasrn_rss SET rss_order=rss_order-1 WHERE rssid="'.$id.'"');
header("Location: hasrn_admin.php?action=feed");
}
else if ($do == "rssdel") {
$id = (isset($_GET['rssid'])) ? $_GET['rssid'] : "";
// $result = dbquery('DELETE FROM '.$db_prefix.'hasrn_rss WHERE rssid="'.$id.'"');
opentable($locale['LAN_RSS_220']);
echo "<center><br>
".$locale['LAN_RSS_221']."<br><br> rss_ID: $id <br><br>
<a href=\"hasrn_admin.php\">".$locale['LAN_RSS_222']."</a><br><br>
<a href=\"".ADMIN."index.php\">".$locale['LAN_RSS_223']."</a><br><br>
</center>";
closetable();
// header("Location: hasrn_admin.php?action=rss");
}
else { // nur EDIT oder NEU
echo "Beginn ELSE Zweig <br>
DO=".$do."<br>
RSS_SAVE:".$_POST['rss_speichern']."<br>
RSSID :".$_GET['rssid']." <br>";
echo "RSS_SAVE gesetzt?" . (isset($_POST['rss_speichern']) ? "JA" : "NEIN") ;
//FORMULAR ABGESCHICKT - DATEN SPEICHERN
echo "<pre>";
print_r($_POST);
echo "</pre>";
if (isset($_POST['rss_speichern'])) {
$id = (isset($_GET['rssid'])) ? stripinput($_GET['rssid']) : "";
$name = stripinput($_POST['name']);
$xml = stripinput($_POST['xml']);
$quelle = stripinput($_POST['quelle']);
$quellelink = stripinput($_POST['quellelink']);
$quellelogo = stripinput($_POST['logo']);
// $logo = $data['rsslogo'];
$maxitemspage = stripinput($_POST['maxitemspage']);
$maxitemspanel = stripinput($_POST['maxitemspanel']);
$cat = stripinput($_POST['catordernr']);
$startseite = $_POST['rssaufstartseite'];
if ($do == 'rssedit') {
$SQL = 'UPDATE '.$db_prefix.'hasrn_rss SET
rssname = "'.$name.'",
rsscat = "'.$cat.'",
rssxml = "'.$xml.'",
rssquelle = "'.$quelle.'",
rssquellelink = "'.$quellelink.'",
rsslogo = "'.$quellelogo.'",
rss_maxitems_page = "'.$maxitemspage.'",
rss_maxitems_panel = "'.$maxitemspanel.'",
rssaufstartseite = "'.$startseite.'"
WHERE rssid="'.$id.'"';
echo $SQL."<br>";
// $result = dbquery($SQL);
unset($action, $rss_name, $rss_description, $rss_id);
fallback(FUSION_SELF."?action=feed");
echo "Änderung speichern:<br>".$SQL."<br>";
} else {
$SQL = 'SELECT MAX(rss_order) AS rssorder FROM '.$db_prefix.'hasrn_rss';
$RES = dbquery($SQL);
$ROW = dbarray($RES);
$order = $ROW['rssorder'] + 1;
$SQL = 'INSERT INTO '.$db_prefix.'hasrn_rss (rsstitel, rssdesc, rsstop, rss_order)
VALUES("'.$titel.'", "'.$desc.'", "'.$toprss.'", "'.$order.'")';
$result = dbquery($SQL);
// unset($name, $file, $type, $new_window, $feeds_page);
}
} // Ende IF Formulasr abgeschickt
else echo "<b><br>FORMULAR NICHT ABGESCHICKT</b>";
// Kein Formular abgeschickt
if ($do == 'rssedit') { // Eingabefelder vor-füllen falls EDIT
if(isset($_GET['rssid'])) { $id = stripinput($_GET['rssid']); }
$result = dbquery('SELECT * FROM '.$db_prefix.'hasrn_rss WHERE rssid="'.$id.'"');
$data = dbarray($result);
$name = $data['rssname'];
$xml = $data['rssxml'];
$quelle = $data['rssquelle'];
$quellelink = $data['rssquellelink'];
$logo = $data['rsslogo'];
$maxitemspage = $data['rss_maxitems_page'];
$maxitemspanel = $data['rss_maxitems_panel'];
$startseite = ($data['rssaufstartseite']) ? "checked=\"checked\"" : "";
$formaction = $link."rssedit&rssid=".$data['rssid'];
$tablekopf = $locale['hrn167'];
} else if ($do == "newrss") {
$formaction = $link;
$tablekopf = $locale['hrn166'];
$name = ''; $xml = ''; $quelle = ''; $quellelink = ''; $logo = "";
$maxitemspage = 0; $maxitemspanel = 0;
$startseite = "";
}
// Kategorie-Select aufbauen
$rescat = dbquery('SELECT * FROM '.$db_prefix.'hasrn_cat ORDER BY cat_order ASC');
$anzahl_cat = dbrows($rescat);
if($anzahl_cat >0) {
$cat_vorhanden = 1;
$category = array();
$catoption = "";
while ($cdata = dbarray($rescat)) {
$c = $cdata['catid'];
$category[$c] = $cdata['cattitel'];
$catoption .= "<option value=\"".$cdata['cat_order']."\">".$cdata['cattitel']."</option>";
}
} else {
$cat_vorhanden = 0;
}
// Felder voreingestellt, Formular zeigen
if (isset($tablekopf)) {
opentable($tablekopf);
echo $formaction."<br>";
echo "
<form name=\"addrss\" method=\"post\" action=\"".$formaction."\">
<table align=\"center\" width=\"90%\" cellspacing=\"1\" cellpadding=\"0\" class=\"tbl\">
<tr>
<td width=\"200\">".$locale['hrn150']."</td>
<td><input type=\"text\" name=\"name\" value=\"".$name."\" class=\"textbox\" style=\"width:200px;\"></td>
</tr>
<tr>
<td>".$locale['hrn155']."</td>
<td><select name=\"catordernr\" class=\"textbox\">".$catoption."</select></td>
</tr>
<tr>
<td>".$locale['hrn162']."</td>
<td><input type=\"text\" name=\"xml\" value=\"".$xml."\" class=\"textbox\" style=\"width:300px;\"></td>
</tr>
<tr>
<td>".$locale['hrn152']."</td>
<td><input type=\"text\" name=\"quelle\" value=\"".$quelle."\" class=\"textbox\" style=\"width:300px;\"></td>
</tr>
<tr>
<td>".$locale['hrn153']."</td>
<td><input type=\"text\" name=\"quellelink\" value=\"".$quellelink."\" class=\"textbox\" style=\"width:300px;\"></td>
</tr>
<tr>
<td>".$locale['hrn154']."</td>
<td><input type=\"text\" name=\"quellelogo\" value=\"".$quellelogo."\" class=\"textbox\" style=\"width:300px;\"></td>
</tr>
<tr>
<td>".$locale['hrn163']."</td>
<td><input type=\"text\" name=\"maxitemspage\" value=\"".$maxitemspage."\" class=\"textbox\" style=\"width:30px;\"></td>
</tr>
<tr>
<td>".$locale['hrn164']."</td>
<td><input type=\"text\" name=\"maxitemspanel\" value=\"".$maxitemspanel."\" class=\"textbox\" style=\"width:30px;\"></td>
</tr>
<tr>
<td>".$locale['hrn165']."</td>
<td><input type=\"checkbox\" name=\"rssaufstartseite\" class=\"textbox\" value=\"1\" ".$startseite."> </td>
</tr>
<tr>
<td align=\"center\" colspan=\"2\">
<input type=\"submit\" name=\"rss_speichern\" value=\"".$locale['hrn125']."\" class=\"button\"></td>
</tr>
</table>
</form>";
closetable();
}
// ENDE FORMULAR ANZEIGEN
} // ENDE DO-Abfrage = ENDE ELSE-Zweig.
// NUR DIE LISTE ZEIGEN
opentable($locale['hrn122']);
// Kategorien laden
$rescat = dbquery("SELECT * FROM ".$db_prefix."hasrn_cat ORDER BY catid");
$anzahl_cat = dbrows($rescat);
if($anzahl_cat >0) {
$cat_vorhanden = 1;
$category = array();
while ($cdata = dbarray($rescat)) {
$c = $cdata['catid'];
$category[$c] = $cdata['cattitel'];
}
} else {
$cat_vorhanden = 0;
}
if ($cat_vorhanden) {
echo "<div align=\"center\">";
$result = dbquery("SELECT * FROM ".$db_prefix."hasrn_rss ORDER BY rss_order ASC");
$numrows = dbrows($result);
$res = $result;
if ($numrows != 0) {
// Liste vorhandener Feeds
echo "SQL für Speichern: ".$SQL."<br><<".$_POST['rss_speichern'].">> $do<br><br>";
echo "
<table class=\"tbl-border\" width=\"95%\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\">
<tr>
<td class=\"tbl2\"><b>".$locale['hrn150']."</b><br>".$locale['hrn152']."</td>
<td class=\"tbl2\">".$locale['hrn151']."</td>
<td class=\"tbl2\">".$locale['hrn157']." </td>
<td class=\"tbl2\">".$locale['hrn158']." </td>
<td class=\"tbl2\">".$locale['hrn159']." </td>
<td class=\"tbl2\">".$locale['hrn132']."</td>
<td class=\"tbl2\"></td>
</tr>";
$i = 1;
while ($data = dbarray($result)) {
if ($numrows != 1) {
$up = $data['rss_order'] - 1;
$down = $data['rss_order'] + 1;
if ($i == 1) {
$up_down = ' <a href="'.$link.'rssdown&rssid='.$data['rssid'].'&order='.$down.'"><img src="'.THEME.'images/down.gif" border="0"></a>';
} else if ($i < $numrows) {
$up_down = ' <a href="'.$link.'rssup&rssid='.$data['rssid'].'&order='.$up.'"><img src="'.THEME.'images/up.gif" border="0"></a>';
$up_down .= ' <a href="'.$link.'rssdown&rssid='.$data['rssid'].'&order='.$down.'"><img src="'.THEME.'images/down.gif" border="0"></a>';
} else {
$up_down = ' <a href="'.$link.'rssup&rssid='.$data['rssid'].'&order='.$up.'"><img src="'.THEME.'images/up.gif" border="0"></a>';
}
$i++;
} else {
$up_down = '';
$i++;
}
$order = $data['rss_order'];
$c = $data['rsscat']; $cat = $category[$c]; unset($c);
$maxitem = ($data['rss_maxitems_page'] == 0) ? "Alle" : $data['rss_maxitems_page'];
$startpanel = ($data['rssaufstartseite'] == 0) ? $locale['hrn161'] : $locale['hrn160'];
echo "<tr>
<td class=\"tbl1\"><b>".$data['rssname']."</b><br/>".$data['rssquelle']."</td>
<td class=\"tbl1\">".$cat."</td>
<td class=\"tbl1\" align=\"center\">".$maxitem."</td>
<td class=\"tbl1\" align=\"center\">".$data['rss_maxitems_panel']."</td>
<td class=\"tbl1\" align=\"center\">".$startpanel."</td>
<td class=\"tbl1\"><nobr>".$order." ".$up_down."</nobr></td>
<td class=\"tbl2\"><nobr><a href=\"".$link."rssedit&rssid=".$data['rssid']."\"><img src=\"images/adminedit.gif\" border=\"0\" alt=\"".$locale['hrn123']."\"></a>
| <a href=\"".$link."rssdel&rssid=".$data['rssid']."\"><img src=\"images/admindel.gif\" border=\"0\" alt=\"".$locale['hrn124']."\"></a></nobr></td>
</tr>";
} // Ende WHILE
echo "</table>";
} else { // wenn Numrows = 0, also keine Kategorien vorhanden
echo $locale['hrn129'];
} // Ende If Numrows = 0
echo "<p><a href=\"".$link."newrss\">".$locale['hrn126']."</a></p>";
echo "</div>";
} else { // ENDE IF CAT_VORHANDEN
echo $locale['hrn142']."<br><br><a href=\"".FUSION_SELF.$aidlink."&action=cat&do=newcat\">".$locale['hrn126']."</a>";
}
closetable();
?>