[ PHPXref.com ] [ Generated: Sun Jul 20 18:29:26 2008 ] [ LnBlog 0.7.0 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/plugins/ -> sidebar_loginlink.php (source)

   1  <?php 
   2  
   3  class LoginLink extends Plugin {
   4  
   5  	function LoginLink() {
   6          $this->plugin_desc = _("Adds login panel to the sidebar.");
   7          $this->plugin_version = "0.3.0";
   8          $this->use_form = false;
   9          $this->admin_link = false;
  10          $this->member_list = array();
  11          $this->member_list["use_form"] =
  12              array("description"=>_("Use a login form, instead of a link to the login page"),
  13                    "default"=>false,
  14                    "control"=>"checkbox");
  15          $this->member_list["admin_link"] =
  16              array("description"=>_("Show link to administration pages"),
  17                    "default"=>false,
  18                    "control"=>"checkbox");
  19          $this->getConfig();
  20      }
  21  
  22  	function output($parm=false) {
  23          # Check if the user is logged in and, if so, present 

  24          # administrative options.

  25          $usr = NewUser();
  26          $blg = NewBlog();
  27          if (! $blg->isBlog()) return false;
  28          $root = $blg->getURL();
  29          if ($usr->checkLogin()) return false;
  30  
  31          if ($this->use_form) {
  32  ?>
  33  <h3><?php p_("Login"); ?></h3>
  34  <fieldset style="border: 0">
  35  <form method="post" action="<?php echo $blg->uri('login'); ?>">
  36  <div>
  37  <label for="user"><?php p_("Username"); ?></label>
  38  <input name="user" id="user" type="text" />
  39  </div>
  40  <div>
  41  <label for="passwd"><?php p_("Password"); ?></label>
  42  <input name="passwd" id="passwd" type="password" />
  43  </div>
  44  <input type="submit" value="<?php p_("Login"); ?>" />
  45  </form>
  46  </fieldset>
  47  <?php 
  48          } else {
  49  ?>
  50  <p style="margin: 5%"><strong><a href="<?php echo $blg->uri('login'); ?>"><?php p_("User Login"); ?></a></strong></p>
  51  <?php
  52          }
  53          if ($this->admin_link) {
  54  ?>
  55  <p style="margin: 5%"><a href="<?php echo INSTALL_ROOT_URL; ?>"><?php pf_("%s Administration", PACKAGE_NAME); ?></a></p>
  56  <?php
  57          }
  58      }   # End function

  59      
  60  }
  61  
  62  $login = new LoginLink();
  63  $login->registerEventHandler("sidebar", "OnOutput", "output");
  64  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]