public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['memberreader'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // logic for this is done in HeimrichHannot\Memberplus\Hooks::getPageIdFromUrlHook
     if (\Input::get('article_reader')) {
         \Input::setGet('items', \Input::get('article_reader'));
     } else {
         if (!isset($_GET['items']) && \Config::get('useAutoItem') && isset($_GET['auto_item'])) {
             \Input::setGet('items', \Input::get('auto_item'));
         }
     }
     if (!\Input::get('items')) {
         return '';
     }
     $this->mlGroups = deserialize($this->mlGroups);
     if (!is_array($this->mlGroups) || empty($this->mlGroups)) {
         return '';
     }
     return parent::generate();
 }
 /**
  * Generate the module
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['mod_airquality_full'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Return if there are no items
     if (!\Input::get('items')) {
         return '';
     }
     if (TL_MODE == 'FE') {
         $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/airquality/assets/js/Chart.min.js|static';
         $GLOBALS['TL_CSS'][] = 'system/modules/airquality/assets/styles/style.css';
     }
     return parent::generate();
 }
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['acquisto_category_nav'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     if (FE_USER_LOGGED_IN) {
         $this->Import('FrontendUser', 'Member');
     }
     $this->generateTrail(\Input::get('category'));
     $pid = 0;
     if ($this->acquisto_levelOffset != 0) {
         $pid = $this->trail[$this->acquisto_levelOffset - 1];
     } elseif ($this->acquisto_referenceCategory) {
         $pid = $this->acquisto_referenceCategory;
     }
     $this->items = $this->getCategory($pid, $this->acquisto_levelOffset, 0, $this->acquisto_hardlimit);
     if (!is_array($this->items)) {
         return '';
     }
     return parent::generate();
 }
Ejemplo n.º 4
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&table=tl_module&act=edit&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();
 }
Ejemplo n.º 5
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&table=tl_module&act=edit&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.º 6
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 = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['articlenav'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&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 != '' && !\Config::get('disableAlias') ? $this->objArticles->alias : $this->objArticles->id;
         $this->redirect($this->addToUrl('articles=' . $strAlias));
     }
     return parent::generate();
 }
Ejemplo n.º 7
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&table=tl_module&act=edit&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 '';
 }
Ejemplo n.º 8
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&table=tl_module&act=edit&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();
 }
 /**
  * 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']['eventlist_plus'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&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 '';
     }
     parent::generate();
     // needs to be overwritten in model, otherwise datacontainer argument in options_callback contains protected calendars
     $this->objModel->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar, true));
     $objForm = new EventFilterForm($this->objModel);
     if (($strForm = $objForm->generate()) === null) {
         return '';
     }
     $this->Template->form = $objForm->generate();
     return $this->Template->parse();
 }
Ejemplo n.º 10
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&table=tl_module&act=edit&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.º 11
0
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['modulealias'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
         return $objTemplate->parse();
     }
     $arrModules = deserialize($this->aliasModules);
     if (is_array($arrModules) && count($arrModules)) {
         global $objPage;
         $objModules = $this->Database->execute("SELECT id, aliasPages FROM tl_module WHERE id IN (" . implode(',', $arrModules) . ") ORDER BY " . $this->Database->findInSet('id', $arrModules));
         while ($objModules->next()) {
             $arrPages = deserialize($objModules->aliasPages);
             if (is_array($arrPages) && count($arrPages)) {
                 foreach ($arrPages as $intPage) {
                     $arrPages = array_merge($arrPages, $this->getChildRecords($intPage, 'tl_page', false));
                 }
                 if (in_array($objPage->id, $arrPages)) {
                     return $this->getFrontendModule($objModules->id, $this->inColumn);
                 }
             }
         }
     }
     return '';
 }
Ejemplo n.º 12
0
 function pagefromtemplate(&$event, $param)
 {
     if (strlen(trim($_REQUEST['newpagetemplate'])) > 0) {
         global $conf;
         global $INFO;
         global $ID;
         $tpl = io_readFile(wikiFN($_REQUEST['newpagetemplate']));
         if ($this->getConf('userreplace')) {
             $stringvars = array_map(create_function('$v', 'return explode(",",$v,2);'), explode(';', $_REQUEST['newpagevars']));
             foreach ($stringvars as $value) {
                 $tpl = str_replace(trim($value[0]), trim($value[1]), $tpl);
             }
         }
         if ($this->getConf('standardreplace')) {
             // replace placeholders
             $file = noNS($ID);
             $page = strtr($file, '_', ' ');
             $tpl = str_replace(array('@ID@', '@NS@', '@FILE@', '@!FILE@', '@!FILE!@', '@PAGE@', '@!PAGE@', '@!!PAGE@', '@!PAGE!@', '@USER@', '@NAME@', '@MAIL@', '@DATE@'), array($ID, getNS($ID), $file, utf8_ucfirst($file), utf8_strtoupper($file), $page, utf8_ucfirst($page), utf8_ucwords($page), utf8_strtoupper($page), $_SERVER['REMOTE_USER'], $INFO['userinfo']['name'], $INFO['userinfo']['mail'], $conf['dformat']), $tpl);
             // we need the callback to work around strftime's char limit
             $tpl = preg_replace_callback('/%./', create_function('$m', 'return strftime($m[0]);'), $tpl);
         }
         $event->result = $tpl;
         $event->preventDefault();
     }
 }
Ejemplo n.º 13
0
/**
* Callback function for preg_replace_callback call in utf8_ucwords
* You don't need to call this yourself
* @param array of matches corresponding to a single word
* @return string with first char of the word in uppercase
* @see utf8_ucwords
* @see utf8_strtoupper
* @package utf8
* @subpackage strings
*/
function utf8_ucwords_callback($matches)
{
    $leadingws = $matches[2];
    $ucfirst = utf8_strtoupper($matches[3]);
    $ucword = utf8_substr_replace(ltrim($matches[0]), $ucfirst, 0, 1);
    return $leadingws . $ucword;
}
Ejemplo n.º 14
0
 public function index()
 {
     $this->load->language('product/manufacturer');
     $this->load->model('catalog/manufacturer');
     $this->load->model('tool/image');
     $this->document->setTitle($this->language->get('heading_title'));
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_index'] = $this->language->get('text_index');
     $data['text_empty'] = $this->language->get('text_empty');
     $data['button_continue'] = $this->language->get('button_continue');
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'));
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->url->link('product/manufacturer'));
     $data['categories'] = array();
     $results = $this->model_catalog_manufacturer->getManufacturers();
     foreach ($results as $result) {
         if (is_numeric(utf8_substr($result['name'], 0, 1))) {
             $key = '0 - 9';
         } else {
             $key = utf8_substr(utf8_strtoupper($result['name']), 0, 1);
         }
         if (!isset($data['categories'][$key])) {
             $data['categories'][$key]['name'] = $key;
         }
         $data['categories'][$key]['manufacturer'][] = array('name' => $result['name'], 'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']));
     }
     $data['continue'] = $this->url->link('common/home');
     $data['column_left'] = $this->load->controller('common/column_left');
     $data['column_right'] = $this->load->controller('common/column_right');
     $data['content_top'] = $this->load->controller('common/content_top');
     $data['content_bottom'] = $this->load->controller('common/content_bottom');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $this->response->setOutput($this->load->view('product/manufacturer_list', $data));
 }
Ejemplo n.º 15
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&table=tl_module&act=edit&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();
 }
Ejemplo n.º 16
0
 /**
  * Generate module
  */
 protected function compile()
 {
     $objTerm = $this->Database->execute("SELECT * FROM tl_glossary_term WHERE pid IN(" . implode(',', array_map('intval', $this->glossaries)) . ")" . " ORDER BY sortTerm");
     if ($objTerm->numRows < 1) {
         $this->Template->terms = array();
         return;
     }
     global $objPage;
     $this->import('String');
     $arrTerms = array();
     while ($objTerm->next()) {
         $objTemp = new stdClass();
         $key = utf8_strtoupper(utf8_substr($objTerm->sortTerm, 0, 1));
         $objTemp->term = $objTerm->term;
         $objTemp->anchor = 'gl' . utf8_romanize($key);
         $objTemp->id = standardize($objTerm->term);
         $objTemp->isParent = false;
         $objTemp->isReference = false;
         if ($objTerm->addReference) {
             if ($objTerm->referenceType == 'parent') {
                 $objTemp->hasParent = true;
             } elseif ($objTerm->referenceType == 'reference') {
                 $objTemp->isReference = true;
                 $objTemp->referenceTerm = false;
                 $objReference = $this->Database->prepare("SELECT `id`,`term` FROM `tl_glossary_term` WHERE `id`=?")->execute($objTerm->referenceTerm);
                 if ($objReference->next()) {
                     $objTemp->referenceTerm = $objReference->term;
                     $objTemp->referenceAnchor = standardize($objReference->term);
                 }
             }
         }
         // Clean the RTE output
         if ($objPage->outputFormat == 'xhtml') {
             $objTerm->definition = $this->String->toXhtml($objTerm->definition);
         } else {
             $objTerm->definition = $this->String->toHtml5($objTerm->definition);
         }
         $objTemp->definition = $this->String->encodeEmail($objTerm->definition);
         if ($objTerm->addExample) {
             $objTemp->addExample = true;
             $objTemp->example = $objPage->outputFormat == 'xhtml' ? $this->String->toXhtml($objTerm->example) : $this->String->toHtml5($objTerm->example);
         } else {
             $objTemp->addExample = false;
         }
         $objTemp->addImage = false;
         // Add image
         if ($objTerm->addImage && is_file(TL_ROOT . '/' . $objTerm->singleSRC)) {
             $this->addImageToTemplate($objTemp, $objTerm->row());
         }
         $objTemp->enclosures = array();
         // Add enclosures
         if ($objTerm->addEnclosure) {
             $this->addEnclosuresToTemplate($objTemp, $objTerm->row());
         }
         $arrTerms[$key][] = $objTemp;
     }
     $this->Template->terms = $arrTerms;
     $this->Template->request = ampersand($this->Environment->request, true);
     $this->Template->topLink = $GLOBALS['TL_LANG']['MSC']['backToTop'];
 }
 /**
  * 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') {
         /** @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.º 19
0
 public function index()
 {
     $this->language->load('product/manufacturer');
     $this->load->model('catalog/manufacturer');
     $this->load->model('tool/image');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_index'] = $this->language->get('text_index');
     $this->data['text_empty'] = $this->language->get('text_empty');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->url->link('product/manufacturer'), 'separator' => $this->language->get('text_separator'));
     $this->data['categories'] = array();
     $results = $this->model_catalog_manufacturer->getManufacturers();
     foreach ($results as $result) {
         if (is_numeric(utf8_substr($result['name'], 0, 1))) {
             $key = '0 - 9';
         } else {
             $key = utf8_substr(utf8_strtoupper($result['name']), 0, 1);
         }
         if (!isset($this->data['manufacturers'][$key])) {
             $this->data['categories'][$key]['name'] = $key;
         }
         $this->data['categories'][$key]['manufacturer'][] = array('name' => $result['name'], 'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']));
     }
     $this->data['continue'] = $this->url->link('common/home');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/manufacturer_list.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/product/manufacturer_list.tpl';
     } else {
         $this->template = 'default/template/product/manufacturer_list.tpl';
     }
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
 /**
  * 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();
 }
 /**
  * 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();
 }
 /**
  * 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.º 23
0
 public function index()
 {
     $this->language->load('product/manufacturer');
     $this->load->model('catalog/manufacturer');
     $this->load->model('tool/image');
     $this->document->setTitle($this->language->get('text_brand'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_index'] = $this->language->get('text_index');
     $this->data['text_empty'] = $this->language->get('text_empty');
     $this->data['button_continue'] = $this->language->get('button_continue');
     //add-----------------------
     $this->data['text_manufinf_vuvod'] = $this->language->get('text_manufinf_vuvod');
     $this->data['text_manufinf_otzuv'] = $this->language->get('text_manufinf_otzuv');
     $this->data['text_manufinf_kilk'] = $this->language->get('text_manufinf_kilk');
     $this->data['text_manufinf_buy'] = $this->language->get('text_manufinf_buy');
     $this->data['text_manufinf_addtocomp'] = $this->language->get('text_manufinf_addtocomp');
     $this->data['text_manufinf_absent'] = $this->language->get('text_manufinf_absent');
     $this->data['text_manuflist_news'] = $this->language->get('text_manuflist_news');
     $this->data['text_manuflist_brends'] = $this->language->get('text_manuflist_brends');
     $this->data['text_manuflist_contact'] = $this->language->get('text_manuflist_contact');
     $this->data['text_manuflist_brendsabs'] = $this->language->get('text_manuflist_brendsabs');
     $this->data[''] = $this->language->get('');
     $this->data['pref_lang'] = $this->language->get('pref_lang');
     //add-----------------------
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->url->link('product/manufacturer'), 'separator' => $this->language->get('text_separator'));
     $this->load->model('catalog/information');
     $this->data['informations'] = array();
     foreach ($this->model_catalog_information->getInformations() as $result) {
         $this->data['informations'][] = array('title' => $result['title'], 'href' => $this->url->link('information/information', 'information_id=' . $result['information_id']));
     }
     $this->data['categories'] = array();
     $results = $this->model_catalog_manufacturer->getManufacturers();
     foreach ($results as $result) {
         if (is_numeric(utf8_substr($result['name'], 0, 1))) {
             $key = '0 - 9';
         } else {
             $key = utf8_substr(utf8_strtoupper($result['name']), 0, 1);
         }
         if ($result['image']) {
             $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
         } else {
             $image = $this->model_tool_image->resize('no_image.jpg', $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height'));
         }
         if (!isset($this->data['manufacturers'][$key])) {
             $this->data['categories'][$key]['name'] = $key;
         }
         $this->data['categories'][$key]['manufacturer'][] = array('thumb' => $image, 'name' => $result['name'], 'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']));
     }
     $this->data['continue'] = $this->url->link('common/home');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/manufacturer_list.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/product/manufacturer_list.tpl';
     } else {
         $this->template = 'default/template/product/manufacturer_list.tpl';
     }
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
Ejemplo n.º 24
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']['CTE']['book_gallery'][1]) . ' ###';
         return $objTemplate->parse();
     }
     return parent::generate();
 }
 /**
  * Return if the file does not exist
  * @return string
  */
 public function generate()
 {
     $this->arrDownloadarchives = unserialize($this->downloadarchive);
     if ($this->downloadarchive != null && !is_array($this->arrDownloadarchives)) {
         $this->arrDownloadarchives = array($this->downloadarchive);
     }
     // Return if there are no categories
     if (count($this->arrDownloadarchives) < 1) {
         return '';
     }
     if (TL_MODE == 'BE') {
         $title = array();
         foreach ($this->arrDownloadarchives as $archive) {
             $objDownloadarchivee = \FelixPfeiffer\Downloadarchive\DownloadarchiveModel::findByPk($archive);
             $title[] = $objDownloadarchivee->title;
         }
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['downloadarchive'][0]) . ' - ' . implode(", ", $title) . ' ###';
         return $objTemplate->parse();
     }
     $this->checkForPublishedArchives();
     $this->import('FrontendUser', 'User');
     foreach ($this->arrDownloadarchives as $archive) {
         $objFiles = \FelixPfeiffer\Downloadarchive\DownloadarchiveitemsModel::findPublishedByPid($archive);
         if ($objFiles === null) {
             continue;
         }
         while ($objFiles->next()) {
             $objFile = \FilesModel::findByUuid($objFiles->singleSRC);
             if (!file_exists(TL_ROOT . '/' . $objFile->path) || $objFiles->guests && FE_USER_LOGGED_IN || $objFiles->protected == 1 && !FE_USER_LOGGED_IN && !BE_USER_LOGGED_IN) {
                 continue;
             }
             $arrGroups = deserialize($objFiles->groups);
             if ($objFiles->protected == 1 && is_array($arrGroups) && count(array_intersect($this->User->groups, $arrGroups)) < 1 && !BE_USER_LOGGED_IN) {
                 continue;
             }
             $allowedDownload = trimsplit(',', strtolower($GLOBALS['TL_CONFIG']['allowedDownload']));
             if (!in_array($objFile->extension, $allowedDownload)) {
                 continue;
             }
             $arrFile = $objFiles->row();
             $filename = $objFile->path;
             $arrFile['filename'] = $filename;
             $this->arrDownloadfiles[$archive][$filename] = $arrFile;
         }
     }
     $file = \Input::get('file', true);
     // Send the file to the browser and do not send a 404 header (see #4632)
     if ($file != '' && !preg_match('/^meta(_[a-z]{2})?\\.txt$/', basename($file))) {
         foreach ($this->arrDownloadfiles as $k => $archive) {
             if (array_key_exists($file, $archive)) {
                 \Controller::sendFileToBrowser($file);
             }
         }
     }
     return parent::generate();
 }
Ejemplo n.º 26
0
 public static function strtoupper($string)
 {
     global $sourcedir;
     if (function_exists('mb_strtoupper')) {
         return mb_strtoupper($string, 'UTF-8');
     }
     require_once $sourcedir . '/lib/Subs-Charset.php';
     return utf8_strtoupper($string);
 }
Ejemplo n.º 27
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']['comments'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         return $objTemplate->parse();
     }
     return parent::generate();
 }
 function prepareInputDataForProcess($input, $computers_id)
 {
     global $DBocs;
     $tables = $this->getTablesForQuery();
     $fields = $this->getFieldsForQuery();
     $rule_parameters = array();
     $select_sql = "";
     //Build the select request
     foreach ($fields as $field) {
         switch (utf8_strtoupper($field)) {
             //OCS server ID is provided by extra_params -> get the configuration associated with the ocs server
             case "OCS_SERVER":
                 $rule_parameters["OCS_SERVER"] = $this->ocsservers_id;
                 break;
                 //TAG and DOMAIN should come from the OCS DB
             //TAG and DOMAIN should come from the OCS DB
             default:
                 $select_sql .= ($select_sql != "" ? " , " : "") . $field;
         }
     }
     //Build the FROM part of the request
     //Remove all the non duplicated table names
     $from_sql = "FROM `hardware` ";
     foreach ($tables as $table => $linkfield) {
         if ($table != 'hardware' && !empty($linkfield)) {
             $from_sql .= " LEFT JOIN `{$table}` ON (`{$table}`.`{$linkfield}` = `hardware`.`ID`)";
         }
     }
     if ($select_sql != "") {
         //Build the all request
         $sql = "SELECT {$select_sql}\n                 {$from_sql}\n                 WHERE `hardware`.`ID` = '{$computers_id}'";
         OcsServer::checkOCSconnection($this->ocsservers_id);
         $result = $DBocs->query($sql);
         $ocs_datas = array();
         $fields = $this->getFieldsForQuery(1);
         //May have more than one line : for example in case of multiple network cards
         if ($DBocs->numrows($result) > 0) {
             while ($datas = $DBocs->fetch_array($result)) {
                 foreach ($fields as $field) {
                     if ($field != "OCS_SERVER" && isset($datas[$field])) {
                         $ocs_datas[$field][] = $datas[$field];
                     }
                 }
             }
         }
         //This cas should never happend but...
         //Sometimes OCS can't find network ports but fill the right ip in hardware table...
         //So let's use the ip to proceed rules (if IP is a criteria of course)
         if (in_array("IPADDRESS", $fields) && !isset($ocs_datas['IPADDRESS'])) {
             $ocs_datas['IPADDRESS'] = OcsServer::getGeneralIpAddress($this->ocsservers_id, $computers_id);
         }
         return array_merge($rule_parameters, $ocs_datas);
     }
     return $rule_parameters;
 }
Ejemplo n.º 29
0
 /**
  * Modify the default module and render parent generate.
  *
  * @return string
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $template = new \BackendTemplate('be_wildcard');
         $template->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['list'][0]) . ' ###';
         $template->title = $this->headline;
         $template->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $template->parse();
     }
     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']['eventreader_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();
     }
     global $objPage;
     // add registration before generating event details, otherwise formhybrid ajax requests wont get triggered
     if (in_array('event_registration', \ModuleLoader::getActive()) && $this->addRegistration && $this->checkConditions() && $this->objEvent->addRegistration) {
         if (!$this->objEvent->codes && !\Input::get('step') || \Input::get('step') == EventRegistration::STEP_REGISTRATION) {
             if ($this->registrationFormModule > 0) {
                 $this->registration = \Controller::getFrontendModule($this->registrationFormModule);
             }
         } else {
             if (\Input::get('step') == EventRegistration::STEP_SUMMARY) {
                 if ($this->summaryModule > 0) {
                     $this->registration = \Controller::getFrontendModule($this->summaryModule);
                 }
             } else {
                 if ($this->codeCheckModule > 0) {
                     $this->registration = \Controller::getFrontendModule($this->codeCheckModule);
                 }
             }
         }
     }
     if ($this->cal_template_modal) {
         $this->strTemplate = $this->customTpl ?: 'mod_event_modal';
         $this->cal_template = $this->cal_template_modal;
         // list config
         $this->cal_showInModal = true;
         $this->cal_readerModule = $this->id;
         // set modal css ID for generateModal() and parent::generate()
         $arrCss = deserialize($this->cssID, true);
         $arrCss[0] = EventsPlusHelper::getCSSModalID($this->id);
         $this->cssID = $arrCss;
         $this->base = \Controller::generateFrontendUrl($objPage->row());
         if ($this->Environment->isAjaxRequest && !$this->isSearchIndexer()) {
             $this->strTemplate = 'mod_event_modal_ajax';
             if (!$this->generateAjax()) {
                 return '';
             }
         }
         if (!$this->checkConditions()) {
             return $this->generateModal();
         }
     }
     return parent::generate();
 }