/** * Add another flash message. * Severity can be specified and must be one of * t3lib_FlashMessage::NOTICE, * t3lib_FlashMessage::INFO, * t3lib_FlashMessage::OK, * t3lib_FlashMessage::WARNING, * t3lib_FlashMessage::ERROR * * @param string $message * @param string $title optional message title * @param integer $severity optional severity code. One of the t3lib_FlashMessage constants * @return void * @api */ public function add($message, $title = '', $severity = t3lib_FlashMessage::OK) { if (!is_string($message)) { throw new InvalidArgumentException('The flash message must be string, ' . gettype($message) . ' given.', 1243258395); } $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $message, $title, $severity, TRUE); t3lib_FlashMessageQueue::addMessage($flashMessage); }
/** * This is the main method that is called when a task is executed * It MUST be implemented by all classes inheriting from this one * Note that there is no error handling, errors and failures are expected * to be handled and logged by the client implementations. * Should return true on successful execution, false on error. * * @access public * @return boolean Returns true on successful execution, false on error * * @author Max Beer <*****@*****.**> */ public function execute() { $this->clearUrlEncodeCache(); if ($this->returnMessage && TYPO3_MODE === 'BE') { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $this->returnMessage, '', t3lib_FlashMessage::OK); t3lib_FlashMessageQueue::addMessage($flashMessage); } return true; }
/** * Remove double entries */ protected function removeDoubleEntries() { $sql = "SELECT COUNT( * ) c, image_path FROM tx_flrealurlimage_cache GROUP BY image_path ORDER BY c DESC LIMIT 0, 20"; $res = $GLOBALS['TYPO3_DB']->sql_query($sql); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($row['c'] > 1) { $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tx_flrealurlimage_cache', 'image_path="' . $row['image_path'] . '"', '', 'crdate ASC', $row['c'] - 1); $ids = array(); foreach ($rows as $r) { $ids[] = $r['uid']; } $GLOBALS['TYPO3_DB']->exec_DELETEquery('tx_flrealurlimage_cache', 'uid IN (' . implode(',', $ids) . ')'); $msg = 'Found ' . $row['c'] . ' of "' . $row['image_path'] . '"-path and delete ' . sizeof($ids) . ' entries.'; t3lib_FlashMessageQueue::addMessage(t3lib_div::makeInstance('t3lib_FlashMessage', '', $msg, t3lib_FlashMessage::INFO)); } } }
/** * implements the hook processDatamap_afterDatabaseOperations that gets invoked * when a form in the backend was saved and written to the database. * * Here we will do the caching of recurring events * * @param string $status * @param string $table * @param integer $id * @param array $fieldArray * @param t3lib_TCEmain $tce */ public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $tce) { $GLOBALS['LANG']->includeLLFile('EXT:cz_simple_cal/Resources/Private/Language/locallang_mod.xml'); if ($table == 'tx_czsimplecal_domain_model_event') { //if: an event was changed if ($status == 'new') { // if: record is new $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager'); $indexer = $objectManager->get('Tx_CzSimpleCal_Indexer_Event'); // get the uid of the new record if (!is_numeric($id)) { $id = $tce->substNEWwithIDs[$id]; } // create the slug $event = $this->fetchEventObject($id); $event->generateSlug(); $this->getEventRepository()->update($event); // index events $indexer->create($event); $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('flashmessages.tx_czsimplecal_domain_model_event.create'), '', t3lib_FlashMessage::OK); t3lib_FlashMessageQueue::addMessage($message); } else { if ($this->haveFieldsChanged(Tx_CzSimpleCal_Domain_Model_Event::getFieldsRequiringReindexing(), $fieldArray)) { //if: record was updated and a value that requires re-indexing was changed $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager'); $indexer = $objectManager->get('Tx_CzSimpleCal_Indexer_Event'); $indexer->update($id); $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('flashmessages.tx_czsimplecal_domain_model_event.updateAndIndex'), '', t3lib_FlashMessage::OK); t3lib_FlashMessageQueue::addMessage($message); } else { $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('flashmessages.tx_czsimplecal_domain_model_event.updateNoIndex'), '', t3lib_FlashMessage::INFO); t3lib_FlashMessageQueue::addMessage($message); } } } }
/** * This method is used to add a message to the internal queue * * NOTE: * This method is basesd on TYPO3 4.3 or higher! * * @param string the message itself * @param integer message level (-1 = success (default), 0 = info, 1 = notice, 2 = warning, 3 = error) * * @access private * @return void */ private function addMessage($message, $severity = t3lib_FlashMessage::OK) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', $message, '', $severity); t3lib_FlashMessageQueue::addMessage($message); }
public function addMessage($message, $title = '', $severity = 0, $storeInSession = FALSE) { $flashMessage = tx_rnbase::makeInstance(tx_rnbase_util_Typo3Classes::getFlashMessageClass(), $message, $title, $severity, $storeInSession); if (tx_rnbase_util_TYPO3::isTYPO62OrHigher()) { /** @var $flashMessageService FlashMessageService */ $flashMessageService = tx_rnbase::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); $flashMessageService->getMessageQueueByIdentifier()->enqueue($flashMessage); } else { t3lib_FlashMessageQueue::addMessage($flashMessage); } }
/** * Creates the editing form with TCEforms, based on the input from GPvars. * * @return string HTML form elements wrapped in tables */ function makeEditForm() { global $BE_USER, $LANG, $TCA; // Initialize variables: $this->elementsData = array(); $this->errorC = 0; $this->newC = 0; $thePrevUid = ''; $editForm = ''; $trData = NULL; // Traverse the GPvar edit array foreach ($this->editconf as $table => $conf) { // Tables: if (is_array($conf) && $TCA[$table] && $BE_USER->check('tables_modify', $table)) { // Traverse the keys/comments of each table (keys can be a commalist of uids) foreach ($conf as $cKey => $cmd) { if ($cmd == 'edit' || $cmd == 'new') { // Get the ids: $ids = t3lib_div::trimExplode(',', $cKey, 1); // Traverse the ids: foreach ($ids as $theUid) { // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...) // First, resetting flags. $hasAccess = 1; $deniedAccessReason = ''; $deleteAccess = 0; $this->viewId = 0; // If the command is to create a NEW record...: if ($cmd == 'new') { if (intval($theUid)) { // NOTICE: the id values in this case points to the page uid onto which the record should be create OR (if the id is negativ) to a record from the same table AFTER which to create the record. // Find parent page on which the new record reside if ($theUid < 0) { // Less than zero - find parent page $calcPRec = t3lib_BEfunc::getRecord($table, abs($theUid)); $calcPRec = t3lib_BEfunc::getRecord('pages', $calcPRec['pid']); } else { // always a page $calcPRec = t3lib_BEfunc::getRecord('pages', abs($theUid)); } // Now, calculate whether the user has access to creating new records on this position: if (is_array($calcPRec)) { $CALC_PERMS = $BE_USER->calcPerms($calcPRec); // Permissions for the parent page if ($table == 'pages') { // If pages: $hasAccess = $CALC_PERMS & 8 ? 1 : 0; #$this->viewId = $calcPRec['pid']; $this->viewId = 0; } else { $hasAccess = $CALC_PERMS & 16 ? 1 : 0; $this->viewId = $calcPRec['uid']; } } } $this->dontStoreDocumentRef = 1; // Don't save this document title in the document selector if the document is new. } else { // Edit: $calcPRec = t3lib_BEfunc::getRecord($table, $theUid); t3lib_BEfunc::fixVersioningPid($table, $calcPRec); if (is_array($calcPRec)) { if ($table == 'pages') { // If pages: $CALC_PERMS = $BE_USER->calcPerms($calcPRec); $hasAccess = $CALC_PERMS & 2 ? 1 : 0; $deleteAccess = $CALC_PERMS & 4 ? 1 : 0; $this->viewId = $calcPRec['uid']; } else { $CALC_PERMS = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages', $calcPRec['pid'])); // Fetching pid-record first. $hasAccess = $CALC_PERMS & 16 ? 1 : 0; $deleteAccess = $CALC_PERMS & 16 ? 1 : 0; $this->viewId = $calcPRec['pid']; // Adding "&L=xx" if the record being edited has a languageField with a value larger than zero! if ($TCA[$table]['ctrl']['languageField'] && $calcPRec[$TCA[$table]['ctrl']['languageField']] > 0) { $this->viewId_addParams = '&L=' . $calcPRec[$TCA[$table]['ctrl']['languageField']]; } } // Check internals regarding access: if ($hasAccess) { $hasAccess = $BE_USER->recordEditAccessInternals($table, $calcPRec); $deniedAccessReason = $BE_USER->errorMsg; } } else { $hasAccess = 0; } } if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/alt_doc.php']['makeEditForm_accessCheck'] as $_funcRef) { $_params = array('table' => $table, 'uid' => $theUid, 'cmd' => $cmd, 'hasAccess' => $hasAccess); $hasAccess = t3lib_div::callUserFunction($_funcRef, $_params, $this); } } // AT THIS POINT we have checked the access status of the editing/creation of records and we can now proceed with creating the form elements: if ($hasAccess) { $prevPageID = is_object($trData) ? $trData->prevPageID : ''; $trData = t3lib_div::makeInstance('t3lib_transferData'); $trData->addRawData = TRUE; $trData->defVals = $this->defVals; $trData->lockRecords = 1; $trData->disableRTE = !$BE_USER->isRTE(); $trData->prevPageID = $prevPageID; $trData->fetchRecord($table, $theUid, $cmd == 'new' ? 'new' : ''); // 'new' reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); $rec['uid'] = $cmd == 'new' ? uniqid('NEW') : $theUid; if ($cmd == 'new') { $rec['pid'] = $theUid == 'prev' ? $thePrevUid : $theUid; } $this->elementsData[] = array('table' => $table, 'uid' => $rec['uid'], 'pid' => $rec['pid'], 'cmd' => $cmd, 'deleteAccess' => $deleteAccess); // Now, render the form: if (is_array($rec)) { // Setting visual path / title of form: $this->generalPathOfForm = $this->tceforms->getRecordPath($table, $rec); if (!$this->storeTitle) { $this->storeTitle = $this->recTitle ? htmlspecialchars($this->recTitle) : t3lib_BEfunc::getRecordTitle($table, $rec, TRUE); } // Setting variables in TCEforms object: $this->tceforms->hiddenFieldList = ''; $this->tceforms->globalShowHelp = $this->disHelp ? 0 : 1; if (is_array($this->overrideVals[$table])) { $this->tceforms->hiddenFieldListArr = array_keys($this->overrideVals[$table]); } // Register default language labels, if any: $this->tceforms->registerDefaultLanguageData($table, $rec); // Create form for the record (either specific list of fields or the whole record): $panel = ''; if ($this->columnsOnly) { if (is_array($this->columnsOnly)) { $panel .= $this->tceforms->getListedFields($table, $rec, $this->columnsOnly[$table]); } else { $panel .= $this->tceforms->getListedFields($table, $rec, $this->columnsOnly); } } else { $panel .= $this->tceforms->getMainFields($table, $rec); } $panel = $this->tceforms->wrapTotal($panel, $rec, $table); // Setting the pid value for new records: if ($cmd == 'new') { $panel .= '<input type="hidden" name="data[' . $table . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; $this->newC++; } // Display "is-locked" message: if ($lockInfo = t3lib_BEfunc::isRecordLocked($table, $rec['uid'])) { $lockedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($lockInfo['msg']), '', t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($lockedMessage); } // Combine it all: $editForm .= $panel; } $thePrevUid = $rec['uid']; } else { $this->errorC++; $editForm .= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.noEditPermission', 1) . '<br /><br />' . ($deniedAccessReason ? 'Reason: ' . htmlspecialchars($deniedAccessReason) . '<br /><br />' : ''); } } } } } } return $editForm; }
/** * Initializes the controller before invoking an action method. * * @return void */ protected function initializeAction() { parent::initializeAction(); $this->template->setExtDirectStateProvider(); if (tx_Workspaces_Service_Workspaces::isOldStyleWorkspaceUsed()) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:warning.oldStyleWorkspaceInUser'), '', t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($message); } $this->pageRenderer->loadExtJS(); $this->pageRenderer->enableExtJSQuickTips(); $states = $GLOBALS['BE_USER']->uc['moduleData']['Workspaces']['States']; $this->pageRenderer->addInlineSetting('Workspaces', 'States', $states); // Load JavaScript: $this->pageRenderer->addExtDirectCode(array('TYPO3.Workspaces')); $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/flashmessages.js'); $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.grid.RowExpander.js'); $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.app.SearchField.js'); $this->pageRenderer->addJsFile($this->backPath . '../t3lib/js/extjs/ux/Ext.ux.FitToParent.js'); $resourcePath = t3lib_extMgm::extRelPath('workspaces') . 'Resources/Public/JavaScript/'; $this->pageRenderer->addCssFile($resourcePath . 'gridfilters/css/GridFilters.css'); $this->pageRenderer->addCssFile($resourcePath . 'gridfilters/css/RangeMenu.css'); $jsFiles = array('gridfilters/menu/RangeMenu.js', 'gridfilters/menu/ListMenu.js', 'gridfilters/GridFilters.js', 'gridfilters/filter/Filter.js', 'gridfilters/filter/StringFilter.js', 'gridfilters/filter/DateFilter.js', 'gridfilters/filter/ListFilter.js', 'gridfilters/filter/NumericFilter.js', 'gridfilters/filter/BooleanFilter.js', 'gridfilters/filter/BooleanFilter.js', 'configuration.js', 'helpers.js', 'actions.js', 'component.js', 'toolbar.js', 'grid.js', 'workspaces.js'); foreach ($jsFiles as $jsFile) { $this->pageRenderer->addJsFile($resourcePath . $jsFile); } }
/** * Creating form for editing the permissions ($this->edit = true) * (Adding content to internal content variable) * * @return void */ public function doEdit() { global $BE_USER, $LANG; // Get ACL configuration $beAclConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_acl']); $disableOldPermissionSystem = 0; if ($beAclConfig['disableOldPermissionSystem']) { $disableOldPermissionSystem = 1; } $LANG->includeLLFile('EXT:be_acl/res/locallang_perm.xml'); if ($BE_USER->workspace != 0) { // Adding section with the permission setting matrix: $lockedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('WorkspaceWarningText'), $LANG->getLL('WorkspaceWarning'), t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($lockedMessage); } // Get usernames and groupnames $beGroupArray = t3lib_BEfunc::getListGroupNames('title,uid'); $beGroupKeys = array_keys($beGroupArray); $beUserArray = t3lib_BEfunc::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUserArray = t3lib_BEfunc::blindUserNames($beUserArray, $beGroupKeys, 1); } $beGroupArray_o = $beGroupArray = t3lib_BEfunc::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beGroupArray = t3lib_BEfunc::blindGroupNames($beGroupArray_o, $beGroupKeys, 1); } $firstGroup = $beGroupKeys[0] ? $beGroupArray[$beGroupKeys[0]] : ''; // data of the first group, the user is member of // Set JavaScript // Generate list if record is available on subpages, if yes, enter the id $this->content .= '<script src="../../../' . t3lib_extMgm::extRelPath('be_acl') . 'res/acl.js" type="text/javascript"></script>'; // Owner selector: $options = ''; $userset = 0; // flag: is set if the page-userid equals one from the user-list foreach ($beUserArray as $uid => $row) { if ($uid == $this->pageinfo['perms_userid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>'; } $options = ' <option value="0"></option>' . $options; // Hide selector if not needed if ($disableOldPermissionSystem) { $hidden = ' style="display:none;" '; } else { $hidden = ''; } $selector = ' <select name="data[pages][' . $this->id . '][perms_userid]"' . $hidden . '> ' . $options . ' </select>'; if ($disableOldPermissionSystem) { $this->content .= $selector; } else { $this->content .= $this->doc->section($LANG->getLL('Owner') . ':', $selector); } // Group selector: $options = ''; $userset = 0; foreach ($beGroupArray as $uid => $row) { if ($uid == $this->pageinfo['perms_groupid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>'; } if (!$userset && $this->pageinfo['perms_groupid']) { // If the group was not set AND there is a group for the page $options = ' <option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArray_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options; } $options = ' <option value="0"></option>' . $options; $selector = ' <select name="data[pages][' . $this->id . '][perms_groupid]"' . $hidden . '> ' . $options . ' </select>'; if ($disableOldPermissionSystem) { $this->content .= $selector; } else { $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($LANG->getLL('Group') . ':', $selector); } // Permissions checkbox matrix: $code = ' <input type="hidden" name="pageID" value="' . $this->id . '" /> <table border="0" cellspacing="2" cellpadding="0" id="typo3-permissionMatrix"> <tr> <td></td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('1', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('16', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('2', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('4', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('8', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('recursiveAcl', 1)) . '</td> <td></td> </tr>'; if (!$disableOldPermissionSystem) { $code .= ' <tr> <td align="right" class="bgColor2">' . $LANG->getLL('Owner', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 4) . '</td> <td class="bgColor-20"></td> <td></td> </tr> <tr> <td align="right" class="bgColor2">' . $LANG->getLL('Group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 4) . '</td> <td class="bgColor-20"></td> <td></td> </tr> <tr> <td align="right" class="bgColor2">' . $LANG->getLL('Everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 4) . '</td> <td class="bgColor-20"></td> <td></td> </tr>'; } // ACL CODE $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_beacl_acl', 'pid=' . intval($this->id)); while ($result = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $acl_prefix = 'data[tx_beacl_acl][' . $result['uid'] . ']'; $code .= '<tr> <td align="right" class="bgColor2"><select name="' . $acl_prefix . '[type]" onChange="updateUserGroup(' . $result['uid'] . ')"><option value="0" ' . ($result['type'] ? '' : 'selected="selected"') . '>User</option><option value="1" ' . ($result['type'] ? 'selected="selected"' : '') . '>Group</option></select><select name="' . $acl_prefix . '[object_id]"></select></td> <td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 1, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 5, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 2, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 3, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_acl_' . $result['uid'], 4, 'data[tx_beacl_acl][' . $result['uid'] . '][permissions]') . ' <input type="hidden" name="' . $acl_prefix . '[permissions]" value="' . $result['permissions'] . '" /> <script type="text/javascript">updateUserGroup(' . $result['uid'] . ', ' . $result['object_id'] . '); setCheck("check[perms_acl_' . $result['uid'] . ']","data[tx_beacl_acl][' . $result['uid'] . '][permissions]"); global_currentACLs[global_currentACLs.length] = ' . $result['uid'] . ' ; </script> </td> <td class="bgColor-20"> <input type="hidden" name="' . $acl_prefix . '[recursive]" value="0" /> <input type="checkbox" name="' . $acl_prefix . '[recursive]" value="1" ' . ($result['recursive'] ? 'checked="checked"' : '') . ' /> </td> <td><a href="#" onClick="deleteACL(' . $result['uid'] . ')"><img ' . t3lib_iconWorks::skinImg('../../../', 'gfx/garbage.gif') . ' alt="' . $LANG->getLL('delAcl', 1) . '" /></a></td> </tr>'; } $code .= ' </table> <br />'; if ($disableOldPermissionSystem) { $code .= '<span style="display:none;">'; for ($i = 1; $i <= 5; ++$i) { $code .= $this->printCheckBox('perms_user', $i) . $this->printCheckBox('perms_group', $i) . $this->printCheckBox('perms_everybody', $i); } $code .= '</span>'; } $code .= ' <span id="insertHiddenFields"></span> <img ' . t3lib_iconWorks::skinImg('../../../', 'gfx/garbage.gif') . ' alt="' . $LANG->getLL('delAcl', 1) . '" / id="templateDeleteImage" style="display:none"> <a href="javascript:addACL()"><img ' . t3lib_iconWorks::skinImg('../../../', 'gfx/new_el.gif') . ' alt="' . $LANG->getLL('addAcl', 1) . '" />' . $LANG->getLL('addAcl', 1) . '</a><br> <input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" /> ' . ($disableOldPermissionSystem ? '' : $this->getRecursiveSelect($this->id, $this->perms_clause)) . ' <input type="submit" name="submit" value="' . $LANG->getLL('saveAndClose', 1) . '" />' . '<input type="submit" value="' . $LANG->getLL('Abort', 1) . '" onclick="' . htmlspecialchars('jumpToUrl(\'index.php?id=' . $this->id . '\'); return false;') . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars(TYPO3_MOD_PATH . 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . intval($this->return_id) . '&lastEdited=' . $this->id) . '" /> ' . t3lib_TCEforms::getHiddenTokenField('tceAction'); // Adding section with the permission setting matrix: $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($LANG->getLL('permissions') . ':', $code); // CSH for permissions setting $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br /><br />'); // Adding help text: if ($BE_USER->uc['helpText']) { $this->content .= $this->doc->divider(20); $legendText = '<strong>' . $LANG->getLL('1', 1) . '</strong>: ' . $LANG->getLL('1_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('16', 1) . '</strong>: ' . $LANG->getLL('16_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('2', 1) . '</strong>: ' . $LANG->getLL('2_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('4', 1) . '</strong>: ' . $LANG->getLL('4_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('8', 1) . '</strong>: ' . $LANG->getLL('8_t', 1); $code = $legendText . '<br /><br />' . $LANG->getLL('def', 1); $this->content .= $this->doc->section($LANG->getLL('Legend', 1) . ':', $code); } }
/** * execute this task * * @return boolean */ public function execute() { $this->init(); while ($this->shouldAnotherChunkBeProcessed()) { $events = $this->eventRepository->findRecordsForReindexing($this->chunkSize, $this->minIndexAgeAbsolute); if (!$events->count() > 0) { // if: there is nothing more to do return true; } $this->indexEvents($events); } // if: the script stopped, but not all data could be processed if ($GLOBALS['LANG']) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf('cz_simple_cal (uid: %d): %s', $this->getTaskUid(), sprintf($GLOBALS['LANG']->sL('LLL:EXT:cz_simple_cal/Resources/Private/Language/locallang_mod.xml:tx_czsimplecal_scheduler_index.info_index_not_finished'), date('c', $this->eventRepository->getMaxIndexAge()))), '', t3lib_FlashMessage::INFO); t3lib_FlashMessageQueue::addMessage($message); } return true; }
/** * Creates or displayes an error message telling the user that the submitted * form token is invalid. * * @return void */ protected function createValidationErrorMessage() { $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:error.formProtection.tokenInvalid'), '', t3lib_FlashMessage::ERROR, TRUE); t3lib_FlashMessageQueue::addMessage($message); }
/** * Renders the sub elements of the given elementContentTree array. This function basically * renders the "new" and "paste" buttons for the parent element and then traverses through * the sub elements (if any exist). The sub element's (preview-) content will be rendered * by render_framework_singleSheet(). * * Calls render_framework_allSheets() and therefore generates a recursion. * * @param array $elementContentTreeArr: Content tree starting with the element which possibly has sub elements * @param string $languageKey: Language key for current display * @param string $sheet: Key of the sheet we want to render * @param integer $calcPerms: Defined the access rights for the enclosing parent * @return string HTML output (a table) of the sub elements and some "insert new" and "paste" buttons * @access protected * @see render_framework_allSheets(), render_framework_singleSheet() */ function render_framework_subElements($elementContentTreeArr, $languageKey, $sheet, $calcPerms = 0) { global $LANG; $beTemplate = ''; $flagRenderBeLayout = false; $canEditContent = $GLOBALS['BE_USER']->isPSet($calcPerms, 'pages', 'editcontent'); // Define l/v keys for current language: $langChildren = intval($elementContentTreeArr['ds_meta']['langChildren']); $langDisable = intval($elementContentTreeArr['ds_meta']['langDisable']); //if page DS and the checkbox is not set use always langDisable in inheritance mode if ($elementContentTreeArr['el']['table'] == 'pages' && $GLOBALS['BE_USER']->isAdmin()) { if ($langDisable != 1 && $this->MOD_SETTINGS['disablePageStructureInheritance'] != '1' && $langChildren == 1) { $langDisable = 1; } } $lKey = $langDisable ? 'lDEF' : ($langChildren ? 'lDEF' : 'l' . $languageKey); $vKey = $langDisable ? 'vDEF' : ($langChildren ? 'v' . $languageKey : 'vDEF'); if (!is_array($elementContentTreeArr['sub'][$sheet]) || !is_array($elementContentTreeArr['sub'][$sheet][$lKey])) { return ''; } $output = ''; $cells = array(); // get used TO if (isset($elementContentTreeArr['el']['TO']) && intval($elementContentTreeArr['el']['TO'])) { $toRecord = t3lib_BEfunc::getRecordWSOL('tx_templavoila_tmplobj', intval($elementContentTreeArr['el']['TO'])); } else { $toRecord = $this->apiObj->getContentTree_fetchPageTemplateObject($this->rootElementRecord); } try { $toRepo = t3lib_div::makeInstance('tx_templavoila_templateRepository'); /** @var $toRepo tx_templavoila_templateRepository */ $to = $toRepo->getTemplateByUid($toRecord['uid']); /** @var $to tx_templavoila_template */ $beTemplate = $to->getBeLayout(); } catch (InvalidArgumentException $e) { // might happen if uid was not what the Repo expected - that's ok here } if ($beTemplate === FALSE && isset($elementContentTreeArr['ds_meta']['beLayout'])) { $beTemplate = $elementContentTreeArr['ds_meta']['beLayout']; } // no layout, no special rendering $flagRenderBeLayout = $beTemplate ? TRUE : FALSE; // Traverse container fields: foreach ($elementContentTreeArr['sub'][$sheet][$lKey] as $fieldID => $fieldValuesContent) { try { $newValue = $to->getLocalDataprotValueByXpath('//' . $fieldID . '/tx_templavoila/preview'); $elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['tx_templavoila']['preview'] = $newValue; } catch (UnexpectedValueException $e) { } if (is_array($fieldValuesContent[$vKey]) && ($elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['isMapped'] || $elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['type'] == 'no_map') && $elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['tx_templavoila']['preview'] != 'disable') { $fieldContent = $fieldValuesContent[$vKey]; $cellContent = ''; // Create flexform pointer pointing to "before the first sub element": $subElementPointer = array('table' => $elementContentTreeArr['el']['table'], 'uid' => $elementContentTreeArr['el']['uid'], 'sheet' => $sheet, 'sLang' => $lKey, 'field' => $fieldID, 'vLang' => $vKey, 'position' => 0); if (isset($elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['TCEforms']['config']['maxitems'])) { $maxCnt = $elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['TCEforms']['config']['maxitems']; $maxItemsReached = is_array($fieldContent['el_list']) && count($fieldContent['el_list']) >= $maxCnt; } else { $maxItemsReached = FALSE; } if ($maxItemsReached) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('maximal_content_elements'), $maxCnt, $elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['tx_templavoila']['title']), t3lib_FlashMessage::INFO); t3lib_FlashMessageQueue::addMessage($flashMessage); } $canCreateNew = $canEditContent && !$maxItemsReached; $canDragDrop = !$maxItemsReached && $canEditContent && $elementContentTreeArr['previewData']['sheets'][$sheet][$fieldID]['tx_templavoila']['enableDragDrop'] !== '0' && $this->modTSconfig['properties']['enableDragDrop'] !== '0'; if (!$this->translatorMode && $canCreateNew) { $cellContent .= $this->link_bottomControls($subElementPointer, $canCreateNew); } // Render the list of elements (and possibly call itself recursively if needed): if (is_array($fieldContent['el_list'])) { foreach ($fieldContent['el_list'] as $position => $subElementKey) { $subElementArr = $fieldContent['el'][$subElementKey]; if ((!$subElementArr['el']['isHidden'] || $this->MOD_SETTINGS['tt_content_showHidden'] !== '0') && $this->displayElement($subElementArr)) { // When "onlyLocalized" display mode is set and an alternative language gets displayed if ($this->MOD_SETTINGS['langDisplayMode'] == 'onlyLocalized' && $this->currentLanguageUid > 0) { // Default language element. Subsitute displayed element with localized element if ($subElementArr['el']['sys_language_uid'] == 0 && is_array($subElementArr['localizationInfo'][$this->currentLanguageUid]) && ($localizedUid = $subElementArr['localizationInfo'][$this->currentLanguageUid]['localization_uid'])) { $localizedRecord = t3lib_BEfunc::getRecordWSOL('tt_content', $localizedUid, '*'); $tree = $this->apiObj->getContentTree('tt_content', $localizedRecord); $subElementArr = $tree['tree']; } } $this->containedElements[$this->containedElementsPointer]++; // Modify the flexform pointer so it points to the position of the curren sub element: $subElementPointer['position'] = $position; if (!$this->translatorMode) { $cellContent .= '<div' . ($canDragDrop ? ' class="sortableItem tpm-element t3-page-ce inactive"' : ' class="tpm-element t3-page-ce inactive"') . ' id="' . $this->addSortableItem($this->apiObj->flexform_getStringFromPointer($subElementPointer), $canDragDrop) . '">'; } $cellContent .= $this->render_framework_allSheets($subElementArr, $languageKey, $subElementPointer, $elementContentTreeArr['ds_meta']); if (!$this->translatorMode && $canCreateNew) { $cellContent .= $this->link_bottomControls($subElementPointer, $canCreateNew); } if (!$this->translatorMode) { $cellContent .= '</div>'; } } else { // Modify the flexform pointer so it points to the position of the curren sub element: $subElementPointer['position'] = $position; $cellId = $this->addSortableItem($this->apiObj->flexform_getStringFromPointer($subElementPointer), $canDragDrop); $cellFragment = '<div' . ($canDragDrop ? ' class="sortableItem tpm-element"' : ' class="tpm-element"') . ' id="' . $cellId . '"></div>'; $cellContent .= $cellFragment; } } } $cellIdStr = ''; $tmpArr = $subElementPointer; unset($tmpArr['position']); $cellId = $this->addSortableItem($this->apiObj->flexform_getStringFromPointer($tmpArr), $canDragDrop); $cellIdStr = ' id="' . $cellId . '"'; if ($canDragDrop) { $this->sortableContainers[] = $cellId; } // Add cell content to registers: if ($flagRenderBeLayout == TRUE) { $beTemplateCell = '<table width="100%" class="beTemplateCell"> <tr> <td class="bgColor6 tpm-title-cell">' . $LANG->sL($fieldContent['meta']['title'], 1) . '</td> </tr> <tr> <td ' . $cellIdStr . ' class="tpm-content-cell">' . $cellContent . '</td> </tr> </table>'; $beTemplate = str_replace('###' . $fieldID . '###', $beTemplateCell, $beTemplate); } else { $width = round(100 / count($elementContentTreeArr['sub'][$sheet][$lKey])); $cells[] = array('id' => $cellId, 'idStr' => $cellIdStr, 'title' => $LANG->sL($fieldContent['meta']['title'], 1), 'width' => $width, 'content' => $cellContent); } } } if ($flagRenderBeLayout) { //replace lang markers $beTemplate = preg_replace_callback("/###(LLL:[\\w-\\/:]+?\\.xml\\:[\\w-\\.]+?)###/", create_function('$matches', 'return $GLOBALS["LANG"]->sL($matches[1], 1);'), $beTemplate); // removes not used markers $beTemplate = preg_replace("/###field_.*?###/", '', $beTemplate); return $beTemplate; } // Compile the content area for the current element if (count($cells)) { $hookObjectsArr = $this->hooks_prepareObjectsArray('renderFrameworkClass'); $alreadyRendered = FALSE; $output = ''; foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'composeSubelements')) { $hookObj->composeSubelements($cells, $elementContentTreeArr, $output, $alreadyRendered, $this); } } if (!$alreadyRendered) { $headerCells = $contentCells = array(); foreach ($cells as $cell) { $headerCells[] = vsprintf('<td width="%4$d%%" class="bgColor6 tpm-title-cell">%3$s</td>', $cell); $contentCells[] = vsprintf('<td %2$s width="%4$d%%" class="tpm-content-cell">%5$s</td>', $cell); } $output = ' <table border="0" cellpadding="2" cellspacing="2" width="100%" class="tpm-subelement-table"> <tr>' . (count($headerCells) ? implode('', $headerCells) : '<td> </td>') . '</tr> <tr>' . (count($contentCells) ? implode('', $contentCells) : '<td> </td>') . '</tr> </table> '; } } return $output; }
/** * [Describe function...] * * @param [type] $NACats: ... * @param [type] $row: ... * @return [type] ... */ function printError($NACats, $row = array()) { $msgHeader = 'SAVING DISABLED!!'; $msgBody = ($row['l18n_parent'] && $row['sys_language_uid'] ? 'The translation original of this' : 'This') . ' record has the following categories assigned that are not defined in your BE usergroup: ' . urldecode(implode($NACats, chr(10))); if ($this->compatibility()->int_from_ver(TYPO3_version) < 4003000) { $msg = ' <div style="padding:15px 15px 20px 0;"> <div class="typo3-message message-warning"> <div class="message-header">' . $msgHeader . '</div> <div class="message-body">' . $msgBody . '</div> </div> </div>'; // add flashmessages styles to older TYPO3 versions $cssPath = $GLOBALS['BACK_PATH'] . t3lib_extMgm::extRelPath('tt_news'); $msg = '<link rel="stylesheet" type="text/css" href="' . $cssPath . 'compat/flashmessages.css" media="screen" />' . $msg; } else { // in TYPO3 4.3 or higher we use flashmessages to display the message $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $msgBody, $msgHeader, t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($flashMessage); $inlineFlashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $msgBody, '', t3lib_FlashMessage::WARNING); $msg = $inlineFlashMessage->render(); } return $msg; }
/** * Search for the given address in one of the geocoding services and update * its data. * * Data lat, lon, zip and city may get updated. * * @param array &$address Address record from database * @param integer $service Geocoding service to use * - 0: internal caching database table * - 1: geonames.org * - 2: nominatim.openstreetmap.org * * @return boolean True if the address got updated, false if not. */ function searchAddress(&$address, $service = 0) { $config = tx_odsosm_div::getConfig(array('default_country', 'geo_service_email', 'geo_service_user')); $ll = false; $country = strtoupper(strlen($address['country']) == 2 ? $address['country'] : $config['default_country']); $email = t3lib_div::validEmail($config['geo_service_email']) ? $config['geo_service_email'] : $_SERVER['SERVER_ADMIN']; if (TYPO3_DLOG) { $service_names = array(0 => 'cache', 1 => 'geonames', 2 => 'nominatim'); t3lib_div::devLog('Search address using ' . $service_names[$service], 'ods_osm', 0, $address); } switch ($service) { case 0: // cache $where = array(); if ($country) { $where[] = 'country=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($country, 'tx_odsosm_geocache'); } if ($address['city']) { $where[] = '(city=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($address['city'], 'tx_odsosm_geocache') . ' OR search_city=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($address['city'], 'tx_odsosm_geocache') . ')'; } if ($address['zip']) { $where[] = 'zip=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($address['zip'], 'tx_odsosm_geocache'); } if ($address['street']) { $where[] = 'street=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($address['street'], 'tx_odsosm_geocache'); } if ($address['housenumber']) { $where[] = 'housenumber=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($address['housenumber'], 'tx_odsosm_geocache'); } if ($where) { $where[] = 'deleted=0'; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_odsosm_geocache', implode(' AND ', $where)); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if ($row) { $ll = true; $set = array('tstamp' => time(), 'cache_hit' => $row['cache_hit'] + 1); $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_odsosm_geocache', 'uid=' . $row['uid'], $set); $address['lat'] = $row['lat']; $address['lon'] = $row['lon']; if ($row['zip']) { $address['zip'] = $row['zip']; } if ($row['city']) { $address['city'] = $row['city']; } if ($row['state']) { $address['state'] = $row['state']; } if (empty($address['country'])) { $address['country'] = $row['country']; } } } break; case 1: // http://www.geonames.org/ if ($country) { $query['country'] = $country; } if ($address['city']) { $query['placename'] = $address['city']; } if ($address['zip']) { $query['postalcode'] = $address['zip']; } if ($query) { $query['maxRows'] = 1; $query['username'] = $config['geo_service_user']; $xml = t3lib_div::getURL('http://api.geonames.org/postalCodeSearch?' . http_build_query($query, '', '&'), false, 'User-Agent: TYPO3 extension ods_osm/' . t3lib_extMgm::getExtensionVersion('ods_osm')); if (TYPO3_DLOG && $xml === false) { t3lib_div::devLog('t3lib_div::getURL failed', "ods_osm", 3); } if ($xml) { $xmlobj = new SimpleXMLElement($xml); if ($xmlobj->status) { if (TYPO3_DLOG) { t3lib_div::devLog('GeoNames message', 'ods_osm', 2, (array) $xmlobj->status->attributes()); } $o_flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', (string) $xmlobj->status->attributes()->message, 'GeoNames message', t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($o_flashMessage); } if ($xmlobj->code) { $ll = true; $address['lat'] = (string) $xmlobj->code->lat; $address['lon'] = (string) $xmlobj->code->lng; if ($xmlobj->code->postalcode) { $address['zip'] = (string) $xmlobj->code->postalcode; } if ($xmlobj->code->name) { $address['city'] = (string) $xmlobj->code->name; } if (empty($address['country'])) { $address['country'] = (string) $xmlobj->code->countryCode; } } } } break; case 2: // http://nominatim.openstreetmap.org/ $query['country'] = $country; $query['email'] = $email; $query['addressdetails'] = 1; $query['format'] = 'xml'; if ($this->address_type == 'structured') { if ($address['city']) { $query['city'] = $address['city']; } if ($address['zip']) { $query['postalcode'] = $address['zip']; } if ($address['street']) { $query['street'] = $address['street']; } if ($address['housenumber']) { $query['street'] = $address['housenumber'] . ' ' . $query['street']; } if (TYPO3_DLOG) { t3lib_div::devLog('Nominatim structured', 'ods_osm', -1, $query); } $ll = tx_odsosm_div::searchAddressNominatim($query, $address); if (!$ll && $query['postalcode']) { unset($query['postalcode']); if (TYPO3_DLOG) { t3lib_div::devLog('Nominatim retrying without zip', 'ods_osm', -1, $query); } $ll = tx_odsosm_div::searchAddressNominatim($query, $address); } } if ($this->address_type == 'unstructured') { $query['q'] = $address['address']; if (TYPO3_DLOG) { t3lib_div::devLog('Nominatim unstructured', 'ods_osm', -1, $query); } $ll = tx_odsosm_div::searchAddressNominatim($query, $address); } break; } if (TYPO3_DLOG) { if ($ll) { t3lib_div::devLog('Return address', 'ods_osm', 0, $address); } else { t3lib_div::devLog('No address found', 'ods_osm', 0); } } return $ll; }
/** * Performs the connection test for the selected service and passes the appropriate results to the view * * @param string $service Key of the service to test * @param string $parameters Parameters for the service being tested * @param integer $format Type of format to use (0 = raw, 1 = array, 2 = xml) * @return string Result from the test */ protected function performTest($service, $parameters, $format) { $result = ''; // Get the corresponding service object from the repository $serviceObject = $this->connectorRepository->findServiceByKey($service); if ($serviceObject->init()) { $parameters = $this->parseParameters($parameters); try { // Call the right "fetcher" depending on chosen format switch ($format) { case 1: $result = $serviceObject->fetchArray($parameters); break; case 2: $result = $serviceObject->fetchXML($parameters); break; default: $result = $serviceObject->fetchRaw($parameters); break; } // If the result is empty, issue an information message if (empty($result)) { /** @var $messageObject t3lib_FlashMessage */ $messageObject = t3lib_div::makeInstance('t3lib_FlashMessage', Tx_Extbase_Utility_Localization::translate('no.result', 'svconnector'), '', t3lib_FlashMessage::INFO); t3lib_FlashMessageQueue::addMessage($messageObject); } } catch (Exception $e) { /** @var $messageObject t3lib_FlashMessage */ $messageObject = t3lib_div::makeInstance('t3lib_FlashMessage', Tx_Extbase_Utility_Localization::translate('service.error', 'svconnector', array($e->getMessage(), $e->getCode())), '', t3lib_FlashMessage::ERROR); t3lib_FlashMessageQueue::addMessage($messageObject); } } return $result; }
/** * [Describe function...] * * @return [type] ... */ function main() { global $SOBE, $BE_USER, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; global $tmpl, $tplRow, $theConstants; $POST = t3lib_div::_POST(); // ************************** // Checking for more than one template an if, set a menu... // ************************** $manyTemplatesMenu = $this->pObj->templateMenu(); $template_uid = 0; if ($manyTemplatesMenu) { $template_uid = $this->pObj->MOD_SETTINGS["templatesOnPage"]; } // ************************** // Main // ************************** // BUGBUG: Should we check if the uset may at all read and write template-records??? $bType = $this->pObj->MOD_SETTINGS["ts_browser_type"]; $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize if ($existTemplate) { $theOutput .= '<h4 style="margin-bottom:5px;">' . $GLOBALS['LANG']->getLL('currentTemplate') . ' <img ' . t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)) . ' align="top" /> <strong>' . $this->pObj->linkWrapTemplateTitle($tplRow["title"], $bType == "setup" ? "config" : "constants") . '</strong>' . htmlspecialchars(trim($tplRow["sitetitle"]) ? ' - (' . $tplRow["sitetitle"] . ')' : '') . '</h4>'; if ($manyTemplatesMenu) { $theOutput .= $this->pObj->doc->section("", $manyTemplatesMenu); $theOutput .= $this->pObj->doc->divider(5); } if ($POST["add_property"] || $POST["update_value"] || $POST["clear_object"]) { // add property $line = ""; if (is_array($POST["data"])) { $name = key($POST["data"]); if ($POST['data'][$name]['name'] !== '') { // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form. unset($POST['update_value']); $POST['add_property'] = 'Add'; } if ($POST["add_property"]) { $property = trim($POST['data'][$name]['name']); if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) { $badPropertyMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('noSpaces') . '<br />' . $GLOBALS['LANG']->getLL('nothingUpdated'), $GLOBALS['LANG']->getLL('badProperty'), t3lib_FlashMessage::ERROR); t3lib_FlashMessageQueue::addMessage($badPropertyMessage); } else { $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']); $propertyAddedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('propertyAdded')); t3lib_FlashMessageQueue::addMessage($propertyAddedMessage); $line .= LF . $pline; } } elseif ($POST['update_value']) { $pline = $name . " = " . trim($POST['data'][$name]['value']); $updatedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('valueUpdated')); t3lib_FlashMessageQueue::addMessage($updatedMessage); $line .= LF . $pline; } elseif ($POST['clear_object']) { if ($POST['data'][$name]['clearValue']) { $pline = $name . ' >'; $objectClearedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($pline), $GLOBALS['LANG']->getLL('objectCleared')); t3lib_FlashMessageQueue::addMessage($objectClearedMessage); $line .= LF . $pline; } } } if ($line) { $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; // Set the data to be saved $recData = array(); $field = $bType == "setup" ? "config" : "constants"; $recData["sys_template"][$saveId][$field] = $tplRow[$field] . $line; // Create new tce-object $tce = t3lib_div::makeInstance("t3lib_TCEmain"); $tce->stripslashes_values = 0; // Initialize $tce->start($recData, array()); // Saved the stuff $tce->process_datamap(); // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php) $tce->clear_cacheCmd("all"); // re-read the template ... $this->initialize_editor($this->pObj->id, $template_uid); } } } $tsbr = t3lib_div::_GET('tsbr'); $update = 0; if (is_array($tsbr)) { // If any plus-signs were clicked, it's registred. $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_" . $bType] = $tmpl->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_" . $bType]); $update = 1; } if ($POST["Submit"]) { // If any POST-vars are send, update the condition array $this->pObj->MOD_SETTINGS["tsbrowser_conditions"] = $POST["conditions"]; $update = 1; } if ($update) { $GLOBALS["BE_USER"]->pushModuleData($this->pObj->MCONF["name"], $this->pObj->MOD_SETTINGS); } $tmpl->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions']; $tmpl->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy'; // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match. $tmpl->constantMode = $this->pObj->MOD_SETTINGS["ts_browser_const"]; if ($this->pObj->sObj && $tmpl->constantMode) { $tmpl->constantMode = "untouched"; } $tmpl->regexMode = $this->pObj->MOD_SETTINGS["ts_browser_regexsearch"]; $tmpl->fixedLgd = $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"]; $tmpl->linkObjects = TRUE; $tmpl->ext_regLinenumbers = TRUE; $tmpl->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments']; $tmpl->bType = $bType; $tmpl->resourceCheck = 1; $tmpl->uplPath = PATH_site . $tmpl->uplPath; $tmpl->removeFromGetFilePath = PATH_site; //debug($tmpl->uplPath); if ($this->pObj->MOD_SETTINGS["ts_browser_type"] == "const") { $tmpl->ext_constants_BRP = intval(t3lib_div::_GP("breakPointLN")); } else { $tmpl->ext_config_BRP = intval(t3lib_div::_GP("breakPointLN")); } $tmpl->generateConfig(); if ($bType == "setup") { $theSetup = $tmpl->setup; } else { $theSetup = $tmpl->setup_constants; } // EDIT A VALUE: if ($this->pObj->sObj) { list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : ""); if ($existTemplate) { // Value $out = ''; $out .= htmlspecialchars($this->pObj->sObj) . ' =<br />'; $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />'; $out .= '<input type="Submit" name="update_value" value="' . $GLOBALS['LANG']->getLL('updateButton') . '" />'; $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editProperty'), $out, 0, 0); // Property if (t3lib_extMgm::isLoaded("tsconfig_help")) { $url = $BACK_PATH . "wizard_tsconfig.php?mode=tsref&onlyProperty=1"; $params = array(); $params["formName"] = "editForm"; $params["itemName"] = "data[" . htmlspecialchars($this->pObj->sObj) . "][name]"; $params["itemValue"] = "data[" . htmlspecialchars($this->pObj->sObj) . "][propertyValue]"; $TSicon = '<a href="#" onClick="vHWin=window.open(\'' . $url . t3lib_div::implodeArrayForUrl("", array("P" => $params)) . '\',\'popUp' . $md5ID . '\',\'height=500,width=780,status=0,menubar=0,scrollbars=1\');vHWin.focus();return false;"><img src="' . $BACK_PATH . 'gfx/wizard_tsconfig_s.gif" width="22" height="16" border="0" class="absmiddle" hspace=2 title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef') . '"></a>'; } else { $TSicon = ""; } $out = ''; $out = '<nobr>' . htmlspecialchars($this->pObj->sObj) . '.'; $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />' . $TSicon . ' = </nobr><br />'; $out .= '<input type="Text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $GLOBALS['TBE_TEMPLATE']->formWidth(40) . ' />'; $out .= '<input type="Submit" name="add_property" value="' . $GLOBALS['LANG']->getLL('addButton') . '" />'; $theOutput .= $this->pObj->doc->spacer(20); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('addProperty'), $out, 0, 0); // clear $out = ''; $out = htmlspecialchars($this->pObj->sObj) . " <strong>" . $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('clear'), 'toUpper') . "</strong> "; $out .= '<input type="Checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />'; $out .= '<input type="Submit" name="clear_object" value="' . $GLOBALS['LANG']->getLL('clearButton') . '" />'; $theOutput .= $this->pObj->doc->spacer(20); $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('clearObject'), $out, 0, 0); $theOutput .= $this->pObj->doc->spacer(10); } else { $noTemplateMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('noCurrentTemplate'), $GLOBALS['LANG']->getLL('edit'), t3lib_FlashMessage::ERROR); t3lib_FlashMessageQueue::addMessage($noTemplateMessage); } // Links: $out = ''; if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) { if (count($theSetup)) { $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj) . '">'; $out .= sprintf($GLOBALS['LANG']->getLL('addKey'), htmlspecialchars($this->pObj->sObj)); } } else { $out = '<a href="index.php?id=' . $this->pObj->id . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0">'; $out .= sprintf($GLOBALS['LANG']->getLL('removeKey'), htmlspecialchars($this->pObj->sObj)); } if ($out) { $theOutput .= $this->pObj->doc->divider(5); $theOutput .= $this->pObj->doc->section("", $out); } // back $out = $GLOBALS['LANG']->getLL('back'); $out = '<a href="index.php?id=' . $this->pObj->id . '"><strong>' . $out . '</strong></a>'; $theOutput .= $this->pObj->doc->divider(5); $theOutput .= $this->pObj->doc->section("", $out); } else { $tmpl->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS["tsbrowser_depthKeys_" . $bType]; if (t3lib_div::_POST('search') && t3lib_div::_POST('search_field')) { // If any POST-vars are send, update the condition array $tmpl->tsbrowser_depthKeys = $tmpl->ext_getSearchKeys($theSetup, '', t3lib_div::_POST('search_field'), array()); } $menu = '<div class="tsob-menu"><label>' . $GLOBALS['LANG']->getLL('browse') . '</label>'; $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']); $menu .= '<label for="ts_browser_toplevel_' . $bType . '">' . $GLOBALS['LANG']->getLL('objectList') . '</label>'; $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]); //search $menu .= '<label for="search_field">' . $GLOBALS['LANG']->getLL('search') . '</label>'; $menu .= '<input type="Text" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . '/>'; $menu .= '<input type="Submit" name="search" class="tsob-search-submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:search') . '" />'; $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"'); $menu .= '<label for="checkTs_browser_regexsearch">' . $GLOBALS['LANG']->getLL('regExp') . '</label>'; $menu .= '</div>'; $theOutput .= $this->pObj->doc->section('', '<nobr>' . $menu . '</nobr>'); $theKey = $this->pObj->MOD_SETTINGS["ts_browser_toplevel_" . $bType]; if (!$theKey || !str_replace("-", "", $theKey)) { $theKey = ""; } list($theSetup, $theSetupValue) = $tmpl->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : ''); $tree = $tmpl->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']); $tree = $tmpl->substituteCMarkers($tree); // Parser Errors: $pEkey = $bType == "setup" ? "config" : "constants"; if (count($tmpl->parserErrors[$pEkey])) { $errMsg = array(); foreach ($tmpl->parserErrors[$pEkey] as $inf) { $errMsg[] = $inf[1] . ": " . $inf[0]; } $theOutput .= $this->pObj->doc->spacer(10); $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', implode($errMsg, '<br />'), $GLOBALS['LANG']->getLL('errorsWarnings'), t3lib_FlashMessage::ERROR); $theOutput .= $flashMessage->render(); } if (isset($this->pObj->MOD_SETTINGS["ts_browser_TLKeys_" . $bType][$theKey])) { $remove = '<td width="1%" nowrap><a href="index.php?id=' . $this->pObj->id . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0"><strong>' . $GLOBALS['LANG']->getLL('removeKey') . '</strong></a></td>'; } else { $remove = ''; } $label = $theKey ? $theKey : ($bType == 'setup' ? $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('setupRoot'), 'toUpper') : $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('constantRoot'), 'toUpper')); $theOutput .= $this->pObj->doc->spacer(15); $theOutput .= $this->pObj->doc->sectionEnd(); $theOutput .= '<table border="0" cellpadding="1" cellspacing="0" id="typo3-objectBrowser" width="100%"> <tr> <td><img src=clear.gif width=4 height=1></td> <td class="bgColor2"> <table border=0 cellpadding=0 cellspacing=0 class="bgColor5" width="100%"><tr class="t3-row-header"><td nowrap width="99%"><strong>' . $label . '</strong></td>' . $remove . '</tr></table> </td> </tr> <tr> <td><img src=clear.gif width=4 height=1></td> <td class="bgColor2"> <table border=0 cellpadding=0 cellspacing=0 class="bgColor4" width="100%"><tr><td nowrap>' . $tree . '</td></tr></table></td> </tr> </table> '; // second row options $menu = '<div class="tsob-menu-row2">'; $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"'); $menu .= '<label for="checkTs_browser_showComments">' . $GLOBALS['LANG']->getLL('displayComments') . '</label>'; $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"'); $menu .= '<label for="checkTs_browser_alphaSort">' . $GLOBALS['LANG']->getLL('sortAlphabetically') . '</label>'; $menu .= t3lib_BEfunc::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS["ts_browser_fixedLgd"], '', '', 'id="checkTs_browser_fixedLgd"'); $menu .= '<label for="checkTs_browser_fixedLgd">' . $GLOBALS['LANG']->getLL('cropLines') . '</label>'; if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) { $menu .= '<br /><br /><label>' . $GLOBALS['LANG']->getLL('displayConstants') . '</label>'; $menu .= t3lib_BEfunc::getFuncMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']); } $menu .= '</div>'; $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1); // Conditions: if (is_array($tmpl->sections)) { $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1); $out = ''; foreach ($tmpl->sections as $key => $val) { $out .= '<tr><td nowrap class="tsob-conditions"><input type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? " checked" : "") . ' />'; $out .= '<label for="check' . $key . '">' . $tmpl->substituteCMarkers(htmlspecialchars($val)) . '</label></td></tr>'; } $theOutput .= ' <table border="0" cellpadding="0" cellspacing="0" class="bgColor4">' . $out . ' <td><br /><input type="Submit" name="Submit" value="' . $GLOBALS['LANG']->getLL('setConditions') . '" /></td> </table> '; } // Ending section: $theOutput .= $this->pObj->doc->sectionEnd(); } return $theOutput; }
/** * Check if the extension has been setup properly. * Renders a flash message when geoip is not available. * * @return void */ public function setupCheck() { try { Tx_Contexts_Geolocation_Adapter::getInstance(); } catch (Tx_Contexts_Geolocation_Exception $exception) { t3lib_FlashMessageQueue::addMessage(t3lib_div::makeInstance('t3lib_FlashMessage', 'The "<tt>geoip</tt>" PHP extension is not available.' . ' Geolocation contexts will not work.', 'Geolocation configuration', t3lib_FlashMessage::ERROR)); } }
/** * Display extensions details. * * @param string Extension key * @return void Writes content to $this->content */ function showExtDetails($extKey) { global $TYPO3_LOADED_EXT; list($list, ) = $this->extensionList->getInstalledExtensions(); $absPath = tx_em_Tools::getExtPath($extKey, $list[$extKey]['type']); // Check updateModule: if (isset($list[$extKey]) && @is_file($absPath . 'class.ext_update.php')) { require_once $absPath . 'class.ext_update.php'; $updateObj = new ext_update(); if (!$updateObj->access()) { unset($this->MOD_MENU['singleDetails']['updateModule']); } } else { unset($this->MOD_MENU['singleDetails']['updateModule']); } if ($this->CMD['doDelete']) { $this->MOD_MENU['singleDetails'] = array(); } // Function menu here: if (!$this->CMD['standAlone'] && !t3lib_div::_GP('standAlone')) { $content = $GLOBALS['LANG']->getLL('ext_details_ext') . ' <strong>' . $this->extensionTitleIconHeader($extKey, $list[$extKey]) . '</strong> (' . htmlspecialchars($extKey) . ')'; $this->content .= $this->doc->section('', $content); } // Show extension details: if ($list[$extKey]) { // Checking if a command for install/uninstall is executed: if (($this->CMD['remove'] || $this->CMD['load']) && !in_array($extKey, $this->requiredExt)) { // Install / Uninstall extension here: if (t3lib_extMgm::isLocalconfWritable()) { // Check dependencies: $depStatus = $this->install->checkDependencies($extKey, $list[$extKey]['EM_CONF'], $list); if (!$this->CMD['remove'] && !$depStatus['returnCode']) { $this->content .= $depStatus['html']; $newExtList = -1; } elseif ($this->CMD['remove']) { $newExtList = $this->extensionList->removeExtFromList($extKey, $list); } else { $newExtList = $this->extensionList->addExtToList($extKey, $list); } // Successful installation: if ($newExtList != -1) { $updates = ''; if ($this->CMD['load']) { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $script = t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[load]' => 1, 'CMD[clrCmd]' => $this->CMD['clrCmd'], 'SET[singleDetails]' => 'info')); } else { $script = ''; } $standaloneUpdates = ''; if ($this->CMD['standAlone']) { $standaloneUpdates .= '<input type="hidden" name="standAlone" value="1" />'; } if ($this->CMD['silendMode']) { $standaloneUpdates .= '<input type="hidden" name="silendMode" value="1" />'; } $depsolver = t3lib_div::_POST('depsolver'); if (is_array($depsolver['ignore'])) { foreach ($depsolver['ignore'] as $depK => $depV) { $dependencyUpdates .= '<input type="hidden" name="depsolver[ignore][' . $depK . ']" value="1" />'; } } $updatesForm = $this->install->updatesForm($extKey, $list[$extKey], 1, $script, $dependencyUpdates . $standaloneUpdates . '<input type="hidden" name="_do_install" value="1" /><input type="hidden" name="_clrCmd" value="' . $this->CMD['clrCmd'] . '" />', TRUE); if ($updatesForm) { $updates = $GLOBALS['LANG']->getLL('ext_details_new_tables_fields') . '<br />' . $GLOBALS['LANG']->getLL('ext_details_new_tables_fields_select') . $updatesForm; $labelDBUpdate = $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('ext_details_db_needs_update'), 'toUpper'); $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_installing') . ' ', $this->extensionTitleIconHeader($extKey, $list[$extKey])) . ' ' . $labelDBUpdate, $updates, 1, 1, 1, 1); } } elseif ($this->CMD['remove']) { $updates .= $this->install->checkClearCache($list[$extKey]); if ($updates) { $updates = ' <form action="' . $this->script . '" method="post">' . $updates . ' <br /><input type="submit" name="write" value="' . $GLOBALS['LANG']->getLL('ext_details_remove_ext') . '" /> <input type="hidden" name="_do_install" value="1" /> <input type="hidden" name="_clrCmd" value="' . $this->CMD['clrCmd'] . '" /> <input type="hidden" name="CMD[showExt]" value="' . $this->CMD['showExt'] . '" /> <input type="hidden" name="CMD[remove]" value="' . $this->CMD['remove'] . '" /> <input type="hidden" name="standAlone" value="' . $this->CMD['standAlone'] . '" /> <input type="hidden" name="silentMode" value="' . $this->CMD['silentMode'] . '" /> ' . ($this->noDocHeader ? '<input type="hidden" name="nodoc" value="1" />' : '') . ' </form>'; $labelDBUpdate = $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('ext_details_db_needs_update'), 'toUpper'); $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_removing') . ' ', $this->extensionTitleIconHeader($extKey, $list[$extKey])) . ' ' . $labelDBUpdate, $updates, 1, 1, 1, 1); } } if (!$updates || t3lib_div::_GP('_do_install') || $this->noDocHeader && $this->CMD['remove']) { $this->install->writeNewExtensionList($newExtList); $action = $this->CMD['load'] ? 'installed' : 'removed'; $GLOBALS['BE_USER']->writelog(5, 1, 0, 0, 'Extension list has been changed, extension %s has been %s', array($extKey, $action)); if (!t3lib_div::_GP('silentMode') && !$this->CMD['standAlone']) { $messageLabel = 'ext_details_ext_' . $action . '_with_key'; $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL($messageLabel), $extKey), '', t3lib_FlashMessage::OK, TRUE); t3lib_FlashMessageQueue::addMessage($flashMessage); } if ($this->CMD['clrCmd'] || t3lib_div::_GP('_clrCmd')) { if ($this->CMD['load'] && @is_file($absPath . 'ext_conf_template.txt')) { $vA = array('CMD' => array('showExt' => $extKey)); } else { $vA = array('CMD' => ''); } } else { $vA = array('CMD' => array('showExt' => $extKey)); } if ($this->CMD['standAlone'] || t3lib_div::_GP('standAlone')) { $this->content .= sprintf($GLOBALS['LANG']->getLL('ext_details_ext_installed_removed'), $this->CMD['load'] ? $GLOBALS['LANG']->getLL('ext_details_installed') : $GLOBALS['LANG']->getLL('ext_details_removed')) . '<br /><br />' . $this->getSubmitAndOpenerCloseLink(); } else { // Determine if new modules were installed: $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $list[$extKey]); if (($this->CMD['load'] || $this->CMD['remove']) && is_array($techInfo['flags']) && in_array('Module', $techInfo['flags'], true)) { $vA['CMD']['refreshMenu'] = 1; } t3lib_utility_Http::redirect(t3lib_div::linkThisScript($vA)); exit; } } } } else { $writeAccessError = $GLOBALS['LANG']->csConvObj->conv_case($GLOBALS['LANG']->charSet, $GLOBALS['LANG']->getLL('ext_details_write_access_error'), 'toUpper'); $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_installing') . ' ', $this->extensionTitleIconHeader($extKey, $list[$extKey])) . ' ' . $writeAccessError, $GLOBALS['LANG']->getLL('ext_details_write_error_localconf'), 1, 1, 2, 1); } } elseif ($this->CMD['downloadFile'] && !in_array($extKey, $this->requiredExt)) { // Link for downloading extension has been clicked - deliver content stream: $dlFile = $this->CMD['downloadFile']; if (t3lib_div::isAllowedAbsPath($dlFile) && t3lib_div::isFirstPartOfStr($dlFile, PATH_site) && t3lib_div::isFirstPartOfStr($dlFile, $absPath) && @is_file($dlFile)) { $mimeType = 'application/octet-stream'; Header('Content-Type: ' . $mimeType); Header('Content-Disposition: attachment; filename=' . basename($dlFile)); echo t3lib_div::getUrl($dlFile); exit; } else { throw new RuntimeException('TYPO3 Fatal Error: ' . $GLOBALS['LANG']->getLL('ext_details_error_downloading'), 1270853980); } } elseif ($this->CMD['editFile'] && !in_array($extKey, $this->requiredExt)) { // Editing extension file: $editFile = rawurldecode($this->CMD['editFile']); if (t3lib_div::isAllowedAbsPath($editFile) && t3lib_div::isFirstPartOfStr($editFile, $absPath)) { $fI = t3lib_div::split_fileref($editFile); if (@is_file($editFile) && t3lib_div::inList($this->editTextExtensions, $fI['fileext'] ? $fI['fileext'] : $fI['filebody'])) { if (filesize($editFile) < $this->kbMax * 1024) { $outCode = '<form action="' . $this->script . ' method="post" name="editfileform">'; $info = ''; $submittedContent = t3lib_div::_POST('edit'); $saveFlag = 0; if (isset($submittedContent['file']) && !$GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit']) { // Check referer here? $oldFileContent = t3lib_div::getUrl($editFile); if ($oldFileContent != $submittedContent['file']) { $oldMD5 = md5(str_replace(CR, '', $oldFileContent)); $info .= sprintf($GLOBALS['LANG']->getLL('ext_details_md5_previous'), '<strong>' . $oldMD5 . '</strong>') . '<br />'; t3lib_div::writeFile($editFile, $submittedContent['file']); $saveFlag = 1; } else { $info .= $GLOBALS['LANG']->getLL('ext_details_no_changes') . '<br />'; } } $fileContent = t3lib_div::getUrl($editFile); $outCode .= sprintf($GLOBALS['LANG']->getLL('ext_details_file'), '<strong>' . substr($editFile, strlen($absPath)) . '</strong> (' . t3lib_div::formatSize(filesize($editFile)) . ')<br />'); $fileMD5 = md5(str_replace(CR, '', $fileContent)); $info .= sprintf($GLOBALS['LANG']->getLL('ext_details_md5_current'), '<strong>' . $fileMD5 . '</strong>') . '<br />'; if ($saveFlag) { $saveMD5 = md5(str_replace(CR, '', $submittedContent['file'])); $info .= sprintf($GLOBALS['LANG']->getLL('ext_details_md5_submitted'), '<strong>' . $saveMD5 . '</strong>') . '<br />'; if ($fileMD5 != $saveMD5) { $info .= tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_saving_failed_changes_lost') . '</strong>') . '<br />'; } else { $info .= tx_em_Tools::rfw('<br /><strong>' . $GLOBALS['LANG']->getLL('ext_details_file_saved') . '</strong>') . '<br />'; } } $outCode .= '<textarea name="edit[file]" rows="35" wrap="off"' . $this->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font enable-tab">' . t3lib_div::formatForTextarea($fileContent) . '</textarea>'; $outCode .= '<input type="hidden" name="edit[filename]" value="' . $editFile . '" />'; $outCode .= '<input type="hidden" name="CMD[editFile]" value="' . htmlspecialchars($editFile) . '" />'; $outCode .= '<input type="hidden" name="CMD[showExt]" value="' . $extKey . '" />'; $outCode .= $info; if (!$GLOBALS['TYPO3_CONF_VARS']['EXT']['noEdit']) { $outCode .= '<br /><input type="submit" name="save_file" value="' . $GLOBALS['LANG']->getLL('ext_details_file_save_button') . '" />'; } else { $outCode .= tx_em_Tools::rfw('<br />' . $GLOBALS['LANG']->getLL('ext_details_saving_disabled') . ' '); } $onClick = 'window.location.href="' . t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey)) . '";return false;'; $outCode .= '<input type="submit" name="cancel" value="' . $GLOBALS['LANG']->getLL('ext_details_cancel_button') . '" onclick="' . htmlspecialchars($onClick) . '" /></form>'; $theOutput .= $this->doc->spacer(15); $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_edit_file'), '', 0, 1); $theOutput .= $this->doc->sectionEnd() . $outCode; $this->content .= $theOutput; } else { $theOutput .= $this->doc->spacer(15); $theOutput .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('ext_details_filesize_exceeded_kb'), $this->kbMax), sprintf($GLOBALS['LANG']->getLL('ext_details_file_too_large'), $this->kbMax)); } } } else { die(sprintf($GLOBALS['LANG']->getLL('ext_details_fatal_edit_error'), htmlspecialchars($editFile))); } } else { // MAIN: switch ((string) $this->MOD_SETTINGS['singleDetails']) { case 'info': // Loaded / Not loaded: if (!in_array($extKey, $this->requiredExt)) { if ($TYPO3_LOADED_EXT[$extKey]) { $content = '<strong>' . $GLOBALS['LANG']->getLL('ext_details_loaded_and_running') . '</strong><br />' . '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[remove]' => 1))) . '">' . $GLOBALS['LANG']->getLL('ext_details_remove_button') . ' ' . tx_em_Tools::removeButton() . '</a>'; } else { $content = $GLOBALS['LANG']->getLL('ext_details_not_loaded') . '<br />' . '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[load]' => 1))) . '">' . $GLOBALS['LANG']->getLL('ext_details_install_button') . ' ' . tx_em_Tools::installButton() . '</a>'; } } else { $content = $GLOBALS['LANG']->getLL('ext_details_always_loaded'); } $this->content .= $this->doc->spacer(10); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_current_status'), $content, 0, 1); if (t3lib_extMgm::isLoaded($extKey)) { $updates = $this->install->updatesForm($extKey, $list[$extKey]); if ($updates) { $this->content .= $this->doc->spacer(10); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_update_needed'), $updates . '<br /><br />' . $GLOBALS['LANG']->getLL('ext_details_notice_static_data'), 0, 1); } } // Config: if (@is_file($absPath . 'ext_conf_template.txt')) { $this->content .= $this->doc->spacer(10); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_configuration'), $GLOBALS['LANG']->getLL('ext_details_notice_clear_cache') . '<br /><br />', 0, 1); $this->content .= $this->install->tsStyleConfigForm($extKey, $list[$extKey]); } // Show details: $headline = $GLOBALS['LANG']->getLL('ext_details_details'); $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'info', $headline); $content = $this->extensionDetails->extInformationarray($extKey, $list[$extKey]); $this->content .= $this->doc->spacer(10); $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE); break; case 'upload': $em = t3lib_div::_POST('em'); if ($em['action'] == 'doUpload') { $em['extKey'] = $extKey; $em['extInfo'] = $list[$extKey]; $content = $this->extensionDetails->uploadExtensionToTER($em); $content .= $this->doc->spacer(10); // Must reload this, because EM_CONF information has been updated! list($list, ) = $this->extensionList->getInstalledExtensions(); } else { // headline and CSH $headline = $GLOBALS['LANG']->getLL('ext_details_upload_to_ter'); $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'upload', $headline); // Upload: if (substr($extKey, 0, 5) != 'user_') { $content = $this->getRepositoryUploadForm($extKey, $list[$extKey]); $eC = 0; } else { $content = $GLOBALS['LANG']->getLL('ext_details_no_unique_ext'); $eC = 2; } if (!$this->fe_user['username']) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($GLOBALS['LANG']->getLL('ext_details_no_username'), '<a href="' . t3lib_div::linkThisScript(array('SET[function]' => 3)) . '">', '</a>'), '', t3lib_FlashMessage::INFO); $content .= '<br />' . $flashMessage->render(); } } $this->content .= $this->doc->section($headline, $content, 0, 1, $eC, TRUE); break; case 'backup': if ($this->CMD['doDelete']) { $content = $this->install->extDelete($extKey, $list[$extKey], $this->CMD); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_delete'), $GLOBALS['LANG']->getLL('ext_details_delete'), $content, 0, 1); } else { // headline and CSH $headline = $GLOBALS['LANG']->getLL('ext_details_backup'); $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'backup_delete', $headline); $content = $this->extBackup($extKey, $list[$extKey]); $this->content .= $this->doc->section($headline, $content, 0, 1, 0, 1); $content = $this->install->extDelete($extKey, $list[$extKey], $this->CMD); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_delete'), $content, 0, 1); $content = $this->extUpdateEMCONF($extKey, $list[$extKey]); $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_update_em_conf'), $content, 0, 1); } break; case 'dump': $this->extDumpTables($extKey, $list[$extKey]); break; case 'edit': // headline and CSH $headline = $GLOBALS['LANG']->getLL('ext_details_ext_files'); $headline = t3lib_BEfunc::wrapInHelp('_MOD_tools_em', 'editfiles', $headline); $content = $this->getFileListOfExtension($extKey, $list[$extKey]); $this->content .= $this->doc->section($headline, $content, FALSE, TRUE, FALSE, TRUE); break; case 'updateModule': $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('ext_details_update'), is_object($updateObj) ? $updateObj->main() : $GLOBALS['LANG']->getLL('ext_details_no_update_object'), 0, 1); break; default: $this->extObjContent(); break; } } } }
/** * @return void */ public function newPageAction() { $message = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage.detail'), $GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xml:info.newpage'), t3lib_FlashMessage::INFO); t3lib_FlashMessageQueue::addMessage($message); }
/** * Rendering the quick-edit view. * * @return void */ function renderQuickEdit() { global $LANG, $BE_USER, $BACK_PATH; // Alternative template $this->doc->setModuleTemplate('templates/db_layout_quickedit.html'); // Alternative form tag; Quick Edit submits its content to tce_db.php. $this->doc->form = '<form action="' . htmlspecialchars($BACK_PATH . 'tce_db.php?&prErr=1&uPT=1') . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); // Set the edit_record value for internal use in this function: $edit_record = $this->edit_record; // If a command to edit all records in a column is issue, then select all those elements, and redirect to alt_doc.php: if (substr($edit_record, 0, 9) == '_EDIT_COL') { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND colPos=' . intval(substr($edit_record, 10)) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'sorting'); $idListA = array(); while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $idListA[] = $cRow['uid']; } $url = $BACK_PATH . 'alt_doc.php?edit[tt_content][' . implode(',', $idListA) . ']=edit&returnUrl=' . rawurlencode($this->local_linkThisScript(array('edit_record' => ''))); t3lib_utility_Http::redirect($url); } // If the former record edited was the creation of a NEW record, this will look up the created records uid: if ($this->new_unique_uid) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'userid=' . intval($BE_USER->user['uid']) . ' AND NEWid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->new_unique_uid, 'sys_log')); $sys_log_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if (is_array($sys_log_row)) { $edit_record = $sys_log_row['tablename'] . ':' . $sys_log_row['recuid']; } } // Creating the selector box, allowing the user to select which element to edit: $opt = array(); $is_selected = 0; $languageOverlayRecord = ''; if ($this->current_sys_language) { list($languageOverlayRecord) = t3lib_BEfunc::getRecordsByField('pages_language_overlay', 'pid', $this->id, 'AND sys_language_uid=' . intval($this->current_sys_language)); } if (is_array($languageOverlayRecord)) { $inValue = 'pages_language_overlay:' . $languageOverlayRecord['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editLanguageHeader', 1) . ' ]</option>'; } else { $inValue = 'pages:' . $this->id; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('editPageProperties', 1) . ' ]</option>'; } // Selecting all content elements from this language and allowed colPos: $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . intval($this->id) . ' AND sys_language_uid=' . intval($this->current_sys_language) . ' AND colPos IN (' . $this->colPosList . ')' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? '' : t3lib_BEfunc::BEenableFields('tt_content')) . t3lib_Befunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'colPos,sorting'); $colPos = ''; $first = 1; $prev = $this->id; // Page is the pid if no record to put this after. while ($cRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { t3lib_BEfunc::workspaceOL('tt_content', $cRow); if (is_array($cRow)) { if ($first) { if (!$edit_record) { $edit_record = 'tt_content:' . $cRow['uid']; } $first = 0; } if (strcmp($cRow['colPos'], $colPos)) { $colPos = $cRow['colPos']; $opt[] = '<option value=""></option>'; $opt[] = '<option value="_EDIT_COL:' . $colPos . '">__' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'colPos', $colPos), 1) . ':__</option>'; } $inValue = 'tt_content:' . $cRow['uid']; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>' . htmlspecialchars(t3lib_div::fixed_lgd_cs($cRow['header'] ? $cRow['header'] : '[' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.no_title') . '] ' . strip_tags($cRow['bodytext']), $BE_USER->uc['titleLen'])) . '</option>'; $prev = -$cRow['uid']; } } // If edit_record is not set (meaning, no content elements was found for this language) we simply set it to create a new element: if (!$edit_record) { $edit_record = 'tt_content:new/' . $prev . '/' . $colPos; $inValue = 'tt_content:new/' . $prev . '/' . $colPos; $is_selected += intval($edit_record == $inValue); $opt[] = '<option value="' . $inValue . '"' . ($edit_record == $inValue ? ' selected="selected"' : '') . '>[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>'; } // If none is yet selected... if (!$is_selected) { $opt[] = '<option value=""></option>'; $opt[] = '<option value="' . $edit_record . '" selected="selected">[ ' . $LANG->getLL('newLabel', 1) . ' ]</option>'; } // Splitting the edit-record cmd value into table/uid: $this->eRParts = explode(':', $edit_record); // Delete-button flag? $this->deleteButton = t3lib_div::testInt($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 4); // If undo-button should be rendered (depends on available items in sys_history) $this->undoButton = 0; $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . intval($this->eRParts[1]), '', 'tstamp DESC', '1'); if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) { $this->undoButton = 1; } // Setting up the Return URL for coming back to THIS script (if links take the user to another script) $R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI')); $R_URL_getvars = t3lib_div::_GET(); unset($R_URL_getvars['popView']); unset($R_URL_getvars['new_unique_uid']); $R_URL_getvars['edit_record'] = $edit_record; $this->R_URI = $R_URL_parts['path'] . '?' . t3lib_div::implodeArrayForUrl('', $R_URL_getvars); // Setting close url/return url for exiting this script: $this->closeUrl = $this->local_linkThisScript(array('SET' => array('function' => 1))); // Goes to 'Columns' view if close is pressed (default) if ($BE_USER->uc['condensedMode']) { $this->closeUrl = $BACK_PATH . 'alt_db_navframe.php'; } if ($this->returnUrl) { $this->closeUrl = $this->returnUrl; } // Return-url for JavaScript: $retUrlStr = $this->returnUrl ? "+'&returnUrl='+'" . rawurlencode($this->returnUrl) . "'" : ''; // Drawing the edit record selectbox $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>'; // Creating editing form: if ($BE_USER->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 1)) { // Splitting uid parts for special features, if new: list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts[1]); // Convert $uidVal to workspace version if any: if ($uidVal != 'new') { if ($draftRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) { $uidVal = $draftRecord['uid']; } } // Initializing transfer-data object: $trData = t3lib_div::makeInstance('t3lib_transferData'); $trData->addRawData = TRUE; $trData->defVals[$this->eRParts[0]] = array('colPos' => intval($ex_colPos), 'sys_language_uid' => intval($this->current_sys_language)); $trData->disableRTE = $this->MOD_SETTINGS['disableRTE']; $trData->lockRecords = 1; $trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal); // 'new' // Getting/Making the record: reset($trData->regTableItems_data); $rec = current($trData->regTableItems_data); if ($uidVal == 'new') { $new_unique_uid = uniqid('NEW'); $rec['uid'] = $new_unique_uid; $rec['pid'] = intval($ex_pid) ? intval($ex_pid) : $this->id; $recordAccess = TRUE; } else { $rec['uid'] = $uidVal; // Checking internals access: $recordAccess = $BE_USER->recordEditAccessInternals($this->eRParts[0], $uidVal); } if (!$recordAccess) { // If no edit access, print error message: $content .= $this->doc->section($LANG->getLL('noAccess'), $LANG->getLL('noAccess_msg') . '<br /><br />' . ($BE_USER->errorMsg ? 'Reason: ' . $BE_USER->errorMsg . '<br /><br />' : ''), 0, 1); } elseif (is_array($rec)) { // If the record is an array (which it will always be... :-) // Create instance of TCEforms, setting defaults: $tceforms = t3lib_div::makeInstance('t3lib_TCEforms'); $tceforms->backPath = $BACK_PATH; $tceforms->initDefaultBEMode(); $tceforms->fieldOrder = $this->modTSconfig['properties']['tt_content.']['fieldOrder']; $tceforms->palettesCollapsed = !$this->MOD_SETTINGS['showPalettes']; $tceforms->disableRTE = $this->MOD_SETTINGS['disableRTE']; $tceforms->enableClickMenu = TRUE; // Clipboard is initialized: $tceforms->clipObj = t3lib_div::makeInstance('t3lib_clipboard'); // Start clipboard $tceforms->clipObj->initializeClipboard(); // Initialize - reads the clipboard content from the user session if ($BE_USER->uc['edit_showFieldHelp'] != 'text' && $this->MOD_SETTINGS['showDescriptions']) { $tceforms->edit_showFieldHelp = 'text'; } // Render form, wrap it: $panel = ''; $panel .= $tceforms->getMainFields($this->eRParts[0], $rec); $panel = $tceforms->wrapTotal($panel, $rec, $this->eRParts[0]); // Add hidden fields: $theCode = $panel; if ($uidVal == 'new') { $theCode .= '<input type="hidden" name="data[' . $this->eRParts[0] . '][' . $rec['uid'] . '][pid]" value="' . $rec['pid'] . '" />'; } $theCode .= ' <input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" /> <input type="hidden" name="_disableRTE" value="' . $tceforms->disableRTE . '" /> <input type="hidden" name="edit_record" value="' . $edit_record . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars($uidVal == 'new' ? t3lib_extMgm::extRelPath('cms') . 'layout/db_layout.php?id=' . $this->id . '&new_unique_uid=' . $new_unique_uid . '&returnUrl=' . rawurlencode($this->returnUrl) : $this->R_URI) . '" /> ' . t3lib_TCEforms::getHiddenTokenField('tceAction'); // Add JavaScript as needed around the form: $theCode = $tceforms->printNeededJSFunctions_top() . $theCode . $tceforms->printNeededJSFunctions(); // Add warning sign if record was "locked": if ($lockInfo = t3lib_BEfunc::isRecordLocked($this->eRParts[0], $rec['uid'])) { $lockedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars($lockInfo['msg']), '', t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($lockedMessage); } // Add whole form as a document section: $content .= $this->doc->section('', $theCode); } } else { // If no edit access, print error message: $content .= $this->doc->section($LANG->getLL('noAccess'), $LANG->getLL('noAccess_msg') . '<br /><br />', 0, 1); } // Bottom controls (function menus): $q_count = $this->getNumberOfHiddenElements(); $h_func_b = t3lib_BEfunc::getFuncCheck($this->id, 'SET[tt_content_showHidden]', $this->MOD_SETTINGS['tt_content_showHidden'], 'db_layout.php', '', 'id="checkTt_content_showHidden"') . '<label for="checkTt_content_showHidden">' . (!$q_count ? $GLOBALS['TBE_TEMPLATE']->dfw($LANG->getLL('hiddenCE', 1)) : $LANG->getLL('hiddenCE', 1) . ' (' . $q_count . ')') . '</label>'; $h_func_b .= '<br />' . t3lib_BEfunc::getFuncCheck($this->id, 'SET[showPalettes]', $this->MOD_SETTINGS['showPalettes'], 'db_layout.php', '', 'id="checkShowPalettes"') . '<label for="checkShowPalettes">' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showPalettes', 1) . '</label>'; if (t3lib_extMgm::isLoaded('context_help') && $BE_USER->uc['edit_showFieldHelp'] != 'text') { $h_func_b .= '<br />' . t3lib_BEfunc::getFuncCheck($this->id, 'SET[showDescriptions]', $this->MOD_SETTINGS['showDescriptions'], 'db_layout.php', '', 'id="checkShowDescriptions"') . '<label for="checkShowDescriptions">' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.showDescriptions', 1) . '</label>'; } if ($BE_USER->isRTE()) { $h_func_b .= '<br />' . t3lib_BEfunc::getFuncCheck($this->id, 'SET[disableRTE]', $this->MOD_SETTINGS['disableRTE'], 'db_layout.php', '', 'id="checkDisableRTE"') . '<label for="checkDisableRTE">' . $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.disableRTE', 1) . '</label>'; } // Add the function menus to bottom: $content .= $this->doc->section('', $h_func_b, 0, 0); $content .= $this->doc->spacer(10); // Select element matrix: if ($this->eRParts[0] == 'tt_content' && t3lib_div::testInt($this->eRParts[1])) { $posMap = t3lib_div::makeInstance('ext_posMap'); $posMap->backPath = $BACK_PATH; $posMap->cur_sys_language = $this->current_sys_language; $HTMLcode = ''; // CSH: $HTMLcode .= t3lib_BEfunc::cshItem($this->descrTable, 'quickEdit_selElement', $BACK_PATH, '|<br />'); $HTMLcode .= $posMap->printContentElementColumns($this->id, $this->eRParts[1], $this->colPosList, $this->MOD_SETTINGS['tt_content_showHidden'], $this->R_URI); $content .= $this->doc->spacer(20); $content .= $this->doc->section($LANG->getLL('CEonThisPage'), $HTMLcode, 0, 1); $content .= $this->doc->spacer(20); } // Finally, if comments were generated in TCEforms object, print these as a HTML comment: if (count($tceforms->commentMessages)) { $content .= ' <!-- TCEFORM messages ' . htmlspecialchars(implode(LF, $tceforms->commentMessages)) . ' --> '; } return $content; }
/** * Handles an error. * If the error is registered as exceptionalError it will by converted into an exception, to be handled * by the configured exceptionhandler. Additionall the error message is written to the configured logs. * If TYPO3_MODE is 'BE' the error message is also added to the flashMessageQueue, in FE the error message * is displayed in the admin panel (as TsLog message) * * @param integer The error level - one of the E_* constants * @param string The error message * @param string Name of the file the error occurred in * @param integer Line number where the error occurred * @return void * @throws t3lib_error_Exception with the data passed to this method if the error is registered as exceptionalError */ public function handleError($errorLevel, $errorMessage, $errorFile, $errorLine) { // don't do anything if error_reporting is disabled by an @ sign if (error_reporting() == 0) { return TRUE; } $errorLevels = array(E_WARNING => 'Warning', E_NOTICE => 'Notice', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error'); $message = 'PHP ' . $errorLevels[$errorLevel] . ': ' . $errorMessage . ' in ' . $errorFile . ' line ' . $errorLine; if ($errorLevel & $this->exceptionalErrors) { throw new t3lib_error_Exception($message, 1); } else { switch ($errorLevel) { case E_USER_ERROR: case E_RECOVERABLE_ERROR: $severity = 2; break; case E_USER_WARNING: case E_WARNING: $severity = 1; break; default: $severity = 0; break; } $logTitle = 'Core: Error handler (' . TYPO3_MODE . ')'; // Write error message to the configured syslogs, // see: $TYPO3_CONF_VARS['SYS']['systemLog'] if ($errorLevel & $GLOBALS['TYPO3_CONF_VARS']['SYS']['syslogErrorReporting']) { t3lib_div::sysLog($message, $logTitle, $severity); } // In case an error occurs before a database connection exists, try // to connect to the DB to be able to write an entry to devlog/sys_log if (is_object($GLOBALS['TYPO3_DB']) && empty($GLOBALS['TYPO3_DB']->link)) { try { $GLOBALS['TYPO3_DB']->connectDB(); } catch (Exception $e) { // There's nothing more we can do at this point if the // database failed. It is up to the various log writers // to check for themselves whether the have a DB connection // available or not. } } // Write error message to devlog extension(s), // see: $TYPO3_CONF_VARS['SYS']['enable_errorDLOG'] if (TYPO3_ERROR_DLOG) { t3lib_div::devLog($message, $logTitle, $severity + 1); } // Write error message to TSlog (admin panel) if (is_object($GLOBALS['TT'])) { $GLOBALS['TT']->setTSlogMessage($logTitle . ': ' . $message, $severity + 1); } // Write error message to sys_log table (ext: belog, Tools->Log) if ($errorLevel & $GLOBALS['TYPO3_CONF_VARS']['SYS']['belogErrorReporting']) { $this->writeLog($logTitle . ': ' . $message, $severity); } // Add error message to the flashmessageQueue if (defined('TYPO3_ERRORHANDLER_MODE') && TYPO3_ERRORHANDLER_MODE == 'debug') { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $message, 'PHP ' . $errorLevels[$errorLevel], $severity); t3lib_FlashMessageQueue::addMessage($flashMessage); } } // Don't execute PHP internal error handler return TRUE; }
/** * Main function of the module * * @access public * * @return void */ public function main() { // Is the user allowed to access this page? $access = is_array($this->pageInfo) || $GLOBALS['BE_USER']->isAdmin(); if ($this->id && $access) { // Increase max_execution_time and max_input_time for large documents. if (!ini_get('safe_mode')) { ini_set('max_execution_time', '0'); ini_set('max_input_time', '-1'); } switch ($this->CMD) { case 'indexFile': if (!empty($this->data['id']) && isset($this->data['core'])) { // Save document to database and index. $doc =& tx_dlf_document::getInstance($this->data['id'], $this->id, TRUE); if ($doc->ready) { $doc->save($this->id, $this->data['core']); } else { $_message = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.FileNotLoaded'), $title, $uid)), tx_dlf_helper::getLL('flash.error', TRUE), t3lib_FlashMessage::ERROR, TRUE); t3lib_FlashMessageQueue::addMessage($_message); } } break; case 'reindexDocs': if (isset($this->data['core'])) { if (!empty($this->data['collection'])) { // Get all documents in this collection. $_result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_relations', 'tx_dlf_collections', 'AND tx_dlf_documents.pid=' . intval($this->id) . ' AND tx_dlf_collections.uid=' . intval($this->data['collection']) . ' AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations') . tx_dlf_helper::whereClause('tx_dlf_documents') . tx_dlf_helper::whereClause('tx_dlf_collections'), 'tx_dlf_documents.uid', '', ''); } else { // Get all documents. $_result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_documents.title AS title,tx_dlf_documents.uid AS uid', 'tx_dlf_documents', 'tx_dlf_documents.pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_documents'), '', '', ''); } // Save them as a list object in user's session. $elements = array(); while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($_result)) { $elements[] = array($resArray['uid'], $resArray['title']); } $this->list = t3lib_div::makeInstance('tx_dlf_list', $elements); // Start index looping. if (count($this->list) > 0) { $this->indexLoop(); } } break; case 'indexLoop': // Refresh user's session to prevent session timeout. $GLOBALS['BE_USER']->fetchUserSession(); // Get document list from user's session. $this->list = t3lib_div::makeInstance('tx_dlf_list'); // Continue index looping. if (count($this->list) > 0 && isset($this->data['core'])) { $this->indexLoop(); } else { $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.seeLog', TRUE), tx_dlf_helper::getLL('flash.done', TRUE), t3lib_FlashMessage::OK, TRUE); t3lib_FlashMessageQueue::addMessage($_message); } break; } $this->markerArray['CONTENT'] .= t3lib_FlashMessageQueue::renderFlashMessages(); switch ($this->MOD_SETTINGS['function']) { case 'indexFile': $this->markerArray['CONTENT'] .= $this->getFileForm(); break; case 'reindexDoc': $this->markerArray['CONTENT'] .= $this->getDocList(); break; case 'reindexDocs': $this->markerArray['CONTENT'] .= $this->getCollList(); break; } } else { // TODO: Ändern! $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; } $this->printContent(); }
/** * Adds log error messages from the previous file operations of this script instance * to the FlashMessageQueue * * @return void */ function getErrorMessages() { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', 'type = 2 AND userid = ' . intval($GLOBALS['BE_USER']->user['uid']) . ' AND tstamp=' . intval($GLOBALS['EXEC_TIME']) . ' AND error != 0'); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $logData = unserialize($row['log_data']); $msg = $row['error'] . ': ' . sprintf($row['details'], $logData[0], $logData[1], $logData[2], $logData[3], $logData[4]); $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $msg, '', t3lib_FlashMessage::ERROR, TRUE); t3lib_FlashMessageQueue::addMessage($flashMessage); } $GLOBALS['TYPO3_DB']->sql_free_result($res); }
/** * Checks whether a Mount Page is properly configured. * * @param array $mountPage A mount page * @return boolean TRUE if the Mount Page is OK, FALSE otherwise */ protected function validateMountPage(array $mountPage) { $isValidMountPage = TRUE; if (empty($mountPage['mountPageSource'])) { $isValidMountPage = FALSE; $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_FlashMessage', 'Property "Mounted page" must not be empty. Invalid Mount Page configuration for page ID ' . $mountPage['uid'] . '.', 'Failed to initialize Mount Page tree. ', t3lib_FlashMessage::ERROR); t3lib_FlashMessageQueue::addMessage($flashMessage); } if (!$this->mountedPageExists($mountPage['mountPageSource'])) { $isValidMountPage = FALSE; $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_FlashMessage', 'The mounted page must be accessible in the frontend. ' . 'Invalid Mount Page configuration for page ID ' . $mountPage['uid'] . ', the mounted page with ID ' . $mountPage['mountPageSource'] . ' is not accessible in the frontend.', 'Failed to initialize Mount Page tree. ', t3lib_FlashMessage::ERROR); t3lib_FlashMessageQueue::addMessage($flashMessage); } return $isValidMountPage; }
protected function deleteDocument() { $documentUid = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('delete_uid'); $documentType = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('delete_type'); $message = 'Document(s) with type ' . $documentType . ' and id ' . $documentUid . ' deleted'; $severity = t3lib_FlashMessage::OK; if (empty($documentUid) || empty($documentType)) { $message = 'Missing uid or type to delete documents.'; $severity = t3lib_FlashMessage::ERROR; } else { try { $uids = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $documentUid); $uidCondition = implode(' OR ', $uids); $solrServers = $this->connectionManager->getConnectionsBySite($this->site); foreach ($solrServers as $solrServer) { $response = $solrServer->deleteByQuery('uid:(' . $uidCondition . ')' . ' AND type:' . $documentType . ' AND siteHash:' . $this->site->getSiteHash()); $solrServer->commit(FALSE, FALSE, FALSE); if ($response->getHttpStatus() != 200) { throw new RuntimeException('Delete Query failed.', 1332250835); } } } catch (Exception $e) { $message = $e->getMessage(); $severity = t3lib_FlashMessage::ERROR; } } $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_FlashMessage', $message, '', $severity); t3lib_FlashMessageQueue::addMessage($flashMessage); }
/** * log( ) * * @param string $prompt : prompt * @param integer $status : -1 = no flash message, 0 = notice, 1 = info, 2 = OK, 3 = warn, 4 = error * @param string $action : 0=No category, 1=new record, 2=update record, 3= delete record, 4= move record, 5= Check/evaluate * @param string $header : 0=No header, 1=Deal! TYPO3 for amazon and ebay, 2=Deal! TYPO3 for amazon and ebay * @return void * @access public * @version 0.0.3 * @since 0.0.3 */ public function log($prompt, $status = -1, $action = 2, $header = 2) { $this->initVarsConfArr(); $table = $this->datamapTable; $uid = $this->datamapRecordUid; $pid = null; if ($table) { $logPrompt = '[' . $this->prefixLog . ' (' . $table . ':' . $uid . ')] ' . $prompt . PHP_EOL; } else { $logPrompt = '[' . $this->prefixLog . '] ' . $prompt . PHP_EOL; } //$fmPrompt = $prompt; $fmPrompt = nl2br(htmlentities($prompt)); switch ($header) { case 0: $fmHeader = ''; break; case 1: $fmHeader = $GLOBALS['LANG']->sL('LLL:EXT:deal/lib/tcemainprocdm/locallang.xml:promptDealPhrase'); break; case 2: default: $fmHeader = $GLOBALS['LANG']->sL('LLL:EXT:deal/lib/tcemainprocdm/locallang.xml:promptDealPhrase'); break; } switch ($status) { case -1: $fmStatus = null; $logStatus = 0; break; case 0: $fmStatus = t3lib_FlashMessage::NOTICE; $logStatus = 0; break; case 1: $fmStatus = t3lib_FlashMessage::INFO; $logStatus = 0; break; case 2: $fmStatus = t3lib_FlashMessage::OK; $logStatus = 0; break; case 3: $fmStatus = t3lib_FlashMessage::WARNING; $logStatus = 0; // $fmPrompt = $prompt . '<br /> // ' . $GLOBALS['LANG']->sL('LLL:EXT:deal/lib/tcemainprocdm/locallang.xml:promptDetailsToSyslog'); break; case 4: $fmStatus = t3lib_FlashMessage::ERROR; $logStatus = 0; // $fmPrompt = $prompt . '<br /> // ' . $GLOBALS['LANG']->sL('LLL:EXT:deal/lib/tcemainprocdm/locallang.xml:promptDetailsToSyslog'); break; default: $logStatus = 0; break; } // Language for labels of static templates and page tsConfig if ($this->confArr['drsAdmintoolsLogEnabled']) { $this->reference->log($table, $uid, $action, $pid, $logStatus, '[DRS] ' . $logPrompt); } // RETURN : Don't prompt to the backend if ($status < 0) { return; } // RETURN : Don't prompt to the backend $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $fmPrompt, $fmHeader, $fmStatus); t3lib_FlashMessageQueue::addMessage($flashMessage); }
/** * Creating form for editing the permissions ($this->edit = true) * (Adding content to internal content variable) * * @return void */ public function doEdit() { global $BE_USER, $LANG; if ($BE_USER->workspace != 0) { // Adding section with the permission setting matrix: $lockedMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $LANG->getLL('WorkspaceWarningText'), $LANG->getLL('WorkspaceWarning'), t3lib_FlashMessage::WARNING); t3lib_FlashMessageQueue::addMessage($lockedMessage); } // Get usernames and groupnames $beGroupArray = t3lib_BEfunc::getListGroupNames('title,uid'); $beGroupKeys = array_keys($beGroupArray); $beUserArray = t3lib_BEfunc::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUserArray = t3lib_BEfunc::blindUserNames($beUserArray, $beGroupKeys, 1); } $beGroupArray_o = $beGroupArray = t3lib_BEfunc::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beGroupArray = t3lib_BEfunc::blindGroupNames($beGroupArray_o, $beGroupKeys, 1); } $firstGroup = $beGroupKeys[0] ? $beGroupArray[$beGroupKeys[0]] : ''; // data of the first group, the user is member of // Owner selector: $options = ''; $userset = 0; // flag: is set if the page-userid equals one from the user-list foreach ($beUserArray as $uid => $row) { if ($uid == $this->pageinfo['perms_userid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>'; } $options = ' <option value="0"></option>' . $options; $selector = ' <select name="data[pages][' . $this->id . '][perms_userid]"> ' . $options . ' </select>'; $this->content .= $this->doc->section($LANG->getLL('Owner') . ':', $selector); // Group selector: $options = ''; $userset = 0; foreach ($beGroupArray as $uid => $row) { if ($uid == $this->pageinfo['perms_groupid']) { $userset = 1; $selected = ' selected="selected"'; } else { $selected = ''; } $options .= ' <option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>'; } if (!$userset && $this->pageinfo['perms_groupid']) { // If the group was not set AND there is a group for the page $options = ' <option value="' . $this->pageinfo['perms_groupid'] . '" selected="selected">' . htmlspecialchars($beGroupArray_o[$this->pageinfo['perms_groupid']]['title']) . '</option>' . $options; } $options = ' <option value="0"></option>' . $options; $selector = ' <select name="data[pages][' . $this->id . '][perms_groupid]"> ' . $options . ' </select>'; $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($LANG->getLL('Group') . ':', $selector); // Permissions checkbox matrix: $code = ' <table border="0" cellspacing="2" cellpadding="0" id="typo3-permissionMatrix"> <tr> <td></td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('1', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('16', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('2', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('4', 1)) . '</td> <td class="bgColor2">' . str_replace(' ', '<br />', $LANG->getLL('8', 1)) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $LANG->getLL('Owner', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_user', 4) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $LANG->getLL('Group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_group', 4) . '</td> </tr> <tr> <td align="right" class="bgColor2">' . $LANG->getLL('Everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 1) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 5) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 2) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 3) . '</td> <td class="bgColor-20">' . $this->printCheckBox('perms_everybody', 4) . '</td> </tr> </table> <br /> <input type="hidden" name="data[pages][' . $this->id . '][perms_user]" value="' . $this->pageinfo['perms_user'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_group]" value="' . $this->pageinfo['perms_group'] . '" /> <input type="hidden" name="data[pages][' . $this->id . '][perms_everybody]" value="' . $this->pageinfo['perms_everybody'] . '" /> ' . $this->getRecursiveSelect($this->id, $this->perms_clause) . ' <input type="submit" name="submit" value="' . $LANG->getLL('Save', 1) . '" />' . '<input type="submit" value="' . $LANG->getLL('Abort', 1) . '" onclick="' . htmlspecialchars('jumpToUrl(\'index.php?id=' . $this->id . '\'); return false;') . '" /> <input type="hidden" name="redirect" value="' . htmlspecialchars(TYPO3_MOD_PATH . 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . intval($this->return_id) . '&lastEdited=' . $this->id) . '" /> '; // Adding section with the permission setting matrix: $this->content .= $this->doc->divider(5); $this->content .= $this->doc->section($LANG->getLL('permissions') . ':', $code); // CSH for permissions setting $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module_setting', $GLOBALS['BACK_PATH'], '<br /><br />'); // Adding help text: if ($BE_USER->uc['helpText']) { $this->content .= $this->doc->divider(20); $legendText = '<strong>' . $LANG->getLL('1', 1) . '</strong>: ' . $LANG->getLL('1_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('16', 1) . '</strong>: ' . $LANG->getLL('16_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('2', 1) . '</strong>: ' . $LANG->getLL('2_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('4', 1) . '</strong>: ' . $LANG->getLL('4_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('8', 1) . '</strong>: ' . $LANG->getLL('8_t', 1); $code = $legendText . '<br /><br />' . $LANG->getLL('def', 1); $this->content .= $this->doc->section($LANG->getLL('Legend', 1) . ':', $code); } }
/** * Adds a flash message to the queue. * * @param t3lib_FlashMessage $flashMessage * * @return void */ protected function addFlashMessage(t3lib_FlashMessage $flashMessage) { if (class_exists('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService', TRUE)) { /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */ $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); /** @var \TYPO3\CMS\Core\Messaging\FlashMessageQueue $defaultFlashMessageQueue */ $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $defaultFlashMessageQueue->enqueue($flashMessage); } else { t3lib_FlashMessageQueue::addMessage($flashMessage); } }
/** * This saves the document to the database and index * * @access public * * @param integer $pid: The PID of the saved record * @param integer $core: The UID of the Solr core for indexing * * @return boolean TRUE on success or FALSE on failure */ public function save($pid = 0, $core = 0) { // Save parameters for logging purposes. $_pid = $pid; $_core = $core; if (TYPO3_MODE !== 'BE') { if (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_document->save(' . $_pid . ', ' . $_core . ')] Saving a document is only allowed in the backend', self::$extKey, SYSLOG_SEVERITY_ERROR); } return FALSE; } // Make sure $pid is a non-negative integer. $pid = max(intval($pid), 0); // Make sure $core is a non-negative integer. $core = max(intval($core), 0); // If $pid is not given, try to get it elsewhere. if (!$pid && $this->pid) { // Retain current PID. $pid = $this->pid; } elseif (!$pid) { if (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_document->save(' . $_pid . ', ' . $_core . ')] Invalid PID "' . $pid . '" for document saving', self::$extKey, SYSLOG_SEVERITY_ERROR); } return FALSE; } // Set PID for metadata definitions. $this->cPid = $pid; // Set UID placeholder if not updating existing record. if ($pid != $this->pid) { $this->uid = uniqid('NEW'); } // Get metadata array. $metadata = $this->getTitledata($pid); // Check for record identifier. if (empty($metadata['record_id'][0])) { if (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_document->save(' . $_pid . ', ' . $_core . ')] No record identifier found to avoid duplication', self::$extKey, SYSLOG_SEVERITY_ERROR); } return FALSE; } // Load plugin configuration. $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); // Get UID for user "_cli_dlf". $be_user = 0; $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('be_users.uid AS uid', 'be_users', 'username='******'TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_users') . t3lib_BEfunc::BEenableFields('be_users') . t3lib_BEfunc::deleteClause('be_users'), '', '', '1'); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { list($be_user) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); } else { if (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_document->save(' . $_pid . ', ' . $_core . ')] Backend user "_cli_dlf" not found or disabled', self::$extKey, SYSLOG_SEVERITY_ERROR); } return FALSE; } // Get UID for structure type. $structure = 0; $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_structures.uid AS uid', 'tx_dlf_structures', 'tx_dlf_structures.pid=' . intval($pid) . ' AND tx_dlf_structures.index_name=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['type'][0], 'tx_dlf_structures') . tx_dlf_helper::whereClause('tx_dlf_structures'), '', '', '1'); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { list($structure) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); } else { if (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_document->save(' . $_pid . ', ' . $_core . ')] Could not identify document/structure type', self::$extKey, SYSLOG_SEVERITY_ERROR); } return FALSE; } $metadata['type'][0] = $structure; // Get UIDs for collections. $collections = array(); $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_collections.index_name AS index_name,tx_dlf_collections.uid AS uid', 'tx_dlf_collections', 'tx_dlf_collections.pid=' . intval($pid) . ' AND tx_dlf_collections.cruser_id=' . intval($be_user) . ' AND tx_dlf_collections.fe_cruser_id=0' . tx_dlf_helper::whereClause('tx_dlf_collections'), '', '', ''); for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) { $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); $collUid[$resArray['index_name']] = $resArray['uid']; } foreach ($metadata['collection'] as $collection) { if (!empty($collUid[$collection])) { // Add existing collection's UID. $collections[] = $collUid[$collection]; } else { // Insert new collection. $collNewUid = uniqid('NEW'); $collData['tx_dlf_collections'][$collNewUid] = array('pid' => $pid, 'label' => $collection, 'index_name' => $collection, 'oai_name' => !empty($conf['publishNewCollections']) ? $collection : '', 'description' => '', 'documents' => 0, 'owner' => 0, 'status' => 0); $substUid = tx_dlf_helper::processDB($collData); // Prevent double insertion. unset($collData); // Add new collection's UID. $collections[] = $substUid[$collNewUid]; if (!defined('TYPO3_cliMode')) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.newCollection'), $collection, $substUid[$collNewUid])), tx_dlf_helper::getLL('flash.attention', TRUE), t3lib_FlashMessage::INFO, TRUE); t3lib_FlashMessageQueue::addMessage($message); } } } // Preserve user-defined collections. $result = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('tx_dlf_collections.uid AS uid', 'tx_dlf_documents', 'tx_dlf_relations', 'tx_dlf_collections', 'AND tx_dlf_documents.pid=' . intval($pid) . ' AND tx_dlf_collections.pid=' . intval($pid) . ' AND tx_dlf_documents.uid=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->uid, 'tx_dlf_documents') . ' AND NOT (tx_dlf_collections.cruser_id=' . intval($be_user) . ' AND tx_dlf_collections.fe_cruser_id=0) AND tx_dlf_relations.ident=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations'), '', '', ''); for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) { list($collections[]) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); } $metadata['collection'] = $collections; // Get UID for owner. $owner = 0; $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_libraries.uid AS uid', 'tx_dlf_libraries', 'tx_dlf_libraries.pid=' . intval($pid) . ' AND tx_dlf_libraries.index_name=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($metadata['owner'][0], 'tx_dlf_libraries') . tx_dlf_helper::whereClause('tx_dlf_libraries'), '', '', '1'); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { list($owner) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); } else { // Insert new library. $libNewUid = uniqid('NEW'); $libData['tx_dlf_libraries'][$libNewUid] = array('pid' => $pid, 'label' => $metadata['owner'][0], 'index_name' => $metadata['owner'][0], 'website' => '', 'contact' => '', 'image' => '', 'oai_label' => '', 'oai_base' => '', 'opac_label' => '', 'opac_base' => '', 'union_label' => '', 'union_base' => ''); $substUid = tx_dlf_helper::processDB($libData); // Add new library's UID. $owner = $substUid[$libNewUid]; if (!defined('TYPO3_cliMode')) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.newLibrary'), $metadata['owner'][0], $owner)), tx_dlf_helper::getLL('flash.attention', TRUE), t3lib_FlashMessage::INFO, TRUE); t3lib_FlashMessageQueue::addMessage($message); } } $metadata['owner'][0] = $owner; // Load table of contents. $this->_getTableOfContents(); // Get UID of superior document. $partof = 0; if (!empty($this->tableOfContents[0]['points']) && $this->tableOfContents[0]['points'] != $this->location && !tx_dlf_helper::testInt($this->tableOfContents[0]['points'])) { $superior =& tx_dlf_document::getInstance($this->tableOfContents[0]['points'], $pid); if ($superior->ready) { if ($superior->pid != $pid) { $superior->save($pid, $core); } $partof = $superior->uid; } } // Use the date of publication as alternative sorting metric for parts of multi-part works. if (!empty($partof)) { if (empty($metadata['volume'][0]) && !empty($metadata['year'][0])) { $metadata['volume'] = $metadata['year']; } if (empty($metadata['volume_sorting'][0])) { if (!empty($metadata['year_sorting'][0])) { $metadata['volume_sorting'][0] = $metadata['year_sorting'][0]; } elseif (!empty($metadata['year'][0])) { $metadata['volume_sorting'][0] = $metadata['year'][0]; } } } // Get metadata for lists and sorting. $listed = array(); $sortable = array(); $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable', 'tx_dlf_metadata', '(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid=' . intval($pid) . tx_dlf_helper::whereClause('tx_dlf_metadata'), '', '', ''); while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { if (!empty($metadata[$resArray['index_name']])) { if ($resArray['is_listed']) { $listed[$resArray['index_name']] = $metadata[$resArray['index_name']]; } if ($resArray['is_sortable']) { $sortable[$resArray['index_name']] = $metadata[$resArray['index_name']][0]; } } } // Fill data array. $data['tx_dlf_documents'][$this->uid] = array('pid' => $pid, $GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['starttime'] => 0, $GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['endtime'] => 0, 'prod_id' => $metadata['prod_id'][0], 'location' => $this->location, 'record_id' => $metadata['record_id'][0], 'opac_id' => $metadata['opac_id'][0], 'union_id' => $metadata['union_id'][0], 'urn' => $metadata['urn'][0], 'purl' => $metadata['purl'][0], 'title' => $metadata['title'][0], 'title_sorting' => $metadata['title_sorting'][0], 'author' => implode('; ', $metadata['author']), 'year' => implode('; ', $metadata['year']), 'place' => implode('; ', $metadata['place']), 'thumbnail' => $this->_getThumbnail(TRUE), 'metadata' => serialize($listed), 'metadata_sorting' => serialize($sortable), 'structure' => $metadata['type'][0], 'partof' => $partof, 'volume' => $metadata['volume'][0], 'volume_sorting' => $metadata['volume_sorting'][0], 'collections' => $metadata['collection'], 'owner' => $metadata['owner'][0], 'solrcore' => $core, 'status' => 0); // Unhide hidden documents. if (!empty($conf['unhideOnIndex'])) { $data['tx_dlf_documents'][$this->uid][$GLOBALS['TCA']['tx_dlf_documents']['ctrl']['enablecolumns']['disabled']] = 0; } // Process data. $newIds = tx_dlf_helper::processDB($data); // Replace placeholder with actual UID. if (strpos($this->uid, 'NEW') === 0) { $this->uid = $newIds[$this->uid]; $this->pid = $pid; $this->parentId = $partof; } if (!defined('TYPO3_cliMode')) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentSaved'), $metadata['title'][0], $this->uid)), tx_dlf_helper::getLL('flash.done', TRUE), t3lib_FlashMessage::OK, TRUE); t3lib_FlashMessageQueue::addMessage($message); } // Add document to index. if ($core) { tx_dlf_indexing::add($this, $core); } else { if (TYPO3_DLOG) { t3lib_div::devLog('[tx_dlf_document->save(' . $_pid . ', ' . $_core . ')] Invalid UID "' . $core . '" for Solr core', self::$extKey, SYSLOG_SEVERITY_NOTICE); } } return TRUE; }
/** * Main function of the module * * @access public * * @return void */ public function main() { // Is the user allowed to access this page? $access = is_array($this->pageInfo) && $GLOBALS['BE_USER']->isAdmin(); if ($this->id && $access) { // Check if page is sysfolder. if ($this->pageInfo['doktype'] != 254) { $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.wrongPageTypeMsg'), tx_dlf_helper::getLL('flash.wrongPageType', TRUE), t3lib_FlashMessage::ERROR, FALSE); t3lib_FlashMessageQueue::addMessage($_message); $this->markerArray['CONTENT'] .= t3lib_FlashMessageQueue::renderFlashMessages(); $this->printContent(); return; } // Should we do something? if (!empty($this->CMD)) { // Sanitize input... $_method = 'cmd' . ucfirst($this->CMD); // ...and unset to prevent infinite looping. unset($this->CMD); if (method_exists($this, $_method)) { $this->{$_method}(); } } // Check for existing structure configuration. $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dlf_structures', 'pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_structures')); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { // Fine. $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.structureOkayMsg'), tx_dlf_helper::getLL('flash.structureOkay', TRUE), t3lib_FlashMessage::OK, FALSE); } else { // Configuration missing. $_url = t3lib_div::locationHeaderUrl(t3lib_div::linkThisScript(array('id' => $this->id, 'CMD' => 'addStructure'))); $_message = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf(tx_dlf_helper::getLL('flash.structureNotOkayMsg'), $_url), tx_dlf_helper::getLL('flash.structureNotOkay', TRUE), t3lib_FlashMessage::ERROR, FALSE); } t3lib_FlashMessageQueue::addMessage($_message); // Check for existing metadata configuration. $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'tx_dlf_metadata', 'pid=' . intval($this->id) . tx_dlf_helper::whereClause('tx_dlf_metadata')); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { // Fine. $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.metadataOkayMsg'), tx_dlf_helper::getLL('flash.metadataOkay', TRUE), t3lib_FlashMessage::OK, FALSE); } else { // Configuration missing. $_url = t3lib_div::locationHeaderUrl(t3lib_div::linkThisScript(array('id' => $this->id, 'CMD' => 'addMetadata'))); $_message = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf(tx_dlf_helper::getLL('flash.metadataNotOkayMsg'), $_url), tx_dlf_helper::getLL('flash.metadataNotOkay', TRUE), t3lib_FlashMessage::ERROR, FALSE); } t3lib_FlashMessageQueue::addMessage($_message); // Check the access conditions for the command line indexer's user. $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,db_mountpoints', 'be_groups', 'title=' . $GLOBALS['TYPO3_DB']->fullQuoteStr('_cli_dlf', 'be_groups') . ' AND ' . $GLOBALS['TCA']['be_groups']['ctrl']['enablecolumns']['disabled'] . '=0' . t3lib_BEfunc::deleteClause('be_groups')); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); if (t3lib_div::inList($resArray['db_mountpoints'], $this->id)) { // Fine. $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.usergroupOkayMsg'), tx_dlf_helper::getLL('flash.usergroupOkay', TRUE), t3lib_FlashMessage::OK, FALSE); } else { // Configuration missing. $_url = t3lib_div::locationHeaderUrl(t3lib_div::linkThisScript(array('id' => $this->id, 'CMD' => 'addAccessRights'))); $_message = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf(tx_dlf_helper::getLL('flash.usergroupNotOkayMsg'), $_url), tx_dlf_helper::getLL('flash.usergroupNotOkay', TRUE), t3lib_FlashMessage::ERROR, FALSE); } } else { // Usergoup missing. $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.usergroupMissingMsg'), tx_dlf_helper::getLL('flash.usergroupMissing', TRUE), t3lib_FlashMessage::ERROR, FALSE); } t3lib_FlashMessageQueue::addMessage($_message); // Check for existing Solr core. $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid', 'tx_dlf_solrcores', 'pid IN (' . intval($this->id) . ',0)' . tx_dlf_helper::whereClause('tx_dlf_solrcores')); if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); if ($resArray['pid']) { // Fine. $_message = t3lib_div::makeInstance('t3lib_FlashMessage', tx_dlf_helper::getLL('flash.solrcoreOkayMsg'), tx_dlf_helper::getLL('flash.solrcoreOkay', TRUE), t3lib_FlashMessage::OK, FALSE); } else { // Default core available, but this is deprecated. $_url = t3lib_div::locationHeaderUrl(t3lib_div::linkThisScript(array('id' => $this->id, 'CMD' => 'addSolrcore'))); $_message = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf(tx_dlf_helper::getLL('flash.solrcoreDeprecatedMsg'), $_url), tx_dlf_helper::getLL('flash.solrcoreDeprecatedOkay', TRUE), t3lib_FlashMessage::NOTICE, FALSE); } } else { // Solr core missing. $_url = t3lib_div::locationHeaderUrl(t3lib_div::linkThisScript(array('id' => $this->id, 'CMD' => 'addSolrcore'))); $_message = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf(tx_dlf_helper::getLL('flash.solrcoreMissingMsg'), $_url), tx_dlf_helper::getLL('flash.solrcoreMissing', TRUE), t3lib_FlashMessage::WARNING, FALSE); } t3lib_FlashMessageQueue::addMessage($_message); $this->markerArray['CONTENT'] .= t3lib_FlashMessageQueue::renderFlashMessages(); } else { // TODO: Ändern! $this->markerArray['CONTENT'] .= 'You are not allowed to access this page or have not selected a page, yet.'; } $this->printContent(); }