| 1 | <?php |
| 2 | class xorgAuthWidget { |
| 3 | public static function behavior_initWidgets($w) { |
| 4 | $w->create('XorgAuth', __('Auth. X.org'), array('xorgAuthWidget', 'widget')); |
| 5 | } |
| 6 | |
| 7 | static public function widget($w) { |
| 8 | global $core; |
| 9 | $name = @$core->auth->getInfo('user_displayname'); |
| 10 | if ($name) { |
| 11 | $str = '<div><ul><li><strong>Tu es ' . $core->auth->getInfo('user_displayname') . '</strong></li>'; |
| 12 | if ($core->auth->check('usage,contentadmin,admin', $core->blog->id)) { |
| 13 | $str .= '<li><a href="' . $core->blog->url . 'admin/index.php">Interface de rédaction</a></li>'; |
| 14 | } |
| 15 | return $str . '<li><a href="' . $core->blog->url . 'auth/exit">Déconnexion</a></li></ul></div>'; |
| 16 | } else { |
| 17 | return '<ul><li><a href="' . $core->blog->url . 'auth/Xorg?path=' . $_SERVER['PATH_INFO'] . '">M\'authentifier via Polytechnique.org</a></li></ul>'; |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | ?> |