LnBlog PHP Cross Reference Blogging Systems

Source: /plugins/sidebar_loginlink.php - 79 lines - 2251 bytes - Summary - Text - Print

   1  <?php 
   2  
   3  class LoginLink extends Plugin {
   4  
   5  	function LoginLink($do_output=0) {
   6          global $SYSTEM;
   7          $this->plugin_desc = _("Adds login panel to the sidebar.");
   8          $this->plugin_version = "0.3.0";
   9          $this->use_form = false;
  10          $this->admin_link = false;
  11          $this->addOption("use_form",
  12              _("Use a login form, instead of a link to the login page"),
  13              false, "checkbox");
  14          $this->addOption("admin_link",
  15              _("Show link to administration pages"),
  16              false, "checkbox");
  17          $this->addOption('no_event',
  18              _('No event handlers - do output when plugin is created'),
  19              $SYSTEM->sys_ini->value("plugins","EventDefaultOff", 0), 
  20              'checkbox');
  21  
  22          $this->getConfig();
  23  
  24          if ( $this->no_event || 
  25               $SYSTEM->sys_ini->value("plugins","EventForceOff", 0) ) {
  26              # If either of these is true, then don't set the event handler

  27              # and rely on explicit invocation for output.

  28          } else {
  29              $this->registerEventHandler("sidebar", "OnOutput", "output");
  30          }
  31          
  32          if ($do_output) $this->output();
  33      }
  34  
  35  	function output($parm=false) {
  36          # Check if the user is logged in and, if so, present 

  37          # administrative options.

  38          $usr = NewUser();
  39          $blg = NewBlog();
  40          if (! $blg->isBlog()) return false;
  41          $root = $blg->getURL();
  42          if ($usr->checkLogin()) return false;
  43  
  44          if ($this->use_form) {
  45  ?>
  46  <h3><?php p_("Login"); ?></h3>
  47  <fieldset style="border: 0">
  48  <form method="post" action="<?php echo $blg->uri('login'); ?>">
  49  <div>
  50  <label for="user"><?php p_("Username"); ?></label>
  51  <input name="user" id="user" type="text" />
  52  </div>
  53  <div>
  54  <label for="passwd"><?php p_("Password"); ?></label>
  55  <input name="passwd" id="passwd" type="password" />
  56  </div>
  57  <input type="submit" value="<?php p_("Login"); ?>" />
  58  </form>
  59  </fieldset>
  60  <?php 
  61          } else {
  62  ?>
  63  <p style="margin: 5%"><strong><a href="<?php echo $blg->uri('login'); ?>"><?php p_("User Login"); ?></a></strong></p>
  64  <?php
  65          }
  66          if ($this->admin_link) {
  67  ?>
  68  <p style="margin: 5%"><a href="<?php echo INSTALL_ROOT_URL; ?>"><?php pf_("%s Administration", PACKAGE_NAME); ?></a></p>
  69  <?php
  70          }
  71      }   # End function

  72      
  73  }
  74  
  75  global $PLUGIN_MANAGER;
  76  if (! $PLUGIN_MANAGER->plugin_config->value('loginlink', 'creator_output', 0)) {
  77      $plug = new LoginLink();
  78  }
  79  ?>

title

Description

title

Description

title

Description

title

title

Body