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
bad315bc
Commit
bad315bc
authored
Jan 19, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grundlagen für Rechtesystem eingebaut
parent
5a00b9e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
30 deletions
+35
-30
api.class.php
api.class.php
+35
-30
No files found.
api.class.php
View file @
bad315bc
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
class
MediaDBViewerAPI
{
class
MediaDBViewerAPI
{
private
$API_KEY
;
private
$API_KEY
;
private
$API_Rechte
;
private
$DB_Server
;
private
$DB_Server
;
private
$DB_Username
;
private
$DB_Username
;
private
$DB_Passwort
;
private
$DB_Passwort
;
...
@@ -23,6 +24,7 @@ class MediaDBViewerAPI{
...
@@ -23,6 +24,7 @@ class MediaDBViewerAPI{
$this
->
DB_Username
=
$entry
[
'Username'
];
$this
->
DB_Username
=
$entry
[
'Username'
];
$this
->
DB_Passwort
=
$entry
[
'Passwort'
];
$this
->
DB_Passwort
=
$entry
[
'Passwort'
];
$this
->
DB_Database
=
$entry
[
'Database'
];
$this
->
DB_Database
=
$entry
[
'Database'
];
$this
->
API_Rechte
=
$entry
[
'Rechte'
];
$this
->
API_KEY
=
$entry
[
'Schuessel'
];
$this
->
API_KEY
=
$entry
[
'Schuessel'
];
$this
->
DB_Objekt
=
new
mysqli
(
$this
->
DB_Server
,
$this
->
DB_Username
,
$this
->
DB_Passwort
,
$this
->
DB_Database
);
$this
->
DB_Objekt
=
new
mysqli
(
$this
->
DB_Server
,
$this
->
DB_Username
,
$this
->
DB_Passwort
,
$this
->
DB_Database
);
if
(
$DB_Objekt
->
error
!=
null
){
if
(
$DB_Objekt
->
error
!=
null
){
...
@@ -290,10 +292,7 @@ class MediaDBViewerAPI{
...
@@ -290,10 +292,7 @@ class MediaDBViewerAPI{
}
}
}
}
public
function
API_SetData
(
$GET_arr
,
$POST_arr
=
""
){
public
function
API_SetData
(
$GET_arr
,
$POST_arr
=
""
){
/*ob_start();
if
(
(
$this
->
API_Rechte
>=
3
)){
var_dump($POST_arr);
$result = ob_get_clean();
*/
if
(
isset
(
$GET_arr
[
"Tabelle"
])){
if
(
isset
(
$GET_arr
[
"Tabelle"
])){
if
(
$GET_arr
[
"Tabelle"
]
==
"Filme"
){
if
(
$GET_arr
[
"Tabelle"
]
==
"Filme"
){
if
(
isset
(
$POST_arr
[
"imdbID"
])){
if
(
isset
(
$POST_arr
[
"imdbID"
])){
...
@@ -308,13 +307,12 @@ class MediaDBViewerAPI{
...
@@ -308,13 +307,12 @@ class MediaDBViewerAPI{
else
{
else
{
return
$this
->
error
(
1004
,
"Erwartet war Tabelle!"
);
return
$this
->
error
(
1004
,
"Erwartet war Tabelle!"
);
}
}
}
else
{
return
$this
->
error
(
1007
,
"Keine Rechte um die Filminfos zu setzen!"
);
}
}
}
public
function
API_serverinfo
(
$GET_arr
=
""
,
$POST_arr
=
""
){
public
function
API_serverinfo
(
$GET_arr
=
""
,
$POST_arr
=
""
){
if
(
(
$this
->
API_Rechte
>=
3
)){
return
array
(
"time"
=>
time
(),
return
array
(
"time"
=>
time
(),
"time_h"
=>
date
(
""
,
time
()),
"time_h"
=>
date
(
""
,
time
()),
"HTTP_USER_AGENT"
=>
$_SERVER
[
'HTTP_USER_AGENT'
],
"HTTP_USER_AGENT"
=>
$_SERVER
[
'HTTP_USER_AGENT'
],
...
@@ -323,6 +321,9 @@ class MediaDBViewerAPI{
...
@@ -323,6 +321,9 @@ class MediaDBViewerAPI{
"Datenbankbenutzer"
=>
$this
->
DB_Username
,
"Datenbankbenutzer"
=>
$this
->
DB_Username
,
"Datenbank"
=>
$this
->
DB_Database
)
"Datenbank"
=>
$this
->
DB_Database
)
);
);
}
else
{
return
$this
->
error
(
1007
,
"Keine Rechte um die serverinfo abzufragen!"
);
}
}
}
/*
/*
* Ab hier Helfer-Funktionen
* Ab hier Helfer-Funktionen
...
@@ -347,7 +348,7 @@ class MediaDBViewerAPI{
...
@@ -347,7 +348,7 @@ class MediaDBViewerAPI{
* Funktion nur ändern, Um Markus zu ärgern ;-)
* Funktion nur ändern, Um Markus zu ärgern ;-)
*/
*/
public
function
APIrespons
(
$Laufzeit
=
0
,
$respons
=
""
){
public
function
APIrespons
(
$Laufzeit
=
0
,
$respons
=
""
){
if
(
strpos
(
$_SERVER
[
"HTTP_USER_AGENT"
],
"Android"
)
==
0
){
if
(
(
strpos
(
$_SERVER
[
"HTTP_USER_AGENT"
],
"Android"
)
==
0
)
AND
(
$this
->
API_Rechte
>=
3
)
){
$this
->
Statistik
[
"Querys"
]
=
$this
->
Querys
;
$this
->
Statistik
[
"Querys"
]
=
$this
->
Querys
;
return
array
(
"API_VERSION"
=>
API_VERSION
,
return
array
(
"API_VERSION"
=>
API_VERSION
,
"API_KEY"
=>
$this
->
API_KEY
,
"API_KEY"
=>
$this
->
API_KEY
,
...
@@ -396,6 +397,10 @@ class MediaDBViewerAPI{
...
@@ -396,6 +397,10 @@ class MediaDBViewerAPI{
return
array
(
"FehlerID"
=>
$ErrID
,
return
array
(
"FehlerID"
=>
$ErrID
,
"FehlerText"
=>
"Folgende Daten wurden Erfolgreich empfangen!"
,
"FehlerText"
=>
"Folgende Daten wurden Erfolgreich empfangen!"
,
"FehlerBeschreibung"
=>
$Description
);
"FehlerBeschreibung"
=>
$Description
);
case
1007
:
return
array
(
"FehlerID"
=>
$ErrID
,
"FehlerText"
=>
"Keine Rechte für diese Aktion!!"
,
"FehlerBeschreibung"
=>
$Description
);
break
;
break
;
default
:
default
:
return
array
(
"FehlerID"
=>
1000
,
return
array
(
"FehlerID"
=>
1000
,
...
...
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