Exemplo n.º 1
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);
     }
 }
 /**
  * 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;
 }
Exemplo n.º 3
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;
 }
    /**
     * 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));
        }
    }
 /**
  * Initialize the system log.
  *
  * @return void
  * @see sysLog()
  */
 public static function initSysLog()
 {
     // for CLI logging name is <fqdn-hostname>:<TYPO3-path>
     // Note that TYPO3_REQUESTTYPE is not used here as it may not yet be defined
     if (defined('TYPO3_cliMode') && TYPO3_cliMode) {
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = self::getHostname($requestHost = FALSE) . ':' . PATH_site;
     } else {
         $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] = self::getIndpEnv('TYPO3_SITE_URL');
     }
     // init custom logging
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
         $params = array('initLog' => TRUE);
         $fakeThis = FALSE;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
             self::callUserFunction($hookMethod, $params, $fakeThis);
         }
     }
     // init TYPO3 logging
     foreach (explode(';', $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog'], 2) as $log) {
         list($type, $destination) = explode(',', $log, 3);
         if ($type == 'syslog') {
             if (TYPO3_OS == 'WIN') {
                 $facility = LOG_USER;
             } else {
                 $facility = constant('LOG_' . strtoupper($destination));
             }
             openlog($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'], LOG_ODELAY, $facility);
         }
     }
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'] = t3lib_utility_Math::forceIntegerInRange($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel'], 0, 4);
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit'] = TRUE;
 }
Exemplo n.º 6
0
    function getTree(&$PA, &$fobj)
    {
        $fobj->additionalCode_pre['tx_cpstcatree'] = '
<script src="' . t3lib_extMgm::extRelPath('cps_tcatree') . 'js/tx_cpstcatree.js" type="text/javascript"></script>';
        $this->init($PA);
        if (isset($this->fieldConfig['trueMaxItems'])) {
            $this->fieldConfig['maxitems'] = $this->fieldConfig['trueMaxItems'];
        }
        // #53379, 131106, dwildt, 3-
        //		$maxitems = t3lib_div::intInRange($this->fieldConfig['maxitems'], 0, 2000000000, 1000);
        //		$minitems = t3lib_div::intInRange($this->fieldConfig['minitems'], 0);
        //		$size = t3lib_div::intInRange($this->fieldConfig['size'], 0, 2000000000, 1);
        // #53379, 131106, dwildt, 3+
        $maxitems = t3lib_utility_Math::forceIntegerInRange($this->fieldConfig['maxitems'], 0, 2000000000, 1000);
        $minitems = t3lib_utility_Math::forceIntegerInRange($this->fieldConfig['minitems'], 0);
        $size = t3lib_utility_Math::forceIntegerInRange($this->fieldConfig['size'], 0, 2000000000, 1);
        $this->registerRequiredProperty('range', $this->itemFormElName, array($minitems, $maxitems, 'imgName' => $this->table . '_' . $this->row['uid'] . '_' . $this->field), $fobj);
        $content .= '<input type="hidden" name="' . $this->itemFormElName . '_mul" value="' . ($this->fieldConfig['multiple'] ? 1 : 0) . '" />';
        if ($this->fieldConfig['foreign_table']) {
            $treeContent = '<span id="' . $this->table . '_' . $this->fieldConfig['foreign_table'] . '_tree">' . $this->renderTree() . '</span>';
            // Count items
            $count = substr_count($treeContent, '<li');
            // Add height to tcatree div
            $height = '';
            if (isset($this->fieldConfig['autoSizeMax']) && $count > $this->fieldConfig['autoSizeMax']) {
                $height = ' height: ' . 22 * $this->fieldConfig['autoSizeMax'] . 'px; overflow: scroll;';
            }
            $thumbnails = '<div name="' . $this->itemFormElName . '_selTree" class="tree-div" style="position: relative; border: 1px solid #999; background: #fff; left: 0px; top: 0px; width: 350px; margin-bottom: 5px; padding: 0 10px 10px 0;' . $height . '">';
            $thumbnails .= $treeContent;
            $thumbnails .= '</div>';
        }
        // Get label for non matching values from tsconfig or t3lib_tceforms
        if (isset($this->PA['fieldTSconfig']['noMatchingValue_label'])) {
            $nMV_label = $GLOBALS['LANG']->sL($this->PA['fieldTSconfig']['noMatchingValue_label']);
        } else {
            $nMV_label = '[ ' . $fobj->getLL('l_noMatchingValue') . ' ]';
        }
        $nMV_label = @sprintf($nMV_label, $this->PA['itemFormElValue']);
        // Check all selected items for hidden records
        $itemArray = t3lib_div::trimExplode(',', $this->PA['itemFormElValue'], 1);
        foreach ($itemArray as $key => $item) {
            $item = explode('|', $item, 2);
            $evalValue = rawurldecode($item[0]);
            if (in_array($evalValue, $this->removeItems) and !$this->PA['fieldTSconfig']['disableNoMatchingValueElement']) {
                // If item should be hidden
                $item[1] = $nMV_label;
            }
            $item[1] = rawurldecode($item[1]);
            $itemArray[$key] = implode('|', $item);
        }
        $params = array('size' => $size, 'autoSizeMax' => $this->fieldConfig['autoSizeMax'], 'style' => ' style="width: 200px;"', 'dontShowMoveIcons' => $maxitems < 2, 'maxitems' => $maxitems, 'info' => '', 'headers' => array('selector' => $fobj->getLL('l_selected') . ':<br />', 'items' => $fobj->getLL('l_items') . ':<br />'), 'noBrowser' => 1, 'thumbnails' => $thumbnails);
        // Get select field with browser
        $content .= $fobj->dbFileIcons($this->itemFormElName, '', '', $itemArray, '', $params, $this->PA['onFocus']);
        $altItem = '<input type="hidden" name="' . $this->itemFormElName . '" value="' . htmlspecialchars($this->PA['itemFormElValue']) . '" />';
        $content = $fobj->renderWizards(array($content, $altItem), $this->fieldConfig['wizards'], $this->table, $this->row, $this->field, $this->PA, $this->itemFormElName, array());
        if (in_array('required', t3lib_div::trimExplode(',', $this->fieldConfig['eval'], 1)) and $this->NA_Items) {
            $this->registerRequiredProperty('range', 'data[' . $this->table . '][' . $this->row['uid'] . '][noDisallowedCategories]', array(1, 1, 'imgName' => $this->table . '_' . $this->row['uid'] . '_noDisallowedCategories'), $fobj);
            $content .= '<input type="hidden" name="data[' . $this->table . '][' . $this->row['uid'] . '][noDisallowedCategories]" value="' . ($this->NA_Items ? '' : '1') . '" />';
        }
        return $content;
    }
Exemplo n.º 7
0
 /**
  * Logs message to the system log.
  * This should be implemented around the source code, including the Core and both frontend and backend, logging serious errors.
  * If you want to implement the sysLog in your applications, simply add lines like:
  *		 t3lib_div::sysLog('[write message in English here]', 'extension_key', 'severity');
  *
  * @param string $msg Message (in English).
  * @param string $extKey Extension key (from which extension you are calling the log) or "Core"
  * @param integer $severity Severity: 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error
  * @return void
  */
 public static function sysLog($msg, $extKey, $severity = 0)
 {
     $severity = t3lib_utility_Math::forceIntegerInRange($severity, 0, 4);
     // is message worth logging?
     if (intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLogLevel']) > $severity) {
         return;
     }
     // initialize logging
     if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogInit']) {
         self::initSysLog();
     }
     // do custom logging
     if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'])) {
         $params = array('msg' => $msg, 'extKey' => $extKey, 'backTrace' => debug_backtrace(), 'severity' => $severity);
         $fakeThis = FALSE;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLog'] as $hookMethod) {
             self::callUserFunction($hookMethod, $params, $fakeThis);
         }
     }
     // TYPO3 logging enabled?
     if (!$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog']) {
         return;
     }
     $dateFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
     $timeFormat = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'];
     // use all configured logging options
     foreach (explode(';', $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLog'], 2) as $log) {
         list($type, $destination, $level) = explode(',', $log, 4);
         // is message worth logging for this log type?
         if (intval($level) > $severity) {
             continue;
         }
         $msgLine = ' - ' . $extKey . ': ' . $msg;
         // write message to a file
         if ($type == 'file') {
             $lockObject = t3lib_div::makeInstance('t3lib_lock', $destination, $GLOBALS['TYPO3_CONF_VARS']['SYS']['lockingMode']);
             /** @var t3lib_lock $lockObject */
             $lockObject->setEnableLogging(FALSE);
             $lockObject->acquire();
             $file = fopen($destination, 'a');
             if ($file) {
                 fwrite($file, date($dateFormat . ' ' . $timeFormat) . $msgLine . LF);
                 fclose($file);
                 self::fixPermissions($destination);
             }
             $lockObject->release();
         } elseif ($type == 'mail') {
             list($to, $from) = explode('/', $destination);
             if (!t3lib_div::validEmail($from)) {
                 $from = t3lib_utility_Mail::getSystemFrom();
             }
             /** @var $mail t3lib_mail_Message */
             $mail = t3lib_div::makeInstance('t3lib_mail_Message');
             $mail->setTo($to)->setFrom($from)->setSubject('Warning - error in TYPO3 installation')->setBody('Host: ' . $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . LF . 'Extension: ' . $extKey . LF . 'Severity: ' . $severity . LF . LF . $msg);
             $mail->send();
         } elseif ($type == 'error_log') {
             error_log($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['systemLogHost'] . $msgLine, 0);
         } elseif ($type == 'syslog') {
             $priority = array(LOG_INFO, LOG_NOTICE, LOG_WARNING, LOG_ERR, LOG_CRIT);
             syslog($priority[(int) $severity], $msgLine);
         }
     }
 }
 /**
  * Hook function for cleaning output XHTML
  * hooks on "class.tslib_fe.php:2946"
  * page.config.tx_seo.sourceCodeFormatter.indentType = space
  * page.config.tx_seo.sourceCodeFormatter.indentAmount = 16
  *
  * @param       array           hook parameters
  * @param       object          Reference to parent object (TSFE-obj)
  * @return      void
  */
 public function processOutputHook(&$feObj, $ref)
 {
     if ($GLOBALS['TSFE']->type != 0) {
         return;
     }
     $configuration = $GLOBALS['TSFE']->config['config']['tx_seo.']['sourceCodeFormatter.'];
     // disabled for this page type
     if (isset($configuration['enable']) && $configuration['enable'] == '0') {
         return;
     }
     // 4.5 compatibility
     if (method_exists('t3lib_div', 'intInRange')) {
         $indentAmount = t3lib_div::intInRange($configuration['indentAmount'], 1, 100);
     } else {
         $indentAmount = t3lib_utility_Math::forceIntegerInRange($configuration['indentAmount'], 1, 100);
     }
     // use the "space" character as a indention type
     if ($configuration['indentType'] == 'space') {
         $indentElement = ' ';
         // use any character from the ASCII table
     } else {
         $indentTypeIsNumeric = FALSE;
         // 4.5 compatibility
         if (method_exists('t3lib_div', 'testInt')) {
             $indentTypeIsNumeric == t3lib_div::testInt($configuration['indentType']);
         } else {
             $indentTypeIsNumeric = t3lib_utility_Math::canBeInterpretedAsInteger($configuration['indentType']);
         }
         if ($indentTypeIsNumeric) {
             $indentElement = chr($configuration['indentType']);
         } else {
             // use tab by default
             $indentElement = "\t";
         }
     }
     $indention = '';
     for ($i = 1; $i <= $indentAmount; $i++) {
         $indention .= $indentElement;
     }
     $spltContent = explode("\n", $ref->content);
     $level = 0;
     $cleanContent = array();
     $textareaOpen = false;
     foreach ($spltContent as $lineNum => $line) {
         $line = trim($line);
         if (empty($line)) {
             continue;
         }
         $out = $line;
         // ugly strpos => TODO: use regular expressions
         // starts with an ending tag
         if (strpos($line, '</div>') === 0 || strpos($line, '<div') !== 0 && strpos($line, '</div>') === strlen($line) - 6 || strpos($line, '</html>') === 0 || strpos($line, '</body>') === 0 || strpos($line, '</head>') === 0 || strpos($line, '</ul>') === 0) {
             $level--;
         }
         if (strpos($line, '<textarea') !== false) {
             $textareaOpen = true;
         }
         // add indention only if no textarea is open
         if (!$textareaOpen) {
             for ($i = 0; $i < $level; $i++) {
                 $out = $indention . $out;
             }
         }
         if (strpos($line, '</textarea>') !== false) {
             $textareaOpen = false;
         }
         // starts with an opening <div>, <ul>, <head> or <body>
         if (strpos($line, '<div') === 0 && strpos($line, '</div>') !== strlen($line) - 6 || strpos($line, '<body') === 0 && strpos($line, '</body>') !== strlen($line) - 7 || strpos($line, '<head') === 0 && strpos($line, '</head>') !== strlen($line) - 7 || strpos($line, '<ul') === 0 && strpos($line, '</ul>') !== strlen($line) - 5) {
             $level++;
         }
         $cleanContent[] = $out;
     }
     $ref->content = implode("\n", $cleanContent);
 }
 /**
  * Forces the integer $theInt into the boundaries of $min and $max.
  *
  * @access	public
  *
  * @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 intInRange($theInt, $min, $max = 2000000000, $zeroValue = 0)
 {
     if (t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 6000000) {
         // TYPO3 > 6.0
         return t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $zeroValue);
     } else {
         // TYPO3 4.5 - 4.7
         return t3lib_div::intInRange($theInt, $min, $max, $zeroValue);
     }
 }
	/**
	 * Forces the integer $theInt into the boundaries of $min and $max. If the $theInt is FALSE then the $defaultValue is applied.
	 *
	 * @param $theInt integer Input value
	 * @param $min integer Lower limit
	 * @param $max integer Higher limit
	 * @param $defaultValue integer Default value if input is FALSE.
	 * @return integer The input value forced into the boundaries of $min and $max
	 */
	public static function forceIntegerInRange($theInt, $min, $max = 2000000000, $defaultValue = 0) {
		if (class_exists('t3lib_utility_Math')) {
			$result = t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $defaultValue);
		} else {
			$result = t3lib_div::intInRange($theInt, $min, $max, $defaultValue);
		}
		return $result;
	}
 public static function intInRange($theInt, $min, $max = 2000000000, $zeroValue = 0)
 {
     $result = FALSE;
     $callingClassName = '\\TYPO3\\CMS\\Core\\Utility\\MathUtility';
     if (class_exists($callingClassName) && method_exists($callingClassName, 'forceIntegerInRange')) {
         $result = call_user_func($callingClassName . '::forceIntegerInRange', $theInt, $min, $max, $zeroValue);
     } else {
         if (class_exists('t3lib_utility_Math') && method_exists('t3lib_utility_Math', 'forceIntegerInRange')) {
             $result = t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $zeroValue);
         } else {
             if (class_exists('t3lib_div') && method_exists('t3lib_div', 'intInRange')) {
                 $result = t3lib_div::intInRange($theInt, $min, $max, $zeroValue);
             }
         }
     }
     return $result;
 }
 /**
  * Shows the list of feusers
  * @param $friends
  * @return string
  */
 function listView($friends = false)
 {
     $this->mode = 'listView.';
     $markerArray = array();
     $where = '';
     if (!isset($this->piVars['pointer'])) {
         $this->piVars['pointer'] = 0;
     }
     // Initializing the query parameters:
     list($this->internal['orderBy'], $this->internal['descFlag']) = explode(':', $this->piVars['sort']);
     if (class_exists(t3lib_utility_VersionNumber) && t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4006000) {
         $this->internal['results_at_a_time'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['itemsPerPage'], 0, 1000, 10);
         $this->internal['maxPages'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['maxPages'], 0, 1000, 5);
         $this->internal['showFirstLast'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['showFirstLast'], 0, 1, 0);
         $this->internal['dontLinkActivePage'] = t3lib_utility_Math::forceIntegerInRange($this->conf[$this->mode]['dontLinkActivePage'], 0, 1, 0);
     } else {
         $this->internal['results_at_a_time'] = t3lib_div::intInRange($this->conf[$this->mode]['itemsPerPage'], 0, 1000, 10);
         $this->internal['maxPages'] = t3lib_div::intInRange($this->conf[$this->mode]['maxPages'], 0, 1000, 5);
         $this->internal['showFirstLast'] = t3lib_div::intInRange($this->conf[$this->mode]['showFirstLast'], 0, 1, 0);
         $this->internal['dontLinkActivePage'] = t3lib_div::intInRange($this->conf[$this->mode]['dontLinkActivePage'], 0, 1, 0);
     }
     $this->conf['searchFields'] = 'username,name,firstname,usergroup,email,address,city,zip';
     $this->internal['searchFieldList'] = $this->conf['searchFields'];
     $this->conf['orderByFields'] = 'username,name,firstname,usergroup,email,address,zip,city';
     $this->internal['orderByList'] = $this->conf['orderByFields'];
     if ($this->conf[$this->mode]['pagefloat']) {
         // Where in the list is the current page shown. The value 'center' puts it in the middle.
         $this->internal['pagefloat'] = $this->conf[$this->mode]['pagefloat'];
     }
     if (!$this->conf['neverHideUser'] && $this->conf['hideUserField']) {
         $where = "AND NOT " . $this->conf['hideUserField'];
     }
     // Show only friends
     if ($friends === true) {
         $friends_array = $this->getFriendsId();
         if (count($friends_array) == 0) {
             $friends_array = array(0);
         }
         $where .= " AND uid IN (" . implode(',', $friends_array) . ")";
     }
     $userGroupsToShow = t3lib_div::intExplode(',', $this->conf['userGroupToShow'], TRUE);
     if (count($userGroupsToShow) > 0) {
         $groupWhere = array();
         foreach ($userGroupsToShow as $userGroupToShow) {
             $groupWhere[] = " CONCAT(',', usergroup, ',') LIKE '%,{$userGroupToShow},%'";
         }
         $where .= " AND (" . implode(" OR ", $groupWhere) . ")";
     }
     // Get number of records:
     $res = $this->pi_exec_query($this->internal['currentTable'], 1, $where);
     list($this->internal['res_count']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
     // Make listing query, pass query to MySQL:
     $res = $this->pi_exec_query($this->internal['currentTable'], 0, $where, '', '', $this->conf['orderByFields']);
     // Adds the search box:
     $markerArray['SEARCH'] = str_replace('value="Search"', 'value="Suche"', $this->pi_list_searchBox());
     // Adds the result browser:
     $markerArray['BROWSE'] = $this->pi_list_browseresults();
     if ($this->conf['have_GSI_hack']) {
         $markerArray['BROWSE_RESULTS'] = $this->pi_list_browseresults(1, '', 0);
         $markerArray['BROWSE_PAGES'] = $this->pi_list_browseresults(0, '', 1);
     }
     // sort field headers
     foreach (t3lib_div::trimExplode(',', $this->conf['orderByFields'], 1) as $f) {
         $markerArray['SORT_' . $f] = $this->pi_linkTP_keepPIvars($this->getFieldLabel($f), array('sort' => $f . ':' . ($this->internal['descFlag'] ? 0 : 1)));
     }
     $tplCode = '';
     // different templates for login users
     if ($GLOBALS['TSFE']->loginUser) {
         $tplCode = $this->cObj->getSubpart($this->templateFile, '###TEMPLATE_LIST_LOGIN###');
     }
     // fallback to standard template
     if ($tplCode == '') {
         $tplCode = $this->cObj->getSubpart($this->templateFile, '###TEMPLATE_LIST###');
     }
     $this->rowTplCode = $this->cObj->getSubpart($tplCode, '###SUB_TEMPLATE_ITEM###');
     $tplCode = $this->cObj->getSubpart($tplCode, '###SUB_TEMPLATE_ITEMS###');
     if ($tplCode == '') {
         return '<p>USER LIST (LIST VIEW) - EMPTY TEMPLATE!</p>';
     }
     // Adds the whole list table
     $markerArray['ITEMS'] = $this->list_makelist($res, $friends);
     // the language vars
     $markerArray['LIST_PERSON'] = $this->pi_getLL('list_person');
     $markerArray['LIST_USERNAME'] = $this->pi_getLL('list_username');
     $markerArray['LIST_NAME'] = $this->pi_getLL('list_name');
     $markerArray['LIST_FIRSTNAME'] = $this->pi_getLL('list_firstname');
     $markerArray['LIST_KORP'] = $this->pi_getLL('list_korp');
     return $this->cObj->substituteMarkerArray($tplCode, $markerArray, '###|###', 0);
 }
 /**
  * Transforms fields into certain things...
  *
  * @return void  all parsing done directly on input array $dataArray
  */
 public function parseValues($theTable, array &$dataArray, array $origArray, $cmdKey)
 {
     $cObj = t3lib_div::makeInstance('tslib_cObj');
     if (is_array($this->conf['parseValues.'])) {
         foreach ($this->conf['parseValues.'] as $theField => $theValue) {
             $listOfCommands = t3lib_div::trimExplode(',', $theValue, 1);
             if (in_array('setEmptyIfAbsent', $listOfCommands)) {
                 $this->setEmptyIfAbsent($theTable, $theField, $dataArray);
             }
             $internalType = $GLOBALS['TCA'][$theTable]['columns'][$theField]['config']['internal_type'];
             if (isset($dataArray[$theField]) || isset($origArray[$theField]) || $internalType == 'file') {
                 foreach ($listOfCommands as $cmd) {
                     $cmdParts = preg_split('/\\[|\\]/', $cmd);
                     // Point is to enable parameters after each command enclosed in brackets [..]. These will be in position 1 in the array.
                     $theCmd = trim($cmdParts[0]);
                     $bValueAssigned = TRUE;
                     if ($theField === 'password' && !isset($dataArray[$theField])) {
                         $bValueAssigned = FALSE;
                     }
                     $dataValue = isset($dataArray[$theField]) ? $dataArray[$theField] : $origArray[$theField];
                     switch ($theCmd) {
                         case 'int':
                             $dataValue = intval($dataValue);
                             break;
                         case 'lower':
                         case 'upper':
                             $dataValue = $cObj->caseshift($dataValue, $theCmd);
                             break;
                         case 'nospace':
                             $dataValue = str_replace(' ', '', $dataValue);
                             break;
                         case 'alpha':
                             $dataValue = preg_replace('/[^a-zA-Z]/', '', $dataValue);
                             break;
                         case 'num':
                             $dataValue = preg_replace('/[^0-9]/', '', $dataValue);
                             break;
                         case 'alphanum':
                             $dataValue = preg_replace('/[^a-zA-Z0-9]/', '', $dataValue);
                             break;
                         case 'alphanum_x':
                             $dataValue = preg_replace('/[^a-zA-Z0-9_-]/', '', $dataValue);
                             break;
                         case 'trim':
                             $dataValue = trim($dataValue);
                             break;
                         case 'random':
                             $dataValue = substr(md5(uniqid(microtime(), 1)), 0, intval($cmdParts[1]));
                             break;
                         case 'files':
                             $fieldDataArray = array();
                             if ($dataArray[$theField]) {
                                 if (is_array($dataValue)) {
                                     $fieldDataArray = $dataValue;
                                 } else {
                                     if (is_string($dataValue) && $dataValue) {
                                         $fieldDataArray = t3lib_div::trimExplode(',', $dataValue, 1);
                                     }
                                 }
                             }
                             $dataValue = $this->processFiles($theTable, $theField, $fieldDataArray, $cmdKey);
                             break;
                         case 'multiple':
                             $fieldDataArray = array();
                             if (!empty($dataArray[$theField])) {
                                 if (is_array($dataArray[$theField])) {
                                     $fieldDataArray = $dataArray[$theField];
                                 } else {
                                     if (is_string($dataArray[$theField]) && $dataArray[$theField]) {
                                         $fieldDataArray = t3lib_div::trimExplode(',', $dataArray[$theField], 1);
                                     }
                                 }
                             }
                             $dataValue = $fieldDataArray;
                             break;
                         case 'checkArray':
                             if (is_array($dataValue)) {
                                 $newDataValue = 0;
                                 foreach ($dataValue as $kk => $vv) {
                                     $kk = class_exists('t3lib_utility_Math') ? t3lib_utility_Math::forceIntegerInRange($kk, 0) : t3lib_div::intInRange($kk, 0);
                                     if ($kk <= 30) {
                                         if ($vv) {
                                             $newDataValue |= pow(2, $kk);
                                         }
                                     }
                                 }
                                 $dataValue = $newDataValue;
                             }
                             break;
                         case 'uniqueHashInt':
                             $otherFields = t3lib_div::trimExplode(';', $cmdParts[1], 1);
                             $hashArray = array();
                             foreach ($otherFields as $fN) {
                                 $vv = $dataArray[$fN];
                                 $vv = preg_replace('/\\s+/', '', $vv);
                                 $vv = preg_replace('/[^a-zA-Z0-9]/', '', $vv);
                                 $vv = strtolower($vv);
                                 $hashArray[] = $vv;
                             }
                             $dataValue = hexdec(substr(md5(serialize($hashArray)), 0, 8));
                             break;
                         case 'wwwURL':
                             if ($dataValue) {
                                 $urlParts = parse_url($dataValue);
                                 if ($urlParts !== FALSE) {
                                     if (!$urlParts['scheme']) {
                                         $urlParts['scheme'] = 'http';
                                         $dataValue = $urlParts['scheme'] . '://' . $dataValue;
                                     }
                                     if (t3lib_div::isValidUrl($dataValue)) {
                                         $dataValue = $urlParts['scheme'] . '://' . $urlParts['host'] . $urlParts['path'] . ($urlParts['query'] ? '?' . $urlParts['query'] : '') . ($urlParts['fragment'] ? '#' . $urlParts['fragment'] : '');
                                     }
                                 }
                             }
                             break;
                         case 'date':
                             if ($dataValue && $this->evalDate($dataValue, $this->conf['dateFormat'])) {
                                 $dateArray = $this->fetchDate($dataValue, $this->conf['dateFormat']);
                                 $dataValue = $dateArray['y'] . '-' . $dateArray['m'] . '-' . $dateArray['d'];
                                 $translateArray = array('d' => $dateArray['d'] < 10 ? '0' . $dateArray['d'] : $dateArray['d'], 'j' => $dateArray['d'], 'm' => $dateArray['m'] < 10 ? '0' . $dateArray['m'] : $dateArray['m'], 'n' => $dateArray['m'], 'y' => $dateArray['y'], 'Y' => $dateArray['y']);
                                 $searchArray = array_keys($translateArray);
                                 $replaceArray = array_values($translateArray);
                                 $dataValue = str_replace($searchArray, $replaceArray, $this->conf['dateFormat']);
                             } else {
                                 if (!isset($dataArray[$theField])) {
                                     $bValueAssigned = FALSE;
                                 }
                             }
                             break;
                         default:
                             $bValueAssigned = FALSE;
                             break;
                     }
                     if ($bValueAssigned) {
                         $dataArray[$theField] = $dataValue;
                     }
                 }
             }
         }
     }
 }
 /**
  * Finding "closest" versioning type, used for creation of new records.
  *
  * @see workspaceVersioningTypeAccess() for hints on $type
  * @param integer $type Versioning type to evaluation: -1, 0, >1
  * @return integer Returning versioning type
  * @deprecated since TYPO3 4.4, will be removed in TYPO3 6.0 as only element versioning is supported now
  * @todo Define visibility
  */
 public function workspaceVersioningTypeGetClosest($type)
 {
     t3lib_div::logDeprecatedFunction();
     $type = t3lib_utility_Math::forceIntegerInRange($type, -1);
     if ($this->workspace > 0) {
         switch ((int) $type) {
             case -1:
                 $type = -1;
                 break;
             case 0:
                 $type = $this->workspaceVersioningTypeAccess($type) ? $type : -1;
                 break;
             default:
                 $type = $this->workspaceVersioningTypeAccess($type) ? $type : ($this->workspaceVersioningTypeAccess(0) ? 0 : -1);
                 break;
         }
     }
     return $type;
 }
Exemplo n.º 15
0
 /**
  * Wrapper to support old an new method to test integer value.
  *
  * @param integer $value
  * @param integer $min
  * @param integer $max
  * @param integer $default
  * @return integer
  */
 public static function forceIntegerInRange($value, $min, $max = 2000000, $default = 0)
 {
     if (version_compare(TYPO3_version, '4.6.0', '>=')) {
         $result = t3lib_utility_Math::forceIntegerInRange($value, $min, $max, $default);
     } else {
         $result = t3lib_div::intInRange($value, $min, $max, $default);
     }
     return $result;
 }
 /**
  * Wrapper for t3lib_div::intInRange (TYPO3 4.5)/t3lib_utility_Math::forceIntegerInRange (TYPO3 4.6+)
  *
  * @param $var mixed Any input variable to test
  * @return boolean Returns TRUE if string is an integer
  */
 public static function forceIntegerInRange($theInt, $min, $max = 2000000000, $defaultValue = 0)
 {
     if (version_compare(TYPO3_branch, '4.6', '<')) {
         return t3lib_div::intInRange($theInt, $min, $max, $defaultValue);
     }
     return t3lib_utility_Math::forceIntegerInRange($theInt, $min, $max, $defaultValue);
 }