15189.diff

Administrator Admin, 2010-07-21 16:07

Download (2.43 KB)

View differences:

t3lib/class.t3lib_frontendedit.php (working copy)
503 503

  
504 504
			// Unless permissions specifically allow it, editing is not allowed.
505 505
		$mayEdit = false;
506

  
507
		if ($table=='pages') {
508
				// 2 = permission to edit the page
509
			if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($dataArray, 2)) {
510
				$mayEdit = true;
506
		if ($GLOBALS['BE_USER']->recordEditAccessInternals($table, $dataArray)) {
507
			if ($table=='pages') {
508
					// 2 = permission to edit the page
509
				if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess($dataArray, 2)) {
510
					$mayEdit = true;
511
				}
512
			} else {
513
					// 16 = permission to edit content on the page
514
				if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess(t3lib_BEfunc::getRecord('pages', $dataArray['pid']), 16)) {
515
					$mayEdit = true;
516
				}
511 517
			}
512
		} else {
513
				// 16 = permission to edit content on the page
514
			if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->doesUserHaveAccess(t3lib_BEfunc::getRecord('pages', $dataArray['pid']), 16)) {
515
				$mayEdit = true;
516
			}
517
		}
518 518

  
519
		if (!$conf['onlyCurrentPid'] || ($dataArray['pid'] == $GLOBALS['TSFE']->id)) {
520
				// Permissions:
521
			$types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']),1);
522
			$allow = array_flip($types);
519
			if (!$conf['onlyCurrentPid'] || ($dataArray['pid'] == $GLOBALS['TSFE']->id)) {
520
					// Permissions:
521
				$types = t3lib_div::trimExplode(',', t3lib_div::strtolower($conf['allow']),1);
522
				$allow = array_flip($types);
523 523

  
524
			$perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
525
			if ($table == 'pages') {
526
				$allow = $this->getAllowedEditActions($table, $conf, $dataArray['pid'], $allow);
524
				$perms = $GLOBALS['BE_USER']->calcPerms($GLOBALS['TSFE']->page);
525
				if ($table == 'pages') {
526
					$allow = $this->getAllowedEditActions($table, $conf, $dataArray['pid'], $allow);
527 527

  
528
					// Can only display editbox if there are options in the menu
529
				if (count($allow)) {
530
					$mayEdit = true;
528
						// Can only display editbox if there are options in the menu
529
					if (count($allow)) {
530
						$mayEdit = true;
531
					}
532
				} else {
533
					$mayEdit = count($allow) && ($perms & 16);
531 534
				}
532
			} else {
533
				$mayEdit = count($allow) && ($perms & 16);
534 535
			}
535 536
		}
536 537