/**
  * constructor for class tx_reports_report_status_Status
  *
  * @param	string	the status' title
  * @param	string	the status' value
  * @param	string	an optional message further describing the status
  * @param	integer	a severity level, one of
  */
 public function __construct($title, $value, $message = '', $severity = self::OK)
 {
     $this->title = (string) $title;
     $this->value = (string) $value;
     $this->message = (string) $message;
     $this->severity = t3lib_div::intInRange($severity, self::NOTICE, self::ERROR, self::OK);
 }
示例#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);
     }
 }
示例#3
0
 /**
  * Validate User Search Options
  *
  * @param  array $options
  * @return void
  * @throws Zend_Service_Exception
  */
 protected function _validateUserSearch(array $options)
 {
     $validOptions = array('api_key', 'method', 'user_id', 'per_page', 'page', 'extras', 'min_upload_date', 'min_taken_date', 'max_upload_date', 'max_taken_date', 'safe_search');
     $this->_compareOptions($options, $validOptions);
     $options['per_page'] = t3lib_div::intInRange($options['per_page'], 1, 500, 10);
     if ($options['page']) {
         $options['page'] = intval($options['page']);
     }
 }
 /**
  * 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
  */
 public static function forceIntegerInRange($theInt, $min, $max = 2000000000, $zeroValue = 0)
 {
     $result = '';
     if (self::isEqualOrHigherSixZero()) {
         $result = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($theInt, $min, $max, $zeroValue);
     } elseif (class_exists('t3lib_utility_Math')) {
         $result = t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $zeroValue);
     } else {
         $result = t3lib_div::intInRange($theInt, $min, $max, $zeroValue);
     }
     return $result;
 }
 /**
  * normalizes anything that describes a time
  * and sets it to be a timestamp
  * 
  * @param mixed $value
  * @return void
  */
 protected function normalizeArgumentToTimestamp($value)
 {
     if (empty($value)) {
         return;
     } elseif (is_numeric($value)) {
         return t3lib_div::intInRange($this->argumentName, 0);
     } elseif (is_string($value)) {
         return Tx_CzSimpleCal_Utility_StrToTime::strtotime($value);
     } elseif ($value instanceof DateTime) {
         return intval($value->format('U'));
     }
     return;
 }
function user_itemMarkerArrayFunc($paramArray, $conf)
{
    echo 'xx';
    $markerArray = $paramArray[0];
    $lConf = $paramArray[1];
    $pObj =& $conf['parentObj'];
    // make a reference to the parent-object
    $row = $pObj->local_cObj->data;
    $imageNum = isset($lConf['imageCount']) ? $lConf['imageCount'] : 1;
    $imageNum = t3lib_div::intInRange($imageNum, 0, 100);
    $theImgCode = '';
    $imgs = t3lib_div::trimExplode(',', $row['image'], 1);
    $imgsCaptions = explode(chr(10), $row['imagecaption']);
    reset($imgs);
    $cc = 0;
    while (list(, $val) = each($imgs)) {
        if ($cc == $imageNum) {
            break;
        }
        if ($val) {
            $lConf['image.']['altText'] = '';
            // reset altText
            $lConf['image.']['altText'] = $lConf['image.']['altText'];
            // set altText to value from TS
            $lConf['image.']['file'] = 'uploads/pics/' . $val;
            switch ($lConf['imgAltTextField']) {
                case 'image':
                    $lConf['image.']['altText'] .= $val;
                    break;
                case 'imagecaption':
                    $lConf['image.']['altText'] .= $imgsCaptions[$cc];
                    break;
                default:
                    $lConf['image.']['altText'] .= $row[$lConf['imgAltTextField']];
            }
        }
        $theImgCode .= $pObj->local_cObj->wrap($pObj->local_cObj->IMAGE($lConf['image.']) . $pObj->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']), $lConf['imageWrapIfAny_' . $cc]);
        $cc++;
    }
    $markerArray['###NEWS_IMAGE###'] = '';
    if ($cc) {
        $markerArray['###NEWS_IMAGE###'] = $pObj->local_cObj->wrap(trim($theImgCode), $lConf['imageWrapIfAny']);
    }
    $markerArray['###TEST###'] = '';
    return $markerArray;
}
    /**
     * Rendering the cObject, HRULER
     *
     * @param	array		Array of TypoScript properties
     * @return	string		Output
     */
    public function render($conf = array())
    {
        $lineThickness = isset($conf['lineThickness.']) ? $this->cObj->stdWrap($conf['lineThickness'], $conf['lineThickness.']) : $conf['lineThickness'];
        $lineThickness = t3lib_div::intInRange($lineThickness, 1, 50);
        $lineColor = isset($conf['lineColor.']) ? $this->cObj->stdWrap($conf['lineColor'], $conf['lineColor.']) : $conf['lineColor'];
        if (!$lineColor) {
            $lineColor = 'black';
        }
        $spaceBefore = isset($conf['spaceLeft.']) ? intval($this->cObj->stdWrap($conf['spaceLeft'], $conf['spaceLeft.'])) : intval($conf['spaceLeft']);
        $spaceAfter = isset($conf['spaceRight.']) ? intval($this->cObj->stdWrap($conf['spaceRight'], $conf['spaceRight.'])) : intval($conf['spaceRight']);
        $tableWidth = isset($conf['tableWidth.']) ? intval($this->cObj->stdWrap($conf['tableWidth'], $conf['tableWidth.'])) : intval($conf['tableWidth']);
        if (!$tableWidth) {
            $tableWidth = '99%';
        }
        $theValue = '';
        $theValue .= '<table border="0" cellspacing="0" cellpadding="0"
			width="' . htmlspecialchars($tableWidth) . '"
			summary=""><tr>';
        if ($spaceBefore) {
            $theValue .= '<td width="1">
				<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
				width="' . $spaceBefore . '"
				height="1" alt="" title="" />
			</td>';
        }
        $theValue .= '<td bgcolor="' . $lineColor . '">
			<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
			width="1"
			height="' . $lineThickness . '"
			alt="" title="" />
		</td>';
        if ($spaceAfter) {
            $theValue .= '<td width="1">
				<img src="' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif"
				width="' . $spaceAfter . '"
				height="1" alt="" title="" />
			</td>';
        }
        $theValue .= '</tr></table>';
        if (isset($conf['stdWrap.'])) {
            $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
        }
        return $theValue;
    }
 /**
  * @return  array
  */
 function main()
 {
     global $TYPO3_DB;
     // Initialize result array:
     $resultArray = array('message' => $this->cli_help['name'] . chr(10) . chr(10) . $this->cli_help['description'], 'headers' => array('index' => array('Full index of translation', 'NEEDS MUCH MORE WORK....', 1)), 'index' => array());
     $startingPoints = t3lib_div::intExplode(',', $this->cli_argValue('--pid'));
     $workspaceID = $this->cli_isArg('--workspace') ? t3lib_div::intInRange($this->cli_argValue('--workspace'), -1) : 0;
     $depth = $this->cli_isArg('--depth') ? t3lib_div::intInRange($this->cli_argValue('--depth'), 0) : 1000;
     if ($workspaceID != 0) {
         $GLOBALS['BE_USER']->setWorkspace($workspaceID);
         if ($GLOBALS['BE_USER']->workspace != $workspaceID) {
             die('Workspace ' . $workspaceID . ' did not exist!' . chr(10));
         }
     }
     $this->resultArray =& $resultArray;
     foreach ($startingPoints as $pidPoint) {
         if ($pidPoint >= 0) {
             $this->genTree($pidPoint, $depth, (int) $this->cli_argValue('--echotree'), 'main_parseTreeCallBack');
         }
     }
     return $resultArray;
 }
    /**
     * Prints the selector box form-field for the db/file/select elements (multiple)
     *
     * @param	string		Form element name
     * @param	string		Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type). Seperated with '|' a user defined mode can be set to be passed as param to the EB.
     * @param	string		Commalist of "allowed"
     * @param	array		The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs.
     * @param	string		Alternative selector box.
     * @param	array		An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails"
     * @param	string		On focus attribute string
     * @param	string		$user_el_param Additional parameter for the EB
     * @return	string		The form fields for the selection.
     */
    function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $userEBParam = '')
    {
        list($mode, $modeEB) = explode('|', $mode);
        $modeEB = $modeEB ? $modeEB : $mode;
        $disabled = '';
        if ($this->tceforms->renderReadonly || $params['readOnly']) {
            $disabled = ' disabled="disabled"';
        }
        // Sets a flag which means some JavaScript is included on the page to support this element.
        $this->tceforms->printNeededJS['dbFileIcons'] = 1;
        // INIT
        $uidList = array();
        $opt = array();
        $itemArrayC = 0;
        // Creating <option> elements:
        if (is_array($itemArray)) {
            $itemArrayC = count($itemArray);
            reset($itemArray);
            switch ($mode) {
                case 'db':
                    while (list(, $pp) = each($itemArray)) {
                        if ($pp['title']) {
                            $pTitle = $pp['title'];
                        } else {
                            if (function_exists('t3lib_BEfunc::getRecordWSOL')) {
                                $pRec = t3lib_BEfunc::getRecordWSOL($pp['table'], $pp['id']);
                            } else {
                                $pRec = t3lib_BEfunc::getRecord($pp['table'], $pp['id']);
                            }
                            $pTitle = is_array($pRec) ? $pRec[$GLOBALS['TCA'][$pp['table']]['ctrl']['label']] : NULL;
                        }
                        if ($pTitle) {
                            $pTitle = $pTitle ? t3lib_div::fixed_lgd_cs($pTitle, $this->tceforms->titleLen) : t3lib_BEfunc::getNoRecordTitle();
                            $pUid = $pp['table'] . '_' . $pp['id'];
                            $uidList[] = $pUid;
                            $opt[] = '<option value="' . htmlspecialchars($pUid) . '">' . htmlspecialchars($pTitle) . '</option>';
                        }
                    }
                    break;
                case 'folder':
                case 'file':
                    while (list(, $pp) = each($itemArray)) {
                        $pParts = explode('|', $pp);
                        $uidList[] = $pUid = $pTitle = $pParts[0];
                        $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pParts[0])) . '">' . htmlspecialchars(rawurldecode($pParts[0])) . '</option>';
                    }
                    break;
                default:
                    while (list(, $pp) = each($itemArray)) {
                        $pParts = explode('|', $pp, 2);
                        $uidList[] = $pUid = $pParts[0];
                        $pTitle = $pParts[1] ? $pParts[1] : $pParts[0];
                        $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pUid)) . '">' . htmlspecialchars(rawurldecode($pTitle)) . '</option>';
                    }
                    break;
            }
        }
        // Create selector box of the options
        $sSize = $params['autoSizeMax'] ? t3lib_div::intInRange($itemArrayC + 1, t3lib_div::intInRange($params['size'], 1), $params['autoSizeMax']) : $params['size'];
        if (!$selector) {
            $selector = '<select size="' . $sSize . '"' . $this->tceforms->insertDefStyle('group') . ' multiple="multiple" name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt) . '</select>';
        }
        $icons = array('L' => array(), 'R' => array());
        if (!$params['readOnly']) {
            if (!$params['noBrowser']) {
                $aOnClick = 'setFormValueOpenBrowser(\'' . $modeEB . '\',\'' . ($fName . '|||' . $allowed . '|' . $userEBParam . '|') . '\'); return false;';
                $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert3.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_browse_' . ($mode === 'file' ? 'file' : 'db'))) . ' />' . '</a>';
            }
            if (!$params['dontShowMoveIcons']) {
                if ($sSize >= 5) {
                    $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Top\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_totop.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_top')) . ' />' . '</a>';
                }
                $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Up\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/up.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_up')) . ' />' . '</a>';
                $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Down\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/down.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_down')) . ' />' . '</a>';
                if ($sSize >= 5) {
                    $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Bottom\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_tobottom.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_bottom')) . ' />' . '</a>';
                }
            }
            // todo Clipboard
            $clipElements = $this->tceforms->getClipboardElements($allowed, $mode);
            if (count($clipElements)) {
                $aOnClick = '';
                #			$counter = 0;
                foreach ($clipElements as $elValue) {
                    if ($mode === 'file' or $mode === 'folder') {
                        $itemTitle = 'unescape(\'' . rawurlencode(tx_dam::file_basename($elValue)) . '\')';
                    } else {
                        // 'db' mode assumed
                        list($itemTable, $itemUid) = explode('|', $elValue);
                        if (function_exists('t3lib_BEfunc::getRecordWSOL')) {
                            $rec = t3lib_BEfunc::getRecordWSOL($itemTable, $itemUid);
                        } else {
                            $rec = t3lib_BEfunc::getRecord($itemTable, $itemUid);
                        }
                        $itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, $rec));
                        $elValue = $itemTable . '_' . $itemUid;
                    }
                    $aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',\'' . t3lib_div::slashJS(t3lib_div::rawUrlEncodeJS($elValue)) . '\',' . t3lib_div::slashJS($itemTitle) . ');';
                    #$aOnClick .= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20', ' ', $elValue)).'\'),'.$itemTitle.');';
                    #				$counter++;
                    #				if ($params['maxitems'] && $counter >= $params['maxitems'])	{	break;	}	// Makes sure that no more than the max items are inserted... for convenience.
                }
                $aOnClick .= 'return false;';
                $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert5.png', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib(sprintf($this->tceforms->getLL('l_clipInsert_' . ($mode === 'file' ? 'file' : 'db')), count($clipElements))) . ' />' . '</a>';
            }
            $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_clear.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_remove_selected')) . ' />' . '</a>';
        }
        $str = '<table border="0" cellpadding="0" cellspacing="0" width="1">
			' . ($params['headers'] ? '
				<tr>
					<td>' . $this->tceforms->wrapLabels($params['headers']['selector']) . '</td>
					<td></td>
					<td></td>
					<td></td>
					<td>' . ($params['thumbnails'] ? $this->tceforms->wrapLabels($params['headers']['items']) : '') . '</td>
				</tr>' : '') . '
			<tr>
				<td valign="top">' . $selector . '<br />' . $this->tceforms->wrapLabels($params['info']) . '</td>
				<td valign="top">' . implode('<br />', $icons['L']) . '</td>
				<td valign="top">' . implode('<br />', $icons['R']) . '</td>
				<td style="height:5px;"><span></span></td>
				<td valign="top">' . $this->tceforms->wrapLabels($params['thumbnails']) . '</td>
			</tr>
		</table>';
        // Creating the hidden field which contains the actual value as a comma list.
        $str .= '<input type="hidden" name="' . $fName . '" value="' . htmlspecialchars(implode(',', $uidList)) . '" />';
        return $str;
    }
    /**
     * 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));
        }
    }
 /**
  * Creates an array with pointers to divisions of document.
  * ONLY for PDF files at this point. All other types will have an array with a single element with the value "0" (zero) coming back.
  *
  * @param	string		File extension
  * @param	string		Absolute filename (must exist and be validated OK before calling function)
  * @return	array		Array of pointers to sections that the document should be divided into
  */
 function fileContentParts($ext, $absFile)
 {
     $cParts = array(0);
     switch ($ext) {
         case 'pdf':
             // Getting pdf-info:
             $cmd = $this->app['pdfinfo'] . ' ' . escapeshellarg($absFile);
             exec($cmd, $res);
             $pdfInfo = $this->splitPdfInfo($res);
             unset($res);
             if (intval($pdfInfo['pages'])) {
                 $cParts = array();
                 // Calculate mode
                 if ($this->pdf_mode > 0) {
                     $iter = ceil($pdfInfo['pages'] / $this->pdf_mode);
                 } else {
                     $iter = t3lib_div::intInRange(abs($this->pdf_mode), 1, $pdfInfo['pages']);
                 }
                 // Traverse and create intervals.
                 for ($a = 0; $a < $iter; $a++) {
                     $low = floor($a * ($pdfInfo['pages'] / $iter)) + 1;
                     $high = floor(($a + 1) * ($pdfInfo['pages'] / $iter));
                     $cParts[] = $low . '-' . $high;
                 }
             }
             break;
     }
     return $cParts;
 }
 /**
  * Generates the configuration array by replacing constants and parsing the whole thing.
  * Depends on $this->config and $this->constants to be set prior to this! (done by processTemplate/runThroughTemplates)
  *
  * @return	void
  * @see t3lib_TSparser, start()
  */
 function generateConfig()
 {
     // Add default TS for all three code types:
     array_unshift($this->constants, '' . $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_constants']);
     // Adding default TS/constants
     array_unshift($this->config, '' . $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup']);
     // Adding default TS/setup
     array_unshift($this->editorcfg, '' . $GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_editorcfg']);
     // Adding default TS/editorcfg
     // Parse the TypoScript code text for include-instructions!
     $this->processIncludes();
     // These vars are also set lateron...
     $this->setup['resources'] = $this->resources;
     $this->setup['sitetitle'] = $this->sitetitle;
     // ****************************
     // Parse TypoScript Constants
     // ****************************
     // Initialize parser and match-condition classes:
     $constants = t3lib_div::makeInstance('t3lib_TSparser');
     $constants->breakPointLN = intval($this->ext_constants_BRP);
     $constants->setup = $this->const;
     $constants->setup = $this->mergeConstantsFromPageTSconfig($constants->setup);
     /* @var $matchObj t3lib_matchCondition_frontend */
     $matchObj = t3lib_div::makeInstance('t3lib_matchCondition_frontend');
     $matchObj->setSimulateMatchConditions($this->matchAlternative);
     $matchObj->setSimulateMatchResult((bool) $this->matchAll);
     // Traverse constants text fields and parse them
     foreach ($this->constants as $str) {
         $constants->parse($str, $matchObj);
     }
     // Read out parse errors if any
     $this->parserErrors['constants'] = $constants->errors;
     // Then flatten the structure from a multi-dim array to a single dim array with all constants listed as key/value pairs (ready for substitution)
     $this->flatSetup = array();
     $this->flattenSetup($constants->setup, '', '');
     // ***********************************************
     // Parse TypoScript Setup (here called "config")
     // ***********************************************
     // Initialize parser and match-condition classes:
     $config = t3lib_div::makeInstance('t3lib_TSparser');
     $config->breakPointLN = intval($this->ext_config_BRP);
     $config->regLinenumbers = $this->ext_regLinenumbers;
     $config->regComments = $this->ext_regComments;
     $config->setup = $this->setup;
     // Transfer information about conditions found in "Constants" and which of them returned true.
     $config->sections = $constants->sections;
     $config->sectionsMatch = $constants->sectionsMatch;
     // Traverse setup text fields and concatenate them into one, single string separated by a [GLOBAL] condition
     $all = '';
     foreach ($this->config as $str) {
         $all .= "\n[GLOBAL]\n" . $str;
     }
     // Substitute constants in the Setup code:
     if ($this->tt_track) {
         $GLOBALS['TT']->push('Substitute Constants (' . count($this->flatSetup) . ')');
     }
     $all = $this->substituteConstants($all);
     if ($this->tt_track) {
         $GLOBALS['TT']->pull();
     }
     // Searching for possible unsubstituted constants left (only for information)
     if (strstr($all, '{$')) {
         $theConstList = array();
         $findConst = explode('{$', $all);
         array_shift($findConst);
         foreach ($findConst as $constVal) {
             $constLen = t3lib_div::intInRange(strcspn($constVal, '}'), 0, 50);
             $theConstList[] = '{$' . substr($constVal, 0, $constLen + 1);
         }
         if ($this->tt_track) {
             $GLOBALS['TT']->setTSlogMessage(implode(', ', $theConstList) . ': Constants may remain un-substituted!!', 2);
         }
     }
     // Logging the textual size of the TypoScript Setup field text with all constants substituted:
     if ($this->tt_track) {
         $GLOBALS['TT']->setTSlogMessage('TypoScript template size as textfile: ' . strlen($all) . ' bytes');
     }
     // Finally parse the Setup field TypoScript code (where constants are now substituted)
     $config->parse($all, $matchObj);
     // Read out parse errors if any
     $this->parserErrors['config'] = $config->errors;
     // Transfer the TypoScript array from the parser object to the internal $this->setup array:
     $this->setup = $config->setup;
     if ($this->backend_info) {
         $this->setup_constants = $constants->setup;
         // Used for backend purposes only
     }
     // **************************************************
     // Parse Backend Editor Configuration (backend only)
     // **************************************************
     if ($this->parseEditorCfgField) {
         $editorcfg = t3lib_div::makeInstance('t3lib_TSparser');
         $editorcfg->breakPointLN = intval($this->ext_editorcfg_BRP);
         $editorcfg->setup = array();
         // Empty as a start...
         $all = implode("\n[GLOBAL]\n", $this->editorcfg);
         // substitute constants in config
         $all = $this->substituteConstants($all);
         // parse Config
         $matchObj->matchAll = 1;
         // This should make sure that conditions are disabled. For now they are NOT active for the backend.
         $editorcfg->parse($all, $matchObj);
         $this->parserErrors['editorcfg'] = $editorcfg->errors;
         $this->setup_editorcfg = $editorcfg->setup;
     }
     // ****************************************************************
     // Final processing of the $this->setup TypoScript Template array
     // Basically: This is unsetting/setting of certain reserved keys.
     // ****************************************************************
     // These vars are allready set after 'processTemplate', but because $config->setup overrides them (in the line above!), we set them again. They are not changed compared to the value they had in the top of the page!
     unset($this->setup['resources']);
     unset($this->setup['resources.']);
     $this->setup['resources'] = implode(',', t3lib_div::trimExplode(',', $this->resources, 1));
     unset($this->setup['sitetitle']);
     unset($this->setup['sitetitle.']);
     $this->setup['sitetitle'] = $this->sitetitle;
     // Unsetting some vars...
     unset($this->setup['types.']);
     unset($this->setup['types']);
     if (is_array($this->setup)) {
         foreach ($this->setup as $key => $value) {
             if ($value == 'PAGE') {
                 // Set the typeNum of the current page object:
                 if (isset($this->setup[$key . '.']['typeNum'])) {
                     $typeNum = $this->setup[$key . '.']['typeNum'];
                     $this->setup['types.'][$typeNum] = $key;
                     // If there is no type 0 yet and typeNum was not set, we use the current object as the default
                 } elseif (!isset($this->setup['types.'][0]) || !$this->setup['types.'][0]) {
                     $this->setup['types.'][0] = $key;
                 }
             }
         }
     }
     unset($this->setup['styles.']);
     unset($this->setup['temp.']);
     unset($constants);
     // Storing the conditions found/matched information:
     $this->sections = $config->sections;
     $this->sectionsMatch = $config->sectionsMatch;
 }
 /**
  * Creates and returns a SELECT query for records from $table and with conditions based on the configuration in the $conf array
  * Implements the "select" function in TypoScript
  *
  * @param	string		See ->exec_getQuery()
  * @param	array		See ->exec_getQuery()
  * @param	boolean		If set, the function will return the query not as a string but array with the various parts. RECOMMENDED!
  * @return	mixed		A SELECT query if $returnQueryArray is FALSE, otherwise the SELECT query in an array as parts.
  * @access private
  * @see CONTENT(), numRows()
  */
 function getQuery($table, $conf, $returnQueryArray = FALSE)
 {
     // Handle PDO-style named parameter markers first
     $queryMarkers = $this->getQueryMarkers($table, $conf);
     // replace the markers in the non-stdWrap properties
     foreach ($queryMarkers as $marker => $markerValue) {
         $properties = array('uidInList', 'selectFields', 'where', 'max', 'begin', 'groupBy', 'orderBy', 'join', 'leftjoin', 'rightjoin');
         foreach ($properties as $property) {
             if ($conf[$property]) {
                 $conf[$property] = str_replace('###' . $marker . '###', $markerValue, $conf[$property]);
             }
         }
     }
     // Construct WHERE clause:
     $conf['pidInList'] = isset($conf['pidInList.']) ? trim($this->stdWrap($conf['pidInList'], $conf['pidInList.'])) : trim($conf['pidInList']);
     // Handle recursive function for the pidInList
     if (isset($conf['recursive'])) {
         $conf['recursive'] = intval($conf['recursive']);
         if ($conf['recursive'] > 0) {
             foreach (explode(',', $conf['pidInList']) as $value) {
                 if ($value === 'this') {
                     $value = $GLOBALS['TSFE']->id;
                 }
                 $pidList .= $value . ',' . $this->getTreeList($value, $conf['recursive']);
             }
             $conf['pidInList'] = trim($pidList, ',');
         }
     }
     if (!strcmp($conf['pidInList'], '')) {
         $conf['pidInList'] = 'this';
     }
     $queryParts = $this->getWhere($table, $conf, TRUE);
     // Fields:
     $queryParts['SELECT'] = $conf['selectFields'] ? $conf['selectFields'] : '*';
     // Setting LIMIT:
     if ($conf['max'] || $conf['begin']) {
         $error = 0;
         // Finding the total number of records, if used:
         if (strstr(strtolower($conf['begin'] . $conf['max']), 'total')) {
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, $queryParts['WHERE'], $queryParts['GROUPBY']);
             if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
                 $GLOBALS['TT']->setTSlogMessage($error);
             } else {
                 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
                 $conf['max'] = str_ireplace('total', $row[0], $conf['max']);
                 $conf['begin'] = str_ireplace('total', $row[0], $conf['begin']);
             }
             $GLOBALS['TYPO3_DB']->sql_free_result($res);
         }
         if (!$error) {
             $conf['begin'] = t3lib_div::intInRange(ceil($this->calc($conf['begin'])), 0);
             $conf['max'] = t3lib_div::intInRange(ceil($this->calc($conf['max'])), 0);
             if ($conf['begin'] && !$conf['max']) {
                 $conf['max'] = 100000;
             }
             if ($conf['begin'] && $conf['max']) {
                 $queryParts['LIMIT'] = $conf['begin'] . ',' . $conf['max'];
             } elseif (!$conf['begin'] && $conf['max']) {
                 $queryParts['LIMIT'] = $conf['max'];
             }
         }
     }
     if (!$error) {
         // Setting up tablejoins:
         $joinPart = '';
         if ($conf['join']) {
             $joinPart = 'JOIN ' . trim($conf['join']);
         } elseif ($conf['leftjoin']) {
             $joinPart = 'LEFT OUTER JOIN ' . trim($conf['leftjoin']);
         } elseif ($conf['rightjoin']) {
             $joinPart = 'RIGHT OUTER JOIN ' . trim($conf['rightjoin']);
         }
         // Compile and return query:
         $queryParts['FROM'] = trim($table . ' ' . $joinPart);
         // replace the markers in the queryParts to handle stdWrap
         // enabled properties
         foreach ($queryMarkers as $marker => $markerValue) {
             foreach ($queryParts as $queryPartKey => &$queryPartValue) {
                 $queryPartValue = str_replace('###' . $marker . '###', $markerValue, $queryPartValue);
             }
         }
         $query = $GLOBALS['TYPO3_DB']->SELECTquery($queryParts['SELECT'], $queryParts['FROM'], $queryParts['WHERE'], $queryParts['GROUPBY'], $queryParts['ORDERBY'], $queryParts['LIMIT']);
         return $returnQueryArray ? $queryParts : $query;
     }
 }
 /**
  * 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);
 }
 /**
  * Processing of update/insert values based on field type.
  *
  * The input value is typecast and trimmed/shortened according to the field
  * type and the configuration options from the $fInfo parameter.
  *
  * @param	mixed		$value The input value to process
  * @param	array		$fInfo Field configuration data
  * @return	mixed		The processed input value
  */
 private function processAccordingToConfig(&$value, $fInfo)
 {
     $options = $this->parseFieldDef($fInfo['Type']);
     switch (strtolower($options['fieldType'])) {
         case 'int':
         case 'smallint':
         case 'tinyint':
         case 'mediumint':
             $value = intval($value);
             if ($options['featureIndex']['UNSIGNED']) {
                 $value = t3lib_div::intInRange($value, 0);
             }
             break;
         case 'double':
             $value = (double) $value;
             break;
         case 'varchar':
         case 'char':
             $value = substr($value, 0, trim($options['value']));
             break;
         case 'text':
         case 'blob':
             $value = substr($value, 0, 65536);
             break;
         case 'tinytext':
         case 'tinyblob':
             $value = substr($value, 0, 256);
             break;
         case 'mediumtext':
         case 'mediumblob':
             // ??
             break;
     }
 }
示例#16
0
 /**
  * Returns a selector-box with loaded extension keys
  *
  * @param	string		Form element name prefix
  * @param	array		The current values selected
  * @return	string		HTML select element
  */
 function extensionSelector($prefix, $value)
 {
     global $TYPO3_LOADED_EXT;
     $extTrav = array_keys($TYPO3_LOADED_EXT);
     // make box:
     $opt = array();
     $opt[] = '<option value=""></option>';
     foreach ($extTrav as $v) {
         if ($v !== '_CACHEFILE') {
             if (is_array($value)) {
                 $sel = in_array($v, $value) ? ' selected="selected"' : '';
             }
             $opt[] = '<option value="' . htmlspecialchars($v) . '"' . $sel . '>' . htmlspecialchars($v) . '</option>';
         }
     }
     return '<select name="' . $prefix . '[]" multiple="multiple" size="' . t3lib_div::intInRange(count($opt), 5, 10) . '">' . implode('', $opt) . '</select>';
 }
示例#17
0
    /**
     * Main function, starting the rendering of the list.
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $CLIENT;
        // Start document template object:
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/db_list.html');
        // Loading current page record and checking access:
        $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        // Initialize the dblist object:
        $dblist = t3lib_div::makeInstance('localRecordList');
        $dblist->backPath = $BACK_PATH;
        $dblist->calcPerms = $BE_USER->calcPerms($this->pageinfo);
        $dblist->thumbs = $BE_USER->uc['thumbnailsByDefault'];
        $dblist->returnUrl = $this->returnUrl;
        $dblist->allFields = $this->MOD_SETTINGS['bigControlPanel'] || $this->table ? 1 : 0;
        $dblist->localizationView = $this->MOD_SETTINGS['localization'];
        $dblist->showClipboard = 1;
        $dblist->disableSingleTableView = $this->modTSconfig['properties']['disableSingleTableView'];
        $dblist->listOnlyInSingleTableMode = $this->modTSconfig['properties']['listOnlyInSingleTableView'];
        $dblist->hideTables = $this->modTSconfig['properties']['hideTables'];
        $dblist->tableTSconfigOverTCA = $this->modTSconfig['properties']['table.'];
        $dblist->clickTitleMode = $this->modTSconfig['properties']['clickTitleMode'];
        $dblist->alternateBgColors = $this->modTSconfig['properties']['alternateBgColors'] ? 1 : 0;
        $dblist->allowedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['allowedNewTables'], 1);
        $dblist->deniedNewTables = t3lib_div::trimExplode(',', $this->modTSconfig['properties']['deniedNewTables'], 1);
        $dblist->newWizards = $this->modTSconfig['properties']['newWizards'] ? 1 : 0;
        $dblist->pageRow = $this->pageinfo;
        $dblist->counter++;
        $dblist->MOD_MENU = array('bigControlPanel' => '', 'clipBoard' => '', 'localization' => '');
        $dblist->modTSconfig = $this->modTSconfig;
        // Clipboard is initialized:
        $dblist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
        // Start clipboard
        $dblist->clipObj->initializeClipboard();
        // Initialize - reads the clipboard content from the user session
        // Clipboard actions are handled:
        $CB = t3lib_div::_GET('CB');
        // CB is the clipboard command array
        if ($this->cmd == 'setCB') {
            // CBH is all the fields selected for the clipboard, CBC is the checkbox fields which were checked. By merging we get a full array of checked/unchecked elements
            // This is set to the 'el' array of the CB after being parsed so only the table in question is registered.
            $CB['el'] = $dblist->clipObj->cleanUpCBC(array_merge((array) t3lib_div::_POST('CBH'), (array) t3lib_div::_POST('CBC')), $this->cmd_table);
        }
        if (!$this->MOD_SETTINGS['clipBoard']) {
            $CB['setP'] = 'normal';
        }
        // If the clipboard is NOT shown, set the pad to 'normal'.
        $dblist->clipObj->setCmd($CB);
        // Execute commands.
        $dblist->clipObj->cleanCurrent();
        // Clean up pad
        $dblist->clipObj->endClipboard();
        // Save the clipboard content
        // This flag will prevent the clipboard panel in being shown.
        // It is set, if the clickmenu-layer is active AND the extended view is not enabled.
        $dblist->dontShowClipControlPanels = $CLIENT['FORMSTYLE'] && !$this->MOD_SETTINGS['bigControlPanel'] && $dblist->clipObj->current == 'normal' && !$BE_USER->uc['disableCMlayers'] && !$this->modTSconfig['properties']['showClipControlPanelsDespiteOfCMlayers'];
        // If there is access to the page, then render the list contents and set up the document template object:
        if ($access) {
            // Deleting records...:
            // Has not to do with the clipboard but is simply the delete action. The clipboard object is used to clean up the submitted entries to only the selected table.
            if ($this->cmd == 'delete') {
                $items = $dblist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), $this->cmd_table, 1);
                if (count($items)) {
                    $cmd = array();
                    foreach ($items as $iK => $value) {
                        $iKParts = explode('|', $iK);
                        $cmd[$iKParts[0]][$iKParts[1]]['delete'] = 1;
                    }
                    $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                    $tce->stripslashes_values = 0;
                    $tce->start(array(), $cmd);
                    $tce->process_cmdmap();
                    if (isset($cmd['pages'])) {
                        t3lib_BEfunc::setUpdateSignal('updatePageTree');
                    }
                    $tce->printLogErrorMessages(t3lib_div::getIndpEnv('REQUEST_URI'));
                }
            }
            // Initialize the listing object, dblist, for rendering the list:
            $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000);
            $dblist->start($this->id, $this->table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
            $dblist->setDispFields();
            // Render versioning selector:
            if (t3lib_extMgm::isLoaded('version')) {
                $dblist->HTMLcode .= $this->doc->getVersionSelector($this->id);
            }
            // Render the list of tables:
            $dblist->generateList();
            // Write the bottom of the page:
            $dblist->writeBottom();
            // Add JavaScript functions to the page:
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function jumpToUrl(URL)	{	//
					window.location.href = URL;
					return false;
				}
				function jumpExt(URL,anchor)	{	//
					var anc = anchor?anchor:"";
					window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
					return false;
				}
				function jumpSelf(URL)	{	//
					window.location.href = URL+(T3_RETURN_URL?"&returnUrl="+T3_RETURN_URL:"");
					return false;
				}

				function setHighlight(id)	{	//
					top.fsMod.recentIds["web"]=id;
					top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_"+top.fsMod.currentBank;	// For highlighting

					if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)	{
						top.content.nav_frame.refresh_nav();
					}
				}
				' . $this->doc->redirectUrls($dblist->listURL()) . '
				' . $dblist->CBfunctions() . '
				function editRecords(table,idList,addParams,CBflag)	{	//
					window.location.href="' . $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&edit["+table+"]["+idList+"]=edit"+addParams;
				}
				function editList(table,idList)	{	//
					var list="";

						// Checking how many is checked, how many is not
					var pointer=0;
					var pos = idList.indexOf(",");
					while (pos!=-1)	{
						if (cbValue(table+"|"+idList.substr(pointer,pos-pointer))) {
							list+=idList.substr(pointer,pos-pointer)+",";
						}
						pointer=pos+1;
						pos = idList.indexOf(",",pointer);
					}
					if (cbValue(table+"|"+idList.substr(pointer))) {
						list+=idList.substr(pointer)+",";
					}

					return list ? list : idList;
				}

				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
        }
        // access
        // Begin to compile the whole page, starting out with page header:
        $this->body = '';
        $this->body .= '<form action="' . htmlspecialchars($dblist->listURL()) . '" method="post" name="dblistForm">';
        $this->body .= $dblist->HTMLcode;
        $this->body .= '<input type="hidden" name="cmd_table" /><input type="hidden" name="cmd" /></form>';
        // If a listing was produced, create the page footer with search form etc:
        if ($dblist->HTMLcode) {
            // Making field select box (when extended view for a single table is enabled):
            if ($dblist->table) {
                $this->body .= $dblist->fieldSelectBox($dblist->table);
            }
            // Adding checkbox options for extended listing and clipboard display:
            $this->body .= '

					<!--
						Listing options for clipboard and thumbnails
					-->
					<div id="typo3-listOptions">
						<form action="" method="post">';
            $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkLargeControl"') . ' <label for="checkLargeControl">' . $LANG->getLL('largeControl', 1) . '</label><br />';
            if ($dblist->showClipboard) {
                $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkShowClipBoard"') . ' <label for="checkShowClipBoard">' . $LANG->getLL('showClipBoard', 1) . '</label><br />';
            }
            $this->body .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[localization]', $this->MOD_SETTINGS['localization'], 'db_list.php', $this->table ? '&table=' . $this->table : '', 'id="checkLocalization"') . ' <label for="checkLocalization">' . $LANG->getLL('localization', 1) . '</label><br />';
            $this->body .= '
						</form>
					</div>';
            $this->body .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_options', $GLOBALS['BACK_PATH']);
            // Printing clipboard if enabled:
            if ($this->MOD_SETTINGS['clipBoard'] && $dblist->showClipboard) {
                $this->body .= $dblist->clipObj->printClipboard();
                $this->body .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'list_clipboard', $GLOBALS['BACK_PATH']);
            }
            // Search box:
            $this->body .= $dblist->getSearchBox();
            // Display sys-notes, if any are found:
            $this->body .= $dblist->showSysNotesForPage();
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $dblist->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->body);
        // Build the <body> for the module
        $this->content = $this->doc->startPage('DB list');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
示例#18
0
    /**
     * Main function, creating the listing
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TYPO3_CONF_VARS, $FILEMOUNTS;
        // Initialize the template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/file_list.html');
        $this->doc->getPageRenderer()->loadPrototype();
        // Validating the input "id" (the path, directory!) and checking it against the mounts of the user.
        $this->id = $this->basicFF->is_directory($this->id);
        $access = $this->id && $this->basicFF->checkPathAgainstMounts($this->id . '/');
        // There there was access to this file path, continue, make the list
        if ($access) {
            // include the initialization for the flash uploader
            if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) {
                $this->doc->JScodeArray['flashUploader'] = '
					if (top.TYPO3.FileUploadWindow.isFlashAvailable()) {
						document.observe("dom:loaded", function() {
								// monitor the button
							$("button-upload").observe("click", initFlashUploader);

							function initFlashUploader(event) {
									// set the page specific options for the flashUploader
								var flashUploadOptions = {
									uploadURL:           top.TS.PATH_typo3 + "ajax.php",
									uploadFileSizeLimit: "' . t3lib_div::getMaxUploadFileSize() . '",
									uploadFileTypes: {
										allow:  "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow'] . '",
										deny: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny'] . '"
									},
									uploadFilePostName:  "upload_1",
									uploadPostParams: {
										"file[upload][1][target]": "' . $this->id . '",
										"file[upload][1][data]": 1,
										"file[upload][1][charset]": "utf-8",
										"ajaxID": "TYPO3_tcefile::process"
									}
								};

									// get the flashUploaderWindow instance from the parent frame
								var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions);
								// add an additional function inside the container to show the checkbox option
								var infoComponent = new top.Ext.Panel({
									autoEl: { tag: "div" },
									height: "auto",
									bodyBorder: false,
									border: false,
									hideBorders: true,
									cls: "t3-upload-window-infopanel",
									id: "t3-upload-window-infopanel-addition",
									html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" />\' + top.String.format(top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles) + \'</label>\'
								});
								flashUploader.add(infoComponent);

									// do a reload of this frame once all uploads are done
								flashUploader.on("totalcomplete", function() {
									window.location.reload();
								});

									// this is the callback function that delivers the additional post parameter to the flash application
								top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) {
									var uploader = top.TYPO3.getInstance("FileUploadWindow");
									if (uploader.isVisible()) {
										uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0));
									}
								};

								event.stop();
							};
						});
					}
				';
            }
            // Create filelisting object
            $this->filelist = t3lib_div::makeInstance('fileList');
            $this->filelist->backPath = $BACK_PATH;
            // Apply predefined values for hidden checkboxes
            // Set predefined value for DisplayBigControlPanel:
            if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'activated') {
                $this->MOD_SETTINGS['bigControlPanel'] = TRUE;
            } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'deactivated') {
                $this->MOD_SETTINGS['bigControlPanel'] = FALSE;
            }
            // Set predefined value for DisplayThumbnails:
            if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'activated') {
                $this->MOD_SETTINGS['displayThumbs'] = TRUE;
            } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'deactivated') {
                $this->MOD_SETTINGS['displayThumbs'] = FALSE;
            }
            // Set predefined value for Clipboard:
            if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'activated') {
                $this->MOD_SETTINGS['clipBoard'] = TRUE;
            } elseif ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'deactivated') {
                $this->MOD_SETTINGS['clipBoard'] = FALSE;
            }
            // if user never opened the list module, set the value for displayThumbs
            if (!isset($this->MOD_SETTINGS['displayThumbs'])) {
                $this->MOD_SETTINGS['displayThumbs'] = $BE_USER->uc['thumbnailsByDefault'];
            }
            $this->filelist->thumbs = $this->MOD_SETTINGS['displayThumbs'];
            // Create clipboard object and initialize that
            $this->filelist->clipObj = t3lib_div::makeInstance('t3lib_clipboard');
            $this->filelist->clipObj->fileMode = 1;
            $this->filelist->clipObj->initializeClipboard();
            $CB = t3lib_div::_GET('CB');
            if ($this->cmd == 'setCB') {
                $CB['el'] = $this->filelist->clipObj->cleanUpCBC(array_merge(t3lib_div::_POST('CBH'), t3lib_div::_POST('CBC')), '_FILE');
            }
            if (!$this->MOD_SETTINGS['clipBoard']) {
                $CB['setP'] = 'normal';
            }
            $this->filelist->clipObj->setCmd($CB);
            $this->filelist->clipObj->cleanCurrent();
            $this->filelist->clipObj->endClipboard();
            // Saves
            // If the "cmd" was to delete files from the list (clipboard thing), do that:
            if ($this->cmd == 'delete') {
                $items = $this->filelist->clipObj->cleanUpCBC(t3lib_div::_POST('CBC'), '_FILE', 1);
                if (count($items)) {
                    // Make command array:
                    $FILE = array();
                    foreach ($items as $v) {
                        $FILE['delete'][] = array('data' => $v);
                    }
                    // Init file processing object for deleting and pass the cmd array.
                    $fileProcessor = t3lib_div::makeInstance('t3lib_extFileFunctions');
                    $fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS['BE']['fileExtensions']);
                    $fileProcessor->init_actionPerms($GLOBALS['BE_USER']->getFileoperationPermissions());
                    $fileProcessor->dontCheckForUnique = $this->overwriteExistingFiles ? 1 : 0;
                    $fileProcessor->start($FILE);
                    $fileProcessor->processData();
                    $fileProcessor->printLogErrorMessages();
                }
            }
            if (!isset($this->MOD_SETTINGS['sort'])) {
                // Set default sorting
                $this->MOD_SETTINGS['sort'] = 'file';
                $this->MOD_SETTINGS['reverse'] = 0;
            }
            // Start up filelisting object, include settings.
            $this->pointer = t3lib_div::intInRange($this->pointer, 0, 100000);
            $this->filelist->start($this->id, $this->pointer, $this->MOD_SETTINGS['sort'], $this->MOD_SETTINGS['reverse'], $this->MOD_SETTINGS['clipBoard'], $this->MOD_SETTINGS['bigControlPanel']);
            // Generate the list
            $this->filelist->generateList();
            // Write the footer
            $this->filelist->writeBottom();
            // Set top JavaScript:
            $this->doc->JScode = $this->doc->wrapScriptTags('

			if (top.fsMod) top.fsMod.recentIds["file"] = unescape("' . rawurlencode($this->id) . '");
			function jumpToUrl(URL)	{	//
				window.location.href = URL;
			}

			' . $this->filelist->CBfunctions());
            // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers.
            $this->doc->getContextMenuCode();
            // Setting up the buttons and markers for docheader
            list($buttons, $otherMarkers) = $this->filelist->getButtonsAndOtherMarkers($this->id);
            // add the folder info to the marker array
            $otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo();
            $docHeaderButtons = array_merge($this->getButtons(), $buttons);
            // Build the <body> for the module
            // Create output
            $pageContent = '';
            $pageContent .= '<form action="' . htmlspecialchars($this->filelist->listURL()) . '" method="post" name="dblistForm">';
            $pageContent .= $this->filelist->HTMLcode;
            $pageContent .= '<input type="hidden" name="cmd" /></form>';
            if ($this->filelist->HTMLcode) {
                // Making listing options:
                $pageContent .= '

					<!--
						Listing options for extended view, clipboard and thumbnails
					-->
					<div id="typo3-listOptions">
				';
                // Add "display bigControlPanel" checkbox:
                if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayBigControlPanel') === 'selectable') {
                    $pageContent .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[bigControlPanel]', $this->MOD_SETTINGS['bigControlPanel'], 'file_list.php', '', 'id="bigControlPanel"') . '<label for="bigControlPanel"> ' . $GLOBALS['LANG']->getLL('bigControlPanel', TRUE) . '</label><br />';
                }
                // Add "display thumbnails" checkbox:
                if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableDisplayThumbnails') === 'selectable') {
                    $pageContent .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[displayThumbs]', $this->MOD_SETTINGS['displayThumbs'], 'file_list.php', '', 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->getLL('displayThumbs', TRUE) . '</label><br />';
                }
                // Add "clipboard" checkbox:
                if ($GLOBALS['BE_USER']->getTSConfigVal('options.file_list.enableClipBoard') === 'selectable') {
                    $pageContent .= t3lib_BEfunc::getFuncCheck($this->id, 'SET[clipBoard]', $this->MOD_SETTINGS['clipBoard'], 'file_list.php', '', 'id="checkClipBoard"') . ' <label for="checkClipBoard">' . $GLOBALS['LANG']->getLL('clipBoard', TRUE) . '</label>';
                }
                $pageContent .= '
					</div>
				';
                // Set clipboard:
                if ($this->MOD_SETTINGS['clipBoard']) {
                    $pageContent .= $this->filelist->clipObj->printClipboard();
                    $pageContent .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'filelist_clipboard', $GLOBALS['BACK_PATH']);
                }
            }
            $markerArray = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $pageContent);
            $this->content = $this->doc->moduleBody(array(), $docHeaderButtons, array_merge($markerArray, $otherMarkers));
            // Renders the module page
            $this->content = $this->doc->render($LANG->getLL('files'), $this->content);
        } else {
            // Create output - no access (no warning though)
            $this->content = $this->doc->render($LANG->getLL('files'), '');
        }
    }
    /**
     * Putting things together, in particular the JavaScript code needed for the DHTML menu.
     *
     * @return	mixed		Returns the value of a call to the parent function, parent::extProc_finish();
     */
    function extProc_finish()
    {
        $dirL = $this->mconf['directionLeft'] ? '-GL_getObj(id).width' : '';
        $dirU = $this->mconf['directionUp'] ? '-GL_getObj(id).height' : '';
        $parentLayerId = end($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']);
        $DoTop = array();
        $GLV_menuOn = array();
        $relCode = array();
        $relFlag = 0;
        if ($this->mconf['relativeToParentLayer'] && $parentLayerId) {
            $relCode['X'] .= 'GLV_curLayerX["' . $parentLayerId . '"]+';
            $relCode['Y'] .= 'GLV_curLayerY["' . $parentLayerId . '"]+';
            if ($this->mconf['relativeToParentLayer.']['addWidth']) {
                $relCode['X'] .= 'GLV_curLayerWidth["' . $parentLayerId . '"]+';
            }
            if ($this->mconf['relativeToParentLayer.']['addHeight']) {
                $relCode['Y'] .= 'GLV_curLayerHeight["' . $parentLayerId . '"]+';
            }
        }
        if ($this->mconf['relativeToTriggerItem']) {
            $DoTop[] = '
		var parentObject = GL_getObj(GLV_menuXY[WMid][id][2]);
		var TI_width = parentObject.width;
		var TI_height = parentObject.height;
		var anchorObj = GL_getObj(GLV_menuXY[WMid][id][3]);
		var TI_x = anchorObj.x;
		var TI_y = anchorObj.y;
			';
            $relCode['X'] .= 'TI_x+';
            $relCode['Y'] .= 'TI_y+';
            if ($this->mconf['relativeToTriggerItem.']['addWidth']) {
                $relCode['X'] .= 'TI_width+';
            }
            if ($this->mconf['relativeToTriggerItem.']['addHeight']) {
                $relCode['Y'] .= 'TI_height+';
            }
            $relFlag = 1;
        }
        if ($relFlag) {
            $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].left = (' . $relCode['X'] . intval($this->mconf['leftOffset']) . $dirL . ')+"px";';
            $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].top =  (' . $relCode['Y'] . intval($this->mconf['topOffset']) . $dirU . ')+"px";';
        } else {
            // X position (y is fixed)
            if (!strcmp($this->mconf['lockPosition'], 'x')) {
                $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].left = (' . $relCode['X'] . 'GLV_menuXY["' . $this->WMid . '"][id][0]-(' . intval($this->mconf['xPosOffset']) . ')' . $dirL . ')+"px";';
                if ($this->isSetIntval($this->mconf['topOffset'])) {
                    $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].top = (' . $relCode['Y'] . intval($this->mconf['topOffset']) . $dirU . ')+"px";';
                }
            } elseif ($this->isSetIntval($this->mconf['xPosOffset'])) {
                $GLV_menuOn[] = $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].left = (GLV_x-(' . intval($this->mconf['xPosOffset']) . ')' . $dirL . ')+"px";';
                if ($this->isSetIntval($this->mconf['topOffset'])) {
                    $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].top = (' . $relCode['Y'] . intval($this->mconf['topOffset']) . $dirU . ')+"px";';
                }
            }
            // Y position	(x is fixed)
            if (!strcmp($this->mconf['lockPosition'], 'y')) {
                $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].top = (' . $relCode['Y'] . 'GLV_menuXY["' . $this->WMid . '"][id][1]-(' . intval($this->mconf['yPosOffset']) . ')' . $dirU . ')+"px";';
                if ($this->isSetIntval($this->mconf['leftOffset'])) {
                    $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].left = (' . $relCode['X'] . intval($this->mconf['leftOffset']) . $dirL . ')+"px";';
                }
            } elseif ($this->isSetIntval($this->mconf['yPosOffset'])) {
                $GLV_menuOn[] = $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].top = (GLV_y-(' . intval($this->mconf['yPosOffset']) . ')' . $dirU . ')+"px";';
                if ($this->isSetIntval($this->mconf['leftOffset'])) {
                    $DoTop[] = 'GLV_menuOn["' . $this->WMid . '"].left = (' . $relCode['X'] . intval($this->mconf['leftOffset']) . $dirL . ')+"px";';
                }
            }
        }
        // BordersWithIn:
        $DoTop[] = $this->extCalcBorderWithin('left', $this->WMbordersWithin[0]);
        $DoTop[] = $this->extCalcBorderWithin('top', $this->WMbordersWithin[1]);
        $DoTop[] = $this->extCalcBorderWithin('right', $this->WMbordersWithin[2]);
        $DoTop[] = $this->extCalcBorderWithin('bottom', $this->WMbordersWithin[3]);
        $DoTop[] = $this->extCalcBorderWithin('left', $this->WMbordersWithin[4]);
        $DoTop[] = $this->extCalcBorderWithin('top', $this->WMbordersWithin[5]);
        if ($this->mconf['freezeMouseover'] && !$this->mconf['freezeMouseover.']['alwaysKeep']) {
            $this->WMhideCode .= '
GL' . $this->WMid . '_out("");';
        }
        $TEST = '';
        if (count($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'])) {
            foreach ($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'] as $mIdStr) {
                $this->WMhideCode .= '
GL_hideAll("' . $mIdStr . '");';
                $this->WMrestoreScript .= '
GL_restoreMenu("' . $mIdStr . '");';
                $this->WMresetSubMenus .= '
if (!GLV_doReset["' . $mIdStr . '"] && GLV_currentLayer["' . $mIdStr . '"]!=null)	resetSubMenu=0;';
            }
        }
        // IESelectFix - Adds IFRAME tag to HTML, Hides IFRAME layer below menu
        if ($this->mconf['ieSelectFix']) {
            $this->WMhideCode .= '
	GL_iframer(\'' . $this->WMid . '\',\'\',false);';
            $this->divLayers['iframe'] = '<iframe id="Iframe' . $this->WMid . '" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; background-color:transparent; layer-background-color:transparent; display:none;"></iframe>';
        }
        $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'] = array_merge($this->WMtempStore, $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']);
        $GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared'] = '<script type="text/javascript" src="' . t3lib_extMgm::siteRelPath('cms') . 'tslib/media/scripts/jsfunc.layermenu.js"></script>';
        $GLOBALS['TSFE']->JSCode .= '

GLV_curLayerWidth["' . $this->WMid . '"]=0;
GLV_curLayerHeight["' . $this->WMid . '"]=0;
GLV_curLayerX["' . $this->WMid . '"]=0;
GLV_curLayerY["' . $this->WMid . '"]=0;
GLV_menuOn["' . $this->WMid . '"] = null;
GLV_gap["' . $this->WMid . '"]=' . t3lib_div::intInRange($this->mconf['hideMenuWhenNotOver'], 0, 600) . ';
GLV_currentLayer["' . $this->WMid . '"] = null;
GLV_currentROitem["' . $this->WMid . '"] = null;
GLV_hasBeenOver["' . $this->WMid . '"]=0;
GLV_doReset["' . $this->WMid . '"]=false;
GLV_lastKey["' . $this->WMid . '"] = "' . $this->WMlastKey . '";
GLV_onlyOnLoad["' . $this->WMid . '"] = ' . ($this->WMonlyOnLoad ? 1 : 0) . ';
GLV_dontHideOnMouseUp["' . $this->WMid . '"] = ' . ($this->mconf['dontHideOnMouseUp'] ? 1 : 0) . ';
GLV_dontFollowMouse["' . $this->WMid . '"] = ' . ($this->mconf['dontFollowMouse'] ? 1 : 0) . ';
GLV_date = new Date();
GLV_timeout["' . $this->WMid . '"] = GLV_date.getTime();
GLV_timeoutRef["' . $this->WMid . '"] = ' . t3lib_div::intInRange($this->mconf['hideMenuTimer'], 0, 20000) . ';
GLV_menuXY["' . $this->WMid . '"] = new Array();
' . implode(LF, $this->WMxyArray) . '
' . $this->WMrestoreVars;
        if ($this->mconf['freezeMouseover']) {
            $GLOBALS['TSFE']->JSCode .= '
// Alternative rollover/out functions for use with GMENU_LAYER
function GL' . $this->WMid . '_over(mitm_id)	{
	GL' . $this->WMid . '_out("");	// removes any old roll over state of an item. Needed for alwaysKeep and Opera browsers.
	switch(mitm_id)	{
' . implode(LF, $this->VMmouseoverActions) . '
	}
	GLV_currentROitem["' . $this->WMid . '"]=mitm_id;
}
function GL' . $this->WMid . '_out(mitm_id)	{
	if (!mitm_id)	mitm_id=GLV_currentROitem["' . $this->WMid . '"];
	switch(mitm_id)	{
' . implode(LF, $this->VMmouseoutActions) . '
	}
}
';
        }
        $GLOBALS["TSFE"]->JSCode .= '
function GL' . $this->WMid . '_getMouse(e) {
	if (GLV_menuOn["' . $this->WMid . '"]!=null && !GLV_dontFollowMouse["' . $this->WMid . '"]){
' . implode(LF, $GLV_menuOn) . '
	}
	GL_mouseMoveEvaluate("' . $this->WMid . '");
}
function GL' . $this->WMid . '_hideCode() {
' . $this->WMhideCode . '
}
function GL' . $this->WMid . '_doTop(WMid,id) {
' . trim(implode(LF, $DoTop)) . '
}
function GL' . $this->WMid . '_restoreMenu() {
' . $this->WMrestoreScript . '
}
function GL' . $this->WMid . '_resetSubMenus() {
	var resetSubMenu=1;
' . $this->WMresetSubMenus . '
	return resetSubMenu;
}

GLV_timeout_pointers[GLV_timeout_count] = "' . $this->WMid . '";
GLV_timeout_count++;

';
        $GLOBALS['TSFE']->JSeventFuncCalls['onload']['GL_initLayers()'] = 'GL_initLayers();';
        $GLOBALS['TSFE']->JSeventFuncCalls['onload'][$this->WMid] = 'GL_restoreMenu("' . $this->WMid . '");';
        // Should be called BEFORE any of the 'local' getMouse functions!
        // is put inside in a try catch block to avoid JS errors in IE
        $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']['GL_getMouse(e)'] = 'try{GL_getMouse(e);}catch(ex){};';
        $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove'][$this->WMid] = 'try{GL' . $this->WMid . '_getMouse(e);}catch(ex){};';
        $GLOBALS['TSFE']->JSeventFuncCalls['onmouseup'][$this->WMid] = 'GL_mouseUp(\'' . $this->WMid . '\',e);';
        $GLOBALS['TSFE']->divSection .= implode($this->divLayers, LF) . LF;
        return parent::extProc_finish();
    }
示例#20
0
    /**
     * Main function which creates the image if needed and outputs the HTML code for the page displaying the image.
     * Accumulates the content in $this->content
     *
     * @return	void
     */
    function main()
    {
        // Creating stdGraphic object, initialize it and make image:
        $img = t3lib_div::makeInstance('t3lib_stdGraphic');
        $img->mayScaleUp = 0;
        $img->init();
        if ($this->sample) {
            $img->scalecmd = '-sample';
        }
        if ($this->alternativeTempPath && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['allowedTempPaths'], $this->alternativeTempPath)) {
            $img->tempPath = $this->alternativeTempPath;
        }
        if (strstr($this->width . $this->height, 'm')) {
            $max = 'm';
        } else {
            $max = '';
        }
        $this->height = t3lib_div::intInRange($this->height, 0);
        $this->width = t3lib_div::intInRange($this->width, 0);
        if ($this->frame) {
            $this->frame = intval($this->frame);
        }
        $imgInfo = $img->imageMagickConvert($this->file, 'web', $this->width . $max, $this->height, $img->IMparams($this->effects), $this->frame, '');
        if (strlen($this->content) > 0) {
            // insert image in cached HTML content
            if (is_array($imgInfo)) {
                $this->content = str_replace('###IMAGE###', $img->imgTag($imgInfo), $this->content);
            }
        } else {
            // Create HTML output:
            $this->content .= '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>' . htmlspecialchars($this->title ? $this->title : "Image") . '</title>
	' . ($this->title ? '' : '<meta name="robots" content="noindex,follow" />') . '
</head>
		' . ($this->bodyTag ? $this->bodyTag : '<body>');
            if (is_array($imgInfo)) {
                $wrapParts = explode('|', $this->wrap);
                $this->content .= trim($wrapParts[0]) . $img->imgTag($imgInfo) . trim($wrapParts[1]);
            }
            $this->content .= '
		</body>
		</html>';
        }
    }
 /**
  * Wraps the input content string in a table with a gray border if the table/row combination evaluates to being disabled/hidden.
  * Used for marking previewed records in the frontend.
  *
  * @param	string		The table name
  * @param	array		The data record from $table
  * @param	string		The content string to wrap
  * @param	integer		The thickness of the border
  * @param	array		The array with TypoScript properties for the content object
  * @return	string		The input string wrapped in a table with a border color of #cccccc and thickness = $thick
  * @see	editPanel()
  */
 protected function editPanelPreviewBorder($table, array $row, $content, $thick, array $conf = array())
 {
     if ($this->isDisabled($table, $row)) {
         $thick = t3lib_div::intInRange($thick, 1, 100);
         $color = $conf['color'] ? $conf['color'] : '#cccccc';
         if ($conf['innerWrap']) {
             $content = $this->wrap($content, $conf['innerWrap']);
         }
         if ($conf['innerWrap.']) {
             $content = $this->stdWrap($content, $conf['innerWrap.']);
         }
         $content = '<table class="typo3-editPanel-previewBorder" border="' . $thick . '" cellpadding="0" cellspacing="0" bordercolor="' . $color . '" width="100%" summary=""><tr><td>' . $content . '</td></tr></table>';
         if ($conf['outerWrap']) {
             $content = $this->wrap($content, $conf['outerWrap']);
         }
         if ($conf['outerWrap.']) {
             $content = $this->stdWrap($panel, $conf['outerWrap.']);
         }
     }
     return $content;
 }
 /**
  * versionListView
  *
  * returns a version listview for the (url-)given keyword
  * uses the template layout (subpart VERSION_LIST)
  *
  * @param	[string]		$content: Content of the extension output
  * @param	[array]		        $conf: Configuration Array of the extension
  * @return	[string]		Listview of the current wiki-page (keyword)
  */
 function versionListView($content, $conf)
 {
     $markerArray = array();
     if ($this->piVars["diff_uid"]) {
         // parse and replace subparts in the template file
         $subpart = $this->cObj->getSubpart($this->templateCode, "###DIFF_VIEW###");
         // globale replacing
         $markerArray["###KEYWORD###"] = '[[' . $this->piVars["keyword"] . ']]';
         // Replace markers in template
         $markerArray["###ICON_VERSIONS###"] = $this->makeIconLink($this->cObj->cObjGetSingle($this->conf["iconVersions"], $this->conf["iconVersions."]), $this->pi_linkTP_keepPIvars_url(array("cmd" => "list", "showUid" => "", "diff_uid" => "", "keyword" => $this->piVars["keyword"]), 1, 0));
         $markerArray["###ICON_BACK###"] = $this->pi_linkTP_keepPIvars($this->cObj->cObjGetSingle($this->conf["iconBack"], $this->conf["iconBack."]), array("showUid" => "", "cmd" => "", "pointer" => "", "diff_uid" => "", "keyword" => $this->piVars["keyword"]), 1, 0);
         $markerArray["###ICON_HOME###"] = $this->pi_linkTP_keepPIvars($this->cObj->cObjGetSingle($this->conf["iconHome"], $this->conf["iconHome."]), array("showUid" => "", "cmd" => "", "pointer" => "", "diff_uid" => "", "keyword" => $this->wikiHomePage), 1, 0);
         //Get Data and Versions...
         $latestUid = $this->getUid($this->piVars["keyword"]);
         $newestVersion = $this->pi_getRecord("tx_drwiki_pages", $latestUid, 1);
         $olderVersion = $this->pi_getRecord("tx_drwiki_pages", $this->piVars["diff_uid"], 1);
         $markerArray["###DIFF_LATEST_UID###"] = $latestUid;
         $markerArray["###DIFF_DIFF_UID###"] = $this->piVars["diff_uid"];
         if (strcmp($olderVersion["body"], $newestVersion["body"])) {
             //load diff engineand do the diff
             require_once PATH_t3lib . 'class.t3lib_diff.php';
             $diffEngine = t3lib_div::makeInstance('t3lib_diff');
             // do diff word by word (red vs. green)
             $result = $diffEngine->makeDiffDisplay($olderVersion["body"], $newestVersion["body"]);
             $markerArray["###DIFF_RESULT###"] = '<p class="diff-result">' . $result . '</p>';
         } else {
             $markerArray["###DIFF_RESULT###"] = '<p><strong>The two test strings are exactly the same!</strong></p>';
         }
         //format strings
         $newestVersion = preg_replace('|\\r\\n|', '<br />', $newestVersion);
         $olderVersion = preg_replace('|\\r\\n|', '<br />', $olderVersion);
         $markerArray["###DIFF_RESULT###"] .= '<table class="diff-table">' . '<tr><td class="diff-r" style="font-weight:bold">' . $this->piVars["keyword"] . ' (ID: ' . $this->piVars["diff_uid"] . ') ' . $olderVersion["date"] . ' by ' . $olderVersion["author"] . ' &rArr </td>' . '<td class="diff-g" style="font-weight:bold">' . $this->piVars["keyword"] . ' (ID: ' . $latestUid . ') ' . $newestVersion["date"] . ' by ' . $newestVersion["author"] . ' &rArr;</td></tr>' . '<tr><td class="diff-table-cell-red">' . $olderVersion["body"] . '</td>' . '<td class="diff-table-cell-green">' . $newestVersion["body"] . '</td></tr>' . '</table>';
         $subpart = $this->cObj->substituteMarkerArrayCached($subpart, $markerArray);
     } else {
         $pidList = $this->pi_getPidList($this->conf["pidList"], $this->conf["recursive"]);
         // get it into FlexForms!!!
         list($this->internal["orderBy"], $this->internal["descFlag"]) = explode(":", $this->piVars["sort"]);
         $this->internal["results_at_a_time"] = t3lib_div::intInRange($this->conf["listView."]["results_at_a_time"], 0, 1000, 3);
         // Number of results to show in a listing.
         $this->internal["maxPages"] = t3lib_div::intInRange($this->conf["listView."]["maxPages"], 0, 1000, 2);
         // The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
         $this->internal["orderByList"] = "uid,author,tstamp";
         $sqlkeyword = $GLOBALS['TYPO3_DB']->fullQuoteStr(trim($this->piVars['keyword']), 'tx_drwiki_pages');
         $where = 'tx_drwiki_pages.pid IN (' . $pidList . ')' . $this->cObj->enableFields('tx_drwiki_pages') . ' AND keyword = ' . $sqlkeyword;
         // Get number of existing versions of this wikipage
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('COUNT(*)', 'tx_drwiki_pages', $where);
         list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
         // validate to positive ints
         $results_at_a_time = t3lib_div::intInRange($this->internal["results_at_a_time"], 1, 1000);
         $pointer = t3lib_div::intInRange($this->piVars['pointer'], 0, 1000);
         // sorting of shown records
         if (t3lib_div::inList($this->internal["orderByList"], $this->internal["orderBy"])) {
             $orderby = $GLOBALS['TYPO3_DB']->fullQuoteStr($this->internal['orderBy'] . ($this->internal['descFlag'] ? ' DESC' : ''), 'tx_drwiki_pages');
         } else {
             $orderby = 'uid DESC';
         }
         // limits for pageview
         $limit = $pointer * $results_at_a_time . ',' . $results_at_a_time;
         // Get the records to show on this page
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_drwiki_pages', $where, '', $orderby, $limit);
         // parse and replace subparts in the template file
         $subpart = $this->cObj->getSubpart($this->templateCode, "###VERSION_LIST###");
         $subpartHeader = $this->cObj->getSubpart($subpart, "###VERSION_LIST_HEADER");
         $subpartRows = $this->cObj->getSubpart($subpart, "###VERSION_LIST_ROWS");
         $templateRow = $this->cObj->getSubpart($subpartRows, "###VERSION_LIST_ROW");
         $templateRowOdd = $this->cObj->getSubpart($subpartRows, "###VERSION_LIST_ROW_ODD");
         // globale replacing
         $markerArray["###KEYWORD###"] = $this->piVars["keyword"];
         // Replace markers in template
         $markerArray["###BROWSER###"] = $this->pi_list_browseresults();
         $markerArray["###ICON_BACK###"] = $this->pi_linkTP_keepPIvars($this->cObj->cObjGetSingle($this->conf["iconBack"], $this->conf["iconBack."]), array("showUid" => "", "cmd" => "", "pointer" => "", "diff_uid" => "", "keyword" => $this->piVars["keyword"]), 1, 0);
         $markerArray["###ICON_HOME###"] = $this->pi_linkTP_keepPIvars($this->cObj->cObjGetSingle($this->conf["iconHome"], $this->conf["iconHome."]), array("showUid" => "", "cmd" => "", "pointer" => "", "diff_uid" => "", "keyword" => $this->wikiHomePage), 1, 0);
         $subpart = $this->cObj->substituteMarkerArrayCached($subpart, $markerArray);
         // Header
         $markerArray["###HEADER_UID###"] = $this->getFieldHeader_sortLink("uid");
         $markerArray["###HEADER_AUTHOR###"] = $this->getFieldHeader_sortLink("author");
         $markerArray["###HEADER_TSTAMP###"] = $this->getFieldHeader_sortLink("tstamp");
         $markerArray["###HEADER_SUMMARY###"] = $this->getFieldHeader("summary");
         $markerArray["###HEADER_DIFF_SELECT###"] = $this->getFieldHeader("diff");
         $subpartHeader = $this->cObj->substituteMarkerArrayCached($subpartHeader, $markerArray);
         $subpart = $this->cObj->substituteSubpart($subpart, "###VERSION_LIST_HEADER###", $subpartHeader);
         // Columns
         $tmpRow = $this->internal["currentRow"];
         $c = 0;
         $subpartRows = "";
         while ($this->internal["currentRow"] = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $markerArray["###UID###"] = $this->getFieldContent("uid");
             if ($this->getFieldContent("author")) {
                 $markerArray["###AUTHOR###"] = $this->getFieldContent("author");
             } else {
                 $markerArray["###AUTHOR###"] = $this->anonymousUser;
             }
             $markerArray["###TSTAMP###"] = $this->getFieldContent("tstamp");
             $markerArray["###DIFF_SELECT###"] = $this->getFieldContent("diff");
             $markerArray["###SUMMARY###"] = strip_tags($this->getFieldContent("summary"));
             $markerArray["###EDIT_PANEL###"] = $this->pi_getEditPanel($this->internal["current_row"]);
             if (!($c % 2)) {
                 $subpartRows .= $this->cObj->substituteMarkerArrayCached($templateRow, $markerArray);
             } else {
                 $subpartRows .= $this->cObj->substituteMarkerArrayCached($templateRowOdd, $markerArray);
             }
             $c++;
         }
         $subpart = $this->cObj->substituteSubpart($subpart, "###VERSION_LIST_ROWS###", $subpartRows);
         $this->internal["currentRow"] = $tmpRow;
     }
     return $subpart;
 }
示例#23
0
 /**
  * Extracts the sample description text from the content array.
  *
  * @param	array		Content array
  * @return	string		Description string
  */
 function bodyDescription($contentArr)
 {
     // Setting description
     $maxL = t3lib_div::intInRange($this->conf['index_descrLgd'], 0, 255, 200);
     if ($maxL) {
         // Takes the quadruple lenght first, because whitespace and entities may be removed and thus shorten the string more yet.
         #		$bodyDescription = implode(' ',split('[[:space:],]+',substr(trim($contentArr['body']),0,$maxL*4)));
         $bodyDescription = str_replace(array(' ', TAB, CR, LF), ' ', $contentArr['body']);
         // Shorten the string:
         $bodyDescription = $this->csObj->strtrunc('utf-8', $bodyDescription, $maxL);
     }
     return $bodyDescription;
 }
 /**
  * Returns the IP address to lock to.
  * The IP address may be partial based on $parts.
  *
  * @param	integer		1-4: Indicates how many parts of the IP address to return. 4 means all, 1 means only first number.
  * @return	string		(Partial) IP address for REMOTE_ADDR
  * @access private
  */
 function ipLockClause_remoteIPNumber($parts)
 {
     $IP = t3lib_div::getIndpEnv('REMOTE_ADDR');
     if ($parts >= 4) {
         return $IP;
     } else {
         $parts = t3lib_div::intInRange($parts, 1, 3);
         $IPparts = explode('.', $IP);
         for ($a = 4; $a > $parts; $a--) {
             unset($IPparts[$a - 1]);
         }
         return implode('.', $IPparts);
     }
 }
 /**
  * outputs a selector for users / groups, returns current ACLs
  *
  * @param	integer		type of ACL. 0 -> user, 1 -> group
  * @param	string		Pointer where the display code is stored
  * @param	array		configuration of ACLs
  * @return	array		list of groups/users where the ACLs will be shown
  */
 function acl_objectSelector($type, &$displayPointer, $conf)
 {
     global $BE_USER;
     $aclObjects = array();
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_beacl_acl.object_id AS object_id, tx_beacl_acl.type AS type', 'tx_beacl_acl, be_groups, be_users', 'tx_beacl_acl.type=' . intval($type) . ' AND ((tx_beacl_acl.object_id=be_groups.uid AND tx_beacl_acl.type=1) OR (tx_beacl_acl.object_id=be_users.uid AND tx_beacl_acl.type=0))', '', 'be_groups.title ASC, be_users.realname ASC');
     while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $aclObjects[] = $result['object_id'];
     }
     $aclObjects = array_unique($aclObjects);
     // advanced selector disabled
     if (!$conf['enableFilterSelector']) {
         return $aclObjects;
     }
     if (!empty($aclObjects)) {
         // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of
         $groupArray = $BE_USER->userGroupsUID;
         $be_user_Array = t3lib_BEfunc::getUserNames();
         if (!$GLOBALS['BE_USER']->isAdmin()) {
             $be_user_Array = t3lib_BEfunc::blindUserNames($be_user_Array, $groupArray, 0);
         }
         $be_group_Array = t3lib_BEfunc::getGroupNames();
         if (!$GLOBALS['BE_USER']->isAdmin()) {
             $be_group_Array = t3lib_BEfunc::blindGroupNames($be_group_Array, $groupArray, 0);
         }
         // get current selection from UC, merge data, write it back to UC
         $currentSelection = is_array($BE_USER->uc['moduleData']['txbeacl_aclSelector'][$type]) ? $BE_USER->uc['moduleData']['txbeacl_aclSelector'][$type] : array();
         $currentSelectionOverride_raw = t3lib_div::_GP('tx_beacl_objsel');
         $currentSelectionOverride = array();
         if (is_array($currentSelectionOverride_raw[$type])) {
             foreach ($currentSelectionOverride_raw[$type] as $tmp) {
                 $currentSelectionOverride[$tmp] = $tmp;
             }
         }
         if ($currentSelectionOverride) {
             $currentSelection = $currentSelectionOverride;
         }
         $BE_USER->uc['moduleData']['txbeacl_aclSelector'][$type] = $currentSelection;
         $BE_USER->writeUC($BE_USER->uc);
         // display selector
         $displayCode = '<select size="' . t3lib_div::intInRange(count($aclObjects), 5, 15) . '" name="tx_beacl_objsel[' . $type . '][]" multiple="multiple">';
         foreach ($aclObjects as $singleObjectId) {
             if ($type == 0) {
                 $tmpnam = $be_user_Array[$singleObjectId]['username'];
             } else {
                 $tmpnam = $be_group_Array[$singleObjectId]['title'];
             }
             $displayCode .= '<option value="' . $singleObjectId . '" ' . (@in_array($singleObjectId, $currentSelection) ? 'selected' : '') . '>' . $tmpnam . '</option>';
         }
         $displayCode .= '</select>';
         $displayCode .= '<br /><input type="button" value="' . $GLOBALS['LANG']->getLL('aclObjSelUpdate') . '" onClick="document.editform.action=document.location; document.editform.submit()" /><p />';
         // create section
         switch ($type) {
             case 0:
                 $tmpnam = 'aclUsers';
                 break;
             default:
                 $tmpnam = 'aclGroups';
                 break;
         }
         $displayPointer = $this->doc->section($GLOBALS['LANG']->getLL($tmpnam, 1), $displayCode);
         return $currentSelection;
     }
     return NULL;
 }
 /**
  * Sets the message' severity
  *
  * @param	string	The severity, must be either of t3lib_FlashMessage::INFO, t3lib_FlashMessage::OK, t3lib_FlashMessage::WARNING or t3lib_FlashMessage::ERROR. Default is t3lib_FlashMessage::OK.
  * @return	void
  */
 public function setSeverity($severity = self::OK)
 {
     $this->severity = t3lib_div::intInRange($severity, self::NOTICE, self::ERROR, self::OK);
 }
    /**
     * Constructor for initializing the class
     *
     * @return	void
     */
    function init()
    {
        // Initialize GPvars:
        $this->number = t3lib_div::_GP('number');
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::_GP('returnUrl');
        $this->returnUrl = $this->returnUrl ? $this->returnUrl : t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'file_list.php?id=' . rawurlencode($this->target);
        // set the number of input fields
        if (empty($this->number)) {
            $this->number = $GLOBALS['BE_USER']->getTSConfigVal('options.defaultFileUploads');
        }
        $this->number = t3lib_div::intInRange($this->number, 1, $this->uploadNumber);
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
        // Init basic-charset-functions object:
        $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
        // Cleaning and checking target
        $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
        $this->target = $this->basicff->is_directory($this->target);
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            t3lib_BEfunc::typo3PrintError($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
            exit;
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_upload.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
            $confirm = ' && confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . ')';
        } else {
            $confirm = '';
        }
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

			function reload(a) {	//
				if (!changed || (changed ' . $confirm . ')) {
					var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . urlencode($this->charsetConversion->conv($this->returnUrl, $GLOBALS['LANG']->charSet, 'utf-8')) . '";
					window.location.href = "file_upload.php?"+params;
				}
			}
			function backToList() {	//
				top.goToModule("file_list");
			}
			var changed = 0;
		');
    }
 /**
  * Start function
  * This class is able to generate a mail in formmail-style from the data in $V
  * Fields:
  *
  * [recipient]:			email-adress of the one to receive the mail. If array, then all values are expected to be recipients
  * [attachment]:		....
  *
  * [subject]:			The subject of the mail
  * [from_email]:		Sender email. If not set, [email] is used
  * [from_name]:			Sender name. If not set, [name] is used
  * [replyto_email]:		Reply-to email. If not set [from_email] is used
  * [replyto_name]:		Reply-to name. If not set [from_name] is used
  * [organisation]:		Organization (header)
  * [priority]:			Priority, 1-5, default 3
  * [html_enabled]:		If mail is sent as html
  * [use_base64]:		If set, base64 encoding will be used instead of quoted-printable
  *
  * @param	array		Contains values for the field names listed above (with slashes removed if from POST input)
  * @param	boolean		Whether to base64 encode the mail content
  * @return	void
  */
 function start($V, $base64 = false)
 {
     $convCharset = FALSE;
     // do we need to convert form data?
     if ($GLOBALS['TSFE']->config['config']['formMailCharset']) {
         // Respect formMailCharset if it was set
         $this->charset = $GLOBALS['TSFE']->csConvObj->parse_charset($GLOBALS['TSFE']->config['config']['formMailCharset']);
         $convCharset = TRUE;
     } elseif ($GLOBALS['TSFE']->metaCharset != $GLOBALS['TSFE']->renderCharset) {
         // Use metaCharset for mail if different from renderCharset
         $this->charset = $GLOBALS['TSFE']->metaCharset;
         $convCharset = TRUE;
     }
     parent::start();
     if ($base64 || $V['use_base64']) {
         $this->useBase64();
     }
     if (isset($V['recipient'])) {
         // convert form data from renderCharset to mail charset
         $val = $V['subject'] ? $V['subject'] : 'Formmail on ' . t3lib_div::getIndpEnv('HTTP_HOST');
         $this->subject = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
         $this->subject = $this->sanitizeHeaderString($this->subject);
         $val = $V['from_name'] ? $V['from_name'] : ($V['name'] ? $V['name'] : '');
         // Be careful when changing $val! It is used again as the fallback value for replyto_name
         $this->from_name = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
         $this->from_name = $this->sanitizeHeaderString($this->from_name);
         $this->from_name = preg_match('/\\s|,/', $this->from_name) >= 1 ? '"' . $this->from_name . '"' : $this->from_name;
         $val = $V['replyto_name'] ? $V['replyto_name'] : $val;
         $this->replyto_name = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
         $this->replyto_name = $this->sanitizeHeaderString($this->replyto_name);
         $this->replyto_name = preg_match('/\\s|,/', $this->replyto_name) >= 1 ? '"' . $this->replyto_name . '"' : $this->replyto_name;
         $val = $V['organisation'] ? $V['organisation'] : '';
         $this->organisation = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset) : $val;
         $this->organisation = $this->sanitizeHeaderString($this->organisation);
         $this->from_email = $V['from_email'] ? $V['from_email'] : ($V['email'] ? $V['email'] : '');
         $this->from_email = t3lib_div::validEmail($this->from_email) ? $this->from_email : '';
         $this->replyto_email = $V['replyto_email'] ? $V['replyto_email'] : $this->from_email;
         $this->replyto_email = t3lib_div::validEmail($this->replyto_email) ? $this->replyto_email : '';
         $this->priority = $V['priority'] ? t3lib_div::intInRange($V['priority'], 1, 5) : 3;
         // Auto responder.
         $this->auto_respond_msg = trim($V['auto_respond_msg']) && $this->from_email ? trim($V['auto_respond_msg']) : '';
         $this->auto_respond_msg = $this->sanitizeHeaderString($this->auto_respond_msg);
         $Plain_content = '';
         $HTML_content = '<table border="0" cellpadding="2" cellspacing="2">';
         // Runs through $V and generates the mail
         if (is_array($V)) {
             foreach ($V as $key => $val) {
                 if (!t3lib_div::inList($this->reserved_names, $key)) {
                     $space = strlen($val) > 60 ? LF : '';
                     $val = is_array($val) ? implode($val, LF) : $val;
                     // convert form data from renderCharset to mail charset (HTML may use entities)
                     $Plain_val = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv($val, $GLOBALS['TSFE']->renderCharset, $this->charset, 0) : $val;
                     $HTML_val = $convCharset && strlen($val) ? $GLOBALS['TSFE']->csConvObj->conv(htmlspecialchars($val), $GLOBALS['TSFE']->renderCharset, $this->charset, 1) : htmlspecialchars($val);
                     $Plain_content .= strtoupper($key) . ':  ' . $space . $Plain_val . LF . $space;
                     $HTML_content .= '<tr><td bgcolor="#eeeeee"><font face="Verdana" size="1"><strong>' . strtoupper($key) . '</strong></font></td><td bgcolor="#eeeeee"><font face="Verdana" size="1">' . nl2br($HTML_val) . '&nbsp;</font></td></tr>';
                 }
             }
         }
         $HTML_content .= '</table>';
         if ($V['html_enabled']) {
             $this->setHTML($this->encodeMsg($HTML_content));
         }
         $this->addPlain($Plain_content);
         for ($a = 0; $a < 10; $a++) {
             $varname = 'attachment' . ($a ? $a : '');
             if (!isset($_FILES[$varname])) {
                 continue;
             }
             if (!is_uploaded_file($_FILES[$varname]['tmp_name'])) {
                 t3lib_div::sysLog('Possible abuse of t3lib_formmail: temporary file "' . $_FILES[$varname]['tmp_name'] . '" ("' . $_FILES[$varname]['name'] . '") was not an uploaded file.', 'Core', 3);
             }
             if ($_FILES[$varname]['tmp_name']['error'] !== UPLOAD_ERR_OK) {
                 t3lib_div::sysLog('Error in uploaded file in t3lib_formmail: temporary file "' . $_FILES[$varname]['tmp_name'] . '" ("' . $_FILES[$varname]['name'] . '") Error code: ' . $_FILES[$varname]['tmp_name']['error'], 'Core', 3);
             }
             $theFile = t3lib_div::upload_to_tempfile($_FILES[$varname]['tmp_name']);
             $theName = $_FILES[$varname]['name'];
             if ($theFile && file_exists($theFile)) {
                 if (filesize($theFile) < $GLOBALS['TYPO3_CONF_VARS']['FE']['formmailMaxAttachmentSize']) {
                     $this->addAttachment($theFile, $theName);
                 }
             }
             t3lib_div::unlink_tempfile($theFile);
         }
         $this->setHeaders();
         $this->setContent();
         $this->setRecipient($V['recipient']);
         if ($V['recipient_copy']) {
             $this->recipient_copy = trim($V['recipient_copy']);
         }
         // log dirty header lines
         if ($this->dirtyHeaders) {
             t3lib_div::sysLog('Possible misuse of t3lib_formmail: see TYPO3 devLog', 'Core', 3);
             if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) {
                 t3lib_div::devLog('t3lib_formmail: ' . t3lib_div::arrayToLogString($this->dirtyHeaders, '', 200), 'Core', 3);
             }
         }
     }
 }
示例#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;
 }
    /**
     * Create the selector box for selecting fields to display from a table:
     *
     * @param	string		Table name
     * @param	boolean		If true, form-fields will be wrapped around the table.
     * @return	string		HTML table with the selector box (name: displayFields['.$table.'][])
     */
    function fieldSelectBox($table = '', $formFields = 1)
    {
        global $TCA, $LANG;
        // Init:
        $table = $table ? $table : $this->table;
        t3lib_div::loadTCA($table);
        $formElements = array('', '');
        if ($formFields) {
            $formElements = array('<form action="' . htmlspecialchars($this->listURL()) . '" method="post">', '</form>');
        }
        // Load already selected fields, if any:
        $setFields = is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
        // Request fields from table:
        $fields = $this->makeFieldList($table);
        #TODO??
        // Add pseudo "control" fields
        #		$fields['_PATH_'] = '_PATH_';
        #		$fields['_LOCALIZATION_'] = '_LOCALIZATION_';
        #		$fields['_CONTROL_'] = '_CONTROL_';
        #		$fields['_CLIPBOARD_'] = '_CLIPBOARD_';
        // Create an option for each field:
        $opt = array();
        $opt[] = '<option value=""></option>';
        foreach ($fields as $fN) {
            $fL = is_array($TCA[$table]['columns'][$fN]) ? preg_replace('/:$/', '', $LANG->sL($TCA[$table]['columns'][$fN]['label'])) : '[' . $fN . ']';
            // Field label
            $opt[] = '
											<option value="' . $fN . '"' . (in_array($fN, $setFields) ? ' selected="selected"' : '') . '>' . htmlspecialchars($fL) . '</option>';
        }
        // Compile the options into a multiple selector box:
        $lMenu = '
										<select size="' . t3lib_div::intInRange(count($fields) + 1, 3, 8) . '" multiple="multiple" name="displayFields[' . $table . '][]">' . implode('', $opt) . '
										</select>
				';
        // Table with the search box:
        $content .= '
		' . $formElements[0] . '
				<!--
					Field selector for extended table view:
				-->
				<table border="0" cellpadding="0" cellspacing="0" class="bgColor4" id="typo3-dblist-fieldSelect">
					<tr>
						<td>' . $lMenu . '</td>
						<td><input type="Submit" name="search" value="&gt;&gt;"></td>
					</tr>
					</table>
			' . $formElements[1] . '
		';
        return $content;
    }