$message = $l['log-forgot-email']; $message = str_replace('%USERNAME%', $client->get('username'), $message); $message = str_replace('%PASSWORD%', $newpass, $message); $message = str_replace('%LINK%', $link, $message); $mail->AddAddress($client->get('email'), $client->get('username')); $mail->Subject = $config->get('site_name') . $l['log-forgot-subject']; $mail->Body = $message; if (!$mail->Send()) { // if we can't send the email, then don't write the // new password in the db $ets->page_body = $l['log-forgot-failed']; break; } else { // email was sent, set the password to something new $client->set('password', $hash); $client->updateDB(); $ets->page_body = $l['log-forgot-success']; } } } } if (empty($_POST) || !empty($err)) { if (!empty($err)) { $ets->page_body = input_error_box($err); } // build input $form->action = script_path . 'login.php?action=forgot'; $form->method = 'post'; $form->class = 'nlb_form'; $form->name = 'new_entry'; $table->class = 'nlb_table';
} 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']; if ($sent) { $ets->page_body .= $l['reg-checkmail']; } } } if (empty($_POST) || $baddata) { if (!empty($_POST) && $text->is_missing_required) { foreach ($text->missing_fields as $miss) { $problems[] = $l['missing-field'] . $miss; } $baddata = true; }
foreach (array('subject', 'custom', 'body', 'mood', 'bb', 'html', 'smiles') as $item) { $update->setItem($item, $c[$item]); } // deal with comments. if (empty($c['comments'])) { // comments are allowed $update->recountComments(); } else { // no comments $update->setItem('comments', -1); } // deal with blog count $author->recountBlogs(); // set it in stone $update->updateToDB(); $author->updateDB(); $ets->page_body = $l['goodedit']; } } } if (empty($_POST) || $baddata) { /** * Build input */ // check for problems. if (!empty($_POST) && $text->is_missing_required) { $baddata = true; foreach ($text->missing_fields as $miss) { $problems[] = $l['missing-field'] . $miss; } }