public function renderInvalidPageCacheAlert() { $systemSettings = $this->settings->getSettings(Schema::MODULE_NAME); if ($this->acl->hasPermission('admin/system/maintenance/cache') && $systemSettings['page_cache_is_valid'] == 0) { $this->view->displayTemplate('System/Partials/alert_invalid_page_cache.tpl'); } }
/** * @return \ACP3\Core\View\Renderer\Smarty */ public function create() { $smarty = new \Smarty(); $renderer = new Smarty($smarty, $this->appPath, $this->environment); $renderer->configure(['compile_id' => $this->config->getSettings(Schema::MODULE_NAME)['design']]); return $renderer; }
/** * @return \ACP3\Core\Http\RequestInterface */ public function create() { $request = $this->getRequest(); $request->setHomepage($this->config->getSettings(Schema::MODULE_NAME)['homepage']); $request->processQuery(); return $request; }
/** * Title constructor. * @param Steps $steps * @param EventDispatcherInterface $eventDispatcher * @param SettingsInterface $config */ public function __construct(Steps $steps, EventDispatcherInterface $eventDispatcher, SettingsInterface $config) { parent::__construct($steps, $eventDispatcher); $settings = $config->getSettings(Schema::MODULE_NAME); if (isset($settings['site_title'])) { $this->siteTitle = $settings['site_title']; } }
/** * @return string */ public function getLocale() { if ($this->locale === '') { $locale = $this->user->getLanguage(); $this->locale = $this->languagePackExists($locale) === true ? $locale : $this->config->getSettings(Schema::MODULE_NAME)['lang']; } return $this->locale; }
/** * @inheritdoc */ public function process(array $params, \Smarty_Internal_Template $smarty) { $params['id'] = !empty($params['id']) ? $params['id'] : $params['name']; $serviceId = $this->config->getSettings(Schema::MODULE_NAME)['wysiwyg']; $wysiwyg = $this->wysiwygFactory->create($serviceId); $wysiwyg->setParameters($params); $smarty->smarty->assign($wysiwyg->getData()); return $smarty->smarty->fetch('asset:System/Partials/wysiwyg.tpl'); }
/** * @inheritdoc */ public function save(array $data, $entryId = null) { if ($entryId === null) { $settings = $this->config->getSettings(Schema::MODULE_NAME); $data['html'] = $settings['html']; $data['status'] = 0; } $data['updated_at'] = 'now'; return parent::save($data, $entryId); }
/** * @inheritdoc */ public function save(array $data, $entryId = null) { $settings = $this->config->getSettings(Schema::MODULE_NAME); $data = array_merge($data, ['comments' => $settings['comments'] == 1 ? isset($data['comments']) && $data['comments'] == 1 ? 1 : 0 : $settings['comments']]); if ($entryId === null) { $picNum = $this->repository->getLastPictureByGalleryId($entryId); $data['pic'] = !is_null($picNum) ? $picNum + 1 : 1; } return parent::save($data, $entryId); }
public function invalidatePageCache() { if ($this->canUsePageCache->canUsePageCache()) { if ($this->settings->getSettings(Schema::MODULE_NAME)['page_cache_purge_mode'] == 1) { Purge::doPurge($this->applicationPath->getCacheDir() . 'http'); } else { $this->settings->saveSettings(['page_cache_is_valid' => false], Schema::MODULE_NAME); } } }
public function invalidatePageCache() { if ($this->canUsePageCache->canUsePageCache()) { if ($this->settings->getSettings(Schema::MODULE_NAME)['page_cache_purge_mode'] == 1) { Purge::doPurge($this->applicationPath->getCacheDir() . 'http'); } else { $systemModuleId = $this->modules->getModuleId(Schema::MODULE_NAME); $this->settingsRepository->update(['value' => false], ['module_id' => $systemModuleId, 'name' => 'page_cache_is_valid']); } } }
/** * @param string $moduleName * @return int */ public function getResultsPerPage($moduleName) { if (!isset($this->resultsPerPage[$moduleName])) { $moduleSettings = $this->settings->getSettings($moduleName); if (!empty($moduleSettings['entries'])) { $this->resultsPerPage[$moduleName] = $moduleSettings['entries']; } else { $moduleName = Schema::MODULE_NAME; $this->getResultsPerPage($moduleName); } } return (int) $this->resultsPerPage[$moduleName]; }
/** * @param array $userInfo */ protected function setFormatAndTimeZone(array $userInfo = []) { if (!empty($userInfo)) { $this->dateFormatLong = $userInfo['date_format_long']; $this->dateFormatShort = $userInfo['date_format_short']; $timeZone = $userInfo['time_zone']; } else { $settings = $this->config->getSettings(Schema::MODULE_NAME); $this->dateFormatLong = $settings['date_format_long']; $this->dateFormatShort = $settings['date_format_short']; $timeZone = $settings['date_time_zone']; } $this->dateTimeZone = new \DateTimeZone($timeZone); }
/** * Versendet einen Newsletter * * @param int $newsletterId * @param string|array $recipients * @param bool $bcc * * @return bool */ public function sendNewsletter($newsletterId, $recipients, $bcc = false) { $settings = $this->config->getSettings(Schema::MODULE_NAME); $newsletter = $this->newsletterRepository->getOneById($newsletterId); $sender = ['email' => $settings['mail'], 'name' => $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME)['site_title']]; $this->mailer->reset()->setBcc($bcc)->setFrom($sender)->setSubject($newsletter['title'])->setUrlWeb($this->router->route('newsletter/archive/details/id_' . $newsletterId, true))->setMailSignature($settings['mailsig']); if ($newsletter['html'] == 1) { $this->mailer->setTemplate('newsletter/layout.email.tpl'); $this->mailer->setHtmlBody($newsletter['text']); } else { $this->mailer->setBody($newsletter['text']); } $this->mailer->setRecipients($recipients); return $this->mailer->send(); }
/** * @param string $group * @param string $layout * * @return string */ protected function generateFilenameHash($group, $layout) { $filename = $this->config->getSettings(Schema::MODULE_NAME)['design']; $filename .= '_' . $layout; $filename .= '_' . $this->assets->getEnabledLibrariesAsString(); $filename .= '_' . $group; return md5($filename); }
/** * Erstellt den Galerie-Cache anhand der angegebenen ID * * @param integer $galleryId * * @return boolean */ public function saveCache($galleryId) { $pictures = $this->pictureRepository->getPicturesByGalleryId($galleryId); $cPictures = count($pictures); $settings = $this->config->getSettings(Schema::MODULE_NAME); for ($i = 0; $i < $cPictures; ++$i) { $pictures[$i]['width'] = $settings['thumbwidth']; $pictures[$i]['height'] = $settings['thumbheight']; $picInfos = @getimagesize($this->appPath->getModulesDir() . 'gallery/' . $pictures[$i]['file']); if ($picInfos !== false) { if ($picInfos[0] > $settings['thumbwidth'] || $picInfos[1] > $settings['thumbheight']) { $newHeight = $settings['thumbheight']; $newWidth = intval($picInfos[0] * $newHeight / $picInfos[1]); } $pictures[$i]['width'] = isset($newWidth) ? $newWidth : $picInfos[0]; $pictures[$i]['height'] = isset($newHeight) ? $newHeight : $picInfos[1]; } } return $this->cache->save(self::CACHE_ID . $galleryId, $pictures); }
/** * @param string $emailAddress * @param string $hash * * @return bool */ protected function sendDoubleOptInEmail($emailAddress, $hash) { $url = $this->router->route('newsletter/index/activate/hash_' . $hash, true); $systemSettings = $this->config->getSettings(\ACP3\Modules\ACP3\System\Installer\Schema::MODULE_NAME); $settings = $this->config->getSettings(Schema::MODULE_NAME); $subject = $this->translator->t('newsletter', 'subscribe_mail_subject', ['%title%' => $systemSettings['site_title']]); $body = $this->translator->t('newsletter', 'subscribe_mail_body', ['{host}' => $this->request->getHost()]) . "\n\n"; $from = ['email' => $settings['mail'], 'name' => $systemSettings['site_title']]; $this->mailer->reset()->setFrom($from)->setSubject($subject)->setMailSignature($settings['mailsig']); if ($settings['html'] == 1) { $this->mailer->setTemplate('newsletter/layout.email.tpl'); $body .= '<a href="' . $url . '">' . $url . '<a>'; $this->mailer->setHtmlBody($this->stringFormatter->nl2p($body)); } else { $body .= $url; $this->mailer->setBody($body); } $this->mailer->setRecipients($emailAddress); return $this->mailer->send(); }
/** * Initializes PHPMailer and sets the basic configuration parameters * * @return $this */ private function configure() { if ($this->phpMailer === null) { $this->phpMailer = new \PHPMailer(true); $settings = $this->config->getSettings(Schema::MODULE_NAME); if (strtolower($settings['mailer_type']) === 'smtp') { $this->phpMailer->set('Mailer', 'smtp'); $this->phpMailer->Host = $settings['mailer_smtp_host']; $this->phpMailer->Port = $settings['mailer_smtp_port']; $this->phpMailer->SMTPSecure = in_array($settings['mailer_smtp_security'], ['ssl', 'tls']) ? $settings['mailer_smtp_security'] : ''; if ((bool) $settings['mailer_smtp_auth'] === true) { $this->phpMailer->SMTPAuth = true; $this->phpMailer->Username = $settings['mailer_smtp_user']; $this->phpMailer->Password = $settings['mailer_smtp_password']; } } else { $this->phpMailer->set('Mailer', 'mail'); } $this->phpMailer->CharSet = 'UTF-8'; $this->phpMailer->Encoding = 'quoted-printable'; $this->phpMailer->WordWrap = 76; } return $this; }
/** * Check, whether to use urls with mod_rewrite or not * * @param string $path * * @return bool */ protected function useModRewrite($path) { return (bool) $this->config->getSettings(System\Installer\Schema::MODULE_NAME)['mod_rewrite'] === true && $this->isAdminUri($path) === false; }
/** * @return array */ protected function getSeoSettings() { return $this->config->getSettings(Schema::MODULE_NAME); }
/** * @return bool */ private function canGenerateSitemapAutomatically() { $seoSettings = $this->settings->getSettings(Schema::MODULE_NAME); return $seoSettings['sitemap_is_enabled'] == 1 && $seoSettings['sitemap_save_mode'] == 1; }
/** * @return bool */ public function canUsePageCache() { $systemSettings = $this->settings->getSettings(Schema::MODULE_NAME); return $systemSettings['page_cache_is_enabled'] == 1 && $this->environment === ApplicationMode::PRODUCTION; }
/** * @inheritdoc */ public function save(array $data, $newsId = null) { $settings = $this->config->getSettings(Schema::MODULE_NAME); $data = array_merge($data, ['updated_at' => 'now', 'readmore' => $this->useReadMore($data, $settings), 'comments' => $this->useComments($data, $settings), 'category_id' => $data['cat']]); return parent::save($data, $newsId); }
/** * @return $this * @deprecated will be removed in version 4.5.0 */ public function setEntriesPerPage() { $this->entriesPerPage = (int) $this->config->getSettings(Schema::MODULE_NAME)['entries']; return $this; }