New Copyright widget.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 3 Jun 2008 22:31:58 +0000 (00:31 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 3 Jun 2008 22:31:58 +0000 (00:31 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
_admin.php
_public.php
widget.copyright.php [new file with mode: 0644]

index 8cbb165..3e21539 100644 (file)
@@ -1,6 +1,7 @@
 <?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__) . '/widget.blog.owner.php';
 
@@ -9,6 +10,7 @@ $core->addBehavior('coreBlogConstruct', array('xorgAuth', 'behavior_coreBlogCons
 
 /* Declare the authentication widget on public page */
 $core->addBehavior('initWidgets', array('xorgAuthWidget', 'behavior_initWidgets'));
+$core->addBehavior('initWidgets', array('xorgCopyrightWidget', 'behavior_initWidgets'));
 
 
 /* Declare stuff to set permissions on each post */
index a962ea5..c67db8b 100644 (file)
@@ -2,6 +2,7 @@
 
 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';
diff --git a/widget.copyright.php b/widget.copyright.php
new file mode 100644 (file)
index 0000000..1cf240d
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+class xorgCopyrightWidget {
+  public static function behavior_initWidgets(&$w) {
+    $w->create('XorgCopyright', __('Copyright'), array('xorgCopyrightWidget', 'widget'));
+  }
+
+  static public function widget(&$w) {
+    global $core;
+    $copyright = $core->blog->settings->get('copyright_notice');
+    $editor    = $core->blog->settings->get('editor');
+
+    $text = '<div><h2>Mentions légales</h2><ul>';
+    if ($editor) {
+      $text .= '<li>Editeur&nbsp;: ' . $editor . '</li>';
+    }
+    $text .= '<li>Hébergé par <a href="http://xorg.polytechnique.org">Polytechnique.org</a></li>';
+    if ($copyright) {
+      $text .= '<li>' . $copyright . '</li>';
+    }
+    return $text . '</ul></div>';
+  }
+}
+
+?>