/**
  * This method is the implementation of an abstract parent method.
  * The method should return the overlay record for a certain language.
  *
  * (non-PHPdoc)
  * @see classes/tx_languagevisibility_element#getOverLayRecordForCertainLanguageImplementation($languageId)
  */
 protected function getOverLayRecordForCertainLanguageImplementation($languageId)
 {
     $ctrl = $GLOBALS['TCA'][$this->table]['ctrl'];
     // we can't use the exclude fields here because we might loose (hidden) parent-records
     if (is_object($GLOBALS['TSFE']->sys_page)) {
         $excludeClause = $GLOBALS['TSFE']->sys_page->deleteClause($this->table);
     } else {
         $excludeClause = t3lib_BEfunc::deleteClause($this->table);
     }
     if (isset($ctrl['versioningWS']) && $ctrl['versioningWS'] > 0) {
         $workspaces = '0,' . $GLOBALS['BE_USER']->workspace;
         $workspaceCondition = 't3ver_wsid IN (' . rtrim($workspaces, ',') . ') AND ';
     } else {
         $workspaceCondition = '';
     }
     // Select overlay record (Live workspace, initial placeholders included):
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->table, 'pid=' . intval($this->getPid()) . ' AND ' . $workspaceCondition . $ctrl['languageField'] . '=' . intval($languageId) . ($languageId > 0 ? ' AND ' . $ctrl['transOrigPointerField'] . '=' . intval($this->getUid()) : '') . $excludeClause, '', '', '1');
     $olrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
     $olrow = $this->getContextIndependentWorkspaceOverlay($this->table, $olrow);
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     if (!$this->getEnableFieldResult($olrow)) {
         $olrow = array();
     }
     return $olrow;
 }
コード例 #2
0
    /**
     * This method is called by the Scheduler task that triggers
     * the autopublication process
     * It searches for workspaces whose publication date is in the past
     * and publishes them
     *
     * @return	void
     */
    public function autoPublishWorkspaces()
    {
        global $TYPO3_CONF_VARS;
        // Temporarily set admin rights
        // FIXME: once workspaces are cleaned up a better solution should be implemented
        $currentAdminStatus = $GLOBALS['BE_USER']->user['admin'];
        $GLOBALS['BE_USER']->user['admin'] = 1;
        // Select all workspaces that needs to be published / unpublished:
        $workspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,swap_modes,publish_time,unpublish_time', 'sys_workspace', 'pid=0
				AND
				((publish_time!=0 AND publish_time<=' . intval($GLOBALS['EXEC_TIME']) . ')
				OR (publish_time=0 AND unpublish_time!=0 AND unpublish_time<=' . intval($GLOBALS['EXEC_TIME']) . '))' . t3lib_BEfunc::deleteClause('sys_workspace'));
        $workspaceService = t3lib_div::makeInstance('tx_Workspaces_Service_Workspaces');
        foreach ($workspaces as $rec) {
            // First, clear start/end time so it doesn't get select once again:
            $fieldArray = $rec['publish_time'] != 0 ? array('publish_time' => 0) : array('unpublish_time' => 0);
            $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_workspace', 'uid=' . intval($rec['uid']), $fieldArray);
            // Get CMD array:
            $cmd = $workspaceService->getCmdArrayForPublishWS($rec['uid'], $rec['swap_modes'] == 1);
            // $rec['swap_modes']==1 means that auto-publishing will swap versions, not just publish and empty the workspace.
            // Execute CMD array:
            $tce = t3lib_div::makeInstance('t3lib_TCEmain');
            $tce->stripslashes_values = 0;
            $tce->start(array(), $cmd);
            $tce->process_cmdmap();
        }
        // Restore admin status
        $GLOBALS['BE_USER']->user['admin'] = $currentAdminStatus;
    }
 /**
  *
  * @return string;
  */
 public function getStoragePids()
 {
     $pids = array();
     $toList = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('tx_templavoila_tmplobj.uid,tx_templavoila_tmplobj.pid', 'tx_templavoila_tmplobj', 'tx_templavoila_tmplobj.datastructure=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->filename, 'tx_templavoila_tmplobj') . t3lib_BEfunc::deleteClause('tx_templavoila_tmplobj'));
     foreach ($toList as $toRow) {
         $pids[$toRow['pid']]++;
     }
     return implode(',', array_keys($pids));
 }
コード例 #4
0
 /**
  * Returns an array of UIDs which are not referenced on
  * the page with the given uid (= parent id).
  *
  * @param	array		$allReferencedElementsArr: Array with UIDs of referenced elements
  * @return	array		Array with UIDs of tt_content records
  * @access	protected
  */
 function getUnreferencedElementsRecords($allReferencedElementsArr)
 {
     global $TYPO3_DB, $BE_USER;
     $elementRecordsArr = array();
     $res = $TYPO3_DB->exec_SELECTquery('uid', 'tt_content', 'uid NOT IN (' . implode(',', $allReferencedElementsArr) . ')' . ' AND t3ver_wsid=' . intval($BE_USER->workspace) . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'sorting');
     if ($res) {
         while (($elementRecordArr = $TYPO3_DB->sql_fetch_assoc($res)) !== FALSE) {
             $elementRecordsArr[] = $elementRecordArr['uid'];
         }
     }
     return $elementRecordsArr;
 }
コード例 #5
0
ファイル: tca.php プロジェクト: Konafets/seminars
 /**
  * Creates the values for a country selector in the TCA, using the alpha 2 codes as array keys.
  *
  * @param array[] $parameters
  *
  * @return void
  */
 function user_createCountrySelector(array &$parameters)
 {
     $parameters['items'] = array(array('', ''));
     $table = 'static_countries';
     $titleField = 'cn_short_local';
     $keyField = 'cn_iso_2';
     $allFields = $keyField . ', ' . $titleField;
     $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($allFields, $table, '1 = 1' . t3lib_BEfunc::deleteClause($table), '', $titleField);
     /** @var $row string[] */
     foreach ($rows as $row) {
         $parameters['items'][] = array($row[$titleField], $row[$keyField]);
     }
 }
 /**
  * Checks whether a an BE user account named admin with default password exists.
  *
  * @return	tx_reports_reports_status_Status	An tx_reports_reports_status_Status object representing whether a default admin account exists
  */
 protected function getAdminAccountStatus()
 {
     $value = $GLOBALS['LANG']->getLL('status_ok');
     $message = '';
     $severity = tx_reports_reports_status_Status::OK;
     $whereClause = 'username = '******'TYPO3_DB']->fullQuoteStr('admin', 'be_users') . ' AND password = '******'TYPO3_DB']->fullQuoteStr('5f4dcc3b5aa765d61d8327deb882cf99', 'be_users') . t3lib_BEfunc::deleteClause('be_users');
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, username, password', 'be_users', $whereClause);
     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $value = $GLOBALS['LANG']->getLL('status_insecure');
         $severity = tx_reports_reports_status_Status::ERROR;
         $editUserAccountUrl = 'alt_doc.php?returnUrl=mod.php?M=tools_txreportsM1&edit[be_users][' . $row['uid'] . ']=edit';
         $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.backend_admin'), '<a href="' . $editUserAccountUrl . '">', '</a>');
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     return t3lib_div::makeInstance('tx_reports_reports_status_Status', $GLOBALS['LANG']->getLL('status_adminUserAccount'), $value, $message, $severity);
 }
 /**
  * Generates a list of pids of all sub pages for the given depth.
  *
  * @param	integer		the pid of the page
  * @param	integer		the depth for the search
  * @return	string		the list of pids
  * @author	of method	Michael Oehlhof <*****@*****.**>
  * @access public
  */
 function getRecursiveUidList($parentUid, $depth)
 {
     global $TCA;
     if ($depth != -1) {
         $depth = $depth - 1;
         //decreasing depth
     }
     # Get ressource records:
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'pid IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($parentUid) . ') ' . t3lib_BEfunc::deleteClause('pages') . t3lib_BEfunc::versioningPlaceholderClause('pages'));
     if ($depth > 0) {
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $parentUid .= ',' . $this->getRecursiveUidList($row['uid'], $depth);
         }
     }
     return $parentUid;
 }
コード例 #8
0
 /**
  * Returns information about localization of traditional content elements (non FCEs).
  * It will be added to the content tree by getContentTree().
  *
  * @param	array		$contentTreeArr: Part of the content tree of the element to create the localization information for.
  * @param	array		$tt_content_elementRegister: Array of sys_language UIDs with some information as the value
  * @return	array		Localization information
  * @access	protected
  * @see	getContentTree_element()
  */
 function getContentTree_getLocalizationInfoForElement($contentTreeArr, &$tt_content_elementRegister)
 {
     global $TYPO3_DB;
     $localizationInfoArr = array();
     if ($contentTreeArr['el']['table'] == 'tt_content' && $contentTreeArr['el']['sys_language_uid'] <= 0) {
         // Finding translations of this record and select overlay record:
         $fakeElementRow = array('uid' => $contentTreeArr['el']['uid'], 'pid' => $contentTreeArr['el']['pid']);
         t3lib_beFunc::fixVersioningPID('tt_content', $fakeElementRow);
         $res = $TYPO3_DB->exec_SELECTquery('*', 'tt_content', 'pid=' . $fakeElementRow['pid'] . ' AND sys_language_uid>0' . ' AND l18n_parent=' . intval($contentTreeArr['el']['uid']) . t3lib_BEfunc::deleteClause('tt_content'));
         $attachedLocalizations = array();
         while (TRUE == ($olrow = $TYPO3_DB->sql_fetch_assoc($res))) {
             t3lib_BEfunc::workspaceOL('tt_content', $olrow);
             if (!isset($attachedLocalizations[$olrow['sys_language_uid']])) {
                 $attachedLocalizations[$olrow['sys_language_uid']] = $olrow['uid'];
             }
         }
         $TYPO3_DB->sql_free_result($res);
         // Traverse the available languages of the page (not default and [All])
         if (is_array($this->allSystemWebsiteLanguages) && is_array($this->allSystemWebsiteLanguages['rows'])) {
             foreach (array_keys($this->allSystemWebsiteLanguages['rows']) as $sys_language_uid) {
                 if ($sys_language_uid > 0) {
                     if (isset($attachedLocalizations[$sys_language_uid])) {
                         $localizationInfoArr[$sys_language_uid] = array();
                         $localizationInfoArr[$sys_language_uid]['mode'] = 'exists';
                         $localizationInfoArr[$sys_language_uid]['localization_uid'] = $attachedLocalizations[$sys_language_uid];
                         $tt_content_elementRegister[$attachedLocalizations[$sys_language_uid]]++;
                     } elseif ($contentTreeArr['el']['CType'] != 'templavoila_pi1') {
                         // Only localize content elements with "Default" langauge set
                         if ((int) $contentTreeArr['el']['sys_language_uid'] === 0) {
                             $localizationInfoArr[$sys_language_uid] = array();
                             $localizationInfoArr[$sys_language_uid]['mode'] = 'localize';
                         }
                     } elseif (!$contentTreeArr['ds_meta']['langDisable'] && ((int) $contentTreeArr['el']['sys_language_uid'] === -1 || (int) $contentTreeArr['el']['sys_language_uid'] === 0)) {
                         $localizationInfoArr[$sys_language_uid] = array();
                         $localizationInfoArr[$sys_language_uid]['mode'] = 'localizedFlexform';
                     } else {
                         $localizationInfoArr[$sys_language_uid] = array();
                         $localizationInfoArr[$sys_language_uid]['mode'] = 'no_localization';
                     }
                 }
             }
         }
     }
     return $localizationInfoArr;
 }
コード例 #9
0
ファイル: index.php プロジェクト: tiggr/ke_troubletickets
 /**
  * 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';
     }
     */
 }
 function getSingleField_beforeRender($table, $field, &$row, &$PA)
 {
     global $TCA;
     if ($table == 'tx_caretaker_instance' && $field === 'testconfigurations') {
         switch ($PA['fieldConf']['config']['tag']) {
             case 'testconfigurations.test_service':
                 /* * /
                 			if (count($PA['fieldConf']['config']['items']) != count($TCA['tx_caretaker_test']['columns']['test_service']['config']['items'])) {
                 				t3lib_div::loadTCA('tx_caretaker_test');
                 				$PA['fieldConf']['config']['items'] = $TCA['tx_caretaker_test']['columns']['test_service']['config']['items'];
                 			}
                 			// */
                 break;
             case 'testconfigurations.test_conf':
                 $test = $this->getFFValue($table, $row, $field, str_replace('test_conf', 'test_service', $PA['itemFormElName']));
                 // get related test configuration
                 $testrow = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,test_service,test_conf', 'tx_caretaker_test', 'uid=' . intval($test) . t3lib_BEfunc::deleteClause('tx_caretaker_test'));
                 $row['test_service'] = $testrow[0]['test_service'];
                 if ($PA['itemFormElValue'] == NULL) {
                     $PA['itemFormElValue'] = $testrow[0]['test_conf'];
                 }
                 if (is_array($PA['itemFormElValue'])) {
                     $PA['itemFormElValue'] = t3lib_div::array2xml($PA['itemFormElValue']);
                 }
                 if (!is_array($PA['fieldConf']['config']['ds'])) {
                     t3lib_div::loadTCA('tx_caretaker_test');
                     $PA['fieldConf']['config']['ds'] = $TCA['tx_caretaker_test']['columns']['test_conf']['config']['ds'];
                 }
                 // var_dump($PA['fieldConf']['config']['ds']);
                 /* * /
                 			$row['test_service'] = $test;
                 			if (!is_array($PA['fieldConf']['config']['ds'])) {
                 				t3lib_div::loadTCA('tx_caretaker_test');
                 				$PA['fieldConf']['config']['ds'] = $TCA['tx_caretaker_test']['columns']['test_conf']['config']['ds'];
                 			}
                 			// FIXME
                 			$PA['itemFormElValue']='';
                 			// */
                 break;
         }
     }
 }
 /**
  * Import from t3lib_page in order to eate backend version
  * Creates language-overlay for records in general (where translation is found in records from the same table)
  *
  * @param	string		$table: Table name
  * @param	array		$row: Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
  * @param	integer		$sys_language_content: Pointer to the sys_language uid for content on the site.
  * @param	string		$OLmode: Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false)
  * @return	mixed		Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return false if no translation is found.
  */
 function getRecordOverlay($table, $row, $sys_language_content, $OLmode = '')
 {
     global $TCA, $TYPO3_DB;
     if ($row['uid'] > 0 && $row['pid'] > 0) {
         if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
             if (!$TCA[$table]['ctrl']['transOrigPointerTable']) {
                 // Will try to overlay a record only if the sys_language_content value is larger that zero.
                 if ($sys_language_content > 0) {
                     // Must be default language or [All], otherwise no overlaying:
                     if ($row[$TCA[$table]['ctrl']['languageField']] <= 0) {
                         // Select overlay record:
                         $res = $TYPO3_DB->exec_SELECTquery('*', $table, 'pid=' . intval($row['pid']) . ' AND ' . $TCA[$table]['ctrl']['languageField'] . '=' . intval($sys_language_content) . ' AND ' . $TCA[$table]['ctrl']['transOrigPointerField'] . '=' . intval($row['uid']) . t3lib_BEfunc::BEenableFields($table) . t3lib_BEfunc::deleteClause($table), '', '', '1');
                         $olrow = $TYPO3_DB->sql_fetch_assoc($res);
                         // Merge record content by traversing all fields:
                         if (is_array($olrow)) {
                             foreach ($row as $fN => $fV) {
                                 if ($fN != 'uid' && $fN != 'pid' && isset($olrow[$fN])) {
                                     if ($TCA[$table]['l10n_mode'][$fN] != 'exclude' && ($TCA[$table]['l10n_mode'][$fN] != 'mergeIfNotBlank' || strcmp(trim($olrow[$fN]), ''))) {
                                         $row[$fN] = $olrow[$fN];
                                     }
                                 }
                             }
                         } elseif ($OLmode === 'hideNonTranslated' && $row[$TCA[$table]['ctrl']['languageField']] == 0) {
                             // Unset, if non-translated records should be hidden. ONLY done if the source record really is default language and not [All] in which case it is allowed.
                             unset($row);
                         }
                         // Otherwise, check if sys_language_content is different from the value of the record - that means a japanese site might try to display french content.
                     } elseif ($sys_language_content != $row[$TCA[$table]['ctrl']['languageField']]) {
                         unset($row);
                     }
                 } else {
                     // When default language is displayed, we never want to return a record carrying another language!:
                     if ($row[$TCA[$table]['ctrl']['languageField']] > 0) {
                         unset($row);
                     }
                 }
             }
         }
     }
     return $row;
 }
コード例 #12
0
 /**
  *
  * @param integer $pageId
  * @return array
  */
 public static function getLangRecords($pageId)
 {
     if (!static::$sysLanguageRecordAll) {
         static::$sysLanguageRecordAll = TRUE;
         tx_rnbase::load('tx_rnbase_util_DB');
         $records = tx_rnbase_util_DB::doSelect('*', 'sys_language', array());
         foreach ($records as $record) {
             static::$sysLanguageRecords[(int) $record['uid']] = $record;
         }
     }
     $records = static::$sysLanguageRecords;
     if ($pageId) {
         // check all page overlays to get all available languages for the page
         $available = tx_rnbase_util_DB::doSelect('sys_language.uid', array('sys_language,pages_language_overlay', 'sys_language'), array('where' => 'pages_language_overlay.sys_language_uid=sys_language.uid' . ' AND pages_language_overlay.pid=' . (int) $pageId . t3lib_BEfunc::deleteClause('pages_language_overlay'), 'orderby' => 'sys_language.title ASC'));
         $records = array();
         foreach ($available as $langRow) {
             $langUid = (int) $langRow['uid'];
             $records[$langUid] = self::getLangRecord($langUid);
         }
     }
     return $records;
 }
 /**
  * Get all available configuration records.
  *
  * @access protected
  * @return array which contains the available configuration records.
  */
 protected function getCrawlerConfigurationRecords()
 {
     $records = array();
     $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_crawler_configuration', '1=1' . t3lib_BEfunc::deleteClause('tx_crawler_configuration'));
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
         $records[] = $row;
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($result);
     return $records;
 }
コード例 #14
0
 /**
  * [Describe function...]
  *
  * @param	[type]		$where: ...
  * @return	[type]		...
  */
 function getCategoryFolders($where)
 {
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pid', 'tt_news_cat', 'pid>=0' . $where . t3lib_BEfunc::deleteClause('tt_news_cat'), 'pid');
     $list = array();
     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
         $list[] = $row['pid'];
     }
     $GLOBALS['TYPO3_DB']->sql_free_result($res);
     //		debug($list, ' ('.__CLASS__.'::'.__FUNCTION__.')', __LINE__, __FILE__, 3);
     return $list;
 }
コード例 #15
0
 /**
  * A function which can be used for load a batch of records from $table into internal memory of this object.
  * The function is also used to produce proper default data for new records
  * Ultimately the function will call renderRecord()
  *
  * @param	string		Table name, must be found in $TCA
  * @param	string		Comma list of id values. If $idList is "prev" then the value from $this->prevPageID is used. NOTICE: If $operation is "new", then negative ids are meant to point to a "previous" record and positive ids are PID values for new records. Otherwise (for existing records that is) it is straight forward table/id pairs.
  * @param	string		If "new", then a record with default data is returned. Further, the $id values are meant to be PID values (or if negative, pointing to a previous record). If NOT new, then the table/ids are just pointing to an existing record!
  * @return	void
  * @see renderRecord()
  */
 function fetchRecord($table, $idList, $operation)
 {
     global $TCA;
     if ((string) $idList == 'prev') {
         $idList = $this->prevPageID;
     }
     if ($TCA[$table]) {
         t3lib_div::loadTCA($table);
         // For each ID value (integer) we
         $ids = t3lib_div::trimExplode(',', $idList, 1);
         foreach ($ids as $id) {
             if (strcmp($id, '')) {
                 // If ID is not blank:
                 // For new records to be created, find default values:
                 if ($operation == 'new') {
                     // Default values:
                     $newRow = array();
                     // Used to store default values as found here:
                     // Default values as set in userTS:
                     $TCAdefaultOverride = $GLOBALS['BE_USER']->getTSConfigProp('TCAdefaults');
                     if (is_array($TCAdefaultOverride[$table . '.'])) {
                         foreach ($TCAdefaultOverride[$table . '.'] as $theF => $theV) {
                             if (isset($TCA[$table]['columns'][$theF])) {
                                 $newRow[$theF] = $theV;
                             }
                         }
                     }
                     if ($id < 0) {
                         $record = t3lib_beFunc::getRecord($table, abs($id), 'pid');
                         $pid = $record['pid'];
                         unset($record);
                     } else {
                         $pid = intval($id);
                     }
                     $pageTS = t3lib_beFunc::getPagesTSconfig($pid);
                     if (isset($pageTS['TCAdefaults.'])) {
                         $TCAPageTSOverride = $pageTS['TCAdefaults.'];
                         if (is_array($TCAPageTSOverride[$table . '.'])) {
                             foreach ($TCAPageTSOverride[$table . '.'] as $theF => $theV) {
                                 if (isset($TCA[$table]['columns'][$theF])) {
                                     $newRow[$theF] = $theV;
                                 }
                             }
                         }
                     }
                     // Default values as submitted:
                     if (is_array($this->defVals[$table])) {
                         foreach ($this->defVals[$table] as $theF => $theV) {
                             if (isset($TCA[$table]['columns'][$theF])) {
                                 $newRow[$theF] = $theV;
                             }
                         }
                     }
                     // Fetch default values if a previous record exists
                     if ($id < 0 && $TCA[$table]['ctrl']['useColumnsForDefaultValues']) {
                         // Fetches the previous record:
                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . abs($id) . t3lib_BEfunc::deleteClause($table));
                         if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                             // Gets the list of fields to copy from the previous record.
                             $fArr = t3lib_div::trimExplode(',', $TCA[$table]['ctrl']['useColumnsForDefaultValues'], 1);
                             foreach ($fArr as $theF) {
                                 if (isset($TCA[$table]['columns'][$theF])) {
                                     $newRow[$theF] = $row[$theF];
                                 }
                             }
                         }
                         $GLOBALS['TYPO3_DB']->sql_free_result($res);
                     }
                     // Finally, call renderRecord:
                     $this->renderRecord($table, uniqid('NEW'), $id, $newRow);
                 } else {
                     $id = intval($id);
                     // Fetch database values
                     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid=' . intval($id) . t3lib_BEfunc::deleteClause($table));
                     if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                         t3lib_BEfunc::fixVersioningPid($table, $row);
                         $this->renderRecord($table, $id, $row['pid'], $row);
                         $contentTable = $GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'];
                         $this->lockRecord($table, $id, $contentTable == $table ? $row['pid'] : 0);
                         // Locking the pid if the table edited is the content table.
                     }
                     $GLOBALS['TYPO3_DB']->sql_free_result($res);
                 }
             }
         }
     }
 }
コード例 #16
0
 /**
  * Gets the related items from a table using a n:m relation.
  *
  * @param string $localTableName Local table name
  * @param integer $localRecordUid Local record uid
  * @param array $localFieldTca The local table's TCA
  * @return array Array of related items, values already resolved from related records
  */
 protected function getRelatedItemsFromMMTable($localTableName, $localRecordUid, array $localFieldTca)
 {
     $relatedItems = array();
     $mmTableName = $localFieldTca['config']['MM'];
     $mmTableSortingField = '';
     if (isset($this->configuration['relationTableSortingField'])) {
         $mmTableSortingField = $mmTableName . '.' . $this->configuration['relationTableSortingField'];
     }
     $foreignTableName = $localFieldTca['config']['foreign_table'];
     t3lib_div::loadTCA($foreignTableName);
     $foreignTableTca = $GLOBALS['TCA'][$foreignTableName];
     $foreignTableLabelField = $this->resolveForeignTableLabelField($foreignTableTca);
     $relationHandler = t3lib_div::makeInstance('t3lib_loadDBGroup');
     $relationHandler->start('', $foreignTableName, $mmTableName, $localRecordUid, $localTableName, $localFieldTca['config']);
     $selectUids = $relationHandler->tableArray[$foreignTableName];
     if (is_array($selectUids) && count($selectUids) > 0) {
         $relatedRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($foreignTableLabelField, $foreignTableName, 'uid IN (' . implode(',', $selectUids) . ')' . t3lib_BEfunc::deleteClause($foreignTableName));
         foreach ($relatedRecords as $record) {
             if ($GLOBALS['TSFE']->sys_language_uid > 0) {
                 $record = $this->getTranslationOverlay($foreignTableName, $record);
             }
             $relatedItems[] = $record[$foreignTableLabelField];
         }
     }
     return $relatedItems;
 }
コード例 #17
0
 /**
  *
  *
  * @return integer
  */
 public function getDatastructureCountForPid($pid)
 {
     $dsCnt = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('DISTINCT datastructure', 'tx_templavoila_tmplobj', 'pid=' . intval($pid) . t3lib_BEfunc::deleteClause('tx_templavoila_tmplobj'), 'datastructure');
     array_unique($dsCnt);
     return count($dsCnt);
 }
コード例 #18
0
 /**
  * [Describe function...]
  *
  * @param	[type]		$fN: ...
  * @param	[type]		$fV: ...
  * @param	[type]		$conf: ...
  * @param	[type]		$table: ...
  * @param	[type]		$splitString: ...
  * @return	[type]		...
  */
 function makeValueList($fN, $fV, $conf, $table, $splitString)
 {
     $fieldSetup = $conf;
     $out = '';
     if ($fieldSetup['type'] == 'files') {
         $d = dir(PATH_site . $fieldSetup['uploadfolder']);
         while (FALSE !== ($entry = $d->read())) {
             if ($entry == '.' || $entry == '..') {
                 continue;
             }
             $fileArray[] = $entry;
         }
         $d->close();
         natcasesort($fileArray);
         while (list(, $fileName) = each($fileArray)) {
             if (t3lib_div::inList($fV, $fileName) || $fV == $fileName) {
                 if (!$out) {
                     $out = htmlspecialchars($fileName);
                 } else {
                     $out .= $splitString . htmlspecialchars($fileName);
                 }
             }
         }
     }
     if ($fieldSetup['type'] == 'multiple') {
         foreach ($fieldSetup['items'] as $key => $val) {
             if (substr($val[0], 0, 4) == 'LLL:') {
                 $value = $GLOBALS['LANG']->sL($val[0]);
             } else {
                 $value = $val[0];
             }
             if (t3lib_div::inList($fV, $val[1]) || $fV == $val[1]) {
                 if (!$out) {
                     $out = htmlspecialchars($value);
                 } else {
                     $out .= $splitString . htmlspecialchars($value);
                 }
             }
         }
     }
     if ($fieldSetup['type'] == 'binary') {
         foreach ($fieldSetup['items'] as $Key => $val) {
             if (substr($val[0], 0, 4) == 'LLL:') {
                 $value = $GLOBALS['LANG']->sL($val[0]);
             } else {
                 $value = $val[0];
             }
             if (!$out) {
                 $out = htmlspecialchars($value);
             } else {
                 $out .= $splitString . htmlspecialchars($value);
             }
         }
     }
     if ($fieldSetup['type'] == 'relation') {
         if ($fieldSetup['items']) {
             foreach ($fieldSetup['items'] as $key => $val) {
                 if (substr($val[0], 0, 4) == 'LLL:') {
                     $value = $GLOBALS['LANG']->sL($val[0]);
                 } else {
                     $value = $val[0];
                 }
                 if (t3lib_div::inList($fV, $value) || $fV == $value) {
                     if (!$out) {
                         $out = htmlspecialchars($value);
                     } else {
                         $out .= $splitString . htmlspecialchars($value);
                     }
                 }
             }
         }
         global $TCA;
         if (stristr($fieldSetup['allowed'], ',')) {
             $from_table_Arr = explode(',', $fieldSetup['allowed']);
             $useTablePrefix = 1;
             if (!$fieldSetup['prepend_tname']) {
                 $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, 'uid ' . t3lib_BEfunc::deleteClause($table), $groupBy = '', $orderBy = '', $limit = '');
                 if ($checkres) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) {
                         if (stristr($row[$fN], ',')) {
                             $checkContent = explode(',', $row[$fN]);
                             foreach ($checkContent as $singleValue) {
                                 if (!stristr($singleValue, '_')) {
                                     $dontPrefixFirstTable = 1;
                                 }
                             }
                         } else {
                             $singleValue = $row[$fN];
                             if (strlen($singleValue) && !stristr($singleValue, '_')) {
                                 $dontPrefixFirstTable = 1;
                             }
                         }
                     }
                     $GLOBALS['TYPO3_DB']->sql_free_result($checkres);
                 }
             }
         } else {
             $from_table_Arr[0] = $fieldSetup['allowed'];
         }
         if ($fieldSetup['prepend_tname']) {
             $useTablePrefix = 1;
         }
         if ($fieldSetup['foreign_table']) {
             $from_table_Arr[0] = $fieldSetup['foreign_table'];
         }
         $counter = 0;
         foreach ($from_table_Arr as $from_table) {
             if ($useTablePrefix && !$dontPrefixFirstTable && $counter != 1 || $counter == 1) {
                 $tablePrefix = $from_table . '_';
             }
             $counter = 1;
             if (is_array($TCA[$from_table])) {
                 t3lib_div::loadTCA($from_table);
                 $labelField = $TCA[$from_table]['ctrl']['label'];
                 $altLabelField = $TCA[$from_table]['ctrl']['label_alt'];
                 if ($TCA[$from_table]['columns'][$labelField]['config']['items']) {
                     reset($TCA[$from_table]['columns'][$labelField]['config']['items']);
                     while (list(, $labelArray) = each($TCA[$from_table]['columns'][$labelField]['config']['items'])) {
                         if (substr($labelArray[0], 0, 4) == 'LLL:') {
                             $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]);
                         } else {
                             $labelFieldSelect[$labelArray[1]] = $labelArray[0];
                         }
                     }
                     $useSelectLabels = 1;
                 }
                 if ($TCA[$from_table]['columns'][$altLabelField]['config']['items']) {
                     reset($TCA[$from_table]['columns'][$altLabelField]['config']['items']);
                     foreach ($TCA[$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
                         if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
                             $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]);
                         } else {
                             $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0];
                         }
                     }
                     $useAltSelectLabels = 1;
                 }
                 $altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : '';
                 $select_fields = 'uid,' . $labelField . $altLabelFieldSelect;
                 if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
                     $webMounts = $GLOBALS['BE_USER']->returnWebmounts();
                     $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
                     $webMountPageTree = '';
                     foreach ($webMounts as $key => $val) {
                         if ($webMountPageTree) {
                             $webMountPageTreePrefix = ',';
                         }
                         $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause);
                     }
                     if ($from_table == 'pages') {
                         $where_clause = 'uid IN (' . $webMountPageTree . ') ' . t3lib_BEfunc::deleteClause($from_table) . ' AND ' . $perms_clause;
                     } else {
                         $where_clause = 'pid IN (' . $webMountPageTree . ') ' . t3lib_BEfunc::deleteClause($from_table);
                     }
                 } else {
                     $where_clause = 'uid' . t3lib_BEfunc::deleteClause($from_table);
                 }
                 $orderBy = 'uid';
                 if (!$this->tableArray[$from_table]) {
                     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy, $limit = '');
                     $this->tableArray[$from_table] = array();
                 }
                 if ($res) {
                     while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                         $this->tableArray[$from_table][] = $row;
                     }
                     $GLOBALS['TYPO3_DB']->sql_free_result($res);
                 }
                 reset($this->tableArray[$from_table]);
                 foreach ($this->tableArray[$from_table] as $key => $val) {
                     $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 1 ? 'on' : $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'];
                     $prefixString = $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] == 'on' ? '' : ' [' . $tablePrefix . $val['uid'] . '] ';
                     if (t3lib_div::inList($fV, $tablePrefix . $val['uid']) || $fV == $tablePrefix . $val['uid']) {
                         if ($useSelectLabels) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $labelFieldSelect[$val[$labelField]]);
                             }
                         } elseif ($val[$labelField]) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $val[$labelField]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $val[$labelField]);
                             }
                         } elseif ($useAltSelectLabels) {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $altLabelFieldSelect[$val[$altLabelField]]);
                             }
                         } else {
                             if (!$out) {
                                 $out = htmlspecialchars($prefixString . $val[$altLabelField]);
                             } else {
                                 $out .= $splitString . htmlspecialchars($prefixString . $val[$altLabelField]);
                             }
                         }
                     }
                 }
             }
         }
     }
     return $out;
 }
コード例 #19
0
 /**
  * Selects records from table / pid
  *
  * @param	string		Table to select from
  * @param	integer		Page ID to select from
  * @param	integer		Max number of records to select
  * @return	pointer		SQL resource pointer
  */
 function exec_listQueryPid($table, $pid, $limit)
 {
     global $TCA, $LANG;
     $orderBy = $TCA[$table]['ctrl']['sortby'] ? 'ORDER BY ' . $TCA[$table]['ctrl']['sortby'] : $TCA[$table]['ctrl']['default_sortby'];
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'pid=' . intval($pid) . t3lib_BEfunc::deleteClause($table) . t3lib_BEfunc::versioningPlaceholderClause($table), '', $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy), $limit);
     // Warning about hitting limit:
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) == $limit) {
         $this->content .= $this->doc->section($LANG->getLL('execlistqu_maxNumberLimit'), sprintf($LANG->getLL('makeconfig_anSqlQueryReturned', 1), $limit), 0, 1, 2);
     }
     return $res;
 }
コード例 #20
0
 /**
  * Find orphan records
  * VERY CPU and memory intensive since it will look up the whole page tree!
  *
  * @return	array
  */
 function main()
 {
     global $TYPO3_DB;
     // Initialize result array:
     $resultArray = array('message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'], 'headers' => array('versions' => array('All versions', 'Showing all versions of records found', 0), 'versions_published' => array('All published versions', 'This is all records that has been published and can therefore be removed permanently', 1), 'versions_liveWS' => array('All versions in Live workspace', 'This is all records that are offline versions in the Live workspace. You may wish to flush these if you only use workspaces for versioning since then you might find lots of versions piling up in the live workspace which have simply been disconnected from the workspace before they were published.', 1), 'versions_lost_workspace' => array('Versions outside a workspace', 'Versions that has lost their connection to a workspace in TYPO3.', 3), 'versions_inside_versioned_page' => array('Versions in versions', 'Versions inside an already versioned page. Something that is confusing to users and therefore should not happen but is technically possible.', 2), 'versions_unused_placeholders' => array('Unused placeholder records', 'Placeholder records which are not used anymore by offline versions.', 2), 'versions_move_placeholders_ok' => array('Move placeholders', 'Move-to placeholder records which has good integrity', 0), 'versions_move_placeholders_bad' => array('Move placeholders with bad integrity', 'Move-to placeholder records which has bad integrity', 2), 'versions_move_id_check' => array('Checking if t3ver_move_id is correct', 't3ver_move_id must only be set with online records having t3ver_state=3.', 2)), 'versions' => array());
     $startingPoint = $this->cli_isArg('--pid') ? t3lib_div::intInRange($this->cli_argValue('--pid'), 0) : 0;
     $depth = $this->cli_isArg('--depth') ? t3lib_div::intInRange($this->cli_argValue('--depth'), 0) : 1000;
     $this->genTree($startingPoint, $depth, (int) $this->cli_argValue('--echotree'));
     $resultArray['versions'] = $this->recStats['versions'];
     $resultArray['versions_published'] = $this->recStats['versions_published'];
     $resultArray['versions_liveWS'] = $this->recStats['versions_liveWS'];
     $resultArray['versions_lost_workspace'] = $this->recStats['versions_lost_workspace'];
     $resultArray['versions_inside_versioned_page'] = $this->recStats['versions_inside_versioned_page'];
     // Finding all placeholders with no records attached!
     $resultArray['versions_unused_placeholders'] = array();
     foreach ($GLOBALS['TCA'] as $table => $cfg) {
         if ($cfg['ctrl']['versioningWS']) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid', $table, 't3ver_state=1 AND pid>=0' . t3lib_BEfunc::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 if (count(t3lib_BEfunc::selectVersionsOfRecord($table, $phrec['uid'], 'uid')) <= 1) {
                     $resultArray['versions_unused_placeholders'][t3lib_div::shortmd5($table . ':' . $phrec['uid'])] = $table . ':' . $phrec['uid'];
                 }
             }
         }
     }
     asort($resultArray['versions_unused_placeholders']);
     // Finding all move placeholders with inconsistencies:
     $resultArray['versions_move_placeholders_ok'] = array();
     $resultArray['versions_move_placeholders_bad'] = array();
     foreach ($GLOBALS['TCA'] as $table => $cfg) {
         if ((int) $cfg['ctrl']['versioningWS'] >= 2) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,t3ver_move_id,t3ver_wsid,t3ver_state', $table, 't3ver_state=3 AND pid>=0' . t3lib_BEfunc::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 $shortID = t3lib_div::shortmd5($table . ':' . $phrec['uid']);
                 if ((int) $phrec['t3ver_wsid'] != 0) {
                     $phrecCopy = $phrec;
                     if (t3lib_BEfunc::movePlhOL($table, $phrec)) {
                         if ($wsAlt = t3lib_BEfunc::getWorkspaceVersionOfRecord($phrecCopy['t3ver_wsid'], $table, $phrec['uid'], 'uid,pid,t3ver_state')) {
                             if ($wsAlt['t3ver_state'] != 4) {
                                 $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'State for version was not "4" as it should be!', $phrecCopy);
                             } else {
                                 $resultArray['versions_move_placeholders_ok'][$shortID] = array($table . ':' . $phrec['uid'], 'PLH' => $phrecCopy, 'online' => $phrec, 'PNT' => $wsAlt);
                             }
                         } else {
                             $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'No version was found for online record to be moved. A version must exist.', $phrecCopy);
                         }
                     } else {
                         $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'Did not find online record for "t3ver_move_id" value ' . $phrec['t3ver_move_id'], $phrec);
                     }
                 } else {
                     $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'Placeholder was not assigned a workspace value in t3ver_wsid.', $phrec);
                 }
             }
         }
     }
     ksort($resultArray['versions_move_placeholders_ok']);
     ksort($resultArray['versions_move_placeholders_bad']);
     // Finding move_id_check inconsistencies:
     $resultArray['versions_move_id_check'] = array();
     foreach ($GLOBALS['TCA'] as $table => $cfg) {
         if ((int) $cfg['ctrl']['versioningWS'] >= 2) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,t3ver_move_id,t3ver_wsid,t3ver_state', $table, 't3ver_move_id!=0' . t3lib_BEfunc::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 if ((int) $phrec['t3ver_state'] == 3) {
                     if ($phrec['pid'] != -1) {
                         // OK
                     } else {
                         $resultArray['versions_move_id_check'][] = array($table . ':' . $phrec['uid'], 'Record was offline, must not be!', $phrec);
                     }
                 } else {
                     $resultArray['versions_move_id_check'][] = array($table . ':' . $phrec['uid'], 'Record had t3ver_move_id set to "' . $phrec['t3ver_move_id'] . '" while having t3ver_state=' . $phrec['t3ver_state'], $phrec);
                 }
             }
         }
     }
     return $resultArray;
 }
コード例 #21
0
ファイル: Indexer.php プロジェクト: punktDe/solr
 /**
  * Finds the alternative page language overlay records for a page based on
  * the sys_language_mode.
  *
  * Possible Language Modes:
  * 1) content_fallback --> all languages
  * 2) strict --> available languages with page overlay
  * 3) ignore --> available languages with page overlay
  * 4) unknown mode or blank --> all languages
  *
  * @param integer $pageId Page ID.
  * @return array An array of translation overlays (or fake overlays) found for the given page.
  */
 protected function getTranslationOverlaysForPage($pageId)
 {
     $translationOverlays = array();
     $pageId = intval($pageId);
     $site = Tx_Solr_Site::getSiteByPageId($pageId);
     $languageModes = array('content_fallback', 'strict', 'ignore');
     $hasOverlayMode = in_array($site->getSysLanguageMode(), $languageModes, TRUE);
     $isContentFallbackMode = $site->getSysLanguageMode() === 'content_fallback';
     if ($hasOverlayMode && !$isContentFallbackMode) {
         $translationOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pid, sys_language_uid', 'pages_language_overlay', 'pid = ' . $pageId . t3lib_BEfunc::deleteClause('pages_language_overlay') . t3lib_BEfunc::BEenableFields('pages_language_overlay'));
     } else {
         // ! If no sys_language_mode is configured, all languages will be indexed !
         $languages = t3lib_BEfunc::getSystemLanguages();
         // remove default language (L = 0)
         array_shift($languages);
         foreach ($languages as $language) {
             $translationOverlays[] = array('pid' => $pageId, 'sys_language_uid' => $language[1]);
         }
     }
     return $translationOverlays;
 }
コード例 #22
0
 /**
  * performs the service processing
  *
  * @param	string 	Content which should be processed.
  * @param	string 	Content type
  * @param	array 	Configuration array
  * @return	boolean
  */
 function process($content = '', $type = '', $conf = array())
 {
     $this->conf = $conf;
     $this->out = array();
     $this->out['fields'] = array();
     $this->exif = array();
     if ($content) {
         $this->setInput($content, $type);
     }
     if ($inputFile = $this->getInputFile()) {
         $cmd = t3lib_exec::getCommand($this->info['exec']) . ' -q -m -g -S ' . escapeshellarg($inputFile);
         $exif = $ret = NULL;
         exec($cmd, $exif, $ret);
         if (!$ret and is_array($exif)) {
             $section = 'EXIF';
             array_shift($exif);
             // ---- ExifTool ----
             array_shift($exif);
             // ExifToolVersion                 : 6.57
             foreach ($exif as $line) {
                 if (preg_match('#---- ([^ ]*) ----#', $line, $matches)) {
                     $section = $matches[1];
                 }
                 // Only request 2 elements because exiftool output contains colons in $value
                 list($name, $value) = explode(':', $line, 2);
                 $name = trim($name);
                 $value = trim($value);
                 if ($value) {
                     // ignore empty lines headers and empty entries
                     $name = str_replace('-', '', $name);
                     $name = str_replace(' ', '', $name);
                     // add to exif table
                     $this->exif[$section][$name] = $value;
                     // add to DAM table
                     switch ($name) {
                         case 'CameraModel':
                             $this->out['fields']['file_creator'] = $value;
                             break;
                         case 'XResolution':
                         case 'HorizontalResolution':
                             $this->out['fields']['hres'] = intval($value);
                             break;
                         case 'YResolution':
                         case 'VerticalResolution':
                             $this->out['fields']['vres'] = intval($value);
                             break;
                         case 'Title':
                         case 'Headline':
                         case 'XPTitle':
                             $this->out['fields']['title'] = $value;
                             break;
                         case 'Keywords':
                         case 'XPKeywords':
                             $this->out['fields']['keywords'] = $value;
                             break;
                         case 'Subject':
                         case 'ImageDescription':
                         case 'Description':
                             $this->out['fields']['description'] = $value;
                             break;
                         case 'CaptionAbstract':
                             $this->out['fields']['caption'] = $value;
                             break;
                         case 'ModifyDate':
                             $this->out['fields']['date_mod'] = tx_svmetaextract_lib::parseDate($value);
                             $this->out['fields']['file_mtime'] = tx_svmetaextract_lib::parseDate($value);
                             break;
                         case 'ImageCreated':
                         case 'CreateDate':
                         case 'DateTimeOriginal':
                             $this->out['fields']['date_cr'] = tx_svmetaextract_lib::parseDate($value);
                             $this->out['fields']['file_ctime'] = tx_svmetaextract_lib::parseDate($value);
                             break;
                         case 'CreatorTool':
                         case 'Software':
                             $this->out['fields']['file_creator'] = $value;
                             break;
                         case 'City':
                             $this->out['fields']['loc_city'] = $value;
                             break;
                         case 'Country':
                             // TODO format?
                             # $this->out['fields']['loc_country'] = $value;
                             break;
                         case 'CountryCode':
                             if (strlen($value) == 2) {
                                 $isoCodeField = tx_staticinfotables_div::getIsoCodeField('static_countries', $value);
                                 $enableFields = t3lib_BEfunc::deleteClause('static_countries');
                                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('cn_iso_3', 'static_countries', $isoCodeField . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr(strtoupper($value), 'static_countries') . $enableFields);
                                 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                                     $this->out['fields']['loc_country'] = $row['cn_iso_3'];
                                 }
                             }
                             break;
                         case 'Artist':
                         case 'Creator':
                             $this->out['fields']['creator'] = $value;
                             break;
                         case 'Copyright':
                         case 'CopyrightNotice':
                             $this->out['fields']['copyright'] = $value;
                             break;
                         case 'Rights':
                             $this->out['fields']['copyright'] = $value;
                             break;
                         case 'RightsUsageTerms':
                         case 'UsageTerms':
                             $this->out['fields']['instructions'] = $value;
                             break;
                         case 'Credit':
                             $this->out['fields']['copyright'] = $value;
                             break;
                         case 'Instructions':
                             $this->out['fields']['instructions'] = $value;
                             break;
                     }
                 }
             }
         }
         // TODO read XMP XML
         // $this->out['fields']['meta']['XMP_XML'] = $this->xmpRaw;
         unset($this->exif['File']);
         unset($this->exif['Composite']);
         $this->postProcess();
         $this->out['fields']['meta'] = $this->exif;
         $this->out['exif_done'] = true;
         $this->out['iptc_done'] = true;
         $this->out['xmp_done'] = true;
     } else {
         $this->errorPush(T3_ERR_SV_NO_INPUT, 'No or empty input.');
     }
     return $this->getLastError();
 }
コード例 #23
0
    /**
     * Reads items from a foreign_table, that has a foreign_field (uid of the parent record) and
     * stores the parts in the internal array itemArray and tableArray.
     *
     * @param	integer		$uid: The uid of the parent record (this value is also on the foreign_table in the foreign_field)
     * @param	array		$conf: TCA configuration for current field
     * @return	void
     */
    function readForeignField($uid, $conf)
    {
        $key = 0;
        $uid = intval($uid);
        $whereClause = '';
        $foreign_table = $conf['foreign_table'];
        $foreign_table_field = $conf['foreign_table_field'];
        $useDeleteClause = $this->undeleteRecord ? false : true;
        // search for $uid in foreign_field, and if we have symmetric relations, do this also on symmetric_field
        if ($conf['symmetric_field']) {
            $whereClause = '(' . $conf['foreign_field'] . '=' . $uid . ' OR ' . $conf['symmetric_field'] . '=' . $uid . ')';
        } else {
            $whereClause = $conf['foreign_field'] . '=' . $uid;
        }
        // use the deleteClause (e.g. "deleted=0") on this table
        if ($useDeleteClause) {
            $whereClause .= t3lib_BEfunc::deleteClause($foreign_table);
        }
        // if it's requested to look for the parent uid AND the parent table,
        // add an additional SQL-WHERE clause
        if ($foreign_table_field && $this->currentTable) {
            $whereClause .= ' AND ' . $foreign_table_field . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->currentTable, $foreign_table);
        }
        // get the correct sorting field
        if ($conf['foreign_sortby']) {
            // specific manual sortby for data handled by this field
            if ($conf['symmetric_sortby'] && $conf['symmetric_field']) {
                // sorting depends on, from which side of the relation we're looking at it
                $sortby = '
					CASE
						WHEN ' . $conf['foreign_field'] . '=' . $uid . '
						THEN ' . $conf['foreign_sortby'] . '
						ELSE ' . $conf['symmetric_sortby'] . '
					END';
            } else {
                // regular single-side behaviour
                $sortby = $conf['foreign_sortby'];
            }
        } elseif ($conf['foreign_default_sortby']) {
            // specific default sortby for data handled by this field
            $sortby = $conf['foreign_default_sortby'];
        } elseif ($GLOBALS['TCA'][$foreign_table]['ctrl']['sortby']) {
            // manual sortby for all table records
            $sortby = $GLOBALS['TCA'][$foreign_table]['ctrl']['sortby'];
        } elseif ($GLOBALS['TCA'][$foreign_table]['ctrl']['default_sortby']) {
            // default sortby for all table records
            $sortby = $GLOBALS['TCA'][$foreign_table]['ctrl']['default_sortby'];
        }
        // strip a possible "ORDER BY" in front of the $sortby value
        $sortby = $GLOBALS['TYPO3_DB']->stripOrderBy($sortby);
        // get the rows from storage
        $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid', $foreign_table, $whereClause, '', $sortby);
        if (count($rows)) {
            foreach ($rows as $row) {
                $this->itemArray[$key]['id'] = $row['uid'];
                $this->itemArray[$key]['table'] = $foreign_table;
                $this->tableArray[$foreign_table][] = $row['uid'];
                $key++;
            }
        }
    }
コード例 #24
0
ファイル: index.php プロジェクト: rod86/t3sandbox
    /**
     * Returns an array of available languages (to use for FlexForms)
     *
     * @param	integer		$id: If zero, the query will select all sys_language records from root level. If set to another value, the query will select all sys_language records that has a pages_language_overlay record on that page (and is not hidden, unless you are admin user)
     * @param	boolean		$onlyIsoCoded: If set, only languages which are paired with a static_info_table / static_language record will be returned.
     * @param	boolean		$setDefault: If set, an array entry for a default language is set.
     * @param	boolean		$setMulti: If set, an array entry for "multiple languages" is added (uid -1)
     * @return	array
     * @access protected
     */
    function getAvailableLanguages($id = 0, $onlyIsoCoded = true, $setDefault = true, $setMulti = false)
    {
        global $LANG, $TYPO3_DB, $BE_USER, $TCA, $BACK_PATH;
        t3lib_div::loadTCA('sys_language');
        $output = array();
        $excludeHidden = $BE_USER->isAdmin() ? '1=1' : 'sys_language.hidden=0';
        if ($id) {
            $excludeHidden .= ' AND pages_language_overlay.deleted=0';
            $res = $TYPO3_DB->exec_SELECTquery('DISTINCT sys_language.*, pages_language_overlay.hidden as PLO_hidden, pages_language_overlay.title as PLO_title', 'pages_language_overlay,sys_language', 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . intval($id) . ' AND ' . $excludeHidden, '', 'sys_language.title');
        } else {
            $res = $TYPO3_DB->exec_SELECTquery('sys_language.*', 'sys_language', $excludeHidden, '', 'sys_language.title');
        }
        if ($setDefault) {
            $output[0] = array('uid' => 0, 'title' => strlen($this->modSharedTSconfig['properties']['defaultLanguageLabel']) ? $this->modSharedTSconfig['properties']['defaultLanguageLabel'] : $LANG->getLL('defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($this->modSharedTSconfig['properties']['defaultLanguageFlag']) ? $this->modSharedTSconfig['properties']['defaultLanguageFlag'] : null);
        }
        if ($setMulti) {
            $output[-1] = array('uid' => -1, 'title' => $LANG->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'multiple');
        }
        while (TRUE == ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
            t3lib_BEfunc::workspaceOL('sys_language', $row);
            if ($id) {
                $table = 'pages_language_overlay';
                $enableFields = t3lib_BEfunc::BEenableFields($table);
                if (trim($enableFields) == 'AND') {
                    $enableFields = '';
                }
                $enableFields .= t3lib_BEfunc::deleteClause($table);
                // Selecting overlay record:
                $resP = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages_language_overlay', 'pid=' . intval($id) . '
						AND sys_language_uid=' . intval($row['uid']), '', '', '1');
                $pageRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resP);
                $GLOBALS['TYPO3_DB']->sql_free_result($resP);
                t3lib_BEfunc::workspaceOL('pages_language_overlay', $pageRow);
                $row['PLO_hidden'] = $pageRow['hidden'];
                $row['PLO_title'] = $pageRow['title'];
            }
            $output[$row['uid']] = $row;
            if ($row['static_lang_isocode']) {
                $staticLangRow = t3lib_BEfunc::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
                if ($staticLangRow['lg_iso_2']) {
                    $output[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
                }
            }
            if (strlen($row['flag'])) {
                $output[$row['uid']]['flagIcon'] = $row['flag'];
            }
            if ($onlyIsoCoded && !$output[$row['uid']]['ISOcode']) {
                unset($output[$row['uid']]);
            }
            $disableLanguages = t3lib_div::trimExplode(',', $this->modSharedTSconfig['properties']['disableLanguages'], 1);
            foreach ($disableLanguages as $language) {
                // $language is the uid of a sys_language
                unset($output[$language]);
            }
        }
        return $output;
    }
コード例 #25
0
 /**
  * Create selector for workspaces and change workspace if command is given to do that.
  *
  * @return	string		HTML
  */
 function workspaceSelector()
 {
     global $TYPO3_DB, $BE_USER, $LANG;
     // Changing workspace and if so, reloading entire backend:
     if (strlen($this->changeWorkspace)) {
         $BE_USER->setWorkspace($this->changeWorkspace);
         return $this->doc->wrapScriptTags('top.location.href="' . t3lib_BEfunc::getBackendScript() . '";');
     }
     // Changing workspace and if so, reloading entire backend:
     if (strlen($this->changeWorkspacePreview)) {
         $BE_USER->setWorkspacePreview($this->changeWorkspacePreview);
     }
     // Create options array:
     $options = array();
     if ($BE_USER->checkWorkspace(array('uid' => 0))) {
         $options[0] = '[' . $LANG->getLL('shortcut_onlineWS') . ']';
     }
     if ($BE_USER->checkWorkspace(array('uid' => -1))) {
         $options[-1] = '[' . $LANG->getLL('shortcut_offlineWS') . ']';
     }
     // Add custom workspaces (selecting all, filtering by BE_USER check):
     $workspaces = $TYPO3_DB->exec_SELECTgetRows('uid,title,adminusers,members,reviewers', 'sys_workspace', 'pid=0' . t3lib_BEfunc::deleteClause('sys_workspace'), '', 'title');
     if (count($workspaces)) {
         foreach ($workspaces as $rec) {
             if ($BE_USER->checkWorkspace($rec)) {
                 $options[$rec['uid']] = $rec['uid'] . ': ' . $rec['title'];
             }
         }
     }
     // Build selector box:
     if (count($options)) {
         foreach ($options as $value => $label) {
             $selected = (int) $BE_USER->workspace === $value ? ' selected="selected"' : '';
             $options[$value] = '<option value="' . htmlspecialchars($value) . '"' . $selected . '>' . htmlspecialchars($label) . '</option>';
         }
     } else {
         $options[] = '<option value="-99">' . $LANG->getLL('shortcut_noWSfound', 1) . '</option>';
     }
     $selector = '';
     // Preview:
     if ($BE_USER->workspace !== 0) {
         $selector .= '<label for="workspacePreview">Frontend Preview:</label> <input type="checkbox" name="workspacePreview" id="workspacePreview" onclick="changeWorkspacePreview(' . ($BE_USER->user['workspace_preview'] ? 0 : 1) . ')"; ' . ($BE_USER->user['workspace_preview'] ? 'checked="checked"' : '') . '/>&nbsp;';
     }
     $selector .= '<a href="mod/user/ws/index.php" target="content">' . t3lib_iconWorks::getSpriteIconForRecord('sys_workspace', array()) . '</a>';
     if (count($options) > 1) {
         $selector .= '<select name="_workspaceSelector" onchange="changeWorkspace(this.options[this.selectedIndex].value);">' . implode('', $options) . '</select>';
     }
     return $selector;
 }
コード例 #26
0
 /**
  * retrieves the available workspaces from the database and checks whether
  * they're available to the current BE user
  *
  * @return	array	array of worspaces available to the current user
  */
 protected function getAvailableWorkspaces()
 {
     $availableWorkspaces = array();
     // add default workspaces
     if ($GLOBALS['BE_USER']->checkWorkspace(array('uid' => 0))) {
         $availableWorkspaces[0] = '[' . $GLOBALS['LANG']->getLL('shortcut_onlineWS') . ']';
     }
     if ($GLOBALS['BE_USER']->checkWorkspace(array('uid' => -1))) {
         $availableWorkspaces[-1] = '[' . $GLOBALS['LANG']->getLL('shortcut_offlineWS') . ']';
     }
     // add custom workspaces (selecting all, filtering by BE_USER check):
     $customWorkspaces = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, title, adminusers, members, reviewers', 'sys_workspace', 'pid = 0' . t3lib_BEfunc::deleteClause('sys_workspace'), '', 'title');
     if (count($customWorkspaces)) {
         foreach ($customWorkspaces as $workspace) {
             if ($GLOBALS['BE_USER']->checkWorkspace($workspace)) {
                 $availableWorkspaces[$workspace['uid']] = $workspace['uid'] . ': ' . htmlspecialchars($workspace['title']);
             }
         }
     }
     return $availableWorkspaces;
 }
コード例 #27
0
 /**
  * Gets the Solr connections applicaple for a page.
  *
  * The connections include the default connection and connections to be used
  * for translations of a page.
  *
  * @param Tx_Solr_IndexQueue_Item $item An index queue item
  * @return array An array of Tx_Solr_SolrService connections, the array's keys are the sys_language_uid of the language of the connection
  */
 protected function getSolrConnectionsByItem(Tx_Solr_IndexQueue_Item $item)
 {
     $solrConnections = parent::getSolrConnectionsByItem($item);
     $page = $item->getRecord();
     // may use t3lib_div::hideIfDefaultLanguage($page['l18n_cfg']) with TYPO3 4.6
     if ($page['l18n_cfg'] & 1) {
         // page is configured to hide the default translation -> remove Solr connection for default language
         unset($solrConnections[0]);
     }
     if (t3lib_div::hideIfNotTranslated($page['l18n_cfg'])) {
         $accessibleSolrConnections = array();
         if (isset($solrConnections[0])) {
             $accessibleSolrConnections[0] = $solrConnections[0];
         }
         $translationOverlays = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('pid, sys_language_uid', 'pages_language_overlay', 'pid = ' . $page['uid'] . t3lib_BEfunc::deleteClause('pages_language_overlay') . t3lib_BEfunc::BEenableFields('pages_language_overlay'));
         foreach ($translationOverlays as $overlay) {
             $languageId = $overlay['sys_language_uid'];
             $accessibleSolrConnections[$languageId] = $solrConnections[$languageId];
         }
         $solrConnections = $accessibleSolrConnections;
     }
     return $solrConnections;
 }
 /**
  * Counting content elements for a single language on a page.
  *
  * @param	integer		Page id to select for.
  * @param	integer		Sys language uid
  * @return	integer		Number of content elements from the PID where the language is set to a certain value.
  */
 function getContentElementCount($pageId, $sysLang)
 {
     if ($sysLang == 0) {
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'tt_content', 'pid=' . intval($pageId) . ' AND sys_language_uid=' . intval($sysLang) . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'));
         list($count) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
     }
     return $count ? $count : '-';
 }
コード例 #29
0
 /**
  * Returns all content elements for the given page, where the language is set to $langUid
  *
  * @param int $pageUid
  * @param int $langUid
  * @return mixed
  */
 public function getRemainingPageContentElements($pageUid, $sortedContentElements)
 {
     $sortedContentElements = array_map('intval', $sortedContentElements);
     $contentElements = array();
     if (is_array($sortedContentElements)) {
         $notInWhere = '';
         if (!empty($sortedContentElements) && is_array($sortedContentElements)) {
             $notInWhere = ' AND (uid NOT IN (' . implode(',', $sortedContentElements) . '))';
         }
         $fields = '*';
         $table = 'tt_content';
         $where = '(pid=' . (int) $pageUid . ')' . $notInWhere . t3lib_BEfunc::deleteClause('tt_content');
         $contentElements = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows($fields, $table, $where, '', 'sorting ASC, sys_language_uid ASC, uid ASC', '');
     }
     return $contentElements;
 }
コード例 #30
0
 /**
  * Select records from a table and add them to recList
  *
  * @param	string		Table name (from TCA)
  * @param	integer		PID to select records from
  * @param	array		Array where records are accumulated, passed by reference
  * @return	void
  */
 function subElements_getNonPageRecords($tN, $uid, &$recList)
 {
     global $TCA;
     $records = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', $tN, 'pid=' . intval($uid) . ($TCA[$tN]['ctrl']['versioningWS'] ? ' AND t3ver_state=0' : '') . t3lib_BEfunc::deleteClause($tN), '', $TCA[$tN]['ctrl']['sortby'] ? $TCA[$tN]['ctrl']['sortby'] : $GLOBALS['TYPO3_DB']->stripOrderBy($TCA[$tN]['ctrl']['default_sortby']));
     foreach ($records as $rec) {
         $recList[] = array($tN, $rec);
     }
 }