00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00109 class t3lib_pageSelect {
00110 var $urltypes = Array('','http:
00111 var $where_hid_del = ' AND pages.deleted=0';
00112 var $where_groupAccess = '';
00113 var $sys_language_uid = 0;
00114
00115
00116 var $versioningPreview = FALSE;
00117 var $versioningWorkspaceId = 0;
00118 var $workspaceCache = array();
00119
00120
00121
00122 var $error_getRootLine = '';
00123 var $error_getRootLine_failPid = 0;
00124
00125
00134 function init($show_hidden) {
00135 $this->where_groupAccess = '';
00136 $this->where_hid_del = ' AND pages.deleted=0 ';
00137 if (!$show_hidden) {
00138 $this->where_hid_del.= 'AND pages.hidden=0 ';
00139 }
00140 $this->where_hid_del.= 'AND (pages.starttime<='.$GLOBALS['SIM_EXEC_TIME'].') AND (pages.endtime=0 OR pages.endtime>'.$GLOBALS['SIM_EXEC_TIME'].') ';
00141
00142
00143 if (!$this->versioningPreview) {
00144 $this->where_hid_del.= ' AND NOT(pages.t3ver_state=1)';
00145 } else {
00146
00147 $this->versioningPreview_where_hid_del = $this->where_hid_del;
00148 $this->where_hid_del = ' AND pages.deleted=0 ';
00149 }
00150 }
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00184 function getPage($uid, $disableGroupAccessCheck=FALSE) {
00185 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid='.intval($uid).$this->where_hid_del.($disableGroupAccessCheck ? '' : $this->where_groupAccess));
00186 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00187 $this->versionOL('pages',$row);
00188 if (is_array($row)) return $this->getPageOverlay($row);
00189 }
00190 return Array();
00191 }
00192
00200 function getPage_noCheck($uid) {
00201 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'uid='.intval($uid).$this->deleteClause('pages'));
00202 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00203 $this->versionOL('pages',$row);
00204 if (is_array($row)) return $this->getPageOverlay($row);
00205 }
00206 return Array();
00207 }
00208
00216 function getFirstWebPage($uid) {
00217 $output = '';
00218 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'pid='.intval($uid).$this->where_hid_del.$this->where_groupAccess, '', 'sorting', '1');
00219 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00220 $this->versionOL('pages',$row);
00221 if (is_array($row)) $output = $this->getPageOverlay($row);
00222 }
00223 $GLOBALS['TYPO3_DB']->sql_free_result($res);
00224 return $output;
00225 }
00226
00234 function getPageIdFromAlias($alias) {
00235 $alias = strtolower($alias);
00236 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'alias='.$GLOBALS['TYPO3_DB']->fullQuoteStr($alias, 'pages').' AND pid>=0 AND pages.deleted=0');
00237 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00238 return $row['uid'];
00239 }
00240 return 0;
00241 }
00242
00250 function getPageOverlay($pageInput,$lUid=-1) {
00251
00252
00253 if ($lUid<0) $lUid = $this->sys_language_uid;
00254 $row = NULL;
00255
00256
00257 if ($lUid) {
00258 $fieldArr = explode(',', $GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields']);
00259 if (is_array($pageInput)) {
00260 $page_id = $pageInput['uid'];
00261 $fieldArr = array_intersect($fieldArr,array_keys($pageInput));
00262 } else {
00263 $page_id = $pageInput;
00264 }
00265
00266 if (count($fieldArr)) {
00267
00268
00269
00270
00271
00272
00273
00274 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00275 implode(',',$fieldArr),
00276 'pages_language_overlay',
00277 'pid='.intval($page_id).'
00278 AND sys_language_uid='.intval($lUid).
00279 $this->enableFields('pages_language_overlay'),
00280 '',
00281 '',
00282 '1'
00283 );
00284 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00285 $this->versionOL('pages_language_overlay',$row);
00286
00287 if (is_array($row)) {
00288 $row['_PAGES_OVERLAY'] = TRUE;
00289
00290
00291 unset($row['uid']);
00292 unset($row['pid']);
00293 }
00294 }
00295 }
00296
00297
00298 if (is_array($pageInput)) {
00299 return is_array($row) ? array_merge($pageInput,$row) : $pageInput;
00300 } else {
00301 return is_array($row) ? $row : array();
00302 }
00303 }
00304
00314 function getRecordOverlay($table,$row,$sys_language_content,$OLmode='') {
00315 global $TCA;
00316
00317 if ($row['uid']>0 && $row['pid']>0) {
00318 if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
00319 if (!$TCA[$table]['ctrl']['transOrigPointerTable']) {
00320
00321
00322 if ($sys_language_content>0) {
00323
00324
00325 if ($row[$TCA[$table]['ctrl']['languageField']]<=0) {
00326
00327
00328 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00329 '*',
00330 $table,
00331 'pid='.intval($row['pid']).
00332 ' AND '.$TCA[$table]['ctrl']['languageField'].'='.intval($sys_language_content).
00333 ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
00334 $this->enableFields($table),
00335 '',
00336 '',
00337 '1'
00338 );
00339 $olrow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00340 $this->versionOL($table,$olrow);
00341 #debug($row);
00342 #debug($olrow);
00343
00344 if (is_array($olrow)) {
00345 foreach($row as $fN => $fV) {
00346 if ($fN!='uid' && $fN!='pid' && isset($olrow[$fN])) {
00347
00348 if ($GLOBALS['TSFE']->TCAcachedExtras[$table]['l10n_mode'][$fN]!='exclude'
00349 && ($GLOBALS['TSFE']->TCAcachedExtras[$table]['l10n_mode'][$fN]!='mergeIfNotBlank' || strcmp(trim($olrow[$fN]),''))) {
00350 $row[$fN] = $olrow[$fN];
00351 }
00352 } elseif ($fN=='uid') {
00353 $row['_LOCALIZED_UID'] = $olrow['uid'];
00354 }
00355 }
00356 } elseif ($OLmode==='hideNonTranslated' && $row[$TCA[$table]['ctrl']['languageField']]==0) {
00357 unset($row);
00358 }
00359
00360
00361 } elseif ($sys_language_content!=$row[$TCA[$table]['ctrl']['languageField']]) {
00362 unset($row);
00363 }
00364 } else {
00365
00366 if ($row[$TCA[$table]['ctrl']['languageField']]>0) {
00367 unset($row);
00368 }
00369 }
00370 }
00371 }
00372 }
00373
00374 return $row;
00375 }
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00413 function getMenu($uid,$fields='*',$sortField='sorting',$addWhere='',$checkShortcuts=1) {
00414
00415 $output = Array();
00416 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, 'pages', 'pid='.intval($uid).$this->where_hid_del.$this->where_groupAccess.' '.$addWhere, '', $sortField);
00417 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00418 $this->versionOL('pages',$row);
00419
00420 if (is_array($row)) {
00421
00422 $origUid = $row['uid'];
00423 $mount_info = $this->getMountPointInfo($origUid, $row);
00424 if (is_array($mount_info) && $mount_info['overlay']) {
00425 $mp_row = $this->getPage($mount_info['mount_pid']);
00426 if (count($mp_row)) {
00427 $row = $mp_row;
00428 $row['_MP_PARAM'] = $mount_info['MPvar'];
00429 } else unset($row);
00430 }
00431
00432
00433 if ($row['doktype'] == 4 && ($row['shortcut'] || $row['shortcut_mode']) && $checkShortcuts) {
00434 if ($row['shortcut_mode'] == 0) {
00435 $searchField = 'uid';
00436 $searchUid = intval($row['shortcut']);
00437 } else {
00438 $searchField = 'pid';
00439
00440 $searchUid = intval($row['shortcut'])?intval($row['shortcut']):$row['uid'];
00441 }
00442 $res2 = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', $searchField.'='.$searchUid.$this->where_hid_del.$this->where_groupAccess.' '.$addWhere, '', $sortField);
00443 if (!$GLOBALS['TYPO3_DB']->sql_num_rows($res2)) {
00444 unset($row);
00445 }
00446 $GLOBALS['TYPO3_DB']->sql_free_result($res2);
00447 } elseif ($row['doktype'] == 4 && $checkShortcuts) {
00448
00449 unset($row);
00450 }
00451
00452
00453 if (is_array($row)) {
00454 $output[$origUid] = $this->getPageOverlay($row);
00455 }
00456 }
00457 }
00458 return $output;
00459 }
00460
00471 function getDomainStartPage($domain, $path='',$request_uri='') {
00472 $domain = explode(':',$domain);
00473 $domain = strtolower(ereg_replace('\.$','',$domain[0]));
00474
00475 $path = trim(ereg_replace('\/[^\/]*$','',$path));
00476
00477 $domain.= $path;
00478 $domain = ereg_replace('\
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00762 function checkRecord($table,$uid,$checkPage=0) {
00763 global $TCA;
00764 $uid = intval($uid);
00765 if (is_array($TCA[$table])) {
00766 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'uid='.intval($uid).$this->enableFields($table));
00767 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00768 $this->versionOL($table,$row);
00769 $GLOBALS['TYPO3_DB']->sql_free_result($res);
00770
00771 if (is_array($row)) {
00772 if ($checkPage) {
00773 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid='.intval($row['pid']).$this->enableFields('pages'));
00774 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
00775 return $row;
00776 } else {
00777 return 0;
00778 }
00779 } else {
00780 return $row;
00781 }
00782 }
00783 }
00784 }
00785 }
00786
00797 function getRawRecord($table,$uid,$fields='*',$noWSOL=FALSE) {
00798 global $TCA;
00799 $uid = intval($uid);
00800 if (is_array($TCA[$table]) || $table=='pages') {
00801 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fields, $table, 'uid='.intval($uid).$this->deleteClause($table));
00802 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
00803 $GLOBALS['TYPO3_DB']->sql_free_result($res);
00804 if ($row) {
00805 if (!$noWSOL) {
00806 $this->versionOL($table,$row);
00807 }
00808 if (is_array($row)) return $row;
00809 }
00810 }
00811 }
00812
00825 function getRecordsByField($theTable,$theField,$theValue,$whereClause='',$groupBy='',$orderBy='',$limit='') {
00826 global $TCA;
00827 if (is_array($TCA[$theTable])) {
00828 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
00829 '*',
00830 $theTable,
00831 $theField.'='.$GLOBALS['TYPO3_DB']->fullQuoteStr($theValue, $theTable).
00832 $this->deleteClause($theTable).' '.
00833 $whereClause,
00834 $groupBy,
00835 $orderBy,
00836 $limit
00837 );
00838 $rows = array();
00839 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00840 #$this->versionOL($theTable,$row); // not used since records here are fetched based on other fields than uid!
00841 if (is_array($row)) $rows[] = $row;
00842 }
00843 $GLOBALS['TYPO3_DB']->sql_free_result($res);
00844 if (count($rows)) return $rows;
00845 }
00846 }
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00877 function getHash($hash,$expTime=0) {
00878
00879 $expTime = intval($expTime);
00880 if ($expTime) {
00881 $whereAdd = ' AND tstamp > '.(time()-$expTime);
00882 }
00883 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash').$whereAdd);
00884 if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
00885 $GLOBALS['TYPO3_DB']->sql_free_result($res);
00886 return $row['content'];
00887 }
00888 }
00889
00900 function storeHash($hash,$data,$ident) {
00901 $insertFields = array(
00902 'hash' => $hash,
00903 'content' => $data,
00904 'ident' => $ident,
00905 'tstamp' => time()
00906 );
00907 $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
00908 $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
00909 }
00910
00918 function deleteClause($table) {
00919 global $TCA;
00920 if (!strcmp($table,'pages')) {
00921 return ' AND pages.deleted=0';
00922 } else {
00923 return $TCA[$table]['ctrl']['delete'] ? ' AND '.$table.'.'.$TCA[$table]['ctrl']['delete'].'=0' : '';
00924 }
00925 }
00926
00938 function enableFields($table,$show_hidden=-1,$ignore_array=array(),$noVersionPreview=FALSE) {
00939 global $TYPO3_CONF_VARS;
00940
00941 if ($show_hidden==-1 && is_object($GLOBALS['TSFE'])) {
00942 $show_hidden = $table=='pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords;
00943 }
00944 if ($show_hidden==-1) $show_hidden=0;
00945
00946 $ctrl = $GLOBALS['TCA'][$table]['ctrl'];
00947 $query='';
00948 if (is_array($ctrl)) {
00949
00950
00951 if ($ctrl['delete']) {
00952 $query.=' AND '.$table.'.'.$ctrl['delete'].'=0';
00953 }
00954
00955
00956 if ($ctrl['versioningWS'] && !$this->versioningPreview) {
00957 $query.=' AND '.$table.'.t3ver_state!=1';
00958 }
00959
00960
00961 if (is_array($ctrl['enablecolumns'])) {
00962 if (!$this->versioningPreview || !$ctrl['versioningWS'] || $noVersionPreview) {
00963 if ($ctrl['enablecolumns']['disabled'] && !$show_hidden && !$ignore_array['disabled']) {
00964 $field = $table.'.'.$ctrl['enablecolumns']['disabled'];
00965 $query.=' AND '.$field.'=0';
00966 }
00967 if ($ctrl['enablecolumns']['starttime'] && !$ignore_array['starttime']) {
00968 $field = $table.'.'.$ctrl['enablecolumns']['starttime'];
00969 $query.=' AND ('.$field.'<='.$GLOBALS['SIM_EXEC_TIME'].')';
00970 }
00971 if ($ctrl['enablecolumns']['endtime'] && !$ignore_array['endtime']) {
00972 $field = $table.'.'.$ctrl['enablecolumns']['endtime'];
00973 $query.=' AND ('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_EXEC_TIME'].')';
00974 }
00975 if ($ctrl['enablecolumns']['fe_group'] && !$ignore_array['fe_group']) {
00976 $field = $table.'.'.$ctrl['enablecolumns']['fe_group'];
00977 $query.= $this->getMultipleGroupsWhereClause($field, $table);
00978 }
00979
00980
00981
00982 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'])) {
00983 $_params = array(
00984 'table' => $table,
00985 'show_hidden' => $show_hidden,
00986 'ignore_array' => $ignore_array,
00987 'ctrl' => $ctrl
00988 );
00989 foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'] as $_funcRef) {
00990 $query .= t3lib_div::callUserFunction($_funcRef,$_params,$this);
00991 }
00992 }
00993 }
00994 }
00995 } else {
00996 die ('NO entry in the $TCA-array for the table "'.$table.'". This means that the function enableFields() is called with an invalid table name as argument.');
00997 }
00998
00999 return $query;
01000 }
01001
01010 function getMultipleGroupsWhereClause($field, $table) {
01011 $memberGroups = t3lib_div::intExplode(',',$GLOBALS['TSFE']->gr_list);
01012 $orChecks=array();
01013 $orChecks[]=$field.'=\'\'';
01014 $orChecks[]=$field.' IS NULL';
01015 $orChecks[]=$field.'=\'0\'';
01016
01017 foreach($memberGroups as $value) {
01018 $orChecks[] = $GLOBALS['TYPO3_DB']->listQuery($field, $value, $table);
01019 }
01020
01021 return ' AND ('.implode(' OR ',$orChecks).')';
01022 }
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01056 function fixVersioningPid($table,&$rr) {
01057 global $TCA;
01058
01059 if ($this->versioningPreview && is_array($rr) && $rr['pid']==-1 && ($table=='pages' || $TCA[$table]['ctrl']['versioningWS'])) {
01060
01061
01062 if (isset($rr['t3ver_oid']) && isset($rr['t3ver_wsid'])) {
01063 $oid = $rr['t3ver_oid'];
01064 $wsid = $rr['t3ver_wsid'];
01065 } else {
01066 $newPidRec = $this->getRawRecord($table,$rr['uid'],'t3ver_oid,t3ver_wsid',TRUE);
01067 if (is_array($newPidRec)) {
01068 $oid = $newPidRec['t3ver_oid'];
01069 $wsid = $newPidRec['t3ver_wsid'];
01070 }
01071 }
01072
01073
01074 if ($oid && (($this->versioningWorkspaceId == 0 && $this->checkWorkspaceAccess($wsid)) || !strcmp((int)$wsid,$this->versioningWorkspaceId))) {
01075 $oidRec = $this->getRawRecord($table,$oid,'pid',TRUE);
01076
01077 if (is_array($oidRec)) {
01078 # SWAP uid as well? Well no, because when fixing a versioning PID happens it is assumed that this is a "branch" type page and therefore the uid should be kept (like in versionOL()). However if the page is NOT a branch version it should not happen - but then again, direct access to that uid should not happen!
01079 $rr['_ORIG_pid'] = $rr['pid'];
01080 $rr['pid'] = $oidRec['pid'];
01081 }
01082 }
01083 }
01084 }
01085
01097 function versionOL($table,&$row) {
01098 global $TCA;
01099
01100 if ($this->versioningPreview && is_array($row)) {
01101 if ($wsAlt = $this->getWorkspaceVersionOfRecord($this->versioningWorkspaceId, $table, $row['uid'], implode(',',array_keys($row)))) {
01102 if (is_array($wsAlt)) {
01103
01104
01105 $wsAlt['_ORIG_pid'] = $wsAlt['pid'];
01106 $wsAlt['pid'] = $row['pid'];
01107
01108
01109
01110
01111 if ($table!=='pages' || $wsAlt['t3ver_swapmode']<=0) {
01112 $wsAlt['_ORIG_uid'] = $wsAlt['uid'];
01113 $wsAlt['uid'] = $row['uid'];
01114
01115
01116 if ($table==='pages') {
01117 $wsAlt['alias'] = $row['alias'];
01118 }
01119 } else {
01120
01121
01122 $wsAlt['_ONLINE_uid'] = $row['uid'];
01123 }
01124
01125
01126 $row = $wsAlt;
01127
01128
01129 if ((int)$row['t3ver_state']===2) {
01130 $row = FALSE;
01131 }
01132 } else {
01133
01134 if ($wsAlt==-1 || (int)$row['t3ver_state']===1) {
01135 $row = FALSE;
01136 }
01137 }
01138 }
01139 }
01140 }
01141
01152 function getWorkspaceVersionOfRecord($workspace, $table, $uid, $fields='*') {
01153 global $TCA;
01154
01155 if ($workspace!==0 && ($table=='pages' || $TCA[$table]['ctrl']['versioningWS'])) {
01156
01157
01158 if ($table=='pages') {
01159 $enFields = $this->versioningPreview_where_hid_del;
01160 } else {
01161 $enFields = $this->enableFields($table,-1,array(),TRUE);
01162 }
01163
01164
01165 list($newrow) = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01166 $fields,
01167 $table,
01168 'pid=-1 AND
01169 t3ver_oid='.intval($uid).' AND
01170 t3ver_wsid='.intval($workspace).
01171 $this->deleteClause($table)
01172 );
01173
01174
01175 if (is_array($newrow)) {
01176 if ($GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01177 'uid',
01178 $table,
01179 'pid=-1 AND
01180 t3ver_oid='.intval($uid).' AND
01181 t3ver_wsid='.intval($workspace).
01182 $enFields
01183 )) {
01184 return $newrow;
01185 } else {
01186 return -1;
01187 }
01188 } else {
01189
01190 if ($GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
01191 'uid',
01192 $table,
01193 'uid='.intval($uid).$enFields
01194 )) {
01195 return 1;
01196 } else {
01197 return -1;
01198 }
01199 }
01200 }
01201
01202 return FALSE;
01203 }
01204
01211 function checkWorkspaceAccess($wsid) {
01212 if (!$GLOBALS['BE_USER']) {
01213 return false;
01214 }
01215 if (isset($this->workspaceCache[$wsid])) {
01216 $ws = $this->workspaceCache[$wsid];
01217 }
01218 else {
01219 if ($wsid > 0) {
01220 $ws = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_workspace', 'uid='.intval($wsid).' AND deleted=0');
01221 if (count($ws)) {
01222 $ws = $ws[0];
01223 }
01224 else {
01225 return false;
01226 }
01227 }
01228 else {
01229 $ws = $wsid;
01230 }
01231 $ws = $GLOBALS['BE_USER']->checkWorkspace($ws);
01232 $this->workspaceCache[$wsid] = $ws;
01233 }
01234 return ($ws['_ACCESS'] != '');
01235 }
01236 }
01237
01238
01239
01240 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_page.php']) {
01241 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_page.php']);
01242 }
01243 ?>