public static function register($post) { global $db, $LANG; $session = ''; $max_acc = (int) \query\main::get_option('accounts_per_ip'); if ($max_acc !== 0 && (int) \query\main::users(array('ip' => \site\utils::getIP())) >= $max_acc) { throw new \Exception($LANG['msg_error']); // administrator don't allow that manny accounts } else { if (\user\main::banned('registration')) { throw new \Exception($LANG['msg_banned']); } else { if (!isset($post['email']) || !filter_var($post['email'], FILTER_VALIDATE_EMAIL)) { throw new \Exception($LANG['register_usevalide']); } else { if (!isset($post['username'])) { throw new \Exception($LANG['register_complete_name']); } else { if (!preg_match('/(^[a-zA-Z0-9 ]{3,25}$)/', $post['username'])) { throw new \Exception($LANG['register_invalid_name']); } else { if (!isset($post['password']) || !isset($post['password2'])) { throw new \Exception($LANG['register_paswdreq']); } else { if (!preg_match('/(^[a-zA-Z0-9-_]{5,40}$)/', $post['password'])) { throw new \Exception($LANG['register_invalid_paswd']); } else { if ($post['password'] != $post['password2']) { throw new \Exception($LANG['register_passwdnm']); } else { if (!($session = \user\main::insert_user($post))) { throw new \Exception($LANG['register_accexists']); } return $session; } } } } } } } } }
<?php if (\user\main::banned('login') || \user\main::banned('register')) { header('Location: ' . $GLOBALS['siteURL']); die; } else { if (\query\main::get_option('facebook_appID') === '' || \query\main::get_option('facebook_secret') === '') { die('This service it\'s unavailable for the moment.'); } } include DIR . '/' . LBDIR . '/facebook-sdk-4.0/autoload.php'; use Facebook\FacebookSession; use Facebook\FacebookRedirectLoginHelper; use Facebook\FacebookRequest; use Facebook\FacebookResponse; use Facebook\FacebookSDKException; use Facebook\FacebookRequestException; use Facebook\FacebookAuthorizationException; use Facebook\GraphObject; use Facebook\GraphUser; use Facebook\Entities\AccessToken; use Facebook\HttpClients\FacebookCurlHttpClient; use Facebook\HttpClients\FacebookHttpable; FacebookSession::setDefaultApplication(\query\main::get_option('facebook_appID'), \query\main::get_option('facebook_secret')); $helper = new FacebookRedirectLoginHelper($GLOBALS['siteURL'] . '?plugin=' . $_GET['plugin']); try { $session = $helper->getSessionFromRedirect(); } catch (FacebookRequestException $ex) { echo $ex->getMessage(); } catch (Exception $ex) { echo $ex->getMessage();
public function execute() { if (file_exists(THEMES_LOC . '/' . $this->template . '/functions.php')) { include THEMES_LOC . '/' . $this->template . '/functions.php'; } if ($redirect_to = \user\main::banned()) { if (!filter_var($redirect_to, FILTER_VALIDATE_URL)) { header('HTTP/1.0 403 Forbidden'); } else { header('Location: ' . $redirect_to); } die; } if (isset($_GET['ref'])) { setcookie('referrer', (int) $_GET['ref'], strtotime('+30 days')); } switch ($this->page_type) { case 'page': $this->page_page(); break; case 'single': $this->page_single(); break; case 'product': $this->page_product(); break; case 'category': $this->page_category(); break; case 'search': $this->page_search(); break; case 'store': $this->page_store(); break; case 'stores': $this->page_stores(); break; case 'reviews': $this->page_reviews(); break; case 'user': $this->page_user($this->id); break; case 'tpage': $this->page_tpage($this->id); break; case 'ajax': $this->ajax($this->id); break; case 'cron': $this->cron($this->id); break; case 'plugin': $this->plugin($this->id); break; default: $this->page_index(); break; } }