Admin
This commit is contained in:
@@ -44,7 +44,7 @@ class Modules
|
||||
|
||||
public function Books(): Books
|
||||
{
|
||||
if ($this->books === null) { require_once 'modules/books.php'; $this->books = new Books(); }
|
||||
if ($this->books === null) { require_once 'modules/books.php'; $this->books = new Books($this->site); }
|
||||
return $this->books;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
class Books
|
||||
{
|
||||
/** @var Website */
|
||||
private $site;
|
||||
|
||||
/** @var array */
|
||||
private $staticData;
|
||||
|
||||
public function __construct()
|
||||
public function __construct(Website $site)
|
||||
{
|
||||
$this->site = $site;
|
||||
$this->load();
|
||||
}
|
||||
|
||||
@@ -104,12 +108,10 @@ class Books
|
||||
|
||||
public function createPreview($prog)
|
||||
{
|
||||
global $CONFIG;
|
||||
|
||||
$src = $prog['imgfront_path'];
|
||||
$dst = $prog['preview_path'];
|
||||
|
||||
if ($CONFIG['use_magick'])
|
||||
if ($this->site->config['use_magick'])
|
||||
magick_resize_image($src, 200, 0, $dst);
|
||||
else
|
||||
smart_resize_image($src, 200, 0, true, $dst);
|
||||
|
||||
@@ -223,7 +223,7 @@ class Programs
|
||||
|
||||
if (strpos($prog['internal_name'], ' ') !== FALSE) return ['result'=>'err', 'message' => 'Internal name contains spaces ' . $prog['name']];
|
||||
|
||||
foreach (explode('|', $prog['ui_language']) as $lang) if (convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']];;
|
||||
foreach (explode('|', $prog['ui_language']) as $lang) if ($this->convertLanguageToFlag($lang) === null) return ['result'=>'err', 'message' => 'Unknown ui-lang ' . $prog['name']];;
|
||||
|
||||
if (!in_array($prog['prog_language'], self::PROG_LANGS)) return ['result'=>'err', 'message' => 'Unknown prog-lang ' . $prog['name']];
|
||||
|
||||
@@ -232,11 +232,11 @@ class Programs
|
||||
if ($prog['license'] !== null && !array_key_exists($prog['license'], self::LICENSES)) return ['result'=>'err', 'message' => 'Unknown license ' . $prog['name']];
|
||||
|
||||
$isdl = false;
|
||||
foreach (self::getURLs($prog) as $xurl)
|
||||
foreach ($this->getURLs($prog) as $xurl)
|
||||
{
|
||||
if (!in_array($xurl['type'], self::URL_ORDER)) return ['result'=>'err', 'message' => 'Unknown url ' . $xurl['type']];
|
||||
|
||||
if ($xurl['type']==='download' && $xurl['isdirect'] && !file_exists(self::getDirectDownloadPath($prog))) return ['result'=>'err', 'message' => 'Direct download not found ' . $prog['name']];
|
||||
if ($xurl['type']==='download' && $xurl['isdirect'] && !file_exists($this->getDirectDownloadPath($prog))) return ['result'=>'err', 'message' => 'Direct download not found ' . $prog['name']];
|
||||
|
||||
if ($xurl['type']==='download' || $xurl['type']==='playstore' || $xurl['type']==='itunesstore') $isdl = true;
|
||||
}
|
||||
|
||||
@@ -63,11 +63,6 @@ function formatMilliseconds($millis)
|
||||
}
|
||||
}
|
||||
|
||||
function isProd() {
|
||||
global $CONFIG;
|
||||
return $CONFIG['prod'];
|
||||
}
|
||||
|
||||
/**
|
||||
* easy image resize function
|
||||
* @author http://www.nimrodstech.com/php-image-resize/
|
||||
|
||||
Reference in New Issue
Block a user