Initial commit
This commit is contained in:
394
bibellookup_1984.php
Normal file
394
bibellookup_1984.php
Normal file
@ -0,0 +1,394 @@
|
||||
<?php
|
||||
|
||||
function mailnachricht($wort, $art, $id)
|
||||
{
|
||||
$db = dbconnect(); #12.09.2014
|
||||
$user_admin=$_COOKIE["user_admin"];
|
||||
$empfaenger = "admin@lg-on.de";
|
||||
$betreff = "Leitgedanken-Online: Fehler bei Bibelstelle";
|
||||
|
||||
if($art=='T'){
|
||||
$systemart="Textwort";
|
||||
$result1_daten = $db->query("SELECT ueberschrift,date_format(datum, '%d.%m.%Y') datum
|
||||
FROM quelle
|
||||
WHERE lid = '$id'
|
||||
");
|
||||
$row_daten = $result1_daten->fetch_array();
|
||||
|
||||
$info ="$row_daten[ueberschrift] ($row_daten[datum])";
|
||||
|
||||
}
|
||||
|
||||
if($art=='L'){
|
||||
$systemart="Publikationen";
|
||||
$result1_daten = $db->query("SELECT thema
|
||||
FROM lue_quelle
|
||||
WHERE eid = '$id'
|
||||
");
|
||||
$row_daten = $result1_daten->fetch_array();
|
||||
|
||||
$info ="$row_daten[thema]";
|
||||
}
|
||||
|
||||
if($art=='B'){
|
||||
$systemart="Luther Bibel 1984";
|
||||
|
||||
$info ="Falscher Textverweis in Bibelstelle";
|
||||
}
|
||||
|
||||
$result_user = $db->query("SELECT nachname, vorname FROM admin where user=\"$user_admin\"");
|
||||
$row_user = $result_user->fetch_array();
|
||||
|
||||
|
||||
$text = "
|
||||
<html>
|
||||
<head>
|
||||
<title>Fehler bei Bibelstelle</title>
|
||||
</head>
|
||||
<body>
|
||||
<font face='Arial' size='2'>
|
||||
Guten Tag!<br><br>
|
||||
In Leitgedanken Online wurde ein Fehler in der einer Bibelstelle gefunden.
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
Textwort:
|
||||
</font>
|
||||
</td>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
<b>$wort</b>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
System:
|
||||
</font>
|
||||
</td>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
<b>$systemart</b>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
Thema:
|
||||
</font>
|
||||
</td>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
<b>$info</b>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
ID:
|
||||
</font>
|
||||
</td>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
<b>$id</b>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
Betroffener:
|
||||
</font>
|
||||
</td>
|
||||
<td valign='top'>
|
||||
<font face='Arial' size='2'>
|
||||
<b>$row_user[vorname] $row_user[nachname]</b>
|
||||
</font>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
Bitte korrigieren Sie den Fehler umgehend!
|
||||
<p>
|
||||
Diese Mail wurde automatisch generiert!<br>
|
||||
Antworten Sie daher nicht auf diese Mail<br>
|
||||
<br>
|
||||
Vielen Dank
|
||||
</body>
|
||||
</html>";
|
||||
|
||||
|
||||
$headers = "MIME-Version: 1.0\n";
|
||||
#$headers .= "Content-type: text/html; charset=iso-8859-1\n";
|
||||
$headers .= "Content-type: text/html; charset=utf-8\n";
|
||||
$headers .= "From: Leitgedanken Online <admin@lg-on.de>\n";
|
||||
|
||||
@$return = @mail($empfaenger, $betreff, $text, $headers);
|
||||
|
||||
}
|
||||
|
||||
|
||||
# Text zwischen Text ausblenden, wie Überschriften
|
||||
# http://entwickler-forum.de/showthread.php?t=61357
|
||||
function strip_only($str, $tags, $stripContent = false) {
|
||||
$content = '';
|
||||
if(!is_array($tags)) {
|
||||
$tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags));
|
||||
if(end($tags) == '') array_pop($tags);
|
||||
}
|
||||
foreach($tags as $tag) {
|
||||
if ($stripContent)
|
||||
$content = '(.+</'.$tag.'[^>]*>|)';
|
||||
$str = preg_replace('#</?'.$tag.'[^>]*>'.$content.'#is', '', $str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function splitWord($a, $b, $c, $d, $e, $f, $g, $h, $art, $id)
|
||||
{
|
||||
|
||||
/*
|
||||
$ "a: '$a'<br>
|
||||
b: '$b'<br>
|
||||
c: '$c'<br>
|
||||
d: '$d'<br>
|
||||
e: '$e'<br>
|
||||
f: '$f'<br>
|
||||
g: '$g'<br>
|
||||
h: '$h'<br>
|
||||
i: '$i'<br>
|
||||
<br>
|
||||
";
|
||||
*/
|
||||
|
||||
// mehrere Textwörter
|
||||
|
||||
if($g=='-'){
|
||||
|
||||
$db = dbconnect();
|
||||
$result1_pruef = $db->query("SELECT count(*) Anz
|
||||
FROM bibel_lut_1984
|
||||
WHERE anz_buch = '$a'
|
||||
AND buch = '$b'
|
||||
AND kapitel ='$c'
|
||||
AND vers = '$f'
|
||||
ORDER BY bid ASC
|
||||
");
|
||||
$row_pruef1 = $result1_pruef->fetch_array();
|
||||
|
||||
|
||||
$result2_pruef = $db->query("SELECT count(*) Anz
|
||||
FROM bibel_lut_1984
|
||||
WHERE anz_buch = '$a'
|
||||
AND buch = '$b'
|
||||
AND kapitel ='$c'
|
||||
AND vers = '$h'
|
||||
ORDER BY bid ASC
|
||||
");
|
||||
$row_pruef2 = $result2_pruef->fetch_array();
|
||||
|
||||
|
||||
if($row_pruef1['Anz'] > 0 AND $row_pruef2 ['Anz'] > 0){
|
||||
|
||||
$result1 = $db->query("SELECT bid
|
||||
FROM bibel_lut_1984
|
||||
WHERE anz_buch = '$a'
|
||||
AND buch = '$b'
|
||||
AND kapitel ='$c'
|
||||
AND vers = '$f'
|
||||
ORDER BY bid ASC
|
||||
");
|
||||
$row1 = $result1->fetch_array();
|
||||
|
||||
$result2 = $db->query("SELECT bid
|
||||
FROM bibel_lut_1984
|
||||
WHERE anz_buch = '$a'
|
||||
AND buch = '$b'
|
||||
AND kapitel ='$c'
|
||||
AND vers = '$h'
|
||||
ORDER BY bid ASC
|
||||
");
|
||||
$row2 = $result2->fetch_array();
|
||||
|
||||
|
||||
|
||||
$query = "SELECT vers, inhalt
|
||||
FROM bibel_lut_1984
|
||||
WHERE bid between $row1[bid] AND $row2[bid]
|
||||
AND vers !=''
|
||||
ORDER BY bid ASC
|
||||
";
|
||||
|
||||
$result = $db->query( $query)
|
||||
or die ("Cannot execute query: mehrere Textwörter");
|
||||
|
||||
// Schleife über alle Kapitel der Bibel
|
||||
$ret_wort = "";
|
||||
|
||||
while ($row = $result->fetch_array()){
|
||||
# Text zwischen Überschriften wegfiltern
|
||||
$tags = 'h3';
|
||||
$inhalt = strip_only($row['inhalt'], $tags, true); // text
|
||||
|
||||
$ret_wort .= " <span class=\'verse\'>$row[vers]</span> $inhalt";
|
||||
}
|
||||
|
||||
}else{
|
||||
$ret_wort ="Die Textstelle konnte nicht geladen werden<br>Evtl liegt ein Schreibfehler vor. <br>Der Administrator wurde verständigt!";
|
||||
$wort="$a$b $c$d$e$f$g$h";
|
||||
mailnachricht($wort, $art,$id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// einzelne Textstellen
|
||||
if($g=='' AND $f!=''){
|
||||
$db = dbconnect();
|
||||
$result_pruef = $db->query("SELECT count(*) Anz
|
||||
FROM bibel_lut_1984
|
||||
WHERE anz_buch = '$a'
|
||||
AND buch = '$b'
|
||||
AND kapitel ='$c'
|
||||
AND vers = '$f'
|
||||
ORDER BY bid ASC
|
||||
");
|
||||
$row_pruef = $result_pruef->fetch_array();
|
||||
|
||||
|
||||
|
||||
if($row_pruef['Anz'] > 0){
|
||||
$result1 = $db->query("SELECT bid
|
||||
FROM bibel_lut_1984
|
||||
WHERE anz_buch = '$a'
|
||||
AND buch = '$b'
|
||||
AND kapitel ='$c'
|
||||
AND vers = '$f'
|
||||
ORDER BY bid ASC
|
||||
");
|
||||
$row1 = $result1->fetch_array();
|
||||
|
||||
|
||||
$query = "SELECT vers, inhalt
|
||||
FROM bibel_lut_1984
|
||||
WHERE bid = $row1[bid]
|
||||
AND vers !=''
|
||||
ORDER BY bid ASC
|
||||
";
|
||||
|
||||
$result = $db->query( $query)
|
||||
or die ("Cannot execute query");
|
||||
|
||||
// Schleife über alle Kapitel der Bibel
|
||||
$ret_wort = "";
|
||||
|
||||
while ($row = $result->fetch_array()){
|
||||
|
||||
# Text zwischen Überschriften wegfiltern
|
||||
$tags = 'h3';
|
||||
$inhalt = strip_only($row['inhalt'], $tags, true); // text
|
||||
|
||||
$ret_wort .= " <span class=\'verse\'>$row[vers]</span> $inhalt";
|
||||
}
|
||||
|
||||
}else{
|
||||
$ret_wort ="Die Textstelle konnte nicht geladen werden<br>Evtl liegt ein Schreibfehler vor. <br>Der Administrator wurde verständigt!";
|
||||
$wort="$a$b $c$d$e$f$g$h";
|
||||
mailnachricht($wort, $art,$id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ganze Kapitel
|
||||
if($g=='' AND $f==''){
|
||||
$db = dbconnect();
|
||||
|
||||
$query = "SELECT vers, inhalt
|
||||
FROM bibel_lut_1984
|
||||
WHERE anz_buch = '$a'
|
||||
AND buch = '$b'
|
||||
AND kapitel ='$c'
|
||||
AND vers != ''
|
||||
ORDER BY bid ASC
|
||||
";
|
||||
|
||||
|
||||
$result = $db->query( $query)
|
||||
or die ("Cannot execute query: Ganze Kapitel");
|
||||
|
||||
// Schleife über alle Kapitel der Bibel
|
||||
$ret_wort = "";
|
||||
|
||||
while ($row = $result->fetch_array()){
|
||||
|
||||
# Text zwischen Überschriften wegfiltern
|
||||
$tags = 'h3';
|
||||
$inhalt = strip_only($row['inhalt'], $tags, true); // text
|
||||
|
||||
$ret_wort .= " <span class=\'verse\'>$row[vers]</span> $inhalt";
|
||||
}
|
||||
|
||||
$max=1000;
|
||||
$origin=strlen($ret_wort);
|
||||
$ret_wort = substr($ret_wort.' ' , 0 , $max + 1);
|
||||
$ret_wort = substr($ret_wort , 0 , strrpos ($ret_wort , ' '));
|
||||
|
||||
$ret_wort = strip_tags($ret_wort, '<nobr><em>,<span>,<br>,<b>,<strong>,<ul>,<li>,<ol>,<a>');
|
||||
if($max<=$origin){
|
||||
# Funktioniert manchmal nicht, da nicht zwischen Wort getrennt wird [strrpos ($ret_wort , ' ')] sondern immer nach einem
|
||||
# vollständigen Wort. Das Merkmal ist: Wenn ein Leerzeichen kommt, dann trennen.
|
||||
# Es kann passieren, dass es dann nach dem Wort span [<span class=\'verse\'>] getrennt wird,
|
||||
# Dann sieht es so aus: <span<nobr> <b>[...]</b></nobr>, weil nach dem Span ein Leerzeichen kommt.
|
||||
# Der Tag wird dann nicht dargestellt.
|
||||
# Zur Minderung: $ret_wort = strip_tags($ret_wort, '<nobr><em>,<span>,<br>,<b>,<strong>,<ul>,<li>,<ol>,<a>');
|
||||
$ret_wort.="<nobr> <b>[...]</b></nobr>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$wort="$a$b $c$d$e$f$g$h";
|
||||
$sql1 = $db->query( "INSERT INTO test (wort, inhalt) VALUES ('$wort', '$ret_wort')" );
|
||||
|
||||
|
||||
$ret_wort=trim($ret_wort);
|
||||
$ret_wort = strip_tags($ret_wort, '<nobr><em>,<span>,<br>,<b>,<strong>,<ul>,<li>,<ol>,<a>');
|
||||
$ret_wort =str_replace ("#", "\#" , $ret_wort);
|
||||
return $ret_wort;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getword($wort){
|
||||
|
||||
$wort = str_replace (array("ä", "Ä", "ü", "Ü", "ö", "Ö", "ß")
|
||||
, array("ä", "Ä", "ü", "Ü", "ö", "Ö", "ß")
|
||||
, $wort
|
||||
);
|
||||
|
||||
$trenner = explode("|", $wort);
|
||||
$wort = $trenner[0];
|
||||
|
||||
if(isset($trenner[1])){
|
||||
$art = $trenner[1];
|
||||
}else{
|
||||
$art = "";
|
||||
}
|
||||
|
||||
if(isset($trenner[2])){
|
||||
$id = $trenner[2];
|
||||
}else{
|
||||
$id = "";
|
||||
}
|
||||
|
||||
return preg_replace_callback("/([0-9][0-9]?\.\s*)?(Philemon|Judas|Johannes|Mose|Könige|Chronik|Korinther|Samuel|Thessalonicher|Timotheus|Petrus|Sirach|Mose|Josua|Richter|Rut|Ruth|Samuel|Könige|Chronik|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|Judit|Weisheit|Baruch|Makkabäer|Stücke zu Ester|Stücke zu Daniel|Gebet Manasses|Matthäus|Markus|Lukas|Apostelgeschichte|Römer|Korinther|Galater|Epheser|Philipper|Kolosser|Thessalonicher|Timotheus|Titus|Hebräer|Jakobus|Offenbarung)(\s*[0-9]{1,3})(,\s*)?(\s*aus\s*|\s*Vers\s*)?([0-9]{0,3})?(\-|\.{0,1})?([0-9]{0,3})?/", function($m) use (&$art,&$id) { return splitWord($m[1], $m[2], $m[3], $m[4], $m[5], $m[6], $m[7], $m[8],"$art", "$id");}, $wort);
|
||||
}
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user