/**
  * @param array $tsConfig
  * @param array $userArguments
  *
  * @return string
  */
 public function main(array $tsConfig, $userArguments = [])
 {
     $url = $tsConfig['url'];
     $regExpCurlyBraceOpen = preg_quote(rawurlencode('{'), '@');
     $regExpCurlyBraceClose = preg_quote(rawurlencode('}'), '@');
     $pattern = "@{$regExpCurlyBraceOpen}product{$regExpCurlyBraceClose}@i";
     // Return if argument to be replaced is not set!
     if (!preg_match($pattern, $url)) {
         return $tsConfig['TAG'];
     }
     /** @var \TYPO3\CMS\Core\Database\DatabaseConnection $db */
     $db = $GLOBALS['TYPO3_DB'];
     /**
      * <a href="' . $finalTagParts['url'] . '"' . $finalTagParts['targetParams'] . $finalTagParts['aTagParams'] . '>
      *
      * @see http://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html
      */
     $return = '<a href="%1$s"%2$s>';
     $product = false;
     // get necessary params to apply; replace in url
     if ($page = $db->exec_SELECTgetSingleRow('tx_product', 'pages', 'uid=' . $GLOBALS['TSFE']->id)) {
         if (MathUtility::canBeInterpretedAsInteger($page['tx_product']) && MathUtility::convertToPositiveInteger($page['tx_product'])) {
             $product = MathUtility::convertToPositiveInteger($page['tx_product']);
         }
     }
     /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */
     $contentObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $url = str_ireplace($GLOBALS['TSFE']->baseUrl, '', $contentObject->getTypoLink_URL($userArguments['targetPid'], $product ? ['product' => $product] : []));
     return sprintf($return, $url, $tsConfig['targetParams'] . $tsConfig['aTagParams']);
 }
Example #2
0
 /**
  * This method is called by a hook in the TYPO3 core when a record is saved.
  *
  * We use the tx_linkhandler for backend "save & show" button to display records on the configured detail view page.
  *
  * @param  string  $status                                  Type of database operation i.e. new/update.
  * @param  string  $table                                   The table currently being processed.
  * @param  integer $id                                      The records id (if any).
  * @param  array   $fieldArray                              The field names and their values to be processed (passed by reference).
  * @param  \TYPO3\CMS\Core\DataHandling\DataHandler $pObj   Reference to the parent object.
  */
 public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $pObj)
 {
     if (isset($GLOBALS['_POST']['_savedokview_x'])) {
         $settingFound = FALSE;
         $currentPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($GLOBALS['_POST']['popViewId']);
         $rootPageData = $this->getRootPage($currentPageId);
         $defaultPageId = isset($rootPageData) && array_key_exists('uid', $rootPageData) ? $rootPageData['uid'] : $currentPageId;
         $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($currentPageId);
         $handlerConfigurationStruct = $pagesTsConfig['mod.']['tx_linkhandler.'];
         // search for the current setting for given table
         foreach ($pagesTsConfig['mod.']['tx_linkhandler.'] as $key => $handler) {
             if (is_array($handler) && $handler['listTables'] === $table) {
                 $settingFound = TRUE;
                 $selectedConfiguration = $key;
                 break;
             }
         }
         if ($settingFound) {
             $l18nPointer = array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl']) ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] : '';
             if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
                 $id = $pObj->substNEWwithIDs[$id];
             }
             if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
                 $recordArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $id);
             } else {
                 $recordArray = $fieldArray;
             }
             if (array_key_exists('previewPageId', $handlerConfigurationStruct[$selectedConfiguration]) && \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($handlerConfigurationStruct[$selectedConfiguration]['previewPageId']) > 0) {
                 $previewPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($handlerConfigurationStruct[$selectedConfiguration]['previewPageId']);
             } else {
                 $previewPageId = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($defaultPageId);
             }
             if ($GLOBALS['BE_USER']->workspace != 0) {
                 $timeToLiveHours = intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')) ? intval($GLOBALS['BE_USER']->getTSConfigVal('options.workspaces.previewLinkTTLHours')) : 24 * 2;
                 $wsPreviewValue = ';' . $GLOBALS['BE_USER']->workspace . ':' . $GLOBALS['BE_USER']->user['uid'] . ':' . 60 * 60 * $timeToLiveHours;
                 // get record UID for
                 if (array_key_exists($l18nPointer, $recordArray) && $recordArray[$l18nPointer] > 0 && $recordArray['sys_language_uid'] > 0) {
                     $id = $recordArray[$l18nPointer];
                 } elseif (array_key_exists('t3ver_oid', $recordArray) && intval($recordArray['t3ver_oid']) > 0) {
                     // this makes no sense because we already receive the UID of the WS-Placeholder which will be the real record in the LIVE-WS
                     $id = $recordArray['t3ver_oid'];
                 }
             } else {
                 $wsPreviewValue = '';
                 if (array_key_exists($l18nPointer, $recordArray) && $recordArray[$l18nPointer] > 0 && $recordArray['sys_language_uid'] > 0) {
                     $id = $recordArray[$l18nPointer];
                 }
             }
             $previewDomainRootline = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($previewPageId);
             $previewDomain = \TYPO3\CMS\Backend\Utility\BackendUtility::getViewDomain($previewPageId, $previewDomainRootline);
             $linkParamValue = 'record:' . $table . ':' . $id;
             $queryString = '&eID=linkhandlerPreview&linkParams=' . urlencode($linkParamValue . $wsPreviewValue);
             $languageParam = '&L=' . $recordArray['sys_language_uid'];
             $queryString .= $languageParam . '&authCode=' . \TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode($linkParamValue . $wsPreviewValue . intval($recordArray['sys_language_uid']), '', 32);
             $GLOBALS['_POST']['viewUrl'] = $previewDomain . '/index.php?id=' . $previewPageId . $queryString . '&y=';
             $GLOBALS['_POST']['popViewId_addParams'] = $queryString;
         }
     }
 }
Example #3
0
 /**
  * Find the selected sys_language_uid which are set by the templavoila page module.
  *
  * @return integer
  */
 private function getUserSysLanguageUidForLanguageListing()
 {
     $sysLanguageId = 0;
     $moduleKey = 'web_txtemplavoilaM1';
     if (array_key_exists('web_tvpagemodulM1', $GLOBALS['BE_USER']->uc['moduleData'])) {
         $moduleKey = 'web_tvpagemodulM1';
     }
     if (is_array($GLOBALS['BE_USER']->uc['moduleData'][$moduleKey]) && array_key_exists('language', $GLOBALS['BE_USER']->uc['moduleData'][$moduleKey]) && \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($GLOBALS['BE_USER']->uc['moduleData'][$moduleKey]['language']) > 0) {
         $sysLanguageId = $GLOBALS['BE_USER']->uc['moduleData'][$moduleKey]['language'];
     }
     return $sysLanguageId;
 }
Example #4
0
File: Fal.php Project: r3h6/news
 /**
  * Render a video player
  *
  * @param FileReference $element
  * @param integer $width
  * @param integer $height
  * @param string $templateFile template file to override. Absolute path
  * @return string
  */
 public function render(FileReference $element, $width, $height, $templateFile = '')
 {
     $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Fluid_View_StandaloneView');
     if (!$templateFile || !is_readable($templateFile)) {
         $view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('news') . 'Resources/Private/Templates/ViewHelpers/Flv.html');
     } else {
         $view->setTemplatePathAndFilename($templateFile);
     }
     $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'flowplayer-3.2.12.min.js');
     $view->assign('width', \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($width));
     $view->assign('height', \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($height));
     $view->assign('uniqueDivId', 'mediaelement-' . md5($element->getUid() . uniqid()));
     $view->assign('url', $element->getOriginalResource()->getPublicUrl());
     return $view->render();
 }
Example #5
0
 /**
  * Render a video player
  *
  * @param Tx_News_Domain_Model_Media $element
  * @param integer $width
  * @param integer $height
  * @param string $templateFile template file to override. Absolute path
  * @return string
  */
 public function render(Tx_News_Domain_Model_Media $element, $width, $height, $templateFile = '')
 {
     $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Fluid_View_StandaloneView');
     if (!$templateFile || !is_readable($templateFile)) {
         $view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('news') . 'Resources/Private/Templates/ViewHelpers/Flv.html');
     } else {
         $view->setTemplatePathAndFilename($templateFile);
     }
     $url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
     $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'flowplayer-3.2.12.min.js');
     // override width & height if both are set
     if ($element->getWidth() > 0 && $element->getHeight() > 0) {
         $width = $element->getWidth();
         $height = $element->getHeight();
     }
     $view->assign('width', \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($width));
     $view->assign('height', \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($height));
     $view->assign('uniqueDivId', 'mediaelement-' . Tx_News_Service_FileService::getUniqueId($element));
     $view->assign('url', $url);
     return $view->render();
 }
Example #6
0
 /**
  * Render a video player
  *
  * @param \GeorgRinger\News\Domain\Model\Media $element
  * @param int $width
  * @param int $height
  * @param string $templateFile template file to override. Absolute path
  * @return string
  */
 public function render(\GeorgRinger\News\Domain\Model\Media $element, $width, $height, $templateFile = '')
 {
     $view = GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     if (!$templateFile || !is_readable($templateFile)) {
         $view->setTemplatePathAndFilename(ExtensionManagementUtility::extPath('news') . 'Resources/Private/Templates/ViewHelpers/Flv.html');
     } else {
         $view->setTemplatePathAndFilename($templateFile);
     }
     $url = FileService::getCorrectUrl($element->getContent());
     $pageRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Page\\PageRenderer');
     $pageRenderer->addJsFile(self::PATH_TO_JS . 'flowplayer-3.2.12.min.js');
     // override width & height if both are set
     if ($element->getWidth() > 0 && $element->getHeight() > 0) {
         $width = $element->getWidth();
         $height = $element->getHeight();
     }
     $view->assign('width', MathUtility::convertToPositiveInteger($width));
     $view->assign('height', MathUtility::convertToPositiveInteger($height));
     $view->assign('uniqueDivId', 'mediaelement-' . FileService::getUniqueId($element));
     $view->assign('url', $url);
     return $view->render();
 }
 /**
  * Returns the title of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record)
  *
  * @param string $table Table name
  * @param integer $uid UID
  * @param string $title Title string
  * @param array $row Records array (from table name)
  * @return string
  */
 public function linkWrapItems($table, $uid, $title, $row)
 {
     // if we handle translation records, make sure that we refer to the localisation parent with their uid
     if (is_array($GLOBALS['TCA'][$table]['ctrl']) && array_key_exists('transOrigPointerField', $GLOBALS['TCA'][$table]['ctrl'])) {
         $transOrigPointerField = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
         if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($row[$transOrigPointerField]) > 0) {
             $uid = $row[$transOrigPointerField];
         }
     }
     $currentImage = '';
     if ($this->browselistObj->curUrlInfo['recordTable'] === $table && $this->browselistObj->curUrlInfo['recordUid'] === $uid) {
         $currentImage = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_right.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
     }
     $title = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
     if (@$this->browselistObj->mode === 'rte') {
         //used in RTE mode:
         $aOnClick = 'return link_spec(\'' . $this->linkHandler . ':' . $table . ':' . $uid . '\');';
     } else {
         //used in wizard mode
         $aOnClick = 'return link_folder(\'' . $this->linkHandler . ':' . $table . ':' . $uid . '\');';
     }
     return '<a href="#" onclick="' . $aOnClick . '">' . $title . $currentImage . '</a>';
 }
Example #8
0
if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
?>

<br />
<div id="controll-panel">
	<?php 
echo $this->getRefreshLink();
?>
	<?php 
echo $this->getEnableDisableLink();
?>
	<?php 
// Check if ActiveProcess is reached
if (\TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getActiveProcessCount()) < \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getMaxActiveProcessCount())) {
    echo $this->getAddLink();
}
?>
	<?php 
echo $this->getModeLink();
?>
</div>

<h2><?php 
echo $this->getLLLabel('LLL:EXT:crawler/modfunc1/locallang.xml:labels.generalinformation');
?>
:</h2>
<table>
	<tr>
		<td><?php 
    /**
     * @return string
     */
    protected function generatePreviewCode()
    {
        $currentPageId = MathUtility::convertToPositiveInteger($this->popViewId);
        $table = $this->previewData['table'];
        $recordId = $this->previewData['id'];
        $pageTsConfig = BackendUtility::getPagesTSconfig($currentPageId);
        $previewConfiguration = isset($pageTsConfig['TCEMAIN.']['preview.'][$table . '.']) ? $pageTsConfig['TCEMAIN.']['preview.'][$table . '.'] : array();
        $recordArray = BackendUtility::getRecord($table, $recordId);
        // find the right preview page id
        $previewPageId = 0;
        if (isset($previewConfiguration['previewPageId'])) {
            $previewPageId = $previewConfiguration['previewPageId'];
        }
        // if no preview page was configured
        if (!$previewPageId) {
            $rootPageData = null;
            $rootLine = BackendUtility::BEgetRootLine($currentPageId);
            $currentPage = reset($rootLine);
            if ((int) $currentPage['doktype'] === PageRepository::DOKTYPE_DEFAULT) {
                // try the current page
                $previewPageId = $currentPageId;
            } else {
                // or search for the root page
                foreach ($rootLine as $page) {
                    if ($page['is_siteroot']) {
                        $rootPageData = $page;
                        break;
                    }
                }
                $previewPageId = isset($rootPageData) ? (int) $rootPageData['uid'] : $currentPageId;
            }
        }
        $linkParameters = ['no_cache' => 1];
        // language handling
        $languageField = isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) ? $GLOBALS['TCA'][$table]['ctrl']['languageField'] : '';
        if ($languageField && !empty($recordArray[$languageField])) {
            $l18nPointer = isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) ? $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] : '';
            if ($l18nPointer && !empty($recordArray[$l18nPointer]) && isset($previewConfiguration['useDefaultLanguageRecord']) && !$previewConfiguration['useDefaultLanguageRecord']) {
                // use parent record
                $recordId = $recordArray[$l18nPointer];
            }
            $linkParameters['L'] = $recordArray[$languageField];
        }
        // map record data to GET parameters
        if (isset($previewConfiguration['fieldToParameterMap.'])) {
            foreach ($previewConfiguration['fieldToParameterMap.'] as $field => $parameterName) {
                $value = $recordArray[$field];
                if ($field === 'uid') {
                    $value = $recordId;
                }
                $linkParameters[$parameterName] = $value;
            }
        }
        // add/override parameters by configuration
        if (isset($previewConfiguration['additionalGetParameters.'])) {
            $additionalGetParameters = [];
            $this->parseAdditionalGetParameters($additionalGetParameters, $previewConfiguration['additionalGetParameters.']);
            $linkParameters = array_replace($linkParameters, $additionalGetParameters);
        }
        $this->popViewId = $previewPageId;
        $this->popViewId_addParams = GeneralUtility::implodeArrayForUrl('', $linkParameters, '', false, true);
        $previewPageRootline = BackendUtility::BEgetRootLine($this->popViewId);
        return '
				if (window.opener) {
				' . BackendUtility::viewOnClick($this->popViewId, '', $previewPageRootline, '', $this->viewUrl, $this->popViewId_addParams, false) . '
				} else {
				' . BackendUtility::viewOnClick($this->popViewId, '', $previewPageRootline, '', $this->viewUrl, $this->popViewId_addParams) . '
				}';
    }
Example #10
0
 /**
  * Initializes tslib_fe and sets it to $GLOBALS['TSFE']
  *
  * @return	void
  */
 protected function initTSFE()
 {
     \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA();
     $pid = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger(GeneralUtility::_GP('id'));
     $GLOBALS['TSFE'] = GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $pid, 0, 0, 0);
     $GLOBALS['TSFE']->connectToDB();
     $GLOBALS['TSFE']->initFEuser();
     //!TODO first check if already a fe_user session exists - otherwise this line will overwrite the existing one
     $GLOBALS['TSFE']->checkAlternativeIdMethods();
     $GLOBALS['TSFE']->determineId();
     $GLOBALS['TSFE']->initTemplate();
     $GLOBALS['TSFE']->getConfigArray();
     $GLOBALS['TSFE']->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
 }
Example #11
0
 /**
  * Get the recipient IDs given a list of group IDs
  *
  * @param array $groups List of selected group IDs
  *
  * @return array list of the recipient ID
  */
 protected function cmd_compileMailGroup(array $groups)
 {
     // If supplied with an empty array, quit instantly as there is nothing to do
     if (!count($groups)) {
         return array();
     }
     // Looping through the selected array, in order to fetch recipient details
     $idLists = array();
     foreach ($groups as $group) {
         // Testing to see if group ID is a valid integer, if not - skip to next group ID
         $group = MathUtility::convertToPositiveInteger($group);
         if (!$group) {
             continue;
         }
         $recipientList = $this->getSingleMailGroup($group);
         if (!is_array($recipientList)) {
             continue;
         }
         $idLists = array_merge_recursive($idLists, $recipientList);
     }
     // Make unique entries
     if (is_array($idLists['tt_address'])) {
         $idLists['tt_address'] = array_unique($idLists['tt_address']);
     }
     if (is_array($idLists['fe_users'])) {
         $idLists['fe_users'] = array_unique($idLists['fe_users']);
     }
     if (is_array($idLists[$this->userTable]) && $this->userTable) {
         $idLists[$this->userTable] = array_unique($idLists[$this->userTable]);
     }
     if (is_array($idLists['PLAINLIST'])) {
         $idLists['PLAINLIST'] = DirectMailUtility::cleanPlainList($idLists['PLAINLIST']);
     }
     /**
      * Hook for cmd_compileMailGroup
      * manipulate the generated id_lists
      */
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['mod2']['cmd_compileMailGroup'])) {
         $hookObjectsArr = array();
         $temporaryList = "";
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['mod2']['cmd_compileMailGroup'] as $classRef) {
             $hookObjectsArr[] =& GeneralUtility::getUserObj($classRef);
         }
         foreach ($hookObjectsArr as $hookObj) {
             if (method_exists($hookObj, 'cmd_compileMailGroup_postProcess')) {
                 $temporaryList = $hookObj->cmd_compileMailGroup_postProcess($idLists, $this, $groups);
             }
         }
         unset($idLists);
         $idLists = $temporaryList;
     }
     return array('queryInfo' => array('id_lists' => $idLists));
 }
Example #12
0
 /**
  * Set wherever you want to use the parent page id clicked in the tree
  *
  * @param  integer $pid
  * @access  public
  * @return  void
  */
 function setPageId($pid)
 {
     $this->pageId = MathUtility::convertToPositiveInteger($pid);
 }
Example #13
0
                        </tr>
                        <tr>
                            <td><?php 
    echo $LANG->getLL('general.list.infodetail.incfcewithdefaultlanguage.title');
    ?>
</td>
                            <td><?php 
    echo $configurationElementArray['incfcewithdefaultlanguage'];
    ?>
</td>
                        </tr>
                    </table>
                </div>
            </td>
            <td><?php 
    echo '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::resolveBackPath($BACK_PATH . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('l10nmgr')) . 'cm1/index.php?id=' . $configurationElementArray['uid'] . '&srcPID=' . \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($this->getPageId()) . '">' . $configurationElementArray['title'] . '</a>';
    ?>
</td>
            <td><?php 
    echo current(BackendUtility::getRecordPath($configurationElementArray['pid'], '1', 20, 50));
    ?>
</td>
            <td><?php 
    echo $configurationElementArray['depth'];
    ?>
</td>
            <td><?php 
    echo $configurationElementArray['tablelist'];
    ?>
</td>
            <td><?php 
 /**
  * Setter for start count value.
  *
  * @param integer $startCount
  * @return void
  */
 public function setStartCount($startCount)
 {
     $this->startCount = MathUtility::convertToPositiveInteger($startCount);
 }
Example #15
0
 /**
  * Setter for start count value.
  *
  * @param integer $startCount
  * @return void
  */
 public function setStartCount($startCount)
 {
     $this->startCount = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($startCount);
 }
 /**
  * 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;
 }
 /**
  * Wrapper to support old and new method to test integer values.
  *
  * @param integer $value
  * @return integer
  */
 public static function convertToPositiveInteger($value)
 {
     $result = \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($value);
     return $result;
 }
Example #18
0
 /**
  * @param int $pageUid
  *
  * @return \Ecom\EcomToolbox\Utility\AjaxDispatcher
  */
 public function setPageUid($pageUid)
 {
     $this->pageUid = CoreUtility\MathUtility::canBeInterpretedAsInteger($pageUid) ? CoreUtility\MathUtility::convertToPositiveInteger($pageUid) : 1;
     return $this;
 }
 /**
  * Applies validation rules specified in TS setup
  *
  * @param array  Array with key/values being marker-strings/substitution values.
  * @return void  on return, the ControlData failure will contain the list of fields which were not ok
  */
 public function evalValues($theTable, array &$dataArray, array &$origArray, array &$markContentArray, $cmdKey, array $requiredArray)
 {
     $failureMsg = array();
     $displayFieldArray = t3lib_div::trimExplode(',', $this->conf[$cmdKey . '.']['fields'], 1);
     if ($this->controlData->useCaptcha($this->conf, $cmdKey)) {
         $displayFieldArray = array_merge($displayFieldArray, array('captcha_response'));
     }
     // Check required, set failure if not ok.
     $failureArray = array();
     foreach ($requiredArray as $k => $theField) {
         $bIsMissing = FALSE;
         if (isset($dataArray[$theField])) {
             if (empty($dataArray[$theField]) && $dataArray[$theField] != '0') {
                 $bIsMissing = TRUE;
             }
         } else {
             $bIsMissing = TRUE;
         }
         if ($bIsMissing) {
             $failureArray[] = $theField;
             $this->missing[$theField] = TRUE;
         }
     }
     $pid = intval($dataArray['pid']);
     // Evaluate: This evaluates for more advanced things than "required" does. But it returns the same error code, so you must let the required-message tell, if further evaluation has failed!
     $bRecordExists = FALSE;
     if (is_array($this->conf[$cmdKey . '.']['evalValues.'])) {
         $cmd = $this->controlData->getCmd();
         if ($cmd == 'edit' || $cmdKey == 'edit') {
             if ($pid) {
                 // This may be tricked if the input has the pid-field set but the edit-field list does NOT allow the pid to be edited. Then the pid may be false.
                 $recordTestPid = $pid;
             } else {
                 $tempRecArr = $GLOBALS['TSFE']->sys_page->getRawRecord($this->controlData->getTable(), $dataArray['uid']);
                 $recordTestPid = intval($tempRecArr['pid']);
             }
             $bRecordExists = $recordTestPid != 0;
         } else {
             $thePid = $this->controlData->getPid();
             $recordTestPid = $thePid ? $thePid : (method_exists('TYPO3\\CMS\\Core\\Utility\\MathUtility', 'convertToPositiveInteger') ? \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger($pid) : t3lib_div::intval_positive($pid));
         }
         // TODO: Fix scope issue: unsetting $conf entry in tx_srfeuserregister_control->init2 has no effect
         // Do not evaluate any password when inviting
         if ($cmdKey == 'invite') {
             unset($this->conf[$cmdKey . '.']['evalValues.']['password']);
         }
         // Do not evaluate the username if it is generated or if email is used
         if ($this->conf[$cmdKey . '.']['useEmailAsUsername'] || $this->conf[$cmdKey . '.']['generateUsername'] && $cmdKey != 'edit' && $cmdKey != 'password') {
             unset($this->conf[$cmdKey . '.']['evalValues.']['username']);
         }
         $countArray = array();
         $countArray['hook'] = array();
         $countArray['preg'] = array();
         foreach ($this->conf[$cmdKey . '.']['evalValues.'] as $theField => $theValue) {
             $this->evalErrors[$theField] = array();
             $failureMsg[$theField] = array();
             $listOfCommands = t3lib_div::trimExplode(',', $theValue, 1);
             // Unset the incoming value is empty and unsetEmpty is specified
             if (array_search('unsetEmpty', $listOfCommands) !== FALSE) {
                 if (isset($dataArray[$theField]) && empty($dataArray[$theField]) && trim($dataArray[$theField]) !== '0') {
                     unset($dataArray[$theField]);
                 }
                 if (isset($dataArray[$theField . '_again']) && empty($dataArray[$theField . '_again']) && trim($dataArray[$theField . '_again']) !== '0') {
                     unset($dataArray[$theField . '_again']);
                 }
             }
             if (isset($dataArray[$theField]) || isset($dataArray[$theField . '_again']) || !count($origArray) || !isset($origArray[$theField])) {
                 foreach ($listOfCommands as $k => $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]);
                     switch ($theCmd) {
                         case 'uniqueGlobal':
                         case 'uniqueDeletedGlobal':
                         case 'uniqueLocal':
                         case 'uniqueDeletedLocal':
                             $where = $theField . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($dataArray[$theField], $theTable);
                             if ($theCmd == 'uniqueLocal' || $theCmd == 'uniqueGlobal') {
                                 $where .= $GLOBALS['TSFE']->sys_page->deleteClause($theTable);
                             }
                             if ($theCmd == 'uniqueLocal' || $theCmd == 'uniqueDeletedLocal') {
                                 $where .= ' AND pid IN (' . $recordTestPid . ')';
                             }
                             $DBrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,' . $theField, $theTable, $where, '', '', '1');
                             if (!is_array($dataArray[$theField]) && trim($dataArray[$theField]) != '' && isset($DBrows) && is_array($DBrows) && isset($DBrows[0]) && is_array($DBrows[0])) {
                                 if (!$bRecordExists || $DBrows[0]['uid'] != $dataArray['uid']) {
                                     // Only issue an error if the record is not existing (if new...) and if the record with the false value selected was not our self.
                                     $failureArray[] = $theField;
                                     $this->inError[$theField] = TRUE;
                                     $this->evalErrors[$theField][] = $theCmd;
                                     $failureMsg[$theField][] = $this->getFailureText($theField, 'uniqueLocal', 'evalErrors_existed_already');
                                 }
                             }
                             break;
                         case 'twice':
                             $fieldValue = strval($dataArray[$theField]);
                             $fieldAgainValue = strval($dataArray[$theField . '_again']);
                             if (strcmp($fieldValue, $fieldAgainValue)) {
                                 $failureArray[] = $theField;
                                 $this->inError[$theField] = TRUE;
                                 $this->evalErrors[$theField][] = $theCmd;
                                 $failureMsg[$theField][] = $this->getFailureText($theField, $theCmd, 'evalErrors_same_twice');
                             }
                             break;
                         case 'email':
                             if (!is_array($dataArray[$theField]) && trim($dataArray[$theField]) && !t3lib_div::validEmail($dataArray[$theField])) {
                                 $failureArray[] = $theField;
                                 $this->inError[$theField] = TRUE;
                                 $this->evalErrors[$theField][] = $theCmd;
                                 $failureMsg[$theField][] = $this->getFailureText($theField, $theCmd, 'evalErrors_valid_email');
                             }
                             break;
                         case 'required':
                             if (empty($dataArray[$theField]) && $dataArray[$theField] !== '0') {
                                 $failureArray[] = $theField;
                                 $this->inError[$theField] = TRUE;
                                 $this->evalErrors[$theField][] = $theCmd;
                                 $failureMsg[$theField][] = $this->getFailureText($theField, $theCmd, 'evalErrors_required');
                             }
                             break;
                         case 'atLeast':
                             $chars = intval($cmdParts[1]);
                             if (!is_array($dataArray[$theField]) && strlen($dataArray[$theField]) < $chars) {
                                 $failureArray[] = $theField;
                                 $this->inError[$theField] = TRUE;
                                 $this->evalErrors[$theField][] = $theCmd;
                                 $failureMsg[$theField][] = sprintf($this->getFailureText($theField, $theCmd, 'evalErrors_atleast_characters'), $chars);
                             }
                             break;
                         case 'atMost':
                             $chars = intval($cmdParts[1]);
                             if (!is_array($dataArray[$theField]) && strlen($dataArray[$theField]) > $chars) {
                                 $failureArray[] = $theField;
                                 $this->inError[$theField] = TRUE;
                                 $this->evalErrors[$theField][] = $theCmd;
                                 $failureMsg[$theField][] = sprintf($this->getFailureText($theField, $theCmd, 'evalErrors_atmost_characters'), $chars);
                             }
                             break;
                         case 'inBranch':
                             $pars = explode(';', $cmdParts[1]);
                             if (intval($pars[0])) {
                                 $pid_list = $this->cObj->getTreeList(intval($pars[0]), intval($pars[1]) ? intval($pars[1]) : 999, intval($pars[2]));
                                 if (!$pid_list || !t3lib_div::inList($pid_list, $dataArray[$theField])) {
                                     $failureArray[] = $theField;
                                     $this->inError[$theField] = TRUE;
                                     $this->evalErrors[$theField][] = $theCmd;
                                     $failureMsg[$theField][] = sprintf($this->getFailureText($theField, $theCmd, 'evalErrors_unvalid_list'), $pid_list);
                                 }
                             }
                             break;
                         case 'upload':
                             if ($dataArray[$theField] && is_array($GLOBALS['TCA'][$theTable]['columns'][$theField]['config'])) {
                                 $colSettings = $GLOBALS['TCA'][$theTable]['columns'][$theField];
                                 $colConfig = $colSettings['config'];
                                 if ($colConfig['type'] == 'group' && $colConfig['internal_type'] == 'file') {
                                     $uploadPath = $colConfig['uploadfolder'];
                                     $allowedExtArray = t3lib_div::trimExplode(',', $colConfig['allowed'], 1);
                                     $maxSize = $colConfig['max_size'];
                                     $fileNameArray = $dataArray[$theField];
                                     $newFileNameArray = array();
                                     if (is_array($fileNameArray) && $fileNameArray[0] != '') {
                                         foreach ($fileNameArray as $k => $filename) {
                                             if (is_array($filename)) {
                                                 $filename = $filename['name'];
                                             }
                                             $bAllowedFilename = $this->checkFilename($filename);
                                             $fI = pathinfo($filename);
                                             $fileExtension = strtolower($fI['extension']);
                                             $fullfilename = PATH_site . $uploadPath . '/' . $filename;
                                             if ($bAllowedFilename && (!count($allowedExtArray) || in_array($fileExtension, $allowedExtArray))) {
                                                 if (@is_file($fullfilename)) {
                                                     if (!$maxSize || filesize(PATH_site . $uploadPath . '/' . $filename) < $maxSize * 1024) {
                                                         $newFileNameArray[] = $filename;
                                                     } else {
                                                         $this->evalErrors[$theField][] = $theCmd;
                                                         $failureMsg[$theField][] = sprintf($this->getFailureText($theField, 'max_size', 'evalErrors_size_too_large'), $maxSize);
                                                         $failureArray[] = $theField;
                                                         $this->inError[$theField] = TRUE;
                                                         if (@is_file(PATH_site . $uploadPath . '/' . $filename)) {
                                                             @unlink(PATH_site . $uploadPath . '/' . $filename);
                                                         }
                                                     }
                                                 } else {
                                                     if (isset($_FILES) && is_array($_FILES) && isset($_FILES['FE']) && is_array($_FILES['FE']) && isset($_FILES['FE']['tmp_name']) && is_array($_FILES['FE']['tmp_name']) && isset($_FILES['FE']['tmp_name'][$theTable]) && is_array($_FILES['FE']['tmp_name'][$theTable]) && isset($_FILES['FE']['tmp_name'][$theTable][$theField]) && is_array($_FILES['FE']['tmp_name'][$theTable][$theField]) && isset($_FILES['FE']['tmp_name'][$theTable][$theField][$k])) {
                                                         $bWritePermissionError = TRUE;
                                                     } else {
                                                         $bWritePermissionError = FALSE;
                                                     }
                                                     $this->evalErrors[$theField][] = $theCmd;
                                                     $failureMsg[$theField][] = sprintf($this->getFailureText($theField, 'isfile', $bWritePermissionError ? 'evalErrors_write_permission' : 'evalErrors_file_upload'), $filename);
                                                     $failureArray[] = $theField;
                                                 }
                                             } else {
                                                 $this->evalErrors[$theField][] = $theCmd;
                                                 $failureMsg[$theField][] = sprintf($this->getFailureText($theField, 'allowed', 'evalErrors_file_extension'), $fileExtension);
                                                 $failureArray[] = $theField;
                                                 $this->inError[$theField] = TRUE;
                                                 if ($bAllowedFilename && @is_file($fullfilename)) {
                                                     @unlink($fullfilename);
                                                 }
                                             }
                                         }
                                         $dataValue = $newFileNameArray;
                                         $dataArray[$theField] = $dataValue;
                                     }
                                 }
                             }
                             break;
                         case 'wwwURL':
                             if ($dataArray[$theField]) {
                                 $urlParts = parse_url($dataArray[$theField]);
                                 if ($urlParts === FALSE || !t3lib_div::isValidUrl($dataArray[$theField]) || $urlParts['scheme'] != 'http' && $urlParts['scheme'] != 'https' || $urlParts['user'] || $urlParts['pass']) {
                                     $failureArray[] = $theField;
                                     $this->inError[$theField] = TRUE;
                                     $this->evalErrors[$theField][] = $theCmd;
                                     $failureMsg[$theField][] = $this->getFailureText($theField, $theCmd, 'evalErrors_unvalid_url');
                                 }
                             }
                             break;
                         case 'date':
                             if (!is_array($dataArray[$theField]) && $dataArray[$theField] && !$this->evalDate($dataArray[$theField], $this->conf['dateFormat'])) {
                                 $failureArray[] = $theField;
                                 $this->inError[$theField] = TRUE;
                                 $this->evalErrors[$theField][] = $theCmd;
                                 $failureMsg[$theField][] = $this->getFailureText($theField, $theCmd, 'evalErrors_unvalid_date');
                             }
                             break;
                         case 'preg':
                             if (!is_array($dataArray[$theField]) && !(empty($dataArray[$theField]) && $dataArray[$theField] !== '0')) {
                                 if (isset($countArray['preg'][$theCmd])) {
                                     $countArray['preg'][$theCmd]++;
                                 } else {
                                     $countArray['preg'][$theCmd] = 1;
                                 }
                                 $pattern = str_replace('preg[', '', $cmd);
                                 $pattern = substr($pattern, 0, strlen($pattern) - 1);
                                 $matches = array();
                                 $test = preg_match($pattern, $dataArray[$theField], $matches);
                                 if ($test === FALSE || $test == 0) {
                                     $failureArray[] = $theField;
                                     $this->inError[$theField] = TRUE;
                                     $this->evalErrors[$theField][] = $theCmd;
                                     $failureMsg[$theField][] = $this->getFailureText($theField, $theCmd, 'evalErrors_' . $theCmd, $countArray['preg'][$theCmd], $cmd, $test === FALSE);
                                 }
                             }
                             break;
                         case 'hook':
                         default:
                             if (isset($countArray['hook'][$theCmd])) {
                                 $countArray['hook'][$theCmd]++;
                             } else {
                                 $countArray['hook'][$theCmd] = 1;
                             }
                             $extKey = $this->controlData->getExtKey();
                             $prefixId = $this->controlData->getPrefixId();
                             $hookClassArray = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey][$prefixId]['model'];
                             if (is_array($hookClassArray)) {
                                 foreach ($hookClassArray as $classRef) {
                                     $hookObj = t3lib_div::getUserObj($classRef);
                                     if (is_object($hookObj) && method_exists($hookObj, 'evalValues')) {
                                         $test = FALSE;
                                         // set it to TRUE when you test the hooks
                                         $bInternal = FALSE;
                                         $errorField = $hookObj->evalValues($theTable, $dataArray, $origArray, $markContentArray, $cmdKey, $requiredArray, $theField, $cmdParts, $bInternal, $test, $this);
                                         if ($errorField != '') {
                                             $failureArray[] = $errorField;
                                             $this->evalErrors[$theField][] = $theCmd;
                                             if (!$test) {
                                                 $this->inError[$theField] = TRUE;
                                                 $failureMsg[$theField][] = $this->getFailureText($theField, $theCmd, 'evalErrors_' . $theCmd, $countArray['hook'][$theCmd], $cmd, $bInternal);
                                             }
                                             break;
                                         }
                                     } else {
                                         debug($classRef, 'error in the class name for the hook "model"');
                                         // keep debug
                                     }
                                 }
                             }
                             break;
                     }
                 }
             }
             if (in_array($theField, $displayFieldArray) || in_array($theField, $failureArray)) {
                 if (!empty($failureMsg[$theField])) {
                     if ($markContentArray['###EVAL_ERROR_saved###']) {
                         $markContentArray['###EVAL_ERROR_saved###'] .= '<br />';
                     }
                     $errorMsg = implode($failureMsg[$theField], '<br />');
                     $markContentArray['###EVAL_ERROR_saved###'] .= $errorMsg;
                 } else {
                     $errorMsg = '';
                 }
                 $markContentArray['###EVAL_ERROR_FIELD_' . $theField . '###'] = $errorMsg != '' ? $errorMsg : '<!--no error-->';
             }
         }
     }
     if (empty($markContentArray['###EVAL_ERROR_saved###'])) {
         $markContentArray['###EVAL_ERROR_saved###'] = '';
     }
     if ($this->missing['zone'] && t3lib_extMgm::isLoaded(STATIC_INFO_TABLES_EXT)) {
         $staticInfoObj = t3lib_div::getUserObj('&tx_staticinfotables_pi1');
         // empty zone if there is not zone for the provided country
         $zoneArray = $staticInfoObj->initCountrySubdivisions($dataArray['static_info_country']);
         if (!isset($zoneArray) || is_array($zoneArray) && !count($zoneArray)) {
             unset($this->missing['zone']);
             $k = array_search('zone', $failureArray);
             unset($failureArray[$k]);
         }
     }
     $failure = implode($failureArray, ',');
     $this->controlData->setFailure($failure);
     return $this->evalErrors;
 }
 /**
  * @test
  */
 public function convertToPositiveIntegerReturnsTheInputValueForPositiveValues()
 {
     $this->assertEquals(123, \TYPO3\CMS\Core\Utility\MathUtility::convertToPositiveInteger(123));
 }
 /**
  * This will evaluate the input values from $this->dataArr to see if they conforms with the requirements configured in TypoScript per field.
  * For example this could be checking if a field contains a valid email address, a unique value, a value within a certain range etc.
  * It will populate arrays like $this->failure and $this->failureMsg with error messages (which can later be displayed in the template). Mostly it does NOT alter $this->dataArr (such parsing of values was done by parseValues())
  * Works based on configuration in TypoScript key [create/edit].evalValues
  *
  * @return    void
  * @see init(), parseValues()
  */
 function evalValues()
 {
     // Check required, set failure if not ok.
     $tempArr = [];
     foreach ($this->requiredArr as $theField) {
         if (!trim($this->dataArr[$theField])) {
             $tempArr[] = $theField;
         }
     }
     // Evaluate: This evaluates for more advanced things than 'required' does. But it returns the same error code, so you must let the required-message tell, if further evaluation has failed!
     $recExist = 0;
     if (is_array($this->conf[$this->cmdKey . '.']['evalValues.'])) {
         switch ($this->cmd) {
             case 'edit':
                 if (isset($this->dataArr['pid'])) {
                     // This may be tricked if the input has the pid-field set but the edit-field list does NOT allow the pid to be edited. Then the pid may be false.
                     $recordTestPid = intval($this->dataArr['pid']);
                 } else {
                     $tempRecArr = $this->getTypoScriptFrontendController()->sys_page->getRawRecord($this->theTable, $this->dataArr['uid']);
                     $recordTestPid = intval($tempRecArr['pid']);
                 }
                 $recExist = 1;
                 break;
             default:
                 if (is_callable(['t3lib_utility_Math', 'convertToPositiveInteger'])) {
                     $pid = MathUtility::convertToPositiveInteger($this->dataArr['pid']);
                 } else {
                     $pid = MathUtility::convertToPositiveInteger($this->dataArr['pid']);
                 }
                 $recordTestPid = $this->thePid ? $this->thePid : $pid;
                 break;
         }
         foreach ($this->conf[$this->cmdKey . '.']['evalValues.'] as $theField => $theValue) {
             $listOfCommands = GeneralUtility::trimExplode(',', $theValue, 1);
             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]);
                 switch ($theCmd) {
                     case 'uniqueGlobal':
                         if ($DBrows = $this->getTypoScriptFrontendController()->sys_page->getRecordsByField($this->theTable, $theField, $this->dataArr[$theField], '', '', '', '1')) {
                             if (!$recExist || $DBrows[0]['uid'] != $this->dataArr['uid']) {
                                 // Only issue an error if the record is not existing (if new...) and if the record with the false value selected was not our self.
                                 $tempArr[] = $theField;
                                 $this->failureMsg[$theField][] = $this->getFailure($theField, $theCmd, 'The value existed already. Enter a new value.');
                             }
                         }
                         break;
                     case 'uniqueLocal':
                         if ($DBrows = $this->getTypoScriptFrontendController()->sys_page->getRecordsByField($this->theTable, $theField, $this->dataArr[$theField], 'AND pid IN (' . $recordTestPid . ')', '', '', '1')) {
                             if (!$recExist || $DBrows[0]['uid'] != $this->dataArr['uid']) {
                                 // Only issue an error if the record is not existing (if new...) and if the record with the false value selected was not our self.
                                 $tempArr[] = $theField;
                                 $this->failureMsg[$theField][] = $this->getFailure($theField, $theCmd, 'The value existed already. Enter a new value.');
                             }
                         }
                         break;
                     case 'twice':
                         if (strcmp($this->dataArr[$theField], $this->dataArr[$theField . '_again'])) {
                             $tempArr[] = $theField;
                             $this->failureMsg[$theField][] = $this->getFailure($theField, $theCmd, 'You must enter the same value twice');
                         }
                         break;
                     case 'email':
                         if (!GeneralUtility::validEmail($this->dataArr[$theField])) {
                             $tempArr[] = $theField;
                             $this->failureMsg[$theField][] = $this->getFailure($theField, $theCmd, 'You must enter a valid email address');
                         }
                         break;
                     case 'required':
                         if (!trim($this->dataArr[$theField])) {
                             $tempArr[] = $theField;
                             $this->failureMsg[$theField][] = $this->getFailure($theField, $theCmd, 'You must enter a value!');
                         }
                         break;
                     case 'atLeast':
                         $chars = intval($cmdParts[1]);
                         if (strlen($this->dataArr[$theField]) < $chars) {
                             $tempArr[] = $theField;
                             $this->failureMsg[$theField][] = sprintf($this->getFailure($theField, $theCmd, 'You must enter at least %s characters!'), $chars);
                         }
                         break;
                     case 'atMost':
                         $chars = intval($cmdParts[1]);
                         if (strlen($this->dataArr[$theField]) > $chars) {
                             $tempArr[] = $theField;
                             $this->failureMsg[$theField][] = sprintf($this->getFailure($theField, $theCmd, 'You must enter at most %s characters!'), $chars);
                         }
                         break;
                     case 'inBranch':
                         $pars = explode(';', $cmdParts[1]);
                         if (intval($pars[0])) {
                             $pid_list = $this->cObj->getTreeList(intval($pars[0]), intval($pars[1]) ? intval($pars[1]) : 999, intval($pars[2]));
                             if (!$pid_list || !GeneralUtility::inList($pid_list, $this->dataArr[$theField])) {
                                 $tempArr[] = $theField;
                                 $this->failureMsg[$theField][] = sprintf($this->getFailure($theField, $theCmd, 'The value was not a valid valud from this list: %s'), $pid_list);
                             }
                         }
                         break;
                     case 'unsetEmpty':
                         if (!$this->dataArr[$theField]) {
                             $hash = array_flip($tempArr);
                             unset($hash[$theField]);
                             $tempArr = array_keys($hash);
                             unset($this->failureMsg[$theField]);
                             unset($this->dataArr[$theField]);
                             // This should prevent the field from entering the database.
                         }
                         break;
                 }
             }
             $this->markerArray['###EVAL_ERROR_FIELD_' . $theField . '###'] = is_array($this->failureMsg[$theField]) ? implode('<br />', $this->failureMsg[$theField]) : '';
         }
         $tempArr[] = $this->checkCaptcha();
     }
     $this->failure = implode(',', $tempArr);
     //$failure will show which fields were not OK
 }