2012-08-07 15:41:50 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
error_reporting(E_ALL ^ E_NOTICE);
|
|
|
|
ini_set("display_errors","1");
|
|
|
|
|
|
|
|
define('APP_NAME', 'app_achievements');
|
|
|
|
|
2012-12-10 14:07:13 +00:00
|
|
|
require_once('../config.php');
|
|
|
|
include_once('../lang.php');
|
2012-08-07 15:41:50 +00:00
|
|
|
include_once('lang.php');
|
|
|
|
require_once('conf.php');
|
|
|
|
|
|
|
|
// Ask to authenticate user (using ingame or session method) and fill $user with all information
|
2012-12-10 14:07:13 +00:00
|
|
|
ryzom_app_authenticate($user, true);
|
|
|
|
|
|
|
|
#echo var_export($user,true);
|
2012-08-07 15:41:50 +00:00
|
|
|
|
|
|
|
#$user['id'] = $user['char_id'];
|
|
|
|
#$user['name'] = $user['char_name'];
|
|
|
|
|
2012-12-10 14:07:13 +00:00
|
|
|
/*$user = array();
|
2012-08-07 15:41:50 +00:00
|
|
|
$user['cid'] = 1;
|
|
|
|
$user['lang'] = 'en';
|
|
|
|
$user['name'] = 'Talvela';
|
|
|
|
$user['race'] = "r_matis";
|
|
|
|
$user['civilization'] = "c_neutral";
|
|
|
|
$user['cult'] = "c_neutral";
|
|
|
|
$user['ig'] = ($_REQUEST['ig']==1);
|
2012-12-10 14:07:13 +00:00
|
|
|
#$user['ig'] = true;*/
|
2012-08-07 15:41:50 +00:00
|
|
|
|
|
|
|
require_once("class/RyzomUser_class.php");
|
|
|
|
$_USER = new RyzomUser($user);
|
|
|
|
|
|
|
|
if($_USER->isIG()) {
|
|
|
|
require_once("include/ach_render_ig.php");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
require_once("include/ach_render_web.php");
|
|
|
|
}
|
|
|
|
require_once("include/ach_render_common.php");
|
|
|
|
|
|
|
|
require_once("class/DLL_class.php");
|
|
|
|
#require_once("class/InDev_trait.php");
|
|
|
|
require_once("class/Node_abstract.php");
|
|
|
|
require_once("class/AVLTree_class.php");
|
|
|
|
require_once("class/Parentum_abstract.php");
|
|
|
|
require_once("class/AchList_abstract.php");
|
|
|
|
require_once("class/Tieable_inter.php");
|
|
|
|
require_once("class/NodeIterator_class.php");
|
|
|
|
|
|
|
|
|
|
|
|
require_once("class/AchMenu_class.php");
|
|
|
|
require_once("class/AchMenuNode_class.php");
|
|
|
|
require_once("class/AchSummary_class.php");
|
|
|
|
require_once("class/AchCategory_class.php");
|
|
|
|
require_once("class/AchAchievement_class.php");
|
2012-08-20 13:52:35 +00:00
|
|
|
require_once("class/AchTask_class.php");
|
2012-08-07 15:41:50 +00:00
|
|
|
require_once("class/AchObjective_class.php");
|
|
|
|
|
2012-12-10 14:07:13 +00:00
|
|
|
#require_once("fb/facebook.php");
|
2012-08-07 15:41:50 +00:00
|
|
|
|
|
|
|
// Update user acces on Db
|
2012-12-10 14:07:13 +00:00
|
|
|
#$DBc = ryDB::getInstance(APP_NAME."_test");
|
|
|
|
$DBc = ryDB::getInstance(APP_NAME);
|
2012-08-07 15:41:50 +00:00
|
|
|
|
|
|
|
$c = "";
|
|
|
|
if(!$_USER->isIG()) {
|
2012-12-10 14:07:13 +00:00
|
|
|
/*$facebook = new Facebook(array(
|
2012-08-07 15:41:50 +00:00
|
|
|
'appId' => $_CONF['fb_id'],
|
|
|
|
'secret' => $_CONF['fb_secret'],
|
|
|
|
'cookie' => true
|
|
|
|
));
|
|
|
|
|
2012-08-20 16:35:10 +00:00
|
|
|
#code taken from facebook tutorial
|
|
|
|
|
2012-08-07 15:41:50 +00:00
|
|
|
// Get the url to redirect for login to facebook
|
|
|
|
// and request permission to write on the user's wall.
|
|
|
|
$login_url = $facebook->getLoginUrl(
|
|
|
|
array('scope' => 'publish_stream')
|
|
|
|
);
|
|
|
|
|
|
|
|
// If not authenticated, redirect to the facebook login dialog.
|
|
|
|
// The $login_url will take care of redirecting back to us
|
|
|
|
// after successful login.
|
|
|
|
if (! $facebook->getUser()) {
|
|
|
|
$c .= '<script type="text/javascript">
|
|
|
|
top.location.href = "'.$login_url.'";
|
|
|
|
</script>;';
|
|
|
|
}
|
|
|
|
else {
|
2012-08-20 13:52:35 +00:00
|
|
|
$DBc->sqlQuery("INSERT INTO ach_fb_token (aft_player,aft_token,aft_date,aft_allow) VALUES ('".$_USER->getID()."','".$DBc->sqlEscape($facebook->getAccessToken())."','".time()."','1') ON DUPLICATE KEY UPDATE aft_token='".$DBc->sqlEscape($facebook->getAccessToken())."', aft_date='".time()."'");
|
2012-12-10 14:07:13 +00:00
|
|
|
}*/
|
2012-08-07 15:41:50 +00:00
|
|
|
|
2012-08-20 13:52:35 +00:00
|
|
|
|
2012-08-07 15:41:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!$_USER->isIG && $_CONF['enable_webig'] == false) {
|
|
|
|
$c .= ach_render_forbidden(false);
|
|
|
|
}
|
|
|
|
elseif($_USER->isIG && $_CONF['enable_offgame'] == false) {
|
|
|
|
$c .= ach_render_forbidden(true);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$c .= ach_render();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-02-15 13:51:41 +00:00
|
|
|
echo ryzom_app_render(strtoupper(get_translation('ach_app_name',$_USER->getLang())), $c, $_USER->isIG());
|
2012-08-07 15:41:50 +00:00
|
|
|
|
|
|
|
?>
|