321 lines
9.3 KiB
Plaintext
321 lines
9.3 KiB
Plaintext
<?php
|
|
/*
|
|
# Fuer debugging
|
|
error_reporting(E_ALL);
|
|
ini_set('display_errors', 1);
|
|
#echo __LINE__."<br>";
|
|
*/
|
|
include_once 'classes/lg-on_Smarty.class.php';
|
|
$smarty = new lgon_Smarty();
|
|
require_once("config.inc.php");
|
|
require_once("func_rollenrechte.php");
|
|
require_once("func_htmlclean.php");
|
|
$templatename = substr(basename($_SERVER['PHP_SELF']),0,-3)."html";
|
|
require_once "language/german.inc.php";
|
|
|
|
|
|
// Rechteüberprüfung
|
|
if ($user_admin == ""){ require("index.php"); exit;} //Wenn man nicht angemeldet ist, darf man nicht auf die Seite
|
|
if(!rore($user_admin,'a_worterf','RE')){require("lib/rechte.php");exit;}
|
|
// Rechteüberprüfung ende
|
|
|
|
|
|
if(isset($_GET['action'])){
|
|
$action = $_GET['action'];
|
|
}else{
|
|
$action = '';
|
|
}
|
|
|
|
if($action == ''){
|
|
|
|
dbconnect();
|
|
$query = "SELECT bezeichnung FROM thema GROUP BY bezeichnung ORDER BY tid DESC";
|
|
$result = $db->query( $query)
|
|
or die ("Cannot execute query");
|
|
|
|
while ($row = $result->fetch_array()){
|
|
$value[] = $row;
|
|
}
|
|
$smarty->assign('table_data', $value);
|
|
|
|
|
|
$db = dbconnect();
|
|
$query = "SELECT kid, bezeichnung FROM kategorie ORDER BY bezeichnung ASC";
|
|
$result = $db->query( $query)
|
|
or die ("Cannot execute query");
|
|
|
|
while ($row = $result->fetch_array()){
|
|
$value1[] = $row;
|
|
}
|
|
$smarty->assign('table_data1', $value1);
|
|
}
|
|
|
|
# Beim Erfassen wird unterschieden ob eine Textstelle angegeben wurde oder nicht
|
|
# Wird eine angegeben, dann wird geprüft, ob sie den Vorgaben entspricht und dann den insert durchgeführt
|
|
# Wird eine keine Textstelle angegeben dann wird der insert ohne Überprüfung der Textstelle durchgeführt
|
|
|
|
if($action == 'erfassen1'){
|
|
$db = dbconnect();
|
|
$datum = "$_POST[beg_jahr]-$_POST[beg_mon]-$_POST[beg_tag]";
|
|
$vorwort = htmlclean($_POST['vorwort'], $db);
|
|
$wort = htmlclean($_POST['wort'], $db);
|
|
$botschaft = htmlclean($_POST['botschaft'], $db);
|
|
$inhalt = htmlclean($_POST['inhalt'], $db);
|
|
$zusammenfassung = htmlclean($_POST['zusammenfassung'], $db);
|
|
$kontext = htmlclean($_POST['kontext'], $db);
|
|
$textstelle = $_POST['textstelle'];
|
|
|
|
if($_POST['dhtmlgoodies_city'] == NULL){
|
|
$ukid = 'NULL';
|
|
}else{
|
|
$ukid = $_POST['dhtmlgoodies_city'];
|
|
setcookie("ck_ukid",$ukid);
|
|
}
|
|
|
|
if (@checkdate($_POST[beg_mon], $_POST[beg_tag], $_POST[beg_jahr]) == 0) { // checkdate liefert 0 & 1 zurück: 0 wenn Datum falsch, 1 wenn Datum richtig
|
|
$smarty->assign('wort_erfassen_checkdate_err', "1");
|
|
$fehler = TRUE;
|
|
}
|
|
elseif ((
|
|
// Pregs auf vollständige Bibelbücher überprüft
|
|
// Bücher mit mehreren Bücher 1. Johannes...
|
|
preg_match("/^([1-9])\.\s* (Makkabäer|Johannes|Mose|Könige|Chronik|Korinther|Samuel|Thessalonicher|Timotheus|Petrus)\s*[0-9]{1,2}(\,)?\s*(aus)?\s*[0-9]{1,3}(\.|-)?([0-9]{1,3})?(\.)?([0-9]{1,3})?$/im", $textstelle)
|
|
or
|
|
// Bücher mit nur einem Buch Rut 3,5-7
|
|
preg_match("/^(Gebet Manasses|Stücke zu Daniel|Stücke zu Ester|Baruch|Weisheit|Judit|Johannes|Sirach|Josua|Richter|Rut|Ruth|Esra|Nehemia|Esther|Ester|Hiob|Psalm|Sprüche|Prediger|Hoheslied|Jesaja|Jeremia|Klagelieder|Hesekiel|Daniel|Hosea|Joel|Amos|Tobias|Obadja|Jona|Micha|Nahum|Habakuk|Zefanja|Haggai|Sacharja|Maleachi|Matthäus|Markus|Lukas|Apostelgeschichte|Römer|Galater|Epheser|Philipper|Kolosser|Titus|Hebräer|Jakobus|Offenbarung)\s*[0-9]{1,3}(\,)?\s*(aus)?\s*[0-9]{1,3}(\.|-)?([0-9]{1,3})?(\.)?([0-9]{1,3})?$/im", $textstelle)
|
|
or
|
|
// Bücher ohne Kapitel
|
|
preg_match("/^(Philemon|Judas)\s*(aus)?\s*[0-9]{1,3}(\.|-)?([0-9]{1,3})?(\.)?([0-9]{1,3})?$/im", $textstelle)
|
|
)
|
|
AND $textstelle != ""
|
|
)
|
|
{
|
|
|
|
function refill($start, $ende)
|
|
{
|
|
|
|
for($i=$start; $i<$ende; $i++){
|
|
$j.="|$i";
|
|
|
|
}
|
|
$j.="|".$i."|";
|
|
return $j;
|
|
|
|
}
|
|
|
|
function refillpunkt($zahl1, $zahl2, $zahl3)
|
|
{
|
|
|
|
$j="|$zahl1|$zahl2|";
|
|
|
|
if($zahl3 != ''){
|
|
$j.="$zahl3|";
|
|
}
|
|
return $j;
|
|
|
|
}
|
|
|
|
function makeLink($a, $b, $c, $d, $e, $f,$g,$h, $lid)
|
|
{
|
|
settype($f, "integer");
|
|
if($e=='-'){
|
|
|
|
$d=refill($d,$f);
|
|
$e="";
|
|
$f="";
|
|
}elseif($e=='.'){
|
|
$d=refillpunkt($d,$f,$h);
|
|
$e="";
|
|
$f="";
|
|
$g="";
|
|
$h="";
|
|
}else{
|
|
$d="|$d|";
|
|
}
|
|
|
|
|
|
$db = dbconnect();
|
|
$sql = $db->query("UPDATE quelle
|
|
SET txt_anz_buch=trim('$a')
|
|
, txt_buch=trim('$b')
|
|
, txt_kapitel=trim('$c')
|
|
, txt_vers =trim('$d')
|
|
WHERE lid='$lid'");
|
|
|
|
|
|
}
|
|
|
|
|
|
// Wenn Wörter dem richtigen Aufbau entsprechen, dann weiter
|
|
|
|
if(isset($_POST['stapgd'])){
|
|
if($_POST['stapgd'] == 'Y'){
|
|
$stapgd = 'Y';
|
|
}else{
|
|
$stapgd = 'N';
|
|
}
|
|
}else{
|
|
$stapgd = 'N';
|
|
}
|
|
|
|
|
|
## Prüfen, ob es das Thema schon gibt
|
|
$result = $db->query("SELECT tid FROM thema WHERE bezeichnung = '$_POST[thema]'");
|
|
$row = $result->fetch_array();
|
|
|
|
## wenn nicht, dann eintragen
|
|
if($row['tid'] == ''){
|
|
$sql1 = $db->query("INSERT INTO thema ( bezeichnung) VALUES ('$_POST[thema]') ");
|
|
}
|
|
|
|
## ThemaID (tid) abfragen
|
|
$result = $db->query("SELECT tid FROM thema WHERE bezeichnung = '$_POST[thema]'");
|
|
$row = $result->fetch_array();
|
|
|
|
|
|
## Unterhema eintragen
|
|
$sql1 = $db->query("INSERT INTO unterthema ( tid, bezeichnung) VALUES ('$row[tid]', '$_POST[unterthema]') ");
|
|
|
|
## UnterThemaID (utid) abfragen
|
|
$result1 = $db->query("SELECT utid FROM unterthema WHERE bezeichnung = '$_POST[unterthema]' AND tid='$row[tid]' ");
|
|
$row1 = $result1->fetch_array();
|
|
|
|
|
|
|
|
|
|
|
|
$sql1 = $db->query("INSERT INTO quelle ( Textstelle
|
|
, Ueberschrift
|
|
, thema
|
|
, unterthema
|
|
, vorwort
|
|
, botschaft
|
|
, Textwort
|
|
, Inhalt
|
|
, zusammenfassung
|
|
, kontext
|
|
, Datum
|
|
, stapgd
|
|
, kid
|
|
, ukid
|
|
)
|
|
VALUES
|
|
( '$textstelle'
|
|
, \"". $_POST['uberschrift']."\"
|
|
, $row[tid]
|
|
, $row1[utid]
|
|
, '$vorwort'
|
|
, '$botschaft'
|
|
, '$wort'
|
|
, '$inhalt'
|
|
, '$zusammenfassung'
|
|
, '$kontext'
|
|
, '$datum'
|
|
, '$stapgd'
|
|
, \"". $_POST['dhtmlgoodies_country']."\"
|
|
, $ukid
|
|
)"
|
|
);
|
|
$lid = $db->insert_id;
|
|
|
|
$textstelle=preg_replace_callback("/^([1-9]\.)*\s*". //1 a
|
|
"(Makkabäer|Johannes|Mose|Könige|Chronik|Korinther|Samuel|Thessalonicher|Timotheus|Petrus|Gebet Manasses|Stücke zu Daniel|Stücke zu Ester|Baruch|Weisheit|Judit|Judith|Sirach|Josua|Richter|Rut|Ruth|Esra|Nehemia|Esther|Ester|Hiob|Ijob|Psalm|Sprüche|Prediger|Hoheslied|Jesaja|Jeremia|Klagelieder|Hesekiel|Ezechiel|Daniel|Hosea|Joel|Amos|Tobias|Obadja|Jona|Micha|Nahum|Habakuk|Zefanja|Haggai|Sacharja|Maleachi|Matthäus|Markus|Lukas|Apostelgeschichte|Römer|Galater|Epheser|Philipper|Kolosser|Titus|Hebräer|Jakobus|Offenbarung|Philemon|Judas)\s*". //2
|
|
"([0-9]{1,3})". //3 c
|
|
"(\,)?\s*". //4
|
|
"(aus)?\s*". //5
|
|
"([0-9]{0,3})". //6 d
|
|
"(\.|-)?". //7 e
|
|
"([0-9]{0,3})?". //8 f
|
|
"(\.|-)?". //9 g
|
|
"(\s)?". //10 g
|
|
"([0-9]{0,3})". //11 h
|
|
"$/", function($m) use (&$lid) { return makeLink($m[1], $m[2], $m[3], $m[6], $m[7], $m[8], $m[9], $m[11], $lid);}, $textstelle);
|
|
|
|
if (!$sql1)
|
|
{
|
|
$smarty->assign('wort_erfassen_sql_err1', "1");
|
|
$fehler = TRUE;
|
|
}
|
|
|
|
|
|
|
|
}elseif($textstelle == ""){
|
|
if($_POST[stapgd] == 'Y'){
|
|
$stapgd = 'Y';
|
|
}else{
|
|
$stapgd = 'N';
|
|
}
|
|
|
|
|
|
## Prüfen, ob es das Thema schon gibt
|
|
$result = $db->query("SELECT tid FROM thema WHERE bezeichnung = '$_POST[thema]'");
|
|
$row = $result->fetch_array();
|
|
|
|
## wenn nicht, dann eintragen
|
|
if($row[tid] == ''){
|
|
$sql1 = $db->query("INSERT INTO thema ( bezeichnung) VALUES ('$_POST[thema]') ");
|
|
}
|
|
|
|
## ThemaID (tid) abfragen
|
|
$result = $db->query("SELECT tid FROM thema WHERE bezeichnung = '$_POST[thema]'");
|
|
$row = $result->fetch_array();
|
|
|
|
## Unterhema eintragen
|
|
$sql1 = $db->query("INSERT INTO unterthema ( tid, bezeichnung) VALUES ('$row[tid]', '$_POST[unterthema]') ");
|
|
|
|
## UnterThemaID (utid) abfragen
|
|
$result1 = $db->query("SELECT utid FROM unterthema WHERE bezeichnung = '$_POST[unterthema]' AND tid='$row[tid]' ");
|
|
$row1 = $result1->fetch_array();
|
|
|
|
|
|
$sql1 = $db->query("INSERT INTO quelle ( Textstelle
|
|
, Ueberschrift
|
|
, thema
|
|
, unterthema
|
|
, botschaft
|
|
, Textwort
|
|
, Inhalt
|
|
, zusammenfassung
|
|
, kontext
|
|
, Datum
|
|
, stapgd
|
|
, kid
|
|
, ukid
|
|
)
|
|
VALUES
|
|
( '$textstelle'
|
|
, \"". $_POST['uberschrift']."\"
|
|
, $row[tid]
|
|
, $row1[utid]
|
|
, '$botschaft'
|
|
, '$wort'
|
|
, '$inhalt'
|
|
, '$zusammenfassung'
|
|
, '$kontext'
|
|
, '$datum'
|
|
, '$stapgd'
|
|
, \"". $_POST['dhtmlgoodies_country']."\"
|
|
, $ukid
|
|
)"
|
|
);
|
|
|
|
if (!$sql1)
|
|
{
|
|
$smarty->assign('wort_erfassen_sql_err1', "1");
|
|
$fehler = TRUE;
|
|
}
|
|
|
|
|
|
}else{
|
|
$smarty->assign('wort_erfassen_sql_err2', "1");
|
|
$fehler = TRUE;
|
|
}
|
|
|
|
if(!isset($fehler)){
|
|
$smarty->assign('wort_erfassen_success', "1");
|
|
}
|
|
}
|
|
|
|
$smarty->assign('action', "$action");
|
|
$smarty->display("$template/$templatename");
|
|
?> |