Ejemplo n.º 1
0
 public static function PublishRssForPageTypes($siteUniqId, $root = '../')
 {
     $site = Site::GetBySiteUniqId($siteUniqId);
     $list = PageType::GetPageTypes($site['SiteId']);
     foreach ($list as $row) {
         Publish::PublishRssForPageType($siteUniqId, $row['PageTypeId'], $root);
     }
 }
Ejemplo n.º 2
0
 /**
  * @method GET
  */
 function get()
 {
     // get token
     $token = Utilities::ValidateJWTToken(apache_request_headers());
     // check if token is not null
     if ($token != NULL) {
         $siteId = $token->SiteId;
         // get user
         $user = User::GetByUserId($token->UserId);
         // creates an access object
         $access = Utilities::SetAccess($user);
         // get pagetype
         $list = PageType::GetPageTypes($siteId);
         // allowed
         $allowed = array();
         // create a root element in the array
         $root = array('FriendlyId' => '', 'IsSecure' => 0, 'LastModifiedBy' => NULL, 'LastModifiedDate' => NULL, 'Layout' => 'content', 'PageTypeId' => -1, 'PageTypeId' => -1, 'SiteId' => -1, 'Stylesheet' => 'content');
         // return the entire list for all access
         if ($access['CanAccess'] == 'All') {
             $allowed = $list;
             array_unshift($allowed, $root);
         } else {
             foreach ($list as $row) {
                 $pageTypeId = $row['PageTypeId'];
                 if (Utilities::CanPerformAction('root', $access['CanAccess']) != false) {
                     array_push($allowed, $root);
                 }
                 //print('$pageTypeId='.$pageTypeId.' access='.$access['CanAccess']);
                 // check permissions
                 if (Utilities::CanPerformAction($pageTypeId, $access['CanAccess']) != false) {
                     array_push($allowed, $row);
                 }
             }
         }
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($allowed);
         return $response;
     } else {
         // unauthorized access
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }
Ejemplo n.º 3
0
 public static function PublishRssForPageTypes($site)
 {
     $list = PageType::GetPageTypes($site['SiteId']);
     foreach ($list as $row) {
         Publish::PublishRssForPageType($site, $row['PageTypeId']);
     }
 }
Ejemplo n.º 4
0
 /**
  * @method GET
  */
 function get()
 {
     // get an authuser
     $authUser = new AuthUser();
     if (isset($authUser->UserUniqId)) {
         // check if authorized
         $siteId = $authUser->SiteId;
         // get pagetype
         $list = PageType::GetPageTypes($siteId);
         // allowed
         $allowed = array();
         // return the entire list for all access
         if ($authUser->Access == 'All') {
             $allowed = $list;
         } else {
             foreach ($list as $row) {
                 $pageTypeUniqId = $row['PageTypeUniqId'];
                 // check permissions
                 if (Utilities::CanPerformAction($pageTypeUniqId, $authUser->Access) !== false) {
                     array_push($allowed, $row);
                 }
             }
         }
         // return a json response
         $response = new Tonic\Response(Tonic\Response::OK);
         $response->contentType = 'application/json';
         $response->body = json_encode($allowed);
         return $response;
     } else {
         // unauthorized access
         return new Tonic\Response(Tonic\Response::UNAUTHORIZED);
     }
 }