Public Member Functions | |
| init () | |
| Initialization of the class Will determine if table/uid GET vars are database record or a file and if the user has access to view information about the item. | |
| main () | |
| Main function. | |
| renderDBInfo () | |
| Main function. | |
| renderFileInfo ($returnLinkTag) | |
| Main function. | |
| printContent () | |
| End page and print content. | |
Public Attributes | |
| $table | |
| $uid | |
| $perms_clause | |
| $access | |
| $type | |
| $doc | |
| $content | |
| $file | |
| $pageinfo | |
| $row | |
|
|
Initialization of the class Will determine if table/uid GET vars are database record or a file and if the user has access to view information about the item.
Definition at line 158 of file show_item.php. References t3lib_BEfunc::getRecord(), PATH_site, PATH_t3lib, t3lib_BEfunc::readPageAccess(), and table(). 00158 {
00159 global $BE_USER,$LANG,$BACK_PATH,$TCA;
00160
00161 // Setting input variables.
00162 $this->table = t3lib_div::_GET('table');
00163 $this->uid = t3lib_div::_GET('uid');
00164
00165 // Initialize:
00166 $this->perms_clause = $BE_USER->getPagePermsClause(1);
00167 $this->access = 0; // Set to true if there is access to the record / file.
00168 $this->type = ''; // Sets the type, "db" or "file". If blank, nothing can be shown.
00169
00170 // Checking if the $table value is really a table and if the user has access to it.
00171 if (isset($TCA[$this->table])) {
00172 t3lib_div::loadTCA($this->table);
00173 $this->type = 'db';
00174 $this->uid = intval($this->uid);
00175
00176 // Check permissions and uid value:
00177 if ($this->uid && $BE_USER->check('tables_select',$this->table)) {
00178 if ((string)$this->table=='pages') {
00179 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->uid,$this->perms_clause);
00180 $this->access = is_array($this->pageinfo) ? 1 : 0;
00181 $this->row = $this->pageinfo;
00182 } else {
00183 $this->row = t3lib_BEfunc::getRecord($this->table,$this->uid);
00184 if ($this->row) {
00185 $this->pageinfo = t3lib_BEfunc::readPageAccess($this->row['pid'],$this->perms_clause);
00186 $this->access = is_array($this->pageinfo) ? 1 : 0;
00187 }
00188 }
00189
00190 $treatData = t3lib_div::makeInstance('t3lib_transferData');
00191 $treatData->renderRecord($this->table, $this->uid, 0, $this->row);
00192 $cRow = $treatData->theRecord;
00193 }
00194 } else {
00195 // if the filereference $this->file is relative, we correct the path
00196 if (substr($this->table,0,3)=='../') {
00197 $this->file = PATH_site.ereg_replace('^\.\./','',$this->table);
00198 } else {
00199 $this->file = $this->table;
00200 }
00201 if (@is_file($this->file) && t3lib_div::isAllowedAbsPath($this->file)) {
00202 $this->type = 'file';
00203 $this->access = 1;
00204
00205 require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
00206 }
00207 }
00208
00209 // Initialize document template object:
00210 $this->doc = t3lib_div::makeInstance('smallDoc');
00211 $this->doc->backPath = $BACK_PATH;
00212 $this->doc->docType = 'xhtml_trans';
00213
00214 // Starting the page by creating page header stuff:
00215 $this->content.=$this->doc->startPage($LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.viewItem'));
00216 $this->content.=$this->doc->header($LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.viewItem'));
00217 $this->content.=$this->doc->spacer(5);
00218 }
|
|
|
Main function. Will generate the information to display for the item set internally.
Definition at line 225 of file show_item.php. References renderDBInfo(), and renderFileInfo(). 00225 {
00226 global $LANG;
00227
00228 if ($this->access) {
00229 $returnLinkTag = t3lib_div::_GP('returnUrl') ? '<a href="'.t3lib_div::_GP('returnUrl').'" class="typo3-goBack">' : '<a href="#" onclick="window.close();">';
00230
00231 // Branch out based on type:
00232 switch($this->type) {
00233 case 'db':
00234 $this->renderDBInfo();
00235 break;
00236 case 'file':
00237 $this->renderFileInfo($returnLinkTag);
00238 break;
00239 }
00240
00241 // If return Url is set, output link to go back:
00242 if (t3lib_div::_GP('returnUrl')) {
00243 $this->content.= $this->doc->section('','<br />'.$returnLinkTag.'<strong>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.goBack',1).'</strong></a>');
00244 }
00245 }
00246 }
|
|
|
End page and print content.
Definition at line 416 of file show_item.php. 00416 {
00417 $this->content.= $this->doc->endPage();
00418 echo $this->content;
00419 }
|
|
|
Main function. Will generate the information to display for the item set internally.
Definition at line 253 of file show_item.php. References $LANG, $TCA, and table(). Referenced by main(). 00253 {
00254 global $LANG,$TCA;
00255
00256 // Print header, path etc:
00257 $code = $this->doc->getHeader($this->table,$this->row,$this->pageinfo['_thePath'],1).'<br />';
00258 $this->content.= $this->doc->section('',$code);
00259
00260 // Initialize variables:
00261 $tableRows = Array();
00262 $i = 0;
00263
00264 // Traverse the list of fields to display for the record:
00265 $fieldList = t3lib_div::trimExplode(',',$TCA[$this->table]['interface']['showRecordFieldList'],1);
00266 foreach($fieldList as $name) {
00267 $name = trim($name);
00268 if ($TCA[$this->table]['columns'][$name]) {
00269 if (!$TCA[$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields',$this->table.':'.$name)) {
00270 $i++;
00271 $tableRows[] = '
00272 <tr>
00273 <td class="bgColor5">'.$LANG->sL(t3lib_BEfunc::getItemLabel($this->table,$name),1).'</td>
00274 <td class="bgColor4">'.htmlspecialchars(t3lib_BEfunc::getProcessedValue($this->table,$name,$this->row[$name])).'</td>
00275 </tr>';
00276 }
00277 }
00278 }
00279
00280 // Create table from the information:
00281 $tableCode = '
00282 <table border="0" cellpadding="1" cellspacing="1" id="typo3-showitem">
00283 '.implode('',$tableRows).'
00284 </table>';
00285 $this->content.=$this->doc->section('',$tableCode);
00286 $this->content.=$this->doc->divider(2);
00287
00288 // Add path and table information in the bottom:
00289 $code = '';
00290 $code.= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.path').': '.t3lib_div::fixed_lgd_cs($this->pageinfo['_thePath'],-48).'<br />';
00291 $code.= $LANG->sL('LLL:EXT:lang/locallang_core.php:labels.table').': '.$LANG->sL($TCA[$this->table]['ctrl']['title']).' ('.$this->table.') - UID: '.$this->uid.'<br />';
00292 $this->content.= $this->doc->section('', $code);
00293 }
|
|
|
Main function. Will generate the information to display for the item set internally.
Definition at line 301 of file show_item.php. References t3lib_BEfunc::getFileIcon(), PATH_site, and TYPO3_OS. Referenced by main(). 00301 {
00302 global $LANG;
00303
00304 // Initialize object to work on the image:
00305 $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
00306 $imgObj->init();
00307 $imgObj->mayScaleUp = 0;
00308 $imgObj->absPrefix = PATH_site;
00309
00310 // Read Image Dimensions (returns false if file was not an image type, otherwise dimensions in an array)
00311 $imgInfo = '';
00312 $imgInfo = $imgObj->getImageDimensions($this->file);
00313
00314 // File information
00315 $fI = t3lib_div::split_fileref($this->file);
00316 $ext = $fI['fileext'];
00317
00318 $code = '';
00319
00320 // Setting header:
00321 $icon = t3lib_BEfunc::getFileIcon($ext);
00322 $url = 'gfx/fileicons/'.$icon;
00323 $fileName = '<img src="'.$url.'" width="18" height="16" align="top" alt="" /><b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.file',1).':</b> '.$fI['file'];
00324 if (t3lib_div::isFirstPartOfStr($this->file,PATH_site)) {
00325 $code.= '<a href="../'.substr($this->file,strlen(PATH_site)).'" target="_blank">'.$fileName.'</a>';
00326 } else {
00327 $code.= $fileName;
00328 }
00329 $code.=' <b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.filesize').':</b> '.t3lib_div::formatSize(@filesize($this->file)).'<br />
00330 ';
00331 if (is_array($imgInfo)) {
00332 $code.= '<b>'.$LANG->sL('LLL:EXT:lang/locallang_core.php:show_item.php.dimensions').':</b> '.$imgInfo[0].'x'.$imgInfo[1].' pixels';
00333 }
00334 $this->content.=$this->doc->section('',$code);
00335 $this->content.=$this->doc->divider(2);
00336
00337 // If the file was an image...:
00338 if (is_array($imgInfo)) {
00339
00340 $imgInfo = $imgObj->imageMagickConvert($this->file,'web','346','200m','','','',1);
00341 $imgInfo[3] = '../'.substr($imgInfo[3],strlen(PATH_site));
00342 $code = '<br />
00343 <div align="center">'.$returnLinkTag.$imgObj->imgTag($imgInfo).'</a></div>';
00344 $this->content.= $this->doc->section('', $code);
00345 } else {
00346 $this->content.= $this->doc->spacer(10);
00347 $lowerFilename = strtolower($this->file);
00348
00349 // Archive files:
00350 if (TYPO3_OS!='WIN' && !$GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']) {
00351 if ($ext=='zip') {
00352 $code = '';
00353 exec('unzip -l '.$this->file, $t);
00354 if (is_array($t)) {
00355 reset($t);
00356 next($t);
00357 next($t);
00358 next($t);
00359 while(list(,$val)=each($t)) {
00360 $parts = explode(' ',trim($val),7);
00361 $code.= '
00362 '.$parts[6].'<br />';
00363 }
00364 $code = '
00365 <span class="nobr">'.$code.'
00366 </span>
00367 <br /><br />';
00368 }
00369 $this->content.= $this->doc->section('', $code);
00370 } elseif($ext=='tar' || $ext=='tgz' || substr($lowerFilename,-6)=='tar.gz' || substr($lowerFilename,-5)=='tar.z') {
00371 $code = '';
00372 if ($ext=='tar') {
00373 $compr = '';
00374 } else {
00375 $compr = 'z';
00376 }
00377 exec('tar t'.$compr.'f '.$this->file, $t);
00378 if (is_array($t)) {
00379 foreach($t as $val) {
00380 $code.='
00381 '.$val.'<br />';
00382 }
00383
00384 $code.='
00385 -------<br/>
00386 '.count($t).' files';
00387
00388 $code = '
00389 <span class="nobr">'.$code.'
00390 </span>
00391 <br /><br />';
00392 }
00393 $this->content.= $this->doc->section('',$code);
00394 }
00395 } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']) {
00396 $this->content.= $this->doc->section('','Sorry, TYPO3_CONF_VARS[BE][disable_exec_function] was set, so cannot display content of archive file.');
00397 }
00398
00399 // Font files:
00400 if ($ext=='ttf') {
00401 $thumbScript = 'thumbs.php';
00402 $params = '&file='.rawurlencode($this->file);
00403 $url = $thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].$params;
00404 $thumb = '<br />
00405 <div align="center">'.$returnLinkTag.'<img src="'.htmlspecialchars($url).'" border="0" title="'.htmlspecialchars(trim($this->file)).'" alt="" /></a></div>';
00406 $this->content.= $this->doc->section('',$thumb);
00407 }
00408 }
00409 }
|
|
|
Definition at line 141 of file show_item.php. |
|
|
Definition at line 146 of file show_item.php. |
|
|
Definition at line 143 of file show_item.php. |
|
|
Definition at line 147 of file show_item.php. |
|
|
Definition at line 148 of file show_item.php. |
|
|
Definition at line 140 of file show_item.php. |
|
|
Definition at line 149 of file show_item.php. |
|
|
Definition at line 136 of file show_item.php. |
|
|
Definition at line 142 of file show_item.php. |
|
|
Definition at line 137 of file show_item.php. |
1.3.8-20040913