/**
  * Is allowed to view page
  *
  * @param array $privacyOptions
  * @param boolean $trustedData
  * @return boolean
  */
 public function isAllowedViewPage(array $privacyOptions = [], $trustedData = false)
 {
     $userId = !empty($privacyOptions['user_id']) || $this->objectId ? !empty($privacyOptions['user_id']) ? $privacyOptions['user_id'] : $this->objectId : RouteParamUtility::getParam('slug', -1);
     $userField = !empty($privacyOptions['user_id']) ? UserWidgetModel::USER_INFO_BY_ID : UserWidgetModel::USER_INFO_BY_SLUG;
     if (!UserIdentityService::isGuest() || null == ($userInfo = $this->getModel()->getUserInfo($userId, $userField))) {
         return false;
     }
     // check the user's status
     if ($userInfo['status'] != UserWidgetModel::STATUS_DISAPPROVED) {
         return false;
     }
     return true;
 }
 /**
  * Is allowed to view page
  *
  * @param array $privacyOptions
  * @param boolean $trustedData
  * @return boolean
  */
 public function isAllowedViewPage(array $privacyOptions = [], $trustedData = false)
 {
     if (!UserIdentityService::isGuest()) {
         return false;
     }
     if (!$trustedData) {
         $userId = $this->objectId ? $this->objectId : RouteParamUtility::getParam('slug', -1);
         $userInfo = $this->getModel()->getUserInfo($userId, UserWidgetModel::USER_INFO_BY_SLUG);
         if (null == $userInfo) {
             return false;
         }
     }
     return true;
 }
Esempio n. 3
0
 /**
  * Get pages
  *
  * @param string $language
  * @return array
  *      boolean url_active
  *      string url_title
  *      array url_params
  *      array xml_map
  *          string lastmod
  *          string changefreq
  *          string priority
  *     array children
  */
 public function getPages($language)
 {
     if (null === self::$pages) {
         self::$pages = [];
         $users = $this->getModel()->getAllActiveUsers();
         $currentPage = PageService::getCurrentPage();
         if (count($users)) {
             foreach ($users as $user) {
                 self::$pages[] = ['url_active' => !empty($currentPage['slug']) && $currentPage['slug'] == $this->dynamicPageName && RouteParamUtility::getParam('slug') == $user['slug'], 'url_title' => $user['nick_name'], 'url_params' => ['slug' => $user['slug']], 'xml_map' => ['lastmod' => $user['date_edited'], 'changefreq' => null, 'priority' => null], 'children' => []];
             }
         }
     }
     return self::$pages;
 }
 /**
  * Is allowed view page
  * 
  * @param array $privacyOptions
  * @param boolean $trustedData
  * @return boolean
  */
 public function isAllowedViewPage(array $privacyOptions = [], $trustedData = false)
 {
     // check a permission
     if (!AclService::checkPermission('news_view_news', false)) {
         return false;
     }
     // get a news id from the route or params
     if (!$trustedData) {
         $newsId = $this->objectId ? $this->objectId : RouteParamUtility::getParam('slug', -1);
         // check an existing news
         if (null == ($newsInfo = $this->getModel()->getNewsInfo($newsId, true, false, 'slug', true))) {
             return false;
         }
     }
     return true;
 }
Esempio n. 5
0
 /**
  * Is allowed view page
  * 
  * @param array $privacyOptions
  * @param boolean $trusted
  * @return boolean
  */
 public function isAllowedViewPage(array $privacyOptions = [], $trustedData = false)
 {
     // check a permission
     if (!AclService::checkPermission('users_view_profile', false)) {
         return false;
     }
     if (!$trustedData) {
         $userId = !empty($privacyOptions['user_id']) || $this->objectId ? !empty($privacyOptions['user_id']) ? $privacyOptions['user_id'] : $this->objectId : RouteParamUtility::getParam('slug', -1);
         $userField = !empty($privacyOptions['user_id']) ? UserWidgetModel::USER_INFO_BY_ID : UserWidgetModel::USER_INFO_BY_SLUG;
         // check an existing user
         $userInfo = $this->getModel()->getUserInfo($userId, $userField);
         if (!$userInfo || $userInfo['status'] != UserWidgetModel::STATUS_APPROVED) {
             return false;
         }
     }
     return true;
 }
 /**
  * Is allowed view page
  * 
  * @param array $privacyOptions
  * @param boolean $trustedData
  * @return boolean
  */
 public function isAllowedViewPage(array $privacyOptions = [], $trustedData = false)
 {
     // get a news id from the route or params
     if (!$trustedData) {
         $transactionId = $this->objectId ? $this->objectId : RouteParamUtility::getParam('slug', -1);
         // check an existing transaction
         if (null == ($transactionInfo = $this->getModel()->getTransactionInfo($transactionId, true, 'slug'))) {
             return false;
         }
         if ($transactionInfo['amount'] <= 0) {
             return false;
         }
         if (null == ($paymentsTypes = $this->getModel()->getPaymentsTypes(false, true))) {
             return false;
         }
         // check count of transaction's items
         if (!count($this->getModel()->getAllTransactionItems($transactionInfo['id']))) {
             return false;
         }
     }
     return true;
 }
Esempio n. 7
0
 /**
  * Get a route param
  *
  * @param string $paramName
  * @param string $defaultValue
  * @return string
  */
 protected function getRouteParam($paramName, $defaultValue = null)
 {
     return RouteParamUtility::getParam($paramName, $defaultValue);
 }
Esempio n. 8
0
 /**
  * Get query
  *
  * @return array
  */
 public function getQuery()
 {
     return RouteParamUtility::getQuery();
 }