summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-11-18 10:00:18 +0100
committerAndrew Dolgov <[email protected]>2005-11-18 10:00:18 +0100
commite6cb77a07ad5ff4b7d43aa00fdf1fc810bfebf69 (patch)
tree9b02156c3d1debc5530b1ec6b671ce54f700e53b /functions.php
parentcd42edf18dac1955a4046cc68a790aaf77cd6536 (diff)
user manager
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index 9841f95c9..3985890b1 100644
--- a/functions.php
+++ b/functions.php
@@ -553,4 +553,41 @@
}
}
+ function make_password($length = 8) {
+
+ $password = "";
+ $possible = "0123456789bcdfghjkmnpqrstvwxyz";
+
+ $i = 0;
+
+ while ($i < $length) {
+ $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
+
+ if (!strstr($password, $char)) {
+ $password .= $char;
+ $i++;
+ }
+ }
+ return $password;
+ }
+
+ // this is called after user is created to initialize default feeds, labels
+ // or whatever else
+
+ // user preferences are checked on every login, not here
+
+ function initialize_user($link, $uid) {
+
+ db_query($link, "insert into ttrss_labels (owner_uid,sql_exp,description)
+ values ('$uid','unread = true', 'Unread articles')");
+
+ db_query($link, "insert into ttrss_labels (owner_uid,sql_exp,description)
+ values ('$uid','last_read is null and unread = false', 'Updated articles')");
+
+ db_query($link, "insert into ttrss_feeds (owner_uid,title,feed_url)
+ values ('$uid', 'Tiny Tiny RSS Dev. Feed',
+ 'http://bah.spb.su/darcsweb/darcsweb.cgi?r=tt-rss;a=rss')");
+
+ }
+
?>