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
75009d31
Commit
75009d31
authored
Feb 08, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start API mit rechten
parent
2e154721
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
api.class.php
api.class.php
+35
-4
No files found.
api.class.php
View file @
75009d31
...
...
@@ -26,6 +26,18 @@ class MediaDBAPI{
private
$DB_Database
;
private
$Statistik
=
array
(
"QueryCounter"
=>
0
);
private
$Querys
;
private
$FilterEinfach
=
array
(
"imdbID"
=>
"imdbID"
,
"acodecger"
=>
"acodecger"
,
"acodeceng"
=>
"acodeceng"
,
"vcodec"
=>
"vcodec"
,
"resolution"
=>
"resolution"
,
"channelsger"
=>
"channelsger"
,
"channelseng"
=>
"channelseng"
,
"hdd"
=>
"hdd"
);
private
$FilterKomplex
=
array
(
"Jahr"
=>
"year"
,
"Groesse"
=>
"size"
,
"Laufzeit"
=>
"duration"
,
"Hinzugefuegt"
=>
"added"
,
"Gesehen"
=>
"lastView"
,
"Gesehenzaehler"
=>
"views"
);
/* Speicher für Rechte Arrays*/
private
$SpaltenFil
=
array
();
private
$SpaltenEpi
=
array
();
private
$FilterEinf
=
array
();
private
$FilterKomp
=
array
();
private
$StatiViews
=
array
();
public
$DB_Objekt
;
function
APIinit
(
$KEY
)
{
...
...
@@ -41,6 +53,7 @@ class MediaDBAPI{
$this
->
API_Rechte
=
$entry
[
'Rechte'
];
$this
->
API_KEY
=
$entry
[
'Schuessel'
];
$this
->
DB_Objekt
=
new
mysqli
(
$this
->
DB_Server
,
$this
->
DB_Username
,
$this
->
DB_Passwort
,
$this
->
DB_Database
);
$this
->
SetKeyRights
();
//var_dump($this->DB_Objekt);
if
(
$this
->
DB_Objekt
->
connect_error
!=
""
){
$ret
=
false
;
...
...
@@ -51,19 +64,37 @@ class MediaDBAPI{
}
else
{
$ret
=
false
;
}
return
$ret
;
}
private
function
SetKeyRights
(){
if
(
$this
->
API_Rechte
>=
1
){
array_push
(
$this
->
SpaltenFil
,
"imdb"
,
"3d"
);
array_push
(
$this
->
SpaltenEpi
,
"imdb"
,
"3d"
);
array_push
(
$this
->
FilterEinf
,
array
(
"imdbID"
=>
"imdbID"
,
"acodecger"
=>
"acodecger"
,
"acodeceng"
=>
"acodeceng"
,
"vcodec"
=>
"vcodec"
,
"resolution"
=>
"resolution"
,
"channelsger"
=>
"channelsger"
,
"channelseng"
=>
"channelseng"
));
array_push
(
$this
->
FilterKomp
,
array
(
"Jahr"
=>
"year"
,
"Groesse"
=>
"size"
,
"Laufzeit"
=>
"duration"
));
//array_push($this->StatiViews, "");
}
}
public
function
API_GetKeyRights
(
$GET_arr
,
$POST_arr
=
""
){
$array
[
"SpaltenFilme"
]
=
$this
->
SpaltenFil
;
$array
[
"SpaltenEpisoden"
]
=
$this
->
SpaltenEpi
;
$array
[
"FliterEinfach"
]
=
$this
->
FilterEinf
;
$array
[
"FliterKomplex"
]
=
$this
->
FilterKomp
;
$array
[
"StatistikViews"
]
=
$this
->
StatiViews
;
return
$array
;
}
public
function
API_GetDataList
(
$GET_arr
,
$POST_arr
=
""
){
if
(
!
isset
(
$GET_arr
[
'Tabelle'
])
OR
(
$GET_arr
[
'Tabelle'
]
==
""
))
{
return
$this
->
error
(
1004
,
"Erwarteter Parameter: Tabelle"
);
}
else
{
// Array für istgleich vergleiche
$IstgleichArr
=
array
(
"imdbID"
=>
"imdbID"
,
"acodecger"
=>
"acodecger"
,
"acodeceng"
=>
"acodeceng"
,
"vcodec"
=>
"vcodec"
,
/*
$IstgleichArr = array("imdbID" => "imdbID", "acodecger" => "acodecger", "acodeceng" => "acodeceng", "vcodec" => "vcodec",
"resolution" => "resolution", "channelsger" => "channelsger", "channelseng" => "channelseng", "hdd" => "hdd");
// Array für größer Kleiner Vergleich
$GrossKleinerArr = array("Jahr" => "year", "Groesse" => "size", "Laufzeit" => "duration", "Hinzugefuegt" => "added", "Gesehen" => "lastView",
"Gesehenzaehler" => "views" );
$Array
=
array_merge
(
array_intersect_key
(
$GET_arr
,
$
GrossKleinerArr
),
array_intersect_key
(
$GET_arr
,
$IstgleichArr
));
*/
$Array
=
array_merge
(
array_intersect_key
(
$GET_arr
,
$
this
->
FilterKomplex
),
array_intersect_key
(
$GET_arr
,
$this
->
FilterEinfach
));
// Wenn irgenein filter gesetzt ist Filterung nur für Tablle Filme!!
if
(
(
isset
(
$GET_arr
[
'GenreID'
])
OR
isset
(
$GET_arr
[
'Genre'
])
OR
isset
(
$GET_arr
[
'SchauspielerID'
])
OR
isset
(
$GET_arr
[
'Schauspieler'
])
OR
...
...
@@ -108,7 +139,7 @@ class MediaDBAPI{
$first
=
false
;
}
// größergleich oder kleinergleich Filter:
foreach
(
$
GrossKleinerArr
as
$key
=>
$value
)
{
foreach
(
$
this
->
FilterKomplex
as
$key
=>
$value
)
{
if
(
isset
(
$GET_arr
[
$key
])){
if
((
substr
(
$GET_arr
[
$key
],
0
,
1
)
==
"<"
)
OR
(
substr
(
$GET_arr
[
$key
],
0
,
1
)
==
">"
)
OR
!
strpos
(
$GET_arr
[
$key
],
","
))
{
// Kleiner oder Größer und kein Komma!
...
...
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