TYPO3 CMS  TYPO3_6-2
RecyclerUtility.php
Go to the documentation of this file.
1 <?php
3 
18 
25 
26  /************************************************************
27  * USER ACCESS
28  *
29  *
30  ************************************************************/
39  static public function checkAccess($table, $row) {
40  // Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
41  // First, resetting flags.
42  $hasAccess = 0;
43  $calcPRec = $row;
44  BackendUtility::fixVersioningPid($table, $calcPRec);
45  if (is_array($calcPRec)) {
46  if ($table == 'pages') {
47  // If pages:
48  $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($calcPRec);
49  $hasAccess = $CALC_PERMS & 2 ? 1 : 0;
50  } else {
51  $CALC_PERMS = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $calcPRec['pid']));
52  // Fetching pid-record first.
53  $hasAccess = $CALC_PERMS & 16 ? 1 : 0;
54  }
55  // Check internals regarding access:
56  if ($hasAccess) {
57  $hasAccess = $GLOBALS['BE_USER']->recordEditAccessInternals($table, $calcPRec);
58  }
59  }
60  if (!$GLOBALS['BE_USER']->check('tables_modify', $table)) {
61  $hasAccess = 0;
62  }
63  return $hasAccess ? TRUE : FALSE;
64  }
65 
77  static public function getRecordPath($uid, $clause = '', $titleLimit = 1000, $fullTitleLimit = 0) {
78  $loopCheck = 100;
79  $output = ($fullOutput = '/');
80  while ($uid != 0 && $loopCheck > 0) {
81  $loopCheck--;
82  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,title,deleted,t3ver_oid,t3ver_wsid', 'pages', 'uid=' . (int)$uid . (strlen(trim($clause)) ? ' AND ' . $clause : ''));
83  if (is_resource($res)) {
84  $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
85  $GLOBALS['TYPO3_DB']->sql_free_result($res);
86  BackendUtility::workspaceOL('pages', $row);
87  if (is_array($row)) {
88  BackendUtility::fixVersioningPid('pages', $row);
89  $uid = $row['pid'];
90  $output = '/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $titleLimit)) . $output;
91  if ($row['deleted']) {
92  $output = '<span class="deletedPath">' . $output . '</span>';
93  }
94  if ($fullTitleLimit) {
95  $fullOutput = '/' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($row['title'], $fullTitleLimit)) . $fullOutput;
96  }
97  } else {
98  break;
99  }
100  } else {
101  break;
102  }
103  }
104  if ($fullTitleLimit) {
105  return array($output, $fullOutput);
106  } else {
107  return $output;
108  }
109  }
110 
117  static public function getDeletedField($tableName) {
118  $TCA = self::getTableTCA($tableName);
119  if ($TCA && isset($TCA['ctrl']['delete']) && $TCA['ctrl']['delete']) {
120  return $TCA['ctrl']['delete'];
121  }
122  }
123 
130  static public function getTableTCA($tableName) {
131  $TCA = FALSE;
132  if (isset($GLOBALS['TCA'][$tableName])) {
133  $TCA = $GLOBALS['TCA'][$tableName];
134  }
135  return $TCA;
136  }
137 
143  static public function getCurrentCharset() {
144  return $GLOBALS['LANG']->csConvObj->parse_charset($GLOBALS['LANG']->charSet);
145  }
146 
152  static public function isNotUtf8Charset() {
153  return self::getCurrentCharset() !== 'utf-8';
154  }
155 
162  static public function getUtf8String($string) {
163  if (self::isNotUtf8Charset()) {
164  $string = $GLOBALS['LANG']->csConvObj->utf8_encode($string, self::getCurrentCharset());
165  }
166  return $string;
167  }
168 
169 }
static getRecordPath($uid, $clause='', $titleLimit=1000, $fullTitleLimit=0)
$TCA['tx_irretutorial_1ncsv_hotel']
static workspaceOL($table, &$row, $wsid=-99, $unsetMovePointers=FALSE)
$uid
Definition: server.php:36
static fixVersioningPid($table, &$rr, $ignoreWorkspaceMatch=FALSE)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]