fix for getting client working + possibly auto login for ingame part
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
3d309fbfa5
commit
12baee2fcf
7 changed files with 149 additions and 20 deletions
|
@ -3156,6 +3156,7 @@ namespace NLGUI
|
|||
|
||||
CWidgetManager::CWidgetManager()
|
||||
{
|
||||
LinkHack();
|
||||
CStringShared::createStringMapper();
|
||||
|
||||
CReflectableRegister::registerClasses();
|
||||
|
|
|
@ -863,8 +863,10 @@
|
|||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<!--<define id="cs_url"
|
||||
value="http://app.ryzom.com/ticket_system/index.php?mode=load" />-->
|
||||
<define id="cs_url"
|
||||
value="http://app.ryzom.com/ticket_system/index.php?mode=load" />
|
||||
value="http://localhost:40917/www/html/index.php" />
|
||||
<group type="container"
|
||||
id="cs_browser"
|
||||
w="410"
|
||||
|
|
|
@ -34,6 +34,7 @@ class Helpers{
|
|||
foreach ( $variables[$template] as $key => $value ){
|
||||
$smarty -> assign( $key, $value );
|
||||
}
|
||||
if (! helpers :: check_if_game_client ()){
|
||||
if( isset($vars['permission']) && $vars['permission'] == 3 ){
|
||||
$inherited = "extends:layout_admin.tpl|";
|
||||
}else if( isset($vars['permission']) && $vars['permission'] == 2){
|
||||
|
@ -45,6 +46,9 @@ class Helpers{
|
|||
}
|
||||
// extends:' . $inherited .'|register.tpl
|
||||
$smarty -> display( $inherited . $template . '.tpl' );
|
||||
}else{
|
||||
$smarty -> display($template . '.tpl' );
|
||||
}
|
||||
}
|
||||
|
||||
static public function create_folders(){
|
||||
|
@ -70,7 +74,7 @@ class Helpers{
|
|||
static public function check_if_game_client()
|
||||
{
|
||||
// if HTTP_USER_AGENT is not set then its ryzom core
|
||||
if ( !isset( $_SERVER['HTTP_USER_AGENT'] ) ){
|
||||
if ( strpos($_SERVER['HTTP_USER_AGENT'],"Ryzom") === 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
|
@ -113,4 +117,24 @@ class Helpers{
|
|||
global $TIME_FORMAT;
|
||||
return date($TIME_FORMAT,strtotime($time));
|
||||
}
|
||||
|
||||
static public function check_login_ingame(){
|
||||
if ( helpers :: check_if_game_client () or $forcelibrender = false ){
|
||||
$dbr = new DBLayer("ring");
|
||||
if (isset($_GET['UserId']) && isset($_COOKIE['ryzomId'])){
|
||||
$id = $_GET['UserId'];
|
||||
$statement = $dbr->execute("SELECT * FROM ring_users WHERE user_id=:id AND cookie =:cookie", array('id' => $id, 'cookie' => $_COOKIE['ryzomId']));
|
||||
if ($statement->rowCount() ){
|
||||
$entry = $statement->fetch();
|
||||
return array('id' => $id, 'name' => $entry['user_name']);
|
||||
}else{
|
||||
return "FALSE";
|
||||
}
|
||||
}else{
|
||||
return "FALSE";
|
||||
}
|
||||
}else{
|
||||
return "FALSE";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
{block name=content}
|
||||
|
||||
|
||||
<div class="sortable row-fluid ui-sortable">
|
||||
<a data-original-title="6 new members." data-rel="tooltip" class="well span3 top-block" href="#">
|
||||
<span class="icon32 icon-red icon-user"></span>
|
||||
<div>Total Members</div>
|
||||
<div>507</div>
|
||||
<span class="notification">6</span>
|
||||
</a>
|
||||
|
||||
<a data-original-title="4 new pro members." data-rel="tooltip" class="well span3 top-block" href="#">
|
||||
<span class="icon32 icon-color icon-star-on"></span>
|
||||
<div>Pro Members</div>
|
||||
<div>228</div>
|
||||
<span class="notification green">4</span>
|
||||
</a>
|
||||
|
||||
<a data-original-title="$34 new sales." data-rel="tooltip" class="well span3 top-block" href="#">
|
||||
<span class="icon32 icon-color icon-cart"></span>
|
||||
<div>Sales</div>
|
||||
<div>$13320</div>
|
||||
<span class="notification yellow">$34</span>
|
||||
</a>
|
||||
|
||||
<a data-original-title="12 new messages." data-rel="tooltip" class="well span3 top-block" href="#">
|
||||
<span class="icon32 icon-color icon-envelope-closed"></span>
|
||||
<div>Messages</div>
|
||||
<div>25</div>
|
||||
<span class="notification red">12</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="box span12">
|
||||
<div class="box-header well">
|
||||
<h2><i class="icon-info-sign"></i> {$home_title}</h2>
|
||||
<div class="box-icon">
|
||||
<a href="#" class="btn btn-round" onclick="javascript:show_help('intro');return false;"><i class="icon-info-sign"></i></a>
|
||||
<a href="#" class="btn btn-setting btn-round"><i class="icon-cog"></i></a>
|
||||
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
|
||||
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-content">
|
||||
<p><strong>{$home_info}</strong></p>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<p> </p>
|
||||
<table cellpadding = "10"><tr><td>
|
||||
<div class="alert alert-info">
|
||||
<h3>{$login_info}</h3>
|
||||
</div>
|
||||
<form method="post" action="index.php" class="form-horizontal">
|
||||
<br/>
|
||||
<p>
|
||||
Username:
|
||||
<input type="text" value="" id="Username" name="Username" class="input-large span10" placeholder="Username">
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
Password:
|
||||
<input type="text" value="" id="Password" name="Password" class="input-large span10" placeholder="Password">
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Remember me:
|
||||
<label for="remember" class="remember"><div class="checker" id="uniform-remember"><span><input type="checkbox" id="remember" style="opacity: 0;"></span></div>Remember me</label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="hidden" name="function" value="login"/>
|
||||
<input type="submit" value="Login"/>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
{if isset($login_error) and $login_error eq "TRUE"}
|
||||
<p>
|
||||
<strong><font color="red">{$login_error_message}</font></strong>
|
||||
</p>
|
||||
{/if}
|
||||
<p>
|
||||
<font color="green">{$login_register_message} <a href="?page=register">{$login_register_message_here}</a></font>!
|
||||
</p>
|
||||
</td></tr>
|
||||
</table>
|
|
@ -25,6 +25,12 @@ $cfg['db']['shard']['name'] = 'nel';
|
|||
$cfg['db']['shard']['user'] = 'shard';
|
||||
$cfg['db']['shard']['pass'] = '';
|
||||
|
||||
$cfg['db']['ring']['host'] = 'localhost';
|
||||
$cfg['db']['ring']['port'] = '3306';
|
||||
$cfg['db']['ring']['name'] = 'ring_open';
|
||||
$cfg['db']['ring']['user'] = 'shard';
|
||||
$cfg['db']['ring']['pass'] = '';
|
||||
|
||||
//-----------------------------------------------------------------------------------------
|
||||
// If true= the server will add automatically unknown user in the database
|
||||
// (in nel.user= nel.permission= ring.ring_user and ring.characters
|
||||
|
|
|
@ -6,25 +6,28 @@ require( '../../ams_lib/libinclude.php' );
|
|||
session_start();
|
||||
|
||||
//Decide what page to load
|
||||
if ( ! isset( $_GET["page"]) ){
|
||||
if(isset($_SESSION['user'])){
|
||||
$page = 'home';
|
||||
}else{
|
||||
//default page
|
||||
$page = 'login';
|
||||
}
|
||||
}else{
|
||||
$page = $_GET["page"];
|
||||
}
|
||||
|
||||
//perform an action in case one is specified
|
||||
//else check if a php page is included in the inc folder, else just set page to the get param
|
||||
if ( isset( $_POST["function"] ) ){
|
||||
require( "func/" . $_POST["function"] . ".php" );
|
||||
$return = $_POST["function"]();
|
||||
}else if ( isset( $_GET["page"] ) ){
|
||||
$filename = 'inc/' . $_GET["page"] . '.php';
|
||||
}else{
|
||||
$filename = 'inc/' . $page . '.php';
|
||||
if(is_file($filename)){
|
||||
require_once($filename);
|
||||
$return = $_GET["page"]();
|
||||
$return = $page();
|
||||
}
|
||||
$page = $_GET["page"];
|
||||
}
|
||||
|
||||
//add username to the return array in case logged in.
|
||||
|
|
Loading…
Reference in a new issue