/**
  * Registering incoming data
  *
  * @return	void
  */
 public function init()
 {
     // set the GPvars from outside
     $this->file = t3lib_div::_GP('file');
     $this->CB = t3lib_div::_GP('CB');
     $this->overwriteExistingFiles = t3lib_div::_GP('overwriteExistingFiles');
     $this->vC = t3lib_div::_GP('vC');
     $this->redirect = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('redirect'));
     $this->initClipboard();
 }
示例#2
0
 /**
  * Performs the logout processing
  *
  * @return	void
  */
 function logout()
 {
     global $BE_USER;
     $BE_USER->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($BE_USER->user['username']));
     // Logout written to log
     $BE_USER->logoff();
     $redirect = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('redirect'));
     $redirectUrl = $redirect ? $redirect : 'index.php';
     t3lib_utility_Http::redirect($redirectUrl);
 }
    /**
     * Creates the header and frameset for the module/submodules
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $TBE_TEMPLATE, $TBE_STYLES;
        // GPvars:
        $this->exScript = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('exScript'));
        $this->id = intval(t3lib_div::_GP('id'));
        $this->fW = t3lib_div::_GP('fW');
        // Setting resizing flag:
        $this->resizable = $BE_USER->uc['navFrameResizable'] ? TRUE : FALSE;
        // Setting frame width:
        if (intval($this->fW) && $this->resizable) {
            // Framewidth from stored value, last one.
            $width = t3lib_div::intInRange($this->fW, 100, 1000) + 10;
            // +10 to compensate for width of scrollbar. However, width is always INSIDE scrollbars, so potentially it will jump a little forth/back...
        } else {
            //	Framewidth from configuration;
            $width = $BE_USER->uc['navFrameWidth'];
            $width = intval($width) ? intval($width) : ($TBE_STYLES['dims']['navFrameWidth'] ? intval($TBE_STYLES['dims']['navFrameWidth']) : $this->defaultWidth);
        }
        // Navigation frame URL:
        $script = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('script'));
        $nav = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('nav'));
        $URL_nav = htmlspecialchars($nav . '&currentSubScript=' . rawurlencode($script));
        // List frame URL:
        $URL_list = htmlspecialchars($this->exScript ? $this->exScript : $script . ($this->id ? (strpos($script, '?') ? '&' : '?') . 'id=' . rawurlencode($this->id) : ''));
        // Start page output
        $TBE_TEMPLATE->docType = 'xhtml_frames';
        $this->content = $TBE_TEMPLATE->startPage('Frameset');
        if ($this->resizable) {
            $this->content .= '
	<frameset id="typo3-content-frameset" cols="' . $width . ',*">
		<frame name="nav_frame" src="' . $URL_nav . '" marginwidth="0" marginheight="0" scrolling="auto" />
		<frame name="list_frame" src="' . $URL_list . '" marginwidth="0" marginheight="0" scrolling="auto" />
	</frameset>

</html>
';
        } else {
            $this->content .= '

	<frameset id="typo3-content-frameset" cols="' . $width . ',8,*" framespacing="0" frameborder="0" border="0">
		<frame name="nav_frame" src="' . $URL_nav . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
		<frame name="border_frame" src="' . (isset($GLOBALS['TBE_STYLES']['border']) ? $GLOBALS['TBE_STYLES']['border'] : 'border.html') . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
		<frame name="list_frame" src="' . $URL_list . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
	</frameset>

</html>
';
        }
    }
示例#4
0
 /**
  * Constructor, initializing internal variables.
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $LANG, $BACK_PATH;
     // Setting internal vars:
     $this->sys_language = intval(t3lib_div::_GP('sys_language'));
     $this->page_id = intval(t3lib_div::_GP('uid'));
     $this->table = t3lib_div::_GP('table');
     $this->R_URI = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
     $this->input_moveUid = t3lib_div::_GP('moveUid');
     $this->moveUid = $this->input_moveUid ? $this->input_moveUid : $this->page_id;
     $this->makeCopy = t3lib_div::_GP('makeCopy');
     // Select-pages where clause for read-access:
     $this->perms_clause = $BE_USER->getPagePermsClause(1);
     // Starting the document template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $BACK_PATH;
     $this->doc->setModuleTemplate('templates/move_el.html');
     $this->doc->JScode = '';
     // Starting document content (header):
     $this->content = '';
     $this->content .= $this->doc->header($LANG->getLL('movingElement'));
     $this->content .= $this->doc->spacer(5);
 }
示例#5
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('close' => '', 'save' => '', 'save_view' => '', 'save_close' => '', 'shortcut' => '', 'undo' => '');
     if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
         $closeUrl = t3lib_div::sanitizeLocalUrl($this->P['returnUrl']);
         // Getting settings for the undo button:
         $undoButton = 0;
         $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->P['table'], 'sys_history') . ' AND recuid=' . intval($this->P['uid']), '', 'tstamp DESC', '1');
         if ($undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
             $undoButton = 1;
         }
         // Close
         $buttons['close'] = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(unescape(\'' . rawurlencode($closeUrl) . '\')); return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/closedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.closeDoc', 1) . '" alt="" />' . '</a>';
         // Save
         $buttons['save'] = '<a href="#" onclick="TBE_EDITOR.checkAndDoSubmit(1); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedok.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDoc', 1) . '" alt="" />' . '</a>';
         // Save & View
         if (t3lib_extMgm::isLoaded('cms')) {
             $buttons['save_view'] = '<a href="#" onclick="' . htmlspecialchars('document.editform.redirect.value+=\'&popView=1\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/savedokshow.gif') . ' class="c-inputButton" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveDocShow', 1) . '" alt="" />' . '</a>';
         }
         // Save & Close
         $buttons['save_close'] = '<input type="image" class="c-inputButton" onclick="' . htmlspecialchars('document.editform.redirect.value=\'' . $closeUrl . '\'; TBE_EDITOR.checkAndDoSubmit(1); return false;') . '" name="_saveandclosedok"' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/saveandclosedok.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.saveCloseDoc', 1) . '" />';
         // Undo/Revert:
         if ($undoButton) {
             $buttons['undo'] = '<a href="#" onclick="' . htmlspecialchars('window.location.href=\'show_rechis.php?element=' . rawurlencode($this->P['table'] . ':' . $this->P['uid']) . '&revert=' . rawurlencode('field:' . $this->P['field']) . '&sumUp=-1&returnUrl=' . rawurlencode($this->R_URI) . '\'; return false;') . '">' . '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/undo.gif') . ' class="c-inputButton" title="' . htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('rte_undoLastChange'), t3lib_BEfunc::calcAge($GLOBALS['EXEC_TIME'] - $undoButtonR['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.minutesHoursDaysYears')))) . '" alt="" />' . '</a>';
         }
         // Shortcut
         if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
             $buttons['shortcut'] = $this->doc->makeShortcutIcon('P', '', $this->MCONF['name'], 1);
         }
     }
     return $buttons;
 }
示例#6
0
 /**
  * Redirects to alt_doc with new parameters to edit a just created localized record
  *
  * @param	string		String passed by GET &justLocalized=
  * @return	void
  */
 function localizationRedirect($justLocalized)
 {
     global $TCA;
     list($table, $orig_uid, $language) = explode(':', $justLocalized);
     if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
         $localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid', $table, $TCA[$table]['ctrl']['languageField'] . '=' . intval($language) . ' AND ' . $TCA[$table]['ctrl']['transOrigPointerField'] . '=' . intval($orig_uid) . t3lib_BEfunc::deleteClause($table) . t3lib_BEfunc::versioningPlaceholderClause($table));
         if (is_array($localizedRecord)) {
             // Create parameters and finally run the classic page module for creating a new page translation
             $params = '&edit[' . $table . '][' . $localizedRecord['uid'] . ']=edit';
             $returnUrl = '&returnUrl=' . rawurlencode(t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl')));
             $location = $GLOBALS['BACK_PATH'] . 'alt_doc.php?' . $params . $returnUrl . t3lib_BEfunc::getUrlToken('editRecord');
             t3lib_utility_Http::redirect($location);
         }
     }
 }
示例#7
0
	/**
	 * Main function of the MODULE. Write the content to $this->content
	 * There are three main modes:
	 * - Based on a file reference, creating/modifying a DS/TO
	 * - Based on a Template Object uid, remapping
	 * - Based on a Data Structure uid, selecting a Template Object to map.
	 *
	 * @return	void
	 */
	function main_mode()	{
		global $LANG, $BACK_PATH;

		$this->doc = t3lib_div::makeInstance('template');
		$this->doc->docType= 'xhtml_trans';
		$this->doc->backPath = $BACK_PATH;
		$this->doc->setModuleTemplate('EXT:templavoila/resources/templates/cm1_default.html');
		$this->doc->bodyTagId = 'typo3-mod-php';
		$this->doc->divClass = '';

		$this->doc->inDocStylesArray[]='
			#templavoila-frame-visual { height:500px; display:block; margin:0 5px; width:98%; border: 1xpx solid black;}
			DIV.typo3-fullDoc H2 { width: 100%; }
			TABLE#c-mapInfo {margin-top: 10px; margin-bottom: 5px; }
			TABLE#c-mapInfo TR TD {padding-right: 20px;}
			select option.pagetemplate {background-image:url(../icon_pagetemplate.gif);background-repeat: no-repeat; background-position: 5px 50%; padding: 1px 0 3px 24px; -webkit-background-size: 0;}
			select option.fce {background-image:url(../icon_fce_ce.png);background-repeat: no-repeat; background-position: 5px 50%; padding: 1px 0 3px 24px; -webkit-background-size: 0;}
			#c-toMenu { margin-bottom:10px; }
		';
		$this->doc->inDocStylesArray[] = self::$gnyfStyleBlock;

			// Add custom styles
		$this->doc->styleSheetFile2 = t3lib_extMgm::extRelPath($this->extKey)."cm1/styles.css";

			// General GPvars for module mode:
		$this->displayFile = tx_templavoila_file::filename(t3lib_div::_GP('file'));
		$this->displayTable = t3lib_div::_GP('table');
		$this->displayUid = t3lib_div::_GP('uid');
		$this->displayPath = t3lib_div::_GP('htmlPath');
		$this->returnUrl =  t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));

			// GPvars specific to the DS listing/table and mapping features:
		$this->_preview = t3lib_div::_GP('_preview');
		$this->mapElPath = t3lib_div::_GP('mapElPath');
		$this->doMappingOfPath = t3lib_div::_GP('doMappingOfPath');
		$this->showPathOnly = t3lib_div::_GP('showPathOnly');
		$this->mappingToTags = t3lib_div::_GP('mappingToTags');
		$this->DS_element = t3lib_div::_GP('DS_element');
		$this->DS_cmd = t3lib_div::_GP('DS_cmd');
		$this->fieldName = t3lib_div::_GP('fieldName');

			// GPvars specific for DS creation from a file.
		$this->_load_ds_xml_content = t3lib_div::_GP('_load_ds_xml_content');
		$this->_load_ds_xml_to = t3lib_div::_GP('_load_ds_xml_to');
		$this->_saveDSandTO_TOuid = t3lib_div::_GP('_saveDSandTO_TOuid');
		$this->_saveDSandTO_title = t3lib_div::_GP('_saveDSandTO_title');
		$this->_saveDSandTO_type = t3lib_div::_GP('_saveDSandTO_type');
		$this->_saveDSandTO_pid = t3lib_div::_GP('_saveDSandTO_pid');
		$this->DS_element_DELETE = t3lib_div::_GP('DS_element_DELETE');

			// Finding Storage folder:
		$this->findingStorageFolderIds();

			// Setting up form-wrapper:
		$this->doc->form='<form action="'.$this->linkThisScript(array()).'" method="post" name="pageform">';

			// JavaScript
		$this->doc->JScode.= $this->doc->wrapScriptTags('
			script_ended = 0;
			function jumpToUrl(URL)	{	//
				document.location = URL;
			}
			function updPath(inPath)	{	//
				document.location = "'.t3lib_div::linkThisScript(array('htmlPath'=>'','doMappingOfPath'=>1)).'&htmlPath="+top.rawurlencode(inPath);
			}

			function openValidator(key) {
				new Ajax.Request("' . $GLOBALS['BACK_PATH'] . 'ajax.php?ajaxID=tx_templavoila_cm1_ajax::getDisplayFileContent&key=" + key, {
					onSuccess: function(response) {
						var valform = new Element(\'form\',{method: \'post\', target:\'_blank\', action: \'http://validator.w3.org/check#validate_by_input\'});
						valform.insert(new Element(\'input\',{name: \'fragment\', value:response.responseText, type: \'hidden\'}));$(document.body).insert(valform);
						valform.submit();
					}
				});
			}
		');

		if(tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000) {
			$this->doc->getDynTabMenuJScode();
		} else {
			$this->doc->loadJavascriptLib('js/tabmenu.js');
		}

			// Setting up the context sensitive menu:
		$CMparts = $this->doc->getContextMenuCode();
		$this->doc->bodyTagAdditions = $CMparts[1];
		$this->doc->JScode.=$CMparts[0];
		$this->doc->postCode.= $CMparts[2];

			// Icons
		$this->dsTypes = array(
			'sc' => $LANG->getLL('dsTypes_section') . ': ',
			'co' => $LANG->getLL('dsTypes_container') . ': ',
			'el' => $LANG->getLL('dsTypes_attribute') . ': ',
			'at' => $LANG->getLL('dsTypes_element') . ': ',
			'no' => $LANG->getLL('dsTypes_notmapped') . 'Not : ');
		foreach ($this->dsTypes as $id => $title) {
			$this->dsTypes[$id] = array(
					// abbrevation
				$id,
					// descriptive title
				$title,
					// image-path
				t3lib_iconWorks::skinImg($this->doc->backPath,t3lib_extMgm::extRelPath('templavoila').'cm1/item_'.$id.'.gif','width="24" height="16" border="0" style="margin-right: 5px;"'),
					// background-path
				t3lib_iconWorks::skinImg($this->doc->backPath,t3lib_extMgm::extRelPath('templavoila').'cm1/item_'.$id.'.gif','',1)
			);

				// information
			$this->dsTypes[$id][4] = @getimagesize($this->dsTypes[$id][3]);
		}

			// Render content, depending on input values:
		if ($this->displayFile)	{	// Browsing file directly, possibly creating a template/data object records.
			$this->renderFile();
		} elseif ($this->displayTable=='tx_templavoila_datastructure') {	// Data source display
			$this->renderDSO();
		} elseif ($this->displayTable=='tx_templavoila_tmplobj') {	// Data source display
			$this->renderTO();
		}

			// Add spacer:
		$this->content.=$this->doc->spacer(10);

		$this->pageinfo = t3lib_BEfunc::readPageAccess($this->id,$this->perms_clause);
		$docHeaderButtons = $this->getDocHeaderButtons();
		$docContent = array(
			'CSH' => $docHeaderButtons['csh'],
			'CONTENT' => $this->content
		);

		$content  = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
		$content .= $this->doc->moduleBody(
			$this->pageinfo,
			$docHeaderButtons,
			$docContent
		);
		$content .= $this->doc->endPage();

			// Replace content with templated content
		$this->content = $content;
	}
    /**
     * Constructor function for class
     *
     * @return	void
     */
    function init()
    {
        global $LANG, $BACK_PATH, $TYPO3_CONF_VARS;
        // Initialize GPvars:
        $this->number = t3lib_div::_GP('number');
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $TYPO3_CONF_VARS['BE']['fileExtensions']);
        // Init basic-charset-functions object:
        $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
        // Cleaning and checking target
        $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
        $this->target = $this->basicff->is_directory($this->target);
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
            throw new RuntimeException($title . ': ' . $message);
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_newfolder.html');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

			function reload(a)	{	//
				if (!changed || (changed && confirm(' . $LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . ')))	{
					var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . urlencode($this->charsetConversion->conv($this->returnUrl, $GLOBALS['LANG']->charSet, 'utf-8')) . '";
					window.location.href = "file_newfolder.php?"+params;
				}
			}
			function backToList()	{	//
				top.goToModule("file_list");
			}

			var changed = 0;
		');
    }
示例#9
0
 /**
  * Main function
  * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
  *
  * @return	void
  */
 function main()
 {
     // Get this record
     $origRow = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
     // Get TSconfig for it.
     $TSconfig = t3lib_BEfunc::getTCEFORM_TSconfig($this->table, is_array($origRow) ? $origRow : array('pid' => $this->P['pid']));
     // Set [params][pid]
     if (substr($this->P['params']['pid'], 0, 3) == '###' && substr($this->P['params']['pid'], -3) == '###') {
         $this->pid = intval($TSconfig['_' . substr($this->P['params']['pid'], 3, -3)]);
     } else {
         $this->pid = intval($this->P['params']['pid']);
     }
     // Make redirect:
     if (!strcmp($this->pid, '') || strcmp($this->id, '')) {
         // If pid is blank OR if id is set, then return...
         $redirectUrl = t3lib_div::sanitizeLocalUrl($this->P['returnUrl']);
     } else {
         // Otherwise, show the list:
         $urlParameters = array();
         $urlParameters['id'] = $this->pid;
         $urlParameters['table'] = $this->P['params']['table'];
         $urlParameters['returnUrl'] = t3lib_div::getIndpEnv('REQUEST_URI');
         $redirectUrl = t3lib_BEfunc::getModuleUrl('web_list', $urlParameters);
     }
     t3lib_utility_Http::redirect($redirectUrl);
 }
 /**
  * Tests whether valid local URLs are handled correctly.
  * @dataProvider	invalidLocalUrlDataProvider
  * @test
  */
 public function sanitizeLocalUrlDeniesEncodedInvalidUrls($url)
 {
     $this->assertEquals('', t3lib_div::sanitizeLocalUrl(rawurlencode($url)));
 }
示例#11
0
    /**
     * Rendering the overview of versions in the current workspace
     *
     * @return	string		HTML (table)
     * @see ws/index.php for sister function!
     */
    function displayWorkspaceOverview()
    {
        // Initialize variables:
        $this->showWorkspaceCol = $GLOBALS['BE_USER']->workspace === 0 && $this->MOD_SETTINGS['display'] <= -98;
        // Get usernames and groupnames
        $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
        $groupArray = array_keys($be_group_Array);
        $this->be_user_Array = t3lib_BEfunc::getUserNames();
        if (!$GLOBALS['BE_USER']->isAdmin()) {
            $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1);
        }
        // Initialize Workspace ID and filter-value:
        if ($GLOBALS['BE_USER']->workspace === 0) {
            $wsid = $this->details ? -99 : $this->MOD_SETTINGS['display'];
            // Set wsid to the value from the menu (displaying content of other workspaces)
            $filter = $this->details ? 0 : $this->MOD_SETTINGS['filter'];
        } else {
            $wsid = $GLOBALS['BE_USER']->workspace;
            $filter = 0;
        }
        // Initialize workspace object and request all pending versions:
        $wslibObj = t3lib_div::makeInstance('wslib');
        // Selecting ALL versions belonging to the workspace:
        $versions = $wslibObj->selectVersionsInWorkspace($wsid, $filter, -99, $this->uid);
        // $this->uid is the page id of LIVE record.
        // Traverse versions and build page-display array:
        $pArray = array();
        foreach ($versions as $table => $records) {
            foreach ($records as $rec) {
                $pageIdField = $table === 'pages' ? 't3ver_oid' : 'realpid';
                $this->displayWorkspaceOverview_setInPageArray($pArray, $table, $rec);
            }
        }
        // Make header of overview:
        $tableRows = array();
        if (count($pArray)) {
            $tableRows[] = '
				<tr class="bgColor5 tableheader">
					' . ($this->diffOnly ? '' : '<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('liveVersion') . '</td>') . '
					<td nowrap="nowrap" colspan="2">' . $GLOBALS['LANG']->getLL('wsVersions') . '</td>
					<td nowrap="nowrap"' . ($this->diffOnly ? ' colspan="2"' : ' colspan="4"') . '>' . $GLOBALS['LANG']->getLL('controls') . '</td>
				</tr>';
            // Add lines from overview:
            $tableRows = array_merge($tableRows, $this->displayWorkspaceOverview_list($pArray));
            $table = '<table border="0" cellpadding="0" cellspacing="1" class="lrPadding workspace-overview">' . implode('', $tableRows) . '</table>';
        } else {
            $table = '';
        }
        $returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
        $linkBack = t3lib_div::_GP('returnUrl') ? '<a href="' . htmlspecialchars($returnUrl) . '" class="typo3-goBack">' . t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . $GLOBALS['LANG']->getLL('goBack', TRUE) . '</a><br /><br />' : '';
        $resetDiffOnly = $this->diffOnly ? '<a href="index.php?id=' . intval($this->id) . '" class="typo3-goBack">' . $GLOBALS['LANG']->getLL('showAllInformation') . '</a><br /><br />' : '';
        $versionSelector = $GLOBALS['BE_USER']->workspace ? $this->doc->getVersionSelector($this->id) : '';
        return $versionSelector . $linkBack . $resetDiffOnly . $table . $this->markupNewOriginals();
    }
示例#12
0
 /**
  * Initialize the login box. Will also react on a &L=OUT flag and exit.
  *
  * @return	void
  */
 function init()
 {
     // We need a PHP session session for most login levels
     session_start();
     $this->redirect_url = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('redirect_url'));
     $this->GPinterface = t3lib_div::_GP('interface');
     // Grabbing preset username and password, for security reasons this feature only works if SSL is used
     if (t3lib_div::getIndpEnv('TYPO3_SSL')) {
         $this->u = t3lib_div::_GP('u');
         $this->p = t3lib_div::_GP('p');
     }
     // If "L" is "OUT", then any logged in is logged out. If redirect_url is given, we redirect to it
     $this->L = t3lib_div::_GP('L');
     // Login
     $this->loginRefresh = t3lib_div::_GP('loginRefresh');
     // Value of "Login" button. If set, the login button was pressed.
     $this->commandLI = t3lib_div::_GP('commandLI');
     // sets the level of security from conf vars
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel']) {
         $this->loginSecurityLevel = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginSecurityLevel'];
     }
     // try to get the preferred browser language
     $preferredBrowserLanguage = $GLOBALS['LANG']->csConvObj->getPreferredClientLanguage(t3lib_div::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
     // if we found a $preferredBrowserLanguage and it is not the default language and no be_user is logged in
     // initialize $GLOBALS['LANG'] again with $preferredBrowserLanguage
     if ($preferredBrowserLanguage != 'default' && !$GLOBALS['BE_USER']->user['uid']) {
         $GLOBALS['LANG']->init($preferredBrowserLanguage);
     }
     $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_login.xml');
     // check if labels from $GLOBALS['TYPO3_CONF_VARS']['BE']['loginLabels'] were changed,
     // and merge them to $GLOBALS['LOCAL_LANG'] if needed
     $this->mergeOldLoginLabels();
     // Setting the redirect URL to "backend.php" if no alternative input is given
     $this->redirectToURL = $this->redirect_url ? $this->redirect_url : 'backend.php';
     // Do a logout if the command is set
     if ($this->L == 'OUT' && is_object($GLOBALS['BE_USER'])) {
         $GLOBALS['BE_USER']->logoff();
         if ($this->redirect_url) {
             t3lib_utility_Http::redirect($this->redirect_url);
         }
         exit;
     }
 }
示例#13
0
    /**
     * Outputs a screen from where you can install multiple extensions in one go
     * This can be called from external modules with "...index.php?CMD[requestInstallExtensions]=
     *
     * @param	string		Comma list of extension keys to install. Renders a screen with checkboxes for all extensions not already imported or installed
     * @return	void
     */
    function requestInstallExtensions($extList)
    {
        // Return URL:
        $returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
        $installOrImportExtension = t3lib_div::_POST('installOrImportExtension');
        // Extension List:
        $extArray = explode(',', $extList);
        $outputRow = array();
        $outputRow[] = '
			<tr class="t3-row-header tableheader">
				<td>' . $GLOBALS['LANG']->getLL('reqInstExt_install_import') . '</td>
				<td>' . $GLOBALS['LANG']->getLL('reqInstExt_ext_key') . '</td>
			</tr>
		';
        foreach ($extArray as $extKey) {
            // Check for the request:
            if ($installOrImportExtension[$extKey]) {
                $this->installExtension($extKey);
            }
            // Display:
            if (!t3lib_extMgm::isLoaded($extKey)) {
                $outputRow[] = '
				<tr class="bgColor4">
					<td><input type="checkbox" name="' . htmlspecialchars('installOrImportExtension[' . $extKey . ']') . '" value="1" checked="checked" id="check_' . $extKey . '" /></td>
					<td><label for="check_' . $extKey . '">' . htmlspecialchars($extKey) . '</label></td>
				</tr>
				';
            }
        }
        if (count($outputRow) > 1 || !$returnUrl) {
            $content = '
				<!-- ending page form ... -->
			<form action="' . htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')) . '" method="post">
				<table border="0" cellpadding="1" cellspacing="1">' . implode('', $outputRow) . '</table>
			<input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('reqInstExt_import_install_selected') . '" />
			</form>';
            if ($returnUrl) {
                $content .= '
				<br />
				<br />
				<a href="' . htmlspecialchars($returnUrl) . '">' . $GLOBALS['LANG']->getLL('reqInstExt_return') . '</a>
				';
            }
            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('reqInstExt_imp_inst_ext'), $content, 0, 1);
        } else {
            t3lib_utility_Http::redirect($returnUrl);
        }
    }
示例#14
0
 /**
  * Initializing the module
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER;
     // Setting module configuration / page select clause
     $this->MCONF = $GLOBALS['MCONF'];
     $this->perms_clause = $BE_USER->getPagePermsClause(1);
     $this->backPath = $GLOBALS['BACK_PATH'];
     // GPvars:
     $this->id = intval(t3lib_div::_GP('id'));
     $this->pointer = t3lib_div::_GP('pointer');
     $this->imagemode = t3lib_div::_GP('imagemode');
     $this->clear_cache = t3lib_div::_GP('clear_cache');
     $this->popView = t3lib_div::_GP('popView');
     $this->edit_record = t3lib_div::_GP('edit_record');
     $this->new_unique_uid = t3lib_div::_GP('new_unique_uid');
     $this->search_field = t3lib_div::_GP('search_field');
     $this->search_levels = t3lib_div::_GP('search_levels');
     $this->showLimit = t3lib_div::_GP('showLimit');
     $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
     $this->externalTables = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['cms']['db_layout']['addTables'];
     // Load page info array:
     $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
     // Initialize menu
     $this->menuConfig();
     // Setting sys language from session var:
     $this->current_sys_language = intval($this->MOD_SETTINGS['language']);
     // Include scripts: QuickEdit
     if ($this->MOD_SETTINGS['function'] == 0) {
         $this->include_once[] = PATH_t3lib . 'class.t3lib_tceforms.php';
         $this->include_once[] = PATH_t3lib . 'class.t3lib_clipboard.php';
         $this->include_once[] = PATH_t3lib . 'class.t3lib_loaddbgroup.php';
         $this->include_once[] = PATH_t3lib . 'class.t3lib_transferdata.php';
     }
     // Include scripts: Clear-cache cmd.
     if ($this->clear_cache) {
         $this->include_once[] = PATH_t3lib . 'class.t3lib_tcemain.php';
     }
     // CSH / Descriptions:
     $this->descrTable = '_MOD_' . $this->MCONF['name'];
 }
示例#15
0
 /**
  * Constructor function for the class
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $LANG, $BACK_PATH;
     // page-selection permission clause (reading)
     $this->perms_clause = $BE_USER->getPagePermsClause(1);
     // this will hide records from display - it has nothing todo with user rights!!
     if ($pidList = $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')) {
         if ($pidList = $GLOBALS['TYPO3_DB']->cleanIntList($pidList)) {
             $this->perms_clause .= ' AND pages.uid NOT IN (' . $pidList . ')';
         }
     }
     // Setting GPvars:
     $this->id = intval(t3lib_div::_GP('id'));
     // The page id to operate from
     $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
     $this->pagesOnly = t3lib_div::_GP('pagesOnly');
     // Create instance of template class for output
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $BACK_PATH;
     $this->doc->setModuleTemplate('templates/db_new.html');
     $this->doc->JScode = '';
     // Setting up the context sensitive menu:
     $this->doc->getContextMenuCode();
     // Creating content
     $this->content = '';
     $this->content .= $this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:db_new.php.pagetitle'));
     // Id a positive id is supplied, ask for the page record with permission information contained:
     if ($this->id > 0) {
         $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $this->perms_clause);
     }
     // If a page-record was returned, the user had read-access to the page.
     if ($this->pageinfo['uid']) {
         // Get record of parent page
         $this->pidInfo = t3lib_BEfunc::getRecord('pages', $this->pageinfo['pid']);
         // Checking the permissions for the user with regard to the parent page: Can he create new pages, new content record, new page after?
         if ($BE_USER->doesUserHaveAccess($this->pageinfo, 8)) {
             $this->newPagesInto = 1;
         }
         if ($BE_USER->doesUserHaveAccess($this->pageinfo, 16)) {
             $this->newContentInto = 1;
         }
         if (($BE_USER->isAdmin() || is_array($this->pidInfo)) && $BE_USER->doesUserHaveAccess($this->pidInfo, 8)) {
             $this->newPagesAfter = 1;
         }
     } elseif ($BE_USER->isAdmin()) {
         // Admins can do it all
         $this->newPagesInto = 1;
         $this->newContentInto = 1;
         $this->newPagesAfter = 0;
     } else {
         // People with no permission can do nothing
         $this->newPagesInto = 0;
         $this->newContentInto = 0;
         $this->newPagesAfter = 0;
     }
 }
示例#16
0
    /**
     * Initialize script class
     *
     * @return	void
     */
    function init()
    {
        //TODO remove global
        global $BACK_PATH, $TYPO3_CONF_VARS;
        // Setting target, which must be a file reference to a file within the mounts.
        $this->target = $this->origTarget = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
        // Creating file management object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $TYPO3_CONF_VARS['BE']['fileExtensions']);
        if (file_exists($this->target)) {
            $this->target = $this->basicff->cleanDirectoryName($this->target);
            // Cleaning and checking target (file or dir)
        } else {
            $this->target = '';
        }
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
            throw new RuntimeException($title . ': ' . $message);
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . $GLOBALS['FILEMOUNTS'][$key]['name'] . ': ' . $this->shortPath;
        // ***************************
        // Setting template object
        // ***************************
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_edit.html');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList()	{	//
				top.goToModule("file_list");
			}
		');
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform">';
    }
 /**
  * Constructor, initializing internal variables.
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $BACK_PATH, $TBE_MODULES_EXT;
     // Setting class files to include:
     if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) {
         $this->include_once = array_merge($this->include_once, $TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']);
     }
     // Setting internal vars:
     $this->id = intval(t3lib_div::_GP('id'));
     $this->sys_language = intval(t3lib_div::_GP('sys_language_uid'));
     $this->R_URI = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
     $this->colPos = t3lib_div::_GP('colPos');
     $this->uid_pid = intval(t3lib_div::_GP('uid_pid'));
     $this->MCONF['name'] = 'xMOD_db_new_content_el';
     $this->modTSconfig = t3lib_BEfunc::getModTSconfig($this->id, 'mod.wizards.newContentElement');
     $config = t3lib_BEfunc::getPagesTSconfig($this->id);
     $this->config = $config['mod.']['wizards.']['newContentElement.'];
     // Starting the document template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $BACK_PATH;
     $this->doc->setModuleTemplate('templates/db_new_content_el.html');
     $this->doc->JScode = '';
     $this->doc->form = '<form action="" name="editForm"><input type="hidden" name="defValues" value="" />';
     // Setting up the context sensitive menu:
     $this->doc->getContextMenuCode();
     // Getting the current page and receiving access information (used in main())
     $perms_clause = $BE_USER->getPagePermsClause(1);
     $this->pageinfo = t3lib_BEfunc::readPageAccess($this->id, $perms_clause);
     $this->access = is_array($this->pageinfo) ? 1 : 0;
 }
示例#18
0
    /**
     * Constructor for initializing the class
     *
     * @return	void
     */
    function init()
    {
        // Initialize GPvars:
        $this->number = t3lib_div::_GP('number');
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
        $this->returnUrl = $this->returnUrl ? $this->returnUrl : t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . t3lib_extMgm::extRelPath('filelist') . 'mod1/file_list.php?id=' . rawurlencode($this->target);
        // set the number of input fields
        if (empty($this->number)) {
            $this->number = $GLOBALS['BE_USER']->getTSConfigVal('options.defaultFileUploads');
        }
        $this->number = t3lib_div::intInRange($this->number, 1, $this->uploadNumber);
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
        // Init basic-charset-functions object:
        $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
        // Cleaning and checking target
        $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
        $this->target = $this->basicff->is_directory($this->target);
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
            throw new RuntimeException($title . ': ' . $message);
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_upload.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
            $confirm = ' && confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . ')';
        } else {
            $confirm = '';
        }
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

			function reload(a) {	//
				if (!changed || (changed ' . $confirm . ')) {
					var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . urlencode($this->charsetConversion->conv($this->returnUrl, $GLOBALS['LANG']->charSet, 'utf-8')) . '";
					window.location.href = "file_upload.php?"+params;
				}
			}
			function backToList() {	//
				top.goToModule("file_list");
			}
			var changed = 0;
		');
    }
示例#19
0
 /**
  * Returns JavaScript variables setting the returnUrl and thisScript location for use by JavaScript on the page.
  * Used in fx. db_list.php (Web>List)
  *
  * @param	string		URL to "this location" / current script
  * @return	string
  * @see typo3/db_list.php
  */
 function redirectUrls($thisLocation = '')
 {
     $thisLocation = $thisLocation ? $thisLocation : t3lib_div::linkThisScript(array('CB' => '', 'SET' => '', 'cmd' => '', 'popViewId' => ''));
     $out = "\n\tvar T3_RETURN_URL = '" . str_replace('%20', '', rawurlencode(t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl')))) . "';\n\tvar T3_THIS_LOCATION = '" . str_replace('%20', '', rawurlencode($thisLocation)) . "';\n\t\t";
     return $out;
 }
示例#20
0
	/**
	 * Rendering a single data structures information
	 *
	 * @param	array		Data Structure information
	 * @param	array		Array with TO found for this ds
	 * @param	integer		Scope.
	 * @return	string		HTML content
	 */
	function renderDataStructureDisplay(tx_templavoila_datastructure $dsObj, $scope, $toIdArray)	{

		$tableAttribs = ' border="0" cellpadding="1" cellspacing="1" width="98%" style="margin-top: 10px;" class="lrPadding"';

		$XMLinfo = array();
		if ($this->MOD_SETTINGS['set_details'])	{
			$XMLinfo = $this->DSdetails($dsObj->getDataprotXML());
		}

		if ($dsObj->isFilebased()) {
			$onClick = 'document.location=\'' . $this->doc->backPath . 'file_edit.php?target=' . rawurlencode(t3lib_div::getFileAbsFileName($dsObj->getKey())) . '&returnUrl=' . rawurlencode(t3lib_div::sanitizeLocalUrl(t3lib_div::getIndpEnv('REQUEST_URI'))) . '\';';
			$dsIcon = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"><img'.t3lib_iconWorks::skinImg($this->doc->backPath,'gfx/fileicons/xml.gif','width="18" height="16"').' alt="" title="' . $dsObj->getKey() . '" class="absmiddle" /></a>';
		} else {
			$dsIcon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_datastructure' ,array(), array('title' => $dsObj->getKey()));
			$dsIcon = $this->doc->wrapClickMenuOnIcon($dsIcon, 'tx_templavoila_datastructure', $dsObj->getKey(), 1, '&callingScriptId='.rawurlencode($this->doc->scriptID));
		}

			// Preview icon:
		if ($dsObj->getIcon())	{
			if (isset($this->modTSconfig['properties']['dsPreviewIconThumb']) && $this->modTSconfig['properties']['dsPreviewIconThumb'] != '0') {
				$path = realpath(dirname(__FILE__) . '/' . preg_replace('/\w+\/\.\.\//', '', $GLOBALS['BACK_PATH'] . $dsObj->getIcon()));
				$path = str_replace(realpath(PATH_site) . '/', PATH_site, $path);
				if($path == FALSE) {
					$previewIcon = $GLOBALS['LANG']->getLL('noicon', 1);
				} else {
					$previewIcon = t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $path,
						'hspace="5" vspace="5" border="1"',
						strpos($this->modTSconfig['properties']['dsPreviewIconThumb'], 'x') ? $this->modTSconfig['properties']['dsPreviewIconThumb'] : '');
				}
			} else {
				$previewIcon = '<img src="' . $this->doc->backPath . $dsObj->getIcon() . '" alt="" />';
			}
		} else {
			$previewIcon = $GLOBALS['LANG']->getLL('noicon', 1);
		}

			// Links:
		if ($dsObj->isFilebased()) {
			$editLink = $editDataprotLink = '';
			$dsTitle = $dsObj->getLabel();
		} else {
			$editLink = $lpXML.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_datastructure]['.$dsObj->getKey().']=edit',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') .'</a>';
			$editDataprotLink =  '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_datastructure]['.$dsObj->getKey().']=edit&columnsOnly=dataprot',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>';
			$dsTitle = '<a href="'.htmlspecialchars('../cm1/index.php?table=tx_templavoila_datastructure&uid=' . $dsObj->getKey() . '&id=' . $this->id . '&returnUrl=' . rawurlencode( t3lib_div::sanitizeLocalUrl(t3lib_div::getIndpEnv('REQUEST_URI')))) . '">' . htmlspecialchars($dsObj->getLabel()) . '</a>';
		}

			// Compile info table:
		$content.='
		<table'.$tableAttribs.'>
			<tr class="bgColor5">
				<td colspan="3" style="border-top: 1px solid black;">'.
					$dsIcon.
					$dsTitle.
					$editLink.
					'</td>
			</tr>
			<tr class="bgColor4">
				<td rowspan="'.($this->MOD_SETTINGS['set_details'] ? 4 : 2).'" style="width: 100px; text-align: center;">'.$previewIcon.'</td>
				' .
				($this->MOD_SETTINGS['set_details'] ? '<td style="width:200px">' . $GLOBALS['LANG']->getLL('templatestatus', 1) . '</td>
				<td>' . $this->findDSUsageWithImproperTOs($dsObj, $scope, $toIdArray) . '</td>' : '' ) .
			'</tr>
			<tr class="bgColor4">
				<td>' . $GLOBALS['LANG']->getLL('globalprocessing_xml') . '</td>
				<td>
					'.$lpXML.($dsObj->getDataprotXML() ?
					t3lib_div::formatSize(strlen($dsObj->getDataprotXML())).' bytes'.
					($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').'
				</td>
			</tr>'.($this->MOD_SETTINGS['set_details'] ? '
			<tr class="bgColor4">
				<td>' . $GLOBALS['LANG']->getLL('created', 1) . '</td>
				<td>' . t3lib_BEfunc::datetime($dsObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $dsObj->getCruser() . ']</td>
			</tr>
			<tr class="bgColor4">
				<td>' . $GLOBALS['LANG']->getLL('updated', 1) . '</td>
				<td>'.t3lib_BEfunc::datetime($dsObj->getTstamp()).'</td>
			</tr>' : '').'
		</table>
		';

			// Format XML if requested (renders VERY VERY slow)
		if ($this->MOD_SETTINGS['set_showDSxml'])	{
			if ($dsObj->getDataprotXML())	{
				require_once(PATH_t3lib.'class.t3lib_syntaxhl.php');
				$hlObj = t3lib_div::makeInstance('t3lib_syntaxhl');
				$content.='<pre>'.str_replace(chr(9),'&nbsp;&nbsp;&nbsp;',$hlObj->highLight_DS($dsObj->getDataprotXML())).'</pre>';
			}
			$lpXML.= $editDataprotLink;
		}

		if ($this->MOD_SETTINGS['set_details'])	{
			if ($XMLinfo['referenceFields'])	{
				$containerMode = $GLOBALS['LANG']->getLL('yes', 1);
				if ($XMLinfo['languageMode']==='Separate')	{
					$containerMode .= ' ' . $this->doc->icons(3) . $GLOBALS['LANG']->getLL('containerwithseparatelocalization', 1);
				} elseif ($XMLinfo['languageMode']==='Inheritance')	{
					$containerMode .= ' '.$this->doc->icons(2);
					if ($XMLinfo['inputFields'])	{
						$containerMode .= $GLOBALS['LANG']->getLL('mixofcontentandref', 1);
					} else {
						$containerMode .= $GLOBALS['LANG']->getLL('nocontentfields', 1);
					}
				}
			} else {
				$containerMode = 'No';
			}

			$containerMode.=' (ARI='.$XMLinfo['rootelements'].'/'.$XMLinfo['referenceFields'].'/'.$XMLinfo['inputFields'].')';
		}

			// Return content
		return array(
			'HTML' => $content,
			'languageMode' => $XMLinfo['languageMode'],
			'container' => $containerMode
		);
	}
示例#21
0
 /**
  * Initialization of the class
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER;
     // GPvars:
     $this->flags = t3lib_div::_GP('flags');
     $this->data = t3lib_div::_GP('data');
     $this->cmd = t3lib_div::_GP('cmd');
     $this->mirror = t3lib_div::_GP('mirror');
     $this->cacheCmd = t3lib_div::_GP('cacheCmd');
     $this->redirect = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('redirect'));
     $this->prErr = t3lib_div::_GP('prErr');
     $this->_disableRTE = t3lib_div::_GP('_disableRTE');
     $this->CB = t3lib_div::_GP('CB');
     $this->vC = t3lib_div::_GP('vC');
     $this->uPT = t3lib_div::_GP('uPT');
     $this->generalComment = t3lib_div::_GP('generalComment');
     // Creating TCEmain object
     $this->tce = t3lib_div::makeInstance('t3lib_TCEmain');
     $this->tce->stripslashes_values = 0;
     $this->tce->generalComment = $this->generalComment;
     // Configuring based on user prefs.
     if ($BE_USER->uc['recursiveDelete']) {
         $this->tce->deleteTree = 1;
         // True if the delete Recursive flag is set.
     }
     if ($BE_USER->uc['copyLevels']) {
         $this->tce->copyTree = t3lib_div::intInRange($BE_USER->uc['copyLevels'], 0, 100);
         // Set to number of page-levels to copy.
     }
     if ($BE_USER->uc['neverHideAtCopy']) {
         $this->tce->neverHideAtCopy = 1;
     }
     $TCAdefaultOverride = $BE_USER->getTSConfigProp('TCAdefaults');
     if (is_array($TCAdefaultOverride)) {
         $this->tce->setDefaultsFromUserTS($TCAdefaultOverride);
     }
     // Reverse order.
     if ($this->flags['reverseOrder']) {
         $this->tce->reverseOrder = 1;
     }
     #		$this->tce->disableRTE = $this->_disableRTE;
     // Clipboard?
     if (is_array($this->CB)) {
         $this->include_once[] = PATH_t3lib . 'class.t3lib_clipboard.php';
     }
 }
示例#22
0
 /**
  * Initializing the module
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER;
     // Setting module configuration / page select clause
     $this->MCONF = $GLOBALS['MCONF'];
     $this->perms_clause = $BE_USER->getPagePermsClause(1);
     // GPvars:
     $this->id = t3lib_div::_GP('id');
     $this->pointer = t3lib_div::_GP('pointer');
     $this->imagemode = t3lib_div::_GP('imagemode');
     $this->table = t3lib_div::_GP('table');
     $this->search_field = t3lib_div::_GP('search_field');
     $this->search_levels = t3lib_div::_GP('search_levels');
     $this->showLimit = t3lib_div::_GP('showLimit');
     $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
     $this->clear_cache = t3lib_div::_GP('clear_cache');
     $this->cmd = t3lib_div::_GP('cmd');
     $this->cmd_table = t3lib_div::_GP('cmd_table');
     // Initialize menu
     $this->menuConfig();
     // Inclusions?
     if ($this->clear_cache || $this->cmd == 'delete') {
         $this->include_once[] = PATH_t3lib . 'class.t3lib_tcemain.php';
     }
 }
示例#23
0
 /**
  * Main function
  * Will issue a location-header, redirecting either BACK or to a new alt_doc.php instance...
  *
  * @return	void
  */
 function main()
 {
     if ($this->returnEditConf) {
         if ($this->processDataFlag) {
             // Preparing the data of the parent record...:
             $trData = t3lib_div::makeInstance('t3lib_transferData');
             $trData->fetchRecord($this->P['table'], $this->P['uid'], '');
             // 'new'
             reset($trData->regTableItems_data);
             $current = current($trData->regTableItems_data);
             // If that record was found (should absolutely be...), then init TCEmain and set, prepend or append the record
             if (is_array($current)) {
                 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
                 $tce->stripslashes_values = 0;
                 $data = array();
                 $addEl = $this->table . '_' . $this->id;
                 // Setting the new field data:
                 if ($this->P['flexFormPath']) {
                     // If the field is a flexform field, work with the XML structure instead:
                     $currentFlexFormData = t3lib_div::xml2array($current[$this->P['field']]);
                     // Current value of flexform path:
                     $flexToolObj = t3lib_div::makeInstance('t3lib_flexformtools');
                     $curValueOfFlexform = $flexToolObj->getArrayValueByPath($this->P['flexFormPath'], $currentFlexFormData);
                     $insertValue = '';
                     switch ((string) $this->P['params']['setValue']) {
                         case 'set':
                             $insertValue = $addEl;
                             break;
                         case 'prepend':
                             $insertValue = $curValueOfFlexform . ',' . $addEl;
                             break;
                         case 'append':
                             $insertValue = $addEl . ',' . $curValueOfFlexform;
                             break;
                     }
                     $insertValue = implode(',', t3lib_div::trimExplode(',', $insertValue, 1));
                     $data[$this->P['table']][$this->P['uid']][$this->P['field']] = array();
                     $flexToolObj->setArrayValueByPath($this->P['flexFormPath'], $data[$this->P['table']][$this->P['uid']][$this->P['field']], $insertValue);
                 } else {
                     switch ((string) $this->P['params']['setValue']) {
                         case 'set':
                             $data[$this->P['table']][$this->P['uid']][$this->P['field']] = $addEl;
                             break;
                         case 'prepend':
                             $data[$this->P['table']][$this->P['uid']][$this->P['field']] = $current[$this->P['field']] . ',' . $addEl;
                             break;
                         case 'append':
                             $data[$this->P['table']][$this->P['uid']][$this->P['field']] = $addEl . ',' . $current[$this->P['field']];
                             break;
                     }
                     $data[$this->P['table']][$this->P['uid']][$this->P['field']] = implode(',', t3lib_div::trimExplode(',', $data[$this->P['table']][$this->P['uid']][$this->P['field']], 1));
                 }
                 // Submit the data:
                 $tce->start($data, array());
                 $tce->process_datamap();
             }
         }
         // Return to the parent alt_doc.php record editing session:
         t3lib_utility_Http::redirect(t3lib_div::sanitizeLocalUrl($this->P['returnUrl']));
     } else {
         // Redirecting to alt_doc.php with instructions to create a new record
         // AND when closing to return back with information about that records ID etc.
         $redirectUrl = 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')) . '&returnEditConf=1&edit[' . $this->P['params']['table'] . '][' . $this->pid . ']=new';
         t3lib_utility_Http::redirect($redirectUrl);
     }
 }
示例#24
0
 /**
  * Initialize internal variables.
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $BACK_PATH, $TBE_MODULES_EXT;
     // Setting class files to include:
     if (is_array($TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses'])) {
         $this->include_once = array_merge($this->include_once, $TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']);
     }
     $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['templavoila']);
     // Setting internal vars:
     $this->id = intval(t3lib_div::_GP('id'));
     $this->parentRecord = t3lib_div::_GP('parentRecord');
     $this->altRoot = t3lib_div::_GP('altRoot');
     $this->defVals = t3lib_div::_GP('defVals');
     $this->returnUrl = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
     // Starting the document template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->docType = 'xhtml_trans';
     $this->doc->backPath = $BACK_PATH;
     $this->doc->setModuleTemplate('EXT:templavoila/resources/templates/mod1_new_content.html');
     $this->doc->bodyTagId = 'typo3-mod-php';
     $this->doc->divClass = '';
     $this->doc->JScode = '';
     $this->doc->getPageRenderer()->loadPrototype();
     if (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000) {
         $this->doc->JScodeLibArray['dyntabmenu'] = $this->doc->getDynTabMenuJScode();
     } else {
         $this->doc->loadJavascriptLib('js/tabmenu.js');
     }
     $this->doc->form = '<form action="" name="editForm">';
     $tsconfig = t3lib_BEfunc::getModTSconfig($this->id, 'templavoila.wizards.newContentElement');
     $this->config = $tsconfig['properties'];
     // Getting the current page and receiving access information (used in main())
     $perms_clause = $BE_USER->getPagePermsClause(1);
     $pageinfo = t3lib_BEfunc::readPageAccess($this->id, $perms_clause);
     $this->access = is_array($pageinfo) ? 1 : 0;
     $this->apiObj = t3lib_div::makeInstance('tx_templavoila_api');
     // If no parent record was specified, find one:
     if (!$this->parentRecord) {
         $mainContentAreaFieldName = $this->apiObj->ds_getFieldNameByColumnPosition($this->id, 0);
         if ($mainContentAreaFieldName != FALSE) {
             $this->parentRecord = 'pages:' . $this->id . ':sDEF:lDEF:' . $mainContentAreaFieldName . ':vDEF:0';
         }
     }
 }
示例#25
0
 /**
  * Main function. Will generate the information to display for the item set internally.
  *
  * @return	void
  */
 function main()
 {
     if ($this->access) {
         $returnLink = t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));
         $returnLinkTag = $returnLink ? '<a href="' . $returnLink . '" class="typo3-goBack">' : '<a href="#" onclick="window.close();">';
         // render type by user func
         $typeRendered = false;
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) {
                 $typeRenderObj = t3lib_div::getUserObj($classRef);
                 if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
                     if ($typeRenderObj->isValid($this->type, $this)) {
                         $this->content .= $typeRenderObj->render($this->type, $this);
                         $typeRendered = true;
                         break;
                     }
                 }
             }
         }
         // if type was not rendered use default rendering functions
         if (!$typeRendered) {
             // Branch out based on type:
             switch ($this->type) {
                 case 'db':
                     $this->renderDBInfo();
                     break;
                 case 'file':
                     $this->renderFileInfo($returnLinkTag);
                     break;
             }
         }
         // If return Url is set, output link to go back:
         if (t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'))) {
             $this->content = $this->doc->section('', $returnLinkTag . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack', 1) . '</strong></a><br /><br />') . $this->content;
             $this->content .= $this->doc->section('', '<br />' . $returnLinkTag . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack', 1) . '</strong></a>');
         }
     }
 }
示例#26
0
	/**
	 * Main function, drawing marked up XML.
	 *
	 * @return	void
	 */
	function main()	{
		global $LANG,$BACK_PATH;

			// Check admin: If this is changed some day to other than admin users we HAVE to check if there is read access to the record being selected!
		if (!$GLOBALS['BE_USER']->isAdmin())	die('no access.');

		$this->returnUrl =  t3lib_div::sanitizeLocalUrl(t3lib_div::_GP('returnUrl'));

			// Draw the header.
		$this->doc = t3lib_div::makeInstance('template');
		$this->doc->docType = 'xhtml_trans';
		$this->doc->backPath = $BACK_PATH;
		$this->doc->setModuleTemplate('EXT:templavoila/resources/templates/cm2_default.html');
		$this->doc->bodyTagId = 'typo3-mod-php';
		$this->doc->divClass = '';

			// XML code:
		$this->viewTable = t3lib_div::_GP('viewRec');

		$record = t3lib_BEfunc::getRecordWSOL($this->viewTable['table'], $this->viewTable['uid']);	// Selecting record based on table/uid since adding the field might impose a SQL-injection problem; at least the field name would have to be checked first.
		if (is_array($record))	{

				// Set current XML data:
			$currentXML = $record[$this->viewTable['field_flex']];

				// Clean up XML:
			$cleanXML = '';
			if ($GLOBALS['BE_USER']->isAdmin())	{
				if ('tx_templavoila_flex' == $this->viewTable['field_flex'])	{
					$flexObj = t3lib_div::makeInstance('t3lib_flexformtools');
					if ($record['tx_templavoila_flex'])	{
						$cleanXML = $flexObj->cleanFlexFormXML($this->viewTable['table'],'tx_templavoila_flex',$record);

							// If the clean-button was pressed, save right away:
						if (t3lib_div::_POST('_CLEAN_XML'))	{
							$dataArr = array();
							$dataArr[$this->viewTable['table']][$this->viewTable['uid']]['tx_templavoila_flex'] = $cleanXML;

								// Init TCEmain object and store:
							$tce = t3lib_div::makeInstance('t3lib_TCEmain');
							$tce->stripslashes_values=0;
							$tce->start($dataArr,array());
							$tce->process_datamap();

								// Re-fetch record:
							$record = t3lib_BEfunc::getRecordWSOL($this->viewTable['table'], $this->viewTable['uid']);
							$currentXML = $record[$this->viewTable['field_flex']];
						}
					}
				}
			}

			if (md5($currentXML)!=md5($cleanXML))	{
					// Create diff-result:
				$t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
				$diffres = $t3lib_diff_Obj->makeDiffDisplay($currentXML,$cleanXML);

			$flashMessage = t3lib_div::makeInstance(
				't3lib_FlashMessage',
				$LANG->getLL('needsCleaning',1),
				'',
				t3lib_FlashMessage::INFO
			);
			$xmlContentMarkedUp = $flashMessage->render();

			$xmlContentMarkedUp .= '<table border="0">
					<tr class="bgColor5 tableheader">
						<td>'.$LANG->getLL('current',1).'</td>
					</tr>
					<tr>
						<td>'.$this->markUpXML($currentXML).'<br/><br/></td>
					</tr>
					<tr class="bgColor5 tableheader">
						<td>'.$LANG->getLL('clean',1).'</td>
					</tr>
					<tr>
						<td>'.$this->markUpXML($cleanXML).'</td>
					</tr>
					<tr class="bgColor5 tableheader">
						<td>'.$LANG->getLL('diff',1).'</td>
					</tr>
					<tr>
						<td>'.$diffres.'
						<br/><br/><br/>

						<form action="'.t3lib_div::getIndpEnv('REQUEST_URI').'" method="post">
							<input type="submit" value="'.$LANG->getLL('cleanUp',1).'" name="_CLEAN_XML" />
						</form>

						</td>
					</tr>
				</table>

				';
			} else {
				$xmlContentMarkedUp = '';
				if ($cleanXML)	{
					$flashMessage = t3lib_div::makeInstance(
						't3lib_FlashMessage',
						$LANG->getLL('XMLclean',1),
						'',
						t3lib_FlashMessage::OK
					);
					$xmlContentMarkedUp = $flashMessage->render();
				}
				$xmlContentMarkedUp.= $this->markUpXML($currentXML);
			}

			$this->content.=$this->doc->section('',$xmlContentMarkedUp,0,1);
		}

			// Add spacer:
		$this->content.=$this->doc->spacer(10);

		$docHeaderButtons = $this->getDocHeaderButtons();
		$docContent = array(
			'CSH' => $docHeaderButtons['csh'],
			'CONTENT' => $this->content
		);

		$content  = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
		$content .= $this->doc->moduleBody(
			array(),
			$docHeaderButtons,
			$docContent
		);
		$content .= $this->doc->endPage();

			// Replace content with templated content
		$this->content = $content;
	}
示例#27
0
 /**
  * Will get and return the configuration code string
  * Will also save (and possibly redirect/exit) the content if a save button has been pressed
  *
  * @param	array		Current parent record row (passed by value!)
  * @return	array		Configuration Array
  * @access private
  */
 function getConfigCode(&$row)
 {
     // If some data has been submitted, then construct
     if (isset($this->FORMCFG['c'])) {
         // Process incoming:
         $this->changeFunc();
         // Convert to string (either line based or XML):
         if ($this->xmlStorage) {
             // Convert the input array to XML:
             $bodyText = t3lib_div::array2xml_cs($this->FORMCFG['c'], 'T3FormWizard');
             // Setting cfgArr directly from the input:
             $cfgArr = $this->FORMCFG['c'];
         } else {
             // Convert the input array to a string of configuration code:
             $bodyText = $this->cfgArray2CfgString($this->FORMCFG['c']);
             // Create cfgArr from the string based configuration - that way it is cleaned up and any incompatibilities will be removed!
             $cfgArr = $this->cfgString2CfgArray($bodyText);
         }
         // If a save button has been pressed, then save the new field content:
         if ($_POST['savedok_x'] || $_POST['saveandclosedok_x']) {
             // Make TCEmain object:
             $tce = t3lib_div::makeInstance('t3lib_TCEmain');
             $tce->stripslashes_values = 0;
             // Put content into the data array:
             $data = array();
             $data[$this->P['table']][$this->P['uid']][$this->P['field']] = $bodyText;
             if ($this->special == 'formtype_mail') {
                 $data[$this->P['table']][$this->P['uid']]['subheader'] = $this->FORMCFG['recipient'];
             }
             // Perform the update:
             $tce->start($data, array());
             $tce->process_datamap();
             // Re-load the record content:
             $row = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
             // If the save/close button was pressed, then redirect the screen:
             if ($_POST['saveandclosedok_x']) {
                 t3lib_utility_Http::redirect(t3lib_div::sanitizeLocalUrl($this->P['returnUrl']));
             }
         }
     } else {
         // If nothing has been submitted, load the $bodyText variable from the selected database row:
         if ($this->xmlStorage) {
             $cfgArr = t3lib_div::xml2array($row[$this->P['field']]);
         } else {
             // Regular linebased form configuration:
             $cfgArr = $this->cfgString2CfgArray($row[$this->P['field']]);
         }
         $cfgArr = is_array($cfgArr) ? $cfgArr : array();
     }
     // Return configuration code:
     return $cfgArr;
 }