/**
  * 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'];
             }
         }
     }
 }
 /**
  * issue title
  *
  * @param object $parameters
  * @param object $parentObject
  *
  * @return void
  */
 public function issueTitle(&$parameters, $parentObject)
 {
     $titleLength = $GLOBALS['BE_USER']->uc['titleLen'] ? $GLOBALS['BE_USER']->uc['titleLen'] : 30;
     $record = t3lib_BEfunc::getRecord($parameters['table'], $parameters['row']['uid']);
     $newTitle = $record['extension'] . ': ' . $record['inspection'];
     $parameters['title'] = htmlspecialchars(t3lib_div::fixed_lgd_cs($newTitle, $titleLength));
 }
 /**
  * Get the Records
  *
  * @param integer $startPage
  * @param array $basePages
  * @param Tx_GoogleServices_Controller_SitemapController $obj
  * @return Tx_GoogleServices_Domain_Model_Node
  */
 public function getRecords($startPage, $basePages, Tx_GoogleServices_Controller_SitemapController $obj)
 {
     $nodes = array();
     foreach ($basePages as $uid) {
         // Build URL
         $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build();
         // can't generate a valid url
         if (!strlen($url)) {
             continue;
         }
         // Get Record
         $record = t3lib_BEfunc::getRecord('pages', $uid, "*", " AND tx_googleservicesext_hide_in_sitemap = 0");
         if (!is_array($record)) {
             continue;
         }
         // exclude Doctypes
         if (in_array($record['doktype'], array(4))) {
             continue;
         }
         // Build Node
         $node = new Tx_GoogleServices_Domain_Model_Node();
         $node->setLoc($url);
         $node->setPriority($this->getPriority($startPage, $record));
         $node->setChangefreq(Tx_GoogleServices_Service_SitemapDataService::mapTimeout2Period($record['cache_timeout']));
         $node->setLastmod($this->getModifiedDate($record));
         $nodes[] = $node;
     }
     return $nodes;
 }
 /**
  * Checks the page access rights (Code for access check mostly taken from alt_doc.php)
  * as well as the table access rights of the user.
  *
  * @param	string		$cmd: The command that sould be performed ('new' or 'edit')
  * @param	string		$table: The table to check access for
  * @param	string		$theUid: The record uid of the table
  * @return	boolean		Returns true is the user has access, or false if not
  */
 public static function checkAccess($table, $row)
 {
     // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
     // First, resetting flags.
     $hasAccess = 0;
     $deniedAccessReason = '';
     $calcPRec = $row;
     t3lib_BEfunc::fixVersioningPid($table, $calcPRec);
     if (is_array($calcPRec)) {
         if ($table == 'pages') {
             // If pages:
             $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
             $hasAccess = $CALC_PERMS & 2 ? 1 : 0;
         } else {
             $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages', $calcPRec['pid']));
             // Fetching pid-record first.
             $hasAccess = $CALC_PERMS & 16 ? 1 : 0;
         }
         // Check internals regarding access:
         if ($hasAccess) {
             $hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
         }
     }
     if (!$GLOBALS['BE_USER']->check('tables_modify', $table)) {
         $hasAccess = 0;
     }
     if (!$hasAccess) {
         $deniedAccessReason = $GLOBALS['BE_USER']->errorMsg;
         if ($deniedAccessReason) {
             //fb($deniedAccessReason);
         }
     }
     return $hasAccess ? true : false;
 }
    /**
     * Main function
     *
     * @return	void
     */
    function main()
    {
        switch ((string) t3lib_div::_GET('cmd')) {
            case 'menuitem':
                echo '
				<img src="gfx/x_t3logo.png" width="61" height="16" hspace="3" alt="" />';
                $menuItems = array(array('title' => 'About TYPO3', 'xurl' => 'http://typo3.com/', 'subitems' => array(array('title' => 'License', 'xurl' => 'http://typo3.com/License.1625.0.html'), array('title' => 'Support', 'subitems' => array(array('title' => 'Mailing lists', 'xurl' => 'http://lists.netfielders.de/cgi-bin/mailman/listinfo'), array('title' => 'Documentation', 'xurl' => 'http://typo3.org/documentation/'), array('title' => 'Find consultancy', 'xurl' => 'http://typo3.com/Consultancies.1248.0.html'))), array('title' => 'Contribute', 'xurl' => 'http://typo3.org/community/participate/'), array('title' => 'Donate', 'xurl' => 'http://typo3.com/Donations.1261.0.html', 'icon' => '1'))), array('title' => 'Extensions', 'url' => 'mod/tools/em/index.php'), array('title' => 'Menu preferences and such things', 'onclick' => 'alert("A dialog is now shown which will allow user configuration of items in the menu");event.stopPropagation();', 'state' => 'checked'), array('title' => '--div--'), array('title' => 'Recent Items', 'id' => $this->id . '_recent', 'subitems' => array(), 'html' => $this->menuItemObject($this->id . '_recent', '
							fetched: false,
							onActivate: function() {
//								if (!this.fetched)	{
									//Element.update("' . $this->id . '_recent-layer","asdfasdf");
									getElementContent("' . $this->id . '_recent-layer", 0, "logomenu.php?cmd=recent")
									this.fetched = true;
//								}
							}
						')), array('title' => '--div--'), array('title' => 'View frontend', 'xurl' => t3lib_div::getIndpEnv('TYPO3_SITE_URL')), array('title' => 'Log out', 'onclick' => "top.document.location='logout.php';"));
                echo $this->menuLayer($menuItems);
                break;
            case 'recent':
                $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_log.*, MAX(sys_log.tstamp) AS tstamp_MAX', 'sys_log,pages', 'pages.uid=sys_log.event_pid AND sys_log.userid=' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND sys_log.event_pid>0 AND sys_log.type=1 AND sys_log.action=2 AND sys_log.error=0', 'tablename,recuid', 'tstamp_MAX DESC', 20);
                $items = array();
                while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                    $elRow = t3lib_BEfunc::getRecord($row['tablename'], $row['recuid']);
                    if (is_array($elRow)) {
                        $items[] = array('title' => t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($row['tablename'], $elRow), $GLOBALS['BE_USER']->uc['titleLen']) . ' - ' . t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $row['tstamp_MAX']), 'icon' => array(t3lib_iconworks::getIcon($row['tablename'], $elRow), 'width="18" height="16"'), 'onclick' => 'content.' . t3lib_BEfunc::editOnClick('&edit[' . $row['tablename'] . '][' . $row['recuid'] . ']=edit', '', 'dummy.php'));
                    }
                }
                echo $this->menuItems($items);
                break;
        }
    }
 private function prepareRecordsFrom($table)
 {
     $tableRows = $this->getExportableRowUids($table);
     foreach ($tableRows as $uid => $a) {
         $this->_txImpexpInstance->export_addRecord($table, t3lib_BEfunc::getRecord($table, $uid));
     }
 }
 /**
  * Entry function that hooks into the main typo3/alt_clickmenu.php,
  * see ext_tables.php of this extension for more info
  *
  * @param $backRef		the clickMenu object
  * @param $menuItems	the menuItems as an array that are already filled from the main clickmenu 
  * @param $table	the table that is worked on (tx_dam_cat only)
  * @param $uid		the item UID that is worked on
  * @return unknown
  */
 function main(&$backRef, $menuItems, $table, $uid)
 {
     if ($table != 'tx_dam_cat') {
         return $menuItems;
     }
     $this->backRef =& $backRef;
     // Get record
     $this->rec = t3lib_BEfunc::getRecordWSOL($table, $uid);
     $menuItems = array();
     $root = !strcmp($uid, '0') ? true : false;
     if (is_array($this->rec) || $root) {
         $lCP = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages', $root ? tx_dam_db::getPid() : $this->rec['pid']));
         // Edit
         if (!$root && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') && !in_array('edit', $this->backRef->disabledItems)) {
             $menuItems['edit'] = $this->DAMcatEdit($table, $uid);
         }
         // New Category
         if (!in_array('new', $this->backRef->disabledItems) && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'new')) {
             $menuItems['new'] = $this->DAMnewSubCat($table, $uid);
         }
         // Info
         if (!in_array('info', $this->backRef->disabledItems) && !$root) {
             $menuItems['info'] = $this->DAMcatInfo($table, $uid);
         }
         // Delete
         $elInfo = array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $this->rec), $GLOBALS['BE_USER']->uc['titleLen']));
         if (!in_array('delete', $this->backRef->disabledItems) && !$root && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'delete')) {
             $menuItems['spacer2'] = 'spacer';
             $menuItems['delete'] = $this->DAMcatDelete($table, $uid, $elInfo);
         }
     }
     return $menuItems;
 }
 /**
  * Main function
  *
  * @param clickMenu reference parent object
  * @param array menutitems for manipultation
  * @param string table name
  * @param int uid
  * @return array manipulated menuitems
  */
 function main(clickMenu $backRef, array $menuItems, $table, $uid)
 {
     if ($table != 'tx_crawler_configuration') {
         // early return without doing anything
         return $menuItems;
     }
     $localItems = array();
     $row = t3lib_BEfunc::getRecord($table, $uid, 'pid, name, processing_instruction_filter', '', true);
     if (!empty($row)) {
         if (version_compare(TYPO3_version, '4.5.0', '>=')) {
             $url = t3lib_extMgm::extRelPath('info') . 'mod1/index.php';
         } else {
             $url = $backRef->backPath . 'mod/web/info/index.php';
         }
         $url .= '?id=' . intval($row['pid']);
         $url .= '&SET[function]=tx_crawler_modfunc1';
         $url .= '&SET[crawlaction]=start';
         $url .= '&configurationSelection[]=' . $row['name'];
         foreach (t3lib_div::trimExplode(',', $row['processing_instruction_filter']) as $processing_instruction) {
             $url .= '&procInstructions[]=' . $processing_instruction;
         }
         // $onClick = $backRef->urlRefForCM($url);
         $onClick = "top.nextLoadModuleUrl='" . $url . "';top.goToModule('web_info',1);";
         $localItems[] = $backRef->linkItem('Crawl', $backRef->excludeIcon('<img src="' . $backRef->backPath . t3lib_extMgm::extRelPath('crawler') . 'icon_tx_crawler_configuration.gif" border="0" align="top" alt="" />'), $onClick, 0);
     }
     return array_merge($menuItems, $localItems);
 }
 /**
  * Returns array of system languages
  * @param	integer		page id (only used to get TSconfig configuration setting flag and label for default language)
  * @param	string		Backpath for flags
  * @return	array
  */
 function getSystemLanguages($page_id = 0, $backPath = '')
 {
     global $TCA, $LANG;
     // Icons and language titles:
     t3lib_div::loadTCA('sys_language');
     $flagAbsPath = t3lib_div::getFileAbsFileName($TCA['sys_language']['columns']['flag']['config']['fileFolder']);
     $flagIconPath = $backPath . '../' . substr($flagAbsPath, strlen(PATH_site));
     $modSharedTSconfig = t3lib_BEfunc::getModTSconfig($page_id, 'mod.SHARED');
     $languageIconTitles = array();
     // Set default:
     $languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $LANG->getLL('defaultLanguage') . ')' : $LANG->getLL('defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) && @is_file($flagAbsPath . $modSharedTSconfig['properties']['defaultLanguageFlag']) ? $flagIconPath . $modSharedTSconfig['properties']['defaultLanguageFlag'] : null);
     // Set "All" language:
     $languageIconTitles[-1] = array('uid' => -1, 'title' => $LANG->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => $flagIconPath . 'multi-language.gif');
     // Find all system languages:
     $sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', '');
     foreach ($sys_languages as $row) {
         $languageIconTitles[$row['uid']] = $row;
         if ($row['static_lang_isocode'] && t3lib_extMgm::isLoaded('static_info_tables')) {
             $staticLangRow = t3lib_BEfunc::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
             if ($staticLangRow['lg_iso_2']) {
                 $languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
             }
         }
         if (strlen($row['flag'])) {
             $languageIconTitles[$row['uid']]['flagIcon'] = @is_file($flagAbsPath . $row['flag']) ? $flagIconPath . $row['flag'] : '';
         }
     }
     return $languageIconTitles;
 }
 /**
  * Obtains site URL.
  *
  * @static
  * @param int $pageId
  * @return string
  */
 protected static function getSiteUrl($pageId)
 {
     $domain = t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($pageId));
     $pageRecord = t3lib_BEfunc::getRecord('pages', $pageId);
     $scheme = is_array($pageRecord) && isset($pageRecord['url_scheme']) && $pageRecord['url_scheme'] == t3lib_utility_Http::SCHEME_HTTPS ? 'https' : 'http';
     return $domain ? $scheme . '://' . $domain . '/' : t3lib_div::getIndpEnv('TYPO3_SITE_URL');
 }
 /**
  * Draws the RTE
  *
  * @param	object	Reference to parent object, which is an instance of the TCEforms.
  * @param	string		The table name
  * @param	string		The field name
  * @param	array		The current row from which field is being rendered
  * @param	array		Array of standard content for rendering form fields from TCEforms. See TCEforms for details on this. Includes for instance the value and the form field name, java script actions and more.
  * @param	array		"special" configuration - what is found at position 4 in the types configuration of a field from record, parsed into an array.
  * @param	array		Configuration for RTEs; A mix between TSconfig and otherwise. Contains configuration for display, which buttons are enabled, additional transformation information etc.
  * @param	string		Record "type" field value.
  * @param	string		Relative path for images/links in RTE; this is used when the RTE edits content from static files where the path of such media has to be transformed forth and back!
  * @param	integer	PID value of record (true parent page id)
  * @return	string		HTML code for RTE!
  */
 function drawRTE($parentObject, $table, $field, $row, $PA, $specConf, $thisConfig, $RTEtypeVal, $RTErelPath, $thePidValue)
 {
     $code = '';
     $parentObject->RTEcounter = rand();
     // get the language code of the Content Element
     $row['ISOcode'] = $parentObject->getAvailableLanguages();
     $row['ISOcode'] = strtolower($row['ISOcode'][$row['sys_language_uid']]['ISOcode']);
     $this->currentPage = $row['pid'];
     if ($this->currentPage < 0) {
         $pidRow = t3lib_BEfunc::getRecord($table, abs($this->currentPage), 'pid');
         $this->currentPage = $pidRow['pid'];
     }
     $config = $this->init($thisConfig, $parentObject->RTEcounter, $PA);
     $configOrder = $this->getConfigOrder($table, $row, $PA);
     $config = $this->mergeLocationConfig($config, $configOrder, $PA);
     if ($row['ISOcode'] == 'def') {
         $row['ISOcode'] = $config['defaultLanguageFE'];
     }
     $row['ISOcode'] = $row['ISOcode'] == 'en' ? 'default' : $row['ISOcode'];
     $config = $this->fixTinyMCETemplates($config, $row);
     $code .= $this->getFileDialogJS($config, $this->getPath('EXT:tinymce_rte/./'), $parentObject, $table, $field, $row);
     //add callback javascript file
     if ($config['callbackJavascriptFile'] != '') {
         $config['callbackJavascriptFile'] = $this->getPath($config['callbackJavascriptFile']);
         $code .= '<script type="text/javascript" src="' . $config['callbackJavascriptFile'] . '"></script>';
     }
     //loads the current Value and create the textarea
     $value = $this->transformContent('rte', $PA['itemFormElValue'], $table, $field, $row, $specConf, $thisConfig, $RTErelPath, $thePidValue);
     $code .= $this->getTextarea($parentObject, $PA, $value, $config);
     return $code;
 }
 /**
  * Building tcemain CMD-array for swapping all versions in a workspace.
  *
  * @param	integer		Real workspace ID, cannot be ONLINE (zero).
  * @param	boolean		If set, then the currently online versions are swapped into the workspace in exchange for the offline versions. Otherwise the workspace is emptied.
  * @param	[type]		$pageId: ...
  * @return	array		Command array for tcemain
  */
 function getCmdArrayForPublishWS($wsid, $doSwap, $pageId = 0)
 {
     $wsid = intval($wsid);
     $cmd = array();
     if ($wsid >= -1 && $wsid !== 0) {
         // Define stage to select:
         $stage = -99;
         if ($wsid > 0) {
             $workspaceRec = t3lib_BEfunc::getRecord('sys_workspace', $wsid);
             if ($workspaceRec['publish_access'] & 1) {
                 $stage = 10;
             }
         }
         // Select all versions to swap:
         $versions = $this->selectVersionsInWorkspace($wsid, 0, $stage, $pageId ? $pageId : -1);
         // Traverse the selection to build CMD array:
         foreach ($versions as $table => $records) {
             foreach ($records as $rec) {
                 // Build the cmd Array:
                 $cmd[$table][$rec['t3ver_oid']]['version'] = array('action' => 'swap', 'swapWith' => $rec['uid'], 'swapIntoWS' => $doSwap ? 1 : 0);
             }
         }
     }
     return $cmd;
 }
 /**
  * Negative PID values is pointing to a page on the same level as the current.
  *
  * @param	int		$pid: The pid of the record
  * @return	The		real pid of a (new) record
  */
 function getStorageFolderPid($pid)
 {
     if ($pid < 0) {
         $pidRow = t3lib_BEfunc::getRecord('tt_content', abs($pid), 'pid');
         $pid = $pidRow['pid'];
     }
     return $pid;
 }
Exemple #14
0
 /**
  * Constructor.
  *
  * @param integer $rootPageId Site root page ID (uid). The page must be marked as site root ("Use as Root Page" flag).
  */
 public function __construct($rootPageId)
 {
     $page = t3lib_BEfunc::getRecord('pages', $rootPageId);
     if (!$page['is_siteroot']) {
         throw new InvalidArgumentException('The page for the given page ID \'' . $rootPageId . '\' is not marked as root page and can therefore not be used as site root page.', 1309272922);
     }
     $this->rootPage = $page;
 }
 /**
  * Render the sprite icon
  *
  * @param string $table table name
  * @param integer $uid uid of record
  * @param string $title title
  * @return string sprite icon
  */
 public function render($table, $uid, $title)
 {
     $icon = '';
     $row = t3lib_BEfunc::getRecord($table, $uid);
     if (is_array($row)) {
         $icon = t3lib_iconWorks::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($title)));
     }
     return $icon;
 }
 /**
  * Generates a document id for documents representing page records.
  *
  * @param	integer	$uid The page's uid
  * @param	integer $typeNum The page's typeNum
  * @param	integer	$language the language id, defaults to 0
  * @param	string	$accessGroups comma separated list of uids of groups that have access to that page
  * @param	string 	$cHash cHash of the page
  * @return	string	the document id for that page
  */
 public static function getPageDocumentId($uid, $typeNum = 0, $language = 0, $accessGroups = '0,-1', $cHash = '')
 {
     $partialPageRecord = t3lib_BEfunc::getRecord('pages', $uid, 'pid');
     $documentId = self::getSiteHash($uid) . '/pages/' . $partialPageRecord['pid'] . '/' . $uid . '/' . $typeNum . '/' . $language . '/' . $accessGroups;
     if (!empty($cHash)) {
         $documentId .= '/' . $cHash;
     }
     return $documentId;
 }
 function main(&$backRef, $menuItems, $table, $uid)
 {
     global $BE_USER, $TCA, $LANG, $TYPO3_CONF_VARS;
     // Returns directly, because the clicked item was rendered by t3lib_TCEforms::getClickMenu()
     if ($backRef->iParts[3] == '+copy,info,edit,view') {
         return $menuItems;
     }
     // Returns directly, because the clicked item was not from the DAM table
     if ($table != 'tx_dam') {
         return $menuItems;
     }
     $this->backRef =& $backRef;
     $item = $backRef->rec;
     // just clear the whole menu
     $menuItems = array();
     if (is_array($backRef->rec)) {
         if ($backRef->cmLevel == 0) {
             t3lib_div::loadTCA($table);
             $calcPerms = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages', $table === 'pages' ? $backRef->rec['uid'] : $backRef->rec['pid']));
             $permsEdit = $calcPerms & 16;
             $permsDelete = $calcPerms & 16;
             $item['__type'] = 'record';
             $item['__table'] = $table;
             $actionCall = t3lib_div::makeInstance('tx_dam_actionCall');
             if (is_array($backRef->disabledItems)) {
                 foreach ($backRef->disabledItems as $idName) {
                     $actionCall->removeAction($idName);
                 }
             }
             $actionCall->setRequest('context', $item);
             $actionCall->setEnv('returnUrl', t3lib_div::_GP('returnUrl'));
             $actionCall->setEnv('backPath', $backRef->PH_backPath);
             $actionCall->setEnv('defaultCmdScript', PATH_txdam_rel . 'mod_cmd/index.php');
             $actionCall->setEnv('defaultEditScript', PATH_txdam_rel . 'mod_edit/index.php');
             $actionCall->setEnv('calcPerms', $calcPerms);
             $actionCall->setEnv('permsEdit', $permsEdit);
             $actionCall->setEnv('permsDelete', $permsDelete);
             $actionCall->setEnv('cmLevel', $backRef->cmLevel);
             $actionCall->initActions(true);
             $actions = $actionCall->renderActionsContextMenu(true);
             foreach ($actions as $id => $action) {
                 if ($action['isDivider']) {
                     $menuItems[$id] = 'spacer';
                 } else {
                     $onclick = $action['onclick'] ? $action['onclick'] : $this->createOnClick($action['url'], $action['dontHide']);
                     $menuItems[$id] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($action['label']), $backRef->excludeIcon($action['icon']), $onclick, $action['onlyCM'], $action['dontHide']);
                 }
             }
         } else {
         }
     }
     return $menuItems;
 }
 function main()
 {
     global $BE_USER, $BACK_PATH, $LANG;
     $params = t3lib_div::_GP('P');
     t3lib_div::loadTCA($params['table']);
     $params['wConf'] = $GLOBALS['TCA'][$params['table']]['columns'][$params['field']]['config']['wizards']['googlemap'];
     $params['row'] = t3lib_BEfunc::getRecord($params['table'], $params['uid']);
     $this->content = '';
     $wiz = $this->renderWizard($params);
     $this->content .= $this->doc->startPage($LANG->getLL('mlang_tabs_tab'));
     $this->content .= $wiz;
 }
 function processDatamap_postProcessFieldArray($status, $table, $id, &$fieldArray, &$reference)
 {
     if ($status == 'update' && $table == 'tx_podcast_domain_model_episode') {
         $row = t3lib_BEfunc::getRecord($table, $id);
         // reset data, will be set anew when frontend is called
         if (is_array($row)) {
             $fieldArray['mime'] = '';
             $fieldArray['duration'] = '0';
             $fieldArray['altfiles'] = '';
         }
     }
 }
 /**
  * Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader
  *
  * @param array     $rows   Array with table as key and array with all deleted rows
  * @param integer	$totalDeleted: Number of deleted records in total, for PagingToolbar
  * @return string   JSON Array
  **/
 public function transform($deletedRowsArray, $totalDeleted)
 {
     $total = 0;
     $jsonArray = array('rows' => array());
     // iterate
     if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) {
         foreach ($deletedRowsArray as $table => $rows) {
             $total += count($deletedRowsArray[$table]);
             foreach ($rows as $row) {
                 $backendUser = t3lib_BEfunc::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
                 $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'table' => $table, 'crdate' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => $backendUser['username'], 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => tx_recycler_helper::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => tx_recycler_helper::getUtf8String(t3lib_BEfunc::getRecordTitle($table, $row)), 'path' => tx_recycler_helper::getRecordPath($row['pid']));
             }
         }
     }
     $jsonArray['total'] = $totalDeleted;
     return json_encode($jsonArray);
 }
 function main(&$backRef, $menuItems, $tableID, $srcId)
 {
     $this->includeLocalLang();
     $this->backRef =& $backRef;
     /**
      * TODO
      *
      * FIXME
      * backpath will not work in global installations
      */
     if (($tableID == 'dragDrop_tt_news_cat' || $tableID == 'tt_news_cat_CM') && $srcId) {
         $table = 'tt_news_cat';
         $rec = t3lib_BEfunc::getRecordWSOL($table, $srcId);
         // fetch page record to get editing permissions
         $lCP = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages', $rec['pid']));
         $doEdit = $lCP & 16;
         //print_r( array($lCP));
         if ($doEdit && $tableID == 'dragDrop_tt_news_cat') {
             $this->backRef->backPath = '../../../';
             $dstId = intval(t3lib_div::_GP('dstId'));
             $menuItems['moveinto'] = $this->dragDrop_moveCategory($srcId, $dstId);
             $menuItems['copyinto'] = $this->dragDrop_copyCategory($srcId, $dstId);
         }
         if ($tableID == 'tt_news_cat_CM') {
             $this->backRef->backPath = '../../../../typo3/';
             $menuItems = array();
             if ($doEdit) {
                 $menuItems['edit'] = $this->DB_edit($table, $srcId);
                 $menuItems['new'] = $this->DB_new($table, $rec);
                 $menuItems['newsub'] = $this->DB_new($table, $rec, true);
             }
             $menuItems['info'] = $backRef->DB_info($table, $srcId);
             if ($doEdit) {
                 $menuItems['hide'] = $this->DB_hideUnhide($table, $rec, 'hidden');
                 $elInfo = array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle('tt_news_cat', $rec), $GLOBALS['BE_USER']->uc['titleLen']));
                 $menuItems['spacer2'] = 'spacer';
                 $menuItems['delete'] = $this->DB_delete($table, $srcId, $elInfo);
             }
         }
     }
     return $menuItems;
 }
 /**
  * Determine if record of table 'pages' with the given $pid is currently created in TCEforms.
  * This information is required for conditions in BE for PIDupinRootline.
  *
  * @param	integer		$pid: The pid the check for as parent page
  * @return	boolean		true if the is currently a new page record being edited with $pid as uid of the parent page
  */
 protected function isNewPageWithPageId($pageId)
 {
     if (isset($GLOBALS['SOBE']) && $GLOBALS['SOBE'] instanceof SC_alt_doc) {
         $pageId = intval($pageId);
         $elementsData = $GLOBALS['SOBE']->elementsData;
         $data = $GLOBALS['SOBE']->data;
         // If saving a new page record:
         if (is_array($data) && isset($data['pages']) && is_array($data['pages'])) {
             foreach ($data['pages'] as $uid => $fields) {
                 if (strpos($uid, 'NEW') === 0 && $fields['pid'] == $pageId) {
                     return TRUE;
                 }
             }
         }
         // If editing a new page record (not saved yet):
         if (is_array($elementsData)) {
             foreach ($elementsData as $element) {
                 if ($element['cmd'] == 'new' && $element['table'] == 'pages') {
                     if ($element['pid'] < 0) {
                         $pageRecord = t3lib_BEfunc::getRecord('pages', abs($element['pid']), 'pid');
                         $element['pid'] = $pageRecord['pid'];
                     }
                     if ($element['pid'] == $pageId) {
                         return TRUE;
                     }
                 }
             }
         }
     }
     return FALSE;
 }
 /**
  * Call back function for page tree traversal!
  *
  * @param   string    Table name
  * @param   integer   UID of record in processing
  * @param   integer   Echo level  (see calling function
  * @param   string    Version swap mode on that level (see calling function
  * @param   integer   Is root version (see calling function
  * @return  void
  */
 function main_parseTreeCallBack($tableName, $uid, $echoLevel, $versionSwapmode, $rootIsVersion)
 {
     global $TCA;
     if ($tableName == 'pages' && $uid > 0) {
         $pageId = $uid;
         $flexFormDiff = array();
         $sysLang = 1;
         $excludeIndex = array();
         if (!$versionSwapmode) {
             // Init:
             $t8Tools = t3lib_div::makeInstance('tx_l10nmgr_tools');
             $t8Tools->verbose = FALSE;
             // Otherwise it will show records which has fields but none editable.
             $t8Tools->bypassFilter = $this->cli_isArg('--bypassFilter') ? TRUE : FALSE;
             $pageRecord = t3lib_BEfunc::getRecord('pages', $uid);
             if (!in_array($pageRecord['doktype'], $this->disallowDoktypes) && !isset($excludeIndex['pages:' . $pageId])) {
                 $accum['header']['title'] = $pageRecord['title'];
                 $accum['items'] = $t8Tools->indexDetailsPage($pageId);
                 $this->resultArray['index'][$uid] = $accum;
             }
         } else {
             if ($echoLevel > 2) {
                 echo chr(10) . '[tx_templavoila_unusedce:] Did not check page - was on offline page.';
             }
         }
     }
 }
    /**
     * Prints the selector box form-field for the db/file/select elements (multiple)
     *
     * @param	string		Form element name
     * @param	string		Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type). Seperated with '|' a user defined mode can be set to be passed as param to the EB.
     * @param	string		Commalist of "allowed"
     * @param	array		The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs.
     * @param	string		Alternative selector box.
     * @param	array		An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails"
     * @param	string		On focus attribute string
     * @param	string		$user_el_param Additional parameter for the EB
     * @return	string		The form fields for the selection.
     */
    function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $userEBParam = '')
    {
        list($mode, $modeEB) = explode('|', $mode);
        $modeEB = $modeEB ? $modeEB : $mode;
        $disabled = '';
        if ($this->tceforms->renderReadonly || $params['readOnly']) {
            $disabled = ' disabled="disabled"';
        }
        // Sets a flag which means some JavaScript is included on the page to support this element.
        $this->tceforms->printNeededJS['dbFileIcons'] = 1;
        // INIT
        $uidList = array();
        $opt = array();
        $itemArrayC = 0;
        // Creating <option> elements:
        if (is_array($itemArray)) {
            $itemArrayC = count($itemArray);
            reset($itemArray);
            switch ($mode) {
                case 'db':
                    while (list(, $pp) = each($itemArray)) {
                        if ($pp['title']) {
                            $pTitle = $pp['title'];
                        } else {
                            if (function_exists('t3lib_BEfunc::getRecordWSOL')) {
                                $pRec = t3lib_BEfunc::getRecordWSOL($pp['table'], $pp['id']);
                            } else {
                                $pRec = t3lib_BEfunc::getRecord($pp['table'], $pp['id']);
                            }
                            $pTitle = is_array($pRec) ? $pRec[$GLOBALS['TCA'][$pp['table']]['ctrl']['label']] : NULL;
                        }
                        if ($pTitle) {
                            $pTitle = $pTitle ? t3lib_div::fixed_lgd_cs($pTitle, $this->tceforms->titleLen) : t3lib_BEfunc::getNoRecordTitle();
                            $pUid = $pp['table'] . '_' . $pp['id'];
                            $uidList[] = $pUid;
                            $opt[] = '<option value="' . htmlspecialchars($pUid) . '">' . htmlspecialchars($pTitle) . '</option>';
                        }
                    }
                    break;
                case 'folder':
                case 'file':
                    while (list(, $pp) = each($itemArray)) {
                        $pParts = explode('|', $pp);
                        $uidList[] = $pUid = $pTitle = $pParts[0];
                        $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pParts[0])) . '">' . htmlspecialchars(rawurldecode($pParts[0])) . '</option>';
                    }
                    break;
                default:
                    while (list(, $pp) = each($itemArray)) {
                        $pParts = explode('|', $pp, 2);
                        $uidList[] = $pUid = $pParts[0];
                        $pTitle = $pParts[1] ? $pParts[1] : $pParts[0];
                        $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pUid)) . '">' . htmlspecialchars(rawurldecode($pTitle)) . '</option>';
                    }
                    break;
            }
        }
        // Create selector box of the options
        $sSize = $params['autoSizeMax'] ? t3lib_div::intInRange($itemArrayC + 1, t3lib_div::intInRange($params['size'], 1), $params['autoSizeMax']) : $params['size'];
        if (!$selector) {
            $selector = '<select size="' . $sSize . '"' . $this->tceforms->insertDefStyle('group') . ' multiple="multiple" name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt) . '</select>';
        }
        $icons = array('L' => array(), 'R' => array());
        if (!$params['readOnly']) {
            if (!$params['noBrowser']) {
                $aOnClick = 'setFormValueOpenBrowser(\'' . $modeEB . '\',\'' . ($fName . '|||' . $allowed . '|' . $userEBParam . '|') . '\'); return false;';
                $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert3.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_browse_' . ($mode === 'file' ? 'file' : 'db'))) . ' />' . '</a>';
            }
            if (!$params['dontShowMoveIcons']) {
                if ($sSize >= 5) {
                    $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Top\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_totop.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_top')) . ' />' . '</a>';
                }
                $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Up\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/up.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_up')) . ' />' . '</a>';
                $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Down\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/down.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_down')) . ' />' . '</a>';
                if ($sSize >= 5) {
                    $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Bottom\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_tobottom.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_bottom')) . ' />' . '</a>';
                }
            }
            // todo Clipboard
            $clipElements = $this->tceforms->getClipboardElements($allowed, $mode);
            if (count($clipElements)) {
                $aOnClick = '';
                #			$counter = 0;
                foreach ($clipElements as $elValue) {
                    if ($mode === 'file' or $mode === 'folder') {
                        $itemTitle = 'unescape(\'' . rawurlencode(tx_dam::file_basename($elValue)) . '\')';
                    } else {
                        // 'db' mode assumed
                        list($itemTable, $itemUid) = explode('|', $elValue);
                        if (function_exists('t3lib_BEfunc::getRecordWSOL')) {
                            $rec = t3lib_BEfunc::getRecordWSOL($itemTable, $itemUid);
                        } else {
                            $rec = t3lib_BEfunc::getRecord($itemTable, $itemUid);
                        }
                        $itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, $rec));
                        $elValue = $itemTable . '_' . $itemUid;
                    }
                    $aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',\'' . t3lib_div::slashJS(t3lib_div::rawUrlEncodeJS($elValue)) . '\',' . t3lib_div::slashJS($itemTitle) . ');';
                    #$aOnClick .= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20', ' ', $elValue)).'\'),'.$itemTitle.');';
                    #				$counter++;
                    #				if ($params['maxitems'] && $counter >= $params['maxitems'])	{	break;	}	// Makes sure that no more than the max items are inserted... for convenience.
                }
                $aOnClick .= 'return false;';
                $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert5.png', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib(sprintf($this->tceforms->getLL('l_clipInsert_' . ($mode === 'file' ? 'file' : 'db')), count($clipElements))) . ' />' . '</a>';
            }
            $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_clear.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_remove_selected')) . ' />' . '</a>';
        }
        $str = '<table border="0" cellpadding="0" cellspacing="0" width="1">
			' . ($params['headers'] ? '
				<tr>
					<td>' . $this->tceforms->wrapLabels($params['headers']['selector']) . '</td>
					<td></td>
					<td></td>
					<td></td>
					<td>' . ($params['thumbnails'] ? $this->tceforms->wrapLabels($params['headers']['items']) : '') . '</td>
				</tr>' : '') . '
			<tr>
				<td valign="top">' . $selector . '<br />' . $this->tceforms->wrapLabels($params['info']) . '</td>
				<td valign="top">' . implode('<br />', $icons['L']) . '</td>
				<td valign="top">' . implode('<br />', $icons['R']) . '</td>
				<td style="height:5px;"><span></span></td>
				<td valign="top">' . $this->tceforms->wrapLabels($params['thumbnails']) . '</td>
			</tr>
		</table>';
        // Creating the hidden field which contains the actual value as a comma list.
        $str .= '<input type="hidden" name="' . $fName . '" value="' . htmlspecialchars(implode(',', $uidList)) . '" />';
        return $str;
    }
    /**
     * Main function, creating content in the frame
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $TCA;
        // By default, 5 groups are set
        $this->groupLabels = array(1 => 1, 2 => 1, 3 => 1, 4 => 1, 5 => 1);
        $shortCutGroups = $BE_USER->getTSConfig('options.shortcutGroups');
        if (is_array($shortCutGroups['properties']) && count($shortCutGroups['properties'])) {
            foreach ($shortCutGroups['properties'] as $k => $v) {
                if (strcmp('', $v) && strcmp('0', $v)) {
                    $this->groupLabels[$k] = (string) $v;
                } elseif ($BE_USER->isAdmin()) {
                    unset($this->groupLabels[$k]);
                }
            }
        }
        // List of global groups that will be loaded. All global groups have negative IDs.
        $globalGroups = -100;
        // Group -100 is kind of superglobal and can't be changed.
        if (count($this->groupLabels)) {
            $globalGroups .= ',' . implode(',', array_keys($this->groupLabels));
            $globalGroups = str_replace(',', ',-', $globalGroups);
            // Ugly hack to make the UIDs negative - is there any better solution?
        }
        // Fetching shortcuts to display for this user:
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_be_shortcuts', '((userid=' . $BE_USER->user['uid'] . ' AND sc_group>=0) OR sc_group IN (' . $globalGroups . '))', '', 'sc_group,sorting');
        // Init vars:
        $this->lines = array();
        $this->linesPre = array();
        $this->editSC_rec = '';
        $this->selOpt = array();
        $formerGr = '';
        // Traverse shortcuts
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $mParts = explode('|', $row['module_name']);
            $row['module_name'] = $mParts[0];
            $row['M_module_name'] = $mParts[1];
            $mParts = explode('_', $row['M_module_name'] ? $row['M_module_name'] : $row['module_name']);
            $qParts = parse_url($row['url']);
            if (!$BE_USER->isAdmin()) {
                // Check for module access
                if (!isset($LANG->moduleLabels['tabs_images'][implode('_', $mParts) . '_tab'])) {
                    // Nice hack to check if the user has access to this module - otherwise the translation label would not have been loaded :-)
                    continue;
                }
                $page_id = $this->getLinkedPageId($row['url']);
                if (t3lib_div::testInt($page_id)) {
                    // Check for webmount access
                    if (!$GLOBALS['BE_USER']->isInWebMount($page_id)) {
                        continue;
                    }
                    // Check for record access
                    $pageRow = t3lib_BEfunc::getRecord('pages', $page_id);
                    if (!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
                        continue;
                    }
                }
            }
            if ($this->editSC && $row['uid'] == $this->editSC) {
                $this->editSC_rec = $row;
            }
            $sc_group = $row['sc_group'];
            if ($sc_group && strcmp($formerGr, $sc_group)) {
                if ($sc_group != -100) {
                    if ($this->groupLabels[abs($sc_group)] && strcmp('1', $this->groupLabels[abs($sc_group)])) {
                        $label = $this->groupLabels[abs($sc_group)];
                    } else {
                        $label = $LANG->getLL('shortcut_group_' . abs($sc_group), 1);
                        if (!$label) {
                            $label = $LANG->getLL('shortcut_group', 1) . ' ' . abs($sc_group);
                        }
                        // Fallback label
                    }
                    if ($sc_group >= 0) {
                        $onC = 'if (confirm(' . $GLOBALS['LANG']->JScharCode($LANG->getLL('shortcut_delAllInCat')) . ')){window.location.href=\'alt_shortcut.php?deleteCategory=' . $sc_group . '\';}return false;';
                        $this->linesPre[] = '<td>&nbsp;</td><td class="bgColor5"><a href="#" onclick="' . htmlspecialchars($onC) . '" title="' . $LANG->getLL('shortcut_delAllInCat', 1) . '">' . $label . '</a></td>';
                    } else {
                        $label = $LANG->getLL('shortcut_global', 1) . ': ' . ($label ? $label : abs($sc_group));
                        // Fallback label
                        $this->lines[] = '<td>&nbsp;</td><td class="bgColor5">' . $label . '</td>';
                    }
                    unset($label);
                }
            }
            $bgColorClass = $row['uid'] == $this->editSC ? 'bgColor5' : ($row['sc_group'] < 0 ? 'bgColor6' : 'bgColor4');
            if ($row['description'] && $row['uid'] != $this->editSC) {
                $label = $row['description'];
            } else {
                $label = t3lib_div::fixed_lgd_cs(rawurldecode($qParts['query']), 150);
            }
            $titleA = $this->itemLabel($label, $row['module_name'], $row['M_module_name']);
            $editSH = $row['sc_group'] >= 0 || $BE_USER->isAdmin() ? 'editSh(' . intval($row['uid']) . ');' : "alert('" . $LANG->getLL('shortcut_onlyAdmin') . "')";
            $jumpSC = 'jump(unescape(\'' . rawurlencode($row['url']) . '\'),\'' . implode('_', $mParts) . '\',\'' . $mParts[0] . '\');';
            $onC = 'if (document.shForm.editShortcut_check && document.shForm.editShortcut_check.checked){' . $editSH . '}else{' . $jumpSC . '}return false;';
            if ($sc_group >= 0) {
                // user defined groups show up first
                $this->linesPre[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>';
            } else {
                $this->lines[] = '<td class="' . $bgColorClass . '"><a href="#" onclick="' . htmlspecialchars($onC) . '"><img src="' . $this->getIcon($row['module_name']) . '" title="' . htmlspecialchars($titleA) . '" alt="" /></a></td>';
            }
            if (trim($row['description'])) {
                $kkey = strtolower(substr($row['description'], 0, 20)) . '_' . $row['uid'];
                $this->selOpt[$kkey] = '<option value="' . htmlspecialchars($jumpSC) . '">' . htmlspecialchars(t3lib_div::fixed_lgd_cs($row['description'], 50)) . '</option>';
            }
            $formerGr = $row['sc_group'];
        }
        ksort($this->selOpt);
        array_unshift($this->selOpt, '<option>[' . $LANG->getLL('shortcut_selSC', 1) . ']</option>');
        $this->editLoadedFunc();
        $this->editPageIdFunc();
        if (!$this->editLoaded && t3lib_extMgm::isLoaded('cms')) {
            $editIdCode = '<td nowrap="nowrap">' . $LANG->getLL('shortcut_editID', 1) . ': <input type="text" value="' . ($this->editError ? htmlspecialchars($this->editPage) : '') . '" name="editPage"' . $this->doc->formWidth(15) . ' onchange="submitEditPage(this.value);" />' . ($this->editError ? '&nbsp;<strong><span class="typo3-red">' . htmlspecialchars($this->editError) . '</span></strong>' : '') . (is_array($this->theEditRec) ? '&nbsp;<strong>' . $LANG->getLL('shortcut_loadEdit', 1) . ' \'' . t3lib_BEfunc::getRecordTitle('pages', $this->theEditRec, TRUE) . '\'</strong> (' . htmlspecialchars($this->editPath) . ')' : '') . ($this->searchFor ? '&nbsp;' . $LANG->getLL('shortcut_searchFor', 1) . ' <strong>\'' . htmlspecialchars($this->searchFor) . '\'</strong>' : '') . '</td>';
        } else {
            $editIdCode = '';
        }
        // Adding CSH:
        $editIdCode .= '<td>&nbsp;' . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'shortcuts', $GLOBALS['BACK_PATH'], '', TRUE) . '</td>';
        // Compile it all:
        $this->content .= '

			<table border="0" cellpadding="0" cellspacing="0" width="99%">
				<tr>
					<td>
						<!--
							Shortcut Display Table:
						-->
						<table border="0" cellpadding="0" cellspacing="2" id="typo3-shortcuts">
							<tr>
							';
        if ($GLOBALS['BE_USER']->getTSConfigVal('options.enableShortcuts')) {
            $this->content .= implode('
								', $this->lines);
        }
        $this->content .= $editIdCode . '
							</tr>
						</table>
					</td>
					<td align="right">';
        if ($this->hasWorkspaceAccess()) {
            $this->content .= $this->workspaceSelector() . t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'workspaceSelector', $GLOBALS['BACK_PATH'], '', TRUE);
        }
        $this->content .= '
					</td>
				</tr>
			</table>
			';
        // Launch Edit page:
        if ($this->theEditRec['uid']) {
            $this->content .= $this->doc->wrapScriptTags('top.loadEditId(' . $this->theEditRec['uid'] . ');');
        }
        // Load alternative table/uid into editing form.
        if (count($this->alternativeTableUid) == 2 && isset($TCA[$this->alternativeTableUid[0]]) && t3lib_div::testInt($this->alternativeTableUid[1])) {
            $JSaction = t3lib_BEfunc::editOnClick('&edit[' . $this->alternativeTableUid[0] . '][' . $this->alternativeTableUid[1] . ']=edit', '', 'dummy.php');
            $this->content .= $this->doc->wrapScriptTags('function editArbitraryElement() { top.content.' . $JSaction . '; } editArbitraryElement();');
        }
        // Load search for something.
        if ($this->searchFor) {
            $firstMP = intval($GLOBALS['WEBMOUNTS'][0]);
            $this->content .= $this->doc->wrapScriptTags('jump(unescape("' . rawurlencode('db_list.php?id=' . $firstMP . '&search_field=' . rawurlencode($this->searchFor) . '&search_levels=4') . '"),"web_list","web");');
        }
    }
 /**
  * Write the sorting values to a foreign_table, that has a foreign_field (uid of the parent record)
  *
  * @param	array		$conf: TCA configuration for current field
  * @param	integer		$parentUid: The uid of the parent record
  * @param	boolean		$updateToUid: Whether to update the foreign field with the $parentUid (on Copy)
  * @param 	boolean		$skipSorting: Do not update the sorting columns, this could happen for imported values
  * @return	void
  */
 function writeForeignField($conf, $parentUid, $updateToUid = 0, $skipSorting = false)
 {
     $c = 0;
     $foreign_table = $conf['foreign_table'];
     $foreign_field = $conf['foreign_field'];
     $symmetric_field = $conf['symmetric_field'];
     $foreign_table_field = $conf['foreign_table_field'];
     // if there are table items and we have a proper $parentUid
     if (t3lib_div::testInt($parentUid) && count($this->tableArray)) {
         // if updateToUid is not a positive integer, set it to '0', so it will be ignored
         if (!(t3lib_div::testInt($updateToUid) && $updateToUid > 0)) {
             $updateToUid = 0;
         }
         $fields = 'uid,' . $foreign_field . ($symmetric_field ? ',' . $symmetric_field : '');
         // update all items
         foreach ($this->itemArray as $val) {
             $uid = $val['id'];
             $table = $val['table'];
             // fetch the current (not overwritten) relation record if we should handle symmetric relations
             if ($conf['symmetric_field']) {
                 $row = t3lib_BEfunc::getRecord($table, $uid, $fields, '', false);
                 $isOnSymmetricSide = t3lib_loadDBGroup::isOnSymmetricSide($parentUid, $conf, $row);
             }
             $updateValues = array();
             // no update to the uid is requested, so this is the normal behaviour
             // just update the fields and care about sorting
             if (!$updateToUid) {
                 // Always add the pointer to the parent uid
                 if ($isOnSymmetricSide) {
                     $updateValues[$symmetric_field] = $parentUid;
                 } else {
                     $updateValues[$foreign_field] = $parentUid;
                 }
                 // if it is configured in TCA also to store the parent table in the child record, just do it
                 if ($foreign_table_field && $this->currentTable) {
                     $updateValues[$foreign_table_field] = $this->currentTable;
                 }
                 // update sorting columns if not to be skipped
                 if (!$skipSorting) {
                     // get the correct sorting field
                     if ($conf['foreign_sortby']) {
                         // specific manual sortby for data handled by this field
                         $sortby = $conf['foreign_sortby'];
                     } elseif ($GLOBALS['TCA'][$foreign_table]['ctrl']['sortby']) {
                         // manual sortby for all table records
                         $sortby = $GLOBALS['TCA'][$foreign_table]['ctrl']['sortby'];
                     }
                     // strip a possible "ORDER BY" in front of the $sortby value
                     $sortby = $GLOBALS['TYPO3_DB']->stripOrderBy($sortby);
                     $symSortby = $conf['symmetric_sortby'];
                     // set the sorting on the right side, it depends on who created the relation, so what uid is in the symmetric_field
                     if ($isOnSymmetricSide && $symSortby) {
                         $updateValues[$symSortby] = ++$c;
                     } elseif ($sortby) {
                         $updateValues[$sortby] = ++$c;
                     }
                 }
                 // update to a foreign_field/symmetric_field pointer is requested, normally used on record copies
                 // only update the fields, if the old uid is found somewhere - for select fields, TCEmain is doing this already!
             } else {
                 if ($isOnSymmetricSide) {
                     $updateValues[$symmetric_field] = $updateToUid;
                 } else {
                     $updateValues[$foreign_field] = $updateToUid;
                 }
             }
             if (count($updateValues)) {
                 $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $updateValues);
                 $this->updateRefIndex($table, $uid);
             }
         }
     }
 }
 /**
  * Creating the module output.
  *
  * @return	void
  */
 function main()
 {
     global $LANG, $BACK_PATH, $BE_USER;
     if ($this->page_id) {
         // Get record for element:
         $elRow = t3lib_BEfunc::getRecordWSOL($this->table, $this->moveUid);
         // Headerline: Icon, record title:
         $hline = t3lib_iconWorks::getSpriteIconForRecord($this->table, $elRow, array('id' => "c-recIcon", 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($elRow, $this->table))));
         $hline .= t3lib_BEfunc::getRecordTitle($this->table, $elRow, TRUE);
         // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently):
         $onClick = 'window.location.href=\'' . t3lib_div::linkThisScript(array('makeCopy' => !$this->makeCopy)) . '\';';
         $hline .= '<br /><input type="hidden" name="makeCopy" value="0" /><input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy">' . $LANG->getLL('makeCopy', 1) . '</label>';
         // Add the header-content to the module content:
         $this->content .= $this->doc->section($LANG->getLL('moveElement') . ':', $hline, 0, 1);
         $this->content .= $this->doc->spacer(20);
         // Reset variable to pick up the module content in:
         $code = '';
         // IF the table is "pages":
         if ((string) $this->table == 'pages') {
             // Get page record (if accessible):
             $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = t3lib_div::makeInstance('ext_posMap_pages');
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 if ($pageinfo['pid']) {
                     $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree:
                 $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
             }
         }
         // IF the table is "tt_content":
         if ((string) $this->table == 'tt_content') {
             // First, get the record:
             $tt_content_rec = t3lib_BEfunc::getRecord('tt_content', $this->moveUid);
             // ?
             if (!$this->input_moveUid) {
                 $this->page_id = $tt_content_rec['pid'];
             }
             // Checking if the parent page is readable:
             $pageinfo = t3lib_BEfunc::readPageAccess($this->page_id, $this->perms_clause);
             if (is_array($pageinfo) && $BE_USER->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
                 // Initialize the position map:
                 $posMap = t3lib_div::makeInstance('ext_posMap_tt_content');
                 $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
                 $posMap->cur_sys_language = $this->sys_language;
                 // Headerline for the parent page: Icon, record title:
                 $hline = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageinfo, array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($pageinfo, 'pages'))));
                 $hline .= t3lib_BEfunc::getRecordTitle('pages', $pageinfo, TRUE);
                 // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                 $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->page_id, 'mod.SHARED');
                 // SHARED page-TSconfig settings.
                 $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
                 $colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $colPosList)));
                 // Removing duplicates, if any
                 // Adding parent page-header and the content element columns from position-map:
                 $code = $hline . '<br />';
                 $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI);
                 // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
                 $code .= '<br />';
                 $code .= '<br />';
                 if ($pageinfo['pid']) {
                     $pidPageInfo = t3lib_BEfunc::readPageAccess($pageinfo['pid'], $this->perms_clause);
                     if (is_array($pidPageInfo)) {
                         if ($BE_USER->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) {
                             $code .= '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('uid' => intval($pageinfo['pid']), 'moveUid' => $this->moveUid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-up') . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '</a><br />';
                         } else {
                             $code .= t3lib_iconWorks::getSpriteIconForRecord('pages', $pidPageInfo) . t3lib_BEfunc::getRecordTitle('pages', $pidPageInfo, TRUE) . '<br />';
                         }
                     }
                 }
                 // Create the position tree (for pages):
                 $code .= $posMap->positionTree($this->page_id, $pageinfo, $this->perms_clause, $this->R_URI);
             }
         }
         // Add the $code content as a new section to the module:
         $this->content .= $this->doc->section($LANG->getLL('selectPositionOfElement') . ':', $code, 0, 1);
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     $markers['CSH'] = $docHeaderButtons['csh'];
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($LANG->getLL('movingElement'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
 function getItemRootline($ids)
 {
     $rootLine = array();
     foreach ($ids as $item) {
         $uid = $item;
         $itemRootLine = array();
         while ($uid != 0) {
             $row = t3lib_BEfunc::getRecord($this->fieldConfig['foreign_table'], $uid, $this->parentField);
             if (is_array($row) and $row[$this->parentField] > 0) {
                 $uid = $row[$this->parentField];
                 $itemRootLine[] = $uid;
             } else {
                 $uid = 0;
             }
         }
         $rootLine[$item] = $itemRootLine;
     }
     return $rootLine;
 }
 /**
  * [Describe function...]
  *
  * @return	[type]		...
  */
 function procesStoreControl()
 {
     $storeArray = $this->initStoreArray();
     $storeQueryConfigs = unserialize($GLOBALS['SOBE']->MOD_SETTINGS['storeQueryConfigs']);
     $storeControl = t3lib_div::_GP('storeControl');
     $storeIndex = intval($storeControl['STORE']);
     $saveStoreArray = 0;
     $writeArray = array();
     if (is_array($storeControl)) {
         $msg = '';
         if ($storeControl['LOAD']) {
             if ($storeIndex > 0) {
                 $writeArray = $this->loadStoreQueryConfigs($storeQueryConfigs, $storeIndex, $writeArray);
                 $saveStoreArray = 1;
                 $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_loaded'), htmlspecialchars($storeArray[$storeIndex])));
             } elseif ($storeIndex < 0 && t3lib_extMgm::isLoaded('sys_action')) {
                 $actionRecord = t3lib_BEfunc::getRecord('sys_action', abs($storeIndex));
                 if (is_array($actionRecord)) {
                     $dA = unserialize($actionRecord['t2_data']);
                     $dbSC = array();
                     if (is_array($dA['qC'])) {
                         $dbSC[0] = $dA['qC'];
                     }
                     $writeArray = $this->loadStoreQueryConfigs($dbSC, '0', $writeArray);
                     $saveStoreArray = 1;
                     $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_from_action_loaded'), htmlspecialchars($actionRecord['title'])));
                 }
             }
         } elseif ($storeControl['SAVE']) {
             if ($storeIndex < 0) {
                 $qOK = $this->saveQueryInAction(abs($storeIndex));
                 if ($qOK) {
                     $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('query_saved'));
                 } else {
                     $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('query_notsaved'), '', t3lib_FlashMessage::ERROR);
                 }
             } else {
                 if (trim($storeControl['title'])) {
                     if ($storeIndex > 0) {
                         $storeArray[$storeIndex] = $storeControl['title'];
                     } else {
                         $storeArray[] = $storeControl['title'];
                         end($storeArray);
                         $storeIndex = key($storeArray);
                     }
                     $storeQueryConfigs = $this->addToStoreQueryConfigs($storeQueryConfigs, $storeIndex);
                     $saveStoreArray = 1;
                     $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('query_saved'));
                 }
             }
         } elseif ($storeControl['REMOVE']) {
             if ($storeIndex > 0) {
                 $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('query_removed'), htmlspecialchars($storeArray[$storeControl['STORE']])));
                 unset($storeArray[$storeControl['STORE']]);
                 // Removing
                 $saveStoreArray = 1;
             }
         }
         if ($flashMessage) {
             $msg = $flashMessage->render();
         }
     }
     if ($saveStoreArray) {
         unset($storeArray[0]);
         // making sure, index 0 is not set!
         $writeArray['storeArray'] = serialize($storeArray);
         $writeArray['storeQueryConfigs'] = serialize($this->cleanStoreQueryConfigs($storeQueryConfigs, $storeArray));
         $GLOBALS['SOBE']->MOD_SETTINGS = t3lib_BEfunc::getModuleData($GLOBALS['SOBE']->MOD_MENU, $writeArray, $GLOBALS['SOBE']->MCONF['name'], 'ses');
     }
     return $msg;
 }
 /**
  * loads internal array with l10nmgrcfg record
  *
  * @param int	$id		Id of the cfg record
  * @return void
  **/
 function load($id)
 {
     $this->l10ncfg = t3lib_BEfunc::getRecord('tx_l10nmgr_cfg', $id);
 }