X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;ds=sidebyside;f=register.php;h=fbcea845dc6f4f9fa11f67f69170eb472d296ba6;hb=8514e925abc8e170b9069e5b2a504519489e8002;hp=db6dcb86c35ec514dc3c186cbf528a31e64a9c0d;hpb=d134e3a3130a9bd2417be776e5a3a7f8f2467418;p=tt-rss.git
diff --git a/register.php b/register.php
index db6dcb86..fbcea845 100644
--- a/register.php
+++ b/register.php
@@ -4,28 +4,66 @@
// 1) templates/register_notice.txt - displayed above the registration form
// 2) register_expire_do.php - contains user expiration queries when necessary
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
+ set_include_path(get_include_path() . PATH_SEPARATOR .
+ dirname(__FILE__) . "/include");
- $action = $_REQUEST["action"];
+ require_once 'lib/phpmailer/class.phpmailer.php';
+ require_once "functions.php";
require_once "sessions.php";
-
require_once "sanity_check.php";
- require_once "functions.php";
require_once "config.php";
require_once "db.php";
-
- $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
- init_connection($link);
+ $action = $_REQUEST["action"];
+
+ $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
+
+ 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 */
if (DB_TYPE == "pgsql") {
- db_query($link, "DELETE FROM ttrss_users WHERE last_login IS NULL
+ db_query($link, "DELETE FROM ttrss_users WHERE last_login IS NULL
AND created < NOW() - INTERVAL '1 day' AND access_level = 0");
} else {
- db_query($link, "DELETE FROM ttrss_users WHERE last_login IS NULL
+ db_query($link, "DELETE FROM ttrss_users WHERE last_login IS NULL
AND created < DATE_SUB(NOW(), INTERVAL 1 DAY) AND access_level = 0");
}
@@ -40,7 +78,7 @@
$result = db_query($link, "SELECT id FROM ttrss_users WHERE
LOWER(login) = LOWER('$login')");
-
+
$is_registered = db_num_rows($result) > 0;
print "";
@@ -58,9 +96,9 @@
Create new account
-
-
-
+
+
+