X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;ds=sidebyside;f=register.php;h=d63fc251affd8d8a779de81d445291b7dd38b6b0;hb=07391e36b8d8c4cfadcebe47046829457178cbba;hp=fb6261bafc28c3378e0e59a819540406cf803fac;hpb=133ab8c713b28e41c2628f02f176ef8b5a0b524d;p=tt-rss.git
diff --git a/register.php b/register.php
index fb6261ba..d63fc251 100644
--- a/register.php
+++ b/register.php
@@ -4,6 +4,10 @@
// 1) templates/register_notice.txt - displayed above the registration form
// 2) register_expire_do.php - contains user expiration queries when necessary
+ set_include_path(get_include_path() . PATH_SEPARATOR . "include");
+
+ require_once 'lib/phpmailer/class.phpmailer.php';
+
$action = $_REQUEST["action"];
require_once "functions.php";
@@ -14,7 +18,43 @@
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
- init_connection($link);
+ if (!init_connection($link)) return;
+
+ if ($_REQUEST["format"] == "feed") {
+ header("Content-Type: text/xml");
+
+ print '';
+ print "
+ ".htmlspecialchars(SELF_URL_PATH . "/register.php")."
+ Tiny Tiny RSS registration slots
+
+ ";
+
+ if (ENABLE_REGISTRATION) {
+ $result = db_query($link, "SELECT COUNT(*) AS cu FROM ttrss_users");
+ $num_users = db_fetch_result($result, 0, "cu");
+
+ $num_users = REG_MAX_USERS - $num_users;
+ if ($num_users < 0) $num_users = 0;
+ $reg_suffix = "enabled";
+ } else {
+ $num_users = 0;
+ $reg_suffix = "disabled";
+ }
+
+ print "
+ ".htmlspecialchars(SELF_URL_PATH)."/register.php?$num_users"."
+ ";
+
+ print "$num_users slots are currently available, registration $reg_suffix";
+ print "$num_users slots are currently available, registration $reg_suffix";
+
+ print "";
+
+ print "";
+
+ return;
+ }
/* Remove users which didn't login after receiving their registration information */
@@ -55,7 +95,7 @@
Create new account
-
+
@@ -140,7 +180,7 @@
-
+
@@ -148,7 +188,8 @@
if (!ENABLE_REGISTRATION) {
print_error(__("New user registrations are administratively disabled."));
- print "";
return;
@@ -181,19 +222,19 @@
|
- |
+ | |
|
- |
+ | |
|
+ disabled="disabled" onclick='return validateRegForm()'>
|
- "; ?>
@@ -206,7 +247,7 @@
if (!$login || !$email || !$test) {
print_error(__("Your registration information is incomplete."));
- print "";
return;
@@ -221,7 +262,7 @@
if ($is_registered) {
print_error(__('Sorry, this username is already taken.'));
- print "";
} else {
@@ -239,7 +280,7 @@
if (db_num_rows($result) != 1) {
print_error(__('Registration failed.'));
- print "";
} else {
@@ -270,15 +311,15 @@
$mail->CharSet = "UTF-8";
- $mail->From = DIGEST_FROM_ADDRESS;
- $mail->FromName = DIGEST_FROM_NAME;
+ $mail->From = SMTP_FROM_ADDRESS;
+ $mail->FromName = SMTP_FROM_NAME;
$mail->AddAddress($email);
- if (DIGEST_SMTP_HOST) {
- $mail->Host = DIGEST_SMTP_HOST;
+ if (SMTP_HOST) {
+ $mail->Host = SMTP_HOST;
$mail->Mailer = "smtp";
- $mail->Username = DIGEST_SMTP_LOGIN;
- $mail->Password = DIGEST_SMTP_PASSWORD;
+ $mail->Username = SMTP_LOGIN;
+ $mail->Password = SMTP_PASSWORD;
}
// $mail->IsHTML(true);
@@ -304,15 +345,15 @@
$mail->CharSet = "UTF-8";
- $mail->From = DIGEST_FROM_ADDRESS;
- $mail->FromName = DIGEST_FROM_NAME;
+ $mail->From = SMTP_FROM_ADDRESS;
+ $mail->FromName = SMTP_FROM_NAME;
$mail->AddAddress(REG_NOTIFY_ADDRESS);
- if (DIGEST_SMTP_HOST) {
- $mail->Host = DIGEST_SMTP_HOST;
+ if (SMTP_HOST) {
+ $mail->Host = SMTP_HOST;
$mail->Mailer = "smtp";
- $mail->Username = DIGEST_SMTP_LOGIN;
- $mail->Password = DIGEST_SMTP_PASSWORD;
+ $mail->Username = SMTP_LOGIN;
+ $mail->Password = SMTP_PASSWORD;
}
// $mail->IsHTML(true);
@@ -324,7 +365,7 @@
print_notice(__("Account created successfully."));
- print "";
@@ -334,7 +375,7 @@
} else {
print_error('Plese check the form again, you have failed the robot test.');
- print "";
@@ -346,7 +387,7 @@
- "; ?>