コード例 #1
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);
 }
コード例 #2
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);
 }
コード例 #3
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);
 }
コード例 #4
0
 /**
  * This functions builds the content of the page
  *
  * @return	void
  */
 function main()
 {
     $this->content = '';
     $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('backendUserAdministration', true));
     $this->content .= $this->doc->spacer(5);
     switch ($this->MOD_SETTINGS['function']) {
         case 'compare':
             if (t3lib_div::_GP('ads')) {
                 $compareFlags = t3lib_div::_GP('compareFlags');
                 $GLOBALS['BE_USER']->pushModuleData('tools_beuser/index.php/compare', $compareFlags);
             } else {
                 $compareFlags = $GLOBALS['BE_USER']->getModuleData('tools_beuser/index.php/compare', 'ses');
             }
             $this->content .= $this->compareUsers($compareFlags);
             break;
         case 'whoisonline':
             $this->content .= $this->whoIsOnline();
             break;
     }
     // Setting up the buttons and markers for docheader
     $docHeaderButtons = $this->getButtons();
     //$markers['CSH'] = $docHeaderButtons['csh'];
     $markers['FUNC_MENU'] = t3lib_BEfunc::getFuncMenu(0, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
     $markers['CONTENT'] = $this->content;
     // Build the <body> for the module
     $this->content = $this->doc->startPage('Backend User Administration');
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }
コード例 #5
0
    /**
     * Allows to set the translation preferences and check the status
     *
     * @return	void
     */
    function translationHandling()
    {
        global $LANG, $TYPO3_LOADED_EXT;
        $LANG->includeLLFile('EXT:setup/mod/locallang.xml');
        //prepare docheader
        $docHeaderButtons = $this->getButtons();
        $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => $this->getFuncMenu());
        $incoming = t3lib_div::_POST('SET');
        if (isset($incoming['selectedLanguages']) && is_array($incoming['selectedLanguages'])) {
            t3lib_BEfunc::getModuleData($this->MOD_MENU, array('selectedLanguages' => serialize($incoming['selectedLanguages'])), $this->MCONF['name'], '', 'selectedLanguages');
            $this->MOD_SETTINGS['selectedLanguages'] = serialize($incoming['selectedLanguages']);
        }
        $selectedLanguages = unserialize($this->MOD_SETTINGS['selectedLanguages']);
        if (count($selectedLanguages) == 1 && empty($selectedLanguages[0])) {
            $selectedLanguages = array();
        }
        $theLanguages = t3lib_div::trimExplode('|', TYPO3_languages);
        foreach ($theLanguages as $val) {
            if ($val != 'default') {
                $localLabel = '  -  [' . htmlspecialchars($GLOBALS['LOCAL_LANG']['default']['lang_' . $val]) . ']';
                $selected = is_array($selectedLanguages) && in_array($val, $selectedLanguages) ? ' selected="selected"' : '';
                $opt[$GLOBALS['LANG']->getLL('lang_' . $val, 1) . '--' . $val] = '
			 <option value="' . $val . '"' . $selected . '>' . $LANG->getLL('lang_' . $val, 1) . $localLabel . '</option>';
            }
        }
        ksort($opt);
        // Prepare the HTML output:
        $content .= '
			' . t3lib_BEfunc::cshItem('_MOD_tools_em', 'translation', $GLOBALS['BACK_PATH'], '|<br />') . '
			<form action="index.php" method="post" name="translationform">
			<fieldset><legend>' . $GLOBALS['LANG']->getLL('translation_settings') . '</legend>
			<table border="0" cellpadding="2" cellspacing="2">
				<tr class="bgColor4">
					<td>' . $GLOBALS['LANG']->getLL('languages_to_fetch') . '</td>
					<td>
					  <select name="SET[selectedLanguages][]" multiple="multiple" size="10">
					  <option>&nbsp;</option>' . implode('', $opt) . '
			</select>
		  </td>
				</tr>
			</table>
			<br />
			<p>' . $GLOBALS['LANG']->getLL('translation_info') . '<br />
			<br />' . $GLOBALS['LANG']->getLL('translation_loaded_exts') . '</p>
			</fieldset>
			<br />
			<input type="submit" value="' . $GLOBALS['LANG']->getLL('translation_save_selection') . '" />
			<br />
			</form>';
        $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('translation_settings'), $content, 0, 1);
        if (count($selectedLanguages) > 0) {
            $mirrorURL = $this->getMirrorURL();
            $content = '<input type="button" value="' . $GLOBALS['LANG']->getLL('translation_check_status_button') . '" onclick="document.location.href=\'' . htmlspecialchars(t3lib_div::linkThisScript(array('l10n' => 'check'))) . '\'" />&nbsp;<input type="button" value="' . $GLOBALS['LANG']->getLL('translation_update_button') . '" onclick="document.location.href=\'' . htmlspecialchars(t3lib_div::linkThisScript(array('l10n' => 'update'))) . '\'" />';
            // as this page loads dynamically, quit output buffering caused by ob_gzhandler
            t3lib_div::cleanOutputBuffers();
            if (t3lib_div::_GET('l10n') == 'check') {
                $loadedExtensions = array_keys($TYPO3_LOADED_EXT);
                $loadedExtensions = array_diff($loadedExtensions, array('_CACHEFILE'));
                // Override content output - we now do that ourselves:
                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
                // Setting up the buttons and markers for docheader
                $content = $this->doc->startPage('Extension Manager');
                $content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
                $contentParts = explode('###CONTENT###', $content);
                echo $contentParts[0] . $this->content;
                $this->doPrintContent = FALSE;
                flush();
                echo '
				<br />
				<br />
				<p id="progress-message">
					' . $GLOBALS['LANG']->getLL('translation_check_status') . '
				</p>
				<br />
				<div style="width:100%; height:20px; border: 1px solid black;">
					<div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
					<div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:' . $this->doc->bgColor2 . ';">&nbsp;</div>
				</div>
				<br />
				<br /><p>' . $GLOBALS['LANG']->getLL('translation_table_check') . '</p><br />
				<table border="0" cellpadding="2" cellspacing="2">
					<tr class="t3-row-header"><td>' . $GLOBALS['LANG']->getLL('translation_extension_key') . '</td>
				';
                foreach ($selectedLanguages as $lang) {
                    echo '<td>' . $LANG->getLL('lang_' . $lang, 1) . '</td>';
                }
                echo '</tr>';
                $counter = 1;
                foreach ($loadedExtensions as $extKey) {
                    $percentDone = intval($counter / count($loadedExtensions) * 100);
                    echo '
					<script type="text/javascript">
						document.getElementById("progress-bar").style.width = "' . $percentDone . '%";
						document.getElementById("transparent-bar").style.width = "' . (100 - $percentDone) . '%";
						document.getElementById("progress-message").firstChild.data="' . sprintf($GLOBALS['LANG']->getLL('translation_checking_extension'), $extKey) . '";
					</script>
					';
                    flush();
                    $translationStatusArr = $this->terConnection->fetchTranslationStatus($extKey, $mirrorURL);
                    echo '<tr class="bgColor4"><td>' . $extKey . '</td>';
                    foreach ($selectedLanguages as $lang) {
                        // remote unknown -> no l10n available
                        if (!isset($translationStatusArr[$lang])) {
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_no_translation') . '">' . $GLOBALS['LANG']->getLL('translation_n_a') . '</td>';
                            continue;
                        }
                        // determine local md5 from zip
                        if (is_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip')) {
                            $localmd5 = md5_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip');
                        } else {
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_not_installed') . '" style="background-color:#ff0">' . $GLOBALS['LANG']->getLL('translation_status_unknown') . '</td>';
                            continue;
                        }
                        // local!=remote -> needs update
                        if ($localmd5 != $translationStatusArr[$lang]['md5']) {
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_needs_update') . '" style="background-color:#ff0">' . $GLOBALS['LANG']->getLL('translation_status_update') . '</td>';
                            continue;
                        }
                        echo '<td title="' . $GLOBALS['LANG']->getLL('translation_is_ok') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_ok') . '</td>';
                    }
                    echo '</tr>';
                    $counter++;
                }
                echo '</table>
					<script type="text/javascript">
						document.getElementById("progress-message").firstChild.data="' . $GLOBALS['LANG']->getLL('translation_check_done') . '";
					</script>
				';
                echo $contentParts[1] . $this->doc->endPage();
                exit;
            } elseif (t3lib_div::_GET('l10n') == 'update') {
                $loadedExtensions = array_keys($TYPO3_LOADED_EXT);
                $loadedExtensions = array_diff($loadedExtensions, array('_CACHEFILE'));
                // Override content output - we now do that ourselves:
                $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
                // Setting up the buttons and markers for docheader
                $content = $this->doc->startPage('Extension Manager');
                $content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
                $contentParts = explode('###CONTENT###', $content);
                echo $contentParts[0] . $this->content;
                $this->doPrintContent = FALSE;
                flush();
                echo '
				<br />
				<br />
				<p id="progress-message">
					' . $GLOBALS['LANG']->getLL('translation_update_status') . '
				</p>
				<br />
				<div style="width:100%; height:20px; border: 1px solid black;">
					<div id="progress-bar" style="float: left; width: 0%; height: 20px; background-color:green;">&nbsp;</div>
					<div id="transparent-bar" style="float: left; width: 100%; height: 20px; background-color:' . $this->doc->bgColor2 . ';">&nbsp;</div>
				</div>
				<br />
				<br /><p>' . $GLOBALS['LANG']->getLL('translation_table_update') . '<br />
				<em>' . $GLOBALS['LANG']->getLL('translation_full_check_update') . '</em></p><br />
				<table border="0" cellpadding="2" cellspacing="2">
					<tr class="t3-row-header"><td>' . $GLOBALS['LANG']->getLL('translation_extension_key') . '</td>
				';
                foreach ($selectedLanguages as $lang) {
                    echo '<td>' . $LANG->getLL('lang_' . $lang, 1) . '</td>';
                }
                echo '</tr>';
                $counter = 1;
                foreach ($loadedExtensions as $extKey) {
                    $percentDone = intval($counter / count($loadedExtensions) * 100);
                    echo '
					<script type="text/javascript">
						document.getElementById("progress-bar").style.width = "' . $percentDone . '%";
						document.getElementById("transparent-bar").style.width = "' . (100 - $percentDone) . '%";
						document.getElementById("progress-message").firstChild.data="' . sprintf($GLOBALS['LANG']->getLL('translation_updating_extension'), $extKey) . '";
					</script>
					';
                    flush();
                    $translationStatusArr = $this->terConnection->fetchTranslationStatus($extKey, $mirrorURL);
                    echo '<tr class="bgColor4"><td>' . $extKey . '</td>';
                    if (is_array($translationStatusArr)) {
                        foreach ($selectedLanguages as $lang) {
                            // remote unknown -> no l10n available
                            if (!isset($translationStatusArr[$lang])) {
                                echo '<td title="' . $GLOBALS['LANG']->getLL('translation_no_translation') . '">' . $GLOBALS['LANG']->getLL('translation_n_a') . '</td>';
                                continue;
                            }
                            // determine local md5 from zip
                            if (is_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip')) {
                                $localmd5 = md5_file(PATH_site . 'typo3temp/' . $extKey . '-l10n-' . $lang . '.zip');
                            } else {
                                $localmd5 = 'zzz';
                            }
                            // local!=remote or not installed -> needs update
                            if ($localmd5 != $translationStatusArr[$lang]['md5']) {
                                $ret = $this->updateTranslation($extKey, $lang, $mirrorURL);
                                if ($ret === true) {
                                    echo '<td title="' . $GLOBALS['LANG']->getLL('translation_has_been_updated') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_update') . '</td>';
                                } else {
                                    echo '<td title="' . htmlspecialchars($ret) . '" style="background-color:#cb3352">' . $GLOBALS['LANG']->getLL('translation_status_error') . '</td>';
                                }
                                continue;
                            }
                            echo '<td title="' . $GLOBALS['LANG']->getLL('translation_is_ok') . '" style="background-color:#69a550">' . $GLOBALS['LANG']->getLL('translation_status_ok') . '</td>';
                        }
                    } else {
                        echo '<td colspan="' . count($selectedLanguages) . '" title="' . $GLOBALS['LANG']->getLL('translation_problems') . '">' . $GLOBALS['LANG']->getLL('translation_status_could_not_fetch') . '</td>';
                    }
                    echo '</tr>';
                    $counter++;
                }
                echo '</table>
					<script type="text/javascript">
						document.getElementById("progress-message").firstChild.data="' . $GLOBALS['LANG']->getLL('translation_update_done') . '";
					</script>
				';
                // Fix permissions on unzipped language xml files in the entire l10n folder and all subfolders
                t3lib_div::fixPermissions(PATH_typo3conf . 'l10n', TRUE);
                echo $contentParts[1] . $this->doc->endPage();
                exit;
            }
            $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
        }
    }
コード例 #6
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'];
                $arrayBrowser->varName = '$TYPO3_CONF_VARS';
                break;
            case 1:
                foreach ($GLOBALS['TCA'] as $table => $config) {
                    t3lib_div::loadTCA($table);
                }
                $theVar = $GLOBALS['TCA'];
                $arrayBrowser->varName = '$TCA';
                break;
            case 2:
                $theVar = $GLOBALS['TCA_DESCR'];
                $arrayBrowser->varName = '$TCA_DESCR';
                break;
            case 3:
                $theVar = $GLOBALS['TYPO3_LOADED_EXT'];
                $arrayBrowser->varName = '$TYPO3_LOADED_EXT';
                break;
            case 4:
                $theVar = $GLOBALS['T3_SERVICES'];
                $arrayBrowser->varName = '$T3_SERVICES';
                break;
            case 5:
                $theVar = $GLOBALS['TBE_MODULES'];
                $arrayBrowser->varName = '$TBE_MODULES';
                break;
            case 6:
                $theVar = $GLOBALS['TBE_MODULES_EXT'];
                $arrayBrowser->varName = '$TBE_MODULES_EXT';
                break;
            case 7:
                $theVar = $GLOBALS['TBE_STYLES'];
                $arrayBrowser->varName = '$TBE_STYLES';
                break;
            case 8:
                $theVar = $GLOBALS['BE_USER']->uc;
                $arrayBrowser->varName = '$BE_USER->uc';
                break;
            case 9:
                $theVar = $GLOBALS['TYPO3_USER_SETTINGS'];
                $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->startPage('Configuration');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }