Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/Controller/Api/Content.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace Apps\Controller\Api;
4
5
use Apps\ActiveRecord\App as AppRecord;
6
use Extend\Core\Arch\ApiController;
7
8
/**
9
 * Class Content. Content app backend json api
10
 * @package Apps\Controller\Api
11
 */
12
class Content extends ApiController
13
{
14
    public $maxSize = 512000; // in bytes, 500 * 1024
15
    public $maxResize = 150;
16
17
    public $allowedExt = ['jpg', 'png', 'gif', 'jpeg', 'bmp', 'webp'];
18
19
    // import actions from traits
20
    use Content\ActionChangeRate {
0 ignored issues
show
The trait Apps\Controller\Api\Content\ActionChangeRate requires the property $author_id which is not provided by Apps\Controller\Api\Content.
Loading history...
21
        changeRate as actionChangerate;
22
    }
23
24
    use Content\ActionGalleryUpload {
25
        galleryUpload as actionGalleryupload;
26
    }
27
28
    use Content\ActionGalleryList {
0 ignored issues
show
The trait Apps\Controller\Api\Content\ActionGalleryList requires the property $role which is not provided by Apps\Controller\Api\Content.
Loading history...
29
        galleryList as actionGallerylist;
30
    }
31
32
    use Content\ActionGalleryDelete {
0 ignored issues
show
The trait Apps\Controller\Api\Content\ActionGalleryDelete requires the property $query which is not provided by Apps\Controller\Api\Content.
Loading history...
33
        galleryDelete as actionGallerydelete;
34
    }
35
36
    /**
37
     * Prepare configurations before initialization
38
     */
39
    public function before()
40
    {
41
        parent::before();
42
        $configs = AppRecord::getConfigs('app', 'Content');
43
        // prevent null-type config data
44
        if ((int)$configs['gallerySize'] > 0) {
45
            $this->maxSize = (int)$configs['gallerySize'] * 1024;
46
        }
47
48
        if ((int)$configs['galleryResize'] > 0) {
49
            $this->maxResize = (int)$configs['galleryResize'];
50
        }
51
    }
52
}
53