/**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $this->handleRunOnce();
     // PATCH
     if ($input->post('FORM_SUBMIT') == 'database-update') {
         $count = 0;
         $sql = deserialize($input->post('sql'));
         if (is_array($sql)) {
             foreach ($sql as $key) {
                 if (isset($_SESSION['sql_commands'][$key])) {
                     $this->Database->query(str_replace('DEFAULT CHARSET=utf8;', 'DEFAULT CHARSET=utf8 COLLATE ' . $GLOBALS['TL_CONFIG']['dbCollation'] . ';', $_SESSION['sql_commands'][$key]));
                     $count++;
                 }
             }
         }
         $_SESSION['sql_commands'] = array();
         Messages::addConfirmation(sprintf($GLOBALS['TL_LANG']['composer_client']['databaseUpdated'], $count));
         $this->reload();
     }
     /** @var \Contao\Database\Installer $installer */
     $installer = \System::importStatic('Database\\Installer');
     $form = $installer->generateSqlForm();
     if (empty($form)) {
         Messages::addInfo($GLOBALS['TL_LANG']['composer_client']['databaseUptodate']);
         $this->redirect('contao/main.php?do=composer');
     }
     $form = preg_replace('#(<label for="sql_\\d+")>(CREATE TABLE)#', '$1 class="create_table">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` ADD)#', '$1 class="alter_add">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(ALTER TABLE `[^`]+` DROP)#', '$1 class="alter_drop">$2', $form);
     $form = preg_replace('#(<label for="sql_\\d+")>(DROP TABLE)#', '$1 class="drop_table">$2', $form);
     $template = new \BackendTemplate('be_composer_client_update');
     $template->composer = $this->composer;
     $template->form = $form;
     return $template->parse();
 }
Ejemplo n.º 2
0
 /**
  * @return string
  */
 public function generate()
 {
     if ($this->isVisible()) {
         return $this->template->parse();
     }
     return '';
 }
 /**
  * @return string
  */
 public function generate()
 {
     $this->configuration = AntragoConnector::getAntragoConfiguration($this->arrData['ac_configuration']);
     $this->categoryIds = deserialize($this->arrData['ac_categories']);
     $antragoCategories = json_decode(AntragoConnector::getContentFromApi($this->configuration['api_host'] . "/categories", $this->configuration['api_user'], $this->configuration['api_password']), true);
     foreach ($antragoCategories as $val) {
         $this->antragoCategories[$val['id']] = $val;
     }
     // wildcard backend
     if (TL_MODE === 'BE') {
         $template = new \BackendTemplate('be_wildcard');
         $template->wildcard = '### ANTRAGO EVENT-LISTE ###';
         $template->title = "Kategorien: " . implode(', ', deserialize($this->arrData['ac_categories']));
         return $template->parse();
     }
     // EventList Frontend
     // Data der vorhandenen Kategorien holen
     $arrCategoryData = array();
     // hole Kategorien
     foreach ($this->categoryIds as $key => $catId) {
         $arrCategoryData[$key] = array("categoryName" => $this->antragoCategories[$catId]['name'], "categoryId" => $this->antragoCategories[$catId]['id'], "eventData" => $this->getAntragoEventsById($catId));
     }
     $this->eventData = $arrCategoryData;
     return parent::generate();
 }
 public function ldParseBackendTemplate($strBuffer, $strTemplate)
 {
     if ($strTemplate == 'be_welcome') {
         $objTemplate = new \BackendTemplate('be_live_dashboard');
         // sample default widget
         $strContent = '
                 <div class="events">Text 1 <a href="#">Link 1</a></div>
                 <div class="events">Text 2 <a href="#">Link 2</a></div>
                 <div class="events">Text 3 <a href="#">Link 3</a></div>';
         $objWidgetTemplate = new \BackendTemplate('be_live_widget');
         $objWidgetTemplate->widgetTitle = 'Neuste Kommentare';
         $objWidgetTemplate->widgetContent = $strContent;
         $strWidget = $objWidgetTemplate->parse();
         $arrWidgets = array($strWidget);
         // HOOK: add dashboard widget
         if (isset($GLOBALS['TL_HOOKS']['addDashboardWidget']) && is_array($GLOBALS['TL_HOOKS']['addDashboardWidget'])) {
             foreach ($GLOBALS['TL_HOOKS']['addDashboardWidget'] as $callback) {
                 $this->import($callback[0]);
                 $strBuffer = $this->{$callback}[0]->{$callback}[1]($arrWidgets);
                 if ($strBuffer != '') {
                     $arrWidgets[] = $strBuffer;
                 }
             }
         }
         if (!empty($arrWidgets)) {
             $objTemplate->widgets = implode("\n", $arrWidgets);
         }
         return $objTemplate->parse();
     }
     return $strBuffer;
 }
Ejemplo n.º 5
0
 /**
  * Logout the current user and redirect
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### FRONTEND LOGOUT ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set last page visited
     if ($this->redirectBack) {
         $_SESSION['LAST_PAGE_VISITED'] = $this->getReferer();
     }
     $this->import('FrontendUser', 'User');
     $strRedirect = $this->Environment->base;
     // Redirect to last page visited
     if ($this->redirectBack && strlen($_SESSION['LAST_PAGE_VISITED'])) {
         $strRedirect = $_SESSION['LAST_PAGE_VISITED'];
     } elseif (strlen($this->jumpTo)) {
         $objNextPage = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=?")->limit(1)->execute($this->jumpTo);
         if ($objNextPage->numRows) {
             $strRedirect = $this->generateFrontendUrl($objNextPage->fetchAssoc());
         }
     }
     // Log out and redirect
     if ($this->User->logout()) {
         $this->redirect($strRedirect);
     }
     return '';
 }
Ejemplo n.º 6
0
 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_maintenance_mode');
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->headline = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceMode'];
     $objTemplate->isActive = $this->isActive();
     try {
         $driver = \System::getContainer()->get('lexik_maintenance.driver.factory')->getDriver();
         $isLocked = $driver->isExists();
     } catch (\Exception $e) {
         return '';
     }
     // Toggle the maintenance mode
     if (\Input::post('FORM_SUBMIT') == 'tl_maintenance_mode') {
         if ($isLocked) {
             $driver->unlock();
         } else {
             $driver->lock();
         }
         $this->reload();
     }
     if ($isLocked) {
         $objTemplate->class = 'tl_confirm';
         $objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceEnabled'];
         $objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceDisable'];
     } else {
         $objTemplate->class = 'tl_info';
         $objTemplate->explain = $GLOBALS['TL_LANG']['MSC']['maintenanceDisabled'];
         $objTemplate->submit = $GLOBALS['TL_LANG']['tl_maintenance']['maintenanceEnable'];
     }
     return $objTemplate->parse();
 }
 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Do not index or cache the page if no news item has been specified
     if (!\Input::get('items')) {
         /** @var \PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Do not index or cache the page if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         /** @var \PageModel $objPage */
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
Ejemplo n.º 8
0
 /**
  * Do not display the module if there are no articles
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ARTICLE NAVIGATION ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     global $objPage;
     $this->objArticles = \ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);
     // Return if there are no articles
     if ($this->objArticles === null) {
         return '';
     }
     // Redirect to the first article if no article is selected
     if (!\Input::get('articles')) {
         if (!$this->loadFirst) {
             return '';
         }
         $strAlias = $this->objArticles->alias != '' && !$GLOBALS['TL_CONFIG']['disableAlias'] ? $this->objArticles->alias : $this->objArticles->id;
         $this->redirect($this->addToUrl('articles=' . $strAlias));
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     global $objPage;
     if ($this->news_template_modal) {
         $this->strTemplate = 'mod_news_modal';
         $this->news_template = $this->news_template_modal;
         // list config
         $this->news_showInModal = true;
         $this->news_readerModule = $this->id;
         // set modal css ID for generateModal() and parent::generate()
         $arrCss = deserialize($this->cssID, true);
         $arrCss[0] = NewsPlusHelper::getCSSModalID($this->id);
         $this->cssID = $arrCss;
         $this->base = \Controller::generateFrontendUrl($objPage->row());
         if ($this->Environment->isAjaxRequest && !$this->isSearchIndexer()) {
             $this->strTemplate = 'mod_news_modal_ajax';
             $this->generateAjax();
         }
         if (!$this->checkConditions()) {
             return $this->generateModal();
         }
     }
     return parent::generate();
 }
Ejemplo n.º 10
0
 public function addSystemMessages()
 {
     $objUser = \BackendUser::getInstance();
     if ($GLOBALS['TL_CONFIG']['be_changelog_src'] == '') {
         return '';
     }
     $strFile = file_get_contents($GLOBALS['TL_CONFIG']['be_changelog_src']);
     if ($strFile == '') {
         return '';
     }
     $objJson = json_decode($strFile);
     $objTemplate = new \BackendTemplate('be_changelog');
     $objTemplate->strTitle = 'Changelog';
     $arrEntries = array();
     foreach ($objJson as $objEntry) {
         $objTemplateEntry = new \BackendTemplate('be_changelog_entry');
         $objTemplateEntry->strCssClass = $objUser->lastLogin > $objEntry->timestamp ? '' : ' tl_info';
         $objTemplateEntry->strDate = \Date::parse(\Config::get('datimFormat'), $objEntry->timestamp);
         $objTemplateEntry->strVersion = $objEntry->version;
         $objTemplateEntry->strEntries = '<li style="padding-bottom: 5px;">' . implode('</li><li style="padding-bottom: 5px;">', $objEntry->entries) . '</li>';
         $arrEntries[$objEntry->timestamp] = $objTemplateEntry->parse();
     }
     krsort($arrEntries);
     $objTemplate->strEntries = implode('', $arrEntries);
     return $objTemplate->parse();
 }
Ejemplo n.º 11
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### VISITORS LIST ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         if (version_compare(VERSION . '.' . BUILD, '2.8.9', '>')) {
             // Code für Versionen ab 2.9.0
             $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         } else {
             // Code für Versionen < 2.9.0
             $objTemplate->wildcard = '### VISITORS MODUL ONLY FOR CONTAO 2.9 ###';
         }
         return $objTemplate->parse();
     }
     //alte und neue Art gemeinsam zum Array bringen
     if (strpos($this->visitors_categories, ':') !== false) {
         $this->visitors_categories = deserialize($this->visitors_categories, true);
     } else {
         $this->visitors_categories = array($this->visitors_categories);
     }
     // Return if there are no categories
     if (!is_array($this->visitors_categories) || !is_numeric($this->visitors_categories[0])) {
         return '';
     }
     $this->useragent_filter = $this->visitors_useragent;
     return parent::generate();
 }
 /**
  * @param \Database_Result $records
  * @param string           $id
  * @param \DcaWizard       $dcaWizard
  *
  * @return string
  */
 public function generateWizardList($records, $id, $dcaWizard)
 {
     $return = '';
     $rows = $dcaWizard->getRows($records);
     // Alter the rows
     \System::loadLanguageFile('tl_iso_product_collection');
     $rows = array_map(function ($row) {
         // Force an algebraic sign for quantity
         $row['quantity'] = sprintf('%+d', $row['quantity']);
         // Make referenced product collection editable in a popup
         $row['product_collection_id'] = $row['product_collection_id'] ? sprintf('<a href="contao/main.php?do=iso_orders&amp;act=edit&amp;id=%1$u&amp;popup=1&amp;nb=1&amp;rt=%4$s" title="%3$s" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'%3$s\',\'url\':this.href});return false">%2$s</a>', $row['product_collection_id'], \Image::getHtml('edit.gif') . $row['product_collection_id'], sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['edit'][1], $row['product_collection_id']), REQUEST_TOKEN) : '-';
         return $row;
     }, $rows);
     if ($rows) {
         $template = new \BackendTemplate('be_widget_dcawizard');
         $template->headerFields = $dcaWizard->getHeaderFields();
         $template->hasRows = !empty($rows);
         $template->rows = $rows;
         $template->fields = $dcaWizard->fields;
         $template->showOperations = $dcaWizard->showOperations;
         if ($dcaWizard->showOperations) {
             $template->operations = $dcaWizard->getActiveRowOperations();
         }
         $template->generateOperation = function ($operation, $row) use($dcaWizard) {
             return $dcaWizard->generateRowOperation($operation, $row);
         };
         $dom = new \DOMDocument('1.0', 'utf-8');
         $dom->loadHTML($template->parse());
         $return = $dom->saveHTML($dom->getElementsByTagName('table')->item(0));
     }
     // Add the member's total bonus points
     $return .= sprintf('<strong style="display: inline-block; margin: 4px 0 2px 6px; border-bottom: 3px double">%s</strong>', Stock::getStockForProduct($dcaWizard->currentRecord));
     return $return;
 }
Ejemplo n.º 13
0
 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['listing'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Return if the table or the fields have not been set
     if ($this->list_table == '' || $this->list_fields == '') {
         return '';
     }
     // Disable the details page
     if (\Input::get('show') && $this->list_info == '') {
         return '';
     }
     // Fallback to the default template
     if ($this->list_layout == '') {
         $this->list_layout = 'list_default';
     }
     $this->strTemplate = $this->list_layout;
     $this->list_where = $this->replaceInsertTags($this->list_where, false);
     $this->list_info_where = $this->replaceInsertTags($this->list_info_where, false);
     return parent::generate();
 }
 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $repositoryManager = $this->getRepositoryManager();
     /** @var RepositoryInterface $localRepository */
     $localRepository = $repositoryManager->getLocalRepository();
     $dependencyMap = $this->calculateDependencyMap($localRepository);
     $dependencyGraph = array();
     $localPackages = $localRepository->getPackages();
     $localPackages = array_filter($localPackages, function (PackageInterface $localPackage) use($dependencyMap) {
         $name = $localPackage->getName();
         return !isset($dependencyMap[$name]) && !$localPackage instanceof \Composer\Package\AliasPackage;
     });
     $allLocalPackages = $localRepository->getPackages();
     $allLocalPackages = array_combine(array_map(function (PackageInterface $localPackage) {
         return $localPackage->getName();
     }, $allLocalPackages), $allLocalPackages);
     $localPackagesCount = count($localPackages);
     $index = 0;
     /** @var \Composer\Package\PackageInterface $package */
     foreach ($localPackages as $package) {
         $this->buildDependencyGraph($allLocalPackages, $localRepository, $package, null, $package->getPrettyVersion(), $dependencyGraph, ++$index == $localPackagesCount);
     }
     $template = new \BackendTemplate('be_composer_client_dependency_graph');
     $template->composer = $this->composer;
     $template->dependencyGraph = $dependencyGraph;
     return $template->parse();
 }
 /**
  * {@inheritdoc}
  */
 public function handle(\Input $input)
 {
     $repositoryManager = $this->getRepositoryManager();
     // calculate replace map
     $replaceMap = $this->calculateReplaceMap($repositoryManager->getLocalRepository());
     // calculate contao-legacy replace map.
     $legacyReplaceMap = $this->calculateLegacyReplaceMap($repositoryManager->getLocalRepository());
     // build list of explicit required packages
     $requiresList = $this->buildRequiresList($this->composer->getPackage(), $replaceMap);
     // build list of dependencies
     $dependenciesList = $this->buildDependenciesList($requiresList, $repositoryManager->getLocalRepository());
     // build not yet installed package list
     $notInstalledList = $this->buildNotInstalledList($this->composer->getPackage(), $repositoryManager->getLocalRepository());
     // calculate dependency graph
     $dependencyMap = $this->calculateDependencyMap($repositoryManager->getLocalRepository());
     // build grouped list of packages
     $groupedPackages = $this->buildGroupedPackagesList($this->composer->getPackage(), $repositoryManager->getLocalRepository(), $requiresList, $dependencyMap, $notInstalledList);
     $template = new \BackendTemplate('be_composer_client');
     $template->composer = $this->composer;
     $template->dependencyMap = $dependencyMap;
     $template->replaceMap = $replaceMap;
     $template->legacyReplaceMap = $legacyReplaceMap;
     $template->groupedPackages = $groupedPackages;
     $template->requiresList = $requiresList;
     $template->dependenciesList = $dependenciesList;
     if ('detached' !== $GLOBALS['TL_CONFIG']['composerExecutionMode']) {
         $template->output = $_SESSION['COMPOSER_OUTPUT'];
     }
     unset($_SESSION['COMPOSER_OUTPUT']);
     return $template->parse();
 }
Ejemplo n.º 16
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['carpet_list'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->carpet_categories = $this->sortOutProtected(deserialize($this->carpet_categories));
     // No carpaets categries available
     if (!is_array($this->carpet_categories) || empty($this->carpet_categories)) {
         return '';
     }
     // Show the catalog detail if an item has been selected
     if ($this->carpet_detailModule > 0 && (isset($_GET['items']) || $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item']))) {
         return $this->getFrontendModule($this->carpet_detailModule, $this->strColumn);
     }
     if (TL_MODE == 'FE') {
         $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/carpet/assets/jquery.raty.min.js|static';
     }
     return parent::generate();
 }
Ejemplo n.º 17
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### RSS READER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->objFeed = new \SimplePie();
     $arrUrls = trimsplit('[\\n\\t ]', trim($this->rss_feed));
     if (count($arrUrls) > 1) {
         $this->objFeed->set_feed_url($arrUrls);
     } else {
         $this->objFeed->set_feed_url($arrUrls[0]);
     }
     $this->objFeed->set_output_encoding($GLOBALS['TL_CONFIG']['characterSet']);
     $this->objFeed->set_cache_location(TL_ROOT . '/system/tmp');
     $this->objFeed->enable_cache(false);
     if ($this->rss_cache > 0) {
         $this->objFeed->enable_cache(true);
         $this->objFeed->set_cache_duration($this->rss_cache);
     }
     if (!$this->objFeed->init()) {
         $this->log('Error importing RSS feed "' . $this->rss_feed . '"', 'ModuleRssReader generate()', TL_ERROR);
         return '';
     }
     $this->objFeed->handle_content_type();
     return parent::generate();
 }
 /**
  * generate function.
  *
  * @access public
  * @return void
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### PHOTOALBUMS 2 MODULE ###';
         return $objTemplate->parse();
     }
     // Set Pa2 Type
     $this->pa2type = 'MOD';
     // Deserialize vars
     $this->groups = deserialize($this->groups);
     $this->pa2Archives = deserialize($this->pa2Archives);
     $this->pa2AlbumSort = deserialize($this->pa2AlbumSort);
     $this->pa2AlbumsMetaFields = deserialize($this->pa2AlbumsMetaFields);
     $this->pa2ImagesMetaFields = deserialize($this->pa2ImagesMetaFields);
     $this->pa2TimeFilterStart = deserialize($this->pa2TimeFilterStart);
     $this->pa2TimeFilterEnd = deserialize($this->pa2TimeFilterEnd);
     // Set true and false on checkboxes
     $this->pa2ImagesShowHeadline = $this->pa2ImagesShowHeadline == 1 ? true : false;
     $this->pa2ImagesShowTitle = $this->pa2ImagesShowTitle == 1 ? true : false;
     $this->pa2ImagesShowTeaser = $this->pa2ImagesShowTeaser == 1 ? true : false;
     $this->pa2AlbumsShowHeadline = $this->pa2AlbumsShowHeadline == 1 ? true : false;
     $this->pa2AlbumsShowTitle = $this->pa2AlbumsShowTitle == 1 ? true : false;
     $this->pa2AlbumsShowTeaser = $this->pa2AlbumsShowTeaser == 1 ? true : false;
     $this->pa2AlbumLightbox = $this->pa2Mode == 'pa2_only_album_view' ? true : false;
     $this->pa2DetailPage = $this->pa2Mode == 'pa2_with_detail_page' ? $this->pa2DetailPage : '';
     // Set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         $this->Input->setGet('album', $this->Input->get('auto_item'));
     }
     return parent::generate();
 }
Ejemplo n.º 19
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### FAQ READER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         $this->Input->setGet('items', $this->Input->get('auto_item'));
     }
     // Do not index or cache the page if no FAQ has been specified
     if (!$this->Input->get('items')) {
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->faq_categories = deserialize($this->faq_categories);
     // Do not index or cache the page if there are no categories
     if (!is_array($this->faq_categories) || empty($this->faq_categories)) {
         global $objPage;
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
Ejemplo n.º 20
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### NEWS READER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Return if no news item has been specified
     if (!$this->Input->get('items')) {
         global $objPage;
         // Do not index the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || count($this->news_archives) < 1) {
         global $objPage;
         // Do not index the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         return '';
     }
     return parent::generate();
 }
Ejemplo n.º 21
0
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ISOTOPE ECOMMERCE: STORE CONFIG SWICHER ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->iso_config_ids = deserialize($this->iso_config_ids);
     if (!is_array($this->iso_config_ids) || !count($this->iso_config_ids)) {
         // Can't use empty() because its an object property (using __get)
         return '';
     }
     if (\Input::get('config') != '') {
         if (in_array(\Input::get('config'), $this->iso_config_ids)) {
             Isotope::getCart()->config_id = \Input::get('config');
             Isotope::getCart()->save();
         }
         \Controller::redirect(preg_replace('@[?|&]config=' . \Input::get('config') . '@', '', \Environment::get('request')));
     }
     return parent::generate();
 }
Ejemplo n.º 22
0
 /**
  * @return string
  */
 public function generate()
 {
     // Backend
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['member_rating'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if ($GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('member', \Input::get('auto_item'));
     }
     // activate comment by token via url
     if (strlen(\Input::get('activation_token'))) {
         $this->activateOrDelete();
         exit;
     }
     // set the ratedUser var
     $this->ratedUser = \MemberModel::findByPk(\Input::get('member'));
     if ($this->ratedUser === null) {
         return '';
     }
     // overwrite default template
     if ($this->memberRatingDetailTemplate != '') {
         $this->strTemplate = $this->memberRatingDetailTemplate;
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newsarchive'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // No news archives available
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     // Show the news reader if an item has been selected
     if ($this->news_readerModule > 0 && (isset($_GET['items']) || \Config::get('useAutoItem') && isset($_GET['auto_item']))) {
         return $this->getFrontendModule($this->news_readerModule, $this->strColumn);
     }
     // Hide the module if no period has been selected
     if ($this->news_jumpToCurrent == 'hide_module' && !isset($_GET['year']) && !isset($_GET['month']) && !isset($_GET['day'])) {
         return '';
     }
     return parent::generate();
 }
Ejemplo n.º 24
0
 /**
  * Redirect to the selected page
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### QUICK LINK ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Redirect to selected page
     if (\Input::post('FORM_SUBMIT') == 'tl_quicklink') {
         if (strlen(\Input::post('target', true))) {
             $this->redirect(\Input::post('target', true));
         }
         $this->reload();
     }
     // Get all pages
     $this->pages = deserialize($this->pages);
     if (!is_array($this->pages) || $this->pages[0] == '') {
         return '';
     }
     return parent::generate();
 }
Ejemplo n.º 25
0
 /**
  * Do not show the module if no calendar has been selected
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['calendar'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar, true));
     // Return if there are no calendars
     if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) {
         return '';
     }
     $this->strUrl = preg_replace('/\\?.*$/', '', \Environment::get('request'));
     $this->strLink = $this->strUrl;
     if ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) {
         /** @var \PageModel $objTarget */
         $this->strLink = $objTarget->getFrontendUrl();
     }
     return parent::generate();
 }
Ejemplo n.º 26
0
 /**
  * Do not display the module if there are no articles
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['articlenav'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = '' . $GLOBALS['TL_CONFIG']['backendPath'] . '/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     /** @var \PageModel $objPage */
     global $objPage;
     $this->objArticles = \ArticleModel::findPublishedWithTeaserByPidAndColumn($objPage->id, $this->strColumn);
     // Return if there are no articles
     if ($this->objArticles === null) {
         return '';
     }
     // Redirect to the first article if no article is selected
     if (!\Input::get('articles')) {
         if (!$this->loadFirst) {
             return '';
         }
         /** @var \ArticleModel $objArticle */
         $objArticle = $this->objArticles->current();
         $strAlias = $objArticle->alias != '' && !\Config::get('disableAlias') ? $objArticle->alias : $objArticle->id;
         $this->redirect($this->generateFrontendUrl($objPage->row(), '/articles/' . $strAlias));
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['newslist_plus'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $this->news_featured = 'featured';
     // unset search string for highlighted section
     \Input::setGet('searchKeywords', null);
     $this->objArticles = NewsPlusModel::findPublishedByPids($this->news_archives, array(), array(), $this->news_featured == 'featured', $this->numberOfItems, 0);
     if ($this->objArticles === null) {
         return '';
     }
     return parent::generate();
 }
 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['facebook_login'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Return if a front end user is logged in
     if (FE_USER_LOGGED_IN) {
         return '';
     }
     // Execute the login
     if (\Input::get('fblogin')) {
         if ($this->loginWithFacebook()) {
             $this->jumpToOrReload($this->jumpTo);
         } else {
             $_SESSION['FACEBOOK_LOGIN'] = \Message::generate();
             $this->redirect(preg_replace('/(\\?|&)fblogin=1/', '', \Environment::get('request')));
         }
     }
     return parent::generate();
 }
Ejemplo n.º 29
0
 /**
  * Display a wildcard in the back end
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['rss_reader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = '' . $GLOBALS['TL_CONFIG']['backendPath'] . '/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     $this->objFeed = new \SimplePie();
     $arrUrls = trimsplit('[\\n\\t ]', trim($this->rss_feed));
     if (count($arrUrls) > 1) {
         $this->objFeed->set_feed_url($arrUrls);
     } else {
         $this->objFeed->set_feed_url($arrUrls[0]);
     }
     $this->objFeed->set_output_encoding(\Config::get('characterSet'));
     $this->objFeed->set_cache_location(TL_ROOT . '/system/tmp');
     $this->objFeed->enable_cache(false);
     if ($this->rss_cache > 0) {
         $this->objFeed->enable_cache(true);
         $this->objFeed->set_cache_duration($this->rss_cache);
     }
     if (!$this->objFeed->init()) {
         $this->log('Error importing RSS feed "' . $this->rss_feed . '"', __METHOD__, TL_ERROR);
         return '';
     }
     $this->objFeed->handle_content_type();
     return parent::generate();
 }
Ejemplo n.º 30
0
 /**
  * Logout the current user and redirect
  *
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         /** @var \BackendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['logout'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set last page visited
     if ($this->redirectBack) {
         $_SESSION['LAST_PAGE_VISITED'] = $this->getReferer();
     }
     $this->import('FrontendUser', 'User');
     $strRedirect = \Environment::get('base');
     // Redirect to last page visited
     if ($this->redirectBack && !empty($_SESSION['LAST_PAGE_VISITED'])) {
         $strRedirect = $_SESSION['LAST_PAGE_VISITED'];
     } elseif ($this->jumpTo && ($objTarget = $this->objModel->getRelated('jumpTo')) !== null) {
         /** @var \PageModel $objTarget */
         $strRedirect = $objTarget->getFrontendUrl();
     }
     // Log out and redirect
     if ($this->User->logout()) {
         $this->redirect($strRedirect);
     }
     return '';
 }