add('name', PLUGIN_LOGINFORM_NAME); $propbag->add('description', PLUGIN_LOGINFORM_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Garvin Hicking, Neil Dudman'); $propbag->add('version', '1.09'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', 'php' => '4.1.0' )); $propbag->add('configuration', array('title', 'login_url', 'logout_url')); $propbag->add('groups', array('FRONTEND_FEATURES')); // Register (multiple) dependencies. KEY is the name of the depending plugin. VALUE is a mode of either 'remove' or 'keep'. // If the mode 'remove' is set, removing the plugin results in a removal of the depending plugin. 'Keep' meens to // not touch the depending plugin. $this->dependencies = array('serendipity_event_loginform' => 'remove'); } function introspect_config_item($name, &$propbag) { switch($name) { case 'title': $propbag->add('type', 'string'); $propbag->add('name', TITLE); $propbag->add('description', TITLE); $propbag->add('default', ''); break; case 'login_url': $propbag->add('type', 'string'); $propbag->add('name', LOGINURL_NAME); $propbag->add('description', LOGINURL_DESC); $propbag->add('default', ''); break; case 'logout_url': $propbag->add('type', 'string'); $propbag->add('name', LOGOUTURL_NAME); $propbag->add('description', LOGOUTURL_DESC); $propbag->add('default', ''); break; default: return false; } return true; } function generate_content(&$title) { global $serendipity; $title = $this->get_config('title', $title); $login_url = $this->get_config('login_url'); $logout_url = $this->get_config('logout_url'); if ($login_url == "") { $login_url = serendipity_currentURL(); } if ($logout_url == "") { $logout_url = serendipity_currentURL(); } if (isset($serendipity['POST']['action']) && !isset($serendipity['POST']['logout']) && !serendipity_userLoggedIn()) { echo '
' . WRONG_USERNAME_OR_PASSWORD . '
'; } elseif (serendipity_userLoggedIn()) { echo '
' . WELCOME_BACK . ' ' . $_SESSION['serendipityUser'] . '
'; echo '
'; echo ''; echo ''; $show_entry = false; $show_media = false; if (function_exists('serendipity_checkPermission')) { if (serendipity_checkPermission('adminEntries')) { $show_entry = true; } if (serendipity_checkPermission('adminImages') && serendipity_checkPermission('adminImagesAdd')) { $show_media = true; } } elseif (!$serendipity['no_create']) { $show_entry = true; $show_media = true; } if ($show_entry) { echo '
' . NEW_ENTRY . '
'; } if ($show_media) { echo ''; } echo '
'; return true; } // Logout is performed in bundled event plugin! echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo '
'; echo '
'; echo ''; echo ''; echo '
'; echo '
'; if (class_exists('serendipity_event_forgotpassword')) { echo '
' . PLUGIN_EVENT_FORGOTPASSWORD_LOST_PASSWORD . '
'; } return true; } } /* vim: set sts=4 ts=4 expandtab : */