/**
  * Rendering the cObject, HMENU
  *
  * @param	array		Array of TypoScript properties
  * @return	string		Output
  */
 public function render($conf = array())
 {
     $theValue = '';
     if ($this->cObj->checkIf($conf['if.'])) {
         $cls = strtolower($conf[1]);
         if (t3lib_div::inList($GLOBALS['TSFE']->tmpl->menuclasses, $cls)) {
             if (isset($conf['special.']['value.'])) {
                 $conf['special.']['value'] = $this->cObj->stdWrap($conf['special.']['value'], $conf['special.']['value.']);
             }
             $GLOBALS['TSFE']->register['count_HMENU']++;
             $GLOBALS['TSFE']->register['count_HMENU_MENUOBJ'] = 0;
             $GLOBALS['TSFE']->register['count_MENUOBJ'] = 0;
             $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'] = array();
             $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId'] = array();
             $menu = t3lib_div::makeInstance('tslib_' . $cls);
             $menu->parent_cObj = $this->cObj;
             $menu->start($GLOBALS['TSFE']->tmpl, $GLOBALS['TSFE']->sys_page, '', $conf, 1);
             $menu->makeMenu();
             $theValue .= $menu->writeMenu();
         }
         $wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
         if ($wrap) {
             $theValue = $this->cObj->wrap($theValue, $wrap);
         }
         if (isset($conf['stdWrap.'])) {
             $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
         }
     }
     return $theValue;
 }
 /**
  * Renders <f:then> child if BE user is allowed to edit given table, otherwise renders <f:else> child.
  *
  * @param string $table Name of the table
  * @return string the rendered string
  * @api
  */
 public function render($table)
 {
     if ($GLOBALS['BE_USER']->isAdmin() || t3lib_div::inList($GLOBALS['BE_USER']->groupData['tables_modify'], $table)) {
         return $this->renderThenChild();
     }
     return $this->renderElseChild();
 }
 /**
  * Validate ordering as extbase can't handle that currently
  *
  * @param string $fieldToCheck
  * @param string $allowedSettings
  * @return boolean
  */
 public static function isValidOrdering($fieldToCheck, $allowedSettings)
 {
     $isValid = TRUE;
     if (empty($fieldToCheck)) {
         return $isValid;
     } elseif (empty($allowedSettings)) {
         return FALSE;
     }
     $fields = t3lib_div::trimExplode(',', $fieldToCheck, TRUE);
     foreach ($fields as $field) {
         if ($isValid === TRUE) {
             $split = t3lib_div::trimExplode(' ', $field, TRUE);
             $count = count($split);
             switch ($count) {
                 case 1:
                     if (!t3lib_div::inList($allowedSettings, $split[0])) {
                         $isValid = FALSE;
                     }
                     break;
                 case 2:
                     if (strtolower($split[1]) !== 'desc' && strtolower($split[1]) !== 'asc' || !t3lib_div::inList($allowedSettings, $split[0])) {
                         $isValid = FALSE;
                     }
                     break;
                 default:
                     $isValid = FALSE;
             }
         }
     }
     return $isValid;
 }
 function listAvailableOrderingsForAdmin(&$config)
 {
     $this->init();
     $this->lang->init($GLOBALS['BE_USER']->uc['lang']);
     // get orderings
     $fieldLabel = $this->lang->sL('LLL:EXT:ke_search/locallang_db.php:tx_kesearch_index.relevance');
     $notAllowedFields = 'uid,pid,tstamp,crdate,cruser_id,starttime,endtime,fe_group,targetpid,content,params,type,tags,abstract,language,orig_uid,orig_pid,hash';
     if (!$config['config']['relevanceNotAllowed']) {
         $config['items'][] = array($fieldLabel . ' UP', 'score asc');
         $config['items'][] = array($fieldLabel . ' DOWN', 'score desc');
     }
     $res = $GLOBALS['TYPO3_DB']->sql_query('SHOW COLUMNS FROM tx_kesearch_index');
     while ($col = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         if (TYPO3_VERSION_INTEGER >= 7000000) {
             $isInList = TYPO3\CMS\Core\Utility\GeneralUtility::inList($notAllowedFields, $col['Field']);
         } else {
             $isInList = t3lib_div::inList($notAllowedFields, $col['Field']);
         }
         if (!$isInList) {
             $file = $GLOBALS['TCA']['tx_kesearch_index']['columns'][$col['Field']]['label'];
             $fieldLabel = $this->lang->sL($file);
             $config['items'][] = array($fieldLabel . ' UP', $col['Field'] . ' asc');
             $config['items'][] = array($fieldLabel . ' DOWN', $col['Field'] . ' desc');
         }
     }
 }
 function get_right_language_uid($lang_id)
 {
     $ext_conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['p2_realurl']);
     if (isset($ext_conf['language_uids']) && strlen(trim($ext_conf['language_uids']))) {
         if (t3lib_div::inList($ext_conf['language_uids'], $lang_id) || strtolower(trim($ext_conf['language_uids'])) == 'all') {
             // set language to default
             $lang_id = isset($ext_conf['default_language_uid']) ? intval($ext_conf['default_language_uid']) : 0;
         }
     }
     return $lang_id;
 }
 /**
  * Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
  *
  * @param	string		$string: The condition to match against its criterias.
  * @return	boolean		Whether the condition matched
  * @see t3lib_tsparser::parse()
  */
 protected function evaluateCondition($string)
 {
     list($key, $value) = t3lib_div::trimExplode('=', $string, FALSE, 2);
     $result = parent::evaluateConditionCommon($key, $value);
     if (is_bool($result)) {
         return $result;
     } else {
         switch ($key) {
             case 'usergroup':
                 $groupList = $this->getGroupList();
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 foreach ($values as $test) {
                     if ($test == '*' || t3lib_div::inList($groupList, $test)) {
                         return TRUE;
                     }
                 }
                 break;
             case 'adminUser':
                 if ($this->isUserLoggedIn()) {
                     $result = !((bool) $value xor $this->isAdminUser());
                     return $result;
                 }
                 break;
             case 'treeLevel':
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 $treeLevel = count($this->rootline) - 1;
                 // If a new page is being edited or saved the treeLevel is higher by one:
                 if ($this->isNewPageWithPageId($this->pageId)) {
                     $treeLevel++;
                 }
                 foreach ($values as $test) {
                     if ($test == $treeLevel) {
                         return TRUE;
                     }
                 }
                 break;
             case 'PIDupinRootline':
             case 'PIDinRootline':
                 $values = t3lib_div::trimExplode(',', $value, TRUE);
                 if ($key == 'PIDinRootline' || !in_array($this->pageId, $values) || $this->isNewPageWithPageId($this->pageId)) {
                     foreach ($values as $test) {
                         foreach ($this->rootline as $rl_dat) {
                             if ($rl_dat['uid'] == $test) {
                                 return TRUE;
                             }
                         }
                     }
                 }
                 break;
         }
     }
     return FALSE;
 }
 /**
  * Adding fe_users field list to selector box array
  * 
  * @param	array		Parameters, changing "items". Passed by reference.
  * @param	object		Parent object
  * @return	void		
  */
 function main(&$params, &$pObj)
 {
     global $TCA;
     t3lib_div::loadTCA('fe_users');
     $params['items'] = array();
     if (is_array($TCA['fe_users']['columns'])) {
         foreach ($TCA['fe_users']['columns'] as $key => $config) {
             if ($config['label'] && !t3lib_div::inList('password', $key)) {
                 $label = t3lib_div::fixed_lgd(ereg_replace(':$', '', $GLOBALS['LANG']->sL($config['label'])), 30) . ' (' . $key . ')';
                 $params['items'][] = array($label, $key);
             }
         }
     }
 }
 /**
  * Checks if a page is OK to include in the final menu item array. Pages can be excluded if the doktype is wrong, if they are hidden in navigation, have a uid in the list of banned uids etc.
  *
  * @param	array		Array of menu items
  * @param	array		Array of page uids which are to be excluded
  * @param	boolean		If set, then the page is a spacer.
  * @return	boolean		Returns true if the page can be safely included.
  */
 function filterMenuPages(&$data, $banUidArray, $spacer)
 {
     if ($data['_SAFE']) {
         return TRUE;
     }
     $uid = $data['uid'];
     if ($this->mconf['SPC'] || !$spacer) {
         // If the spacer-function is not enabled, spacers will not enter the $menuArr
         if (!t3lib_div::inList($this->doktypeExcludeList, $data['doktype'])) {
             // Page may not be 'not_in_menu' or 'Backend User Section'
             if (!$data['nav_hide'] || $this->conf['includeNotInMenu']) {
                 // Not hidden in navigation
                 if (!t3lib_div::inArray($banUidArray, $uid)) {
                     // not in banned uid's
                     // Checks if the default language version can be shown:
                     // Block page is set, if l18n_cfg allows plus: 1) Either default language or 2) another language but NO overlay record set for page!
                     $blockPage = $data['l18n_cfg'] & 1 && (!$GLOBALS['TSFE']->sys_language_uid || $GLOBALS['TSFE']->sys_language_uid && !$data['_PAGES_OVERLAY']);
                     if (!$blockPage) {
                         // Checking if a page should be shown in the menu depending on whether a translation exists:
                         $tok = TRUE;
                         if ($GLOBALS['TSFE']->sys_language_uid && t3lib_div::hideIfNotTranslated($data['l18n_cfg'])) {
                             // There is an alternative language active AND the current page requires a translation:
                             if (!$data['_PAGES_OVERLAY'] || $data['_PAGES_OVERLAY'] && $data['_PAGES_OVERLAY_LUID'] != $GLOBALS['TSFE']->sys_language_uid) {
                                 $tok = FALSE;
                             }
                         }
                         // Continue if token is true:
                         if ($tok) {
                             // Checking if "&L" should be modified so links to non-accessible pages will not happen.
                             if ($this->conf['protectLvar']) {
                                 $languageUid = intval($GLOBALS['TSFE']->config['config']['sys_language_uid']);
                                 if ($languageUid && ($this->conf['protectLvar'] == 'all' || t3lib_div::hideIfNotTranslated($data['l18n_cfg']))) {
                                     $olRec = $GLOBALS['TSFE']->sys_page->getPageOverlay($data['uid'], $languageUid);
                                     if (!count($olRec)) {
                                         // If no pages_language_overlay record then page can NOT be accessed in the language pointed to by "&L" and therefore we protect the link by setting "&L=0"
                                         $data['_ADD_GETVARS'] .= '&L=0';
                                     }
                                 }
                             }
                             return TRUE;
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * Obtains a xml parser instance.
  *
  * This function will return an instance of a class that implements
  * em_extensionxml_abstract_parser.
  *
  * TODO use autoload if possible (might require EM to be moved in a sysext)
  *
  * @access  public
  * @param   string	  $parserType: type of parser, one of extension and mirror
  * @param	string		$excludeClassNames: (optional) comma-separated list of class names
  * @return	em_extensionxml_abstract_parser	an instance of an extension.xml parser
  */
 public static function getParserInstance($parserType, $excludeClassNames = '')
 {
     if (!isset(self::$instance[$parserType]) || !is_object(self::$instance[$parserType]) || !empty($excludeClassNames)) {
         // reset instance
         self::$instance[$parserType] = $objParser = NULL;
         foreach (self::$parsers[$parserType] as $className => $file) {
             if (!t3lib_div::inList($excludeClassNames, $className)) {
                 //require_once(dirname(__FILE__) . '/' . $file);
                 $objParser = t3lib_div::makeInstance($className);
                 if ($objParser->isAvailable()) {
                     self::$instance[$parserType] =& $objParser;
                     break;
                 }
                 $objParser = NULL;
             }
         }
     }
     return self::$instance[$parserType];
 }
 /**
  * Function uses Portable PHP Hashing Framework to create a proper password string if needed
  *
  * @param	mixed		$value: The value that has to be checked.
  * @param	string		$is_in: Is-In String
  * @param	integer		$set: Determines if the field can be set (value correct) or not, e.g. if input is required but the value is empty, then $set should be set to FALSE. (PASSED BY REFERENCE!)
  * @return	The new value of the field
  */
 function evaluateFieldValue($value, $is_in, &$set)
 {
     $isEnabled = $this->mode ? tx_saltedpasswords_div::isUsageEnabled($this->mode) : tx_saltedpasswords_div::isUsageEnabled();
     if ($isEnabled) {
         $set = FALSE;
         $isMD5 = preg_match('/[0-9abcdef]{32,32}/', $value);
         $isSaltedHash = t3lib_div::inList('$1$,$2$,$2a,$P$', substr($value, 0, 3));
         $this->objInstanceSaltedPW = tx_saltedpasswords_salts_factory::getSaltingInstance(NULL, $this->mode);
         if ($isMD5) {
             $set = TRUE;
             $value = 'M' . $this->objInstanceSaltedPW->getHashedPassword($value);
         } else {
             if (!$isSaltedHash) {
                 $set = TRUE;
                 $value = $this->objInstanceSaltedPW->getHashedPassword($value);
             }
         }
     }
     return $value;
 }
 /**
  * Includes static template records from static_template table, loaded through a hook
  *
  * @param	string		A list of already processed template ids including the current; The list is on the form "[prefix]_[uid]" where [prefix] is "sys" for "sys_template" records, "static" for "static_template" records and "ext_" for static include files (from extensions). The list is used to check that the recursive inclusion of templates does not go into circles: Simply it is used to NOT include a template record/file which has already BEEN included somewhere in the recursion.
  * @param	string		The id of the current template. Same syntax as $idList ids, eg. "sys_123"
  * @param	array		The PID of the input template record
  * @param	array		A full TypoScript template record
  * @return	void
  */
 public function includeStaticTypoScriptSources(&$params, &$pObj)
 {
     // Static Template Records (static_template): include_static is a
     // list of static templates to include
     if (trim($params['row']['include_static'])) {
         $includeStaticArr = t3lib_div::intExplode(',', $params['row']['include_static']);
         // traversing list
         foreach ($includeStaticArr as $id) {
             // if $id is not already included ...
             if (!t3lib_div::inList($params['idList'], 'static_' . $id)) {
                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'static_template', 'uid = ' . intval($id));
                 // there was a template, then we fetch that
                 if ($subrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                     $subrow = $pObj->prependStaticExtra($subrow);
                     $pObj->processTemplate($subrow, $params['idList'] . ',static_' . $id, $params['pid'], 'static_' . $id, $params['templateId']);
                 }
                 $GLOBALS['TYPO3_DB']->sql_free_result($res);
             }
         }
     }
 }
 /**
  * Transformation handler: 'txdam_media' / direction: "rte"
  * Processing linked images from database content going into the RTE.
  * Processing includes converting the src attribute to an absolute URL.
  *
  * @param	string		Content input
  * @return	string		Content output
  */
 function transform_rte($value, &$pObj)
 {
     // Split content by the TYPO3 pseudo tag "<media>":
     $blockSplit = $pObj->splitIntoBlock('media', $value, 1);
     foreach ($blockSplit as $k => $v) {
         $error = '';
         if ($k % 2) {
             // block:
             $tagCode = t3lib_div::unQuoteFilenames(trim(substr($pObj->getFirstTag($v), 0, -1)), true);
             $link_param = $tagCode[1];
             $href = '';
             $useDAMColumn = FALSE;
             // Checking if the id-parameter is int and get meta data
             if (t3lib_div::testInt($link_param)) {
                 $meta = tx_dam::meta_getDataByUid($link_param);
             }
             if (is_array($meta)) {
                 $href = tx_dam::file_url($meta);
                 if (!$tagCode[4]) {
                     require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
                     $displayItems = '';
                     if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn']) {
                         $displayItems = $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn.']['displayItems'] ? $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn.']['displayItems'] : '';
                         $useDAMColumn = TRUE;
                     }
                     $tagCode[4] = tx_dam_guiFunc::meta_compileHoverText($meta, $displayItems, ', ');
                 }
             } else {
                 $href = $link_param;
                 $error = 'No media file found: ' . $link_param;
             }
             // Setting the A-tag:
             $bTag = '<a href="' . htmlspecialchars($href) . '" txdam="' . htmlspecialchars($link_param) . '"' . ($tagCode[2] && $tagCode[2] != '-' ? ' target="' . htmlspecialchars($tagCode[2]) . '"' : '') . ($tagCode[3] && $tagCode[3] != '-' ? ' class="' . htmlspecialchars($tagCode[3]) . '"' : '') . ($tagCode[4] ? ' title="' . htmlspecialchars($tagCode[4]) . '"' : '') . ($useDAMColumn ? ' usedamcolumn="true"' : '') . ($error ? ' rteerror="' . htmlspecialchars($error) . '" style="background-color: yellow; border:2px red solid; color: black;"' : '') . '>';
             $eTag = '</a>';
             $blockSplit[$k] = $bTag . $this->transform_rte($pObj->removeFirstAndLastTag($blockSplit[$k]), $pObj) . $eTag;
         }
     }
     $value = implode('', $blockSplit);
     return $value;
 }
 /**
  * Retrieve a collection (array) of tx_templavoila_datastructure objects
  *
  * @param integer $pid
  * @param integer $scope
  * @return array
  */
 public function getDatastructuresByStoragePidAndScope($pid, $scope)
 {
     $dscollection = array();
     $confArr = self::getStaticDatastructureConfiguration();
     if (count($confArr)) {
         foreach ($confArr as $key => $conf) {
             if ($conf['scope'] == $scope) {
                 $ds = $this->getDatastructureByUidOrFilename($conf['path']);
                 $pids = $ds->getStoragePids();
                 if ($pids == '' || t3lib_div::inList($pids, $pid)) {
                     $dscollection[] = $ds;
                 }
             }
         }
     }
     if (!self::isStaticDsEnabled()) {
         $dsRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', 'tx_templavoila_datastructure', 'scope=' . intval($scope) . ' AND pid=' . intval($pid) . t3lib_BEfunc::deleteClause('tx_templavoila_datastructure') . ' AND pid!=-1 ' . t3lib_BEfunc::versioningPlaceholderClause('tx_templavoila_datastructure'));
         foreach ($dsRows as $ds) {
             $dscollection[] = $this->getDatastructureByUidOrFilename($ds['uid']);
         }
     }
     usort($dscollection, array($this, 'sortDatastructures'));
     return $dscollection;
 }
    /**
     * 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));
        }
    }
    /**
     * View result
     *
     * @return    HTML with filelist and fileview
     */
    function view_result()
    {
        $this->makeFilesArray($this->saveKey);
        $keyA = array_keys($this->fileArray);
        asort($keyA);
        $filesOverview1 = array();
        $filesOverview2 = array();
        $filesContent = array();
        $filesOverview1[] = '<tr' . $this->bgCol(1) . '>
			<td><strong>' . $this->fw('Filename:') . '</strong></td>
			<td><strong>' . $this->fw('Size:') . '</strong></td>
			<td><strong>' . $this->fw('&nbsp;') . '</strong></td>
			<td><strong>' . $this->fw('Overwrite:') . '</strong></td>
		</tr>';
        foreach ($keyA as $fileName) {
            $data = $this->fileArray[$fileName];
            $fI = pathinfo($fileName);
            if (t3lib_div::inList('php,sql,txt,xml', strtolower($fI['extension']))) {
                $linkToFile = '<strong><a href="#' . md5($fileName) . '">' . $this->fw("&nbsp;View&nbsp;") . '</a></strong>';
                if ($fI['extension'] == 'xml') {
                    $data['content'] = $GLOBALS['LANG']->csConvObj->utf8_decode($data['content'], $GLOBALS['LANG']->charSet);
                }
                $filesContent[] = '<tr' . $this->bgCol(1) . '>
				<td><a name="' . md5($fileName) . '"></a><strong>' . $this->fw($fileName) . '</strong></td>
				</tr>
				<tr>
					<td>' . $this->preWrap($data['content'], $fI['extension']) . '</td>
				</tr>';
            } else {
                $linkToFile = $this->fw('&nbsp;');
            }
            $line = '<tr' . $this->bgCol(2) . '>
				<td>' . $this->fw($fileName) . '</td>
				<td>' . $this->fw(t3lib_div::formatSize($data['size'])) . '</td>
				<td>' . $linkToFile . '</td>
				<td>';
            if ($fileName == 'doc/wizard_form.dat' || $fileName == 'doc/wizard_form.html') {
                $line .= '<input type="hidden" name="' . $this->piFieldName('wizArray_upd') . '[save][overwrite_files][' . $fileName . ']" value="1" />';
            } else {
                $checked = '';
                if (!is_array($this->wizArray['save']['overwrite_files']) || isset($this->wizArray['save']['overwrite_files'][$fileName]) && $this->wizArray['save']['overwrite_files'][$fileName] == '1' || !isset($this->wizArray['save']['overwrite_files'][$fileName])) {
                    $checked = ' checked="checked"';
                }
                $line .= '<input type="hidden" name="' . $this->piFieldName('wizArray_upd') . '[save][overwrite_files][' . $fileName . ']" value="0" />';
                $line .= '<input type="checkbox" name="' . $this->piFieldName('wizArray_upd') . '[save][overwrite_files][' . $fileName . ']" value="1"' . $checked . ' />';
            }
            $line .= '</td>
			</tr>';
            if (strstr($fileName, '/')) {
                $filesOverview2[] = $line;
            } else {
                $filesOverview1[] = $line;
            }
        }
        $content = '<table border="0" cellpadding="1" cellspacing="2">' . implode('', $filesOverview1) . implode('', $filesOverview2) . '</table>';
        $content .= '<br /><input type="submit" name="' . $this->piFieldName('updateResult') . '" value="Update result" /><br />';
        $content .= $this->fw('<br /><strong>Author name:</strong> ' . $this->wizArray['emconf'][1]['author'] . '
							<br /><strong>Author email:</strong> ' . $this->wizArray['emconf'][1]['author_email']);
        $content .= '<br /><br />';
        if (!$this->EMmode) {
            $content .= '<input type="submit" name="' . $this->piFieldName('WRITE') . '" value="WRITE to \'' . $this->saveKey . '\'" />';
        } else {
            // $content.='
            // 	<strong>'.$this->fw('Write to location:').'</strong><br />
            // 	<select name="'.$this->piFieldName('loc').'">'.
            // 		'<option value="L" selected="selected">Local: '.$this->pObj->typePaths['L'].$this->saveKey.'/'.(@is_dir(PATH_site.$this->pObj->typePaths['L'].$this->saveKey)?' (OVERWRITE)':' (empty)').'</option>':'').
            // 	'</select>
            // 	<input type="submit" name="'.$this->piFieldName('WRITE').'" value="WRITE" onclick="return confirm(\'If the setting in the selectorbox says OVERWRITE\nthen the marked files of the current extension in that location will be OVERRIDDEN! \nPlease decide if you want to continue.\n\n(Remember, this is a *kickstarter* - NOT AN editor!)\');" />
            // ';
        }
        $this->afterContent = '<br /><table border="0" cellpadding="1" cellspacing="2">' . implode('', $filesContent) . '</table>';
        return $content;
    }
	/**
	 * Gets the value of current language
	 *
	 * @return	integer		Current language or 0
	 */
	function getLanguageVar() {
		$lang = 0;
		// Setting the language variable based on GETvar in URL which has been configured to carry the language uid:
		if ($this->conf['languageGetVar'] && isset($this->pObj->orig_paramKeyValues[$this->conf['languageGetVar']])) {
			$lang = intval($this->pObj->orig_paramKeyValues[$this->conf['languageGetVar']]);

			// Might be excepted (like you should for CJK cases which does not translate to ASCII equivalents)
			if (t3lib_div::inList($this->conf['languageExceptionUids'], $lang)) {
				$lang = 0;
			}
		}
		else {
			// No language in URL, get default from TSFE
			$lang = intval($GLOBALS['TSFE']->config['config']['sys_language_uid']);
		}
		//debug(array('lang' => $lang, 'languageGetVar' => $this->conf['languageGetVar'], 'opkv' => $this->$this->pObj->orig_paramKeyValues[$this->conf['languageGetVar']]), 'realurl');
		return $lang;
	}
 /**
  * Main function, adding items to the click menu array.
  *
  * @param	object		Reference to the parent object of the clickmenu class which calls this function
  * @param	array		The current array of menu items - you have to add or remove items to this array in this function. Thats the point...
  * @param	string		The database table OR filename
  * @param	integer		For database tables, the UID
  * @return	array		The modified menu array.
  */
 function main(&$backRef, $menuItems, $table, $uid)
 {
     global $BE_USER, $LANG, $TYPO3_DB;
     $localItems = array();
     if (!$backRef->cmLevel) {
         $LL = $LANG->includeLLFile(t3lib_extMgm::extPath('templavoila') . 'locallang.xml', 0);
         // Adding link for Mapping tool:
         if (@is_file($table)) {
             if ($BE_USER->isAdmin()) {
                 if (function_exists('finfo_open')) {
                     $finfoMode = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
                     $fi = finfo_open($finfoMode);
                     $mimeInformation = @finfo_file($fi, $table);
                     $enabled = FALSE;
                     if (t3lib_div::isFirstPartOfStr($mimeInformation, 'text/html') || t3lib_div::isFirstPartOfStr($mimeInformation, 'application/xml')) {
                         $enabled = TRUE;
                     }
                     finfo_close($fi);
                 } else {
                     $pi = @pathinfo($table);
                     $enabled = preg_match('/(html?|tmpl|xml)/', $pi['extension']);
                 }
                 if ($enabled) {
                     $url = t3lib_extMgm::extRelPath('templavoila') . 'cm1/index.php?file=' . rawurlencode($table);
                     $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_title', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
                 }
             }
         } elseif (t3lib_div::inList('tx_templavoila_tmplobj,tx_templavoila_datastructure,tx_templavoila_content', $table)) {
             $url = t3lib_extMgm::extRelPath('templavoila') . 'cm1/index.php?table=' . rawurlencode($table) . '&uid=' . $uid . '&_reload_from=1';
             $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_title', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
         }
         $isTVelement = ('tt_content' == $table && $backRef->rec['CType'] == 'templavoila_pi1' || 'pages' == $table) && $backRef->rec['tx_templavoila_flex'];
         // Adding link for "View: Sub elements":
         if ($table == 'tt_content' && $isTVelement) {
             $localItems = array();
             $url = t3lib_extMgm::extRelPath('templavoila') . 'mod1/index.php?id=' . intval($backRef->rec['pid']) . '&altRoot[table]=' . rawurlencode($table) . '&altRoot[uid]=' . $uid . '&altRoot[field_flex]=tx_templavoila_flex';
             $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_viewsubelements', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
         }
         // Adding link for "View: Flexform XML" (admin only):
         if ($BE_USER->isAdmin() && $isTVelement) {
             $url = t3lib_extMgm::extRelPath('templavoila') . 'cm2/index.php?' . '&viewRec[table]=' . rawurlencode($table) . '&viewRec[uid]=' . $uid . '&viewRec[field_flex]=tx_templavoila_flex';
             $localItems[] = $backRef->linkItem($LANG->getLLL('cm1_viewflexformxml', $LL, 1), $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm2/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
         }
         // Adding link for "View: DS/TO" (admin only):
         if ($BE_USER->isAdmin() && $isTVelement) {
             if (tx_templavoila_div::canBeInterpretedAsInteger($backRef->rec['tx_templavoila_ds'])) {
                 $url = t3lib_extMgm::extRelPath('templavoila') . 'cm1/index.php?' . 'table=tx_templavoila_datastructure&uid=' . $backRef->rec['tx_templavoila_ds'];
                 $localItems[] = $backRef->linkItem($LANG->getLLL('cm_viewdsto', $LL, 1) . ' [' . $backRef->rec['tx_templavoila_ds'] . '/' . $backRef->rec['tx_templavoila_to'] . ']', $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('templavoila') . 'cm2/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), $backRef->urlRefForCM($url, 'returnUrl'), 1);
             }
         }
         #			if ($table=='tt_content') {
         #					// Adding link for "Pages using this element":
         #				$localItems[] = $backRef->linkItem(
         #					$LANG->getLLL('cm1_pagesusingthiselement',$LL),
         #					$backRef->excludeIcon('<img src="'.t3lib_extMgm::extRelPath('templavoila').'cm1/cm_icon_activate.gif" width="15" height="12" border=0 align=top>'),
         #					"top.loadTopMenu('".t3lib_div::linkThisScript()."&cmLevel=1&subname=tx_templavoila_cm1_pagesusingthiselement');return false;",
         #					0,
         #					1
         #				);
         #			}
     } else {
         if (t3lib_div::_GP('subname') == 'tx_templavoila_cm1_pagesusingthiselement') {
             $menuItems = array();
             $url = t3lib_extMgm::extRelPath('templavoila') . 'mod1/index.php?id=';
             // Generate a list of pages where this element is also being used:
             $res = $TYPO3_DB->exec_SELECTquery('*', 'tx_templavoila_elementreferences', 'uid=' . $backRef->rec['uid']);
             if ($res) {
                 while (false != ($referenceRecord = $TYPO3_DB->sql_fetch_assoc($res))) {
                     $pageRecord = t3lib_beFunc::getRecord('pages', $referenceRecord['pid']);
                     $icon = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord);
                     // To do: Display language flag icon and jump to correct language
                     #						if ($referenceRecord['lkey'] != 'lDEF') {
                     #							$icon .= ' lKey:'.$referenceRecord['lkey'];
                     #						} elseif ($referenceRecord['vkey'] != 'vDEF') {
                     #							$icon .= ' vKey:'.$referenceRecord['vkey'];
                     #						}
                     if (is_array($pageRecord)) {
                         $menuItems[] = $backRef->linkItem($icon, t3lib_beFunc::getRecordTitle('pages', $pageRecord, 1), $backRef->urlRefForCM($url . $pageRecord['uid'], 'returnUrl'), 1);
                     }
                 }
             }
         }
     }
     // Simply merges the two arrays together and returns ...
     if (count($localItems)) {
         $menuItems = array_merge($menuItems, $localItems);
     }
     return $menuItems;
 }
示例#18
0
 /**
  * @param $lConf
  */
 function initCatmenuEnv(&$lConf)
 {
     if ($lConf['catOrderBy']) {
         $this->config['catOrderBy'] = $lConf['catOrderBy'];
     }
     if ($this->catExclusive) {
         $this->catlistWhere = ' AND tt_news_cat.uid' . ($this->config['categoryMode'] < 0 ? ' NOT' : '') . ' IN (' . $this->catExclusive . ')';
     } else {
         if ($lConf['excludeList']) {
             $this->catlistWhere = ' AND tt_news_cat.uid NOT IN (' . implode(t3lib_div::intExplode(',', $lConf['excludeList']), ',') . ')';
         }
         if ($lConf['includeList']) {
             $this->catlistWhere .= ' AND tt_news_cat.uid IN (' . implode(t3lib_div::intExplode(',', $lConf['includeList']), ',') . ')';
         }
     }
     if ($lConf['includeList'] || $lConf['excludeList'] || $this->catExclusive) {
         // MOUNTS (in tree mode) must only contain the main/parent categories. Therefore it is required to filter out the subcategories from $this->catExclusive or $lConf['includeList']
         $categoryMounts = $this->catExclusive ? $this->catExclusive : $lConf['includeList'];
         $tmpres = $this->db->exec_SELECTquery('uid,parent_category', 'tt_news_cat', 'tt_news_cat.uid IN (' . $categoryMounts . ')' . $this->SPaddWhere . $this->enableCatFields, '', 'tt_news_cat.' . $this->config['catOrderBy']);
         $this->cleanedCategoryMounts = array();
         if ($tmpres) {
             while ($tmprow = $this->db->sql_fetch_assoc($tmpres)) {
                 if (!t3lib_div::inList($categoryMounts, $tmprow['parent_category'])) {
                     $this->dontStartFromRootRecord = true;
                     $this->cleanedCategoryMounts[] = $tmprow['uid'];
                 }
             }
         }
     }
 }
示例#19
0
 /**
  * Returns a selector-box with TCA tables
  *
  * @param	string		Form element name prefix
  * @param	array		The current values selected
  * @param	string		Table names (and the string "_ALL") to exclude. Comma list
  * @return	string		HTML select element
  */
 function tableSelector($prefix, $value, $excludeList = '')
 {
     global $TCA, $LANG;
     $optValues = array();
     if (!t3lib_div::inList($excludeList, '_ALL')) {
         $optValues['_ALL'] = '[' . $LANG->getLL('ALL_tables') . ']';
     }
     foreach ($TCA as $table => $_) {
         if ($GLOBALS['BE_USER']->check('tables_select', $table) && !t3lib_div::inList($excludeList, $table)) {
             $optValues[$table] = $table;
         }
     }
     // make box:
     $opt = array();
     $opt[] = '<option value=""></option>';
     foreach ($optValues as $k => $v) {
         if (is_array($value)) {
             $sel = in_array($k, $value) ? ' selected="selected"' : '';
         }
         $opt[] = '<option value="' . htmlspecialchars($k) . '"' . $sel . '>' . htmlspecialchars($v) . '</option>';
     }
     return '<select name="' . $prefix . '[]" multiple="multiple" size="' . t3lib_div::intInRange(count($opt), 5, 10) . '">' . implode('', $opt) . '</select>';
 }
    /**
     * Renders the extension PHP code; this was
     *
     * @param	string		$k: module name key
     * @param	array		$config: module configuration
     * @param	string		$extKey: extension key
     * @return	void
     */
    function render_extPart($k, $config, $extKey)
    {
        $WOP = '[pi][' . $k . ']';
        $cN = $this->returnName($extKey, 'class', 'pi' . $k);
        $pathSuffix = 'pi' . $k . '/';
        $setType = '';
        switch ($config['addType']) {
            case 'list_type':
                $setType = 'list_type';
                $this->wizard->ext_tables[] = $this->sPS('
					' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\$TCA['tt_content']['types']['list']['subtypes_excludelist'][\$_EXTKEY.'_pi" . $k . "']='layout,select_key,pages';\n\t\t\t\t\t" . ($config['apply_extended'] ? "\$TCA['tt_content']['types']['list']['subtypes_addlist'][\$_EXTKEY.'_pi" . $k . "']='" . $this->wizard->_apply_extended_types[$config['apply_extended']] . "';" : "") . "\n\t\t\t\t");
                //				$this->wizard->ext_localconf[]=$this->sPS('
                //					'.$this->WOPcomment('WOP:'.$WOP.'[addType] / '.$WOP.'[tag_name]')."
                //					  ## Extending TypoScript from static template uid=43 to set up userdefined tag:
                //					t3lib_extMgm::addTypoScript(\$_EXTKEY,'editorcfg','
                //						tt_content.CSS_editor.ch.".$cN." = < plugin.".$cN.".CSS_editor
                //					',43);
                //				");
                break;
            case 'textbox':
                $setType = 'splash_layout';
                if ($config['apply_extended']) {
                    $this->wizard->ext_tables[] = $this->sPS('
						' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\t\$TCA['tt_content']['types']['splash']['subtype_value_field']='splash_layout';\n\t\t\t\t\t\t\$TCA['tt_content']['types']['splash']['subtypes_addlist'][\$_EXTKEY.'_pi" . $k . "']='" . $this->wizard->_apply_extended_types[$config['apply_extended']] . "';\n\t\t\t\t\t");
                }
                break;
            case 'menu_sitemap':
                $setType = 'menu_type';
                if ($config['apply_extended']) {
                    $this->wizard->ext_tables[] = $this->sPS('
						' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\t\$TCA['tt_content']['types']['menu']['subtype_value_field']='menu_type';\n\t\t\t\t\t\t\$TCA['tt_content']['types']['menu']['subtypes_addlist'][\$_EXTKEY.'_pi" . $k . "']='" . $this->wizard->_apply_extended_types[$config['apply_extended']] . "';\n\t\t\t\t\t");
                }
                break;
            case 'ce':
                $setType = 'CType';
                $tFields = array();
                $tFields[] = 'CType;;4;button;1-1-1, header;;3;;2-2-2';
                if ($config['apply_extended']) {
                    $tFields[] = $this->wizard->_apply_extended_types[$config['apply_extended']];
                }
                $this->wizard->ext_tables[] = $this->sPS('
					' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\t\tt3lib_div::loadTCA('tt_content');\n\t\t\t\t\t\$TCA['tt_content']['types'][\$_EXTKEY . '_pi" . $k . "']['showitem'] = '" . implode(', ', $tFields) . "';\n\t\t\t\t");
                break;
            case 'header':
                $setType = 'header_layout';
                break;
            case 'includeLib':
                if ($config['plus_user_ex']) {
                    $setType = 'includeLib';
                }
                break;
            case 'typotags':
                $tagName = preg_replace('/[^a-z0-9_]/', '', strtolower($config['tag_name']));
                if ($tagName) {
                    $this->wizard->ext_localconf[] = $this->sPS('
						' . $this->WOPcomment('WOP:' . $WOP . '[addType] / ' . $WOP . '[tag_name]') . "\n\t\t\t\t\t\t  ## Extending TypoScript from static template uid=43 to set up userdefined tag:\n\t\t\t\t\t\tt3lib_extMgm::addTypoScript(\$_EXTKEY,'setup','\n\t\t\t\t\t\t\ttt_content.text.20.parseFunc.tags." . $tagName . " = < plugin.'.t3lib_extMgm::getCN(\$_EXTKEY).'_pi" . $k . "\n\t\t\t\t\t\t',43);\n\t\t\t\t\t");
                }
                break;
            default:
                break;
        }
        $cache = $config['plus_user_obj'] ? 0 : 1;
        $this->wizard->ext_localconf[] = $this->sPS('
			' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\tt3lib_extMgm::addPItoST43(\$_EXTKEY, 'pi" . $k . "/class." . $cN . ".php', '_pi" . $k . "', '" . $setType . "', " . $cache . ");\n\t\t");
        if ($setType && !t3lib_div::inList('typotags,includeLib', $setType)) {
            $this->wizard->ext_tables[] = $this->sPS('
				' . $this->WOPcomment('WOP:' . $WOP . '[addType]') . "\n\t\t\t\tt3lib_extMgm::addPlugin(array(\n\t\t\t\t\t'" . addslashes($this->getSplitLabels_reference($config, 'title', 'tt_content.' . $setType . '_pi' . $k)) . "',\n\t\t\t\t\t\$_EXTKEY . '_pi" . $k . "',\n\t\t\t\t\tt3lib_extMgm::extRelPath(\$_EXTKEY) . 'ext_icon.gif'\n\t\t\t\t),'" . $setType . "');\n\t\t\t");
        }
        // Make Plugin class:
        switch ($config['addType']) {
            case 'list_type':
                if ($config['list_default']) {
                    if (is_array($this->wizard->wizArray['tables'][$config['list_default']])) {
                        $tempTableConf = $this->wizard->wizArray['tables'][$config['list_default']];
                        $tableName = $this->returnName($extKey, 'tables', $tempTableConf['tablename']);
                        $ll = array();
                        $theLines = array();
                        $theLines['getListRow'] = array();
                        $theLines['getListHeader'] = array();
                        $theLines['getFieldContent'] = array();
                        $theLines['getFieldHeader'] = array();
                        $theLines['singleRows'] = array();
                        $theLines['listItemRows'] = array();
                        $theLines['singleRows_section'] = array();
                        $P_classes = array();
                        $theLines['searchFieldList'] = array();
                        $theLines['orderByList'] = array();
                        $tcol = 'uid';
                        $theLines['getListRow'][$tcol] = '<td><p>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p></td>';
                        $theLines['getListHeader'][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink(\'' . $tcol . '\').\'</p></td>';
                        $theLines['orderByList'][$tcol] = $tcol;
                        if (is_array($tempTableConf['fields'])) {
                            reset($tempTableConf['fields']);
                            while (list(, $fC) = each($tempTableConf['fields'])) {
                                $tcol = $fC['fieldname'];
                                if ($tcol) {
                                    $theLines['singleRows'][$tcol] = trim($this->sPS('
										<tr>
											<td nowrap="nowrap" valign="top"\'.$this->pi_classParam(\'singleView-HCell\').\'><p>\'.$this->getFieldHeader(\'' . $tcol . '\').\'</p></td>
											<td valign="top"><p>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p></td>
										</tr>
									'));
                                    if ($this->fieldIsRTE($fC)) {
                                        $theLines['singleRows_section'][$tcol] = trim($this->sPS('
											\'.$this->getFieldContent(\'' . $tcol . '\').\'
										'));
                                    } else {
                                        $tempN = 'singleViewField-' . str_replace('_', '-', $tcol);
                                        $theLines['singleRows_section'][$tcol] = trim($this->sPS('
											<p\'.$this->pi_classParam("' . $tempN . '").\'><strong>\'.$this->getFieldHeader(\'' . $tcol . '\').\':</strong> \'.$this->getFieldContent(\'' . $tcol . '\').\'</p>
										'));
                                        $P_classes['SV'][] = $tempN;
                                    }
                                    if (!strstr($fC['type'], 'textarea')) {
                                        $theLines['getListRow'][$tcol] = '<td valign="top"><p>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p></td>';
                                        $theLines['getListHeader'][$tcol] = '<td nowrap><p>\'.$this->getFieldHeader(\'' . $tcol . '\').\'</p></td>';
                                        $tempN = 'listrowField-' . str_replace('_', '-', $tcol);
                                        $theLines['listItemRows'][$tcol] = trim($this->sPS('
											<p\'.$this->pi_classParam(\'' . $tempN . '\').\'>\'.$this->getFieldContent(\'' . $tcol . '\').\'</p>
										'));
                                        $P_classes['LV'][] = $tempN;
                                    }
                                    $this->addLocalConf($ll, array('listFieldHeader_' . $tcol => $fC['title']), 'listFieldHeader_' . $tcol, 'pi', $k, 1, 1);
                                    if ($tcol == 'title') {
                                        $theLines['getFieldContent'][$tcol] = trim($this->sPS('
												case "' . $tcol . '":
														// This will wrap the title in a link.
													return $this->pi_list_linkSingle($this->internal[\'currentRow\'][\'' . $tcol . '\'],$this->internal[\'currentRow\'][\'uid\'],1);
												break;
										'));
                                        $theLines['getFieldHeader'][$tcol] = trim($this->sPS('
												case "' . $tcol . '":
													return $this->pi_getLL(\'listFieldHeader_' . $tcol . '\',\'<em>' . $tcol . '</em>\');
												break;
										'));
                                    } elseif ($this->fieldIsRTE($fC)) {
                                        $theLines['getFieldContent'][$tcol] = trim($this->sPS('
													case "' . $tcol . '":
														return $this->pi_RTEcssText($this->internal[\'currentRow\'][\'' . $tcol . '\']);
													break;
											'));
                                    } elseif ($fC['type'] == 'datetime') {
                                        $theLines['getFieldContent'][$tcol] = trim($this->sPS('
												case "' . $tcol . '":
													return strftime(\'%d-%m-%y %H:%M:%S\',$this->internal[\'currentRow\'][\'' . $tcol . '\']);
												break;
										'));
                                    } elseif ($fC['type'] == 'date') {
                                        $theLines['getFieldContent'][$tcol] = trim($this->sPS('
												case "' . $tcol . '":
														// For a numbers-only date, use something like: %d-%m-%y
													return strftime(\'%A %e. %B %Y\',$this->internal[\'currentRow\'][\'' . $tcol . '\']);
												break;
										'));
                                    }
                                    if (strstr($fC['type'], 'input')) {
                                        $theLines['getListHeader'][$tcol] = '<td><p>\'.$this->getFieldHeader_sortLink(\'' . $tcol . '\').\'</p></td>';
                                        $theLines['orderByList'][$tcol] = $tcol;
                                    }
                                    if (strstr($fC['type'], 'input') || strstr($fC['type'], 'textarea')) {
                                        $theLines['searchFieldList'][$tcol] = $tcol;
                                    }
                                }
                            }
                        }
                        $theLines['singleRows']['tstamp'] = trim($this->sPS('
							<tr>
								<td nowrap\'.$this->pi_classParam(\'singleView-HCell\').\'><p>Last updated:</p></td>
								<td valign="top"><p>\'.date(\'d-m-Y H:i\',$this->internal[\'currentRow\'][\'tstamp\']).\'</p></td>
							</tr>
						'));
                        $theLines['singleRows']['crdate'] = trim($this->sPS('
							<tr>
								<td nowrap\'.$this->pi_classParam(\'singleView-HCell\').\'><p>Created:</p></td>
								<td valign="top"><p>\'.date(\'d-m-Y H:i\',$this->internal[\'currentRow\'][\'crdate\']).\'</p></td>
							</tr>
						'));
                        // Add title to local lang file
                        $ll = $this->addStdLocalLangConf($ll, $k);
                        $this->addLocalLangFile($ll, $pathSuffix . 'locallang.xml', 'Language labels for plugin "' . $cN . '"');
                        $innerMainContent = $this->sPS('
							/**
							 * Main method of your PlugIn
							 *
							 * @param	string		$content: The content of the PlugIn
							 * @param	array		$conf: The PlugIn Configuration
							 * @return	The content that should be displayed on the website
							 */
							function main($content, $conf)	{
								switch((string)$conf[\'CMD\'])	{
									case \'singleView\':
										list($t) = explode(\':\',$this->cObj->currentRecord);
										$this->internal[\'currentTable\']=$t;
										$this->internal[\'currentRow\']=$this->cObj->data;
										return $this->pi_wrapInBaseClass($this->singleView($content, $conf));
									break;
									default:
										if (strstr($this->cObj->currentRecord,\'tt_content\'))	{
											$conf[\'pidList\'] = $this->cObj->data[\'pages\'];
											$conf[\'recursive\'] = $this->cObj->data[\'recursive\'];
										}
										return $this->pi_wrapInBaseClass($this->listView($content, $conf));
									break;
								}
							}
						');
                        $innerMainContent .= $this->sPS('
							/**
							 * Shows a list of database entries
							 *
							 * @param	string		$content: content of the PlugIn
							 * @param	array		$conf: PlugIn Configuration
							 * @return	HTML list of table entries
							 */
							function listView($content, $conf) {
								$this->conf = $conf;		// Setting the TypoScript passed to this function in $this->conf
								$this->pi_setPiVarDefaults();
								$this->pi_loadLL();		// Loading the LOCAL_LANG values
								' . (!$cache ? '$this->pi_USER_INT_obj = 1;	// Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . '
								$lConf = $this->conf[\'listView.\'];	// Local settings for the listView function

								if (is_numeric($this->piVars[\'showUid\']))	{	// If a single element should be displayed:
									$this->internal[\'currentTable\'] = \'' . $tableName . '\';
									$this->internal[\'currentRow\'] = $this->pi_getRecord(\'' . $tableName . '\',$this->piVars[\'showUid\']);

									$content = $this->singleView($content, $conf);
									return $content;
								} else {
									$items=array(
										\'1\'=> $this->pi_getLL(\'list_mode_1\',\'Mode 1\'),
										\'2\'=> $this->pi_getLL(\'list_mode_2\',\'Mode 2\'),
										\'3\'=> $this->pi_getLL(\'list_mode_3\',\'Mode 3\'),
									);
									if (!isset($this->piVars[\'pointer\']))	$this->piVars[\'pointer\']=0;
									if (!isset($this->piVars[\'mode\']))	$this->piVars[\'mode\']=1;

										// Initializing the query parameters:
									list($this->internal[\'orderBy\'],$this->internal[\'descFlag\']) = explode(\':\',$this->piVars[\'sort\']);
									$this->internal[\'results_at_a_time\']=t3lib_div::intInRange($lConf[\'results_at_a_time\'],0,1000,3);		// Number of results to show in a listing.
									$this->internal[\'maxPages\']=t3lib_div::intInRange($lConf[\'maxPages\'],0,1000,2);;		// The maximum number of "pages" in the browse-box: "Page 1", "Page 2", etc.
									$this->internal[\'searchFieldList\']=\'' . implode(',', $theLines['searchFieldList']) . '\';
									$this->internal[\'orderByList\']=\'' . implode(',', $theLines['orderByList']) . '\';

										// Get number of records:
									$res = $this->pi_exec_query(\'' . $tableName . '\',1);
									list($this->internal[\'res_count\']) = $GLOBALS[\'TYPO3_DB\']->sql_fetch_row($res);

										// Make listing query, pass query to SQL database:
									$res = $this->pi_exec_query(\'' . $tableName . '\');
									$this->internal[\'currentTable\'] = \'' . $tableName . '\';

										// Put the whole list together:
									$fullTable=\'\';	// Clear var;
								#	$fullTable.=t3lib_div::view_array($this->piVars);	// DEBUG: Output the content of $this->piVars for debug purposes. REMEMBER to comment out the IP-lock in the debug() function in t3lib/config_default.php if nothing happens when you un-comment this line!

										// Adds the mode selector.
									$fullTable.=$this->pi_list_modeSelector($items);

										// Adds the whole list table
									$fullTable.=' . ($config['list_default_listmode'] ? '$this->makelist($res);' : '$this->pi_list_makelist($res);') . '

										// Adds the search box:
									$fullTable.=$this->pi_list_searchBox();

										// Adds the result browser:
									$fullTable.=$this->pi_list_browseresults();

										// Returns the content from the plugin.
									return $fullTable;
								}
							}
						');
                        if ($config['list_default_listmode']) {
                            $innerMainContent .= $this->wrapBody('
								/**
								 * Creates a list from a database query
								 *
								 * @param	ressource	$res: A database result ressource
								 * @return	A HTML list if result items
								 */
								function makelist($res)	{
									$items=array();
										// Make list table rows
									while($this->internal[\'currentRow\'] = $GLOBALS[\'TYPO3_DB\']->sql_fetch_assoc($res))	{
										$items[]=$this->makeListItem();
									}

									$out = \'<div\'.$this->pi_classParam(\'listrow\').\'>
										\'.implode(chr(10),$items).\'
										</div>\';
									return $out;
								}

								/**
								 * Implodes a single row from a database to a single line
								 *
								 * @return	Imploded column values
								 */
								function makeListItem()	{
									$out=\'
										', implode(chr(10), $theLines['listItemRows']), '
										\';
									return $out;
								}
							', 3);
                        }
                        // Single display:
                        if ($config['list_default_singlemode']) {
                            $innerMainContent .= $this->wrapBody('
								/**
								 * Display a single item from the database
								 *
								 * @param	string		$content: The PlugIn content
								 * @param	array		$conf: The PlugIn configuration
								 * @return	HTML of a single database entry
								 */
								function singleView($content, $conf) {
									$this->conf = $conf;
									$this->pi_setPiVarDefaults();
									$this->pi_loadLL();
									' . (!$cache ? '$this->pi_USER_INT_obj = 1;	// Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . '

										// This sets the title of the page for use in indexed search results:
									if ($this->internal[\'currentRow\'][\'title\'])	$GLOBALS[\'TSFE\']->indexedDocTitle=$this->internal[\'currentRow\'][\'title\'];

									$content=\'<div\'.$this->pi_classParam(\'singleView\').\'>
										<H2>Record "\'.$this->internal[\'currentRow\'][\'uid\'].\'" from table "\'.$this->internal[\'currentTable\'].\'":</H2>
										', implode(chr(10), $theLines['singleRows_section']), '
									<p>\'.$this->pi_list_linkSingle($this->pi_getLL(\'back\',\'Back\'),0).\'</p></div>\'.
									$this->pi_getEditPanel();

									return $content;
								}
							', 3);
                        } else {
                            $innerMainContent .= $this->wrapBody('
								/**
								 * Display a single item from the database
								 *
								 * @param	string		$content: The PlugIn content
								 * @param	array		$conf: The PlugIn configuration
								 * @return	HTML of a single database entry
								 */
								function singleView($content, $conf) {
									$this->conf = $conf;
									$this->pi_setPiVarDefaults();
									$this->pi_loadLL();
									' . (!$cache ? '$this->pi_USER_INT_obj = 1;	// Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . '

										// This sets the title of the page for use in indexed search results:
									if ($this->internal[\'currentRow\'][\'title\'])	$GLOBALS[\'TSFE\']->indexedDocTitle=$this->internal[\'currentRow\'][\'title\'];

									$content=\'<div\'.$this->pi_classParam(\'singleView\').\'>
										<H2>Record "\'.$this->internal[\'currentRow\'][\'uid\'].\'" from table "\'.$this->internal[\'currentTable\'].\'":</H2>
										<table>
											', implode(chr(10), $theLines['singleRows']), '
										</table>
									<p>\'.$this->pi_list_linkSingle($this->pi_getLL(\'back\',\'Back\'),0).\'</p></div>\'.
									$this->pi_getEditPanel();

									return $content;
								}
							', 3);
                        }
                        $this->wizard->ext_localconf[] = $this->sPS('
							' . $this->WOPcomment('WOP:' . $WOP . '[...]') . '
							t3lib_extMgm::addTypoScript($_EXTKEY,\'setup\',\'
								tt_content.shortcut.20.0.conf.' . $tableName . ' = < plugin.\'.t3lib_extMgm::getCN($_EXTKEY).\'_pi' . $k . '
								tt_content.shortcut.20.0.conf.' . $tableName . '.CMD = singleView
							\',43);
						');
                        if (!$config['list_default_listmode']) {
                            $innerMainContent .= $this->wrapBody('
								/**
								 * Returns a single table row for list view
								 *
								 * @param	integer		$c: Counter for odd / even behavior
								 * @return	A HTML table row
								 */
								function pi_list_row($c)	{
									$editPanel = $this->pi_getEditPanel();
									if ($editPanel)	$editPanel=\'<TD>\'.$editPanel.\'</TD>\';

									return \'<tr\'.($c%2 ? $this->pi_classParam(\'listrow-odd\') : \'\').\'>
											', implode(chr(10), $theLines['getListRow']), '
											' . $editPanel . '
										</tr>\';
								}
							', 3);
                            $innerMainContent .= $this->wrapBody('
								/**
								 * Returns a table row with column names of the table
								 *
								 * @return	A HTML table row
								 */
								function pi_list_header()	{
									return \'<tr\'.$this->pi_classParam(\'listrow-header\').\'>
											', implode(chr(10), $theLines['getListHeader']), '
										</tr>\';
								}
							', 3);
                        }
                        $innerMainContent .= $this->wrapBody('
							/**
							 * Returns the content of a given field
							 *
							 * @param	string		$fN: name of table field
							 * @return	Value of the field
							 */
							function getFieldContent($fN)	{
								switch($fN) {
									case \'uid\':
										return $this->pi_list_linkSingle($this->internal[\'currentRow\'][$fN],$this->internal[\'currentRow\'][\'uid\'],1);	// The "1" means that the display of single items is CACHED! Set to zero to disable caching.
									break;
									', implode(chr(10), $theLines['getFieldContent']), '
									default:
										return $this->internal[\'currentRow\'][$fN];
									break;
								}
							}
						', 2);
                        $innerMainContent .= $this->wrapBody('
							/**
							 * Returns the label for a fieldname from local language array
							 *
							 * @param	[type]		$fN: ...
							 * @return	[type]		...
							 */
							function getFieldHeader($fN)	{
								switch($fN) {
									', implode(chr(10), $theLines['getFieldHeader']), '
									default:
										return $this->pi_getLL(\'listFieldHeader_\'.$fN,\'[\'.$fN.\']\');
									break;
								}
							}
						', 2);
                        $innerMainContent .= $this->sPS('
							/**
							 * Returns a sorting link for a column header
							 *
							 * @param	string		$fN: Fieldname
							 * @return	The fieldlabel wrapped in link that contains sorting vars
							 */
							function getFieldHeader_sortLink($fN)	{
								return $this->pi_linkTP_keepPIvars($this->getFieldHeader($fN),array(\'sort\'=>$fN.\':\'.($this->internal[\'descFlag\']?0:1)));
							}
						');
                        /*						$CSS_editor_code = '';
                        						$pCSSSel = str_replace('_','-',$cN);
                        
                        						if ($config['list_default_listmode'])	{
                        							$temp_merge=array();
                        							if (is_array($P_classes['LV']))	{
                        								while(list($c,$LVc)=each($P_classes['LV']))	{
                        									$temp_merge[]=$this->sPS('
                        										P_'.$c.' = ['.$LVc.']
                        										P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.'
                        										P_'.$c.'.attribs = BODYTEXT
                        										P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
                        										P_'.$c.'.exampleStop = 1
                        										P_'.$c.'.ch.links = < CSS_editor.ch.A
                        									',1);
                        								}
                        							}
                        							$CSS_editor_code.=$this->wrapBody('
                        								list = List display
                        								list.selector = .'.$pCSSSel.'-listrow
                        								list.example = <div class="'.$pCSSSel.'-listrow"><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p></div>
                        								list.exampleWrap = <div class="'.$pCSSSel.'-listrow"> | </div>
                        								list.ch.P < .P
                        								list.ch.P.exampleStop = 0
                        								list.ch.P.ch {
                        								',implode(chr(10),$temp_merge),'
                        								}
                        							');
                        						} else {
                        							$CSS_editor_code.=$this->sPS('
                        								list = List display
                        								list.selector = .'.$pCSSSel.'-listrow
                        								list.example = <div class="'.$pCSSSel.'-listrow"><table><tr class="'.$pCSSSel.'-listrow-header"><td nowrap><p>Time / Date:</p></td><td><p><a HREF="#">Title:</a></p></td></tr><tr><td valign="top"><p>25-08-02</p></td><td valign="top"><p><a HREF="#">New company name...</a></p></td></tr><tr class="'.$pCSSSel.'-listrow-odd"><td valign="top"><p>16-08-02</p></td><td valign="top"><p><a HREF="#">Yet another headline here</a></p></td></tr><tr><td valign="top"><p>05-08-02</p></td><td valign="top"><p><a HREF="#">The third line - even row</a></p></td></tr></table></div>
                        								list.exampleStop = 1
                        								list.ch {
                        									TABLE = Table
                        									TABLE.selector = TABLE
                        									TABLE.attribs = TABLE
                        									TD = Table cells
                        									TD.selector = TD
                        									TD.attribs = TD
                        									TD_header = Header row cells
                        									TD_header.selector = TR.'.$pCSSSel.'-listrow-header TD
                        									TD_header.attribs = TD
                        									TD_odd = Odd rows cells
                        									TD_odd.selector = TR.'.$pCSSSel.'-listrow-odd TD
                        									TD_odd.attribs = TD
                        								}
                        								list.ch.TD.ch.P < .P
                        								list.ch.TD_header.ch.P < .P
                        								list.ch.TD_odd.ch.P < .P
                        							');
                        						}
                        
                        						if ($config['list_default_singlemode'])	{
                        							$temp_merge=array();
                        							if (is_array($P_classes['SV']))	{
                        								while(list($c,$LVc)=each($P_classes['SV']))	{
                        									$temp_merge[]=$this->sPS('
                        										P_'.$c.' = ['.$LVc.']
                        										P_'.$c.'.selector = +.'.$pCSSSel.'-'.$LVc.'
                        										P_'.$c.'.attribs = BODYTEXT
                        										P_'.$c.'.example = <p class="'.$pCSSSel.'-'.$LVc.'">['.$LVc.'] text <a href="#">with a link</a> in it.</p><p class="'.$pCSSSel.'-'.$LVc.'">In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
                        										P_'.$c.'.exampleStop = 1
                        										P_'.$c.'.ch.links = < CSS_editor.ch.A
                        									',1);
                        								}
                        							}
                        							$CSS_editor_code.=$this->wrapBody('
                        								single = Single display
                        								single.selector = .'.$pCSSSel.'-singleView
                        								single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><p>This is regular bodytext in the list display.</p><p>Viditque Deus cuncta quae fecit et erant valde bona et factum est vespere et mane dies sextus.</p><p><a href="#">Back</a></p></div>
                        								single.exampleWrap = <div class="'.$pCSSSel.'-singleView"> | </div>
                        								single.ch.P < .P
                        								single.ch.P.exampleStop = 0
                        								single.ch.P.ch {
                        								',implode(chr(10),$temp_merge),'
                        								}
                        							');
                        						} else {
                        							$CSS_editor_code.=$this->sPS('
                        								single = Single display
                        								single.selector = .'.$pCSSSel.'-singleView
                        								single.example = <div class="'.$pCSSSel.'-singleView"><H2>Header, if any:</H2><table><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Date:</p></td><td valign="top"><p>13-09-02</p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Title:</p></td><td valign="top"><p><a HREF="#">New title line</a></p></td></tr><tr><td nowrap valign="top" class="'.$pCSSSel.'-singleView-HCell"><p>Teaser text:</p></td><td valign="top"><p>Vocavitque Deus firmamentum caelum et factum est vespere et mane dies secundus dixit vero Deus congregentur.</p><p>Aquae quae sub caelo sunt in locum unum et appareat arida factumque est ita et vocavit Deus aridam terram congregationesque aquarum appellavit maria et vidit Deus quod esset bonum et ait germinet terra herbam virentem et facientem s***n et lignum pomiferum faciens fructum iuxta genus suum cuius s***n in semet ipso sit super terram et factum est ita et protulit terra herbam virentem et adferentem s***n iuxta genus suum lignumque faciens fructum et habens unumquodque sementem secundum speciem suam et vidit Deus quod esset bonum.</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Last updated:</p></td><td valign="top"><p>25-08-2002 18:28</p></td></tr><tr><td nowrap class="'.$pCSSSel.'-singleView-HCell"><p>Created:</p></td><td valign="top"><p>25-08-2002 18:27</p></td></tr></table><p><a href="#">Back</a></p></div>
                        								single.exampleStop = 1
                        								single.ch {
                        									TABLE = Table
                        									TABLE.selector = TABLE
                        									TABLE.attribs = TABLE
                        									TD = Table cells
                        									TD.selector = TD
                        									TD.attribs = TD
                        									TD.ch {
                        		  								TD = Header cells
                        			  							TD.selector = +.'.$pCSSSel.'-singleView-HCell
                        										TD.attribs = TD
                        									}
                        								}
                        								single.ch.P < .P
                        								single.ch.H2 < .H2
                        								single.ch.TD.ch.P < .P
                        								single.ch.TD.ch.TD.ch.P < .P
                        							');
                        						}
                        
                        						$this->addFileToFileArray($config['plus_not_staticTemplate']?'ext_typoscript_editorcfg.txt':$pathSuffix.'static/editorcfg.txt',$this->wrapBody('
                        							plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'"
                        							plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.'
                        							plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div>
                        							plugin.'.$cN.'.CSS_editor.ch {
                        								P = Text
                        								P.selector = P
                        								P.attribs = BODYTEXT
                        								P.example = <p>General text wrapped in &lt;P&gt;:<br />This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
                        								P.exampleStop = 1
                        								P.ch.links = < CSS_editor.ch.A
                        
                        								H2 = Header 2
                        								H2.selector = H2
                        								H2.attribs = HEADER
                        								H2.example = <H2>Header 2 example <a href="#"> with link</a></H2><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p>
                        								H2.ch.links = < CSS_editor.ch.A
                        								H2.exampleStop = 1
                        
                        								H3 = Header 3
                        								H3.selector = H3
                        								H3.attribs = HEADER
                        								H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p>
                        								H3.ch.links = < CSS_editor.ch.A
                        								H3.exampleStop = 1
                        
                        
                        									## LISTING:
                        								modeSelector = Mode selector
                        								modeSelector.selector = .'.$pCSSSel.'-modeSelector
                        								modeSelector.example = <div class="'.$pCSSSel.'-modeSelector"><table><tr><td class="'.$pCSSSel.'-modeSelector-SCell"><p><a HREF="#">Mode 1 (S)</a></p></td><td><p><a HREF="#">Mode 2</a></p></td><td><p><a HREF="#">Mode 3</a></p></td></tr></table></div>
                        								modeSelector.exampleStop = 1
                        								modeSelector.ch.P < .P
                        								modeSelector.ch.TABLE = Table
                        								modeSelector.ch.TABLE.selector = TABLE
                        								modeSelector.ch.TABLE.attribs = TABLE
                        								modeSelector.ch.TD = Table cells
                        								modeSelector.ch.TD.selector = TD
                        								modeSelector.ch.TD.attribs = TD
                        								modeSelector.ch.TD.ch {
                        								  TD = Selected table cells
                        								  TD.selector = + .'.$pCSSSel.'-modeSelector-SCell
                        								  TD.attribs = TD
                        								}
                        								modeSelector.ch.TD.ch.TD.ch.P < .P
                        
                        
                        								browsebox = Browsing box
                        								browsebox.selector = .'.$pCSSSel.'-browsebox
                        								browsebox.example = <div class="'.$pCSSSel.'-browsebox"><p>Displaying results <span class="'.$pCSSSel.'-browsebox-strong">1 to 3</span> out of <span class="'.$pCSSSel.'-browsebox-strong">4</span></p><table><tr><td class="'.$pCSSSel.'-browsebox-SCell"><p><a HREF="#">Page 1 (S)</a></p></td><td><p><a HREF="#">Page 2</a></p></td><td><p><a HREF="#">Next ></a></p></td></tr></table></div>
                        								browsebox.exampleStop = 1
                        								browsebox.ch.P < .P
                        								browsebox.ch.P.ch.strong = Emphasized numbers
                        								browsebox.ch.P.ch.strong {
                        								  selector = SPAN.'.$pCSSSel.'-browsebox-strong
                        								  attribs = TEXT
                        								}
                        								browsebox.ch.TABLE = Table
                        								browsebox.ch.TABLE.selector = TABLE
                        								browsebox.ch.TABLE.attribs = TABLE
                        								browsebox.ch.TD = Table cells
                        								browsebox.ch.TD.selector = TD
                        								browsebox.ch.TD.attribs = TD
                        								browsebox.ch.TD.ch {
                        								  TD = Selected table cells
                        								  TD.selector = + .'.$pCSSSel.'-browsebox-SCell
                        								  TD.attribs = TD
                        								}
                        								browsebox.ch.TD.ch.P < .P
                        								browsebox.ch.TD.ch.TD.ch.P < .P
                        
                        
                        								searchbox = Search box
                        								searchbox.selector = .'.$pCSSSel.'-searchbox
                        								searchbox.example = <div class="'.$pCSSSel.'-searchbox"><table><form action="#" method="POST"><tr><td><input type="text" name="'.$cN.'[sword]" value="Search word" class="'.$pCSSSel.'-searchbox-sword"></td><td><input type="submit" value="Search" class="'.$pCSSSel.'-searchbox-button"></td></tr></form></table></div>
                        								searchbox.exampleStop = 1
                        								searchbox.ch {
                        									TABLE = Table
                        									TABLE.selector = TABLE
                        									TABLE.attribs = TABLE
                        									TD = Table cells
                        									TD.selector = TD
                        									TD.attribs = TD
                        									INPUT = Form fields
                        									INPUT.selector = INPUT
                        									INPUT.attribs = TEXT,background-color,width
                        									INPUT.ch {
                        										sword = Search word field
                        										sword.selector = +.'.$pCSSSel.'-searchbox-sword
                        										sword.attribs = TEXT,background-color,width
                        
                        										button = Submit button
                        										button.selector = +.'.$pCSSSel.'-searchbox-button
                        										button.attribs = TEXT,background-color,width
                        									}
                        								}
                        								',$CSS_editor_code,'
                        							}
                        						'),1);
                        */
                        $this->addFileToFileArray($config['plus_not_staticTemplate'] ? 'ext_typoscript_setup.txt' : $pathSuffix . 'static/setup.txt', $this->sPS('
							plugin.' . $cN . ' {
								CMD =
								pidList =
								recursive =
							}
							plugin.' . $cN . '.listView {
								results_at_a_time =
								maxPages =
							}
							  # Example of default set CSS styles (these go into the document header):
							plugin.' . $cN . '._CSS_DEFAULT_STYLE (
							  .' . $pCSSSel . ' H2 { margin-top: 0px; margin-bottom: 0px; }
							)
							  # Example of how to overrule LOCAL_LANG values for the plugin:
							plugin.' . $cN . '._LOCAL_LANG.default {
							  pi_list_searchBox_search = Search!
							}
							  # Example of how to set default values from TS in the incoming array, $this->piVars of the plugin:
							plugin.' . $cN . '._DEFAULT_PI_VARS.test = test
						'), 1);
                        $this->wizard->EM_CONF_presets['clearCacheOnLoad'] = 1;
                        if (!$config['plus_not_staticTemplate']) {
                            $this->wizard->ext_tables[] = $this->sPS('
								t3lib_extMgm::addStaticFile($_EXTKEY,\'' . $pathSuffix . 'static/\',\'' . addslashes(trim($config['title'])) . '\');
							');
                        }
                    }
                } else {
                    // Add title to local lang file
                    $ll = $this->addStdLocalLangConf($ll, $k, 1);
                    $this->addLocalConf($ll, array('submit_button_label' => 'Click here to submit value'), 'submit_button_label', 'pi', $k, 1, 1);
                    $this->addLocalLangFile($ll, $pathSuffix . 'locallang.xml', 'Language labels for plugin "' . $cN . '"');
                    $innerMainContent = $this->sPS('
						/**
						 * The main method of the PlugIn
						 *
						 * @param	string		$content: The PlugIn content
						 * @param	array		$conf: The PlugIn configuration
						 * @return	The content that is displayed on the website
						 */
						function main($content, $conf) {
							$this->conf = $conf;
							$this->pi_setPiVarDefaults();
							$this->pi_loadLL();
							' . (!$cache ? '$this->pi_USER_INT_obj = 1;	// Configuring so caching is not expected. This value means that no cHash params are ever set. We do this, because it\'s a USER_INT object!' : '') . '

							$content=\'
								<strong>This is a few paragraphs:</strong><br />
								<p>This is line 1</p>
								<p>This is line 2</p>

								<h3>This is a form:</h3>
								<form action="\'.$this->pi_getPageLink($GLOBALS[\'TSFE\']->id).\'" method="POST">
									<input type="text" name="\'.$this->prefixId.\'[input_field]" value="\'.htmlspecialchars($this->piVars[\'input_field\']).\'">
									<input type="submit" name="\'.$this->prefixId.\'[submit_button]" value="\'.htmlspecialchars($this->pi_getLL(\'submit_button_label\')).\'">
								</form>
								<br />
								<p>You can click here to \'.$this->pi_linkToPage(\'get to this page again\',$GLOBALS[\'TSFE\']->id).\'</p>
							\';

							return $this->pi_wrapInBaseClass($content);
						}
					');
                    /*					$CSS_editor_code='';
                    					$pCSSSel = str_replace('_','-',$cN);
                    
                    					$this->addFileToFileArray($config['plus_not_staticTemplate']?'ext_typoscript_editorcfg.txt':$pathSuffix.'static/editorcfg.txt',$this->sPS('
                    						plugin.'.$cN.'.CSS_editor = Plugin: "'.$cN.'"
                    						plugin.'.$cN.'.CSS_editor.selector = .'.$pCSSSel.'
                    						plugin.'.$cN.'.CSS_editor.exampleWrap = <HR><strong>Plugin: "'.$cN.'"</strong><HR><div class="'.$pCSSSel.'"> | </div>
                    						plugin.'.$cN.'.CSS_editor.ch {
                    							P = Text
                    							P.selector = P
                    							P.attribs = BODYTEXT
                    							P.example = <p>General text wrapped in &lt;P&gt;:<br />This is text <a href="#">with a link</a> in it. In principio creavit Deus caelum et terram terra autem erat inanis et vacua et tenebrae super faciem abyssi et spiritus...</p>
                    							P.exampleStop = 1
                    							P.ch.links = < CSS_editor.ch.A
                    
                    							H3 = Header 3
                    							H3.selector = H3
                    							H3.attribs = HEADER
                    							H3.example = <h3>Header 3 example <a href="#"> with link</a></h3><p>Bodytext, Et praeessent diei ac nocti et dividerent lucem ac tenebras et vidit Deus quod esset bonum et factum est...</p>
                    							H3.ch.links = < CSS_editor.ch.A
                    							H3.exampleStop = 1
                    						}
                    					'),1);
                    
                    					if (!$config['plus_not_staticTemplate'])	{
                    						$this->wizard->ext_tables[]=$this->sPS('
                    							t3lib_extMgm::addStaticFile($_EXTKEY, \''.$pathSuffix.'static/\', \''.addslashes(trim($config['title'])).'\');
                    						');
                    					}
                    */
                }
                break;
            case 'textbox':
                $this->wizard->ext_localconf[] = $this->sPS('
					  ## Setting TypoScript for the image in the textbox:
					t3lib_extMgm::addTypoScript($_EXTKEY,\'setup\',\'
						plugin.' . $cN . '_pi' . $k . '.IMAGEcObject {
						  file.width=100
						}
					\',43);
				');
                $innerMainContent = $this->sPS('
					/**
					 * The main method of the PlugIn
					 *
					 * @param	string		$content: The PlugIn content
					 * @param	array		$conf: The PlugIn configuration
					 * @return	The content that is displayed on the website (Textbox)
					 */
					function main($content, $conf)	{

							// Processes the image-field content:
							// $conf[\'IMAGEcObject.\'] is passed to the getImage() function as TypoScript
							// configuration for the image (except filename which is set automatically here)
						$imageFiles = explode(\',\',$this->cObj->data[\'image\']);	// This returns an array with image-filenames, if many
						$imageRows=array();	// Accumulates the images
						reset($imageFiles);
						while(list(,$iFile)=each($imageFiles))	{
							$imageRows[] = \'<tr>
								<td>\'.$this->getImage($iFile,$conf[\'IMAGEcObject.\']).\'</td>
							</tr>\';
						}
						$imageBlock = count($imageRows)?\'<table border=0 cellpadding=5 cellspacing=0>\'.implode(\'\',$imageRows).\'</table>\':\'<img src=clear.gif width=100 height=1>\';

							// Sets bodytext
						$bodyText = nl2br($this->cObj->data[\'bodytext\']);

							// And compiles everything into a table:
						$finalContent = \'<table border=1>
							<tr>
								<td valign=top>\'.$imageBlock.\'</td>
								<td valign=top>\'.$bodyText.\'</td>
							</tr>
						</table>\';

							// And returns content
						return $finalContent;
					}

					/**
					 * This calls a function in the TypoScript API which will return an image tag with the image
					 * processed according to the parsed TypoScript content in the $TSconf array.
					 *
					 * @param	string		$filename: The filename of the image
					 * @param	array		$TSconf: The TS configuration for displaying the image
					 * @return	The image HTML code
					 */
					function getImage($filename,$TSconf)	{
						list($theImage)=explode(\',\',$filename);
						$TSconf[\'file\'] = \'uploads/pics/\'.$theImage;
						$img = $this->cObj->IMAGE($TSconf);
						return $img;
					}
				');
                break;
            case 'header':
                $innerMainContent = $this->sPS('
					/**
					 * The main method of the PlugIn
					 *
					 * @param	string		$content: The PlugIn content
					 * @param	array		$conf: The PlugIn configuration
					 * @return	The content that is displayed on the website (Header)
					 */
					function main($content, $conf)	{
						return \'<H1>\'.$this->cObj->data[\'header\'].\'</H1>\';
					}
				');
                break;
            case 'menu_sitemap':
                $innerMainContent = $this->sPS('

					/**
					 * The main method of the PlugIn
					 *
					 * @param	string		$content: The PlugIn content
					 * @param	array		$conf: The PlugIn configuration
					 * @return	The content that is displayed on the website (Menu)
					 */
					function main($content, $conf)	{
							// Get the PID from which to make the menu.
							// If a page is set as reference in the \'Startingpoint\' field, use that
							// Otherwise use the page\'s id-number from TSFE
						$menuPid = intval($this->cObj->data[\'pages\']?$this->cObj->data[\'pages\']:$GLOBALS[\'TSFE\']->id);

							// Now, get an array with all the subpages to this pid:
							// (Function getMenu() is found in class.t3lib_page.php)
						$menuItems_level1 = $GLOBALS[\'TSFE\']->sys_page->getMenu($menuPid);

							// Prepare vars:
						$tRows=array();

							// Traverse menuitems:
						reset($menuItems_level1);
						while(list($uid,$pages_row)=each($menuItems_level1))	{
							$tRows[]=\'<tr bgColor="#cccccc"><td>\'.$this->pi_linkToPage(
								$pages_row[\'nav_title\']?$pages_row[\'nav_title\']:$pages_row[\'title\'],
								$pages_row[\'uid\'],
								$pages_row[\'target\']
							).\'</td></tr>\';
						}

						$totalMenu = \'<table border=0 cellpadding=0 cellspacing=2>
							<tr><td>This is a menu. Go to your favourite page:</td></tr>
							\'.implode(\'\',$tRows).
							\'</table><br />(\'.$this->tellWhatToDo(\'Click here if you want to know where to change the menu design\').\')\';

						return $totalMenu;
					}

					/**
					 * Here you can do what ever you want
					 *
					 * @param	string		$str: The string that is processed
					 * @return	It\'s your decission
					 */
					function tellWhatToDo($str)	{
						return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath(\'' . $extKey . '\').\'' . $pathSuffix . 'class.' . $cN . '.php and edit the function main()\\nto change how the menu is rendered! It is pure PHP coding!\\\')">\'.$str.\'</a>\';
					}
				');
                break;
            case 'typotags':
                $innerMainContent = $this->sPS('
					/**
					 * The main method of the PlugIn
					 *
					 * @param	string		$content: The PlugIn content
					 * @param	array		$conf: The PlugIn configuration
					 * @return	The content that is displayed on the website (TypoTag)
					 */
					function main($content, $conf)	{
						$tag_content = $this->cObj->getCurrentVal();
						return \'<b>\'.$this->tellWhatToDo(strtoupper($tag_content)).\'</b>\';
					}

					/**
					 * Here you can do what ever you want
					 *
					 * @param	string		$str: The string that is processed
					 * @return	It\'s your decission
					 */
					function tellWhatToDo($str)	{
						return \'<a href="#" onClick="alert(\\\'Open the PHP-file \'.t3lib_extMgm::siteRelPath(\'' . $extKey . '\').\'' . $pathSuffix . 'class.' . $cN . '.php and edit the function main()\\nto change how the tag content is processed!\\\')">\'.$str.\'</a>\';
					}
				');
                break;
            default:
                $innerMainContent = $this->sPS('
					/**
					 * The main method of the PlugIn
					 *
					 * @param	string		$content: The PlugIn content
					 * @param	array		$conf: The PlugIn configuration
					 * @return	The content that is displayed on the website
					 */
					function main($content, $conf)	{
						return \'Hello World!<HR>
							Here is the TypoScript passed to the method:\'.
									t3lib_div::view_array($conf);
					}
				');
                break;
        }
        $indexRequire = 'require_once(PATH_tslib.\'class.tslib_pibase.php\');';
        $indexContent = $this->wrapBody('
			class ' . $cN . ' extends tslib_pibase {
				var $prefixId      = \'' . $cN . '\';		// Same as class name
				var $scriptRelPath = \'' . ($pathSuffix . "class." . $cN . ".php") . '\';	// Path to this script relative to the extension dir.
				var $extKey        = \'' . $extKey . '\';	// The extension key.
				' . ($cache ? 'var $pi_checkCHash = true;
				' : '') . '
				', $innerMainContent, '
			}
		');
        $this->addFileToFileArray($pathSuffix . 'class.' . $cN . '.php', $this->PHPclassFile($extKey, $pathSuffix . 'class.' . $cN . '.php', $indexContent, 'Plugin \'' . $config['title'] . '\' for the \'' . $extKey . '\' extension.', '', '', $indexRequire));
        // Add wizard?
        if ($config['plus_wiz'] && $config['addType'] == 'list_type') {
            $this->addLocalConf($this->wizard->ext_locallang, $config, 'title', 'pi', $k);
            $this->addLocalConf($this->wizard->ext_locallang, $config, 'plus_wiz_description', 'pi', $k);
            $indexContent = $this->sPS('class ' . $cN . '_wizicon {

					/**
					 * Processing the wizard items array
					 *
					 * @param	array		$wizardItems: The wizard items
					 * @return	Modified array with wizard items
					 */
					function proc($wizardItems)	{
						global $LANG;

						$LL = $this->includeLocalLang();

						$wizardItems[\'plugins_' . $cN . '\'] = array(
							\'icon\'=>t3lib_extMgm::extRelPath(\'' . $extKey . '\').\'' . $pathSuffix . 'ce_wiz.gif\',
							\'title\'=>$LANG->getLLL(\'pi' . $k . '_title\',$LL),
							\'description\'=>$LANG->getLLL(\'pi' . $k . '_plus_wiz_description\',$LL),
							\'params\'=>\'&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=' . $extKey . '_pi' . $k . '\'
						);

						return $wizardItems;
					}

					/**
					 * Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
					 *
					 * @return	The array with language labels
					 */
					function includeLocalLang()	{
						$llFile = t3lib_extMgm::extPath(\'' . $extKey . '\').\'locallang.xml\';
						$LOCAL_LANG = t3lib_div::readLLXMLfile($llFile, $GLOBALS[\'LANG\']->lang);

						return $LOCAL_LANG;
					}
				}
			', 0);
            $this->addFileToFileArray($pathSuffix . 'class.' . $cN . '_wizicon.php', $this->PHPclassFile($extKey, $pathSuffix . 'class.' . $cN . '_wizicon.php', $indexContent, 'Class that adds the wizard icon.'));
            // Add wizard icon
            $this->addFileToFileArray($pathSuffix . 'ce_wiz.gif', t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter') . 'res/wiz.gif'));
            // Add clear.gif
            $this->addFileToFileArray($pathSuffix . 'clear.gif', t3lib_div::getUrl(t3lib_extMgm::extPath('kickstarter') . 'res/clear.gif'));
            $this->wizard->ext_tables[] = $this->sPS('
				' . $this->WOPcomment('WOP:' . $WOP . '[plus_wiz]:') . '
				if (TYPO3_MODE == \'BE\') {
					$TBE_MODULES_EXT[\'xMOD_db_new_content_el\'][\'addElClasses\'][\'' . $cN . '_wizicon\'] = t3lib_extMgm::extPath($_EXTKEY).\'pi' . $k . '/class.' . $cN . '_wizicon.php\';
				}
			');
        }
    }
    /**
     * Create visual difference view of two records. Using t3lib_diff library
     *
     * @param	string		Table name
     * @param	array		New version record (green)
     * @param	array		Old version record (red)
     * @return	array		Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change
     */
    function createDiffView($table, $diff_1_record, $diff_2_record)
    {
        global $TCA, $LANG;
        // Initialize:
        $pctChange = 'N/A';
        // Check that records are arrays:
        if (is_array($diff_1_record) && is_array($diff_2_record)) {
            // Load full table description and initialize diff-object:
            t3lib_div::loadTCA($table);
            $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
            // Add header row:
            $tRows = array();
            $tRows[] = '
				<tr class="bgColor5 tableheader">
					<td>' . $LANG->getLL('diffview_label_field_name') . '</td>
					<td width="98%" nowrap="nowrap">' . $LANG->getLL('diffview_label_colored_diff_view') . '</td>
				</tr>
			';
            // Initialize variables to pick up string lengths in:
            $allStrLen = 0;
            $diffStrLen = 0;
            // Traversing the first record and process all fields which are editable:
            foreach ($diff_1_record as $fN => $fV) {
                if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fN)) {
                    // Check if it is files:
                    $isFiles = FALSE;
                    if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN])) && $TCA[$table]['columns'][$fN]['config']['type'] == 'group' && $TCA[$table]['columns'][$fN]['config']['internal_type'] == 'file') {
                        // Initialize:
                        $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder'];
                        $files1 = array_flip(t3lib_div::trimExplode(',', $diff_1_record[$fN], 1));
                        $files2 = array_flip(t3lib_div::trimExplode(',', $diff_2_record[$fN], 1));
                        // Traverse filenames and read their md5 sum:
                        foreach ($files1 as $filename => $tmp) {
                            $files1[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename;
                        }
                        foreach ($files2 as $filename => $tmp) {
                            $files2[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename;
                        }
                        // Implode MD5 sums and set flag:
                        $diff_1_record[$fN] = implode(' ', $files1);
                        $diff_2_record[$fN] = implode(' ', $files2);
                        $isFiles = TRUE;
                    }
                    // If there is a change of value:
                    if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN]))) {
                        // Get the best visual presentation of the value and present that:
                        $val1 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_2_record[$fN], 0, 1);
                        $val2 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_1_record[$fN], 0, 1);
                        // Make diff result and record string lenghts:
                        $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1, $val2, $isFiles ? 'div' : 'span');
                        $diffStrLen .= $t3lib_diff_Obj->differenceLgd;
                        $allStrLen .= strlen($val1 . $val2);
                        // If the compared values were files, substituted MD5 hashes:
                        if ($isFiles) {
                            $allFiles = array_merge($files1, $files2);
                            foreach ($allFiles as $filename => $token) {
                                if (strlen($token) == 32 && strstr($diffres, $token)) {
                                    $filename = t3lib_BEfunc::thumbCode(array($fN => $filename), $table, $fN, $this->doc->backPath) . $filename;
                                    $diffres = str_replace($token, $filename, $diffres);
                                }
                            }
                        }
                        ############# new hook for post processing of DAM images
                        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'])) {
                            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'] as $classRef) {
                                $hookObject =& t3lib_div::getUserObj($classRef);
                                if (method_exists($hookObject, 'postProcessDiffView')) {
                                    $diffres = $hookObject->postProcessDiffView($table, $fN, $diff_2_record, $diff_1_record, $diffres, $this);
                                }
                            }
                        }
                        #############
                        // Add table row with result:
                        $tRows[] = '
							<tr class="bgColor4">
								<td>' . htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fN))) . '</td>
								<td width="98%">' . $diffres . '</td>
							</tr>
						';
                    } else {
                        // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed:
                        $allStrLen += strlen($diff_1_record[$fN] . $diff_2_record[$fN]);
                    }
                }
            }
            // Calculate final change percentage:
            $pctChange = $allStrLen ? ceil($diffStrLen * 100 / $allStrLen) : -1;
            // Create visual representation of result:
            if (count($tRows) > 1) {
                $content .= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">' . implode('', $tRows) . '</table>';
            } else {
                $content .= '<span class="nobr">' . $this->doc->icons(1) . $LANG->getLL('diffview_complete_match') . '</span>';
            }
        } else {
            $content .= $this->doc->icons(3) . $LANG->getLL('diffview_cannot_find_records');
        }
        // Return value:
        return array($content, $pctChange);
    }
 /**
  * Obtains a value of the parameter if it is signed. If not signed, then
  * empty string is returned.
  *
  * @param string $parameterName Must start with 'openid_'
  * @return string
  */
 protected function getSignedParameter($parameterName)
 {
     $signedParametersList = t3lib_div::_GP('openid_signed');
     if (t3lib_div::inList($signedParametersList, substr($parameterName, 7))) {
         $result = t3lib_div::_GP($parameterName);
     } else {
         $result = '';
     }
     return $result;
 }
 /**
  * Returns the level of the given page in the rootline - Multiple pages can be given by separating the UIDs by comma.
  *
  * @param	string		A list of UIDs for which the rootline-level should get returned
  * @return	integer	The level in the rootline. If more than one page was given the lowest level will get returned.
  */
 function getRootlineLevel($list)
 {
     $idx = 0;
     foreach ($this->rootLine as $page) {
         if (t3lib_div::inList($list, $page['uid'])) {
             return $idx;
         }
         $idx++;
     }
     return false;
 }
 /**
  * Checks if a frontend user is allowed to edit a certain record
  *
  * @param	string		The table name, found in $TCA
  * @param	array		The record data array for the record in question
  * @param	array		The array of the fe_user which is evaluated, typ. $GLOBALS['TSFE']->fe_user->user
  * @param	string		Commalist of the only fe_groups uids which may edit the record. If not set, then the usergroup field of the fe_user is used.
  * @param	boolean		True, if the fe_user may edit his own fe_user record.
  * @return	boolean
  * @see user_feAdmin
  */
 function DBmayFEUserEdit($table, $row, $feUserRow, $allowedGroups = '', $feEditSelf = 0)
 {
     $groupList = $allowedGroups ? implode(',', array_intersect(t3lib_div::trimExplode(',', $feUserRow['usergroup'], 1), t3lib_div::trimExplode(',', $allowedGroups, 1))) : $feUserRow['usergroup'];
     $ok = 0;
     // points to the field that allows further editing from frontend if not set. If set the record is locked.
     if (!$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] || !$row[$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']]) {
         // points to the field (integer) that holds the fe_users-id of the creator fe_user
         if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) {
             $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']]);
             if ($rowFEUser && $rowFEUser == $feUserRow['uid']) {
                 $ok = 1;
             }
         }
         // If $feEditSelf is set, fe_users may always edit them selves...
         if ($feEditSelf && $table == 'fe_users' && !strcmp($feUserRow['uid'], $row['uid'])) {
             $ok = 1;
         }
         // points to the field (integer) that holds the fe_group-id of the creator fe_user's first group
         if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) {
             $rowFEUser = intval($row[$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']]);
             if ($rowFEUser) {
                 if (t3lib_div::inList($groupList, $rowFEUser)) {
                     $ok = 1;
                 }
             }
         }
     }
     return $ok;
 }
 function addField($field, $noCheck = 0)
 {
     global $TCA;
     if ($noCheck || is_array($TCA["pages"]["columns"][$field]) || t3lib_div::inList($this->defaultList, $field)) {
         $this->fieldArray[] = $field;
     }
 }
示例#26
0
 /**
  * Shows login form
  *
  * @return	string		content
  */
 protected function showLogin()
 {
     $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_LOGIN###');
     $subpartArray = $linkpartArray = array();
     $gpRedirectUrl = '';
     $markerArray['###LEGEND###'] = $this->pi_getLL('oLabel_header_welcome', '', 1);
     $markerArray['###ERROR###'] = "";
     $markerArray['###CLASS###'] = "";
     if ($this->logintype === 'login') {
         if ($this->userIsLoggedIn) {
             // login success
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('success_header', $this->conf['successHeader_stdWrap.']);
             $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('success_message', $this->conf['successMessage_stdWrap.']);
             $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
             $subpartArray['###LOGIN_FORM###'] = '';
             // Hook for general actions after after login has been confirmed (by Thomas Danzl <*****@*****.**>)
             if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed']) {
                 $_params = array();
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed'] as $_funcRef) {
                     if ($_funcRef) {
                         t3lib_div::callUserFunction($_funcRef, $_params, $this);
                     }
                 }
             }
             // show logout form directly
             if ($this->conf['showLogoutFormAfterLogin']) {
                 // BOf Erwand  9/02/12
                 //$this->redirectUrl = '';
                 // EOf Erwand  9/02/12
                 return $this->showLogout();
             }
         } else {
             // login error
             /* BOf Erwand  9/12/11	
             			$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('error_header',$this->conf['errorHeader_stdWrap.']);
             			$markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('error_message',$this->conf['errorMessage_stdWrap.']);
             			*/
             // Affiche le message d'erreur dans le sous menu
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('welcome_header', $this->conf['welcomeHeader_stdWrap.']);
             $markerArray['###ERROR###'] = $this->getDisplayText('error_header', $this->conf['errorHeader_stdWrap.']);
             $markerArray['###CLASS###'] = "active";
             //EOF Erwand 9/12/11
             $gpRedirectUrl = t3lib_div::_GP('redirect_url');
         }
     } else {
         if ($this->logintype === 'logout') {
             // login form after logout
             /* BOf Erwand  9/12/11
             			$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('logout_header', $this->conf['logoutHeader_stdWrap.']);	
             			*/
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('logout_header', $this->conf['welcomeHeader_stdWrap.']);
             $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('logout_message', $this->conf['welcomeMessage_stdWrap.']);
             // EOF Erwand 9/12/11
         } else {
             // login form
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('welcome_header', $this->conf['welcomeHeader_stdWrap.']);
             $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('welcome_message', $this->conf['welcomeMessage_stdWrap.']);
         }
     }
     // Hook (used by kb_md5fepw extension by Kraft Bernhard <*****@*****.**>)
     // This hook allows to call User JS functions.
     // The methods should also set the required JS functions to get included
     $onSubmit = '';
     $extraHidden = '';
     $onSubmitAr = array();
     $extraHiddenAr = array();
     // check for referer redirect method. if present, save referer in form field
     if (t3lib_div::inList($this->conf['redirectMode'], 'referer') || t3lib_div::inList($this->conf['redirectMode'], 'refererDomains')) {
         $referer = $this->referer ? $this->referer : t3lib_div::getIndpEnv('HTTP_REFERER');
         if ($referer) {
             $extraHiddenAr[] = '<input type="hidden" name="referer" value="' . htmlspecialchars($referer) . '" />';
         }
     }
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'])) {
         $_params = array();
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'] as $funcRef) {
             list($onSub, $hid) = t3lib_div::callUserFunction($funcRef, $_params, $this);
             $onSubmitAr[] = $onSub;
             $extraHiddenAr[] = $hid;
         }
     }
     if (count($onSubmitAr)) {
         $onSubmit = implode('; ', $onSubmitAr) . '; return true;';
     }
     if (count($extraHiddenAr)) {
         $extraHidden = implode(LF, $extraHiddenAr);
     }
     if (!$gpRedirectUrl && $this->redirectUrl) {
         $gpRedirectUrl = $this->redirectUrl;
     }
     // Login form
     $markerArray['###ACTION_URI###'] = $this->getPageLink('', array(), true);
     $markerArray['###EXTRA_HIDDEN###'] = $extraHidden;
     // used by kb_md5fepw extension...
     $markerArray['###LEGEND###'] = $this->pi_getLL('login', '', 1);
     $markerArray['###LOGIN_LABEL###'] = $this->pi_getLL('login', '', 1);
     $markerArray['###ON_SUBMIT###'] = $onSubmit;
     // used by kb_md5fepw extension...
     $markerArray['###PASSWORD_LABEL###'] = $this->pi_getLL('password', '', 1);
     $markerArray['###STORAGE_PID###'] = $this->spid;
     $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1);
     $markerArray['###REDIRECT_URL###'] = htmlspecialchars($gpRedirectUrl);
     $markerArray['###NOREDIRECT###'] = $this->noRedirect ? '1' : '0';
     $markerArray['###PREFIXID###'] = $this->prefixId;
     $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
     if ($this->flexFormValue('showForgotPassword', 'sDEF') || $this->conf['showForgotPasswordLink']) {
         $markerArray['###FORGOT_PASSWORD###'] = $this->pi_getLL('ll_forgot_header', '', 1);
         // BOF ErwanD redirection un page
         // print_r($this->conf);
         if (isset($this->conf['ForgotPasswordLinkPID'])) {
             $url = tslib_pibase::pi_getPageLink(194, '', array($this->prefixId . '[forgot]' => 1));
             $linkpartArray['###FORGOT_PASSWORD###'] = '<a href="' . $url . '">' . $this->pi_getLL('ll_forgot_header', '', 1) . '</a>';
             $linkpartArray['###FORGOT_PASSWORD_LINK###'] = '';
         } else {
             $linkpartArray['###FORGOT_PASSWORD_LINK###'] = explode('|', $this->getPageLink('|', array($this->prefixId . '[forgot]' => 1)));
         }
     } else {
         $subpartArray['###FORGOTP_VALID###'] = '';
     }
     // The permanent login checkbox should only be shown if permalogin is not deactivated (-1), not forced to be always active (2) and lifetime is greater than 0
     if ($this->conf['showPermaLogin'] && t3lib_div::inList('0,1', $GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['lifetime'] > 0) {
         $markerArray['###PERMALOGIN###'] = $this->pi_getLL('permalogin', '', 1);
         if ($GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 1) {
             $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = 'disabled="disabled"';
             $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = 'checked="checked"';
         } else {
             $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = '';
             $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = '';
         }
     } else {
         $subpartArray['###PERMALOGIN_VALID###'] = '';
     }
     return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
 }
 /**
  * Returns true if this editor is able to handle the given file
  *
  * @param	mixed		$media Media object or itemInfo array. Currently the function have to work with a media object or an itemInfo array.
  * @param	array		$conf Additional configuration values. Might be empty.
  * @return	boolean		True if this is the right editor for the file
  */
 function isValid($media, $conf = array())
 {
     $file_type = is_object($media) ? $media->getType() : $media['file_type'];
     return t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $file_type);
 }
 /**
  * [Describe function...]
  *
  * @param	[type]		$row: ...
  * @param	[type]		$conf: ...
  * @param	[type]		$table: ...
  * @return	[type]		...
  */
 function csvRowTitles($row, $conf, $table)
 {
     $out = '';
     $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
     foreach ($row as $fN => $fV) {
         if (t3lib_div::inList($SET['queryFields'], $fN) || !$SET['queryFields'] && $fN != 'pid') {
             if (!$out) {
                 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
                     $out = $GLOBALS['LANG']->sL($conf['columns'][$fN]['label'] ? $conf['columns'][$fN]['label'] : $fN, 1);
                 } else {
                     $out = $GLOBALS['LANG']->sL($fN, 1);
                 }
             } else {
                 if ($GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels']) {
                     $out .= ',' . $GLOBALS['LANG']->sL($conf['columns'][$fN]['label'] ? $conf['columns'][$fN]['label'] : $fN, 1);
                 } else {
                     $out .= ',' . $GLOBALS['LANG']->sL($fN, 1);
                 }
             }
         }
     }
     return $out;
 }
 /**
  * Takes care of deletion and storage of the notes
  *
  * @param	array		$cmdArr: An array of submitted commands (through GET/POST) and their values
  * @param	object		&$reference: Reference to the page module
  * @return	void
  * @access private
  */
 function internal_doProcessing($cmdArr, &$reference)
 {
     global $LANG;
     // Delete a note?
     if (intval($cmdArr['deleteNote'])) {
         if ($this->internal_checkWriteAccess(intval($cmdArr['deleteNote']), $reference)) {
             $cmdArray = array();
             $cmdArray['tx_rlmptvnotes_notes'][intval($cmdArr['deleteNote'])]['delete'] = 1;
             // Store:
             $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
             $TCEmain->stripslashes_values = 0;
             $TCEmain->start(array(), $cmdArray);
             $TCEmain->process_cmdmap();
         }
     }
     // Create a new note?
     if (intval($cmdArr['newNote'])) {
         $pageInfoArr = t3lib_BEfunc::readPageAccess($reference->id, $reference->perms_clause);
         if ($pageInfoArr['uid'] > 0) {
             // Make sure that no other note exists for this page:
             $noteRecords = t3lib_beFunc::getRecordsByField('tx_rlmptvnotes_notes', 'pid', $reference->id);
             if (count($noteRecords) == 0) {
                 // Configure the TCEmain command array:
                 $dataArr = array();
                 $dataArr['tx_rlmptvnotes_notes']['NEW'] = array('pid' => $reference->id, 'title' => $LANG->getLL('untitled', 0), 'note' => '');
                 // Create the new note:
                 $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
                 $TCEmain->stripslashes_values = 0;
                 $TCEmain->start($dataArr, array());
                 $TCEmain->process_datamap();
             }
         }
     }
     // Save a modified note?
     if (intval($cmdArr['saveNote'])) {
         if ($this->internal_checkWriteAccess(intval($cmdArr['saveNote']), $reference)) {
             $postDataArr = t3lib_div::GPvar('tx_rlmptvnotes_data');
             // Configure the TCEmain command array:
             $dataArr = array();
             $dataArr['tx_rlmptvnotes_notes'][intval($cmdArr['saveNote'])] = array('title' => $postDataArr['title'], 'note' => $postDataArr['note']);
             // Update the note:
             $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
             $TCEmain->stripslashes_values = 0;
             $TCEmain->start($dataArr, array());
             $TCEmain->process_datamap();
         }
     }
     // Set status to 'read' for specified backend user?
     if (intval($cmdArr['setRead'])) {
         $pageInfoArr = t3lib_BEfunc::readPageAccess($reference->id, $reference->perms_clause);
         if ($pageInfoArr['uid'] > 0) {
             // Read note record and add be user
             $noteRecords = t3lib_beFunc::getRecordsByField('tx_rlmptvnotes_notes', 'pid', $reference->id);
             $beUsersRead = $noteRecords[0]['beusersread'];
             if (is_array($noteRecords) && !t3lib_div::inList($beUsersRead, intval($cmdArr['setRead']))) {
                 // Configure the TCEmain command array:
                 $dataArr = array();
                 $dataArr['tx_rlmptvnotes_notes'][$noteRecords[0]['uid']] = array('beusersread' => (strlen($beUsersRead) ? $beUsersRead . ',' : '') . intval($cmdArr['setRead']));
                 // Create the new note:
                 $TCEmain = t3lib_div::makeInstance('t3lib_TCEmain');
                 $TCEmain->stripslashes_values = 0;
                 $TCEmain->start($dataArr, array());
                 $TCEmain->process_datamap();
             }
         }
     }
 }
示例#30
0
 /**
  * Returns the CSH Icon for given string
  *
  * @param	string		Locallang key
  * @param	string		The label to be used, that should be wrapped in help
  * @return	string		HTML output.
  */
 protected function getCSH($str, $label)
 {
     $context = '_MOD_user_setup';
     $field = $str;
     $strParts = explode(':', $str);
     if (count($strParts) > 1) {
         // Setting comes from another extension
         $context = $strParts[0];
         $field = $strParts[1];
     } else {
         if (!t3lib_div::inList('language,simuser', $str)) {
             $field = 'option_' . $str;
         }
     }
     return t3lib_BEfunc::wrapInHelp($context, $field, $label);
 }