Support https in blog URLs
[dotclear.git] / _public.php
index 84d05da..adc2d8b 100644 (file)
@@ -1,39 +1,22 @@
 <?php
-$core->url->register('xorgAuth', 'Xorg', '^auth/(.*)$', array('xorgAuthentifier', 'doAuth'));
 
-class xorgAuthWidget {
-  static public function widget(&$w) {
-    global $core;
-    if ($core->auth->xorg_infos['forlife']) {
-      return '<p>Tu es ' . $core->auth->xorg_infos['prenom'] . ' ' . $core->auth->xorg_infos['nom'] . '<br />'
-           . '<a href="auth/exit">déconnexion</a></p>';
-    } else {
-      return '<p><a href="auth/Xorg?path=' . $_SERVER['REQUEST_URI'] . '">M\'authentifier via Polytechnique.org</a></p>';
-    }
-  }
-}
+require_once dirname(__FILE__) . '/page.auth.php';
+require_once dirname(__FILE__) . '/widget.auth.php';
+require_once dirname(__FILE__) . '/widget.copyright.php';
+require_once dirname(__FILE__) . '/widget.post.perms.php';
+require_once dirname(__FILE__) . '/class.xorg.auth.php';
+require_once dirname(__FILE__) . '/page.webservice.php';
 
-class xorgAuthentifier extends dcUrlHandlers {
-  static public function doAuth($args) {
-    global $core;
-    switch ($args) {
-     case 'exit':
-      $core->auth->killSession();
-      break;
-     case 'Xorg':
-      if ($core->auth->callXorg($_GET['path'])) {
-        header('Location: http://murphy.m4x.org' . $_GET['path']);
-        exit;
-      }
-      break;
-     case 'XorgReturn':
-      $core->auth->returnXorg();
-      break;
-     default:
-      self::p404();
-    }
-    return;
-  }
+/* Xorg auth */
+$core->url->register('xorgAuth', 'XorgAuth', '^auth/(.*)$', array('xorgAuthentifier', 'doAuth'));
 
-}
+/* Declare the authentication widget on public page */
+$core->addBehavior('initWidgets', array('xorgAuthWidget', 'behavior_initWidgets'));
+$core->addBehavior('initWidgets', array('xorgCopyrightWidget', 'behavior_initWidgets'));
+
+/* Post permission handling */
+$core->addBehavior('coreBlogGetPosts', array('xorgPostPermsWidget', 'behavior_coreBlogGetPosts'));
+
+/* Webservice to create new blog */
+$core->url->register('xorgWebservice', 'XorgWebservice', '^xorgservice/(.*)$', array('XorgWebservice', 'handle'));
 ?>