/**
  * displays an Error Message
  *
  * @param string $warning
  * @return unknown
  */
 public static function displayError($warning, $stop = true)
 {
     if (class_exists('t3lib_exception')) {
         throw new t3lib_exception($warning);
     }
     $warning = '<h3>TYPOGENTO</h3>' . $warning;
     t3lib_BEfunc::typo3PrintError('', $warning, '', $stop ? 0 : 1);
     if ($stop) {
         die;
     }
 }
    /**
     * Constructor for initializing the class
     *
     * @return	void
     */
    function init()
    {
        // Initialize GPvars:
        $this->number = t3lib_div::_GP('number');
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::_GP('returnUrl');
        $this->returnUrl = $this->returnUrl ? $this->returnUrl : t3lib_div::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . 'file_list.php?id=' . rawurlencode($this->target);
        // set the number of input fields
        if (empty($this->number)) {
            $this->number = $GLOBALS['BE_USER']->getTSConfigVal('options.defaultFileUploads');
        }
        $this->number = t3lib_div::intInRange($this->number, 1, $this->uploadNumber);
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
        // Init basic-charset-functions object:
        $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
        // Cleaning and checking target
        $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
        $this->target = $this->basicff->is_directory($this->target);
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            t3lib_BEfunc::typo3PrintError($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
            exit;
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_upload.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
        if ($GLOBALS['BE_USER']->jsConfirmation(1)) {
            $confirm = ' && confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.redraw')) . ')';
        } else {
            $confirm = '';
        }
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

			function reload(a) {	//
				if (!changed || (changed ' . $confirm . ')) {
					var params = "&target="+encodeURIComponent(path)+"&number="+a+"&returnUrl=' . urlencode($this->charsetConversion->conv($this->returnUrl, $GLOBALS['LANG']->charSet, 'utf-8')) . '";
					window.location.href = "file_upload.php?"+params;
				}
			}
			function backToList() {	//
				top.goToModule("file_list");
			}
			var changed = 0;
		');
    }
    /**
     * Constructor function for class
     *
     * @return	void
     */
    function init()
    {
        //TODO remove global
        global $LANG, $BACK_PATH, $TYPO3_CONF_VARS;
        // Initialize GPvars:
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::_GP('returnUrl');
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $TYPO3_CONF_VARS['BE']['fileExtensions']);
        // Cleaning and checking target
        if (file_exists($this->target)) {
            $this->target = $this->basicff->cleanDirectoryName($this->target);
            // Cleaning and checking target (file or dir)
        } else {
            $this->target = '';
        }
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            t3lib_BEfunc::typo3PrintError($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
            exit;
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_rename.html');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList()	{	//
				top.goToModule("file_list");
			}
		');
    }
Example #4
0
    if (!TYPO3_db) {
        t3lib_BEfunc::typo3PrintError('Database Error', 'No database selected');
        exit;
    } elseif (!$TYPO3_DB->sql_select_db(TYPO3_db)) {
        t3lib_BEfunc::typo3PrintError('Database Error', 'Cannot connect to the current database, "' . TYPO3_db . '"');
        exit;
    }
} else {
    t3lib_BEfunc::typo3PrintError('Database Error', 'The current username, password or host was not accepted when the connection to the database was attempted to be established!');
    exit;
}
// *******************************
// Checks for proper browser
// *******************************
if (!$CLIENT['BROWSER'] && !(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI)) {
    t3lib_BEfunc::typo3PrintError('Browser error', 'Your browser version looks incompatible with this TYPO3 version!', 0);
    exit;
}
// ****************************************************
// Include tables customization (tables + ext_tables)
// ****************************************************
include TYPO3_tables_script ? PATH_typo3conf . TYPO3_tables_script : PATH_t3lib . 'stddb/tables.php';
// Extension additions
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
    include PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_tables.php';
} else {
    include PATH_t3lib . 'stddb/load_ext_tables.php';
}
// extScript
if (TYPO3_extTableDef_script) {
    include PATH_typo3conf . TYPO3_extTableDef_script;
Example #5
0
    /**
     * Checking, if we should perform some sort of redirection OR closing of windows.
     *
     * @return	void
     */
    function checkRedirect()
    {
        global $BE_USER, $TBE_TEMPLATE;
        // Do redirect:
        // If a user is logged in AND a) if either the login is just done (commandLI) or b) a loginRefresh is done or c) the interface-selector is NOT enabled (If it is on the other hand, it should not just load an interface, because people has to choose then...)
        if ($BE_USER->user['uid'] && ($this->commandLI || $this->loginRefresh || !$this->interfaceSelector)) {
            // If no cookie has been set previously we tell people that this is a problem. This assumes that a cookie-setting script (like this one) has been hit at least once prior to this instance.
            if (!$_COOKIE[$BE_USER->name]) {
                if ($this->commandLI == 'setCookie') {
                    // we tried it a second time but still no cookie
                    // 26/4 2005: This does not work anymore, because the saving of challenge values in $_SESSION means the system will act as if the password was wrong.
                    t3lib_BEfunc::typo3PrintError('Login-error', "Yeah, that's a classic. No cookies, no TYPO3.<br /><br />Please accept cookies from TYPO3 - otherwise you'll not be able to use the system.", 0);
                    exit;
                } else {
                    // try it once again - that might be needed for auto login
                    $this->redirectToURL = 'index.php?commandLI=setCookie';
                }
            }
            if ($redirectToURL = (string) $BE_USER->getTSConfigVal('auth.BE.redirectToURL')) {
                $this->redirectToURL = $redirectToURL;
                $this->GPinterface = '';
            }
            // store interface
            $BE_USER->uc['interfaceSetup'] = $this->GPinterface;
            $BE_USER->writeUC();
            // Based on specific setting of interface we set the redirect script:
            switch ($this->GPinterface) {
                case 'backend':
                case 'backend_old':
                    $this->redirectToURL = 'backend.php';
                    break;
                case 'frontend':
                    $this->redirectToURL = '../';
                    break;
            }
            // If there is a redirect URL AND if loginRefresh is not set...
            if (!$this->loginRefresh) {
                t3lib_utility_Http::redirect($this->redirectToURL);
            } else {
                $TBE_TEMPLATE->JScode .= $TBE_TEMPLATE->wrapScriptTags('
					if (parent.opener && (parent.opener.busy || parent.opener.TYPO3.loginRefresh)) {
						if (parent.opener.TYPO3.loginRefresh) {
							parent.opener.TYPO3.loginRefresh.startTimer();
						} else {
							parent.opener.busy.loginRefreshed();
						}
						parent.close();
					}
				');
            }
        } elseif (!$BE_USER->user['uid'] && $this->commandLI) {
            sleep(5);
            // Wrong password, wait for 5 seconds
        }
    }
 /**
  * Check if user is logged in and if so, call ->fetchGroupData() to load group information and access lists of all kind, further check IP, set the ->uc array and send login-notification email if required.
  * If no user is logged in the default behaviour is to exit with an error message, but this will happen ONLY if the constant TYPO3_PROCEED_IF_NO_USER is set true.
  * This function is called right after ->start() in fx. init.php
  *
  * @return	void
  */
 function backendCheckLogin()
 {
     if (!$this->user['uid']) {
         if (!defined('TYPO3_PROCEED_IF_NO_USER') || !TYPO3_PROCEED_IF_NO_USER) {
             t3lib_utility_Http::redirect($GLOBALS['BACK_PATH']);
         }
     } else {
         // ...and if that's the case, call these functions
         $this->fetchGroupData();
         //	The groups are fetched and ready for permission checking in this initialization.	Tables.php must be read before this because stuff like the modules has impact in this
         if ($this->checkLockToIP()) {
             if ($this->isUserAllowedToLogin()) {
                 $this->backendSetUC();
                 // Setting the UC array. It's needed with fetchGroupData first, due to default/overriding of values.
                 $this->emailAtLogin();
                 // email at login - if option set.
             } else {
                 t3lib_BEfunc::typo3PrintError('Login-error', 'TYPO3 is in maintenance mode at the moment. Only administrators are allowed access.', 0);
                 exit;
             }
         } else {
             t3lib_BEfunc::typo3PrintError('Login-error', 'IP locking prevented you from being authorized. Can\'t proceed, sorry.', 0);
             exit;
         }
     }
 }
 /**
  * Calls an Extbase Backend module.
  *
  * @param string $module The name of the module
  * @return void
  */
 public function callModule($module)
 {
     if (isset($GLOBALS['TBE_MODULES']['_configuration'][$module])) {
         $config = $GLOBALS['TBE_MODULES']['_configuration'][$module];
         // Check permissions and exit if the user has no permission for entry
         $GLOBALS['BE_USER']->modAccess($config, TRUE);
         if (t3lib_div::_GP('id')) {
             // Check page access
             $id = t3lib_div::_GP('id');
             $permClause = $GLOBALS['BE_USER']->getPagePermsClause(TRUE);
             $access = is_array(t3lib_BEfunc::readPageAccess($id, $permClause));
             if (!$access) {
                 t3lib_BEfunc::typo3PrintError('No Access', 'You don\'t have access to this page', 0);
             }
         }
         // Resolve the controller/action to use
         $controllerAction = $this->resolveControllerAction($module);
         // As for SCbase modules, output of the controller/action pair should be echoed
         echo $this->transfer($module, $controllerAction['controllerName'], $controllerAction['actionName']);
         return TRUE;
     } else {
         return FALSE;
     }
 }
 /**
  * Draws the form wizard content
  *
  * @return	string		HTML content for the form.
  */
 function formsWizard()
 {
     // First, check the references by selecting the record:
     $row = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
     if (!is_array($row)) {
         t3lib_BEfunc::typo3PrintError('Wizard Error', 'No reference to record', 0);
         exit;
     }
     // This will get the content of the form configuration code field to us - possibly cleaned up, saved to database etc. if the form has been submitted in the meantime.
     $formCfgArray = $this->getConfigCode($row);
     // Generation of the Form Wizards HTML code:
     $content = $this->getFormHTML($formCfgArray, $row);
     // Return content:
     return $content;
 }
    /**
     * Constructor function for class
     *
     * @return	void
     */
    function init()
    {
        global $LANG, $BACK_PATH, $TYPO3_CONF_VARS;
        // Initialize GPvars:
        $this->number = t3lib_div::_GP('number');
        $this->target = t3lib_div::_GP('target');
        $this->returnUrl = t3lib_div::_GP('returnUrl');
        // Init basic-file-functions object:
        $this->basicff = t3lib_div::makeInstance('t3lib_basicFileFunctions');
        $this->basicff->init($GLOBALS['FILEMOUNTS'], $TYPO3_CONF_VARS['BE']['fileExtensions']);
        // Init basic-charset-functions object:
        $this->charsetConversion = t3lib_div::makeInstance('t3lib_cs');
        // Cleaning and checking target
        $this->target = $this->charsetConversion->conv($this->target, 'utf-8', $GLOBALS['LANG']->charSet);
        $this->target = $this->basicff->is_directory($this->target);
        $key = $this->basicff->checkPathAgainstMounts($this->target . '/');
        if (!$this->target || !$key) {
            t3lib_BEfunc::typo3PrintError($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', true), $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', true), '');
            exit;
        }
        // Finding the icon
        switch ($GLOBALS['FILEMOUNTS'][$key]['type']) {
            case 'user':
                $this->icon = 'gfx/i/_icon_ftp_user.gif';
                break;
            case 'group':
                $this->icon = 'gfx/i/_icon_ftp_group.gif';
                break;
            default:
                $this->icon = 'gfx/i/_icon_ftp.gif';
                break;
        }
        $this->icon = '<img' . t3lib_iconWorks::skinImg($this->backPath, $this->icon, 'width="18" height="16"') . ' title="" alt="" />';
        // Relative path to filemount, $key:
        $this->shortPath = substr($this->target, strlen($GLOBALS['FILEMOUNTS'][$key]['path']));
        // Setting title:
        $this->title = $this->icon . htmlspecialchars($GLOBALS['FILEMOUNTS'][$key]['name']) . ': ' . $this->shortPath;
        // Setting template object
        $this->doc = t3lib_div::makeInstance('template');
        $this->doc->setModuleTemplate('templates/file_newfolder.html');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->JScode = $this->doc->wrapScriptTags('
			var path = "' . $this->target . '";

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

			var changed = 0;
		');
    }
 /**
  * Checks access to a backend module with the $MCONF passed as first argument
  *
  * @param	array		$MCONF array of a backend module!
  * @param	boolean		If set, an array will issue an error message and exit.
  * @return	boolean		Will return true if $MCONF['access'] is not set at all, if the BE_USER is admin or if the module is enabled in the be_users/be_groups records of the user (specifically enabled). Will return false if the module name is not even found in $TBE_MODULES
  */
 function modAccess($conf, $exitOnError)
 {
     if (!t3lib_BEfunc::isModuleSetInTBE_MODULES($conf['name'])) {
         if ($exitOnError) {
             t3lib_BEfunc::typo3PrintError('Fatal Error', 'This module "' . $conf['name'] . '" is not enabled in TBE_MODULES', 0);
             exit;
         }
         return FALSE;
     }
     // Workspaces check:
     if ($conf['workspaces']) {
         if ($this->workspace === 0 && t3lib_div::inList($conf['workspaces'], 'online') || $this->workspace === -1 && t3lib_div::inList($conf['workspaces'], 'offline') || $this->workspace > 0 && t3lib_div::inList($conf['workspaces'], 'custom')) {
             // ok, go on...
         } else {
             if ($exitOnError) {
                 t3lib_BEfunc::typo3PrintError('Workspace Error', 'This module "' . $conf['name'] . '" is not available under the current workspace', 0);
                 exit;
             }
             return FALSE;
         }
     }
     // Returns true if conf[access] is not set at all or if the user is admin
     if (!$conf['access'] || $this->isAdmin()) {
         return TRUE;
     }
     // If $conf['access'] is set but not with 'admin' then we return true, if the module is found in the modList
     if (!strstr($conf['access'], 'admin') && $conf['name']) {
         $acs = $this->check('modules', $conf['name']);
     }
     if (!$acs && $exitOnError) {
         t3lib_BEfunc::typo3PrintError('Access Error', 'You don\'t have access to this module.', 0);
         exit;
     } else {
         return $acs;
     }
 }
Example #11
0
 /**
  * Initializes the backend language.
  * This is for example done in typo3/template.php with lines like these:
  *
  * require (PATH_typo3 . 'sysext/lang/lang.php');
  * $LANG = t3lib_div::makeInstance('language');
  * $LANG->init($BE_USER->uc['lang']);
  *
  * @param	string		The language key (two character string from backend users profile)
  * @param	string		IGNORE. Not used.
  * @return	void
  */
 public function init($lang, $altPath = '')
 {
     // Initialize the conversion object:
     $this->csConvObj = t3lib_div::makeInstance('t3lib_cs');
     $this->charSetArray = $this->csConvObj->charSetArray;
     // Internally setting the list of TYPO3 backend languages.
     $this->langSplit = TYPO3_languages;
     // Finding the requested language in this list based
     // on the $lang key being inputted to this function.
     $ls = explode('|', $this->langSplit);
     foreach ($ls as $i => $v) {
         // Language is found. Configure it:
         if ($v == $lang) {
             // The index of the language as found in the TYPO3_languages list
             $this->langSplitIndex = $i;
             // The current language key
             $this->lang = $lang;
             // The help URL if different from the default.
             if ($this->helpUrlArray[$this->lang]) {
                 $this->typo3_help_url = $this->helpUrlArray[$this->lang];
             }
             if ($this->charSetArray[$this->lang]) {
                 // The charset if different from the default.
                 $this->charSet = $this->charSetArray[$this->lang];
             }
         }
     }
     // If a forced charset is used and different from the charset otherwise used:
     if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] && $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] != $this->charSet) {
         // Set the forced charset:
         $this->charSet = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
         if ($this->charSet != 'utf-8' && !$this->csConvObj->initCharset($this->charSet)) {
             t3lib_BEfunc::typo3PrintError('Forced charset not found', 'The forced character set "' . $this->charSet . '" was not found in t3lib/csconvtbl/');
             exit;
         }
     }
 }
Example #12
0
 /**
  * Initializes the backend module
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $TYPO3_CONF_VARS, $FILEMOUNTS;
     // Checking referer / executing
     $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
     $vC = t3lib_div::_GP('vC');
     $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
     if ($httpHost != $refInfo['host'] && $vC != $BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
         t3lib_BEfunc::typo3PrintError('Access Error', 'Referer did not match and veriCode was not valid either!', '');
         exit;
     }
     // Initialize file GPvar
     if (is_array($param = t3lib_div::_GP('file'))) {
         $this->file = $param;
     } elseif ($param) {
         $this->file[] = $param;
     }
     // Initialize folder GPvar
     if (is_array($param = t3lib_div::_GP('folder'))) {
         $this->folder = $param;
     } elseif ($param) {
         $this->folder[] = $param;
     }
     // Initialize record GPvar
     if ($param = t3lib_div::_GP('record')) {
         if (is_array($param)) {
             $this->record = $param;
         } else {
             list($table, $uidList) = explode(':', $param);
             $this->record[$table] = $uidList;
         }
         foreach ($this->record as $table => $uidList) {
             if (is_array($GLOBALS['TCA'][$table]) and $uidList = $GLOBALS['TYPO3_DB']->cleanIntList($uidList)) {
                 $this->record[$table] = explode(',', $uidList);
             } else {
                 unset($this->record[$table]);
             }
         }
     }
     // Initialize target GPvar
     $this->target = t3lib_div::_GP('target');
     // Initialize data GPvar - may be used with forms
     $this->data = t3lib_div::_GP('data');
     $this->returnUrl = t3lib_div::_GP('returnUrl');
     $this->returnUrl = $this->returnUrl ? $this->returnUrl : t3lib_div::getIndpEnv('HTTP_REFERER');
     $this->redirect = t3lib_div::_GP('redirect');
     $this->redirect = $this->redirect ? $this->redirect : $this->returnUrl;
     //
     // Init TCE-file-functions object:
     // has object: ->fileProcessor = t3lib_div::makeInstance('tx_dam_extFileFunctions');
     //
     $this->TCEfile = t3lib_div::makeInstance('tx_dam_tce_file');
     $this->TCEfile->init();
     $this->TCEfile->overwriteExistingFiles(t3lib_div::_GP('overwriteExistingFiles'));
     parent::init();
 }
 /**
  * Fetches the data for the tree
  *
  * @param	integer		item id for which to select subitems (parent id)
  * @param	integer		Max depth (recursivity limit)
  * @param	string		HTML-code prefix for recursive calls.
  * @param	string		? (internal)
  * @param	string		CSS class to use for <td> sub-elements
  * @return	integer		The count of items on the level
  */
 function getTree($uid, $depth = 999, $depthData = '', $blankLineCode = '', $subCSSclass = '')
 {
     // Buffer for id hierarchy is reset:
     $this->buffer_idH = array();
     // Init vars
     $depth = intval($depth);
     $HTML = '';
     $a = 0;
     $res = $this->getDataInit($uid, $subCSSclass);
     $c = $this->getDataCount($res);
     $crazyRecursionLimiter = 999;
     // Traverse the records:
     while ($crazyRecursionLimiter > 0 && ($row = $this->getDataNext($res, $subCSSclass))) {
         $a++;
         $crazyRecursionLimiter--;
         $newID = $row['uid'];
         if ($newID == 0) {
             t3lib_BEfunc::typo3PrintError('Endless recursion detected', 'TYPO3 has detected an error in the database. Please fix it manually (e.g. using phpMyAdmin) and change the UID of ' . $this->table . ':0 to a new value.<br /><br />See <a href="http://bugs.typo3.org/view.php?id=3495" target="_blank">bugs.typo3.org/view.php?id=3495</a> to get more information about a possible cause.', 0);
             exit;
         }
         $this->tree[] = array();
         // Reserve space.
         end($this->tree);
         $treeKey = key($this->tree);
         // Get the key for this space
         $LN = $a == $c ? 'blank' : 'line';
         // If records should be accumulated, do so
         if ($this->setRecs) {
             $this->recs[$row['uid']] = $row;
         }
         // Accumulate the id of the element in the internal arrays
         $this->ids[] = $idH[$row['uid']]['uid'] = $row['uid'];
         $this->ids_hierarchy[$depth][] = $row['uid'];
         $this->orig_ids_hierarchy[$depth][] = $row['_ORIG_uid'] ? $row['_ORIG_uid'] : $row['uid'];
         // Make a recursive call to the next level
         $HTML_depthData = $depthData . '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/ol/' . $LN . '.gif', 'width="18" height="16"') . ' alt="" />';
         if ($depth > 1 && $this->expandNext($newID) && !$row['php_tree_stop']) {
             $nextCount = $this->getTree($newID, $depth - 1, $this->makeHTML ? $HTML_depthData : '', $blankLineCode . ',' . $LN, $row['_SUBCSSCLASS']);
             if (count($this->buffer_idH)) {
                 $idH[$row['uid']]['subrow'] = $this->buffer_idH;
             }
             $exp = 1;
             // Set "did expand" flag
         } else {
             $nextCount = $this->getCount($newID);
             $exp = 0;
             // Clear "did expand" flag
         }
         // Set HTML-icons, if any:
         if ($this->makeHTML) {
             $HTML = $depthData . $this->PMicon($row, $a, $c, $nextCount, $exp);
             $HTML .= $this->wrapStop($this->getIcon($row), $row);
             #	$HTML.=$this->wrapStop($this->wrapIcon($this->getIcon($row),$row),$row);
         }
         // Finally, add the row/HTML content to the ->tree array in the reserved key.
         $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'HTML_depthData' => $this->makeHTML == 2 ? $HTML_depthData : '', 'invertedDepth' => $depth, 'blankLineCode' => $blankLineCode, 'bank' => $this->bank);
     }
     $this->getDataFree($res);
     $this->buffer_idH = $idH;
     return $c;
 }
Example #14
0
 /**
  * Initializes the backend module
  *
  * @return	void
  */
 function init()
 {
     global $BE_USER, $TYPO3_CONF_VARS, $FILEMOUNTS;
     // Checking referer / executing
     $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
     $vC = t3lib_div::_GP('vC');
     $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
     if ($httpHost != $refInfo['host'] && $vC != $BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
         t3lib_BEfunc::typo3PrintError('Access Error', 'Referer did not match and veriCode was not valid either!', '');
         exit;
     }
     parent::init();
     // Initialize GPvars:
     $this->data = t3lib_div::_GP('data');
     $this->returnUrl = t3lib_div::_GP('returnUrl');
     $this->returnUrl = $this->returnUrl ? $this->returnUrl : t3lib_div::getIndpEnv('HTTP_REFERER');
     $this->redirect = t3lib_div::_GP('redirect');
     $this->redirect = $this->redirect ? $this->redirect : $this->returnUrl;
 }