Ejemplo n.º 1
0
 /**
  * login page and post 
  */
 public function doIndex()
 {
     global $MONGO;
     $password = trim(xn("password"));
     $this->username = trim(xn("username"));
     $this->db = trim(xn("db"));
     $this->hostIndex = xi("host");
     $this->languages = rock_load_languages();
     $this->expires = array(3 => "3 " . rock_lang("hours"), 720 => "1 " . rock_lang("month"));
     $this->moreOptions = xi("more");
     if ($this->isPost()) {
         //server exists?
         if (!isset($MONGO["servers"][$this->hostIndex])) {
             $this->message = "Server does not exist";
             return;
         }
         //authenticate
         $server = MServer::serverWithIndex($this->hostIndex);
         if (!$server->auth($this->username, $password, $this->db)) {
             $this->message = rock_lang("can_not_auth");
             $this->display();
             return;
         }
         //remember user
         import("models.MUser");
         MUser::login($this->username, $password, $this->hostIndex, $this->db, xi("expire") * 3600);
         //remember lang
         setcookie("ROCK_LANG", x("lang"), time() + 365 * 86400);
         //jump to admin page
         $this->redirect("admin.index", array("host" => $this->hostIndex));
     } else {
         $this->display();
     }
 }
Ejemplo n.º 2
-1
    }
}
?>
	</div>
	<div class="right"><?php 
h($admin);
?>
 | <a href="#" onclick="showManuals(this);return false;"><?php 
hm("manuals");
?>
 <span style="font-size:11px">▼</span></a> | <a href="<?php 
h(url("plugins.index"));
?>
" target="right">Plugins</a> |  <a href="<?php 
h($logoutUrl);
?>
" target="_top"><?php 
hm("logout");
?>
</a> | <?php 
render_select("language", rock_load_languages(), __LANG__, array("style" => "width:100px", "onchange" => "window.top.location='index.php?action=admin.changeLang&lang='+this.value"));
?>
  | <a href="<?php 
h(url("admin.about"));
?>
" target="right">RockMongo v<?php 
h(ROCK_MONGO_VERSION);
?>
</a></div>
	<div class="clear"></div>
</div>