/** * Returns an instance of class (singleton pattern implementation). * * @return BOL_PluginService */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function siteInfo(array $params = array()) { $config = OW::getConfig(); $facebookConfig = OW::getEventManager()->call('fbconnect.get_configuration'); $this->assign("siteInfo", array("siteName" => $config->getValue('base', 'site_name'), "facebookAppId" => empty($facebookConfig["appId"]) ? null : trim($facebookConfig["appId"]), "userApprove" => (bool) $config->getValue("base", "mandatory_user_approve"), "confirmEmail" => (bool) $config->getValue("base", "confirm_email"), "maintenance" => (bool) $config->getValue("base", "maintenance"), "serverTimezone" => $config->getValue("base", "site_timezone"), "serverTimestamp" => time())); $plugins = BOL_PluginService::getInstance()->findActivePlugins(); $activePluginKeys = array(); /* @var $plugin BOL_Plugin */ foreach ($plugins as $plugin) { $activePluginKeys[] = $plugin->getKey(); } $this->assign("activePluginList", $activePluginKeys); $this->assign("isUserAuthenticated", OW::getUser()->isAuthenticated()); if (OW::getUser()->isAuthenticated()) { $avatarService = BOL_AvatarService::getInstance(); $userId = OW::getUser()->getId(); $avatarInfo = $avatarService->findByUserId($userId); $this->assign("userInfo", array("userId" => $userId, "displayName" => $this->userService->getDisplayName($userId), "avatarUrl" => $avatarService->getAvatarUrl($userId, 1), "bigAvatarUrl" => $avatarService->getAvatarUrl($userId, 2), "origAvatarUrl" => $avatarService->getAvatarUrl($userId, 3), "isAvatarApproved" => !$avatarInfo ? true : (bool) $avatarInfo->getStatus() == BOL_ContentService::STATUS_ACTIVE, "isSuspended" => $this->userService->isSuspended($userId), "isApproved" => $this->userService->isApproved($userId), "isEmailVerified" => OW::getUser()->getUserObject()->getEmailVerify())); $this->assign("menuInfo", $this->service->getMenu(OW::getUser()->getId())); } if (!empty($params['commands'])) { $event = new OW_Event('skandroid.base.ping', $params); OW::getEventManager()->trigger($event); $this->assign('ping', $event->getData()); } }
/** * Constructor. */ public function __construct() { parent::__construct(); $this->pluginService = BOL_PluginService::getInstance(); $this->storageService = BOL_StorageService::getInstance(); $this->themeService = BOL_ThemeService::getInstance(); }
public function albumsDeleteProcess() { $config = OW::getConfig(); // check if uninstall is in progress if (!$config->getValue('photo', 'uninstall_inprogress')) { return; } // check if cron queue is not busy if ($config->getValue('photo', 'uninstall_cron_busy')) { return; } $config->saveConfig('photo', 'uninstall_cron_busy', 1); $albumService = PHOTO_BOL_PhotoAlbumService::getInstance(); try { $albumService->deleteAlbums(self::ALBUMS_DELETE_LIMIT); } catch (Exception $e) { OW::getLogger()->addEntry(json_encode($e)); } $config->saveConfig('photo', 'uninstall_cron_busy', 0); if (!$albumService->countAlbums()) { BOL_PluginService::getInstance()->uninstall('photo'); $config->saveConfig('photo', 'uninstall_inprogress', 0); PHOTO_BOL_PhotoService::getInstance()->setMaintenanceMode(false); } }
/** * Constructor. */ public function __construct() { parent::__construct(); if (!OW::getUser()->isAdmin()) { throw new AuthenticateException(); } if (!OW::getRequest()->isAjax()) { $document = OW::getDocument(); $document->setMasterPage(new ADMIN_CLASS_MasterPage()); $this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title')); } BOL_PluginService::getInstance()->checkManualUpdates(); $plugin = BOL_PluginService::getInstance()->findNextManualUpdatePlugin(); $handlerParams = OW::getRequestHandler()->getHandlerAttributes(); // TODO refactor shortcut below if (!defined('OW_PLUGIN_XP') && $plugin !== null) { if ($handlerParams['controller'] === 'ADMIN_CTRL_Plugins' && $handlerParams['action'] === 'manualUpdateRequest') { //action } else { throw new RedirectException(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'manualUpdateRequest', array('key' => $plugin->getKey()))); } } // TODO temp admin pge inform event function admin_check_if_admin_page() { return true; } OW::getEventManager()->bind('admin.check_if_admin_page', 'admin_check_if_admin_page'); }
public function run() { $config = OW::getConfig(); // check if uninstall is in progress if (!$config->getValue('groups', 'uninstall_inprogress')) { return; } if (!$config->configExists('groups', 'uninstall_cron_busy')) { $config->addConfig('groups', 'uninstall_cron_busy', 0); } // check if cron queue is not busy if ($config->getValue('groups', 'uninstall_cron_busy')) { return; } $config->saveConfig('groups', 'uninstall_cron_busy', 1); $service = GROUPS_BOL_Service::getInstance(); try { $groups = $service->findLimitedList(self::GROUPS_DELETE_LIMIT); if (empty($groups)) { BOL_PluginService::getInstance()->uninstall('groups'); OW::getApplication()->setMaintenanceMode(false); return; } foreach ($groups as $group) { $service->deleteGroup($group->id); } $config->saveConfig('groups', 'uninstall_cron_busy', 0); } catch (Exception $e) { $config->saveConfig('groups', 'uninstall_cron_busy', 0); throw $e; } }
public function templatesDeleteProcess() { $config = OW::getConfig(); // check if uninstall is in progress if (!$config->getValue('virtualgifts', 'uninstall_inprogress')) { return; } // check if cron queue is not busy if ($config->getValue('virtualgifts', 'uninstall_cron_busy')) { return; } $config->saveConfig('virtualgifts', 'uninstall_cron_busy', 1); $giftService = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance(); $templates = $giftService->findAllTemplates(); for ($i = 0; $i < self::TEMPLATE_DELETE_LIMIT; $i++) { if (!isset($templates[$i])) { break; } $giftService->deleteTemplate($templates[$i]->id); } $config->saveConfig('virtualgifts', 'uninstall_cron_busy', 0); $templates = $giftService->findAllTemplates(); if (!$templates) { $config->saveConfig('virtualgifts', 'uninstall_inprogress', 0); BOL_PluginService::getInstance()->uninstall('virtualgifts'); $giftService->setMaintenanceMode(false); } }
public function processCleanUp() { $configs = OW::getConfig()->getValues('cacheextreme'); //clean template cache if ($configs['template_cache']) { OW_ViewRenderer::getInstance()->clearCompiledTpl(); } //clean db backend cache if ($configs['backend_cache']) { OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL); } //clean themes static contents cache if ($configs['theme_static']) { OW::getThemeManager()->getThemeService()->processAllThemes(); } //clean plugins static contents cache if ($configs['plugin_static']) { $pluginService = BOL_PluginService::getInstance(); $activePlugins = $pluginService->findActivePlugins(); /* @var $pluginDto BOL_Plugin */ foreach ($activePlugins as $pluginDto) { $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS; if (file_exists($pluginStaticDir)) { $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS; if (file_exists($staticDir)) { UTIL_File::removeDir($staticDir); } mkdir($staticDir); chmod($staticDir, 0777); UTIL_File::copyDir($pluginStaticDir, $staticDir); } } } }
/** * @see OW_MasterPage::init() */ protected function init() { $language = OW::getLanguage(); OW::getThemeManager()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(BOL_ThemeService::DEFAULT_THEME)); $menuTypes = array(BOL_NavigationService::MENU_TYPE_ADMIN, BOL_NavigationService::MENU_TYPE_APPEARANCE, BOL_NavigationService::MENU_TYPE_PRIVACY, BOL_NavigationService::MENU_TYPE_PAGES, BOL_NavigationService::MENU_TYPE_PLUGINS, BOL_NavigationService::MENU_TYPE_SETTINGS, BOL_NavigationService::MENU_TYPE_USERS, BOL_NavigationService::MENU_TYPE_MOBILE); $menuItems = BOL_NavigationService::getInstance()->findMenuItemsForMenuList($menuTypes); if (defined('OW_PLUGIN_XP')) { foreach ($menuItems as $key1 => $menuType) { foreach ($menuType as $key2 => $menuItem) { if (in_array($menuItem['key'], array('sidebar_menu_plugins_add', 'sidebar_menu_themes_add'))) { unset($menuItems[$key1][$key2]); } } } } $menuDataArray = array('menu_admin' => BOL_NavigationService::MENU_TYPE_ADMIN, 'menu_users' => BOL_NavigationService::MENU_TYPE_USERS, 'menu_settings' => BOL_NavigationService::MENU_TYPE_SETTINGS, 'menu_privacy' => BOL_NavigationService::MENU_TYPE_PRIVACY, 'menu_appearance' => BOL_NavigationService::MENU_TYPE_APPEARANCE, 'menu_pages' => BOL_NavigationService::MENU_TYPE_PAGES, 'menu_plugins' => BOL_NavigationService::MENU_TYPE_PLUGINS, 'menu_mobile' => BOL_NavigationService::MENU_TYPE_MOBILE); foreach ($menuDataArray as $key => $value) { $this->menuCmps[$key] = new ADMIN_CMP_AdminMenu($menuItems[$value]); $this->addMenu($value, $this->menuCmps[$key]); } // admin notifications $adminNotifications = array(); if (!defined('OW_PLUGIN_XP') && OW::getConfig()->getValue('base', 'update_soft')) { $adminNotifications[] = $language->text('admin', 'notification_soft_update', array('link' => OW::getRouter()->urlForRoute('admin_core_update_request'))); } $pluginsCount = BOL_PluginService::getInstance()->getPluginsToUpdateCount(); if (!defined('OW_PLUGIN_XP') && $pluginsCount > 0) { $adminNotifications[] = $language->text('admin', 'notification_plugins_to_update', array('link' => OW::getRouter()->urlForRoute('admin_plugins_installed'), 'count' => $pluginsCount)); } $themesCount = BOL_ThemeService::getInstance()->getThemesToUpdateCount(); if (!defined('OW_PLUGIN_XP') && $themesCount > 0) { $adminNotifications[] = $language->text('admin', 'notification_themes_to_update', array('link' => OW::getRouter()->urlForRoute('admin_themes_choose'), 'count' => $themesCount)); } $event = new BASE_CLASS_EventCollector('admin.add_admin_notification'); OW::getEventManager()->trigger($event); $adminNotifications = array_merge($adminNotifications, $event->getData()); $this->assign('notifications', $adminNotifications); $adminWarnings = array(); if (!defined('OW_PLUGIN_XP') && OW::getConfig()->configExists('base', 'cron_is_active') && (int) OW::getConfig()->getValue('base', 'cron_is_active') === 0) { $adminWarnings[] = $language->text('admin', 'warning_cron_is_not_active', array('path' => OW_DIR_ROOT . 'ow_cron' . DS . 'run.php')); } if (!defined('OW_PLUGIN_XP') && !ini_get('allow_url_fopen')) { $adminWarnings[] = $language->text('admin', 'warning_url_fopen_disabled'); } $event = new BASE_CLASS_EventCollector('admin.add_admin_warning'); OW::getEventManager()->trigger($event); $adminWarnings = array_merge($adminWarnings, $event->getData()); $this->assign('warnings', $adminWarnings); // platform info $event = new OW_Event('admin.get_soft_version_text'); OW_EventManager::getInstance()->trigger($event); $verString = $event->getData(); if (empty($verString)) { $verString = OW::getLanguage()->text('admin', 'soft_version', array('version' => OW::getConfig()->getValue('base', 'soft_version'), 'build' => OW::getConfig()->getValue('base', 'soft_build'))); } $this->assign('version', OW::getConfig()->getValue('base', 'soft_version')); $this->assign('build', OW::getConfig()->getValue('base', 'soft_build')); $this->assign('softVersion', $verString); }
/** * Updates dir structure for all plugins */ public function updateStructureforAllPlugins() { $plugins = $this->pluginService->findAllPlugins(); /* @var $pluginDto BOL_Plugin */ foreach ($plugins as $pluginDto) { $this->pluginService->addPluginDirs($pluginDto); } }
/** * Adds spec. uninstall page route name. * * @param string $key * @param string $routName */ public function addUninstallRouteName($key, $routName) { $plugin = $this->pluginService->findPluginByKey(trim($key)); if ($plugin !== null) { $plugin->setUninstallRoute($routName); $this->pluginService->savePlugin($plugin); } }
private function getPluginDtoByKey($params) { if (!empty($params['key'])) { $pluginDto = $this->pluginService->findPluginByKey(trim($params['key'])); } if (!empty($pluginDto)) { return $pluginDto; } OW::getFeedback()->error(OW::getLanguage()->text('admin', 'manage_plugins_plugin_not_found')); $this->redirectToAction('index'); }
function checkSocialBridgePlugin($provider) { if (!($plugin = BOL_PluginService::getInstance()->findPluginByKey('ynsocialbridge'))) { return false; } else { if (!$plugin->isActive() || !YNSOCIALBRIDGE_BOL_ApisettingService::getInstance()->getConfig($provider)) { return false; } } return true; }
function ynsocialpublisher_addAdminNotification(BASE_CLASS_EventCollector $e) { $language = OW::getLanguage(); if (OW::getPluginManager()->isPluginActive('ynsocialbridge') == false) { $e->add($language->text('ynsocialpublisher', 'requires_configuration_message')); } else { $build = BOL_PluginService::getInstance()->findPluginByKey('ynsocialbridge')->build; if ($build < 2) { $e->add($language->text('ynsocialpublisher', 'requires_configuration_message')); } } }
public function genericInit() { OW::getEventManager()->bind('ads.enabled_plugins', array($this, 'mailboxAdsEnabled')); $credits = new MAILBOX_CLASS_Credits(); OW::getEventManager()->bind('usercredits.on_action_collect', array($credits, 'bindCreditActionsCollect')); OW::getEventManager()->bind('plugin.mailbox.on_plugin_init.handle_controller_attributes', array($this, 'onHandleControllerAttributes')); OW::getEventManager()->bind('admin.add_auth_labels', array($this, 'addAuthLabels')); OW::getEventManager()->bind('plugin.privacy.get_action_list', array($this, 'onCollectPrivacyActions')); OW::getEventManager()->bind('base.online_now_click', array($this, 'onShowOnlineButton')); OW::getEventManager()->bind('base.ping', array($this, 'onPing')); OW::getEventManager()->bind('base.ping.notifications', array($this, 'onApiPing'), 1); OW::getEventManager()->bind('mailbox.ping', array($this, 'onPing')); OW::getEventManager()->bind('mailbox.mark_as_read', array($this, 'onMarkAsRead')); OW::getEventManager()->bind('mailbox.mark_unread', array($this, 'onMarkUnread')); OW::getEventManager()->bind('mailbox.get_conversation_id', array($this, 'getConversationId')); OW::getEventManager()->bind('mailbox.delete_conversation', array($this, 'onDeleteConversation')); OW::getEventManager()->bind('mailbox.create_conversation', array($this, 'onCreateConversation')); OW::getEventManager()->bind('mailbox.authorize_action', array($this, 'onAuthorizeAction')); OW::getEventManager()->bind('mailbox.find_user', array($this, 'onFindUser')); if (OW::getPluginManager()->isPluginActive('ajaxim')) { try { BOL_PluginService::getInstance()->uninstall('ajaxim'); } catch (LogicException $e) { } } if (OW::getPluginManager()->isPluginActive('im')) { try { BOL_PluginService::getInstance()->uninstall('im'); } catch (LogicException $e) { } } OW::getEventManager()->bind('winks.onAcceptWink', array($this, 'onAcceptWink')); OW::getEventManager()->bind('winks.onWinkBack', array($this, 'onWinkBack')); OW::getEventManager()->bind('mailbox.get_unread_message_count', array($this, 'getUnreadMessageCount')); OW::getEventManager()->bind('mailbox.get_chat_user_list', array($this, 'getChatUserList')); OW::getEventManager()->bind('mailbox.post_message', array($this, 'postMessage')); OW::getEventManager()->bind('mailbox.post_reply_message', array($this, 'postReplyMessage')); OW::getEventManager()->bind('mailbox.get_new_messages', array($this, 'getNewMessages')); OW::getEventManager()->bind('mailbox.get_new_messages_for_conversation', array($this, 'getNewMessagesForConversation')); OW::getEventManager()->bind('mailbox.get_messages', array($this, 'getMessages')); OW::getEventManager()->bind('mailbox.get_history', array($this, 'getHistory')); OW::getEventManager()->bind('mailbox.show_send_message_button', array($this, 'showSendMessageButton')); OW::getEventManager()->bind('mailbox.get_active_mode_list', array($this, 'onGetActiveModeList')); OW::getEventManager()->bind('friends.request-accepted', array($this, 'onFriendRequestAccepted')); OW::getEventManager()->bind(OW_EventManager::ON_USER_LOGIN, array($this, 'resetAllUsersLastData')); OW::getEventManager()->bind(OW_EventManager::ON_USER_UNREGISTER, array($this, 'onUserUnregister')); OW::getEventManager()->bind(OW_EventManager::ON_USER_REGISTER, array($this, 'resetAllUsersLastData')); OW::getEventManager()->bind(OW_EventManager::ON_PLUGINS_INIT, array($this, 'updatePlugin')); OW::getEventManager()->bind('base.after_avatar_update', array($this, 'onChangeUserAvatar')); }
public function __construct($clientConfig, $service) { parent::__construct('settingsForm'); $language = OW::getLanguage(); $params = array('key' => '', 'secret' => '', 'max_invite_day' => 10); if ($clientConfig) { $params = unserialize($clientConfig->apiParams); } // API Key $textField['key'] = new TextField('key'); $textField['key']->setLabel($language->text('ynsocialbridge', 'facebook_setting_key'))->setValue($params['key'])->setRequired(false); $this->addElement($textField['key']); //API Secret $textField['secret'] = new TextField('secret'); $textField['secret']->setLabel($language->text('ynsocialbridge', 'facebook_setting_secret'))->setValue($params['secret'])->setRequired(false); $this->addElement($textField['secret']); if (BOL_PluginService::getInstance()->findPluginByKey('yncontactimporter')) { switch ($service) { case 'facebook': $miValidator = new IntValidator(1, 20); $miValidator->setErrorMessage($language->text('ynsocialbridge', 'max_invite_validation_error', array('min' => 1, 'max' => 20))); break; case 'twitter': $miValidator = new IntValidator(1, 250); $miValidator->setErrorMessage($language->text('ynsocialbridge', 'max_invite_validation_error', array('min' => 1, 'max' => 250))); break; case 'linkedin': $miValidator = new IntValidator(1, 10); $miValidator->setErrorMessage($language->text('ynsocialbridge', 'max_invite_validation_error', array('min' => 1, 'max' => 10))); break; default: $miValidator = new IntValidator(1, 10); $miValidator->setErrorMessage($language->text('ynsocialbridge', 'max_invite_validation_error', array('min' => 1, 'max' => 10))); break; } //Max invite $textField['max_invite_day'] = new TextField('max_invite_day'); $textField['max_invite_day']->setLabel($language->text('ynsocialbridge', 'max_invite_day'))->setValue($params['max_invite_day'])->setRequired(false)->addValidator($miValidator); $this->addElement($textField['max_invite_day']); } // button submit $submit = new Submit('submit'); $submit->setValue($language->text('ynsocialbridge', 'save_btn_label')); $this->addElement($submit); }
public function siteInfo() { $config = OW::getConfig(); $this->assign("name", $config->getValue('base', 'site_name')); $this->assign("url", OW_URL_HOME); $plugins = array(); $pluginDtos = BOL_PluginService::getInstance()->findActivePlugins(); /* @var $plugin BOL_Plugin */ foreach ($pluginDtos as $plugin) { $plugins[] = $plugin->getKey(); } $this->assign("plugins", $plugins); $facebookConfig = OW::getEventManager()->call('fbconnect.get_configuration'); // TODO dev /* $facebookConfig = array( "appId" => "1485633834985042" ); */ $this->assign("facebookConnect", array("active" => $facebookConfig === null ? 0 : 1, "config" => $facebookConfig)); }
public function imagesDeleteProcess() { $config = OW::getConfig(); // check if uninstall is in progress if (!$config->getValue('blogs', 'uninstall_inprogress')) { return; } // check if cron queue is not busy if ($config->getValue('blogs', 'uninstall_cron_busy')) { return; } $config->saveConfig('blogs', 'uninstall_cron_busy', 1); $mediaPanelService = BOL_MediaPanelService::getInstance(); $mediaPanelService->deleteImages('blogs', self::IMAGES_DELETE_LIMIT); $config->saveConfig('blogs', 'uninstall_cron_busy', 0); if (!$mediaPanelService->countGalleryImages('blogs')) { $config->saveConfig('blogs', 'uninstall_inprogress', 0); BOL_PluginService::getInstance()->uninstall('blogs'); } }
private function updateItemsLicenseStatus(array $items) { $invalidItems = array(self::URI_VAR_ITEM_TYPE_VAL_PLUGIN => array(), self::URI_VAR_ITEM_TYPE_VAL_THEME => array()); foreach ($items as $item) { $invalidItems[$item[self::URI_VAR_ITEM_TYPE]][$item[self::URI_VAR_KEY]] = $item[self::URI_VAR_DEV_KEY]; } $itemsToCheck = array_merge($this->pluginService->findAllPlugins(), $this->themeService->findAllThemes()); $dataForNotification = array(); /* @var $item BOL_StoreItem */ foreach ($itemsToCheck as $item) { $type = $item instanceof BOL_Plugin ? self::URI_VAR_ITEM_TYPE_VAL_PLUGIN : self::URI_VAR_ITEM_TYPE_VAL_THEME; // if the item is on DB if (isset($invalidItems[$type][$item->getKey()]) && $invalidItems[$type][$item->getKey()] == $item->getDeveloperKey()) { if ((int) $item->getLicenseCheckTimestamp() == 0) { $dataForNotification[] = array("type" => $type, "title" => $item->getTitle()); $item->setLicenseCheckTimestamp(time()); $this->saveStoreItem($item); } else { if ($this->isItemLicenseCheckPeriodExpired($item->getLicenseCheckTimestamp())) { if ($type == self::URI_VAR_ITEM_TYPE_VAL_THEME && $this->themeService->getSelectedThemeName() == $item->getKey()) { $defaultTheme = OW::getEventManager()->call("base.get_default_theme"); if (!$defaultTheme) { $defaultTheme = BOL_ThemeService::DEFAULT_THEME; } $this->themeService->setSelectedThemeName($defaultTheme); } else { if ($type == self::URI_VAR_ITEM_TYPE_VAL_PLUGIN && $item->isActive) { $this->pluginService->deactivate($item->getKey()); } } } } } else { if ($item->getLicenseCheckTimestamp() != null && $item->getLicenseCheckTimestamp() > 0) { $item->setLicenseCheckTimestamp(null); $this->saveStoreItem($item); } } } $this->notifyAdminAboutInvalidItems($dataForNotification); }
public function __construct() { parent::__construct(); $this->setPageHeading(OW::getLanguage()->text('ynsocialbridge', 'admin_ynsocialbridge_heading')); $this->setPageHeadingIconClass('ow_ic_gear_wheel'); $this->_plugin = OW::getPluginManager()->getPlugin('ynsocialbridge'); //load css $cssUrl = $this->_plugin->getStaticCssUrl() . 'ynsocialbridge.css'; OW::getDocument()->addStyleSheet($cssUrl); //add menu $menu = $this->_initMenu(); //check Contact importer if ($this->_contactImporterPlugin = BOL_PluginService::getInstance()->findPluginByKey('yncontactimporter')) { $this->assign('hasContactimporter', 1); } else { $this->assign('hasContactimporter', 0); } //put languages to database when chage //OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('ynsocialbridge')->getRootDir() . 'langs.zip', // 'ynsocialbridge'); }
public function topicsDeleteProcess() { $config = OW::getConfig(); // check if uninstall is in progress if (!$config->getValue('forum', 'uninstall_inprogress')) { return; } // check if cron queue is not busy if ($config->getValue('forum', 'uninstall_cron_busy')) { return; } $config->saveConfig('forum', 'uninstall_cron_busy', 1); $forumService = FORUM_BOL_ForumService::getInstance(); $forumService->deleteTopics(self::TOPICS_DELETE_LIMIT); $mediaPanelService = BOL_MediaPanelService::getInstance(); $mediaPanelService->deleteImages('forum', self::MEDIA_DELETE_LIMIT); $config->saveConfig('forum', 'uninstall_cron_busy', 0); if ((int) $forumService->countAllTopics() + (int) $mediaPanelService->countGalleryImages('forum') == 0) { $config->saveConfig('forum', 'uninstall_inprogress', 0); BOL_PluginService::getInstance()->uninstall('forum'); FORUM_BOL_ForumService::getInstance()->setMaintenanceMode(false); } }
public function addAdminNotification(ADMIN_CLASS_NotificationCollector $coll) { // update soft if (OW::getConfig()->getValue('base', 'update_soft')) { $coll->add(OW::getLanguage()->text('admin', 'notification_soft_update', array('link' => OW::getRouter()->urlForRoute('admin_core_update_request'))), ADMIN_CLASS_NotificationCollector::NOTIFICATION_WARNING); } $pluginsCount = BOL_PluginService::getInstance()->getPluginsToUpdateCount(); // plugins update if ($pluginsCount > 0) { $coll->add(OW::getLanguage()->text('admin', 'notification_plugins_to_update', array('link' => OW::getRouter()->urlForRoute('admin_plugins_installed'), 'count' => $pluginsCount)), ADMIN_CLASS_NotificationCollector::NOTIFICATION_UPDATE); } $themesCount = BOL_ThemeService::getInstance()->getThemesToUpdateCount(); // themes update if ($themesCount > 0) { $coll->add(OW::getLanguage()->text('admin', 'notification_themes_to_update', array('link' => OW::getRouter()->urlForRoute('admin_themes_choose'), 'count' => $themesCount)), ADMIN_CLASS_NotificationCollector::NOTIFICATION_UPDATE); } if (OW::getConfig()->configExists('base', 'cron_is_active') && (int) OW::getConfig()->getValue('base', 'cron_is_active') === 0) { $coll->add(OW::getLanguage()->text('admin', 'warning_cron_is_not_active', array('path' => OW_DIR_ROOT . 'ow_cron' . DS . 'run.php')), ADMIN_CLASS_NotificationCollector::NOTIFICATION_WARNING); } if (!ini_get('allow_url_fopen')) { $coll->add(OW::getLanguage()->text('admin', 'warning_url_fopen_disabled'), ADMIN_CLASS_NotificationCollector::NOTIFICATION_WARNING); } }
public function slideshowUninstallProcess() { $config = OW::getConfig(); // check if uninstall is in progress if (!$config->getValue('slideshow', 'uninstall_inprogress')) { return; } // check if cron queue is not busy if ($config->getValue('slideshow', 'uninstall_cron_busy')) { return; } $config->saveConfig('slideshow', 'uninstall_cron_busy', 1); $service = SLIDESHOW_BOL_Service::getInstance(); $list = $service->getDeleteQueueList(self::SLIDE_DELETE_LIMIT); if ($list) { foreach ($list as $slide) { $service->deleteSlideById($slide->id); } $config->saveConfig('slideshow', 'uninstall_cron_busy', 0); } else { $config->saveConfig('slideshow', 'uninstall_inprogress', 0); BOL_PluginService::getInstance()->uninstall('slideshow'); } }
function skadate_after_route_handler() { OW_ViewRenderer::getInstance()->assignVar('adminDashboardIframeUrl', "//static.oxwall.org/spotlight/?platform=skadate&platform-version=" . OW::getConfig()->getValue('base', 'soft_version') . "&platform-build=" . OW::getConfig()->getValue('base', 'soft_build')); $config = OW::getConfig(); if (!$config->configExists('skadate', 'installInit')) { return; } $installDir = dirname(__FILE__) . DS . "files" . DS; $installPluginfiles = $installDir . 'ow_pluginfiles' . DS; $installUserfiles = $installDir . 'ow_userfiles' . DS; /* read all plugins from DB */ $plugins = BOL_PluginService::getInstance()->findActivePlugins(); $pluginList = array(); /* @var $value BOL_Plugin */ foreach ($plugins as $value) { $pluginList[$value->getKey()] = $value->isSystem ? new OW_SystemPlugin(array('dir_name' => $value->getModule(), 'key' => $value->getKey(), 'active' => $value->isActive(), 'dto' => $value)) : new OW_Plugin(array('dir_name' => $value->getModule(), 'key' => $value->getKey(), 'active' => $value->isActive(), 'dto' => $value)); } /* @var $plugin OW_Plugin */ foreach ($pluginList as $plugin) { if (!file_exists($plugin->getPluginFilesDir())) { mkdir($plugin->getPluginFilesDir()); } chmod($plugin->getPluginFilesDir(), 0777); if (file_exists($installPluginfiles . $plugin->getModuleName())) { UTIL_File::copyDir($installPluginfiles . $plugin->getModuleName(), $plugin->getPluginFilesDir()); } if (!file_exists($plugin->getUserFilesDir())) { mkdir($plugin->getUserFilesDir()); } chmod($plugin->getUserFilesDir(), 0777); if (file_exists($installUserfiles . $plugin->getModuleName())) { UTIL_File::copyDir($installUserfiles . $plugin->getModuleName(), $plugin->getUserFilesDir()); } } $config->deleteConfig('skadate', 'installInit'); }
/** * @param string $xml * @param bool $refreshCache * @param bool $importOnlyActivePluginPrefix * @param bool $updateValues * @return bool */ public function importPrefix($xml, $refreshCache = false, $importOnlyActivePluginPrefix = false, $updateValues = false) { if (false === ($prefixesXml = $xml->xpath("/prefix"))) { return false; } $languageTag = (string) $prefixesXml[0]->attributes()->language_tag; $prefixName = strval($prefixesXml[0]->attributes()->name); if ($importOnlyActivePluginPrefix && !in_array($prefixName, $this->getExceptionPrefixes())) { $plugin = BOL_PluginService::getInstance()->findPluginByKey($prefixName); if (empty($plugin)) { return false; } } if (null === ($language = $this->findByTag($languageTag))) { $language = new BOL_Language(); $language->setTag($languageTag)->setLabel((string) $prefixesXml[0]->attributes()->language_label)->setOrder($this->findMaxOrder() + 1)->setStatus('inactive'); $language->setRtl((string) $prefixesXml[0]->attributes()->language_rtl); $this->save($language); } if (null === ($prefix = $this->findPrefix($prefixName))) { $prefix = new BOL_LanguagePrefix(); $prefix->setPrefix($prefixName)->setLabel(strval($prefixesXml[0]->attributes()->label)); $this->savePrefix($prefix); } $keysXml = $prefixesXml[0]->xpath('child::key'); foreach ($keysXml as $keyXml) { if (null === ($key = $this->findKey((string) $prefixesXml[0]->attributes()->name, (string) $keyXml->attributes()->name))) { $key = new BOL_LanguageKey(); $key->setKey((string) $keyXml->attributes()->name); $key->setPrefixId($prefix->getId()); $this->saveKey($key); } $valueDto = $this->findValue($language->getId(), $key->getId()); if ($valueDto !== null && !$updateValues) { continue; } if ($valueDto === null) { $valueDto = new BOL_LanguageValue(); $valueDto->setLanguageId($language->getId()); $valueDto->setKeyId($key->getId()); } $valueDto->setValue((string) $keyXml->value); $this->saveValue($valueDto, false); } if ($refreshCache) { $this->generateCache($language->getId()); } }
private function setImportInfo() { $service = BOL_LanguageService::getInstance(); $langsToImport = array(); $prefixesToImport = array(); $arr = glob("{$service->getImportDirPath()}language_*"); $type = ''; if (!empty($arr)) { $type = 'pack'; $flag = false; foreach ($arr as $index => $dir) { $dh = opendir($dir); if (!file_exists($dir . DS . 'language.xml')) { continue; } $langXmlE = simplexml_load_file($dir . DS . 'language.xml'); /* @var $xmlElement SimpleXMLElement */ $l = array('label' => strval($langXmlE->attributes()->label), 'tag' => strval($langXmlE->attributes()->tag)); if (!in_array($l, $langsToImport)) { $langsToImport[] = $l; } while (false !== ($file = readdir($dh))) { if ($file == '.' || $file == '..') { continue; } if (is_dir("{$dir}/{$file}")) { //printVar("$file/"); } else { if ($file == 'language.xml') { continue; } $xmlElement = simplexml_load_file("{$dir}/{$file}"); /* @var $xmlElement SimpleXMLElement */ $arr = $xmlElement->xpath('/prefix/key'); $tmp = $xmlElement->xpath('/prefix'); $prefixElement = $tmp[0]; $plugin = BOL_PluginService::getInstance()->findPluginByKey(strval($prefixElement->attributes()->name)); if (!empty($plugin)) { $p = array('label' => strval($prefixElement->attributes()->label), 'prefix' => strval($prefixElement->attributes()->name)); if (!in_array($p, $prefixesToImport)) { $prefixesToImport[] = $p; } } } } $flag = true; } if (!$flag) { throw new LogicException(); } } else { $type = "single-xml"; $arr = glob("{$service->getImportDirPath()}*.xml"); if (empty($arr) || !file_exists($arr[0])) { throw new LogicException(); } $xmlElement = simplexml_load_file($arr[0]); if (!$xmlElement) { throw new LogicException(); } $tmp = $xmlElement->xpath('/prefix'); $prefixElement = $tmp[0]; $plugin = BOL_PluginService::getInstance()->findPluginByKey(strval($prefixElement->attributes()->name)); if (!empty($plugin)) { $l = array('tag' => strval($prefixElement->attributes()->language_tag), 'label' => strval($prefixElement->attributes()->language_label)); $langsToImport[] = $l; $prefixesToImport[] = array('label' => $prefixElement->attributes()->label, 'prefix' => $prefixElement->attributes()->name); } } $this->assign('langsToImport', $langsToImport); $this->assign('prefixesToImport', $prefixesToImport); $this->assign('type', $type); }
public function checkLicenseKey($key, $developerKey, $licenseKey) { return BOL_PluginService::getInstance()->checkLicenseKey($key, $developerKey, $licenseKey); }
$event = new OW_Event(OW_EventManager::ON_PLUGINS_INIT); OW::getEventManager()->trigger($event); //init cache manager $beckend = OW::getEventManager()->call('base.cache_backend_init'); if ($beckend !== null) { OW::getCacheManager()->setCacheBackend($beckend); OW::getCacheManager()->setLifetime(3600); OW::getDbo()->setUseCashe(true); } OW::getThemeManager()->initDefaultTheme(); // setting current theme $activeThemeName = OW::getConfig()->getValue('base', 'selectedTheme'); if ($activeThemeName !== BOL_ThemeService::DEFAULT_THEME && OW::getThemeManager()->getThemeService()->themeExists($activeThemeName)) { OW_ThemeManager::getInstance()->setCurrentTheme(BOL_ThemeService::getInstance()->getThemeObjectByName(trim($activeThemeName))); } $plugins = BOL_PluginService::getInstance()->findActivePlugins(); foreach ($plugins as $plugin) { /* @var $plugin BOL_Plugin */ $pluginRootDir = OW::getPluginManager()->getPlugin($plugin->getKey())->getRootDir(); if (file_exists($pluginRootDir . DS . 'cron.php')) { include $pluginRootDir . DS . 'cron.php'; $className = strtoupper($plugin->getKey()) . '_Cron'; $cron = new $className(); $runJobs = array(); $newRunJobDtos = array(); foreach (BOL_CronService::getInstance()->findJobList() as $runJob) { /* @var $runJob BOL_CronJob */ $runJobs[$runJob->methodName] = $runJob->runStamp; } $jobs = $cron->getJobList(); foreach ($jobs as $job => $interval) {
public function checkPluginUpdates() { BOL_PluginService::getInstance()->checkUpdates(); }
public function findGatewayProductList($gatewayId) { $products = $this->billingGatewayProductDao->findListForGateway($gatewayId); if (!$products) { return null; } $pluginService = BOL_PluginService::getInstance(); $list = array(); foreach ($products as $prod) { $list[$prod->id]['dto'] = $prod; $plugin = $pluginService->findPluginByKey($prod->pluginKey); if ($plugin) { $list[$prod->id]['plugin'] = $plugin->title; } } return $list; }