* @license PHP License * @package WB * @subpackage base */ include dirname( __FILE__ ) . '/../../include/WB/Class.php'; $user = array(); $user[] = array( 'nickname' => 'gerd', 'emaillocal'=> 'gerd', 'emaildomain'=> 'php-tools.net', 'surname' => 'Schaufelberger', 'forename' => 'gERD', 'enabled' => 1, 'approved' => 1 ); $user[] = array( 'nickname' => 'asa', 'emaillocal'=> 'axel', 'emaildomain'=> 'example.com', 'surname' => 'Sauerhöfer', 'forename' => 'Axel', 'enabled' => 1, 'approved' => 1 ); $user[] = array( 'nickname' => 'joedoe', 'emaillocal'=> 'joedoe', 'emaildomain'=> 'example.com', 'surname' => 'Doe', 'forename' => 'Joe', 'enabled' => 1, 'approved' => 1 ); $user[] = array( 'nickname' => 'mandy', 'emaillocal'=> 'mandymueller', 'emaildomain'=> 'example.com', 'surname' => 'Müller', 'forename' => 'Mandy', 'enabled' => 1, 'approved' => 1 ); $user[] = array( 'nickname' => 'ronny', 'emaillocal'=> 'ronnyschmidt', 'emaildomain'=> 'example.com', 'surname' => 'Schmidt', 'forename' => 'Ronny', 'enabled' => 1, 'approved' => 1 ); $table = WBClass::create( 'WBDatasource_Table' ); /** @var $table WBDatasource_Table */ echo "
"; foreach ($user as $u) { echo 'user: ' . $u['nickname']; $clause = array(); $clause[] = array( 'field' => 'nickname', 'value' => $u['nickname'] ); $find = $table->get('user', null, null, $clause); if (count($find)) { echo " " . $find[0]['id'] . " - found\n"; continue; } $id = $table->save('user', '__new', $u); $pwd = array( 'password' => md5($id . ':' . $u['nickname'] . '123') ); $table->save('user', $id, $pwd); echo " $id - OK\n"; } ?>