public function __construct()
 {
     parent::__construct();
     $this->_ddosProtection();
     /***** Assign the values for Registry Class *****/
     // URL
     $this->registry->site_url = PH7_URL_ROOT;
     $this->registry->url_relative = PH7_RELATIVE;
     $this->registry->page_ext = PH7_PAGE_EXT;
     // Site Name
     $this->registry->site_name = M\DbConfig::getSetting('siteName');
     /***** Internationalization *****/
     // Default path language
     $this->lang->load('global', PH7_PATH_APP_LANG);
     /***** PH7Tpl Template Engine initialization *****/
     /*** Assign the global variables ***/
     /*** Objects ***/
     $this->view->config = $this->config;
     $this->view->design = $this->design;
     /***** Info *****/
     $oInfo = M\DbConfig::getMetaMain(PH7_LANG_NAME);
     $aMetaVars = ['site_name' => $this->registry->site_name, 'page_title' => $oInfo->pageTitle, 'slogan' => $oInfo->slogan, 'meta_description' => $oInfo->metaDescription, 'meta_keywords' => $oInfo->metaKeywords, 'meta_author' => $oInfo->metaAuthor, 'meta_robots' => $oInfo->metaRobots, 'meta_copyright' => $oInfo->metaCopyright, 'meta_rating' => $oInfo->metaRating, 'meta_distribution' => $oInfo->metaDistribution, 'meta_category' => $oInfo->metaCategory, 'header' => 0, 'is_disclaimer' => (bool) M\DbConfig::getSetting('disclaimer'), 'is_cookie_consent_bar' => (bool) M\DbConfig::getSetting('cookieConsentBar'), 'country' => Geo::getCountry(), 'city' => Geo::getCity()];
     $this->view->assigns($aMetaVars);
     $aModsEnabled = ['is_connect_enabled' => SysMod::isEnabled('connect'), 'is_affiliate_enabled' => SysMod::isEnabled('affiliate'), 'is_game_enabled' => SysMod::isEnabled('game'), 'is_chat_enabled' => SysMod::isEnabled('chat'), 'is_chatroulette_enabled' => SysMod::isEnabled('chatroulette'), 'is_picture_enabled' => SysMod::isEnabled('picture'), 'is_video_enabled' => SysMod::isEnabled('video'), 'is_hotornot_enabled' => SysMod::isEnabled('hotornot'), 'is_forum_enabled' => SysMod::isEnabled('forum'), 'is_note_enabled' => SysMod::isEnabled('note'), 'is_blog_enabled' => SysMod::isEnabled('blog'), 'is_newsletter_enabled' => SysMod::isEnabled('newsletter'), 'is_invite_enabled' => SysMod::isEnabled('invite'), 'is_webcam_enabled' => SysMod::isEnabled('webcam')];
     $this->view->assigns($aModsEnabled);
     unset($oInfo, $aMetaVars, $aModsEnabled);
     /**
      * This below PHP condition is not necessary because if there is no session,
      * the get() method of the \PH7\Framework\Session\Session object an empty value and revisit this avoids having undefined variables in some modules (such as the "connect" module).
      */
     //if (\PH7\UserCore::auth()) {
     $this->view->count_unread_mail = \PH7\MailCoreModel::countUnreadMsg($this->session->get('member_id'));
     $this->view->count_pen_friend_request = \PH7\FriendCoreModel::getPending($this->session->get('member_id'));
     //}
     /***** Display *****/
     $this->view->setTemplateDir($this->registry->path_module_views . PH7_TPL_MOD_NAME);
     /***** End Template Engine PH7Tpl *****/
     $this->_checkPerms();
     $this->_checkModStatus();
     $this->_checkBanStatus();
     $this->_checkSiteStatus();
 }
Пример #2
0
 /**
  * Show the geolocation of the user.
  *
  * @param boolean $bPrint Print or return the HTML code. Default TRUE
  * @return mixed (string | void)
  */
 public function geoIp($bPrint = true)
 {
     $sCountry = Geo::getCountry();
     $sCountryLang = t(str_replace('GB', 'UK', Geo::getCountryCode()));
     // Country name translated into the user language.
     $sCity = Geo::getCity();
     $sHtml = '<a href="' . Uri::get('user', 'country', 'index', $sCountry . PH7_SH . $sCity) . '" title="' . t('Meet New People on %0%, %1% with %site_name%!', $sCountryLang, $sCity) . '">' . $sCountryLang . ', ' . $sCity . '</a>';
     if ($bPrint) {
         echo $sHtml;
     } else {
         return $sHtml;
     }
 }