diff --git a/code/web/app/app_achievements/_API/ach_progress.php b/code/web/app/app_achievements/_API/ach_progress.php index 9665a6bb3..eaffd703d 100644 --- a/code/web/app/app_achievements/_API/ach_progress.php +++ b/code/web/app/app_achievements/_API/ach_progress.php @@ -14,12 +14,12 @@ echo ''; echo ""; - echo ""; - $res = $DBc->sendSQL("SELECT * FROM ach_player_perk WHERE app_player='".$DBc->mre($_REQUEST['cid'])."'","ARRAY"); + echo ""; + $res = $DBc->sendSQL("SELECT * FROM ach_player_task WHERE apt_player='".$DBc->mre($_REQUEST['cid'])."'","ARRAY"); foreach($res as $elem) { - echo ""; + echo ""; } - echo ""; + echo ""; echo ""; echo ""; diff --git a/code/web/app/app_achievements/_API/ach_struct.php b/code/web/app/app_achievements/_API/ach_struct.php index 604dc03e5..b640dd1d2 100644 --- a/code/web/app/app_achievements/_API/ach_struct.php +++ b/code/web/app/app_achievements/_API/ach_struct.php @@ -11,15 +11,15 @@ require_once($_CONF['app_achievements_path']."class/AchList_abstract.php"); require_once($_CONF['app_achievements_path']."class/Tieable_inter.php"); require_once($_CONF['app_achievements_path']."class/NodeIterator_class.php"); - require_once($_CONF['app_achievements_path']."class/Node_trait.php"); - require_once($_CONF['app_achievements_path']."class/InDev_trait.php"); + #require_once($_CONF['app_achievements_path']."class/Node_trait.php"); + #require_once($_CONF['app_achievements_path']."class/InDev_trait.php"); require_once($_CONF['app_achievements_path']."class/AchMenu_class.php"); require_once($_CONF['app_achievements_path']."class/AchMenuNode_class.php"); require_once($_CONF['app_achievements_path']."class/AchSummary_class.php"); require_once($_CONF['app_achievements_path']."class/AchCategory_class.php"); require_once($_CONF['app_achievements_path']."class/AchAchievement_class.php"); - require_once($_CONF['app_achievements_path']."class/AchPerk_class.php"); + require_once($_CONF['app_achievements_path']."class/AchTask_class.php"); require_once($_CONF['app_achievements_path']."class/AchObjective_class.php"); class RUser { @@ -72,13 +72,13 @@ $iter4 = $curr3->getIterator(); while($iter4->hasNext()) { $curr4 = $iter4->getNext(); - echo "getDisplayName()."]]>"; + echo "getDisplayName()."]]>"; $iter5 = $curr4->getIterator(); while($iter5->hasNext()) { $curr5 = $iter5->getNext(); echo "getMetaImage()."'>getDisplayName()."]]>"; } - echo ""; + echo ""; } echo ""; } diff --git a/code/web/app/app_achievements/_API/class/mySQL_class.php b/code/web/app/app_achievements/_API/class/mySQL_class.php index 67ce66226..002abb709 100644 --- a/code/web/app/app_achievements/_API/class/mySQL_class.php +++ b/code/web/app/app_achievements/_API/class/mySQL_class.php @@ -42,6 +42,8 @@ return false; } mysql_select_db($db,$this->DBc) or $this->error(mysql_error()); + + return true; } function resetStats() { @@ -99,7 +101,7 @@ else { return $res; } - mysql_free_result($res); + //mysql_free_result($res); } else { return false; diff --git a/code/web/app/app_achievements/_AchWebParser/AchWebMonitor.php b/code/web/app/app_achievements/_AchWebParser/AchWebMonitor.php deleted file mode 100644 index 7a5895418..000000000 --- a/code/web/app/app_achievements/_AchWebParser/AchWebMonitor.php +++ /dev/null @@ -1,35 +0,0 @@ -connect($CONF['mysql_server'],$CONF['mysql_user'],$CONF['mysql_pass'],$CONF['mysql_database']); - - //check status - $res = $DBc->sendSQL("SELECT * FROM ach_monitor_status ORDER by ams_start DESC LIMIT 0,1","ARRAY"); - - if(($res[0]['ams_start'] < (time()-$CONF['timeout']) && $res[0]['ams_end'] == 0) || ($res[0]['ams_end'] > 0 && $res[0]['ams_end'] < (time()-$CONF['timeout']))) { - $fp = fsockopen($CONF['self_host'], 80, $errno, $errstr, 30); - if(!$fp) { - logf("ERROR: self call; socket: ".$errstr." (."$errno.")"); - } - else { - $out = "GET ".$CONF['self_path']." HTTP/1.1\r\n"; - $out .= "Host: ".$CONF['self_host']."\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - fclose($fp); - } - } - - exit(0); -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/AchWebParser.php b/code/web/app/app_achievements/_AchWebParser/AchWebParser.php index 3394635f3..e7f588b99 100644 --- a/code/web/app/app_achievements/_AchWebParser/AchWebParser.php +++ b/code/web/app/app_achievements/_AchWebParser/AchWebParser.php @@ -75,10 +75,10 @@ $atom_list = array(); - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_player='".$cid."' AND app_perk=ap_id)","ARRAY"); - foreach($res as $perk) { + $res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_player='".$cid."' AND apt_task=at_id)","ARRAY"); + foreach($res as $task) { //get unfinished atoms belonging to unfinished objectives - $res2 = $DBc->sendSQL("SELECT ach_atom.* FROM ach_atom,ach_objective,ach_achievement WHERE ao_perk='".$perk['ap_id']."' AND ao_id=atom_objective AND ap_achievement=aa_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$cid."' AND apo_objective=ao_id) AND (aa_tie_race IS NULL OR aa_tie_race='') AND (aa_tie_cult IS NULL OR aa_tie_cult='') AND (aa_tie_civ IS NULL OR aa_tie_civ='')","ARRAY"); + $res2 = $DBc->sendSQL("SELECT ach_atom.* FROM ach_atom,ach_objective,ach_achievement WHERE ao_task='".$task['at_id']."' AND ao_id=atom_objective AND ap_achievement=aa_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$cid."' AND apo_objective=ao_id)","ARRAY"); foreach($res2 as $atom) { $a = new Atom($atom,$cid); $atom_list[] = $a; @@ -96,8 +96,9 @@ $log->logf("done!"); - #STEP 3: detect obj/perk progression + #STEP 3: detect obj/task progression $log->logi("Detecting Objectives... ",false); + //obj $res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."') AND NOT EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id AND NOT EXISTS (SELECT * FROM ach_player_atom WHERE apa_atom=atom_id AND apa_state='GRANT' AND apa_player='".$cid."')) AND EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id)","ARRAY"); $sz = sizeof($res); @@ -117,6 +118,13 @@ $DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$cid."','".time()."')","NONE"); } + //meta + $res = $DBc->sendSQL("SELECT ao_id FROM ach_objective,ach_task as t1,ach_achievement WHERE ao_display='meta' ao_task=t1.at_id AND t1.at_achievement=aa_id AND NOT EXISTS (SELECT * FROM ach_task as t2 WHERE t2.at_achievement=aa_metalink AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=t2.at_id AND apt_player='".$cid."'))"); + $sz = sizeof($res); + for($i=0;$i<$sz;$i++) { + $DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$cid."','".time()."')","NONE"); + } + $log->logf("done!"); $log->logi("Clearing atom data... ",false); @@ -125,24 +133,58 @@ $log->logf("done!"); - //perk - $log->logi("Detecting Perks... ",false); - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND NOT EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id) AND ap_dev='0'","ARRAY"); + //task + $log->logi("Detecting Tasks... ",false); + $res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE at_condition='all' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND aptp_player='".$cid."') AND NOT EXISTS (SELECT * FROM ach_objective WHERE ao_task=ap_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=ap_id) AND at_dev='0'","ARRAY"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE"); + $DBc->sendSQL("INSERT INTO ach_player_task (apt_task,apt_player,apt_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE"); } - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='value' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND ap_value<=(SELECT count(*) FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id) AND ap_dev='0'","ARRAY"); + $res = $DBc->sendSQL("SELECT ap_id FROM ach_task WHERE at_condition='value' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cid."') AND at_value<=(SELECT count(*) FROM ach_objective WHERE ao_task=at_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0'","ARRAY"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE"); + $DBc->sendSQL("INSERT INTO ach_player_task (apt_task,apt_player,apt_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE"); } - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='any' AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_perk=ap_id AND app_player='".$cid."') AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id) AND ap_dev='0'","ARRAY"); + $res = $DBc->sendSQL("SELECT at_id FROM ach_task WHERE ap_condition='any' AND NOT EXISTS (SELECT * FROM ach_player_task WHERE apt_task=at_id AND apt_player='".$cid."') AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_player='".$cid."')) AND EXISTS (SELECT * FROM ach_objective WHERE ao_task=at_id) AND at_dev='0'","ARRAY"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE"); + $DBc->sendSQL("INSERT INTO ach_player_task (apt_task,apt_player,apt_date) VALUES ('".$res[$i]['ap_id']."','".$cid."','".time()."')","NONE"); + } + + if($CONF['facebook'] == true) { + require_once("../fb/facebook.php"); + + $facebook = new Facebook(array(appId=>$CONF['fb_id'], secret=>$CONF['fb_secret'])); + + + $res = $DBc->sendSQL("SELECT * FROM ach_fb_token WHERE aft_player='".$cid."'","ARRAY"); + + $access_token = $res[0]['aft_token']; + + if($res[0]['aft_allow'] == 1) { + + $res2 = $DBc->sendSQL("SELECT * FROM ach_player_task WHERE apt_player='".$cid."' AND apt_fb='0'","ARRAY"); + $sz = sizeof($res2); + + for($i=0;$i<$sz;$i++) { + + //this has to be adapted! + + /*$result = $facebook->api( + '/me/feed/', + array('access_token' => $$access_token, 'message' => 'Playing around with FB Graph..') + );*/ + + } + + $DBc->sendSQL("UPDATE ach_player_task SET apt_fb='1' WHERE apt_player='".$cid."'","NONE"); + + + + + } } $log->logf("done!"); diff --git a/code/web/app/app_achievements/_AchWebParser/_AchWebParser.php b/code/web/app/app_achievements/_AchWebParser/_AchWebParser.php deleted file mode 100644 index 425b62540..000000000 --- a/code/web/app/app_achievements/_AchWebParser/_AchWebParser.php +++ /dev/null @@ -1,207 +0,0 @@ - 0 || $_REQUEST["invoke"] == "TRUE") { - if($_REQUEST["cid"] > 0 && $_REQUEST["invoke"] == "TRUE") { - $MODE = "SINGLE"; - $CID = $DBc->mre($_REQUEST["cid"]); - } - else { - $e = "Failed to start SINGLE mode; cid=".$_REQUEST["cid"]; - logf($e); - die($e); - } - } - - //create database connection - $DBc = new mySQL($CONF['mysql_error']); - $DBc->connect($CONF['mysql_server'],$CONF['mysql_user'],$CONF['mysql_pass'],$CONF['mysql_database']); - - if($MODE == "CRON") { - $RID = $DBc->sendSQL("INSERT INTO ach_monitor_state (ams_start,ams_end) VALUES ('".time()."','0')","INSERT"); // insert run into monitoring table - } - - require_once("class/DataSourceHandler_class.php"); - require_once("class/DataSource_abstract.php"); - - require_once("class/Atom_class.php"); - - //create datasource handler - $_DATA = new DataSourceHandler(); - foreach($CONF['data_source'] as $elem) { //populate - require_once("source/".$elem."/".$elem."_class.php"); - eval('$tmp = new '.$elem.'();'); - $_DATA->registerDataSource($tmp); - } - - //synch chars from ring_open character table - if($CONF['synch_chars'] == true) { - $DBc_char = new mySQL($CONF['mysql_error']); - $DBc_char->connect($CONF['char_mysql_server'],$CONF['char_mysql_user'],$CONF['char_mysql_pass'],$CONF['char_mysql_database']); - - $DBc->sendSQL("UPDATE ach_monitor_character SET amc_confirmed='0'","NONE"); - - $res = $DBc_char->sendSQL("SELECT char_id,last_played_date FROM characters","ARRAY"); - $sz = sizeof($res); - for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_monitor_character (amc_character,amc_last_import,amc_last_login,amc_confirmed) VALUES ('".$res[$i]['char_id']."','0','".dateTime_to_timestamp($res[$i]['last_played_date'])."','1') ON DUPLICATE KEY UPDATE amc_confirmed='1', amc_last_login='".dateTime_to_timestamp($res[$i]['last_played_date'])."'","NONE"); - } - - $DBc->sendSQL("DELETE FROM ach_monitor_character WHERE amc_confirmed='0'","NONE"); //remove deleted characters - //remove data for deleted chars - $DBc->sendSQL("DELETE FROM ach_player_atom WHERE NOT EXISTS (SELECT * FROM ach_monitor_character WHERE amc_character='apa_player')","NONE"); - $DBc->sendSQL("DELETE FROM ach_player_objective WHERE NOT EXISTS (SELECT * FROM ach_monitor_character WHERE amc_character='apo_player')","NONE"); - $DBc->sendSQL("DELETE FROM ach_player_perk WHERE NOT EXISTS (SELECT * FROM ach_monitor_character WHERE amc_character='app_player')","NONE"); - $DBc->sendSQL("DELETE FROM ach_player_valuecache WHERE NOT EXISTS (SELECT * FROM ach_monitor_character WHERE amc_character='apv_player')","NONE"); - } - - // fetch candidates - if($MODE == "SINGLE") { - $chars = array(); - $chars[] = array('amc_character',$CID); - } - else { - #$chars = array(); - - $DBc->sendSQL("UPDATE ach_monitor_character SET amc_working='0' WHERE amc_last_import<'".(time()-60*60)."'"); // unlock if something went wrong - - $DBc->sendSQL("UPDATE ach_monitor_character SET amc_working='".$RID."' WHERE amc_last_login>amc_last_import AND amc_working='0'","NONE"); - - $chars = $DBc->sendSQL("SELECT amc_character FROM ach_monitor_character WHERE amc_working='".$RID."'","ARRAY"); - } - - - //fork if enabled in conf - if($CONF['fork'] == true && $MODE == "CRON") { - require_once("class/ParallelCURL_class.php"); - - $max_requests = 0; - $curl_options = array( - CURLOPT_SSL_VERIFYPEER => FALSE, - CURLOPT_SSL_VERIFYHOST => FALSE, - CURLOPT_USERAGENT, 'Ryzom - Achievement Tracker', - ); - - $_CURL = new ParallelCurl($max_requests, $curl_options); - - foreach($chars as $elem) { - $_CURL->startRequest("http://".$CONF['self_host']."/".$CONF['self_path']."?invoke=TRUE&cid=".$elem['amc_character'], 'received_char',null); - } - } - else { - $atom_list = array(); - - foreach($chars as $elem) { - $_DATA->freeData($elem['amc_character']); - - #STEP 1: evaluate atoms - - //get unfinished perks which have no parent or complete parent - #$res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE (ap_parent IS NULL OR EXISTS (SELECT * FROM ach_player_perk WHERE app_player='".$elem['amc_character']."' AND app_perk=ap_parent)) AND (NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_player='".$elem['amc_character']."' AND app_perk=ap_id))","ARRAY"); - - //get all unfinished perks since perks my not directly inherit objectives... - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_player='".$elem['amc_character']."' AND app_perk=ap_id)","ARRAY"); - foreach($res as $perk) { - //get unfinished atoms belonging to unfinished objectives - $res = $DBc->sendSQL("SELECT ach_atom.* FROM ach_atom,ach_objective WHERE ao_perk='".$perk['ap_id']."' AND ao_id=atom_objective AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_player='".$elem['amc_character']."' AND apo_objective=ao_id)","ARRAY"); - foreach($res2 as $atom) { - if(!isset($atom_list[$atom['atom_id']])) { // only load if not already cached - $atom_list[$atom['atom_id']] = new Atom($atom); - } - - $atom_list[$atom['atom_id']]->evalRuleset($elem['amc_character']); - } - } - - $_DATA->freeData($elem['amc_character']); - - $DBc->sendSQL("UPDATE ach_monitor_character SET amc_last_import='".time()."', amc_working='0' WHERE amc_character='".$elem['amc_character']."' AND amc_working='".$RID."'","NONE"); - - #STEP 2: detect obj/perk progression - //obj - $res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_condition='all' AND NOT EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id AND NOT EXISTS (SELECT * FROM ach_player_atom WHERE apa_atom=atom_id AND apa_state!='GRANT' AND apa_player='".$elem['amc_character']."'))","ARRAY"); - $sz = sizeof($res); - for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$elem['amc_character']."','".time()."')","NONE"); - } - - $res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_condition='value' AND ao_value<=(SELECT count(*) FROM ach_atom WHERE atom_objective=ao_id AND EXISTS (SELECT * FROM ach_player_atom WHERE apa_atom=atom_id AND apa_state='GRANT' AND apa_player='".$elem['amc_character']."'))","ARRAY"); - $sz = sizeof($res); - for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$elem['amc_character']."','".time()."')","NONE"); - } - - $res = $DBc->sendSQL("SELECT ao_id FROM ach_objective WHERE ao_condition='any' AND EXISTS (SELECT * FROM ach_atom WHERE atom_objective=ao_id AND EXISTS (SELECT * FROM ach_player_atom WHERE apa_atom=atom_id AND apa_state='GRANT' AND apa_player='".$elem['amc_character']."'))","ARRAY"); - $sz = sizeof($res); - for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_objective (apo_objective,apo_player,apo_date) VALUES ('".$res[$i]['ao_id']."','".$elem['amc_character']."','".time()."')","NONE"); - } - - //perk - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='all' AND NOT EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND NOT EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_state!='GRANT' AND apo_player='".$elem['amc_character']."'))","ARRAY"); - $sz = sizeof($res); - for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_perk (app_objective,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$elem['amc_character']."','".time()."')","NONE"); - } - - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='value' AND ap_value<=(SELECT count(*) FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_state='GRANT' AND apo_player='".$elem['amc_character']."'))","ARRAY"); - $sz = sizeof($res); - for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_perk (app_objective,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$elem['amc_character']."','".time()."')","NONE"); - } - - $res = $DBc->sendSQL("SELECT ap_id FROM ach_perk WHERE ap_condition='any' AND EXISTS (SELECT * FROM ach_objective WHERE ao_perk=ap_id AND EXISTS (SELECT * FROM ach_player_objective WHERE apo_objective=ao_id AND apo_state='GRANT' AND apo_player='".$elem['amc_character']."'))","ARRAY"); - $sz = sizeof($res); - for($i=0;$i<$sz;$i++) { - $DBc->sendSQL("INSERT INTO ach_player_perk (app_objective,app_player,app_date) VALUES ('".$res[$i]['ap_id']."','".$elem['amc_character']."','".time()."')","NONE"); - } - } - } - - if($CONF['sleep_time'] != false) { - sleep($CONF['sleep_time']); - } - - //self call if cron mode is on - if($MODE == "CRON" && $CONF['enable_selfcall'] == true) { - $DBc->sendSQL("UPDATE ach_monitor_state SET ams_end='".time()."' WHERE ams_id='".$RID."'","NONE"); - - $fp = fsockopen($CONF['self_host'], 80, $errno, $errstr, 30); - if(!$fp) { - logf("ERROR: self call; socket: ".$errstr." (."$errno.")"); - } - else { - $out = "GET ".$CONF['self_path']." HTTP/1.1\r\n"; - $out .= "Host: ".$CONF['self_host']."\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - fwrite($fp, $out); - fclose($fp); - } - } - - if($logfile) { - $logfile->write(); - } - - exit(0); -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php b/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php index 9e9bc30ab..628d454b0 100644 --- a/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php +++ b/code/web/app/app_achievements/_AchWebParser/class/Atom_class.php @@ -1,4 +1,10 @@ user = $user; } - function register() { - global $DBc,$_DATA; - - #echo "register
"; + function register() { // register the atom's ruleset code try { return eval($this->ruleset); @@ -25,53 +28,55 @@ catch(Exception $e) { echo $e->getMessage(); } + + return null; } - function registerValue($name,$func) { + function registerValue($name,$func) { // register to listen for a value global $_DISPATCHER; $tmp = new Callback($this,$func); $_DISPATCHER->registerValue($name,$tmp); } - function unregisterValue($name,$callback) { + function unregisterValue($name,$callback) { // unregister listening global $_DISPATCHER; $_DISPATCHER->unregisterValue($name,$callback); } - function registerEntity($name,$func) { + function registerEntity($name,$func) { // register to listen for an entity global $_DISPATCHER; $tmp = new Callback($this,$func); $_DISPATCHER->registerEntity($name,$tmp); } - function unregisterEntity($name,$callback) { + function unregisterEntity($name,$callback) { // unregister global $_DISPATCHER; $_DISPATCHER->unregisterEntity($name,$callback); } - function grant($count = 1) { + function grant($count = 1) { // grant an atom global $DBc; $DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state,apa_value) VALUES ('".$this->id."','".$this->user."','".time()."',null,'GRANT','".$count."')","NONE"); } - function deny() { + function deny() { // deny an atom global $DBc; $DBc->sendSQL("INSERT INTO ach_player_atom (apa_atom,apa_player,apa_date,apa_expire,apa_state) VALUES ('".$this->id."','".$this->user."','".time()."',null,'DENY','1')","NONE"); } - function reset_() { + function reset_() { // reset progress for this atom global $DBc; $DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$this->user."'","NONE"); } - function reset_all() { + function reset_all() { // reset progress for all atoms of the same objective global $DBc; $res = $DBc->sendSQL("SELECT atom_id FROM ach_atom WHERE atom_objective='".$this->objective."'","ARRAY"); @@ -81,13 +86,13 @@ } } - function unlock() { + function unlock() { // unlock atom global $DBc; $DBc->sendSQL("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."' AND apa_player='".$this->user."' AND apa_state='DENY'","NONE"); } - function unlock_all() { + function unlock_all() { // unlock all atoms of the same objective global $DBc; $res = $DBc->sendSQL("SELECT atom_id FROM ach_atom WHERE atom_objective='".$this->objective."'","ARRAY"); diff --git a/code/web/app/app_achievements/_AchWebParser/class/Callback_class.php b/code/web/app/app_achievements/_AchWebParser/class/Callback_class.php index 5d7351f74..3449d024f 100644 --- a/code/web/app/app_achievements/_AchWebParser/class/Callback_class.php +++ b/code/web/app/app_achievements/_AchWebParser/class/Callback_class.php @@ -1,4 +1,7 @@ func = $func; } - function call($what) { + function call($what) { // now call it eval(''.$this->func.'($what,$this->who,$this);'); } } diff --git a/code/web/app/app_achievements/_AchWebParser/class/DataSource_abstract.php b/code/web/app/app_achievements/_AchWebParser/class/DataSource_abstract.php deleted file mode 100644 index bfda4f00e..000000000 --- a/code/web/app/app_achievements/_AchWebParser/class/DataSource_abstract.php +++ /dev/null @@ -1,47 +0,0 @@ -types = $CONF["types"]; - $this->write = $CONF["write"]; - $this->data = array(); - } - - function freeData($ident) { - unset $this->data[$ident]; - } - - function getTypes() { - return $this->types; - } - - function isWriteable() { - return $this->write; - } - - function getData($ident,$type,$mode,$cond) { - if(!isset($this->data[$ident])) { - $this->data[$ident] = array(); - } - - if(!isset($this->data[$ident][$type])) { - $this->loadData($ident,$type); - } - - if($mode == "*") { - return $this->data[$ident][$type]->getRows($cond); - } - else { - return $this->data[$ident][$type]->countRows($cond); - } - } - - abstract function loadData($ident,$type); - abstract function writeData($ident,$type,$keys,$data); - } -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/class/DataTable_class.php b/code/web/app/app_achievements/_AchWebParser/class/DataTable_class.php deleted file mode 100644 index fcc7ba8b5..000000000 --- a/code/web/app/app_achievements/_AchWebParser/class/DataTable_class.php +++ /dev/null @@ -1,88 +0,0 @@ -table = $res; - } - - function countRows(&$cond) { - $rules = $this->parseCond($cond); - - $res = 0; - - foreach($this->table as $elem) { - $m = true; - - foreach($rules as $r) { - $tmp = ' - if($elem[$r[0]] '.$r[1].') { } - else { - $m = false; - } - '; - - try { - eval($tmp); - } - catch(Exception $e) { - return $e->getMessage(); - } - } - - if($m == true) { - $res++; - } - } - - return $res; - } - - function getRows(&$cond) { - $rules = $this->parseCond($cond); - - $res = array(); - - foreach($this->table as $elem) { - $m = true; - - foreach($rules as $r) { - $tmp = ' - if($elem[$r[0]] '.$r[1].') { } - else { - $m = false; - } - '; - - try { - eval($tmp); - } - catch(Exception $e) { - return $e->getMessage(); - } - } - - if($m == true) { - $res[] = $elem; - } - } - - return $res; - } - - private function parseCond(&$cond) { - $c = array(); - - $tmp = explode("and",strtolower($cond)); - - foreach($tmp as $elem) { - $matches = array(); - preg_match("#([a-zA-Z0-9_]+) ?([.]*)#", trim($elem), $matches); - - $c[] = array($matches[1],$matches[2]); - } - - return $c; - } - } -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php b/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php index aab4cb01c..02ff15356 100644 --- a/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php +++ b/code/web/app/app_achievements/_AchWebParser/class/Logfile_class.php @@ -1,7 +1,6 @@ logfile = false; diff --git a/code/web/app/app_achievements/_AchWebParser/class/ParallelCURL_class.php b/code/web/app/app_achievements/_AchWebParser/class/ParallelCURL_class.php deleted file mode 100644 index 233d7a101..000000000 --- a/code/web/app/app_achievements/_AchWebParser/class/ParallelCURL_class.php +++ /dev/null @@ -1,160 +0,0 @@ -startRequest('http://example.com', 'on_request_done', array('something')); -// -// The first argument is the address that should be fetched -// The second is the callback function that will be run once the request is done -// The third is a 'cookie', that can contain arbitrary data to be passed to the callback -// -// This startRequest call will return immediately, as long as less than the maximum number of -// requests are outstanding. Once the request is done, the callback function will be called, eg: -// -// on_request_done($content, 'http://example.com', $ch, array('something')); -// -// The callback should take four arguments. The first is a string containing the content found at -// the URL. The second is the original URL requested, the third is the curl handle of the request that -// can be queried to get the results, and the fourth is the arbitrary 'cookie' value that you -// associated with this object. This cookie contains user-defined data. -// -// By Pete Warden , freely reusable, see http://petewarden.typepad.com for more - -class ParallelCurl { - - public $max_requests; - public $options; - - public $outstanding_requests; - public $multi_handle; - - public function __construct($in_max_requests = 10, $in_options = array()) { - $this->max_requests = $in_max_requests; - $this->options = $in_options; - - $this->outstanding_requests = array(); - $this->multi_handle = curl_multi_init(); - } - - //Ensure all the requests finish nicely - public function __destruct() { - $this->finishAllRequests(); - } - - // Sets how many requests can be outstanding at once before we block and wait for one to - // finish before starting the next one - public function setMaxRequests($in_max_requests) { - $this->max_requests = $in_max_requests; - } - - // Sets the options to pass to curl, using the format of curl_setopt_array() - public function setOptions($in_options) { - - $this->options = $in_options; - } - - // Start a fetch from the $url address, calling the $callback function passing the optional - // $user_data value. The callback should accept 3 arguments, the url, curl handle and user - // data, eg on_request_done($url, $ch, $user_data); - public function startRequest($url, $callback, $user_data = array(), $post_fields=null) { - - if( $this->max_requests > 0 ) - $this->waitForOutstandingRequestsToDropBelow($this->max_requests); - - $ch = curl_init(); - curl_setopt_array($ch, $this->options); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); - - if (isset($post_fields)) { - curl_setopt($ch, CURLOPT_POST, TRUE); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); - } - - curl_multi_add_handle($this->multi_handle, $ch); - - $ch_array_key = (int)$ch; - - $this->outstanding_requests[$ch_array_key] = array( - 'url' => $url, - 'callback' => $callback, - 'user_data' => $user_data, - ); - - $this->checkForCompletedRequests(); - } - - // You *MUST* call this function at the end of your script. It waits for any running requests - // to complete, and calls their callback functions - public function finishAllRequests() { - $this->waitForOutstandingRequestsToDropBelow(1); - } - - // Checks to see if any of the outstanding requests have finished - private function checkForCompletedRequests() { - - // Call select to see if anything is waiting for us - if (curl_multi_select($this->multi_handle, 0.0) === -1) - return; - - // Since something's waiting, give curl a chance to process it - do { - $mrc = curl_multi_exec($this->multi_handle, $active); - } while ($mrc == CURLM_CALL_MULTI_PERFORM); - - // Now grab the information about the completed requests - while ($info = curl_multi_info_read($this->multi_handle)) { - - $ch = $info['handle']; - $ch_array_key = (int)$ch; - - if (!isset($this->outstanding_requests[$ch_array_key])) { - die("Error - handle wasn't found in requests: '$ch' in ". - print_r($this->outstanding_requests, true)); - } - - $request = $this->outstanding_requests[$ch_array_key]; - - $url = $request['url']; - $content = curl_multi_getcontent($ch); - $callback = $request['callback']; - $user_data = $request['user_data']; - - call_user_func($callback, $content, $url, $ch, $user_data); - - unset($this->outstanding_requests[$ch_array_key]); - - curl_multi_remove_handle($this->multi_handle, $ch); - } - - } - - // Blocks until there's less than the specified number of requests outstanding - private function waitForOutstandingRequestsToDropBelow($max) - { - while (1) { - $this->checkForCompletedRequests(); - if (count($this->outstanding_requests)<$max) - break; - - usleep(10000); - } - } - -} - - -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php b/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php index 5aca70da4..7e1fd43c2 100644 --- a/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php +++ b/code/web/app/app_achievements/_AchWebParser/class/mySQL_class.php @@ -95,7 +95,7 @@ else { return $res; } - mysql_free_result($res); + //mysql_free_result($res); } else { return false; diff --git a/code/web/app/app_achievements/_AchWebParser/conf.php b/code/web/app/app_achievements/_AchWebParser/conf.php index dc5286fd1..cf259daba 100644 --- a/code/web/app/app_achievements/_AchWebParser/conf.php +++ b/code/web/app/app_achievements/_AchWebParser/conf.php @@ -18,4 +18,8 @@ $CONF['char_mysql_database'] = "app_achievements"; $CONF['data_source'] = array("PDRtoXMLdriver"); + + $CONF['facebook'] = false; + $CONF['fb_id'] = "447985781893176"; + $CONF['fb_secret'] = "f953772f1f7d871db022a6023e7a3f42"; ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/include/functions_inc.php b/code/web/app/app_achievements/_AchWebParser/include/functions_inc.php index 969ffc2f1..ed1a02ded 100644 --- a/code/web/app/app_achievements/_AchWebParser/include/functions_inc.php +++ b/code/web/app/app_achievements/_AchWebParser/include/functions_inc.php @@ -26,7 +26,14 @@ return mktime($t[0],$t[1],$t[2],$d[1],$d[2],$d[0]); } - function received_char($res, $url, $ch, $argv) { - logf("character tracking returned: ".$res); + function curl_get_file_contents($URL) { // http://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/ + $c = curl_init(); + curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($c, CURLOPT_URL, $URL); + $contents = curl_exec($c); + $err = curl_getinfo($c,CURLINFO_HTTP_CODE); + curl_close($c); + if ($contents) return $contents; + else return FALSE; } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/parser.php b/code/web/app/app_achievements/_AchWebParser/parser.php deleted file mode 100644 index 65836d1ee..000000000 --- a/code/web/app/app_achievements/_AchWebParser/parser.php +++ /dev/null @@ -1,132 +0,0 @@ -private function parseRuleset() { - $this->ruleset_parsed = $this->ruleset; - #WORKPAD:#### - /* - Trigger: - by value - (by event) - - Sources: - XML - valuecache - ring_open - (Achievement Service) - (Mirror Service) - - Keywords: - VALUE - GRANT:EVENT player_death - DENY:TIMER 3600 - RESET - RESET_ALL - UNLOCK - UNLOCK_ALL - - IF - SCRIPT - MSG - - VALUE dappers = c_money - IF(dappers >= 5000) { - GRANT - } - - VALUE sum = c_cache:sum - IF(sum > 1000) { - GRANT - } - - VALUE tmp = c_fame[scorchers] - IF(tmp == 0) { - DENY:3600 - } - - VALUE x = c_pos_x - VALUE y = c_pos_y - SCRIPT inside(x,y) { - IF(MSG == "Majestic Garden") { - GRANT - } - } - - EVENT player_death - ON player_death { - UNLOCK - } - - EVENT region_changed - ON region_changed { - IF(MSG == "Majestic Garden") { - GRANT - } - } - */ - ############# - - - #VALUE var = name; - $match = array(); - preg_match_all("#VALUE ([a-zA-Z0-9_]) ?= ?([a-zA-Z0-9_]);#", $this->ruleset_parsed, $match,PREG_PATTERN_ORDER); - foreach($match[0] as $key=>$elem) { - $tmp = '$'.$match[1][$key].' = $_DATA->getData("VALUE","'.$match[2][$key].'",$user);\n'; - $tmp .= 'if($'.$match[1][$key].' == ) {\n'; - $tmp .= 'ERROR\n'; - $tmp .= '}\n'; - $this->ruleset_parsed = str_replace($elem,$tmp,$this->ruleset_parsed); - } - - - #IF(statement) { } - $match = array(); - preg_match_all("#IF ?\(([^\)]*)\) ?{#", $this->ruleset_parsed, $match,PREG_PATTERN_ORDER); - foreach($match[0] as $key=>$elem) { - $tmp = 'if() {\n'; - $this->ruleset_parsed = str_replace($elem,$tmp,$this->ruleset_parsed); - } - - - SCRIPT script(a,r,g,s) { - MSG - } - - #EVENT name; - $match = array(); - preg_match_all("#EVENT ([^;]*);#", $this->ruleset_parsed, $match,PREG_PATTERN_ORDER); - foreach($match[0] as $key=>$elem) { - $tmp = ''; - $this->ruleset_parsed = str_replace($elem,$tmp,$this->ruleset_parsed); - } - - ON name { - MSG - } - - #GRANT; - #GRANT:EVENT name; - #GRANT:TIMER seconds; - $match = array(); - preg_match_all("#GRANT:?([^;]*);#", $this->ruleset_parsed, $match,PREG_PATTERN_ORDER); - foreach($match[0] as $key=>$elem) { - $tmp = '$this->grant("'.$match[1][$key].'");'; - $this->ruleset_parsed = str_replace($elem,$tmp,$this->ruleset_parsed); - } - - #DENY; - #DENY:EVENT name; - #DENY:TIMER seconds; - $match = array(); - preg_match_all("#DENY:?([^;]*);#", $this->ruleset_parsed, $match,PREG_PATTERN_ORDER); - foreach($match[0] as $key=>$elem) { - $tmp = '$this->deny("'.$match[1][$key].'");'; - $this->ruleset_parsed = str_replace($elem,$tmp,$this->ruleset_parsed); - } - - #RESET; - #RESET_ALL; - #UNLOCK; - #UNLOCK_ALL; - $this->ruleset_parsed = str_replace("RESET_ALL;",'$this->reset_all();',$this->ruleset_parsed); - $this->ruleset_parsed = str_replace("RESET;",'$this->reset_();',$this->ruleset_parsed); - $this->ruleset_parsed = str_replace("UNLOCK_ALL;",'$this->unlock_all();',$this->ruleset_parsed); - $this->ruleset_parsed = str_replace("UNLOCK;",'$this->unlock();',$this->ruleset_parsed); - } \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/script/include_InPoly_class.php b/code/web/app/app_achievements/_AchWebParser/script/include_InPoly_class.php index 491fa11bb..14e2ff3a2 100644 --- a/code/web/app/app_achievements/_AchWebParser/script/include_InPoly_class.php +++ b/code/web/app/app_achievements/_AchWebParser/script/include_InPoly_class.php @@ -58,6 +58,8 @@ } } + return false; + } function pointStringToCoordinates($pointString) { diff --git a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php index b48da1c0d..655a02623 100644 --- a/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php +++ b/code/web/app/app_achievements/_AchWebParser/source/PDRtoXMLdriver/PDRtoXMLdriver_class.php @@ -80,7 +80,7 @@ } function drive($cid) { - global $CONF,$_DISPATCHER; + global $_DISPATCHER; echo "kk"; diff --git a/code/web/app/app_achievements/_AchWebParser/source/ValueCache/ValueCache_class.php b/code/web/app/app_achievements/_AchWebParser/source/ValueCache/ValueCache_class.php deleted file mode 100644 index 7d92d4996..000000000 --- a/code/web/app/app_achievements/_AchWebParser/source/ValueCache/ValueCache_class.php +++ /dev/null @@ -1,19 +0,0 @@ -sendSQL("SELECT apv_value,apv_date,apv_name FROM ach_player_valuecache WHERE apv_player='".$DBc->mre($ident)."'","ARRAY"); - - $this->data[$ident][$type] = new DataTable($res); - } - - function writeData($ident,$type,$keys,$data) { - global $DBc; - - $DBc->sendSQL("INSERT INTO ach_player_valuecache (apv_name,apv_player,apv_value,apv_date) VALUES ('".$DBc->mre($keys[0])."','".$DBc->mre($ident)."','".$DBc->mre($data[0])."','".time()."') ON DUPLICATE KEY UPDATE apv_value='".$DBc->mre($data)."', apv_date='".time()."'","NONE"); - } - } -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/source/ValueCache/conf.php b/code/web/app/app_achievements/_AchWebParser/source/ValueCache/conf.php deleted file mode 100644 index 69f6c5cf8..000000000 --- a/code/web/app/app_achievements/_AchWebParser/source/ValueCache/conf.php +++ /dev/null @@ -1,7 +0,0 @@ - \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/source/XMLapi/XMLapi_class.php b/code/web/app/app_achievements/_AchWebParser/source/XMLapi/XMLapi_class.php deleted file mode 100644 index 9ba55aa0a..000000000 --- a/code/web/app/app_achievements/_AchWebParser/source/XMLapi/XMLapi_class.php +++ /dev/null @@ -1,229 +0,0 @@ -xml_path = $CONF['xml_path']; - } - - function loadData($ident,$type) { - switch($type) { - case 'c_stats': - case 'c_connection': - case 'c_gear': - case 'c_fp': - case 'c_skills': - case 'c_fame': - case 'c_pet': - $path = $this->xml_path."full/".$ident.".xml"; - break; - case 'c_items': - $path = $this->xml_path."item/".$ident.".xml"; - break; - default: - return false; - break; - } - - $xml = new SimpleXMLElement(file_get_contents($path)); - - switch($type) { - case 'c_stats': - $this->loadStats($xml); - break; - case 'c_connection': - $this->loadConnection($xml); - break; - case 'c_gear': - $this->loadGear($xml); - break; - case 'c_fp': - $this->loadFp($xml); - break; - case 'c_skills': - $this->loadSkills($xml); - break; - case 'c_fame': - $this->loadFame($xml); - break; - case 'c_pet': - $this->loadPet($xml); - break; - case 'c_items': - $this->loadItems($xml); - break; - default: - return false; - break; - } - } - - private function getItems(&$xml) { - $dta = array(); - - $r = $xml->xpath('item'); - $dta[] = $r->attributes(); - - return $dta; - } - - private function loadGear(&$xml) { - $this->data['c_gear'] = $this->getItems($xml); - } - - private function loadFp(&$xml) { - $dta = array(); - - $r = $xml->xpath('faction_points'); - foreach($r->children() as $elem) { - $dta[] = array($elem->getName()=>$elem); - } - - $this->data['c_fp'] = $dta; - } - - private function loadSkills(&$xml) { - $dta = array(); - - $r = $xml->xpath('skills'); - foreach($r->children() as $elem) { - $dta[] = array($elem->getName()=>$elem); - } - - $this->data['c_skills'] = $dta; - } - - private function loadPet(&$xml) { - $dta = array(); - - $r = $xml->xpath('pet'); - foreach($r as $pet) { - $tmp = $pet->attributes(); - $child = $pet->children(); - $tmp = array_merge($tmp,$child[0]->attributes()); - - $dta[] = $tmp; - } - - $this->data['c_pet'] = $dta; - } - - private function loadFame(&$xml) { - $dta = array(); - - $r = $xml->xpath('fames'); - foreach($r->children() as $elem) { - $dta[] = array($elem->getName()=>$elem); - } - - $this->data['c_fame'] = $dta; - } - - private function loadItems(&$xml) { - $this->data['c_items'] = $this->getItems($xml); - } - - private function loadConnection(&$xml) { - $dta = array(); - - $r = $xml->xpath('log'); - - while(list( , $node) = each($r)) { - #$attr = $node->attributes(); - #$dta[] = array("in"=>$attr[],"out"=>$attr[1],"duration"=>$attr[2]); - $dta[] = $node->attributes(); - } - - $this->data['c_connection'] = $dta; - } - - private function loadStats(&$xml) { - $dta = array(); - - $slist = array( 'name', - 'shard', - 'uid', - 'slot', - 'cid', - 'race', - 'gender', - 'titleid', - 'played_time', - 'latest_login', - 'latest_logout', - 'hair_type', - 'hair_color', - 'tattoo', - 'eyes_color', - 'gabarit_height', - 'gabarit_torso_width', - 'gabarit_arms_width', - 'gabarit_legs_width', - 'gabarit_breast_size', - 'morph1', - 'morph2', - 'morph3', - 'morph4', - 'morph5', - 'morph6', - 'morph7', - 'morph8', - 'gid', - 'name', - 'icon', - 'money', - 'cult', - 'civ', - 'constitution', - 'metabolism', - 'intelligence', - 'wisdom', - 'strength', - 'wellbalanced', - 'dexterity', - 'will', - 'building'); - - foreach($slist as $elem) { - $r = $xml->xpath($elem); - $dta[$elem] = $r[0]; - } - - # - $r = $xml->xpath("position"); - $attr = $r->attributes(); - $dta['pos_x'] = $attr['x']; - $dta['pos_y'] = $attr['y']; - $dta['pos_head'] = $attr['head']; - - #3941 - #1790 - #1890 - #2750 - $r = $xml->xpath("hitpoints"); - $attr = $r->attributes(); - $dta['hitpoints'] = $attr['hitpoints']; - - $r = $xml->xpath("stamina"); - $attr = $r->attributes(); - $dta['stamina'] = $attr['stamina']; - - $r = $xml->xpath("sap"); - $attr = $r->attributes(); - $dta['sap'] = $attr['sap']; - - $r = $xml->xpath("focus"); - $attr = $r->attributes(); - $dta['focus'] = $attr['focus']; - - $this->data['c_stats'] = array($dta); - } - - function writeData($ident,$field,$data,$type) { - return false; - } - - } -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/_AchWebParser/source/XMLapi/conf.php b/code/web/app/app_achievements/_AchWebParser/source/XMLapi/conf.php deleted file mode 100644 index d243c6a67..000000000 --- a/code/web/app/app_achievements/_AchWebParser/source/XMLapi/conf.php +++ /dev/null @@ -1,8 +0,0 @@ - \ No newline at end of file diff --git a/code/web/app/app_achievements/_doc/Class_scheme.dia b/code/web/app/app_achievements/_doc/Class_scheme.dia index 723783818..111831ea0 100644 Binary files a/code/web/app/app_achievements/_doc/Class_scheme.dia and b/code/web/app/app_achievements/_doc/Class_scheme.dia differ diff --git a/code/web/app/app_achievements/_doc/Class_scheme.png b/code/web/app/app_achievements/_doc/Class_scheme.png index f282dad0e..9c37c3570 100644 Binary files a/code/web/app/app_achievements/_doc/Class_scheme.png and b/code/web/app/app_achievements/_doc/Class_scheme.png differ diff --git a/code/web/app/app_achievements/_doc/ER_scheme.dia b/code/web/app/app_achievements/_doc/ER_scheme.dia index bfac940f4..c2ae2694d 100644 Binary files a/code/web/app/app_achievements/_doc/ER_scheme.dia and b/code/web/app/app_achievements/_doc/ER_scheme.dia differ diff --git a/code/web/app/app_achievements/_doc/ER_scheme.png b/code/web/app/app_achievements/_doc/ER_scheme.png index c1e7f5e59..898378ac0 100644 Binary files a/code/web/app/app_achievements/_doc/ER_scheme.png and b/code/web/app/app_achievements/_doc/ER_scheme.png differ diff --git a/code/web/app/app_achievements/_doc/Ryzom Player Achievements.pdf b/code/web/app/app_achievements/_doc/Ryzom Player Achievements.pdf new file mode 100644 index 000000000..6ae82b1f1 Binary files /dev/null and b/code/web/app/app_achievements/_doc/Ryzom Player Achievements.pdf differ diff --git a/code/web/app/app_achievements/_doc/app_achievements.sql b/code/web/app/app_achievements/_doc/app_achievements.sql index 15d92eb41..572dc9d55 100644 --- a/code/web/app/app_achievements/_doc/app_achievements.sql +++ b/code/web/app/app_achievements/_doc/app_achievements.sql @@ -1,13 +1,14 @@ -- phpMyAdmin SQL Dump --- version 3.3.3 +-- version 3.5.1 -- http://www.phpmyadmin.net -- -- Host: localhost --- Erstellungszeit: 27. Mai 2012 um 21:05 --- Server Version: 5.1.46 --- PHP-Version: 5.3.2 +-- Generation Time: Aug 20, 2012 at 01:48 PM +-- Server version: 5.5.24-log +-- PHP Version: 5.4.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; @@ -16,13 +17,13 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET NAMES utf8 */; -- --- Datenbank: `app_achievements` +-- Database: `app_achievements_test` -- -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_achievement` +-- Table structure for table `ach_achievement` -- CREATE TABLE IF NOT EXISTS `ach_achievement` ( @@ -33,26 +34,29 @@ CREATE TABLE IF NOT EXISTS `ach_achievement` ( `aa_tie_cult` varchar(64) COLLATE utf8_bin DEFAULT NULL, `aa_tie_civ` varchar(64) COLLATE utf8_bin DEFAULT NULL, `aa_image` varchar(64) COLLATE utf8_bin NOT NULL, + `aa_dev` tinyint(1) unsigned NOT NULL DEFAULT '0', + `aa_sticky` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`aa_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=5 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=346 ; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_achievement_lang` +-- Table structure for table `ach_achievement_lang` -- CREATE TABLE IF NOT EXISTS `ach_achievement_lang` ( `aal_achievement` bigint(20) unsigned NOT NULL, `aal_lang` varchar(2) COLLATE utf8_bin NOT NULL, `aal_name` varchar(255) COLLATE utf8_bin NOT NULL, + `aal_template` varchar(255) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`aal_achievement`,`aal_lang`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_atom` +-- Table structure for table `ach_atom` -- CREATE TABLE IF NOT EXISTS `ach_atom` ( @@ -60,28 +64,30 @@ CREATE TABLE IF NOT EXISTS `ach_atom` ( `atom_objective` bigint(20) unsigned NOT NULL, `atom_mandatory` tinyint(1) unsigned NOT NULL, `atom_ruleset` blob NOT NULL, - `atom_primary` tinyint(1) unsigned NOT NULL, + `atom_ruleset_parsed` blob NOT NULL, PRIMARY KEY (`atom_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=25 ; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_category` +-- Table structure for table `ach_category` -- CREATE TABLE IF NOT EXISTS `ach_category` ( `ac_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `ac_parent` bigint(20) unsigned DEFAULT NULL, `ac_order` smallint(5) unsigned NOT NULL, - `ac_image` varchar(64) COLLATE utf8_bin NOT NULL, + `ac_image` varchar(64) COLLATE utf8_bin DEFAULT NULL, + `ac_dev` tinyint(1) unsigned NOT NULL DEFAULT '0', + `ac_heroic` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`ac_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=6 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=50 ; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_category_lang` +-- Table structure for table `ach_category_lang` -- CREATE TABLE IF NOT EXISTS `ach_category_lang` ( @@ -94,77 +100,66 @@ CREATE TABLE IF NOT EXISTS `ach_category_lang` ( -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_objective` +-- Table structure for table `ach_fb_token` -- -CREATE TABLE IF NOT EXISTS `ach_objective` ( - `ao_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `ao_perk` bigint(20) unsigned NOT NULL, - `ao_condition` enum('all','any','value') COLLATE utf8_bin NOT NULL, - `ao_value` int(10) unsigned DEFAULT NULL, - `ao_display` enum('simple','meta','value','hidden') COLLATE utf8_bin NOT NULL DEFAULT 'hidden', - PRIMARY KEY (`ao_id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=14 ; +CREATE TABLE IF NOT EXISTS `ach_fb_token` ( + `aft_player` bigint(20) unsigned NOT NULL, + `aft_token` varchar(255) NOT NULL, + `aft_date` bigint(20) unsigned NOT NULL, + `aft_allow` tinyint(1) unsigned NOT NULL, + PRIMARY KEY (`aft_player`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_objective_lang` +-- Table structure for table `ach_objective` +-- + +CREATE TABLE IF NOT EXISTS `ach_objective` ( + `ao_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `ao_task` bigint(20) unsigned NOT NULL, + `ao_condition` enum('all','any','value') COLLATE utf8_bin NOT NULL, + `ao_value` bigint(20) unsigned DEFAULT NULL, + `ao_display` enum('simple','meta','value','hidden') COLLATE utf8_bin NOT NULL DEFAULT 'hidden', + `ao_metalink` bigint(20) unsigned DEFAULT NULL, + PRIMARY KEY (`ao_id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2026 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ach_objective_lang` -- CREATE TABLE IF NOT EXISTS `ach_objective_lang` ( `aol_objective` bigint(20) unsigned NOT NULL, `aol_lang` varchar(2) COLLATE utf8_bin NOT NULL, - `aol_name` varchar(255) COLLATE utf8_bin NOT NULL, + `aol_name` varchar(255) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`aol_objective`,`aol_lang`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_perk` --- - -CREATE TABLE IF NOT EXISTS `ach_perk` ( - `ap_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `ap_achievement` bigint(20) unsigned NOT NULL, - `ap_parent` bigint(20) unsigned DEFAULT NULL, - `ap_value` int(10) unsigned NOT NULL, - PRIMARY KEY (`ap_id`), - UNIQUE KEY `ap_parent` (`ap_parent`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=7 ; - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `ach_perk_lang` --- - -CREATE TABLE IF NOT EXISTS `ach_perk_lang` ( - `apl_perk` bigint(20) unsigned NOT NULL, - `apl_lang` varchar(2) COLLATE utf8_bin NOT NULL, - `apl_name` varchar(255) COLLATE utf8_bin NOT NULL, - PRIMARY KEY (`apl_perk`,`apl_lang`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; - --- -------------------------------------------------------- - --- --- Tabellenstruktur für Tabelle `ach_player_atom` +-- Table structure for table `ach_player_atom` -- CREATE TABLE IF NOT EXISTS `ach_player_atom` ( `apa_atom` bigint(20) unsigned NOT NULL, `apa_player` bigint(20) unsigned NOT NULL, `apa_date` bigint(20) unsigned NOT NULL, - `apa_expire` blob NOT NULL, + `apa_expire` blob, + `apa_state` enum('GRANT','DENY') COLLATE utf8_bin NOT NULL, + `apa_value` bigint(20) unsigned NOT NULL, KEY `apa_atom` (`apa_atom`,`apa_player`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_player_objective` +-- Table structure for table `ach_player_objective` -- CREATE TABLE IF NOT EXISTS `ach_player_objective` ( @@ -177,20 +172,21 @@ CREATE TABLE IF NOT EXISTS `ach_player_objective` ( -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_player_perk` +-- Table structure for table `ach_player_task` -- -CREATE TABLE IF NOT EXISTS `ach_player_perk` ( - `app_perk` bigint(20) unsigned NOT NULL, - `app_player` bigint(20) unsigned NOT NULL, - `app_date` bigint(20) unsigned NOT NULL, - PRIMARY KEY (`app_perk`,`app_player`) +CREATE TABLE IF NOT EXISTS `ach_player_task` ( + `apt_task` bigint(20) unsigned NOT NULL, + `apt_player` bigint(20) unsigned NOT NULL, + `apt_date` bigint(20) unsigned NOT NULL, + `apt_fb` tinyint(1) unsigned NOT NULL, + PRIMARY KEY (`apt_task`,`apt_player`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- --- Tabellenstruktur für Tabelle `ach_player_valuecache` +-- Table structure for table `ach_player_valuecache` -- CREATE TABLE IF NOT EXISTS `ach_player_valuecache` ( @@ -200,3 +196,40 @@ CREATE TABLE IF NOT EXISTS `ach_player_valuecache` ( `apv_date` bigint(20) unsigned NOT NULL, PRIMARY KEY (`apv_name`,`apv_player`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ach_task` +-- + +CREATE TABLE IF NOT EXISTS `ach_task` ( + `at_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `at_achievement` bigint(20) unsigned NOT NULL, + `at_parent` bigint(20) unsigned DEFAULT NULL, + `at_value` int(10) unsigned NOT NULL, + `at_condition` enum('all','any','value') COLLATE utf8_bin NOT NULL DEFAULT 'all', + `at_condition_value` int(10) unsigned DEFAULT NULL, + `at_dev` tinyint(1) unsigned NOT NULL DEFAULT '0', + `at_torder` smallint(5) unsigned NOT NULL, + PRIMARY KEY (`at_id`), + UNIQUE KEY `ap_parent` (`at_parent`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=635 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ach_task_lang` +-- + +CREATE TABLE IF NOT EXISTS `ach_task_lang` ( + `atl_task` bigint(20) unsigned NOT NULL, + `atl_lang` varchar(2) COLLATE utf8_bin NOT NULL, + `atl_name` varchar(255) COLLATE utf8_bin NOT NULL, + `atl_template` varchar(255) COLLATE utf8_bin DEFAULT NULL, + PRIMARY KEY (`atl_task`,`atl_lang`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/code/web/app/app_achievements/_doc/devshot_005.jpg b/code/web/app/app_achievements/_doc/devshot_005.jpg deleted file mode 100644 index 63fc3380d..000000000 Binary files a/code/web/app/app_achievements/_doc/devshot_005.jpg and /dev/null differ diff --git a/code/web/app/app_achievements/class/AVLTree_class.php b/code/web/app/app_achievements/class/AVLTree_class.php index 61944bde5..4c751d041 100644 --- a/code/web/app/app_achievements/class/AVLTree_class.php +++ b/code/web/app/app_achievements/class/AVLTree_class.php @@ -29,7 +29,6 @@ } function inorder() { - #echo "
inorder: "; $this->AVLinorder($this->root); } @@ -145,6 +144,7 @@ } private function balance($r) { + #return $r; if($r->bal() == -2) { $lc = $r->getLeft(); if($lc->getHeightLeft() >= $lc->getHeightRight()) { diff --git a/code/web/app/app_achievements/class/AchAchievement_class.php b/code/web/app/app_achievements/class/AchAchievement_class.php index 4de86b646..f4f69e9e2 100644 --- a/code/web/app/app_achievements/class/AchAchievement_class.php +++ b/code/web/app/app_achievements/class/AchAchievement_class.php @@ -37,6 +37,7 @@ protected $image; protected $name; protected $template; + protected $sticky; function AchAchievement($data,$parent) { global $DBc,$_USER; @@ -54,8 +55,9 @@ $this->name = $data['aal_name']; $this->template = $data['aal_template']; $this->dev = $data['aa_dev']; + $this->sticky = $data['aa_sticky']; - $res = $DBc->sqlQuery("SELECT * FROM ach_perk LEFT JOIN (ach_perk_lang) ON (apl_lang='".$_USER->getLang()."' AND apl_perk=ap_id) LEFT JOIN (ach_player_perk) ON (app_perk=ap_id AND app_player='".$_USER->getID()."') WHERE ap_achievement='".$this->id."' ORDER by ap_porder ASC"); + $res = $DBc->sqlQuery("SELECT * FROM ach_task LEFT JOIN (ach_task_lang) ON (atl_lang='".$_USER->getLang()."' AND atl_task=at_id) LEFT JOIN (ach_player_task) ON (apt_task=at_id AND apt_player='".$_USER->getID()."') WHERE at_achievement='".$this->id."' ORDER by at_torder ASC"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { @@ -70,8 +72,19 @@ } } + function parentDone() { + if($this->parent_id == null) { + return true; + } + else { + $p = $this->parent->getChildDataByID($this->parent_id); + + return ($p->hasOpen() == false); + } + } + protected function makeChild($a) { - return new AchPerk($a,$this); + return new AchTask($a,$this); } function unlockedByParent() { @@ -148,6 +161,18 @@ function getCategory() { return $this->category; } + + function getSticky() { + return $this->sticky; + } + + function isSticky() { + return ($this->sticky == 1); + } + + function isHeroic() { + return $this->parent->isHeroic(); + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/class/AchCategory_class.php b/code/web/app/app_achievements/class/AchCategory_class.php index 218b9078c..a43aad899 100644 --- a/code/web/app/app_achievements/class/AchCategory_class.php +++ b/code/web/app/app_achievements/class/AchCategory_class.php @@ -1,6 +1,5 @@ id = $DBc->sqlEscape($id); - $res = $DBc->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND (aa_parent IS NULL OR NOT EXISTS (SELECT * FROM ach_perk WHERE ap_achievement=aa_id AND NOT EXISTS (SELECT * FROM ach_player_perk WHERE app_player='".$_USER->getID()."' AND app_perk=ap_id))) AND (aa_tie_race IS NULL OR aa_tie_race LIKE '".$race."') AND (aa_tie_cult IS NULL OR aa_tie_cult LIKE '".$cult."') AND (aa_tie_civ IS NULL OR aa_tie_civ LIKE '".$civ."') ORDER by aal_name ASC"); + $res = $DBc->sqlQuery("SELECT * FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$this->id."' AND (aa_tie_race IS NULL OR aa_tie_race LIKE '".$race."') AND (aa_tie_cult IS NULL OR aa_tie_cult LIKE '".$cult."') AND (aa_tie_civ IS NULL OR aa_tie_civ LIKE '".$civ."') ORDER by aa_sticky DESC, aal_name ASC"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { @@ -49,6 +49,9 @@ $this->addDone($tmp); #AchList::addDone() } } + + $res = $DBc->sqlQuery("SELECT ac_heroic FROM ach_category WHERE ac_id='".$this->id."'"); + $this->heroic = $res[0]['ac_heroic']; //load counts for tie determination $res = $DBc->sqlQuery("SELECT count(*) as anz FROM ach_achievement WHERE aa_tie_cult IS NOT NULL AND aa_category='".$this->id."' AND aa_dev='0'"); @@ -75,10 +78,6 @@ return new AchAchievement($a,$this); } - #function getID() { - # return $this->id; - #} - function isTiedCult() { return ($this->ties_cult > 0); } @@ -102,5 +101,9 @@ function getCurrentCult() { return $this->cult; } + + function isHeroic() { + return ($this->heroic == 1); + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/class/AchList_abstract.php b/code/web/app/app_achievements/class/AchList_abstract.php index 7d9846637..77ed94786 100644 --- a/code/web/app/app_achievements/class/AchList_abstract.php +++ b/code/web/app/app_achievements/class/AchList_abstract.php @@ -3,7 +3,7 @@ /*--------------------------- This class organizes nodes to distinguish between "open" and "done" nodes. - child_open and child_done refer to the index set in Parentum::nodes[] + child_open and child_done refer to Parentum::nodes ---------------------------*/ protected $child_done; @@ -25,12 +25,10 @@ } final function hasOpen() { - #echo "hasOpen: ".$this->child_open->getSize()."
"; return ($this->child_open->getSize() != 0); } final function hasDone() { - #echo "hasDone: ".$this->child_done->getSize()."
"; return ($this->child_done->getSize() != 0); } diff --git a/code/web/app/app_achievements/class/AchObjective_class.php b/code/web/app/app_achievements/class/AchObjective_class.php index 5a314a8fc..3189f98c9 100644 --- a/code/web/app/app_achievements/class/AchObjective_class.php +++ b/code/web/app/app_achievements/class/AchObjective_class.php @@ -1,6 +1,6 @@ setParent($parent); $this->setID($data['ao_id']); - $this->perk = $data['ao_perk']; + $this->task = $data['ao_task']; $this->condition = $data['ao_condition']; $this->value = $data['ao_value']; $this->name = $data['aol_name']; $this->display = $data['ao_display']; $this->done = $data['apo_date']; $this->meta_image = $data['aa_image']; + $this->metalink = $data['ao_metalink']; + + if($this->metalink != null) { + $this->name = $data['aal_name']; + } $this->progress = $this->value; @@ -41,8 +47,12 @@ return $this->meta_image; } - function getPerk() { - return $this->perk; + function getMetalink() { + return $this->metalink; + } + + function getTask() { + return $this->task; } function getCondition() { @@ -62,6 +72,9 @@ } function getDisplayName() { + if(substr($this->name,0,1) == "!") { + return substr($this->name,1); + } return $this->parent->fillTemplate(explode(";",$this->name)); } diff --git a/code/web/app/app_achievements/class/AchSummary_class.php b/code/web/app/app_achievements/class/AchSummary_class.php index c607774de..cf459028d 100644 --- a/code/web/app/app_achievements/class/AchSummary_class.php +++ b/code/web/app/app_achievements/class/AchSummary_class.php @@ -10,17 +10,15 @@ $this->menu = $menu; - //read all recent perks of user + //read all recent tasks of user //make distinct achievement list - $res = $DBc->sqlQuery("SELECT DISTINCT aa_id,ach.*,(SELECT aal_name FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_name, (SELECT aal_template FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_template FROM ach_achievement as ach,ach_perk,ach_player_perk WHERE ap_achievement=aa_id AND app_player='".$_USER->getID()."' AND app_perk=ap_id ORDER by app_date DESC LIMIT 0,".($size-1)); + $res = $DBc->sqlQuery("SELECT DISTINCT aa_id,ach.*,(SELECT aal_name FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_name, (SELECT aal_template FROM ach_achievement_lang WHERE aal_lang='".$_USER->getLang()."' AND aal_achievement=ach.aa_id) as aal_template FROM ach_achievement as ach,ach_task,ach_player_task WHERE at_achievement=aa_id AND apt_player='".$_USER->getID()."' AND apt_task=at_id ORDER by apt_date DESC LIMIT 0,".($size-1)); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { $this->addDone($this->makeChild($res[$i])); } - - #echo var_export($this->child_done,true); } #@override: Parentum::makeChild() @@ -30,23 +28,21 @@ function getSummary() { if(!is_array($this->stats)) { // only load if needed - //now we have to find the # of perks for each main menu entry + //now we have to find the # of tasks for each main menu entry //and also sum up how many have been completed $this->stats = array(); // [][name,done,total] $iter = $this->menu->getIterator(); while($iter->hasNext()) { - #echo "1"; $curr = $iter->getNext(); if($curr->getID() == 0 || $curr->inDev()) { continue; // skip summary page } - #echo $curr->getID().","; - #echo var_export($curr,true); + $res = $this->sumStats($curr); - $this->stats[] = array($curr->getName(),$res[0],$res[1]); + $this->stats[] = array($curr->getName(),$res[0],$res[1],$res[2]); } } @@ -62,14 +58,20 @@ $done = 0; $total = 0; + $hero = false; //read for current ID //sum - $res = $DBc->sqlQuery("SELECT count(ap_id) as anz FROM ach_perk,ach_achievement,ach_player_perk WHERE aa_category='".$node->getID()."' AND ap_achievement=aa_id AND app_player='".$_USER->getID()."' AND app_perk=ap_id"); + $res = $DBc->sqlQuery("SELECT count(at_id) as anz FROM ach_task,ach_achievement,ach_player_task WHERE aa_category='".$node->getID()."' AND at_achievement=aa_id AND apt_player='".$_USER->getID()."' AND apt_task=at_id"); $done += $res[0]["anz"]; - $res = $DBc->sqlQuery("SELECT count(ap_id) as anz FROM ach_perk,ach_achievement WHERE aa_category='".$node->getID()."' AND ap_achievement=aa_id AND aa_dev='0' AND ap_dev='0'"); + $res = $DBc->sqlQuery("SELECT count(at_id) as anz FROM ach_task,ach_achievement WHERE aa_category='".$node->getID()."' AND at_achievement=aa_id AND aa_dev='0' AND at_dev='0'"); $total += $res[0]["anz"]; + + $res = $DBc->sqlQuery("SELECT ac_heroic FROM ach_category WHERE ac_id='".$node->getID()."' AND ac_dev='0'"); + if($res[0]["ac_heroic"] == 1) { + $hero = true; + } $iter = $node->getIterator(); while($iter->hasNext()) { @@ -78,9 +80,10 @@ $res = $this->sumStats($curr); $done += $res[0]; $total += $res[1]; + $hero = ($hero == true || $res[2] == true); } - return array($done,$total); + return array($done,$total,$hero); } @@ -99,5 +102,9 @@ function getCurrentCult() { return "c_neutral"; } + + function isHeroic() { + return false; + } } ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/class/AchPerk_class.php b/code/web/app/app_achievements/class/AchTask_class.php similarity index 74% rename from code/web/app/app_achievements/class/AchPerk_class.php rename to code/web/app/app_achievements/class/AchTask_class.php index 25585db11..f9c27eddd 100644 --- a/code/web/app/app_achievements/class/AchPerk_class.php +++ b/code/web/app/app_achievements/class/AchTask_class.php @@ -1,5 +1,5 @@ setParent($parent); - $this->setID($data['ap_id']); - $this->achievement = $data['ap_achievement']; - $this->value = $data['ap_value']; - $this->name = $data['apl_name']; - $this->done = $data['app_date']; - $this->dev = $data['ap_dev']; - $this->template = $data['apl_template']; - $this->parent_id = $data['ap_parent']; + $this->setID($data['at_id']); + $this->achievement = $data['at_achievement']; + $this->value = $data['at_value']; + $this->name = $data['atl_name']; + $this->done = $data['apt_date']; + $this->dev = $data['at_dev']; + $this->template = $data['atl_template']; + $this->parent_id = $data['at_parent']; - $res = $DBc->sqlQuery("SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang='".$_USER->getLang()."' AND aol_objective=ao_id) LEFT JOIN (ach_player_objective) ON (apo_objective=ao_id AND apo_player='".$_USER->getID()."') LEFT JOIN (ach_achievement) ON (aa_id=ao_metalink) WHERE ao_perk='".$this->id."'"); + $res = $DBc->sqlQuery("SELECT * FROM ach_objective LEFT JOIN (ach_objective_lang) ON (aol_lang='".$_USER->getLang()."' AND aol_objective=ao_id) LEFT JOIN (ach_player_objective) ON (apo_objective=ao_id AND apo_player='".$_USER->getID()."') LEFT JOIN (ach_achievement,ach_achievement_lang) ON (aa_id=ao_metalink AND aa_id=aal_achievement AND aal_lang='".$_USER->getLang()."') WHERE ao_task='".$this->id."' ORDER by aol_name ASC,aal_name ASC"); $sz = sizeof($res); for($i=0;$i<$sz;$i++) { $this->addChild($this->makeChild($res[$i])); @@ -72,6 +72,9 @@ } function getDisplayName() { + if(substr($this->name,0,1) == "!") { + return substr($this->name,1); + } return $this->parent->fillTemplate(explode(";",$this->name)); } diff --git a/code/web/app/app_achievements/class/DLL_class.php b/code/web/app/app_achievements/class/DLL_class.php index 38e4be733..2d989208e 100644 --- a/code/web/app/app_achievements/class/DLL_class.php +++ b/code/web/app/app_achievements/class/DLL_class.php @@ -73,19 +73,16 @@ $this->avl->insert($n); $this->size++; - - #$this->avl->inorder(); - #echo "
"; + + return null; } function removeNode($id) { - echo "rid: ".$id."
"; $this->avl->inorder(); - echo "
"; $n = $this->findNode($id); if($n != null) { - echo "removed; "; + $p = $n->getParent(); $c = $n->getChild(); @@ -116,23 +113,11 @@ $this->size--; } - $this->avl->inorder(); - echo "
"; } function findNode($id) { return $this->avl->find($id); } - - /*function storeOrder() { - $iter = $this->getIterator(); - $i = 0; - while($iter->hasNext()) { - $curr = $iter->getNext(); - $curr->StoreOrder($i); - $i++; - } - }*/ } class DLLnode { @@ -166,11 +151,6 @@ return new NodeIterator($this); } - #function ListStoreOrder($i) { - # $this->data->setListOrder($i); - # $this->data->update(); - #} - function getID() { return $this->data->getID(); } diff --git a/code/web/app/app_achievements/class/InDev_trait.php b/code/web/app/app_achievements/class/InDev_trait.php index 3f749526a..8fd627e35 100644 --- a/code/web/app/app_achievements/class/InDev_trait.php +++ b/code/web/app/app_achievements/class/InDev_trait.php @@ -7,15 +7,15 @@ protected $dev; - function inDev() { + final function inDev() { return ($this->dev == 1); } - function getDev() { + final function getDev() { return $this->dev; } - function setInDev($tf) { + final function setInDev($tf) { if($tf == true) { $this->setDev(1); } @@ -26,7 +26,7 @@ $this->update(); } - function setDev($d) { + final function setDev($d) { $this->dev = $d; } } diff --git a/code/web/app/app_achievements/class/NodeIterator_class.php b/code/web/app/app_achievements/class/NodeIterator_class.php index fe71b44b0..5508ff86e 100644 --- a/code/web/app/app_achievements/class/NodeIterator_class.php +++ b/code/web/app/app_achievements/class/NodeIterator_class.php @@ -1,8 +1,7 @@ node = $node; - #$this->curr = 0; } function hasNext() { - #$tmp = array_keys($this->nodes); - #return isset($this->nodes[$tmp[$this->curr]]); if($this->node == null) { - #echo "empty"; return false; } - - #if($this->node->getChild() == null) { - # return false; - #} - - #echo "true"; return true; } function getNext() { - #$tmp = array_keys($this->nodes); - #return $this->nodes[$tmp[$this->curr++]]; $n = $this->node; $this->node = $this->node->getChild(); return $n->data; diff --git a/code/web/app/app_achievements/class/Node_abstract.php b/code/web/app/app_achievements/class/Node_abstract.php index 091e5b10d..7b15d74b4 100644 --- a/code/web/app/app_achievements/class/Node_abstract.php +++ b/code/web/app/app_achievements/class/Node_abstract.php @@ -10,7 +10,7 @@ protected $parent; function Node() { - + // dummy constructor } final function getID() { diff --git a/code/web/app/app_achievements/conf.php b/code/web/app/app_achievements/conf.php index f31fc7bc3..e63550b19 100644 --- a/code/web/app/app_achievements/conf.php +++ b/code/web/app/app_achievements/conf.php @@ -11,7 +11,7 @@ $_CONF['enable_offgame'] = true; $_CONF['image_url'] = "http://www.3025-game.de/special/app_achievements/"; - $_CONF['use_fb'] = true; + $_CONF['use_fb'] = false; $_CONF['fb_id'] = "447985781893176"; $_CONF['fb_secret'] = "f953772f1f7d871db022a6023e7a3f42"; ?> \ No newline at end of file diff --git a/code/web/app/app_achievements/fb.php b/code/web/app/app_achievements/fb.php deleted file mode 100644 index 57b33dbbd..000000000 --- a/code/web/app/app_achievements/fb.php +++ /dev/null @@ -1,57 +0,0 @@ - $_CONF['fb_id'], - 'secret' => $_CONF['fb_secret'], - 'cookie' => true - )); - - // 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()) { - - echo ''; - } - else { - echo var_export($facebook->getUser(),true); - // Do the wall post. - try { - - $facebook->api("/me/feed", "post", array( - message => "My character Talvela just earned 'Bejeweled' on Ryzom!", - picture => "http://www.3025-game.de/special/app_achievements/pic/icon/test.png", - link => "http://www.ryzom.com", - name => "Ryzom - MMO", - caption => "Join and play for fee!" - )); - echo "post"; - - } catch (FacebookApiException $e) { - echo $e; - $login_url = $facebook->getLoginUrl( array( - 'scope' => 'publish_stream' - )); - echo 'Please login.'; - #error_log($e->getType()); - #error_log($e->getMessage()); - } - } -?> \ No newline at end of file diff --git a/code/web/app/app_achievements/fb/base_facebook.php b/code/web/app/app_achievements/fb/base_facebook.php new file mode 100644 index 000000000..772cc97e1 --- /dev/null +++ b/code/web/app/app_achievements/fb/base_facebook.php @@ -0,0 +1,1269 @@ + + */ +class FacebookApiException extends Exception +{ + /** + * The result from the API server that represents the exception information. + */ + protected $result; + + /** + * Make a new API Exception with the given result. + * + * @param array $result The result from the API server + */ + public function __construct($result) { + $this->result = $result; + + $code = isset($result['error_code']) ? $result['error_code'] : 0; + + if (isset($result['error_description'])) { + // OAuth 2.0 Draft 10 style + $msg = $result['error_description']; + } else if (isset($result['error']) && is_array($result['error'])) { + // OAuth 2.0 Draft 00 style + $msg = $result['error']['message']; + } else if (isset($result['error_msg'])) { + // Rest server style + $msg = $result['error_msg']; + } else { + $msg = 'Unknown Error. Check getResult()'; + } + + parent::__construct($msg, $code); + } + + /** + * Return the associated result object returned by the API server. + * + * @return array The result from the API server + */ + public function getResult() { + return $this->result; + } + + /** + * Returns the associated type for the error. This will default to + * 'Exception' when a type is not available. + * + * @return string + */ + public function getType() { + if (isset($this->result['error'])) { + $error = $this->result['error']; + if (is_string($error)) { + // OAuth 2.0 Draft 10 style + return $error; + } else if (is_array($error)) { + // OAuth 2.0 Draft 00 style + if (isset($error['type'])) { + return $error['type']; + } + } + } + + return 'Exception'; + } + + /** + * To make debugging easier. + * + * @return string The string representation of the error + */ + public function __toString() { + $str = $this->getType() . ': '; + if ($this->code != 0) { + $str .= $this->code . ': '; + } + return $str . $this->message; + } +} + +/** + * Provides access to the Facebook Platform. This class provides + * a majority of the functionality needed, but the class is abstract + * because it is designed to be sub-classed. The subclass must + * implement the four abstract methods listed at the bottom of + * the file. + * + * @author Naitik Shah + */ +abstract class BaseFacebook +{ + /** + * Version. + */ + const VERSION = '3.1.1'; + + /** + * Default options for curl. + */ + public static $CURL_OPTS = array( + CURLOPT_CONNECTTIMEOUT => 10, + CURLOPT_RETURNTRANSFER => true, + CURLOPT_TIMEOUT => 60, + CURLOPT_USERAGENT => 'facebook-php-3.1', + ); + + /** + * List of query parameters that get automatically dropped when rebuilding + * the current URL. + */ + protected static $DROP_QUERY_PARAMS = array( + 'code', + 'state', + 'signed_request', + ); + + /** + * Maps aliases to Facebook domains. + */ + public static $DOMAIN_MAP = array( + 'api' => 'https://api.facebook.com/', + 'api_video' => 'https://api-video.facebook.com/', + 'api_read' => 'https://api-read.facebook.com/', + 'graph' => 'https://graph.facebook.com/', + 'graph_video' => 'https://graph-video.facebook.com/', + 'www' => 'https://www.facebook.com/', + ); + + /** + * The Application ID. + * + * @var string + */ + protected $appId; + + /** + * The Application App Secret. + * + * @var string + */ + protected $appSecret; + + /** + * The ID of the Facebook user, or 0 if the user is logged out. + * + * @var integer + */ + protected $user; + + /** + * The data from the signed_request token. + */ + protected $signedRequest; + + /** + * A CSRF state variable to assist in the defense against CSRF attacks. + */ + protected $state; + + /** + * The OAuth access token received in exchange for a valid authorization + * code. null means the access token has yet to be determined. + * + * @var string + */ + protected $accessToken = null; + + /** + * Indicates if the CURL based @ syntax for file uploads is enabled. + * + * @var boolean + */ + protected $fileUploadSupport = false; + + /** + * Initialize a Facebook Application. + * + * The configuration: + * - appId: the application ID + * - secret: the application secret + * - fileUpload: (optional) boolean indicating if file uploads are enabled + * + * @param array $config The application configuration + */ + public function __construct($config) { + $this->setAppId($config['appId']); + $this->setAppSecret($config['secret']); + if (isset($config['fileUpload'])) { + $this->setFileUploadSupport($config['fileUpload']); + } + + $state = $this->getPersistentData('state'); + if (!empty($state)) { + $this->state = $this->getPersistentData('state'); + } + } + + /** + * Set the Application ID. + * + * @param string $appId The Application ID + * @return BaseFacebook + */ + public function setAppId($appId) { + $this->appId = $appId; + return $this; + } + + /** + * Get the Application ID. + * + * @return string the Application ID + */ + public function getAppId() { + return $this->appId; + } + + /** + * Set the App Secret. + * + * @param string $apiSecret The App Secret + * @return BaseFacebook + * @deprecated + */ + public function setApiSecret($apiSecret) { + $this->setAppSecret($apiSecret); + return $this; + } + + /** + * Set the App Secret. + * + * @param string $appSecret The App Secret + * @return BaseFacebook + */ + public function setAppSecret($appSecret) { + $this->appSecret = $appSecret; + return $this; + } + + /** + * Get the App Secret. + * + * @return string the App Secret + * @deprecated + */ + public function getApiSecret() { + return $this->getAppSecret(); + } + + /** + * Get the App Secret. + * + * @return string the App Secret + */ + public function getAppSecret() { + return $this->appSecret; + } + + /** + * Set the file upload support status. + * + * @param boolean $fileUploadSupport The file upload support status. + * @return BaseFacebook + */ + public function setFileUploadSupport($fileUploadSupport) { + $this->fileUploadSupport = $fileUploadSupport; + return $this; + } + + /** + * Get the file upload support status. + * + * @return boolean true if and only if the server supports file upload. + */ + public function getFileUploadSupport() { + return $this->fileUploadSupport; + } + + /** + * DEPRECATED! Please use getFileUploadSupport instead. + * + * Get the file upload support status. + * + * @return boolean true if and only if the server supports file upload. + */ + public function useFileUploadSupport() { + return $this->getFileUploadSupport(); + } + + /** + * Sets the access token for api calls. Use this if you get + * your access token by other means and just want the SDK + * to use it. + * + * @param string $access_token an access token. + * @return BaseFacebook + */ + public function setAccessToken($access_token) { + $this->accessToken = $access_token; + return $this; + } + + /** + * Determines the access token that should be used for API calls. + * The first time this is called, $this->accessToken is set equal + * to either a valid user access token, or it's set to the application + * access token if a valid user access token wasn't available. Subsequent + * calls return whatever the first call returned. + * + * @return string The access token + */ + public function getAccessToken() { + if ($this->accessToken !== null) { + // we've done this already and cached it. Just return. + return $this->accessToken; + } + + // first establish access token to be the application + // access token, in case we navigate to the /oauth/access_token + // endpoint, where SOME access token is required. + $this->setAccessToken($this->getApplicationAccessToken()); + $user_access_token = $this->getUserAccessToken(); + if ($user_access_token) { + $this->setAccessToken($user_access_token); + } + + return $this->accessToken; + } + + /** + * Determines and returns the user access token, first using + * the signed request if present, and then falling back on + * the authorization code if present. The intent is to + * return a valid user access token, or false if one is determined + * to not be available. + * + * @return string A valid user access token, or false if one + * could not be determined. + */ + protected function getUserAccessToken() { + // first, consider a signed request if it's supplied. + // if there is a signed request, then it alone determines + // the access token. + $signed_request = $this->getSignedRequest(); + if ($signed_request) { + // apps.facebook.com hands the access_token in the signed_request + if (array_key_exists('oauth_token', $signed_request)) { + $access_token = $signed_request['oauth_token']; + $this->setPersistentData('access_token', $access_token); + return $access_token; + } + + // the JS SDK puts a code in with the redirect_uri of '' + if (array_key_exists('code', $signed_request)) { + $code = $signed_request['code']; + $access_token = $this->getAccessTokenFromCode($code, ''); + if ($access_token) { + $this->setPersistentData('code', $code); + $this->setPersistentData('access_token', $access_token); + return $access_token; + } + } + + // signed request states there's no access token, so anything + // stored should be cleared. + $this->clearAllPersistentData(); + return false; // respect the signed request's data, even + // if there's an authorization code or something else + } + + $code = $this->getCode(); + if ($code && $code != $this->getPersistentData('code')) { + $access_token = $this->getAccessTokenFromCode($code); + if ($access_token) { + $this->setPersistentData('code', $code); + $this->setPersistentData('access_token', $access_token); + return $access_token; + } + + // code was bogus, so everything based on it should be invalidated. + $this->clearAllPersistentData(); + return false; + } + + // as a fallback, just return whatever is in the persistent + // store, knowing nothing explicit (signed request, authorization + // code, etc.) was present to shadow it (or we saw a code in $_REQUEST, + // but it's the same as what's in the persistent store) + return $this->getPersistentData('access_token'); + } + + /** + * Retrieve the signed request, either from a request parameter or, + * if not present, from a cookie. + * + * @return string the signed request, if available, or null otherwise. + */ + public function getSignedRequest() { + if (!$this->signedRequest) { + if (isset($_REQUEST['signed_request'])) { + $this->signedRequest = $this->parseSignedRequest( + $_REQUEST['signed_request']); + } else if (isset($_COOKIE[$this->getSignedRequestCookieName()])) { + $this->signedRequest = $this->parseSignedRequest( + $_COOKIE[$this->getSignedRequestCookieName()]); + } + } + return $this->signedRequest; + } + + /** + * Get the UID of the connected user, or 0 + * if the Facebook user is not connected. + * + * @return string the UID if available. + */ + public function getUser() { + if ($this->user !== null) { + // we've already determined this and cached the value. + return $this->user; + } + + return $this->user = $this->getUserFromAvailableData(); + } + + /** + * Determines the connected user by first examining any signed + * requests, then considering an authorization code, and then + * falling back to any persistent store storing the user. + * + * @return integer The id of the connected Facebook user, + * or 0 if no such user exists. + */ + protected function getUserFromAvailableData() { + // if a signed request is supplied, then it solely determines + // who the user is. + $signed_request = $this->getSignedRequest(); + if ($signed_request) { + if (array_key_exists('user_id', $signed_request)) { + $user = $signed_request['user_id']; + $this->setPersistentData('user_id', $signed_request['user_id']); + return $user; + } + + // if the signed request didn't present a user id, then invalidate + // all entries in any persistent store. + $this->clearAllPersistentData(); + return 0; + } + + $user = $this->getPersistentData('user_id', $default = 0); + $persisted_access_token = $this->getPersistentData('access_token'); + + // use access_token to fetch user id if we have a user access_token, or if + // the cached access token has changed. + $access_token = $this->getAccessToken(); + if ($access_token && + $access_token != $this->getApplicationAccessToken() && + !($user && $persisted_access_token == $access_token)) { + $user = $this->getUserFromAccessToken(); + if ($user) { + $this->setPersistentData('user_id', $user); + } else { + $this->clearAllPersistentData(); + } + } + + return $user; + } + + /** + * Get a Login URL for use with redirects. By default, full page redirect is + * assumed. If you are using the generated URL with a window.open() call in + * JavaScript, you can pass in display=popup as part of the $params. + * + * The parameters: + * - redirect_uri: the url to go to after a successful login + * - scope: comma separated list of requested extended perms + * + * @param array $params Provide custom parameters + * @return string The URL for the login flow + */ + public function getLoginUrl($params=array()) { + $this->establishCSRFTokenState(); + $currentUrl = $this->getCurrentUrl(); + + // if 'scope' is passed as an array, convert to comma separated list + $scopeParams = isset($params['scope']) ? $params['scope'] : null; + if ($scopeParams && is_array($scopeParams)) { + $params['scope'] = implode(',', $scopeParams); + } + + return $this->getUrl( + 'www', + 'dialog/oauth', + array_merge(array( + 'client_id' => $this->getAppId(), + 'redirect_uri' => $currentUrl, // possibly overwritten + 'state' => $this->state), + $params)); + } + + /** + * Get a Logout URL suitable for use with redirects. + * + * The parameters: + * - next: the url to go to after a successful logout + * + * @param array $params Provide custom parameters + * @return string The URL for the logout flow + */ + public function getLogoutUrl($params=array()) { + return $this->getUrl( + 'www', + 'logout.php', + array_merge(array( + 'next' => $this->getCurrentUrl(), + 'access_token' => $this->getAccessToken(), + ), $params) + ); + } + + /** + * Get a login status URL to fetch the status from Facebook. + * + * The parameters: + * - ok_session: the URL to go to if a session is found + * - no_session: the URL to go to if the user is not connected + * - no_user: the URL to go to if the user is not signed into facebook + * + * @param array $params Provide custom parameters + * @return string The URL for the logout flow + */ + public function getLoginStatusUrl($params=array()) { + return $this->getUrl( + 'www', + 'extern/login_status.php', + array_merge(array( + 'api_key' => $this->getAppId(), + 'no_session' => $this->getCurrentUrl(), + 'no_user' => $this->getCurrentUrl(), + 'ok_session' => $this->getCurrentUrl(), + 'session_version' => 3, + ), $params) + ); + } + + /** + * Make an API call. + * + * @return mixed The decoded response + */ + public function api(/* polymorphic */) { + $args = func_get_args(); + if (is_array($args[0])) { + return $this->_restserver($args[0]); + } else { + return call_user_func_array(array($this, '_graph'), $args); + } + } + + /** + * Constructs and returns the name of the cookie that + * potentially houses the signed request for the app user. + * The cookie is not set by the BaseFacebook class, but + * it may be set by the JavaScript SDK. + * + * @return string the name of the cookie that would house + * the signed request value. + */ + protected function getSignedRequestCookieName() { + return 'fbsr_'.$this->getAppId(); + } + + /** + * Constructs and returns the name of the coookie that potentially contain + * metadata. The cookie is not set by the BaseFacebook class, but it may be + * set by the JavaScript SDK. + * + * @return string the name of the cookie that would house metadata. + */ + protected function getMetadataCookieName() { + return 'fbm_'.$this->getAppId(); + } + + /** + * Get the authorization code from the query parameters, if it exists, + * and otherwise return false to signal no authorization code was + * discoverable. + * + * @return mixed The authorization code, or false if the authorization + * code could not be determined. + */ + protected function getCode() { + if (isset($_REQUEST['code'])) { + if ($this->state !== null && + isset($_REQUEST['state']) && + $this->state === $_REQUEST['state']) { + + // CSRF state has done its job, so clear it + $this->state = null; + $this->clearPersistentData('state'); + return $_REQUEST['code']; + } else { + self::errorLog('CSRF state token does not match one provided.'); + return false; + } + } + + return false; + } + + /** + * Retrieves the UID with the understanding that + * $this->accessToken has already been set and is + * seemingly legitimate. It relies on Facebook's Graph API + * to retrieve user information and then extract + * the user ID. + * + * @return integer Returns the UID of the Facebook user, or 0 + * if the Facebook user could not be determined. + */ + protected function getUserFromAccessToken() { + try { + $user_info = $this->api('/me'); + return $user_info['id']; + } catch (FacebookApiException $e) { + return 0; + } + } + + /** + * Returns the access token that should be used for logged out + * users when no authorization code is available. + * + * @return string The application access token, useful for gathering + * public information about users and applications. + */ + protected function getApplicationAccessToken() { + return $this->appId.'|'.$this->appSecret; + } + + /** + * Lays down a CSRF state token for this process. + * + * @return void + */ + protected function establishCSRFTokenState() { + if ($this->state === null) { + $this->state = md5(uniqid(mt_rand(), true)); + $this->setPersistentData('state', $this->state); + } + } + + /** + * Retrieves an access token for the given authorization code + * (previously generated from www.facebook.com on behalf of + * a specific user). The authorization code is sent to graph.facebook.com + * and a legitimate access token is generated provided the access token + * and the user for which it was generated all match, and the user is + * either logged in to Facebook or has granted an offline access permission. + * + * @param string $code An authorization code. + * @return mixed An access token exchanged for the authorization code, or + * false if an access token could not be generated. + */ + protected function getAccessTokenFromCode($code, $redirect_uri = null) { + if (empty($code)) { + return false; + } + + if ($redirect_uri === null) { + $redirect_uri = $this->getCurrentUrl(); + } + + try { + // need to circumvent json_decode by calling _oauthRequest + // directly, since response isn't JSON format. + $access_token_response = + $this->_oauthRequest( + $this->getUrl('graph', '/oauth/access_token'), + $params = array('client_id' => $this->getAppId(), + 'client_secret' => $this->getAppSecret(), + 'redirect_uri' => $redirect_uri, + 'code' => $code)); + } catch (FacebookApiException $e) { + // most likely that user very recently revoked authorization. + // In any event, we don't have an access token, so say so. + return false; + } + + if (empty($access_token_response)) { + return false; + } + + $response_params = array(); + parse_str($access_token_response, $response_params); + if (!isset($response_params['access_token'])) { + return false; + } + + return $response_params['access_token']; + } + + /** + * Invoke the old restserver.php endpoint. + * + * @param array $params Method call object + * + * @return mixed The decoded response object + * @throws FacebookApiException + */ + protected function _restserver($params) { + // generic application level parameters + $params['api_key'] = $this->getAppId(); + $params['format'] = 'json-strings'; + + $result = json_decode($this->_oauthRequest( + $this->getApiUrl($params['method']), + $params + ), true); + + // results are returned, errors are thrown + if (is_array($result) && isset($result['error_code'])) { + $this->throwAPIException($result); + } + + if ($params['method'] === 'auth.expireSession' || + $params['method'] === 'auth.revokeAuthorization') { + $this->destroySession(); + } + + return $result; + } + + /** + * Return true if this is video post. + * + * @param string $path The path + * @param string $method The http method (default 'GET') + * + * @return boolean true if this is video post + */ + protected function isVideoPost($path, $method = 'GET') { + if ($method == 'POST' && preg_match("/^(\/)(.+)(\/)(videos)$/", $path)) { + return true; + } + return false; + } + + /** + * Invoke the Graph API. + * + * @param string $path The path (required) + * @param string $method The http method (default 'GET') + * @param array $params The query/post data + * + * @return mixed The decoded response object + * @throws FacebookApiException + */ + protected function _graph($path, $method = 'GET', $params = array()) { + if (is_array($method) && empty($params)) { + $params = $method; + $method = 'GET'; + } + $params['method'] = $method; // method override as we always do a POST + + if ($this->isVideoPost($path, $method)) { + $domainKey = 'graph_video'; + } else { + $domainKey = 'graph'; + } + + $result = json_decode($this->_oauthRequest( + $this->getUrl($domainKey, $path), + $params + ), true); + + // results are returned, errors are thrown + if (is_array($result) && isset($result['error'])) { + $this->throwAPIException($result); + } + + return $result; + } + + /** + * Make a OAuth Request. + * + * @param string $url The path (required) + * @param array $params The query/post data + * + * @return string The decoded response object + * @throws FacebookApiException + */ + protected function _oauthRequest($url, $params) { + if (!isset($params['access_token'])) { + $params['access_token'] = $this->getAccessToken(); + } + + // json_encode all params values that are not strings + foreach ($params as $key => $value) { + if (!is_string($value)) { + $params[$key] = json_encode($value); + } + } + + return $this->makeRequest($url, $params); + } + + /** + * Makes an HTTP request. This method can be overridden by subclasses if + * developers want to do fancier things or use something other than curl to + * make the request. + * + * @param string $url The URL to make the request to + * @param array $params The parameters to use for the POST body + * @param CurlHandler $ch Initialized curl handle + * + * @return string The response text + */ + protected function makeRequest($url, $params, $ch=null) { + if (!$ch) { + $ch = curl_init(); + } + + $opts = self::$CURL_OPTS; + if ($this->getFileUploadSupport()) { + $opts[CURLOPT_POSTFIELDS] = $params; + } else { + $opts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&'); + } + $opts[CURLOPT_URL] = $url; + + // disable the 'Expect: 100-continue' behaviour. This causes CURL to wait + // for 2 seconds if the server does not support this header. + if (isset($opts[CURLOPT_HTTPHEADER])) { + $existing_headers = $opts[CURLOPT_HTTPHEADER]; + $existing_headers[] = 'Expect:'; + $opts[CURLOPT_HTTPHEADER] = $existing_headers; + } else { + $opts[CURLOPT_HTTPHEADER] = array('Expect:'); + } + + curl_setopt_array($ch, $opts); + $result = curl_exec($ch); + + if (curl_errno($ch) == 60) { // CURLE_SSL_CACERT + self::errorLog('Invalid or no certificate authority found, '. + 'using bundled information'); + curl_setopt($ch, CURLOPT_CAINFO, + dirname(__FILE__) . '/fb_ca_chain_bundle.crt'); + $result = curl_exec($ch); + } + + if ($result === false) { + $e = new FacebookApiException(array( + 'error_code' => curl_errno($ch), + 'error' => array( + 'message' => curl_error($ch), + 'type' => 'CurlException', + ), + )); + curl_close($ch); + throw $e; + } + curl_close($ch); + return $result; + } + + /** + * Parses a signed_request and validates the signature. + * + * @param string $signed_request A signed token + * @return array The payload inside it or null if the sig is wrong + */ + protected function parseSignedRequest($signed_request) { + list($encoded_sig, $payload) = explode('.', $signed_request, 2); + + // decode the data + $sig = self::base64UrlDecode($encoded_sig); + $data = json_decode(self::base64UrlDecode($payload), true); + + if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') { + self::errorLog('Unknown algorithm. Expected HMAC-SHA256'); + return null; + } + + // check sig + $expected_sig = hash_hmac('sha256', $payload, + $this->getAppSecret(), $raw = true); + if ($sig !== $expected_sig) { + self::errorLog('Bad Signed JSON signature!'); + return null; + } + + return $data; + } + + /** + * Build the URL for api given parameters. + * + * @param $method String the method name. + * @return string The URL for the given parameters + */ + protected function getApiUrl($method) { + static $READ_ONLY_CALLS = + array('admin.getallocation' => 1, + 'admin.getappproperties' => 1, + 'admin.getbannedusers' => 1, + 'admin.getlivestreamvialink' => 1, + 'admin.getmetrics' => 1, + 'admin.getrestrictioninfo' => 1, + 'application.getpublicinfo' => 1, + 'auth.getapppublickey' => 1, + 'auth.getsession' => 1, + 'auth.getsignedpublicsessiondata' => 1, + 'comments.get' => 1, + 'connect.getunconnectedfriendscount' => 1, + 'dashboard.getactivity' => 1, + 'dashboard.getcount' => 1, + 'dashboard.getglobalnews' => 1, + 'dashboard.getnews' => 1, + 'dashboard.multigetcount' => 1, + 'dashboard.multigetnews' => 1, + 'data.getcookies' => 1, + 'events.get' => 1, + 'events.getmembers' => 1, + 'fbml.getcustomtags' => 1, + 'feed.getappfriendstories' => 1, + 'feed.getregisteredtemplatebundlebyid' => 1, + 'feed.getregisteredtemplatebundles' => 1, + 'fql.multiquery' => 1, + 'fql.query' => 1, + 'friends.arefriends' => 1, + 'friends.get' => 1, + 'friends.getappusers' => 1, + 'friends.getlists' => 1, + 'friends.getmutualfriends' => 1, + 'gifts.get' => 1, + 'groups.get' => 1, + 'groups.getmembers' => 1, + 'intl.gettranslations' => 1, + 'links.get' => 1, + 'notes.get' => 1, + 'notifications.get' => 1, + 'pages.getinfo' => 1, + 'pages.isadmin' => 1, + 'pages.isappadded' => 1, + 'pages.isfan' => 1, + 'permissions.checkavailableapiaccess' => 1, + 'permissions.checkgrantedapiaccess' => 1, + 'photos.get' => 1, + 'photos.getalbums' => 1, + 'photos.gettags' => 1, + 'profile.getinfo' => 1, + 'profile.getinfooptions' => 1, + 'stream.get' => 1, + 'stream.getcomments' => 1, + 'stream.getfilters' => 1, + 'users.getinfo' => 1, + 'users.getloggedinuser' => 1, + 'users.getstandardinfo' => 1, + 'users.hasapppermission' => 1, + 'users.isappuser' => 1, + 'users.isverified' => 1, + 'video.getuploadlimits' => 1); + $name = 'api'; + if (isset($READ_ONLY_CALLS[strtolower($method)])) { + $name = 'api_read'; + } else if (strtolower($method) == 'video.upload') { + $name = 'api_video'; + } + return self::getUrl($name, 'restserver.php'); + } + + /** + * Build the URL for given domain alias, path and parameters. + * + * @param $name string The name of the domain + * @param $path string Optional path (without a leading slash) + * @param $params array Optional query parameters + * + * @return string The URL for the given parameters + */ + protected function getUrl($name, $path='', $params=array()) { + $url = self::$DOMAIN_MAP[$name]; + if ($path) { + if ($path[0] === '/') { + $path = substr($path, 1); + } + $url .= $path; + } + if ($params) { + $url .= '?' . http_build_query($params, null, '&'); + } + + return $url; + } + + /** + * Returns the Current URL, stripping it of known FB parameters that should + * not persist. + * + * @return string The current URL + */ + protected function getCurrentUrl() { + if (isset($_SERVER['HTTPS']) && + ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1) || + isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && + $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + $protocol = 'https://'; + } + else { + $protocol = 'http://'; + } + $currentUrl = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $parts = parse_url($currentUrl); + + $query = ''; + if (!empty($parts['query'])) { + // drop known fb params + $params = explode('&', $parts['query']); + $retained_params = array(); + foreach ($params as $param) { + if ($this->shouldRetainParam($param)) { + $retained_params[] = $param; + } + } + + if (!empty($retained_params)) { + $query = '?'.implode($retained_params, '&'); + } + } + + // use port if non default + $port = + isset($parts['port']) && + (($protocol === 'http://' && $parts['port'] !== 80) || + ($protocol === 'https://' && $parts['port'] !== 443)) + ? ':' . $parts['port'] : ''; + + // rebuild + return $protocol . $parts['host'] . $port . $parts['path'] . $query; + } + + /** + * Returns true if and only if the key or key/value pair should + * be retained as part of the query string. This amounts to + * a brute-force search of the very small list of Facebook-specific + * params that should be stripped out. + * + * @param string $param A key or key/value pair within a URL's query (e.g. + * 'foo=a', 'foo=', or 'foo'. + * + * @return boolean + */ + protected function shouldRetainParam($param) { + foreach (self::$DROP_QUERY_PARAMS as $drop_query_param) { + if (strpos($param, $drop_query_param.'=') === 0) { + return false; + } + } + + return true; + } + + /** + * Analyzes the supplied result to see if it was thrown + * because the access token is no longer valid. If that is + * the case, then we destroy the session. + * + * @param $result array A record storing the error message returned + * by a failed API call. + */ + protected function throwAPIException($result) { + $e = new FacebookApiException($result); + switch ($e->getType()) { + // OAuth 2.0 Draft 00 style + case 'OAuthException': + // OAuth 2.0 Draft 10 style + case 'invalid_token': + // REST server errors are just Exceptions + case 'Exception': + $message = $e->getMessage(); + if ((strpos($message, 'Error validating access token') !== false) || + (strpos($message, 'Invalid OAuth access token') !== false) || + (strpos($message, 'An active access token must be used') !== false) + ) { + $this->destroySession(); + } + break; + } + + throw $e; + } + + + /** + * Prints to the error log if you aren't in command line mode. + * + * @param string $msg Log message + */ + protected static function errorLog($msg) { + // disable error log if we are running in a CLI environment + // @codeCoverageIgnoreStart + if (php_sapi_name() != 'cli') { + error_log($msg); + } + // uncomment this if you want to see the errors on the page + // print 'error_log: '.$msg."\n"; + // @codeCoverageIgnoreEnd + } + + /** + * Base64 encoding that doesn't need to be urlencode()ed. + * Exactly the same as base64_encode except it uses + * - instead of + + * _ instead of / + * + * @param string $input base64UrlEncoded string + * @return string + */ + protected static function base64UrlDecode($input) { + return base64_decode(strtr($input, '-_', '+/')); + } + + /** + * Destroy the current session + */ + public function destroySession() { + $this->accessToken = null; + $this->signedRequest = null; + $this->user = null; + $this->clearAllPersistentData(); + + // Javascript sets a cookie that will be used in getSignedRequest that we + // need to clear if we can + $cookie_name = $this->getSignedRequestCookieName(); + if (array_key_exists($cookie_name, $_COOKIE)) { + unset($_COOKIE[$cookie_name]); + if (!headers_sent()) { + // The base domain is stored in the metadata cookie if not we fallback + // to the current hostname + $base_domain = '.'. $_SERVER['HTTP_HOST']; + + $metadata = $this->getMetadataCookie(); + if (array_key_exists('base_domain', $metadata) && + !empty($metadata['base_domain'])) { + $base_domain = $metadata['base_domain']; + } + + setcookie($cookie_name, '', 0, '/', $base_domain); + } else { + self::errorLog( + 'There exists a cookie that we wanted to clear that we couldn\'t '. + 'clear because headers was already sent. Make sure to do the first '. + 'API call before outputing anything' + ); + } + } + } + + /** + * Parses the metadata cookie that our Javascript API set + * + * @return an array mapping key to value + */ + protected function getMetadataCookie() { + $cookie_name = $this->getMetadataCookieName(); + if (!array_key_exists($cookie_name, $_COOKIE)) { + return array(); + } + + // The cookie value can be wrapped in "-characters so remove them + $cookie_value = trim($_COOKIE[$cookie_name], '"'); + + if (empty($cookie_value)) { + return array(); + } + + $parts = explode('&', $cookie_value); + $metadata = array(); + foreach ($parts as $part) { + $pair = explode('=', $part, 2); + if (!empty($pair[0])) { + $metadata[urldecode($pair[0])] = + (count($pair) > 1) ? urldecode($pair[1]) : ''; + } + } + + return $metadata; + } + + /** + * Each of the following four methods should be overridden in + * a concrete subclass, as they are in the provided Facebook class. + * The Facebook class uses PHP sessions to provide a primitive + * persistent store, but another subclass--one that you implement-- + * might use a database, memcache, or an in-memory cache. + * + * @see Facebook + */ + + /** + * Stores the given ($key, $value) pair, so that future calls to + * getPersistentData($key) return $value. This call may be in another request. + * + * @param string $key + * @param array $value + * + * @return void + */ + abstract protected function setPersistentData($key, $value); + + /** + * Get the data for $key, persisted by BaseFacebook::setPersistentData() + * + * @param string $key The key of the data to retrieve + * @param boolean $default The default value to return if $key is not found + * + * @return mixed + */ + abstract protected function getPersistentData($key, $default = false); + + /** + * Clear the data with $key from the persistent storage + * + * @param string $key + * @return void + */ + abstract protected function clearPersistentData($key); + + /** + * Clear all data from the persistent storage + * + * @return void + */ + abstract protected function clearAllPersistentData(); +} diff --git a/code/web/app/app_achievements/fb/fb_ca_chain_bundle.crt b/code/web/app/app_achievements/fb/fb_ca_chain_bundle.crt new file mode 100644 index 000000000..b92d7190e --- /dev/null +++ b/code/web/app/app_achievements/fb/fb_ca_chain_bundle.crt @@ -0,0 +1,121 @@ +-----BEGIN CERTIFICATE----- +MIIFgjCCBGqgAwIBAgIQDKKbZcnESGaLDuEaVk6fQjANBgkqhkiG9w0BAQUFADBm +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSUwIwYDVQQDExxEaWdpQ2VydCBIaWdoIEFzc3VyYW5j +ZSBDQS0zMB4XDTEwMDExMzAwMDAwMFoXDTEzMDQxMTIzNTk1OVowaDELMAkGA1UE +BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVBhbG8gQWx0bzEX +MBUGA1UEChMORmFjZWJvb2ssIEluYy4xFzAVBgNVBAMUDiouZmFjZWJvb2suY29t +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9rzj7QIuLM3sdHu1HcI1VcR3g +b5FExKNV646agxSle1aQ/sJev1mh/u91ynwqd2BQmM0brZ1Hc3QrfYyAaiGGgEkp +xbhezyfeYhAyO0TKAYxPnm2cTjB5HICzk6xEIwFbA7SBJ2fSyW1CFhYZyo3tIBjj +19VjKyBfpRaPkzLmRwIDAQABo4ICrDCCAqgwHwYDVR0jBBgwFoAUUOpzidsp+xCP +nuUBINTeeZlIg/cwHQYDVR0OBBYEFPp+tsFBozkjrHlEnZ9J4cFj2eM0MA4GA1Ud +DwEB/wQEAwIFoDAMBgNVHRMBAf8EAjAAMF8GA1UdHwRYMFYwKaAnoCWGI2h0dHA6 +Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9jYTMtZmIuY3JsMCmgJ6AlhiNodHRwOi8vY3Js +NC5kaWdpY2VydC5jb20vY2EzLWZiLmNybDCCAcYGA1UdIASCAb0wggG5MIIBtQYL +YIZIAYb9bAEDAAEwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3LmRpZ2ljZXJ0 +LmNvbS9zc2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUHAgIwggFWHoIB +UgBBAG4AeQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQByAHQAaQBmAGkA +YwBhAHQAZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBjAGUAcAB0AGEA +bgBjAGUAIABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAgAEMAUAAvAEMA +UABTACAAYQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQAGEAcgB0AHkA +IABBAGcAcgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBtAGkAdAAgAGwA +aQBhAGIAaQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBjAG8AcgBwAG8A +cgBhAHQAZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBlAHIAZQBuAGMA +ZQAuMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjANBgkqhkiG9w0BAQUF +AAOCAQEACOkTIdxMy11+CKrbGNLBSg5xHaTvu/v1wbyn3dO/mf68pPfJnX6ShPYy +4XM4Vk0x4uaFaU4wAGke+nCKGi5dyg0Esg7nemLNKEJaFAJZ9enxZm334lSCeARy +wlDtxULGOFRyGIZZPmbV2eNq5xdU/g3IuBEhL722mTpAye9FU/J8Wsnw54/gANyO +Gzkewigua8ip8Lbs9Cht399yAfbfhUP1DrAm/xEcnHrzPr3cdCtOyJaM6SRPpRqH +ITK5Nc06tat9lXVosSinT3KqydzxBYua9gCFFiR3x3DgZfvXkC6KDdUlDrNcJUub +a1BHnLLP4mxTHL6faAXYd05IxNn/IA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIGVTCCBT2gAwIBAgIQCFH5WYFBRcq94CTiEsnCDjANBgkqhkiG9w0BAQUFADBs +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j +ZSBFViBSb290IENBMB4XDTA3MDQwMzAwMDAwMFoXDTIyMDQwMzAwMDAwMFowZjEL +MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 +LmRpZ2ljZXJ0LmNvbTElMCMGA1UEAxMcRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug +Q0EtMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9hCikQH17+NDdR +CPge+yLtYb4LDXBMUGMmdRW5QYiXtvCgFbsIYOBC6AUpEIc2iihlqO8xB3RtNpcv +KEZmBMcqeSZ6mdWOw21PoF6tvD2Rwll7XjZswFPPAAgyPhBkWBATaccM7pxCUQD5 +BUTuJM56H+2MEb0SqPMV9Bx6MWkBG6fmXcCabH4JnudSREoQOiPkm7YDr6ictFuf +1EutkozOtREqqjcYjbTCuNhcBoz4/yO9NV7UfD5+gw6RlgWYw7If48hl66l7XaAs +zPw82W3tzPpLQ4zJ1LilYRyyQLYoEt+5+F/+07LJ7z20Hkt8HEyZNp496+ynaF4d +32duXvsCAwEAAaOCAvcwggLzMA4GA1UdDwEB/wQEAwIBhjCCAcYGA1UdIASCAb0w +ggG5MIIBtQYLYIZIAYb9bAEDAAIwggGkMDoGCCsGAQUFBwIBFi5odHRwOi8vd3d3 +LmRpZ2ljZXJ0LmNvbS9zc2wtY3BzLXJlcG9zaXRvcnkuaHRtMIIBZAYIKwYBBQUH +AgIwggFWHoIBUgBBAG4AeQAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEMAZQBy +AHQAaQBmAGkAYwBhAHQAZQAgAGMAbwBuAHMAdABpAHQAdQB0AGUAcwAgAGEAYwBj +AGUAcAB0AGEAbgBjAGUAIABvAGYAIAB0AGgAZQAgAEQAaQBnAGkAQwBlAHIAdAAg +AEMAUAAvAEMAUABTACAAYQBuAGQAIAB0AGgAZQAgAFIAZQBsAHkAaQBuAGcAIABQ +AGEAcgB0AHkAIABBAGcAcgBlAGUAbQBlAG4AdAAgAHcAaABpAGMAaAAgAGwAaQBt +AGkAdAAgAGwAaQBhAGIAaQBsAGkAdAB5ACAAYQBuAGQAIABhAHIAZQAgAGkAbgBj +AG8AcgBwAG8AcgBhAHQAZQBkACAAaABlAHIAZQBpAG4AIABiAHkAIAByAGUAZgBl +AHIAZQBuAGMAZQAuMA8GA1UdEwEB/wQFMAMBAf8wNAYIKwYBBQUHAQEEKDAmMCQG +CCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5jb20wgY8GA1UdHwSBhzCB +hDBAoD6gPIY6aHR0cDovL2NybDMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0SGlnaEFz +c3VyYW5jZUVWUm9vdENBLmNybDBAoD6gPIY6aHR0cDovL2NybDQuZGlnaWNlcnQu +Y29tL0RpZ2lDZXJ0SGlnaEFzc3VyYW5jZUVWUm9vdENBLmNybDAfBgNVHSMEGDAW +gBSxPsNpA/i/RwHUmCYaCALvY2QrwzAdBgNVHQ4EFgQUUOpzidsp+xCPnuUBINTe +eZlIg/cwDQYJKoZIhvcNAQEFBQADggEBAF1PhPGoiNOjsrycbeUpSXfh59bcqdg1 +rslx3OXb3J0kIZCmz7cBHJvUV5eR13UWpRLXuT0uiT05aYrWNTf58SHEW0CtWakv +XzoAKUMncQPkvTAyVab+hA4LmzgZLEN8rEO/dTHlIxxFVbdpCJG1z9fVsV7un5Tk +1nq5GMO41lJjHBC6iy9tXcwFOPRWBW3vnuzoYTYMFEuFFFoMg08iXFnLjIpx2vrF +EIRYzwfu45DC9fkpx1ojcflZtGQriLCnNseaIGHr+k61rmsb5OPs4tk8QUmoIKRU +9ZKNu8BVIASm2LAXFszj0Mi0PeXZhMbT9m5teMl5Q+h6N/9cNUm/ocU= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIEQjCCA6ugAwIBAgIEQoclDjANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEy +MjIxNTI3MjdaFw0xNDA3MjIxNTU3MjdaMGwxCzAJBgNVBAYTAlVTMRUwEwYDVQQK +EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xKzApBgNV +BAMTIkRpZ2lDZXJ0IEhpZ2ggQXNzdXJhbmNlIEVWIFJvb3QgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGzOVz5vvUu+UtLTKm3+WBP8nNJUm2cSrD +1ZQ0Z6IKHLBfaaZAscS3so/QmKSpQVk609yU1jzbdDikSsxNJYL3SqVTEjju80lt +cZF+Y7arpl/DpIT4T2JRvvjF7Ns4kuMG5QiRDMQoQVX7y1qJFX5x6DW/TXIJPb46 +OFBbdzEbjbPHJEWap6xtABRaBLe6E+tRCphBQSJOZWGHgUFQpnlcid4ZSlfVLuZd +HFMsfpjNGgYWpGhz0DQEE1yhcdNafFXbXmThN4cwVgTlEbQpgBLxeTmIogIRfCdm +t4i3ePLKCqg4qwpkwr9mXZWEwaElHoddGlALIBLMQbtuC1E4uEvLAgMBAAGjggET +MIIBDzASBgNVHRMBAf8ECDAGAQH/AgEBMCcGA1UdJQQgMB4GCCsGAQUFBwMBBggr +BgEFBQcDAgYIKwYBBQUHAwQwMwYIKwYBBQUHAQEEJzAlMCMGCCsGAQUFBzABhhdo +dHRwOi8vb2NzcC5lbnRydXN0Lm5ldDAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8v +Y3JsLmVudHJ1c3QubmV0L3NlcnZlcjEuY3JsMB0GA1UdDgQWBBSxPsNpA/i/RwHU +mCYaCALvY2QrwzALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8BdiE1U9s/8KAGv7 +UISX8+1i0BowGQYJKoZIhvZ9B0EABAwwChsEVjcuMQMCAIEwDQYJKoZIhvcNAQEF +BQADgYEAUuVY7HCc/9EvhaYzC1rAIo348LtGIiMduEl5Xa24G8tmJnDioD2GU06r +1kjLX/ktCdpdBgXadbjtdrZXTP59uN0AXlsdaTiFufsqVLPvkp5yMnqnuI3E2o6p +NpAkoQSbB6kUCNnXcW26valgOjDLZFOnr241QiwdBAJAAE/rRa8= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC +VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u +ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc +KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u +ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1 +MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE +ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j +b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF +bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg +U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA +A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/ +I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3 +wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC +AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb +oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5 +BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p +dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk +MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp +b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu +dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0 +MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi +E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa +MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI +hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN +95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd +2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= +-----END CERTIFICATE----- diff --git a/code/web/app/app_achievements/include/ach_render_ig.php b/code/web/app/app_achievements/include/ach_render_ig.php index e9f54c163..0d9574924 100644 --- a/code/web/app/app_achievements/include/ach_render_ig.php +++ b/code/web/app/app_achievements/include/ach_render_ig.php @@ -110,7 +110,7 @@ function ach_render_yubopoints() { global $DBc,$_USER,$_CONF; - $res = $DBc->sqlQuery("SELECT sum(ap_value) as anz FROM ach_perk,ach_player_perk WHERE ap_id=app_perk AND app_player='".$_USER->getID()."'"); + $res = $DBc->sqlQuery("SELECT sum(at_value) as anz FROM ach_task,ach_player_task WHERE ap_id=apt_task AND apt_player='".$_USER->getID()."'"); $html = "".$_USER->getName()."  ".max(0,$res[0]['anz']).""; @@ -176,6 +176,10 @@ #return ""; $html = ""; + if($cat->isHeroic() && !$cat->hasDone()) { + return "
You haven't earned any Heroic Deeds so far.
"; + } + if($cat->isTiedCult() || $cat->isTiedCiv()) { $html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat); } @@ -183,22 +187,22 @@ $iter = $cat->getDone(); while($iter->hasNext()) { $curr = $iter->getNext(); - #$sz = sizeof($tmp); - #for($i=0;$i<$sz;$i++) { - #echo "A"; - if($curr->inDev()) { + + if($curr->inDev() || !$curr->parentDone()) { continue; } $html .= ach_render_achievement_done($curr); } + if($cat->isHeroic()) { + return $html; + } + $iter = $cat->getOpen(); while($iter->hasNext()) { $curr = $iter->getNext(); - #$sz = sizeof($tmp); - #for($i=0;$i<$sz;$i++) { - #echo "B"; - if($curr->inDev()) { + + if($curr->inDev() || !$curr->parentDone()) { continue; } $html .= ach_render_achievement_open($curr); @@ -218,9 +222,13 @@ getImage()."'>
".$ach->getName()."
- ".ach_render_perk_done($ach)."
+ ".ach_render_task_done($ach)."
- ".$ach->getValueDone()."
+ "; + if(!$ach->isHeroic()) { + $html .= "".$ach->getValueDone()."
"; + } + $html .= " @@ -242,7 +250,7 @@ getImage()."'>
".$ach->getName()."
- ".ach_render_perk_open($ach)."
+ ".ach_render_task_open($ach)."
".$ach->getValueOpen()."
@@ -255,40 +263,38 @@ return $html; } - function ach_render_perk_open(&$ach) { + function ach_render_task_open(&$ach) { $html = ""; - $perk_list = $ach->getOpen(); - $perk = $perk_list->getNext(); + $task_list = $ach->getOpen(); + $task = $task_list->getNext(); - if($perk->inDev()) { + if($task->inDev()) { return $html; } - if($perk->getName() != null) { - $html .= "".$perk->getDisplayName()." "; + if($task->getName() != null) { + $html .= "".$task->getDisplayName()." "; } - if($perk->objDrawable()) { - $html .= "".ach_render_obj_list($perk->getIterator()).""; + if($task->objDrawable()) { + $html .= "".ach_render_obj_list($task->getIterator()).""; } return $html; } - function ach_render_perk_done(&$ach) { + function ach_render_task_done(&$ach) { global $_CONF; $html = ""; - $perk_list = $ach->getDone(); - while($perk_list->hasNext()) { - $perk = $perk_list->getNext(); + $task_list = $ach->getDone(); + while($task_list->hasNext()) { + $task = $task_list->getNext(); - #foreach($perk_list as $elem) { - #$perk = $ach->getChild($elem); - if($perk->inDev()) { + if($task->inDev()) { continue; } - $html .= "".$perk->getDisplayName()." ( ".date('d.m.Y',$perk->getDone())." ) ".$perk->getValue().""; + $html .= "".$task->getDisplayName()." ( ".date('d.m.Y',$task->getDone())." ) ".$task->getValue().""; } return $html; @@ -301,7 +307,6 @@ $skip = false; while($obj->hasNext()) { - #foreach($obj as $elem) { $elem = $obj->getNext(); if(($i%2) == 0) { $html .= ""; @@ -366,7 +371,7 @@ function ach_render_obj_meta(&$obj) { global $_CONF; - $html = ""; + if($obj->isdone()) { $col = "#71BE02"; $grey = ""; @@ -402,6 +407,11 @@ } function ach_render_progressbar($prog,$val,$width) { + $hero = false; + if($val == false) { + $hero = true; + $val = $prog; + } $val = max(1,$val); $left = floor($width*(100*($prog/$val))/100); $left = max(1,$left); @@ -413,13 +423,18 @@ + - @@ -451,7 +466,16 @@ $html .= ""; } - $html .= ""; + $html .= ""; + $sum_done += $elem[1]; $sum_total += $elem[2]; diff --git a/code/web/app/app_achievements/include/ach_render_web.php b/code/web/app/app_achievements/include/ach_render_web.php index 8c9df92bd..a82005496 100644 --- a/code/web/app/app_achievements/include/ach_render_web.php +++ b/code/web/app/app_achievements/include/ach_render_web.php @@ -51,7 +51,7 @@ } function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) { - global $_USER,$_CONF; + global $_USER; $html = ""; - - $html .= "
-
- -
"; - if(($prog/$val) > 0.5) { - $html .= " ".nf($prog)." / ".nf($val)." "; + if($hero == false) { + if(($prog/$val) > 0.5) { + $html .= " ".nf($prog)." / ".nf($val)." "; + } + $html .= ""; + if(($prog/$val) <= 0.5) { + $html .= " ".nf($prog)." / ".nf($val)." "; + } } - $html .= ""; - if(($prog/$val) <= 0.5) { - $html .= " ".nf($prog)." / ".nf($val)." "; + else { + $html .= " ".nf($prog)." "; } $html .= "
".$elem[0]."
".ach_render_progressbar($elem[1],$elem[2],150)."
".$elem[0]."
"; + if($elem[3] == false) { + $html .= ach_render_progressbar($elem[1],$elem[2],150); + } + else { + $html .= ach_render_progressbar($elem[1],false,150); + } + + $html .= "
- - - - - - - - - - - - -
name
image
 
- - - "; - - if($_REQUEST['ac_id'] > 0 && $_REQUEST['confirm'] == "delete") { - $curr = $menu->getNode($_REQUEST['ac_id']); - $html .= "
-
- Are you sure you want to delete this category?"; - if($curr->hasAchievements()) { - $html .= "You may NOT DELETE this category since there are still achievements tied to it or one of its sub-categories!"; - } - else { - $html .= "".$curr->getName()."

"; - - if($curr->getParentID() == null) { - $html .= "WARNING: Deleting this category will also delete ALL sub-categories!
"; - } - $html .= "delete"; - } - $html .= "

-
"; - } - - $html .= ""; - - return $html.ach_render_mnode($menu,$sub); - } - - function ach_render_mnode(&$menu,$sub) { - global $_CONF; - - # echo "1"; - - $iter = $menu->getIterator(); - while($iter->hasNext()) { - $curr = $iter->getNext(); - #$sz = $menu->getSize(); - #for($i=0;$i<$sz;$i++) { - # $curr = $menu->getChild($i); - - $html .= " - "; - if($sub == 0) { - $html .= ""; - } - $html .= " - - -
getImage()."' />"; - if($curr->inDev()) { - $html .= ""; - } - - $html .= $curr->getName(); - - if($curr->inDev()) { - $html .= ""; - } - $html .= " "; - - if($sub == 0) { - $html .= " "; - } - - $html .= "   
"; - if($sub == 0) { - $html .= ""; - } - - $html .= ""; - - if(!$curr->isEmpty()) { - $html .= "
".ach_render_mnode($curr,($sub+4))."
"; - } - } - - return $html; - } -?> \ No newline at end of file diff --git a/code/web/app/app_achievements_admin/include/adm_render_ach.php b/code/web/app/app_achievements_admin/include/adm_render_ach.php index 1639d5b66..6f4475adc 100644 --- a/code/web/app/app_achievements_admin/include/adm_render_ach.php +++ b/code/web/app/app_achievements_admin/include/adm_render_ach.php @@ -22,16 +22,13 @@ function adm_render_mnode(&$menu,$sub) { global $_CONF; + + $html = ""; $iter = $menu->getIterator(); while($iter->hasNext()) { $curr = $iter->getNext(); - #$sz = $menu->getSize(); - #for($i=0;$i<$sz;$i++) { - # $curr = $menu->getChild($i); - if($curr->inDev()) { - #continue; - } + $html .= ""; if($sub == 0) { @@ -53,6 +50,40 @@ } function adm_render_category(&$cat) { + global $menu,$metalist,$DBc,$_USER; + + $html = ""; + + $m = $menu->getIterator(); + while($m->hasNext()) { + $n = $m->getNext(); + $html .= ""; + + $m2 = $n->getIterator(); + while($m2->hasNext()) { + $n2 = $m2->getNext(); + $html .= ""; + + //db + $res = $DBc->sqlQuery("SELECT aa_id,aal_name FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$n2->getID()."' ORDER by aa_sticky DESC, aal_name ASC"); + $sz = sizeof($res); + for($i=0;$i<$sz;$i++) { + $html .= ""; + } + } + + //db + $res = $DBc->sqlQuery("SELECT aa_id,aal_name FROM ach_achievement LEFT JOIN (ach_achievement_lang) ON (aal_lang='".$_USER->getLang()."' AND aal_achievement=aa_id) WHERE aa_category='".$n->getID()."' ORDER by aa_sticky DESC, aal_name ASC"); + $sz = sizeof($res); + for($i=0;$i<$sz;$i++) { + $html .= ""; + } + } + + $metalist = $html; + + + $html = " -
+
"; - if($cat->isTiedCult()) { + if($cat->isTiedCultDev()) { $html.= ""; } - if($cat->isTiedCiv()) { + if($cat->isTiedCivDev()) { $html.= "
'; - $html .= ach_render_perk_done($ach); + $html .= ach_render_task_done($ach); $html .= '
@@ -217,7 +219,7 @@ '.$ach->getValueOpen().'
'; - $html .= ach_render_perk_open($ach); + $html .= ach_render_task_open($ach); $html .= ' @@ -232,52 +234,46 @@ return $html; } - function ach_render_perk_open(&$ach) { - #echo var_export($perk_list,true); + function ach_render_task_open(&$ach) { $html = ""; - $perk_list = $ach->getOpen(); - $perk = $perk_list->getNext(); + $task_list = $ach->getOpen(); + $task = $task_list->getNext(); - #$perk = $ach->getChild($perk_list[0]); - - if($perk->inDev()) { + if($task->inDev()) { return $html; } $html .= ""; - if($perk->getName() != null) { - $html .= $perk->getName(); + if($task->getName() != null) { + $html .= $task->getName(); } else { - $tml .= "[untitled]"; + $html .= "[untitled]"; } - $html .= "
Perk: grant"; - #if($perk->getName() != null) { - $html .= "
"; - #} - if($perk->objDrawable()) { - $html .= ach_render_obj_list($perk->getIterator()); + $html .= " Task: grant"; + + if($task->objDrawable()) { + $html .= ach_render_obj_list($task->getIterator()); } return $html; } - function ach_render_perk_done(&$ach) { + function ach_render_task_done(&$ach) { global $_CONF; $html = ""; - $perk_list = $ach->getDone(); - while($perk_list->hasNext()) { - $perk = $perk_list->getNext(); - #foreach($perk_list as $elem) { - #$perk = $ach->getChild($elem); - if($perk->inDev()) { + $task_list = $ach->getDone(); + while($task_list->hasNext()) { + $task = $task_list->getNext(); + + if($task->inDev()) { continue; } - $html .= "
".$perk->getName()." ( ".date('d.m.Y',$perk->getDone())." ) ".$perk->getValue()." Perk: deny
"; + $html .= "
".$task->getName()." ( ".date('d.m.Y',$task->getDone())." ) ".$task->getValue()." Task: deny
"; } return $html; @@ -489,7 +485,7 @@ } function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) { - global $_USER,$_CONF; + global $_USER; $html = "