removed faq feature
parent
f79f711e16
commit
821e37c1b2
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
function admin_faq_title() {
|
||||
return _("Edit FAQs");
|
||||
}
|
||||
|
||||
function admin_faq() {
|
||||
if (! isset($_REQUEST['action'])) {
|
||||
$faqs_html = "";
|
||||
$faqs = sql_select("SELECT * FROM `FAQ`");
|
||||
foreach ($faqs as $faq) {
|
||||
$faqs_html .= sprintf('<tr><td> <dl><dt>%s</dt><dd>%s</dd></dl> </td>' . '<td> <dl><dt>%s</dt><dd>%s</dd></dl> </td>' . '<td><a href="%s&action=edit&id=%s">Edit</a></td></tr>', $faq['Frage_de'], $faq['Antwort_de'], $faq['Frage_en'], $faq['Antwort_en'], page_link_to('admin_faq'), $faq['FID']);
|
||||
}
|
||||
return template_render('../templates/admin_faq.html', array(
|
||||
'link' => page_link_to("admin_faq"),
|
||||
'faqs' => $faqs_html
|
||||
));
|
||||
} else {
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'create':
|
||||
$frage = strip_request_item_nl('frage');
|
||||
$antwort = strip_request_item_nl('antwort');
|
||||
$question = strip_request_item_nl('question');
|
||||
$answer = strip_request_item_nl('answer');
|
||||
|
||||
sql_query("INSERT INTO `FAQ` SET `Frage_de`='" . sql_escape($frage) . "', `Frage_en`='" . sql_escape($question) . "', `Antwort_de`='" . sql_escape($antwort) . "', `Antwort_en`='" . sql_escape($answer) . "'");
|
||||
|
||||
redirect(page_link_to("admin_faq"));
|
||||
break;
|
||||
|
||||
case 'save':
|
||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
|
||||
$id = $_REQUEST['id'];
|
||||
else
|
||||
return error("Incomplete call, missing FAQ ID.", true);
|
||||
|
||||
$faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1");
|
||||
if (count($faq) > 0) {
|
||||
list($faq) = $faq;
|
||||
|
||||
$frage = strip_request_item_nl('frage');
|
||||
$antwort = strip_request_item_nl('antwort');
|
||||
$question = strip_request_item_nl('question');
|
||||
$answer = strip_request_item_nl('answer');
|
||||
|
||||
sql_query("UPDATE `FAQ` SET `Frage_de`='" . sql_escape($frage) . "', `Frage_en`='" . sql_escape($question) . "', `Antwort_de`='" . sql_escape($antwort) . "', `Antwort_en`='" . sql_escape($answer) . "' WHERE `FID`=" . sql_escape($id) . " LIMIT 1");
|
||||
|
||||
redirect(page_link_to("admin_faq"));
|
||||
} else
|
||||
return error("No FAQ found.", true);
|
||||
break;
|
||||
|
||||
case 'edit':
|
||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
|
||||
$id = $_REQUEST['id'];
|
||||
else
|
||||
return error("Incomplete call, missing FAQ ID.", true);
|
||||
|
||||
$faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1");
|
||||
if (count($faq) > 0) {
|
||||
list($faq) = $faq;
|
||||
|
||||
return template_render('../templates/admin_faq_edit_form.html', array(
|
||||
'link' => page_link_to("admin_faq"),
|
||||
'id' => $id,
|
||||
'frage' => $faq['Frage_de'],
|
||||
'antwort' => $faq['Antwort_de'],
|
||||
'question' => $faq['Frage_en'],
|
||||
'answer' => $faq['Antwort_en']
|
||||
));
|
||||
} else
|
||||
return error("No FAQ found.", true);
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id']))
|
||||
$id = $_REQUEST['id'];
|
||||
else
|
||||
return error("Incomplete call, missing FAQ ID.", true);
|
||||
|
||||
$faq = sql_select("SELECT * FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1");
|
||||
if (count($faq) > 0) {
|
||||
list($faq) = $faq;
|
||||
|
||||
sql_query("DELETE FROM `FAQ` WHERE `FID`=" . sql_escape($id) . " LIMIT 1");
|
||||
redirect(page_link_to("admin_faq"));
|
||||
} else
|
||||
return error("No FAQ found.", true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
function faq_title() {
|
||||
return _("FAQ");
|
||||
}
|
||||
|
||||
function guest_faq() {
|
||||
$html = "";
|
||||
$faqs = sql_select("SELECT * FROM `FAQ`");
|
||||
foreach ($faqs as $faq) {
|
||||
$html .= "<dl>";
|
||||
if ($_SESSION['locale'] == "de_DE.UTF-8") {
|
||||
$html .= sprintf(
|
||||
'<dt>%s</dt> <dd>%s</dd>',
|
||||
$faq['Frage_de'],
|
||||
$faq['Antwort_de']
|
||||
);
|
||||
} else {
|
||||
$html .= sprintf(
|
||||
'<dt>%s</dt> <dd>%s</dd>',
|
||||
$faq['Frage_en'],
|
||||
$faq['Antwort_en']
|
||||
);
|
||||
}
|
||||
$html .= "</dl>";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
?>
|
Binary file not shown.
@ -1,6 +0,0 @@
|
||||
%faqs%
|
||||
<hr/>Create new FAQ:
|
||||
<form action="%link%&action=create" method="post">
|
||||
%new_form%
|
||||
<input type="submit" name="submit" value="Create" />
|
||||
</form>
|
@ -1,41 +0,0 @@
|
||||
Edit FAQ:
|
||||
<form action="%link%&action=save" method="post">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
Frage
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="frage">%frage%</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Antwort
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="antwort">%antwort%</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Question
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="question">%question%</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Answer
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="answer">%answer%</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="id" value="%id%" /><input type="submit" name="submit" value="Save" />
|
||||
</form><hr/>
|
||||
<form action="%link%&action=delete" method="post">
|
||||
Delete FAQ: <input type="hidden" name="id" value="%id%" /><input type="submit" name="submit" value="Delete" />
|
||||
</form>
|
Loading…
Reference in New Issue