Example #1
0
 /**
  * Search and include and returns (as string) the used language
  */
 private static function GetLanguage()
 {
     if (!empty(self::$Language)) {
         return self::$Language;
     }
     /* Find out, wich language should used */
     if (isset($_SESSION['UserID'])) {
         self::$Language = SBB::SQL()->GetObject()->Select('users', 'Language', 'ID="' . Session::Read('UserID') . '"', NULL, 1)->Language;
     } else {
         if (isset($_COOKIE['SBB_Lang'])) {
             self::$Language = $_COOKIE['SBB_Lang'];
         }
     }
     if (empty(self::$Language)) {
         self::$Language = SBB::SQL()->GetObject()->Select('language', 'Shortcut', 'DefaultLanguage=1', NULL, 1)->Shortcut;
     }
     /* Include the Languagefiles */
     if (!empty(self::$Language)) {
         $Dir = DIR_LANGUAGE . self::$Language . '/';
         if (is_dir($Dir)) {
             foreach (scandir($Dir) as $File) {
                 if (is_file($Dir . $File) && strpos($Dir . $File, '.php') !== false) {
                     require_once $Dir . $File;
                 }
             }
         } else {
             return false;
         }
     }
     return empty(self::$Language) ? false : self::$Language;
 }
Example #2
0
 public function __construct()
 {
     $this->Infos['Title'] = Language::Get('com.sbb.page.register');
     // If logged in, redirect to start page
     if (isset($_COOKIE['sbb_Token']) || Session::Read('UserID')) {
         header("Location: index.php");
     }
     $Message = '';
     if (isset($_POST['Register'])) {
         // Captcha doesn't work
         /*if($_POST['Captcha'] != $_SESSION['Captcha']) {
         			$message = '{lang=com.sbb.captcha.wrong}';
         		}
         		else*/
         if (Register::Check($_POST)) {
             User::Create($_POST['Username'], $_POST['Password'], $_POST['Email']);
             $Message = Language::Get('com.sbb.register.success');
         } else {
             $Message = '<b>' . Language::Get('com.sbb.error') . ':</b><ul><li>' . implode('</li><li>', Register::GetError()) . '</li></ul>';
         }
     }
     // F├╝llt die Variablen im TPL
     SBB::Template()->Assign(array('Message' => $Message, 'Page' => 'Register'));
 }
Example #3
0
 public static function Logout()
 {
     SBB::SQL()->Delete('session', 'Token = \'' . $_COOKIE['sbb_Token'] . '\'');
     SBB::SQL()->Delete('session', 'Token = \'' . Session::Read('Token') . '\'');
     Session::Remove('UserID');
     Session::Remove('Token');
     setcookie('sbb_Token', '', time() - 60 * 60 * 24 * 365);
 }