Пример #1
0
 if ($_REQUEST['add'] || $_REQUEST['_add']) {
     // the user is attempting to add a block of content of some kind
     $a = Area::get($c, $_REQUEST['arHandle']);
     if (is_object($a)) {
         $ax = $a;
         $cx = $c;
         if ($a->isGlobalArea()) {
             $cx = Stack::getByName($_REQUEST['arHandle']);
             $ax = Area::get($cx, STACKS_AREA_NAME);
         }
         $ap = new Permissions($ax);
         if ($_REQUEST['btask'] == 'alias_existing_block') {
             if (is_array($_REQUEST['pcID'])) {
                 // we're taking an existing block and aliasing it to here
                 foreach ($_REQUEST['pcID'] as $pcID) {
                     $pc = PileContent::get($pcID);
                     $p = $pc->getPile();
                     if ($p->isMyPile()) {
                         if ($_REQUEST['deletePileContents']) {
                             $pc->delete();
                         }
                     }
                     if ($pc->getItemType() == "BLOCK") {
                         $bID = $pc->getItemID();
                         $b = Block::getByID($bID);
                         $b->setBlockAreaObject($ax);
                         $bt = BlockType::getByHandle($b->getBlockTypeHandle());
                         if ($ap->canAddBlock($bt)) {
                             $btx = BlockType::getByHandle(BLOCK_HANDLE_SCRAPBOOK_PROXY);
                             $nvc = $cx->getVersionToModify();
                             if ($a->isGlobalArea()) {
Пример #2
0
use Concrete\Core\Page\Stack\Pile\Pile;
use Concrete\Core\Page\Stack\Pile\PileContent;
defined('C5_EXECUTE') or die("Access Denied.");
if (!$u->isRegistered() || !Core::make('token')->validate('tools/clipboard/from') && !Core::make('token')->validate('tools/clipboard/to')) {
    die(t("Access Denied."));
}
$p = false;
$c = Page::getByID($_REQUEST['cID']);
// add a block to a pile
$cp = new Permissions($c);
if (!$cp->canViewPage()) {
    die(t("Access Denied."));
}
if (Request::request('task', 'default') === 'delete') {
    $pileContent = PileContent::get(Request::request('pcID', 0));
    if (!$pileContent->getPile()->isMyPile()) {
        die(t("Access Denied."));
    }
    $pileContent->delete();
} else {
    $u = new User();
    $a = Area::get($c, $_REQUEST['arHandle']);
    if ($a->isGlobalArea()) {
        $ax = STACKS_AREA_NAME;
        $cx = Stack::getByName($_REQUEST['arHandle']);
    }
    $b = Block::getByID($_REQUEST['bID'], $cx, $ax);
    if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
        $bi = $b->getInstance();
        $b = Block::getByID($bi->getOriginalBlockID());
Пример #3
0
 /**
  * @param string $display
  * @return array
  */
 public function getPileContentObjects($display = 'display_order')
 {
     $pc = array();
     $db = Loader::db();
     switch ($display) {
         case 'display_order_date':
             $order = 'displayOrder asc, timestamp desc';
             break;
         case 'date_desc':
             $order = 'timestamp desc';
             break;
         default:
             $order = 'displayOrder asc';
             break;
     }
     $v = array($this->pID);
     $q = "select pcID from PileContents where pID = ? order by {$order}";
     $r = $db->query($q, $v);
     while ($row = $r->fetchRow()) {
         $pc[] = PileContent::get($row['pcID']);
     }
     return $pc;
 }
Пример #4
0
use Concrete\Core\Page\Stack\Pile\Pile;
use Concrete\Core\Page\Stack\Pile\PileContent;
defined('C5_EXECUTE') or die("Access Denied.");
if (!$u->isRegistered()) {
    die(t("Access Denied."));
}
$p = false;
$c = Page::getByID($_REQUEST['cID']);
// add a block to a pile
$cp = new Permissions($c);
if (!$cp->canViewPage()) {
    exit;
}
if (Request::request('task', 'default') === 'delete') {
    PileContent::get(Request::request('pcID', 0))->delete();
} else {
    $u = new User();
    $a = Area::get($c, $_REQUEST['arHandle']);
    if ($a->isGlobalArea()) {
        $ax = STACKS_AREA_NAME;
        $cx = Stack::getByName($_REQUEST['arHandle']);
    }
    $b = Block::getByID($_REQUEST['bID'], $cx, $ax);
    if ($b->getBlockTypeHandle() == BLOCK_HANDLE_SCRAPBOOK_PROXY) {
        $bi = $b->getInstance();
        $b = Block::getByID($bi->getOriginalBlockID());
    }
    $ap = new Permissions($a);
    if (!$ap->canViewArea()) {
        exit;