Structures the classes:
[dotclear.git] / widget.auth.php
diff --git a/widget.auth.php b/widget.auth.php
new file mode 100644 (file)
index 0000000..fd6bd83
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+class xorgAuthWidget {
+  public static function behavior_initWidgets(&$w) {
+    $w->create('XorgAuth', __('Auth. X.org'), array('xorgAuthWidget', 'widget'));
+  }
+
+  static public function widget(&$w) {
+    global $core;
+    $name = $core->auth->userID();
+    if ($name) {
+      return '<p>Tu es ' . $core->auth->getInfo('user_displayname') . '<br />'
+           . '<a href="' . $core->blog->url . 'auth/exit">déconnexion</a></p>';
+    } else {
+      return '<p><a href="' . $core->blog->url . 'auth/Xorg?path=' . $_SERVER['REQUEST_URI'] . '">M\'authentifier via Polytechnique.org</a></p>';
+    }
+  }
+}
+
+?>