2020-07-15 20:08:22 +02:00
|
|
|
<?php
|
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* Class SSettings
|
|
|
|
* class handling all Settings used by php scripts
|
|
|
|
*/
|
|
|
|
class SSettings {
|
2020-10-03 20:28:19 +00:00
|
|
|
private $database;
|
2020-07-15 20:08:22 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SSettings constructor.
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
|
|
|
$this->database = Database::getInstance();
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:50:25 +00:00
|
|
|
/**
|
|
|
|
* get the videopath saved in db
|
|
|
|
* @return string videopath
|
|
|
|
*/
|
2020-07-15 20:08:22 +02:00
|
|
|
public function getVideoPath() {
|
|
|
|
$query = "SELECT video_path from settings";
|
|
|
|
|
|
|
|
$result = $this->database->getConnection()->query($query);
|
|
|
|
|
|
|
|
$r = mysqli_fetch_assoc($result);
|
|
|
|
return $r['video_path'];
|
|
|
|
}
|
2020-07-18 01:10:04 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* check if TMDB is enableds
|
|
|
|
* @return bool isenabled?
|
|
|
|
*/
|
2020-08-12 17:50:25 +00:00
|
|
|
public function isTMDBGrabbingEnabled(): bool {
|
2020-09-23 18:43:50 +00:00
|
|
|
$query = "SELECT TMDB_grabbing from settings WHERE 1";
|
2020-07-18 01:10:04 +02:00
|
|
|
|
|
|
|
$result = $this->database->getConnection()->query($query);
|
2020-08-12 17:50:25 +00:00
|
|
|
if (!$result) {
|
2020-07-18 01:10:04 +02:00
|
|
|
return true; // if undefined in db --> default true
|
2020-08-12 17:50:25 +00:00
|
|
|
} else {
|
2020-07-18 01:10:04 +02:00
|
|
|
$r = mysqli_fetch_assoc($result);
|
|
|
|
return $r['TMDB_grabbing'] == '1';
|
|
|
|
}
|
|
|
|
}
|
2020-08-12 17:50:25 +00:00
|
|
|
}
|