/**
  * Ajax handler for the "suggest" feature in TCEforms.
  *
  * @param array $params The parameters from the AJAX call
  * @param TYPO3AJAX $ajaxObj The AJAX object representing the AJAX call
  * @return void
  */
 public function processAjaxRequest($params, &$ajaxObj)
 {
     // get parameters from $_GET/$_POST
     $search = t3lib_div::_GP('value');
     $table = t3lib_div::_GP('table');
     $field = t3lib_div::_GP('field');
     $uid = t3lib_div::_GP('uid');
     $pageId = t3lib_div::_GP('pid');
     t3lib_div::loadTCA($table);
     // If the $uid is numeric, we have an already existing element, so get the
     // TSconfig of the page itself or the element container (for non-page elements)
     // otherwise it's a new element, so use given id of parent page (i.e., don't modify it here)
     if (is_numeric($uid)) {
         if ($table == 'pages') {
             $pageId = $uid;
         } else {
             $row = t3lib_BEfunc::getRecord($table, $uid);
             $pageId = $row['pid'];
         }
     }
     $TSconfig = t3lib_BEfunc::getPagesTSconfig($pageId);
     $queryTables = array();
     $foreign_table_where = '';
     $wizardConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config']['wizards']['suggest'];
     if (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed'])) {
         $queryTables = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed']);
     } elseif (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table'])) {
         $queryTables = array($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table']);
         $foreign_table_where = $GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table_where'];
         // strip ORDER BY clause
         $foreign_table_where = trim(preg_replace('/ORDER[[:space:]]+BY.*/i', '', $foreign_table_where));
     }
     $resultRows = array();
     // fetch the records for each query table. A query table is a table from which records are allowed to
     // be added to the TCEForm selector, originally fetched from the "allowed" config option in the TCA
     foreach ($queryTables as $queryTable) {
         t3lib_div::loadTCA($queryTable);
         // if the table does not exist, skip it
         if (!is_array($GLOBALS['TCA'][$queryTable]) || !count($GLOBALS['TCA'][$queryTable])) {
             continue;
         }
         $config = (array) $wizardConfig['default'];
         if (is_array($wizardConfig[$queryTable])) {
             $config = t3lib_div::array_merge_recursive_overrule($config, $wizardConfig[$queryTable]);
         }
         // merge the configurations of different "levels" to get the working configuration for this table and
         // field (i.e., go from the most general to the most special configuration)
         if (is_array($TSconfig['TCEFORM.']['suggest.']['default.'])) {
             $config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.']['suggest.']['default.']);
         }
         if (is_array($TSconfig['TCEFORM.']['suggest.'][$queryTable . '.'])) {
             $config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.']['suggest.'][$queryTable . '.']);
         }
         // use $table instead of $queryTable here because we overlay a config
         // for the input-field here, not for the queried table
         if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.'])) {
             $config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.']);
         }
         if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.'])) {
             $config = t3lib_div::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.']);
         }
         //process addWhere
         if (!isset($config['addWhere']) && $foreign_table_where) {
             $config['addWhere'] = $foreign_table_where;
         }
         if (isset($config['addWhere'])) {
             $config['addWhere'] = strtr(' ' . $config['addWhere'], array('###THIS_UID###' => intval($uid), '###CURRENT_PID###' => intval($pageId)));
         }
         // instantiate the class that should fetch the records for this $queryTable
         $receiverClassName = $config['receiverClass'];
         if (!class_exists($receiverClassName)) {
             $receiverClassName = 't3lib_TCEforms_Suggest_DefaultReceiver';
         }
         $receiverObj = t3lib_div::makeInstance($receiverClassName, $queryTable, $config);
         $params = array('value' => $search);
         $rows = $receiverObj->queryTable($params);
         if (empty($rows)) {
             continue;
         }
         $resultRows = t3lib_div::array_merge($resultRows, $rows);
         unset($rows);
     }
     $listItems = array();
     if (count($resultRows) > 0) {
         // traverse all found records and sort them
         $rowsSort = array();
         foreach ($resultRows as $key => $row) {
             $rowsSort[$key] = $row['text'];
         }
         asort($rowsSort);
         $rowsSort = array_keys($rowsSort);
         // Limit the number of items in the result list
         $maxItems = $config['maxItemsInResultList'] ? $config['maxItemsInResultList'] : 10;
         $maxItems = min(count($resultRows), $maxItems);
         // put together the selector entry
         for ($i = 0; $i < $maxItems; $i++) {
             $row = $resultRows[$rowsSort[$i]];
             $rowId = $row['table'] . '-' . $row['uid'] . '-' . $table . '-' . $uid . '-' . $field;
             $listItems[] = '<li' . ($row['class'] != '' ? ' class="' . $row['class'] . '"' : '') . ' id="' . $rowId . '" style="' . $row['style'] . '">' . $row['text'] . '</li>';
         }
     }
     if (count($listItems) > 0) {
         $list = implode('', $listItems);
     } else {
         $list = '<li class="suggest-noresults"><i>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.noRecordFound') . '</i></li>';
     }
     $list = '<ul class="' . $this->cssClass . '-resultlist">' . $list . '</ul>';
     $ajaxObj->addContent(0, $list);
 }
    /**
     * Send an email notification to users in workspace
     *
     * @param array $stat Workspace access array (from t3lib_userauthgroup::checkWorkspace())
     * @param integer $stageId New Stage number: 0 = editing, 1= just ready for review, 10 = ready for publication, -1 = rejected!
     * @param string $table Table name of element (or list of element names if $id is zero)
     * @param integer $id Record uid of element (if zero, then $table is used as reference to element(s) alone)
     * @param string $comment User comment sent along with action
     * @param t3lib_TCEmain $tcemainObj TCEmain object
     * @param string $notificationAlternativeRecipients Comma separated list of recipients to notificate instead of be_users selected by sys_workspace, list is generated by workspace extension module
     * @return void
     */
    protected function notifyStageChange(array $stat, $stageId, $table, $id, $comment, t3lib_TCEmain $tcemainObj, $notificationAlternativeRecipients = FALSE)
    {
        $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace', $stat['uid']);
        // So, if $id is not set, then $table is taken to be the complete element name!
        $elementName = $id ? $table . ':' . $id : $table;
        if (is_array($workspaceRec)) {
            // Get the new stage title from workspaces library, if workspaces extension is installed
            if (t3lib_extMgm::isLoaded('workspaces')) {
                $stageService = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
                $newStage = $stageService->getStageTitle((int) $stageId);
            } else {
                // TODO: CONSTANTS SHOULD BE USED - tx_service_workspace_workspaces
                // TODO: use localized labels
                // Compile label:
                switch ((int) $stageId) {
                    case 1:
                        $newStage = 'Ready for review';
                        break;
                    case 10:
                        $newStage = 'Ready for publishing';
                        break;
                    case -1:
                        $newStage = 'Element was rejected!';
                        break;
                    case 0:
                        $newStage = 'Rejected element was noticed and edited';
                        break;
                    default:
                        $newStage = 'Unknown state change!?';
                        break;
                }
            }
            if ($notificationAlternativeRecipients == false) {
                // Compile list of recipients:
                $emails = array();
                switch ((int) $stat['stagechg_notification']) {
                    case 1:
                        switch ((int) $stageId) {
                            case 1:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
                                break;
                            case 10:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
                                break;
                            case -1:
                                #								$emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
                                #								$emails = array_merge($emails,$this->getEmailsForStageChangeNotification($workspaceRec['members']));
                                // List of elements to reject:
                                $allElements = explode(',', $elementName);
                                // Traverse them, and find the history of each
                                foreach ($allElements as $elRef) {
                                    list($eTable, $eUid) = explode(':', $elRef);
                                    $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('log_data,tstamp,userid', 'sys_log', 'action=6 and details_nr=30
											AND tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($eTable, 'sys_log') . '
											AND recuid=' . intval($eUid), '', 'uid DESC');
                                    // Find all implicated since the last stage-raise from editing to review:
                                    foreach ($rows as $dat) {
                                        $data = unserialize($dat['log_data']);
                                        $emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($dat['userid'], TRUE));
                                        if ($data['stage'] == 1) {
                                            break;
                                        }
                                    }
                                }
                                break;
                            case 0:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']);
                                break;
                            default:
                                $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
                                break;
                        }
                        break;
                    case 10:
                        $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
                        $emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']));
                        $emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['members']));
                        break;
                }
            } else {
                $emails = array();
                foreach ($notificationAlternativeRecipients as $emailAddress) {
                    $emails[] = array('email' => $emailAddress);
                }
            }
            // prepare and then send the emails
            if (count($emails)) {
                // Path to record is found:
                list($elementTable, $elementUid) = explode(':', $elementName);
                $elementUid = intval($elementUid);
                $elementRecord = t3lib_BEfunc::getRecord($elementTable, $elementUid);
                $recordTitle = t3lib_BEfunc::getRecordTitle($elementTable, $elementRecord);
                if ($elementTable == 'pages') {
                    $pageUid = $elementUid;
                } else {
                    t3lib_BEfunc::fixVersioningPid($elementTable, $elementRecord);
                    $pageUid = $elementUid = $elementRecord['pid'];
                }
                // fetch the TSconfig settings for the email
                // old way, options are TCEMAIN.notificationEmail_body/subject
                $TCEmainTSConfig = $tcemainObj->getTCEMAIN_TSconfig($pageUid);
                // these options are deprecated since TYPO3 4.5, but are still
                // used in order to provide backwards compatibility
                $emailMessage = trim($TCEmainTSConfig['notificationEmail_body']);
                $emailSubject = trim($TCEmainTSConfig['notificationEmail_subject']);
                // new way, options are
                // pageTSconfig: tx_version.workspaces.stageNotificationEmail.subject
                // userTSconfig: page.tx_version.workspaces.stageNotificationEmail.subject
                $pageTsConfig = t3lib_BEfunc::getPagesTSconfig($pageUid);
                $emailConfig = $pageTsConfig['tx_version.']['workspaces.']['stageNotificationEmail.'];
                $markers = array('###RECORD_TITLE###' => $recordTitle, '###RECORD_PATH###' => t3lib_BEfunc::getRecordPath($elementUid, '', 20), '###SITE_NAME###' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], '###SITE_URL###' => t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir, '###WORKSPACE_TITLE###' => $workspaceRec['title'], '###WORKSPACE_UID###' => $workspaceRec['uid'], '###ELEMENT_NAME###' => $elementName, '###NEXT_STAGE###' => $newStage, '###COMMENT###' => $comment, '###USER_REALNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_USERNAME###' => $tcemainObj->BE_USER->user['username']);
                // sending the emails the old way with sprintf(),
                // because it was set explicitly in TSconfig
                if ($emailMessage && $emailSubject) {
                    t3lib_div::deprecationLog('This TYPO3 installation uses Workspaces staging notification by setting the TSconfig options "TCEMAIN.notificationEmail_subject" / "TCEMAIN.notificationEmail_body". Please use the more flexible marker-based options tx_version.workspaces.stageNotificationEmail.message / tx_version.workspaces.stageNotificationEmail.subject');
                    $emailSubject = sprintf($emailSubject, $elementName);
                    $emailMessage = sprintf($emailMessage, $markers['###SITE_NAME###'], $markers['###SITE_URL###'], $markers['###WORKSPACE_TITLE###'], $markers['###WORKSPACE_UID###'], $markers['###ELEMENT_NAME###'], $markers['###NEXT_STAGE###'], $markers['###COMMENT###'], $markers['###USER_REALNAME###'], $markers['###USER_USERNAME###'], $markers['###RECORD_PATH###'], $markers['###RECORD_TITLE###']);
                    // filter out double email addresses
                    $emailRecipients = array();
                    foreach ($emails as $recip) {
                        $emailRecipients[$recip['email']] = $recip['email'];
                    }
                    $emailRecipients = implode(',', $emailRecipients);
                    // Send one email to everybody
                    t3lib_div::plainMailEncoded($emailRecipients, $emailSubject, $emailMessage);
                } else {
                    // send an email to each individual user, to ensure the
                    // multilanguage version of the email
                    $emailHeaders = $emailConfig['additionalHeaders'];
                    $emailRecipients = array();
                    // an array of language objects that are needed
                    // for emails with different languages
                    $languageObjects = array($GLOBALS['LANG']->lang => $GLOBALS['LANG']);
                    // loop through each recipient and send the email
                    foreach ($emails as $recipientData) {
                        // don't send an email twice
                        if (isset($emailRecipients[$recipientData['email']])) {
                            continue;
                        }
                        $emailSubject = $emailConfig['subject'];
                        $emailMessage = $emailConfig['message'];
                        $emailRecipients[$recipientData['email']] = $recipientData['email'];
                        // check if the email needs to be localized
                        // in the users' language
                        if (t3lib_div::isFirstPartOfStr($emailSubject, 'LLL:') || t3lib_div::isFirstPartOfStr($emailMessage, 'LLL:')) {
                            $recipientLanguage = $recipientData['lang'] ? $recipientData['lang'] : 'default';
                            if (!isset($languageObjects[$recipientLanguage])) {
                                // a LANG object in this language hasn't been
                                // instantiated yet, so this is done here
                                /** @var $languageObject language */
                                $languageObject = t3lib_div::makeInstance('language');
                                $languageObject->init($recipientLanguage);
                                $languageObjects[$recipientLanguage] = $languageObject;
                            } else {
                                $languageObject = $languageObjects[$recipientLanguage];
                            }
                            if (t3lib_div::isFirstPartOfStr($emailSubject, 'LLL:')) {
                                $emailSubject = $languageObject->sL($emailSubject);
                            }
                            if (t3lib_div::isFirstPartOfStr($emailMessage, 'LLL:')) {
                                $emailMessage = $languageObject->sL($emailMessage);
                            }
                        }
                        $emailSubject = t3lib_parseHtml::substituteMarkerArray($emailSubject, $markers, '', TRUE, TRUE);
                        $emailMessage = t3lib_parseHtml::substituteMarkerArray($emailMessage, $markers, '', TRUE, TRUE);
                        // Send an email to the recipient
                        t3lib_div::plainMailEncoded($recipientData['email'], $emailSubject, $emailMessage, $emailHeaders);
                    }
                    $emailRecipients = implode(',', $emailRecipients);
                }
                $tcemainObj->newlog2('Notification email for stage change was sent to "' . $emailRecipients . '"', $table, $id);
            }
        }
    }
Example #3
0
 /**
  * Generate a different preview link
  *
  * @param string $status status
  * @param string $table table name
  * @param integer $recordUid id of the record
  * @param array $fields fieldArray
  * @param t3lib_TCEmain $parentObject parent Object
  * @return void
  */
 public function processDatamap_afterDatabaseOperations($status, $table, $recordUid, array $fields, t3lib_TCEmain $parentObject)
 {
     // Clear category cache
     if ($table === 'tx_news_domain_model_category') {
         $cache = t3lib_div::makeInstance('Tx_News_Service_CacheService', 'news_categorycache');
         $cache->flush();
     }
     // Preview link
     if ($table === 'tx_news_domain_model_news') {
         // direct preview
         if (!is_numeric($recordUid)) {
             $recordUid = $parentObject->substNEWwithIDs[$recordUid];
         }
         if (isset($GLOBALS['_POST']['_savedokview_x']) && !$fields['type']) {
             // If "savedokview" has been pressed and current article has "type" 0 (= normal news article)
             $pagesTsConfig = t3lib_BEfunc::getPagesTSconfig($GLOBALS['_POST']['popViewId']);
             if ($pagesTsConfig['tx_news.']['singlePid']) {
                 $record = t3lib_BEfunc::getRecord('tx_news_domain_model_news', $recordUid);
                 $parameters = array('no_cache' => 1, 'tx_news_pi1[controller]' => 'News', 'tx_news_pi1[action]' => 'detail', 'tx_news_pi1[news_preview]' => $record['uid']);
                 if ($record['sys_language_uid'] > 0) {
                     if ($record['l10n_parent'] > 0) {
                         $parameters['tx_news_pi1[news_preview]'] = $record['l10n_parent'];
                     }
                     $parameters['L'] = $record['sys_language_uid'];
                 }
                 $GLOBALS['_POST']['popViewId_addParams'] = t3lib_div::implodeArrayForUrl('', $parameters, '', FALSE, TRUE);
                 $GLOBALS['_POST']['popViewId'] = $pagesTsConfig['tx_news.']['singlePid'];
             }
         }
     }
 }
 /**
  * Set the DB TCA field with an userfunction to allow dynamic manipulation
  *
  * @param	array		$PA:
  * @param	array		$fobj:
  * @return	The		TCA field
  */
 function user_rgslideshow($PA, $fobj)
 {
     // get the correct tables which are allowed > tsconfig rgslideshow.tables
     $pid = $this->getStorageFolderPid($PA['row']['pid']);
     $pagesTSC = t3lib_BEfunc::getPagesTSconfig($pid);
     // get page TSconfig
     $table = $pagesTSC['rgslideshow.']['tables'];
     // if there are any tables set in TsConfig
     if ($table != '') {
         // get the old value to set this into the field
         $flexform = t3lib_div::xml2array($PA['row']['pi_flexform']);
         $imgOld = is_array($flexform) ? $flexform['data']['sDEF']['lDEF']['images2']['vDEF'] : '';
         // configuration of the field, see TCA for more options
         $config = array('fieldConf' => array('label' => 'images2', 'config' => array('type' => 'group', 'prepend_tname' => 1, 'internal_type' => 'db', 'allowed' => $table, 'show_thumbs' => 1, 'size' => 10, 'autoSizeMax' => 20, 'maxitems' => 30, 'minitems' => 0, 'form_type' => 'group')), 'onFocus' => '', 'label' => 'Plugin Options', 'itemFormElValue' => $imgOld, 'itemFormElName' => 'data[tt_content][' . $PA['row']['uid'] . '][pi_flexform][data][sDEF][lDEF][images2][vDEF]', 'itemFormElName_file' => 'data_files[tt_content][' . $PA['row']['uid'] . '][pi_flexform][data][sDEF][lDEF][images2][vDEF]');
         // create the element
         $form = t3lib_div::makeInstance('t3lib_TCEforms');
         $form->initDefaultBEMode();
         $form->backPath = $GLOBALS['BACK_PATH'];
         $element = $form->getSingleField_typeGroup('tt_content', 'pi_flexform', $PA['row'], $config);
         return $form->printNeededJSFunctions_top() . $element . $form->printNeededJSFunctions();
     } else {
         // no tables allowed
         return '<div style="font-weight:bold;padding:1px 10px;margin:2px:5px">
             No Table allowed. Set it in TsConfig with
             <pre>rgslideshow.tables = tt_news,pages,fe_users,...</pre>
           </div> ';
     }
 }
 function init()
 {
     global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
     if (t3lib_div::_GP('pageId') < 0 || t3lib_div::_GP('pageId') == '' || t3lib_div::_GP('templateId') < 0 || t3lib_div::_GP('templateId') == '' || t3lib_div::_GP('ISOcode') == '') {
         die('if you want to us this mod you need at least to define pageId, templateId and ISOcode as GET parameter. Example path/to/TinyMCETemplate.php?pageId=7&templateId=2&ISOcode=en');
     }
     $this->pageId = t3lib_div::_GP('pageId');
     $this->templateId = t3lib_div::_GP('templateId');
     $this->ISOcode = t3lib_div::_GP('ISOcode');
     $this->pageTSconfig = t3lib_BEfunc::getPagesTSconfig($this->pageId);
     if (t3lib_div::_GP('mode') != 'FE') {
         $this->conf = $this->pageTSconfig['RTE.']['default.'];
     } else {
         $this->conf = $this->pageTSconfig['RTE.']['default.']['FE.'];
     }
     $LANG->init(strtolower($this->ISOcode));
     $this->tinymce_rte = t3lib_div::makeInstance('tx_tinymce_rte_base');
     $this->conf = $this->tinymce_rte->init($this->conf);
     $row = array('pid' => $this->pageId, 'ISOcode' => $this->ISOcode);
     $this->conf = $this->tinymce_rte->fixTinyMCETemplates($this->conf, $row);
     if (is_array($this->conf['TinyMCE_templates.'][$this->templateId]) && $this->conf['TinyMCE_templates.'][$this->templateId]['include'] != '') {
         if (is_file($this->conf['TinyMCE_templates.'][$this->templateId]['include'])) {
             include_once $this->conf['TinyMCE_templates.'][$this->templateId]['include'];
         } else {
             die('no file found at include path');
         }
     }
 }
    /**
     * Hook-function: inject JavaScript code before the BE page is compiled
     * called in typo3/template.php:startPage
     *
     * @param array $parameters (not very usable, as it just contains a title..)
     * @param template $pObj
     */
    function preStartPageHook($parameters, $pObj)
    {
        // Only add JS if this is the top TYPO3 frame/document
        if ($pObj->bodyTagId == 'typo3-backend-php') {
            $tinymce_rte = t3lib_div::makeInstance('tx_tinymce_rte_base');
            $pageTSconfig = t3lib_BEfunc::getPagesTSconfig(0);
            $conf = $pageTSconfig['RTE.']['pageLoad.'];
            $conf = $tinymce_rte->init($conf);
            $conf['init.']['mode'] = 'none';
            unset($conf['init.']['spellchecker_rpc_url']);
            $pObj->JScode .= $tinymce_rte->getCoreScript($conf);
            //$pObj->JScode .= $tinymce_rte->getInitScript( $conf['init.'] );
            $pObj->JScode .= '
				<script type="text/javascript">
					function typo3filemanager(field_name, url, type, win) {
						if( document.getElementById("typo3-contentContainer") && 
								document.getElementById("typo3-contentContainer").getElementsByTagName("iframe")[0] && 
								document.getElementById("typo3-contentContainer").getElementsByTagName("iframe")[0].contentWindow &&
								document.getElementById("typo3-contentContainer").getElementsByTagName("iframe")[0].contentWindow.typo3filemanager ) {
							// TYPO3 4.5
							document.getElementById("typo3-contentContainer").getElementsByTagName("iframe")[0].contentWindow.typo3filemanager(field_name, url, type, win);
						} else if( document.getElementById("content").contentWindow.list_frame && document.getElementById("content").contentWindow.list_frame.typo3filemanager ) {
							// < TYPO3 4.5
							document.getElementById("content").contentWindow.list_frame.typo3filemanager(field_name, url, type, win);
						} else {
							// < TYPO3 4.5 compact mode
							document.getElementById("content").contentWindow.typo3filemanager(field_name, url, type, win);
						}
					}
				</script>
			';
        }
    }
 public function user_fieldvisibility($PA, $fobj)
 {
     $this->init();
     //init some class attributes
     $this->pageId = $PA['row']['pid'];
     $uid = $PA['row']['uid'];
     if (substr($uid, 0, 3) == 'NEW') {
         $this->isNewElement = TRUE;
     }
     if ($PA['table'] == 'pages' && !$this->isNewElement) {
         $this->pageId = $PA['row']['uid'];
     }
     $_modTSconfig = $GLOBALS["BE_USER"]->getTSConfig('mod.languagevisibility', t3lib_BEfunc::getPagesTSconfig($this->pageId));
     $this->modTSconfig = $_modTSconfig['properties'];
     ###
     $languageRep = t3lib_div::makeInstance('tx_languagevisibility_languagerepository');
     $dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon');
     if (version_compare(TYPO3_version, '4.3.0', '<')) {
         $elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory');
         $elementfactory = new $elementfactoryName($dao);
     } else {
         $elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao);
     }
     $value = $PA['row'][$PA['field']];
     $table = $PA['table'];
     $isOverlay = tx_languagevisibility_beservices::isOverlayRecord($PA['row'], $table);
     $visivilitySetting = @unserialize($value);
     if (!is_array($visivilitySetting) && $value != '') {
         $content .= 'Visibility Settings seems to be corrupt:' . $value;
     }
     if ($isOverlay) {
         $uid = tx_languagevisibility_beservices::getOriginalUidOfTranslation($PA['row'], $table);
         $table = tx_languagevisibility_beservices::getOriginalTableOfTranslation($table);
         //This element is an overlay therefore we need to render the visibility field just for the language of the overlay
         $overlayRecordsLanguage = $languageRep->getLanguageById($PA['row']['sys_language_uid']);
         try {
             $originalElement = $elementfactory->getElementForTable($table, $uid);
         } catch (Exception $e) {
             return '';
         }
         $infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, array($overlayRecordsLanguage), $PA['itemFormElName'], true);
     } else {
         //This element is an original element (no overlay)
         try {
             $originalElement = $elementfactory->getElementForTable($table, $uid);
         } catch (Exception $e) {
             return 'sorry this element supports no visibility settings';
         }
         $content .= $originalElement->getInformativeDescription();
         if ($originalElement->isMonolithicTranslated()) {
             return $content;
         }
         $languageList = $languageRep->getLanguages();
         $infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, $languageList, $PA['itemFormElName'], false);
     }
     $content .= $this->_renderLanguageInfos($infosStruct);
     return '<div id="fieldvisibility">' . $content . '<a href="#" onclick="resetSelectboxes()">reset</a></div>' . $this->_javascript();
 }
 function addIncludes()
 {
     global $TSFE;
     $tinymce_rte = t3lib_div::makeInstance('tx_tinymce_rte_base');
     $pageTSconfig = t3lib_BEfunc::getPagesTSconfig($TSFE->id);
     $config = $pageTSconfig['RTE.']['default.'];
     $config = $tinymce_rte->init($config);
     $myIncludes = $tinymce_rte->getCoreScript($config);
     $myIncludes .= "\n" . $tinymce_rte->getInitScript($config['init.']);
     return $myIncludes;
 }
 /**
  * Preprocessing of fields
  *
  * @param string $table table name
  * @param string $field field name
  * @param array $row record row
  * @param string $altName
  * @param string $palette
  * @param string $extra
  * @param string $pal
  * @param t3lib_TCEforms $parentObject
  * @return void
  */
 public function getSingleField_preProcess($table, $field, array &$row, $altName, $palette, $extra, $pal, t3lib_TCEforms $parentObject)
 {
     // Predefine the archive date
     if ($table === 'tx_news_domain_model_news' && empty($row['archive']) && is_numeric($row['pid'])) {
         $pagesTsConfig = t3lib_BEfunc::getPagesTSconfig($row['pid']);
         if (is_array($pagesTsConfig['tx_news.']['predefine.']) && is_array($pagesTsConfig['tx_news.']['predefine.']) && isset($pagesTsConfig['tx_news.']['predefine.']['archive'])) {
             $calculatedTime = strtotime($pagesTsConfig['tx_news.']['predefine.']['archive']);
             if ($calculatedTime !== FALSE) {
                 $row['archive'] = $calculatedTime;
             }
         }
     }
 }
 function addIncludes()
 {
     $tinymce_rte = t3lib_div::makeInstance('tx_tinymce_rte_base');
     $pageTSconfig = t3lib_BEfunc::getPagesTSconfig("");
     $myConf = $pageTSconfig['RTE.']['default.'];
     $myConf['loadConfig'] = 'EXT:tinymce_rte/static/pageLoad.ts';
     if ($myConf['pageLoadConfigFile'] != '' && is_file($tinymce_rte->getPath($myConf['pageLoadConfigFile'], 1))) {
         $myConf['loadConfig'] = $myConf['pageLoadConfigFile'];
     }
     $rteConf = $tinymce_rte->init($myConf);
     $rteConf['init.']['mode'] = 'none';
     $myIncludes = array();
     $myIncludes[] = $tinymce_rte->getCoreScript($rteConf);
     $myIncludes[] = $tinymce_rte->getInitScript($rteConf['init.']);
     return $myIncludes;
 }
Example #11
0
 /**
  * Initializes the Module
  * @return    void
  */
 function init()
 {
     /*{{{*/
     global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
     parent::init();
     $this->enableFields_tickets = t3lib_BEfunc::deleteClause($this->tickets_table) . t3lib_BEfunc::BEenableFields($this->tickets_table);
     $this->enableFields_fe_users = t3lib_BEfunc::deleteClause($this->users_table) . t3lib_BEfunc::BEenableFields($this->users_table);
     $this->enableFields_category = t3lib_BEfunc::deleteClause($this->category_table) . t3lib_BEfunc::BEenableFields($this->category_table);
     $this->enableFields_address = t3lib_BEfunc::deleteClause($this->address_table) . t3lib_BEfunc::BEenableFields($this->address_table);
     $this->enableFields_pages = t3lib_BEfunc::deleteClause($this->pages_table) . t3lib_BEfunc::BEenableFields($this->pages_table);
     $this->lib = t3lib_div::makeInstance('tx_ketroubletickets_lib');
     // get the page ts config
     $this->pageTSConfig = t3lib_BEfunc::getPagesTSconfig($this->id);
     /*
     if (t3lib_div::_GP('clear_all_cache'))    {
         $this->include_once[] = PATH_t3lib.'class.t3lib_tcemain.php';
     }
     */
 }
 /**
  * Itemsproc function to extend the selection of templateLayouts in the plugin
  *
  * @param array &$config configuration array
  * @param t3lib_TCEforms $parentObject parent object
  * @return void
  */
 public function user_templateLayout(array &$config, t3lib_TCEforms $parentObject)
 {
     // Check if the layouts are extended by ext_tables
     if (isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['templateLayouts']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['templateLayouts'])) {
         // Add every item
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['templateLayouts'] as $layouts) {
             $additionalLayout = array($GLOBALS['LANG']->sL($layouts[0], TRUE), $layouts[1]);
             array_push($config['items'], $additionalLayout);
         }
     }
     // Add tsconfig values
     if (is_numeric($config['row']['pid'])) {
         $pagesTsConfig = t3lib_BEfunc::getPagesTSconfig($config['row']['pid']);
         if (isset($pagesTsConfig['tx_news.']['templateLayouts.']) && is_array($pagesTsConfig['tx_news.']['templateLayouts.'])) {
             // Add every item
             foreach ($pagesTsConfig['tx_news.']['templateLayouts.'] as $key => $label) {
                 $additionalLayout = array($GLOBALS['LANG']->sL($label, TRUE), $key);
                 array_push($config['items'], $additionalLayout);
             }
         }
     }
 }
    /**
     * Hook-function: inject JavaScript code before the BE page is compiled
     * called in typo3/template.php:startPage
     *
     * @param array $parameters (not very usable, as it just contains a title..)
     * @param template $pObj
     */
    function preStartPageHook($parameters, $pObj)
    {
        // Only add JS if this is the top TYPO3 frame/document
        if ($pObj->bodyTagId == 'typo3-backend-php') {
            $tinymce_rte = t3lib_div::makeInstance('tx_tinymce_rte_base');
            $pageTSconfig = t3lib_BEfunc::getPagesTSconfig("");
            $this->conf = $pageTSconfig['RTE.']['default.'];
            $this->conf['loadConfig'] = 'EXT:tinymce_rte/static/pageLoad.ts';
            if ($this->conf['pageLoadConfigFile'] != '' && is_file($tinymce_rte->getPath($this->conf['pageLoadConfigFile'], 1))) {
                $this->conf['loadConfig'] = $this->conf['pageLoadConfigFile'];
            }
            $this->conf = $tinymce_rte->init($this->conf);
            $this->conf['init.']['mode'] = 'none';
            $pObj->JScode .= $tinymce_rte->getCoreScript($this->conf);
            $pObj->JScode .= $tinymce_rte->getInitScript($this->conf['init.']);
            $pObj->JScode .= '
				<script type="text/javascript">
					function typo3filemanager(field_name, url, type, win) {
						document.getElementById("content").contentWindow.list_frame.typo3filemanager(field_name, url, type, win);
					}
				</script>
			';
        }
    }
 /**
  * Return TSconfig for a page id
  *
  * @param	integer		Page id (PID) from which to get configuration.
  * @return	array		TSconfig array, if any
  */
 function getTCEMAIN_TSconfig($tscPID)
 {
     if (!isset($this->cachedTSconfig[$tscPID])) {
         $this->cachedTSconfig[$tscPID] = $this->BE_USER->getTSConfig('TCEMAIN', t3lib_BEfunc::getPagesTSconfig($tscPID));
     }
     return $this->cachedTSconfig[$tscPID]['properties'];
 }
    /**
     * Constructor:
     * Initializes a lot of variables, setting JavaScript functions in header etc.
     *
     * @return	void
     */
    function init()
    {
        global $BE_USER, $BACK_PATH;
        // Main GPvars:
        $this->pointer = t3lib_div::_GP('pointer');
        $this->bparams = t3lib_div::_GP('bparams');
        $this->P = t3lib_div::_GP('P');
        $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
        $this->expandPage = t3lib_div::_GP('expandPage');
        $this->expandFolder = t3lib_div::_GP('expandFolder');
        $this->PM = t3lib_div::_GP('PM');
        // Find "mode"
        $this->mode = t3lib_div::_GP('mode');
        if (!$this->mode) {
            $this->mode = 'rte';
        }
        // Creating backend template object:
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        // Load the Prototype library and browse_links.js
        $this->doc->getPageRenderer()->loadPrototype();
        $this->doc->loadJavascriptLib('js/browse_links.js');
        // init hook objects:
        $this->hookObjects = array();
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'] as $classData) {
                $processObject = t3lib_div::getUserObj($classData);
                if (!$processObject instanceof t3lib_browseLinksHook) {
                    throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195039394);
                }
                $parameters = array();
                $processObject->init($this, $parameters);
                $this->hookObjects[] = $processObject;
            }
        }
        // Site URL
        $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
        // Current site url
        // the script to link to
        $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
        // init fileProcessor
        $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
        // CurrentUrl - the current link url must be passed around if it exists
        if ($this->mode == 'wizard') {
            $currentLinkParts = t3lib_div::unQuoteFilenames($this->P['currentValue'], TRUE);
            $initialCurUrlArray = array('href' => $currentLinkParts[0], 'target' => $currentLinkParts[1], 'class' => $currentLinkParts[2], 'title' => $currentLinkParts[3]);
            $this->curUrlArray = is_array(t3lib_div::_GP('curUrl')) ? array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) : $initialCurUrlArray;
            $this->curUrlInfo = $this->parseCurUrl($this->siteURL . '?id=' . $this->curUrlArray['href'], $this->siteURL);
            if ($this->curUrlInfo['pageid'] == 0 && $this->curUrlArray['href']) {
                // pageid == 0 means that this is not an internal (page) link
                if (file_exists(PATH_site . rawurldecode($this->curUrlArray['href']))) {
                    // check if this is a link to a file
                    if (t3lib_div::isFirstPartOfStr($this->curUrlArray['href'], PATH_site)) {
                        $currentLinkParts[0] = substr($this->curUrlArray['href'], strlen(PATH_site));
                    }
                    $this->curUrlInfo = $this->parseCurUrl($this->siteURL . $this->curUrlArray['href'], $this->siteURL);
                } elseif (strstr($this->curUrlArray['href'], '@')) {
                    // check for email link
                    if (t3lib_div::isFirstPartOfStr($this->curUrlArray['href'], 'mailto:')) {
                        $currentLinkParts[0] = substr($this->curUrlArray['href'], 7);
                    }
                    $this->curUrlInfo = $this->parseCurUrl('mailto:' . $this->curUrlArray['href'], $this->siteURL);
                } else {
                    // nothing of the above. this is an external link
                    if (strpos($this->curUrlArray['href'], '://') === false) {
                        $currentLinkParts[0] = 'http://' . $this->curUrlArray['href'];
                    }
                    $this->curUrlInfo = $this->parseCurUrl($currentLinkParts[0], $this->siteURL);
                }
            } elseif (!$this->curUrlArray['href']) {
                $this->curUrlInfo = array();
                $this->act = 'page';
            } else {
                $this->curUrlInfo = $this->parseCurUrl($this->siteURL . '?id=' . $this->curUrlArray['href'], $this->siteURL);
            }
        } else {
            $this->curUrlArray = t3lib_div::_GP('curUrl');
            if ($this->curUrlArray['all']) {
                $this->curUrlArray = t3lib_div::get_tag_attributes($this->curUrlArray['all']);
            }
            $this->curUrlInfo = $this->parseCurUrl($this->curUrlArray['href'], $this->siteURL);
        }
        // Determine nature of current url:
        $this->act = t3lib_div::_GP('act');
        if (!$this->act) {
            $this->act = $this->curUrlInfo['act'];
        }
        // Rich Text Editor specific configuration:
        $addPassOnParams = '';
        if ((string) $this->mode == 'rte') {
            $RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
            $addPassOnParams .= '&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams);
            $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
            $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
        }
        // Initializing the target value (RTE)
        $this->setTarget = $this->curUrlArray['target'] != '-' ? $this->curUrlArray['target'] : '';
        if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
            $this->setTarget = $this->thisConfig['defaultLinkTarget'];
        }
        // Initializing the class value (RTE)
        $this->setClass = $this->curUrlArray['class'] != '-' ? $this->curUrlArray['class'] : '';
        // Initializing the title value (RTE)
        $this->setTitle = $this->curUrlArray['title'] != '-' ? $this->curUrlArray['title'] : '';
        // BEGIN accumulation of header JavaScript:
        $JScode = '
				// This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
			var add_href="' . ($this->curUrlArray['href'] ? '&curUrl[href]=' . rawurlencode($this->curUrlArray['href']) : '') . '";
			var add_target="' . ($this->setTarget ? '&curUrl[target]=' . rawurlencode($this->setTarget) : '') . '";
			var add_class="' . ($this->setClass ? '&curUrl[class]=' . rawurlencode($this->setClass) : '') . '";
			var add_title="' . ($this->setTitle ? '&curUrl[title]=' . rawurlencode($this->setTitle) : '') . '";
			var add_params="' . ($this->bparams ? '&bparams=' . rawurlencode($this->bparams) : '') . '";

			var cur_href="' . ($this->curUrlArray['href'] ? $this->curUrlArray['href'] : '') . '";
			var cur_target="' . ($this->setTarget ? $this->setTarget : '') . '";
			var cur_class = "' . ($this->setClass ? $this->setClass : '-') . '";
			var cur_title="' . ($this->setTitle ? $this->setTitle : '') . '";

			function browse_links_setTarget(target)	{	//
				cur_target=target;
				add_target="&curUrl[target]="+escape(target);
			}
			function browse_links_setClass(cssClass) {   //
				cur_class = cssClass;
				add_class = "&curUrl[class]=" + escape(cssClass);
			}
			function browse_links_setTitle(title)	{	//
				cur_title=title;
				add_title="&curUrl[title]="+escape(title);
			}
			function browse_links_setValue(value) {	//
				cur_href=value;
				add_href="&curUrl[href]="+value;
			}
		';
        if ($this->mode == 'wizard') {
            // Functions used, if the link selector is in wizard mode (= TCEforms fields)
            unset($this->P['fieldChangeFunc']['alert']);
            $update = '';
            foreach ($this->P['fieldChangeFunc'] as $k => $v) {
                $update .= '
				window.opener.' . $v;
            }
            $P2 = array();
            $P2['itemName'] = $this->P['itemName'];
            $P2['formName'] = $this->P['formName'];
            $P2['fieldChangeFunc'] = $this->P['fieldChangeFunc'];
            $P2['params']['allowedExtensions'] = $this->P['params']['allowedExtensions'];
            $P2['params']['blindLinkOptions'] = $this->P['params']['blindLinkOptions'];
            $addPassOnParams .= t3lib_div::implodeArrayForUrl('P', $P2);
            $JScode .= '
				function link_typo3Page(id,anchor)	{	//
					updateValueInMainForm(id + (anchor ? anchor : ""));
					close();
					return false;
				}
				function link_folder(folder)	{	//
					updateValueInMainForm(folder);
					close();
					return false;
				}
				function link_current()	{	//
					if (cur_href!="http://" && cur_href!="mailto:")	{
						returnBeforeCleaned = cur_href;
						if (returnBeforeCleaned.substr(0, 7) == "http://") {
							returnToMainFormValue = returnBeforeCleaned.substr(7);
						} else if (returnBeforeCleaned.substr(0, 7) == "mailto:") {
							if (returnBeforeCleaned.substr(0, 14) == "mailto:mailto:") {
								returnToMainFormValue = returnBeforeCleaned.substr(14);
							} else {
								returnToMainFormValue = returnBeforeCleaned.substr(7);
							}
						} else {
							returnToMainFormValue = returnBeforeCleaned;
						}
						updateValueInMainForm(returnToMainFormValue);
						close();
					}
					return false;
				}
				function checkReference()	{	//
					if (window.opener && window.opener.document && window.opener.document.' . $this->P['formName'] . ' && window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"] )	{
						return window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"];
					} else {
						close();
					}
				}
				function updateValueInMainForm(input)	{	//
					var field = checkReference();
					if (field)	{
						if (cur_target == "" && (cur_title != "" || cur_class != "-")) {
							cur_target = "-";
						}
						if (cur_title == "" && cur_class == "-") {
							cur_class = "";
						}
						cur_class = cur_class.replace(/[\'\\"]/g, "");
						if (cur_class.indexOf(" ") != -1) {
							cur_class = "\\"" + cur_class + "\\"";
						}
						cur_title = cur_title.replace(/(^\\")|(\\"$)/g, "");
						if (cur_title.indexOf(" ") != -1) {
							cur_title = "\\"" + cur_title + "\\"";
						}
						input = input + " " + cur_target + " " + cur_class + " " + cur_title;
						field.value = input;
						' . $update . '
					}
				}
			';
        } else {
            // Functions used, if the link selector is in RTE mode:
            $JScode .= '
				function link_typo3Page(id,anchor)	{	//
					var theLink = \'' . $this->siteURL . '?id=\'+id+(anchor?anchor:"");
					self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
					return false;
				}
				function link_folder(folder)	{	//
					var theLink = \'' . $this->siteURL . '\'+folder;
					self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
					return false;
				}
				function link_spec(theLink)	{	//
					self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
					return false;
				}
				function link_current()	{	//
					if (cur_href!="http://" && cur_href!="mailto:")	{
						self.parent.parent.renderPopup_addLink(cur_href, cur_target, cur_class, cur_title);
					}
					return false;
				}
			';
        }
        // General "jumpToUrl" function:
        $JScode .= '
			function jumpToUrl(URL,anchor)	{	//
				var add_act = URL.indexOf("act=")==-1 ? "&act=' . $this->act . '" : "";
				var add_mode = URL.indexOf("mode=")==-1 ? "&mode=' . $this->mode . '" : "";
				var theLocation = URL + add_act + add_mode + add_href + add_target + add_class + add_title + add_params' . ($addPassOnParams ? '+"' . $addPassOnParams . '"' : '') . '+(anchor?anchor:"");
				window.location.href = theLocation;
				return false;
			}
		';
        /**
         * Splits parts of $this->bparams
         * @see $bparams
         */
        $pArr = explode('|', $this->bparams);
        // This is JavaScript especially for the TBE Element Browser!
        $formFieldName = 'data[' . $pArr[0] . '][' . $pArr[1] . '][' . $pArr[2] . ']';
        // insertElement - Call check function (e.g. for uniqueness handling):
        if ($pArr[4] && $pArr[5]) {
            $JScodeCheck = '
					// Call a check function in the opener window (e.g. for uniqueness handling):
				if (parent.window.opener) {
					var res = parent.window.opener.' . $pArr[5] . '("' . addslashes($pArr[4]) . '",table,uid,type);
					if (!res.passed) {
						if (res.message) alert(res.message);
						performAction = false;
					}
				} else {
					alert("Error - reference to main window is not set properly!");
					parent.close();
				}
			';
        }
        // insertElement - Call helper function:
        if ($pArr[4] && $pArr[6]) {
            $JScodeHelper = '
						// Call helper function to manage data in the opener window:
					if (parent.window.opener) {
						parent.window.opener.' . $pArr[6] . '("' . addslashes($pArr[4]) . '",table,uid,type,"' . addslashes($pArr[0]) . '");
					} else {
						alert("Error - reference to main window is not set properly!");
						parent.close();
					}
			';
        }
        // insertElement - perform action commands:
        if ($pArr[4] && $pArr[7]) {
            // Call user defined action function:
            $JScodeAction = '
					if (parent.window.opener) {
						parent.window.opener.' . $pArr[7] . '("' . addslashes($pArr[4]) . '",table,uid,type);
						focusOpenerAndClose(close);
					} else {
						alert("Error - reference to main window is not set properly!");
						parent.close();
					}
			';
        } else {
            if ($pArr[0] && !$pArr[1] && !$pArr[2]) {
                $JScodeAction = '
					addElement(filename,table+"_"+uid,fp,close);
			';
            } else {
                $JScodeAction = '
					if (setReferences()) {
						parent.window.opener.group_change("add","' . $pArr[0] . '","' . $pArr[1] . '","' . $pArr[2] . '",elRef,targetDoc);
					} else {
						alert("Error - reference to main window is not set properly!");
					}
					focusOpenerAndClose(close);
			';
            }
        }
        $JScode .= '
			var elRef="";
			var targetDoc="";

			function launchView(url)	{	//
				var thePreviewWindow="";
				thePreviewWindow = window.open("' . $BACK_PATH . 'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
				if (thePreviewWindow && thePreviewWindow.focus)	{
					thePreviewWindow.focus();
				}
			}
			function setReferences()	{	//
				if (parent.window.opener && parent.window.opener.content && parent.window.opener.content.document.editform && parent.window.opener.content.document.editform["' . $formFieldName . '"]) {
					targetDoc = parent.window.opener.content.document;
					elRef = targetDoc.editform["' . $formFieldName . '"];
					return true;
				} else {
					return false;
				}
			}
			function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close)	{	//
				var performAction = true;
				' . $JScodeCheck . '
					// Call performing function and finish this action:
				if (performAction) {
						' . $JScodeHelper . $JScodeAction . '
				}
				return false;
			}
			function addElement(elName,elValue,altElValue,close)	{	//
				if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin)	{
					parent.window.opener.setFormValueFromBrowseWin("' . $pArr[0] . '",altElValue?altElValue:elValue,elName);
					focusOpenerAndClose(close);
				} else {
					alert("Error - reference to main window is not set properly!");
					parent.close();
				}
			}
			function focusOpenerAndClose(close)	{	//
				BrowseLinks.focusOpenerAndClose(close);
			}
		';
        // Finally, add the accumulated JavaScript to the template object:
        $this->doc->JScode .= $this->doc->wrapScriptTags($JScode);
        // Debugging:
        if (FALSE) {
            debug(array('pointer' => $this->pointer, 'act' => $this->act, 'mode' => $this->mode, 'curUrlInfo' => $this->curUrlInfo, 'curUrlArray' => $this->curUrlArray, 'P' => $this->P, 'bparams' => $this->bparams, 'RTEtsConfigParams' => $this->RTEtsConfigParams, 'expandPage' => $this->expandPage, 'expandFolder' => $this->expandFolder, 'PM' => $this->PM), 'Internal variables of Script Class:');
        }
    }
 /**
  * Constructor, initializing internal variables.
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $BACK_PATH, $TBE_MODULES_EXT;
     // Setting class files to include:
     if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) {
         $this->include_once = array_merge($this->include_once, $TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']);
     }
     // Setting internal vars:
     $this->id = intval(t3lib_div::_GP('id'));
     $this->sys_language = intval(t3lib_div::_GP('sys_language_uid'));
     $this->R_URI = t3lib_div::_GP('returnUrl');
     $this->colPos = t3lib_div::_GP('colPos');
     $this->uid_pid = intval(t3lib_div::_GP('uid_pid'));
     $this->MCONF['name'] = 'xMOD_db_new_content_el';
     $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.wizards.newContentElement');
     $config = t3lib_BEfunc::getPagesTSconfig($this->id);
     $this->config = $config['mod.']['wizards.']['newContentElement.'];
     // Starting the document template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $BACK_PATH;
     $this->doc->setModuleTemplate('templates/db_new_content_el.html');
     $this->doc->JScode = '';
     $this->doc->JScodeLibArray['dyntabmenu'] = $this->doc->getDynTabMenuJScode();
     $this->doc->form = '<form action="" name="editForm"><input type="hidden" name="defValues" value="" />';
     // Setting up the context sensitive menu:
     $this->doc->getContextMenuCode();
     // Getting the current page and receiving access information (used in main())
     $perms_clause = $BE_USER->getPagePermsClause(1);
     $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $perms_clause);
     $this->access = is_array($this->pageinfo) ? 1 : 0;
 }
 /**
  * wrapper funktion
  *
  * @param number $pageId
  * @return array
  */
 public static function getPagesTSconfig($pageId = 0)
 {
     // ab TYPO3 6.2.x wird die TS config gecached wenn nicht direkt eine
     // rootline ungleich NULL übergeben wird.
     // wir müssen die rootline auf nicht NULL setzen und kein array damit
     // die rootline korrekt geholt wird und nichts aus dem Cache. Sonst werde
     // die gerade hinzugefügten TS Dateien nicht beachtet
     $rootLine = 1;
     return t3lib_BEfunc::getPagesTSconfig($pageId, $rootLine);
 }
 /**
  * Returns the Page TSconfig for page with id, $id
  *
  * @param int $id Page uid for which to create Page TSconfig
  * @param array $rootLine If $rootLine is an array, that is used as rootline, otherwise rootline is just calculated
  * @param bool $returnPartArray If $returnPartArray is set, then the array with accumulated Page TSconfig is returned non-parsed. Otherwise the output will be parsed by the TypoScript parser.
  * @return array Page TSconfig
  * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser
  */
 public function getPagesTSconfig($id, $rootLine = NULL, $returnPartArray = FALSE)
 {
     /** @noinspection PhpDeprecationInspection PhpUndefinedClassInspection */
     return t3lib_BEfunc::getPagesTSconfig($id, $rootLine, $returnPartArray);
 }
Example #19
0
    /**
     * Create a regular new element (pages and records)
     *
     * @return	void
     */
    function regularNew()
    {
        $doNotShowFullDescr = false;
        // Initialize array for accumulating table rows:
        $this->tRows = array();
        // tree images
        $halfLine = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/halfline.gif', 'width="18" height="8"') . ' alt="" />';
        $firstLevel = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />';
        $secondLevel = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/join.gif', 'width="18" height="16"') . ' alt="" />';
        $secondLevelLast = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/line.gif', 'width="18" height="16"') . ' alt="" />
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/joinbottom.gif', 'width="18" height="16"') . ' alt="" />';
        // Slight spacer from header:
        $this->code .= $halfLine;
        // New Page
        $table = 'pages';
        $v = $GLOBALS['TCA'][$table];
        $pageIcon = t3lib_iconWorks::getSpriteIconForRecord($table, array());
        $newPageIcon = t3lib_iconWorks::getSpriteIcon('actions-page-new');
        $rowContent = $firstLevel . $newPageIcon . '&nbsp;<strong>' . $GLOBALS['LANG']->getLL('createNewPage') . '</strong>';
        // New pages INSIDE this pages
        if ($this->newPagesInto && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, 'pages')) {
            // Create link to new page inside:
            $rowContent .= '<br />' . $secondLevel . $this->linkWrap(t3lib_iconWorks::getSpriteIconForRecord($table, array()) . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.inside', 1) . ')', $table, $this->id);
        }
        // New pages AFTER this pages
        if ($this->newPagesAfter && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $GLOBALS['BE_USER']->check('tables_modify', 'pages') && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
            $rowContent .= '<br />' . $secondLevel . $this->linkWrap($pageIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1) . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.after', 1) . ')', 'pages', -$this->id);
        }
        // Link to page-wizard:
        $rowContent .= '<br />' . $secondLevelLast . '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($GLOBALS['LANG']->getLL('pageSelectPosition')) . '</a>';
        // Half-line:
        $rowContent .= '<br />' . $halfLine;
        // Compile table row to show the icon for "new page (select position)"
        $startRows = array();
        if ($this->showNewRecLink('pages')) {
            $startRows[] = '
				<tr>
					<td nowrap="nowrap">' . $rowContent . '</td>
					<td>' . t3lib_BEfunc::wrapInHelp($table, '') . '</td>
				</tr>
			';
        }
        // New tables (but not pages) INSIDE this pages
        $isAdmin = $GLOBALS['BE_USER']->isAdmin();
        $newContentIcon = t3lib_iconWorks::getSpriteIcon('actions-document-new');
        if ($this->newContentInto) {
            if (is_array($GLOBALS['TCA'])) {
                $groupName = '';
                foreach ($GLOBALS['TCA'] as $table => $v) {
                    $count = count($GLOBALS['TCA'][$table]);
                    $counter = 1;
                    if ($table != 'pages' && $this->showNewRecLink($table) && $this->isTableAllowedForThisPage($this->pageinfo, $table) && $GLOBALS['BE_USER']->check('tables_modify', $table) && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1) && $GLOBALS['BE_USER']->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, $table)) {
                        $newRecordIcon = t3lib_iconWorks::getSpriteIconForRecord($table, array());
                        $rowContent = '';
                        // Create new link for record:
                        $newLink = $this->linkWrap($newRecordIcon . $GLOBALS['LANG']->sL($v['ctrl']['title'], 1), $table, $this->id);
                        // If the table is 'tt_content' (from "cms" extension), create link to wizard
                        if ($table == 'tt_content') {
                            $groupName = $GLOBALS['LANG']->getLL('createNewContent');
                            $rowContent = $firstLevel . $newContentIcon . '&nbsp;<strong>' . $GLOBALS['LANG']->getLL('createNewContent') . '</strong>';
                            // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's wizard instead:
                            $overrideExt = $this->web_list_modTSconfig['properties']['newContentWiz.']['overrideWithExtension'];
                            $pathToWizard = t3lib_extMgm::isLoaded($overrideExt) ? t3lib_extMgm::extRelPath($overrideExt) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
                            $href = $pathToWizard . '?id=' . $this->id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
                            $rowContent .= '<br />' . $secondLevel . $newLink . '<br />' . $secondLevelLast . '<a href="' . htmlspecialchars($href) . '">' . $newContentIcon . htmlspecialchars($GLOBALS['LANG']->getLL('clickForWizard')) . '</a>';
                            // Half-line added:
                            $rowContent .= '<br />' . $halfLine;
                        } else {
                            // get the title
                            if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) {
                                continue;
                            }
                            if ($v['ctrl']['adminOnly'] && !$isAdmin) {
                                continue;
                            }
                            $nameParts = explode('_', $table);
                            $thisTitle = '';
                            if ($nameParts[0] == 'tx' || $nameParts[0] == 'tt') {
                                // try to extract extension name
                                if (substr($v['ctrl']['title'], 0, 8) == 'LLL:EXT:') {
                                    $_EXTKEY = substr($v['ctrl']['title'], 8);
                                    $_EXTKEY = substr($_EXTKEY, 0, strpos($_EXTKEY, '/'));
                                    if ($_EXTKEY != '') {
                                        // first try to get localisation of extension title
                                        $temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY)));
                                        $langFile = $temp[0];
                                        $thisTitle = $GLOBALS['LANG']->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title');
                                        // if no localisation available, read title from ext_emconf.php
                                        if (!$thisTitle && is_file(t3lib_extMgm::extPath($_EXTKEY) . 'ext_emconf.php')) {
                                            include t3lib_extMgm::extPath($_EXTKEY) . 'ext_emconf.php';
                                            $thisTitle = $EM_CONF[$_EXTKEY]['title'];
                                        }
                                        $iconFile[$_EXTKEY] = '<img src="' . t3lib_extMgm::extRelPath($_EXTKEY) . 'ext_icon.gif" />';
                                    } else {
                                        $thisTitle = $nameParts[1];
                                        $iconFile[$_EXTKEY] = '';
                                    }
                                } else {
                                    $thisTitle = $nameParts[1];
                                    $iconFile[$_EXTKEY] = '';
                                }
                            } else {
                                $_EXTKEY = 'system';
                                $thisTitle = $GLOBALS['LANG']->getLL('system_records');
                                $iconFile['system'] = t3lib_iconWorks::getSpriteIcon('apps-pagetree-root');
                            }
                            if ($groupName == '' || $groupName != $_EXTKEY) {
                                $groupName = $_EXTKEY;
                            }
                            $rowContent .= $newLink;
                            $counter++;
                        }
                        // Compile table row:
                        if ($table == 'tt_content') {
                            $startRows[] = '
								<tr>
									<td nowrap="nowrap">' . $rowContent . '</td>
									<td>' . t3lib_BEfunc::wrapInHelp($table, '') . '</td>
								</tr>';
                        } else {
                            $this->tRows[$groupName]['title'] = $thisTitle;
                            $this->tRows[$groupName]['html'][] = $rowContent;
                            $this->tRows[$groupName]['table'][] = $table;
                        }
                    }
                }
            }
        }
        // user sort
        $pageTS = t3lib_BEfunc::getPagesTSconfig($this->id);
        if (isset($pageTS['mod.']['wizards.']['newRecord.']['order'])) {
            $this->newRecordSortList = t3lib_div::trimExplode(',', $pageTS['mod.']['wizards.']['newRecord.']['order'], true);
        }
        uksort($this->tRows, array($this, 'sortNewRecordsByConfig'));
        // Compile table row:
        $finalRows = array();
        $finalRows[] = implode('', $startRows);
        foreach ($this->tRows as $key => $value) {
            $row = '<tr>
						<td nowrap="nowrap">' . $halfLine . '<br />' . $firstLevel . '' . $iconFile[$key] . '&nbsp;<strong>' . $value['title'] . '</strong>' . '</td><td>' . t3lib_BEfunc::wrapInHelp($table, '') . '</td>
						</tr>';
            $count = count($value['html']) - 1;
            foreach ($value['html'] as $recordKey => $record) {
                $row .= '
					<tr>
						<td nowrap="nowrap">' . ($recordKey < $count ? $secondLevel : $secondLevelLast) . $record . '</td>
						<td>' . t3lib_BEfunc::wrapInHelp($value['table'][$recordKey], '') . '</td>
					</tr>';
            }
            $finalRows[] = $row;
        }
        // end of tree
        $finalRows[] = '
			<tr>
				<td><img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/ol/stopper.gif', 'width="18" height="16"') . ' alt="" /></td>
				<td></td>
			</tr>
		';
        // Make table:
        $this->code .= '
			<table border="0" cellpadding="0" cellspacing="0" id="typo3-newRecord">
			' . implode('', $finalRows) . '
			</table>
		';
    }
	/**
	 * Obtains the name of the default language.
	 *
	 * @return string
	 */
	protected function getDefaultLanguageName() {
		$tsConfig = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
		if (isset($tsConfig['mod.']['SHARED.']['defaultLanguageLabel'])) {
			$label = $tsConfig['mod.']['SHARED.']['defaultLanguageLabel'];
		}
		else {
			$label = $GLOBALS['LANG']->getLL('default_language');
		}
		return $label;
	}
 /**
  * Get pid for tags from TsConfig
  *
  * @param integer $newsUid uid of current news record
  * @return int
  */
 protected function getTagPidFromTsConfig($newsUid)
 {
     $pid = 0;
     $newsRecord = t3lib_BEfunc::getRecord('tx_news_domain_model_news', (int) $newsUid);
     $pagesTsConfig = t3lib_BEfunc::getPagesTSconfig($newsRecord['pid']);
     if (isset($pagesTsConfig['tx_news.']) && isset($pagesTsConfig['tx_news.']['tagPid'])) {
         $pid = (int) $pagesTsConfig['tx_news.']['tagPid'];
     }
     return $pid;
 }
 /**
  * Sub function of insertElement: creates a new tt_content record in the database.
  *
  * @param	array		$destinationPointer: flexform pointer to the parent element of the new record
  * @param	array		$row: The record data to insert into the database
  * @return	mixed		The UID of the newly created record or FALSE if operation was not successful
  * @access	public
  */
 function insertElement_createRecord($destinationPointer, $row)
 {
     if ($this->debug) {
         t3lib_div::devLog('API: insertElement_createRecord()', 'templavoila', 0, array('destinationPointer' => $destinationPointer, 'row' => $row));
     }
     $parentRecord = t3lib_BEfunc::getRecordWSOL($destinationPointer['table'], $destinationPointer['uid'], 'uid,pid,t3ver_oid,tx_templavoila_flex' . ($destinationPointer['table'] == 'pages' ? ',t3ver_swapmode' : ''));
     if ($destinationPointer['position'] > 0) {
         $currentReferencesArr = $this->flexform_getElementReferencesFromXML($parentRecord['tx_templavoila_flex'], $destinationPointer);
     }
     $newRecordPid = $destinationPointer['table'] == 'pages' ? $parentRecord['pid'] == -1 && $parentRecord['t3ver_swapmode'] == -1 ? $parentRecord['t3ver_oid'] : $parentRecord['uid'] : $parentRecord['pid'];
     $dataArr = array();
     $dataArr['tt_content']['NEW'] = $row;
     $dataArr['tt_content']['NEW']['pid'] = $newRecordPid;
     unset($dataArr['tt_content']['NEW']['uid']);
     // If the destination is not the default language, try to set the old-style sys_language_uid field accordingly
     if ($destinationPointer['sLang'] != 'lDEF' || $destinationPointer['vLang'] != 'vDEF') {
         $languageKey = $destinationPointer['vLang'] != 'vDEF' ? $destinationPointer['vLang'] : $destinationPointer['sLang'];
         $staticLanguageRows = t3lib_BEfunc::getRecordsByField('static_languages', 'lg_iso_2', substr($languageKey, 1));
         if (isset($staticLanguageRows[0]['uid'])) {
             $languageRecord = t3lib_BEfunc::getRecordRaw('sys_language', 'static_lang_isocode=' . intval($staticLanguageRows[0]['uid']));
             if (isset($languageRecord['uid'])) {
                 $dataArr['tt_content']['NEW']['sys_language_uid'] = $languageRecord['uid'];
             }
         }
     }
     // Instantiate TCEmain and create the record:
     $tce = t3lib_div::makeInstance('t3lib_TCEmain');
     /* @var $tce t3lib_TCEmain */
     // set default TCA values specific for the user
     $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
     $pageTS = t3lib_BEfunc::getPagesTSconfig($newRecordPid, true);
     if (isset($pageTS['TCAdefaults.'])) {
         $TCAdefaultOverride = array_merge($TCAdefaultOverride, $pageTS['TCAdefaults.']);
     }
     if (is_array($TCAdefaultOverride)) {
         $tce->setDefaultsFromUserTS($TCAdefaultOverride);
     }
     $tce->stripslashes_values = 0;
     $flagWasSet = $this->getTCEmainRunningFlag();
     $this->setTCEmainRunningFlag(TRUE);
     if ($this->debug) {
         t3lib_div::devLog('API: insertElement_createRecord()', 'templavoila', 0, array('dataArr' => $dataArr));
     }
     $tce->start($dataArr, array());
     $tce->process_datamap();
     if ($this->debug && count($tce->errorLog)) {
         t3lib_div::devLog('API: insertElement_createRecord(): tcemain failed', 'templavoila', 0, array('errorLog' => $tce->errorLog));
     }
     $newUid = $tce->substNEWwithIDs['NEW'];
     if (!$flagWasSet) {
         $this->setTCEmainRunningFlag(FALSE);
     }
     return intval($newUid) ? intval($newUid) : FALSE;
 }
 /**
  * Constructor:
  * Initializes a lot of variables, setting JavaScript functions in header etc.
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $BACK_PATH, $LANG, $TYPO3_CONF_VARS;
     // Main GPvars:
     $this->siteUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
     $this->act = t3lib_div::_GP('act');
     $this->expandPage = t3lib_div::_GP('expandPage');
     $this->expandFolder = t3lib_div::_GP('expandFolder');
     $this->pointer = t3lib_div::_GP('pointer');
     $this->P = t3lib_div::_GP('P');
     $this->PM = t3lib_div::_GP('PM');
     // Find RTE parameters
     $this->bparams = t3lib_div::_GP('bparams');
     $this->contentTypo3Language = t3lib_div::_GP('contentTypo3Language');
     $this->contentTypo3Charset = t3lib_div::_GP('contentTypo3Charset');
     $this->editorNo = t3lib_div::_GP('editorNo');
     $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
     $pArr = explode('|', $this->bparams);
     $pRteArr = explode(':', $pArr[1]);
     $this->editorNo = $this->editorNo ? $this->editorNo : $pRteArr[0];
     $this->contentTypo3Language = $this->contentTypo3Language ? $this->contentTypo3Language : $pRteArr[1];
     $this->contentTypo3Charset = $this->contentTypo3Charset ? $this->contentTypo3Charset : $pRteArr[2];
     $this->RTEtsConfigParams = $this->RTEtsConfigParams ? $this->RTEtsConfigParams : $pArr[2];
     // Find "mode"
     $this->mode = t3lib_div::_GP('mode');
     if (!$this->mode) {
         $this->mode = 'rte';
     }
     // init fileProcessor
     $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
     $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
     // init hook objects:
     $this->hookObjects = array();
     if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) {
         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'] as $classData) {
             $processObject = t3lib_div::getUserObj($classData);
             if (!$processObject instanceof t3lib_browseLinksHook) {
                 throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195115652);
             }
             $parameters = array();
             $processObject->init($this, $parameters);
             $this->hookObjects[] = $processObject;
         }
     }
     // Site URL
     $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
     // Current site url
     // the script to link to
     $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
     // CurrentUrl - the current link url must be passed around if it exists
     if ($this->mode == 'wizard') {
         $currentLinkParts = t3lib_div::trimExplode(' ', $this->P['currentValue']);
         $this->curUrlArray = array('target' => $currentLinkParts[1]);
         $this->curUrlInfo = $this->parseCurUrl($this->siteURL . '?id=' . $currentLinkParts[0], $this->siteURL);
     } else {
         $this->curUrlArray = t3lib_div::_GP('curUrl');
         if ($this->curUrlArray['all']) {
             $this->curUrlArray = t3lib_div::get_tag_attributes($this->curUrlArray['all']);
         }
         $this->curUrlInfo = $this->parseCurUrl($this->curUrlArray['href'], $this->siteURL);
     }
     // Determine nature of current url:
     $this->act = t3lib_div::_GP('act');
     if (!$this->act) {
         $this->act = $this->curUrlInfo['act'];
     }
     // Initializing the titlevalue
     $this->setTitle = $LANG->csConvObj->conv($this->curUrlArray['title'], 'utf-8', $LANG->charSet);
     // Rich Text Editor specific configuration:
     $addPassOnParams = '';
     $classSelected = array();
     if ((string) $this->mode == 'rte') {
         $RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
         $addPassOnParams .= '&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams);
         $addPassOnParams .= $this->contentTypo3Language ? '&contentTypo3Language=' . rawurlencode($this->contentTypo3Language) : '';
         $addPassOnParams .= $this->contentTypo3Charset ? '&contentTypo3Charset=' . rawurlencode($this->contentTypo3Charset) : '';
         $RTEsetup = $BE_USER->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
         $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
         if (is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['link.'])) {
             $this->buttonConfig = $this->thisConfig['buttons.']['link.'];
         }
         if ($this->thisConfig['classesAnchor'] || $this->thisConfig['classesLinks']) {
             $this->setClass = $this->curUrlArray['class'];
             if ($this->thisConfig['classesAnchor']) {
                 $classesAnchorArray = t3lib_div::trimExplode(',', $this->thisConfig['classesAnchor'], 1);
             } else {
                 $classesAnchorArray = t3lib_div::trimExplode(',', $this->thisConfig['classesLinks'], 1);
             }
             $anchorTypes = array('page', 'url', 'file', 'mail', 'spec');
             $classesAnchor = array();
             $classesAnchor['all'] = array();
             if (is_array($RTEsetup['properties']['classesAnchor.'])) {
                 foreach ($RTEsetup['properties']['classesAnchor.'] as $label => $conf) {
                     if (in_array($conf['class'], $classesAnchorArray)) {
                         $classesAnchor['all'][] = $conf['class'];
                         if (in_array($conf['type'], $anchorTypes)) {
                             $classesAnchor[$conf['type']][] = $conf['class'];
                             if (is_array($this->thisConfig['classesAnchor.']) && is_array($this->thisConfig['classesAnchor.']['default.']) && $this->thisConfig['classesAnchor.']['default.'][$conf['type']] == $conf['class']) {
                                 $this->classesAnchorDefault[$conf['type']] = $conf['class'];
                                 if ($conf['titleText']) {
                                     $this->classesAnchorDefaultTitle[$conf['type']] = $this->getLLContent(trim($conf['titleText']));
                                 }
                                 if ($conf['target']) {
                                     $this->classesAnchorDefaultTarget[$conf['type']] = trim($conf['target']);
                                 }
                             }
                         }
                     }
                 }
             }
             foreach ($anchorTypes as $anchorType) {
                 foreach ($classesAnchorArray as $class) {
                     if (!in_array($class, $classesAnchor['all']) || in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType])) {
                         $selected = '';
                         if ($this->setClass == $class || !$this->setClass && $this->classesAnchorDefault[$anchorType] == $class) {
                             $selected = 'selected="selected"';
                             $classSelected[$anchorType] = true;
                         }
                         $classLabel = is_array($RTEsetup['properties']['classes.']) && is_array($RTEsetup['properties']['classes.'][$class . '.']) && $RTEsetup['properties']['classes.'][$class . '.']['name'] ? $this->getPageConfigLabel($RTEsetup['properties']['classes.'][$class . '.']['name'], 0) : $class;
                         $classStyle = is_array($RTEsetup['properties']['classes.']) && is_array($RTEsetup['properties']['classes.'][$class . '.']) && $RTEsetup['properties']['classes.'][$class . '.']['value'] ? $RTEsetup['properties']['classes.'][$class . '.']['value'] : '';
                         $this->classesAnchorJSOptions[$anchorType] .= '<option ' . $selected . ' value="' . $class . '"' . ($classStyle ? ' style="' . $classStyle . '"' : '') . '>' . $classLabel . '</option>';
                     }
                 }
                 if ($this->classesAnchorJSOptions[$anchorType]) {
                     $selected = '';
                     if (!$this->setClass && !$this->classesAnchorDefault[$anchorType]) {
                         $selected = 'selected="selected"';
                     }
                     $this->classesAnchorJSOptions[$anchorType] = '<option ' . $selected . ' value=""></option>' . $this->classesAnchorJSOptions[$anchorType];
                 }
             }
         }
     }
     // Initializing the target value (RTE)
     // Unset the target if it is set to a value different than default and if no class is selected and the target field is not displayed
     // In other words, do not forward the target if we changed tab and the target field is not displayed
     $this->setTarget = isset($this->curUrlArray['target']) && !($this->curUrlArray['target'] != $this->thisConfig['defaultLinkTarget'] && !$classSelected[$this->act] && is_array($this->buttonConfig['targetSelector.']) && $this->buttonConfig['targetSelector.']['disabled'] && is_array($this->buttonConfig['popupSelector.']) && $this->buttonConfig['popupSelector.']['disabled']) ? $this->curUrlArray['target'] : '';
     if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
         $this->setTarget = $this->thisConfig['defaultLinkTarget'];
     }
     // init the DAM object
     $this->initDAM();
     $this->getModSettings();
     $this->processParams();
     // Creating backend template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $BACK_PATH;
 }
 /**
  * Get all modes for anythingSlider
  * @return array
  */
 public function getAnythingSliderModes($config, $item)
 {
     $confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jfmulticontent']);
     $availableModes = t3lib_div::trimExplode(",", $confArr['anythingSliderModes']);
     if (count($availableModes) < 1 || !$confArr['anythingSliderModes']) {
         $availableModes = array('horizontal', 'vertical', 'fade');
     }
     $pageTS = t3lib_BEfunc::getPagesTSconfig($config['row']['pid']);
     $jfmulticontentModes = t3lib_div::trimExplode(",", $pageTS['mod.']['jfmulticontent.']['anythingSliderModes'], TRUE);
     $optionList = array();
     if (count($jfmulticontentModes) > 0) {
         foreach ($availableModes as $key => $availableMode) {
             if (in_array(trim($availableMode), $jfmulticontentModes)) {
                 $optionList[] = array(trim($availableMode), trim($availableMode));
             }
         }
     } else {
         foreach ($availableModes as $key => $availableMode) {
             $optionList[] = array(trim($availableMode), trim($availableMode));
         }
     }
     $config['items'] = array_merge($config['items'], $optionList);
     return $config;
 }
Example #25
0
<?php

unset($MCONF);
require 'conf.php';
require $BACK_PATH . 'init.php';
$pageId = 0;
if (t3lib_div::_GP('pageId')) {
    $pageId = t3lib_div::_GP('pageId');
}
$pageTSconfig = t3lib_BEfunc::getPagesTSconfig($pageId);
$config = $pageTSconfig['RTE.']['default.']['spellcheck.'];
// General settings
$config['general.engine'] = $config['general.']['engine'];
//$config['general.engine'] = 'PSpell';
//$config['general.engine'] = 'PSpellShell';
//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
// PSpell settings
$config['PSpell.mode'] = $config['PSpell.']['mode'];
$config['PSpell.spelling'] = $config['PSpell.']['spelling'];
$config['PSpell.jargon'] = $config['PSpell.']['jargon'];
$config['PSpell.encoding'] = $config['PSpell.']['encoding'];
// PSpellShell settings
$config['PSpellShell.mode'] = $config['PSpellShell.']['mode'];
$config['PSpellShell.aspell'] = $config['PSpellShell.']['aspell'];
$config['PSpellShell.tmp'] = $config['PSpellShell.']['tmp'];
// Windows PSpellShell settings
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
//$config['PSpellShell.tmp'] = 'c:/temp';
 /**
  * Get the RTE configuration from Page TSConfig
  *
  * @return	array		RTE configuration array
  */
 protected function getRTEConfig()
 {
     global $BE_USER;
     $RTEtsConfigParts = explode(':', t3lib_div::_GP('RTEtsConfigParams'));
     $RTEsetup = $BE_USER->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
     return t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
 }
 /**
  * Merges the Configs for Locations into the main config
  *
  * @param	array  The config that should be modified
  * @param array  
  * @return array The altered config
  */
 function mergeLocationConfig($config, $configOrder = array('default'), $PA = array())
 {
     if (TYPO3_MODE == 'BE') {
         global $BE_USER;
     }
     if (!is_array($BE_USER->userTS['RTE.'])) {
         $BE_USER->userTS['RTE.'] = array();
     }
     $pageTs = t3lib_BEfunc::getPagesTSconfig($this->currentPage);
     // Merge configs
     foreach ($configOrder as $order) {
         $order = explode('.', $order);
         // Only use this when order[0] matches tablename contained in $PA['itemFormElName']
         // otherwise all configurations delivered by the hook would be merged
         if (preg_match('/' . $order[0] . '/', $PA['itemFormElName']) || $order[0] == 'default' && $order[1] == 'lang') {
             // Added even cases , since we do not know what ext developers return using the hook
             // Do we need higher cases, since we do not know what will come from the hook?
             switch (count($order)) {
                 case 7:
                     $tsc = $pageTs['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'][$order[4] . '.'][$order[5] . '.'][$order[6] . '.'];
                     $utsc = $BE_USER->userTS['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'][$order[4] . '.'][$order[5] . '.'][$order[6] . '.'];
                     break;
                 case 6:
                     $tsc = $pageTs['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'][$order[4] . '.'][$order[5] . '.'];
                     $utsc = $BE_USER->userTS['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'][$order[4] . '.'][$order[5] . '.'];
                     break;
                 case 5:
                     $tsc = $pageTs['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'][$order[4] . '.'];
                     $utsc = $BE_USER->userTS['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'][$order[4] . '.'];
                     break;
                 case 4:
                     $tsc = $pageTs['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'];
                     $utsc = $BE_USER->userTS['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'][$order[3] . '.'];
                     break;
                 case 3:
                     $tsc = $pageTs['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'];
                     $utsc = $BE_USER->userTS['RTE.'][$order[0] . '.'][$order[1] . '.'][$order[2] . '.'];
                     break;
                 case 2:
                     $tsc = $pageTs['RTE.'][$order[0] . '.'][$order[1] . '.'];
                     $utsc = $BE_USER->userTS['RTE.'][$order[0] . '.'][$order[1] . '.'];
                     break;
                 default:
                     $tsc = $pageTs['RTE.'][$order[0] . '.'];
                     $utsc = $BE_USER->userTS['RTE.'][$order[0] . '.'];
                     break;
             }
         }
         if (isset($tsc)) {
             $config = $this->array_merge_recursive_override($config, $tsc);
         }
         if (isset($utsc)) {
             $config = $this->array_merge_recursive_override($config, $utsc);
         }
     }
     unset($config['field.']);
     unset($config['lang.']);
     unset($config['ctype.']);
     return $config;
 }
 /**
  * Checking if the RTE is available/enabled for a certain table/field and if so, it returns true.
  * Used to determine if the RTE button should be displayed.
  *
  * @param	string		Table name
  * @param	array		Record row (needed, if there are RTE dependencies based on other fields in the record)
  * @param	string		Field name
  * @return	boolean		Returns true if the rich text editor would be enabled/available for the field name specified.
  */
 function isRTEforField($table, $row, $field)
 {
     $specConf = $this->getSpecConfForField($table, $row, $field);
     $p = t3lib_BEfunc::getSpecConfParametersFromArray($specConf['rte_transform']['parameters']);
     if (isset($specConf['richtext']) && (!$p['flag'] || !$row[$p['flag']])) {
         t3lib_BEfunc::fixVersioningPid($table, $row);
         list($tscPID, $thePidValue) = t3lib_BEfunc::getTSCpid($table, $row['uid'], $row['pid']);
         if ($thePidValue >= 0) {
             // If the pid-value is not negative (that is, a pid could NOT be fetched)
             $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($tscPID));
             $RTEtypeVal = t3lib_BEfunc::getTCAtypeValue($table, $row);
             $thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'], $table, $field, $RTEtypeVal);
             if (!$thisConfig['disabled']) {
                 return TRUE;
             }
         }
     }
     return FALSE;
 }
    /**
     * Main function of class
     *
     * @return	string		HTML output
     */
    function main()
    {
        global $LANG;
        $menu = t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[tsconf_parts]', $this->pObj->MOD_SETTINGS['tsconf_parts'], $this->pObj->MOD_MENU['tsconf_parts']);
        $menu .= '<br /><label for="checkTsconf_alphaSort">' . $GLOBALS['LANG']->getLL('sort_alphabetic', true) . '</label> ' . t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[tsconf_alphaSort]', $this->pObj->MOD_SETTINGS['tsconf_alphaSort'], '', '', 'id="checkTsconf_alphaSort"');
        $menu .= '<br /><br />';
        if ($this->pObj->MOD_SETTINGS['tsconf_parts'] == 99) {
            $TSparts = t3lib_BEfunc::getPagesTSconfig($this->pObj->id, '', 1);
            $lines = array();
            $pUids = array();
            foreach ($TSparts as $k => $v) {
                if ($k != 'uid_0') {
                    if ($k == 'defaultPageTSconfig') {
                        $pTitle = '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_default', 1) . '</strong>';
                        $editIcon = '';
                    } else {
                        $pUids[] = substr($k, 4);
                        $row = t3lib_BEfunc::getRecordWSOL('pages', substr($k, 4));
                        $pTitle = $this->pObj->doc->getHeader('pages', $row, '', 0);
                        $editIdList = substr($k, 4);
                        $params = '&edit[pages][' . $editIdList . ']=edit&columnsOnly=TSconfig';
                        $onclickUrl = t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], '');
                        $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
                    }
                    $TScontent = nl2br(htmlspecialchars(trim($v) . chr(10)));
                    $tsparser = t3lib_div::makeInstance('t3lib_TSparser');
                    $tsparser->lineNumberOffset = 0;
                    $TScontent = $tsparser->doSyntaxHighlight(trim($v) . LF, '', 0);
                    $lines[] = '
						<tr><td nowrap="nowrap" class="bgColor5">' . $pTitle . '</td></tr>
						<tr><td nowrap="nowrap" class="bgColor4">' . $TScontent . $editIcon . '</td></tr>
						<tr><td>&nbsp;</td></tr>
					';
                }
            }
            if (count($pUids)) {
                $params = '&edit[pages][' . implode(',', $pUids) . ']=edit&columnsOnly=TSconfig';
                $onclickUrl = t3lib_BEfunc::editOnClick($params, $GLOBALS['BACK_PATH'], '');
                $editIcon = '<a href="#" onclick="' . htmlspecialchars($onclickUrl) . '" title="' . $GLOBALS['LANG']->getLL('editTSconfig_all', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '<strong>' . $GLOBALS['LANG']->getLL('editTSconfig_all', 1) . '</strong>' . '</a>';
            } else {
                $editIcon = '';
            }
            $theOutput .= $this->pObj->doc->section($LANG->getLL('tsconf_title'), t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_edit', $GLOBALS['BACK_PATH'], '|<br />') . $menu . '
					<br /><br />

					<!-- Edit fields: -->
					<table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table><br />' . $editIcon, 0, 1);
        } else {
            $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
            // Defined global here!
            $tmpl->tt_track = 0;
            // Do not log time-performance information
            $tmpl->fixedLgd = 0;
            $tmpl->linkObjects = 0;
            $tmpl->bType = '';
            $tmpl->ext_expandAllNotes = 1;
            $tmpl->ext_noPMicons = 1;
            switch ($this->pObj->MOD_SETTINGS['tsconf_parts']) {
                case '1':
                    $modTSconfig = t3lib_BEfunc::getModTSconfig($this->pObj->id, 'mod');
                    break;
                case '1a':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_layout', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1b':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_view', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1c':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_modules', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1d':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_list', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1e':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_info', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1f':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_func', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '1g':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('mod.web_ts', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '2':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('RTE', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '5':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEFORM', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '6':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TCEMAIN', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '3':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('TSFE', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                case '4':
                    $modTSconfig = $GLOBALS['BE_USER']->getTSConfig('user', t3lib_BEfunc::getPagesTSconfig($this->pObj->id));
                    break;
                default:
                    $modTSconfig['properties'] = t3lib_BEfunc::getPagesTSconfig($this->pObj->id);
                    break;
            }
            $modTSconfig = $modTSconfig['properties'];
            if (!is_array($modTSconfig)) {
                $modTSconfig = array();
            }
            $theOutput .= $this->pObj->doc->section($LANG->getLL('tsconf_title'), t3lib_BEfunc::cshItem('_MOD_' . $GLOBALS['MCONF']['name'], 'tsconfig_hierarchy', $GLOBALS['BACK_PATH'], '|<br />') . $menu . '

					<!-- Page TSconfig Tree: -->
					<table border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td nowrap="nowrap">' . $tmpl->ext_getObjTree($modTSconfig, '', '', '', '', $this->pObj->MOD_SETTINGS['tsconf_alphaSort']) . '</td>
						</tr>
					</table>', 0, 1);
        }
        // Return output:
        return $theOutput;
    }
Example #30
0
 /**
  * Loads the specific DCA for a table. It loads the plain DCA from the
  * first class (usually the extension that wants to change a flexform) and
  * calls all registered hooks for this table. The hooks are usually
  * provided by a third-party extension that want to extend the orginal DCA.
  *
  * @param string $table The table we are working on
  * @param int $pid
  * @param array $row
  * @return array
  */
 public static function loadDynaFlexConfig($table, $pid, &$row)
 {
     $resultDca = NULL;
     if (!is_array($GLOBALS['T3_VAR']['ext']['dynaflex'][$table])) {
         return $resultDca;
     }
     $cleanUpFields = array();
     $tableRegs = $GLOBALS['T3_VAR']['ext']['dynaflex'][$table];
     foreach ($tableRegs as $tableRegRef) {
         if ($tableRegRef == 'TS') {
             /** @var t3lib_beUserAuth $backendUser */
             $backendUser = $GLOBALS['BE_USER'];
             // load the DCA from page typoscript
             $pageTsConfig = $backendUser->getTSConfig('dynaflex.' . $table, t3lib_BEfunc::getPagesTSconfig($pid));
             $resultDca = self::removeTrailingDotsRecursive($pageTsConfig['properties']);
         } else {
             // load the DCA from a class and maybe some hooks from within the class
             $tableRegObj = t3lib_div::getUserObj($tableRegRef);
             // check if should do anything
             if (isset($tableRegObj->rowChecks) && is_array($tableRegObj->rowChecks)) {
                 foreach ($tableRegObj->rowChecks as $fieldName => $checkValue) {
                     if ($row[$fieldName] != $checkValue) {
                         continue 2;
                     }
                 }
             }
             if (empty($resultDca)) {
                 $resultDca = $tableRegObj->DCA;
             }
             if (is_array($tableRegObj->hooks)) {
                 foreach ($tableRegObj->hooks as $classRef) {
                     $hookObj = t3lib_div::getUserObj($classRef);
                     if (method_exists($hookObj, 'alterDCA_onLoad')) {
                         $hookObj->alterDCA_onLoad($resultDca, $table);
                     }
                 }
             }
             if (is_array($tableRegObj->cleanUpField)) {
                 $cleanUpFields = array_unique(array_merge($cleanUpFields, $tableRegObj->cleanUpField));
             }
         }
     }
     return array('DCA' => $resultDca, 'cleanUpField' => $cleanUpFields);
 }