Beispiel #1
0
    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH;
        // 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;
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            $this->CALC_PERMS = $BE_USER->calcPerms($this->pageinfo);
            if ($BE_USER->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            $this->doc = t3lib_div::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->setModuleTemplate('templates/info.html');
            $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), "defCol" => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), "defRow" => array("0" => array('<td valign="top">', '</td>'), "defCol" => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')));
            // JavaScript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				script_ended = 0;
				function jumpToUrl(URL)	{	//
					window.location.href = URL;
				}
			');
            $this->doc->postCode = $this->doc->wrapScriptTags('
				script_ended = 1;
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
            $this->doc->form = '<form action="index.php" method="post" name="webinfoForm">';
            $vContent = $this->doc->getVersionSelector($this->id, 1);
            if ($vContent) {
                $this->content .= $this->doc->section('', $vContent);
            }
            $this->extObjContent();
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons();
            $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
            // Build the <body> for the module
            $this->content = $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
            $this->content .= $this->doc->endPage();
            $this->content = $this->doc->insertStylesAndJS($this->content);
        } else {
            // If no access or if ID == zero
            $this->doc = t3lib_div::makeInstance('mediumDoc');
            $this->doc->backPath = $BACK_PATH;
            $this->content .= $this->doc->startPage($LANG->getLL('title'));
            $this->content .= $this->doc->header($LANG->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
            $this->content .= $this->doc->endPage();
            $this->content = $this->doc->insertStylesAndJS($this->content);
        }
    }
 /**
  * Initialize the module output
  *
  * @return	void
  */
 function init()
 {
     global $LANG;
     // Create internal template object:
     $this->doc = t3lib_div::makeInstance('template');
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->setModuleTemplate('templates/show_rechis.html');
     // Start the page header:
     $this->content .= $this->doc->header($LANG->getLL('title'));
     $this->content .= $this->doc->spacer(5);
 }
Beispiel #3
0
 /**
  * Show list references
  *
  * @return	void
  */
 function func_relations()
 {
     global $LANG, $BACK_PATH;
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('relations'));
     $this->content .= $this->doc->spacer(5);
     $admin = t3lib_div::makeInstance('t3lib_admin');
     $admin->genTree_makeHTML = 0;
     $admin->backPath = $BACK_PATH;
     $fkey_arrays = $admin->getGroupFields('');
     $admin->selectNonEmptyRecordsWithFkeys($fkey_arrays);
     $fileTest = $admin->testFileRefs();
     $code = '';
     if (is_array($fileTest['noReferences'])) {
         foreach ($fileTest['noReferences'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong></nobr><br>';
         }
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_ref'), $code, true, true);
     $code = '';
     if (is_array($fileTest['moreReferences'])) {
         foreach ($fileTest['moreReferences'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong>: ' . $val[2] . ' ' . $GLOBALS['LANG']->getLL('references') . '</nobr><br>' . $val[3] . '<br><br>';
         }
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_many_ref'), $code, true, true);
     $code = '';
     if (is_array($fileTest['noFile'])) {
         ksort($fileTest['noFile']);
         foreach ($fileTest['noFile'] as $val) {
             $code .= '<nobr>' . $val[0] . '/<strong>' . $val[1] . '</strong> ' . $GLOBALS['LANG']->getLL('isMissing') . ' </nobr><br>' . $GLOBALS['LANG']->getLL('referencedFrom') . $val[2] . '<br><br>';
         }
     }
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('files_no_file'), $code, true, true);
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('select_db'), $admin->testDBRefs($admin->checkSelectDBRefs), true, true);
     $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('group_db'), $admin->testDBRefs($admin->checkGroupDBRefs), true, true);
 }
 /**
  * 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::_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);
 }
Beispiel #5
0
    /**
     * Generate the main settings formular:
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TBE_MODULES;
        // file creation / delete
        if ($this->isAdmin) {
            if ($this->installToolFileKeep) {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileHasKeep'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::WARNING);
                $this->content .= $flashMessage->render();
            }
            if (t3lib_div::_POST('deleteInstallToolEnableFile')) {
                unlink(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                $this->setInstallToolFileExists();
                if ($this->getInstallToolFileExists()) {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR);
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileDelete_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK);
                }
                $this->content .= $flashMessage->render();
            }
            if (t3lib_div::_POST('createInstallToolEnableFile')) {
                touch(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                t3lib_div::fixPermissions(PATH_typo3conf . 'ENABLE_INSTALL_TOOL');
                $this->setInstallToolFileExists();
                if ($this->getInstallToolFileExists()) {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_ok'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::OK);
                } else {
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('enableInstallTool.fileCreate_failed'), $LANG->getLL('enableInstallTool.file'), t3lib_FlashMessage::ERROR);
                }
                $this->content .= $flashMessage->render();
            }
        }
        if ($this->languageUpdate) {
            $this->doc->JScodeArray['languageUpdate'] .= '
				if (top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			';
        }
        if ($this->pagetreeNeedsRefresh) {
            t3lib_BEfunc::setUpdateSignal('updatePageTree');
        }
        // Start page:
        $this->doc->loadJavascriptLib('md5.js');
        // use a wrapper div
        $this->content .= '<div id="user-setup-wrapper">';
        // Load available backend modules
        $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
        $this->loadModules->observeWorkspaces = true;
        $this->loadModules->load($TBE_MODULES);
        $this->content .= $this->doc->header($LANG->getLL('UserSettings') . ' - ' . $BE_USER->user['realName'] . ' [' . $BE_USER->user['username'] . ']');
        // show if setup was saved
        if ($this->setupIsUpdated && !$this->tempDataIsCleared && !$this->settingsAreResetToDefault) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('setupWasUpdated'), $LANG->getLL('UserSettings'));
            $this->content .= $flashMessage->render();
        }
        // Show if temporary data was cleared
        if ($this->tempDataIsCleared) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('tempDataClearedFlashMessage'), $LANG->getLL('tempDataCleared'));
            $this->content .= $flashMessage->render();
        }
        // Show if temporary data was cleared
        if ($this->settingsAreResetToDefault) {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('settingsAreReset'), $LANG->getLL('resetConfiguration'));
            $this->content .= $flashMessage->render();
        }
        // If password is updated, output whether it failed or was OK.
        if ($this->passwordIsSubmitted) {
            if ($this->passwordIsUpdated) {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_ok'), $LANG->getLL('newPassword'));
            } else {
                $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('newPassword_failed'), $LANG->getLL('newPassword'), t3lib_FlashMessage::ERROR);
            }
            $this->content .= $flashMessage->render();
        }
        // render the menu items
        $menuItems = $this->renderUserSetup();
        $this->content .= $this->doc->spacer(20) . $this->doc->getDynTabMenu($menuItems, 'user-setup', FALSE, FALSE, 0, 1, FALSE, 1, $this->dividers2tabs);
        $formToken = $this->formProtection->generateToken('BE user setup', 'edit');
        // Submit and reset buttons
        $this->content .= $this->doc->spacer(20);
        $this->content .= $this->doc->section('', t3lib_BEfunc::cshItem('_MOD_user_setup', 'reset', $BACK_PATH) . '
			<input type="hidden" name="simUser" value="' . $this->simUser . '" />
			<input type="hidden" name="formToken" value="' . $formToken . '" />
			<input type="submit" name="data[save]" value="' . $LANG->getLL('save') . '" />
			<input type="button" value="' . $LANG->getLL('resetConfiguration') . '" onclick="if(confirm(\'' . $LANG->getLL('setToStandardQuestion') . '\')) {document.getElementById(\'setValuesToDefault\').value=1;this.form.submit();}" />
			<input type="button" value="' . $LANG->getLL('clearSessionVars') . '"  onclick="if(confirm(\'' . $LANG->getLL('clearSessionVarsQuestion') . '\')){document.getElementById(\'clearSessionVars\').value=1;this.form.submit();}" />
			<input type="hidden" name="data[setValuesToDefault]" value="0" id="setValuesToDefault" />
			<input type="hidden" name="data[clearSessionVars]" value="0" id="clearSessionVars" />');
        // Notice
        $this->content .= $this->doc->spacer(30);
        $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('activateChanges'), '', t3lib_FlashMessage::INFO);
        $this->content .= $flashMessage->render();
        // end of wrapper div
        $this->content .= '</div>';
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CSH'] = $docHeaderButtons['csh'];
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render($LANG->getLL('UserSettings'), $this->content);
    }
 /**
  * Creates module content.
  *
  * @return	void
  */
 function main()
 {
     global $LANG;
     // see what we have to do and get parameters (call before processing data!!!)
     $this->getModuleParameters();
     $hasAccess = $GLOBALS['BE_USER']->isAdmin() || 0 != ($GLOBALS['BE_USER']->groupData['workspace_perms'] & 4) || $this->isEditAction && $this->checkWorkspaceAccess();
     if (!$hasAccess) {
         $title = $this->getTitle();
         $this->content .= $this->doc->startPage($title);
         $this->content .= $this->doc->header($title);
         $this->content .= $this->doc->spacer(5);
         $this->content .= $LANG->getLL($this->isEditAction ? 'edit_workspace_no_permission' : 'create_workspace_no_permission');
         $this->content .= $this->doc->spacer(5);
         $goBack = $GLOBALS['LANG']->getLL('edit_workspace_go_back');
         $this->content .= t3lib_iconWorks::getSpriteIcon('actions-view-go-back') . '<a href="javascript:history.back()" title="' . $goBack . '">' . $goBack . '</a>';
         $this->content .= $this->doc->endPage();
         return;
     }
     // process submission (this may override action and workspace ID!)
     if (t3lib_div::_GP('workspace_form_submited')) {
         $this->processData();
         // if 'Save&Close' was pressed, redirect to main module script
         if (t3lib_div::_GP('_saveandclosedok_x')) {
             // `n` below is to prevent caching
             t3lib_utility_Http::redirect('index.php?n=' . uniqid(''));
         }
     }
     $this->initTCEForms();
     //
     // start page
     //
     $this->content .= $this->doc->header($this->getTitle());
     $this->content .= $this->doc->spacer(5);
     //
     // page content
     //
     $this->content .= $this->tceforms->printNeededJSFunctions_top();
     $this->content .= $this->buildForm();
     $this->content .= $this->tceforms->printNeededJSFunctions();
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     // $markers['CSH'] = $docHeaderButtons['csh'];
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($this->getTitle());
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
    /**
     * Creating the module output.
     *
     * @return	void
     */
    function main()
    {
        global $LANG, $BACK_PATH;
        if ($this->id && $this->access) {
            // Init position map object:
            $posMap = t3lib_div::makeInstance('ext_posMap');
            $posMap->cur_sys_language = $this->sys_language;
            $posMap->backPath = $BACK_PATH;
            if ((string) $this->colPos != '') {
                // If a column is pre-set:
                if ($this->uid_pid < 0) {
                    $row = array();
                    $row['uid'] = abs($this->uid_pid);
                } else {
                    $row = '';
                }
                $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language);
            } else {
                $this->onClickEvent = '';
            }
            // ***************************
            // Creating content
            // ***************************
            // use a wrapper div
            $this->content .= '<div id="user-setup-wrapper">';
            $this->content .= $this->doc->header($LANG->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
            // Wizard
            $code = '';
            $wizardItems = $this->getWizardItems();
            // Wrapper for wizards
            $this->elementWrapper['sectionHeader'] = array('<h3 class="divider">', '</h3>');
            $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>');
            $this->elementWrapper['wizard'] = array('<tr>', '</tr>');
            $this->elementWrapper['wizardPart'] = array('<td>', '</td>');
            // copy wrapper for tabs
            $this->elementWrapperForTabs = $this->elementWrapper;
            // Hook for manipulating wizardItems, wrapper, onClickEvent etc.
            if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) {
                foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) {
                    $hookObject = t3lib_div::getUserObj($classData);
                    if (!$hookObject instanceof cms_newContentElementWizardsHook) {
                        throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 1227834741);
                    }
                    $hookObject->manipulateWizardItems($wizardItems, $this);
                }
            }
            if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) {
                // restore wrapper for tabs if they are overwritten in hook
                $this->elementWrapper = $this->elementWrapperForTabs;
            }
            // add document inline javascript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				function goToalt_doc()	{	//
					' . $this->onClickEvent . '
				}

				if(top.refreshMenu) {
					top.refreshMenu();
				} else {
					top.TYPO3ModuleMenu.refreshMenu();
				}
			');
            // Traverse items for the wizard.
            // An item is either a header or an item rendered with a radio button and title/description and icon:
            $cc = $key = 0;
            $menuItems = array();
            foreach ($wizardItems as $k => $wInfo) {
                if ($wInfo['header']) {
                    $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]);
                    $key = count($menuItems) - 1;
                } else {
                    $content = '';
                    // Radio button:
                    $oC = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : '');
                    $content .= $this->elementWrapper['wizardPart'][0] . '<input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($this->doc->thisBlur() . $oC) . '" />' . $this->elementWrapper['wizardPart'][1];
                    // Onclick action for icon/title:
                    $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $this->doc->thisBlur() . $oC . 'return false;';
                    // Icon:
                    $iInfo = @getimagesize($wInfo['icon']);
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">
						<img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1];
                    // Title + description:
                    $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' . $this->elementWrapper['wizardPart'][1];
                    // Finally, put it together in a container:
                    $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1];
                    $cc++;
                }
            }
            // add closing section-tag
            foreach ($menuItems as $key => $val) {
                $menuItems[$key]['content'] .= $this->elementWrapper['section'][1];
            }
            // Add the wizard table to the content, wrapped in tabs:
            if ($this->config['renderMode'] == 'tabs') {
                $this->doc->inDocStylesArray[] = '
					.typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #adadad; width: 680px; }
					.typo3-dyntabmenu-divs table { margin: 15px; }
					.typo3-dyntabmenu-divs table td { padding: 3px; }
				';
                $code = $LANG->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', false, false, 100);
            } else {
                $code = $LANG->getLL('sel1', 1) . '<br /><br />';
                foreach ($menuItems as $section) {
                    $code .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $section['content'];
                }
            }
            $this->content .= $this->doc->section(!$this->onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1);
            // If the user must also select a column:
            if (!$this->onClickEvent) {
                // Add anchor "sel2"
                $this->content .= $this->doc->section('', '<a name="sel2"></a>');
                $this->content .= $this->doc->spacer(20);
                // Select position
                $code = $LANG->getLL('sel2', 1) . '<br /><br />';
                // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable:
                $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED');
                $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3';
                $colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $colPosList)));
                // Removing duplicates, if any
                // Finally, add the content of the column selector to the content:
                $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI);
                $this->content .= $this->doc->section($LANG->getLL('2_selectPosition'), $code, 0, 1);
            }
            // Close wrapper div
            $this->content .= '</div>';
        } else {
            // In case of no access:
            $this->content = '';
            $this->content .= $this->doc->header($LANG->getLL('newContentElement'));
            $this->content .= $this->doc->spacer(5);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CSH'] = $docHeaderButtons['csh'];
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage($LANG->getLL('newContentElement'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->sectionEnd();
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Beispiel #8
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;
     }
 }