Commit b7f23ddc authored by Nico Schallehn's avatar Nico Schallehn
parents bfaaaf73 dffb556d
eclipse.preferences.version=1
encoding/api.class.php=UTF-8
encoding/api.php=UTF-8
encoding/ergaenzung.txt=ISO-8859-1
......@@ -57,7 +57,9 @@ class MediaDBAPI{
//var_dump($this->DB_Objekt);
if($this->DB_Objekt->connect_error != ""){
$ret = false;
}else{ $ret = true; }
}else{
$this->query("SET NAMES 'utf8'");
$ret = true; }
}else{ $ret = false; }
}else{ $ret = false; }
$db->close();
......@@ -133,8 +135,28 @@ class MediaDBAPI{
$first = false;
}
if(isset($GET_arr['Suche'])){
$Suche = " (`name` LIKE '%".$GET_arr['Suche']."%' OR `md5` LIKE '%".$GET_arr['Suche']."%' OR `comment` LIKE '%".$GET_arr['Suche']."%')";
/* Work a round für Android 5 Geräte*/
$SucheWort = $GET_arr['Suche'];//htmlentities($GET_arr['Suche'], ENT_COMPAT, 'UTF-8');
//htmlentities($string, ENT_COMPAT, 'UTF-8')
/*$SucheWort = str_replace("\u00e4", "ä", $SucheWort);
$SucheWort = str_replace("\u00f6", "ö", $SucheWort);
$SucheWort = str_replace("\u00fc", "ü", $SucheWort);
$SucheWort = str_replace("\u00c4", "Ä", $SucheWort);
$SucheWort = str_replace("\u00d6", "Ö", $SucheWort);
$SucheWort = str_replace("\u00dc", "Ü", $SucheWort);
$SucheWort = str_replace("%C3%A4", "ä", $SucheWort);
$SucheWort = str_replace("%C3%B6", "ö", $SucheWort);
$SucheWort = str_replace("%C3%BC", "ü", $SucheWort);
$SucheWort = str_replace("%C3%84", "Ä", $SucheWort);
$SucheWort = str_replace("%C3%96", "Ö", $SucheWort);
$SucheWort = str_replace("%C3%9C", "Ü", $SucheWort);
*/
$Suche = " (`name` LIKE '%".$SucheWort."%' OR `md5` LIKE '%".$SucheWort."%' OR `comment` LIKE '%".$SucheWort."%')";
//OR `year` = '".$GET_arr['Suche']."' OR `resolution` LIKE '%".$GET_arr['Suche']."%'
$this->DebugOut($Suche);
$Where .= (($first?"":" AND ").$Suche);
$first = false;
}
......@@ -224,6 +246,12 @@ class MediaDBAPI{
$first = false;
}
}
// Sonderlösung für nur imdbID
if($GET_arr['Spalten'] == "imdbID"){
$Group = "GROUP BY imdbID";
}
// Überprüfen ob Schauspieler oder Genre gefordert wird
$SpaltenArr = explode(",", $GET_arr['Spalten']);
$ListGenre = (in_array("Genre", $SpaltenArr)?true:false);
......@@ -271,7 +299,7 @@ class MediaDBAPI{
.$Where
.$this->iset($GET_arr['Sortierung'], " ", " ORDER BY ", " ")
.$this->iset($GET_arr['Anzahl'],"", " Limit "," ")
.";";
." ".$Group.";";
$entrys = $this->query($Query);
if($this->DB_Objekt->error != ""){ return $this->error(1005, $this->DB_Objekt->error);}
......@@ -286,8 +314,8 @@ class MediaDBAPI{
$tempArray = array();
foreach ($finfo as $val) {
if(!(($val->name == "imdbID") AND $NoimdbID)){
$tempArray[$val->name] = utf8_encode(($entry[$val->name] == NULL?"":$entry[$val->name]));//$entry[$val->name]); //($entry[$val->name] == null?"":$entry[$val->name])
//$tempArray[$val->name] = utf8_encode(($entry[$val->name] == NULL?"":$entry[$val->name]));//$entry[$val->name]); //($entry[$val->name] == null?"":$entry[$val->name])
$tempArray[$val->name] = ($entry[$val->name] == NULL?"":$entry[$val->name]);
}
}
// Genre oder Schauspielerblock hinzufügen wenn es gewünscht ist
......@@ -296,7 +324,7 @@ class MediaDBAPI{
$Genre = $this->query($Query);
if($this->DB_Objekt->error != ""){ return $this->error(1005, $this->DB_Objekt->error);}
$GenreArr = $Genre->fetch_array();
$tempArray["Genre"] = explode(",", utf8_encode($GenreArr["Genre"]));
$tempArray["Genre"] = explode(",", ($GenreArr["Genre"]));
}
if($ListSchauspieler){
$Query = 'SELECT group_concat(s.name ORDER BY s.name) AS Schauspieler '.
......@@ -304,7 +332,7 @@ class MediaDBAPI{
$Schauspieler = $this->query($Query);
if($this->DB_Objekt->error != ""){ return $this->error(1005, $this->DB_Objekt->error);}
$SchauspielerArr = $Schauspieler->fetch_array();
$tempArray["Schauspieler"] = explode(",", utf8_encode($SchauspielerArr["Schauspieler"]));
$tempArray["Schauspieler"] = explode(",", ($SchauspielerArr["Schauspieler"]));
}
if ($Statistik == true) {
if (($GET_arr['Tabelle'] == "Staffeln")) {
......@@ -374,34 +402,9 @@ class MediaDBAPI{
$result = $this->query($Query);
if($this->DB_Objekt->error != ""){ return $this->error(1005, $this->DB_Objekt->error);}
return $this->error(1008, utf8_encode($Query));
}
}/*
else if(isset($POST_arr["season_nr"]) AND ($GET_arr["Tabelle"] == "Staffeln") ){
//UPDATE ".$GET_arr["Tabelle"]." WHERE imdbID = ".$POST_arr["imdbID"];
$Set = "SET ";
$first = true;
if(isset($POST_arr["Gesehen"])){ //AND is_numeric($GET_arr[$key])
$Set .= ($first?"":" , ")."views = views+1";
$first = false;
}
if(isset($POST_arr["checked"])){ //AND is_numeric($GET_arr[$key])
$Set .= ($first?"":" , ")."checked = '".$POST_arr["checked"]."'";
$first = false;
}
if(isset($POST_arr["comment"])){ //AND is_numeric($GET_arr[$key])
$Set .= ($first?"":" , ")."comment = '".$POST_arr["comment"]."'";
$first = false;
return $this->error(1008, ($Query)); //utf8_encode
}
if($first){// Fehler...
return $this->error(1004, "Mindestens einer der folgenden Paramter war erwartet = Gesehen, checked, comment!");
}else{
$Query = "UPDATE Filme ".$Set." WHERE imdbID = '".$POST_arr["imdbID"]."' AND `3d` = '".$POST_arr["3d"]."';";
return $this->error(1001, "Auszuführender Query: ".$Query);
}
}*/
}
else {
return $this->error(1004, "Erwartet war Tabelle=(Filme und imdbID, 3d) ODER (Episoden und season_nr,episodenumber) ODER (Staffeln und season_nr)!");
}
......@@ -433,7 +436,7 @@ class MediaDBAPI{
$tempArray = array();
foreach ($finfo as $val) {
if(!(($val->name == "imdbID") AND $NoimdbID)){
$tempArray[$val->name] = utf8_encode($entry[$val->name]);
$tempArray[$val->name] = ($entry[$val->name]); //utf8_encode
}
}
array_push($entryArray,$tempArray);
......@@ -472,7 +475,7 @@ class MediaDBAPI{
//$this->Statistik["QueryCounter"]++;
$ret = $this->DB_Objekt->query($Query);
$this->Querys[$this->Statistik["QueryCounter"]++]= array( "Query" => $Query,
$this->Querys[$this->Statistik["QueryCounter"]++]= array( "Query" => ($Query),
"MySQLnum_rows" => $ret->num_rows,
"MySQLfield_count" => $this->DB_Objekt->field_count ,
"MySQLerror" => $this->DB_Objekt->error );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment