aboutsummaryrefslogtreecommitdiff
path: root/views/default/openid_server
diff options
context:
space:
mode:
authorPablo Martin <caedes@sindominio.net>2012-10-17 02:38:11 +0000
committerPablo Martin <caedes@sindominio.net>2012-10-17 02:38:11 +0000
commit0b8b67d74a51586c5a45012e9e0f7bbe54f7e954 (patch)
treec091196f6359bc7d6aa0c39b3ec061e0c2c7c983 /views/default/openid_server
downloadelgg-0b8b67d74a51586c5a45012e9e0f7bbe54f7e954.tar.gz
elgg-0b8b67d74a51586c5a45012e9e0f7bbe54f7e954.tar.bz2
Elgg OpenID server adapted for Elgg 1.8.
Diffstat (limited to 'views/default/openid_server')
-rwxr-xr-xviews/default/openid_server/forms/admin.php154
-rwxr-xr-xviews/default/openid_server/forms/autologin.php22
-rwxr-xr-xviews/default/openid_server/forms/autologout.php24
-rwxr-xr-xviews/default/openid_server/forms/trust.php35
-rwxr-xr-xviews/default/openid_server/metatags.php16
-rwxr-xr-xviews/default/openid_server/metatags.php.old23
6 files changed, 274 insertions, 0 deletions
diff --git a/views/default/openid_server/forms/admin.php b/views/default/openid_server/forms/admin.php
new file mode 100755
index 000000000..e19a97e8e
--- /dev/null
+++ b/views/default/openid_server/forms/admin.php
@@ -0,0 +1,154 @@
+<?php
+
+/**
+ * Elgg openid_server trust page
+ *
+ * @package openid_server
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardiner <kevin@radagast.biz>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ *
+ * @uses the following values in $vars:
+ *
+ * 'trust' the trust object with the database information and action type
+ */
+
+global $CONFIG;
+
+$trust = $vars['trust'];
+
+if (!$trust->ident) {
+ $trust->ident = 0;
+}
+
+$trust_root_msg = elgg_echo('openid_server:trust_root');
+$trust_site_msg = elgg_echo('openid_server:trust_site');
+$auto_login_msg = elgg_echo('openid_server:autologin_url');
+$auto_logout_msg = elgg_echo('openid_server:autologout_url');
+$iframe_width_msg = elgg_echo('openid_server:iframe_width');
+$iframe_height_msg = elgg_echo('openid_server:iframe_height');
+$explanation = elgg_echo('openid_server:admin_explanation');
+if ($trust->action == 'change') {
+ $button_msg = elgg_echo('openid_server:change_button');
+} else {
+ $button_msg = elgg_echo('openid_server:add_button');
+}
+
+
+$form = <<< END
+ <style type="text/css">
+ label,input {
+ display: block;
+ float: left;
+ margin-bottom: 5px;
+ }
+ label {
+ text-align: left;
+ width: 125px;
+ padding-right: 20px;
+ }
+ br {
+ clear: left;
+ }
+ </style>
+ $explanation
+ <form action="{$CONFIG->wwwroot}mod/openid_server/actions/admin.php" method="post">
+ <label for="trust_root">$trust_root_msg:</label> <input type="text" name="trust_root" size="80" value="{$trust->trust_root}"><br />
+ <label for="site_name">$trust_site_msg:</label> <input type="text" name="site_name" value="{$trust->site_name}"><br />
+ <label for="auto_login">$auto_login_msg:</label> <input type="text" name="auto_login" size="80" value="{$trust->auto_login}"><br />
+ <label for="auto_logout">$auto_logout_msg:</label> <input type="text" name="auto_logout" size="80" value="{$trust->auto_logout}"><br />
+ <label for="width">$iframe_width_msg:</label> <input type="text" name="width" size="10" value="{$trust->width}"><br />
+ <label for="height">$iframe_height_msg:</label> <input type="text" name="height" size="10" value="{$trust->height}"><br />
+ <input type="hidden" name="action" value="{$trust->action}">
+ <input type="hidden" name="trust_id" value="{$trust->ident}">
+ <input type="submit" name="submit" value="$button_msg">
+ </form>
+END;
+ return $form;
+}
+
+
+if (logged_on && run("users:flags:get", array("admin", $_SESSION['userid']))) {
+ $action = trim(optional_param('action'));
+ $trust_id = optional_param('trust_id',0,PARAM_INT);
+ $show_full_form = true;
+ $body = '';
+ if ($action) {
+ $trust = new StdClass;
+ $trust->trust_root = optional_param('trust_root');
+ $trust->site_name = optional_param('site_name');
+ $trust->auto_login = optional_param('auto_login');
+ $trust->auto_logout = optional_param('auto_logout');
+ $trust->width = optional_param('width');
+ $trust->height = optional_param('height');
+
+ switch($action) {
+ case 'change':
+ $trust->ident = $trust_id;
+ update_record('openid_server_trust',$trust);
+ $messages[] = gettext("Trust root updated");
+ break;
+ case 'add':
+ insert_record('openid_server_trust',$trust,false);
+ $messages[] = gettext("Trust root added");
+ break;
+ case 'delete':
+ delete_records('openid_server_trust','ident',$trust_id);
+ $messages[] = gettext("Trust root deleted");
+ break;
+ }
+ } else {
+ if ($trust_id) {
+ $trust = get_record('openid_server_trust','ident',$trust_id);
+ $trust->action = 'change';
+ $body = generate_trust_form($trust);
+ $title = gettext("Edit trust record");
+ $show_full_form = false;
+ }
+ }
+
+ if ($show_full_form) {
+ $edit_url = $CFG->wwwroot.'mod/openid_server/admin.php?trust_id=';
+ $delete_url = $CFG->wwwroot.'mod/openid_server/admin.php?action=delete&trust_id=';
+ $title = gettext("Manage default trust roots");
+ $results = get_records_sql("SELECT ident, site_name, trust_root FROM {$CFG->prefix}openid_server_trust WHERE openid_url IS NULL OR openid_url = ''");
+ if ($results) {
+ $body .= '<h2>'.gettext("Default trust roots").'</h2>'."\n";
+ $body.= '<table border="0">'."\n";
+ foreach($results as $item) {
+ $body .= '<tr><td width="150">'.$item->site_name.'</td><td width="250">'.$item->trust_root.'</td><td><a href="'
+ .$edit_url.$item->ident.'">'.gettext("Edit").'</a></td><td><a href="'
+ .$delete_url.$item->ident.'">'.gettext("Delete").'</a></td></tr>'."\n";
+ }
+ }
+ $body .= "</table>\n";
+ $body .= '<h2>'.gettext("Add default trust root").'</h2>';
+ $trust = new StdClass;
+ $trust->trust_root = '';
+ $trust->site_name = '';
+ $trust->auto_login = '';
+ $trust->auto_logout = '';
+ $trust->width = 0;
+ $trust->height = 0;
+ $trust->action = 'add';
+ $body .= generate_trust_form($trust);
+ }
+}
+
+define("context", "admin");
+
+templates_page_setup();
+
+echo templates_page_draw( array(
+ sitename,
+ templates_draw(array(
+ 'body' => $body,
+ 'title' => $title,
+ 'context' => 'contentholder'
+ )
+ )
+ )
+ );
+
+?>
diff --git a/views/default/openid_server/forms/autologin.php b/views/default/openid_server/forms/autologin.php
new file mode 100755
index 000000000..6880e1543
--- /dev/null
+++ b/views/default/openid_server/forms/autologin.php
@@ -0,0 +1,22 @@
+<!--
+/**
+ * Elgg openid_server: autologin form view
+ *
+ * @package ElggOpenID
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+-->
+<html>
+<head>
+<title>
+<?php echo elgg_echo('openid_server:autologin_title'); ?>
+</title>
+<meta http-equiv="refresh" content="3;<?php echo $vars['return_url']; ?>"/>
+</head>
+<body>
+<?php echo elgg_echo('openid_server:autologin_body')."<br /><br />\n".$vars['iframes'] ?>
+</body>
+</html> \ No newline at end of file
diff --git a/views/default/openid_server/forms/autologout.php b/views/default/openid_server/forms/autologout.php
new file mode 100755
index 000000000..86b5c9682
--- /dev/null
+++ b/views/default/openid_server/forms/autologout.php
@@ -0,0 +1,24 @@
+<!--
+/**
+ * Elgg openid_server: autologout form view
+ *
+ * @package ElggOpenID
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+ -->
+
+<html>
+<head>
+<title>
+<?php echo elgg_echo('openid_server:autologout_title'); ?>
+</title>
+<meta http-equiv="refresh" content="3;<?php echo $CONFIG->wwwroot; ?>"/>
+</head>
+<body>
+<?php echo elgg_echo('openid_server:autologout_body')."<br /><br />\n".$vars['iframes'] ?>
+</body>
+</html> \ No newline at end of file
diff --git a/views/default/openid_server/forms/trust.php b/views/default/openid_server/forms/trust.php
new file mode 100755
index 000000000..5a1e05ca1
--- /dev/null
+++ b/views/default/openid_server/forms/trust.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * Elgg openid_server trust page
+ *
+ * @package openid_server
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardiner <kevin@radagast.biz>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.com/
+ *
+ * @uses the following values in $vars:
+ *
+ * 'openid' the user's OpenID
+ * 'trust_root' the trust root for the OpenID client requesting authentication
+ */
+?>
+
+<div class="layout_canvas">
+<div class="one_column">
+<div class="contentWrapper">
+<div class="form">
+ <p><?php echo sprintf(elgg_echo('openid_server:trust_question'),$vars['openid_url'],$vars['openid_trust_root']) ?></p>
+ <form method="post" action="<?php echo $vars['url'] ?>mod/openid_server/actions/trust.php">
+ <input type="checkbox" name="remember" value="on" id="remember" /><label
+ for="remember"><?php echo elgg_echo('openid_server:remember_trust') ?></label>
+ <br />
+ <input type="hidden" name="trust_root" value="<?php echo $vars['openid_trust_root']; ?>" />
+ <input type="submit" name="trust" value="<?php echo elgg_echo('openid_server:confirm_trust') ?>" />
+ <input type="submit" name = "reject" value="<?php echo elgg_echo('openid_server:reject_trust') ?>" />
+ </form>
+</div>
+</div>
+</div>
+</div>
diff --git a/views/default/openid_server/metatags.php b/views/default/openid_server/metatags.php
new file mode 100755
index 000000000..9b486568e
--- /dev/null
+++ b/views/default/openid_server/metatags.php
@@ -0,0 +1,16 @@
+<?php
+
+ /**
+ * Adds metatags to identify OpenID server
+ *
+ * @package ElggOpenID
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ *
+ */
+
+ global $CONFIG;
+?>
+ <link rel="openid.server" href="<?php echo $CONFIG->wwwroot; ?>mod/openid_server/server.php" />
diff --git a/views/default/openid_server/metatags.php.old b/views/default/openid_server/metatags.php.old
new file mode 100755
index 000000000..fddca8ceb
--- /dev/null
+++ b/views/default/openid_server/metatags.php.old
@@ -0,0 +1,23 @@
+<?php
+
+ /**
+ * Adds metatags to identify OpenID server
+ *
+ * @package ElggOpenID
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Kevin Jardine <kevin@radagast.biz>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ *
+ */
+
+?>
+
+<!--
+
+why does this not work?
+
+<link rel="openid.server" href="<?php print $CONFIG->wwwroot; ?>mod/openid_server/server.php" />
+<link rel="openid2.provider" href="<?php print $CONFIG->wwwroot; ?>mod/openid_server/server.php" />
+
+--> \ No newline at end of file