/** * 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; }
public static function Check(array $Post) { $SQL = SBB::SQL(); if (!preg_match('/^[a-zA-Z0-9_\\-\\s]{4,32}$/', $Post['Username'])) { self::$Error[] = Language::Get('com.sbb.register.invalid_username'); } if ($Post['Password'] != $Post['PasswordRepeat']) { self::$Error[] = Language::Get('com.sbb.register.incorrect_password'); } if ($Post['Email'] != $Post['EmailRepeat']) { self::$Error[] = Language::Get('com.sbb.register.incorrect_email'); } if (!preg_match('/^[a-z0-9\\-_]+\\@[a-z0-9\\-]+\\.[a-z]{2,3}$/', $Post['Email'])) { self::$Error[] = Language::Get('com.sbb.register.invalid_email'); } $SQL->Select('users', 'UserName', 'Username = \'' . mysql_real_escape_string($Post['Username']) . '\''); if ($SQL->NumRows() == 1) { self::$Error[] = Language::Get('com.sbb.register.username_exist'); } $SQL->Select('users', 'Email', 'Email = \'' . mysql_real_escape_string($Post['Email']) . '\''); if ($SQL->NumRows() == 1) { self::$Error[] = Language::Get('com.sbb.register.email_exist'); } if (count(self::$Error) != 0) { return false; } return true; }
public static function CreateVariables() { $Objects = SBB::SQL()->GetObjects()->Select('config', 'ConfigVariable, ConfigValue', 'Type = \'VAR\''); $Variables = array(); if (isset($Objects)) { foreach ($Objects as $Variable) { $Variables[$Variable->ConfigVariable] = $Variable->ConfigValue; } } return $Variables; }
public static function Check(array $Post) { $SQL = SBB::SQL(); $SQL->Select('users', 'Salt, Password', 'Username = \'' . mysql_real_escape_string($Post['Username']) . '\'', '', 1); $Row = $SQL->FetchObject(); if ($SQL->NumRows() == 1) { if (User::EncryptPassword($Post['Password'], $Row->Salt) != $Row->Password) { self::$Error[] = Language::Get('com.sbb.login.wrong_password'); } else { return true; } } else { self::$Error[] = Language::Get('com.sbb.login.notexist_username'); } return false; }
public static function Load() { if (defined('CLASS_SBB')) { return false; } define('CLASS_SBB', ''); Autoloader::Register(); self::$Database = Database::GetDatabase(); self::SQL()->Connect(); Config::CreateConstants(); self::$Template = new Template(); self::$Page = Page::GetPage(); Menu::Render(); self::TemplateAssign(); // Compile self::Template()->Display('case.tpl'); }
public function __construct() { $this->Infos['Title'] = Language::Get('com.sbb.page.user'); if (isset($_GET['userID'])) { $UserInfos = array(); SBB::SQL()->Select('users', '*', 'ID = \'' . $_GET['userID'] . '\'', 1); $Row = SBB::SQL()->FetchArray(); $UserInfos[] = $Row; $Avatar = new Avatar($Row['Email'], 100); SBB::Template()->Assign(array('Page' => 'userPage', 'UserInfos' => $UserInfos, 'Avatar' => $Avatar)); } else { $Users = array(); SBB::SQL()->Select('users', '*'); while ($Row = SBB::SQL()->FetchObject) { $Users[] = $Row; } SBB::Template()->Assign(array('Page' => 'userList', 'Users' => $Users)); } }
public static function Render() { $Active = SBB::Page()->GetInfo('Menu'); if (isset(self::$ReservedLinks['menu.' . strtolower($Active)])) { $Active = 'menu.' . strtolower($Active); } $MenuList = array(); $Entries = SBB::SQL()->GetObjects()->Select('menu', '*', NULL, 'Position'); foreach ($Entries as $Row) { if (isset(self::$ReservedLinks[$Row->Target])) { $MenuList[] = array('Link' => self::$ReservedLinks[$Row->Target], 'Name' => Language::Get($Row->MenuName), 'Active' => $Active == $Row->Target ? true : false); } else { $Target = str_replace('?page=', '', $Row - Target); $Target = strpos($Target, '&') !== false ? strstr($Target, '&', true) : $Target; $MenuList[] = array('Link' => $Row->Target, 'Name' => Language::Get($Row->MenuName), 'Active' => $Active == $Target ? true : false); } } SBB::Template()->Assign(array('Menu' => $MenuList)); }
public function __construct() { $this->Infos['Title'] = Language::Get('com.sbb.page.profile'); // If logged in, redirect to start page if (!User::LoggedIn()) { header("Location: index.php"); } $Message = ''; if (isset($_POST['Submit'])) { if (User::CheckUpdate($_POST)) { User::Update(array('Homepage' => $_POST['Homepage'], 'Signatur' => $_POST['Signature'])); $Message = Language::Get('com.sbb.profile.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('Homepage' => User::Get('Homepage'), 'Signature' => User::Get('Signatur'), 'Message' => $Message, 'Page' => 'Profile')); }
public function __construct() { $this->Infos['Title'] = Language::Get('com.sbb.page.login'); // If logged in, redirect to start page if (isset($_COOKIE['sbb_Token']) || session::Read('UserID')) { header("Location: index.php"); } $Message = ''; if (isset($_POST['Login'])) { if (Login::Check($_POST)) { SBB::SQL()->Select('users', 'ID', 'Username = \'' . mysql_real_escape_string($_POST['Username']) . '\'', '', 1); $UserID = SBB::SQL()->FetchObject()->ID; User::Login($UserID, $_POST['StayLoggedIn']); $Message = Language::Get('com.sbb.login.success'); header('Location: index.php'); } else { $Message = '<b>' . Language::Get('com.sbb.error') . ':</b><ul><li>' . implode('</li><li>', Login::GetError()) . '</li></ul>'; } } SBB::Template()->Assign(array('Page' => 'Login', 'Message' => $Message)); }
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')); }
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); }
public function __construct() { $this->Infos['Title'] = Language::Get('com.sbb.page.error'); $Type = isset($_GET['type']) ? $_GET['type'] : 404; SBB::Template()->Assign(array('Page' => 'Error', 'ErrorType' => $Type)); }
public function __construct() { $this->Infos['Title'] = Language::Get('com.sbb.page.board'); SBB::Template()->Assign(array('Page' => 'Board')); }
*/ // PHP Initial ini_set('display_errors', 1); ini_set('unserialize_callback_func', 'spl_autoload_call'); date_default_timezone_set('Europe/Berlin'); error_reporting(E_ALL ^ E_NOTICE | E_STRICT); session_start(); // Define "lib" directory constant if (!defined('DIR_LIB')) { define('DIR_LIB', dirname(__FILE__) . '/'); } // Include required files require_once 'includes/config.inc.php'; require_once 'includes/constants.inc.php'; require_once 'core/SBB.class.php'; SBB::Load(); /* // Initial Classes Autoloader::Register(); MySQL::Connect(CFG_DB_HOST, CFG_DB_USER, CFG_DB_PASSWORD, CFG_DB_DATABASE); // TODO: UPDATE TO SQL-CLASS Template::Initial(); SBB::Load(); // Initial Silex Board Core // Post Initial -> Catching Infos SBB::Language()->Assign(); Template::Assign(array( 'Site' => 'Seitenname', 'DIR_STYLE' => DIR_STYLE, 'DIR_JS' => DIR_JS, 'Load' => '~Load: '.round(((microtime(true) - $GeneratingTime) * 1000), 2).'ms') );
<?php /** * @author Nox Nebula * @copyright © 2011 Silex Bulletin Board - Team * @license GNU GENERAL PUBLIC LICENSE - Version 3 * @package SilexBoard */ /* Langfile: English */ self::$Items = array_merge(self::$Items, array('com.sbb.error' => 'Error', 'com.sbb.copyright' => 'Forum software: Silex Bulletin Board ' . SILEX_VERSION . ' – © 2011 silexboard.org', 'com.sbb.language.info' => 'English', 'com.sbb.language.changed' => 'Your Language was changed to ' . SBB::Template()->Get('LangChangedTo') . '.', 'com.sbb.header.welcome' => 'Welcome', 'com.sbb.header.welcome_text' => 'Welcome on ' . SBB::Template()->Get('PageTitle') . ' - ' . SBB::Template()->Get('PageSlogan'), 'com.sbb.header.logo_title' => 'Frontpage', 'com.sbb.header.slogan' => 'The modern Bulletin Board Software', 'com.sbb.menu.home' => 'Home', 'com.sbb.menu.forum' => 'Forum', 'com.sbb.menu.userlist' => 'Memberlist', 'com.sbb.crumbs.home' => 'Home', 'com.sbb.crumbs.forum' => 'Forum', 'com.sbb.crumbs.user' => 'Memberlist', 'com.sbb.register.register' => 'Sign up', 'com.sbb.register.username' => 'Username', 'com.sbb.register.email' => 'E-mail address', 'com.sbb.register.email_repeat' => 'Repeat E-mail address', 'com.sbb.register.password' => 'Password', 'com.sbb.register.password_repeat' => 'Repeat password', 'com.sbb.register.invalid_username' => 'Invalid username', 'com.sbb.register.invalid_email' => 'Invalid e-mail adress', 'com.sbb.register.incorrect_password' => 'The passwords don\'t match', 'com.sbb.register.incorrect_email' => 'The e-mail adresses don\'t match', 'com.sbb.register.username_exist' => 'This username already exists!', 'com.sbb.register.email_exist' => 'This e-mail adress already exists!', 'com.sbb.register.success' => 'You are successfully registered!', 'com.sbb.login.login' => 'Log in', 'com.sbb.login.stay' => 'Stay logged in', 'com.sbb.login.bar_handle' => 'Log in/Sign up', 'com.sbb.login.username' => 'Username', 'com.sbb.login.password' => 'Password', 'com.sbb.login.wrong_password' => 'The password is wrong!', 'com.sbb.login.notexist_username' => 'This user doesn\'t exist!', 'com.sbb.login.success' => 'You are successfully logged in!', 'com.sbb.form.submit' => 'Submit', 'com.sbb.logout.logout' => 'Logout', 'com.sbb.logout.logged_out' => 'You are logged out now.', 'com.sbb.logout.main_menu' => 'Main Menu', 'com.sbb.logout.never_logged_in' => 'You are never logged in.', 'com.sbb.profile.homepage' => 'Homepage', 'com.sbb.profile.signature' => 'Signature', 'com.sbb.board.empty' => 'Currently the Board is empty.', 'com.sbb.board.not_categorized' => 'Not categorized', 'com.sbb.board.error.no_board' => 'This forum doesn\'t exists', 'com.sbb.topics.error.no_topics' => 'There are no topics.', 'com.sbb.captcha' => 'Captcha', 'com.sbb.captcha_wrong' => 'Captcha is wrong!', 'com.sbb.email.activation.title' => 'Your registration will be completed if you follow this link: ', 'com.sbb.config.style.default' => 'Default style', 'com.sbb.config.page.title' => 'Page title'));
<?php /** * @author Nox Nebula * @copyright © 2011 Silex Bulletin Board - Team * @license GNU GENERAL PUBLIC LICENSE - Version 3 * @package SilexBoard */ /* Langfile: German */ self::$Items = array_merge(self::$Items, array('com.sbb.error' => 'Fehler', 'com.sbb.copyright' => 'Forensoftware: Silex Bulletin Board ' . SILEX_VERSION . ' – © 2011 silexboard.org', 'com.sbb.language.info' => 'Deutsch (Informal)', 'com.sbb.language.changed' => 'Deine Sprache wurde nach ' . SBB::Template()->Get('LangChangedTo') . ' geändert', 'com.sbb.header.welcome' => 'Willkommen', 'com.sbb.header.welcome_text' => 'Herzlich willkommen auf ' . SBB::Template()->Get('PageTitle') . ' - ' . SBB::Template()->Get('PageSlogan'), 'com.sbb.header.logo_title' => 'Startseite', 'com.sbb.header.slogan' => 'Die moderne Bulletin-Board-Software', 'com.sbb.menu.home' => 'Startseite', 'com.sbb.menu.forum' => 'Forum', 'com.sbb.menu.userlist' => 'Benutzerliste', 'com.sbb.crumbs.home' => 'Startseite', 'com.sbb.crumbs.forum' => 'Forum', 'com.sbb.crumbs.user' => 'Benutzerliste', 'com.sbb.register.register' => 'Registrieren', 'com.sbb.register.username' => 'Benutzername', 'com.sbb.register.email' => 'E-mail Adresse', 'com.sbb.register.email_repeat' => 'E-mail Adresse wiederholen', 'com.sbb.register.password' => 'Passwort', 'com.sbb.register.password_repeat' => 'Passwort wiederholen', 'com.sbb.register.invalid_username' => 'Ungültiger Benutzername', 'com.sbb.register.invalid_email' => 'Ungültige E-Mail Adresse', 'com.sbb.register.incorrect_password' => 'Die Passwörter stimmen nicht überein', 'com.sbb.register.incorrect_email' => 'Die E-Mail Adressen stimmen nicht überein', 'com.sbb.register.username_exist' => 'Dieser Benutzername existiert bereits!', 'com.sbb.register.email_exist' => 'Diese E-Mail Adresse existiert bereits!', 'com.sbb.register.success' => 'Du hast dich erfolgreich registriert!', 'com.sbb.login.login' => 'Einloggen', 'com.sbb.login.bar_handle' => 'Einloggen/Registrieren', 'com.sbb.login.username' => 'Benutzername', 'com.sbb.login.password' => 'Passwort', 'com.sbb.login.stay' => 'Eingeloggt bleiben', 'com.sbb.login.wrong_password' => 'Das Passwort ist falsch!', 'com.sbb.login.notexist_username' => 'Dieser Benutzer existiert nicht!', 'com.sbb.login.success' => 'Du hast dich erfolgreich angemeldet!', 'com.sbb.form.submit' => 'Absenden', 'com.sbb.logout.logout' => 'Ausloggen', 'com.sbb.logout.logged_out' => 'Sie sind jetzt ausgeloggt.', 'com.sbb.logout.main_menu' => 'Hauptmenü,', 'com.sbb.logout.never_logged_in' => 'Sie waren niemals eingeloggt.', 'com.sbb.profile.homepage' => 'Homepage', 'com.sbb.profile.signature' => 'Signatur', 'com.sbb.board.empty' => 'Zurzeit ist das Board leer.', 'com.sbb.board.not_categorized' => 'Nicht Kategorisiert', 'com.sbb.board.error.no_board' => 'Das Forum existiert nicht', 'com.sbb.topics.error.no_topics' => 'Es gibt keine Themen.', 'com.sbb.captcha' => 'Captcha', 'com.sbb.captcha_wrong' => 'Captcha ist falsch!', 'com.sbb.email.activation.title' => 'Du musst diesen Link klicken um deine Registrierung abzuschließen: ', 'com.sbb.config.style.default' => 'Standardstil', 'com.sbb.config.page.title' => 'Seitentitel'));