예제 #1
0
 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;
 }
예제 #2
0
        $field->setMultiple(true);
        $field->setId('pageadmin-content');
        $field->setSize(8);
        foreach (userPerm::getAll() as $name => $value) {
            $field->add($name, $value);
        }
    }
    if ($action == 'edit') {
        $form->addHiddenField('id', $id);
        $title = '"' . $form->get('firstname') . ' ' . $form->get('name') . '" ' . lang::get('edit');
    } else {
        $title = lang::get('add');
    }
    if ($form->isSubmit()) {
        if ($form->get('password') != $form->sql->getValue('password')) {
            $form->addPost('password', userLogin::hash($form->get('password'), $form->sql->getValue('salt')));
        }
    }
    $button = '<a href="' . url::backend('user', ['subpage' => 'overview']) . '" class="btn btn-sm btn-default">' . lang::get('back') . '</a>';
    ?>
	<div class="row"><?php 
    echo bootstrap::panel($title, [$button], $form->show());
    ?>
</div>
    <?php 
}
if ($action == '') {
    $table = table::factory();
    $table->addCollsLayout('*, 250,110');
    $table->addRow()->addCell("Name")->addCell(lang::get('email'))->addCell(lang::get('action'));
    $table->addSection('tbody');
예제 #3
0
파일: user.php 프로젝트: DINKIN/rokket
</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'));
            } else {
                foreach ($ids as $var) {
                    $sql = new sql();
                    $sql->setTable('user');
                    $sql->setWhere("id=" . $var);
                    $sql->delete();
                }
예제 #4
0
        if ($form->get('admin') == 1) {
            $field->addAttribute('style', 'display:none;');
        }
        $field->setMultiple(true);
        $field->setId('pageadmin-content');
        $field->setSize(8);
        foreach (userPerm::getAll() as $name => $value) {
            $field->add($name, $value);
        }
    }
    if ($action == 'edit') {
        $form->addHiddenField('id', $id);
    }
    if ($form->isSubmit()) {
        if ($form->get('password') != $form->sql->getValue('password')) {
            $form->addPost('password', userLogin::hash($form->get('password')));
        }
    }
    ?>
	<div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                	<?php 
    if ($action == 'edit') {
        ?>
                    	<h3 class="panel-title pull-left">"<?php 
        echo $form->get('firstname') . " " . $form->get('name');
        ?>
" <?php 
        echo lang::get('edit');
예제 #5
0
    public static function newInstall()
    {
        $sql = new sql();
        $sql->query('DROP TABLE `' . 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,
		  `sort`		int(16)		unsigned 	NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $sql->query('DROP TABLE `' . 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,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $sql->query('DROP TABLE `' . 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,
		  `perms`		varchar(255)			NOT NULL,
		  `admin`		int(1) 		unsigned	NOT NULL,
		  PRIMARY KEY  (`id`)
		) ENGINE=MyISAM  DEFAULT CHARSET=utf8;');
        $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')));
        $sql->addPost('admin', 1);
        $sql->save();
        $sql->query('DROP TABLE `' . sql::table('structure_area') . '`');
        $sql->query('CREATE TABLE `' . sql::table("structure_area") . '` (
		  `id`			int(16)		unsigned	NOT NULL		auto_increment,
		  `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 `' . 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 `' . sql::table('slots') . '`');
        $sql->query('CREATE TABLE `' . sql::table("slots") . '` (
		  `id` 			int(11) 	unsigned	NOT NULL	auto_increment,
		  `name` 		varchar(255)			NOT NULL,
		  `description`	varchar(255)			NOT NULL,
		  `template` 	varchar(255)			NOT NULL,
		  `modul`	 	int(11)		unsigned	NOT NULL,
		  `is-structure`int(1)		unsigned	NOT NULL	DEFAULT "1",
		  `structure` 	varchar(255)			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;');
    }