| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | namespace Aurora\Modules\Ios; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | |
| 15: | |
| 16: | |
| 17: | |
| 18: | |
| 19: | class Module extends \Aurora\System\Module\AbstractModule |
| 20: | { |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | public function init() |
| 28: | { |
| 29: | $this->AddEntries( |
| 30: | array( |
| 31: | 'ios' => 'EntryIos', |
| 32: | 'profile' => 'EntryProfile' |
| 33: | ) |
| 34: | ); |
| 35: | } |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public function GetSettings() |
| 44: | { |
| 45: | \Aurora\System\Api::checkUserRoleIsAtLeast(\Aurora\System\Enums\UserRole::Anonymous); |
| 46: | |
| 47: | return array( |
| 48: | 'AllowIosProfile' => $this->getConfig('AllowIosProfile', false), |
| 49: | 'SyncIosAfterLogin' => $this->getConfig('SyncIosAfterLogin', false) |
| 50: | ); |
| 51: | } |
| 52: | |
| 53: | |
| 54: | |
| 55: | |
| 56: | |
| 57: | public function EntryIos() |
| 58: | { |
| 59: | $sResult = \file_get_contents($this->GetPath().'/templates/Ios.html'); |
| 60: | |
| 61: | $oApiIntegrator = \Aurora\System\Managers\Integrator::getInstance(); |
| 62: | $iUserId = \Aurora\System\Api::getAuthenticatedUserId(); |
| 63: | if (0 < $iUserId) { |
| 64: | $sResult = strtr($sResult, array( |
| 65: | '{{IOS/HELLO}}' => $this->i18N('HELLO'), |
| 66: | '{{IOS/DESC_P1}}' => $this->i18N('DESC_P1'), |
| 67: | '{{IOS/DESC_P2}}' => $this->i18N('DESC_P2'), |
| 68: | '{{IOS/DESC_P3}}' => $this->i18N('DESC_P3'), |
| 69: | '{{IOS/DESC_P4}}' => $this->i18N('DESC_P4'), |
| 70: | '{{IOS/DESC_P5}}' => $this->i18N('DESC_P5'), |
| 71: | '{{IOS/DESC_P6}}' => $this->i18N('DESC_P6'), |
| 72: | '{{IOS/DESC_P7}}' => $this->i18N('DESC_P7'), |
| 73: | '{{IOS/DESC_BUTTON_YES}}' => $this->i18N('DESC_BUTTON_YES'), |
| 74: | '{{IOS/DESC_BUTTON_SKIP}}' => $this->i18N('DESC_BUTTON_SKIP'), |
| 75: | '{{IOS/DESC_BUTTON_OPEN}}' => $this->i18N('DESC_BUTTON_OPEN'), |
| 76: | '{{AppVersion}}' => AU_APP_VERSION, |
| 77: | '{{IntegratorLinks}}' => $oApiIntegrator->buildHeadersLink() |
| 78: | )); |
| 79: | \Aurora\Modules\CoreWebclient\Module::Decorator()->SetHtmlOutputHeaders(); |
| 80: | } else { |
| 81: | \Aurora\System\Api::Location('./'); |
| 82: | } |
| 83: | |
| 84: | return $sResult; |
| 85: | } |
| 86: | |
| 87: | |
| 88: | |
| 89: | |
| 90: | public function EntryProfile() |
| 91: | { |
| 92: | $oIosManager = new Manager($this); |
| 93: | |
| 94: | $oUser = \Aurora\System\Api::getAuthenticatedUser(); |
| 95: | |
| 96: | $mResultProfile = $oIosManager && $oUser ? $oIosManager->generateXMLProfile($oUser) : false; |
| 97: | |
| 98: | if (!$mResultProfile) { |
| 99: | \Aurora\System\Api::Location('./?IOS/Error'); |
| 100: | } else { |
| 101: | \header('Content-type: application/x-apple-aspen-config; chatset=utf-8'); |
| 102: | \header('Content-Disposition: attachment; filename="afterlogic.mobileconfig"'); |
| 103: | echo $mResultProfile; |
| 104: | } |
| 105: | } |
| 106: | |
| 107: | } |
| 108: | |