static function loginform($url, $hidden = array(), $useAutorSelector = true) { global $serendipity; $imgopenid = $serendipity['baseURL'] . 'index.php?/plugin/openid.png'; // Check, if we have any user with OpenID configured $select = serendipity_common_openid::load_account_selectbox(); if ($select === false) { // No we don't. Say so $result = '<div class="no_openid_user">'; $result .= '<img src="' . $imgopenid . '" alt="OpenID">'; $result .= '<p>' . PLUGIN_OPENID_LOGIN_NOOPENID . '</p></div>'; return $result; } $imggoogle = $serendipity['baseURL'] . 'index.php?/plugin/oid_google.png'; $imgyahoo = $serendipity['baseURL'] . 'index.php?/plugin/oid_yahoo.png'; $imgaol = $serendipity['baseURL'] . 'index.php?/plugin/oid_aol.png'; $form = ''; // We need two forms in order to allow ENTER in the input line $form .= '<form name="openid" id="openid" method="post" action="' . $url . '">'; $form .= '<input type="hidden" name="serendipity[openidflag]" value="1" />'; foreach ($hidden as $key => $val) { $form .= '<input type="hidden" name="serendipity[' . $key . ']" value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($val) : htmlspecialchars($val, ENT_COMPAT, LANG_CHARSET)) . '" />'; } $form .= '<img src="' . $imgopenid . '" alt="OpenID"> '; if ($useAutorSelector) { $form .= $select; $form .= '<input type="submit" name="openIDLogin" value="Login with OpenID" />'; } if (!$useAutorSelector) { $form .= '<input type="text" size="40" name="serendipity[openid_url]" value="" placeholder="' . PLUGIN_OPENID_LOGIN_INPUT . '"/>'; $form .= '<input type="submit" name="openIDLogin" value="Login" />'; $form .= '</form>'; $form .= '<form name="openid" id="openid" method="post" action="' . $url . '">'; $form .= '<input type="hidden" name="serendipity[openidflag]" value="1" />'; foreach ($hidden as $key => $val) { $form .= '<input type="hidden" name="serendipity[' . $key . ']" value="' . (function_exists('serendipity_specialchars') ? serendipity_specialchars($val) : htmlspecialchars($val, ENT_COMPAT, LANG_CHARSET)) . '" />'; } $form .= '<input name="openIDLoginGoogle" type="image" src="' . $imggoogle . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_GOOGLE . '" title="' . PLUGIN_OPENID_LOGIN_WITH_GOOGLE . '"/> '; $form .= '<input name="openIDLoginYahoo" type="image" src="' . $imgyahoo . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_YAHOO . '" title="' . PLUGIN_OPENID_LOGIN_WITH_YAHOO . '"/> '; $form .= '<input name="openIDLoginAol" type="image" src="' . $imgaol . '" alt="' . PLUGIN_OPENID_LOGIN_WITH_AOL . '" title="' . PLUGIN_OPENID_LOGIN_WITH_AOL . '"/> '; } $form .= '</form>'; return $form; }
function print_sidebar() { global $serendipity; if ($_SESSION['serendipityAuthedUser'] == true) { if (!empty($serendipity['GET']['openidflag']) && $serendipity['GET']['openidflag'] == 3) { if ($checkRet = serendipity_common_openid::authenticate_openid($_GET, $this->get_consumertest_path(), true)) { if (serendipity_common_openid::updateOpenID($checkRet['openID'], $serendipity['authorid'])) { echo '<strong>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars(PLUGIN_OPENID_UPDATE_SUCCESS) : htmlspecialchars(PLUGIN_OPENID_UPDATE_SUCCESS, ENT_COMPAT, LANG_CHARSET)) . '</strong><br /><br />'; } else { echo '<strong>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars(PLUGIN_OPENID_UPDATE_FAIL) : htmlspecialchars(PLUGIN_OPENID_UPDATE_FAIL, ENT_COMPAT, LANG_CHARSET)) . '</strong><br /><br />'; } } else { echo '<strong>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars(PLUGIN_OPENID_INVALID_RESPONSE) : htmlspecialchars(PLUGIN_OPENID_INVALID_RESPONSE, ENT_COMPAT, LANG_CHARSET)) . '</strong><br /><br />'; } // Job done. unset($serendipity['GET']['openidflag']); } elseif (!empty($serendipity['POST']['openidflag']) && $serendipity['POST']['openidflag'] == 3) { echo '<strong>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars(PLUGIN_OPENID_INVALID_RESPONSE) : htmlspecialchars(PLUGIN_OPENID_INVALID_RESPONSE, ENT_COMPAT, LANG_CHARSET)) . '</strong><br /><br />'; } } $imgopenid = $serendipity['baseURL'] . 'index.php?/plugin/openid.png'; $imggoogle = $serendipity['baseURL'] . 'index.php?/plugin/oids_google.png'; $imgyahoo = $serendipity['baseURL'] . 'index.php?/plugin/oids_yahoo.png'; $imgaol = $serendipity['baseURL'] . 'index.php?/plugin/oids_aol.png'; echo '<div>'; echo '<strong>' . (function_exists('serendipity_specialchars') ? serendipity_specialchars(PLUGIN_EVENT_OPENID_SELECT) : htmlspecialchars(PLUGIN_EVENT_OPENID_SELECT, ENT_COMPAT, LANG_CHARSET)) . '</strong><br /><br />'; // To allow ENTER in the input line we have to create two forms: echo '<form action="?" method="post">'; echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />'; echo '<input type="hidden" name="serendipity[adminAction]" value="profiles" />'; echo '<input type="hidden" name="serendipity[openidflag]" value="3" />'; echo '<img src="' . $imgopenid . '" alt="OpenID URL"> <input type="text" size="50" name="serendipity[openid_url]" value="' . serendipity_common_openid::getOpenID($serendipity['authorid']) . '" />'; echo ' <input type="submit" name="submit" value="' . EDIT . '" placeholder="' . PLUGIN_OPENID_LOGIN_INPUT . '"/>'; echo '</form>'; echo '<form action="?" method="post">'; echo '<input type="hidden" name="serendipity[adminModule]" value="event_display" />'; echo '<input type="hidden" name="serendipity[adminAction]" value="profiles" />'; echo '<input type="hidden" name="serendipity[openidflag]" value="3" />'; echo '<input name="openIDLoginGoogle" type="image" src="' . $imggoogle . '" alt="' . PLUGIN_OPENID_SET_GOOGLE_OID . '" title="' . PLUGIN_OPENID_SET_GOOGLE_OID . '"/> '; echo '<input name="openIDLoginYahoo" type="image" src="' . $imgyahoo . '" alt="' . PLUGIN_OPENID_SET_YAHOO_OID . '" title="' . PLUGIN_OPENID_SET_YAHOO_OID . '"/> '; echo '<input name="openIDLoginAol" type="image" src="' . $imgaol . '" alt="' . PLUGIN_OPENID_SET_AOL_OID . '" title="' . PLUGIN_OPENID_SET_AOL_OID . '"/> '; echo '</form>'; echo '</div><br /><hr />'; }