/** * Renders the form in the kickstarter; this was add_cat_modulefunction() * * @return HTML */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; // Enter title of the module function $subContent = '<strong>Enter the title of function-menu item:</strong><br />' . $this->renderStringBox_lang('title', $ffPrefix, $piConf); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Position $optValues = array('web_func' => 'Web>Func', 'web_func_wizards' => 'Web>Func, Wizards', 'web_info' => 'Web>Info', 'web_ts' => 'Web>Template', 'user_task' => 'User>Task Center'); $subContent = '<strong>Sub- or main module?</strong><br />' . $this->renderSelectBox($ffPrefix . '[position]', $piConf['position'], $optValues) . '<br /><br />These images gives you an idea what the options above means:' . $this->resImg('modulefunc_task.png') . $this->resImg('modulefunc_func.png'); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_moduleFunction'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_moduleFunction'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Renders the form in the kickstarter; this was add_cat_languages() * * @return HTML */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $action[1] = 1; $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; $subContent = ''; reset($this->wizard->languages); while (list($k, $v) = each($this->wizard->languages)) { $key = $ffPrefix . '[' . $k . ']'; $subContent .= $this->renderCheckBox($key, $piConf[$k]) . '<label for="field_' . md5($key) . '">' . $v . '</label><br />'; } $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($this->textSetup('Select which languages to setup:', $subContent)) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_languages'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_languages'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Renders the form in the kickstarter; this was add_cat_() * * @return string ... */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $action[1] = 1; $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; // Enter Page TSconfige $subContent = '<strong>Default Page TSconfig:</strong><br />' . $this->renderTextareaBox($ffPrefix . '[page_TSconfig]', $piConf['page_TSconfig']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Enter User TSconfig $subContent = '<strong>Default User TSconfig:</strong><br />' . $this->renderTextareaBox($ffPrefix . '[user_TSconfig]', $piConf['user_TSconfig']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_tsconfig'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_tsconfig'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Renders the form in the kickstarter * * @return string wizard */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; // Enter title of the static extension template $subContent = '<strong>Enter a title for the static extension template:</strong><br />' . $this->renderStringBox($ffPrefix . '[title]', $piConf['title']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Enter constants $subContent = '<strong>Constants:</strong><br />' . $this->renderTextareaBox($ffPrefix . '[constants]', $piConf['constants']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Enter setup $subContent = '<strong>Setup:</strong><br />' . $this->renderTextareaBox($ffPrefix . '[setup]', $piConf['setup']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_ts'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_ts'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Function to call hooks from any extension * * @param string $extKey: Unique extension key * @param string $theHook: Name of hook * @param mixed $parameter: Parameter to assign to function * @param mixed $ref: Reference to calling object * @return void * */ public static function callHookObjects($extKey, $theHook, &$parameter, &$ref) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$theHook])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$theHook] as $funcRef) { t3lib_div::callUserFunction($funcRef, $parameter, $ref); } } }
/** * processes certain hooks for each section * * @param string hook name * @param array the data to proces by the hook * @return array the processed data */ function &process_hook($hookName, &$data) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter'][$this->sectionID][$hookName])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter'][$this->sectionID][$hookName] as $_funcRef) { $data =& t3lib_div::callUserFunction($_funcRef, $data, $this); } } return $data; }
/** * Routes the given eID action to the related ExtDirect method with the necessary * ajax object. * * @return void */ public function routeAction() { tslib_eidtools::initLanguage(); tslib_eidtools::connectDB(); $ajaxID = t3lib_div::_GP('action'); $ajaxScript = $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['ExtDirect::' . $ajaxID]; $this->ajaxObject = t3lib_div::makeInstance('TYPO3AJAX', 'ExtDirect::' . $ajaxID); $parameters = array(); t3lib_div::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, FALSE, TRUE); }
function processOutput() { if ($GLOBALS['TSFE']->type != $GLOBALS['pdf_generator2_parameters']['typeNum']) { parent::processOutput(); } else { $_params = array('pObj' => &$this); require_once t3lib_div::getFileAbsFileName('EXT:pdf_generator2/class.tx_pdfgenerator2.php'); t3lib_div::callUserFunction("tx_pdfgenerator2->tslib_fe_processOutput", $_params, $this); } }
/** * Renders the form in the kickstarter; this was add_cat_() * * @return string wizard */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], '<strong>Edit Service #' . $action[1] . '</strong>', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; if (!$this->wizard->EMmode && $this->wizard->saveKey) { $extKeyRec = $this->wizard->pObj->getExtKeyRecord($this->saveKey); } // Title $subContent = '<strong>Title:</strong><br />' . $this->renderStringBox($ffPrefix . '[title]', $piConf['title'] ? $piConf['title'] : $extKeyRec['title']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Description $subContent = '<strong>Description:</strong><br />' . $this->renderStringBox($ffPrefix . '[description]', $piConf['description'] ? $piConf['description'] : $extKeyRec['description']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; $lines[] = '<tr><td> </td><td></td></tr>'; // Type $subContent = '<strong>Service type:</strong><br />' . $this->renderStringBox($ffPrefix . '[type]', $piConf['type'] ? $piConf['type'] : $extKeyRec['type']) . '<br />' . 'Enter here the key to define which type of service this should be.<br />Examples: "textExtract", "metaExtract".'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // SubType $subContent = '<strong>Sub type(s) (comma list):</strong><br />' . $this->renderStringBox($ffPrefix . '[subtype]', $piConf['subtype'] ? $piConf['subtype'] : $extKeyRec['subtype']) . '<br />' . 'Possible subtypes are defined by the service type.<br />You have read the service type documentation.<br />Example: using subtypes for file types (doc, txt, pdf, ...) the service might work for.'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; $lines[] = '<tr><td> </td><td></td></tr>'; // Priority $optValues = array('50' => 'default (50)', '10' => 'very low (10)', '20' => 'low (20)', '40' => 'bit lower (40)', '60' => 'bit higher (60)', '80' => 'high (80)', '100' => 'Very high (100)'); $subContent = '<strong>Priority:</strong><br />' . $this->renderSelectBox($ffPrefix . '[priority]', $piConf['priority'], $optValues) . '<br />' . '50 = medium priority. <br />The priority of services can be changed by admin configuration.'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Quality $quality = $piConf['quality'] ? $piConf['quality'] : $extKeyRec['quality']; $quality = $quality ? $quality : '50'; $subContent = '<strong>Quality:</strong><br />' . $this->renderStringBox($ffPrefix . '[quality]', $quality) . '<br />' . 'The numbering of the quality is defined by the service type.<br />You have read the service type documentation.<br />The default quality range is 0-100.'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // OS Dependencies $optValues = array('' => 'no special dependency', 'unix' => 'Unix only', 'win' => 'Windows only'); $lines[] = '<tr><td> </td><td></td></tr>'; $subContent = '<strong>Operating System dependency:</strong><br />' . $this->renderSelectBox($ffPrefix . '[os]', $piConf['os'], $optValues); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Exec dependencies $subContent = '<strong>External program(s) (comma list):</strong><br />' . $this->renderStringBox($ffPrefix . '[exec]', $piConf['exec']) . '<br />' . 'Program(s) needed to run this service (eg. "perl").'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_services'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_services'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Renders the form in the kickstarter; this was add_cat_fields() * * @return string HTML code */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; } // Header field $optValues = array('tt_content' => 'tt_content (Content)', 'fe_users' => 'fe_users (Frontend Users)', 'fe_groups' => 'fe_groups (Frontend Groups)', 'be_users' => 'be_users (Backend Users)', 'be_groups' => 'be_groups (Backend Groups)', 'pages' => 'pages (Pages)'); foreach ($GLOBALS['TCA'] as $tablename => $tableTCA) { if (!$optValues[$tablename]) { $optValues[$tablename] = $tablename . ' (' . $GLOBALS['LANG']->sL($tableTCA['ctrl']['title']) . ')'; } } asort($optValues); $subContent = '<strong>Which table:<br /></strong>' . $this->renderSelectBox($ffPrefix . '[which_table]', $piConf['which_table'], $optValues) . $this->whatIsThis('Select the table which should be extended with these extra fields.'); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '<input type="hidden" name="' . $this->piFieldName('wizArray_upd') . $ffPrefix . '[title]" value="' . ($piConf['which_table'] ? $optValues[$piConf['which_table']] : '') . '" /></td></tr>'; // PRESETS: $selPresetBox = $this->presetBox($piConf['fields']); // Fields $c = array(0); $this->usedNames = array(); if (is_array($piConf['fields'])) { $piConf['fields'] = $this->cleanFieldsAndDoCommands($piConf['fields'], $this->sectionID, $action[1], $piConf['which_table'] ? $piConf['which_table'] : ''); // Do it for real... reset($piConf['fields']); while (list($k, $v) = each($piConf['fields'])) { $c[] = $k; $subContent = $this->renderField($ffPrefix . '[fields][' . $k . ']', $v); $lines[] = '<tr' . $this->bgCol(2) . '><td>' . $this->fw('<strong>FIELD:</strong> <em>' . $v['fieldname'] . '</em>') . '</td></tr>'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } } // New field: $k = max($c) + 1; $v = array(); $lines[] = '<tr' . $this->bgCol(2) . '><td>' . $this->fw('<strong>NEW FIELD:</strong>') . '</td></tr>'; $subContent = $this->renderField($ffPrefix . '[fields][' . $k . ']', $v, 1); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw('<br /><br />Load preset fields: <br />' . $selPresetBox) . '</td></tr>'; /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_fields'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_fields'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Proxy for the PHP mail() function. Adds possibility to hook in and send the mails in a different way. * The hook can be used by adding function to the configuration array: * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'] * * @param string Email address to send to. * @param string Subject line, non-encoded. (see PHP function mail()) * @param string Message content, non-encoded. (see PHP function mail()) * @param string Additional headers for the mail (see PHP function mail()) * @param string Additional flags for the sending mail tool (see PHP function mail()) * @return boolean Indicates whether the mail has been sent or not * @see PHP function mail() [] * @link http://www.php.net/manual/en/function.mail.php */ public static function mail($to, $subject, $messageBody, $additionalHeaders = NULL, $additionalParameters = NULL) { $success = TRUE; // If the mail does not have a From: header, fall back to the default in TYPO3_CONF_VARS. if (!preg_match('/^From:/im', $additionalHeaders) && $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']) { if (!is_null($additionalHeaders) && substr($additionalHeaders, -1) != LF) { $additionalHeaders .= LF; } if ($GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName']) { $additionalHeaders .= 'From: "' . $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromName'] . '" <' . $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress'] . '>'; } else { $additionalHeaders .= 'From: ' . $GLOBALS['TYPO3_CONF_VARS']['MAIL']['defaultMailFromAddress']; } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'])) { $parameters = array('to' => $to, 'subject' => $subject, 'messageBody' => $messageBody, 'additionalHeaders' => $additionalHeaders, 'additionalParameters' => $additionalParameters); $fakeThis = FALSE; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'] as $hookSubscriber) { $hookSubscriberContainsArrow = strpos($hookSubscriber, '->'); if ($hookSubscriberContainsArrow !== FALSE) { // deprecated, remove in TYPO3 4.7 t3lib_div::deprecationLog('The usage of user function notation for the substituteMailDelivery hook is deprecated, use the t3lib_mail_MailerAdapter interface instead.'); $success = $success && t3lib_div::callUserFunction($hookSubscriber, $parameters, $fakeThis); } else { $mailerAdapter = t3lib_div::makeInstance($hookSubscriber); if ($mailerAdapter instanceof t3lib_mail_MailerAdapter) { $success = $success && $mailerAdapter->mail($to, $subject, $messageBody, $additionalHeaders, $additionalParameters, $fakeThis); } else { throw new RuntimeException($hookSubscriber . ' is not an implementation of t3lib_mail_MailerAdapter, but must implement that interface to be used in the substituteMailDelivery hook.', 1294062286); } } } } else { if (t3lib_utility_PhpOptions::isSafeModeEnabled() && !is_null($additionalParameters)) { $additionalParameters = null; } if (is_null($additionalParameters)) { $success = @mail($to, $subject, $messageBody, $additionalHeaders); } else { $success = @mail($to, $subject, $messageBody, $additionalHeaders, $additionalParameters); } } if (!$success) { t3lib_div::sysLog('Mail to "' . $to . '" could not be sent (Subject: "' . $subject . '").', 'Core', 3); } return $success; }
/** * * @param array $row * @return string */ protected function getExtraInfo($row) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']])) { $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info'][$row['list_type']]; } elseif (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT'])) { $hookArr = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['list_type_Info']['_DEFAULT']; } $extraInfo = ''; if (count($hookArr) > 0) { $_params = array('pObj' => &$this, 'row' => $row, 'infoArr' => $infoArr); foreach ($hookArr as $_funcRef) { $extraInfo .= t3lib_div::callUserFunction($_funcRef, $_params, $this); } } return $extraInfo ? $extraInfo : ''; }
/** * Setting the language key that'll be used by the current page. * In this function it should be checked, 1) that this language exists, 2) that a page_overlay_record exists, .. and if not the default language, 0 (zero), should be set. * * @return void * @access private */ function settingLanguage() { if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'])) { $_params = array(); foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_preProcess'] as $_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } } parent::settingLanguage(); if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_postProcess'])) { $_params = array(); foreach ($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['settingLanguage_postProcess'] as $_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } } }
/** * Renders the form in the kickstarter; this was add_cat_emconf() * * @return [type] ... */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $action[1] = 1; $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; if (!$this->wizard->EMmode && $this->wizard->saveKey) { $extKeyRec = $this->wizard->pObj->getExtKeyRecord($this->wizard->saveKey); } // Title $subContent = '<strong>Title:</strong><br />' . $this->renderStringBox($ffPrefix . '[title]', $piConf['title'] ? $piConf['title'] : $extKeyRec['title']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Description $subContent = '<strong>Description:</strong><br />' . $this->renderTextareaBox($ffPrefix . '[description]', $piConf['description'] ? $piConf['description'] : $extKeyRec['description']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Sub-position $optValues = array('' => '', 'fe' => 'Frontend', 'plugin' => 'Frontend Plugins', 'be' => 'Backend', 'module' => 'Backend Modules', 'services' => 'Services', 'example' => 'Examples', 'misc' => 'Miscellaneous', 'templates' => 'Templates', 'doc' => 'Documentation'); $subContent = '<strong>Category:</strong><br />' . $this->renderSelectBox($ffPrefix . '[category]', $piConf['category'], $optValues); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // State $optValues = array('alpha' => 'Alpha (Very initial development)', 'beta' => 'Beta (Under current development, should work partly)', 'stable' => 'Stable (Stable and used in production)', 'experimental' => 'Experimental (Nobody knows if this is going anywhere yet...)', 'test' => 'Test (Test extension, demonstrates concepts etc.)'); $subContent = '<strong>State</strong><br />' . $this->renderSelectBox($ffPrefix . '[state]', $piConf['state'], $optValues); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Dependencies $subContent = '<strong>Dependencies (comma list of extkeys):</strong><br />' . $this->renderStringBox($ffPrefix . '[dependencies]', $piConf['dependencies']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Author $subContent = '<strong>Author Name:</strong><br />' . $this->renderStringBox($ffPrefix . '[author]', $piConf['author'] ? $piConf['author'] : $GLOBALS['BE_USER']->user['realName']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Author/Email $subContent = '<strong>Author email:</strong><br />' . $this->renderStringBox($ffPrefix . '[author_email]', $piConf['author_email'] ? $piConf['author_email'] : $GLOBALS['BE_USER']->user['email']); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_emconf'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_emconf'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Proxy for the PHP mail() function. Adds possibility to hook in and send the mails in a different way. * The hook can be used by adding function to the configuration array: * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'] * * @param string Email address to send to. * @param string Subject line, non-encoded. (see PHP function mail()) * @param string Message content, non-encoded. (see PHP function mail()) * @param string Additional headers for the mail (see PHP function mail()) * @param string Additional flags for the sending mail tool (see PHP function mail()) * @return boolean Indicates whether the mail has been sent or not * @see PHP function mail() [] * @link http://www.php.net/manual/en/function.mail.php */ public static function mail($to, $subject, $messageBody, $additionalHeaders = null, $additionalParameters = null) { $success = TRUE; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'])) { $parameters = array('to' => $to, 'subject' => $subject, 'messageBody' => $messageBody, 'additionalHeaders' => $additionalHeaders, 'additionalParameters' => $additionalParameters); $fakeThis = FALSE; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/utility/class.t3lib_utility_mail.php']['substituteMailDelivery'] as $hookMethod) { $success = $success && t3lib_div::callUserFunction($hookMethod, $parameters, $fakeThis); } } else { $success = @mail($to, $subject, $messageBody, $additionalHeaders, $additionalParameters); } if (!$success) { t3lib_div::sysLog('Mail to "' . $email . '" could not be sent (Subject: "' . $subject . '").', 'Core', 3); } return $success; }
/** * The main method of the plugin * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return string The content that is displayed on the website */ public function main($content, $conf) { $content = parent::main($content, $conf); // Process the redirect (without cookie warning) if (($this->logintype === 'login' || $this->logintype === 'logout') && $this->redirectUrl && !$this->noRedirect) { // Add hook for extra processing before redirect if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['beforeRedirect']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['beforeRedirect'])) { $_params = array('loginType' => $this->logintype, 'redirectUrl' => &$this->redirectUrl); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['beforeRedirect'] as $_funcRef) { if ($_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } } } t3lib_utility_Http::redirect($this->redirectUrl); } return $content; }
/** * Renders the form in the kickstarter; this was add_cat_module() * * @return HTML */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], ' ', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; // Enter title of the module $subContent = '<strong>Enter a title for the module:</strong><br />' . $this->renderStringBox_lang('title', $ffPrefix, $piConf); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Description $subContent = '<strong>Enter a description:</strong><br />' . $this->renderStringBox_lang('description', $ffPrefix, $piConf); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Description $subContent = '<strong>Enter a tab label (shorter description):</strong><br />' . $this->renderStringBox_lang('tablabel', $ffPrefix, $piConf); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Position $optValues = array('web' => 'Sub in Web-module', 'file' => 'Sub in File-module', 'user' => 'Sub in User-module', 'tools' => 'Sub in Tools-module', 'help' => 'Sub in Help-module', '_MAIN' => 'New main module'); $subContent = '<strong>Sub- or main module?</strong><br />' . $this->renderSelectBox($ffPrefix . '[position]', $piConf['position'], $optValues) . $this->resImg('module.png'); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Sub-position $optValues = array('0' => 'Bottom (default)', 'top' => 'Top', 'web_after_page' => 'If in Web-module, after Web>Page', 'web_before_info' => 'If in Web-module, before Web>Info'); $subContent = '<strong>Position in module menu?</strong><br />' . $this->renderSelectBox($ffPrefix . '[subpos]', $piConf['subpos'], $optValues); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // docheaders $subContent = '<strong>Backend Module with docheaders</strong>' . $this->resImg('docheader.png') . $this->renderCheckBox($ffPrefix . '[docheader]', $piConf['docheader']) . 'Use docheader<br />'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Admin only $subContent = '<strong>Other settings</strong><br />' . $this->renderCheckBox($ffPrefix . '[admin_only]', $piConf['admin_only']) . 'Admin-only access!<br />'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Options $subContent = $this->renderCheckBox($ffPrefix . '[interface]', $piConf['interface']) . 'Allow other extensions to interface with function menu<br />'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_module'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_module'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border=0 cellpadding=2 cellspacing=2>' . implode('', $lines) . '</table>'; return $content; }
/** * @static * @param $url * @param string $fallback * @return mixed */ public static function findRedirectUrl($url, $fallback = '') { $res = ''; if (!empty($fallback)) { $res = $fallback; } if (!empty($url)) { $parts = parse_url($url); if (!empty($parts['query'])) { $query = t3lib_div::explodeUrl2Array($parts['query']); if (!empty($query['redirect_url'])) { $res = $query['redirect_url']; } } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['redirectUrl_postProcess'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ajaxlogin']['redirectUrl_postProcess'] as $_funcRef) { $_params = array('urlParts' => $parts, 'queryParts' => $query, 'redirect_url' => &$res); t3lib_div::callUserFunction($_funcRef, $_params, $this); } } return self::sanitizeUrl($res); }
/** * Save the content from t3editor retrieved via Ajax * * new Ajax.Request('/dev/t3e/dummy/typo3/ajax.php', { * parameters: { * ajaxID: 'tx_t3editor::saveCode', * t3editor_savetype: 'tx_tstemplateinfo' * } * }); * * @param array params Parameters (not used yet) * @param TYPO3AJAX ajaxObj AjaxObject to handle response */ public function ajaxSaveCode($params, $ajaxObj) { // cancel if its not an Ajax request if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) { $ajaxObj->setContentFormat('json'); $codeType = t3lib_div::_GP('t3editor_savetype'); $savingsuccess = false; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/t3editor/classes/class.tx_t3editor.php']['ajaxSaveCode'])) { $_params = array('pObj' => &$this, 'type' => $codeType); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/t3editor/classes/class.tx_t3editor.php']['ajaxSaveCode'] as $key => $_funcRef) { $savingsuccess = t3lib_div::callUserFunction($_funcRef, $_params, $this) || $savingsuccess; } } $ajaxObj->setContent(array('result' => $savingsuccess)); } }
/** * Parsing the $this->raw TypoScript lines from pointer, $this->rawP * * @param array Reference to the setup array in which to accumulate the values. * @return string Returns the string of the condition found, the exit signal or possible nothing (if it completed parsing with no interruptions) */ function parseSub(&$setup) { global $TYPO3_CONF_VARS; while (isset($this->raw[$this->rawP])) { $line = ltrim($this->raw[$this->rawP]); $lineP = $this->rawP; $this->rawP++; if ($this->syntaxHighLight) { $this->regHighLight("prespace", $lineP, strlen($line)); } // Breakpoint? if ($this->breakPointLN && $this->lineNumberOffset + $this->rawP - 1 == $this->breakPointLN + 1) { // by adding 1 we get that line processed return '[_BREAK]'; } // Set comment flag? if (!$this->multiLineEnabled && substr($line, 0, 2) == '/*') { $this->commentSet = 1; } if (!$this->commentSet && ($line || $this->multiLineEnabled)) { // If $this->multiLineEnabled we will go and get the line values here because we know, the first if() will be true. if ($this->multiLineEnabled) { // If multiline is enabled. Escape by ')' if ($this->multiLineHeredoc === FALSE && substr($line, 0, 1) == ')' || $this->multiLineHeredoc !== FALSE && substr($line, 0, strlen($this->multiLineHeredoc . ";")) === $this->multiLineHeredoc . ";") { // Multiline ends... if ($this->syntaxHighLight) { $this->regHighLight("operator", $lineP, strlen($line) - 1); } $this->multiLineEnabled = 0; // Disable multiline $this->multiLineHeredoc = FALSE; $theValue = implode($this->multiLineValue, chr(10)); if (strstr($this->multiLineObject, '.')) { $this->setVal($this->multiLineObject, $setup, array($theValue)); // Set the value deeper. } else { $setup[$this->multiLineObject] = $theValue; // Set value regularly if ($this->lastComment && $this->regComments) { $setup[$this->multiLineObject . '..'] .= $this->lastComment; } if ($this->regLinenumbers) { $setup[$this->multiLineObject . '.ln..'][] = $this->lineNumberOffset + $this->rawP - 1; } } } else { if ($this->syntaxHighLight) { $this->regHighLight("value", $lineP); } $this->multiLineValue[] = $this->raw[$this->rawP - 1]; } } elseif ($this->inBrace == 0 && substr($line, 0, 1) == '[') { // Beginning of condition (only on level zero compared to brace-levels if ($this->syntaxHighLight) { $this->regHighLight("condition", $lineP); } return $line; } else { if (substr($line, 0, 1) == '[' && strtoupper(trim($line)) == '[GLOBAL]') { // Return if GLOBAL condition is set - no matter what. if ($this->syntaxHighLight) { $this->regHighLight("condition", $lineP); } $this->error('Line ' . ($this->lineNumberOffset + $this->rawP - 1) . ': On return to [GLOBAL] scope, the script was short of ' . $this->inBrace . ' end brace(s)', 1); $this->inBrace = 0; return $line; } elseif (strcspn($line, '}#/') != 0) { // If not brace-end or comment $varL = strcspn($line, ' {=<>:('); // Find object name string until we meet an operator $objStrName = trim(substr($line, 0, $varL)); if ($this->syntaxHighLight) { $this->regHighLight("objstr", $lineP, strlen(substr($line, $varL))); } if (strlen($objStrName)) { $r = array(); if ($this->strict && preg_match('/[^[:alnum:]_\\.-]/i', $objStrName, $r)) { $this->error('Line ' . ($this->lineNumberOffset + $this->rawP - 1) . ': Object Name String, "' . htmlspecialchars($objStrName) . '" contains invalid character "' . $r[0] . '". Must be alphanumeric or one of: "_-."'); } else { $line = ltrim(substr($line, $varL)); if ($this->syntaxHighLight) { $this->regHighLight("objstr_postspace", $lineP, strlen($line)); if (strlen($line) > 0) { $this->regHighLight("operator", $lineP, strlen($line) - 1); $this->regHighLight("operator_postspace", $lineP, strlen(ltrim(substr($line, 1)))); } } // Checking for special TSparser properties (to change TS values at parsetime) $match = array(); if (preg_match('/^:=([^\\(]+)\\((.+)\\).*/', $line, $match)) { $tsFunc = trim($match[1]); $tsFuncArg = $match[2]; list($currentValue) = $this->getVal($objStrName, $setup); switch ($tsFunc) { case 'prependString': $newValue = $tsFuncArg . $currentValue; break; case 'appendString': $newValue = $currentValue . $tsFuncArg; break; case 'removeString': $newValue = str_replace($tsFuncArg, '', $currentValue); break; case 'replaceString': list($fromStr, $toStr) = explode('|', $tsFuncArg, 2); $newValue = str_replace($fromStr, $toStr, $currentValue); break; case 'addToList': $newValue = (strcmp('', $currentValue) ? $currentValue . ',' : '') . trim($tsFuncArg); break; case 'removeFromList': $existingElements = t3lib_div::trimExplode(',', $currentValue); $removeElements = t3lib_div::trimExplode(',', $tsFuncArg); if (count($removeElements)) { $newValue = implode(',', array_diff($existingElements, $removeElements)); } break; default: if (isset($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsparser.php']['preParseFunc'][$tsFunc])) { $hookMethod = $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tsparser.php']['preParseFunc'][$tsFunc]; $params = array('currentValue' => $currentValue, 'functionArgument' => $tsFuncArg); $fakeThis = FALSE; $newValue = t3lib_div::callUserFunction($hookMethod, $params, $fakeThis); } else { t3lib_div::sysLog('Missing function definition for ' . $tsFunc . ' on TypoScript line ' . $lineP, 'Core', 2); } } if (isset($newValue)) { $line = '= ' . $newValue; } } switch (substr($line, 0, 1)) { case '=': if ($this->syntaxHighLight) { $this->regHighLight('value', $lineP, strlen(ltrim(substr($line, 1))) - strlen(trim(substr($line, 1)))); } if (strstr($objStrName, '.')) { $value = array(); $value[0] = trim(substr($line, 1)); $this->setVal($objStrName, $setup, $value); } else { $setup[$objStrName] = trim(substr($line, 1)); if ($this->lastComment && $this->regComments) { // Setting comment.. $setup[$objStrName . '..'] .= $this->lastComment; } if ($this->regLinenumbers) { $setup[$objStrName . '.ln..'][] = $this->lineNumberOffset + $this->rawP - 1; } } break; case '{': $this->inBrace++; if (strstr($objStrName, '.')) { $exitSig = $this->rollParseSub($objStrName, $setup); if ($exitSig) { return $exitSig; } } else { if (!isset($setup[$objStrName . '.'])) { $setup[$objStrName . '.'] = array(); } $exitSig = $this->parseSub($setup[$objStrName . '.']); if ($exitSig) { return $exitSig; } } break; case '(': $this->multiLineObject = $objStrName; $this->multiLineEnabled = 1; $this->multiLineValue = array(); break; case '<': if (substr($line, 0, 3) === "<<<") { $this->multiLineObject = $objStrName; $this->multiLineEnabled = 1; $this->multiLineValue = array(); $this->multiLineHeredoc = trim(substr($line, 3)); } else { if ($this->syntaxHighLight) { $this->regHighLight("value_copy", $lineP, strlen(ltrim(substr($line, 1))) - strlen(trim(substr($line, 1)))); } $theVal = trim(substr($line, 1)); if (substr($theVal, 0, 1) == '.') { $res = $this->getVal(substr($theVal, 1), $setup); } else { $res = $this->getVal($theVal, $this->setup); } $this->setVal($objStrName, $setup, unserialize(serialize($res)), 1); // unserialize(serialize(...)) may look stupid but is needed because of some reference issues. See Kaspers reply to "[TYPO3-core] good question" from December 15 2005. } break; case '>': if ($this->syntaxHighLight) { $this->regHighLight("value_unset", $lineP, strlen(ltrim(substr($line, 1))) - strlen(trim(substr($line, 1)))); } $this->setVal($objStrName, $setup, 'UNSET'); break; default: $this->error('Line ' . ($this->lineNumberOffset + $this->rawP - 1) . ': Object Name String, "' . htmlspecialchars($objStrName) . '" was not preceeded by any operator, =<>({'); break; } } $this->lastComment = ''; } } elseif (substr($line, 0, 1) == '}') { $this->inBrace--; $this->lastComment = ''; if ($this->syntaxHighLight) { $this->regHighLight("operator", $lineP, strlen($line) - 1); } if ($this->inBrace < 0) { $this->error('Line ' . ($this->lineNumberOffset + $this->rawP - 1) . ': An end brace is in excess.', 1); $this->inBrace = 0; } else { break; } } else { if ($this->syntaxHighLight) { $this->regHighLight("comment", $lineP); } // Comment. The comments are concatenated in this temporary string: if ($this->regComments) { $this->lastComment .= trim($line) . chr(10); } } } } // Unset comment if ($this->commentSet) { if ($this->syntaxHighLight) { $this->regHighLight("comment", $lineP); } if (substr($line, 0, 2) == '*/') { $this->commentSet = 0; } } } }
/** * Gets a code for a browsing device based on the input useragent string. * * @param string $userAgent: The useragent string, t3lib_div::getIndpEnv('HTTP_USER_AGENT') * @return string Code for the specific device type */ public static function getDeviceType($userAgent) { // Hook: $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/div/class.t3lib_utility_client.php']['getDeviceType']: $getDeviceTypeHooks =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/div/class.t3lib_utility_client.php']['getDeviceType']; if (is_array($getDeviceTypeHooks)) { foreach ($getDeviceTypeHooks as $hookFunction) { $returnResult = true; $hookParameters = array('userAgent' => &$userAgent, 'returnResult' => &$returnResult); // need reference for third parameter in t3lib_div::callUserFunction, // so create a reference to NULL $null = NULL; $hookResult = t3lib_div::callUserFunction($hookFunction, $hookParameters, $null); if ($returnResult && is_string($hookResult) && !empty($hookResult)) { return $hookResult; } } } $userAgent = strtolower(trim($userAgent)); $deviceType = ''; // pda if (strstr($userAgent, 'avantgo')) { $deviceType = 'pda'; } // wap $browser = substr($userAgent, 0, 4); $wapviwer = substr(stristr($userAgent, 'wap'), 0, 3); if ($wapviwer == 'wap' || $browser == 'noki' || $browser == 'eric' || $browser == 'r380' || $browser == 'up.b' || $browser == 'winw' || $browser == 'wapa') { $deviceType = 'wap'; } // grabber if (strstr($userAgent, 'g.r.a.b.') || strstr($userAgent, 'utilmind httpget') || strstr($userAgent, 'webcapture') || strstr($userAgent, 'teleport') || strstr($userAgent, 'webcopier')) { $deviceType = 'grabber'; } // robots if (strstr($userAgent, 'crawler') || strstr($userAgent, 'spider') || strstr($userAgent, 'googlebot') || strstr($userAgent, 'searchbot') || strstr($userAgent, 'infoseek') || strstr($userAgent, 'altavista') || strstr($userAgent, 'diibot')) { $deviceType = 'robot'; } return $deviceType; }
/** * Renders the form in the kickstarter; this was add_cat_pi() * * @return HTML */ function render_wizard() { $lines = array(); $action = explode(':', $this->wizard->modData['wizAction']); if ($action[0] == 'edit') { $this->regNewEntry($this->sectionID, $action[1]); $lines = $this->catHeaderLines($lines, $this->sectionID, $this->wizard->options[$this->sectionID], '<strong>Edit Plugin #' . $action[1] . '</strong>', $action[1]); $piConf = $this->wizard->wizArray[$this->sectionID][$action[1]]; $ffPrefix = '[' . $this->sectionID . '][' . $action[1] . ']'; // Enter title of the plugin $subContent = '<strong>Enter a title for the plugin:</strong><br />' . $this->renderStringBox_lang('title', $ffPrefix, $piConf); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; $subContent = $this->renderCheckBox($ffPrefix . '[plus_user_obj]', $piConf['plus_user_obj']) . 'By default plugins are generated as cachable USER cObjects. Check this checkbox to generate an uncached USER_INT cObject.<br />'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; $subContent = $this->renderCheckBox($ffPrefix . '[plus_not_staticTemplate]', $piConf['plus_not_staticTemplate']) . 'Enable this option if you want the TypoScript code to be set by default. Otherwise the code will go into a static template file which must be included in the template record (it\'s <em>NOT</em> recommended to set this option).<br />'; $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Position if (is_array($this->wizard->wizArray['fields'])) { $optValues = array('0' => ''); foreach ($this->wizard->wizArray['fields'] as $kk => $fC) { if ($fC['which_table'] == 'tt_content') { $optValues[$kk] = ($fC['title'] ? $fC['title'] : 'Item ' . $kk) . ' (' . count($fC['fields']) . ' fields)'; } } if (count($optValues) > 1) { $subContent = '<strong>Apply a set of extended fields</strong><br /> If you have configured a set of extra fields (Extend existing Tables) for the tt_content table, you can have them assigned to this plugin. <br />' . $this->renderSelectBox($ffPrefix . '[apply_extended]', $piConf['apply_extended'], $optValues); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } } // Insert Plugin if (is_array($this->wizard->wizArray['tables'])) { $optValues = array('0' => ''); foreach ($this->wizard->wizArray['tables'] as $kk => $fC) { $optValues[$kk] = ($fC['tablename'] || $fC['title'] ? $fC['title'] . ' (' . $this->returnName($this->wizard->extKey, 'tables') . ($fC['tablename'] ? '_' . $fC['tablename'] : '') . ')' : 'Item ' . $kk) . ' (' . count($fC['fields']) . ' fields)'; } $incListing = '<br /><br />If you have configured custom tables you can select one of the tables to list by default as an example: <br />' . $this->renderSelectBox($ffPrefix . '[list_default]', $piConf['list_default'], $optValues); $incListing .= '<br />' . $this->renderCheckBox($ffPrefix . '[list_default_listmode]', $piConf['list_default_listmode']) . 'Listing: Sections instead of table-rows'; $incListing .= '<br />' . $this->renderCheckBox($ffPrefix . '[list_default_singlemode]', $piConf['list_default_singlemode']) . 'Singleview: Sections instead of table-rows'; } else { $incListing = ''; } if (!$piConf['addType']) { $piConf['addType'] = 'list_type'; } $subContent = $this->renderRadioBox($ffPrefix . '[addType]', $piConf['addType'], 'list_type') . $this->textSetup('Add to \'Insert Plugin\' list in Content Elements\'', 'Most frontend plugins should be added to the Plugin list of Content Element type \'Insert Plugin\'. This is what happens with most other plugins you know of.' . $this->resImg('pi_pi.png') . '<br />' . $this->renderCheckBox($ffPrefix . '[plus_wiz]', $piConf['plus_wiz']) . 'Add icon to \'New Content Element\' wizard:' . $this->resImg('pi_cewiz.png') . 'Write a description for the entry (if any):<br />' . $this->renderStringBox_lang('plus_wiz_description', $ffPrefix, $piConf) . $incListing); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Text box $subContent = $this->renderRadioBox($ffPrefix . '[addType]', $piConf['addType'], 'textbox') . $this->textSetup('Add as a \'Textbox\' type', 'The Textbox Content Element is not very common but has a confortable set of fields: Bodytext and image upload.' . $this->resImg('pi_textbox.png')); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Menu/Sitemap $subContent = $this->renderRadioBox($ffPrefix . '[addType]', $piConf['addType'], 'menu_sitemap') . $this->textSetup('Add as a \'Menu/Sitemap\' item', 'Adds the plugin to the Menu/Sitemap list. Use this if your plugin is a list of links to pages or elements on the website. An alternative sitemap? Or some special kind of menu in a special design?' . $this->resImg('pi_menu_sitemap.png')); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // New content element $subContent = $this->renderRadioBox($ffPrefix . '[addType]', $piConf['addType'], 'ce') . $this->textSetup('Add as a totally new Content Element type', 'You can also take the plunge into a whole new content element type! Scarry eh?' . $this->resImg('pi_ce.png')); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // New header type $subContent = $this->renderRadioBox($ffPrefix . '[addType]', $piConf['addType'], 'header') . $this->textSetup('Add as a new header type', 'Finally you might insert a new header type here:' . $this->resImg('pi_header.png')); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Processing of tags in content. $subContent = $this->renderRadioBox($ffPrefix . '[addType]', $piConf['addType'], 'typotags') . $this->textSetup('Processing of userdefined tag', htmlspecialchars('If you wish the plugin to process content from a userdefined tag in Content Element text-fields, enter the tagname here. Eg. if you wish the tags <mytag>This is the content</mytag> to be your userdefined tags, just enter \'mytag\' in this field (lowercase a-z, 0-9 and underscore):') . '<br />' . $this->renderStringBox($ffPrefix . '[tag_name]', $piConf['tag_name'])); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; // Just include library $subContent = $this->renderRadioBox($ffPrefix . '[addType]', $piConf['addType'], 'includeLib') . $this->textSetup('Just include library', 'In this case your library is just included when pages are rendered.<br /><br />' . $this->renderCheckBox($ffPrefix . '[plus_user_ex]', $piConf['plus_user_ex']) . 'Provide TypoScript example for USER cObject in \'page.1000\'<br />'); $lines[] = '<tr' . $this->bgCol(3) . '><td>' . $this->fw($subContent) . '</td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_pi'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['add_cat_pi'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this->wizard); } } $content = '<table border=0 cellpadding=2 cellspacing=2>' . implode('', $lines) . '</table>'; return $content; }
/** * compress inline code * * @return void */ protected function doCompress() { if ($this->compressJavascript && $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler']) { // use extern compress routine $params = array('jsInline' => &$this->jsInline, 'jsFooterInline' => &$this->jsFooterInline, 'jsLibs' => &$this->jsLibs, 'jsFiles' => &$this->jsFiles, 'jsFooterFiles' => &$this->jsFooterFiles, 'headerData' => &$this->headerData, 'footerData' => &$this->footerData); t3lib_div::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['jsCompressHandler'], $params, $this); } else { // traverse the arrays, compress files $this->compressError = ''; if ($this->compressJavascript) { if (count($this->jsInline)) { foreach ($this->jsInline as $name => $properties) { if ($properties['compress']) { $error = ''; $this->jsInline[$name]['code'] = t3lib_div::minifyJavaScript($properties['code'], $error); if ($error) { $this->compressError .= 'Error with minify JS Inline Block "' . $name . '": ' . $error . LF; } } } } if (TYPO3_MODE === 'BE') { $this->jsFiles = $this->getCompressor()->compressJsFiles($this->jsFiles); $this->jsFooterFiles = $this->getCompressor()->compressJsFiles($this->jsFooterFiles); } } } if ($this->compressCss) { // use extern compress routine $params = array('cssInline' => &$this->cssInline, 'cssFiles' => &$this->cssFiles, 'headerData' => &$this->headerData, 'footerData' => &$this->footerData); if ($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssCompressHandler']) { // use extern concatenate routine t3lib_div::callUserFunction($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['cssCompressHandler'], $params, $this); } elseif (TYPO3_MODE === 'BE') { $this->cssFiles = $this->getCompressor()->compressCssFiles($this->cssFiles); } } }
/** * Side menu * * @return HTML code of the side menu */ function sidemenu() { $actionType = $this->modData['wizSubCmd'] . ':' . $this->modData['wizAction']; $singles = $this->getSingles(); $lines = array(); $extRelPath = t3lib_extMgm::extRelPath('kickstarter'); foreach ($this->options as $k => $v) { // Add items: $items = $this->wizArray[$k]; $c = 0; $iLines = array(); if (is_array($items)) { foreach ($items as $k2 => $conf) { $dummyTitle = t3lib_div::inList($singles, $k) ? '[Click to Edit]' : '<em>Item ' . $k2 . '</em>'; $isActive = !strcmp($k . ':edit:' . $k2, $actionType); $delIcon = $this->linkStr('<img src="' . $extRelPath . 'icons/garbage.gif" width="11" height="12" border="0" title="Remove item" />', '', 'deleteEl:' . $k . ':' . $k2); $iLines[] = '<tr' . ($isActive ? $this->bgCol(2, -30) : $this->bgCol(2)) . '><td>' . $this->fw($this->linkStr($this->bwWithFlag($conf['title'] ? $conf['title'] : $dummyTitle, $isActive), $k, 'edit:' . $k2)) . '</td><td>' . $delIcon . '</td></tr>'; $c = $k2; } } if (!t3lib_div::inList($singles, $k) || !count($iLines)) { $c++; $addIcon = $this->linkStr('<img src="' . $extRelPath . 'icons/add.gif" width="12" height="12" border="0" title="Add item" />', $k, 'edit:' . $c); } else { $addIcon = ''; } $lines[] = '<tr' . $this->bgCol(1) . '><td nowrap="nowrap"><strong>' . $this->fw($v[0]) . '</strong></td><td>' . $addIcon . '</td></tr>'; $lines = array_merge($lines, $iLines); } $lines[] = '<tr><td> </td><td></td></tr>'; $lines[] = '<tr><td width="150"> ' . $this->fw('Enter extension key:') . '<br /> <input type="text" name="' . $this->piFieldName('wizArray_upd') . '[save][extension_key]" value="' . htmlspecialchars($this->wizArray['save']['extension_key']) . '" maxlength="30" /> ' . ($this->wizArray['save']['extension_key'] ? '' : '<br /><a href="http://typo3.org/1382.0.html" target="_blank"><font color="red">Make sure to enter the right extension key from the beginning here!</font> You can register one here.</a>') . ' </td><td></td></tr>'; $lines[] = '<tr><td><input type="submit" value="Update..." /></td><td></td></tr>'; $lines[] = '<tr><td><input type="submit" name="' . $this->piFieldName('totalForm') . '" value="Total form" /></td><td></td></tr>'; if ($this->saveKey) { $lines[] = '<tr><td><input type="submit" name="' . $this->piFieldName('viewResult') . '" value="View result" /></td><td></td></tr>'; $lines[] = '<tr><td><input type="submit" name="' . $this->piFieldName('downloadAsFile') . '" value="D/L as file" /></td><td></td></tr>'; $lines[] = '<tr><td> <input type="hidden" name="' . $this->piFieldName('wizArray_upd') . '[save][print_wop_comments]" value="0" /><input type="checkbox" name="' . $this->piFieldName('wizArray_upd') . '[save][print_wop_comments]" value="1" ' . ($this->wizArray['save']['print_wop_comments'] ? ' checked="checked"' : '') . ' />' . $this->fw('Print WOP comments') . ' </td><td></td></tr>'; } /* HOOK: Place a hook here, so additional output can be integrated */ if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['sidemenu'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['kickstarter']['sidemenu'] as $_funcRef) { $lines = t3lib_div::callUserFunction($_funcRef, $lines, $this); } } $content = '<table border="0" cellpadding="2" cellspacing="2">' . implode('', $lines) . '</table>'; return $content; }
/** * Generates a XML sitemap from the page structure * * @param string the content to be filled, usually empty * @param array additional configuration parameters * @return string the XML sitemap ready to render */ public function renderXMLSitemap($content, $conf) { $this->conf = $conf; $id = intval($GLOBALS['TSFE']->id); $depth = 50; $additionalFields = 'uid,pid,doktype,shortcut,crdate,SYS_LASTCHANGED'; $baseURL = $this->getBaseUrl(); $baseURLParts = parse_url($baseURL); $currentHostname = $baseURLParts['host']; // -- do a 301 redirect to the "main" sitemap.xml if not already there if ($this->conf['redirectToMainSitemap'] && $baseURL) { $sitemapURL = $baseURL . 'sitemap.xml'; $requestURL = t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'); if ($requestURL != $sitemapURL && strpos($requestURL, 'sitemap.xml')) { header('Location: ' . t3lib_div::locationHeaderUrl($sitemapURL), true, 301); } } // Initializing the tree object $treeStartingRecord = $GLOBALS['TSFE']->sys_page->getRawRecord('pages', $id, $additionalFields); // now we need to see if this page is a redirect from the parent page // and loop while parentid is not null and the parent is still a redirect $parentId = $treeStartingRecord['pid']; while ($parentId > 0) { $parentRecord = $GLOBALS['TSFE']->sys_page->getRawRecord('pages', $parentId, $additionalFields); // check for shortcuts if ($this->conf['resolveMainShortcut'] == 1) { if ($parentRecord['doktype'] == 4 && ($parentRecord['shortcut'] == $id || $parentRecord['shortcut_mode'] > 0)) { $treeStartingRecord = $parentRecord; $id = $parentId = $parentRecord['pid']; } else { break; } } else { // just traverse the rootline up $treeStartingRecord = $parentRecord; $id = $parentId = $parentRecord['pid']; } } $tree = t3lib_div::makeInstance('t3lib_pageTree'); $tree->addField('SYS_LASTCHANGED', 1); $tree->addField('crdate', 1); $tree->addField('no_search', 1); $tree->addField('doktype', 1); $tree->addField('nav_hide', 1); // disable recycler and everything below $tree->init('AND doktype!=255' . $GLOBALS['TSFE']->sys_page->enableFields('pages')); // create the tree from starting point $tree->getTree($id, $depth, ''); $treeRecords = $tree->tree; array_unshift($treeRecords, array('row' => $treeStartingRecord)); foreach ($treeRecords as $row) { $item = $row['row']; // don't render spacers, sysfolders etc, and the ones that have the // "no_search" checkbox if ($item['doktype'] >= 199 || intval($item['no_search']) == 1) { continue; } // remove "hide-in-menu" items if ($this->conf['renderHideInMenu'] == 0 && intval($item['nav_hide']) == 1) { continue; } $conf = array('parameter' => $item['uid']); // also allow different languages if (!empty($GLOBALS['TSFE']->sys_language_uid)) { $conf['additionalParams'] = '&L=' . $GLOBALS['TSFE']->sys_language_uid; } // create the final URL $url = $GLOBALS['TSFE']->cObj->typoLink_URL($conf); $urlParts = parse_url($url); if (!$urlParts['host']) { $url = $baseURL . ltrim($url, '/'); } $url = htmlspecialchars($url); if (isset($this->usedUrls[$url])) { continue; } $lastmod = $item['SYS_LASTCHANGED'] ? $item['SYS_LASTCHANGED'] : $item['crdate']; // format date, see http://www.w3.org/TR/NOTE-datetime for possible formats $lastmod = date('c', $lastmod); $this->usedUrls[$url] = array('url' => $url, 'lastmod' => $lastmod); } // check for additional pages $additionalPages = trim($this->conf['scrapeLinksFromPages']); if ($additionalPages) { $additionalPages = t3lib_div::trimExplode(',', $additionalPages, TRUE); if (count($additionalPages)) { $additionalSubpagesOfPages = $this->conf['scrapeLinksFromPages.']['includingSubpages']; $additionalSubpagesOfPages = t3lib_div::trimExplode(',', $additionalSubpagesOfPages); $this->fetchAdditionalUrls($additionalPages, $additionalSubpagesOfPages); } } // creating the XML output $content = ''; // create the content foreach ($this->usedUrls as $urlData) { // skip pages that are not on the same domain if (stripos($urlData['url'], $currentHostname) === FALSE) { continue; } if ($urlData['lastmod']) { $lastmod = ' <lastmod>' . htmlspecialchars($urlData['lastmod']) . '</lastmod>'; } else { $lastmod = ''; } $content .= ' <url> <loc>' . htmlspecialchars($urlData['url']) . '</loc>' . $lastmod . ' </url>'; } // hook for adding additional urls if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seo_basics']['sitemap']['additionalUrlsHook'])) { $_params = array('content' => &$content, 'usedUrls' => &$this->usedUrls); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seo_basics']['sitemap']['additionalUrlsHook'] as $_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } } // see https://www.google.com/webmasters/tools/docs/en/protocol.html for complete format $content = '<?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . $content . ' </urlset>'; return $content; }
/** * Convert a title to something that can be used in an page path: * - Convert spaces to underscores * - Convert non A-Z characters to ASCII equivalents * - Convert some special things like the 'ae'-character * - Strip off all other symbols * Works with the character set defined as "forceCharset" * * @param string Input title to clean * @return string Encoded title, passed through rawurlencode() = ready to put in the URL. * @see rootLineToPath() */ function encodeTitle($title) { // Fetch character set: $charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] : $GLOBALS['TSFE']->defaultCharSet; // Convert to lowercase: $processedTitle = $GLOBALS['TSFE']->csConvObj->conv_case($charset, $title, 'toLower'); // Strip tags $processedTitle = strip_tags($processedTitle); // Convert some special tokens to the space character: $space = isset($this->conf['spaceCharacter']) ? $this->conf['spaceCharacter'] : '_'; $processedTitle = preg_replace('/[ \-+_]+/', $space, $processedTitle); // convert spaces // Convert extended letters to ascii equivalents: $processedTitle = $GLOBALS['TSFE']->csConvObj->specCharsToASCII($charset, $processedTitle); // Strip the rest...: $processedTitle = preg_replace('/[^a-zA-Z0-9\\' . $space . ']/', '', $processedTitle); // strip the rest $processedTitle = preg_replace('/\\' . $space . '+/', $space, $processedTitle); // Convert multiple 'spaces' to a single one $processedTitle = trim($processedTitle, $space); if ($this->conf['encodeTitle_userProc']) { $params = array('pObj' => &$this, 'title' => $title, 'processedTitle' => $processedTitle); $processedTitle = t3lib_div::callUserFunction($this->conf['encodeTitle_userProc'], $params, $this); } // Return encoded URL: return rawurlencode(strtolower($processedTitle)); }
/** * renders the data for all tabs in the user setup and returns * everything that is needed with tabs and dyntab menu * * @return ready to use for the dyntabmenu itemarray */ protected function renderUserSetup() { $result = array(); $firstTabLabel = ''; $code = array(); $i = 0; $fieldArray = $this->getFieldsFromShowItem(); $this->dividers2tabs = isset($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) ? intval($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) : 0; $tabLabel = ''; foreach ($fieldArray as $fieldName) { $more = ''; if (substr($fieldName, 0, 8) == '--div--;') { if ($firstTabLabel == '') { // first tab $tabLabel = $this->getLabel(substr($fieldName, 8), '', false); $firstTabLabel = $tabLabel; } else { if ($this->dividers2tabs) { $result[] = array('label' => $tabLabel, 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : ''); $tabLabel = $this->getLabel(substr($fieldName, 8), '', false); $i = 0; $code = array(); } } continue; } $config = $GLOBALS['TYPO3_USER_SETTINGS']['columns'][$fieldName]; // field my be disabled in setup.fields if (isset($this->tsFieldConf[$fieldName . '.']['disabled']) && $this->tsFieldConf[$fieldName . '.']['disabled'] == 1) { continue; } if (isset($config['access']) && !$this->checkAccess($config)) { continue; } $label = $this->getLabel($config['label'], $fieldName); $label = $this->getCSH($config['csh'] ? $config['csh'] : $fieldName, $label); $type = $config['type']; $eval = $config['eval']; $class = $config['class']; $style = $config['style']; if ($class) { $more .= ' class="' . $class . '"'; } if ($style) { $more .= ' style="' . $style . '"'; } if ($this->overrideConf[$fieldName]) { $more .= ' disabled="disabled"'; } $value = $config['table'] == 'be_users' ? $GLOBALS['BE_USER']->user[$fieldName] : $GLOBALS['BE_USER']->uc[$fieldName]; if (!$value && isset($config['default'])) { $value = $config['default']; } switch ($type) { case 'text': case 'password': $dataAdd = ''; if ($config['table'] == 'be_users') { $dataAdd = '[be_users]'; } if ($eval == 'md5') { $more .= ' onchange="this.value=this.value?MD5(this.value):\'\';"'; } if ($type == 'password') { $value = ''; } $noAutocomplete = $type == 'password' ? 'autocomplete="off" ' : ''; $html = '<input id="field_' . $fieldName . '" type="' . $type . '" name="data' . $dataAdd . '[' . $fieldName . ']" ' . $noAutocomplete . 'value="' . htmlspecialchars($value) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . $more . ' />'; break; case 'check': if (!$class) { $more .= ' class="check"'; } $html = '<input id="field_' . $fieldName . '" type="checkbox" name="data[' . $fieldName . ']"' . ($value ? ' checked="checked"' : '') . $more . ' />'; break; case 'select': if (!$class) { $more .= ' class="select"'; } if ($config['itemsProcFunc']) { $html = t3lib_div::callUserFunction($config['itemsProcFunc'], $config, $this, ''); } else { $html = '<select id="field_' . $fieldName . '" name="data[' . $fieldName . ']"' . $more . '>' . LF; foreach ($config['items'] as $key => $optionLabel) { $html .= '<option value="' . $key . '"' . ($value == $key ? ' selected="selected"' : '') . '>' . $this->getLabel($optionLabel, '', false) . '</option>' . LF; } $html .= '</select>'; } break; case 'user': $html = t3lib_div::callUserFunction($config['userFunc'], $config, $this, ''); break; default: $html = ''; } $code[$i][1] = $label; $code[$i++][2] = $html; } if ($this->dividers2tabs == 0) { $tabLabel = $firstTabLabel; } $result[] = array('label' => $tabLabel, 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : ''); return $result; }
/** * [Describe function...] * * @param [type] $row: ... * @param [type] $conf: ... * @param [type] $table: ... * @return [type] ... */ function resultRowDisplay($row, $conf, $table) { static $even = FALSE; $tce = t3lib_div::makeInstance('t3lib_TCEmain'); $SET = $GLOBALS['SOBE']->MOD_SETTINGS; $out = '<tr class="bgColor' . ($even ? '6' : '4') . '">'; $even = !$even; foreach ($row as $fN => $fV) { if (t3lib_div::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid' && $fN != 'deleted') { if ($SET['search_result_labels']) { $fVnew = $this->getProcessedValueExtra($table, $fN, $fV, $conf, '<br />'); } else { $fVnew = htmlspecialchars($fV); } $out .= '<td>' . $fVnew . '</td>'; } } $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit'; $out .= '<td nowrap>'; if (!$row['deleted']) { $out .= '<a href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ',\'' . $GLOBALS['BACK_PATH'] . '\');return false;">' . t3lib_iconWorks::getSpriteIcon('status-dialog-information') . '</a>'; $out .= '<a href="#" onClick="' . t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], t3lib_div::getIndpEnv('REQUEST_URI') . t3lib_div::implodeArrayForUrl('SET', (array) t3lib_div::_POST('SET'))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; } else { $out .= '<a href="' . t3lib_div::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => t3lib_div::linkThisScript(array()))) . t3lib_BEfunc::getUrlToken('tceAction') . '">'; $out .= t3lib_iconWorks::getSpriteIcon('actions-edit-restore', array('title' => 'undelete only')) . '</a>'; $out .= '<a href="' . t3lib_div::linkThisUrl($GLOBALS['BACK_PATH'] . 'tce_db.php', array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => t3lib_div::linkThisUrl('alt_doc.php', array('edit[' . $table . '][' . $row['uid'] . ']' => 'edit', 'returnUrl' => t3lib_div::linkThisScript(array()))))) . t3lib_BEfunc::getUrlToken('tceAction') . '">'; $out .= t3lib_iconWorks::getSpriteIcon('actions-edit-restore-edit', array('title' => 'undelete and edit')) . '</a>'; } $_params = array($table => $row); if (is_array($this->hookArray['additionalButtons'])) { foreach ($this->hookArray['additionalButtons'] as $_funcRef) { $out .= t3lib_div::callUserFunction($_funcRef, $_params, $this); } } $out .= '</td> </tr> '; return $out; }
/** * Process redirect methods. The function searches for a redirect url using all configured methods. * * @return string redirect url */ protected function processRedirect() { $redirect_url = array(); if ($this->conf['redirectMode']) { $redirectMethods = t3lib_div::trimExplode(',', $this->conf['redirectMode'], TRUE); foreach ($redirectMethods as $redirMethod) { if ($GLOBALS['TSFE']->loginUser && $this->logintype === 'login') { // logintype is needed because the login-page wouldn't be accessible anymore after a login (would always redirect) switch ($redirMethod) { case 'groupLogin': // taken from dkd_redirect_at_login written by Ingmar Schlecht; database-field changed $groupData = $GLOBALS['TSFE']->fe_user->groupData; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('felogin_redirectPid', $GLOBALS['TSFE']->fe_user->usergroup_table, 'felogin_redirectPid!="" AND uid IN (' . implode(',', $groupData['uid']) . ')'); if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) { $redirect_url[] = $this->pi_getPageLink($row[0]); // take the first group with a redirect page Zend_Debug::dump($row); } break; case 'userLogin': $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('felogin_redirectPid', $GLOBALS['TSFE']->fe_user->user_table, $GLOBALS['TSFE']->fe_user->userid_column . '=' . $GLOBALS['TSFE']->fe_user->user['uid'] . ' AND felogin_redirectPid!=""'); if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) { $redirect_url[] = $this->pi_getPageLink($row[0]); } break; case 'login': if ($this->conf['redirectPageLogin']) { $redirect_url[] = $this->pi_getPageLink(intval($this->conf['redirectPageLogin'])); } break; case 'getpost': $redirect_url[] = $this->redirectUrl; break; case 'referer': // avoid forced logout, when trying to login immediatly after a logout $redirect_url[] = preg_replace('/[&?]logintype=[a-z]+/', '', $this->referer); break; case 'refererDomains': // Auto redirect. // Feature to redirect to the page where the user came from (HTTP_REFERER). // Allowed domains to redirect to, can be configured with plugin.tx_felogin_pi1.domains // Thanks to plan2.net / Martin Kutschker for implementing this feature. if ($this->conf['domains']) { $url = $this->referer; // is referring url allowed to redirect? $match = array(); if (preg_match('/^http://([[:alnum:]._-]+)//', $url, $match)) { $redirect_domain = $match[1]; $found = false; foreach (t3lib_div::trimExplode(',', $this->conf['domains'], TRUE) as $d) { if (preg_match('/(^|\\.)/' . $d . '$', $redirect_domain)) { $found = true; break; } } if (!$found) { $url = ''; } } // Avoid forced logout, when trying to login immediatly after a logout if ($url) { $redirect_url[] = preg_replace('/[&?]logintype=[a-z]+/', '', $url); } } break; } } else { if ($this->logintype === 'login') { // after login-error switch ($redirMethod) { case 'loginError': if ($this->conf['redirectPageLoginError']) { $redirect_url[] = $this->pi_getPageLink(intval($this->conf['redirectPageLoginError'])); } break; } } elseif ($this->logintype == '' && $redirMethod == 'login' && $this->conf['redirectPageLogin']) { // if login and page not accessible $this->cObj->typolink('', array('parameter' => $this->conf['redirectPageLogin'], 'linkAccessRestrictedPages' => TRUE)); $redirect_url[] = $this->cObj->lastTypoLinkUrl; } elseif ($this->logintype == '' && $redirMethod == 'logout' && $this->conf['redirectPageLogout'] && $GLOBALS['TSFE']->loginUser) { // if logout and page not accessible $redirect_url[] = $this->pi_getPageLink(intval($this->conf['redirectPageLogout'])); } elseif ($this->logintype === 'logout') { // after logout // Hook for general actions after after logout has been confirmed if ($this->logintype === 'logout' && $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['logout_confirmed']) { $_params = array(); foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['logout_confirmed'] as $_funcRef) { if ($_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } } } switch ($redirMethod) { case 'logout': if ($this->conf['redirectPageLogout']) { $redirect_url[] = $this->pi_getPageLink(intval($this->conf['redirectPageLogout'])); } break; } } else { // not logged in // Placeholder for maybe future options switch ($redirMethod) { case 'getpost': // preserve the get/post value $redirect_url[] = $this->redirectUrl; break; } } } } } // remove empty values if (count($redirect_url)) { return t3lib_div::trimExplode(',', implode(',', $redirect_url), TRUE); } else { return array(); } }
/** * The mother of all functions creating links/URLs etc in a TypoScript environment. * See the references below. * Basically this function takes care of issues such as type,id,alias and Mount Points, URL rewriting (through hooks), M5/B6 encoded parameters etc. * It is important to pass all links created through this function since this is the guarantee that globally configured settings for link creating are observed and that your applications will conform to the various/many configuration options in TypoScript Templates regarding this. * * @param array The page record of the page to which we are creating a link. Needed due to fields like uid, alias, target, no_cache, title and sectionIndex_uid. * @param string Default target string to use IF not $page['target'] is set. * @param boolean If set, then the "&no_cache=1" parameter is included in the URL. * @param string Alternative script name if you don't want to use $GLOBALS['TSFE']->config['mainScript'] (normally set to "index.php") * @param array Array with overriding values for the $page array. * @param string Additional URL parameters to set in the URL. Syntax is "&foo=bar&foo2=bar2" etc. Also used internally to add parameters if needed. * @param string If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $GLOBALS['TSFE']->config['config']['forceTypeValue'] if found. * @param string The target Doamin, if any was detected in typolink * @return array Contains keys like "totalURL", "url", "sectionIndex", "linkVars", "no_cache", "type", "target" of which "totalURL" is normally the value you would use while the other keys contains various parts that was used to construct "totalURL" * @see tslib_frameset::frameParams(), tslib_cObj::typoLink(), tslib_cObj::SEARCHRESULT(), TSpagegen::pagegenInit(), tslib_menu::link() */ function linkData($page, $oTarget, $no_cache, $script, $overrideArray = '', $addParams = '', $typeOverride = '', $targetDomain = '') { global $TYPO3_CONF_VARS; $LD = array(); // Overriding some fields in the page record and still preserves the values by adding them as parameters. Little strange function. if (is_array($overrideArray)) { foreach ($overrideArray as $theKey => $theNewVal) { $addParams .= '&real_' . $theKey . '=' . rawurlencode($page[$theKey]); $page[$theKey] = $theNewVal; } } // Adding Mount Points, "&MP=", parameter for the current page if any is set: if (!strstr($addParams, '&MP=')) { if (trim($GLOBALS['TSFE']->MP_defaults[$page['uid']])) { // Looking for hardcoded defaults: $addParams .= '&MP=' . rawurlencode(trim($GLOBALS['TSFE']->MP_defaults[$page['uid']])); } elseif ($GLOBALS['TSFE']->config['config']['MP_mapRootPoints']) { // Else look in automatically created map: $m = $this->getFromMPmap($page['uid']); if ($m) { $addParams .= '&MP=' . rawurlencode($m); } } } // Setting ID/alias: if (!$script) { $script = $GLOBALS['TSFE']->config['mainScript']; } if ($page['alias']) { $LD['url'] = $script . '?id=' . rawurlencode($page['alias']); } else { $LD['url'] = $script . '?id=' . $page['uid']; } // Setting target $LD['target'] = trim($page['target']) ? trim($page['target']) : $oTarget; // typeNum $typeNum = $this->setup[$LD['target'] . '.']['typeNum']; if (!t3lib_div::testInt($typeOverride) && intval($GLOBALS['TSFE']->config['config']['forceTypeValue'])) { $typeOverride = intval($GLOBALS['TSFE']->config['config']['forceTypeValue']); } if (strcmp($typeOverride, '')) { $typeNum = $typeOverride; } // Override... if ($typeNum) { $LD['type'] = '&type=' . intval($typeNum); } else { $LD['type'] = ''; } $LD['orig_type'] = $LD['type']; // Preserving the type number. // noCache $LD['no_cache'] = trim($page['no_cache']) || $no_cache ? '&no_cache=1' : ''; // linkVars if ($GLOBALS['TSFE']->config['config']['uniqueLinkVars']) { if ($addParams) { $LD['linkVars'] = t3lib_div::implodeArrayForUrl('', t3lib_div::explodeUrl2Array($GLOBALS['TSFE']->linkVars . $addParams)); } else { $LD['linkVars'] = $GLOBALS['TSFE']->linkVars; } } else { $LD['linkVars'] = $GLOBALS['TSFE']->linkVars . $addParams; } // Add absRefPrefix if exists. $LD['url'] = $GLOBALS['TSFE']->absRefPrefix . $LD['url']; // If the special key 'sectionIndex_uid' (added 'manually' in tslib/menu.php to the page-record) is set, then the link jumps directly to a section on the page. $LD['sectionIndex'] = $page['sectionIndex_uid'] ? '#c' . $page['sectionIndex_uid'] : ''; // Compile the normal total url $LD['totalURL'] = $this->removeQueryString($LD['url'] . $LD['type'] . $LD['no_cache'] . $LD['linkVars'] . $GLOBALS['TSFE']->getMethodUrlIdToken) . $LD['sectionIndex']; // Call post processing function for link rendering: if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'])) { $_params = array('LD' => &$LD, 'args' => array('page' => $page, 'oTarget' => $oTarget, 'no_cache' => $no_cache, 'script' => $script, 'overrideArray' => $overrideArray, 'addParams' => $addParams, 'typeOverride' => $typeOverride, 'targetDomain' => $targetDomain), 'typeNum' => $typeNum); foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'] as $_funcRef) { t3lib_div::callUserFunction($_funcRef, $_params, $this); } } // Return the LD-array return $LD; }