Example #1
0
 /**
  * @param string $link the given link as integer uid or string
  * @return boolean
  * @author Alexander Fuchs <*****@*****.**>
  * @api
  */
 public function render($link)
 {
     if ($link === NULL) {
         return FALSE;
     }
     return t3lib_utility_Math::canBeInterpretedAsInteger($link) ? TRUE : FALSE;
 }
Example #2
0
 /**
  * Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is 'FALSE' then the $zeroValue is applied.
  *
  * @param integer $theInt Input value
  * @param integer $min Lower limit
  * @param integer $max Higher limit
  * @param integer $zeroValue Default value if input is FALSE.
  * @return integer The input value forced into the boundaries of $min and $max
  * @deprecated since TYPO3 4.6, will be removed in TYPO3 4.8 - Use t3lib_utility_Math::forceIntegerInRange() instead
  */
 public static function intInRange($theInt, $min, $max = 2000000000, $zeroValue = 0)
 {
     if (tx_rnbase_util_TYPO3::isTYPO46OrHigher()) {
         return t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $zeroValue);
     } else {
         return t3lib_div::intInRange($theInt, $min, $max, $zeroValue);
     }
 }
 /**
  * For RTE: This displays all content elements on a page and lets you create a link to the element.
  *
  * @return	string		HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
  */
 function expandPage()
 {
     $out = '';
     $expPageId = $this->browseLinks->expandPage;
     // Set page id (if any) to expand
     // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
     if (!$this->browseLinks->expandPage && $this->browseLinks->curUrlInfo['cElement']) {
         $expPageId = $this->browseLinks->curUrlInfo['pageid'];
         // Set to the current link page id.
     }
     // Draw the record list IF there is a page id to expand:
     if ($expPageId && t3lib_utility_Math::canBeInterpretedAsInteger($expPageId) && $GLOBALS['BE_USER']->isInWebMount($expPageId)) {
         // Set header:
         $out .= $this->browseLinks->barheader($GLOBALS['LANG']->getLL('contentElements') . ':');
         // Create header for listing, showing the page title/icon:
         $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']);
         $mainPageRec = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('pages', $expPageId);
         $picon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mainPageRec);
         $picon .= \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('pages', $mainPageRec, TRUE);
         $out .= $picon . '<br />';
         // Look up tt_content elements from the expanded page:
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,header,hidden,starttime,endtime,fe_group,CType,colPos,bodytext,tx_jfmulticontent_view,tx_jfmulticontent_pages,tx_jfmulticontent_contents', 'tt_content', 'pid=' . intval($expPageId) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tt_content') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting');
         $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
         // Traverse list of records:
         $c = 0;
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $c++;
             $icon = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row);
             if ($this->browseLinks->curUrlInfo['act'] == 'page' && $this->browseLinks->curUrlInfo['cElement'] == $row['uid']) {
                 $arrCol = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
             } else {
                 $arrCol = '';
             }
             // Putting list element HTML together:
             $out .= '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/join' . ($c == $cc ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . $arrCol . '<a href="#" onclick="return link_typo3Page(\'' . $expPageId . '\',\'#' . $row['uid'] . '\');">' . $icon . \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle('tt_content', $row, TRUE) . '</a><br />';
             $contents = array();
             // get all contents
             switch ($row['tx_jfmulticontent_view']) {
                 case "page":
                     $contents = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(",", $row['tx_jfmulticontent_pages']);
                     break;
                 case "content":
                     $contents = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(",", $row['tx_jfmulticontent_contents']);
                     break;
                 case "irre":
                     $resIrre = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'tx_jfmulticontent_irre_parentid=' . intval($row['uid']) . ' AND deleted = 0 AND hidden = 0', '', '');
                     while ($rowIrre = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resIrre)) {
                         $contents[] = $rowIrre['uid'];
                     }
                     break;
             }
             if (count($contents) > 0) {
                 $out .= '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />' . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/blank.gif', 'width="18" height="16"') . ' alt="" />';
                 foreach ($contents as $key => $content) {
                     $out .= '<a href="#" onclick="return link_typo3Page(\'' . $expPageId . '\',\'#jfmulticontent_c' . $row['uid'] . '-' . ($key + 1) . '\');">' . '&nbsp;' . ($key + 1) . '&nbsp;' . '</a>';
                 }
                 $out .= '<br/>';
             }
         }
     }
     return $out;
 }
 /**
  * Initialize the system log.
  *
  * @return void
  * @see sysLog()
  */
 public static function initSysLog()
 {
     // for CLI logging name is <fqdn-hostname>:<TYPO3-path>
     // Note that TYPO3_REQUESTTYPE is not used here as it may not yet be defined
     if (defined('TYPO3_cliMode') && TYPO3_cliMode) {
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = self::getHostname($requestHost = FALSE) . ':' . PATH_site;
     } else {
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = self::getIndpEnv('TYPO3_SITE_URL');
     }
     // init custom logging
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
         $params = array('initLog' => TRUE);
         $fakeThis = FALSE;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
             self::callUserFunction($hookMethod, $params, $fakeThis);
         }
     }
     // init TYPO3 logging
     foreach (explode(';', $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog'], 2) as $log) {
         list($type, $destination) = explode(',', $log, 3);
         if ($type == 'syslog') {
             if (TYPO3_OS == 'WIN') {
                 $facility = LOG_USER;
             } else {
                 $facility = constant('LOG_' . strtoupper($destination));
             }
             openlog($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'], LOG_ODELAY, $facility);
         }
     }
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'] = t3lib_utility_Math::forceIntegerInRange($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'], 0, 4);
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit'] = TRUE;
 }
 /**
  * Logs message to the system log.
  * This should be implemented around the source code, including the Core and both frontend and backend, logging serious errors.
  * If you want to implement the sysLog in your applications, simply add lines like:
  *		 t3lib_div::sysLog('[write message in English here]', 'extension_key', 'severity');
  *
  * @param string $msg Message (in English).
  * @param string $extKey Extension key (from which extension you are calling the log) or "Core"
  * @param integer $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error
  * @return void
  */
 public static function sysLog($msg, $extKey, $severity = 0)
 {
     $severity = t3lib_utility_Math::forceIntegerInRange($severity, 0, 4);
     // is message worth logging?
     if (intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel']) > $severity) {
         return;
     }
     // initialize logging
     if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit']) {
         self::initSysLog();
     }
     // do custom logging
     if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
         $params = array('msg' => $msg, 'extKey' => $extKey, 'backTrace' => debug_backtrace(), 'severity' => $severity);
         $fakeThis = FALSE;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
             self::callUserFunction($hookMethod, $params, $fakeThis);
         }
     }
     // TYPO3 logging enabled?
     if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog']) {
         return;
     }
     $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
     $timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
     // use all configured logging options
     foreach (explode(';', $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog'], 2) as $log) {
         list($type, $destination, $level) = explode(',', $log, 4);
         // is message worth logging for this log type?
         if (intval($level) > $severity) {
             continue;
         }
         $msgLine = ' - ' . $extKey . ': ' . $msg;
         // write message to a file
         if ($type == 'file') {
             $lockObject = t3lib_div::makeInstance('t3lib_lock', $destination, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
             /** @var t3lib_lock $lockObject */
             $lockObject->setEnableLogging(FALSE);
             $lockObject->acquire();
             $file = fopen($destination, 'a');
             if ($file) {
                 fwrite($file, date($dateFormat . ' ' . $timeFormat) . $msgLine . LF);
                 fclose($file);
                 self::fixPermissions($destination);
             }
             $lockObject->release();
         } elseif ($type == 'mail') {
             list($to, $from) = explode('/', $destination);
             if (!t3lib_div::validEmail($from)) {
                 $from = t3lib_utility_Mail::getSystemFrom();
             }
             /** @var $mail t3lib_mail_Message */
             $mail = t3lib_div::makeInstance('t3lib_mail_Message');
             $mail->setTo($to)->setFrom($from)->setSubject('Warning - error in TYPO3 installation')->setBody('Host: ' . $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . LF . 'Extension: ' . $extKey . LF . 'Severity: ' . $severity . LF . LF . $msg);
             $mail->send();
         } elseif ($type == 'error_log') {
             error_log($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . $msgLine, 0);
         } elseif ($type == 'syslog') {
             $priority = array(LOG_INFO, LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT);
             syslog($priority[(int) $severity], $msgLine);
         }
     }
 }
 /**
  * Hook function for cleaning output XHTML
  * hooks on "class.tslib_fe.php:2946"
  * page.config.tx_seo.sourceCodeFormatter.indentType = space
  * page.config.tx_seo.sourceCodeFormatter.indentAmount = 16
  *
  * @param       array           hook parameters
  * @param       object          Reference to parent object (TSFE-obj)
  * @return      void
  */
 public function processOutputHook(&$feObj, $ref)
 {
     if ($GLOBALS['TSFE']->type != 0) {
         return;
     }
     $configuration = $GLOBALS['TSFE']->config['config']['tx_seo.']['sourceCodeFormatter.'];
     // disabled for this page type
     if (isset($configuration['enable']) && $configuration['enable'] == '0') {
         return;
     }
     // 4.5 compatibility
     if (method_exists('t3lib_div', 'intInRange')) {
         $indentAmount = t3lib_div::intInRange($configuration['indentAmount'], 1, 100);
     } else {
         $indentAmount = t3lib_utility_Math::forceIntegerInRange($configuration['indentAmount'], 1, 100);
     }
     // use the "space" character as a indention type
     if ($configuration['indentType'] == 'space') {
         $indentElement = ' ';
         // use any character from the ASCII table
     } else {
         $indentTypeIsNumeric = FALSE;
         // 4.5 compatibility
         if (method_exists('t3lib_div', 'testInt')) {
             $indentTypeIsNumeric == t3lib_div::testInt($configuration['indentType']);
         } else {
             $indentTypeIsNumeric = t3lib_utility_Math::canBeInterpretedAsInteger($configuration['indentType']);
         }
         if ($indentTypeIsNumeric) {
             $indentElement = chr($configuration['indentType']);
         } else {
             // use tab by default
             $indentElement = "\t";
         }
     }
     $indention = '';
     for ($i = 1; $i <= $indentAmount; $i++) {
         $indention .= $indentElement;
     }
     $spltContent = explode("\n", $ref->content);
     $level = 0;
     $cleanContent = array();
     $textareaOpen = false;
     foreach ($spltContent as $lineNum => $line) {
         $line = trim($line);
         if (empty($line)) {
             continue;
         }
         $out = $line;
         // ugly strpos => TODO: use regular expressions
         // starts with an ending tag
         if (strpos($line, '</div>') === 0 || strpos($line, '<div') !== 0 && strpos($line, '</div>') === strlen($line) - 6 || strpos($line, '</html>') === 0 || strpos($line, '</body>') === 0 || strpos($line, '</head>') === 0 || strpos($line, '</ul>') === 0) {
             $level--;
         }
         if (strpos($line, '<textarea') !== false) {
             $textareaOpen = true;
         }
         // add indention only if no textarea is open
         if (!$textareaOpen) {
             for ($i = 0; $i < $level; $i++) {
                 $out = $indention . $out;
             }
         }
         if (strpos($line, '</textarea>') !== false) {
             $textareaOpen = false;
         }
         // starts with an opening <div>, <ul>, <head> or <body>
         if (strpos($line, '<div') === 0 && strpos($line, '</div>') !== strlen($line) - 6 || strpos($line, '<body') === 0 && strpos($line, '</body>') !== strlen($line) - 7 || strpos($line, '<head') === 0 && strpos($line, '</head>') !== strlen($line) - 7 || strpos($line, '<ul') === 0 && strpos($line, '</ul>') !== strlen($line) - 5) {
             $level++;
         }
         $cleanContent[] = $out;
     }
     $ref->content = implode("\n", $cleanContent);
 }
	/**
	 * Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is FALSE then the $defaultValue is applied.
	 *
	 * @param $theInt integer Input value
	 * @param $min integer Lower limit
	 * @param $max integer Higher limit
	 * @param $defaultValue integer Default value if input is FALSE.
	 * @return integer The input value forced into the boundaries of $min and $max
	 */
	public static function forceIntegerInRange($theInt, $min, $max = 2000000000, $defaultValue = 0) {
		if (class_exists('t3lib_utility_Math')) {
			$result = t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $defaultValue);
		} else {
			$result = t3lib_div::intInRange($theInt, $min, $max, $defaultValue);
		}
		return $result;
	}
 /**
  * Shows the list of feusers
  * @param $friends
  * @return string
  */
 function listView($friends = false)
 {
     $this->mode = 'listView.';
     $markerArray = array();
     $where = '';
     if (!isset($this->piVars['pointer'])) {
         $this->piVars['pointer'] = 0;
     }
     // Initializing the query parameters:
     list($this->internal['orderBy'], $this->internal['descFlag']) = explode(':', $this->piVars['sort']);
     if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4006000) {
         $this->internal['results_at_a_time'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['itemsPerPage'], 0, 1000, 10);
         $this->internal['maxPages'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['maxPages'], 0, 1000, 5);
         $this->internal['showFirstLast'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['showFirstLast'], 0, 1, 0);
         $this->internal['dontLinkActivePage'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['dontLinkActivePage'], 0, 1, 0);
     } else {
         $this->internal['results_at_a_time'] = t3lib_div::intInRange($this->conf[$this->mode]['itemsPerPage'], 0, 1000, 10);
         $this->internal['maxPages'] = t3lib_div::intInRange($this->conf[$this->mode]['maxPages'], 0, 1000, 5);
         $this->internal['showFirstLast'] = t3lib_div::intInRange($this->conf[$this->mode]['showFirstLast'], 0, 1, 0);
         $this->internal['dontLinkActivePage'] = t3lib_div::intInRange($this->conf[$this->mode]['dontLinkActivePage'], 0, 1, 0);
     }
     $this->conf['searchFields'] = 'username,name,firstname,usergroup,email,address,city,zip';
     $this->internal['searchFieldList'] = $this->conf['searchFields'];
     $this->conf['orderByFields'] = 'username,name,firstname,usergroup,email,address,zip,city';
     $this->internal['orderByList'] = $this->conf['orderByFields'];
     if ($this->conf[$this->mode]['pagefloat']) {
         // Where in the list is the current page shown. The value 'center' puts it in the middle.
         $this->internal['pagefloat'] = $this->conf[$this->mode]['pagefloat'];
     }
     if (!$this->conf['neverHideUser'] && $this->conf['hideUserField']) {
         $where = "AND NOT " . $this->conf['hideUserField'];
     }
     // Show only friends
     if ($friends === true) {
         $friends_array = $this->getFriendsId();
         if (count($friends_array) == 0) {
             $friends_array = array(0);
         }
         $where .= " AND uid IN (" . implode(',', $friends_array) . ")";
     }
     $userGroupsToShow = t3lib_div::intExplode(',', $this->conf['userGroupToShow'], TRUE);
     if (count($userGroupsToShow) > 0) {
         $groupWhere = array();
         foreach ($userGroupsToShow as $userGroupToShow) {
             $groupWhere[] = " CONCAT(',', usergroup, ',') LIKE '%,{$userGroupToShow},%'";
         }
         $where .= " AND (" . implode(" OR ", $groupWhere) . ")";
     }
     // Get number of records:
     $res = $this->pi_exec_query($this->internal['currentTable'], 1, $where);
     list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
     // Make listing query, pass query to MySQL:
     $res = $this->pi_exec_query($this->internal['currentTable'], 0, $where, '', '', $this->conf['orderByFields']);
     // Adds the search box:
     $markerArray['SEARCH'] = str_replace('value="Search"', 'value="Suche"', $this->pi_list_searchBox());
     // Adds the result browser:
     $markerArray['BROWSE'] = $this->pi_list_browseresults();
     if ($this->conf['have_GSI_hack']) {
         $markerArray['BROWSE_RESULTS'] = $this->pi_list_browseresults(1, '', 0);
         $markerArray['BROWSE_PAGES'] = $this->pi_list_browseresults(0, '', 1);
     }
     // sort field headers
     foreach (t3lib_div::trimExplode(',', $this->conf['orderByFields'], 1) as $f) {
         $markerArray['SORT_' . $f] = $this->pi_linkTP_keepPIvars($this->getFieldLabel($f), array('sort' => $f . ':' . ($this->internal['descFlag'] ? 0 : 1)));
     }
     $tplCode = '';
     // different templates for login users
     if ($GLOBALS['TSFE']->loginUser) {
         $tplCode = $this->cObj->getSubpart($this->templateFile, '###TEMPLATE_LIST_LOGIN###');
     }
     // fallback to standard template
     if ($tplCode == '') {
         $tplCode = $this->cObj->getSubpart($this->templateFile, '###TEMPLATE_LIST###');
     }
     $this->rowTplCode = $this->cObj->getSubpart($tplCode, '###SUB_TEMPLATE_ITEM###');
     $tplCode = $this->cObj->getSubpart($tplCode, '###SUB_TEMPLATE_ITEMS###');
     if ($tplCode == '') {
         return '<p>USER LIST (LIST VIEW) - EMPTY TEMPLATE!</p>';
     }
     // Adds the whole list table
     $markerArray['ITEMS'] = $this->list_makelist($res, $friends);
     // the language vars
     $markerArray['LIST_PERSON'] = $this->pi_getLL('list_person');
     $markerArray['LIST_USERNAME'] = $this->pi_getLL('list_username');
     $markerArray['LIST_NAME'] = $this->pi_getLL('list_name');
     $markerArray['LIST_FIRSTNAME'] = $this->pi_getLL('list_firstname');
     $markerArray['LIST_KORP'] = $this->pi_getLL('list_korp');
     return $this->cObj->substituteMarkerArray($tplCode, $markerArray, '###|###', 0);
 }
 public static function intval_positive($theInt)
 {
     $result = FALSE;
     $callingClassName = '\\TYPO3\\CMS\\Core\\Utility\\MathUtility';
     if (class_exists($callingClassName) && method_exists($callingClassName, 'convertToPositiveInteger')) {
         $result = call_user_func($callingClassName . '::convertToPositiveInteger', $theInt);
     } else {
         if (class_exists('t3lib_utility_Math') && method_exists('t3lib_utility_Math', 'convertToPositiveInteger')) {
             $result = t3lib_utility_Math::convertToPositiveInteger($theInt);
         } else {
             if (class_exists('t3lib_div') && method_exists('t3lib_div', 'intval_positive')) {
                 $result = t3lib_div::intval_positive($theInt);
             }
         }
     }
     return $result;
 }
 /**
  * Transforms fields into certain things...
  *
  * @return void  all parsing done directly on input array $dataArray
  */
 public function parseValues($theTable, array &$dataArray, array $origArray, $cmdKey)
 {
     $cObj = t3lib_div::makeInstance('tslib_cObj');
     if (is_array($this->conf['parseValues.'])) {
         foreach ($this->conf['parseValues.'] as $theField => $theValue) {
             $listOfCommands = t3lib_div::trimExplode(',', $theValue, 1);
             if (in_array('setEmptyIfAbsent', $listOfCommands)) {
                 $this->setEmptyIfAbsent($theTable, $theField, $dataArray);
             }
             $internalType = $GLOBALS['TCA'][$theTable]['columns'][$theField]['config']['internal_type'];
             if (isset($dataArray[$theField]) || isset($origArray[$theField]) || $internalType == 'file') {
                 foreach ($listOfCommands as $cmd) {
                     $cmdParts = preg_split('/\\[|\\]/', $cmd);
                     // Point is to enable parameters after each command enclosed in brackets [..]. These will be in position 1 in the array.
                     $theCmd = trim($cmdParts[0]);
                     $bValueAssigned = TRUE;
                     if ($theField === 'password' && !isset($dataArray[$theField])) {
                         $bValueAssigned = FALSE;
                     }
                     $dataValue = isset($dataArray[$theField]) ? $dataArray[$theField] : $origArray[$theField];
                     switch ($theCmd) {
                         case 'int':
                             $dataValue = intval($dataValue);
                             break;
                         case 'lower':
                         case 'upper':
                             $dataValue = $cObj->caseshift($dataValue, $theCmd);
                             break;
                         case 'nospace':
                             $dataValue = str_replace(' ', '', $dataValue);
                             break;
                         case 'alpha':
                             $dataValue = preg_replace('/[^a-zA-Z]/', '', $dataValue);
                             break;
                         case 'num':
                             $dataValue = preg_replace('/[^0-9]/', '', $dataValue);
                             break;
                         case 'alphanum':
                             $dataValue = preg_replace('/[^a-zA-Z0-9]/', '', $dataValue);
                             break;
                         case 'alphanum_x':
                             $dataValue = preg_replace('/[^a-zA-Z0-9_-]/', '', $dataValue);
                             break;
                         case 'trim':
                             $dataValue = trim($dataValue);
                             break;
                         case 'random':
                             $dataValue = substr(md5(uniqid(microtime(), 1)), 0, intval($cmdParts[1]));
                             break;
                         case 'files':
                             $fieldDataArray = array();
                             if ($dataArray[$theField]) {
                                 if (is_array($dataValue)) {
                                     $fieldDataArray = $dataValue;
                                 } else {
                                     if (is_string($dataValue) && $dataValue) {
                                         $fieldDataArray = t3lib_div::trimExplode(',', $dataValue, 1);
                                     }
                                 }
                             }
                             $dataValue = $this->processFiles($theTable, $theField, $fieldDataArray, $cmdKey);
                             break;
                         case 'multiple':
                             $fieldDataArray = array();
                             if (!empty($dataArray[$theField])) {
                                 if (is_array($dataArray[$theField])) {
                                     $fieldDataArray = $dataArray[$theField];
                                 } else {
                                     if (is_string($dataArray[$theField]) && $dataArray[$theField]) {
                                         $fieldDataArray = t3lib_div::trimExplode(',', $dataArray[$theField], 1);
                                     }
                                 }
                             }
                             $dataValue = $fieldDataArray;
                             break;
                         case 'checkArray':
                             if (is_array($dataValue)) {
                                 $newDataValue = 0;
                                 foreach ($dataValue as $kk => $vv) {
                                     $kk = class_exists('t3lib_utility_Math') ? t3lib_utility_Math::forceIntegerInRange($kk, 0) : t3lib_div::intInRange($kk, 0);
                                     if ($kk <= 30) {
                                         if ($vv) {
                                             $newDataValue |= pow(2, $kk);
                                         }
                                     }
                                 }
                                 $dataValue = $newDataValue;
                             }
                             break;
                         case 'uniqueHashInt':
                             $otherFields = t3lib_div::trimExplode(';', $cmdParts[1], 1);
                             $hashArray = array();
                             foreach ($otherFields as $fN) {
                                 $vv = $dataArray[$fN];
                                 $vv = preg_replace('/\\s+/', '', $vv);
                                 $vv = preg_replace('/[^a-zA-Z0-9]/', '', $vv);
                                 $vv = strtolower($vv);
                                 $hashArray[] = $vv;
                             }
                             $dataValue = hexdec(substr(md5(serialize($hashArray)), 0, 8));
                             break;
                         case 'wwwURL':
                             if ($dataValue) {
                                 $urlParts = parse_url($dataValue);
                                 if ($urlParts !== FALSE) {
                                     if (!$urlParts['scheme']) {
                                         $urlParts['scheme'] = 'http';
                                         $dataValue = $urlParts['scheme'] . '://' . $dataValue;
                                     }
                                     if (t3lib_div::isValidUrl($dataValue)) {
                                         $dataValue = $urlParts['scheme'] . '://' . $urlParts['host'] . $urlParts['path'] . ($urlParts['query'] ? '?' . $urlParts['query'] : '') . ($urlParts['fragment'] ? '#' . $urlParts['fragment'] : '');
                                     }
                                 }
                             }
                             break;
                         case 'date':
                             if ($dataValue && $this->evalDate($dataValue, $this->conf['dateFormat'])) {
                                 $dateArray = $this->fetchDate($dataValue, $this->conf['dateFormat']);
                                 $dataValue = $dateArray['y'] . '-' . $dateArray['m'] . '-' . $dateArray['d'];
                                 $translateArray = array('d' => $dateArray['d'] < 10 ? '0' . $dateArray['d'] : $dateArray['d'], 'j' => $dateArray['d'], 'm' => $dateArray['m'] < 10 ? '0' . $dateArray['m'] : $dateArray['m'], 'n' => $dateArray['m'], 'y' => $dateArray['y'], 'Y' => $dateArray['y']);
                                 $searchArray = array_keys($translateArray);
                                 $replaceArray = array_values($translateArray);
                                 $dataValue = str_replace($searchArray, $replaceArray, $this->conf['dateFormat']);
                             } else {
                                 if (!isset($dataArray[$theField])) {
                                     $bValueAssigned = FALSE;
                                 }
                             }
                             break;
                         default:
                             $bValueAssigned = FALSE;
                             break;
                     }
                     if ($bValueAssigned) {
                         $dataArray[$theField] = $dataValue;
                     }
                 }
             }
         }
     }
 }
 public function getPid($type = '')
 {
     if ($type) {
         if (isset($this->pid[$type])) {
             $result = $this->pid[$type];
         }
     }
     if (!$result) {
         $bPidIsInt = class_exists('t3lib_utility_Math') ? t3lib_utility_Math::canBeInterpretedAsInteger($this->conf['pid']) : t3lib_div::testInt($this->conf['pid']);
         $result = $bPidIsInt ? intval($this->conf['pid']) : $GLOBALS['TSFE']->id;
     }
     return $result;
 }
 /**
  * Returns the $integer if greater than zero, otherwise returns zero.
  *
  * @param integer $theInt Integer string to process
  * @return integer
  */
 public static function convertToPositiveInteger($theInt)
 {
     $result = '';
     if (self::isEqualOrHigherSixZero()) {
         $result = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($theInt);
     } elseif (class_exists('t3lib_utility_Math')) {
         $result = t3lib_utility_Math::convertToPositiveInteger($theInt);
     } else {
         $result = t3lib_div::intval_positive($theInt);
     }
     return $result;
 }
 /**
  * Finding "closest" versioning type, used for creation of new records.
  *
  * @see workspaceVersioningTypeAccess() for hints on $type
  * @param integer $type Versioning type to evaluation: -1, 0, >1
  * @return integer Returning versioning type
  * @deprecated since TYPO3 4.4, will be removed in TYPO3 6.0 as only element versioning is supported now
  * @todo Define visibility
  */
 public function workspaceVersioningTypeGetClosest($type)
 {
     t3lib_div::logDeprecatedFunction();
     $type = t3lib_utility_Math::forceIntegerInRange($type, -1);
     if ($this->workspace > 0) {
         switch ((int) $type) {
             case -1:
                 $type = -1;
                 break;
             case 0:
                 $type = $this->workspaceVersioningTypeAccess($type) ? $type : -1;
                 break;
             default:
                 $type = $this->workspaceVersioningTypeAccess($type) ? $type : ($this->workspaceVersioningTypeAccess(0) ? 0 : -1);
                 break;
         }
     }
     return $type;
 }
 /**
  * Tests if the value can be interpreted as integer.
  *
  * @param mixed $value
  * @return bool
  */
 protected static function testInt($value)
 {
     if (class_exists('\\TYPO3\\CMS\\Core\\Utility\\MathUtility')) {
         $result = \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($value);
     } elseif (class_exists('t3lib_utility_Math')) {
         $result = t3lib_utility_Math::canBeInterpretedAsInteger($value);
     } else {
         $result = t3lib_div::testInt($value);
     }
     return $result;
 }
 /**
  * Prepares an email message
  *
  * @param string  $key: template key
  * @param array $cObj: the cObject
  * @param array $langObj: the language object
  * @param array $controlData: the object of the control data
  * @param string $theTable: the table in use
  * @param string $prefixId: the extension prefix id
  * @param array  $DBrows: invoked with just one row of fe_users
  * @param string  $recipient: an email or the id of a front user
  * @param array  Array with key/values being marker-strings/substitution values.
  * @param array  $errorFieldArray: array of field with errors (former $dataObj->inError[$theField])
  * @param array  $setFixedConfig: a setfixed TS config array
  * @return string : text in case of error
  */
 public function compile($key, $conf, $cObj, $langObj, $controlData, $tcaObj, $markerObj, $dataObj, $displayObj, $setfixedObj, $theTable, $prefixId, array $DBrows, array $origRows, array $securedArray, $recipient, array $markerArray, $cmd, $cmdKey, $templateCode, $errorFieldArray, array $setFixedConfig, &$errorCode)
 {
     $missingSubpartArray = array();
     $userSubpartsFound = 0;
     $adminSubpartsFound = 0;
     $bHTMLMailEnabled = $this->isHTMLMailEnabled($conf);
     if (!isset($DBrows[0]) || !is_array($DBrows[0])) {
         $DBrows = $origRows;
     }
     $authObj = t3lib_div::getUserObj('&tx_srfeuserregister_auth');
     $bHTMLallowed = $DBrows[0]['module_sys_dmail_html'];
     // Setting CSS style markers if required
     if ($bHTMLMailEnabled) {
         $this->addCSSStyleMarkers($markerArray, $conf, $cObj);
     }
     $viewOnly = TRUE;
     $content = array('user' => array(), 'userhtml' => array(), 'admin' => array(), 'adminhtml' => array(), 'mail' => array());
     $content['mail'] = '';
     $content['user']['all'] = '';
     $content['userhtml']['all'] = '';
     $content['admin']['all'] = '';
     $content['adminhtml']['all'] = '';
     $setfixedArray = array('SETFIXED_CREATE', 'SETFIXED_CREATE_REVIEW', 'SETFIXED_INVITE', 'SETFIXED_REVIEW');
     $infomailArray = array('INFOMAIL', 'INFOMAIL_NORECORD');
     if (isset($conf['email.'][$key]) && $conf['email.'][$key] != '0' || $conf['enableEmailConfirmation'] && in_array($key, $setfixedArray) || $conf['infomail'] && in_array($key, $infomailArray) && !($key === 'INFOMAIL_NORECORD' && $conf['email.'][$key] == '0')) {
         $subpartMarker = '###' . $this->emailMarkPrefix . $key . '###';
         $content['user']['all'] = trim($cObj->getSubpart($templateCode, $subpartMarker));
         if ($content['user']['all'] == '') {
             $missingSubpartArray[] = $subpartMarker;
         } else {
             $content['user']['all'] = $displayObj->removeRequired($conf, $cObj, $controlData, $dataObj, $content['user']['all'], $errorFieldArray);
             $userSubpartsFound++;
         }
         if ($bHTMLMailEnabled && $bHTMLallowed) {
             $subpartMarker = '###' . $this->emailMarkPrefix . $key . $this->emailMarkHTMLSuffix . '###';
             $content['userhtml']['all'] = trim($cObj->getSubpart($templateCode, $subpartMarker));
             if ($content['userhtml']['all'] == '') {
                 $missingSubpartArray[] = $subpartMarker;
             } else {
                 $content['userhtml']['all'] = $displayObj->removeRequired($conf, $cObj, $controlData, $dataObj, $content['userhtml']['all'], $errorFieldArray);
                 $userSubpartsFound++;
             }
         }
     }
     if (!isset($conf['notify.'][$key]) || $conf['notify.'][$key]) {
         $subpartMarker = '###' . $this->emailMarkPrefix . $key . $this->emailMarkAdminSuffix . '###';
         $content['admin']['all'] = trim($cObj->getSubpart($templateCode, $subpartMarker));
         if ($content['admin']['all'] == '') {
             $missingSubpartArray[] = $subpartMarker;
         } else {
             $content['admin']['all'] = $displayObj->removeRequired($conf, $cObj, $controlData, $dataObj, $content['admin']['all'], $errorFieldArray);
             $adminSubpartsFound++;
         }
         if ($bHTMLMailEnabled) {
             $subpartMarker = '###' . $this->emailMarkPrefix . $key . $this->emailMarkAdminSuffix . $this->emailMarkHTMLSuffix . '###';
             $content['adminhtml']['all'] = trim($cObj->getSubpart($templateCode, $subpartMarker));
             if ($content['adminhtml']['all'] == '') {
                 $missingSubpartArray[] = $subpartMarker;
             } else {
                 $content['adminhtml']['all'] = $displayObj->removeRequired($conf, $cObj, $controlData, $dataObj, $content['adminhtml']['all'], $errorFieldArray);
                 $adminSubpartsFound++;
             }
         }
     }
     $contentIndexArray = array();
     $contentIndexArray['text'] = array();
     $contentIndexArray['html'] = array();
     if ($content['user']['all']) {
         $content['user']['rec'] = $cObj->getSubpart($content['user']['all'], '###SUB_RECORD###');
         $contentIndexArray['text'][] = 'user';
     }
     if ($content['userhtml']['all']) {
         $content['userhtml']['rec'] = $cObj->getSubpart($content['userhtml']['all'], '###SUB_RECORD###');
         $contentIndexArray['html'][] = 'userhtml';
     }
     if ($content['admin']['all']) {
         $content['admin']['rec'] = $cObj->getSubpart($content['admin']['all'], '###SUB_RECORD###');
         $contentIndexArray['text'][] = 'admin';
     }
     if ($content['adminhtml']['all']) {
         $content['adminhtml']['rec'] = $cObj->getSubpart($content['adminhtml']['all'], '###SUB_RECORD###');
         $contentIndexArray['html'][] = 'adminhtml';
     }
     $bChangesOnly = $conf['email.']['EDIT_SAVED'] == '2' && $cmd == 'edit';
     if ($bChangesOnly) {
         $keepFields = array('uid', 'pid', 'tstamp', 'name', 'username');
     } else {
         $keepFields = array();
     }
     $markerArray = $markerObj->fillInMarkerArray($markerArray, $DBrows[0], $securedArray, '', FALSE);
     $markerObj->addLabelMarkers($markerArray, $conf, $cObj, $controlData->getExtKey(), $theTable, $DBrows[0], $origRows[0], $securedArray, $keepFields, $controlData->getRequiredArray(), $dataObj->getFieldList(), $GLOBALS['TCA'][$theTable]['columns'], $bChangesOnly);
     $content['user']['all'] = $cObj->substituteMarkerArray($content['user']['all'], $markerArray);
     $content['userhtml']['all'] = $cObj->substituteMarkerArray($content['userhtml']['all'], $markerArray);
     $content['admin']['all'] = $cObj->substituteMarkerArray($content['admin']['all'], $markerArray);
     $content['adminhtml']['all'] = $cObj->substituteMarkerArray($content['adminhtml']['all'], $markerArray);
     foreach ($DBrows as $k => $row) {
         $origRow = $origRows[$k];
         if (isset($origRow) && is_array($origRow)) {
             if (isset($row) && is_array($row)) {
                 $currentRow = array_merge($origRow, $row);
             } else {
                 $currentRow = $origRow;
             }
         } else {
             $currentRow = $row;
         }
         if ($bChangesOnly) {
             $mrow = array();
             foreach ($row as $field => $v) {
                 if (in_array($field, $keepFields)) {
                     $mrow[$field] = $row[$field];
                 } else {
                     if ($row[$field] != $origRow[$field]) {
                         $mrow[$field] = $row[$field];
                     } else {
                         $mrow[$field] = '';
                         // needed to empty the ###FIELD_...### markers
                     }
                 }
             }
         } else {
             $mrow = $currentRow;
         }
         $markerArray['###SYS_AUTHCODE###'] = $authObj->authCode($row);
         $setfixedObj->computeUrl($cmdKey, $prefixId, $cObj, $controlData, $markerArray, $setFixedConfig, $currentRow, $theTable, $conf['useShortUrls'], $conf['edit.']['setfixed'], $conf['confirmType']);
         $markerObj->addStaticInfoMarkers($markerArray, $prefixId, $row, $viewOnly);
         foreach ($GLOBALS['TCA'][$theTable]['columns'] as $theField => $fieldConfig) {
             if ($fieldConfig['config']['internal_type'] == 'file' && $fieldConfig['config']['allowed'] != '' && $fieldConfig['config']['uploadfolder'] != '') {
                 $markerObj->addFileUploadMarkers($theTable, $theField, $fieldConfig, $markerArray, $cmd, $cmdKey, $row, $viewOnly, 'email', $emailType == 'html');
             }
         }
         $markerObj->addLabelMarkers($markerArray, $conf, $cObj, $controlData->getExtKey(), $theTable, $row, $origRow, $securedArray, $keepFields, $controlData->getRequiredArray(), $dataObj->getFieldList(), $GLOBALS['TCA'][$theTable]['columns'], $bChangesOnly);
         foreach ($contentIndexArray as $emailType => $indexArray) {
             $fieldMarkerArray = array();
             $fieldMarkerArray = $markerObj->fillInMarkerArray($fieldMarkerArray, $mrow, $securedArray, '', FALSE, 'FIELD_', $emailType == 'html');
             $tcaObj->addTcaMarkers($fieldMarkerArray, $conf, $cObj, $langObj, $controlData, $row, $origRow, $cmd, $cmdKey, $theTable, $prefixId, $viewOnly, 'email', $bChangesOnly, $emailType == 'html');
             $markerArray = array_merge($markerArray, $fieldMarkerArray);
             foreach ($indexArray as $index) {
                 $content[$index]['rec'] = $markerObj->removeStaticInfoSubparts($content[$index]['rec'], $markerArray, $viewOnly);
                 $content[$index]['accum'] .= $cObj->substituteMarkerArray($content[$index]['rec'], $markerArray);
                 if ($emailType == 'text') {
                     $content[$index]['accum'] = htmlSpecialChars_decode($content[$index]['accum'], ENT_QUOTES);
                 }
             }
         }
     }
     // Substitute the markers and eliminate HTML markup from plain text versions
     if ($content['user']['all']) {
         $content['user']['final'] = $cObj->substituteSubpart($content['user']['all'], '###SUB_RECORD###', $content['user']['accum']);
         $content['user']['final'] = $displayObj->removeHTMLComments($content['user']['final']);
         $content['user']['final'] = $displayObj->replaceHTMLBr($content['user']['final']);
         $content['user']['final'] = $displayObj->removeHtmlTags($content['user']['final']);
         $content['user']['final'] = $displayObj->removeSuperfluousLineFeeds($content['user']['final']);
         // Remove erroneous \n from locallang file
         $content['user']['final'] = str_replace('\\n', '', $content['user']['final']);
     }
     if ($content['userhtml']['all']) {
         $content['userhtml']['final'] = $cObj->substituteSubpart($content['userhtml']['all'], '###SUB_RECORD###', $this->pibaseObj->pi_wrapInBaseClass($content['userhtml']['accum']));
         // Remove HTML comments
         $content['userhtml']['final'] = $displayObj->removeHTMLComments($content['userhtml']['final']);
         // Remove erroneous \n from locallang file
         $content['userhtml']['final'] = str_replace('\\n', '', $content['userhtml']['final']);
     }
     if ($content['admin']['all']) {
         $content['admin']['final'] = $cObj->substituteSubpart($content['admin']['all'], '###SUB_RECORD###', $content['admin']['accum']);
         $content['admin']['final'] = $displayObj->removeHTMLComments($content['admin']['final']);
         $content['admin']['final'] = $displayObj->replaceHTMLBr($content['admin']['final']);
         $content['admin']['final'] = $displayObj->removeHtmlTags($content['admin']['final']);
         $content['admin']['final'] = $displayObj->removeSuperfluousLineFeeds($content['admin']['final']);
         // Remove erroneous \n from locallang file
         $content['admin']['final'] = str_replace('\\n', '', $content['admin']['final']);
     }
     if ($content['adminhtml']['all']) {
         $content['adminhtml']['final'] = $cObj->substituteSubpart($content['adminhtml']['all'], '###SUB_RECORD###', $this->pibaseObj->pi_wrapInBaseClass($content['adminhtml']['accum']));
         // Remove HTML comments
         $content['adminhtml']['final'] = $displayObj->removeHTMLComments($content['adminhtml']['final']);
         // Remove erroneous \n from locallang file
         $content['adminhtml']['final'] = str_replace('\\n', '', $content['adminhtml']['final']);
     }
     $bRecipientIsInt = class_exists('t3lib_utility_Math') ? t3lib_utility_Math::canBeInterpretedAsInteger($recipient) : t3lib_div::testInt($recipient);
     if ($bRecipientIsInt) {
         $fe_userRec = $GLOBALS['TSFE']->sys_page->getRawRecord('fe_users', $recipient);
         $recipient = $fe_userRec['email'];
     }
     // Check if we need to add an attachment
     if ($conf['addAttachment'] && $conf['addAttachment.']['cmd'] == $cmd && $conf['addAttachment.']['sFK'] == $controlData->getFeUserData('sFK')) {
         $file = $conf['addAttachment.']['file'] ? $GLOBALS['TSFE']->tmpl->getFileName($conf['addAttachment.']['file']) : '';
     }
     // SETFIXED_REVIEW will be sent to user only id the admin part is present
     if ($userSubpartsFound + $adminSubpartsFound >= 1 && ($adminSubpartsFound >= 1 || $key != 'SETFIXED_REVIEW')) {
         $this->send($conf, $recipient, $conf['email.']['admin'], $content['user']['final'], $content['userhtml']['final'], $content['admin']['final'], $content['adminhtml']['final'], $file);
     } else {
         if ($conf['notify.'][$key]) {
             $errorCode = array();
             $errorCode['0'] = 'internal_no_subtemplate';
             $errorCode['1'] = $missingSubpartArray['0'];
             return FALSE;
         }
     }
 }
 /**
  * makeStatisticsReportsCommand
  *
  * @param int stroagePid
  * @param string senderEmailAddress
  * @param string receiverEmailAddress list of receiver email addresses separated by comma
  * @return void
  */
 public function makeStatisticsReportsCommand($storagePid, $senderEmailAddress = '', $receiverEmailAddress = '')
 {
     // do some init work...
     $this->initializeAction();
     // abort if no storagePid is found
     if (!t3lib_utility_Math::canBeInterpretedAsInteger($storagePid)) {
         echo 'NO storagePid given. Please enter the storagePid in the scheduler task.';
         exit(1);
     }
     // abort if no senderEmailAddress is found
     if (empty($senderEmailAddress)) {
         echo 'NO senderEmailAddress given. Please enter the senderEmailAddress in the scheduler task.';
         exit(1);
     }
     // abort if no senderEmailAddress is found
     if (empty($receiverEmailAddress)) {
         echo 'NO receiverEmailAddress given. Please enter the receiverEmailAddress in the scheduler task.';
         exit(1);
     } else {
         $receiverEmailAddress = explode(', ', $receiverEmailAddress);
     }
     // set storagePid to point extbase to the right repositories
     $configurationArray = array('persistence' => array('storagePid' => $storagePid));
     $this->configurationManager->setConfiguration($configurationArray);
     // start the work...
     // 1. get the categories
     $categories = $this->categoryRepository->findAll();
     foreach ($categories as $uid => $category) {
         $searchParameter['category'][$uid] = $uid;
     }
     // 2. get events of last month
     $startDateTime = strtotime('first day of last month 00:00:00');
     $endDateTime = strtotime('last day of last month 23:59:59');
     $allevents = $this->eventRepository->findAllByCategoriesAndDateInterval($searchParameter['category'], $startDateTime, $endDateTime);
     // used to name the csv file...
     $helper['nameto'] = strftime('%Y%m', $startDateTime);
     // email to all receivers...
     $out = $this->sendTemplateEmail($receiverEmailAddress, array($senderEmailAddress => 'WÖHRL Akademie - noreply'), 'Statistik Report Veranstaltungen: ' . ': ' . strftime('%x', $startDateTime) . ' - ' . strftime('%x', $endDateTime), 'Statistics', array('events' => $allevents, 'categories' => $categories, 'helper' => $helper, 'attachCsv' => TRUE, 'attachIcs' => FALSE));
     return;
 }
Example #17
0
 /**
  * Tests if the value represents an integer number.
  *
  * @param mixed $value
  * @return bool
  */
 public static function testInt($value)
 {
     static $useOldGoodTestInt = null;
     if (is_null($useOldGoodTestInt)) {
         $useOldGoodTestInt = !class_exists('t3lib_utility_Math');
     }
     if ($useOldGoodTestInt) {
         /** @noinspection PhpDeprecationInspection PhpUndefinedMethodInspection */
         $result = t3lib_div::testInt($value);
     } else {
         /** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
         $result = t3lib_utility_Math::canBeInterpretedAsInteger($value);
     }
     return $result;
 }
 /**
  * Computes the setfixed url's
  *
  * @param array  $markerArray: the input marker array
  * @param array  $setfixed: the TS setup setfixed configuration
  * @param array  $record: the record row
  * @param array $controlData: the object of the control data
  * @return void
  */
 public function computeUrl($cmdKey, $prefixId, $cObj, $controlData, &$markerArray, $setfixed, array $record, $theTable, $useShortUrls, $editSetfixed, $confirmType)
 {
     if ($controlData->getSetfixedEnabled() && is_array($setfixed)) {
         $authObj = t3lib_div::getUserObj('&tx_srfeuserregister_auth');
         foreach ($setfixed as $theKey => $data) {
             if (strstr($theKey, '.')) {
                 $theKey = substr($theKey, 0, -1);
             }
             $setfixedpiVars = array();
             if ($theTable != 'fe_users' && $theKey == 'EDIT') {
                 $noFeusersEdit = TRUE;
             } else {
                 $noFeusersEdit = FALSE;
             }
             $setfixedpiVars[$prefixId . '%5BrU%5D'] = $record['uid'];
             $fieldList = $data['_FIELDLIST'];
             $fieldListArray = t3lib_div::trimExplode(',', $fieldList);
             foreach ($fieldListArray as $fieldname) {
                 if (isset($data[$fieldname])) {
                     $fieldValue = $data[$fieldname];
                     if ($fieldname == 'usergroup' && $data['usergroup.']) {
                         $tablesObj = t3lib_div::getUserObj('&tx_srfeuserregister_lib_tables');
                         $addressObj = $tablesObj->get('address');
                         $userGroupObj = $addressObj->getFieldObj('usergroup');
                         if (is_object($userGroupObj)) {
                             $fieldValue = $userGroupObj->getExtendedValue($controlData->getExtKey(), $fieldValue, $data['usergroup.'], $record);
                             $data[$fieldname] = $fieldValue;
                         }
                     }
                     $record[$fieldname] = $fieldValue;
                 }
             }
             if ($noFeusersEdit) {
                 $cmd = $pidCmd = 'edit';
                 if ($editSetfixed) {
                     $bSetfixedHash = TRUE;
                 } else {
                     $bSetfixedHash = FALSE;
                     $setfixedpiVars[$prefixId . '%5BaC%5D'] = $authObj->authCode($record, $fieldList);
                 }
             } else {
                 $cmd = 'setfixed';
                 $pidCmd = $controlData->getCmd() == 'invite' ? 'confirmInvitation' : 'confirm';
                 $setfixedpiVars[$prefixId . '%5BsFK%5D'] = $theKey;
                 $bSetfixedHash = TRUE;
                 if (isset($record['auto_login_key'])) {
                     $setfixedpiVars[$prefixId . '%5Bkey%5D'] = $record['auto_login_key'];
                 }
             }
             if ($bSetfixedHash) {
                 $setfixedpiVars[$prefixId . '%5BaC%5D'] = $authObj->setfixedHash($record, $fieldList);
             }
             $setfixedpiVars[$prefixId . '%5Bcmd%5D'] = $cmd;
             if (is_array($data)) {
                 foreach ($data as $fieldname => $fieldValue) {
                     if (strpos($fieldname, '.') !== FALSE) {
                         continue;
                     }
                     $setfixedpiVars['fD%5B' . $fieldname . '%5D'] = rawurlencode($fieldValue);
                 }
             }
             $linkPID = $controlData->getPid($pidCmd);
             if (t3lib_div::_GP('L') && !t3lib_div::inList($GLOBALS['TSFE']->config['config']['linkVars'], 'L')) {
                 $setfixedpiVars['L'] = t3lib_div::_GP('L');
             }
             if ($useShortUrls) {
                 $thisHash = $this->storeFixedPiVars($setfixedpiVars);
                 $setfixedpiVars = array($prefixId . '%5BregHash%5D' => $thisHash);
             }
             $urlConf = array();
             $urlConf['disableGroupAccessCheck'] = TRUE;
             $bconfirmTypeIsInt = class_exists('t3lib_utility_Math') ? t3lib_utility_Math::canBeInterpretedAsInteger($confirmType) : t3lib_div::testInt($confirmType);
             $confirmType = $bconfirmTypeIsInt ? intval($confirmType) : $GLOBALS['TSFE']->type;
             $url = Tx_SrFeuserRegister_Utility_UrlUtility::getTypoLink_URL($cObj, $linkPID . ',' . $confirmType, $setfixedpiVars, '', $urlConf);
             $bIsAbsoluteURL = strncmp($url, 'http://', 7) == 0 || strncmp($url, 'https://', 8) == 0;
             $markerKey = '###SETFIXED_' . $cObj->caseshift($theKey, 'upper') . '_URL###';
             $url = ($bIsAbsoluteURL ? '' : $controlData->getSiteUrl()) . ltrim($url, '/');
             $markerArray[$markerKey] = str_replace(array('[', ']'), array('%5B', '%5D'), $url);
         }
         // foreach
     }
 }
 /**
  * Tests if the input can be interpreted as integer.
  *
  * @access	public
  *
  * @param	integer		$theInt: Input value
  *
  * @return	boolean		TRUE if $theInt is an integer, FALSE otherwise
  */
 public static function testInt($theInt)
 {
     if (t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 6000000) {
         // TYPO3 > 6.0
         return t3lib_utility_Math::canBeInterpretedAsInteger($theInt);
     } else {
         // TYPO3 4.5 - 4.7
         return t3lib_div::testInt($theInt);
     }
 }
 /**
  * Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is FALSE then the $defaultValue is applied.
  *
  * @see t3lib_utility_Math::canBeInterpretedAsInteger
  * @param $theInt integer Input value
  * @param $min integer Lower limit
  * @param $max integer Higher limit
  * @param $defaultValue integer Default value if input is FALSE.
  * @return integer The input value forced into the boundaries of $min and $max
  */
 public static function canBeInterpretedAsInteger($var)
 {
     if (class_exists('t3lib_utility_Math')) {
         $result = t3lib_utility_Math::canBeInterpretedAsInteger($var);
     } else {
         $result = t3lib_div::testInt($var);
     }
     return $result;
 }
 /**
  * Implements the "typolink" property of stdWrap (and others)
  * Basically the input string, $linktext, is (typically) wrapped in a <a>-tag linking to some page, email address, file or URL based on a parameter defined by the configuration array $conf.
  * This function is best used from internal functions as is. There are some API functions defined after this function which is more suited for general usage in external applications.
  * Generally the concept "typolink" should be used in your own applications as an API for making links to pages with parameters and more. The reason for this is that you will then automatically make links compatible with all the centralized functions for URL simulation and manipulation of parameters into hashes and more.
  * For many more details on the parameters and how they are intepreted, please see the link to TSref below.
  *
  * @param string $linktxt The string (text) to link
  * @param array $conf TypoScript configuration (see link below)
  * @param tslib_cObj $cObj
  * @return	string		A link-wrapped string.
  * @see stdWrap(), tslib_pibase::pi_linkTP()
  * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=321&cHash=59bd727a5e
  */
 function typoLink($linktxt, $conf, $cObj = NULL)
 {
     $finalTagParts = array();
     // If called from media link handler, use the reference of the passed cObj
     if (!is_object($this->cObj)) {
         $this->cObj = $cObj;
     }
     $link_param = trim($this->cObj->stdWrap($conf['parameter'], $conf['parameter.']));
     $initP = '?id=' . $GLOBALS['TSFE']->id . '&type=' . $GLOBALS['TSFE']->type;
     $this->cObj->lastTypoLinkUrl = '';
     $this->cObj->lastTypoLinkTarget = '';
     if ($link_param) {
         $link_paramA = t3lib_div::unQuoteFilenames($link_param, TRUE);
         $link_param = trim($link_paramA[0]);
         // Link parameter value
         $linkClass = trim($link_paramA[2]);
         // Link class
         if ($linkClass === '-') {
             $linkClass = '';
         }
         // The '-' character means 'no class'. Necessary in order to specify a title as fourth parameter without setting the target or class!
         $forceTarget = trim($link_paramA[1]);
         // Target value
         $forceTitle = trim($link_paramA[3]);
         // Title value
         if ($forceTarget === '-') {
             $forceTarget = '';
         }
         // The '-' character means 'no target'. Necessary in order to specify a class as third parameter without setting the target!
         // Check, if the target is coded as a JS open window link:
         $JSwindowParts = array();
         $JSwindowParams = '';
         $onClick = '';
         if ($forceTarget && preg_match('/^([0-9]+)x([0-9]+)(:(.*)|.*)$/', $forceTarget, $JSwindowParts)) {
             // Take all pre-configured and inserted parameters and compile parameter list, including width+height:
             $JSwindow_tempParamsArr = t3lib_div::trimExplode(',', strtolower($conf['JSwindow_params'] . ',' . $JSwindowParts[4]), TRUE);
             $JSwindow_paramsArr = array();
             foreach ($JSwindow_tempParamsArr as $JSv) {
                 list($JSp, $JSv) = explode('=', $JSv);
                 $JSwindow_paramsArr[$JSp] = $JSp . '=' . $JSv;
             }
             // Add width/height:
             $JSwindow_paramsArr['width'] = 'width=' . $JSwindowParts[1];
             $JSwindow_paramsArr['height'] = 'height=' . $JSwindowParts[2];
             // Imploding into string:
             $JSwindowParams = implode(',', $JSwindow_paramsArr);
             $forceTarget = '';
             // Resetting the target since we will use onClick.
         }
         // Internal target:
         $target = isset($conf['target']) ? $conf['target'] : $GLOBALS['TSFE']->intTarget;
         if ($conf['target.']) {
             $target = $this->cObj->stdWrap($target, $conf['target.']);
         }
         // Checking if the id-parameter is an alias.
         if (version_compare(TYPO3_version, '4.6.0', '>=')) {
             $isInteger = t3lib_utility_Math::canBeInterpretedAsInteger($link_param);
         } else {
             $isInteger = t3lib_div::testInt($link_param);
         }
         if (!$isInteger) {
             $GLOBALS['TT']->setTSlogMessage("tx_dam_tsfemediatag->typolink(): File id '" . $link_param . "' is not an integer, so '" . $linktxt . "' was not linked.", 1);
             return $linktxt;
         }
         if (!is_object($media = tx_dam::media_getByUid($link_param))) {
             $GLOBALS['TT']->setTSlogMessage("tx_dam_tsfemediatag->typolink(): File id '" . $link_param . "' was not found, so '" . $linktxt . "' was not linked.", 1);
             return $linktxt;
         }
         if (!$media->isAvailable) {
             $GLOBALS['TT']->setTSlogMessage("tx_dam_tsfemediatag->typolink(): File '" . $media->getPathForSite() . "' (" . $link_param . ") did not exist, so '" . $linktxt . "' was not linked.", 1);
             return $linktxt;
         }
         $meta = $media->getMetaArray();
         if (is_array($this->conf['procFields.'])) {
             foreach ($this->conf['procFields.'] as $field => $fieldConf) {
                 if (substr($field, -1, 1) === '.') {
                     $fN = substr($field, 0, -1);
                 } else {
                     $fN = $field;
                     $fieldConf = array();
                 }
                 $meta[$fN] = $media->getContent($fN, $fieldConf);
             }
         }
         $this->addMetaToData($meta);
         // Title tag
         $title = $conf['title'];
         if ($conf['title.']) {
             $title = $this->cObj->stdWrap($title, $conf['title.']);
         }
         // Setting title if blank value to link:
         if ($linktxt === '') {
             $linktxt = $media->getContent('title');
         }
         if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
             $this->cObj->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix . $GLOBALS['TSFE']->config['mainScript'] . $initP . '&jumpurl=' . rawurlencode($media->getPathForSite()) . $GLOBALS['TSFE']->getMethodUrlIdToken;
         } else {
             $this->cObj->lastTypoLinkUrl = $media->getURL();
         }
         if ($forceTarget) {
             $target = $forceTarget;
         }
         $this->cObj->lastTypoLinkTarget = $target;
         $finalTagParts['url'] = $this->cObj->lastTypoLinkUrl;
         $finalTagParts['targetParams'] = $target ? ' target="' . $target . '"' : '';
         $finalTagParts['aTagParams'] = $this->cObj->getATagParams($conf);
         $finalTagParts['TYPE'] = 'file';
         if ($forceTitle) {
             $title = $forceTitle;
         }
         if ($JSwindowParams) {
             // Create TARGET-attribute only if the right doctype is used
             if (!t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2', $GLOBALS['TSFE']->xhtmlDoctype)) {
                 $target = ' target="FEopenLink"';
             } else {
                 $target = '';
             }
             $onClick = "vHWin=window.open('" . $GLOBALS['TSFE']->baseUrlWrap($finalTagParts['url']) . "','FEopenLink','" . $JSwindowParams . "');vHWin.focus();return false;";
             $res = '<a href="' . htmlspecialchars($finalTagParts['url']) . '"' . $target . ' onclick="' . htmlspecialchars($onClick) . '"' . ($title ? ' title="' . $title . '"' : '') . ($linkClass ? ' class="' . $linkClass . '"' : '') . $finalTagParts['aTagParams'] . '>';
         } else {
             $res = '<a href="' . htmlspecialchars($finalTagParts['url']) . '"' . ($title ? ' title="' . $title . '"' : '') . $finalTagParts['targetParams'] . ($linkClass ? ' class="' . $linkClass . '"' : '') . $finalTagParts['aTagParams'] . '>';
         }
         // Call userFunc
         if ($conf['userFunc']) {
             $finalTagParts['TAG'] = $res;
             $res = $this->cObj->callUserFunction($conf['userFunc'], $conf['userFunc.'], $finalTagParts);
         }
         // If flag "returnLastTypoLinkUrl" set, then just return the latest URL made:
         if ($conf['returnLast']) {
             switch ($conf['returnLast']) {
                 case 'url':
                     return $this->cObj->lastTypoLinkUrl;
                     break;
                 case 'target':
                     return $this->cObj->lastTypoLinkTarget;
                     break;
             }
         }
         if ($conf['postUserFunc']) {
             $linktxt = $this->cObj->callUserFunction($conf['postUserFunc'], $conf['postUserFunc.'], $linktxt);
         }
         if ($conf['ATagBeforeWrap']) {
             return $res . $this->cObj->wrap($linktxt, $conf['wrap']) . '</a>';
         } else {
             return $this->cObj->wrap($res . $linktxt . '</a>', $conf['wrap']);
         }
     } else {
         return $linktxt;
     }
 }
 /**
  * Adds elements to the input $markContentArray based on the values from the fields from $fieldList found in $row
  *
  * @param	array		Array with key/values being marker-strings/substitution values.
  * @param	array		An array with keys found in the $fieldList (typically a record) which values should be moved to the $markContentArray
  * @param	string		A list of fields from the $row array to add to the $markContentArray array. If empty all fields from $row will be added (unless they are integers)
  * @param	boolean		If set, all values added to $markContentArray will be nl2br()'ed
  * @param	string		Prefix string to the fieldname before it is added as a key in the $markContentArray. Notice that the keys added to the $markContentArray always start and end with "###"
  * @param	boolean		If set, all values are passed through htmlspecialchars() - RECOMMENDED to avoid most obvious XSS and maintain XHTML compliance.
  * @return	array		The modified $markContentArray
  */
 public function fillInMarkerArray(&$markerArray, $row, $securedArray, $fieldList = '', $nl2br = TRUE, $prefix = 'FIELD_', $HSC = TRUE)
 {
     if (is_array($securedArray)) {
         foreach ($securedArray as $field => $value) {
             $row[$field] = $securedArray[$field];
         }
     }
     if ($fieldList) {
         $fArr = t3lib_div::trimExplode(',', $fieldList, 1);
         foreach ($fArr as $field) {
             $markerArray['###' . $prefix . $field . '###'] = $nl2br ? nl2br($row[$field]) : $row[$field];
         }
     } else {
         if (is_array($row)) {
             foreach ($row as $field => $value) {
                 $bFieldIsInt = class_exists('t3lib_utility_Math') ? t3lib_utility_Math::canBeInterpretedAsInteger($field) : t3lib_div::testInt($field);
                 if (!$bFieldIsInt) {
                     if (is_array($value)) {
                         $value = implode(',', $value);
                     }
                     if ($HSC) {
                         $value = htmlspecialchars($value);
                     }
                     $markerArray['###' . $prefix . $field . '###'] = $nl2br ? nl2br($value) : $value;
                 }
             }
         }
     }
     // Add global markers
     $extKey = $this->controlData->getExtKey();
     $prefixId = $this->controlData->getPrefixId();
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$prefixId]['registrationProcess'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$prefixId]['registrationProcess'] as $classRef) {
             $hookObj = t3lib_div::getUserObj($classRef);
             if (method_exists($hookObj, 'addGlobalMarkers')) {
                 $hookObj->addGlobalMarkers($markerArray, $this);
             }
         }
     }
     return $markerArray;
 }
	/**
	 * Tests if the value represents an integer number.
	 *
	 * @param mixed $value
	 * @return bool
	 */
	static public function testInt($value) {
		static $useOldGoodTestInt = null;

		if (is_null($useOldGoodTestInt)) {
			$useOldGoodTestInt = !class_exists('t3lib_utility_Math');
		}
		if ($useOldGoodTestInt) {
			$result = t3lib_div::testInt($value);
		}
		else {
			$result = t3lib_utility_Math::canBeInterpretedAsInteger($value);
		}
		return $result;
	}
 /**
  * @param string| int $value
  * @return bool
  */
 public function canBeInterpretedAsInteger($value)
 {
     $canBeInterpretedAsInteger = NULL;
     if (class_exists('t3lib_utility_Math')) {
         $canBeInterpretedAsInteger = t3lib_utility_Math::canBeInterpretedAsInteger($value);
     } else {
         $canBeInterpretedAsInteger = t3lib_div::testInt($value);
     }
     return $canBeInterpretedAsInteger;
 }
    function getTree(&$PA, &$fobj)
    {
        $fobj->additionalCode_pre['tx_cpstcatree'] = '
<script src="' . t3lib_extMgm::extRelPath('cps_tcatree') . 'js/tx_cpstcatree.js" type="text/javascript"></script>';
        $this->init($PA);
        if (isset($this->fieldConfig['trueMaxItems'])) {
            $this->fieldConfig['maxitems'] = $this->fieldConfig['trueMaxItems'];
        }
        // #53379, 131106, dwildt, 3-
        //		$maxitems = t3lib_div::intInRange($this->fieldConfig['maxitems'], 0, 2000000000, 1000);
        //		$minitems = t3lib_div::intInRange($this->fieldConfig['minitems'], 0);
        //		$size = t3lib_div::intInRange($this->fieldConfig['size'], 0, 2000000000, 1);
        // #53379, 131106, dwildt, 3+
        $maxitems = t3lib_utility_Math::forceIntegerInRange($this->fieldConfig['maxitems'], 0, 2000000000, 1000);
        $minitems = t3lib_utility_Math::forceIntegerInRange($this->fieldConfig['minitems'], 0);
        $size = t3lib_utility_Math::forceIntegerInRange($this->fieldConfig['size'], 0, 2000000000, 1);
        $this->registerRequiredProperty('range', $this->itemFormElName, array($minitems, $maxitems, 'imgName' => $this->table . '_' . $this->row['uid'] . '_' . $this->field), $fobj);
        $content .= '<input type="hidden" name="' . $this->itemFormElName . '_mul" value="' . ($this->fieldConfig['multiple'] ? 1 : 0) . '" />';
        if ($this->fieldConfig['foreign_table']) {
            $treeContent = '<span id="' . $this->table . '_' . $this->fieldConfig['foreign_table'] . '_tree">' . $this->renderTree() . '</span>';
            // Count items
            $count = substr_count($treeContent, '<li');
            // Add height to tcatree div
            $height = '';
            if (isset($this->fieldConfig['autoSizeMax']) && $count > $this->fieldConfig['autoSizeMax']) {
                $height = ' height: ' . 22 * $this->fieldConfig['autoSizeMax'] . 'px; overflow: scroll;';
            }
            $thumbnails = '<div name="' . $this->itemFormElName . '_selTree" class="tree-div" style="position: relative; border: 1px solid #999; background: #fff; left: 0px; top: 0px; width: 350px; margin-bottom: 5px; padding: 0 10px 10px 0;' . $height . '">';
            $thumbnails .= $treeContent;
            $thumbnails .= '</div>';
        }
        // Get label for non matching values from tsconfig or t3lib_tceforms
        if (isset($this->PA['fieldTSconfig']['noMatchingValue_label'])) {
            $nMV_label = $GLOBALS['LANG']->sL($this->PA['fieldTSconfig']['noMatchingValue_label']);
        } else {
            $nMV_label = '[ ' . $fobj->getLL('l_noMatchingValue') . ' ]';
        }
        $nMV_label = @sprintf($nMV_label, $this->PA['itemFormElValue']);
        // Check all selected items for hidden records
        $itemArray = t3lib_div::trimExplode(',', $this->PA['itemFormElValue'], 1);
        foreach ($itemArray as $key => $item) {
            $item = explode('|', $item, 2);
            $evalValue = rawurldecode($item[0]);
            if (in_array($evalValue, $this->removeItems) and !$this->PA['fieldTSconfig']['disableNoMatchingValueElement']) {
                // If item should be hidden
                $item[1] = $nMV_label;
            }
            $item[1] = rawurldecode($item[1]);
            $itemArray[$key] = implode('|', $item);
        }
        $params = array('size' => $size, 'autoSizeMax' => $this->fieldConfig['autoSizeMax'], 'style' => ' style="width: 200px;"', 'dontShowMoveIcons' => $maxitems < 2, 'maxitems' => $maxitems, 'info' => '', 'headers' => array('selector' => $fobj->getLL('l_selected') . ':<br />', 'items' => $fobj->getLL('l_items') . ':<br />'), 'noBrowser' => 1, 'thumbnails' => $thumbnails);
        // Get select field with browser
        $content .= $fobj->dbFileIcons($this->itemFormElName, '', '', $itemArray, '', $params, $this->PA['onFocus']);
        $altItem = '<input type="hidden" name="' . $this->itemFormElName . '" value="' . htmlspecialchars($this->PA['itemFormElValue']) . '" />';
        $content = $fobj->renderWizards(array($content, $altItem), $this->fieldConfig['wizards'], $this->table, $this->row, $this->field, $this->PA, $this->itemFormElName, array());
        if (in_array('required', t3lib_div::trimExplode(',', $this->fieldConfig['eval'], 1)) and $this->NA_Items) {
            $this->registerRequiredProperty('range', 'data[' . $this->table . '][' . $this->row['uid'] . '][noDisallowedCategories]', array(1, 1, 'imgName' => $this->table . '_' . $this->row['uid'] . '_noDisallowedCategories'), $fobj);
            $content .= '<input type="hidden" name="data[' . $this->table . '][' . $this->row['uid'] . '][noDisallowedCategories]" value="' . ($this->NA_Items ? '' : '1') . '" />';
        }
        return $content;
    }
 public function getAllowedWhereClause($theTable, $pid, $conf, $cmdKey, $bAllow = TRUE)
 {
     $whereClause = '';
     $subgroupWhereClauseArray = array();
     $pidArray = array();
     $tmpArray = t3lib_div::trimExplode(',', $conf['userGroupsPidList'], 1);
     if (count($tmpArray)) {
         foreach ($tmpArray as $value) {
             $valueIsInt = class_exists('t3lib_utility_Math') ? t3lib_utility_Math::canBeInterpretedAsInteger($value) : t3lib_div::testInt($value);
             if ($valueIsInt) {
                 $pidArray[] = intval($value);
             }
         }
     }
     if (count($pidArray) > 0) {
         $whereClause = ' pid IN (' . implode(',', $pidArray) . ') ';
     } else {
         $whereClause = ' pid=' . intval($pid) . ' ';
     }
     $whereClausePart2 = '';
     $whereClausePart2Array = array();
     $this->getAllowedValues($conf, $cmdKey, $allowedUserGroupArray, $allowedSubgroupArray, $deniedUserGroupArray);
     if ($allowedUserGroupArray['0'] != 'ALL') {
         $uidArray = $GLOBALS['TYPO3_DB']->fullQuoteArray($allowedUserGroupArray, $theTable);
         $subgroupWhereClauseArray[] = 'uid ' . ($bAllow ? 'IN' : 'NOT IN') . ' (' . implode(',', $uidArray) . ')';
     }
     if (count($allowedSubgroupArray)) {
         $subgroupArray = $GLOBALS['TYPO3_DB']->fullQuoteArray($allowedSubgroupArray, $theTable);
         $subgroupWhereClauseArray[] = 'subgroup ' . ($bAllow ? 'IN' : 'NOT IN') . ' (' . implode(',', $subgroupArray) . ')';
     }
     if (count($subgroupWhereClauseArray)) {
         $subgroupWhereClause .= implode(' ' . ($bAllow ? 'OR' : 'AND') . ' ', $subgroupWhereClauseArray);
         $whereClausePart2Array[] = '( ' . $subgroupWhereClause . ' )';
     }
     if (count($deniedUserGroupArray)) {
         $uidArray = $GLOBALS['TYPO3_DB']->fullQuoteArray($deniedUserGroupArray, $theTable);
         $whereClausePart2Array[] = 'uid ' . ($bAllow ? 'NOT IN' : 'IN') . ' (' . implode(',', $uidArray) . ')';
     }
     if (count($whereClausePart2Array)) {
         $whereClausePart2 = implode(' ' . ($bAllow ? 'AND' : 'OR') . ' ', $whereClausePart2Array);
         $whereClause .= ' AND (' . $whereClausePart2 . ')';
     }
     return $whereClause;
 }
    /**
     * Creates the TCA for fields
     *
     * @param	array		&$DBfields: array of fields (PASSED BY REFERENCE)
     * @param	array		$columns: $array of fields (PASSED BY REFERENCE)
     * @param	array		$fConf: field config
     * @param	string		$WOP: ???
     * @param	string		$table: tablename
     * @param	string		$extKey: extensionkey
     * @return	void
     */
    function makeFieldTCA(&$DBfields, &$columns, $fConf, $WOP, $table, $extKey)
    {
        if (!(string) $fConf['type']) {
            return;
        }
        $id = $table . '_' . $fConf['fieldname'];
        $version = class_exists('t3lib_utility_VersionNumber') ? t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) : t3lib_div::int_from_ver(TYPO3_version);
        $configL = array();
        $t = (string) $fConf['type'];
        switch ($t) {
            case 'input':
            case 'input+':
                $isString = true;
                $configL[] = '\'type\' => \'input\',	' . $this->WOPcomment('WOP:' . $WOP . '[type]');
                if ($version < 4006000) {
                    $configL[] = '\'size\' => \'' . t3lib_div::intInRange($fConf['conf_size'], 5, 48, 30) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_size]');
                    if (intval($fConf['conf_max'])) {
                        $configL[] = '\'max\' => \'' . t3lib_div::intInRange($fConf['conf_max'], 1, 255) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_max]');
                    }
                } else {
                    $configL[] = '\'size\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_size'], 5, 48, 30) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_size]');
                    if (intval($fConf['conf_max'])) {
                        $configL[] = '\'max\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_max'], 1, 255) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_max]');
                    }
                }
                $evalItems = array();
                if ($fConf['conf_required']) {
                    $evalItems[0][] = 'required';
                    $evalItems[1][] = $WOP . '[conf_required]';
                }
                if ($t == 'input+') {
                    $isString = (bool) (!$fConf['conf_eval']) || t3lib_div::inList('alphanum,upper,lower', $fConf['conf_eval']);
                    $isDouble2 = (bool) (!$fConf['conf_eval']) || t3lib_div::inList('double2', $fConf['conf_eval']);
                    if ($fConf['conf_varchar'] && $isString) {
                        $evalItems[0][] = 'trim';
                        $evalItems[1][] = $WOP . '[conf_varchar]';
                    }
                    if ($fConf['conf_eval'] === 'int+') {
                        $configL[] = '\'range\' => array(\'lower\' => 0, \'upper\' => 1000),	' . $this->WOPcomment('WOP:' . $WOP . '[conf_eval] = int+ results in a range setting');
                        $fConf['conf_eval'] = 'int';
                    }
                    if ($fConf['conf_eval']) {
                        $evalItems[0][] = $fConf['conf_eval'];
                        $evalItems[1][] = $WOP . '[conf_eval]';
                    }
                    if ($fConf['conf_check']) {
                        $configL[] = '\'checkbox\' => \'' . ($isString ? '' : '0') . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_check]');
                    }
                    if ($fConf['conf_stripspace']) {
                        $evalItems[0][] = 'nospace';
                        $evalItems[1][] = $WOP . '[conf_stripspace]';
                    }
                    if ($fConf['conf_pass']) {
                        $evalItems[0][] = 'password';
                        $evalItems[1][] = $WOP . '[conf_pass]';
                    }
                    if ($fConf['conf_md5']) {
                        $evalItems[0][] = 'md5';
                        $evalItems[1][] = $WOP . '[conf_md5]';
                    }
                    if ($fConf['conf_unique']) {
                        if ($fConf['conf_unique'] == 'L') {
                            $evalItems[0][] = 'uniqueInPid';
                            $evalItems[1][] = $WOP . '[conf_unique] = Local (unique in this page (PID))';
                        }
                        if ($fConf['conf_unique'] == 'G') {
                            $evalItems[0][] = 'unique';
                            $evalItems[1][] = $WOP . '[conf_unique] = Global (unique in whole database)';
                        }
                    }
                    $wizards = array();
                    if ($fConf['conf_wiz_color']) {
                        $wizards[] = trim($this->sPS('
							' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_color]') . '
							\'color\' => array(
								\'title\' => \'Color:\',
								\'type\' => \'colorbox\',
								\'dim\' => \'12x12\',
								\'tableStyle\' => \'border:solid 1px black;\',
								\'script\' => \'wizard_colorpicker.php\',
								\'JSopenParams\' => \'height=300,width=250,status=0,menubar=0,scrollbars=1\',
							),
						'));
                    }
                    if ($fConf['conf_wiz_link']) {
                        $wizards[] = trim($this->sPS('
							' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_link]') . '
							\'link\' => array(
								\'type\' => \'popup\',
								\'title\' => \'Link\',
								\'icon\' => \'link_popup.gif\',
								\'script\' => \'browse_links.php?mode=wizard\',
								\'JSopenParams\' => \'height=300,width=500,status=0,menubar=0,scrollbars=1\'
							),
						'));
                    }
                    if (count($wizards)) {
                        $configL[] = trim($this->wrapBody('
							\'wizards\' => array(
								\'_PADDING\' => 2,
								', implode(chr(10), $wizards), '
							),
						'));
                    }
                } else {
                    if ($fConf['conf_varchar']) {
                        $evalItems[0][] = 'trim';
                        $evalItems[1][] = $WOP . '[conf_varchar]';
                    }
                }
                if (count($evalItems)) {
                    $configL[] = '\'eval\' => \'' . implode(",", $evalItems[0]) . '\',	' . $this->WOPcomment('WOP:' . implode(' / ', $evalItems[1]));
                }
                if (!$isString && !$isDouble2) {
                    $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,';
                } elseif (!$isString && $isDouble2) {
                    $DBfields[] = $fConf["fieldname"] . " double(11,2) DEFAULT '0.00' NOT NULL,";
                } elseif (!$fConf['conf_varchar']) {
                    $DBfields[] = $fConf['fieldname'] . ' tinytext,';
                } else {
                    if ($version < 4006000) {
                        $varCharLn = intval($fConf['conf_max']) ? t3lib_div::intInRange($fConf['conf_max'], 1, 255) : 255;
                    } else {
                        $varCharLn = intval($fConf['conf_max']) ? t3lib_utility_Math::forceIntegerInRange($fConf['conf_max'], 1, 255) : 255;
                    }
                    $DBfields[] = $fConf['fieldname'] . ' ' . ($varCharLn > $this->wizard->charMaxLng ? 'var' : '') . 'char(' . $varCharLn . ') DEFAULT \'\' NOT NULL,';
                }
                break;
            case 'link':
                $DBfields[] = $fConf['fieldname'] . ' tinytext,';
                $configL[] = trim($this->sPS('
					\'type\'     => \'input\',
					\'size\'     => \'15\',
					\'max\'      => \'255\',
					\'checkbox\' => \'\',
					\'eval\'     => \'trim\',
					\'wizards\'  => array(
						\'_PADDING\' => 2,
						\'link\'     => array(
							\'type\'         => \'popup\',
							\'title\'        => \'Link\',
							\'icon\'         => \'link_popup.gif\',
							\'script\'       => \'browse_links.php?mode=wizard\',
							\'JSopenParams\' => \'height=300,width=500,status=0,menubar=0,scrollbars=1\'
						)
					)
				'));
                break;
            case 'datetime':
            case 'date':
                $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,';
                $configL[] = trim($this->sPS('
					\'type\'     => \'input\',
					\'size\'     => \'' . ($t == "datetime" ? 12 : 8) . '\',
					\'max\'      => \'20\',
					\'eval\'     => \'' . $t . '\',
					\'checkbox\' => \'0\',
					\'default\'  => \'0\'
				'));
                break;
            case 'integer':
                $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,';
                $configL[] = trim($this->sPS('
					\'type\'     => \'input\',
					\'size\'     => \'4\',
					\'max\'      => \'4\',
					\'eval\'     => \'int\',
					\'checkbox\' => \'0\',
					\'range\'    => array(
						\'upper\' => \'1000\',
						\'lower\' => \'10\'
					),
					\'default\' => 0
				'));
                break;
            case 'textarea':
            case 'textarea_nowrap':
                $DBfields[] = $fConf['fieldname'] . ' text,';
                $configL[] = '\'type\' => \'text\',';
                if ($t == 'textarea_nowrap') {
                    $configL[] = '\'wrap\' => \'OFF\',';
                }
                if ($version < 4006000) {
                    $configL[] = '\'cols\' => \'' . t3lib_div::intInRange($fConf['conf_cols'], 5, 48, 30) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_cols]');
                    $configL[] = '\'rows\' => \'' . t3lib_div::intInRange($fConf['conf_rows'], 1, 20, 5) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rows]');
                } else {
                    $configL[] = '\'cols\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_cols'], 5, 48, 30) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_cols]');
                    $configL[] = '\'rows\' => \'' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_rows'], 1, 20, 5) . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rows]');
                }
                if ($fConf["conf_wiz_example"]) {
                    $wizards = array();
                    $wizards[] = trim($this->sPS('
						' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_example]') . '
						\'example\' => array(
							\'title\'         => \'Example Wizard:\',
							\'type\'          => \'script\',
							\'notNewRecords\' => 1,
							\'icon\'          => t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . $id . '/wizard_icon.gif\',
							\'script\'        => t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . $id . '/index.php\',
						),
					'));
                    $cN = $this->returnName($extKey, 'class', $id . 'wiz');
                    $this->writeStandardBE_xMod($extKey, array('title' => 'Example Wizard title...'), $id . '/', $cN, 0, $id . 'wiz');
                    $this->addFileToFileArray($id . '/wizard_icon.gif', t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter') . 'res/notfound.gif'));
                    $configL[] = trim($this->wrapBody('
						\'wizards\' => array(
							\'_PADDING\' => 2,
							', implode(chr(10), $wizards), '
						),
					'));
                }
                break;
            case 'textarea_rte':
                $DBfields[] = $fConf['fieldname'] . ' text,';
                $configL[] = '\'type\' => \'text\',';
                $configL[] = '\'cols\' => \'30\',';
                $configL[] = '\'rows\' => \'5\',';
                if ($fConf['conf_rte_fullscreen']) {
                    $wizards = array();
                    $wizards[] = trim($this->sPS('
						' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_fullscreen]') . '
						\'RTE\' => array(
							\'notNewRecords\' => 1,
							\'RTEonly\'       => 1,
							\'type\'          => \'script\',
							\'title\'         => \'Full screen Rich Text Editing|Formatteret redigering i hele vinduet\',
							\'icon\'          => \'wizard_rte2.gif\',
							\'script\'        => \'wizard_rte.php\',
						),
					'));
                    $configL[] = trim($this->wrapBody('
						\'wizards\' => array(
							\'_PADDING\' => 2,
							', implode(chr(10), $wizards), '
						),
					'));
                }
                $rteImageDir = '';
                if ($fConf['conf_rte_separateStorageForImages'] && t3lib_div::inList('moderate,basic,custom', $fConf['conf_rte'])) {
                    $this->wizard->EM_CONF_presets['createDirs'][] = $this->ulFolder($extKey) . 'rte/';
                    $rteImageDir = '|imgpath=' . $this->ulFolder($extKey) . 'rte/';
                }
                $transformation = 'ts_images-ts_reglinks';
                if ($fConf['conf_mode_cssOrNot'] && t3lib_div::inList('moderate,custom', $fConf['conf_rte'])) {
                    $transformation = 'ts_css';
                }
                switch ($fConf['conf_rte']) {
                    case 'tt_content':
                        $typeP = 'richtext[]:rte_transform[mode=ts]';
                        break;
                    case 'moderate':
                        $typeP = 'richtext[]:rte_transform[mode=' . $transformation . '' . $rteImageDir . ']';
                        break;
                    case 'basic':
                        $typeP = 'richtext[]:rte_transform[mode=ts_css' . $rteImageDir . ']';
                        $this->wizard->ext_localconf[] = trim($this->wrapBody("\n\t\t\t\t\t\t\t\tt3lib_extMgm::addPageTSConfig('\n\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\t\t\t\t\t\t\t\t\t# CONFIGURATION of RTE in table \"" . $table . "\", field \"" . $fConf["fieldname"] . "\"\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\n\t\t\t\t\t\t\t\t\t", trim($this->slashValueForSingleDashes(str_replace(chr(9), "  ", $this->sPS("\n\t\t\t\t\t\t\t\t\t\tRTE.config." . $table . "." . $fConf["fieldname"] . " {\n\t\t\t\t\t\t\t\t\t\t\thidePStyleItems = H1, H4, H5, H6\n\t\t\t\t\t\t\t\t\t\t\tproc.exitHTMLparser_db=1\n\t\t\t\t\t\t\t\t\t\t\tproc.exitHTMLparser_db {\n\t\t\t\t\t\t\t\t\t\t\t\tkeepNonMatchedTags=1\n\t\t\t\t\t\t\t\t\t\t\t\ttags.font.allowedAttribs= color\n\t\t\t\t\t\t\t\t\t\t\t\ttags.font.rmTagIfNoAttrib = 1\n\t\t\t\t\t\t\t\t\t\t\t\ttags.font.nesting = global\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t")))), "\n\t\t\t\t\t\t\t\t');\n\t\t\t\t\t\t", 0));
                        break;
                    case 'none':
                        $typeP = 'richtext[]';
                        break;
                    case 'custom':
                        $enabledButtons = array();
                        $traverseList = explode(',', 'cut,copy,paste,formatblock,class,fontstyle,fontsize,textcolor,bold,italic,underline,left,center,right,orderedlist,unorderedlist,outdent,indent,link,table,image,line,user,chMode');
                        $HTMLparser = array();
                        $fontAllowedAttrib = array();
                        $allowedTags_WOP = array();
                        $allowedTags = array();
                        while (list(, $lI) = each($traverseList)) {
                            $nothingDone = 0;
                            if ($fConf['conf_rte_b_' . $lI]) {
                                $enabledButtons[] = $lI;
                                switch ($lI) {
                                    case 'formatblock':
                                    case 'left':
                                    case 'center':
                                    case 'right':
                                        $allowedTags[] = 'div';
                                        $allowedTags[] = 'p';
                                        break;
                                    case 'class':
                                        $allowedTags[] = 'span';
                                        break;
                                    case 'fontstyle':
                                        $allowedTags[] = 'font';
                                        $fontAllowedAttrib[] = 'face';
                                        break;
                                    case 'fontsize':
                                        $allowedTags[] = 'font';
                                        $fontAllowedAttrib[] = 'size';
                                        break;
                                    case 'textcolor':
                                        $allowedTags[] = 'font';
                                        $fontAllowedAttrib[] = 'color';
                                        break;
                                    case 'bold':
                                        $allowedTags[] = 'b';
                                        $allowedTags[] = 'strong';
                                        break;
                                    case 'italic':
                                        $allowedTags[] = 'i';
                                        $allowedTags[] = 'em';
                                        break;
                                    case 'underline':
                                        $allowedTags[] = 'u';
                                        break;
                                    case 'orderedlist':
                                        $allowedTags[] = 'ol';
                                        $allowedTags[] = 'li';
                                        break;
                                    case 'unorderedlist':
                                        $allowedTags[] = 'ul';
                                        $allowedTags[] = 'li';
                                        break;
                                    case 'outdent':
                                    case 'indent':
                                        $allowedTags[] = 'blockquote';
                                        break;
                                    case 'link':
                                        $allowedTags[] = 'a';
                                        break;
                                    case 'table':
                                        $allowedTags[] = 'table';
                                        $allowedTags[] = 'tr';
                                        $allowedTags[] = 'td';
                                        break;
                                    case 'image':
                                        $allowedTags[] = 'img';
                                        break;
                                    case 'line':
                                        $allowedTags[] = 'hr';
                                        break;
                                    default:
                                        $nothingDone = 1;
                                        break;
                                }
                                if (!$nothingDone) {
                                    $allowedTags_WOP[] = $WOP . '[conf_rte_b_' . $lI . ']';
                                }
                            }
                        }
                        if (count($fontAllowedAttrib)) {
                            $HTMLparser[] = 'tags.font.allowedAttribs = ' . implode(',', $fontAllowedAttrib);
                            $HTMLparser[] = 'tags.font.rmTagIfNoAttrib = 1';
                            $HTMLparser[] = 'tags.font.nesting = global';
                        }
                        if (count($enabledButtons)) {
                            $typeP = 'richtext[' . implode('|', $enabledButtons) . ']:rte_transform[mode=' . $transformation . '' . $rteImageDir . ']';
                        }
                        $rte_colors = array();
                        $setupUpColors = array();
                        for ($a = 1; $a <= 3; $a++) {
                            if ($fConf['conf_rte_color' . $a]) {
                                $rte_colors[$id . '_color' . $a] = trim($this->sPS('
									' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_color' . $a . ']') . '
									' . $id . '_color' . $a . ' {
										name = Color ' . $a . '
										value = ' . $fConf['conf_rte_color' . $a] . '
									}
								'));
                                $setupUpColors[] = trim($fConf['conf_rte_color' . $a]);
                            }
                        }
                        $rte_classes = array();
                        for ($a = 1; $a <= 6; $a++) {
                            if ($fConf['conf_rte_class' . $a]) {
                                $rte_classes[$id . '_class' . $a] = trim($this->sPS('
									' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_class' . $a . ']') . '
									' . $id . '_class' . $a . ' {
										name = ' . $fConf['conf_rte_class' . $a] . '
										value = ' . $fConf['conf_rte_class' . $a . '_style'] . '
									}
								'));
                            }
                        }
                        $PageTSconfig = array();
                        if ($fConf['conf_rte_removecolorpicker']) {
                            $PageTSconfig[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removecolorpicker]');
                            $PageTSconfig[] = 'disableColorPicker = 1';
                        }
                        if (count($rte_classes)) {
                            $PageTSconfig[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_class*]');
                            $PageTSconfig[] = 'classesParagraph = ' . implode(', ', array_keys($rte_classes));
                            $PageTSconfig[] = 'classesCharacter = ' . implode(', ', array_keys($rte_classes));
                            if (in_array('p', $allowedTags) || in_array('div', $allowedTags)) {
                                $HTMLparser[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_class*]');
                                if (in_array('p', $allowedTags)) {
                                    $HTMLparser[] = 'p.fixAttrib.class.list = ,' . implode(',', array_keys($rte_classes));
                                }
                                if (in_array('div', $allowedTags)) {
                                    $HTMLparser[] = 'div.fixAttrib.class.list = ,' . implode(',', array_keys($rte_classes));
                                }
                            }
                        }
                        if (count($rte_colors)) {
                            $PageTSconfig[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_color*]');
                            $PageTSconfig[] = 'colors = ' . implode(', ', array_keys($rte_colors));
                            if (in_array('color', $fontAllowedAttrib) && $fConf['conf_rte_removecolorpicker']) {
                                $HTMLparser[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removecolorpicker]');
                                $HTMLparser[] = 'tags.font.fixAttrib.color.list = ,' . implode(',', $setupUpColors);
                                $HTMLparser[] = 'tags.font.fixAttrib.color.removeIfFalse = 1';
                            }
                        }
                        if (!strcmp($fConf['conf_rte_removePdefaults'], 1)) {
                            $PageTSconfig[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removePdefaults]');
                            $PageTSconfig[] = 'hidePStyleItems = H1, H2, H3, H4, H5, H6, PRE';
                        } elseif ($fConf['conf_rte_removePdefaults'] == 'H2H3') {
                            $PageTSconfig[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_removePdefaults]');
                            $PageTSconfig[] = 'hidePStyleItems = H1, H4, H5, H6';
                        } else {
                            $allowedTags[] = 'h1';
                            $allowedTags[] = 'h2';
                            $allowedTags[] = 'h3';
                            $allowedTags[] = 'h4';
                            $allowedTags[] = 'h5';
                            $allowedTags[] = 'h6';
                            $allowedTags[] = 'pre';
                        }
                        $allowedTags = array_unique($allowedTags);
                        if (count($allowedTags)) {
                            $HTMLparser[] = '	' . $this->WOPcomment('WOP:' . implode(' / ', $allowedTags_WOP));
                            $HTMLparser[] = 'allowTags = ' . implode(', ', $allowedTags);
                        }
                        if ($fConf['conf_rte_div_to_p']) {
                            $HTMLparser[] = '	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rte_div_to_p]');
                            $HTMLparser[] = 'tags.div.remap = P';
                        }
                        if (count($HTMLparser)) {
                            $PageTSconfig[] = trim($this->wrapBody('
								proc.exitHTMLparser_db=1
								proc.exitHTMLparser_db {
									', implode(chr(10), $HTMLparser), '
								}
							'));
                        }
                        $finalPageTSconfig = array();
                        if (count($rte_colors)) {
                            $finalPageTSconfig[] = trim($this->wrapBody('
								RTE.colors {
								', implode(chr(10), $rte_colors), '
								}
							'));
                        }
                        if (count($rte_classes)) {
                            $finalPageTSconfig[] = trim($this->wrapBody('
								RTE.classes {
								', implode(chr(10), $rte_classes), '
								}
							'));
                        }
                        if (count($PageTSconfig)) {
                            $finalPageTSconfig[] = trim($this->wrapBody('
								RTE.config.' . $table . '.' . $fConf['fieldname'] . ' {
								', implode(chr(10), $PageTSconfig), '
								}
							'));
                        }
                        if (count($finalPageTSconfig)) {
                            $this->wizard->ext_localconf[] = trim($this->wrapBody("\n\t\t\t\t\t\t\t\tt3lib_extMgm::addPageTSConfig('\n\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\t\t\t\t\t\t\t\t\t# CONFIGURATION of RTE in table \"" . $table . "\", field \"" . $fConf["fieldname"] . "\"\n\t\t\t\t\t\t\t\t\t# ***************************************************************************************\n\n\t\t\t\t\t\t\t\t", trim($this->slashValueForSingleDashes(str_replace(chr(9), "  ", implode(chr(10) . chr(10), $finalPageTSconfig)))), "\n\t\t\t\t\t\t\t\t');\n\t\t\t\t\t\t\t", 0));
                        }
                        break;
                }
                $this->wizard->_typeP[$fConf['fieldname']] = $typeP;
                break;
            case 'check':
            case 'check_4':
            case 'check_10':
                $configL[] = '\'type\' => \'check\',';
                if ($t == 'check') {
                    $DBfields[] = $fConf['fieldname'] . ' tinyint(3) DEFAULT \'0\' NOT NULL,';
                    if ($fConf['conf_check_default']) {
                        $configL[] = '\'default\' => 1,	' . $this->WOPcomment('WOP:' . $WOP . '[conf_check_default]');
                    }
                } else {
                    $DBfields[] = $fConf['fieldname'] . ' int(11) DEFAULT \'0\' NOT NULL,';
                }
                if ($t == 'check_4' || $t == 'check_10') {
                    $configL[] = '\'cols\' => 4,';
                    $cItems = array();
                    $aMax = intval($fConf["conf_numberBoxes"]);
                    for ($a = 0; $a < $aMax; $a++) {
                        $cItems[] = 'array(\'' . addslashes($this->getSplitLabels_reference($fConf, "conf_boxLabel_" . $a, $table . "." . $fConf["fieldname"] . ".I." . $a)) . '\', \'\'),';
                    }
                    $configL[] = trim($this->wrapBody('
						\'items\' => array(
							', implode(chr(10), $cItems), '
						),
					'));
                }
                break;
            case 'radio':
            case 'select':
                $configL[] = '\'type\' => \'' . ($t == 'select' ? 'select' : 'radio') . '\',';
                $notIntVal = 0;
                $len = array();
                $numberOfItems = $version < 4006000 ? t3lib_div::intInRange($fConf['conf_select_items'], 1, 20) : t3lib_utility_Math::forceIntegerInRange($fConf['conf_select_items'], 1, 20);
                for ($a = 0; $a < $numberOfItems; $a++) {
                    $val = $fConf["conf_select_itemvalue_" . $a];
                    if ($version < 4006000) {
                        $notIntVal += t3lib_div::testInt($val) ? 0 : 1;
                    } else {
                        $notIntVal += t3lib_utility_Math::canBeInterpretedAsInteger($val) ? 0 : 1;
                    }
                    $len[] = strlen($val);
                    if ($fConf["conf_select_icons"] && $t == "select") {
                        $icon = ', t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . 'selicon_' . $id . '_' . $a . '.gif' . '\'';
                        // Add wizard icon
                        $this->addFileToFileArray("selicon_" . $id . "_" . $a . ".gif", t3lib_div::getUrl(t3lib_extMgm::extPath("kickstarter") . "res/wiz.gif"));
                    } else {
                        $icon = "";
                    }
                    //					$cItems[]='Array("'.str_replace("\\'","'",addslashes($this->getSplitLabels($fConf,"conf_select_item_".$a))).'", "'.addslashes($val).'"'.$icon.'),';
                    $cItems[] = 'array(\'' . addslashes($this->getSplitLabels_reference($fConf, "conf_select_item_" . $a, $table . "." . $fConf["fieldname"] . ".I." . $a)) . '\', \'' . addslashes($val) . '\'' . $icon . '),';
                }
                $configL[] = trim($this->wrapBody('
					' . $this->WOPcomment('WOP:' . $WOP . '[conf_select_items]') . '
					\'items\' => array(
						', implode(chr(10), $cItems), '
					),
				'));
                if ($fConf['conf_select_pro'] && $t == 'select') {
                    $cN = $this->returnName($extKey, 'class', $id);
                    $configL[] = '\'itemsProcFunc\' => \'' . $cN . '->main\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_select_pro]');
                    $classContent = $this->sPS('class ' . $cN . ' {

	/**
	 * [Describe function...]
	 *
	 * @param	[type]		$$params: ...
	 * @param	[type]		$pObj: ...
	 * @return	[type]		...
	 */
							function main(&$params,&$pObj)	{
/*
								debug(\'Hello World!\',1);
								debug(\'$params:\',1);
								debug($params);
								debug(\'$pObj:\',1);
								debug($pObj);
*/
									// Adding an item!
								$params[\'items\'][] = array($pObj->sL(\'Added label by PHP function|Tilfjet Dansk tekst med PHP funktion\'), 999);

								// No return - the $params and $pObj variables are passed by reference, so just change content in then and it is passed back automatically...
							}
						}
					', 0);
                    $this->addFileToFileArray('class.' . $cN . '.php', $this->PHPclassFile($extKey, 'class.' . $cN . '.php', $classContent, 'Class/Function which manipulates the item-array for table/field ' . $id . '.'));
                    $this->wizard->ext_tables[] = $this->sPS('
						' . $this->WOPcomment('WOP:' . $WOP . '[conf_select_pro]:') . '
						if (TYPO3_MODE === \'BE\')	{
							include_once(t3lib_extMgm::extPath(\'' . $extKey . '\').\'' . 'class.' . $cN . '.php\');
						}
					');
                }
                $numberOfRelations = $version < 4006000 ? t3lib_div::intInRange($fConf['conf_relations'], 1, 100) : t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations'], 1, 100);
                if ($t == 'select') {
                    if ($version < 4006000) {
                        $configL[] = '\'size\' => ' . t3lib_div::intInRange($fConf['conf_relations_selsize'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]');
                    } else {
                        $configL[] = '\'size\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations_selsize'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]');
                    }
                    $configL[] = '\'maxitems\' => ' . $numberOfRelations . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations]');
                }
                if ($numberOfRelations > 1 && $t == "select") {
                    if ($numberOfRelations * 4 < 256) {
                        $DBfields[] = $fConf["fieldname"] . " varchar(" . $numberOfRelations * 4 . ") DEFAULT '' NOT NULL,";
                    } else {
                        $DBfields[] = $fConf["fieldname"] . " text,";
                    }
                } elseif ($notIntVal) {
                    $varCharLn = $version < 4006000 ? t3lib_div::intInRange(max($len), 1) : t3lib_utility_Math::forceIntegerInRange(max($len), 1);
                    $DBfields[] = $fConf["fieldname"] . " " . ($varCharLn > $this->wizard->charMaxLng ? 'var' : '') . "char(" . $varCharLn . ") DEFAULT '' NOT NULL,";
                } else {
                    $DBfields[] = $fConf["fieldname"] . ' int(11) DEFAULT \'0\' NOT NULL,';
                }
                break;
            case 'rel':
                if ($fConf["conf_rel_type"] == "group") {
                    $configL[] = '\'type\' => \'group\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]');
                    $configL[] = '\'internal_type\' => \'db\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]');
                } else {
                    $configL[] = '\'type\' => \'select\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]');
                }
                if ($fConf["conf_rel_type"] != "group" && $fConf["conf_relations"] == 1 && $fConf["conf_rel_dummyitem"]) {
                    $configL[] = trim($this->wrapBody('
						' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_dummyitem]') . '
						\'items\' => array(
							', 'array(\'\', 0),', '
						),
					'));
                }
                if (t3lib_div::inList("tt_content,fe_users,fe_groups", $fConf["conf_rel_table"])) {
                    $this->wizard->EM_CONF_presets["dependencies"][] = "cms";
                }
                if ($fConf["conf_rel_table"] == "_CUSTOM") {
                    $fConf["conf_rel_table"] = $fConf["conf_custom_table_name"] ? $fConf["conf_custom_table_name"] : "NO_TABLE_NAME_AVAILABLE";
                }
                if ($fConf["conf_rel_type"] == "group") {
                    $configL[] = '\'allowed\' => \'' . ($fConf["conf_rel_table"] != "_ALL" ? $fConf["conf_rel_table"] : "*") . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_table]');
                    if ($fConf["conf_rel_table"] == "_ALL") {
                        $configL[] = '\'prepend_tname\' => 1,	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_table]=_ALL');
                    }
                } else {
                    switch ($fConf["conf_rel_type"]) {
                        case "select_cur":
                            $where = "AND " . $fConf["conf_rel_table"] . ".pid=###CURRENT_PID### ";
                            break;
                        case "select_root":
                            $where = "AND " . $fConf["conf_rel_table"] . ".pid=###SITEROOT### ";
                            break;
                        case "select_storage":
                            $where = "AND " . $fConf["conf_rel_table"] . ".pid=###STORAGE_PID### ";
                            break;
                        default:
                            $where = "";
                            break;
                    }
                    $configL[] = '\'foreign_table\' => \'' . $fConf["conf_rel_table"] . '\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_table]');
                    $configL[] = '\'foreign_table_where\' => \'' . $where . 'ORDER BY ' . $fConf["conf_rel_table"] . '.uid\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_rel_type]');
                }
                if ($version < 4006000) {
                    $configL[] = '\'size\' => ' . t3lib_div::intInRange($fConf['conf_relations_selsize'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]');
                    $configL[] = '\'minitems\' => 0,';
                    $configL[] = '\'maxitems\' => ' . t3lib_div::intInRange($fConf['conf_relations'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations]');
                    $confRelations = t3lib_div::intInRange($fConf['conf_relations'], 1, 100);
                } else {
                    $configL[] = '\'size\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations_selsize'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_selsize]');
                    $configL[] = '\'minitems\' => 0,';
                    $configL[] = '\'maxitems\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations]');
                    $confRelations = t3lib_utility_Math::forceIntegerInRange($fConf['conf_relations'], 1, 100);
                }
                if ($fConf["conf_relations_mm"]) {
                    $mmTableName = $id . "_mm";
                    $configL[] = '"MM" => "' . $mmTableName . '",	' . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_mm]');
                    $DBfields[] = $fConf["fieldname"] . ' int(11) DEFAULT \'0\' NOT NULL,';
                    $createTable = $this->sPS("\n\t\t\t\t\t\t#\n\t\t\t\t\t\t# Table structure for table '" . $mmTableName . "'\n\t\t\t\t\t\t# " . $this->WOPcomment('WOP:' . $WOP . '[conf_relations_mm]') . "\n\t\t\t\t\t\t#\n\t\t\t\t\t\tCREATE TABLE " . $mmTableName . " (\n\t\t\t\t\t\t  uid_local int(11) DEFAULT '0' NOT NULL,\n\t\t\t\t\t\t  uid_foreign int(11) DEFAULT '0' NOT NULL,\n\t\t\t\t\t\t  tablenames varchar(30) DEFAULT '' NOT NULL,\n\t\t\t\t\t\t  sorting int(11) DEFAULT '0' NOT NULL,\n\t\t\t\t\t\t  KEY uid_local (uid_local),\n\t\t\t\t\t\t  KEY uid_foreign (uid_foreign)\n\t\t\t\t\t\t);\n\t\t\t\t\t");
                    $this->wizard->ext_tables_sql[] = chr(10) . $createTable . chr(10);
                } elseif ($confRelations > 1 || $fConf["conf_rel_type"] == "group") {
                    $DBfields[] = $fConf["fieldname"] . " text,";
                } else {
                    $DBfields[] = $fConf["fieldname"] . ' int(11) DEFAULT \'0\' NOT NULL,';
                }
                if ($fConf["conf_rel_type"] != "group") {
                    $wTable = $fConf["conf_rel_table"];
                    $wizards = array();
                    if ($fConf["conf_wiz_addrec"]) {
                        $wizards[] = trim($this->sPS('
							' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_addrec]') . '
							\'add\' => array(
								\'type\'   => \'script\',
								\'title\'  => \'Create new record\',
								\'icon\'   => \'add.gif\',
								\'params\' => array(
									\'table\'    => \'' . $wTable . '\',
									\'pid\'      => \'###CURRENT_PID###\',
									\'setValue\' => \'prepend\'
								),
								\'script\' => \'wizard_add.php\',
							),
						'));
                    }
                    if ($fConf["conf_wiz_listrec"]) {
                        $wizards[] = trim($this->sPS('
							' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_listrec]') . '
							\'list\' => array(
								\'type\'   => \'script\',
								\'title\'  => \'List\',
								\'icon\'   => \'list.gif\',
								\'params\' => array(
									\'table\' => \'' . $wTable . '\',
									\'pid\'   => \'###CURRENT_PID###\',
								),
								\'script\' => \'wizard_list.php\',
							),
						'));
                    }
                    if ($fConf["conf_wiz_editrec"]) {
                        $wizards[] = trim($this->sPS('
							' . $this->WOPcomment('WOP:' . $WOP . '[conf_wiz_editrec]') . '
							\'edit\' => array(
								\'type\'                     => \'popup\',
								\'title\'                    => \'Edit\',
								\'script\'                   => \'wizard_edit.php\',
								\'popup_onlyOpenIfSelected\' => 1,
								\'icon\'                     => \'edit2.gif\',
								\'JSopenParams\'             => \'height=350,width=580,status=0,menubar=0,scrollbars=1\',
							),
						'));
                    }
                    if (count($wizards)) {
                        $configL[] = trim($this->wrapBody('
							\'wizards\' => array(
								\'_PADDING\'  => 2,
								\'_VERTICAL\' => 1,
								', implode(chr(10), $wizards), '
							),
						'));
                    }
                }
                break;
            case "files":
                $configL[] = '\'type\' => \'group\',';
                $configL[] = '\'internal_type\' => \'file\',';
                switch ($fConf["conf_files_type"]) {
                    case "images":
                        $configL[] = '\'allowed\' => $GLOBALS[\'TYPO3_CONF_VARS\'][\'GFX\'][\'imagefile_ext\'],	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]');
                        break;
                    case "webimages":
                        $configL[] = '\'allowed\' => \'gif,png,jpeg,jpg\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]');
                        // TODO use web images definition from install tool
                        break;
                    case "all":
                        $configL[] = '\'allowed\' => \'\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]');
                        $configL[] = '\'disallowed\' => \'php,php3\',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_type]');
                        break;
                }
                $configL[] = '\'max_size\' => $GLOBALS[\'TYPO3_CONF_VARS\'][\'BE\'][\'maxFileSize\'],	' . $this->WOPcomment('WOP:' . $WOP . '[conf_max_filesize]');
                $this->wizard->EM_CONF_presets["uploadfolder"] = 1;
                $ulFolder = 'uploads/tx_' . str_replace("_", "", $extKey);
                $configL[] = '\'uploadfolder\' => \'' . $ulFolder . '\',';
                if ($fConf['conf_files_thumbs']) {
                    $configL[] = '\'show_thumbs\' => 1,	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_thumbs]');
                }
                if ($version < 4006000) {
                    $configL[] = '\'size\' => ' . t3lib_div::intInRange($fConf['conf_files_selsize'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_selsize]');
                    $configL[] = '\'minitems\' => 0,';
                    $configL[] = '\'maxitems\' => ' . t3lib_div::intInRange($fConf['conf_files'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files]');
                } else {
                    $configL[] = '\'size\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_files_selsize'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files_selsize]');
                    $configL[] = '\'minitems\' => 0,';
                    $configL[] = '\'maxitems\' => ' . t3lib_utility_Math::forceIntegerInRange($fConf['conf_files'], 1, 100) . ',	' . $this->WOPcomment('WOP:' . $WOP . '[conf_files]');
                }
                $DBfields[] = $fConf["fieldname"] . " text,";
                break;
            case 'flex':
                $DBfields[] = $fConf['fieldname'] . ' mediumtext,';
                $configL[] = trim($this->sPS('
					\'type\' => \'flex\',
		\'ds\' => array(
			\'default\' => \'FILE:EXT:' . $extKey . '/flexform_' . $table . '_' . $fConf['fieldname'] . '.xml\',
		),
				'));
                $this->addFileToFileArray('flexform_' . $table . '_' . $fConf['fieldname'] . '.xml', $this->createFlexForm());
                break;
            case "none":
                $DBfields[] = $fConf["fieldname"] . " tinytext,";
                $configL[] = trim($this->sPS('
					\'type\' => \'none\',
				'));
                break;
            case "passthrough":
                $DBfields[] = $fConf["fieldname"] . " tinytext,";
                $configL[] = trim($this->sPS('
					\'type\' => \'passthrough\',
				'));
                break;
            case 'inline':
                #$DBfields=$this->getInlineDBfields($fConf);
                if ($DBfields) {
                    $DBfields = array_merge($DBfields, $this->getInlineDBfields($table, $fConf));
                }
                $configL = $this->getInlineTCAconfig($table, $fConf);
                break;
            default:
                debug("Unknown type: " . (string) $fConf["type"]);
                break;
        }
        if ($t == "passthrough") {
            $columns[$fConf["fieldname"]] = trim($this->wrapBody('
				\'' . $fConf["fieldname"] . '\' => array(		' . $this->WOPcomment('WOP:' . $WOP . '[fieldname]') . '
					\'config\' => array(
						', implode(chr(10), $configL), '
					)
				),
			', 2));
        } else {
            $columns[$fConf["fieldname"]] = trim($this->wrapBody('
				\'' . $fConf["fieldname"] . '\' => array(		' . $this->WOPcomment('WOP:' . $WOP . '[fieldname]') . '
					\'exclude\' => ' . ($fConf["excludeField"] ? 1 : 0) . ',		' . $this->WOPcomment('WOP:' . $WOP . '[excludeField]') . '
					\'label\' => \'' . addslashes($this->getSplitLabels_reference($fConf, "title", $table . "." . $fConf["fieldname"])) . '\',		' . $this->WOPcomment('WOP:' . $WOP . '[title]') . '
					\'config\' => array(
						', implode(chr(10), $configL), '
					)
				),
			', 2));
        }
    }
	/**
	 * Returns the type of an iso code: nr, 2, 3
	 *
	 * @param	string		iso code
	 * @return	string		iso code type
	 */
	function isoCodeType ($isoCode) {
		$type = '';
			// t3lib_utility_Math was introduced in TYPO3 4.6
		$isoCodeAsInteger = class_exists('t3lib_utility_Math')
			? t3lib_utility_Math::canBeInterpretedAsInteger($isoCode)
			: t3lib_div::testInt($isoCode);
		if ($isoCodeAsInteger) {
			$type = 'nr';
		} elseif (strlen($isoCode) == 2) {
			$type = '2';
		} elseif (strlen($isoCode) == 3) {
			$type = '3';
		}
		return $type;
	}
Example #29
0
 /**
  * Initializes the list view (normal list, my events or my VIP events) and
  * creates a seminar bag or a registration bag (for the "my events" view),
  * but does not create any actual HTML output.
  *
  * @param string $whatToDisplay
  *        the flavor of list view: either an empty string (for the default
  *        list view), the value from "what_to_display", or "other_dates"
  *
  * @return tx_seminars_Bag_Abstract a seminar bag or a registration bag
  *                                  containing the seminars or registrations
  *                                  for the list view
  */
 public function initListView($whatToDisplay = '')
 {
     if (strstr($this->cObj->currentRecord, 'tt_content')) {
         $this->conf['pidList'] = $this->getConfValueString('pages');
         $this->conf['recursive'] = $this->getConfValueInteger('recursive');
     }
     $this->hideColumnsForAllViewsFromTypoScriptSetup();
     $this->hideRegisterColumnIfNecessary($whatToDisplay);
     $this->hideColumnsForAllViewsExceptMyEvents($whatToDisplay);
     $this->hideCsvExportOfRegistrationsColumnIfNecessary($whatToDisplay);
     $this->hideListRegistrationsColumnIfNecessary($whatToDisplay);
     $this->hideEditColumnIfNecessary($whatToDisplay);
     $this->hideFilesColumnIfUserCannotAccessFiles();
     $this->hideStatusColumnIfNotUsed($whatToDisplay);
     if (!isset($this->piVars['pointer'])) {
         $this->piVars['pointer'] = 0;
     }
     $this->internal['descFlag'] = $this->getListViewConfValueBoolean('descFlag');
     $this->internal['orderBy'] = $this->getListViewConfValueString('orderBy');
     if (class_exists('t3lib_utility_Math')) {
         // number of results to show in a listing
         $this->internal['results_at_a_time'] = t3lib_utility_Math::forceIntegerInRange($this->getListViewConfValueInteger('results_at_a_time'), 0, 1000, 20);
         // maximum number of 'pages' in the browse-box: 'Page 1', 'Page 2', etc.
         $this->internal['maxPages'] = t3lib_utility_Math::forceIntegerInRange($this->getListViewConfValueInteger('maxPages'), 0, 1000, 2);
     } else {
         // number of results to show in a listing
         $this->internal['results_at_a_time'] = t3lib_div::intInRange($this->getListViewConfValueInteger('results_at_a_time'), 0, 1000, 20);
         // maximum number of 'pages' in the browse-box: 'Page 1', 'Page 2', etc.
         $this->internal['maxPages'] = t3lib_div::intInRange($this->getListViewConfValueInteger('maxPages'), 0, 1000, 2);
     }
     if ($whatToDisplay === 'my_events') {
         $builder = $this->createRegistrationBagBuilder();
     } else {
         $builder = $this->createSeminarBagBuilder();
     }
     if ($whatToDisplay !== 'my_events') {
         $this->limitForAdditionalParameters($builder);
     }
     if (!in_array($whatToDisplay, array('my_entered_events', 'my_events', 'topic_list'), TRUE)) {
         $builder->limitToDateAndSingleRecords();
         $this->limitToTimeFrameSetting($builder);
     }
     $user = Tx_Oelib_FrontEndLoginManager::getInstance()->getLoggedInUser('tx_seminars_Mapper_FrontEndUser');
     switch ($whatToDisplay) {
         case 'topic_list':
             $builder->limitToTopicRecords();
             $this->hideColumnsForTheTopicListView();
             break;
         case 'my_events':
             $builder->limitToAttendee($user);
             break;
         case 'my_vip_events':
             $groupForDefaultVips = $this->getConfValueInteger('defaultEventVipsFeGroupID', 's_template_special');
             $isDefaultVip = $groupForDefaultVips != 0 && $user->hasGroupMembership($groupForDefaultVips);
             if (!$isDefaultVip) {
                 // The current user is not listed as a default VIP for all
                 // events. Change the query to show only events where the
                 // current user is manually added as a VIP.
                 $builder->limitToEventManager($this->getLoggedInFrontEndUserUid());
             }
             break;
         case 'my_entered_events':
             $builder->limitToOwner($user !== NULL ? $user->getUid() : 0);
             $builder->showHiddenRecords();
             break;
         case 'events_next_day':
             $builder->limitToEventsNextDay($this->seminar);
             break;
         case 'other_dates':
             $builder->limitToOtherDatesForTopic($this->seminar);
             break;
         default:
     }
     if ($whatToDisplay === 'other_dates' || $whatToDisplay === 'seminar_list') {
         $hideBookedOutEvents = $this->getConfValueBoolean('showOnlyEventsWithVacancies', 's_listView');
         if ($hideBookedOutEvents) {
             $builder->limitToEventsWithVacancies();
         }
     }
     $pointer = (int) $this->piVars['pointer'];
     if (class_exists('t3lib_utility_Math')) {
         $resultsAtATime = t3lib_utility_Math::forceIntegerInRange($this->internal['results_at_a_time'], 1, 1000);
     } else {
         $resultsAtATime = t3lib_div::intInRange($this->internal['results_at_a_time'], 1, 1000);
     }
     $builder->setLimit($pointer * $resultsAtATime . ',' . $resultsAtATime);
     $seminarOrRegistrationBag = $builder->build();
     $this->internal['res_count'] = $seminarOrRegistrationBag->countWithoutLimit();
     $this->previousDate = '';
     $this->previousCategory = '';
     return $seminarOrRegistrationBag;
 }
Example #30
0
 /**
  * Wrapper to support old an new method to test integer value.
  *
  * @param integer $value
  * @return bool
  */
 public static function canBeInterpretedAsInteger($value)
 {
     if (version_compare(TYPO3_version, '4.6.0', '>=')) {
         $result = t3lib_utility_Math::canBeInterpretedAsInteger($value);
     } else {
         $result = t3lib_div::testInt($value);
     }
     return $result;
 }