public function indexAction(Request $request, SessionInterface $session) { $entityId = $request->get('id'); if (Util::checkUserIsLoggedIn()) { $session->set('selected_product_id', SystemProduct::SYS_PRODUCT_DOCUMENTADOR); $loggedInUserId = $session->get('user/id'); $page = $this->getRepository(Entity::class)->getById($entityId, $loggedInUserId); if ($page) { $spaceId = $page['space_id']; } $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_DOCUMENTADOR_NAME . ' / ' . $page['name'] . ' / Attachments'; } else { $httpHOST = Util::getHttpHost(); $clientId = $this->getRepository(UbirimiClient::class)->getByBaseURL($httpHOST, 'array', 'id'); $loggedInUserId = null; $settingsDocumentador = $this->getRepository(UbirimiClient::class)->getDocumentadorSettings($clientId); $documentatorUseAnonymous = $settingsDocumentador['anonymous_use_flag']; $page = $this->getRepository(Entity::class)->getById($entityId, $loggedInUserId); if ($page) { $spaceId = $page['space_id']; $spaceHasAnonymousAccess = $this->getRepository(Space::class)->hasAnonymousAccess($spaceId); if (!($documentatorUseAnonymous && $spaceHasAnonymousAccess)) { Util::signOutAndRedirect(); die; } } $sectionPageTitle = SystemProduct::SYS_PRODUCT_DOCUMENTADOR_NAME . ' / ' . $page['name'] . ' / Attachments'; } $menuSelectedCategory = 'documentator'; if ($page) { $attachments = $this->getRepository(EntityAttachment::class)->getByEntityId($entityId); } return $this->render(__DIR__ . '/../../../Resources/views/page/attachment/View.php', get_defined_vars()); }
public function indexAction(Request $request, SessionInterface $session) { if (Util::checkUserIsLoggedIn()) { $clientSettings = $session->get('client/settings'); $session->set('selected_product_id', SystemProduct::SYS_PRODUCT_DOCUMENTADOR); $clientId = $session->get('client/id'); } else { $httpHOST = Util::getHttpHost(); $clientId = $this->getRepository(UbirimiClient::class)->getByBaseURL($httpHOST, 'array', 'id'); $clientSettings = $this->getRepository(UbirimiClient::class)->getById($clientId); $loggedInUserId = null; $settingsDocumentador = $this->getRepository(UbirimiClient::class)->getDocumentadorSettings($clientId); $documentatorUseAnonymous = $settingsDocumentador['anonymous_use_flag']; $documentatorAnonymousViewUserProfiles = $settingsDocumentador['anonymous_view_user_profile_flag']; if (!($documentatorUseAnonymous && $documentatorAnonymousViewUserProfiles)) { Util::signOutAndRedirect(); die; } } $userId = $request->get('id'); $user = $this->getRepository(UbirimiUser::class)->getById($userId); if ($user['client_id'] != $clientId) { return new RedirectResponse('/general-settings/bad-link-access-denied'); } $menuSelectedCategory = 'documentator'; $activities = $this->getRepository(UbirimiUser::class)->getDocumentadorActivityStream($userId); $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_DOCUMENTADOR_NAME . ' / ' . $user['first_name'] . ' ' . $user['last_name'] . ' / Activity'; return $this->render(__DIR__ . '/../../Resources/views/user/Activity.php', get_defined_vars()); }
public function indexAction(Request $request, SessionInterface $session) { $entityId = $request->get('id'); if (Util::checkUserIsLoggedIn()) { $session->set('selected_product_id', SystemProduct::SYS_PRODUCT_DOCUMENTADOR); $page = $this->getRepository(Entity::class)->getById($entityId, $session->get('user/id')); if ($page) { $spaceId = $page['space_id']; } $sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_DOCUMENTADOR_NAME . ' / ' . $page['name']; } else { $httpHOST = Util::getHttpHost(); $clientId = $this->getRepository(UbirimiClient::class)->getByBaseURL($httpHOST, 'array', 'id'); $loggedInUserId = null; $settingsDocumentador = $this->getRepository(UbirimiClient::class)->getDocumentadorSettings($clientId); $documentatorUseAnonymous = $settingsDocumentador['anonymous_use_flag']; $page = $this->getRepository(Entity::class)->getById($entityId, $loggedInUserId); if ($page) { $spaceId = $page['space_id']; $spaceHasAnonymousAccess = $this->getRepository(Space::class)->hasAnonymousAccess($spaceId); if (!($documentatorUseAnonymous && $spaceHasAnonymousAccess)) { Util::signOutAndRedirect(); die; } } $sectionPageTitle = SystemProduct::SYS_PRODUCT_DOCUMENTADOR_NAME . ' / ' . $page['name']; } $menuSelectedCategory = 'documentator'; if ($page) { $parentEntityId = $page['parent_entity_id']; $parentPage = null; if ($parentEntityId) { $parentPage = $this->getRepository(Entity::class)->getById($parentEntityId); } $revisionId = $request->attributes->has('rev_id') ? str_replace('/', '', $request->get('rev_id')) : null; if ($revisionId) { $revision = $this->getRepository(Entity::class)->getRevisionsByPageIdAndRevisionId($entityId, $revisionId); } $space = $this->getRepository(Space::class)->getById($spaceId); if ($space['client_id'] != $session->get('client/id')) { return new RedirectResponse('/general-settings/bad-link-access-denied'); } $pagesInSpace = $this->getRepository(Entity::class)->getAllBySpaceId($spaceId); $treeStructure = $this->getRepository(Space::class)->generateTreeStructure($pagesInSpace, $entityId); $comments = $this->getRepository(EntityComment::class)->getComments($entityId, 'array'); $lastRevision = $this->getRepository(Entity::class)->getLastRevisionByPageId($entityId); $childPages = $this->getRepository(Entity::class)->getChildren($entityId); $pageFiles = $this->getRepository(Entity::class)->getFilesByEntityId($entityId); $attachments = $this->getRepository(EntityAttachment::class)->getByEntityId($entityId); } return $this->render(__DIR__ . '/../../Resources/views/page/View.php', get_defined_vars()); }
public static function checkUserIsLoggedInAndRedirect($context = null) { if (!Util::checkUserIsLoggedIn()) { Util::signOutAndRedirect($context); } }