Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MediaDBViewerAPI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BA_SI-Projekt
MediaDBViewerAPI
Commits
b7f23ddc
Commit
b7f23ddc
authored
Feb 08, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://192.168.0.34/BA_SI-Projekt/MediaDBViewerAPI.git
parents
bfaaaf73
dffb556d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
36 deletions
+40
-36
org.eclipse.core.resources.prefs
.settings/org.eclipse.core.resources.prefs
+1
-0
Key.sqlite.example
Key.sqlite.example
+0
-0
api.class.php
api.class.php
+39
-36
No files found.
.settings/org.eclipse.core.resources.prefs
View file @
b7f23ddc
eclipse.preferences.version=1
eclipse.preferences.version=1
encoding/api.class.php=UTF-8
encoding/api.class.php=UTF-8
encoding/api.php=UTF-8
encoding/api.php=UTF-8
encoding/ergaenzung.txt=ISO-8859-1
Key.sqlite.example
0 → 100644
View file @
b7f23ddc
File added
api.class.php
View file @
b7f23ddc
...
@@ -57,7 +57,9 @@ class MediaDBAPI{
...
@@ -57,7 +57,9 @@ class MediaDBAPI{
//var_dump($this->DB_Objekt);
//var_dump($this->DB_Objekt);
if
(
$this
->
DB_Objekt
->
connect_error
!=
""
){
if
(
$this
->
DB_Objekt
->
connect_error
!=
""
){
$ret
=
false
;
$ret
=
false
;
}
else
{
$ret
=
true
;
}
}
else
{
$this
->
query
(
"SET NAMES 'utf8'"
);
$ret
=
true
;
}
}
else
{
$ret
=
false
;
}
}
else
{
$ret
=
false
;
}
}
else
{
$ret
=
false
;
}
}
else
{
$ret
=
false
;
}
$db
->
close
();
$db
->
close
();
...
@@ -133,8 +135,28 @@ class MediaDBAPI{
...
@@ -133,8 +135,28 @@ class MediaDBAPI{
$first
=
false
;
$first
=
false
;
}
}
if
(
isset
(
$GET_arr
[
'Suche'
])){
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']."%'
//OR `year` = '".$GET_arr['Suche']."' OR `resolution` LIKE '%".$GET_arr['Suche']."%'
$this
->
DebugOut
(
$Suche
);
$Where
.=
((
$first
?
""
:
" AND "
)
.
$Suche
);
$Where
.=
((
$first
?
""
:
" AND "
)
.
$Suche
);
$first
=
false
;
$first
=
false
;
}
}
...
@@ -224,6 +246,12 @@ class MediaDBAPI{
...
@@ -224,6 +246,12 @@ class MediaDBAPI{
$first
=
false
;
$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
// Überprüfen ob Schauspieler oder Genre gefordert wird
$SpaltenArr
=
explode
(
","
,
$GET_arr
[
'Spalten'
]);
$SpaltenArr
=
explode
(
","
,
$GET_arr
[
'Spalten'
]);
$ListGenre
=
(
in_array
(
"Genre"
,
$SpaltenArr
)
?
true
:
false
);
$ListGenre
=
(
in_array
(
"Genre"
,
$SpaltenArr
)
?
true
:
false
);
...
@@ -271,7 +299,7 @@ class MediaDBAPI{
...
@@ -271,7 +299,7 @@ class MediaDBAPI{
.
$Where
.
$Where
.
$this
->
iset
(
$GET_arr
[
'Sortierung'
],
" "
,
" ORDER BY "
,
" "
)
.
$this
->
iset
(
$GET_arr
[
'Sortierung'
],
" "
,
" ORDER BY "
,
" "
)
.
$this
->
iset
(
$GET_arr
[
'Anzahl'
],
""
,
" Limit "
,
" "
)
.
$this
->
iset
(
$GET_arr
[
'Anzahl'
],
""
,
" Limit "
,
" "
)
.
";"
;
.
"
"
.
$Group
.
"
;"
;
$entrys
=
$this
->
query
(
$Query
);
$entrys
=
$this
->
query
(
$Query
);
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
...
@@ -286,8 +314,8 @@ class MediaDBAPI{
...
@@ -286,8 +314,8 @@ class MediaDBAPI{
$tempArray
=
array
();
$tempArray
=
array
();
foreach
(
$finfo
as
$val
)
{
foreach
(
$finfo
as
$val
)
{
if
(
!
((
$val
->
name
==
"imdbID"
)
AND
$NoimdbID
)){
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
// Genre oder Schauspielerblock hinzufügen wenn es gewünscht ist
...
@@ -296,7 +324,7 @@ class MediaDBAPI{
...
@@ -296,7 +324,7 @@ class MediaDBAPI{
$Genre
=
$this
->
query
(
$Query
);
$Genre
=
$this
->
query
(
$Query
);
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
$GenreArr
=
$Genre
->
fetch_array
();
$GenreArr
=
$Genre
->
fetch_array
();
$tempArray
[
"Genre"
]
=
explode
(
","
,
utf8_encode
(
$GenreArr
[
"Genre"
]));
$tempArray
[
"Genre"
]
=
explode
(
","
,
(
$GenreArr
[
"Genre"
]));
}
}
if
(
$ListSchauspieler
){
if
(
$ListSchauspieler
){
$Query
=
'SELECT group_concat(s.name ORDER BY s.name) AS Schauspieler '
.
$Query
=
'SELECT group_concat(s.name ORDER BY s.name) AS Schauspieler '
.
...
@@ -304,7 +332,7 @@ class MediaDBAPI{
...
@@ -304,7 +332,7 @@ class MediaDBAPI{
$Schauspieler
=
$this
->
query
(
$Query
);
$Schauspieler
=
$this
->
query
(
$Query
);
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
$SchauspielerArr
=
$Schauspieler
->
fetch_array
();
$SchauspielerArr
=
$Schauspieler
->
fetch_array
();
$tempArray
[
"Schauspieler"
]
=
explode
(
","
,
utf8_encode
(
$SchauspielerArr
[
"Schauspieler"
]));
$tempArray
[
"Schauspieler"
]
=
explode
(
","
,
(
$SchauspielerArr
[
"Schauspieler"
]));
}
}
if
(
$Statistik
==
true
)
{
if
(
$Statistik
==
true
)
{
if
((
$GET_arr
[
'Tabelle'
]
==
"Staffeln"
))
{
if
((
$GET_arr
[
'Tabelle'
]
==
"Staffeln"
))
{
...
@@ -374,34 +402,9 @@ class MediaDBAPI{
...
@@ -374,34 +402,9 @@ class MediaDBAPI{
$result
=
$this
->
query
(
$Query
);
$result
=
$this
->
query
(
$Query
);
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
if
(
$this
->
DB_Objekt
->
error
!=
""
){
return
$this
->
error
(
1005
,
$this
->
DB_Objekt
->
error
);}
return
$this
->
error
(
1008
,
utf8_encode
(
$Query
));
return
$this
->
error
(
1008
,
(
$Query
));
//utf8_encode
}
}
/*
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;
}
}
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
{
else
{
return
$this
->
error
(
1004
,
"Erwartet war Tabelle=(Filme und imdbID, 3d) ODER (Episoden und season_nr,episodenumber) ODER (Staffeln und season_nr)!"
);
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{
...
@@ -433,7 +436,7 @@ class MediaDBAPI{
$tempArray
=
array
();
$tempArray
=
array
();
foreach
(
$finfo
as
$val
)
{
foreach
(
$finfo
as
$val
)
{
if
(
!
((
$val
->
name
==
"imdbID"
)
AND
$NoimdbID
)){
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
);
array_push
(
$entryArray
,
$tempArray
);
...
@@ -472,7 +475,7 @@ class MediaDBAPI{
...
@@ -472,7 +475,7 @@ class MediaDBAPI{
//$this->Statistik["QueryCounter"]++;
//$this->Statistik["QueryCounter"]++;
$ret
=
$this
->
DB_Objekt
->
query
(
$Query
);
$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
,
"MySQLnum_rows"
=>
$ret
->
num_rows
,
"MySQLfield_count"
=>
$this
->
DB_Objekt
->
field_count
,
"MySQLfield_count"
=>
$this
->
DB_Objekt
->
field_count
,
"MySQLerror"
=>
$this
->
DB_Objekt
->
error
);
"MySQLerror"
=>
$this
->
DB_Objekt
->
error
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment