Esempio n. 1
0
    /**
     * Compares the users with the given flags
     *
     * @param	array		options that should be taking into account to compare the users
     * @return	string		the content
     */
    function compareUsers($compareFlags)
    {
        // Menu:
        $options = array('filemounts' => $GLOBALS['LANG']->getLL('filemounts', true), 'webmounts' => $GLOBALS['LANG']->getLL('webmounts', true), 'tempPath' => $GLOBALS['LANG']->getLL('defaultUploadPath', true), 'firstMainGroup' => $GLOBALS['LANG']->getLL('mainUserGroup', true), 'groupList' => $GLOBALS['LANG']->getLL('memberOfGroups', true), 'pagetypes_select' => $GLOBALS['LANG']->getLL('pageTypesAccess', true), 'tables_select' => $GLOBALS['LANG']->getLL('selectTables', true), 'tables_modify' => $GLOBALS['LANG']->getLL('modifyTables', true), 'non_exclude_fields' => $GLOBALS['LANG']->getLL('nonExcludeFields', true), 'explicit_allowdeny' => $GLOBALS['LANG']->getLL('explicitAllowDeny', true), 'allowed_languages' => $GLOBALS['LANG']->getLL('limitToLanguages', true), 'workspace_perms' => $GLOBALS['LANG']->getLL('workspacePermissions', true), 'workspace_membership' => $GLOBALS['LANG']->getLL('workspaceMembership', true), 'custom_options' => $GLOBALS['LANG']->getLL('customOptions', true), 'modules' => $GLOBALS['LANG']->getLL('modules', true), 'userTS' => $GLOBALS['LANG']->getLL('tsconfig', true), 'userTS_hl' => $GLOBALS['LANG']->getLL('tsconfigHL', true));
        $be_user_uid = t3lib_div::_GP('be_user_uid');
        if ($be_user_uid) {
            // This is used to test with other users. Development ONLY!
            $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');
            // New backend user object
            $tempBE_USER->userTS_dontGetCached = 1;
            $tempBE_USER->OS = TYPO3_OS;
            $tempBE_USER->setBeUserByUid($be_user_uid);
            $tempBE_USER->fetchGroupData();
            $uInfo = $tempBE_USER->ext_compileUserInfoForHash();
            $uInfo_dat = $tempBE_USER->ext_printOverview($uInfo, $options, 1);
            $lines = array();
            foreach ($options as $kk => $vv) {
                if ($kk == 'modules') {
                    $loadModules = t3lib_div::makeInstance('t3lib_loadModules');
                    $loadModules->load($GLOBALS['TBE_MODULES'], $tempBE_USER);
                    $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
                    $uInfo_dat[$kk] = $alt_menuObj->topMenu($loadModules->modules, 1, $GLOBALS['BACK_PATH']);
                }
                $lines[] = '<tr class="bgColor4">
					<td nowrap="nowrap" valign="top">' . $vv . ':&nbsp;&nbsp;</td>
					<td>' . $uInfo_dat[$kk] . '&nbsp;</td>
				</tr>';
                if ($kk == 'webmounts' && !$tempBE_USER->isAdmin()) {
                    $lines[] = '<tr class="bgColor4">
						<td nowrap="nowrap" valign="top">' . $GLOBALS['LANG']->getLL('nonMountedReadablePages', true) . '&nbsp;&nbsp;</td>
						<td>' . $tempBE_USER->ext_getReadableButNonmounted() . '&nbsp;</td>
					</tr>';
                }
            }
            $email = htmlspecialchars($tempBE_USER->user['email']);
            $realname = htmlspecialchars($tempBE_USER->user['realName']);
            $outTable = '<table border="0" cellpadding="1" cellspacing="1"><tr class="bgColor5"><td>' . t3lib_iconWorks::getSpriteIconForRecord('be_users', $tempBE_USER->user, array('title' => $tempBE_USER->user['uid'])) . htmlspecialchars($tempBE_USER->user['username']) . '</td>';
            $outTable .= '<td>' . ($realname ? $realname . ', ' : '') . ($email ? '<a href="mailto:' . $email . '">' . $email . '</a>' : '') . '</td>';
            $outTable .= '<td>' . $this->elementLinks('be_users', $tempBE_USER->user) . '</td></tr></table>';
            $outTable .= '<strong><a href="' . htmlspecialchars($this->MCONF['_']) . '">' . $GLOBALS['LANG']->getLL('backToOverview', true) . '</a></strong><br />';
            $outTable .= '<br /><table border="0" cellpadding="2" cellspacing="1">' . implode('', $lines) . '</table>';
            $content .= $this->doc->section($GLOBALS['LANG']->getLL('userInfo', true), $outTable, 0, 1);
        } else {
            $menu = array(0 => array());
            $rowCounter = 0;
            $columnCounter = 0;
            $itemsPerColumn = ceil(count($options) / 3);
            foreach ($options as $kk => $vv) {
                if ($rowCounter == $itemsPerColumn) {
                    $rowCounter = 0;
                    $columnCounter++;
                    $menu[$columnCounter] = array();
                }
                $rowCounter++;
                $menu[$columnCounter][] = '<input type="checkbox" class="checkbox" value="1" name="compareFlags[' . $kk . ']" id="checkCompare_' . $kk . '"' . ($compareFlags[$kk] ? ' checked="checked"' : '') . '> <label for="checkCompare_' . $kk . '">' . htmlspecialchars($vv) . '</label>';
            }
            $outCode = '<p>' . $GLOBALS['LANG']->getLL('groupBy', true) . '</p>';
            $outCode .= '<table border="0" cellpadding="3" cellspacing="1" class="compare-checklist valign-top"><tr>';
            foreach ($menu as $column) {
                $outCode .= '<td>' . implode('<br />', $column) . '</td>';
            }
            $outCode .= '</tr></table>';
            $outCode .= '<br /><input type="submit" name="ads" value="' . $GLOBALS['LANG']->getLL('update', true) . '">';
            $content = $this->doc->section($GLOBALS['LANG']->getLL('groupAndCompareUsers', true), $outCode, 0, 1);
            // Traverse all users
            $users = t3lib_BEfunc::getUserNames();
            $comparation = array();
            $counter = 0;
            $offset = 0;
            $numberAtTime = 1000;
            $tooManyUsers = '';
            foreach ($users as $r) {
                if ($counter >= $offset) {
                    // This is used to test with other users. Development ONLY!
                    $tempBE_USER = t3lib_div::makeInstance('local_beUserAuth');
                    // New backend user object
                    /* @var $tempBE_USER local_beUserAuth */
                    $tempBE_USER->OS = TYPO3_OS;
                    $tempBE_USER->setBeUserByUid($r['uid']);
                    $tempBE_USER->fetchGroupData();
                    // Making group data
                    $md5pre = '';
                    $menu = array();
                    $uInfo = $tempBE_USER->ext_compileUserInfoForHash((array) $compareFlags);
                    foreach ($options as $kk => $vv) {
                        if ($compareFlags[$kk]) {
                            $md5pre .= serialize($uInfo[$kk]) . '|';
                        }
                    }
                    // setting md5:
                    $md5 = md5($md5pre);
                    if (!isset($comparation[$md5])) {
                        $comparation[$md5] = $tempBE_USER->ext_printOverview($uInfo, $compareFlags);
                        $comparation[$md5]['users'] = array();
                    }
                    $comparation[$md5]['users'][] = $tempBE_USER->user;
                    unset($tempBE_USER);
                }
                $counter++;
                if ($counter >= $numberAtTime + $offset) {
                    $tooManyUsers = $GLOBALS['LANG']->getLL('tooManyUsers', true) . ' ' . count($users) . '. ' . $GLOBALS['LANG']->getLL('canOnlyDisplay', true) . ' ' . $numberAtTime . '.';
                    break;
                }
            }
            // Print the groups:
            $allGroups = array();
            // Header:
            $allCells = array();
            $link_createNewUser = '******' . htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[be_users][0]=new', $this->doc->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('newUser', true) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-new') . '</a>';
            $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td><strong>' . $GLOBALS['LANG']->getLL('usernames', TRUE) . '</strong></td><td width="12">' . $link_createNewUser . '</td></tr></table>';
            foreach ($options as $kk => $vv) {
                if ($compareFlags[$kk]) {
                    $allCells[$kk] = '<strong>' . $vv . ':</strong>';
                }
            }
            $allGroups[] = $allCells;
            foreach ($comparation as $dat) {
                $allCells = array();
                $curUid = $GLOBALS['BE_USER']->user['uid'];
                $uListArr = array();
                foreach ($dat['users'] as $uDat) {
                    $uItem = '<tr><td width="130">' . t3lib_iconWorks::getSpriteIconForRecord('be_users', $uDat, array('title' => $uDat['uid'])) . $this->linkUser($uDat['username'], $uDat) . '&nbsp;&nbsp;</td><td nowrap="nowrap">' . $this->elementLinks('be_users', $uDat);
                    if ($curUid != $uDat['uid'] && !$uDat['disable'] && ($uDat['starttime'] == 0 || $uDat['starttime'] < $GLOBALS['EXEC_TIME']) && ($uDat['endtime'] == 0 || $uDat['endtime'] > $GLOBALS['EXEC_TIME'])) {
                        $uItem .= '<a href="' . t3lib_div::linkThisScript(array('SwitchUser' => $uDat['uid'])) . '" target="_top" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('switchUserTo', true) . ' ' . $uDat['username']) . ' ' . $GLOBALS['LANG']->getLL('changeToMode', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-backend-user-switch') . '</a>' . '<a href="' . t3lib_div::linkThisScript(array('SwitchUser' => $uDat['uid'], 'switchBackUser' => 1)) . '" target="_top" title="' . htmlspecialchars($GLOBALS['LANG']->getLL('switchUserTo', true) . ' ' . $uDat['username']) . ' ' . $GLOBALS['LANG']->getLL('switchBackMode', TRUE) . '">' . t3lib_iconWorks::getSpriteIcon('actions-system-backend-user-emulate') . '</a>';
                    }
                    $uItem .= '</td></tr>';
                    $uListArr[] = $uItem;
                }
                $allCells['USERS'] = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . implode('', $uListArr) . '</table>';
                foreach ($options as $kk => $vv) {
                    if ($compareFlags[$kk]) {
                        $allCells[$kk] = $dat[$kk];
                    }
                }
                $allGroups[] = $allCells;
            }
            // Make table
            $outTable = '';
            $TDparams = ' nowrap="nowrap" class="bgColor5" valign="top"';
            $i = 0;
            foreach ($allGroups as $allCells) {
                $outTable .= '<tr><td' . $TDparams . '>' . implode('</td><td' . $TDparams . '>', $allCells) . '</td></tr>';
                $TDparams = ' nowrap="nowrap" class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '" valign="top"';
            }
            $outTable = '<table border="0" cellpadding="2" cellspacing="2">' . $outTable . '</table>';
            $outTable .= '<br /><br />' . $GLOBALS['LANG']->getLL('cachedGrouplistsUpdated', true);
            $outTable .= $tooManyUsers ? '<br /><br /><strong><span class="typo3-red">' . $tooManyUsers . '</span></strong>' : '';
            $content .= $this->doc->spacer(10);
            $content .= $this->doc->section($GLOBALS['LANG']->getLL('result', true), $outTable, 0, 1);
        }
        return $content;
    }
Esempio n. 2
0
 /**
  * Main function to generate the content
  *
  * @return	void
  */
 function main()
 {
     $this->content = $this->doc->header('Indexing Engine Statistics');
     $this->content .= $this->doc->spacer(5);
     switch ($this->MOD_SETTINGS['function']) {
         case 'stat':
             $this->content .= $this->doc->section('Records', $this->doc->table($this->getRecordsNumbers()), 0, 1);
             $this->content .= $this->doc->spacer(15);
             $this->content .= $this->doc->section('index_phash TYPES', $this->doc->table($this->getPhashTypes()), 1);
             $this->content .= $this->doc->spacer(15);
             break;
         case 'externalDocs':
             $this->content .= $this->doc->section('External documents', $this->doc->table($this->getPhashExternalDocs()), 0, 1);
             $this->content .= $this->doc->spacer(15);
             break;
         case 'typo3pages':
             $this->content .= $this->doc->section('TYPO3 Pages', $this->doc->table($this->getPhashT3pages()), 0, 1);
             $this->content .= $this->doc->spacer(15);
             break;
     }
     $docHeaderButtons = $this->getButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
     $this->content = $this->doc->startPage('Indexing Engine Statistics');
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Esempio n. 3
0
    /**
     * [Describe function...]
     *
     * @return	[type]		...
     */
    function main()
    {
        $arrayBrowser = t3lib_div::makeInstance('t3lib_arrayBrowser');
        $this->content = $this->doc->header($GLOBALS['LANG']->getLL('configuration', true));
        $this->content .= $this->doc->spacer(5);
        $this->content .= '<div id="lowlevel-config">
						<label for="search_field">' . $GLOBALS['LANG']->getLL('enterSearchPhrase', true) . '</label>
						<input type="text" id="search_field" name="search_field" value="' . htmlspecialchars($search_field) . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . ' />
						<input type="submit" name="search" id="search" value="' . $GLOBALS['LANG']->getLL('search', true) . '" />';
        $this->content .= t3lib_BEfunc::getFuncCheck(0, 'SET[regexsearch]', $this->MOD_SETTINGS['regexsearch'], '', '', 'id="checkRegexsearch"') . '<label for="checkRegexsearch">' . $GLOBALS['LANG']->getLL('useRegExp', true) . '</label>';
        $this->content .= t3lib_BEfunc::getFuncCheck(0, 'SET[fixedLgd]', $this->MOD_SETTINGS['fixedLgd'], '', '', 'id="checkFixedLgd"') . '<label for="checkFixedLgd">' . $GLOBALS['LANG']->getLL('cropLines', true) . '</label>
						</div>';
        $this->content .= $this->doc->spacer(5);
        switch ($this->MOD_SETTINGS['function']) {
            case 0:
                $theVar = $GLOBALS['TYPO3_CONF_VARS'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_CONF_VARS';
                break;
            case 1:
                foreach ($GLOBALS['TCA'] as $table => $config) {
                    t3lib_div::loadTCA($table);
                }
                $theVar = $GLOBALS['TCA'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TCA';
                break;
            case 2:
                $theVar = $GLOBALS['TCA_DESCR'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TCA_DESCR';
                break;
            case 3:
                $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
                break;
            case 4:
                $theVar = $GLOBALS['T3_SERVICES'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$T3_SERVICES';
                break;
            case 5:
                $theVar = $GLOBALS['TBE_MODULES'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_MODULES';
                break;
            case 6:
                $theVar = $GLOBALS['TBE_MODULES_EXT'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_MODULES_EXT';
                break;
            case 7:
                $theVar = $GLOBALS['TBE_STYLES'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TBE_STYLES';
                break;
            case 8:
                $theVar = $GLOBALS['BE_USER']->uc;
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$BE_USER->uc';
                break;
            case 9:
                $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
                t3lib_div::naturalKeySortRecursive($theVar);
                $arrayBrowser->varName = '$TYPO3_USER_SETTINGS';
                break;
            default:
                $theVar = array();
                break;
        }
        // Update node:
        $update = 0;
        $node = t3lib_div::_GET('node');
        if (is_array($node)) {
            // If any plus-signs were clicked, it's registred.
            $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']] = $arrayBrowser->depthKeys($node, $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']]);
            $update = 1;
        }
        if ($update) {
            $GLOBALS['BE_USER']->pushModuleData($this->MCONF['name'], $this->MOD_SETTINGS);
        }
        $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
        $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
        $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
        $arrayBrowser->searchKeysToo = TRUE;
        $search_field = t3lib_div::_GP('search_field');
        if (t3lib_div::_POST('search') && trim($search_field)) {
            // If any POST-vars are send, update the condition array
            $arrayBrowser->depthKeys = $arrayBrowser->getSearchKeys($theVar, '', $search_field, array());
        }
        $tree = $arrayBrowser->tree($theVar, '', '');
        $label = $this->MOD_MENU['function'][$this->MOD_SETTINGS['function']];
        $this->content .= $this->doc->sectionEnd();
        // Variable name:
        if (t3lib_div::_GP('varname')) {
            $line = t3lib_div::_GP('_') ? t3lib_div::_GP('_') : t3lib_div::_GP('varname');
            if (t3lib_div::_GP('writetoexttables')) {
                // Write the line to extTables.php
                // change value to $GLOBALS
                $length = strpos($line, '[');
                $var = substr($line, 0, $length);
                $changedLine = '$GLOBALS[\'' . substr($line, 1, $length - 1) . '\']' . substr($line, $length);
                // insert line  in extTables.php
                $extTables = t3lib_div::getURL(PATH_typo3conf . TYPO3_extTableDef_script);
                $extTables = '<?php' . preg_replace('/<\\?php|\\?>/is', '', $extTables) . $changedLine . LF . '?>';
                $success = t3lib_div::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);
                if ($success) {
                    // show flash message
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessage', TRUE), TYPO3_extTableDef_script, '<br />', '<strong>' . $changedLine . '</strong>'), t3lib_FlashMessage::OK);
                } else {
                    // Error: show flash message
                    $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', '', sprintf($GLOBALS['LANG']->getLL('writeMessageFailed', TRUE), TYPO3_extTableDef_script), t3lib_FlashMessage::ERROR);
                }
                $this->content .= $flashMessage->render();
            }
            $this->content .= '<div id="lowlevel-config-var">
				<strong>' . $GLOBALS['LANG']->getLL('variable', TRUE) . '</strong><br />
				<input type="text" name="_" value="' . trim(htmlspecialchars($line)) . '" size="120" /><br/>';
            if (TYPO3_extTableDef_script !== '' && ($this->MOD_SETTINGS['function'] === '1' || $this->MOD_SETTINGS['function'] === '4')) {
                // write only for $TCA and TBE_STYLES if  TYPO3_extTableDef_script is defined
                $this->content .= '<br /><input type="submit" name="writetoexttables" value="' . $GLOBALS['LANG']->getLL('writeValue', TRUE) . '" /></div>';
            } else {
                $this->content .= $GLOBALS['LANG']->getLL('copyPaste', TRUE) . LF . '</div>';
            }
        }
        $this->content .= '<br /><table border="0" cellpadding="0" cellspacing="0" class="t3-tree t3-tree-config">';
        $this->content .= '<tr>
					<th class="t3-row-header t3-tree-config-header">' . $label . '</th>
				</tr>
				<tr>
					<td>' . $tree . '</td>
				</tr>
			</table>
		';
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu(), 'CONTENT' => $this->content);
        // Build the <body> for the module
        $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render('Configuration', $this->content);
    }
Esempio n. 4
0
 /**
  * Main function for Workspace Manager module.
  *
  * @return	void
  */
 function main()
 {
     global $LANG, $BE_USER, $BACK_PATH;
     // See if we need to switch workspace
     $changeWorkspace = t3lib_div::_GET('changeWorkspace');
     if ($changeWorkspace != '') {
         $BE_USER->setWorkspace($changeWorkspace);
         $this->content .= $this->doc->wrapScriptTags('top.location.href="' . $BACK_PATH . t3lib_BEfunc::getBackendScript() . '";');
     } else {
         // Starting page:
         $this->content .= $this->doc->header($LANG->getLL('title'));
         $this->content .= $this->doc->spacer(5);
         // Get usernames and groupnames
         $be_group_Array = t3lib_BEfunc::getListGroupNames('title,uid');
         $groupArray = array_keys($be_group_Array);
         // Need 'admin' field for t3lib_iconWorks::getIconImage()
         $this->be_user_Array_full = $this->be_user_Array = t3lib_BEfunc::getUserNames('username,usergroup,usergroup_cached_list,uid,admin,workspace_perms');
         if (!$GLOBALS['BE_USER']->isAdmin()) {
             $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, $groupArray, 1);
         }
         // Build top menu:
         $menuItems = array();
         $menuItems[] = array('label' => $LANG->getLL('menuitem_review'), 'content' => $this->moduleContent_publish());
         $menuItems[] = array('label' => $LANG->getLL('menuitem_workspaces'), 'content' => $this->moduleContent_workspaceList());
         // Add hidden fields and create tabs:
         $content = $this->doc->getDynTabMenu($menuItems, 'user_ws');
         $this->content .= $this->doc->section('', $content, 0, 1);
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         // $markers['CSH'] = $docHeaderButtons['csh'];
     }
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($LANG->getLL('title'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Esempio n. 5
0
 /**
  * Main function
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS;
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('adminLog'));
     $this->content .= $this->doc->spacer(5);
     // Menu compiled:
     $menuU = t3lib_BEfunc::getFuncMenu(0, 'SET[users]', $this->MOD_SETTINGS['users'], $this->MOD_MENU['users']);
     $menuM = t3lib_BEfunc::getFuncMenu(0, 'SET[max]', $this->MOD_SETTINGS['max'], $this->MOD_MENU['max']);
     $menuT = t3lib_BEfunc::getFuncMenu(0, 'SET[time]', $this->MOD_SETTINGS['time'], $this->MOD_MENU['time']);
     $menuA = t3lib_BEfunc::getFuncMenu(0, 'SET[action]', $this->MOD_SETTINGS['action'], $this->MOD_MENU['action']);
     $menuW = t3lib_BEfunc::getFuncMenu(0, 'SET[workspaces]', $this->MOD_SETTINGS['workspaces'], $this->MOD_MENU['workspaces']);
     $groupByPage = t3lib_BEfunc::getFuncCheck(0, 'SET[groupByPage]', $this->MOD_SETTINGS['groupByPage']);
     $style = ' style="margin:4px 2px;padding:1px;vertical-align:middle;width: 115px;"';
     $inputDate = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate'] ? $this->MOD_SETTINGS['manualdate'] : '') . '" name="SET[manualdate]" id="tceforms-datetimefield-manualdate"' . $style . ' />';
     $pickerInputDate = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/datepicker.gif', '', 0) . ' style="cursor:pointer; vertical-align:middle;" alt=""' . ' id="picker-tceforms-datetimefield-manualdate" />';
     $inputDate_end = '<input type="text" value="' . ($this->MOD_SETTINGS['manualdate_end'] ? $this->MOD_SETTINGS['manualdate_end'] : '') . '" name="SET[manualdate]" id="tceforms-datetimefield-manualdate_end"' . $style . ' />';
     $pickerInputDate_end = '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/datepicker.gif', '', 0) . ' style="cursor:pointer; vertical-align:middle;" alt=""' . ' id="picker-tceforms-datetimefield-manualdate_end" />';
     $setButton = '<input type="button" value="' . $GLOBALS['LANG']->getLL('set') . '" onclick="jumpToUrl(\'mod.php?&amp;id=0&amp;M=tools_log&amp;SET[manualdate]=\'+escape($(\'tceforms-datetimefield-manualdate\').value)+\'&amp;SET[manualdate_end]=\'+escape($(\'tceforms-datetimefield-manualdate_end\').value),this);" />';
     $this->content .= $this->doc->section('', $this->doc->menuTable(array(array($GLOBALS['LANG']->getLL('users'), $menuU), array($GLOBALS['LANG']->getLL('time'), $menuT . ($this->MOD_SETTINGS['time'] == 30 ? '<br />' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:from', true) . ' ' . $inputDate . $pickerInputDate . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:to', true) . ' ' . $inputDate_end . $pickerInputDate_end . '&nbsp;' . $setButton : ''))), array(array($GLOBALS['LANG']->getLL('max'), $menuM), array($GLOBALS['LANG']->getLL('action'), $menuA)), array($GLOBALS['BE_USER']->workspace !== 0 ? array($GLOBALS['LANG']->getLL('workspace'), '<strong>' . $GLOBALS['BE_USER']->workspace . '</strong>') : array($GLOBALS['LANG']->getLL('workspace'), $menuW), array($GLOBALS['LANG']->getLL('groupByPage'), $groupByPage))));
     $codeArr = $this->lF->initArray();
     $oldHeader = '';
     $c = 0;
     // Action (type):
     $where_part = '';
     if ($this->MOD_SETTINGS['action'] > 0) {
         $where_part .= ' AND type=' . intval($this->MOD_SETTINGS['action']);
     } elseif ($this->MOD_SETTINGS['action'] == -1) {
         $where_part .= ' AND error != 0';
     }
     $starttime = 0;
     $endtime = $GLOBALS['EXEC_TIME'];
     // Time:
     switch ($this->MOD_SETTINGS['time']) {
         case 0:
             // This week
             $week = (date('w') ? date('w') : 7) - 1;
             $starttime = mktime(0, 0, 0) - $week * 3600 * 24;
             break;
         case 1:
             // Last week
             $week = (date('w') ? date('w') : 7) - 1;
             $starttime = mktime(0, 0, 0) - ($week + 7) * 3600 * 24;
             $endtime = mktime(0, 0, 0) - $week * 3600 * 24;
             break;
         case 2:
             // Last 7 days
             $starttime = mktime(0, 0, 0) - 7 * 3600 * 24;
             break;
         case 10:
             // This month
             $starttime = mktime(0, 0, 0, date('m'), 1);
             break;
         case 11:
             // Last month
             $starttime = mktime(0, 0, 0, date('m') - 1, 1);
             $endtime = mktime(0, 0, 0, date('m'), 1);
             break;
         case 12:
             // Last 31 days
             $starttime = mktime(0, 0, 0) - 31 * 3600 * 24;
             break;
         case 30:
             $starttime = $this->theTime;
             if ($this->theTime_end) {
                 $endtime = $this->theTime_end;
             } else {
                 $endtime = $GLOBALS['EXEC_TIME'];
             }
     }
     if ($starttime) {
         $where_part .= ' AND tstamp>=' . $starttime . ' AND tstamp<' . $endtime;
     }
     // Users
     $selectUsers = array();
     if (substr($this->MOD_SETTINGS['users'], 0, 3) == "gr-") {
         // All users
         $this->be_user_Array = t3lib_BEfunc::blindUserNames($this->be_user_Array, array(substr($this->MOD_SETTINGS['users'], 3)), 1);
         if (is_array($this->be_user_Array)) {
             foreach ($this->be_user_Array as $val) {
                 if ($val['uid'] != $BE_USER->user['uid']) {
                     $selectUsers[] = $val['uid'];
                 }
             }
         }
         $selectUsers[] = 0;
         $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')';
     } elseif (substr($this->MOD_SETTINGS['users'], 0, 3) == "us-") {
         // All users
         $selectUsers[] = intval(substr($this->MOD_SETTINGS['users'], 3));
         $where_part .= ' AND userid in (' . implode($selectUsers, ',') . ')';
     } elseif ($this->MOD_SETTINGS['users'] == -1) {
         $where_part .= ' AND userid=' . $BE_USER->user['uid'];
         // Self user
     }
     // Workspace
     if ($GLOBALS['BE_USER']->workspace !== 0) {
         $where_part .= ' AND workspace=' . intval($GLOBALS['BE_USER']->workspace);
     } elseif ($this->MOD_SETTINGS['workspaces'] != -99) {
         $where_part .= ' AND workspace=' . intval($this->MOD_SETTINGS['workspaces']);
     }
     // Finding out which page ids are in the log:
     $logPids = array();
     if ($this->MOD_SETTINGS['groupByPage']) {
         $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('event_pid', 'sys_log', '1=1' . $where_part, 'event_pid');
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) {
             $logPids[] = $row['event_pid'];
         }
         // Overview:
         $overviewList = array();
         foreach ($logPids as $pid) {
             if ((int) $pid > 0) {
                 $overviewList[] = htmlspecialchars(sprintf($GLOBALS['LANG']->getLL('pagenameWithUID'), t3lib_BEfunc::getRecordPath($pid, '', 20), $pid));
             }
         }
         sort($overviewList);
         $this->content .= $this->doc->divider(5);
         $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('overview'), sprintf($GLOBALS['LANG']->getLL('timeInfo'), date($this->dateFormat, $starttime), date($this->dateFormat, $endtime)) . '<br /><br /><br />' . implode('<br />', $overviewList), 1, 1, 0);
         $this->content .= $this->doc->spacer(30);
     } else {
         $logPids[] = '_SINGLE';
     }
     foreach ($logPids as $pid) {
         $codeArr = $this->lF->initArray();
         $this->lF->reset();
         $oldHeader = '';
         $this->content .= $this->doc->divider(5);
         switch ($pid) {
             case '_SINGLE':
                 $insertMsg = '';
                 break;
             case '-1':
                 $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forNonPageRelatedActions') . ' ';
                 break;
             case '0':
                 $insertMsg = ' ' . $GLOBALS['LANG']->getLL('forRootLevel') . ' ';
                 break;
             default:
                 $insertMsg = ' ' . sprintf($GLOBALS['LANG']->getLL('forPage'), t3lib_BEfunc::getRecordPath($pid, '', 20), $pid) . ' ';
                 break;
         }
         $this->content .= $this->doc->section(sprintf($GLOBALS['LANG']->getLL('logForNonPageRelatedActionsOrRootLevelOrPage'), $insertMsg, date($this->dateFormat, $starttime), date($this->dateFormat, $endtime)), '', 1, 1, 0);
         $log = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_log', '1=1' . $where_part . ($pid != '_SINGLE' ? ' AND event_pid=' . intval($pid) : ''), '', 'uid DESC', intval($this->MOD_SETTINGS['max']));
         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($log)) {
             $header = $this->doc->formatTime($row['tstamp'], 10);
             if (!$oldHeader) {
                 $oldHeader = $header;
             }
             if ($header != $oldHeader) {
                 $this->content .= $this->doc->spacer(10);
                 $this->content .= $this->doc->section($oldHeader, $this->doc->table($codeArr));
                 $codeArr = $this->lF->initArray();
                 $oldHeader = $header;
                 $this->lF->reset();
             }
             $i++;
             $codeArr[$i][] = $this->lF->getTimeLabel($row['tstamp']);
             $codeArr[$i][] = $this->lF->getUserLabel($row['userid'], $row['workspace']);
             $codeArr[$i][] = $this->lF->getTypeLabel($row['type']);
             $codeArr[$i][] = $row['error'] ? $this->lF->getErrorFormatting($this->lF->errorSign[$row['error']], $row['error']) : '';
             $codeArr[$i][] = $this->lF->getActionLabel($row['type'] . '_' . $row['action']);
             $codeArr[$i][] = $this->lF->formatDetailsForList($row);
         }
         $this->content .= $this->doc->spacer(10);
         $this->content .= $this->doc->section($header, $this->doc->table($codeArr));
         $GLOBALS['TYPO3_DB']->sql_free_result($log);
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     //$markers['CSH'] = $docHeaderButtons['csh'];
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('adminLog'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
Esempio n. 6
0
    /**
     * Creates view for dumping static tables and table/fields structures...
     *
     * @param	string		Extension key
     * @param	array		Extension information array
     * @return	void
     */
    function extDumpTables($extKey, $extInfo)
    {
        // Get dbInfo which holds the structure known from the tables.sql file
        $techInfo = $this->install->makeDetailedExtensionAnalysis($extKey, $extInfo);
        $absPath = tx_em_Tools::getExtPath($extKey, $extInfo['type']);
        // Static tables:
        if (is_array($techInfo['static'])) {
            if ($this->CMD['writeSTATICdump']) {
                // Writing static dump:
                $writeFile = $absPath . 'ext_tables_static+adt.sql';
                if (@is_file($writeFile)) {
                    $dump_static = tx_em_Database::dumpStaticTables(implode(',', $techInfo['static']));
                    t3lib_div::writeFile($writeFile, $dump_static);
                    $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('extDumpTables_tables_fields'), sprintf($GLOBALS['LANG']->getLL('extDumpTables_bytes_written_to'), t3lib_div::formatSize(strlen($dump_static)), substr($writeFile, strlen(PATH_site))), 0, 1);
                }
            } else {
                // Showing info about what tables to dump - and giving the link to execute it.
                $msg = $GLOBALS['LANG']->getLL('extDumpTables_dumping_content') . '<br />';
                $msg .= '<br />' . implode('<br />', $techInfo['static']) . '<br />';
                // ... then feed that to this function which will make new CREATE statements of the same fields but based on the current database content.
                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('extDumpTables_static_tables'), $msg . '<hr /><strong><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[writeSTATICdump]' => 1))) . '">' . $GLOBALS['LANG']->getLL('extDumpTables_write_static') . '</a></strong>', 0, 1);
                $this->content .= $this->doc->spacer(20);
            }
        }
        // Table and field definitions:
        if (is_array($techInfo['dump_tf'])) {
            $dump_tf_array = tx_em_Database::getTableAndFieldStructure($techInfo['dump_tf']);
            $dump_tf = tx_em_Database::dumpTableAndFieldStructure($dump_tf_array);
            if ($this->CMD['writeTFdump']) {
                $writeFile = $absPath . 'ext_tables.sql';
                if (@is_file($writeFile)) {
                    t3lib_div::writeFile($writeFile, $dump_tf);
                    $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('extDumpTables_tables_fields'), sprintf($GLOBALS['LANG']->getLL('extDumpTables_bytes_written_to'), t3lib_div::formatSize(strlen($dump_tf)), substr($writeFile, strlen(PATH_site))), 0, 1);
                }
            } else {
                $msg = $GLOBALS['LANG']->getLL('extDumpTables_dumping_db_structure') . '<br />';
                if (is_array($techInfo['tables'])) {
                    $msg .= '<br /><strong>' . $GLOBALS['LANG']->getLL('extDumpTables_tables') . '</strong><br />' . implode('<br />', $techInfo['tables']) . '<br />';
                }
                if (is_array($techInfo['fields'])) {
                    $msg .= '<br /><strong>' . $GLOBALS['LANG']->getLL('extDumpTables_solo_fields') . '</strong><br />' . implode('<br />', $techInfo['fields']) . '<br />';
                }
                // ... then feed that to this function which will make new CREATE statements of the same fields but based on the current database content.
                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('extDumpTables_tables_fields'), $msg . '<hr /><strong><a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('CMD[showExt]' => $extKey, 'CMD[writeTFdump]' => 1))) . '">' . $GLOBALS['LANG']->getLL('extDumpTables_write_dump') . '</a></strong><hr />
						<pre>' . htmlspecialchars($dump_tf) . '</pre>', 0, 1);
                $details = '							' . $GLOBALS['LANG']->getLL('extDumpTables_based_on') . '<br />
				<ul>
				<li>' . $GLOBALS['LANG']->getLL('extDumpTables_based_on_one') . '</li>
				<li>' . $GLOBALS['LANG']->getLL('extDumpTables_based_on_two') . '</li>
				</ul>
				' . $GLOBALS['LANG']->getLL('extDumpTables_bottomline') . '<br />';
                $this->content .= $this->doc->section('', $details);
            }
        }
    }
    /**
     * Produces the config form for an extension (if any template file, ext_conf_template.txt is found)
     *
     * @param	string		Extension key
     * @param	array		Extension information array
     * @param	boolean		If true, the form HTML content is returned, otherwise the content is set in $this->content.
     * @param	string		Submit-to URL (supposedly)
     * @param	string		Additional form fields to include.
     * @return	string		Depending on $output. Can return the whole form.
     */
    function tsStyleConfigForm($extKey, $extInfo, $output = 0, $script = '', $addFields = '')
    {
        global $TYPO3_CONF_VARS;
        // Initialize:
        $absPath = $this->getExtPath($extKey, $extInfo['type']);
        $relPath = $this->typeRelPaths[$extInfo['type']] . $extKey . '/';
        // Look for template file for form:
        if (t3lib_extMgm::isLoaded($extKey) && @is_file($absPath . 'ext_conf_template.txt')) {
            // Load tsStyleConfig class and parse configuration template:
            $tsStyleConfig = t3lib_div::makeInstance('t3lib_tsStyleConfig');
            $tsStyleConfig->doNotSortCategoriesBeforeMakingForm = TRUE;
            $theConstants = $tsStyleConfig->ext_initTSstyleConfig(t3lib_div::getUrl($absPath . 'ext_conf_template.txt'), $relPath, $absPath, $GLOBALS['BACK_PATH']);
            // Load the list of resources.
            $tsStyleConfig->ext_loadResources($absPath . 'res/');
            // Load current value:
            $arr = unserialize($TYPO3_CONF_VARS['EXT']['extConf'][$extKey]);
            $arr = is_array($arr) ? $arr : array();
            // Call processing function for constants config and data before write and form rendering:
            if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/mod/tools/em/index.php']['tsStyleConfigForm'])) {
                $_params = array('fields' => &$theConstants, 'data' => &$arr, 'extKey' => $extKey);
                foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/mod/tools/em/index.php']['tsStyleConfigForm'] as $_funcRef) {
                    t3lib_div::callUserFunction($_funcRef, $_params, $this);
                }
                unset($_params);
            }
            // If saving operation is done:
            if (t3lib_div::_POST('submit')) {
                $tsStyleConfig->ext_procesInput(t3lib_div::_POST(), array(), $theConstants, array());
                $arr = $tsStyleConfig->ext_mergeIncomingWithExisting($arr);
                $this->writeTsStyleConfig($extKey, $arr);
            }
            // Setting value array
            $tsStyleConfig->ext_setValueArray($theConstants, $arr);
            // Getting session data:
            $MOD_MENU = array();
            $MOD_MENU['constant_editor_cat'] = $tsStyleConfig->ext_getCategoriesForModMenu();
            $MOD_SETTINGS = t3lib_BEfunc::getModuleData($MOD_MENU, t3lib_div::_GP('SET'), 'xMod_test');
            // Resetting the menu (stop)
            if (count($MOD_MENU['constant_editor_cat']) > 1) {
                $menu = $GLOBALS['LANG']->getLL('extInfoArray_category') . ' ' . t3lib_BEfunc::getFuncMenu(0, 'SET[constant_editor_cat]', $MOD_SETTINGS['constant_editor_cat'], $MOD_MENU['constant_editor_cat'], '', '&CMD[showExt]=' . $extKey);
                $this->content .= $this->doc->section('', '<span class="nobr">' . $menu . '</span>');
                $this->content .= $this->doc->spacer(10);
            }
            // Category and constant editor config:
            $form = '
				<table border="0" cellpadding="0" cellspacing="0" width="600">
					<tr>
						<td>' . $tsStyleConfig->ext_getForm($MOD_SETTINGS['constant_editor_cat'], $theConstants, $script, $addFields) . '</form></td>
					</tr>
				</table>';
        } else {
            $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->getLL('tsStyleConfigForm_additional_config'), '', t3lib_FlashMessage::INFO);
            $form = '
				<table border="0" cellpadding="0" cellspacing="0" width="600">
					<tr>
						<td>
							<form action="' . htmlspecialchars($script) . '" method="post">' . $addFields . $flashMessage->render() . '<br /><input type="submit" name="write" value="' . $GLOBALS['LANG']->getLL('updatesForm_make_updates') . '" />
							</form>
						</td>
					</tr>
				</table>';
        }
        if ($output) {
            return $form;
        } else {
            $this->content .= $this->doc->section('', $form);
        }
    }