コード例 #1
0
ファイル: Maintenance.php プロジェクト: contao/core-bundle
 /**
  * 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();
 }
コード例 #2
0
 /**
  * Generate module
  */
 protected function compile()
 {
     // Create files
     if (\Input::post('FORM_SUBMIT') == 'tl_newsport') {
         $objModel = NewsportConfigModel::findByPk($this->objDc->id);
         if ($objModel === null) {
             return;
         }
         $importer = new NewsImporter($objModel);
         if ($importer->run()) {
             // Confirm and reload
             \Message::addConfirmation($GLOBALS['TL_LANG']['tl_newsport_config']['confirm']);
             $this->reload();
         }
     }
     $this->Template->base = \Environment::get('base');
     $this->Template->href = $this->getReferer(true);
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
     $this->Template->action = ampersand(\Environment::get('request'));
     $this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
     $this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
     $this->Template->message = \Message::generate();
     $this->Template->submit = specialchars($GLOBALS['TL_LANG']['tl_newsport_config']['import'][0]);
     $this->Template->headline = sprintf($GLOBALS['TL_LANG']['tl_newsport_config']['headline'], \Input::get('id'));
     $this->Template->explain = $GLOBALS['TL_LANG']['tl_newsport_config']['make'][1];
     $this->Template->label = $GLOBALS['TL_LANG']['tl_newsport_config']['label'];
 }
コード例 #3
0
ファイル: Button.php プロジェクト: ralfhartmann/isotope_core
 /**
  * Return the "cut" button
  *
  * @param array  $row
  * @param string $href
  * @param string $label
  * @param string $title
  * @param string $icon
  * @param string $attributes
  *
  * @return string
  */
 public function forCut($row, $href, $label, $title, $icon, $attributes)
 {
     if ($row['pid'] == 0) {
         return '';
     }
     return '<a href="' . preg_replace('/&(amp;)?id=[^& ]*/i', '', ampersand(\Environment::get('request'))) . '&amp;act=paste&amp;mode=cut&amp;table=tl_iso_product&amp;id=' . $row['id'] . '&amp;pid=' . \Input::get('id') . '&rt=' . \Input::get('rt') . '" title="' . specialchars($title) . '"' . $attributes . ' onclick="Backend.getScrollOffset();">' . \Image::getHtml($icon, $label) . '</a> ';
 }
コード例 #4
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     $lang = null;
     $host = null;
     // Start from the website root if there is no reference page
     if (!$this->rootPage) {
         $this->rootPage = $objPage->rootId;
     } else {
         $objRootPage = \PageModel::findWithDetails($this->rootPage);
         // Set the language
         if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
             $lang = $objRootPage->rootLanguage;
         }
         // Set the domain
         if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
             $host = $objRootPage->domain;
         }
     }
     $this->Template->formId = 'tl_quicknav_' . $this->id;
     $this->Template->targetPage = $GLOBALS['TL_LANG']['MSC']['targetPage'];
     $this->Template->button = specialchars($GLOBALS['TL_LANG']['MSC']['go']);
     $this->Template->title = $this->customLabel ?: $GLOBALS['TL_LANG']['MSC']['quicknav'];
     $this->Template->request = ampersand(\Environment::get('request'), true);
     $this->Template->items = $this->getQuicknavPages($this->rootPage, 1, $host, $lang);
 }
コード例 #5
0
 protected function generateCreditUrl($objCredit)
 {
     if ($objCredit->page === null) {
         return null;
     }
     $strCacheKey = 'id-' . $objCredit->page->id . '-' . $objCredit->result->ptable . '-' . $objCredit->parent->id;
     $autoitem = null;
     switch ($objCredit->result->ptable) {
         case 'tl_news':
             $autoitem = 'items';
             break;
         case 'tl_calendar_events':
             $autoitem = 'events';
             break;
         default:
             if (isset($GLOBALS['TL_FILECREDIT_MODELS'][$objCredit->result->ptable])) {
                 $autoitem = $GLOBALS['TL_FILECREDIT_MODELS'][$objCredit->result->ptable];
             }
     }
     // Load the URL from cache
     if (isset(self::$arrUrlCache[$strCacheKey])) {
         return self::$arrUrlCache[$strCacheKey];
     }
     if (is_null($autoitem)) {
         self::$arrUrlCache[$strCacheKey] = $this->generateFrontendUrl($objCredit->page->row());
     } else {
         self::$arrUrlCache[$strCacheKey] = ampersand($this->generateFrontendUrl($objCredit->page->row(), ($GLOBALS['TL_CONFIG']['useAutoItem'] && !$GLOBALS['TL_CONFIG']['disableAlias'] ? '/' : '/' . $autoitem . '/') . (!$GLOBALS['TL_CONFIG']['disableAlias'] && $objCredit->parent->alias != '' ? $objCredit->parent->alias : $objCredit->parent->id)));
     }
     return self::$arrUrlCache[$strCacheKey];
 }
コード例 #6
0
ファイル: PurgeData.php プロジェクト: contao/core-bundle
 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     $arrJobs = array();
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_purge_data');
     $objTemplate->isActive = $this->isActive();
     $objTemplate->message = \Message::generateUnwrapped();
     // Run the jobs
     if (\Input::post('FORM_SUBMIT') == 'tl_purge') {
         $purge = \Input::post('purge');
         if (!empty($purge) && is_array($purge)) {
             foreach ($purge as $group => $jobs) {
                 foreach ($jobs as $job) {
                     list($class, $method) = $GLOBALS['TL_PURGE'][$group][$job]['callback'];
                     $this->import($class);
                     $this->{$class}->{$method}();
                 }
             }
         }
         \Message::addConfirmation($GLOBALS['TL_LANG']['tl_maintenance']['cacheCleared']);
         $this->reload();
     }
     // Tables
     foreach ($GLOBALS['TL_PURGE']['tables'] as $key => $config) {
         $arrJobs[$key] = array('id' => 'purge_' . $key, 'title' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][0], 'description' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][1], 'group' => 'tables', 'affected' => '');
         // Get the current table size
         foreach ($config['affected'] as $table) {
             $objCount = $this->Database->execute("SELECT COUNT(*) AS count FROM " . $table);
             $arrJobs[$key]['affected'] .= '<br>' . $table . ': <span>' . sprintf($GLOBALS['TL_LANG']['MSC']['entries'], $objCount->count) . ', ' . $this->getReadableSize($this->Database->getSizeOf($table), 0) . '</span>';
         }
     }
     $strCachePath = str_replace(TL_ROOT . DIRECTORY_SEPARATOR, '', \System::getContainer()->getParameter('kernel.cache_dir'));
     // Folders
     foreach ($GLOBALS['TL_PURGE']['folders'] as $key => $config) {
         $arrJobs[$key] = array('id' => 'purge_' . $key, 'title' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][0], 'description' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][1], 'group' => 'folders', 'affected' => '');
         // Get the current folder size
         foreach ($config['affected'] as $folder) {
             $total = 0;
             $folder = sprintf($folder, $strCachePath);
             // Only check existing folders
             if (is_dir(TL_ROOT . '/' . $folder)) {
                 $objFiles = Finder::create()->in(TL_ROOT . '/' . $folder)->files();
                 $total = iterator_count($objFiles);
             }
             $arrJobs[$key]['affected'] .= '<br>' . $folder . ': <span>' . sprintf($GLOBALS['TL_LANG']['MSC']['files'], $total) . '</span>';
         }
     }
     // Custom
     foreach ($GLOBALS['TL_PURGE']['custom'] as $key => $job) {
         $arrJobs[$key] = array('id' => 'purge_' . $key, 'title' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][0], 'description' => $GLOBALS['TL_LANG']['tl_maintenance_jobs'][$key][1], 'group' => 'custom');
     }
     $objTemplate->jobs = $arrJobs;
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->headline = $GLOBALS['TL_LANG']['tl_maintenance']['clearCache'];
     $objTemplate->job = $GLOBALS['TL_LANG']['tl_maintenance']['job'];
     $objTemplate->description = $GLOBALS['TL_LANG']['tl_maintenance']['description'];
     $objTemplate->submit = \StringUtil::specialchars($GLOBALS['TL_LANG']['tl_maintenance']['clearCache']);
     $objTemplate->help = \Config::get('showHelp') && $GLOBALS['TL_LANG']['tl_maintenance']['cacheTables'][1] != '' ? $GLOBALS['TL_LANG']['tl_maintenance']['cacheTables'][1] : '';
     return $objTemplate->parse();
 }
コード例 #7
0
 public function generateAddActions($arrData, $id, Watchlist $objWatchlist)
 {
     global $objPage;
     if ($objPage === null) {
         return;
     }
     if (\Validator::isUuid($id)) {
         $objFile = \FilesModel::findByUuid($id);
     } else {
         $objFile = \FilesModel::findBy('path', $id);
     }
     $objItem = new WatchlistItemModel();
     $objItem->pid = Watchlist::getInstance()->getId();
     $objItem->uuid = $objFile->uuid;
     $objItem->pageID = $objPage->id;
     $objItem->cid = $arrData['id'];
     $objItem->type = $arrData['type'];
     $objT = new \FrontendTemplate('watchlist_add_actions');
     $objT->addHref = ampersand(\Controller::generateFrontendUrl($objPage->row()) . '?act=' . WATCHLIST_ACT_ADD . '&cid=' . $objItem->cid . '&type=' . $objItem->type . '&id=' . $strUuid . '&title=' . urlencode($objItem->getTitle()));
     $objT->addTitle = $GLOBALS['TL_LANG']['WATCHLIST']['addTitle'];
     $objT->addLink = $GLOBALS['TL_LANG']['WATCHLIST']['addLink'];
     $objT->active = $objWatchlist->isInList($strUuid);
     $objT->id = $strUuid;
     return $objT->parse();
 }
コード例 #8
0
 /**
  * Generate module
  */
 protected function compile()
 {
     $this->Template->trackingWidget = $this->generateTrackingWidget();
     $arrResponse = array();
     $arrTrackingNumbers = array();
     if ($this->Input->post('FORM_SUBMIT') == $this->strFormId && !$this->doNotSubmit) {
         if ($this->Input->post('tracking_number') || $this->Input->get('tracking_number')) {
             $arrTrackingNumbers = preg_split("/[\\s,]+/", $this->Input->post('tracking_number'));
         }
     } elseif ($this->Input->get('tracking_number')) {
         $arrTrackingNumbers[] = $this->Input->get('tracking_number');
     }
     if (count($arrTrackingNumbers)) {
         foreach ($arrTrackingNumbers as $tracking) {
             $tracking = new FedExAPITracking($tracking, array());
             $xml = $tracking->buildRequest();
             $arrResult = $tracking->sendRequest($xml);
             $arrResponses[] = $this->parseResponse($arrResult['TrackResponse']);
         }
     }
     $this->Template->datimLabel = $GLOBALS['TL_LANG']['MSC']['fedexTrackDatimLabel'];
     $this->Template->activityLabel = $GLOBALS['TL_LANG']['MSC']['fedexTrackActivityLabel'];
     $this->Template->locationLabel = $GLOBALS['TL_LANG']['MSC']['fedexTrackLocationLabel'];
     $this->Template->detailsLabel = $GLOBALS['TL_LANG']['MSC']['fedexTrackDetailsLabel'];
     $this->Template->action = ampersand($this->Environment->request, ENCODE_AMPERSANDS);
     $this->Template->formId = $this->strFormId;
     $this->Template->formSubmit = $this->strFormId;
     $this->Template->enctype = 'application/x-www-form-urlencoded';
     $this->Template->slabel = $GLOBALS['TL_LANG']['MSC']['submitTracking'];
     $this->Template->trackingNumberLabel = $GLOBALS['TL_LANG']['MSC']['trackingNumberLabel'];
     $this->Template->trackingResults = $arrResponses;
 }
コード例 #9
0
ファイル: ModuleArticle.php プロジェクト: AgentCT/tags
 private function getTagsForArticle($max_tags = 0, $relevance = 0, $target = 0)
 {
     $table = 'tl_article';
     $id = $this->id;
     $arrTags = $this->Database->prepare("SELECT * FROM tl_tag WHERE from_table = ? AND tid = ? ORDER BY tag ASC")->execute($table, $id)->fetchAllAssoc();
     $res = false;
     if (count($arrTags)) {
         if ($max_tags > 0) {
             $arrTags = array_slice($arrTags, 0, $max_tags);
         }
         $arrTagsWithCount = $this->Database->prepare("SELECT tag, COUNT(tag) as tagcount FROM tl_tag WHERE from_table = ? GROUP BY tag ORDER BY tag ASC")->execute($table)->fetchAllAssoc();
         $countarray = array();
         foreach ($arrTagsWithCount as $data) {
             $countarray[$data['tag']] = $data['tagcount'];
         }
         foreach ($arrTags as $idx => $tag) {
             $arrTags[$idx]['tagcount'] = $countarray[$tag['tag']];
             $arrTags[$idx]['tag_class'] = \Contao\TagList::_getTagNameClass($tag['tag']);
         }
         if ($relevance == 1) {
             usort($arrTags, array($this, 'sortByRelevance'));
         }
         if (strlen($target)) {
             $pageArr = array();
             $objFoundPage = $this->Database->prepare("SELECT id, alias FROM tl_page WHERE id=? OR alias=?")->limit(1)->execute(array($target, $target));
             $pageArr = $objFoundPage->numRows ? $objFoundPage->fetchAssoc() : array();
             if (count($pageArr)) {
                 foreach ($arrTags as $idx => $tag) {
                     $arrTags[$idx]['url'] = ampersand($this->generateFrontendUrl($pageArr, '/tag/' . $tag['tag']));
                 }
             }
         }
     }
     return $arrTags;
 }
コード例 #10
0
ファイル: BackendIndex.php プロジェクト: contao/core-bundle
 /**
  * Run the controller and parse the login template
  *
  * @return Response
  */
 public function run()
 {
     /** @var BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_login');
     $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], \Config::get('websiteTitle'));
     $objTemplate->theme = \Backend::getTheme();
     $objTemplate->messages = \Message::generate();
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->languages = \System::getLanguages(true);
     $objTemplate->title = \StringUtil::specialchars($strHeadline);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
     $objTemplate->headline = $strHeadline;
     $objTemplate->curLanguage = \Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
     $objTemplate->curUsername = \Input::post('username') ?: '';
     $objTemplate->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
     $objTemplate->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
     $objTemplate->loginButton = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
     $objTemplate->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
     $objTemplate->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $objTemplate->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
     $objTemplate->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $objTemplate->jsDisabled = $GLOBALS['TL_LANG']['MSC']['jsDisabled'];
     return $objTemplate->getResponse();
 }
コード例 #11
0
ファイル: index.php プロジェクト: iCodr8/core
 /**
  * Run the controller and parse the login template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_login');
     // Show a cookie warning
     if (Input::get('referer', true) != '' && empty($_COOKIE)) {
         $this->Template->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
     }
     $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], Config::get('websiteTitle'));
     $this->Template->theme = Backend::getTheme();
     $this->Template->messages = Message::generate();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->languages = System::getLanguages(true);
     $this->Template->title = specialchars($strHeadline);
     $this->Template->charset = Config::get('characterSet');
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
     $this->Template->headline = $strHeadline;
     $this->Template->curLanguage = Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
     $this->Template->curUsername = Input::post('username') ?: '';
     $this->Template->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
     $this->Template->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
     $this->Template->loginButton = specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
     $this->Template->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
     $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $this->Template->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
     $this->Template->frontendFile = Environment::get('base');
     $this->Template->disableCron = Config::get('disableCron');
     $this->Template->ie6warning = sprintf($GLOBALS['TL_LANG']['ERR']['ie6warning'], '<a href="http://ie6countdown.com">', '</a>');
     $this->Template->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $this->Template->output();
 }
コード例 #12
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var PageModel $objPage */
     global $objPage;
     // Set the trail and level
     if ($this->defineRoot && $this->rootPage > 0) {
         $trail = array($this->rootPage);
         $level = 0;
     } else {
         $trail = $objPage->trail;
         $level = $this->levelOffset > 0 ? $this->levelOffset : 0;
     }
     $lang = null;
     $host = null;
     // Overwrite the domain and language if the reference page belongs to a differnt root page (see #3765)
     if ($this->defineRoot && $this->rootPage > 0) {
         $objRootPage = \PageModel::findWithDetails($this->rootPage);
         // Set the language
         if (\Config::get('addLanguageToUrl') && $objRootPage->rootLanguage != $objPage->rootLanguage) {
             $lang = $objRootPage->rootLanguage;
         }
         // Set the domain
         if ($objRootPage->rootId != $objPage->rootId && $objRootPage->domain != '' && $objRootPage->domain != $objPage->domain) {
             $host = $objRootPage->domain;
         }
     }
     $this->Template->request = ampersand(\Environment::get('indexFreeRequest'));
     $this->Template->skipId = 'skipNavigation' . $this->id;
     $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
     $this->Template->items = $this->renderNavigation($trail[$level], 1, $host, $lang);
 }
コード例 #13
0
 /**
  * Add the cookie HTML buffer
  * @param string
  * @return string
  */
 public function addCookiebarBuffer($strContent)
 {
     if ($this->isCookiebarEnabled()) {
         $objRoot = $this->getCurrentRootPage();
         $objTemplate = new \FrontendTemplate('cookiebar_default');
         $objTemplate->message = $objRoot->cookiebar_message;
         $objTemplate->position = $objRoot->cookiebar_position;
         $objTemplate->button = $objRoot->cookiebar_button;
         $objTemplate->cookie = $this->getCookiebarName($objRoot);
         $objTemplate->more = '';
         // Add the "more" link
         if ($objRoot->cookiebar_jumpTo > 0) {
             $objJump = \PageModel::findByPk($objRoot->cookiebar_jumpTo);
             if ($objJump !== null) {
                 $objJump->loadDetails();
                 $objTemplate->more = $GLOBALS['TL_LANG']['MSC']['more'];
                 $objTemplate->moreHref = ampersand($this->generateFrontendUrl($objJump->row(), null, $objJump->language));
                 $objTemplate->moreTitle = specialchars($GLOBALS['TL_LANG']['MSC']['more']);
             }
         }
         // Place the cookiebar in DOM structure
         if ($objRoot->cookiebar_placement === 'before_wrapper') {
             $strContent = str_replace('<div id="wrapper">', $objTemplate->parse() . '<div id="wrapper">', $strContent);
         } else {
             $strContent = str_replace('</body>', $objTemplate->parse() . '</body>', $strContent);
         }
     }
     return $strContent;
 }
コード例 #14
0
 public function checkLog($ptable, $tstamp, $item)
 {
     switch ($ptable) {
         case 'tl_article':
             $objArticle = \ArticleModel::findById($item['pid']);
             $objPage = \PageModel::findById($objArticle->pid);
             $item['page'] = $objPage->title;
             $item['showUrl'] = $this->generateFrontendUrl($objPage->row(), '');
             break;
         case 'tl_news':
             $objNews = \NewsModel::findById($item['pid']);
             $objArchive = \NewsArchiveModel::findById($objNews->pid);
             $objPage = \PageModel::findById($objArchive->jumpTo);
             $item['page'] = $objNews->headline;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objNews->alias != '' ? $objNews->alias : $objNews->id)));
             break;
         case 'tl_calendar':
             break;
         case 'tl_faq':
             $objFAQ = \FaqModel::findById($item['id']);
             $objCategory = \FaqCategoryModel::findById($item['pid']);
             $objPage = \PageModel::findById($objCategory->jumpTo);
             $item['htmlElement'] = '<div class="ce_faq"><h1>' . $objFAQ->question . '</h1>' . $objFAQ->answer . '</div>';
             $item['page'] = $objCategory->title;
             $item['title'] = $objFAQ->question;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objFAQ->alias != '' ? $objFAQ->alias : $objFAQ->id)));
             break;
     }
     return $item;
 }
コード例 #15
0
ファイル: ModuleAutoload.php プロジェクト: eknoes/core
 /**
  * Generate the module
  */
 protected function compile()
 {
     \System::loadLanguageFile('tl_autoload');
     // Process the request
     if (\Input::post('FORM_SUBMIT') == 'tl_autoload') {
         $this->createAutoloadFiles();
         $this->reload();
     }
     $arrModules = array();
     // List all modules
     foreach (scan(TL_ROOT . '/system/modules') as $strFile) {
         if (strncmp($strFile, '.', 1) === 0 || !is_dir(TL_ROOT . '/system/modules/' . $strFile)) {
             continue;
         }
         $arrModules[] = $strFile;
     }
     $this->Template->modules = $arrModules;
     $this->Template->messages = \Message::generate();
     $this->Template->href = $this->getReferer(true);
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
     $this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
     $this->Template->headline = $GLOBALS['TL_LANG']['tl_autoload']['headline'];
     $this->Template->action = ampersand(\Environment::get('request'));
     $this->Template->available = $GLOBALS['TL_LANG']['tl_autoload']['available'];
     $this->Template->xplAvailable = $GLOBALS['TL_LANG']['tl_autoload']['xplAvailable'];
     $this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
     $this->Template->override = $GLOBALS['TL_LANG']['tl_autoload']['override'];
     $this->Template->xplOverride = $GLOBALS['TL_LANG']['tl_autoload']['xplOverride'];
     $this->Template->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
     $this->Template->autoload = $GLOBALS['TL_LANG']['tl_autoload']['autoload'];
     $this->Template->ideCompat = $GLOBALS['TL_LANG']['tl_autoload']['ideCompat'];
 }
コード例 #16
0
ファイル: GlossaryInsertTags.php プロジェクト: 4t2/glossary2
 public function replaceGlossaryTags($strTag)
 {
     $arrSplit = explode('::', $strTag);
     /*
            		{{glossary::ID}} / {{glossary::Term}}
     */
     if ($arrSplit[0] == 'glossary' && !empty($arrSplit[1])) {
         global $objPage;
         $this->import('Database');
         $arrGlossaries = array();
         $isGlossaryPage = false;
         $glossaryPageId = 0;
         /* look for glossary module on the current page */
         $objGlossaries = $this->Database->prepare("SELECT `glossaries` FROM `tl_module` WHERE `type`='glossaryList' AND `id` = (SELECT `module` FROM `tl_content` WHERE `type`='module' AND `pid`= (SELECT `id` FROM `tl_article` WHERE `pid`=?))")->limit(1)->execute($objPage->id);
         if ($objGlossaries->next()) {
             $arrValues = deserialize($objGlossaries->glossaries);
             $arrGlossaries = array_values($arrValues);
             $isGlossaryPage = true;
         }
         if (count($arrGlossaries) == 0) {
             /* find first glossary in page hierarchy */
             $objGlossaries = $this->Database->execute("SELECT `id`,`glossaries` FROM `tl_module` WHERE `type`='glossaryList'");
             while ($glossaryPageId == 0 && $objGlossaries->next()) {
                 $objArticles = $this->Database->prepare("SELECT `pid` FROM `tl_article` WHERE `published`=1 AND `id` IN (SELECT `pid` FROM `tl_content` WHERE `published`=1 AND `type`='module' AND `module` = ?)")->execute($objGlossaries->id);
                 while ($glossaryPageId == 0 && $objArticles->next()) {
                     if ($objPage->rootId == $this->getRootPage($objArticles->pid)) {
                         $arrValues = deserialize($objGlossaries->glossaries);
                         $arrGlossaries = array_values($arrValues);
                         $glossaryPageId = $objArticles->pid;
                     }
                 }
             }
             $objPages = $this->Database->execute("SELECT `pid` FROM `tl_article` WHERE `published`=1 AND `id` IN (SELECT `pid` FROM `tl_content` WHERE `published`=1 AND `type`='module' AND `module` = (SELECT `id` FROM `tl_module` WHERE `type`='glossaryList'))");
         }
         if (count($arrGlossaries) > 0) {
             if ((int) $arrSplit[1] > 0) {
                 $objTerm = $this->Database->prepare("SELECT `id`,`term` FROM `tl_glossary_term` WHERE `id`=?")->limit(1)->execute($arrSplit[1]);
             } else {
                 $objTerm = $this->Database->prepare("SELECT `id`,`term` FROM `tl_glossary_term` WHERE `term`=? AND `pid` IN (" . implode(',', $arrGlossaries) . ")")->limit(1)->execute($arrSplit[1]);
             }
             if ($objTerm->next()) {
                 $this->import('String');
                 if ($isGlossaryPage) {
                     return ampersand($this->Environment->request, true) . '#' . standardize($objTerm->term);
                 } elseif ($glossaryPageId > 0) {
                     $objGlossaryPage = $this->Database->prepare("SELECT * FROM `tl_page` WHERE `id`=?")->limit(1)->execute($glossaryPageId);
                     if ($objGlossaryPage->next()) {
                         if (version_compare(VERSION, '2.10', '>')) {
                             $strGlossaryUrl = $this->generateFrontendUrl($objGlossaryPage->row(), null, $objPage->rootLanguage);
                         } else {
                             $strGlossaryUrl = $this->generateFrontendUrl($objGlossaryPage->row());
                         }
                         return $strGlossaryUrl . '#' . standardize($objTerm->term);
                     }
                 }
             }
         }
     }
     return false;
 }
コード例 #17
0
ファイル: files.php プロジェクト: rburch/core
 /**
  * Run the controller and parse the login template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_files');
     $this->Template->main = '';
     // Ajax request
     if (Environment::get('isAjaxRequest')) {
         $this->objAjax = new Ajax(Input::post('action'));
         $this->objAjax->executePreActions();
     }
     $this->Template->main .= $this->getBackendModule('files');
     // Default headline
     if ($this->Template->headline == '') {
         $this->Template->headline = $GLOBALS['TL_CONFIG']['websiteTitle'];
     }
     $this->Template->theme = $this->getTheme();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filetree']);
     $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
     $this->Template->pageOffset = Input::cookie('BE_PAGE_OFFSET');
     $this->Template->error = Input::get('act') == 'error' ? $GLOBALS['TL_LANG']['ERR']['general'] : '';
     $this->Template->skipNavigation = $GLOBALS['TL_LANG']['MSC']['skipNavigation'];
     $this->Template->request = ampersand(Environment::get('request'));
     $this->Template->top = $GLOBALS['TL_LANG']['MSC']['backToTop'];
     $this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
     $this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
     $this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
     $this->Template->loadFonts = $GLOBALS['TL_CONFIG']['loadGoogleFonts'];
     $GLOBALS['TL_CONFIG']['debugMode'] = false;
     $this->Template->output();
 }
コード例 #18
0
ファイル: file.php プロジェクト: rikaix/core
 /**
  * Run the controller and parse the template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_picker');
     $this->Template->main = '';
     // Ajax request
     if ($_POST && Environment::get('isAjaxRequest')) {
         $this->objAjax = new Ajax(Input::post('action'));
         $this->objAjax->executePreActions();
     }
     $strTable = Input::get('table');
     $strField = Input::get('field');
     $this->loadDataContainer($strTable);
     $objDca = new DC_Table($strTable);
     // AJAX request
     if ($_POST && Environment::get('isAjaxRequest')) {
         $this->objAjax->executePostActions($objDca);
     }
     $objFileTree = new $GLOBALS['BE_FFL']['fileSelector'](array('strId' => $strField, 'strTable' => $strTable, 'strField' => $strField, 'strName' => $strField, 'varValue' => explode(',', Input::get('value'))), $objDca);
     $this->Template->main = $objFileTree->generate();
     $this->Template->theme = $this->getTheme();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['filepicker']);
     $this->Template->headline = $GLOBALS['TL_LANG']['MSC']['ppHeadline'];
     $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
     $this->Template->options = $this->createPageList();
     $this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
     $this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
     $this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
     $this->Template->search = $GLOBALS['TL_LANG']['MSC']['search'];
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->value = $this->Session->get('file_selector_search');
     $GLOBALS['TL_CONFIG']['debugMode'] = false;
     $this->Template->output();
 }
コード例 #19
0
ファイル: ModuleNewsletterList.php プロジェクト: iCodr8/core
 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $arrJumpTo = array();
     $arrNewsletter = array();
     $strRequest = ampersand(\Environment::get('request'), true);
     $objNewsletter = \NewsletterModel::findSentByPids($this->nl_channels);
     if ($objNewsletter !== null) {
         while ($objNewsletter->next()) {
             if (($objTarget = $objNewsletter->getRelated('pid')) === null) {
                 continue;
             }
             $jumpTo = intval($objTarget->jumpTo);
             // A jumpTo page is not mandatory for newsletter channels (see #6521) but required for the list module
             if ($jumpTo < 1) {
                 throw new \Exception("Newsletter channels without redirect page cannot be used in a newsletter list");
             }
             $strUrl = $strRequest;
             if (!isset($arrJumpTo[$objTarget->jumpTo])) {
                 $objJumpTo = $objTarget->getRelated('jumpTo')->loadDetails();
                 if ($objJumpTo !== null) {
                     $arrJumpTo[$objTarget->jumpTo] = $this->generateFrontendUrl($objJumpTo->row(), \Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s');
                 } else {
                     $arrJumpTo[$objTarget->jumpTo] = $strUrl;
                 }
             }
             $strUrl = $arrJumpTo[$objTarget->jumpTo];
             $strAlias = $objNewsletter->alias != '' && !\Config::get('disableAlias') ? $objNewsletter->alias : $objNewsletter->id;
             $arrNewsletter[] = array('subject' => $objNewsletter->subject, 'title' => strip_insert_tags($objNewsletter->subject), 'href' => sprintf($strUrl, $strAlias), 'date' => \Date::parse($objPage->dateFormat, $objNewsletter->date), 'datim' => \Date::parse($objPage->datimFormat, $objNewsletter->date), 'time' => \Date::parse($objPage->timeFormat, $objNewsletter->date), 'channel' => $objNewsletter->channel);
         }
     }
     $this->Template->newsletters = $arrNewsletter;
 }
コード例 #20
0
 /**
  * Generate the module
  */
 protected function compile()
 {
     $objVotings = $this->Database->execute("\n            SELECT *,\n                (SELECT COUNT(*) FROM tl_voting_enquiry WHERE pid=tl_voting.id) AS total_enquiries\n            FROM tl_voting\n            " . (!BE_USER_LOGGED_IN ? " WHERE published=1" : "") . "\n            ORDER BY start DESC\n        ");
     if (!$objVotings->numRows) {
         return;
     }
     $strUrl = '';
     // Get the jumpTo page
     if ($this->jumpTo > 0) {
         $objJump = $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")->limit(1)->execute($this->jumpTo);
         if ($objJump->numRows) {
             $strUrl = ampersand($this->generateFrontendUrl($objJump->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s'));
         }
     }
     $limit = $objVotings->numRows;
     $count = 0;
     $arrVotings = array();
     // Generate votings
     while ($objVotings->next()) {
         $arrVotings[$objVotings->id] = $objVotings->row();
         $arrVotings[$objVotings->id]['class'] = (++$count == 1 ? ' first' : '') . ($count == $limit ? ' last' : '') . ($count % 2 == 0 ? ' odd' : ' even') . ($this->isActive($objVotings) ? ' active' : '') . ($objVotings->start > time() ? ' upcoming' : '');
         $arrVotings[$objVotings->id]['href'] = sprintf($strUrl, $objVotings->alias);
         $arrVotings[$objVotings->id]['linkTitle'] = specialchars($objVotings->name);
         $arrVotings[$objVotings->id]['period'] = $this->getPeriod($objVotings);
     }
     $this->Template->votings = $arrVotings;
 }
コード例 #21
0
 /**
  * Set Link href.
  *
  * @param Attributes $attributes Link attributes.
  *
  * @return void
  */
 protected function setHref(Attributes $attributes)
 {
     if (substr($this->url, 0, 7) == 'mailto:') {
         $attributes->setAttribute('href', \String::encodeEmail($this->url));
     } else {
         $attributes->setAttribute('href', ampersand($this->url));
     }
 }
コード例 #22
0
ファイル: ContentToplink.php プロジェクト: rikaix/core
 /**
  * Generate the content element
  */
 protected function compile()
 {
     if ($this->linkTitle == '') {
         $this->linkTitle = $GLOBALS['TL_LANG']['MSC']['backToTop'];
     }
     $this->Template->label = $this->linkTitle;
     $this->Template->title = specialchars($this->linkTitle);
     $this->Template->request = ampersand(\Environment::get('request'), true);
 }
コード例 #23
0
ファイル: ContentHyperlink.php プロジェクト: rikaix/core
 /**
  * Generate the content element
  */
 protected function compile()
 {
     global $objPage;
     if (substr($this->url, 0, 7) == 'mailto:') {
         $this->url = \String::encodeEmail($this->url);
     } else {
         $this->url = ampersand($this->url);
     }
     $embed = explode('%s', $this->embed);
     if ($this->linkTitle == '') {
         $this->linkTitle = $this->url;
     }
     // Use an image instead of the title
     if ($this->useImage && $this->singleSRC != '' && is_numeric($this->singleSRC)) {
         $objModel = \FilesModel::findByPk($this->singleSRC);
         if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
             $this->Template = new \FrontendTemplate('ce_hyperlink_image');
             $this->Template->setData($this->arrData);
             $objFile = new \File($objModel->path);
             if ($objFile->isGdImage) {
                 $size = deserialize($this->size);
                 $intMaxWidth = TL_MODE == 'BE' ? 320 : $GLOBALS['TL_CONFIG']['maxImageWidth'];
                 // Adjust the image size
                 if ($intMaxWidth > 0 && ($size[0] > $intMaxWidth || !$size[0] && $objFile->width > $intMaxWidth)) {
                     $size[0] = $intMaxWidth;
                     $size[1] = floor($intMaxWidth * $objFile->height / $objFile->width);
                 }
                 $src = \Image::get($objModel->path, $size[0], $size[1], $size[2]);
                 if (($imgSize = @getimagesize(TL_ROOT . '/' . rawurldecode($src))) !== false) {
                     $this->Template->arrSize = $imgSize;
                     $this->Template->imgSize = ' ' . $imgSize[3];
                 }
                 $this->Template->src = TL_FILES_URL . $src;
                 $this->Template->alt = specialchars($this->alt);
                 $this->Template->linkTitle = specialchars($this->linkTitle);
                 $this->Template->caption = $this->caption;
             }
         }
     }
     if (strncmp($this->rel, 'lightbox', 8) !== 0 || $objPage->outputFormat == 'xhtml') {
         $this->Template->attribute = ' rel="' . $this->rel . '"';
     } else {
         $this->Template->attribute = ' data-lightbox="' . substr($this->rel, 9, -1) . '"';
     }
     $this->Template->rel = $this->rel;
     // Backwards compatibility
     $this->Template->href = $this->url;
     $this->Template->embed_pre = $embed[0];
     $this->Template->embed_post = $embed[1];
     $this->Template->link = $this->linkTitle;
     $this->Template->linkTitle = specialchars($this->linkTitle);
     $this->Template->target = '';
     // Override the link target
     if ($this->target) {
         $this->Template->target = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
     }
 }
コード例 #24
0
 /**
  * Generate module
  */
 protected function compile()
 {
     $this->Template->addressWidget = $this->generateAddressWidget();
     $this->Template->action = ampersand($this->Environment->request, ENCODE_AMPERSANDS);
     $this->Template->formId = $this->strFormId;
     $this->Template->formSubmit = $this->strFormId;
     $this->Template->enctype = 'application/x-www-form-urlencoded';
     $this->Template->slabel = $GLOBALS['TL_LANG']['MSC']['submitTimeInTransit'];
 }
コード例 #25
0
 /**
  * Generate content element
  */
 protected function compile()
 {
     if (!strlen($this->linkTitle)) {
         $this->linkTitle = $GLOBALS['TL_LANG']['MSC']['backToTop'];
     }
     $this->Template->label = $this->linkTitle;
     $this->Template->title = specialchars($this->linkTitle);
     $this->Template->request = ampersand($this->Environment->request, true);
 }
コード例 #26
0
 /**
  * Generate module
  */
 protected function compile()
 {
     global $objPage;
     $trail = $objPage->trail;
     $level = $this->levelOffset > 0 ? $this->levelOffset + 1 : 1;
     $this->Template->skipId = 'skipNavigation' . $this->id;
     $this->Template->request = ampersand($this->Environment->request, ENCODE_AMPERSANDS);
     $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
     $this->Template->items = $this->renderNavigation($trail[$level]);
 }
コード例 #27
0
 /**
  * Generate module
  */
 protected function compile()
 {
     if ($this->includeRoot) {
         $this->rootPage = 0;
     }
     $this->Template->targetPage = $GLOBALS['TL_LANG']['MSC']['targetPage'];
     $this->Template->button = specialchars($GLOBALS['TL_LANG']['MSC']['go']);
     $this->Template->title = strlen($this->customLabel) ? $this->customLabel : $GLOBALS['TL_LANG']['MSC']['quicknav'];
     $this->Template->request = ampersand($this->Environment->request, true);
     $this->Template->items = $this->getQuicknavPages($this->rootPage);
 }
コード例 #28
0
 /**
  * Run the controller and parse the password template
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_password');
     if (\Input::post('FORM_SUBMIT') == 'tl_password') {
         $pw = \Input::postUnsafeRaw('password');
         $cnf = \Input::postUnsafeRaw('confirm');
         // The passwords do not match
         if ($pw != $cnf) {
             \Message::addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']);
         } elseif (utf8_strlen($pw) < \Config::get('minPasswordLength')) {
             \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], \Config::get('minPasswordLength')));
         } elseif ($pw == $this->User->username) {
             \Message::addError($GLOBALS['TL_LANG']['ERR']['passwordName']);
         } else {
             // Make sure the password has been changed
             if (\Encryption::verify($pw, $this->User->password)) {
                 \Message::addError($GLOBALS['TL_LANG']['MSC']['pw_change']);
             } else {
                 $this->loadDataContainer('tl_user');
                 // Trigger the save_callback
                 if (is_array($GLOBALS['TL_DCA']['tl_user']['fields']['password']['save_callback'])) {
                     foreach ($GLOBALS['TL_DCA']['tl_user']['fields']['password']['save_callback'] as $callback) {
                         if (is_array($callback)) {
                             $this->import($callback[0]);
                             $pw = $this->{$callback[0]}->{$callback[1]}($pw);
                         } elseif (is_callable($callback)) {
                             $pw = $callback($pw);
                         }
                     }
                 }
                 $objUser = \UserModel::findByPk($this->User->id);
                 $objUser->pwChange = '';
                 $objUser->password = \Encryption::hash($pw);
                 $objUser->save();
                 \Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['pw_changed']);
                 $this->redirect('' . $GLOBALS['TL_CONFIG']['backendPath'] . '/main.php');
             }
         }
         $this->reload();
     }
     $objTemplate->theme = \Backend::getTheme();
     $objTemplate->messages = \Message::generate();
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->title = specialchars($GLOBALS['TL_LANG']['MSC']['pw_new']);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pw_change'];
     $objTemplate->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
     $objTemplate->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $objTemplate->confirm = $GLOBALS['TL_LANG']['MSC']['confirm'][0];
     $objTemplate->output();
 }
コード例 #29
0
 /**
  * Generate the content element
  */
 protected function compile()
 {
     $objNewsletter = \NewsletterModel::findByIdOrAlias($this->pid);
     $objNewsletterChannel = \NewsletterChannelModel::findByIds(array($objNewsletter->pid), array('limit' => 1));
     $objParent = $this->getPageDetails($objNewsletterChannel->jumpTo);
     $href = ampersand($this->generateFrontendUrl($objParent->row(), sprintf(\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s', $objNewsletter->alias)));
     //$href = ampersand($this->generateFrontendUrl($objParent->row(), ((\Config::get('useAutoItem') && !\Config::get('disableAlias')) ?  '/%s' : '/items/%s'), $objParent->language));
     $this->Template->setData($objNewsletter->row());
     $this->Template->view_online = $href;
     return;
 }
 /**
  *
  */
 public function compile()
 {
     //die(var_dump($GLOBALS['TL_DCA']['tl_module']));
     global $objPage;
     $this->showLevel = 1;
     $this->hardLimit = true;
     $this->Template->request = ampersand(\Environment::get('indexFreeRequest'));
     $this->Template->skipId = 'skipNavigation' . $this->id;
     $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
     $this->Template->items = $this->renderNavigation($objPage->id, 1);
 }