public function pastePage(DataContainer $dc, $row, $table, $cr, $clipboardData = false) { if ($row['type'] == 'avisota') { $disablePA = false; // Disable all buttons if there is a circular reference if ($clipboardData !== false && ($clipboardData['mode'] == 'cut' && ($cr == 1 || $clipboardData['id'] == $row['id']) || $clipboardData['mode'] == 'cutAll' && ($cr == 1 || in_array($row['id'], $clipboardData['id'])))) { $disablePA = true; } // Check permissions if the user is not an administrator if (!$this->User->isAdmin) { $page = \Database::getInstance()->prepare("SELECT * FROM " . $table . " WHERE id=?")->limit(1)->execute($row['pid']); // Disable "paste after" button if there is no permission 2 for the parent page if (!$disablePA && $page->numRows) { if (!$this->User->isAllowed(2, $page->row())) { $disablePA = true; } } // Disable "paste after" button if the parent page is a root page and the user is not an administrator if (!$disablePA && ($row['pid'] < 1 || in_array($row['id'], $dc->rootIds))) { $disablePA = true; } } // Return the buttons $imagePasteAfter = $this->generateImage('pasteafter.gif', sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id']), 'class="blink"'); if ($row['id'] > 0) { return $disablePA ? $this->generateImage('pasteafter_.gif', '', 'class="blink"') . ' ' : '<a href="' . $this->addToUrl('act=' . $clipboardData['mode'] . '&mode=1&pid=' . $row['id'] . (!is_array($clipboardData['id']) ? '&id=' . $clipboardData['id'] : '')) . '" title="' . specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])) . '" onclick="Backend.getScrollOffset();">' . $imagePasteAfter . '</a> ' . $this->generateImage('pasteinto_.gif', '', 'class="blink"'); } return ''; } return parent::pastePage($dc, $row, $table, $cr, $clipboardData); }