add('name', PLUGIN_OPENID_NAME);
$propbag->add('description', PLUGIN_OPENID_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Grischa Brockhaus, Rob Richards');
$propbag->add('version', '0.7');
$propbag->add('requirements', array(
'serendipity' => '1.2',
'smarty' => '2.6.7',
'php' => '5.1.3'
));
$propbag->add('groups', array('BACKEND_USERMANAGEMENT'));
$propbag->add('event_hooks', array(
'backend_login' => true,
'backend_login_page' => true,
'backend_sidebar_entries_event_display_profiles' => true,
'frontend_header' => true,
'external_plugin' => true
));
$propbag->add('configuration', array(
'plugin_desc',
'delegation_desc',
'server',
'delegate',
'xrds_location'
));
}
function introspect_config_item($name, &$propbag)
{
switch($name) {
case 'plugin_desc':
$propbag->add('type', 'content');
$propbag->add('default', PLUGIN_OPENID_DESCRIPTION);
break;
case 'delegation_desc':
$propbag->add('type', 'content');
$propbag->add('default', PLUGIN_OPENID_DELEGATION_DESCRIPTION);
break;
case 'server':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_OPENID_SERVER);
$propbag->add('description', PLUGIN_OPENID_SERVER_DESC);
$propbag->add('default', '');
break;
case 'delegate':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_OPENID_DELEGATE);
$propbag->add('description', PLUGIN_OPENID_DELEGATE_DESC);
$propbag->add('default', '');
break;
case 'xrds_location':
$propbag->add('type', 'string');
$propbag->add('name', PLUGIN_OPENID_XRDS_LOC);
$propbag->add('description', PLUGIN_OPENID_XRDS_LOC_DESC);
$propbag->add('default', '');
break;
default:
return false;
}
return true;
}
function generate_content(&$title) {
$title = PLUGIN_OPENID_NAME;
}
function event_hook($event, &$bag, &$eventData, $addData = null) {
global $serendipity;
static $login_url = null;
if ($login_url === null) {
$login_url = $serendipity['baseURL'] . $serendipity['indexFile'] . '?/plugin/loginbox';
}
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
switch($event) {
case 'external_plugin' :
if ($eventData=="openid.png") {
header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/openid.png');
}
elseif ($eventData=="oid_google.png") {
header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/google.png');
}
elseif ($eventData=="oids_google.png") {
header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/google_small.png');
}
elseif ($eventData=="oid_yahoo.png") {
header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/yahoo.png');
}
elseif ($eventData=="oids_yahoo.png") {
header('Content-Type: image/png');
echo file_get_contents(dirname(__FILE__). '/img/yahoo_small.png');
}
break;
case 'frontend_header':
$server = $this->get_config('server');
$openidurl = $this->get_config('delegate');
$xrdsloc = $this->get_config('xrds_location');
if (! empty($server) && (! empty($openidurl) || ! empty($xrdsloc))) {
/* Make sure linefeeds exist otherwise OpenID does not always work correctly */
echo "\n";
echo ' '."\n";
if (! empty($openidurl)) {
echo ' '."\n";
}
if (! empty($xrdsloc)) {
echo ' '."\n";
}
}
break;
case 'backend_login_page':
$hidden = array('action'=>'admin');
$eventData['header'] .= '