Ejemplo n.º 1
0
	public function on_start() {
		$c = Page::getByPath('/dashboard/blocks/stacks');
		$cp = new Permissions($c);
		if ($cp->canRead()) {
			$c = Page::getCurrentPage();
			$pcp = new Permissions($c);
			if ((!$pcp->canReadVersions()) || ($_GET['vtask'] != 'view_versions' && $_GET['vtask'] != 'compare')) {
				$cID = $c->getCollectionID();
				$this->redirect('/dashboard/blocks/stacks','view_details', $cID);		
			} else {
				$this->theme = 'dashboard';
			}
		} else {
			global $c; // ugh
			$v = View::getInstance();
			$c = new Page();
			$c->loadError(COLLECTION_NOT_FOUND);
			$v->setCollectionObject($c);
			$this->c = $c;
			$cont = Loader::controller("/page_not_found");
			$v->setController($cont);				
			$v->render('/page_not_found');
		}
	}		
Ejemplo n.º 2
0
 /** 
  * Returns an array of page objects based on current settings
  */
 public function get($itemsToGet = 0, $offset = 0)
 {
     $pages = array();
     if ($this->getQuery() == '') {
         $this->setBaseQuery();
     }
     $this->setItemsPerPage($itemsToGet);
     $r = parent::get($itemsToGet, $offset);
     foreach ($r as $row) {
         $nc = $this->loadPageID($row['cID']);
         if (!$this->displayOnlyApprovedPages) {
             $cp = new Permissions($nc);
             if ($cp->canReadVersions()) {
                 $nc->loadVersionObject('RECENT');
             } else {
                 $nc->loadVersionObject();
             }
         } else {
             $nc->loadVersionObject();
         }
         $nc->setPageIndexScore($row['cIndexScore']);
         $pages[] = $nc;
     }
     return $pages;
 }
Ejemplo n.º 3
0
     switch ($cp->getError()) {
         case COLLECTION_FORBIDDEN:
             $v = View::getInstance();
             $v->setCollectionObject($c);
             $v->render('/page_forbidden');
             break;
     }
 }
 if (!$c->isActive() && !$cp->canWrite()) {
     $v = View::getInstance();
     $v->render('/page_not_found');
 }
 ## If there's no error, then we build the collection, but first we load it with the appropriate
 ## version. We pass the function the collection object, as well as the collection permissions
 ## object, which the function will use to determine what version we get to see
 if ($cp->canWrite() || $cp->canReadVersions()) {
     $cvID = $_REQUEST['cvID'] ? $_REQUEST['cvID'] : "RECENT";
 } else {
     $cvID = "ACTIVE";
 }
 if ($_REQUEST['ccm-disable-controls'] == true || intval($cvID) > 0) {
     $v = View::getInstance();
     $v->disableEditing();
     $v->disableLinks();
 }
 $vp = $c->loadVersionObject($cvID);
 // returns the $vp object, which we then check
 if ($vp->isError()) {
     // if we've gotten an error getting information about this particular collection
     // than we load up the Content class, and get prepared to fire away
     switch ($vp->getError()) {
Ejemplo n.º 4
0
 function getAreaBlocksArray($c)
 {
     if (is_array($this->areaBlocksArray)) {
         return $this->areaBlocksArray;
     }
     $this->cID = $c->getCollectionID();
     $this->c = $c;
     $this->areaBlocksArray = array();
     if ($this->arIsGlobal) {
         $blocks = array();
         $cp = new Permissions($c);
         if ($cp->canReadVersions()) {
             $c = Stack::getByName($this->arHandle);
         } else {
             $c = Stack::getByName($this->arHandle, 'ACTIVE');
         }
         if (is_object($c)) {
             $blocks = $c->getBlocks(STACKS_AREA_NAME);
             $globalArea = Area::get($c, STACKS_AREA_NAME);
         }
     } else {
         $blocks = $c->getBlocks($this->arHandle);
     }
     foreach ($blocks as $ab) {
         if ($this->arIsGlobal && is_object($globalArea)) {
             $ab->setBlockAreaObject($globalArea);
         } else {
             $ab->setBlockAreaObject($this);
         }
         $this->areaBlocksArray[] = $ab;
         $this->totalBlocks++;
     }
     return $this->areaBlocksArray;
 }
Ejemplo n.º 5
0
	menuHTML += '<li><a class="ccm-menu-icon ccm-icon-permissions" dialog-append-buttons="true" id="ccm-toolbar-nav-permissions" dialog-width="640" dialog-height="330" dialog-modal="false" dialog-title="<?php 
                echo t('Permissions');
                ?>
" href="<?php 
                echo REL_DIR_FILES_TOOLS_REQUIRED;
                ?>
/edit_collection_popup.php?&cID=<?php 
                echo $cID;
                ?>
&ctask=edit_permissions"><?php 
                echo t('Permissions');
                ?>
</a></li>';
<?php 
            }
            if ($cp->canReadVersions()) {
                ?>
	menuHTML += '<li><a class="ccm-menu-icon ccm-icon-versions" id="ccm-toolbar-nav-versions" dialog-width="640" dialog-height="340" dialog-modal="false" dialog-title="<?php 
                echo t('Page Versions');
                ?>
" id="menuVersions<?php 
                echo $cID;
                ?>
" href="<?php 
                echo REL_DIR_FILES_TOOLS_REQUIRED;
                ?>
/versions.php?cID=<?php 
                echo $cID;
                ?>
"><?php 
                echo t('Versions');
Ejemplo n.º 6
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$valt = Loader::helper('validation/token');
$fh = Loader::helper('file');
$token = '&' . $valt->getParameter();
$c = Page::getByID($_REQUEST['cID']);
$cID = $c->getCollectionID();
$cp = new Permissions($c);
$isCheckedOut = $c->isCheckedOut() && !$c->isEditMode();
if (!$cp->canReadVersions() && !$cp->canApproveCollection()) {
    die(_("Access Denied."));
}
if ($_GET['vtask'] == 'view_version') {
    ?>
		<?php 
    /*
    		we use the always-updated ID below so that Safari doesn't cache the iframe's contents. We probably shouldn't be
    		making a new iframe on every request to this anyway, but it doesn't happen very often and it represents a significant
    		hurdle to making it a bit of a better citizen, so we'll do it this way for now.
    */
    ?>
		
		<iframe border="0" id="v<?php 
    echo time();
    ?>
" frameborder="0" height="100%" width="100%" src="<?php 
    echo BASE_URL . DIR_REL;
    ?>
/<?php 
    echo DISPATCHER_FILENAME;
Ejemplo n.º 7
0
                ?>
	menuHTML += '<li class="ccm-main-nav-edit-option" <?php 
                if (!$c->isEditMode()) {
                    ?>
 style="display: none" <?php 
                }
                ?>
><a href="javascript:void(0)" id="ccm-nav-permissions"><?php 
                echo t('Permissions');
                ?>
</a></li>';
 <?php 
            }
            ?>
 <?php 
            if ($cp->canReadVersions() && !$c->isMasterCollection()) {
                ?>
 	menuHTML += '<li class="ccm-main-nav-edit-option" <?php 
                if (!$c->isEditMode()) {
                    ?>
 style="display: none" <?php 
                }
                ?>
><a href="javascript:void(0)" id="ccm-nav-versions"><?php 
                echo t('Versions');
                ?>
</a></li>';
 <?php 
            }
            if (($sh->canRead() || $cp->canDeleteCollection()) && !$c->isMasterCollection()) {
                ?>
Ejemplo n.º 8
0
		public function getGlobalBlocks() {
			$db = Loader::db();
			$v = array( Stack::ST_TYPE_GLOBAL_AREA );
			$rs = $db->GetCol('select stName from Stacks where Stacks.stType = ?', $v );
			$blocks = array();
			if (count($rs) > 0) {
				$pcp = new Permissions($this);
				foreach($rs as $garHandle) {
					if ($pcp->canReadVersions()) {
						$s = Stack::getByName($garHandle, 'RECENT');
					} else {
						$s = Stack::getByName($garHandle, 'ACTIVE');
					}
					if (is_object($s)) {
						$blocksTmp = $s->getBlocks(STACKS_AREA_NAME);
						$blocks = array_merge($blocks, $blocksTmp);
					}
				}
			}
			
			return $blocks;
		}