Exemplo n.º 1
0
 if (!$baddata) {
     /**
      *      A D D   U S E R
      */
     $text->makeClean('slash_if_needed', 'trim');
     $c = $text->clean;
     $timezone = $c['timezone'] - 13;
     $new = array('username' => $c['username'], 'password' => md5($c['password']), 'email' => $c['email'], 'access' => $config->get('default_access'), 'registered' => time(), 'last_login' => time(), 'ip' => $_SERVER['REMOTE_ADDR'], 'blog_count' => 0, 'timezone' => $timezone, 'bio' => "", 'custom' => $c['custom'], 'date_format' => $config->get('default_date_format'), 'birthday' => "", 'perpage' => 10, 'gender' => 0);
     $check_email = $config->get('validate_email');
     if ($check_email == "true") {
         // include mail class thing.
         $new['valid'] = 0;
     } else {
         $new['valid'] = 1;
     }
     $id = $user->newUser($new);
     unset($user);
     $user = new nlb_user($db, $id);
     // add template into DB.
     $date = 1000000;
     // make the cache in the past so ETS will update it.
     $db->query('INSERT INTO ' . db_source . " ( \r\n\t\t`owner_id` , `blog` , `blog_updated` , `friends` , `friends_updated` , `profile` , `profile_updated` )\r\n\t\tVALUES (\r\n\t\t'{$id}', 'empty', '{$date}', 'empty', '{$date}', 'empty', '{$date}'\r\n\t\t);");
     $db->query('INSERT INTO ' . db_cache . " ( \r\n\t\t`owner_id` , `blog` , `blog_updated` , `friends` , `friends_updated` , `profile` , `profile_updated` )\r\n\t\tVALUES (\r\n\t\t'{$id}', 'empty', '{$date}', 'empty', '{$date}', 'empty', '{$date}'\r\n\t\t);");
     $user->setTemplateSource($clean['template'], $config->get('home_text'));
     // did the first user just register?
     if ($id == 1) {
         $user->grant('admin');
         $user->updateDB();
     }
     $sent = $user->validateEmail($config);
     $ets->page_body = $l['reg-done'];