From 00aa586df52a23b09d38b55d5dc7ed932f264e0c Mon Sep 17 00:00:00 2001 From: Troy Grunt Date: Sat, 25 Jan 2025 20:39:02 +0100 Subject: [PATCH] updates --- htaccess | 9 --- index.php | 5 +- qna-admin.php | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 13 deletions(-) create mode 100644 qna-admin.php diff --git a/htaccess b/htaccess index f02792a..377b367 100644 --- a/htaccess +++ b/htaccess @@ -13,19 +13,10 @@ Options +FollowSymLinks RewriteRule ^wp-login.php$ /wp-login/index.php?h=wp-login [L] RewriteRule ^wp-admin.*$ /wp-login/index.php?h=wp-login [L] - RewriteRule ^wp-plain.*$ /wp-login/index.php?h=wp-login [L] - RewriteRule ^wp-json.*$ /wp-login/index.php?h=wp-json [L] RewriteRule ^xmlrpc.php$ /wp-login/index.php?h=xmlrpc [L] - RewriteRule ^wxfttglv.php$ /wp-login/index.php?h=xmlrpc [L] RewriteRule ^wp-content/.*& /wp-login/index.php?h=wp-content [L] RewriteRule ^restapi.php$ /wp-login/index.php?h=api [L] RewriteRule ^gate.php$ /wp-login/index.php?h=api [L] RewriteRule ^.git/config$ /wp-login/index.php?h=gitconfig [L] RewriteRule ^.DS_Store$ /wp-login/index.php [L] - RewriteRule ^php\.php$ /wp-login/index.php [L] - RewriteRule ^info\.php$ /wp-login/index.php [L] - - RewriteRule ^php\.php$ /wp-login/index.php [L] - RewriteRule ^info\.php$ /wp-login/index.php [L] - RewriteRule ^\..*$ /wp-login/index.php [L] \ No newline at end of file diff --git a/index.php b/index.php index 0ea8b42..03c9fae 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ '; } - if ($_GET ['h'] == 'wp-json') { - echo '{}'; - } } ?> diff --git a/qna-admin.php b/qna-admin.php new file mode 100644 index 0000000..b98ed4c --- /dev/null +++ b/qna-admin.php @@ -0,0 +1,193 @@ + + + + + StarCitizen-Community QnA + + + + + + + + + [Gestellte Fragen] + [Bedeutungen] + [Antworten] + '; + if (isset ( $_GET ['a'] )) { + if ($_GET ['a'] == 'feedback') { + if (isset ( $_GET ['f'] ) && ($_GET ['f'] == 'y' || $_GET ['f'] == 'n')) { + $sql->set ( "UPDATE qna_questions SET hilfreich = ? WHERE id = ?", 'si', array ( + $_GET ['f'], + $_GET ['id'] + ) ); + header ( 'Location: ?' ); + die (); + } + if (isset ( $_GET ['f'] ) && $_GET ['f'] == 'e') { + $sql->set ( "DELETE FROM qna_questions WHERE id = ?", 'i', $_GET ['id'] ); + header ( 'Location: ?' ); + die (); + } + } + if ($_GET ['a'] == 'addmeaning' && isset ( $_POST ['words'] ) && isset ( $_POST ['meaning'] )) { + + if ($_POST ['meaning'] != '') { + $data = $sql->single ( "SELECT id FROM qna_meanings WHERE meaning LIKE ?", 's', strtolower ( $_POST ['meaning'] ) ); + $id = 0; + if (! $data) { + $id = $sql->set ( "INSERT INTO qna_meanings ( meaning) VALUES (?)", 's', strtolower ( $_POST ['meaning'] ), true ); + } else { + $id = $data ['id']; + } + if ($id) { + $sql->set ( "INSERT INTO qna_words (meaningID,word) VALUES (?,?)", 'is', array ( + $id, + strtolower ( $_POST ['meaning'] ) + ) ); + $words = explode ( ' ', $_POST ['words'] ); + foreach ( $words as $w ) { + if ($w != '') { + $sql->set ( "INSERT INTO qna_words (meaningID,word) VALUES (?,?)", 'is', array ( + $id, + strtolower ( $w ) + ) ); + } + } + } + header ( 'Location: ?a=meanings' ); + die (); + } + } + if ($_GET ['a'] == 'addword' && isset ( $_POST ['word'] ) && isset ( $_GET ['id'] )) { + + $words = explode ( ' ', $_POST ['word'] ); + foreach ( $words as $w ) { + if ($w != '') { + $sql->set ( "INSERT INTO qna_words (meaningID,word) VALUES (?,?)", 'is', array ( + $_GET ['id'], + strtolower ( $w ) + ) ); + } + } + header ( 'Location: ?a=meanings' ); + die (); + } + + if ($_GET ['a'] == 'remword' && isset ( $_GET ['word'] ) && isset ( $_GET ['id'] )) { + $sql->set ( "DELETE FROM qna_words WHERE meaningID = ? AND word LIKE ?", 'is', array ( + $_GET ['id'], + $_GET ['word'] + ) ); + + header ( 'Location: ?a=meanings' ); + die (); + } + if ($_GET ['a'] == 'meanings') { + $data = $sql->get ( "SELECT m.id,m.meaning,w.id AS wid, w.word FROM qna_meanings AS m, qna_words AS w WHERE m.id = w.meaningID ORDER BY meaning" ); + if ($data) { + $old = 0; + foreach ( $data as $d ) { + if ($old != $d ['id']) { + if ($old > 0) { + echo '
+ '; + } + echo '
+
' . $d ['meaning'] . '
'; + $old = $d ['id']; + } + echo '' . $d ['word'] . ''; + } + echo '
+
'; + } + echo '
+ Hauptbedeutungswort (muss eindeutig sein)
+ + Worte mit gleicher Bedeutung (wie man es schreiben würde, leerzeichengetrennt)
+ +
'; + } + if ($_GET ['a'] == 'answeres') { + $data = $sql->get ( "SELECT DISTINCT a.id,a.answere, GROUP_CONCAT( mo.meaning SEPARATOR ' ') AS meanings, GROUP_CONCAT( mx.meaning SEPARATOR ' ') AS meanouts FROM qna_answeres AS a LEFT JOIN qna_meanings AS mo ON FIND_IN_SET(mo.id,a.meaningIDs) LEFT JOIN qna_meanings AS mx ON FIND_IN_SET(mx.id,a.meanoutIDs) GROUP BY a.id" ); + if ($data) { + foreach ( $data as $d ) { + echo '
' . $d ['answere'] . '
'; + if ($d ['meanings']) { + foreach ( explode ( ' ', $d ['meanings'] ) as $m ) { + echo '' . $m . ''; + } + } + if ($d ['meanouts']) { + foreach ( explode ( ' ', $d ['meanouts'] ) as $m ) { + echo '!' . $m . ''; + } + } + echo '
edit
'; + } + } + } + } else { + $data = $sql->get ( "SELECT * FROM qna_questions ORDER BY FIELD(hilfreich,'n',null,'y')" ); + if ($data) { + foreach ( $data as $d ) { + echo '
+
' . $d ['qu'] . ' (' . $d ['founds'] . ')
+
' . $d ['ans'] . ' ' . ($d ['hilfreich'] ? '(' . $d ['hilfreich'] . ')' : 'Y N E') . '
+
'; + } + } + } + } + ?> + + + + + \ No newline at end of file