summaryrefslogtreecommitdiffstats
path: root/include/preferences.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2009-04-25 00:33:14 -0700
committerArun Persaud <arun@nubati.net>2009-04-25 11:32:25 -0700
commita57cfa3be6ee0fbce336dc98e2862ac39f2b1add (patch)
treeb7e4fc46ca06b6147c005700fb2a092c5b13a080 /include/preferences.php
parent4cbc3848a891ac9addf10264d24a9f4273c5e355 (diff)
downloade-DoKo-a57cfa3be6ee0fbce336dc98e2862ac39f2b1add.tar.gz
e-DoKo-a57cfa3be6ee0fbce336dc98e2862ac39f2b1add.tar.bz2
e-DoKo-a57cfa3be6ee0fbce336dc98e2862ac39f2b1add.zip
NEW FEATURE: added OpenID support
Users can add and delete OpenIDs on the settings page and then log in user those OpenIds. They can also use their OpenIDs to register.
Diffstat (limited to 'include/preferences.php')
-rw-r--r--include/preferences.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/include/preferences.php b/include/preferences.php
index f42ae82..4abaf3b 100644
--- a/include/preferences.php
+++ b/include/preferences.php
@@ -5,6 +5,8 @@
if(!isset($HOST))
exit;
+include_once('openid.php');
+
$name = $_SESSION["name"];
$email = DB_get_email('name',$name);
$myid = DB_get_userid('email',$email);
@@ -20,6 +22,7 @@ $changed_autosetup = 0;
$changed_sorting = 0;
$changed_openforgames = 0;
$changed_vacation = 0;
+$changed_openid = 0;
display_user_menu($myid);
@@ -33,6 +36,20 @@ DB_update_user_timestamp($myid);
* update the database and track changes with a variable, so that
* we can later highlight the changed value
*/
+
+/* check for deleted openids */
+foreach($_REQUEST as $key=>$value)
+{
+ if(strstr($key,"delete-openid-"))
+ {
+ /* found and openid to delete */
+ $DelOpenID = substr(str_replace("_",".",$key),14);
+ DB_DetachOpenID($DelOpenID, $myid);
+ $changed_openid = 1;
+ }
+}
+
+
if(myisset('vacation_start','vacation_stop','vacation_comment') &&
($_REQUEST['vacation_start']!='' || $_REQUEST['vacation_stop']!='')
)
@@ -236,6 +253,12 @@ if(myisset("password0") && $_REQUEST["password0"]!="" )
/* error output below */
}
+if(myisset("openid_url") && $_REQUEST['openid_url']!='')
+ {
+ $openid_url = OpenIDUrlEncode($_REQUEST['openid_url']);
+ DB_AttachOpenID($openid_url, $myid);
+ }
+
/* get infos again in case they have changed */
$PREF = DB_get_PREF($myid);
$timezone = DB_get_user_timezone($myid);
@@ -386,6 +409,31 @@ echo " <tr><td>Password(new, retype): </td><td>",
" </td></tr>\n";
echo " </table>\n";
echo " </fieldset>\n";
+echo " <fieldset>\n";
+echo " <legend>OpenID</legend>\n";
+
+$openids = array();
+$openids = DB_GetOpenIDsByUser($myid);
+
+if(sizeof($openids))
+ {
+ echo " <table class=\"openid\">\n";
+ echo " <thead><tr><th>Delete?</th><th>OpenId</th></tr></thead>\n";
+ echo " <tbody>\n";
+ foreach ($openids as $ids)
+ {
+ $id=($ids[0]);
+ echo " <tr><td><input type=\"checkbox\" name=\"delete-openid-$id\" /></td><td>",$id, "</td></tr>\n";
+ }
+ echo " </tbody>\n";
+ echo " </table>\n";
+ }
+
+echo " add OpenID: ",
+ "<input type=\"text\" id=\"openid_url\" name=\"openid_url\" size=\"20\" maxlength=\"50\" />";
+if($changed_openid)
+ echo " Deleted some OpenIDs! <br />\n";
+echo " </fieldset>\n";
echo " <fieldset><legend>Submit</legend><input type=\"submit\" name=\"passwd\" value=\"set\" /></fieldset>\n";
echo " </form>\n";
echo "</div>\n";