Пример #1
0
    array_push($leadingLinesArray, substr($leadingLines, $i, 1));
}
$yg_id = explode('-', $yg_id);
$obj_id = $yg_id[0];
$siteID = $yg_id[1];
$maxlevels = 5;
switch ($yg_type) {
    case 'pages':
        sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
        $icons = new Icons();
        $pageMgr = new PageMgr($siteID);
        $page = $pageMgr->getPage($obj_id);
        if ($page) {
            $base = $page->get();
            $maxlevels = $base['LEVEL'] + 2;
            $objects = $pageMgr->getList($obj_id, array('SUBNODES'), $maxlevels, $roleid);
            $objects = $pageMgr->getAdditionalTreeInfo(false, $objects);
            foreach ($objects as $objectIndex => $object_item) {
                $iconData = getIconForPage($object_item);
                $objects[$objectIndex]['ICON'] = $iconData['iconclass'];
                $objects[$objectIndex]['STYLE'] = $iconData['style'];
                $objects[$objectIndex]['SITEID'] = $siteID;
            }
        }
        sUserMgr()->unimpersonate();
        break;
    case 'cblocks':
        sUserMgr()->impersonate(sUserMgr()->getAdministratorID());
        $cb = sCblockMgr()->getCblock($obj_id);
        if ($cb) {
            $base = $cb->get();
Пример #2
0
 }
 $SourcePageMgr = new PageMgr($sourcesite);
 $sourcePage = $SourcePageMgr->getPage($source);
 $oldPageInfo = $sourcePage->get();
 if ($sourcesite != $targetsite) {
     $oldpage = $source;
     $SourcePageMgr = new PageMgr($sourcesite);
     $sourcePage = $SourcePageMgr->getPage($source);
     $oldPageInfo = $sourcePage->get();
     $oldpagepid = $oldPageInfo["ID"];
     $TargetPageMgr = new PageMgr($targetsite);
     $rSub = $TargetPageMgr->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $target, "RSUB");
     $rDelete = $SourcePageMgr->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $source, "RDELETE");
     $rWrite = $SourcePageMgr->permissions->checkInternal(sUserMgr()->getCurrentUserID(), $source, "RWRITE");
     if ($rSub && $rDelete && $rWrite) {
         $copyjobs = $SourcePageMgr->getList($oldpage);
         $copystarted = false;
         $idmap = array();
         for ($i = 0; $i < count($copyjobs); $i++) {
             if ($copyjobs[$i]["ID"] == $oldpage) {
                 if ($copystarted === false) {
                     $rootlevel = $copyjobs[$i]["LEVEL"];
                     $copystarted = true;
                     $newPageID = $TargetPageMgr->add($target);
                     $newPage = $TargetPageMgr->getPage($newPageID);
                     $newPage->copyFrom($sourcePage);
                     $idmap[$oldpage] = $newPageID;
                     // Inherit permissions of the parent of the newly created copy
                     $allPerms = $sourcePage->permissions->getPermissions();
                     $newPage->permissions->clear();
                     $newPage->permissions->setPermissions($allPerms, $newPageID);
Пример #3
0
     $icons = new Icons();
     $objecttype = 'pages';
     $siteMgr = new Sites();
     $sites = $siteMgr->getList(true);
     $siteID = $this->request->parameters['site'];
     if (!$siteID) {
         $siteID = $sites[0]['ID'];
     }
     foreach ($sites as $sites_item) {
         if ($sites_item['ID'] == $siteID) {
             $sitename = $sites_item['NAME'];
         }
     }
     if ($siteID) {
         $pageMgr = new PageMgr($siteID);
         $objects = $pageMgr->getList(0, array(), $maxlevels, $roleid);
         $objects = $pageMgr->getAdditionalTreeInfo(false, $objects);
         foreach ($objects as $objectIndex => $object_item) {
             $iconData = getIconForPage($object_item);
             $objects[$objectIndex]['ICON'] = $iconData['iconclass'];
             $objects[$objectIndex]['STYLE'] = $iconData['style'];
             $objects[$objectIndex]['SITEID'] = $siteID;
         }
         // Use translated name for root-node
         $objects[0]['NAME'] = $itext['TXT_PAGES'] != '' ? $itext['TXT_PAGES'] : '$TXT_PAGES';
         $smarty->assign("sites", $sites);
         $smarty->assign("sitename", $sitename);
         $smarty->assign("sites", $sites);
     }
     break;
 case 'tab_usergroup_cblocks':
Пример #4
0
<?php

\framework\import('org.phpmailer.phpmailer');
$jsQueue = new JSQueue(NULL);
$templateMgr = new Templates();
$siteMgr = new Sites();
switch ($action) {
    case 'addSite':
        $wid = $this->params['wid'];
        $newSiteId = $siteMgr->add($itext['TXT_NEW_OBJECT'] ? $itext['TXT_NEW_OBJECT'] : '$TXT_NEW_OBJECT');
        // Set permissions for newly created site (but only for roles with "RSITES" privilege)
        $pageMgr = new PageMgr($newSiteId);
        $roles = sUsergroups()->getList();
        $pagesList = $pageMgr->getList(0, array(), 1, $roleID);
        $koala->callJSFunction('Koala.yg_addSiteItem', $wid, $newSiteId, $itext['TXT_NEW_OBJECT'] ? $itext['TXT_NEW_OBJECT'] : '$TXT_NEW_OBJECT');
        break;
    case 'deleteSite':
        $wid = $this->params['wid'];
        $siteID = $this->params['siteID'];
        $winID = explode('_', $wid);
        $winID = $winID[1];
        $siteMgr->remove($siteID);
        $koala->queueScript('if ($(\'sites_' . $winID . '_' . $siteID . '\')) $(\'sites_' . $winID . '_' . $siteID . '\').remove();');
        $koala->queueScript('Koala.windows[\'wid_' . $winID . '\'].refresh();');
        $koala->queueScript('$(Koala.windows[\'wid_' . $winID . '\'].boundWindow).addClassName(\'boxghost\');');
        $koala->queueScript('Koala.windows[Koala.windows[\'wid_' . $winID . '\'].boundWindow].init();');
        $koala->callJSFunction('Koala.yg_disable', 'tree_btn_delete', 'btn-' . $winID, 'tree_btn');
        break;
    case 'setSiteTemplateRoot':
        $siteID = $this->params['siteID'];
        $template = $this->params['templateId'];
Пример #5
0
// Check for filter and build filter array if needed
$filterArray = array();
if ($createdFromTS && $createdToTS) {
    $filterArray[] = array('TYPE' => 'CREATEDTS', 'OPERATOR' => 'is_bigger', 'VALUE' => $createdFromTS);
    $filterArray[] = array('TYPE' => 'CREATEDTS', 'OPERATOR' => 'is_smaller', 'VALUE' => $createdToTS);
}
if ($removedFromTS && $removedToTS) {
    $filterArray[] = array('TYPE' => 'CHANGEDTS', 'OPERATOR' => 'is_bigger', 'VALUE' => $removedFromTS);
    $filterArray[] = array('TYPE' => 'CHANGEDTS', 'OPERATOR' => 'is_smaller', 'VALUE' => $removedToTS);
}
switch ($type) {
    case 'page':
        $siteID = explode('-', $ygid);
        $siteID = $siteID[1];
        $pageMgr = new PageMgr($siteID);
        $trashedObjects = $pageMgr->getList(0, array('TRASHCAN'), 0, 0, $filterArray);
        // for paging
        $pageDirInfo = calcPageDir(count($trashedObjects), 'prop.CHANGEDTS', 'DESC');
        $pageDirOrderBy = $pageDirInfo['pageDirOrderBy'];
        $pageDirOrderDir = $pageDirInfo['pageDirOrderDir'];
        $pageDirLimit = explode(',', $pageDirInfo['pageDirLimit']);
        $pageDirLimitFrom = $pageDirLimit[0];
        $pageDirLimitLength = $pageDirLimit[1];
        // END for paging
        $filterArray[] = array('TYPE' => 'LIMITER', 'VALUE' => $pageDirLimitFrom, 'VALUE2' => $pageDirLimitLength);
        $filterArray[] = array('TYPE' => 'ORDER', 'VALUE' => $pageDirOrderBy, 'VALUE2' => $pageDirOrderDir);
        $trashedObjects = $pageMgr->getList(0, array('TRASHCAN'), 0, 0, $filterArray);
        foreach ($trashedObjects as $trashedObjectIdx => $trashedObject) {
            $page = $pageMgr->getPage($trashedObject['ID']);
            $lastHistory = $page->history->getChanges(1);
            $trashedObjects[$trashedObjectIdx]['PARENTS'] = $pageMgr->getParents($trashedObject['ID']);