/**
  * Returns a combined binary representation of the current users permissions for the page-record, $row.
  * The perms for user, group and everybody is OR'ed together (provided that the page-owner is the user and for the groups that the user is a member of the group
  * If the user is admin, 31 is returned	(full permissions for all five flags)
  *
  * @param	array		Input page row with all perms_* fields available.
  * @param	object		BE User Object
  * @return	integer		Bitwise representation of the users permissions in relation to input page row, $row
  */
 public function calcPerms($params, $that)
 {
     $row = $params['row'];
     $beAclConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_acl']);
     if (!$beAclConfig['disableOldPermissionSystem']) {
         $out = $params['outputPermissions'];
     } else {
         $out = 0;
     }
     $rootLine = t3lib_BEfunc::BEgetRootLine($row['uid']);
     $i = 0;
     $takeUserIntoAccount = 1;
     $groupIdsAlreadyUsed = array();
     foreach ($rootLine as $level => $values) {
         if ($i != 0) {
             $recursive = ' AND recursive=1';
         } else {
             $recursive = '';
         }
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_beacl_acl', 'pid=' . intval($values['uid']) . $recursive, '', 'recursive ASC');
         while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             if ($result['type'] == 0 && $that->user['uid'] == $result['object_id'] && $takeUserIntoAccount) {
                 // user has to be taken into account
                 $out |= $result['permissions'];
                 $takeUserIntoAccount = 0;
             } elseif ($result['type'] == 1 && $that->isMemberOfGroup($result['object_id']) && !in_array($result['object_id'], $groupIdsAlreadyUsed)) {
                 $out |= $result['permissions'];
                 $groupIdsAlreadyUsed[] = $result['object_id'];
             }
         }
         $i++;
     }
     return $out;
 }
 /**
  * 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');
 }
 /**
  * The main function in the class
  *
  * @return	string		HTML content
  */
 function main()
 {
     $output = 'Enter [table]:[uid]:[fieldlist (optional)] <input name="table_uid" value="' . htmlspecialchars(t3lib_div::_POST('table_uid')) . '" />';
     $output .= '<input type="submit" name="_" value="REFRESH" /><br/>';
     // Show record:
     if (t3lib_div::_POST('table_uid')) {
         list($table, $uid, $fieldName) = t3lib_div::trimExplode(':', t3lib_div::_POST('table_uid'), 1);
         if ($GLOBALS['TCA'][$table]) {
             $rec = t3lib_BEfunc::getRecordRaw($table, 'uid=' . intval($uid), $fieldName ? $fieldName : '*');
             if (count($rec)) {
                 $pidOfRecord = $rec['pid'];
                 $output .= '<input type="checkbox" name="show_path" value="1"' . (t3lib_div::_POST('show_path') ? ' checked="checked"' : '') . '/> Show path and rootline of record<br/>';
                 if (t3lib_div::_POST('show_path')) {
                     $output .= '<br/>Path of PID ' . $pidOfRecord . ': <em>' . t3lib_BEfunc::getRecordPath($pidOfRecord, '', 30) . '</em><br/>';
                     $output .= 'RL:' . Tx_Extdeveval_Compatibility::viewArray(t3lib_BEfunc::BEgetRootLine($pidOfRecord)) . '<br/>';
                     $output .= 'FLAGS:' . ($rec['deleted'] ? ' <b>DELETED</b>' : '') . ($rec['pid'] == -1 ? ' <b>OFFLINE VERSION of ' . $rec['t3ver_oid'] . '</b>' : '') . '<br/><hr/>';
                 }
                 if (t3lib_div::_POST('_EDIT')) {
                     $output .= '<hr/>Edit:<br/><br/>';
                     $output .= '<input type="submit" name="_SAVE" value="SAVE" /><br/>';
                     foreach ($rec as $field => $value) {
                         $output .= '<b>' . htmlspecialchars($field) . ':</b><br/>';
                         if (count(explode(chr(10), $value)) > 1) {
                             $output .= '<textarea name="record[' . $table . '][' . $uid . '][' . $field . ']" cols="100" rows="10">' . t3lib_div::formatForTextarea($value) . '</textarea><br/>';
                         } else {
                             $output .= '<input name="record[' . $table . '][' . $uid . '][' . $field . ']" value="' . htmlspecialchars($value) . '" size="100" /><br/>';
                         }
                     }
                 } elseif (t3lib_div::_POST('_SAVE')) {
                     $incomingData = t3lib_div::_POST('record');
                     $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($uid), $incomingData[$table][$uid]);
                     $output .= '<br/>Updated ' . $table . ':' . $uid . '...';
                     $this->updateRefIndex($table, $uid);
                 } else {
                     if (t3lib_div::_POST('_DELETE')) {
                         $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid=' . intval($uid));
                         $output .= '<br/>Deleted ' . $table . ':' . $uid . '...';
                         $this->updateRefIndex($table, $uid);
                     } else {
                         $output .= '<input type="submit" name="_EDIT" value="EDIT" />';
                         $output .= '<input type="submit" name="_DELETE" value="DELETE" onclick="return confirm(\'Are you sure you wish to delete?\');" />';
                         $output .= '<br/>' . md5(implode($rec));
                         $output .= Tx_Extdeveval_Compatibility::viewArray($rec);
                     }
                 }
             } else {
                 $output .= 'No record existed!';
             }
         }
     }
     return $output;
 }
예제 #4
0
    /**
     * Initialize the normal module operation
     *
     * @return	void
     */
    function init()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        // Setting more GPvars:
        $this->popViewId = t3lib_div::_GP('popViewId');
        $this->popViewId_addParams = t3lib_div::_GP('popViewId_addParams');
        $this->viewUrl = t3lib_div::_GP('viewUrl');
        $this->editRegularContentFromId = t3lib_div::_GP('editRegularContentFromId');
        $this->recTitle = t3lib_div::_GP('recTitle');
        $this->disHelp = t3lib_div::_GP('disHelp');
        $this->noView = t3lib_div::_GP('noView');
        $this->perms_clause = $BE_USER->getPagePermsClause(1);
        // Set other internal variables:
        $this->R_URL_getvars['returnUrl'] = $this->retUrl;
        $this->R_URI = $this->R_URL_parts['path'] . '?' . t3lib_div::implodeArrayForUrl('', $this->R_URL_getvars);
        // MENU-ITEMS:
        // If array, then it's a selector box menu
        // If empty string it's just a variable, that'll be saved.
        // Values NOT in this array will not be saved in the settings-array for the module.
        $this->MOD_MENU = array('showPalettes' => '');
        // Setting virtual document name
        $this->MCONF['name'] = 'xMOD_alt_doc.php';
        // CLEANSE SETTINGS
        $this->MOD_SETTINGS = t3lib_BEfunc::getModuleData($this->MOD_MENU, t3lib_div::_GP('SET'), $this->MCONF['name']);
        // Create an instance of the document template object
        $this->doc = $GLOBALS['TBE_TEMPLATE'];
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/alt_doc.html');
        $this->doc->form = '<form action="' . htmlspecialchars($this->R_URI) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="document.editform._scrollPosition.value=(document.documentElement.scrollTop || document.body.scrollTop); return TBE_EDITOR.checkSubmit(1);">';
        $this->doc->getPageRenderer()->loadPrototype();
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function jumpToUrl(URL,formEl)	{	//
				if (!TBE_EDITOR.isFormChanged())	{
					window.location.href = URL;
				} else if (formEl && formEl.type=="checkbox") {
					formEl.checked = formEl.checked ? 0 : 1;
				}
			}
				// Object: TS:
				// passwordDummy and decimalSign are used by tbe_editor.js and have to be declared here as
				// TS object overwrites the object declared in tbe_editor.js
			function typoSetup	()	{	//
				this.uniqueID = "";
				this.passwordDummy = "********";
				this.decimalSign = ".";
			}
			var TS = new typoSetup();

				// Info view:
			function launchView(table,uid,bP)	{	//
				var backPath= bP ? bP : "";
				var thePreviewWindow="";
				thePreviewWindow = window.open(backPath+"show_item.php?table="+encodeURIComponent(table)+"&uid="+encodeURIComponent(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
				if (thePreviewWindow && thePreviewWindow.focus)	{
					thePreviewWindow.focus();
				}
			}
			function deleteRecord(table,id,url)	{	//
				if (
					' . ($GLOBALS['BE_USER']->jsConfirmation(4) ? 'confirm(' . $LANG->JScharCode($LANG->getLL('deleteWarning')) . ')' : '1==1') . '
				)	{
					window.location.href = "tce_db.php?cmd["+table+"]["+id+"][delete]=1' . t3lib_BEfunc::getUrlToken('tceAction') . '&redirect="+escape(url)+"&vC=' . $BE_USER->veriCode() . '&prErr=1&uPT=1";
				}
				return false;
			}
		' . (isset($_POST['_savedokview_x']) && $this->popViewId ? 'if (window.opener) { ' . t3lib_BEfunc::viewOnClick($this->popViewId, '', t3lib_BEfunc::BEgetRootLine($this->popViewId), '', $this->viewUrl, $this->popViewId_addParams, FALSE) . ' } else { ' . t3lib_BEfunc::viewOnClick($this->popViewId, '', t3lib_BEfunc::BEgetRootLine($this->popViewId), '', $this->viewUrl, $this->popViewId_addParams) . ' } ' : ''));
        // Setting up the context sensitive menu:
        $this->doc->getContextMenuCode();
        $this->doc->bodyTagAdditions = 'onload="window.scrollTo(0,' . t3lib_div::intInRange(t3lib_div::_GP('_scrollPosition'), 0, 10000) . ');"';
    }
 /**
  * Initializes the $_SERVER['HTTP_HOST'] environment variable in CLI
  * environments dependent on the Index Queue item's root page.
  *
  * When the Index Queue Worker task is executed by a cron job there is no
  * HTTP_HOST since we are in a CLI environment. RealURL needs the host
  * information to generate a proper URL though. Using the Index Queue item's
  * root page information we can determine the correct host although being
  * in a CLI environment.
  *
  * @param	Tx_Solr_IndexQueue_Item	$item Index Queue item to use to determine the host.
  */
 protected function initializeHttpHost(Tx_Solr_IndexQueue_Item $item)
 {
     static $hosts = array();
     // relevant for realURL environments, only
     if (t3lib_extMgm::isLoaded('realurl')) {
         $rootpageId = $item->getRootPageUid();
         $hostFound = !empty($hosts[$rootpageId]);
         if (!$hostFound) {
             $rootline = t3lib_BEfunc::BEgetRootLine($rootpageId);
             $host = t3lib_BEfunc::firstDomainRecord($rootline);
             $hosts[$rootpageId] = $host;
         }
         $_SERVER['HTTP_HOST'] = $hosts[$rootpageId];
     }
 }
예제 #6
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return array all available buttons as an associated array
  */
 protected function getButtons()
 {
     $buttons = array('view' => '', 'record_list' => '', 'shortcut' => '');
     if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('tx_impexp', '', $this->MCONF['name']);
     }
     // Input data grabbed:
     $inData = t3lib_div::_GP('tx_impexp');
     if ((string) $inData['action'] == 'import') {
         if ($this->id && is_array($this->pageinfo) || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
             if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
                 // View
                 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $this->doc->backPath, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
                 // Record list
                 if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
                     $href = $this->doc->backPath . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
                     $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-list-open') . '</a>';
                 }
             }
         }
     }
     return $buttons;
 }
 /**
  * returns a datastructure: pageid - userId / groupId - permissions
  *
  * @param	array		user ID list
  * @param	array		group ID list
  */
 function buildACLtree($users, $groups)
 {
     // get permissions in the starting point for users and groups
     $rootLine = t3lib_BEfunc::BEgetRootLine($this->id);
     $userStartPermissions = array();
     $groupStartPermissions = array();
     array_shift($rootLine);
     // needed as a starting point
     foreach ($rootLine as $level => $values) {
         $recursive = ' AND recursive=1';
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('type, object_id, permissions', 'tx_beacl_acl', 'pid=' . intval($values['uid']) . $recursive);
         while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             if ($result['type'] == 0 && in_array($result['object_id'], $users) && !array_key_exists($result['object_id'], $userStartPermissions)) {
                 $userStartPermissions[$result['object_id']] = $result['permissions'];
             } elseif ($result['type'] == 1 && in_array($result['object_id'], $groups) && !array_key_exists($result['object_id'], $groupStartPermissions)) {
                 $groupStartPermissions[$result['object_id']] = $result['permissions'];
             }
         }
     }
     foreach ($userStartPermissions as $oid => $perm) {
         $startPerms[0][$oid]['permissions'] = $perm;
         $startPerms[0][$oid]['recursive'] = 1;
     }
     foreach ($groupStartPermissions as $oid => $perm) {
         $startPerms[1][$oid]['permissions'] = $perm;
         $startPerms[1][$oid]['recursive'] = 1;
     }
     $this->traversePageTree_acl($startPerms, $rootLine[0]['uid']);
     // check if there are any ACLs on these pages
     // build a recursive function traversing through the pagetree
 }
예제 #8
0
 /**
  * Makes link to page $id in frontend (view page)
  * Returns an magnifier-glass icon which links to the frontend index.php document for viewing the page with id $id
  * $id must be a page-uid
  * If the BE_USER has access to Web>List then a link to that module is shown as well (with return-url)
  *
  * @param	integer		The page id
  * @param	string		The current "BACK_PATH" (the back relative to the typo3/ directory)
  * @param	string		Additional parameters for the image tag(s)
  * @return	string		HTML string with linked icon(s)
  */
 function viewPageIcon($id, $backPath, $addParams = 'hspace="3"')
 {
     global $BE_USER;
     $str = '';
     // If access to Web>List for user, then link to that module.
     if ($BE_USER->check('modules', 'web_list')) {
         $href = $backPath . 'db_list.php?id=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
         $str .= '<a href="' . htmlspecialchars($href) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/list.gif', 'width="11" height="11"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '"' . ($addParams ? ' ' . trim($addParams) : '') . ' alt="" />' . '</a>';
     }
     // Make link to view page
     $str .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($id, $backPath, t3lib_BEfunc::BEgetRootLine($id))) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/zoom.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '"' . ($addParams ? ' ' . trim($addParams) : "") . ' hspace="3" alt="" />' . '</a>';
     return $str;
 }
예제 #9
0
 /**
  * Main function
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
     // Access check...
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
     $access = is_array($this->pageinfo) ? 1 : 0;
     $addCmd = '';
     if ($this->id && $access) {
         $addCmd = '&ADMCMD_view=1&ADMCMD_editIcons=1' . t3lib_BEfunc::ADMCMD_previewCmds($this->pageinfo);
     }
     $parts = parse_url(t3lib_div::getIndpEnv('TYPO3_SITE_URL'));
     $dName = t3lib_BEfunc::getDomainStartPage($parts['host'], $parts['path']) ? t3lib_BEfunc::firstDomainRecord(t3lib_BEfunc::BEgetRootLine($this->id)) : '';
     // preview of mount pages
     $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
     $sys_page->init(FALSE);
     $mountPointInfo = $sys_page->getMountPointInfo($this->id);
     if ($mountPointInfo && $mountPointInfo['overlay']) {
         $this->id = $mountPointInfo['mount_pid'];
         $addCmd .= '&MP=' . $mountPointInfo['MPvar'];
     }
     $this->url .= ($dName ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://') . $dName : $BACK_PATH . '..') . '/index.php?id=' . $this->id . ($this->type ? '&type=' . $this->type : '') . $addCmd;
 }
 /**
  * Processes the CURL request and sends action to Varnish server
  *
  * @param string $url
  * @param integer $pid
  * @param string $host
  * @param boolean $quote
  *
  * @return array
  */
 protected function processClearCacheCommand($url, $pid, $host = '', $quote = TRUE)
 {
     $responseArray = array();
     foreach ($this->serverArray as $server) {
         $response = array('server' => $server);
         // Build request
         if ($this->stripSlash) {
             $url = rtrim($url, '/');
         }
         $request = $server . '/' . ltrim($url, '/');
         $response['request'] = $request;
         // Check for curl functions
         if (!function_exists('curl_init')) {
             // TODO: Implement fallback to file_get_contents()
             $response['status'] = t3lib_FlashMessage::ERROR;
             $response['message'] = 'No curl_init available';
         } else {
             // If no host was given we need to loop over all
             $hostArray = array();
             if ($host !== '') {
                 $hostArray = t3lib_div::trimExplode(',', $host, 1);
             } else {
                 // Get all (non-redirecting) domains from root
                 $rootLine = t3lib_BEfunc::BEgetRootLine($pid);
                 foreach ($rootLine as $row) {
                     $domainArray = t3lib_BEfunc::getRecordsByField('sys_domain', 'pid', $row['uid'], ' AND redirectTo="" AND hidden=0');
                     if (is_array($domainArray) && !empty($domainArray)) {
                         foreach ($domainArray as $domain) {
                             $hostArray[] = $domain['domainName'];
                         }
                         unset($domain);
                     }
                 }
                 unset($row);
             }
             // Fallback to current server
             if (empty($hostArray)) {
                 $domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/');
                 $hostArray[] = substr($domain, strpos($domain, '://') + 3);
             }
             // Loop over hosts
             foreach ($hostArray as $xHost) {
                 $response['host'] = $xHost;
                 // Curl initialization
                 $ch = curl_init();
                 // Disable direct output
                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
                 // Only get header response
                 curl_setopt($ch, CURLOPT_HEADER, 1);
                 curl_setopt($ch, CURLOPT_NOBODY, 1);
                 // Set url
                 curl_setopt($ch, CURLOPT_URL, $request);
                 // Set method and protocol
                 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $this->httpMethod);
                 curl_setopt($ch, CURLOPT_HTTP_VERSION, $this->httpProtocol === 'http_10' ? CURL_HTTP_VERSION_1_0 : CURL_HTTP_VERSION_1_1);
                 // Set X-Host and X-Url header
                 curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Host: ' . ($quote ? preg_quote($xHost) : $xHost), 'X-Url: ' . ($quote ? preg_quote($url) : $url)));
                 // Store outgoing header
                 curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
                 // Include preProcess hook (e.g. to set some alternative curl options
                 foreach ($this->hookObjects as $hookObject) {
                     /** @var tx_vcc_hook_communicationServiceHookInterface $hookObject */
                     $hookObject->preProcess($ch, $request, $response, $this);
                 }
                 unset($hookObject);
                 $header = curl_exec($ch);
                 if (!curl_error($ch)) {
                     $response['status'] = curl_getinfo($ch, CURLINFO_HTTP_CODE) == 200 ? t3lib_FlashMessage::OK : t3lib_FlashMessage::ERROR;
                     $response['message'] = preg_split('/(\\r|\\n)+/m', trim($header));
                 } else {
                     $response['status'] = t3lib_FlashMessage::ERROR;
                     $response['message'] = array(curl_error($ch));
                 }
                 $response['requestHeader'] = preg_split('/(\\r|\\n)+/m', trim(curl_getinfo($ch, CURLINFO_HEADER_OUT)));
                 // Include postProcess hook (e.g. to start some other jobs)
                 foreach ($this->hookObjects as $hookObject) {
                     /** @var tx_vcc_hook_communicationServiceHookInterface $hookObject */
                     $hookObject->postProcess($ch, $request, $response, $this);
                 }
                 unset($hookObject);
                 curl_close($ch);
                 // Log debug information
                 $logData = array('url' => $url, 'pid' => $pid, 'host' => $host, 'response' => $response);
                 $logType = $response['status'] == t3lib_FlashMessage::OK ? tx_vcc_service_loggingService::OK : tx_vcc_service_loggingService::ERROR;
                 $this->loggingService->log('CommunicationService::processClearCacheCommand', $logData, $logType, $pid, 3);
                 $responseArray[] = $response;
             }
             unset($xHost);
         }
     }
     unset($server);
     return $responseArray;
 }
 /**
  * [Describe function...]
  *
  * @param	[type]		$id: ...
  * @param	[type]		$perms_clause: ...
  * @return	[type]		...
  */
 function ext_prevPageWithTemplate($id, $perms_clause)
 {
     $rootLine = t3lib_BEfunc::BEgetRootLine($id, $perms_clause ? ' AND ' . $perms_clause : '');
     foreach ($rootLine as $p) {
         if ($this->ext_getFirstTemplate($p['uid'])) {
             return $p;
         }
     }
 }
예제 #12
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array		all available buttons as an assoc. array
  */
 function getHeaderButtons()
 {
     global $LANG;
     $buttons = array('csh' => '', 'view' => '', 'edit' => '', 'record_list' => '', 'level_up' => '', 'reload' => '', 'shortcut' => '', 'back' => '', 'csv' => '', 'export' => '');
     $backPath = $GLOBALS['BACK_PATH'];
     // CSH
     // 		if (!strlen($this->id))	{
     // 			$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_txttnewsM1', 'list_module_noId', $backPath);
     // 		} elseif(!$this->id) {
     // 			$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_txttnewsM1', 'list_module_root', $backPath);
     // 		} else {
     // 			$buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_txttnewsM1', 'list_module', $backPath);
     // 		}
     if (isset($this->id)) {
         if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
             $href = t3lib_BEfunc::getModuleUrl('web_list', array('id' => $this->pageinfo['uid'], 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI')));
             $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/list.gif', 'width="11" height="11"') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '" alt="" />' . '</a>';
         }
         // View
         $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id, $backPath, t3lib_BEfunc::BEgetRootLine($this->id))) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/zoom.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '" alt="" />' . '</a>';
         // If edit permissions are set (see class.t3lib_userauthgroup.php)
         if ($this->localCalcPerms & 2 && !empty($this->id)) {
             // Edit
             $params = '&edit[pages][' . $this->pageinfo['uid'] . ']=edit';
             $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $backPath, -1)) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/edit2.gif') . ' title="' . $LANG->getLL('editPage', 1) . '" alt="" />' . '</a>';
         }
         //			if ($this->table) {
         // Export
         if (t3lib_extMgm::isLoaded('impexp')) {
             $modUrl = t3lib_extMgm::extRelPath('impexp') . 'app/index.php';
             $params = $modUrl . '?tx_impexp[action]=export&tx_impexp[list][]=';
             $params .= rawurlencode('tt_news:' . $this->id) . '&tx_impexp[list][]=';
             $params .= rawurlencode('tt_news_cat:' . $this->id);
             $buttons['export'] = '<a href="' . htmlspecialchars($backPath . $params) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, t3lib_extMgm::extRelPath('impexp') . 'export.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.export', 1) . '" alt="" />' . '</a>';
         }
         //			}
         // Reload
         $buttons['reload'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript()) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/refresh_n.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.reload', 1) . '" alt="" />' . '</a>';
         // Shortcut
         if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
             $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, showThumbs, pointer, table, search_field, searchLevels, showLimit, sortField, sortRev', implode(',', array_keys($this->MOD_MENU)), 'web_txttnewsM1');
         }
         // Back
         if ($this->returnUrl) {
             $buttons['back'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/goback.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', 1) . '" alt="" />' . '</a>';
         }
     }
     return $buttons;
 }
예제 #13
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     global $LANG, $BACK_PATH;
     $buttons = array('csh' => '', 'back' => '', 'view' => '', 'new_page' => '', 'record_list' => '');
     if (!$this->pagesOnly) {
         // Regular new element:
         // New page
         if ($this->showNewRecLink('pages')) {
             $buttons['new_page'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('pagesOnly' => '1'))) . '" title="' . $LANG->sL('LLL:EXT:cms/layout/locallang.xml:newPage', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-page-new') . '</a>';
         }
         // CSH
         $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_regular', $GLOBALS['BACK_PATH'], '', TRUE);
     } elseif ($this->showNewRecLink('pages')) {
         // Pages only wizard
         // CSH
         $buttons['csh'] = t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'new_pages', $GLOBALS['BACK_PATH'], '', TRUE);
     }
     // Back
     if ($this->R_URI) {
         $buttons['back'] = '<a href="' . htmlspecialchars($this->R_URI) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '</a>';
     }
     if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
         // View
         $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $this->backPath, t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
         // Record list
         // If access to Web>List for user, then link to that module.
         $buttons['record_list'] = t3lib_BEfunc::getListViewLink(array('id' => $this->pageinfo['uid'], 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI')), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList'));
     }
     return $buttons;
 }
예제 #14
0
 /**
  * Makes link to page $id in frontend (view page)
  * Returns an magnifier-glass icon which links to the frontend index.php document for viewing the page with id $id
  * $id must be a page-uid
  * If the BE_USER has access to Web>List then a link to that module is shown as well (with return-url)
  *
  * @param	integer		The page id
  * @param	string		The current "BACK_PATH" (the back relative to the typo3/ directory)
  * @param	string		Additional parameters for the image tag(s)
  * @return	string		HTML string with linked icon(s)
  */
 function viewPageIcon($id, $backPath, $addParams = 'hspace="3"')
 {
     global $BE_USER;
     // If access to Web>List for user, then link to that module.
     $str = t3lib_BEfunc::getListViewLink(array('id' => $id, 'returnUrl' => t3lib_div::getIndpEnv('REQUEST_URI')), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList'));
     // Make link to view page
     $str .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($id, $backPath, t3lib_BEfunc::BEgetRootLine($id))) . '">' . '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/zoom.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '"' . ($addParams ? ' ' . trim($addParams) : "") . ' hspace="3" alt="" />' . '</a>';
     return $str;
 }
 /**
  * Checks if the page id, $id, is found within the webmounts set up for the user.
  * This should ALWAYS be checked for any page id a user works with, whether it's about reading, writing or whatever.
  * The point is that this will add the security that a user can NEVER touch parts outside his mounted pages in the page tree. This is otherwise possible if the raw page permissions allows for it. So this security check just makes it easier to make safe user configurations.
  * If the user is admin OR if this feature is disabled (fx. by setting TYPO3_CONF_VARS['BE']['lockBeUserToDBmounts']=0) then it returns "1" right away
  * Otherwise the function will return the uid of the webmount which was first found in the rootline of the input page $id
  *
  * @param	integer		Page ID to check
  * @param	string		Content of "->getPagePermsClause(1)" (read-permissions). If not set, they will be internally calculated (but if you have the correct value right away you can save that database lookup!)
  * @param	boolean		If set, then the function will exit with an error message.
  * @return	integer		The page UID of a page in the rootline that matched a mount point
  */
 function isInWebMount($id, $readPerms = '', $exitOnError = 0)
 {
     if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] || $this->isAdmin()) {
         return 1;
     }
     $id = intval($id);
     // Check if input id is an offline version page in which case we will map id to the online version:
     $checkRec = t3lib_beFUnc::getRecord('pages', $id, 'pid,t3ver_oid');
     if ($checkRec['pid'] == -1) {
         $id = intval($checkRec['t3ver_oid']);
     }
     if (!$readPerms) {
         $readPerms = $this->getPagePermsClause(1);
     }
     if ($id > 0) {
         $wM = $this->returnWebmounts();
         $rL = t3lib_BEfunc::BEgetRootLine($id, ' AND ' . $readPerms);
         foreach ($rL as $v) {
             if ($v['uid'] && in_array($v['uid'], $wM)) {
                 return $v['uid'];
             }
         }
     }
     if ($exitOnError) {
         t3lib_BEfunc::typo3PrintError('Access Error', 'This page is not within your DB-mounts', 0);
         exit;
     }
 }
    /**
     * Extension action, displays extension report
     *
     * @return void
     */
    public function extensionAction()
    {
        $values = array();
        // FIXME: It's unclear to me how to get this value programmatically
        // There is a getArgumentPrefix method, but that only applies to widgets
        $values['argumentPrefix'] = 'tx_smoothmigration_tools_smoothmigrationsmoothmigration';
        // List of frontend extensions
        $loadedExtensions = Tx_Smoothmigration_Utility_ExtensionUtility::getFrontendExtensions(FALSE);
        $this->view->assign('loadedExtensions', $loadedExtensions);
        $selectedExtension = '';
        if ($this->request->hasArgument('extension')) {
            $selectedExtension = $this->request->getArgument('extension');
        }
        // List of sites
        $sites = Tx_Smoothmigration_Utility_DatabaseUtility::getSiteRoots();
        $selectSites = array();
        foreach ($sites as $siteUid => $siteData) {
            $selectSites[$siteUid] = $siteUid . ': ' . $siteData['title'];
        }
        $values['sites'] = $selectSites;
        $selectedSite = '';
        if ($this->request->hasArgument('site')) {
            $selectedSite = $this->request->getArgument('site');
            $values['selectedSite'] = $selectedSite;
        }
        if ($selectedSite && $selectedExtension != 1) {
            // Get TypoScript configuration for selected site
            if (count($sites) && $selectedSite) {
                $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');
                $tmpl->tt_track = 0;
                $tmpl->init();
                $tmpl->runThroughTemplates(t3lib_BEfunc::BEgetRootLine((int) $selectedSite, 'AND 1=1'), 0);
                $tmpl->generateConfig();
            }
            // Fetch correct class names
            $correctClassNames = array();
            if ($selectedExtension) {
                $correctClassNames[$selectedExtension] = t3lib_extMgm::getCN($selectedExtension);
            } else {
                $extensionKeys = Tx_Smoothmigration_Utility_ExtensionUtility::getLoadedExtensions();
                foreach ($extensionKeys as $key) {
                    $correctClassNames[$key] = t3lib_extMgm::getCN($key);
                }
            }
            $listTypes = array();
            $values['plugins'] = array();
            // For all the root plugin objects in the plugin array
            foreach ($tmpl->setup['plugin.'] as $name => $_) {
                $name = rtrim($name, '.');
                // Store the matching extension key with the plugin name
                foreach ($correctClassNames as $key => $className) {
                    if (strstr($name, $className)) {
                        $values['plugins'][$name] = $key;
                        $suffix = str_replace($className, '', $name);
                        $listTypes[] = $key . $suffix;
                    }
                }
            }
            asort($values['plugins']);
            $pluginNames = array_keys($values['plugins']);
            // This catches Powermail which has it's own ctype which it calls powermail_pi1
            $values['cTypes'] = array();
            foreach ($pluginNames as $name) {
                array_push($values['cTypes'], str_replace('tx_', '', $name));
            }
            // Fetch list types, initialize with legacy tt_news list_type: 9
            $values['listTypes'] = array();
            if ($selectedExtension === 'tt_news') {
                $values['listTypes'] = array('9');
            }
            foreach ($tmpl->setup['tt_content.']['list.']['20.'] as $listType => $_) {
                if (preg_match('/^[^.]+$/', $listType)) {
                    foreach ($values['plugins'] as $correctedClassName) {
                        if (preg_match('/^' . $correctedClassName . '/', $listType)) {
                            $values['listTypes'][] = $listType;
                        }
                    }
                }
            }
            asort($values['listTypes']);
            $values['pages'] = array();
            if (count($values['listTypes']) || count($values['cTypes'])) {
                $values['pages'] = Tx_Smoothmigration_Utility_DatabaseUtility::getPagesWithContentElements($values['cTypes'], $values['listTypes']);
            }
            $pages = array();
            foreach ($values['pages'] as $page) {
                $this->setInPageArray($pages, t3lib_BEfunc::BEgetRootLine($page['pageUid'], 'AND 1=1'), $page);
            }
            $lines = array();
            $lines[] = '<tr class="t3-row-header">
				<td nowrap>Page title</td>
				<td nowrap>' . $GLOBALS['LANG']->getLL('isExt') . '</td>
				</tr>';
            $lines = array_merge($lines, $this->renderList($pages));
            $values['table'] = '<table border="0" cellpadding="0" cellspacing="1" id="ts-overview">' . implode('', $lines) . '</table>';
        }
        $this->view->assignMultiple($values);
        $this->view->assign('selectedExtension', $selectedExtension);
        $this->view->assign('moduleToken', $this->moduleToken);
    }
 /**
  * Url parsing
  *
  * @param   array	   $row: broken link record
  * @return  string	  parsed broken url
  */
 public function getBrokenUrl($row)
 {
     $domain = rtrim(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '/');
     $rootLine = t3lib_BEfunc::BEgetRootLine($row['record_pid']);
     // checks alternate domains
     if (count($rootLine) > 0) {
         $protocol = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
         $domainRecord = t3lib_BEfunc::firstDomainRecord($rootLine);
         if (!empty($domainRecord)) {
             $domain = $protocol . $domainRecord;
         }
     }
     return $domain . '/index.php?id=' . $row['url'];
 }
 /**
  * clears the treelist cache for all parents of a changed page.
  * gets called after creating a new page and after moving a page
  *
  * @param	integer	parent page id of the changed page, the page to start clearing from
  */
 protected function clearCacheForAllParents($affectedParentPage)
 {
     $rootline = t3lib_BEfunc::BEgetRootLine($affectedParentPage);
     $rootlineIds = array();
     foreach ($rootline as $page) {
         if ($page['uid'] != 0) {
             $rootlineIds[] = $page['uid'];
         }
     }
     if (!empty($rootlineIds)) {
         $rootlineIdsImploded = implode(',', $rootlineIds);
         $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_treelist', 'pid IN(' . $rootlineIdsImploded . ')');
     }
 }
예제 #19
0
파일: index.php 프로젝트: rod86/t3sandbox
 /**
  * Rendering a single element in outline:
  *
  * @param	array		$contentTreeArr: DataStructure info array (the whole tree)
  * @param	array		$entries: Entries accumulated in this array (passed by reference)
  * @param	integer		$indentLevel: Indentation level
  * @param	array		$parentPointer: Element position in structure
  * @param	string		$controls: HTML for controls to add for this element
  * @return	void
  * @access protected
  * @see	render_outline_allSheets()
  */
 function render_outline_element($contentTreeArr, &$entries, $indentLevel = 0, $parentPointer = array(), $controls = '')
 {
     global $LANG, $TYPO3_CONF_VARS;
     // Get record of element:
     $elementBelongsToCurrentPage = $contentTreeArr['el']['table'] == 'pages' || $contentTreeArr['el']['pid'] == $this->rootElementUid_pidForContent;
     // Prepare the record icon including a context sensitive menu link wrapped around it:
     if (isset($contentTreeArr['el']['iconTag'])) {
         $recordIcon = $contentTreeArr['el']['iconTag'];
     } else {
         $recordIcon = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, $contentTreeArr['el']['icon'], '') . ' border="0" title="' . htmlspecialchars('[' . $contentTreeArr['el']['table'] . ':' . $contentTreeArr['el']['uid'] . ']') . '" alt="" />';
     }
     $titleBarLeftButtons = $this->translatorMode ? $recordIcon : $this->doc->wrapClickMenuOnIcon($recordIcon, $contentTreeArr['el']['table'], $contentTreeArr['el']['uid'], 1, '&amp;callingScriptId=' . rawurlencode($this->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter,delete');
     $titleBarLeftButtons .= $this->getRecordStatHookValue($contentTreeArr['el']['table'], $contentTreeArr['el']['uid']);
     // Prepare table specific settings:
     switch ($contentTreeArr['el']['table']) {
         case 'pages':
             $iconEdit = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage')));
             $titleBarLeftButtons .= $this->translatorMode ? '' : $this->link_edit($iconEdit, $contentTreeArr['el']['table'], $contentTreeArr['el']['uid']);
             $titleBarRightButtons = '';
             $addGetVars = $this->currentLanguageUid ? '&L=' . $this->currentLanguageUid : '';
             $viewPageOnClick = 'onclick= "' . htmlspecialchars(t3lib_BEfunc::viewOnClick($contentTreeArr['el']['uid'], $this->doc->backPath, t3lib_BEfunc::BEgetRootLine($contentTreeArr['el']['uid']), '', '', $addGetVars)) . '"';
             $viewPageIcon = t3lib_iconWorks::getSpriteIcon('actions-document-view', array('title' => $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.showPage', 1)));
             $titleBarLeftButtons .= '<a href="#" ' . $viewPageOnClick . '>' . $viewPageIcon . '</a>';
             break;
         case 'tt_content':
             $languageUid = $contentTreeArr['el']['sys_language_uid'];
             $elementPointer = 'tt_content:' . $contentTreeArr['el']['uid'];
             if ($this->translatorMode) {
                 $titleBarRightButtons = '';
             } else {
                 // Create CE specific buttons:
                 $iconMakeLocal = t3lib_iconWorks::getSpriteIcon('extensions-templavoila-makelocalcopy', array('title' => $LANG->getLL('makeLocal')));
                 $linkMakeLocal = !$elementBelongsToCurrentPage ? $this->link_makeLocal($iconMakeLocal, $parentPointer) : '';
                 if ($this->modTSconfig['properties']['enableDeleteIconForLocalElements'] < 2 || !$elementBelongsToCurrentPage || $this->global_tt_content_elementRegister[$contentTreeArr['el']['uid']] > 1) {
                     $iconUnlink = t3lib_iconWorks::getSpriteIcon('extensions-templavoila-unlink', array('title' => $LANG->getLL('unlinkRecord')));
                     $linkUnlink = $this->link_unlink($iconUnlink, $parentPointer, FALSE);
                 } else {
                     $linkUnlink = '';
                 }
                 if ($this->modTSconfig['properties']['enableDeleteIconForLocalElements'] && $elementBelongsToCurrentPage) {
                     $hasForeignReferences = tx_templavoila_div::hasElementForeignReferences($contentTreeArr['el'], $contentTreeArr['el']['pid']);
                     $iconDelete = t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => $LANG->getLL('deleteRecord')));
                     $linkDelete = $this->link_unlink($iconDelete, $parentPointer, TRUE, $hasForeignReferences);
                 } else {
                     $linkDelete = '';
                 }
                 $iconEdit = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $LANG->getLL('editrecord')));
                 $linkEdit = $elementBelongsToCurrentPage ? $this->link_edit($iconEdit, $contentTreeArr['el']['table'], $contentTreeArr['el']['uid']) : '';
                 $titleBarRightButtons = $linkEdit . $this->clipboardObj->element_getSelectButtons($parentPointer) . $linkMakeLocal . $linkUnlink . $linkDelete;
             }
             break;
     }
     // Prepare the language icon:
     if ($languageUid > 0) {
         $languageLabel = htmlspecialchars($this->pObj->allAvailableLanguages[$languageUid]['title']);
         if ($this->pObj->allAvailableLanguages[$languageUid]['flagIcon']) {
             $languageIcon = tx_templavoila_icons::getFlagIconForLanguage($this->pObj->allAvailableLanguages[$languageUid]['flagIcon'], array('title' => $languageLabel, 'alt' => $languageLabel));
         } else {
             $languageIcon = '[' . $languageLabel . ']';
         }
     } else {
         $languageIcon = '';
     }
     // If there was a langauge icon and the language was not default or [all] and if that langauge is accessible for the user, then wrap the flag with an edit link (to support the "Click the flag!" principle for translators)
     if ($languageIcon && $languageUid > 0 && $GLOBALS['BE_USER']->checkLanguageAccess($languageUid) && $contentTreeArr['el']['table'] === 'tt_content') {
         $languageIcon = $this->link_edit($languageIcon, 'tt_content', $contentTreeArr['el']['uid'], TRUE);
     }
     // Create warning messages if neccessary:
     $warnings = '';
     if ($this->global_tt_content_elementRegister[$contentTreeArr['el']['uid']] > 1 && $this->rootElementLangParadigm != 'free') {
         $warnings .= '<br/>' . $this->doc->icons(2) . ' <em>' . htmlspecialchars(sprintf($LANG->getLL('warning_elementusedmorethanonce', ''), $this->global_tt_content_elementRegister[$contentTreeArr['el']['uid']], $contentTreeArr['el']['uid'])) . '</em>';
     }
     // Displaying warning for container content (in default sheet - a limitation) elements if localization is enabled:
     $isContainerEl = count($contentTreeArr['sub']['sDEF']);
     if (!$this->modTSconfig['properties']['disableContainerElementLocalizationWarning'] && $this->rootElementLangParadigm != 'free' && $isContainerEl && $contentTreeArr['el']['table'] === 'tt_content' && $contentTreeArr['el']['CType'] === 'templavoila_pi1' && !$contentTreeArr['ds_meta']['langDisable']) {
         if ($contentTreeArr['ds_meta']['langChildren']) {
             if (!$this->modTSconfig['properties']['disableContainerElementLocalizationWarning_warningOnly']) {
                 $warnings .= '<br/>' . $this->doc->icons(2) . ' <b>' . $LANG->getLL('warning_containerInheritance_short') . '</b>';
             }
         } else {
             $warnings .= '<br/>' . $this->doc->icons(3) . ' <b>' . $LANG->getLL('warning_containerSeparate_short') . '</b>';
         }
     }
     // Create entry for this element:
     $entries[] = array('indentLevel' => $indentLevel, 'icon' => $titleBarLeftButtons, 'title' => ($elementBelongsToCurrentPage ? '' : '<em>') . htmlspecialchars($contentTreeArr['el']['title']) . ($elementBelongsToCurrentPage ? '' : '</em>'), 'warnings' => $warnings, 'controls' => $titleBarRightButtons . $controls, 'table' => $contentTreeArr['el']['table'], 'uid' => $contentTreeArr['el']['uid'], 'flag' => $languageIcon, 'isNewVersion' => $contentTreeArr['el']['_ORIG_uid'] ? TRUE : FALSE, 'elementTitlebarClass' => (!$elementBelongsToCurrentPage ? 'tpm-elementRef' : 'tpm-element') . ' tpm-outline-level' . $indentLevel);
     // Create entry for localizaitons...
     $this->render_outline_localizations($contentTreeArr, $entries, $indentLevel + 1);
     // Create entries for sub-elements in all sheets:
     if ($contentTreeArr['sub']) {
         foreach ($contentTreeArr['sub'] as $sheetKey => $sheetInfo) {
             if (is_array($sheetInfo)) {
                 $this->render_outline_subElements($contentTreeArr, $sheetKey, $entries, $indentLevel + 1);
             }
         }
     }
 }
 /**
  * Renders the data columns
  *
  * @param	array		$item item array
  * @return	array
  */
 function getItemColumns($item)
 {
     // Columns rendering
     $columns = array();
     foreach ($this->columnList as $field => $descr) {
         switch ($field) {
             case 'page':
                 // Create output item for pages record
                 $pageRow = $item[$field];
                 $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']);
                 $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline);
                 $iconAltText = t3lib_BEfunc::getRecordIconAltText($pageRow, 'pages');
                 $icon = t3lib_iconWorks::getIconImage('pages', $pageRow, $GLOBALS['BACK_PATH'], 'title="' . $iconAltText . '" align="top"');
                 if ($this->showRootline) {
                     $title = t3lib_BEfunc::getRecordPath($pageRow['uid'], '1=1', 0);
                     $title = t3lib_div::fixed_lgd_cs($title, -$GLOBALS['BE_USER']->uc['titleLen']);
                 } else {
                     $title = t3lib_BEfunc::getRecordTitle('pages', $pageRow, TRUE);
                 }
                 if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) {
                     if ($this->enableContextMenus) {
                         $columns[$field] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($icon, 'pages', $pageRow['uid'], 1, '', '+view,edit,info') . $title;
                     } else {
                         $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>';
                     }
                 } else {
                     if ($this->enableContextMenus) {
                         $columns[$field] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($icon, 'pages', $pageRow['uid'], 1, '', '+edit,info') . $title;
                     } else {
                         $columns[$field] = $icon . $title;
                     }
                 }
                 break;
             case 'content_element':
                 // Create output item for content record
                 $refTable = $item['tablenames'];
                 $refRow = $item[$field];
                 if ($refTable == 'pages') {
                     // The reference to the media is on a field of a page record
                     if ($GLOBALS['BE_USER']->isInWebMount($refRow['uid']) && $GLOBALS['BE_USER']->doesUserHaveAccess($refRow, 1)) {
                         $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink($refTable, $refRow);
                     } else {
                         $pageRow = $refRow;
                         $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']);
                         $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline);
                         $iconAltText = t3lib_BEfunc::getRecordIconAltText($refRow, $refTable);
                         $icon = t3lib_iconworks::getIconImage($refTable, $refRow, $GLOBALS['BACK_PATH'], 'class="c-recicon" align="top" title="' . $iconAltText . '"');
                         $title = t3lib_BEfunc::getRecordTitle($refTable, $refRow, 1);
                         if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) {
                             $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>';
                         } else {
                             $columns[$field] = $icon . $title;
                         }
                     }
                 } else {
                     // The reference to the media is on a field of a content element record
                     if ($GLOBALS['BE_USER']->isInWebMount($pageRow['uid']) && $GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, 1)) {
                         $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink($refTable, $refRow);
                     } else {
                         $pageRow = $item['page'];
                         $rootline = t3lib_BEfunc::BEgetRootLine($pageRow['uid']);
                         $pageOnClick = t3lib_BEfunc::viewOnClick($pageRow['uid'], $GLOBALS['BACK_PATH'], $rootline);
                         $iconAltText = t3lib_BEfunc::getRecordIconAltText($refRow, $refTable);
                         $icon = t3lib_iconworks::getIconImage($refTable, $refRow, $GLOBALS['BACK_PATH'], 'class="c-recicon" align="top" title="' . $iconAltText . '"');
                         $title = t3lib_BEfunc::getRecordTitle($refTable, $refRow, 1);
                         if ($pageRow['doktype'] == 1 || $pageRow['doktype'] == 6) {
                             $columns[$field] = '<a href="#" onclick="' . htmlspecialchars($pageOnClick) . '">' . $icon . $title . '</a>';
                         } else {
                             $columns[$field] = $icon . $title;
                         }
                     }
                 }
                 break;
             case 'content_field':
                 // Create output item for reference field
                 $columns[$field] = $item[$field];
                 break;
             case 'softref_key':
                 // Create output item for reference key
                 $columns[$field] = $item['softref_key'] ? $GLOBALS['LANG']->sl('LLL:EXT:dam/lib/locallang.xml:softref_key_' . $item['softref_key']) : $GLOBALS['LANG']->sl('LLL:EXT:dam/lib/locallang.xml:softref_key_media');
                 break;
             case 'content_age':
                 // Create output text describing the age of the content element
                 $columns[$field] = t3lib_BEfunc::dateTimeAge($item[$field], 1);
                 break;
             case 'media_element':
                 // Create output item for tx_dam record
                 $columns[$field] = tx_dam_SCbase::getRecordInfoEditLink('tx_dam', $item);
                 break;
             case 'media_element_age':
                 // Create output text describing the tx_dam record age
                 $columns[$field] = t3lib_BEfunc::dateTimeAge($item['tstamp'], 1);
                 break;
             case '_CLIPBOARD_':
                 $columns[$field] = $this->clipboard_getItemControl($item);
                 break;
             case '_CONTROL_':
                 $columns[$field] = $this->getItemControl($item);
                 $this->columnTDAttr[$field] = ' nowrap="nowrap"';
                 break;
             default:
                 $content = $item[$field];
                 $columns[$field] = htmlspecialchars(t3lib_div::fixed_lgd_cs($content, $this->titleLength));
                 break;
         }
         if ($columns[$field] === '') {
             $columns[$field] = '&nbsp;';
         }
     }
     // Thumbsnails?
     if ($this->showThumbs and $this->thumbnailPossible($item)) {
         $columns['media_element'] .= '<div style="margin:2px 0 2px 0;">' . $this->getThumbNail($item) . '</div>';
     }
     return $columns;
 }
예제 #21
0
 /**
  * Links to publishing etc of a version
  *
  * @param	string		Table name
  * @param	array		Record
  * @param	integer		The uid of the online version of $uid. If zero it means we are drawing a row for the online version itself while a value means we are drawing display for an offline version.
  * @return	string		HTML content, mainly link tags and images.
  */
 function displayWorkspaceOverview_commandLinksSub($table, $rec, $origId)
 {
     $uid = $rec['uid'];
     if ($origId || $GLOBALS['BE_USER']->workspace === 0) {
         if (!$GLOBALS['BE_USER']->workspaceCannotEditRecord($table, $rec)) {
             // Edit
             if ($table === 'pages') {
                 $actionLinks .= '<a href="#" onclick="top.loadEditId(' . $uid . ');top.goToModule(\'' . $this->pageModule . '\'); return false;" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_page', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('apps-version-page-open') . '</a>';
             } else {
                 $params = '&edit[' . $table . '][' . $uid . ']=edit';
                 $actionLinks .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->doc->backPath)) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_user_ws.xml:img_title_edit_element', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
             }
         }
         // History/Log
         $actionLinks .= '<a href="' . htmlspecialchars($this->doc->backPath . 'show_rechis.php?element=' . rawurlencode($table . ':' . $uid) . '&returnUrl=' . rawurlencode($this->REQUEST_URI)) . '" title="' . $GLOBALS['LANG']->getLL('showLog', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-history-open') . '</a>';
     }
     // View
     if ($table === 'pages') {
         $actionLinks .= '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($uid, $this->doc->backPath, t3lib_BEfunc::BEgetRootLine($uid))) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
     }
     return $actionLinks;
 }
예제 #22
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array	all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     $buttons = array('back' => '', 'close' => '', 'new' => '', 'save' => '', 'save_close' => '', 'view' => '', 'record_list' => '', 'shortcut' => '');
     if ($this->id && $this->access) {
         // View page
         $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
         // If access to Web>List for user, then link to that module.
         if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
             $href = $GLOBALS['BACK_PATH'] . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
             $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-list-open') . '</a>';
         }
         if ($this->extClassConf['name'] == 'tx_tstemplateinfo') {
             // NEW button
             $buttons['new'] = '<input type="image" class="c-inputButton" name="createExtension" value="New"' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_el.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle', TRUE) . '" />';
             if (!empty($this->e) && !t3lib_div::_POST('abort') && !t3lib_div::_POST('saveclose')) {
                 // no NEW-button while edit
                 $buttons['new'] = '';
                 // SAVE button
                 $buttons['save'] = t3lib_iconWorks::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', TRUE) . '" ' . '/>'));
                 // SAVE AND CLOSE button
                 $buttons['save_close'] = t3lib_iconWorks::getSpriteIcon('actions-document-save-close', array('html' => '<input type="image" class="c-inputButton" name="saveclose" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', TRUE) . '" ' . '/>'));
                 // CLOSE button
                 $buttons['close'] = t3lib_iconWorks::getSpriteIcon('actions-document-close', array('html' => '<input type="image" class="c-inputButton" name="abort" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', TRUE) . '" ' . '/>'));
             }
         } elseif ($this->extClassConf['name'] == 'tx_tstemplateceditor' && count($this->MOD_MENU['constant_editor_cat'])) {
             // SAVE button
             $buttons['save'] = t3lib_iconWorks::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', TRUE) . '" ' . '/>'));
         } elseif ($this->extClassConf['name'] == 'tx_tstemplateobjbrowser') {
             if (!empty($this->sObj)) {
                 // BACK
                 $buttons['back'] = '<a href="index.php?id=' . $this->id . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.goBack', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '</a>';
             }
         }
         // Shortcut
         if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
             $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
         }
     } else {
         // Shortcut
         if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
             $buttons['shortcut'] = $this->doc->makeShortcutIcon('id', '', $this->MCONF['name']);
         }
     }
     return $buttons;
 }
예제 #23
0
    /**
     * Main function, rendering the document with the iframe with the RTE in.
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG;
        // translate id to the workspace version:
        if ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
            $this->P['uid'] = $versionRec['uid'];
        }
        // If all parameters are available:
        if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
            // Getting the raw record (we need only the pid-value from here...)
            $rawRec = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
            t3lib_BEfunc::fixVersioningPid($this->P['table'], $rawRec);
            // Setting JavaScript, including the pid value for viewing:
            $this->doc->JScode = $this->doc->wrapScriptTags('
					function jumpToUrl(URL,formEl)	{	//
						if (document.editform)	{
							if (!TBE_EDITOR.isFormChanged())	{
								window.location.href = URL;
							} else if (formEl) {
								if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
							}
						} else window.location.href = URL;
					}
				' . ($this->popView ? t3lib_BEfunc::viewOnClick($rawRec['pid'], '', t3lib_BEfunc::BEgetRootLine($rawRec['pid'])) : '') . '
			');
            // Initialize TCeforms - for rendering the field:
            $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
            $tceforms->initDefaultBEMode();
            // Init...
            $tceforms->disableWizards = 1;
            // SPECIAL: Disables all wizards - we are NOT going to need them.
            $tceforms->colorScheme[0] = $this->doc->bgColor;
            // SPECIAL: Setting background color of the RTE to ordinary background
            // Initialize style for RTE object:
            $RTEobj = t3lib_BEfunc::RTEgetObj();
            // Getting reference to the RTE object used to render the field!
            if ($RTEobj->ID == 'rte') {
                $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
                // SPECIAL: Setting style for the RTE <DIV> layer containing the IFRAME
            }
            // Fetching content of record:
            $trData = t3lib_div::makeInstance('t3lib_transferData');
            $trData->lockRecords = 1;
            $trData->fetchRecord($this->P['table'], $this->P['uid'], '');
            // Getting the processed record content out:
            reset($trData->regTableItems_data);
            $rec = current($trData->regTableItems_data);
            $rec['uid'] = $this->P['uid'];
            $rec['pid'] = $rawRec['pid'];
            // TSconfig, setting width:
            $fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
            if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) {
                $width = $fieldTSConfig['RTEfullScreenWidth'];
            } else {
                $width = '100%';
            }
            // Get the form field and wrap it in the table with the buttons:
            $formContent = $tceforms->getSoloField($this->P['table'], $rec, $this->P['field']);
            $formContent = '


			<!--
				RTE wizard:
			-->
				<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
					<tr>
						<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
						<td></td>
					</tr>
				</table>';
            // Adding hidden fields:
            $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
						<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . t3lib_TCEforms::getHiddenTokenField('tceAction');
            // Finally, add the whole setup:
            $this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions();
        } else {
            // ERROR:
            $this->content .= $this->doc->section($LANG->getLL('forms_title'), '<span class="typo3-red">' . $LANG->getLL('table_noData', 1) . '</span>', 0, 1);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage('');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
    /**
     * Renders Content Elements from the tt_content table from page id
     *
     * @param	integer		Page id
     * @return	string		HTML for the listing
     */
    function getTable_tt_content($id)
    {
        global $TCA;
        $this->initializeLanguages();
        // Initialize:
        $RTE = $GLOBALS['BE_USER']->isRTE();
        $lMarg = 1;
        $showHidden = $this->tt_contentConfig['showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content');
        $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(t3lib_BEfunc::getRecordTitle('pages', t3lib_BEfunc::getRecordWSOL('pages', $id), TRUE));
        $GLOBALS['SOBE']->doc->getPageRenderer()->loadExtJs();
        $GLOBALS['SOBE']->doc->getPageRenderer()->addJsFile($GLOBALS['BACK_PATH'] . 'sysext/cms/layout/js/typo3pageModule.js');
        // Get labels for CTypes and tt_content element fields in general:
        $this->CType_labels = array();
        foreach ($TCA['tt_content']['columns']['CType']['config']['items'] as $val) {
            $this->CType_labels[$val[1]] = $GLOBALS['LANG']->sL($val[0]);
        }
        $this->itemLabels = array();
        foreach ($TCA['tt_content']['columns'] as $name => $val) {
            $this->itemLabels[$name] = $GLOBALS['LANG']->sL($val['label']);
        }
        // Select display mode:
        if (!$this->tt_contentConfig['single']) {
            // MULTIPLE column display mode, side by side:
            // Setting language list:
            $langList = $this->tt_contentConfig['sys_language_uid'];
            if ($this->tt_contentConfig['languageMode']) {
                if ($this->tt_contentConfig['languageColsPointer']) {
                    $langList = '0,' . $this->tt_contentConfig['languageColsPointer'];
                } else {
                    $langList = implode(',', array_keys($this->tt_contentConfig['languageCols']));
                }
                $languageColumn = array();
            }
            $langListArr = explode(',', $langList);
            $defLanguageCount = array();
            $defLangBinding = array();
            // For EACH languages... :
            foreach ($langListArr as $lP) {
                // If NOT languageMode, then we'll only be through this once.
                $showLanguage = $this->defLangBinding && $lP == 0 ? ' AND sys_language_uid IN (0,-1)' : ' AND sys_language_uid=' . $lP;
                $cList = explode(',', $this->tt_contentConfig['cols']);
                $content = array();
                $head = array();
                // For EACH column, render the content into a variable:
                foreach ($cList as $key) {
                    if (!$lP) {
                        $defLanguageCount[$key] = array();
                    }
                    // Select content elements from this column/language:
                    $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage);
                    $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
                    // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script:
                    if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
                        $onClick = "window.location.href='db_new_content_el.php?id=" . $id . '&colPos=' . intval($key) . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';";
                        $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent'));
                        $content[$key] .= '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton;
                    }
                    // Traverse any selected elements and render their display code:
                    $rowArr = $this->getResult($result);
                    foreach ($rowArr as $rKey => $row) {
                        if (is_array($row) && (int) $row['t3ver_state'] != 2) {
                            $singleElementHTML = '';
                            if (!$lP) {
                                $defLanguageCount[$key][] = $row['uid'];
                            }
                            $editUidList .= $row['uid'] . ',';
                            $singleElementHTML .= $this->tt_content_drawHeader($row, $this->tt_contentConfig['showInfo'] ? 15 : 5, $this->defLangBinding && $lP > 0, TRUE);
                            $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext');
                            $singleElementHTML .= '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>' . $this->tt_content_drawItem($row, $isRTE) . '</div>';
                            // NOTE: this is the end tag for <div class="t3-page-ce-body">
                            // because of bad (historic) conception, starting tag has to be placed inside tt_content_drawHeader()
                            $singleElementHTML .= '</div>';
                            $statusHidden = $this->isDisabled('tt_content', $row) ? ' t3-page-ce-hidden' : '';
                            $singleElementHTML = '<div class="t3-page-ce' . $statusHidden . '">' . $singleElementHTML . '</div>';
                            if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) {
                                $defLangBinding[$key][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML;
                            } else {
                                $content[$key] .= $singleElementHTML;
                            }
                        } else {
                            unset($rowArr[$rKey]);
                        }
                    }
                    // Add new-icon link, header:
                    $newP = $this->newContentElementOnClick($id, $key, $lP);
                    $head[$key] .= $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key), $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '', $newP);
                    $editUidList = '';
                }
                // For EACH column, fit the rendered content into a table cell:
                $out = '';
                foreach ($cList as $k => $key) {
                    if (!$k) {
                        $out .= '
							<td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td>';
                    } else {
                        $out .= '
							<td><img src="clear.gif" width="4" height="1" alt="" /></td>
							<td bgcolor="#cfcfcf"><img src="clear.gif" width="1" height="1" alt="" /></td>
							<td><img src="clear.gif" width="4" height="1" alt="" /></td>';
                    }
                    $out .= '
							<td class="t3-page-column t3-page-column-' . $key . '">' . $head[$key] . $content[$key] . '</td>';
                    // Storing content for use if languageMode is set:
                    if ($this->tt_contentConfig['languageMode']) {
                        $languageColumn[$key][$lP] = $head[$key] . $content[$key];
                        if (!$this->defLangBinding) {
                            $languageColumn[$key][$lP] .= '<br /><br />' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP);
                        }
                    }
                }
                // Wrap the cells into a table row:
                $out = '
					<table border="0" cellpadding="0" cellspacing="0" class="t3-page-columns">
						<tr>' . $out . '
						</tr>
					</table>';
                // CSH:
                $out .= t3lib_BEfunc::cshItem($this->descrTable, 'columns_multi', $GLOBALS['BACK_PATH']);
            }
            // If language mode, then make another presentation:
            // Notice that THIS presentation will override the value of $out! But it needs the code above to execute since $languageColumn is filled with content we need!
            if ($this->tt_contentConfig['languageMode']) {
                // Get language selector:
                $languageSelector = $this->languageSelector($id);
                // Reset out - we will make new content here:
                $out = '';
                // Separator between language columns (black thin line)
                $midSep = '
						<td><img src="clear.gif" width="4" height="1" alt="" /></td>
						<td bgcolor="black"><img src="clear.gif" width="1" height="1" alt="" /></td>
						<td><img src="clear.gif" width="4" height="1" alt="" /></td>';
                // Traverse languages found on the page and build up the table displaying them side by side:
                $cCont = array();
                $sCont = array();
                foreach ($langListArr as $lP) {
                    // Header:
                    $cCont[$lP] = '
						<td valign="top" align="center" class="bgColor6"><strong>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</strong></td>';
                    // "View page" icon is added:
                    $viewLink = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewOnClick($this->id, $this->backPath, t3lib_BEfunc::BEgetRootLine($this->id), '', '', '&L=' . $lP)) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
                    // Language overlay page header:
                    if ($lP) {
                        list($lpRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($lP));
                        t3lib_BEfunc::workspaceOL('pages_language_overlay', $lpRecord);
                        $params = '&edit[pages_language_overlay][' . $lpRecord['uid'] . ']=edit&overrideVals[pages_language_overlay][sys_language_uid]=' . $lP;
                        $lPLabel = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon(t3lib_iconWorks::getSpriteIconForRecord('pages_language_overlay', $lpRecord), $lpRecord['uid']) . $viewLink . ($GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay') ? '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>' : '') . htmlspecialchars(t3lib_div::fixed_lgd_cs($lpRecord['title'], 20));
                    } else {
                        $lPLabel = $viewLink;
                    }
                    $sCont[$lP] = '
						<td nowrap="nowrap">' . $lPLabel . '</td>';
                }
                // Add headers:
                $out .= '
					<tr class="bgColor5">' . implode($midSep, $cCont) . '
					</tr>';
                $out .= '
					<tr class="bgColor5">' . implode($midSep, $sCont) . '
					</tr>';
                // Traverse previously built content for the columns:
                foreach ($languageColumn as $cKey => $cCont) {
                    $out .= '
					<tr>
						<td valign="top">' . implode('</td>' . $midSep . '
						<td valign="top">', $cCont) . '</td>
					</tr>';
                    if ($this->defLangBinding) {
                        // "defLangBinding" mode
                        foreach ($defLanguageCount[$cKey] as $defUid) {
                            $cCont = array();
                            foreach ($langListArr as $lP) {
                                $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . '<br/>' . $this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid), $id, $lP), $lP);
                            }
                            $out .= '
							<tr>
								<td valign="top">' . implode('</td>' . $midSep . '
								<td valign="top">', $cCont) . '</td>
							</tr>';
                        }
                        // Create spacer:
                        $cCont = array();
                        foreach ($langListArr as $lP) {
                            $cCont[] = '&nbsp;';
                        }
                        $out .= '
						<tr>
							<td valign="top">' . implode('</td>' . $midSep . '
							<td valign="top">', $cCont) . '</td>
						</tr>';
                    }
                }
                // Finally, wrap it all in a table and add the language selector on top of it:
                $out = $languageSelector . '
					<table border="0" cellpadding="0" cellspacing="0" width="480" class="typo3-page-langMode">
						' . $out . '
					</table>';
                // CSH:
                $out .= t3lib_BEfunc::cshItem($this->descrTable, 'language_list', $GLOBALS['BACK_PATH']);
            }
        } else {
            // SINGLE column mode (columns shown beneath each other):
            #debug('single column');
            if ($this->tt_contentConfig['sys_language_uid'] == 0 || !$this->defLangBinding) {
                // Initialize:
                if ($this->defLangBinding && $this->tt_contentConfig['sys_language_uid'] == 0) {
                    $showLanguage = ' AND sys_language_uid IN (0,-1)';
                    $lP = 0;
                } else {
                    $showLanguage = ' AND sys_language_uid=' . $this->tt_contentConfig['sys_language_uid'];
                    $lP = $this->tt_contentConfig['sys_language_uid'];
                }
                $cList = explode(',', $this->tt_contentConfig['showSingleCol']);
                $content = array();
                $out = '';
                // Expand the table to some preset dimensions:
                $out .= '
					<tr>
						<td><img src="clear.gif" width="' . $lMarg . '" height="1" alt="" /></td>
						<td valign="top"><img src="clear.gif" width="150" height="1" alt="" /></td>
						<td><img src="clear.gif" width="10" height="1" alt="" /></td>
						<td valign="top"><img src="clear.gif" width="300" height="1" alt="" /></td>
					</tr>';
                // Traverse columns to display top-on-top
                foreach ($cList as $counter => $key) {
                    // Select content elements:
                    $queryParts = $this->makeQueryArray('tt_content', $id, 'AND colPos=' . intval($key) . $showHidden . $showLanguage);
                    $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
                    $c = 0;
                    $rowArr = $this->getResult($result);
                    $rowOut = '';
                    // If it turns out that there are not content elements in the column, then display a big button which links directly to the wizard script:
                    if ($this->doEdit && $this->option_showBigButtons && !intval($key) && !$GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
                        $onClick = "window.location.href='db_new_content_el.php?id=" . $id . '&colPos=' . intval($key) . '&sys_language_uid=' . $lP . '&uid_pid=' . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';";
                        $theNewButton = $GLOBALS['SOBE']->doc->t3Button($onClick, $GLOBALS['LANG']->getLL('newPageContent'));
                        $theNewButton = '<img src="clear.gif" width="1" height="5" alt="" /><br />' . $theNewButton;
                    } else {
                        $theNewButton = '';
                    }
                    // Traverse any selected elements:
                    foreach ($rowArr as $rKey => $row) {
                        if (is_array($row) && (int) $row['t3ver_state'] != 2) {
                            $c++;
                            $editUidList .= $row['uid'] . ',';
                            $isRTE = $RTE && $this->isRTEforField('tt_content', $row, 'bodytext');
                            // Create row output:
                            $rowOut .= '
								<tr>
									<td></td>
									<td valign="top">' . $this->tt_content_drawHeader($row) . '</td>
									<td>&nbsp;</td>
									<td' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . ' valign="top">' . $this->tt_content_drawItem($row, $isRTE) . '</td>
								</tr>';
                            // If the element was not the last element, add a divider line:
                            if ($c != $GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
                                $rowOut .= '
								<tr>
									<td></td>
									<td colspan="3"><img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/stiblet_medium2.gif', 'width="468" height="1"') . ' class="c-divider" alt="" /></td>
								</tr>';
                            }
                        } else {
                            unset($rowArr[$rKey]);
                        }
                    }
                    // Add spacer between sections in the vertical list
                    if ($counter) {
                        $out .= '
							<tr>
								<td></td>
								<td colspan="3"><br /><br /><br /><br /></td>
							</tr>';
                    }
                    // Add section header:
                    $newP = $this->newContentElementOnClick($id, $key, $this->tt_contentConfig['sys_language_uid']);
                    $out .= '

						<!-- Column header: -->
						<tr>
							<td></td>
							<td valign="top" colspan="3">' . $this->tt_content_drawColHeader(t3lib_BEfunc::getProcessedValue('tt_content', 'colPos', $key), $this->doEdit && count($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '', $newP) . $theNewButton . '<br /></td>
						</tr>';
                    // Finally, add the content from the records in this column:
                    $out .= $rowOut;
                }
                // Finally, wrap all table rows in one, big table:
                $out = '
					<table border="0" cellpadding="0" cellspacing="0" width="400" class="typo3-page-columnsMode">
						' . $out . '
					</table>';
                // CSH:
                $out .= t3lib_BEfunc::cshItem($this->descrTable, 'columns_single', $GLOBALS['BACK_PATH']);
            } else {
                $out = '<br/><br/>' . $GLOBALS['SOBE']->doc->icons(1) . 'Sorry, you cannot view a single language in this localization mode (Default Language Binding is enabled)<br/><br/>';
            }
        }
        // Add the big buttons to page:
        if ($this->option_showBigButtons) {
            $bArray = array();
            if (!$GLOBALS['SOBE']->current_sys_language) {
                if ($this->ext_CALC_PERMS & 2) {
                    $bArray[0] = $GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages][' . $id . "]=edit", $this->backPath, ''), $GLOBALS['LANG']->getLL('editPageProperties'));
                }
            } else {
                if ($this->doEdit && $GLOBALS['BE_USER']->check('tables_modify', 'pages_language_overlay')) {
                    list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . intval($GLOBALS['SOBE']->current_sys_language));
                    $bArray[0] = $GLOBALS['SOBE']->doc->t3Button(t3lib_BEfunc::editOnClick('&edit[pages_language_overlay][' . $languageOverlayRecord['uid'] . "]=edit", $this->backPath, ''), $GLOBALS['LANG']->getLL('editPageProperties_curLang'));
                }
            }
            if ($this->ext_CALC_PERMS & 4 || $this->ext_CALC_PERMS & 2) {
                $bArray[1] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='" . $this->backPath . "move_el.php?table=pages&uid=" . $id . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('move_page'));
            }
            if ($this->ext_CALC_PERMS & 8) {
                $bArray[2] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='" . $this->backPath . "db_new.php?id=" . $id . '&pagesOnly=1&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('newPage2'));
            }
            if ($this->doEdit && $this->ext_function == 1) {
                $bArray[3] = $GLOBALS['SOBE']->doc->t3Button("window.location.href='db_new_content_el.php?id=" . $id . '&sys_language_uid=' . $GLOBALS['SOBE']->current_sys_language . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . "';", $GLOBALS['LANG']->getLL('newPageContent2'));
            }
            $out = '
				<table border="0" cellpadding="4" cellspacing="0" class="typo3-page-buttons">
					<tr>
						<td>' . implode('</td>
						<td>', $bArray) . '</td>
						<td>' . t3lib_BEfunc::cshItem($this->descrTable, 'button_panel', $GLOBALS['BACK_PATH']) . '</td>
					</tr>
				</table>
				<br />
				' . $out;
        }
        // Return content:
        return $out;
    }
예제 #25
0
 /**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return	array		all available buttons as an assoc. array
  */
 protected function getButtons()
 {
     $buttons = array('csh' => '', 'view' => '', 'record_list' => '', 'shortcut' => '');
     // CSH
     $buttons['csh'] = t3lib_BEfunc::cshItem('_MOD_web_info', '', $GLOBALS['BACK_PATH'], '', TRUE);
     // View page
     $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::viewonclick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], t3lib_BEfunc::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showPage', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-view') . '</a>';
     // Shortcut
     if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
         $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
     }
     // If access to Web>List for user, then link to that module.
     if ($GLOBALS['BE_USER']->check('modules', 'web_list')) {
         $href = $GLOBALS['BACK_PATH'] . 'db_list.php?id=' . $this->pageinfo['uid'] . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
         $buttons['record_list'] = '<a href="' . htmlspecialchars($href) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.showList', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-list-open') . '</a>';
     }
     return $buttons;
 }
예제 #26
0
 function getConfigurationsForBranch($rootid, $depth)
 {
     $configurationsForBranch = array();
     $pageTSconfig = $this->getPageTSconfigForId($rootid);
     if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'])) {
         $sets = $pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'];
         if (is_array($sets)) {
             foreach ($sets as $key => $value) {
                 if (!is_array($value)) {
                     continue;
                 }
                 $configurationsForBranch[] = substr($key, -1) == '.' ? substr($key, 0, -1) : $key;
             }
         }
     }
     $pids = array();
     $rootLine = t3lib_BEfunc::BEgetRootLine($rootid);
     foreach ($rootLine as $node) {
         $pids[] = $node['uid'];
     }
     /* @var t3lib_pageTree */
     $tree = t3lib_div::makeInstance('t3lib_pageTree');
     $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
     $tree->init('AND ' . $perms_clause);
     $tree->getTree($rootid, $depth, '');
     foreach ($tree->tree as $node) {
         $pids[] = $node['row']['uid'];
     }
     $res = $this->db->exec_SELECTquery('*', 'tx_crawler_configuration', 'pid IN (' . implode(',', $pids) . ') ' . t3lib_BEfunc::BEenableFields('tx_crawler_configuration') . t3lib_BEfunc::deleteClause('tx_crawler_configuration') . ' ' . t3lib_BEfunc::versioningPlaceholderClause('tx_crawler_configuration') . ' ');
     while ($row = $this->db->sql_fetch_assoc($res)) {
         $configurationsForBranch[] = $row['name'];
     }
     $this->db->sql_free_result($res);
     return $configurationsForBranch;
 }
 /**
  * Fetches RealURl configuration for the given page
  *
  * @param int $pageId
  * @return void
  */
 protected function fetchRealURLConfiguration($pageId)
 {
     $rootLine = t3lib_BEfunc::BEgetRootLine($pageId);
     $rootPageId = $rootLine[1]['uid'];
     $this->config = array();
     if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl'] as $config) {
             if (is_array($config) && $config['pagePath']['rootpage_id'] == $rootPageId) {
                 $this->config = $config;
                 return;
             }
         }
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'])) {
             $this->config = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']['_DEFAULT'];
         }
     } else {
         t3lib_div::sysLog('RealURL is not configured! Please, configure it or uninstall.', 'RealURL', 3);
     }
 }
 /**
  * @param int $uid
  * @param string $clause
  * @param boolean $workspaceOL
  * @return array
  */
 public function BEgetRootLine($uid, $clause = '', $workspaceOL = FALSE)
 {
     return t3lib_BEfunc::BEgetRootLine($uid, $clause, $workspaceOL);
 }
 /**
  * Determines the rootline for the current page.
  *
  * @return	array		The rootline for the current page.
  */
 protected function determineRootline()
 {
     $pageId = isset($this->pageId) ? $this->pageId : $this->determinePageId();
     $rootline = t3lib_BEfunc::BEgetRootLine($pageId, '', TRUE);
     return $rootline;
 }
 /**
  * Check if a page is inside the rootline the current user can see
  *
  * @param	int		$pageId: Id of the the page to be checked
  * @return boolean	Access to the page
  */
 protected function checkRootline($pageId)
 {
     $access = FALSE;
     $dbMounts = array_flip(explode(',', trim($GLOBALS['BE_USER']->dataLists['webmount_list'], ',')));
     $rootline = t3lib_BEfunc::BEgetRootLine($pageId);
     foreach ($rootline as $page) {
         if (isset($dbMounts[$page['uid']]) && !$access) {
             $access = TRUE;
         }
     }
     return $access;
 }