public function __construct() { parent::__construct(); /***** Securing the server for DDoS attack only! Not for the attacks DoS *****/ if (!isDebug() && M\DbConfig::getSetting('DDoS')) { $oDDoS = new Stop(); if ($oDDoS->cookie() || $oDDoS->session()) { sleep(PH7_DDOS_DELAY_SLEEP); } unset($oDDoS); } /* if ($this->browser->isMobile()) { \PH7\Framework\Url\HeaderUrl::redirect('mobile'); } */ /***** 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]; $this->view->assigns($aMetaVars); unset($oInfo); /** * This test 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::getPenFd($this->session->get('member_id')); //} /***** Display *****/ $this->view->setTemplateDir($this->registry->path_module_views . PH7_TPL_MOD_NAME); /***** End Template Engine PH7Tpl *****/ // For permission the modules if (is_file($this->registry->path_module_config . 'Permission.php')) { require $this->registry->path_module_config . 'Permission.php'; new \PH7\Permission(); } }
/** * Displaying the main homepage of the website. */ public function index() { // We must not put the title as this is the homepage, so this is the default title is used. // For Profiles Carousel $this->view->userDesignModel = new UserDesignCoreModel(); $this->view->userDesign = new UserDesignCore(); // Only visitors if (!UserCore::auth()) { // Set CSS and JS files $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'splash.css,tooltip.css,js/jquery/carousel.css'); $this->design->addJs(PH7_DOT, PH7_STATIC . PH7_JS . 'jquery/carouFredSel.js,' . PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_JS . 'splash.js'); // Assigns the promo text to the view $this->view->promo_text = DbConfig::getMetaMain(PH7_LANG_NAME)->promoText; // Assign the background video option $this->view->is_bg_video = DbConfig::getSetting('bgSplashVideo'); // To check if the site is called by a mobile native app $bMobApp = $this->view->is_mobapp = MobApp::is(); /** * When you are in the development mode, you can force the guest page by set a "force" GET request with the "splash" or "classic" parameter. * Example: "/?force=splash" or "/?force=classic" */ if (isDebug() && $this->httpRequest->getExists('force')) { switch ($this->httpRequest->get('force')) { case 'classic': $sPage = 'index.guest'; break; case 'splash': $sPage = 'index.guest_splash'; break; default: exit('You can only choose between "classic" or "splash"'); } } elseif ($bMobApp) { $sPage = 'index.guest_splash'; } else { $bIsSplashPage = (bool) DbConfig::getSetting('splashPage'); $sPage = $bIsSplashPage ? 'index.guest_splash' : 'index.guest'; } $this->manualTplInclude($sPage . '.inc.tpl'); } elseif (UserCore::auth()) { // Set CSS and JS files $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'zoomer.css'); $this->design->addJs(PH7_STATIC . PH7_JS, 'zoomer.js,Wall.js'); // Assigns the user's first name to the view for the Welcome Message $this->view->first_name = $this->session->get('member_first_name'); $this->manualTplInclude('index.user.inc.tpl'); } $this->output(); }
public function __construct() { parent::__construct(); $sWhereLang = $this->httpRequest->get('meta_lang'); $oMeta = DbConfig::getMetaMain($sWhereLang); if (!$this->str->equals($this->httpRequest->post('lang_id'), $oMeta->langId)) { DbConfig::setMetaMain('langId', $this->httpRequest->post('lang_id'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('page_title'), $oMeta->pageTitle)) { DbConfig::setMetaMain('pageTitle', $this->httpRequest->post('page_title'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('slogan'), $oMeta->slogan)) { DbConfig::setMetaMain('slogan', $this->httpRequest->post('slogan'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('promo_text'), $oMeta->promoText)) { DbConfig::setMetaMain('promoText', $this->httpRequest->post('promo_text', Http::ONLY_XSS_CLEAN), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_description'), $oMeta->metaDescription)) { DbConfig::setMetaMain('metaDescription', $this->httpRequest->post('meta_description'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_keywords'), $oMeta->metaKeywords)) { DbConfig::setMetaMain('metaKeywords', $this->httpRequest->post('meta_keywords'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_robots'), $oMeta->metaRobots)) { DbConfig::setMetaMain('metaRobots', $this->httpRequest->post('meta_robots'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_author'), $oMeta->metaAuthor)) { DbConfig::setMetaMain('metaAuthor', $this->httpRequest->post('meta_author'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_copyright'), $oMeta->metaCopyright)) { DbConfig::setMetaMain('metaCopyright', $this->httpRequest->post('meta_copyright'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_rating'), $oMeta->metaRating)) { DbConfig::setMetaMain('metaRating', $this->httpRequest->post('meta_rating'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_distribution'), $oMeta->metaDistribution)) { DbConfig::setMetaMain('metaDistribution', $this->httpRequest->post('meta_distribution'), $sWhereLang); } if (!$this->str->equals($this->httpRequest->post('meta_category'), $oMeta->metaCategory)) { DbConfig::setMetaMain('metaCategory', $this->httpRequest->post('meta_category'), $sWhereLang); } /* Clean DbConfig Cache */ (new Framework\Cache\Cache())->start(DbConfig::CACHE_GROUP, null, null)->clear(); \PFBC\Form::setSuccess('form_meta', t('The Meta Tags was saved successfully!')); }
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(); }
public static function display() { if (isset($_POST['submit_meta'])) { if (\PFBC\Form::isValid($_POST['submit_meta'])) { new MetaMainFormProcess(); } Framework\Url\Header::redirect(); } $sWhereLang = (new Http())->get('meta_lang'); $oMeta = DbConfig::getMetaMain($sWhereLang); $oForm = new \PFBC\Form('form_meta'); $oForm->configure(array('action' => '')); $oForm->addElement(new \PFBC\Element\Hidden('submit_meta', 'form_meta')); $oForm->addElement(new \PFBC\Element\Token('admin_meta')); // Generate the list of languages $oForm->addElement(new \PFBC\Element\HTMLExternal('<div class="center divShow">')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<h3 class="underline"><a href="#showDiv_listLang" title="' . t('Click here to show/hide the languages') . '">' . t('Change language for the Meta Tags') . '</a></h3>')); $oForm->addElement(new \PFBC\Element\HTMLExternal('<ul class="hidden" id="showDiv_listLang">')); $aLangs = (new File())->getDirList(PH7_PATH_APP_LANG); for ($i = 0, $iLength = count($aLangs); $i < $iLength; $i++) { $sAbbrLang = substr($aLangs[$i], 0, 2); $oForm->addElement(new \PFBC\Element\HTMLExternal('<li>' . ($i + 1) . ') ' . '<a class="bold" href="' . Uri::get(PH7_ADMIN_MOD, 'setting', 'metamain', $aLangs[$i], false) . '" title="' . t($sAbbrLang) . '">' . t($sAbbrLang) . ' (' . $aLangs[$i] . ')</a></li>')); } unset($aLangs); $oForm->addElement(new \PFBC\Element\HTMLExternal('</ul></div>')); $oForm->addElement(new \PFBC\Element\Textbox(t('Language:'), 'lang_id', array('value' => $oMeta->langId, 'description' => t('EX: "en", "fr", "es", "jp"'), 'validation' => new \PFBC\Validation\Str(5, 5), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Home page title:'), 'page_title', array('value' => $oMeta->pageTitle, 'validation' => new \PFBC\Validation\Str(2, 100), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Slogan:'), 'slogan', array('value' => $oMeta->slogan, 'validation' => new \PFBC\Validation\Str(2, 200), 'required' => 1))); $oForm->addElement(new \PFBC\Element\CKEditor(t('SEO text:'), 'promo_text', array('description' => t('Promotional text to display on the homepage for visitors.'), 'value' => $oMeta->promoText, 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Description (meta tag):'), 'meta_description', array('value' => $oMeta->metaDescription, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Keywords (meta tag):'), 'meta_keywords', array('description' => t('Separate keywords by commas.'), 'value' => $oMeta->metaKeywords, 'validation' => new \PFBC\Validation\Str(2, 255), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Robots (meta tag):'), 'meta_robots', array('value' => $oMeta->metaRobots, 'validation' => new \PFBC\Validation\Str(2, 50), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Author (meta tag):'), 'meta_author', array('value' => $oMeta->metaAuthor, 'validation' => new \PFBC\Validation\Str(2, 50), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Copyright (meta tag):'), 'meta_copyright', array('value' => $oMeta->metaCopyright, 'validation' => new \PFBC\Validation\Str(2, 50), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Rating (meta tag):'), 'meta_rating', array('value' => $oMeta->metaRating, 'validation' => new \PFBC\Validation\Str(2, 50), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Distribution (meta tag):'), 'meta_distribution', array('value' => $oMeta->metaDistribution, 'validation' => new \PFBC\Validation\Str(2, 50), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Textbox(t('Category (meta tag):'), 'meta_category', array('value' => $oMeta->metaCategory, 'validation' => new \PFBC\Validation\Str(2, 50), 'required' => 1))); $oForm->addElement(new \PFBC\Element\Button()); $oForm->render(); }