| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/GXMainComponents/Controllers/HttpView/Admin/ |
Upload File : |
<?php
/* --------------------------------------------------------------
AppStoreController.inc.php 2019-01-29
Gambio GmbH
http://www.gambio.de
Copyright (c) 2019 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
/**
* Class AppStoreController
*
* Bootstraps the AppStore pages.
*
* @category System
* @package AdminHttpViewControllers
*/
class AppStoreController extends AdminHttpViewController
{
/**
* Default Action
*
* Render the downloads AppStore page.
*
* @return AdminLayoutHttpControllerResponse
*/
public function actionDefault()
{
$languageTextManager = MainFactory::create('LanguageTextManager', 'app_store', $_SESSION['languages_id']);
$title = new NonEmptyStringType($languageTextManager->get_text('PAGE_TITLE'));
$template = new ExistingFile(new NonEmptyStringType(DIR_FS_ADMIN
. '/html/content/app_store/app_store_downloads.html'));
$contentNavigation = MainFactory::create('ContentNavigationCollection', []);
$appUrl = gm_get_conf('APP_STORE_URL');
// Fall back to the production App Store URL if none is set.
if ($appUrl === '') {
$appUrl = 'https://store.gambio.com/a';
gm_set_conf('APP_STORE_URL', 'https://store.gambio.com/a');
}
$appToken = gm_get_conf('APP_STORE_TOKEN');
if ($this->_getQueryParameter('reset-token') || $this->_getQueryParameter('reset-token') === '') {
gm_set_conf('APP_STORE_TOKEN', '');
gm_set_conf('APP_STORE_IS_REGISTERED', 'false');
return new RedirectHttpControllerResponse('./admin.php?do=AppStore');
}
if (gm_get_conf('ADMIN_FEED_ACCEPTED_SHOP_INFORMATION_DATA_PROCESSING') === 'false') {
$appUrl .= '/dataprocessing';
} elseif (gm_get_conf('APP_STORE_IS_REGISTERED') === 'false') {
if (!$appToken) {
$tokenGenerator = MainFactory::create('AppStoreTokenGenerator');
$appToken = $tokenGenerator->generateToken();
gm_set_conf('APP_STORE_TOKEN', $appToken);
}
$appUrl .= '/register';
} elseif (gm_get_conf('ADMIN_FEED_ACCEPTED_SHOP_INFORMATION_DATA_PROCESSING') === 'true') {
$appUrl .= '/downloads';
$contentNavigation->add(new StringType($languageTextManager->get_text('DOWNLOADS', 'app_store')),
new StringType('admin.php?do=AppStore'),
new BoolType(true));
$contentNavigation->add(new StringType($languageTextManager->get_text('INSTALLED_PACKAGES_AND_UPDATES',
'app_store')),
new StringType('admin.php?do=AppStore/Installations'),
new BoolType(false));
}
setcookie('auto_updater_admin_check', 'admin_logged_in', time() + 5 * 60, '/');
$data = MainFactory::create('KeyValueCollection',
[
'appUrl' => $appUrl,
'appToken' => $appToken
]);
$assets = MainFactory::create('AssetCollection',
[
MainFactory::create('Asset', 'app_store.lang.inc.php')
]);
return MainFactory::create('AdminLayoutHttpControllerResponse',
$title,
$template,
$data,
$assets,
$contentNavigation);
}
private function fetchAppStoreUrl() {
}
/**
* Installations Action
*
* Renders the installations page.
*
* @return AdminLayoutHttpControllerResponse
*/
public function actionInstallations()
{
if (gm_get_conf('ADMIN_FEED_ACCEPTED_SHOP_INFORMATION_DATA_PROCESSING') !== 'true') {
return $this->actionDefault();
}
$languageTextManager = MainFactory::create('LanguageTextManager', 'app_store', $_SESSION['languages_id']);
$title = new NonEmptyStringType($languageTextManager->get_text('PAGE_TITLE'));
$template = new ExistingFile(new NonEmptyStringType(DIR_FS_ADMIN
. '/html/content/app_store/app_store_installations.html'));
setcookie('auto_updater_admin_check', 'admin_logged_in', time() + 5 * 60, '/');
$data = MainFactory::create('KeyValueCollection',
[
'appUrl' => gm_get_conf('APP_STORE_URL') . '/installations',
'appToken' => gm_get_conf('APP_STORE_TOKEN')
]);
$assets = MainFactory::create('AssetCollection',
[
MainFactory::create('Asset', 'app_store.lang.inc.php')
]);
$contentNavigation = MainFactory::create('ContentNavigationCollection', []);
$contentNavigation->add(new StringType($languageTextManager->get_text('DOWNLOADS', 'app_store')),
new StringType('admin.php?do=AppStore'),
new BoolType(false));
$contentNavigation->add(new StringType($languageTextManager->get_text('INSTALLED_PACKAGES_AND_UPDATES',
'app_store')),
new StringType('admin.php?do=AppStore/Installations'),
new BoolType(true));
return MainFactory::create('AdminLayoutHttpControllerResponse',
$title,
$template,
$data,
$assets,
$contentNavigation);
}
public function actionConfiguration()
{
if (isset($_POST) && isset($_POST['url'])) {
if ($_POST['url'] !== gm_get_conf('APP_STORE_URL')) {
if (filter_var($_POST['url'], FILTER_VALIDATE_URL) === $_POST['url']) {
gm_set_conf('APP_STORE_URL', $_POST['url']);
}
}
}
$languageTextManager = MainFactory::create('LanguageTextManager', 'app_store', $_SESSION['languages_id']);
$title = new NonEmptyStringType($languageTextManager->get_text('PAGE_TITLE'));
$template = new ExistingFile(new NonEmptyStringType(DIR_FS_ADMIN
. '/html/content/app_store/app_store_configuration.html'));
$appStoreUrl = isset($_POST['url']) ? $_POST['url'] : gm_get_conf('APP_STORE_URL');
$data = MainFactory::create('KeyValueCollection', ['url' => $appStoreUrl]);
$assets = MainFactory::create('AssetCollection',
[
MainFactory::create('Asset', 'app_store.lang.inc.php')
]);
$contentNavigation = MainFactory::create('ContentNavigationCollection', []);
$contentNavigation->add(new StringType($languageTextManager->get_text('DOWNLOADS', 'app_store')),
new StringType('admin.php?do=AppStore'),
new BoolType(false));
$contentNavigation->add(new StringType($languageTextManager->get_text('INSTALLED_PACKAGES_AND_UPDATES',
'app_store')),
new StringType('admin.php?do=AppStore/Installations'),
new BoolType(false));
return MainFactory::create('AdminLayoutHttpControllerResponse',
$title,
$template,
$data,
$assets,
$contentNavigation);
}
/**
* Set the accept data processing value to true and render the default page.
*
* @return AdminLayoutHttpControllerResponse
*/
public function actionAcceptDataProcessing()
{
gm_set_conf('ADMIN_FEED_ACCEPTED_SHOP_INFORMATION_DATA_PROCESSING', 'true');
return $this->actionDefault();
}
/**
* Activate a theme
*
* @return \JsonHttpControllerResponse
*/
public function actionActivateTheme()
{
if (!isset($_POST) || !isset($_POST['themeStorageName'])) {
return MainFactory::create('JsonHttpControllerResponse', ['success' => false]);
}
$themeService = StaticGXCoreLoader::getService('Theme');
$themeName = $_POST['themeStorageName'];
try {
$themeService->activateTheme($themeName);
} catch (Exception $e) {
return MainFactory::create('JsonHttpControllerResponse', ['success' => false]);
}
return MainFactory::create('JsonHttpControllerResponse', ['success' => true]);
}
}