Exemplo n.º 1
0
 public function __construct($id_Website, $controllerName = "index", $langue = 'fr', $zoneArea = 'bigadmin', $user = array())
 {
     $this->timeExecution = microtime(true);
     $this->langueZone = $langue;
     $this->zoneArea = $zoneArea;
     $this->controllerNameNow = $controllerName;
     $this->user = $user;
     if (empty($langue)) {
         $db = new CRUD();
         $isWebsite = $db->dbQS($id_Website, '_website');
         if (!empty($isWebsite)) {
             $langue = $isWebsite['langue_front'];
             $isWebsite['langue_groupe'] = unserialize($isWebsite['langue_groupe']);
             $isWebsite['langue_groupe'][$langue] = $langue;
             $urlToRedirect = URL_USER . $langue . '/';
             $cLangues = count($isWebsite['langue_groupe']);
             if ($cLangues === 1) {
                 $urlToRedirect = URL;
             }
             if ($cLangues > 1) {
                 header('HTTP/1.1 301 Moved Permanently', false, 301);
                 header('Location: ' . $urlToRedirect);
                 exit;
             }
         }
     }
     if (!empty($this->user) && $zoneArea === 'user' && $_SESSION['doorgets_user']['langue'] !== $langue && $controllerName !== 'changelangue') {
         header('Location: ' . URL_USER . $_SESSION['doorgets_user']['langue'] . '/');
         exit;
     }
     parent::__construct($langue);
     if (!empty($this->user) && !empty($this->user['timezone'])) {
         date_default_timezone_set($this->user['timezone']);
     }
     $this->getParams();
     $this->getController();
     $this->reloadController();
     $this->isRtlLanguage = in_array($this->myLanguage, Constant::$rtlLanguage) ? true : false;
 }
Exemplo n.º 2
0
require_once BASE . 'config/config.php';
define('BASE_URL', URL);
// Authentification User
$Auth = new AuthUser();
$User = $Auth->isConnected();
if (empty($User)) {
    header('HTTP/1.0 404 Not Found');
    exit;
}
if (array_key_exists('backurl', $_GET)) {
    $backurl = filter_var($_GET['backurl'], FILTER_SANITIZE_URL);
    $_SESSION['backurl'] = $backurl;
}
$crud = new CRUD();
$urlTraduction = '';
$website = $crud->dbQS(1, '_website');
if (!empty($website)) {
    $langueGroupe = @unserialize($website['langue_groupe']);
    $cLangue = count($langueGroupe);
    if ($cLangue) {
        $urlTraduction = $website['langue_front'] . '/';
    }
    if ($website['oauth_facebook_active'] === '1' && !empty($website['oauth_facebook_id']) && !empty($website['oauth_facebook_secret'])) {
        $app_id = $website['oauth_facebook_id'];
        $app_secret = $website['oauth_facebook_secret'];
        $my_url = BASE_URL . 'oauth2/facebook/connexion/';
        \Facebook\FacebookSession::setDefaultApplication($app_id, $app_secret);
        $helper = new \Facebook\FacebookRedirectLoginHelper($my_url);
        $loginUrl = $helper->getLoginUrl();
        if (isset($_GET['code'])) {
            $code = $_GET['code'];
Exemplo n.º 3
0
 public function __construct($lg = '')
 {
     $this->User = new AuthUser();
     $isUser = $this->User->isConnected();
     if (!empty($isUser)) {
         $this->_User = $isUser;
         $this->isUser = true;
     }
     $lgTemp = $lg;
     if (empty($lg)) {
         $db = new CRUD();
         $isWebsite = $db->dbQS(1, '_website');
         if (!empty($isWebsite)) {
             $lgTemp = $isWebsite['langue_front'];
             $isWebsite['langue_groupe'] = unserialize($isWebsite['langue_groupe']);
             $isWebsite['langue_groupe'][$lgTemp] = $lgTemp;
             $urlToRedirect = URL . 't/' . $lgTemp;
             $cLangues = count($isWebsite['langue_groupe']);
             if ($cLangues === 1) {
                 $urlToRedirect = URL;
             }
             if ($cLangues > 1) {
                 header('HTTP/1.1 301 Moved Permanently', false, 301);
                 header('Location: ' . $urlToRedirect);
                 exit;
             }
         }
     }
     if (!empty($isUser)) {
         $this->_lgUrl = $isUser['langue'] . '/';
     }
     parent::__construct($lgTemp);
     if (!empty($lg) && array_key_exists($lgTemp, $this->allLanguages)) {
         $this->configWeb['langue_front'] = $lgTemp;
     }
     if (!empty($lg) && count($this->allLanguagesWebsite) === 1) {
         header('HTTP/1.1 301 Moved Permanently', false, 301);
         header('Location: ' . URL);
         exit;
     }
     if (!array_key_exists($this->configWeb['langue_front'], $this->configWeb['langue_groupe']) && empty($this->allLanguagesWebsite)) {
         header('Location:' . URL . '#');
         exit;
     }
     @date_default_timezone_set($this->configWeb['horaire']);
     $this->myLanguage = $this->configWeb['langue_front'];
     $this->module = $this->configWeb['module_homepage'];
     $this->theme = $this->configWeb['theme'];
     $this->rubriques = $this->getRubriques('_rubrique');
     $this->activeModules = $this->getAllActiveModules();
     // Widget Newsletter init
     $this->initNewsletterWidget();
     $themeExists = $this->checkTheme();
     if (empty($themeExists)) {
         die('The dir <b>' . THEME . '/' . $this->theme . '</b> not found.');
     }
     $this->htmlContent = $this->getHtmlWaitingPage();
     $isIpUserStatut = $this->isIpUserStatut();
     if ($this->configWeb['statut'] === '1' || $isIpUserStatut) {
         $this->loadParams();
         $this->loadPosition();
         if ($this->position == 'error') {
             $this->redirectToErrorHeader();
         }
         $this->loadMeta();
         $this->isRtlLanguage = in_array($this->myLanguage, Constant::$rtlLanguage) ? true : false;
         // Widget Comment init
         $this->initCommentWidget();
         $this->genController();
         $this->htmlContent = $this->getHtmlWrapper();
     }
 }
Exemplo n.º 4
0
// Google API
include BASE . 'doorgets/lib/google/src/Google/autoload.php';
// Authentification User
$Auth = new AuthUser();
$User = $Auth->isConnected();
if (empty($User)) {
    header('HTTP/1.0 404 Not Found');
    exit;
}
if (array_key_exists('backurl', $_GET)) {
    $backurl = filter_var($_GET['backurl'], FILTER_SANITIZE_URL);
    $_SESSION['backurl'] = $backurl;
}
$crud = new CRUD();
$urlTraduction = '';
$website = $crud->dbQS(Constant::$websiteId, '_website');
if (!empty($website)) {
    $langueGroupe = @unserialize($website['langue_groupe']);
    $cLangue = count($langueGroupe);
    if ($cLangue) {
        $urlTraduction = $website['langue_front'] . '/';
    }
    if ($website['oauth_google_active'] === '1' && !empty($website['oauth_google_id']) && !empty($website['oauth_google_secret'])) {
        $client = new Google_Client();
        $client->setApplicationName("Mon appliation");
        $client->setAccessType('offline');
        $client->setClientId($website['oauth_google_id']);
        $client->setClientSecret($website['oauth_google_secret']);
        $client->setRedirectUri(BASE_URL . 'oauth2/google/connexion');
        $client->addScope("https://www.googleapis.com/auth/plus.login");
        $client->addScope("https://www.googleapis.com/auth/userinfo.email");
Exemplo n.º 5
0
    include BASE . 'doorgets/lib/facebook/src/Facebook/FacebookCanvasLoginHelper.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/Entities/AccessToken.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/HttpClients/FacebookHttpable.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/HttpClients/FacebookCurl.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/HttpClients/FacebookCurlHttpClient.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/FacebookSDKException.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/FacebookRequestException.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/FacebookAuthorizationException.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/GraphLocation.php';
    include BASE . 'doorgets/lib/facebook/src/Facebook/GraphUser.php';
} else {
    exit;
}
$crud = new CRUD();
$urlTraduction = '';
$website = $crud->dbQS(Constant::$websiteId, '_website');
if (!empty($website)) {
    $langueGroupe = @unserialize($website['langue_groupe']);
    $cLangue = count($langueGroupe);
    if ($cLangue) {
        $urlTraduction = $website['langue_front'] . '/';
    }
    if ($website['oauth_facebook_active'] === '1' && !empty($website['oauth_facebook_id']) && !empty($website['oauth_facebook_secret'])) {
        $app_id = $website['oauth_facebook_id'];
        $app_secret = $website['oauth_facebook_secret'];
        $my_url = BASE_URL . 'oauth2/facebook/login/';
        $permissions = array('email');
        // optional
        \Facebook\FacebookSession::setDefaultApplication($app_id, $app_secret);
        $helper = new \Facebook\FacebookRedirectLoginHelper($my_url);
        $loginUrl = $helper->getLoginUrl($permissions);