/** * Spam-Validation of given Params * see powermail/doc/SpamDetection for formula * * @param array $params * @return bool */ public function isValid($params) { if (!$this->settings['spamshield.']['_enable']) { return true; } $this->div = t3lib_div::makeInstance('Tx_Powermail_Utility_Div'); $spamFactor = $this->settings['spamshield.']['factor'] / 100; // Different checks to increase spam indicator $this->honeypodCheck($params, $this->settings['spamshield.']['indicator.']['honeypod']); $this->linkCheck($params, $this->settings['spamshield.']['indicator.']['link'], $this->settings['spamshield.']['indicator.']['linkLimit']); $this->nameCheck($params, $this->settings['spamshield.']['indicator.']['name']); $this->sessionCheck($this->settings['spamshield.']['indicator.']['session']); $this->uniqueCheck($params, $this->settings['spamshield.']['indicator.']['unique']); $this->blacklistStringCheck($params, $this->settings['spamshield.']['indicator.']['blacklistString']); $this->blacklistIpCheck($this->settings['spamshield.']['indicator.']['blacklistIp']); // spam formula with asymptote 1 (100%) if ($this->spamIndicator > 0) { $thisSpamFactor = -1 / $this->spamIndicator + 1; } else { $thisSpamFactor = 0; } // Save Spam Factor in session for db storage $GLOBALS['TSFE']->fe_user->setKey('ses', 'powermail_spamfactor', $this->formatSpamFactor($thisSpamFactor)); $GLOBALS['TSFE']->storeSessionData(); // Spam debugging if ($this->settings['debug.']['spamshield']) { t3lib_utility_Debug::debug($this->msg, 'powermail debug: Show Spamchecks - Spamfactor ' . $this->formatSpamFactor($thisSpamFactor)); } // if spam if ($thisSpamFactor >= $spamFactor) { $this->addError('spam_details', $this->formatSpamFactor($thisSpamFactor)); // Send notification email to admin if (t3lib_div::validEmail($this->settings['spamshield.']['email'])) { $subject = 'Spam in powermail form recognized'; $message = 'Possible spam in powermail form on page with PID ' . $GLOBALS['TSFE']->id; $message .= "\n\n"; $message .= 'Spamfactor of this mail: ' . $this->formatSpamFactor($thisSpamFactor) . "\n"; $message .= "\n\n"; $message .= 'Failed Spamchecks:' . "\n"; $message .= Tx_Powermail_Utility_Div::viewPlainArray($this->msg); $message .= "\n\n"; $message .= 'Given Form variables:' . "\n"; $message .= Tx_Powermail_Utility_Div::viewPlainArray($params); $header = 'MIME-Version: 1.0' . "\r\n"; $header .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $header .= 'From: powermail@' . t3lib_div::getIndpEnv('TYPO3_HOST_ONLY') . "\r\n"; t3lib_div::plainMailEncoded($this->settings['spamshield.']['email'], $subject, $message, $header); } return false; } return true; }
/** * Returns the internal debug messages as a string. * * @return string */ public function toString() { $messagesAsString = ''; if (count($this->debugMessages)) { $messagesAsString = t3lib_utility_Debug::viewArray($this->debugMessages); } return $messagesAsString; }
/** * @param array $array */ public static function viewArray($array) { if (class_exists('t3lib_utility_Debug') && is_callable('t3lib_utility_Debug::viewArray')) { t3lib_utility_Debug::viewArray($array); } else { t3lib_div::view_array($array); } }
/** * @return string */ public static function getDebugTrail() { tx_rnbase::load('tx_rnbase_util_TYPO3'); if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) { return \TYPO3\CMS\Core\Utility\DebugUtility::debugTrail(); } else { return t3lib_utility_Debug::debugTrail(); } }
/** * Example can be found in the testsite package at the page-path "/Intro/TypoScript examples/Menu object examples/Loading multiple.../" * * @param array $I The menu item array, $this->I (in the parent object) * @param array $conf TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated) * @return array The processed $I array returned (and stored in $this->I of the parent object again) * @see tslib_menu::userProcess(), tslib_tmenu::writeMenu(), tslib_gmenu::writeMenu() */ function user_keepRolloverAtOnClick($I, $conf) { $itemRow = $conf['parentObj']->menuArr[$I['key']]; // Setting the document status content to the value of the page title // on mouse over if (!$I['linkHREF']['TARGET']) { $I['linkHREF']['HREF'] = '#'; $I['linkHREF']['onClick'] .= 'ARO_setLocation' . $conf['setLocation'] . '(' . $itemRow['uid'] . ',\'' . $I['theName'] . '\'); return false;'; } else { $I['linkHREF']['onClick'] .= 'ARO_setActiveImg' . '(\'' . $I['theName'] . '\');'; } if ($I['linkHREF']['onMouseover']) { $I['linkHREF']['onMouseover'] = 'ARO_' . $I['linkHREF']['onMouseover']; } if ($I['linkHREF']['onMouseout']) { $I['linkHREF']['onMouseout'] = 'ARO_' . $I['linkHREF']['onMouseout']; } if ($conf['parentObj']->isActive($itemRow['uid'])) { $conf['parentObj']->WMextraScript .= ' <script type="text/javascript"> /*<![CDATA[*/ ARO_Image = "' . $I['theName'] . '"; ' . $I['linkHREF']['onMouseover'] . ' /*]]>*/ </script> '; } // Update the link in the parent object: // setting internal $I - needed by setATagParts() function! $conf['parentObj']->I = $I; // Setting the A1 and A2 of the internal $I $conf['parentObj']->setATagParts(); // retrieving internal $I $I = $conf['parentObj']->I; // Setting the ATag_begin to the value of this $I $I['parts']['ATag_begin'] = $I['A1']; // Debug: if ($conf['debug']) { // Outputting for debug example: echo 'ITEM: <h2>' . htmlspecialchars($itemRow['uid'] . ': ' . $itemRow['title']) . '</h2>'; t3lib_utility_Debug::debug($itemRow); t3lib_utility_Debug::debug($I); echo '<hr />'; } // Returns $I: return $I; }
public function outputDebugLog() { $out = ''; foreach ($this->debugLog as $section => $logData) { $out .= Tx_Formhandler_Globals::$cObj->wrap($section, $this->settings['sectionHeaderWrap']); $sectionContent = ''; foreach ($logData as $messageData) { $message = str_replace("\n", '<br />', $messageData['message']); $message = Tx_Formhandler_Globals::$cObj->wrap($message, $this->settings['severityWrap.'][$messageData['severity']]); $sectionContent .= Tx_Formhandler_Globals::$cObj->wrap($message, $this->settings['messageWrap']); if ($messageData['data']) { if (t3lib_div::int_from_ver(TYPO3_branch) < t3lib_div::int_from_ver('4.5')) { $sectionContent .= t3lib_div::view_array($messageData['data']); } else { $sectionContent .= t3lib_utility_Debug::viewArray($messageData['data']); } $sectionContent .= '<br />'; } } $out .= Tx_Formhandler_Globals::$cObj->wrap($sectionContent, $this->settings['sectionWrap']); } print $out; }
/** * @test */ public function relatedCanBeFetchedFromRelatedAndRelatedFrom() { $relatedFrom = NULL; $related = NULL; $this->newsDomainModelInstance->setRelated($related); $this->newsDomainModelInstance->setRelatedFrom($relatedFrom); // 1st: Empty relations $this->assertEquals(array(), $this->newsDomainModelInstance->getAllRelatedSorted()); $related = new Tx_Extbase_Persistence_ObjectStorage(); $item1 = $this->getNewsRecordForRelated('title2', '20.01.2013'); $item2 = $this->getNewsRecordForRelated('title1', '20.02.2013'); $item3 = $this->getNewsRecordForRelated('title3', '10.01.2013'); $item4 = $this->getNewsRecordForRelated('title4', '1.01.2013'); $item5 = $this->getNewsRecordForRelated('title5', '12.10.2013'); $related->attach($item1); $related->attach($item2); $this->newsDomainModelInstance->setRelated($related); $result = array($item2, $item1); // 2nd: + 2 Relations in related $this->assertEquals($result, $this->newsDomainModelInstance->getAllRelatedSorted(), t3lib_utility_Debug::viewArray($debug)); // 3rd: + 1 relation in relatedFrom $relatedFrom = new Tx_Extbase_Persistence_ObjectStorage(); $relatedFrom->attach($item3); $result = array($item2, $item1, $item3); $this->newsDomainModelInstance->setRelatedFrom($relatedFrom); $this->assertEquals($result, $this->newsDomainModelInstance->getAllRelatedSorted(), t3lib_utility_Debug::viewArray($debug)); // 4th: + 1 relation in relatedFrom, + 1 relation in related $relatedFrom->attach($item4); $this->newsDomainModelInstance->setRelatedFrom($relatedFrom); $related->attach($item5); $this->newsDomainModelInstance->setRelated($related); $result = array($item5, $item2, $item1, $item3, $item4); $this->assertEquals($result, $this->newsDomainModelInstance->getAllRelatedSorted(), t3lib_utility_Debug::viewArray($debug)); }
/** * Logs a call to a deprecated function. * The log message will be taken from the annotation. * @return void */ public static function logDeprecatedFunction() { if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) { return; } // This require_once is needed for deprecation calls // thrown early during bootstrap, if the autoloader is // not instantiated yet. This can happen for example if // ext_localconf triggers a deprecation. require_once 'utility/class.t3lib_utility_debug.php'; $trail = debug_backtrace(); if ($trail[1]['type']) { $function = new ReflectionMethod($trail[1]['class'], $trail[1]['function']); } else { $function = new ReflectionFunction($trail[1]['function']); } $msg = ''; if (preg_match('/@deprecated\\s+(.*)/', $function->getDocComment(), $match)) { $msg = $match[1]; } // trigger PHP error with a short message: <function> is deprecated (called from <source>, defined in <source>) $errorMsg = 'Function ' . $trail[1]['function']; if ($trail[1]['class']) { $errorMsg .= ' of class ' . $trail[1]['class']; } $errorMsg .= ' is deprecated (called from ' . $trail[1]['file'] . '#' . $trail[1]['line'] . ', defined in ' . $function->getFileName() . '#' . $function->getStartLine() . ')'; // write a longer message to the deprecation log: <function> <annotion> - <trace> (<source>) $logMsg = $trail[1]['class'] . $trail[1]['type'] . $trail[1]['function']; $logMsg .= '() - ' . $msg . ' - ' . t3lib_utility_Debug::debugTrail(); $logMsg .= ' (' . substr($function->getFileName(), strlen(PATH_site)) . '#' . $function->getStartLine() . ')'; self::deprecationLog($logMsg); }
/** * Implements the TypoScript data type "getText". This takes a string with parameters and based on those a value from somewhere in the system is returned. * * @param string The parameter string, eg. "field : title" or "field : navtitle // field : title" (in the latter case and example of how the value is FIRST splitted by "//" is shown) * @param mixed Alternative field array; If you set this to an array this variable will be used to look up values for the "field" key. Otherwise the current page record in $GLOBALS['TSFE']->page is used. * @return string The value fetched * @see getFieldVal() */ function getData($string, $fieldArray) { global $TYPO3_CONF_VARS; if (!is_array($fieldArray)) { $fieldArray = $GLOBALS['TSFE']->page; } $retVal = ''; $sections = explode('//', $string); while (!$retVal and list($secKey, $secVal) = each($sections)) { $parts = explode(':', $secVal, 2); $key = trim($parts[1]); if ((string) $key != '') { $type = strtolower(trim($parts[0])); switch ($type) { case 'gpvar': t3lib_div::deprecationLog('Using gpvar in TypoScript getText is deprecated since TYPO3 4.3 - Use gp instead of gpvar.'); // Fall Through // Fall Through case 'gp': // Merge GET and POST and get $key out of the merged array $retVal = $this->getGlobal($key, t3lib_div::array_merge_recursive_overrule(t3lib_div::_GET(), t3lib_div::_POST())); break; case 'tsfe': $retVal = $this->getGlobal('TSFE|' . $key); break; case 'getenv': $retVal = getenv($key); break; case 'getindpenv': $retVal = t3lib_div::getIndpEnv($key); break; case 'field': $retVal = $fieldArray[$key]; break; case 'parameters': $retVal = $this->parameters[$key]; break; case 'register': $retVal = $GLOBALS['TSFE']->register[$key]; break; case 'global': $retVal = $this->getGlobal($key); break; case 'leveltitle': $nkey = $this->getKey($key, $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, 'title', stristr($key, 'slide')); break; case 'levelmedia': $nkey = $this->getKey($key, $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, 'media', stristr($key, 'slide')); break; case 'leveluid': $nkey = $this->getKey($key, $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, 'uid', stristr($key, 'slide')); break; case 'levelfield': $keyP = t3lib_div::trimExplode(',', $key); $nkey = $this->getKey($keyP[0], $GLOBALS['TSFE']->tmpl->rootLine); $retVal = $this->rootLineValue($nkey, $keyP[1], strtolower($keyP[2]) == 'slide'); break; case 'fullrootline': $keyP = t3lib_div::trimExplode(',', $key); $fullKey = intval($keyP[0]) - count($GLOBALS['TSFE']->tmpl->rootLine) + count($GLOBALS['TSFE']->rootLine); if ($fullKey >= 0) { $retVal = $this->rootLineValue($fullKey, $keyP[1], stristr($keyP[2], 'slide'), $GLOBALS['TSFE']->rootLine); } break; case 'date': if (!$key) { $key = 'd/m Y'; } $retVal = date($key, $GLOBALS['EXEC_TIME']); break; case 'page': $retVal = $GLOBALS['TSFE']->page[$key]; break; case 'current': $retVal = $this->data[$this->currentValKey]; break; case 'level': $retVal = count($GLOBALS['TSFE']->tmpl->rootLine) - 1; break; case 'db': $selectParts = t3lib_div::trimExplode(':', $key); $db_rec = $GLOBALS['TSFE']->sys_page->getRawRecord($selectParts[0], $selectParts[1]); if (is_array($db_rec) && $selectParts[2]) { $retVal = $db_rec[$selectParts[2]]; } break; case 'lll': $retVal = $GLOBALS['TSFE']->sL('LLL:' . $key); break; case 'path': $retVal = $GLOBALS['TSFE']->tmpl->getFileName($key); break; case 'cobj': switch ((string) $key) { case 'parentRecordNumber': $retVal = $this->parentRecordNumber; break; } break; case 'debug': switch ((string) $key) { case 'rootLine': $retVal = t3lib_utility_Debug::viewArray($GLOBALS['TSFE']->tmpl->rootLine); break; case 'fullRootLine': $retVal = t3lib_utility_Debug::viewArray($GLOBALS['TSFE']->rootLine); break; case 'data': $retVal = t3lib_utility_Debug::viewArray($this->data); break; } break; } } if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'])) { foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); if (!$hookObject instanceof tslib_content_getDataHook) { throw new UnexpectedValueException('$hookObject must implement interface tslib_content_getDataHook', 1195044480); } $retVal = $hookObject->getDataExtension($string, $fieldArray, $secVal, $retVal, $this); } } } return $retVal; }
public function checkEvent($params, $obj) { $this->initializeAction(); $frameworkConfiguration = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'woehrlSeminare', 'Eventlist'); //~ t3lib_utility_Debug::debug($params, 'addInformation: params: '); $gp = t3lib_div::_GP('tx_powermail_pi1'); $formUid = $gp['form']; $form = $this->formsRepository->findByUid($formUid); if (!method_exists($form, 'getPages')) { return $this->isValid = FALSE; } foreach ($form->getPages() as $page) { // every page in current form foreach ($page->getFields() as $field) { // every field in current page switch ($field->getMarker()) { case 'action': $action = $params[$field->getUid()]; break; case 'editcode': $editcode = $params[$field->getUid()]; break; case 'event': $formIdEvent = $field->getUid(); $eventId = $params[$formIdEvent]; break; case 'eventtitle': $formIdEventtitle = $field->getUid(); break; } } } //~ t3lib_utility_Debug::debug($editcode, 'checkEvent: editcode... '); switch ($action) { case 'delete': //~ $subscriber = $this->subscriberRepository->findAllByFeuser($frameworkConfiguration['persistence']['storagePid'])->getFirst(); $subscriber = $this->subscriberRepository->findAllByEditcode($editcode, $frameworkConfiguration['persistence']['storagePid'])->getFirst(); if (empty($subscriber)) { t3lib_utility_Debug::debug($subscriber, 'checkEvent: NO subscriber found... '); $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); break; } //~ t3lib_utility_Debug::debug($subscriber, 'saveSubscription: delete... '); $event = $this->eventRepository->findByUid($eventId); if (empty($event)) { $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); break; } $event->removeSubscriber($subscriber); break; case 'new': if ($eventId > 0) { $event = $this->eventRepository->findByUid($eventId); // limit reached already --> overbooked if (count($event->getSubscribers()) >= $event->getMaxSubscriber()) { $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); } } break; default: return; } return; //~ t3lib_utility_Debug::debug($eventId , 'checkEvent: eventId'); if ($eventId > 0) { $event = $this->eventRepository->findByUid($eventId); // limit reached already --> overbooked if (count($event->getSubscribers()) >= $event->getMaxSubscriber()) { $obj->isValid = FALSE; // we have to use the language labels of powermail :-( // --> for validationerror_validation: $obj->setError('validation', $idEventTitle); } } return; }
public static function debugTrail() { $result = FALSE; $callingClassName = '\\TYPO3\\CMS\\Core\\Utility\\DebugUtility'; if (class_exists($callingClassName) && method_exists($callingClassName, 'debugTrail')) { $result = call_user_func($callingClassName . '::debugTrail'); } else { if (class_exists('t3lib_utility_Debug') && method_exists('t3lib_utility_Debug', 'debugTrail')) { $result = t3lib_utility_Debug::debugTrail(); } else { if (class_exists('t3lib_div') && method_exists('t3lib_div', 'debugTrail')) { $result = t3lib_div::debugTrail(); } } } return $result; }
/** * Create the rows for display of the page tree * For each page a number of rows are shown displaying GET variable configuration * * @param array Page row * @param string Page icon and title for row * @return string HTML <tr> content (one or more) */ public function drawURLs_addRowsForPage(array $pageRow, $pageTitleAndIcon) { $skipMessage = ''; // Get list of configurations $configurations = $this->getUrlsForPageRow($pageRow, $skipMessage); if (count($this->incomingConfigurationSelection) > 0) { // remove configuration that does not match the current selection foreach ($configurations as $confKey => $confArray) { if (!in_array($confKey, $this->incomingConfigurationSelection)) { unset($configurations[$confKey]); } } } // Traverse parameter combinations: $c = 0; $cc = 0; $content = ''; if (count($configurations)) { foreach ($configurations as $confKey => $confArray) { // Title column: if (!$c) { $titleClm = '<td rowspan="' . count($configurations) . '">' . $pageTitleAndIcon . '</td>'; } else { $titleClm = ''; } if (!in_array($pageRow['uid'], $this->expandExcludeString($confArray['subCfg']['exclude']))) { // URL list: $urlList = $this->urlListFromUrlArray($confArray, $pageRow, $this->scheduledTime, $this->reqMinute, $this->submitCrawlUrls, $this->downloadCrawlUrls, $this->duplicateTrack, $this->downloadUrls, $this->incomingProcInstructions); // Expanded parameters: $paramExpanded = ''; $calcAccu = array(); $calcRes = 1; foreach ($confArray['paramExpanded'] as $gVar => $gVal) { $paramExpanded .= ' <tr> <td class="bgColor4-20">' . htmlspecialchars('&' . $gVar . '=') . '<br/>' . '(' . count($gVal) . ')' . '</td> <td class="bgColor4" nowrap="nowrap">' . nl2br(htmlspecialchars(implode(chr(10), $gVal))) . '</td> </tr> '; $calcRes *= count($gVal); $calcAccu[] = count($gVal); } $paramExpanded = '<table class="lrPadding c-list param-expanded">' . $paramExpanded . '</table>'; $paramExpanded .= 'Comb: ' . implode('*', $calcAccu) . '=' . $calcRes; // Options $optionValues = ''; if ($confArray['subCfg']['userGroups']) { $optionValues .= 'User Groups: ' . $confArray['subCfg']['userGroups'] . '<br/>'; } if ($confArray['subCfg']['baseUrl']) { $optionValues .= 'Base Url: ' . $confArray['subCfg']['baseUrl'] . '<br/>'; } if ($confArray['subCfg']['procInstrFilter']) { $optionValues .= 'ProcInstr: ' . $confArray['subCfg']['procInstrFilter'] . '<br/>'; } // Compile row: $content .= ' <tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '"> ' . $titleClm . ' <td>' . htmlspecialchars($confKey) . '</td> <td>' . nl2br(htmlspecialchars(rawurldecode(trim(str_replace('&', chr(10) . '&', t3lib_div::implodeArrayForUrl('', $confArray['paramParsed'])))))) . '</td> <td>' . $paramExpanded . '</td> <td nowrap="nowrap">' . $urlList . '</td> <td nowrap="nowrap">' . $optionValues . '</td> <td nowrap="nowrap">' . (version_compare(TYPO3_version, '4.5.0', '<') ? t3lib_div::view_array($confArray['subCfg']['procInstrParams.']) : t3lib_utility_Debug::viewArray($confArray['subCfg']['procInstrParams.'])) . '</td> </tr>'; } else { $content .= '<tr class="bgColor' . ($c % 2 ? '-20' : '-10') . '"> ' . $titleClm . ' <td>' . htmlspecialchars($confKey) . '</td> <td colspan="5"><em>No entries</em> (Page is excluded in this configuration)</td> </tr>'; } $c++; } } else { $message = !empty($skipMessage) ? ' (' . $skipMessage . ')' : ''; // Compile row: $content .= ' <tr class="bgColor-20" style="border-bottom: 1px solid black;"> <td>' . $pageTitleAndIcon . '</td> <td colspan="6"><em>No entries</em>' . $message . '</td> </tr>'; } return $content; }
function debug($variable = '', $name = '*variable*', $line = '*line*', $file = '*file*', $recursiveDepth = 3, $debugLevel = E_DEBUG) { // If you wish to use the debug()-function, and it does not output something, please edit the IP mask in TYPO3_CONF_VARS if (!t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) { return; } if (is_object($GLOBALS['error']) && @is_callable(array($GLOBALS['error'], 'debug'))) { $GLOBALS['error']->debug($variable, $name, $line, $file, $recursiveDepth, $debugLevel); } else { $title = $name === '*variable*' ? '' : $name; $group = $line === '*line*' ? NULL : $line; t3lib_utility_Debug::debug($variable, $title, $group); } }
/** * Initializes the current action * * @return void */ protected function initializeAction() { $this->cObj = $this->configurationManager->getContentObject(); $typoScriptSetup = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $this->conf = $typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.']; $this->div = t3lib_div::makeInstance('Tx_Powermail_Utility_Div'); Tx_Powermail_Utility_Div::mergeTypoScript2FlexForm($this->settings); // merge typoscript to flexform (if flexform field also exists and is empty, take typoscript part) $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'Settings', array($this)); // check if ts is included if (!isset($this->settings['staticTemplate'])) { $this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('error_no_typoscript', 'powermail')); } // Debug Output if ($this->settings['debug']['settings']) { t3lib_utility_Debug::debug($this->settings, 'powermail debug: Show Settings'); } }
/** * Explain select queries * If $this->explainOutput is set, SELECT queries will be explained here. Only queries with more than one possible result row will be displayed. * The output is either printed as raw HTML output or embedded into the TS admin panel (checkbox must be enabled!) * * TODO: Feature is not DBAL-compliant * * @param string SQL query * @param string Table(s) from which to select. This is what comes right after "FROM ...". Required value. * @param integer Number of resulting rows * @return boolean True if explain was run, false otherwise */ protected function explain($query, $from_table, $row_count) { if ((int) $this->explainOutput == 1 || (int) $this->explainOutput == 2 && t3lib_div::cmpIP(t3lib_div::getIndpEnv('REMOTE_ADDR'), $GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'])) { // raw HTML output $explainMode = 1; } elseif ((int) $this->explainOutput == 3 && is_object($GLOBALS['TT'])) { // embed the output into the TS admin panel $explainMode = 2; } else { return FALSE; } $error = $this->sql_error(); $trail = t3lib_utility_Debug::debugTrail(); $explain_tables = array(); $explain_output = array(); $res = $this->sql_query('EXPLAIN ' . $query, $this->link); if (is_resource($res)) { while ($tempRow = $this->sql_fetch_assoc($res)) { $explain_output[] = $tempRow; $explain_tables[] = $tempRow['table']; } $this->sql_free_result($res); } $indices_output = array(); // Notice: Rows are skipped if there is only one result, or if no conditions are set if ($explain_output[0]['rows'] > 1 || t3lib_div::inList('ALL', $explain_output[0]['type'])) { // only enable output if it's really useful $debug = TRUE; foreach ($explain_tables as $table) { $tableRes = $this->sql_query('SHOW TABLE STATUS LIKE \'' . $table . '\''); $isTable = $this->sql_num_rows($tableRes); if ($isTable) { $res = $this->sql_query('SHOW INDEX FROM ' . $table, $this->link); if (is_resource($res)) { while ($tempRow = $this->sql_fetch_assoc($res)) { $indices_output[] = $tempRow; } $this->sql_free_result($res); } } $this->sql_free_result($tableRes); } } else { $debug = FALSE; } if ($debug) { if ($explainMode) { $data = array(); $data['query'] = $query; $data['trail'] = $trail; $data['row_count'] = $row_count; if ($error) { $data['error'] = $error; } if (count($explain_output)) { $data['explain'] = $explain_output; } if (count($indices_output)) { $data['indices'] = $indices_output; } if ($explainMode == 1) { t3lib_utility_Debug::debug($data, 'Tables: ' . $from_table, 'DB SQL EXPLAIN'); } elseif ($explainMode == 2) { $GLOBALS['TT']->setTSselectQuery($data); } } return TRUE; } return FALSE; }
/** * Returns a table with the error-messages. * * @return string HTML print of error log */ function printErrorLog() { return count($this->errorLog) ? t3lib_utility_Debug::viewArray($this->errorLog) : ''; }
/** * Shows the log of indexed URLs * * @return string HTML output */ function drawLog() { global $BACK_PATH; $output = ''; // Init: $this->crawlerObj = t3lib_div::makeInstance('tx_crawler_lib'); $this->crawlerObj->setAccessMode('gui'); $this->crawlerObj->setID = t3lib_div::md5int(microtime()); $this->CSVExport = t3lib_div::_POST('_csv'); // Read URL: if (t3lib_div::_GP('qid_read')) { $this->crawlerObj->readUrl(intval(t3lib_div::_GP('qid_read')), TRUE); } // Look for set ID sent - if it is, we will display contents of that set: $showSetId = intval(t3lib_div::_GP('setID')); // Show details: if (t3lib_div::_GP('qid_details')) { // Get entry record: list($q_entry) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_crawler_queue', 'qid=' . intval(t3lib_div::_GP('qid_details'))); // Explode values: $resStatus = $this->getResStatus($q_entry); $q_entry['parameters'] = unserialize($q_entry['parameters']); $q_entry['result_data'] = unserialize($q_entry['result_data']); if (is_array($q_entry['result_data'])) { $q_entry['result_data']['content'] = unserialize($q_entry['result_data']['content']); } if (!$this->pObj->MOD_SETTINGS['log_resultLog']) { unset($q_entry['result_data']['content']['log']); } // Print rudimentary details: $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.back') . '" name="_back" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> Current server time: ' . date('H:i:s', time()) . '<br />' . 'Status: ' . $resStatus . '<br />' . (version_compare(TYPO3_version, '4.5.0', '<') ? t3lib_div::view_array($q_entry) : t3lib_utility_Debug::viewArray($q_entry)); } else { // Show list: // If either id or set id, show list: if ($this->pObj->id || $showSetId) { if ($this->pObj->id) { // Drawing tree: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $tree->init('AND ' . $perms_clause); // Set root row: $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pObj->pageinfo); $tree->tree[] = array('row' => $this->pObj->pageinfo, 'HTML' => $HTML); // Get branch beneath: if ($this->pObj->MOD_SETTINGS['depth']) { $tree->getTree($this->pObj->id, $this->pObj->MOD_SETTINGS['depth'], ''); } // Traverse page tree: $code = ''; $count = 0; foreach ($tree->tree as $data) { $code .= $this->drawLog_addRows($data['row'], $data['HTML'] . t3lib_BEfunc::getRecordTitle('pages', $data['row'], TRUE), intval($this->pObj->MOD_SETTINGS['itemsPerPage'])); if (++$count == 1000) { break; } } } else { $code = ''; $code .= $this->drawLog_addRows($showSetId, 'Set ID: ' . $showSetId); } if ($code) { $output .= ' <br /><br /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.reloadlist') . '" name="_reload" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.downloadcsv') . '" name="_csv" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushvisiblequeue') . '" name="_flush" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.flushfullqueue') . '" name="_flush_all" onclick="return confirm(\'' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.confirmyouresure') . '\');" /> <input type="hidden" value="' . $this->pObj->id . '" name="id" /> <input type="hidden" value="' . $showSetId . '" name="setID" /> <br /> ' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.curtime') . ': ' . date('H:i:s', time()) . ' <br /><br /> <table class="lrPadding c-list crawlerlog">' . $this->drawLog_printTableHeader() . $code . '</table>'; } } else { // Otherwise show available sets: $setList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('set_id, count(*) as count_value, scheduled', 'tx_crawler_queue', '', 'set_id, scheduled', 'scheduled DESC'); $code = ' <tr class="bgColor5 tableheader"> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.setid') . ':</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.count') . 't:</td> <td>' . $GLOBALS['LANG']->sL('LLL:EXT:crawler/modfunc1/locallang.xml:labels.time') . ':</td> </tr> '; $cc = 0; foreach ($setList as $set) { $code .= ' <tr class="bgColor' . ($cc % 2 ? '-20' : '-10') . '"> <td><a href="' . htmlspecialchars('index.php?setID=' . $set['set_id']) . '">' . $set['set_id'] . '</a></td> <td>' . $set['count_value'] . '</td> <td>' . t3lib_BEfunc::dateTimeAge($set['scheduled']) . '</td> </tr> '; $cc++; } $output .= ' <br /><br /> <table class="lrPadding c-list">' . $code . '</table>'; } } if ($this->CSVExport) { $this->outputCsvFile(); } // Return output return $output; }
/** * Prints the debug output of an array * * Compatibility wrapper for obsolete Core methods * * @param array $array Array to output * @return string */ protected function debugArray($array) { if (class_exists('t3lib_utility_Debug')) { return t3lib_utility_Debug::viewArray($array); } else { t3lib_div::view_array($array); } }
/** * Function to read values from session * * @param string $content Given content (normally empty) * @param array $conf TypoScript configuration for this userFunc * @return string Session values */ public function readSession($content = '', $conf = array()) { $info = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->sessionPrefix); $string = 'Powermail Marketing:<br />'; if (is_array($info)) { $string .= t3lib_utility_Debug::viewArray($info); } else { $string .= 'Empty Session!'; } return $string; }
/** * Pushes out some debug messages * * @return void */ protected function debug() { // Debug Output $this->debug_array['Main Table'] = $this->db_values; // array for debug view $this->debug_array['MM Table'] = (count($this->db_values_mm) > 0 ? $this->db_values_mm : 'no values or entry already exists'); // array for debug view if ($this->conf['debug.']['saveToTable']) { t3lib_utility_Debug::debug($this->debug_array, 'powermail debug: Show Values from "SaveToTable" Function'); } }
/** * Authenticate a user (Check various conditions for the user that might invalidate its authentication, eg. password match, domain, IP, etc.) * * @param array $user Data of user. * @return boolean */ public function authUser(array $user) { \t3lib_utility_Debug::debug($user); }
/** * Prints a row with data for the various extension listings * * @param string Extension key * @param array Extension information array * @param array Preset table cells, eg. install/uninstall icons. * @param string <tr> tag class * @param array Array with installed extension keys (as keys) * @param boolean If set, the list is coming from remote server. * @param string Alternative link URL * @return string HTML <tr> content */ function extensionListRow($extKey, $extInfo, $cells, $bgColorClass = '', $inst_list = array(), $import = 0, $altLinkUrl = '') { $stateColors = tx_em_Tools::getStateColors(); // Icon: $imgInfo = @getImageSize(tx_em_Tools::getExtPath($extKey, $extInfo['type']) . '/ext_icon.gif'); if (is_array($imgInfo)) { $cells[] = '<td><img src="' . $GLOBALS['BACK_PATH'] . tx_em_Tools::typeRelPath($extInfo['type']) . $extKey . '/ext_icon.gif' . '" ' . $imgInfo[3] . ' alt="" /></td>'; } elseif ($extInfo['_ICON']) { $cells[] = '<td>' . $extInfo['_ICON'] . '</td>'; } else { $cells[] = '<td><img src="clear.gif" width="1" height="1" alt="" /></td>'; } // Extension title: $cells[] = '<td nowrap="nowrap"><a href="' . htmlspecialchars($altLinkUrl ? $altLinkUrl : t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'SET[singleDetails]' => 'info'))) . '" title="' . htmlspecialchars($extInfo['EM_CONF']['description']) . '">' . t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['title'] ? htmlspecialchars($extInfo['EM_CONF']['title']) : '<em>' . $extKey . '</em>', 40) . '</a></td>'; // Based on the display mode you will see more or less details: if (!$this->parentObject->MOD_SETTINGS['display_details']) { $cells[] = '<td>' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['description'], 400)) . '<br /><img src="clear.gif" width="300" height="1" alt="" /></td>'; $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['author_email'] ? '<a href="mailto:' . htmlspecialchars($extInfo['EM_CONF']['author_email']) . '">' : '') . htmlspecialchars($extInfo['EM_CONF']['author']) . (htmlspecialchars($extInfo['EM_CONF']['author_email']) ? '</a>' : '') . ($extInfo['EM_CONF']['author_company'] ? '<br />' . htmlspecialchars($extInfo['EM_CONF']['author_company']) : '') . '</td>'; } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 2) { $cells[] = '<td nowrap="nowrap">' . $extInfo['EM_CONF']['priority'] . '</td>'; $cells[] = '<td nowrap="nowrap">' . implode('<br />', t3lib_div::trimExplode(',', $extInfo['EM_CONF']['modify_tables'], 1)) . '</td>'; $cells[] = '<td nowrap="nowrap">' . $extInfo['EM_CONF']['module'] . '</td>'; $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['clearCacheOnLoad'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>'; $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['internal'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>'; $cells[] = '<td nowrap="nowrap">' . ($extInfo['EM_CONF']['shy'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>'; } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 3) { $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo); $cells[] = '<td>' . $this->parentObject->extensionDetails->extInformationArray_dbReq($techInfo) . '</td>'; $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['TSfiles']) ? implode('<br />', $techInfo['TSfiles']) : '') . '</td>'; $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['flags']) ? implode('<br />', $techInfo['flags']) : '') . '</td>'; $cells[] = '<td nowrap="nowrap">' . (is_array($techInfo['moduleNames']) ? implode('<br />', $techInfo['moduleNames']) : '') . '</td>'; $cells[] = '<td nowrap="nowrap">' . ($techInfo['conf'] ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes') : '') . '</td>'; $cells[] = '<td>' . tx_em_Tools::rfw((t3lib_extMgm::isLoaded($extKey) && $techInfo['tables_error'] ? '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_table_error') . '</strong><br />' . $GLOBALS['LANG']->getLL('extInfoArray_missing_fields') : '') . (t3lib_extMgm::isLoaded($extKey) && $techInfo['static_error'] ? '<strong>' . $GLOBALS['LANG']->getLL('extInfoArray_static_table_error') . '</strong><br />' . $GLOBALS['LANG']->getLL('extInfoArray_static_tables_missing_empty') : '')) . '</td>'; } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 4) { $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo, 1); $cells[] = '<td>' . (is_array($techInfo['locallang']) ? implode('<br />', $techInfo['locallang']) : '') . '</td>'; $cells[] = '<td>' . (is_array($techInfo['classes']) ? implode('<br />', $techInfo['classes']) : '') . '</td>'; $cells[] = '<td>' . (is_array($techInfo['errors']) ? tx_em_Tools::rfw(implode('<hr />', $techInfo['errors'])) : '') . '</td>'; $cells[] = '<td>' . (is_array($techInfo['NSerrors']) ? !t3lib_div::inList($this->parentObject->nameSpaceExceptions, $extKey) ? t3lib_utility_Debug::viewarray($techInfo['NSerrors']) : tx_em_Tools::dfw($GLOBALS['LANG']->getLL('extInfoArray_exception')) : '') . '</td>'; } elseif ($this->parentObject->MOD_SETTINGS['display_details'] == 5) { $currentMd5Array = $this->parentObject->extensionDetails->serverExtensionMD5array($extKey, $extInfo); $affectedFiles = ''; $msgLines = array(); $msgLines[] = $GLOBALS['LANG']->getLL('listRow_files') . ' ' . count($currentMd5Array); if (strcmp($extInfo['EM_CONF']['_md5_values_when_last_written'], serialize($currentMd5Array))) { $msgLines[] = tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_difference_detected') . '</strong>'); $affectedFiles = tx_em_Tools::findMD5ArrayDiff($currentMd5Array, unserialize($extInfo['EM_CONF']['_md5_values_when_last_written'])); if (count($affectedFiles)) { $msgLines[] = '<br /><strong>' . $GLOBALS['LANG']->getLL('extInfoArray_modified_files') . '</strong><br />' . tx_em_Tools::rfw(implode('<br />', $affectedFiles)); } } $cells[] = '<td>' . implode('<br />', $msgLines) . '</td>'; } else { // Default view: $verDiff = $inst_list[$extKey] && tx_em_Tools::versionDifference($extInfo['EM_CONF']['version'], $inst_list[$extKey]['EM_CONF']['version'], $this->parentObject->versionDiffFactor); $cells[] = '<td nowrap="nowrap"><em>' . $extKey . '</em></td>'; $cells[] = '<td nowrap="nowrap">' . ($verDiff ? '<strong>' . tx_em_Tools::rfw(htmlspecialchars($extInfo['EM_CONF']['version'])) . '</strong>' : $extInfo['EM_CONF']['version']) . '</td>'; if (!$import) { // Listing extension on LOCAL server: // Extension Download: $cells[] = '<td nowrap="nowrap"><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[doBackup]' => 1, 'SET[singleDetails]' => 'backup', 'CMD[showExt]' => $extKey))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:download') . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-download') . '</a></td>'; // Manual download $manual = tx_em_Tools::typePath($extInfo['type']) . $extKey . '/doc/manual.sxw'; $manualRelPath = t3lib_div::resolveBackPath($this->parentObject->doc->backPath . tx_em_Tools::typeRelPath($extInfo['type'])) . $extKey . '/doc/manual.sxw'; if ($extInfo['EM_CONF']['docPath']) { $manual = tx_em_Tools::typePath($extInfo['type']) . $extKey . '/' . $extInfo['EM_CONF']['docPath'] . '/manual.sxw'; $manualRelPath = t3lib_div::resolveBackPath($this->parentObject->doc->backPath . tx_em_Tools::typeRelPath($extInfo['type'])) . $extKey . '/' . $extInfo['EM_CONF']['docPath'] . '/manual.sxw'; } $cells[] = '<td nowrap="nowrap">' . (tx_em_Tools::typePath($extInfo['type']) && @is_file($manual) ? '<a href="' . htmlspecialchars($manualRelPath) . '" target="_blank" title="' . $GLOBALS['LANG']->getLL('listRow_local_manual') . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-extension-documentation') . '</a>' : '') . '</td>'; // Double installation (inclusion of an extension in more than one of system, global or local scopes) $doubleInstall = ''; if (strlen($extInfo['doubleInstall']) > 1) { // Separate the "SL" et al. string into an array and replace L by Local, G by Global etc. $doubleInstallations = str_replace(array('S', 'G', 'L'), array($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:sysext'), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:globalext'), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:localext')), str_split($extInfo['doubleInstall'])); // Last extension is the one actually used $usedExtension = array_pop($doubleInstallations); // Next extension is overridden $overriddenExtensions = array_pop($doubleInstallations); // If the array is not yet empty, the extension is actually installed 3 times (SGL) if (count($doubleInstallations) > 0) { $lastExtension = array_pop($doubleInstallations); $overriddenExtensions .= ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:and') . ' ' . $lastExtension; } $doubleInstallTitle = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_tools_em.xml:double_inclusion'), $usedExtension, $overriddenExtensions); $doubleInstall = ' <strong><abbr title="' . $doubleInstallTitle . '">' . tx_em_Tools::rfw($extInfo['doubleInstall']) . '</abbr></strong>'; } $cells[] = '<td nowrap="nowrap">' . $this->types[$extInfo['type']] . $doubleInstall . '</td>'; } else { // Listing extensions from REMOTE repository: $inst_curVer = $inst_list[$extKey]['EM_CONF']['version']; if (isset($inst_list[$extKey])) { if ($verDiff) { $inst_curVer = '<strong>' . tx_em_Tools::rfw($inst_curVer) . '</strong>'; } } $cells[] = '<td nowrap="nowrap">' . t3lib_befunc::date($extInfo['EM_CONF']['lastuploaddate']) . '</td>'; $cells[] = '<td nowrap="nowrap">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($extInfo['EM_CONF']['author'], $GLOBALS['BE_USER']->uc[titleLen])) . '</td>'; $cells[] = '<td nowrap="nowrap">' . $inst_curVer . '</td>'; $cells[] = '<td nowrap="nowrap">' . $this->api->typeLabels[$inst_list[$extKey]['type']] . (strlen($inst_list[$extKey]['doubleInstall']) > 1 ? '<strong> ' . tx_em_Tools::rfw($inst_list[$extKey]['doubleInstall']) . '</strong>' : '') . '</td>'; $cells[] = '<td nowrap="nowrap">' . ($extInfo['downloadcounter_all'] ? $extInfo['downloadcounter_all'] : ' ') . '/' . ($extInfo['downloadcounter'] ? $extInfo['downloadcounter'] : ' ') . '</td>'; } $cells[] = '<td nowrap="nowrap" class="extstate" style="background-color:' . $stateColors[$extInfo['EM_CONF']['state']] . ';">' . $this->states[$extInfo['EM_CONF']['state']] . '</td>'; } // show a different background through a different class for insecure (-1) extensions, // for unreviewed (0) and reviewed extensions (1), just use the regular class if ($this->xmlHandler->getReviewState($extKey, $extInfo['EM_CONF']['version']) < 0) { $bgclass = ' class="unsupported-ext"'; } else { $bgclass = ' class="' . ($bgColorClass ? $bgColorClass : 'em-listbg1') . '"'; } return ' <tr' . $bgclass . '> ' . implode(' ', $cells) . ' </tr>'; }
/** * Logs a call to a deprecated function. * The log message will be taken from the annotation. * @return void */ public static function logDeprecatedFunction() { if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) { return; } $trail = debug_backtrace(); if ($trail[1]['type']) { $function = new ReflectionMethod($trail[1]['class'], $trail[1]['function']); } else { $function = new ReflectionFunction($trail[1]['function']); } $msg = ''; if (preg_match('/@deprecated\\s+(.*)/', $function->getDocComment(), $match)) { $msg = $match[1]; } // trigger PHP error with a short message: <function> is deprecated (called from <source>, defined in <source>) $errorMsg = 'Function ' . $trail[1]['function']; if ($trail[1]['class']) { $errorMsg .= ' of class ' . $trail[1]['class']; } $errorMsg .= ' is deprecated (called from ' . $trail[1]['file'] . '#' . $trail[1]['line'] . ', defined in ' . $function->getFileName() . '#' . $function->getStartLine() . ')'; // write a longer message to the deprecation log: <function> <annotion> - <trace> (<source>) $logMsg = $trail[1]['class'] . $trail[1]['type'] . $trail[1]['function']; $logMsg .= '() - ' . $msg . ' - ' . t3lib_utility_Debug::debugTrail(); $logMsg .= ' (' . substr($function->getFileName(), strlen(PATH_site)) . '#' . $function->getStartLine() . ')'; self::deprecationLog($logMsg); }
function gibModulPdf($args) { $dateiName = strtolower($args['stug']) . '_' . $args['pord'] . '_' . $args['spo'] . '_' . $args['lang'] . '.pdf'; $pfadKomplett = 'fileadmin/medien/fakultaeten/allgemein/modulbeschreibungen/' . strtolower($args['faku']); if (!is_dir($pfadKomplett)) { mkdir($pfadKomplett, 0755); } $pfadKomplett = 'fileadmin/medien/fakultaeten/allgemein/modulbeschreibungen/' . strtolower($args['faku']) . '/' . strtolower($args['stug']); if (!is_dir($pfadKomplett)) { mkdir($pfadKomplett, 0755); } $dateiPfad = $pfadKomplett . '/' . $dateiName; $documentRoot = t3lib_div::getIndpEnv(TYPO3_DOCUMENT_ROOT); $systemPfad = $documentRoot . '/' . $dateiPfad; $dateiVorhanden = file_exists($systemPfad); if ($dateiVorhanden) { $heute = date("Ymd", time()); $dateiDatum = date("Ymd", filectime($systemPfad)); if ($heute != $dateiDatum) { unlink($systemPfad); $dateiVorhanden = FALSE; } } if (!$dateiVorhanden) { $report = ''; $url1 = 'http://www3.hs-esslingen.de/qislsf/rds?state=modulBeschrGast&moduleParameter=modDescr&struct=auswahlBaum&language=' . $args['lang'] . '&next=wait.vm&lastState=modulBeschrGast' . '&nodeID=auswahlBaum|abschluss:abschl=' . $args['abs'] . '|studiengang:stg=' . $args['stug'] . '|stgSpecials:vert=,schwp=,kzfa=H,pversion=' . $args['spo'] . '|kontoOnTop:pordnr=' . $args['pord'] . '&asi=#' . 'auswahlBaum|abschluss:abschl=' . $args['abs'] . '|studiengang:stg=' . $args['stug'] . '|stgSpecials:vert=,schwp=,kzfa=H,pversion=' . $args['spo'] . '|kontoOnTop:pordnr=' . $args['pord']; $url1 = 'http://www3.hs-esslingen.de/qislsf/rds?state=modulBeschrGast&moduleParameter=modDescr'; if ($GLOBALS['TSFE']->fe_user->user['username'] == 'mmirsch') { t3lib_utility_Debug::debugInPopUpWindow($url1); } $redirectHeader = tx_he_tools_util::getURL($url1, 1, 'GET'); preg_match('#^.*JSESSIONID=(.*);.*#Uis', $redirectHeader, $matches); $sessionCookie = '&jsessionid==' . $matches[1]; $url2 = 'http://www3.hs-esslingen.de/qislsf/rds' . '?state=modulBeschrGast&createPDF=Y&create=blobs&moduleParameter=modDescr&struct=auswahlBaum&language=' . $args['lang'] . '&next=wait.vm&lastState=modulBeschrGast' . '&nodeID=auswahlBaum|abschluss:abschl=' . $args['abs'] . '|studiengang:stg=' . $args['stug'] . '|stgSpecials:vert=,schwp=,kzfa=H,pversion=' . $args['spo'] . '|kontoOnTop:pordnr=' . $args['pord'] . '&asi=#' . 'auswahlBaum|abschluss:abschl=' . $args['abs'] . '|studiengang:stg=' . $args['stug'] . '|stgSpecials:vert=,schwp=,kzfa=H,pversion=' . $args['spo'] . '|kontoOnTop:pordnr=' . $args['pord'] . $sessionCookie; $content = tx_he_tools_util::getURL($url2, 0, 'SET'); if ($GLOBALS['TSFE']->fe_user->user['username'] == 'mmirsch') { t3lib_utility_Debug::debugInPopUpWindow($matches); t3lib_utility_Debug::debugInPopUpWindow($url2); t3lib_utility_Debug::debugInPopUpWindow($content); exit; } /* $url2 = 'http://www3.hs-esslingen.de/qislsf/rds?state=modulBeschrGast&createPDF=Y&create=blobs&moduleParameter=modDescr&struct=auswahlBaum&language=' . $args['lang'] . '&next=wait.vm&lastState=modulBeschrGast' . '&nodeID=auswahlBaum|abschluss:abschl=' . $args['abs'] . '|studiengang:stg=' . $args['stug']. '|stgSpecials:vert=,schwp=,kzfa=H,pversion=' . $args['spo']. '|kontoOnTop:pordnr=' . $args['pord']. '&asi=#' . 'auswahlBaum|abschluss:abschl=' . $args['abs'] . '|studiengang:stg=' . $args['stug']. '|stgSpecials:vert=,schwp=,kzfa=H,pversion=' . $args['spo']. '|kontoOnTop:pordnr=' . $args['pord']; preg_match('#^(.*)(http://www3.hs-esslingen.de/qislsf/.*&asi=)(.*)#Uis',$redirectHeader,$matches); $urlNew = $matches[2]; $content = t3lib_div::getURL($urlNew, 1, true, $report); */ if ($report['error']) { $error = 'Fehler beim Einlesen des PDFs: "' . $dateiPfad . '"'; } else { file_put_contents($dateiPfad, $content); } } $datei = fopen($dateiPfad, 'rb'); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: no-cache'); header("Content-Type : application/pdf"); header("Content-Disposition: attachment; filename=" . $dateiName); while (!feof($datei)) { set_time_limit(60); echo fread($datei, 8192); } fclose($datei); exit; }
/** * [Describe function...] * * @param [type] $mQ: ... * @param [type] $res: ... * @param [type] $table: ... * @return [type] ... */ function getQueryResultCode($mQ, $res, $table) { global $TCA; $output = ''; $cPR = array(); switch ($mQ) { case 'count': $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); $cPR['header'] = 'Count'; $cPR['content'] = '<BR><strong>' . $row[0] . '</strong> records selected.'; break; case 'all': $rowArr = array(); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $rowArr[] = $this->resultRowDisplay($row, $TCA[$table], $table); $lrow = $row; } if (is_array($this->hookArray['beforeResultTable'])) { foreach ($this->hookArray['beforeResultTable'] as $_funcRef) { $out .= t3lib_div::callUserFunction($_funcRef, $GLOBALS['SOBE']->MOD_SETTINGS, $this); } } if (count($rowArr)) { $out .= '<table border="0" cellpadding="2" cellspacing="1" width="100%">' . $this->resultRowTitles($lrow, $TCA[$table], $table) . implode(LF, $rowArr) . '</table>'; } if (!$out) { $out = '<em>No rows selected!</em>'; } $cPR['header'] = 'Result'; $cPR['content'] = $out; break; case 'csv': $rowArr = array(); $first = 1; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($first) { $rowArr[] = $this->csvValues(array_keys($row), ',', ''); $first = 0; } $rowArr[] = $this->csvValues($row, ',', '"', $TCA[$table], $table); } if (count($rowArr)) { $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea(implode(LF, $rowArr)) . '</textarea>'; if (!$this->noDownloadB) { $out .= '<BR><input type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">'; // document.forms[0].target=\'_blank\'; } // Downloads file: if (t3lib_div::_GP('download_file')) { $filename = 'TYPO3_' . $table . '_export_' . date('dmy-Hi') . '.csv'; $mimeType = 'application/octet-stream'; header('Content-Type: ' . $mimeType); header('Content-Disposition: attachment; filename=' . $filename); echo implode(CRLF, $rowArr); exit; } } if (!$out) { $out = '<em>No rows selected!</em>'; } $cPR['header'] = 'Result'; $cPR['content'] = $out; break; case 'xml': $xmlObj = t3lib_div::makeInstance('t3lib_xml', 'typo3_export'); $xmlObj->includeNonEmptyValues = 1; $xmlObj->renderHeader(); $first = 1; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($first) { $xmlObj->setRecFields($table, implode(',', array_keys($row))); $first = 0; } $valueArray = $row; if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) { foreach ($valueArray as $key => $val) { $valueArray[$key] = $this->getProcessedValueExtra($table, $key, $val, array(), ','); } } $xmlObj->addRecord($table, $valueArray); } $xmlObj->renderFooter(); if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { $xmlData = $xmlObj->getResult(); $out .= '<textarea name="whatever" rows="20" wrap="off"' . $GLOBALS['SOBE']->doc->formWidthText($this->formW, '', 'off') . ' class="fixed-font">' . t3lib_div::formatForTextarea($xmlData) . '</textarea>'; if (!$this->noDownloadB) { $out .= '<BR><input type="submit" name="download_file" value="Click to download file" onClick="window.location.href=\'' . $this->downloadScript . '\';">'; // document.forms[0].target=\'_blank\'; } // Downloads file: if (t3lib_div::_GP('download_file')) { $filename = 'TYPO3_' . $table . '_export_' . date('dmy-Hi') . '.xml'; $mimeType = 'application/octet-stream'; header('Content-Type: ' . $mimeType); header('Content-Disposition: attachment; filename=' . $filename); echo $xmlData; exit; } } if (!$out) { $out = '<em>No rows selected!</em>'; } $cPR['header'] = 'Result'; $cPR['content'] = $out; break; case 'explain': default: while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $out .= '<br />' . t3lib_utility_Debug::viewArray($row); } $cPR['header'] = 'Explain SQL query'; $cPR['content'] = $out; break; } return $cPR; }
/** * Renders the hierarchical display for a Data Structure. * Calls itself recursively * * @param array Part of Data Structure (array of elements) * @param boolean If true, the Data Structure table will show links for mapping actions. Otherwise it will just layout the Data Structure visually. * @param array Part of Current mapping information corresponding to the $dataStruct array - used to evaluate the status of mapping for a certain point in the structure. * @param array Array of HTML paths * @param array Options for mapping mode control (INNER, OUTER etc...) * @param array Content from template file splitted by current mapping info - needed to evaluate whether mapping information for a certain level actually worked on live content! * @param integer Recursion level, counting up * @param array Accumulates the table rows containing the structure. This is the array returned from the function. * @param string Form field prefix. For each recursion of this function, two [] parts are added to this prefix * @param string HTML path. For each recursion a section (divided by "|") is added. * @param boolean If true, the "Map" link can be shown, otherwise not. Used internally in the recursions. * @return array Table rows as an array of <tr> tags, $tRows */ function drawDataStructureMap($dataStruct,$mappingMode=0,$currentMappingInfo=array(),$pathLevels=array(),$optDat=array(),$contentSplittedByMapping=array(),$level=0,$tRows=array(),$formPrefix='',$path='',$mapOK=1) { $bInfo = t3lib_div::clientInfo(); $multilineTooltips = ($bInfo['BROWSER'] == 'msie'); $rowIndex = -1; // Data Structure array must be ... and array of course... if (is_array($dataStruct)) { foreach($dataStruct as $key => $value) { $rowIndex++; if ($key == 'meta') { // Do not show <meta> information in mapping interface! continue; } if (is_array($value)) { // The value of each entry must be an array. // ******************** // Making the row: // ******************** $rowCells=array(); // Icon: $info = $this->dsTypeInfo($value); $icon = '<img'.$info[2].' alt="" title="'.$info[1].$key.'" class="absmiddle" />'; // Composing title-cell: if (preg_match('/^LLL:/', $value['tx_templavoila']['title'])) { $translatedTitle = $GLOBALS['LANG']->sL($value['tx_templavoila']['title']); $translateIcon = '<sup title="' . $GLOBALS['LANG']->getLL('displayDSTitleTranslated') . '">*</sup>'; } else { $translatedTitle = $value['tx_templavoila']['title']; $translateIcon = ''; } $this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['title'] = $icon.'<strong>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($translatedTitle, 30)).'</strong>'.$translateIcon; $rowCells['title'] = '<img src="clear.gif" width="'.($level*16).'" height="1" alt="" />'.$this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['title']; // Description: $this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['description'] = $rowCells['description'] = htmlspecialchars($value['tx_templavoila']['description']); // In "mapping mode", render HTML page and Command links: if ($mappingMode) { // HTML-path + CMD links: $isMapOK = 0; if ($currentMappingInfo[$key]['MAP_EL']) { // If mapping information exists...: $mappingElement = str_replace('~~~', ' ', $currentMappingInfo[$key]['MAP_EL']); if (isset($contentSplittedByMapping['cArray'][$key])) { // If mapping of this information also succeeded...: $cF = implode(chr(10),t3lib_div::trimExplode(chr(10),$contentSplittedByMapping['cArray'][$key],1)); if (strlen($cF)>200) { $cF = t3lib_div::fixed_lgd_cs($cF,90).' '.t3lib_div::fixed_lgd_cs($cF,-90); } // Render HTML path: list($pI) = $this->markupObj->splitPath($currentMappingInfo[$key]['MAP_EL']); $tagIcon = t3lib_iconWorks::skinImg($this->doc->backPath, t3lib_extMgm::extRelPath('templavoila') . 'html_tags/' . $pI['el'] . '.gif', 'height="17"') . ' alt="" border="0"'; $okTitle = htmlspecialchars($cF ? sprintf($GLOBALS['LANG']->getLL('displayDSContentFound'), strlen($contentSplittedByMapping['cArray'][$key])) . ($multilineTooltips ? ':' . chr(10) . chr(10) . $cF : '') : $GLOBALS['LANG']->getLL('displayDSContentEmpty')); $rowCells['htmlPath'] = t3lib_iconWorks::getSpriteIcon('status-dialog-ok', array('title' => $okTitle)). tx_templavoila_htmlmarkup::getGnyfMarkup($pI['el'], '---' . htmlspecialchars(t3lib_div::fixed_lgd_cs($mappingElement, -80)) ). ($pI['modifier'] ? $pI['modifier'] . ($pI['modifier_value'] ? ':' . ($pI['modifier'] != 'RANGE' ? $pI['modifier_value'] : '...') : '') : ''); $rowCells['htmlPath'] = '<a href="'.$this->linkThisScript(array( 'htmlPath'=>$path.($path?'|':'').preg_replace('/\/[^ ]*$/','',$currentMappingInfo[$key]['MAP_EL']), 'showPathOnly'=>1, 'DS_element' => t3lib_div::_GP('DS_element') )).'">'.$rowCells['htmlPath'].'</a>'; // CMD links, default content: $rowCells['cmdLinks'] = '<span class="nobr"><input type="submit" value="Re-Map" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path, 'mappingToTags' => $value['tx_templavoila']['tags'], 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" title="' . $GLOBALS['LANG']->getLL('buttonRemapTitle') . '" />' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonChangeMode') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path . ($path ? '|' :'') . $pI['path'], 'doMappingOfPath' => 1, 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" title="' . $GLOBALS['LANG']->getLL('buttonChangeMode') . '" /></span>'; // If content mapped ok, set flag: $isMapOK=1; } else { // Issue warning if mapping was lost: $rowCells['htmlPath'] = t3lib_iconWorks::getSpriteIcon('status-dialog-warning', array('title' => $GLOBALS['LANG']->getLL('msgNoContentFound'))) . htmlspecialchars($mappingElement); } } else { // For non-mapped cases, just output a no-break-space: $rowCells['htmlPath'] = ' '; } // CMD links; Content when current element is under mapping, then display control panel or message: if ($this->mapElPath == $formPrefix.'['.$key.']') { if ($this->doMappingOfPath) { // Creating option tags: $lastLevel = end($pathLevels); $tagsMapping = $this->explodeMappingToTagsStr($value['tx_templavoila']['tags']); $mapDat = is_array($tagsMapping[$lastLevel['el']]) ? $tagsMapping[$lastLevel['el']] : $tagsMapping['*']; unset($mapDat['']); if (is_array($mapDat) && !count($mapDat)) unset($mapDat); // Create mapping options: $didSetSel=0; $opt=array(); foreach($optDat as $k => $v) { list($pI) = $this->markupObj->splitPath($k); if (($value['type']=='attr' && $pI['modifier']=='ATTR') || ($value['type']!='attr' && $pI['modifier']!='ATTR')) { if ( (!$this->markupObj->tags[$lastLevel['el']]['single'] || $pI['modifier']!='INNER') && (!is_array($mapDat) || ($pI['modifier']!='ATTR' && isset($mapDat[strtolower($pI['modifier']?$pI['modifier']:'outer')])) || ($pI['modifier']=='ATTR' && (isset($mapDat['attr']['*']) || isset($mapDat['attr'][$pI['modifier_value']])))) ) { if($k==$currentMappingInfo[$key]['MAP_EL']) { $sel = ' selected="selected"'; $didSetSel=1; } else { $sel = ''; } $opt[]='<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>'; } } } // Finally, put together the selector box: $rowCells['cmdLinks'] = tx_templavoila_htmlmarkup::getGnyfMarkup($pI['el'], '---' . htmlspecialchars(t3lib_div::fixed_lgd_cs($lastLevel['path'], -80)) ). '<br /><select name="dataMappingForm'.$formPrefix.'['.$key.'][MAP_EL]"> '.implode(' ',$opt).' <option value=""></option> </select> <br /> <input type="submit" name="_save_data_mapping" value="' . $GLOBALS['LANG']->getLL('buttonSet') . '" /> <input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('buttonCancel') . '" />'; $rowCells['cmdLinks'].= $this->cshItem('xMOD_tx_templavoila','mapping_modeset',$this->doc->backPath,'',FALSE,'margin-bottom: 0px;'); } else { $rowCells['cmdLinks'] = t3lib_iconWorks::getSpriteIcon('status-dialog-notification') . ' <strong>' . $GLOBALS['LANG']->getLL('msgHowToMap') . '</strong>'; $rowCells['cmdLinks'].= '<br /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonCancel') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'DS_element' => t3lib_div::_GP('DS_element') )) .'\';return false;" />'; } } elseif (!$rowCells['cmdLinks'] && $mapOK && $value['type']!='no_map') { $rowCells['cmdLinks'] = '<input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonMap') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path, 'mappingToTags' => $value['tx_templavoila']['tags'], 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" />'; } } // Display mapping rules: $rowCells['tagRules'] = implode('<br />', t3lib_div::trimExplode(',', strtolower($value['tx_templavoila']['tags']), 1)); if (!$rowCells['tagRules']) { $rowCells['tagRules'] = $GLOBALS['LANG']->getLL('all'); } // Display edit/delete icons: if ($this->editDataStruct) { $editAddCol = '<a href="' . $this->linkThisScript(array( 'DS_element' => $formPrefix . '[' . $key . ']' )) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editEntry'))). '</a> <a href="' . $this->linkThisScript(array( 'DS_element_DELETE' => $formPrefix . '[' . $key . ']' )) . '" onClick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('confirmDeleteEntry')) . ');">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => $GLOBALS['LANG']->getLL('deleteEntry'))). '</a>'; $editAddCol = '<td nowrap="nowrap">' . $editAddCol . '</td>'; } else { $editAddCol = ''; } // Description: if ($this->_preview) { if (!is_array($value['tx_templavoila']['sample_data'])) { $rowCells['description'] = '[' . $GLOBALS['LANG']->getLL('noSampleData') . ']'; } elseif (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000){ $rowCells['description'] = t3lib_div::view_array($value['tx_templavoila']['sample_data']); } else { $rowCells['description'] = t3lib_utility_Debug::viewArray($value['tx_templavoila']['sample_data']); } } // Getting editing row, if applicable: list($addEditRows, $placeBefore) = $this->dsEdit->drawDataStructureMap_editItem($formPrefix, $key, $value, $level, $rowCells); // Add edit-row if found and destined to be set BEFORE: if ($addEditRows && $placeBefore) { $tRows[]= $addEditRows; } else // Put row together if (!$this->mapElPath || $this->mapElPath == $formPrefix.'['.$key.']') { $tRows[]=' <tr class="' . ($rowIndex % 2 ? 'bgColor4' : 'bgColor6') . '"> <td nowrap="nowrap" valign="top">'.$rowCells['title'].'</td> '.($this->editDataStruct ? '<td nowrap="nowrap">'.$key.'</td>' : '').' <td>'.$rowCells['description'].'</td> '.($mappingMode ? '<td nowrap="nowrap">'.$rowCells['htmlPath'].'</td> <td>'.$rowCells['cmdLinks'].'</td>' : '' ).' <td>'.$rowCells['tagRules'].'</td> '.$editAddCol.' </tr>'; } // Recursive call: if (($value['type']=='array') || ($value['type']=='section')) { $tRows = $this->drawDataStructureMap( $value['el'], $mappingMode, $currentMappingInfo[$key]['el'], $pathLevels, $optDat, $contentSplittedByMapping['sub'][$key], $level+1, $tRows, $formPrefix.'['.$key.'][el]', $path.($path?'|':'').$currentMappingInfo[$key]['MAP_EL'], $isMapOK ); } // Add edit-row if found and destined to be set AFTER: if ($addEditRows && !$placeBefore) { $tRows[]= $addEditRows; } } } } return $tRows; }
private function debug($var) { t3lib_utility_Debug::debug($var); }
/** * Show meta data part of Data Structure * * @param [type] $DSstring: ... * @return [type] ... */ function DSdetails($DSstring) { $DScontent = t3lib_div::xml2array($DSstring); $inputFields = 0; $referenceFields = 0; $rootelements = 0; if (is_array ($DScontent) && is_array($DScontent['ROOT']['el'])) { foreach($DScontent['ROOT']['el'] as $elKey => $elCfg) { $rootelements++; if (isset($elCfg['TCEforms'])) { // Assuming that a reference field for content elements is recognized like this, increment counter. Otherwise assume input field of some sort. if ($elCfg['TCEforms']['config']['type']==='group' && $elCfg['TCEforms']['config']['allowed']==='tt_content') { $referenceFields++; } else { $inputFields++; } } if (isset($elCfg['el'])) $elCfg['el'] = '...'; unset($elCfg['tx_templavoila']['sample_data']); unset($elCfg['tx_templavoila']['tags']); unset($elCfg['tx_templavoila']['eType']); if (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000){ $rootElementsHTML.='<b>'.$elCfg['tx_templavoila']['title'].'</b>'.t3lib_div::view_array($elCfg); } else { $rootElementsHTML.='<b>'.$elCfg['tx_templavoila']['title'].'</b>'.t3lib_utility_Debug::viewArray($elCfg); } } } /* $DScontent = array('meta' => $DScontent['meta']); */ $languageMode = ''; if (is_array($DScontent['meta'])) { if ($DScontent['meta']['langDisable']) { $languageMode = 'Disabled'; } elseif ($DScontent['meta']['langChildren']) { $languageMode = 'Inheritance'; } else { $languageMode = 'Separate'; } } return array( 'HTML' => /*t3lib_div::view_array($DScontent).'Language Mode => "'.$languageMode.'"<hr/> Root Elements = '.$rootelements.', hereof ref/input fields = '.($referenceFields.'/'.$inputFields).'<hr/> '.$rootElementsHTML*/ $this->renderDSdetails($DScontent), 'languageMode' => $languageMode, 'rootelements' => $rootelements, 'inputFields' => $inputFields, 'referenceFields' => $referenceFields ); }
/** * Used in the menu item state example of the "testsite" package at page-path "/Intro/TypoScript examples/Menu object examples/Menu state test/" * * @param array $I The menu item array, $this->I (in the parent object) * @param array $conf TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated) * @return array The processed $I array returned (and stored in $this->I of the parent object again) * @see tslib_menu::userProcess(), tslib_tmenu::writeMenu(), tslib_gmenu::writeMenu() */ function user_IProcFuncTest($I, $conf) { $itemRow = $conf['parentObj']->menuArr[$I['key']]; // Setting the document status content to the value of the page title on mouse over $I['linkHREF']['onMouseover'] .= 'extraRollover(\'' . rawurlencode($itemRow['title']) . '\');'; $conf['parentObj']->I = $I; $conf['parentObj']->setATagParts(); $I = $conf['parentObj']->I; if ($I['parts']['ATag_begin']) { $I['parts']['ATag_begin'] = $I['A1']; } if ($conf['debug']) { // Outputting for debug example: echo 'ITEM: <h2>' . htmlspecialchars($itemRow['uid'] . ': ' . $itemRow['title']) . '</h2>'; t3lib_utility_Debug::debug($itemRow); t3lib_utility_Debug::debug($I); echo '<hr />'; } // Returns: return $I; }
/** * store collected data of defined indexers to db * * @param integer $storagepid * @param string $title * @param string $type * @param string $targetpid * @param string $content * @param string $tags * @param string $params * @param string $abstract * @param string $language * @param integer $starttime * @param integer $endtime * @param string $fe_group * @param boolean $debugOnly * @param array $additionalFields */ function storeInIndex($storagePid, $title, $type, $targetPid, $content, $tags = '', $params = '', $abstract = '', $language = 0, $starttime = 0, $endtime = 0, $fe_group = '', $debugOnly = false, $additionalFields = array()) { // if there are errors found in current record return false and break processing if (!$this->checkIfRecordHasErrorsBeforeIndexing($storagePid, $title, $type, $targetPid)) { return false; } // optionally add tag set in the indexer configuration if (!empty($this->indexerConfig['filteroption']) && (substr($type, 0, 4) != 'file' || substr($type, 0, 4) == 'file' && $this->indexerConfig['index_use_page_tags_for_files'] || $this->indexerConfig['type'] == 'file')) { $indexerTag = $this->getTag($this->indexerConfig['filteroption']); $tagChar = $this->extConf['prePostTagChar']; if ($tags) { $tags .= ',' . $tagChar . $indexerTag . $tagChar; } else { $tags = $tagChar . $indexerTag . $tagChar; } if (TYPO3_VERSION_INTEGER >= 7000000) { $tags = TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList($tags); } else { $tags = t3lib_div::uniqueList($tags); } } $table = 'tx_kesearch_index'; $fieldValues = $this->createFieldValuesForIndexing($storagePid, $title, $type, $targetPid, $content, $tags, $params, $abstract, $language, $starttime, $endtime, $fe_group, $additionalFields); // check if record already exists if (substr($type, 0, 4) == 'file') { $recordExists = $this->checkIfFileWasIndexed($fieldValues['type'], $fieldValues['hash']); } else { $recordExists = $this->checkIfRecordWasIndexed($fieldValues['orig_uid'], $fieldValues['pid'], $fieldValues['type'], $fieldValues['language']); } if ($recordExists) { // update existing record $where = 'uid=' . intval($this->currentRow['uid']); unset($fieldValues['crdate']); if ($debugOnly) { // do not process - just debug query t3lib_utility_Debug::debug($GLOBALS['TYPO3_DB']->UPDATEquery($table, $where, $fieldValues), 1); } else { // process storing of index record and return uid $this->prepareRecordForUpdate($fieldValues); return true; } } else { // insert new record if ($debugOnly) { // do not process - just debug query t3lib_utility_Debug::debug($GLOBALS['TYPO3_DB']->INSERTquery($table, $fieldValues, FALSE)); } else { // process storing of index record and return uid $this->prepareRecordForInsert($fieldValues); return $GLOBALS['TYPO3_DB']->sql_insert_id(); } } }