Hello guys, I'm currently having some problem with changing TSconstants as non privileged user. The problem came up during the development of a customer management solution in typo3, which enables typo3 to handle many customers in one installation.
Systemenvironment: TYPO3 4.2.8 Templavoila PHP 5.x Project CMS for primary and secondary schools germany saxony ;) Problemdescription: The following code works perfectly as BE User with admin=1. It should calculates the value of all constants for the fe. And changes the one defined with name und sets it to the given value. Is there anyway to make a normal user temporaly admin? I thought, that it would be possible to do it with $GLOBALS['BE_USER']->user['admin']=1; And setting it back to the previous value. As seen in the code below. The other solution would be a reimplementation of the used classes, i would be happy if i could avoid this. And by pass the security layer with database queries. Thanks Best Regards Kay Strobach function setTSConstantValue($pid,$name,$value) { $userStatus = $GLOBALS['BE_USER']->user['admin']; $GLOBALS['BE_USER']->user['admin']=1; $template_uid = 0; $pageId = $pid; $tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); // Defined global here! $tmpl->tt_track = 0; // Do not log time-performance information $tmpl->init(); $tplRow = $tmpl->ext_getFirstTemplate($pageId,$template_uid); if (is_array($tplRow) || 1) { $sys_page = t3lib_div::makeInstance("t3lib_pageSelect"); $rootLine = $sys_page->getRootLine($pageId); $tmpl->runThroughTemplates($rootLine,$template_uid); // This generates the constants/config + hierarchy info for the template. $theConstants = $tmpl->generateConfig_constants(); // The editable constants are returned in an array. $tmpl->ext_categorizeEditableConstants($theConstants); // The returned constants are sorted in categories, that goes into the $tmpl->categories array $tmpl->ext_regObjectPositions($tplRow["constants"]); // This array will contain key=[expanded constantname], value=linenumber in template. (after edit_divider, if any) $tmpl->ext_putValueInConf($name,$value); $recData=array(); $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']; $recData["sys_template"][$saveId]["constants"] = implode($tmpl->raw,chr(10)); // Create new tce-object $tce = t3lib_div::makeInstance("t3lib_TCEmain"); $tce->admin =1; $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"); $tce->admin = $userStatus; $GLOBALS['BE_USER']->user['admin']=$userStatus; } else { throw new Exception('No Template found!!!'); } } _______________________________________________ TYPO3-english mailing list TYPO3-english@lists.netfielders.de http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english