public function user_fieldvisibility($PA, $fobj) { $this->init(); //init some class attributes $this->pageId = $PA['row']['pid']; $uid = $PA['row']['uid']; if (substr($uid, 0, 3) == 'NEW') { $this->isNewElement = TRUE; } if ($PA['table'] == 'pages' && !$this->isNewElement) { $this->pageId = $PA['row']['uid']; } $_modTSconfig = $GLOBALS["BE_USER"]->getTSConfig('mod.languagevisibility', t3lib_BEfunc::getPagesTSconfig($this->pageId)); $this->modTSconfig = $_modTSconfig['properties']; ### $languageRep = t3lib_div::makeInstance('tx_languagevisibility_languagerepository'); $dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon'); if (version_compare(TYPO3_version, '4.3.0', '<')) { $elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory'); $elementfactory = new $elementfactoryName($dao); } else { $elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao); } $value = $PA['row'][$PA['field']]; $table = $PA['table']; $isOverlay = tx_languagevisibility_beservices::isOverlayRecord($PA['row'], $table); $visivilitySetting = @unserialize($value); if (!is_array($visivilitySetting) && $value != '') { $content .= 'Visibility Settings seems to be corrupt:' . $value; } if ($isOverlay) { $uid = tx_languagevisibility_beservices::getOriginalUidOfTranslation($PA['row'], $table); $table = tx_languagevisibility_beservices::getOriginalTableOfTranslation($table); //This element is an overlay therefore we need to render the visibility field just for the language of the overlay $overlayRecordsLanguage = $languageRep->getLanguageById($PA['row']['sys_language_uid']); try { $originalElement = $elementfactory->getElementForTable($table, $uid); } catch (Exception $e) { return ''; } $infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, array($overlayRecordsLanguage), $PA['itemFormElName'], true); } else { //This element is an original element (no overlay) try { $originalElement = $elementfactory->getElementForTable($table, $uid); } catch (Exception $e) { return 'sorry this element supports no visibility settings'; } $content .= $originalElement->getInformativeDescription(); if ($originalElement->isMonolithicTranslated()) { return $content; } $languageList = $languageRep->getLanguages(); $infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, $languageList, $PA['itemFormElName'], false); } $content .= $this->_renderLanguageInfos($infosStruct); return '<div id="fieldvisibility">' . $content . '<a href="#" onclick="resetSelectboxes()">reset</a></div>' . $this->_javascript(); }
/** * Validates that the correct image of possible images displayed by the extension "simple_captcha" got selected. * * @param array &$check The TypoScript settings for this error check * @param string $name The field name * @param array &$gp The current GET/POST parameters * @return string The error string */ public function check(&$check, $name, &$gp) { $checkFailed = ''; if (t3lib_extMgm::isLoaded('simple_captcha')) { require_once t3lib_extMgm::extPath('simple_captcha') . 'class.tx_simplecaptcha.php'; $simpleCaptcha_className = t3lib_div::makeInstanceClassName('tx_simplecaptcha'); $this->simpleCaptcha = new $simpleCaptcha_className(); if (!$this->simpleCaptcha->checkCaptcha()) { $checkFailed = $this->getCheckFailed($check); } } return $checkFailed; }
/** * Return classname for new instance * Takes the class-extensions API of TYPO3 into account * Usage: 17 * * @param string Base Class name to evaluate * @return string Final class name to instantiate with "new [classname]" */ function makeInstanceClassName($className) { return class_exists('ux_' . $className) ? t3lib_div::makeInstanceClassName('ux_' . $className) : $className; }
* A copy is found in the textfile GPL.txt and important notices to the license * from the author is found in LICENSE.txt distributed with these scripts. * * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ // Initialize FE user object: $feUserObj = tslib_eidtools::initFeUser(); require_once PATH_t3lib . 'class.t3lib_page.php'; require_once PATH_tslib . "class.tslib_content.php"; $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe'); // create object instances: $TSFE = t3lib_div::makeInstance('tslib_fe', $TYPO3_CONF_VARS, $page, 0, true); tslib_eidtools::connectDB(); extract($_POST, EXTR_PREFIX_SAME, "post_"); $tmp_confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rgmediaimagescallback']); $securityKey = t3lib_div::_GET('key'); $pid = intval(t3lib_div::_GET('pid')); $uid = intval(t3lib_div::_GET('uid')); $file = $GLOBALS['TYPO3_DB']->fullQuoteStr(t3lib_div::_GET('file'), 'tx_rgmediaimagescallback_statistic'); if ($file != '' && $title != '' && $id != '' && $securityKey != '' && $pid != '' && $uid != '' && $state == 'start') { // fetch existing data $where = 'hidden=0 AND deleted = 0 AND pageid=' . $pid . ' AND ceuid = ' . $uid . ' AND uniquekey ="' . $securityKey . '" AND title="' . $file . '"'; $res = $TYPO3_DB->exec_SELECTquery('countmedia,uid', 'tx_rgmediaimagescallback_statistic', $where); $row = $TYPO3_DB->sql_fetch_assoc($res); // there is already one record => update
/** * Rendering the "Table" type content element, called from TypoScript (tt_content.table.20) * * @param string Content input. Not used, ignore. * @param array TypoScript configuration * @return string HTML output. * @access private */ function render_table($content, $conf) { $content = trim($this->cObj->data['bodytext']); // Init FlexForm configuration $this->pi_initPIflexForm(); // Get bodytext field content $content = trim($this->cObj->data['bodytext']); if (!strcmp($content, '')) { return ''; } // get flexform values $caption = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_caption'))); $summary = trim(htmlspecialchars($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_summary'))); $useTfoot = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tfoot')); $headerPos = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_headerpos'); $noStyles = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_nostyles'); $tableClass = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'acctables_tableclass'); $delimiter = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_delimiter', 's_parsing')); if ($delimiter) { $delimiter = chr(intval($delimiter)); } else { $delimiter = '|'; } $quotedInput = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'tableparsing_quote', 's_parsing')); if ($quotedInput) { $quotedInput = chr(intval($quotedInput)); } else { $quotedInput = ''; } // Split into single lines (will become table-rows): $rows = t3lib_div::trimExplode(chr(10), $content); reset($rows); // Find number of columns to render: $cols = t3lib_div::intInRange($this->cObj->data['cols'] ? $this->cObj->data['cols'] : count(explode($delimiter, current($rows))), 0, 100); // Traverse rows (rendering the table here) $rCount = count($rows); //*************************************** //***********RENDERING******************* require_once t3lib_extMgm::extPath('th_exttableservice') . 'class.tx_thexttableservice.php'; $tableClass = t3lib_div::makeInstanceClassName('tx_thexttableservice'); $table = new $tableClass(); $table->loadDefinitions(t3lib_extMgm::extPath('aoe_advancedtable') . 'pi1/exttabledefinitions.xml'); $table->insertRows(0, $rCount - 1); $table->insertCols(0, $cols - 1); $cellcontent = ''; //***********Traverse each Row******************* for ($row = 0; $row < $table->getRowCount(); $row++) { $cells = explode($delimiter, $rows[$row]); //Set common row attributes: $_rowClass = $row % 2 ? 'tr-odd ' : 'tr-even '; if ($row == $table->getRowCount() - 1) { //is last row: $_rowClass .= 'tr-last '; } $_rowClass .= 'tr-' . $row; $lastCellInRowData = array(); //***********Traverse each col in row******************* for ($col = 0; $col < $table->getColCount(); $col++) { $cellData = $this->_getCellDataFromCellValue($cells[$col]); $cellcontent = $cellData['content']; //Set common cell attributes: $_cellClass = ''; if ($col == $table->getColCount() - 1) { //is last col: $_cellClass = 'td-last '; } $_cellClass .= 'td-' . $col; //process attributes for the current cell: foreach ($cellData['attributes'] as $k => $v) { switch ($k) { case 'class': $_cellClass .= ' ' . $v; break; case 'rowClass': $_rowClass .= ' ' . $v; break; case 'cellType': if ($v == 'header') { $table->setCellType($col, $row, 'th'); } break; default: //$table->setCellAttribute($col, $row, $k,$v); break; } } $table->setCellAttribute($col, $row, 'class', $_cellClass); //***Check colspan and rowspan****** if ($cellData['colspan']) { $this->_setColspanForTable($col, $row, $table); } elseif ($cellData['rowspan']) { $this->_setRowspanForTable($col, $row, $table); } else { $cellcontent = $this->cObj->stdWrap($cellcontent, $conf['innerStdWrap.']); $table->setCellContent($col, $row, $cellcontent); //.$col ."x" .$row } } // (for-loop cols) $table->setRowAttribute($row, 'class', $_rowClass); } // (for-loop rows) //last row is tfoot? if ($useTfoot) { $table->setRowGroup($table->getRowCount() - 1, 'tfoot'); } if ($caption) { $table->setTableCaption($caption); } if ($summary) { $table->setTableAttribute('summary', $summary); } // Set header type: $type = intval($this->cObj->data['layout']); // Table tag params. $tableTagParams = $this->_getTableAttributes($conf, $type); foreach ($tableTagParams as $key => $value) { if ($value != '') { $table->setTableAttribute($key, $value); } } $tableClass = 'contenttable contenttable-' . $type; $table->setTableAttribute('class', $tableClass); // generate id prefix for accessible header $headerScope = $headerPos == 'top' ? 'col' : 'row'; $headerIdPrefix = $headerScope . $this->cObj->data['uid'] . '-'; //*******set headercells and header attribute********* if ($headerPos == 'top') { $table->setRowGroup(0, 'thead'); $table->setCellTypeInRange(0, 0, $table->getColCount(), 0, 'th'); $table->setCellAttributesInRange(0, 0, $table->getColCount(), 0, array('scope' => $headerScope)); for ($col = 0; $col < $table->getColCount(); $col++) { $table->setCellAttribute($col, 0, 'id', $headerIdPrefix . $col); $table->setCellAttributesInRange($col, 1, $col, $table->getRowCount(), array('headers' => $headerIdPrefix . $col)); } } elseif ($headerPos == 'left') { $table->setCellTypeInRange(0, 0, 0, $table->getRowCount(), 'th'); $table->setCellAttributesInRange(0, 0, $table->getColCount(), 0, array('scope' => $headerScope)); for ($row = 0; $row < $table->getRowCount(); $row++) { $table->setCellAttribute(0, $row, $table->getColCount(), 0, 'id', $headerIdPrefix . $row); $table->setCellAttributesInRange(1, $row, $table->getColCount(), $row, array('headers' => $headerIdPrefix . $row)); } } //*******OUTPUT********* //debug($table->errorMessage); return $this->cObj->stdWrap($table->getXHTML(), $conf['stdWrap.']); }
/** * createActFromPostData() * * creates an activity-object based on POSTed data */ function createActFromPostData() { $leg = t3lib_div::makeInstance('tx_user_fdf_actdb_cc_leg'); $loeb = t3lib_div::makeInstance('tx_user_fdf_actdb_cc_loeb'); $sketch = t3lib_div::makeInstance('tx_user_fdf_actdb_cc_sketch'); $act = $this->createActFromType($this->postdata[type]); $this->ogiue('title', $act); $this->ogiue('actid', $act, 'id'); $this->ogiue('keywords', $act); $this->ogiue('teaser', $act); $this->ogiue('notes', $act, 'nb'); $this->ogiue('description', $act); $this->ogiue('author_name', $act); $this->ogiue('author_email', $act); $this->ogiue('duration_min', $act); $this->ogiue('duration_max', $act); $this->ogiue('participants_min', $act); $this->ogiue('participants_max', $act); $this->ogiue('age_min', $act); $this->ogiue('age_max', $act); if (isset($this->postdata['catids'])) { foreach ($this->postdata['catids'] as $catid) { $act->categories[$catid] = $this->cat_from_id($catid); } } if (isset($this->postdata['ageids'])) { print_r($this->postdata['ageids']); foreach ($this->postdata['ageids'] as $ageid) { print_r($ageid); $age = t3lib_div::makeInstanceClassName('tx_user_fdf_actdb_cc_age'); $age = new $age($ageid); $act->ages[$ageid] = $age; } } if ($act->type == $leg->type || $act->type == $loeb->type) { $this->ogiue('place', $act); $this->ogiue('materials', $act); if (isset($this->postdata[indoor])) { $act->indoor = 1; } if (isset($this->postdata[outdoor])) { $act->outdoor = 1; } } elseif ($act->type == 2) { $this->ogiue('scene', $act); $this->ogiue('roles', $act); $this->ogiue('props', $act); $this->ogiue('lines', $act); $this->ogiue('audience_min_age', $act); $this->ogiue('duration', $act); } return $act; }
/** * Fills the markers for the supported captcha extensions. * * @param array &$markers Reference to the markers array * @return void */ protected function fillCaptchaMarkers(&$markers) { global $LANG; if (t3lib_extMgm::isLoaded('captcha')) { $markers['###CAPTCHA###'] = '<img src="' . t3lib_extMgm::siteRelPath('captcha') . 'captcha/captcha.php" alt="" />'; $markers['###captcha###'] = $markers['###CAPTCHA###']; } if (t3lib_extMgm::isLoaded('simple_captcha')) { require_once t3lib_extMgm::extPath('simple_captcha') . 'class.tx_simplecaptcha.php'; $simpleCaptcha_className = t3lib_div::makeInstanceClassName('tx_simplecaptcha'); $this->simpleCaptcha = new $simpleCaptcha_className(); $captcha = $this->simpleCaptcha->getCaptcha(); $markers['###simple_captcha###'] = $captcha; $markers['###SIMPLE_CAPTCHA###'] = $captcha; } if (t3lib_extMgm::isLoaded('sr_freecap')) { require_once t3lib_extMgm::extPath('sr_freecap') . 'pi2/class.tx_srfreecap_pi2.php'; $this->freeCap = t3lib_div::makeInstance('tx_srfreecap_pi2'); $markers = array_merge($markers, $this->freeCap->makeCaptcha()); } if (t3lib_extMgm::isLoaded('jm_recaptcha')) { require_once t3lib_extMgm::extPath('jm_recaptcha') . 'class.tx_jmrecaptcha.php'; $this->recaptcha = new tx_jmrecaptcha(); $markers['###RECAPTCHA###'] = $this->recaptcha->getReCaptcha(); $markers['###recaptcha###'] = $markers['###RECAPTCHA###']; } if (t3lib_extMgm::isLoaded('wt_calculating_captcha')) { require_once t3lib_extMgm::extPath('wt_calculating_captcha') . 'class.tx_wtcalculatingcaptcha.php'; $captcha = t3lib_div::makeInstance('tx_wtcalculatingcaptcha'); $markers['###WT_CALCULATING_CAPTCHA###'] = $captcha->generateCaptcha(); $markers['###wt_calculating_captcha###'] = $markers['###WT_CALCULATING_CAPTCHA###']; } if (t3lib_extMgm::isLoaded('mathguard')) { require_once t3lib_extMgm::extPath('mathguard') . 'class.tx_mathguard.php'; $captcha = t3lib_div::makeInstance('tx_mathguard'); $markers['###MATHGUARD###'] = $captcha->getCaptcha(); $markers['###mathguard###'] = $markers['###MATHGUARD###']; } }
* @version $Id$ */ $TYPO3_AJAX = true; define('TYPO3_MOD_PATH', '../typo3conf/ext/tt_news/compat/'); $BACK_PATH = ''; // this path is used later for tree icons when the tree class is executed from typo3/alt_doc.php require $BACK_PATH . '../../../../typo3/init.php'; require_once t3lib_extMgm::extPath('tt_news') . 'lib/class.tx_ttnews_typo3ajax.php'; require_once PATH_typo3 . 'sysext/lang/lang.php'; $GLOBALS['LANG'] = t3lib_div::makeInstance('language'); $GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc['lang']); // finding the script path from the variable $ajaxID = (string) t3lib_div::_GP('ajaxID'); $ajaxScript = $TYPO3_CONF_VARS['BE']['AJAX'][$ajaxID]; // instantiating the AJAX object $ajaxClassName = t3lib_div::makeInstanceClassName('tx_ttnews_typo3ajax'); $ajaxObj = new $ajaxClassName($ajaxID); $ajaxParams = array(); // evaluating the arguments and calling the AJAX method/function if (empty($ajaxID)) { $ajaxObj->setError('No valid ajaxID parameter given.'); } else { if (empty($ajaxScript)) { $ajaxObj->setError('Registered backend function for ajaxID "' . $ajaxID . '" was not found.'); } else { $ret = t3lib_div::callUserFunction($ajaxScript, $ajaxParams, $ajaxObj, false, true); if ($ret === false) { $ajaxObj->setError('Registered backend function for ajaxID "' . $ajaxID . '" was not found.'); } } }
/** * Obtain exclusive lock * * @param string Filename which we want to lock * @return bool Success or failure of operation */ function lock($filename) { try { if (!is_object($this->fileLock)) { if (t3lib_div::compat_version('4.3')) { $this->fileLock = t3lib_div::makeInstance('t3lib_lock', 'tx_dam_indexing_' . md5($filename), $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode'], 60, 10); } else { $className = t3lib_div::makeInstanceClassName('t3lib_lock'); $this->fileLock = new $className('tx_dam_indexing_' . md5($filename), $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode'], 60, 10); } } $success = false; if (is_object($this->fileLock)) { // true = Page could get locked without blocking // false = Page could get locked but process was blocked before $success = $this->fileLock->acquire() || $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode'] == 'disable'; if ($this->fileLock->getLockStatus()) { if ($this->writeDevLog) { t3lib_div::devLog('lock(): lock aquired ' . $filename, 'tx_dam_indexing'); } } else { if ($this->writeDevLog) { t3lib_div::devLog('lock(): lock failed ' . $filename, 'tx_dam_indexing'); } } } } catch (Exception $e) { if ($this->writeDevLog) { t3lib_div::devLog('lock(): Exception caught ' . $e->getMessage(), 'tx_dam_indexing'); } } return $success; }
function _initBeUser() { global $BE_USER, $_COOKIE, $TYPO3_CONF_VARS; $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe'); $TSFE = new $temp_TSFEclassName($TYPO3_CONF_VARS, 0, 0); $TSFE->connectToDB(); // ********* // BE_USER // ********* $BE_USER = ''; if ($_COOKIE['be_typo_user']) { // If the backend cookie is set, we proceed and checks if a backend user is logged in. require_once PATH_t3lib . 'class.t3lib_befunc.php'; require_once PATH_t3lib . 'class.t3lib_userauthgroup.php'; require_once PATH_t3lib . 'class.t3lib_beuserauth.php'; require_once PATH_t3lib . 'class.t3lib_tsfebeuserauth.php'; // the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script $BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth'); // New backend user object $BE_USER->OS = TYPO3_OS; $BE_USER->lockIP = $TYPO3_CONF_VARS['BE']['lockIP']; $BE_USER->start(); // Object is initialized $BE_USER->unpack_uc(''); if ($BE_USER->user['uid']) { $BE_USER->fetchGroupData(); $TSFE->beUserLogin = 1; } if ($BE_USER->checkLockToIP() && $BE_USER->checkBackendAccessSettingsFromInitPhp()) { $BE_USER->extInitFeAdmin(); if ($BE_USER->extAdmEnabled) { require_once t3lib_extMgm::extPath('lang') . 'lang.php'; $LANG = t3lib_div::makeInstance('language'); $LANG->init($BE_USER->uc['lang']); $BE_USER->extSaveFeAdminConfig(); // Setting some values based on the admin panel $TSFE->forceTemplateParsing = $BE_USER->extGetFeAdminValue('tsdebug', 'forceTemplateParsing'); $TSFE->displayEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayIcons'); $TSFE->displayFieldEditIcons = $BE_USER->extGetFeAdminValue('edit', 'displayFieldIcons'); if (t3lib_div::_GP('ADMCMD_editIcons')) { $TSFE->displayFieldEditIcons = 1; $BE_USER->uc['TSFE_adminConfig']['edit_editNoPopup'] = 1; } if (t3lib_div::_GP('ADMCMD_simUser')) { $BE_USER->uc['TSFE_adminConfig']['preview_simulateUserGroup'] = intval(t3lib_div::_GP('ADMCMD_simUser')); $BE_USER->ext_forcePreview = 1; } if (t3lib_div::_GP('ADMCMD_simTime')) { $BE_USER->uc['TSFE_adminConfig']['preview_simulateDate'] = intval(t3lib_div::_GP('ADMCMD_simTime')); $BE_USER->ext_forcePreview = 1; } // Include classes for editing IF editing module in Admin Panel is open if ($BE_USER->extAdmModuleEnabled('edit') && $BE_USER->extIsAdmMenuOpen('edit') || $TSFE->displayEditIcons == 1) { $TSFE->includeTCA(); if ($BE_USER->extIsEditAction()) { require_once PATH_t3lib . 'class.t3lib_tcemain.php'; $BE_USER->extEditAction(); } if ($BE_USER->extIsFormShown()) { require_once PATH_t3lib . 'class.t3lib_tceforms.php'; require_once PATH_t3lib . 'class.t3lib_iconworks.php'; require_once PATH_t3lib . 'class.t3lib_loaddbgroup.php'; require_once PATH_t3lib . 'class.t3lib_transferdata.php'; } } if ($TSFE->forceTemplateParsing || $TSFE->displayEditIcons || $TSFE->displayFieldEditIcons) { $TSFE->set_no_cache(); } } // $WEBMOUNTS = (string)($BE_USER->groupData['webmounts'])!='' ? explode(',',$BE_USER->groupData['webmounts']) : Array(); // $FILEMOUNTS = $BE_USER->groupData['filemounts']; } else { // Unset the user initialization. $BE_USER = ''; $TSFE->beUserLogin = 0; } } elseif ($TSFE->ADMCMD_preview_BEUSER_uid) { require_once PATH_t3lib . 'class.t3lib_befunc.php'; require_once PATH_t3lib . 'class.t3lib_userauthgroup.php'; require_once PATH_t3lib . 'class.t3lib_beuserauth.php'; require_once PATH_t3lib . 'class.t3lib_tsfebeuserauth.php'; // the value this->formfield_status is set to empty in order to disable login-attempts to the backend account through this script $BE_USER = t3lib_div::makeInstance('t3lib_tsfeBeUserAuth'); // New backend user object $BE_USER->userTS_dontGetCached = 1; $BE_USER->OS = TYPO3_OS; $BE_USER->setBeUserByUid($TSFE->ADMCMD_preview_BEUSER_uid); $BE_USER->unpack_uc(''); if ($BE_USER->user['uid']) { $BE_USER->fetchGroupData(); $TSFE->beUserLogin = 1; } else { $BE_USER = ''; $TSFE->beUserLogin = 0; } } return $BE_USER; }
/** * Gets instance depending on TYPO3 version * @param $name name of the class * @param array $row row that is used to initialaze element instance * @return tx_languagevisibility_element */ private function getElementInstance($name, $row) { if (version_compare(TYPO3_version, '4.3.0', '<')) { require_once t3lib_extMgm::extPath("languagevisibility") . 'classes/class.' . $name . '.php'; $elementclass = t3lib_div::makeInstanceClassName($name); return new $elementclass($row); } else { return t3lib_div::makeInstance($name, $row); } }
/** * Creates TSFE for executing RealURL. Code idea comes from vara_feurlfrombe extension. * * @param int $pid Page uid * @return void */ function createTSFE($pid) { require_once(PATH_site.'typo3/sysext/cms/tslib/class.tslib_fe.php'); require_once(PATH_site.'t3lib/class.t3lib_userauth.php'); require_once(PATH_site.'typo3/sysext/cms/tslib/class.tslib_feuserauth.php'); require_once(PATH_site.'t3lib/class.t3lib_cs.php'); require_once(PATH_site.'typo3/sysext/cms/tslib/class.tslib_content.php') ; require_once(PATH_site.'t3lib/class.t3lib_tstemplate.php'); require_once(PATH_site.'t3lib/class.t3lib_page.php'); require_once(PATH_site.'t3lib/class.t3lib_timetrack.php'); $temp_TTclassName = t3lib_div::makeInstanceClassName('t3lib_timeTrack'); $GLOBALS['TT'] = new $temp_TTclassName(); $GLOBALS['TT']->start(); // Finds the TSFE classname $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe'); // Create the TSFE class. $GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'], $pid, '0', 0, '','','',''); $GLOBALS['TSFE']->config['config']['language']='default'; // Fire all the required function to get the typo3 FE all set up. $GLOBALS['TSFE']->id = $pid; $GLOBALS['TSFE']->connectToMySQL(); // Prevent mysql debug messages from messing up the output $sqlDebug = $GLOBALS['TYPO3_DB']->debugOutput; $GLOBALS['TYPO3_DB']->debugOutput = false; $GLOBALS['TSFE']->initLLVars(); $GLOBALS['TSFE']->initFEuser(); // Look up the page $GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect'); $GLOBALS['TSFE']->sys_page->init($GLOBALS['TSFE']->showHiddenPage); // If the page is not found (if the page is a sysfolder, etc), then return no URL, preventing any further processing which would result in an error page. $page = $GLOBALS['TSFE']->sys_page->getPage($pid); if (count($page) == 0) { $GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug; return false; } // If the page is a shortcut, look up the page to which the shortcut references, and do the same check as above. if ($page['doktype']==4 && count($GLOBALS['TSFE']->getPageShortcut($page['shortcut'],$page['shortcut_mode'],$page['uid'])) == 0) { $GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug; return false; } // Spacer pages and sysfolders result in a page not found page too... if ($page['doktype'] == 199 || $page['doktype'] == 254) { $GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug; return false; } $GLOBALS['TSFE']->getPageAndRootline(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->forceTemplateParsing = 1; // Find the root template $GLOBALS['TSFE']->tmpl->start($GLOBALS['TSFE']->rootLine); // Fill the pSetup from the same variables from the same location as where tslib_fe->getConfigArray will get them, so they can be checked before this function is called $GLOBALS['TSFE']->sPre = $GLOBALS['TSFE']->tmpl->setup['types.'][$GLOBALS['TSFE']->type]; // toplevel - objArrayName $GLOBALS['TSFE']->pSetup = $GLOBALS['TSFE']->tmpl->setup[$GLOBALS['TSFE']->sPre.'.']; // If there is no root template found, there is no point in continuing which would result in a 'template not found' page and then call exit php. Then there would be no clickmenu at all. // And the same applies if pSetup is empty, which would result in a "The page is not configured" message. if (!$GLOBALS['TSFE']->tmpl->loaded || ($GLOBALS['TSFE']->tmpl->loaded && !$GLOBALS['TSFE']->pSetup)) { $GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug; return false; } $GLOBALS['TSFE']->getConfigArray(); $GLOBALS['TSFE']->inituserGroups(); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TYPO3_DB']->debugOutput = $sqlDebug; return true; }
/** * Return classname for new instance * Takes the class-extensions API of TYPO3 into account * Usage: 17 * * @param string Base Class name to evaluate * @return string Final class name to instantiate with "new [classname]" * @deprecated since TYPO3 4.3 - Use t3lib_div::makeInstance('myClass', $arg1, $arg2, ..., $argN) */ public static function makeInstanceClassName($className) { self::logDeprecatedFunction(); return class_exists($className) && class_exists('ux_' . $className, false) ? t3lib_div::makeInstanceClassName('ux_' . $className) : $className; }
/** * Call back function for page tree traversal! * * @param string Table name * @param integer UID of record in processing * @param integer Echo level (see calling function * @param string Version swap mode on that level (see calling function * @param integer Is root version (see calling function * @return void */ function main_parseTreeCallBack($tableName, $uid, $echoLevel, $versionSwapmode, $rootIsVersion) { if ($tableName == 'pages' && $uid > 0) { if (!$versionSwapmode) { // Initialize TemplaVoila API class: $apiClassName = t3lib_div::makeInstanceClassName('tx_templavoila_api'); $apiObj = new $apiClassName('pages'); // Fetch the content structure of page: $contentTreeData = $apiObj->getContentTree('pages', t3lib_BEfunc::getRecordRaw('pages', 'uid=' . intval($uid))); if ($contentTreeData['tree']['ds_is_found']) { $usedUids = array_keys($contentTreeData['contentElementUsage']); $usedUids[] = 0; // Look up all content elements that are NOT used on this page... $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, header', 'tt_content', 'pid=' . intval($uid) . ' ' . 'AND uid NOT IN (' . implode(',', $usedUids) . ') ' . 'AND t3ver_state!=1' . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'uid'); // Traverse, for each find references if any and register them. while (false !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) { // Look up references to elements: $refrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_refindex', 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('tt_content', 'sys_refindex') . ' AND ref_uid=' . intval($row['uid']) . ' AND deleted=0'); // Register elements etc: $this->resultArray['all_unused'][$row['uid']] = array($row['header'], count($refrows)); if ($echoLevel > 2) { echo chr(10) . ' [tx_templavoila_unusedce:] tt_content:' . $row['uid'] . ' was not used on page...'; } if (!count($refrows)) { $this->resultArray['deleteMe'][$row['uid']] = $row['uid']; if ($echoLevel > 2) { echo ' and can be DELETED'; } } else { if ($echoLevel > 2) { echo ' but is referenced to (' . count($refrows) . ') so do not delete...'; } } } } else { if ($echoLevel > 2) { echo chr(10) . ' [tx_templavoila_unusedce:] Did not check page - did not have a Data Structure set.'; } } } else { if ($echoLevel > 2) { echo chr(10) . ' [tx_templavoila_unusedce:] Did not check page - was on offline page.'; } } } }
/** * Check if given element has traslation in given language * * @param int $elementUid * @param string $table * @param int $languageUid * @return boolean */ public static function hasTranslation($elementUid, $table, $languageUid) { $dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon'); if (version_compare(TYPO3_version, '4.3.0', '<')) { $elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory'); $elementfactory = new $elementfactoryName($dao); } else { $elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao); } $result = false; try { $element = $elementfactory->getElementForTable($table, $elementUid); $result = $element->hasTranslation($languageUid); } catch (UnexpectedValueException $e) { //the element can not be handeld by language visibility $result = false; } return $result; }
function setzeFeUserLinks() { require_once PATH_tslib . 'class.tslib_fe.php'; require_once PATH_t3lib . 'class.t3lib_cs.php'; require_once PATH_tslib . 'class.tslib_content.php'; require_once PATH_t3lib . 'class.t3lib_tstemplate.php'; require_once PATH_t3lib . 'class.t3lib_page.php'; $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe'); if (!is_object($GLOBALS['TT'])) { $GLOBALS['TT'] = new t3lib_timeTrack(); $GLOBALS['TT']->start(); } $GLOBALS['TSFE'] = new $TSFEclassName($GLOBALS['TYPO3_CONF_VARS'], $this->pid, '0', 1, '', '', '', ''); $GLOBALS['TSFE']->connectToMySQL(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->fetch_the_id(); $GLOBALS['TSFE']->getPageAndRootline(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site; $GLOBALS['TSFE']->forceTemplateParsing = 1; $GLOBALS['TSFE']->getConfigArray(); $cObj = t3lib_div::makeInstance('tslib_cObj'); $cObj->start(array(), ''); $urlParameters = array('L' => 0); $profilfelder = 'tx_hepersonen_akad_grad,username,first_name,last_name,tx_hepersonen_profilseite,tx_hepersonen_profildaten'; $profiltabelle = 'fe_users'; $benutzerGruppen = array('PROFESSOR', 'LB', 'MITARBEITER', 'PROJEKT-MA', 'HAUSMEISTER', 'SEKRETARIAT', 'LEITUNG', 'AUSZUBILDENDE'); $bedingungBenutzerGruppen = ' AND (' . tx_he_personen_util::gibBedingungBenutzergruppen($benutzerGruppen) . ') '; $profilbedingung = 'deleted=0 AND disable=0' . $bedingungBenutzerGruppen; $profilabfrage = $GLOBALS['TYPO3_DB']->exec_SELECTquery($profilfelder, $profiltabelle, $profilbedingung); while ($daten = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($profilabfrage)) { $linkUrl = $cObj->getTypoLink_URL($daten['tx_hepersonen_profilseite'], $urlParameters); $linkUrl = str_replace('.de/typo3/de', '.de/de', $linkUrl); $profil_array = unserialize($daten['tx_hepersonen_profildaten']); if (!is_array($profil_array)) { $profil_array = array(); $akadGrad = ''; } else { $akadGrad = $profil_array[prof_titel_liste]; if (empty($akadGrad)) { $akadGrad = $profil_array[akad_grad] . ' '; } else { $akadGrad .= ' '; } } $person = $akadGrad . $daten['first_name'] . ' ' . $daten['last_name']; $this->feUserLinks[$daten['username']] = '<a href="' . $linkUrl . '">' . $person . '</a>'; } }
/** * Initialisation of this backend module * * @return void * @access public */ function init() { parent::init(); $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']); $this->altRoot = t3lib_div::_GP('altRoot'); $this->versionId = t3lib_div::_GP('versionId'); // Fill array allAvailableLanguages and currently selected language (from language selector or from outside) $this->allAvailableLanguages = $this->getAvailableLanguages(0, true, true, true); $this->currentLanguageKey = $this->allAvailableLanguages[$this->MOD_SETTINGS['language']]['ISOcode']; $this->currentLanguageUid = $this->allAvailableLanguages[$this->MOD_SETTINGS['language']]['uid']; // If no translations exist for this page, set the current language to default (as there won't be a language selector) $this->translatedLanguagesArr = $this->getAvailableLanguages($this->id); if (count($this->translatedLanguagesArr) == 1) { // Only default language exists $this->currentLanguageKey = 'DEF'; } // Set translator mode if the default langauge is not accessible for the user: if (!$GLOBALS['BE_USER']->checkLanguageAccess(0) && !$GLOBALS['BE_USER']->isAdmin()) { $this->translatorMode = TRUE; } // Initialize side bar and wizards: $this->sideBarObj =& t3lib_div::getUserObj('&tx_templavoila_mod1_sidebar', ''); $this->sideBarObj->init($this); $this->sideBarObj->position = isset($this->modTSconfig['properties']['sideBarPosition']) ? $this->modTSconfig['properties']['sideBarPosition'] : 'toptabs'; $this->wizardsObj = t3lib_div::getUserObj('&tx_templavoila_mod1_wizards', ''); $this->wizardsObj->init($this); // Initialize TemplaVoila API class: $apiClassName = t3lib_div::makeInstanceClassName('tx_templavoila_api'); $this->apiObj = new $apiClassName($this->altRoot ? $this->altRoot : 'pages'); // Initialize the clipboard $this->clipboardObj =& t3lib_div::getUserObj('&tx_templavoila_mod1_clipboard', ''); $this->clipboardObj->init($this); // Initialize the record module $this->recordsObj =& t3lib_div::getUserObj('&tx_templavoila_mod1_records', ''); $this->recordsObj->init($this); }
/** * load($actid) * * Loads information from the database into the object * * This might throw an exception of class Exception in * case of errors, so be sure to catch it! * * @param $actid * Activity ID ('id'-field in tx_fdfactdb_activity) * NB: Do NOT use the ID from the _leg table. * * @return * Nothing. Member-function of class */ function load($actid) { $db = $GLOBALS['TYPO3_DB']; $query = "SELECT * FROM tx_fdfactdb_activity WHERE id = " . $db->fullQuoteStr($actid, "tx_fdfactdb_activity"); $res = $db->sql_query($query); $row = $db->sql_fetch_assoc($res); if ($row === false) { throw new Exception("ID " . $actid . " not found in database"); } $this->id = $actid; # type is already set # keys $keys = array('title', 'keywords', 'teaser', 'nb', 'description', 'participants_min', 'participants_max', 'duration_min', 'duration_max', 'age_min', 'age_max', 'author_name', 'author_email'); foreach ($keys as $v) { $this->{$v} = $row[$v]; } $db->sql_free_result($res); $res = $db->sql_query("\n SELECT category_id \n FROM tx_fdfactdb_activity_category \n WHERE activity_id = " . $db->fullQuoteStr($actid, "tx_fdfactdb_activity_category")); $cats = array(); while ($row = $db->sql_fetch_assoc($res)) { $cres = $db->sql_query("\n SELECT name, description\n FROM tx_fdfactdb_category\n WHERE id = " . $db->fullQuoteStr($row['category_id'], "tx_fdfactdb_category")); $crow = $db->sql_fetch_assoc($cres); if ($crow === false) { throw new Exception("Category ID " . $row['category_id'] . " doesn't exist in the tx_fdfactdb_category table!"); } $cats[$row['category_id']] = $crow; $db->sql_free_result($cres); } $db->sql_free_result($res); $this->categories = $cats; $res = $db->sql_query("\n SELECT ages_id \n FROM tx_fdfactdb_activity_ages_glue\n WHERE act_id = " . $db->fullQuoteStr($actid, "tx_fdfactdb_activity_ages_glue")); while ($row = $db->sql_fetch_assoc($res)) { $age = t3lib_div::makeInstanceClassName("tx_user_fdf_actdb_cc_age"); $age = new $age($row['ages_id']); $this->ages[$row['ages_id']] = $age; } $db->sql_free_result($res); # Lege-specifikt stuff $res = $db->sql_query("SELECT * FROM tx_fdfactdb_activity_leg WHERE activity_id = " . $db->fullQuoteStr($actid, 'tx_fdfactdb_activity_leg')); $row = $db->sql_fetch_assoc($res); if ($row === false) { throw new Exception("ID " . $actid . " doesn't have associated type-specific data. Time to call your resident IT-guy"); } $keys = array('place', 'materials', 'indoor', 'outdoor'); foreach ($keys as $v) { $this->{$v} = $row[$v]; } $db->sql_free_result($res); }
/** * [Describe function...] * * @return [type] ... */ function __virtualizeFE($aConfig = FALSE) { if (array_key_exists("TYPO3_CONF_VARS", $GLOBALS) && array_key_exists("SC_OPTIONS", $GLOBALS["TYPO3_CONF_VARS"]) && array_key_exists("t3lib/class.t3lib_userauth.php", $GLOBALS["TYPO3_CONF_VARS"]["SC_OPTIONS"]) && array_key_exists("logoff_post_processing", $GLOBALS["TYPO3_CONF_VARS"]["SC_OPTIONS"]["t3lib/class.t3lib_userauth.php"]) && ($iPos = array_search("tx_phpmyadmin_utilities->pmaLogOff", $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'])) !== FALSE) { // deactivating the logoff-hook of PMA, that changes the session_name (!) and causes the session to be incorrectly saved at the end of PHP execution unset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'][$iPos]); } if (!defined('PATH_tslib')) { if (@is_dir(PATH_site . TYPO3_mainDir . 'sysext/cms/tslib/')) { define('PATH_tslib', PATH_site . TYPO3_mainDir . 'sysext/cms/tslib/'); } elseif (@is_dir(PATH_site . 'tslib/')) { define('PATH_tslib', PATH_site . 'tslib/'); } } /* require_once(PATH_tslib.'class.tslib_content.php'); require_once(PATH_t3lib.'class.t3lib_timetrack.php'); require_once(PATH_tslib.'class.tslib_fe.php'); require_once(PATH_t3lib.'class.t3lib_page.php'); require_once(PATH_t3lib.'class.t3lib_userauth.php'); require_once(PATH_tslib.'class.tslib_feuserauth.php'); require_once(PATH_t3lib.'class.t3lib_tstemplate.php'); require_once(PATH_t3lib.'class.t3lib_cs.php'); */ $GLOBALS["TT"] = new t3lib_timeTrack(); $GLOBALS["CLIENT"] = t3lib_div::clientInfo(); // *********************************** // Create $TSFE object (TSFE = TypoScript Front End) // Connecting to database // *********************************** if (t3lib_div::int_from_ver(TYPO3_version) >= t3lib_div::int_from_ver('4.3.0')) { // makeInstanceClassName is deprecated since TYPO3 4.3.0 $GLOBALS["TSFE"] = t3lib_div::makeInstance('tslib_fe', $GLOBALS["TYPO3_CONF_VARS"], t3lib_div::_GP('id'), t3lib_div::_GP('type'), t3lib_div::_GP('no_cache'), t3lib_div::_GP('cHash'), t3lib_div::_GP('jumpurl'), t3lib_div::_GP('MP'), t3lib_div::_GP('RDCT')); } else { $temp_TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe'); $GLOBALS["TSFE"] = new $temp_TSFEclassName($GLOBALS["TYPO3_CONF_VARS"], t3lib_div::_GP('id'), t3lib_div::_GP('type'), t3lib_div::_GP('no_cache'), t3lib_div::_GP('cHash'), t3lib_div::_GP('jumpurl'), t3lib_div::_GP('MP'), t3lib_div::_GP('RDCT')); } //$GLOBALS["TSFE"]->forceTemplateParsing = TRUE; //$GLOBALS['TSFE']->absRefPrefix = "/"; $GLOBALS["TSFE"]->connectToDB(); $GLOBALS["TSFE"]->initFEuser(); $GLOBALS["TSFE"]->determineId(); # catching TYPO34.5+ exceptions (when registering cache handler) if ($sExecMode !== "BE" && $sExecMode !== "FE") { $GLOBALS["TSFE"]->getCompressedTCarray(); } $GLOBALS["TSFE"]->initTemplate(); $GLOBALS["TSFE"]->getFromCache(); if (!is_array($GLOBALS["TSFE"]->config)) { $GLOBALS["TSFE"]->config = array(); $GLOBALS["TSFE"]->forceTemplateParsing = TRUE; } if ($aConfig === FALSE) { $GLOBALS["TSFE"]->getConfigArray(); } else { $GLOBALS["TSFE"]->config = $aConfig; } $GLOBALS["TSFE"]->convPOSTCharset(); $GLOBALS["TSFE"]->settingLanguage(); $GLOBALS["TSFE"]->settingLocale(); $GLOBALS["TSFE"]->cObj = t3lib_div::makeInstance('tslib_cObj'); }
/** * * @param unknown_type $table * @param unknown_type $id * @return */ protected function getContextElement($table, $id) { $dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon'); if (version_compare(TYPO3_version, '4.3.0', '<')) { $elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory'); $elementfactory = new $elementfactoryName($dao); } else { $elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao); } try { $element = $elementfactory->getElementForTable('pages', $uid); } catch (Exception $e) { return '-'; } return $element; }
/** * This method is used to get all bequeathing elements of an element (makes only sence for pages) * it checks if there is any element in the rootline which has any inherited visibility setting (like no+, yes+) as configured visibility. * * @param tx_languagevisibility_language * @param tx_languagevisibility_element * * @return tx_languagevisibility_visibility $visibility */ protected function getInheritedVisibility(tx_languagevisibility_language $language, tx_languagevisibility_element $element) { $dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon'); if (version_compare(TYPO3_version, '4.3.0', '<')) { $elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory'); $elementfactory = new $elementfactoryName($dao); } else { $elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao); } $elements = $elementfactory->getParentElementsFromElement($element, $language); if (is_array($elements) && count($elements) > 0) { foreach ($elements as $element) { /* @var $element tx_languagevisibility_pageelement */ $visibility = new tx_languagevisibility_visibility(); $visibility->setVisibilityString($element->getLocalVisibilitySetting($language->getUid())); //is the setting a inheritable setting: if ($visibility->getVisibilityString() == 'no+' || $visibility->getVisibilityString() == 'yes+') { $visibility->setVisibilityDescription('inherited from uid ' . $element->getUid()); return $visibility; } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['languagevisibility']['getInheritedVisibility'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['languagevisibility']['getInheritedVisibility'] as $classRef) { $hookObj = t3lib_div::getUserObj($classRef); if (method_exists($hookObj, 'getInheritedVisibility')) { $visibility = $hookObj->getInheritedVisibility($language, $elements, $element); if (substr($visibility->getVisibilityString(), -1) == '+') { return $visibility; } } } } $visibility = new tx_languagevisibility_visibility(); $visibility->setVisibilityString('-'); return $visibility; }