public static function registerUser() { $sql = sql::factory(); $sql->setTable('community_user'); $sql->getPosts(['username' => 'string', 'password' => 'string', 'email' => 'string']); $validator = new validator(); $email = $sql->getPost('email'); $username = $sql->getPost('username'); $password = $sql->getPost('password'); $validUsername = $validator->costum($username, function () { preg_match('/\\w{4,}/', $username, $match); return $match[0] == $username; }); if (!$validUsername) { return 'Username darf nur aus Buchstaben Zahlen und Unterstrich bestehen und muss mindestens 4 Zeichen lang sein.'; } if ($sql->num('SELECT id FROM ' . sql::table('community_user') . ' WHERE `username`= "' . $sql->escape($username) . '"')) { return 'Benutzername schon vorhanden'; } if (!$validator->email($email)) { return 'Bitte geben Sie eine E-Mail Adresse an'; } $salt = userLogin::generateSalt(); $sql->addDatePost('registerdate', 'now'); $sql->addPost('salt', $salt); extension::get('COMMUNITY_USER_REGISTER', $sql); $password = userLogin::hash($password, $salt); $sql->addPost('password', $password); $sql->save(); //Mail send return true; }
<button type="submit" name="send"><?php echo lang::get('apply'); ?> </button> </div> </div> </form> <?php } else { if (isset($_POST['sendNew'])) { $new = new sql(); $new->setTable('user'); $admin = isset($_POST['admin']) ? 1 : 0; $salt = userLogin::generateSalt(); $new->addPost('salt', $salt); $new->addPost('firstname', type::post('firstname')); $new->addPost('name', type::post('name')); $new->addPost('email', type::post('email')); $new->addPost('admin', $admin); $new->addPost('username', type::post('username')); $new->addPost('password', userLogin::hash(type::post('password'), $salt)); $new->save(); echo message::success(lang::get('user_added')); } if (isset($_POST['delete'])) { $ids = type::post('ids'); if (is_array($ids) && count($ids) >= 1) { if (in_array(rp::get('user')->get('id'), $ids)) { echo message::danger(lang::get('user_delete_own'));
public static function newInstall() { $sql = new sql(); $sql->query('DROP TABLE IF EXISTS `' . sql::table('module') . '`'); $sql->query('CREATE TABLE `' . sql::table("module") . '` ( `id` int(16) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, `input` text NOT NULL, `output` text NOT NULL, `blocks` int(1) unsigned NOT NULL, `sort` int(16) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); $sql->query('DROP TABLE IF EXISTS `' . sql::table('structure') . '`'); $sql->query('CREATE TABLE `' . sql::table("structure") . '` ( `id` int(16) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, `template` varchar(255) NOT NULL, `sort` int(16) unsigned NOT NULL, `parent_id` int(16) unsigned NOT NULL, `online` int(1) unsigned NOT NULL, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); $sql->query('DROP TABLE IF EXISTS `' . sql::table('user') . '`'); $sql->query('CREATE TABLE `' . sql::table("user") . '` ( `id` int(11) unsigned NOT NULL auto_increment, `firstname` varchar(255) NOT NULL, `name` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `salt` varchar(255) NOT NULL, `perms` varchar(255) NOT NULL, `admin` int(1) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); $salt = userLogin::generateSalt(); $sql->setTable('user'); $sql->addPost('firstname', type::post('firstname')); $sql->addPost('name', type::post('name')); $sql->addPost('email', type::post('email')); $sql->addPost('password', userLogin::hash(type::post('password'), $salt)); $sql->addPost('salt', $salt); $sql->addPost('admin', 1); $sql->save(); $sql->query('DROP TABLE IF EXISTS `' . sql::table('structure_area') . '`'); $sql->query('CREATE TABLE `' . sql::table("structure_area") . '` ( `id` int(16) unsigned NOT NULL auto_increment, `block` int(1) unsigned NOT NULL, `structure_id`int(16) unsigned NOT NULL, `sort` int(16) unsigned NOT NULL, `modul` int(16) unsigned NOT NULL, `online` int(1) unsigned NOT NULL, `value1` text NOT NULL, `value2` text NOT NULL, `value3` text NOT NULL, `value4` text NOT NULL, `value5` text NOT NULL, `value6` text NOT NULL, `value7` text NOT NULL, `value8` text NOT NULL, `value9` text NOT NULL, `value10` text NOT NULL, `value11` text NOT NULL, `value12` text NOT NULL, `value13` text NOT NULL, `value14` text NOT NULL, `value15` text NOT NULL, `link1` int(11) NOT NULL, `link2` int(11) NOT NULL, `link3` int(11) NOT NULL, `link4` int(11) NOT NULL, `link5` int(11) NOT NULL, `link6` int(11) NOT NULL, `link7` int(11) NOT NULL, `link8` int(11) NOT NULL, `link9` int(11) NOT NULL, `link10` int(11) NOT NULL, `linklist1` varchar(255) NOT NULL, `linklist2` varchar(255) NOT NULL, `linklist3` varchar(255) NOT NULL, `linklist4` varchar(255) NOT NULL, `linklist5` varchar(255) NOT NULL, `linklist6` varchar(255) NOT NULL, `linklist7` varchar(255) NOT NULL, `linklist8` varchar(255) NOT NULL, `linklist9` varchar(255) NOT NULL, `linklist10` varchar(255) NOT NULL, `php1` text NOT NULL, `php2` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); $sql->query('DROP TABLE IF EXISTS `' . sql::table('addons') . '`'); $sql->query('CREATE TABLE `' . sql::table("addons") . '` ( `id` int(11) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, `active` int(1) NOT NULL, `install` int(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); $sql->query('DROP TABLE IF EXISTS `' . sql::table('blocks') . '`'); $sql->query('CREATE TABLE `' . sql::table("blocks") . '` ( `id` int(11) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL, `description` varchar(255) NOT NULL, `template` varchar(255) NOT NULL, `is-structure`int(1) unsigned NOT NULL DEFAULT "1", `structure` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;'); }