1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @package Composer |
4
|
|
|
* @category modules |
5
|
|
|
* @author Nazar Mokrynskyi <[email protected]> |
6
|
|
|
* @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
7
|
|
|
* @license MIT License, see license.txt |
8
|
|
|
*/ |
9
|
|
|
namespace cs\modules\Composer\admin; |
10
|
|
|
use |
11
|
|
|
h, |
12
|
|
|
cs\Config, |
13
|
|
|
cs\Language\Prefix, |
14
|
|
|
cs\Page; |
15
|
|
|
|
16
|
|
|
class Controller { |
17
|
|
|
static function general () { |
18
|
|
|
$L = new Prefix('composer_'); |
19
|
|
|
$Page = Page::instance(); |
20
|
|
|
$Page->title($L->general); |
21
|
|
|
if (file_exists(DIR.'/storage/Composer/last_execution.log')) { |
22
|
|
|
require_once __DIR__.'/../ansispan.php'; |
23
|
|
|
$Page->content( |
24
|
|
|
h::p($L->last_log). |
25
|
|
|
h::pre( |
26
|
|
|
ansispan(file_get_contents(DIR.'/storage/Composer/last_execution.log')), |
27
|
|
|
[ |
28
|
|
|
'style' => 'background: #1a1a1a' |
29
|
|
|
] |
30
|
|
|
) |
31
|
|
|
); |
32
|
|
|
} |
33
|
|
|
$Page->content( |
34
|
|
|
h::{'p.cs-text-center button.cs-composer-admin-force-update[is=cs-button]'}($L->force_update) |
35
|
|
|
); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param \cs\Request $Request |
40
|
|
|
*/ |
41
|
|
|
static function auth_json ($Request) { |
42
|
|
|
$L = new Prefix('composer_'); |
43
|
|
|
$Page = Page::instance(); |
44
|
|
|
$Page->title($L->auth_json); |
45
|
|
|
$module_data = Config::instance()->module('Composer'); |
46
|
|
|
$auth_json = $Request->data('auth_json'); |
47
|
|
|
if ($auth_json !== null) { |
48
|
|
|
$module_data->auth_json = $auth_json; |
49
|
|
|
$Page->success($L->changes_saved); |
50
|
|
|
} |
51
|
|
|
$Page->content( |
52
|
|
|
h::{'form[is=cs-form]'}( |
53
|
|
|
h::label($L->auth_json_contents). |
54
|
|
|
h::{'p textarea[is=cs-textarea][autosize][name=auth_json]'}($module_data->auth_json ?: ''). |
55
|
|
|
h::{'button[is=cs-button][type=submit]'}( |
56
|
|
|
$L->save, |
57
|
|
|
[ |
58
|
|
|
'tooltip' => $L->save_info |
59
|
|
|
] |
60
|
|
|
) |
61
|
|
|
) |
62
|
|
|
); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|