Пример #1
0
 public function index()
 {
     ipAddJsVariable('ipTranslationAreYouSure', __('Are you sure?', 'Ip-admin', false));
     ipAddJs('Ip/Internal/Core/assets/js/angular.js');
     ipAddJs('Ip/Internal/Pages/assets/js/pages.js');
     ipAddJs('Ip/Internal/Pages/assets/js/pagesLayout.js');
     ipAddJs('Ip/Internal/Pages/assets/js/menuList.js');
     ipAddJs('Ip/Internal/Pages/assets/jstree/jstree.min.js');
     ipAddJs('Ip/Internal/Pages/assets/js/jquery.pageTree.js');
     ipAddJs('Ip/Internal/Pages/assets/js/jquery.pageProperties.js');
     ipAddJs('Ip/Internal/Grid/assets/grid.js');
     ipAddJs('Ip/Internal/Grid/assets/gridInit.js');
     ipAddJs('Ip/Internal/Grid/assets/subgridField.js');
     ipAddJsVariable('languageList', Helper::languageList());
     ipAddJsVariable('ipPagesLanguagesPermission', ipAdminPermission('Languages'));
     $menus = Model::getMenuList();
     foreach ($menus as $key => &$menu) {
         $default = 'top';
         if ($key == 0) {
             $default = 'bottom';
         }
         $menu['defaultPosition'] = Model::getDefaultMenuPagePosition($menu['alias'], false, $default);
         $default = 'below';
         $menu['defaultPositionWhenSelected'] = Model::getDefaultMenuPagePosition($menu['alias'], true, $default);
     }
     $menus = ipFilter('ipPagesMenuList', $menus);
     ipAddJsVariable('menuList', $menus);
     $variables = array('addPageForm' => Helper::addPageForm(), 'addMenuForm' => Helper::addMenuForm(), 'languagesUrl' => ipConfig()->baseUrl() . '?aa=Languages.index');
     $layout = ipView('view/layout.php', $variables);
     ipResponse()->setLayoutVariable('removeAdminContentWrapper', true);
     ipAddJsVariable('listStylePageSize', ipGetOption('Pages.pageListSize', 30));
     return $layout->render();
 }
Пример #2
0
 protected static function initConfig()
 {
     ipAddCss('Ip/Internal/Core/assets/admin/admin.css');
     ipAddJs('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.js');
     ipAddJsVariable('ipTranslationSaving', __('Saving...', 'Ip-admin', false));
     ipAddJs('Ip/Internal/Design/assets/optionsBox.js');
     ipAddJsVariable('ipModuleDesignConfiguration', Helper::getConfigurationBoxHtml());
     if (file_exists(ipThemeFile(Model::INSTALL_DIR . 'Options.js'))) {
         ipAddJs(ipThemeUrl(Model::INSTALL_DIR . 'Options.js'));
     } elseif (file_exists(ipThemeFile(Model::INSTALL_DIR . 'options.js'))) {
         ipAddJs(ipThemeUrl(Model::INSTALL_DIR . 'options.js'));
     }
     $model = Model::instance();
     $theme = $model->getTheme(ipConfig()->theme());
     if (!$theme) {
         throw new \Ip\Exception("Theme doesn't exist");
     }
     $options = $theme->getOptionsAsArray();
     $fieldNames = array();
     foreach ($options as $option) {
         if (empty($option['name'])) {
             continue;
         }
         $fieldNames[] = $option['name'];
     }
     ipAddJsVariable('ipModuleDesignOptionNames', $fieldNames);
 }
Пример #3
0
 public static function ipBeforeController()
 {
     $request = \Ip\ServiceLocator::request();
     $sessionLifetime = ini_get('session.gc_maxlifetime');
     if (!$sessionLifetime) {
         $sessionLifetime = 120;
     }
     if ($sessionLifetime > 30) {
         $sessionLifetime = $sessionLifetime - 20;
     }
     ipAddJsVariable('ipSessionRefresh', $sessionLifetime);
     if (ipConfig()->isDebugMode()) {
         ipAddJs('Ip/Internal/Core/assets/ipCore/jquery.js', null, 10);
         // default, global jQuery
         ipAddJs('Ip/Internal/Core/assets/ipCore/console.log.js', null, 10);
         ipAddJs('Ip/Internal/Core/assets/ipCore/functions.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/jquery.tools.form.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/form/color.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/form/file.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/form/richtext.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/form/repositoryFile.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/form/url.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/form.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/validator.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/widgets.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/ipCore.js');
     } else {
         ipAddJs('Ip/Internal/Core/assets/ipCore.min.js', null, 10);
     }
     //Form init
     $validatorTranslations = array('Ip-admin' => static::validatorLocalizationData('Ip-admin'), ipContent()->getCurrentLanguage()->getCode() => static::validatorLocalizationData('Ip'));
     ipAddJsVariable('ipValidatorTranslations', $validatorTranslations);
     if (ipAdminId() || \Ip\Internal\Admin\Model::isLoginPage() || \Ip\Internal\Admin\Model::isPasswordResetPage()) {
         if (ipConfig()->isDebugMode()) {
             ipAddJs('Ip/Internal/Core/assets/admin/managementMode.js');
             ipAddJs('Ip/Internal/Core/assets/admin/functions.js');
             ipAddJs('Ip/Internal/Core/assets/admin/validator.js');
             ipAddJs('Ip/Internal/Core/assets/admin/bootstrap/bootstrap.js');
             ipAddJs('Ip/Internal/Core/assets/admin/bootstrap-switch/bootstrap-switch.js');
         } else {
             ipAddJs('Ip/Internal/Core/assets/admin.min.js', null, 10);
         }
         ipAddJs('Ip/Internal/Core/assets/tinymce/pastePreprocess.js');
         ipAddJs('Ip/Internal/Core/assets/tinymce/default.js');
     }
     if (ipAdminId()) {
         ipAddJs('Ip/Internal/Core/assets/js/tiny_mce/jquery.tinymce.min.js');
         ipAddJs('Ip/Internal/Core/assets/js/tiny_mce/tinymce.min.js');
         ipAddJsVariable('ipBrowseLinkModalTemplate', ipView('view/browseLinkModal.php')->render());
         ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/plupload.full.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/plupload.browserplus.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/plupload.gears.js');
         ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/jquery.plupload.queue/jquery.plupload.queue.js');
         if (is_file(ipThemeFile('setup/admin.js'))) {
             ipAddJs(ipThemeUrl('setup/admin.js'));
         }
         ipAddCss('Ip/Internal/Core/assets/admin/admin.css');
     }
 }
Пример #4
0
 public static function ipBeforeController()
 {
     if (ipIsManagementState()) {
         // Works only if admin is logged in (AJAX is sent to Admin Controller)
         if (isset($_SESSION['module']['system']['adminJustLoggedIn']) && ipAdminPermission('Super admin')) {
             ipAddJs('Ip/Internal/System/assets/usageStatistics.js');
             ipAddJsVariable('ipSystemSendUsageStatistics', 1);
         }
     }
 }
Пример #5
0
 /**
  * @ipSubmenu Table types
  */
 public function index()
 {
     ipAddJs('Ip/Internal/Core/assets/js/angular.js');
     ipAddJs('Plugin/DataTableWidget/assets/tableTypesController.js');
     $data = array('createForm' => AdminFormHelper::createForm(true), 'updateForm' => AdminFormHelper::updateForm(true), 'deleteForm' => AdminFormHelper::deleteForm());
     ipAddJsVariable('tableTypes', TableType::getAllAsArray());
     ipAddJsVariable('columnOptions', TableType::getColumnOptions());
     ipAddJsVariable('languages', ipContent()->getLanguages());
     return ipView('view/layout.php', $data)->render();
 }
Пример #6
0
 public static function ipBeforeController()
 {
     $pubId = ipGetOption('AddThis.addThisUid');
     if ($pubId) {
         $data['pubid'] = $pubId;
         // AddThis publisher ID, if applicable
     }
     $data['data_track_addressbar'] = true;
     ipAddJsVariable("addthis_config", $data);
     ipAddJs('http://s7.addthis.com/js/300/addthis_widget.js');
 }
 /**
  * Index action adds an item to administration menu
  */
 public function index()
 {
     ipAddJs('view/assets/js/vendor/angular.js', 1);
     ipAddJs('view/assets/js/vendor/angular-animate.min.js');
     ipAddJs('view/assets/js/vendor/angular-sanitize.min.js');
     ipAddJs('view/assets/js/vendor/ngToast.min.js');
     ipAddJs('view/assets/js/Controllers/WidgetCtrl.js', 6);
     ipAddCss('view/assets/css/ngToast.min.css');
     $BasePath = ipConfig()->baseUrl();
     ipAddJsVariable('BASEPATH', $BasePath);
     $data = array();
     return ipView('view/main.php', $data)->render();
 }
Пример #8
0
 public static function initManagement()
 {
     $widgets = Service::getAvailableWidgets();
     $snippets = array();
     foreach ($widgets as $widget) {
         $snippetHtml = $widget->adminHtmlSnippet();
         if ($snippetHtml != '') {
             $snippets[] = $snippetHtml;
         }
     }
     ipAddJsVariable('ipWidgetSnippets', $snippets);
     ipAddJsVariable('ipContentInit', Model::initManagementData());
     ipAddJs('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.js');
     ipAddCss('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.css');
     if (ipConfig()->isDebugMode()) {
         ipAddJs('Ip/Internal/Content/assets/management/ipContentManagementInit.js');
         ipAddJs('Ip/Internal/Content/assets/management/content.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.contentManagement.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.widgetbutton.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.layoutModal.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.block.js');
         ipAddJs('Ip/Internal/Content/assets/management/jquery.ip.widget.js');
         ipAddJs('Ip/Internal/Content/assets/management/exampleContent.js');
         ipAddJs('Ip/Internal/Content/assets/management/drag.js');
         ipAddJs('Ip/Internal/Content/Widget/Columns/assets/Columns.js');
         ipAddJs('Ip/Internal/Content/Widget/File/assets/File.js');
         ipAddJs('Ip/Internal/Content/Widget/File/assets/jquery.ipWidgetFile.js');
         ipAddJs('Ip/Internal/Content/Widget/File/assets/jquery.ipWidgetFileContainer.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/Form.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/FormContainer.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/FormField.js');
         ipAddJs('Ip/Internal/Content/Widget/Form/assets/FormOptions.js');
         ipAddJs('Ip/Internal/Content/Widget/Html/assets/Html.js');
         ipAddJs('Ip/Internal/Content/Widget/Video/assets/Video.js');
         ipAddJs('Ip/Internal/Content/Widget/Image/assets/Image.js');
         ipAddJs('Ip/Internal/Content/Widget/Gallery/assets/Gallery.js');
         ipAddJs('Ip/Internal/Content/Widget/Text/assets/Text.js');
         ipAddJs('Ip/Internal/Content/Widget/Heading/assets/Heading.js');
         ipAddJs('Ip/Internal/Content/Widget/Heading/assets/HeadingModal.js');
         ipAddJs('Ip/Internal/Content/Widget/Map/assets/Map.js');
     } else {
         ipAddJs('Ip/Internal/Content/assets/management.min.js');
     }
     ipAddJs('Ip/Internal/Core/assets/js/jquery-tools/jquery.tools.ui.scrollable.js');
     ipAddJs('Ip/Internal/Content/assets/jquery.ip.uploadImage.js');
     ipAddJsVariable('isMobile', \Ip\Internal\Browser::isMobile());
     ipAddJsVariable('ipWidgetLayoutModalTemplate', ipView('view/widgetLayoutModal.php')->render());
 }
Пример #9
0
 public static function ipBeforeController()
 {
     if (ipIsManagementState() || ipRoute()->isAdmin() || ipRequest()->getQuery('ipDesignPreview')) {
         ipAddJs('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.js');
         ipAddJs('Ip/Internal/Repository/assets/ipRepository.js');
         ipAddJs('Ip/Internal/Repository/assets/ipRepositoryUploader.js');
         ipAddJs('Ip/Internal/Repository/assets/ipRepositoryAll.js');
         ipAddJs('Ip/Internal/Repository/assets/ipRepositoryBuy.js');
         ipAddJs('Ip/Internal/System/assets/market.js');
         ipAddJs('Ip/Internal/Core/assets/js/easyXDM/easyXDM.min.js');
         $marketUrl = ipConfig()->get('imageMarketUrl', 'http://market.impresspages.org/images-v1/');
         $popupData = array('marketUrl' => $marketUrl, 'allowUpload' => ipAdminPermission('Repository upload'), 'allowRepository' => ipAdminPermission('Repository'));
         ipAddJsVariable('ipRepositoryHtml', ipView('view/popup.php', $popupData)->render());
         ipAddJsVariable('ipRepositoryTranslate_confirm_delete', __('Are you sure you want to delete selected files?', 'Ip-admin'));
         ipAddJsVariable('ipRepositoryTranslate_delete_warning', __('Some of the selected files are still used somewhere on your website. Do you still want to remove them? ', 'Ip-admin'));
     }
 }
Пример #10
0
 public static function ipBeforeController()
 {
     if (ipIsManagementState()) {
         if (ipConfig()->isDebugMode()) {
             ipAddJs('Ip/Internal/InlineManagement/assets/src/inlineManagement.js');
             ipAddJs('Ip/Internal/InlineManagement/assets/src/inlineManagementControls.js');
             ipAddJs('Ip/Internal/InlineManagement/assets/src/inlineManagementImage.js');
             ipAddJs('Ip/Internal/InlineManagement/assets/src/inlineManagementLogo.js');
             ipAddJs('Ip/Internal/InlineManagement/assets/src/inlineManagementText.js');
             ipAddJs('Ip/Internal/InlineManagement/assets/src/jquery.fontselector.js');
         } else {
             ipAddJs('Ip/Internal/InlineManagement/assets/inlineManagement.min.js');
         }
         ipAddJsVariable('ipModuleInlineManagementControls', ipView('view/management/controls.php')->render());
         ipAddJs('Ip/Internal/Content/assets/jquery.ip.uploadImage.js');
         ipAddJs('Ip/Internal/Core/assets/js/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js');
         ipAddCss('Ip/Internal/Core/assets/js/bootstrap-colorpicker/css/bootstrap-colorpicker.css');
     }
 }
Пример #11
0
 public function index()
 {
     $administrators = Model::getAll();
     ipAddJs('Ip/Internal/Core/assets/js/angular.js');
     ipAddJs('Ip/Internal/Administrators/assets/administratorsController.js');
     foreach ($administrators as &$administrator) {
         unset($administrator['hash']);
         unset($administrator['resetSecret']);
         unset($administrator['resetTime']);
         $administrator['permissions'] = \Ip\Internal\AdminPermissionsModel::getUserPermissions($administrator['id']);
     }
     ipAddJsVariable('ipAdministrators', $administrators);
     ipAddJsVariable('ipAdministratorsAdminId', (int) ipAdminId());
     ipaddJsVariable('ipAvailablePermissions', \Ip\Internal\AdminPermissionsModel::availablePermissions());
     ipaddJsVariable('ipAdministratorId', ipAdminId());
     ipaddJsVariable('ipAdministratorsSuperAdminWarning', __('You will not be able to set other permissions for yourself!', 'Ip-admin', false));
     $data = array('createForm' => Helper::createForm(), 'updateForm' => Helper::updateForm());
     return ipView('view/layout.php', $data)->render();
 }
Пример #12
0
 public static function ipBeforeController()
 {
     //show admin submenu if needed
     if (ipRoute()->isAdmin()) {
         ipAddJs('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.js');
         ipAddCss('Ip/Internal/Core/assets/js/jquery-ui/jquery-ui.css');
         $submenu = Submenu::getSubmenuItems();
         $submenu = ipFilter('ipAdminSubmenu', $submenu);
         if ($submenu) {
             ipResponse()->setLayoutVariable('submenu', $submenu);
         }
     }
     // Show admin toolbar if admin is logged in:
     if (ipAdminId() && !ipRequest()->getRequest('pa') || ipRequest()->getRequest('aa') && ipAdminId()) {
         if (!ipRequest()->getQuery('ipDesignPreview') && !ipRequest()->getQuery('disableAdminNavbar')) {
             ipAddJs('Ip/Internal/Admin/assets/admin.js');
             ipAddJsVariable('ipAdminNavbar', static::getAdminNavbarHtml());
         }
     }
     // Show popup with autogenerated user information if needed
     $adminIsAutogenerated = ipStorage()->get('Ip', 'adminIsAutogenerated');
     if ($adminIsAutogenerated) {
         $adminId = \Ip\Internal\Admin\Backend::userId();
         $admin = \Ip\Internal\Administrators\Model::getById($adminId);
         ipAddJs('Ip/Internal/Admin/assets/adminIsAutogenerated.js');
         $data = array('adminUsername' => $admin['username'], 'adminPassword' => ipStorage()->get('Ip', 'adminIsAutogenerated'), 'adminEmail' => $admin['email']);
         ipAddJsVariable('ipAdminIsAutogenerated', ipView('view/adminIsAutoGenerated.php', $data)->render());
     }
     if (ipContent()->getCurrentPage()) {
         // initialize management
         if (ipIsManagementState()) {
             if (!ipRequest()->getQuery('ipDesignPreview') && !ipRequest()->getQuery('disableManagement')) {
                 \Ip\Internal\Content\Helper::initManagement();
             }
         }
         //show page content
         $response = ipResponse();
         $response->setDescription(\Ip\ServiceLocator::content()->getDescription());
         $response->setKeywords(ipContent()->getKeywords());
         $response->setTitle(ipContent()->getTitle());
     }
 }
Пример #13
0
 public function index()
 {
     ipAddJs('Ip/Internal/Core/assets/js/angular.js');
     ipAddJs('Ip/Internal/Plugins/assets/plugins.js');
     ipAddJs('Ip/Internal/Plugins/assets/jquery.pluginProperties.js');
     ipAddJs('Ip/Internal/Plugins/assets/pluginsLayout.js');
     $allPlugins = Model::getAllPluginNames();
     $plugins = array();
     foreach ($allPlugins as $pluginName) {
         $plugin = Helper::getPluginData($pluginName);
         $plugin['icon'] = $this->pluginIcon($pluginName);
         $plugins[] = $plugin;
     }
     ipAddJsVariable('pluginList', $plugins);
     ipAddJsVariable('ipTranslationAreYouSure', __('This action will remove plugin\'s files and database records. Do you want to proceed.?', 'Ip-admin', false));
     $data = array();
     $view = ipView('view/layout.php', $data);
     ipResponse()->setLayoutVariable('removeAdminContentWrapper', true);
     return $view->render();
 }
Пример #14
0
 public static function ipBeforeController()
 {
     $ipUrlOverrides = ipConfig()->get('urlOverrides');
     if (!$ipUrlOverrides) {
         $ipUrlOverrides = array();
     }
     ipAddJsVariable('ipUrlOverrides', $ipUrlOverrides);
     // Add widgets
     //TODO cache found assets to decrease file system usage
     $widgets = Service::getAvailableWidgets();
     if (ipIsManagementState()) {
         foreach ($widgets as $widget) {
             if (!$widget->isCore()) {
                 //core widget assets are included automatically in one minified file
                 static::addWidgetAssets($widget);
             }
         }
         ipAddJsVariable('ipPublishTranslation', __('Publish', 'Ip-admin', false));
     }
 }
Пример #15
0
 public function index()
 {
     ipAddJs('assets/log.js');
     ipAddJsVariable('clearConfirmTranslation', __('Are you sure you want to delete all log records?', 'Ip-admin', false));
     return parent::index();
 }
Пример #16
0
 public function updateConfig()
 {
     ipRequest()->mustBePost();
     $configModel = ConfigModel::instance();
     $form = $configModel->getThemeConfigForm(ipConfig()->theme());
     $post = ipRequest()->getPost();
     $errors = $form->validate($post);
     if ($errors) {
         return JsonRpc::error('Invalid form');
     }
     $configModel = ConfigModel::instance();
     $model = Model::instance();
     $theme = $model->getTheme(ipConfig()->theme());
     if (!$theme) {
         throw new \Ip\Exception("Theme doesn't exist");
     }
     $options = $theme->getOptionsAsArray();
     $valuesToStore = array();
     foreach ($options as $option) {
         if (empty($option['name'])) {
             continue;
         }
         $field = $form->getField($option['name']);
         if (!$field) {
             continue;
         }
         switch ($option['type']) {
             case 'checkbox':
                 /**
                  * @var \Ip\Form\Field\Checkbox $field
                  */
                 $value = $field->isChecked($post, $option['name']);
                 break;
             case 'RepositoryFile':
                 $value = '';
                 if (!empty($post[$option['name']][0])) {
                     $value = $post[$option['name']][0];
                 }
                 break;
             default:
                 $value = $field->getValueAsString($post, $option['name']);
         }
         $valuesToStore[$option['name']] = $value;
     }
     $valuesToStore = ipFilter('ipDesignOptionsSave', $valuesToStore);
     foreach ($valuesToStore as $key => $value) {
         $configModel->setConfigValue(ipConfig()->theme(), $key, $value);
     }
     $lessCompiler = LessCompiler::instance();
     $lessCompiler->rebuild(ipConfig()->theme());
     \Ip\Internal\Core\Service::invalidateAssetCache();
     ipAddJsVariable('ipModuleDesignConfiguration', Helper::getConfigurationBoxHtml());
     return JsonRpc::result(true);
 }