mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 23:26:15 +00:00
#1470 some cleanup; some bugfix; some documentation
--HG-- branch : gsoc2012-achievements
This commit is contained in:
parent
c96ff882cd
commit
c888a5249e
72 changed files with 2693 additions and 2064 deletions
|
@ -14,12 +14,12 @@
|
|||
echo '<?xml version="1.0" ?><ryzom_progress>';
|
||||
echo "<character id='".$_REQUEST['cid']."' />";
|
||||
|
||||
echo "<perks>";
|
||||
$res = $DBc->sendSQL("SELECT * FROM ach_player_perk WHERE app_player='".$DBc->mre($_REQUEST['cid'])."'","ARRAY");
|
||||
echo "<tasks>";
|
||||
$res = $DBc->sendSQL("SELECT * FROM ach_player_task WHERE apt_player='".$DBc->mre($_REQUEST['cid'])."'","ARRAY");
|
||||
foreach($res as $elem) {
|
||||
echo "<perk id='".$elem['app_perk']."' date='".$elem['app_date']."' />";
|
||||
echo "<task id='".$elem['apt_task']."' date='".$elem['apt_date']."' />";
|
||||
}
|
||||
echo "</perks>";
|
||||
echo "</tasks>";
|
||||
|
||||
echo "<objectives>";
|
||||
echo "<done>";
|
||||
|
|
|
@ -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 "<perk id='".$curr4->getID()."' parent='".$curr4->getParentID()."' value='".$curr4->getValue()."'><name><![CDATA[".$curr4->getDisplayName()."]]></name>";
|
||||
echo "<task id='".$curr4->getID()."' parent='".$curr4->getParentID()."' value='".$curr4->getValue()."'><name><![CDATA[".$curr4->getDisplayName()."]]></name>";
|
||||
$iter5 = $curr4->getIterator();
|
||||
while($iter5->hasNext()) {
|
||||
$curr5 = $iter5->getNext();
|
||||
echo "<objective id='".$curr5->getID()."' type='".$curr5->getDisplay()."' value='".$curr5->getValue()."' meta='".$_CONF['image_url']."pic/icon/".$curr5->getMetaImage()."'><name><![CDATA[".$curr5->getDisplayName()."]]></name></objective>";
|
||||
}
|
||||
echo "</perk>";
|
||||
echo "</task>";
|
||||
}
|
||||
echo "</achievement>";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
ini_set("display_errors","1");
|
||||
|
||||
if(file_exists("monitor.stop")) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
require_once("class/mySQL_class.php");
|
||||
require_once("conf.php");
|
||||
|
||||
//create database connection
|
||||
$DBc = new mySQL($CONF['mysql_error']);
|
||||
$DBc->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);
|
||||
?>
|
|
@ -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!");
|
||||
|
|
|
@ -1,207 +0,0 @@
|
|||
<?php
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
ini_set("display_errors","1");
|
||||
|
||||
if(file_exists("parser.stop")) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
require_once("class/mySQL_class.php");
|
||||
require_once("conf.php");
|
||||
require_once("inlcude/functions_inc.php");
|
||||
|
||||
$logfile = false;
|
||||
if($CONF['logging'] == true) {
|
||||
require_once("class/Logfile_class.php");
|
||||
#$logfile = fopen($CONF['logfile'].'.'.date("Ymd",time()).'.txt','a');
|
||||
$logfile = new Logfile($CONF['logfile']);
|
||||
}
|
||||
|
||||
//set mode: cron || single with given cid
|
||||
#MISSING: conf to allow external calls; whitelist ips
|
||||
$MODE = "CRON";
|
||||
if($_REQUEST["cid"] > 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);
|
||||
?>
|
|
@ -1,4 +1,10 @@
|
|||
<?php
|
||||
/*
|
||||
* Class for Atoms.
|
||||
* It's used to run the code from the ruleset and register listening to data.
|
||||
* Also we have the functions to manipulate progress here.
|
||||
*/
|
||||
|
||||
class Atom {
|
||||
private $ruleset;
|
||||
private $id;
|
||||
|
@ -14,10 +20,7 @@
|
|||
$this->user = $user;
|
||||
}
|
||||
|
||||
function register() {
|
||||
global $DBc,$_DATA;
|
||||
|
||||
#echo "register<br>";
|
||||
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");
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
/*
|
||||
* Callback container that handles doing the actual callback
|
||||
*/
|
||||
class Callback {
|
||||
private $who;
|
||||
private $func;
|
||||
|
@ -8,7 +11,7 @@
|
|||
$this->func = $func;
|
||||
}
|
||||
|
||||
function call($what) {
|
||||
function call($what) { // now call it
|
||||
eval(''.$this->func.'($what,$this->who,$this);');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
abstract class DataSource {
|
||||
private $data;
|
||||
private $types = array();
|
||||
private $write = false;
|
||||
|
||||
function DataSource() {
|
||||
require_once(dirname(__FILE__)."/conf.php");
|
||||
|
||||
$this->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);
|
||||
}
|
||||
?>
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
class DataTable {
|
||||
private $table;
|
||||
|
||||
function DataTable(&$res) {
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
class Logfile {
|
||||
private $logfile;
|
||||
private $buffer;
|
||||
|
||||
function Logfile($f = false) {
|
||||
$this->logfile = false;
|
||||
|
|
|
@ -1,160 +0,0 @@
|
|||
<?php
|
||||
|
||||
// This class is designed to make it easy to run multiple curl requests in parallel, rather than
|
||||
// waiting for each one to finish before starting the next. Under the hood it uses curl_multi_exec
|
||||
// but since I find that interface painfully confusing, I wanted one that corresponded to the tasks
|
||||
// that I wanted to run.
|
||||
//
|
||||
// To use it, first create the ParallelCurl object:
|
||||
//
|
||||
// $parallelcurl = new ParallelCurl(10);
|
||||
//
|
||||
// The first argument to the constructor is the maximum number of outstanding fetches to allow
|
||||
// before blocking to wait for one to finish. You can change this later using setMaxRequests()
|
||||
// The second optional argument is an array of curl options in the format used by curl_setopt_array()
|
||||
//
|
||||
// Next, start a URL fetch:
|
||||
//
|
||||
// $parallelcurl->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 <pete@petewarden.com>, 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -95,7 +95,7 @@
|
|||
else {
|
||||
return $res;
|
||||
}
|
||||
mysql_free_result($res);
|
||||
//mysql_free_result($res);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
|
|
@ -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";
|
||||
?>
|
|
@ -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;
|
||||
}
|
||||
?>
|
|
@ -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);
|
||||
}
|
|
@ -58,6 +58,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function pointStringToCoordinates($pointString) {
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
}
|
||||
|
||||
function drive($cid) {
|
||||
global $CONF,$_DISPATCHER;
|
||||
global $_DISPATCHER;
|
||||
|
||||
echo "kk";
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
class ValueCache extends DataSource {
|
||||
function ValueCache() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function loadData($ident,$type) {
|
||||
$res = $DBc->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");
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
$CONF = array();
|
||||
|
||||
$CONF['types'] = array("c_cache");
|
||||
$CONF['write'] = true;
|
||||
|
||||
?>
|
|
@ -1,229 +0,0 @@
|
|||
<?php
|
||||
class XMLapi extends DataSource {
|
||||
private $xml_path;
|
||||
|
||||
function XMLapi() {
|
||||
parent::__construct();
|
||||
|
||||
$this->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];
|
||||
}
|
||||
|
||||
#<position x="17027.559" y="-32943.011" head="-1.981871"/>
|
||||
$r = $xml->xpath("position");
|
||||
$attr = $r->attributes();
|
||||
$dta['pos_x'] = $attr['x'];
|
||||
$dta['pos_y'] = $attr['y'];
|
||||
$dta['pos_head'] = $attr['head'];
|
||||
|
||||
#<hitpoints max="3941">3941</hitpoints>
|
||||
#<stamina max="1790">1790</stamina>
|
||||
#<sap max="1890">1890</sap>
|
||||
#<focus max="2750">2750</focus>
|
||||
$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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
$CONF = array();
|
||||
|
||||
$CONF['types'] = array("c_stats","c_items","c_connection","c_gear","c_fp","c_skills","c_fame","c_pet");
|
||||
$CONF['write'] = false;
|
||||
|
||||
$CONF['xml_path'] = "foo/bar/xml/"; // this is a dummy ^^
|
||||
?>
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 66 KiB |
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 188 KiB After Width: | Height: | Size: 234 KiB |
BIN
code/web/app/app_achievements/_doc/Ryzom Player Achievements.pdf
Normal file
BIN
code/web/app/app_achievements/_doc/Ryzom Player Achievements.pdf
Normal file
Binary file not shown.
|
@ -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 */;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
|
@ -29,7 +29,6 @@
|
|||
}
|
||||
|
||||
function inorder() {
|
||||
#echo "<br>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()) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
class AchCategory extends AchList implements Tieable {
|
||||
#protected $id;
|
||||
protected $ties_cult;
|
||||
protected $ties_civ;
|
||||
protected $ties_race;
|
||||
|
@ -9,6 +8,7 @@
|
|||
protected $ties_civ_dev;
|
||||
protected $cult;
|
||||
protected $civ;
|
||||
protected $heroic;
|
||||
|
||||
function AchCategory($id,$race = null,$cult = null,$civ = null) {
|
||||
global $DBc,$_USER;
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
$this->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);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -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()."<br>";
|
||||
return ($this->child_open->getSize() != 0);
|
||||
}
|
||||
|
||||
final function hasDone() {
|
||||
#echo "hasDone: ".$this->child_done->getSize()."<br>";
|
||||
return ($this->child_done->getSize() != 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
class AchObjective extends Parentum {
|
||||
protected $perk;
|
||||
protected $task;
|
||||
protected $condition;
|
||||
protected $value;
|
||||
protected $name;
|
||||
|
@ -8,6 +8,7 @@
|
|||
protected $done;
|
||||
protected $progress;
|
||||
protected $meta_image;
|
||||
protected $metalink;
|
||||
|
||||
function AchObjective($data,$parent) {
|
||||
global $DBc,$_USER;
|
||||
|
@ -16,13 +17,18 @@
|
|||
|
||||
$this->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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
class AchPerk extends Parentum {
|
||||
class AchTask extends Parentum {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# InDev_trait replaces this in PHP 5.4
|
||||
|
@ -36,22 +36,22 @@
|
|||
protected $template;
|
||||
protected $parent_id;
|
||||
|
||||
function AchPerk($data,$parent) {
|
||||
function AchTask($data,$parent) {
|
||||
global $DBc,$_USER;
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->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));
|
||||
}
|
||||
|
|
@ -73,19 +73,16 @@
|
|||
|
||||
$this->avl->insert($n);
|
||||
$this->size++;
|
||||
|
||||
#$this->avl->inorder();
|
||||
#echo "<br>";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function removeNode($id) {
|
||||
echo "rid: ".$id."<br>";
|
||||
$this->avl->inorder();
|
||||
echo "<br>";
|
||||
|
||||
$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 "<br>";
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?php
|
||||
class NodeIterator {
|
||||
/*---------------------------
|
||||
The NodeIterator can be used just like a foreach() loop to iterate
|
||||
arrays.
|
||||
The NodeIterator can be used to iterate linked lists.
|
||||
|
||||
Sample:
|
||||
$iter = new NodeIterator(array());
|
||||
|
@ -12,33 +11,20 @@
|
|||
}
|
||||
---------------------------*/
|
||||
private $node;
|
||||
#private $curr;
|
||||
|
||||
function NodeIterator($node) {
|
||||
$this->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;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
protected $parent;
|
||||
|
||||
function Node() {
|
||||
|
||||
// dummy constructor
|
||||
}
|
||||
|
||||
final function getID() {
|
||||
|
|
|
@ -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";
|
||||
?>
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
ini_set("display_errors","1");
|
||||
|
||||
define('APP_NAME', 'app_achievements');
|
||||
|
||||
require_once('conf.php');
|
||||
require_once("fb/facebook.php");
|
||||
|
||||
|
||||
$facebook = new Facebook(array(
|
||||
'appId' => $_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 '<script type="text/javascript">
|
||||
top.location.href = "'.$login_url.'";
|
||||
</script>';
|
||||
}
|
||||
else {
|
||||
echo var_export($facebook->getUser(),true);
|
||||
// Do the wall post.
|
||||
try {
|
||||
|
||||
$facebook->api("/me/feed", "post", array(
|
||||
message => "My character Talvela just earned <b>'Bejeweled'</b> 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 <a href="' . $login_url . '">login.</a>';
|
||||
#error_log($e->getType());
|
||||
#error_log($e->getMessage());
|
||||
}
|
||||
}
|
||||
?>
|
1269
code/web/app/app_achievements/fb/base_facebook.php
Normal file
1269
code/web/app/app_achievements/fb/base_facebook.php
Normal file
File diff suppressed because it is too large
Load diff
121
code/web/app/app_achievements/fb/fb_ca_chain_bundle.crt
Normal file
121
code/web/app/app_achievements/fb/fb_ca_chain_bundle.crt
Normal file
|
@ -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-----
|
|
@ -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 = "<font size='32px'>".$_USER->getName()." <img src='".$_CONF['image_url']."pic/yubo_done.png'> ".max(0,$res[0]['anz'])."</font>";
|
||||
|
||||
|
@ -176,6 +176,10 @@
|
|||
#return "";
|
||||
$html = "";
|
||||
|
||||
if($cat->isHeroic() && !$cat->hasDone()) {
|
||||
return "<center style='font-size:24px;'>You haven't earned any Heroic Deeds so far.</center>";
|
||||
}
|
||||
|
||||
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 @@
|
|||
<tr>
|
||||
<td width='70px'><img src='".$_CONF['image_url']."pic/icon/".$ach->getImage()."'></td>
|
||||
<td><center><font size='22px'><b>".$ach->getName()."</b></font></center>
|
||||
<table>".ach_render_perk_done($ach)."</table>
|
||||
<table>".ach_render_task_done($ach)."</table>
|
||||
</td>
|
||||
<td width='35px'><font size='24px' color='#000000'>".$ach->getValueDone()."</font><br><img src='".$_CONF['image_url']."pic/yubo_done.png'></td>
|
||||
<td width='35px'>";
|
||||
if(!$ach->isHeroic()) {
|
||||
$html .= "<font size='24px' color='#000000'>".$ach->getValueDone()."</font><br><img src='".$_CONF['image_url']."pic/yubo_done.png'>";
|
||||
}
|
||||
$html .= "</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
@ -242,7 +250,7 @@
|
|||
<tr>
|
||||
<td width='70px'><img src='".$_CONF['image_url']."pic/icon/grey/".$ach->getImage()."'></td>
|
||||
<td><center><font size='22px'><b>".$ach->getName()."</b></font></center>
|
||||
<table>".ach_render_perk_open($ach)."</table>
|
||||
<table>".ach_render_task_open($ach)."</table>
|
||||
</td>
|
||||
<td width='35px'><font size='22px' color='#000000'>".$ach->getValueOpen()."</font><br><img src='".$_CONF['image_url']."pic/yubo_pending.png'></td>
|
||||
</tr>
|
||||
|
@ -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 .= "<tr><td><font color='#999999' size='12px'><b>".$perk->getDisplayName()."</b></font></td></tr><tr><td> </td></tr>";
|
||||
if($task->getName() != null) {
|
||||
$html .= "<tr><td><font color='#999999' size='12px'><b>".$task->getDisplayName()."</b></font></td></tr><tr><td> </td></tr>";
|
||||
}
|
||||
if($perk->objDrawable()) {
|
||||
$html .= "<tr><td>".ach_render_obj_list($perk->getIterator())."</td></tr>";
|
||||
if($task->objDrawable()) {
|
||||
$html .= "<tr><td>".ach_render_obj_list($task->getIterator())."</td></tr>";
|
||||
}
|
||||
|
||||
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 .= "<tr><td><font color='#66CC00'><b>".$perk->getDisplayName()."</b></font> ( ".date('d.m.Y',$perk->getDone())." ) <img src='".$_CONF['image_url']."pic/yubo_done_small.png' /> ".$perk->getValue()."</td></tr>";
|
||||
$html .= "<tr><td><font color='#66CC00'><b>".$task->getDisplayName()."</b></font> ( ".date('d.m.Y',$task->getDone())." ) <img src='".$_CONF['image_url']."pic/yubo_done_small.png' /> ".$task->getValue()."</td></tr>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
@ -301,7 +307,6 @@
|
|||
$skip = false;
|
||||
|
||||
while($obj->hasNext()) {
|
||||
#foreach($obj as $elem) {
|
||||
$elem = $obj->getNext();
|
||||
if(($i%2) == 0) {
|
||||
$html .= "<tr>";
|
||||
|
@ -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 @@
|
|||
<table width='".$width."px' cellspacing='0' cellpadding='0'>
|
||||
<tr>
|
||||
<td bgcolor='#66CC00' width='".$left."px'><font color='#000000'>";
|
||||
if(($prog/$val) > 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
if($hero == false) {
|
||||
if(($prog/$val) > 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
}
|
||||
$html .= "</font></td>
|
||||
<td align='left' bgcolor='#00000066'><font color='#FFFFFF'>";
|
||||
if(($prog/$val) <= 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
}
|
||||
}
|
||||
$html .= "</font></td>
|
||||
<td align='left' bgcolor='#00000066'><font color='#FFFFFF'>";
|
||||
if(($prog/$val) <= 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
else {
|
||||
$html .= " ".nf($prog)." ";
|
||||
}
|
||||
$html .= "</font></td>
|
||||
</tr>
|
||||
|
@ -451,7 +466,16 @@
|
|||
$html .= "<tr>";
|
||||
}
|
||||
|
||||
$html .= "<td width='225px'>".$elem[0]."<br>".ach_render_progressbar($elem[1],$elem[2],150)."</td>";
|
||||
$html .= "<td width='225px'>".$elem[0]."<br>";
|
||||
if($elem[3] == false) {
|
||||
$html .= ach_render_progressbar($elem[1],$elem[2],150);
|
||||
}
|
||||
else {
|
||||
$html .= ach_render_progressbar($elem[1],false,150);
|
||||
}
|
||||
|
||||
$html .= "</td>";
|
||||
|
||||
$sum_done += $elem[1];
|
||||
$sum_total += $elem[2];
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
|
||||
function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) {
|
||||
global $_USER,$_CONF;
|
||||
global $_USER;
|
||||
|
||||
$html = "<style>
|
||||
.o {
|
||||
|
@ -125,7 +125,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 at_id=apt_task AND apt_player='".$_USER->getID()."'");
|
||||
|
||||
$html = "<div style='display:block;'><span style='font-size:32px;'>".$_USER->getName()." <img src='".$_CONF['image_url']."pic/yubo_done.png'> ".max(0,$res[0]['anz'])."</span></div>";
|
||||
|
||||
|
@ -179,14 +179,13 @@
|
|||
|
||||
function ach_render_mnode(&$menu,$sub) {
|
||||
global $_CONF;
|
||||
|
||||
$html = "";
|
||||
|
||||
$iter = $menu->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
#$curr = $curr->data;
|
||||
#$sz = $menu->getSize();
|
||||
#for($i=0;$i<$sz;$i++) {
|
||||
# $curr = $menu->getChild($i);
|
||||
|
||||
if($curr->inDev()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -213,6 +212,10 @@
|
|||
function ach_render_category(&$cat) {
|
||||
$html = "";
|
||||
|
||||
if($cat->isHeroic() && !$cat->hasDone()) {
|
||||
return "<center style='font-size:24px;'>You haven't earned any Heroic Deeds so far.</center>";
|
||||
}
|
||||
|
||||
if($cat->isTiedCult() || $cat->isTiedCiv()) {
|
||||
$html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat);
|
||||
}
|
||||
|
@ -223,19 +226,23 @@
|
|||
#$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);
|
||||
|
@ -260,11 +267,13 @@
|
|||
<tbody><tr>
|
||||
<td rowspan="2" valign="top"><img src="'.$_CONF['image_url'].'pic/icon/'.$ach->getImage().'"></td>
|
||||
<td width="100%"><center><span style="font-weight:bold;font-size:24px;color:#000000;">'.$ach->getName().'</span></center></td>
|
||||
<td rowspan="2" valign="top" style="font-weight: bold; text-align: center; font-size: 30px;color:#000000;padding-right:10px;">
|
||||
'.$ach->getValueDone().'<br><img src="'.$_CONF['image_url'].'pic/yubo_done.png">
|
||||
</td>
|
||||
<td rowspan="2" valign="top" style="font-weight: bold; text-align: center; font-size: 30px;color:#000000;padding-right:10px;">';
|
||||
if(!$ach->isHeroic()) {
|
||||
$html .= $ach->getValueDone().'<br><img src="'.$_CONF['image_url'].'pic/yubo_done.png">';
|
||||
}
|
||||
$html .= '</td>
|
||||
</tr><tr><td align="center" valign="top">';
|
||||
$html .= ach_render_perk_done($ach);
|
||||
$html .= ach_render_task_done($ach);
|
||||
$html .= '</td></tr></tbody></table></center>
|
||||
</td>
|
||||
<td style="background-image: url('.$_CONF['image_url'].'pic/bar_done_r.png);"></td>
|
||||
|
@ -299,7 +308,7 @@
|
|||
'.$ach->getValueOpen().'<br><img src="'.$_CONF['image_url'].'pic/yubo_pending.png">
|
||||
</td>
|
||||
</tr><tr><td align="center" valign="top">';
|
||||
$html .= ach_render_perk_open($ach);
|
||||
$html .= ach_render_task_open($ach);
|
||||
$html .= '</td></tr></tbody></table></center>
|
||||
</td>
|
||||
<td style="background-image: url('.$_CONF['image_url'].'pic/bar_pending_r.png);"></td>
|
||||
|
@ -314,42 +323,38 @@
|
|||
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;
|
||||
}
|
||||
|
||||
if($perk->getName() != null) {
|
||||
$html .= "<span style='color:#999999;font-weight:bold;display:block;'>".$perk->getDisplayName()."</span>";
|
||||
if($task->getName() != null) {
|
||||
$html .= "<span style='color:#999999;font-weight:bold;display:block;'>".$task->getDisplayName()."</span>";
|
||||
}
|
||||
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();
|
||||
#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 .= "<div style='display:block;'><span style='color:#66CC00;font-weight:bold;'>".$perk->getDisplayName()."</span> ( ".date('d.m.Y',$perk->getDone())." ) <img src='".$_CONF['image_url']."pic/yubo_done.png' width='15px' /> ".$perk->getValue()."</div>";
|
||||
$html .= "<div style='display:block;'><span style='color:#66CC00;font-weight:bold;'>".$task->getDisplayName()."</span> ( ".date('d.m.Y',$task->getDone())." ) <img src='".$_CONF['image_url']."pic/yubo_done.png' width='15px' /> ".$task->getValue()."</div>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
@ -426,7 +431,7 @@
|
|||
|
||||
function ach_render_obj_meta(&$obj) {
|
||||
global $_CONF;
|
||||
$html = "";
|
||||
|
||||
if($obj->isdone()) {
|
||||
$col = "#71BE02";
|
||||
$grey = "";
|
||||
|
@ -462,6 +467,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);
|
||||
|
||||
|
@ -469,13 +479,18 @@
|
|||
<table width='".$width."px' cellspacing='0' cellpadding='0' style='border:1px solid #FFFFFF;color:#000000;'>
|
||||
<tr>
|
||||
<td bgcolor='#66CC00' width='".$left."px' align='right'>";
|
||||
if(($prog/$val) > 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
if($hero == false) {
|
||||
if(($prog/$val) > 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
}
|
||||
$html .= "</td>
|
||||
<td align='left' style='color:#FFFFFF;'>";
|
||||
if(($prog/$val) <= 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
}
|
||||
}
|
||||
$html .= "</td>
|
||||
<td align='left' style='color:#FFFFFF;'>";
|
||||
if(($prog/$val) <= 0.5) {
|
||||
$html .= " ".nf($prog)." / ".nf($val)." ";
|
||||
else {
|
||||
$html .= " ".nf($prog)." ";
|
||||
}
|
||||
$html .= "</td>
|
||||
</tr>
|
||||
|
@ -505,7 +520,14 @@
|
|||
$html .= "<tr>";
|
||||
}
|
||||
|
||||
$html .= "<td width='50%' align='center'>".$elem[0]."<br>".ach_render_progressbar($elem[1],$elem[2],200)."</td>";
|
||||
$html .= "<td width='50%' align='center'>".$elem[0]."<br>";
|
||||
if($elem[3] == 0) {
|
||||
$html .= ach_render_progressbar($elem[1],$elem[2],200);
|
||||
}
|
||||
else {
|
||||
$html .= ach_render_progressbar($elem[1],false,200);
|
||||
}
|
||||
$html .= "</td>";
|
||||
$sum_done += $elem[1];
|
||||
$sum_total += $elem[2];
|
||||
|
||||
|
|
|
@ -52,15 +52,15 @@ require_once("class/AchMenuNode_class.php");
|
|||
require_once("class/AchSummary_class.php");
|
||||
require_once("class/AchCategory_class.php");
|
||||
require_once("class/AchAchievement_class.php");
|
||||
require_once("class/AchPerk_class.php");
|
||||
require_once("class/AchTask_class.php");
|
||||
require_once("class/AchObjective_class.php");
|
||||
|
||||
require_once("fb/facebook.php");
|
||||
|
||||
// Update user acces on Db
|
||||
#$DBc = ryDB::getInstance(APP_NAME."_test");
|
||||
$DBc = ryDB::getInstance(APP_NAME."_test");
|
||||
#$DBc = ryDB::getInstance(APP_NAME);
|
||||
$DBc = ryDB::getInstance("ahufler");
|
||||
#$DBc = ryDB::getInstance("ahufler");
|
||||
|
||||
$c = "";
|
||||
if(!$_USER->isIG()) {
|
||||
|
@ -85,32 +85,10 @@ if(!$_USER->isIG()) {
|
|||
</script>;';
|
||||
}
|
||||
else {
|
||||
echo var_export($facebook->getUser(),true);
|
||||
// Do the wall post.
|
||||
try {
|
||||
|
||||
/*$facebook->api("/me/feed", "post", array(
|
||||
message => "My character Talvela just achieved \"Bejeweled\" on Ryzom!",
|
||||
picture => "http://www.3025-game.de/special/app_achievements/pic/icon/test.png",
|
||||
link => "http://www.ryzom.com",
|
||||
name => "Ryzom",
|
||||
caption => "Join and play for fee!"
|
||||
));*/
|
||||
|
||||
} catch (FacebookApiException $e) {
|
||||
echo $e;
|
||||
$login_url = $facebook->getLoginUrl( array(
|
||||
'scope' => 'publish_stream'
|
||||
));
|
||||
echo 'Please <a href="' . $login_url . '">login.</a>';
|
||||
#error_log($e->getType());
|
||||
#error_log($e->getMessage());
|
||||
$DBc->sqlQuery("INSERT INTO ach_fb_token (aft_player,aft_token,aft_date,aft_allow) VALUES ('".$_USER->getID()."','".$DBc->sqlEscape($facebook->getAccessToken())."','".time()."','1') ON DUPLICATE KEY UPDATE aft_token='".$DBc->sqlEscape($facebook->getAccessToken())."', aft_date='".time()."'");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(!$_USER->isIG && $_CONF['enable_webig'] == false) {
|
||||
|
|
BIN
code/web/app/app_achievements_admin/_doc/ADM_scheme.dia
Normal file
BIN
code/web/app/app_achievements_admin/_doc/ADM_scheme.dia
Normal file
Binary file not shown.
BIN
code/web/app/app_achievements_admin/_doc/ADM_scheme.png
Normal file
BIN
code/web/app/app_achievements_admin/_doc/ADM_scheme.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
class AdmAchievement extends AchAchievement implements ADM {
|
||||
/*function insertNode($n) {
|
||||
$n->setParent($this);
|
||||
$n->insert();
|
||||
$this->addChild($n);
|
||||
}*/
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# AdmDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function removeNode($id) {
|
||||
$res = $this->getChildDataByID($id);
|
||||
|
@ -50,13 +48,33 @@
|
|||
}
|
||||
return null;
|
||||
}
|
||||
#########################
|
||||
|
||||
function AdmAchievement($data,$parent) {
|
||||
parent::__construct($data,$parent);
|
||||
}
|
||||
|
||||
protected function makeChild($d) {
|
||||
return new AdmPerk($d,$this);
|
||||
return new AdmTask($d,$this);
|
||||
}
|
||||
|
||||
function getLang($lang) {
|
||||
global $DBc;
|
||||
|
||||
$res = $DBc->sqlQuery("SELECT * FROM ach_achievement_lang WHERE aal_achievement='".$this->getID()."' AND aal_lang='".$lang."'");
|
||||
|
||||
return array(0=>$res[0]['aal_name'],1=>$res[0]['aal_template']);
|
||||
}
|
||||
|
||||
function setLang($lang,$txt,$tpl) {
|
||||
global $DBc,$_USER;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_achievement_lang (aal_achievement,aal_lang,aal_name,aal_template) VALUES ('".$this->getID()."','".$DBc->sqlEscape($lang)."','".$DBc->sqlEscape($txt)."',".mkn($tpl).") ON DUPLICATE KEY UPDATE aal_name='".$DBc->sqlEscape($txt)."',aal_template=".mkn($tpl)."");
|
||||
|
||||
if($_USER->getLang() == $lang) {
|
||||
$this->name = $txt;
|
||||
$this->template = $tpl;
|
||||
}
|
||||
}
|
||||
|
||||
#@overrides AdmDispatcher::insertNode()
|
||||
|
@ -69,7 +87,7 @@
|
|||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("DELETE FROM ach_achievement WHERE aa_id='".$this->getID()."'");
|
||||
$DBc->sqlQuery("DELETE FROM ach_player_achievement WHERE apa_id='".$this->getID()."'");
|
||||
$DBc->sqlQuery("DELETE FROM ach_objective WHERE ao_metalink='".$this->getID()."'");
|
||||
$DBc->sqlQuery("DELETE FROM ach_achievement_lang WHERE NOT EXISTS (SELECT * FROM ach_achievement WHERE aa_id=aal_achievement)");
|
||||
|
||||
$iter = $this->getIterator();
|
||||
|
@ -83,7 +101,7 @@
|
|||
function update() {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("UPDATE ach_achievement SET aa_category='".$this->getCategory()."',aa_parent=NULL,aa_tie_race=".mkn($this->getTieRace()).",aa_tie_cult=".mkn($this->getTieCult()).",aa_tie_civ=".mkn($this->getTieCiv()).",aa_image='".$DBc->sqlEscape($this->getImage())."',aa_dev='".$this->getDev()."' WHERE aa_id='".$this->getID()."'");
|
||||
$DBc->sqlQuery("UPDATE ach_achievement SET aa_category='".$this->getCategory()."',aa_parent=".mkn($this->getParentID()).",aa_tie_race=".mkn($this->getTieRace()).",aa_tie_cult=".mkn($this->getTieCult()).",aa_tie_civ=".mkn($this->getTieCiv()).",aa_image='".$DBc->sqlEscape($this->getImage())."',aa_dev='".$this->getDev()."',aa_sticky='".$DBc->sqlEscape($this->getSticky())."' WHERE aa_id='".$this->getID()."'");
|
||||
|
||||
#MISSING: update lang entry
|
||||
$DBc->sqlQuery("INSERT INTO ach_achievement_lang (aal_achievement,aal_lang,aal_name,aal_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).") ON DUPLICATE KEY UPDATE aal_name='".$DBc->sqlEscape($this->getName())."',aal_template=".mkn($this->getTemplate())."");
|
||||
|
@ -94,7 +112,7 @@
|
|||
|
||||
$this->dev = 1;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_achievement (aa_category,aa_parent,aa_tie_race,aa_tie_cult,aa_tie_civ,aa_image,aa_dev) VALUES ('".$this->getCategory()."',NULL,".mkn($this->getTieRace()).",".mkn($this->getTieCult()).",".mkn($this->getTieCiv()).",'".$DBc->sqlEscape($this->getImage())."','1')");
|
||||
$DBc->sqlQuery("INSERT INTO ach_achievement (aa_category,aa_parent,aa_tie_race,aa_tie_cult,aa_tie_civ,aa_image,aa_dev,aa_sticky) VALUES ('".$this->getCategory()."',".mkn($this->getParentID()).",".mkn($this->getTieRace()).",".mkn($this->getTieCult()).",".mkn($this->getTieCiv()).",'".$DBc->sqlEscape($this->getImage())."','1','".$DBc->sqlEscape($this->getSticky())."')");
|
||||
$id = $DBc->insertID();
|
||||
$this->setID($id);
|
||||
|
||||
|
@ -130,14 +148,38 @@
|
|||
$this->template = $t;
|
||||
}
|
||||
|
||||
function orderPerks() {
|
||||
$iter = $this->getIterator();
|
||||
function orderTasks() {
|
||||
|
||||
$i = 0;
|
||||
$start = $this->findParentID(null);
|
||||
|
||||
while($start != null) {
|
||||
$start->setTorder($i);
|
||||
$start->update();
|
||||
$i++;
|
||||
#echo $i;
|
||||
$start = $this->findParentID($start->getID());
|
||||
}
|
||||
}
|
||||
|
||||
private function findParentID($id) {
|
||||
$iter = $this->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
|
||||
$curr->setPorder($i);
|
||||
if($curr->getParentID() == $id) {
|
||||
return $curr;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function setParentID($p) {
|
||||
$this->parent_id = $p;
|
||||
}
|
||||
|
||||
function setSticky($s) {
|
||||
$this->sticky = $s;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
class AdmAtom extends Node implements ADM {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# AdmDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function insertNode($n) {
|
||||
$n->setParent($this);
|
||||
$n->insert();
|
||||
|
@ -50,6 +54,7 @@
|
|||
}
|
||||
return null;
|
||||
}
|
||||
#########################
|
||||
|
||||
protected $objective;
|
||||
protected $mandatory;
|
||||
|
@ -73,13 +78,13 @@
|
|||
$DBc->sqlQuery("DELETE FROM ach_player_atom WHERE apa_atom='".$this->id."'");
|
||||
}
|
||||
|
||||
function update() {
|
||||
function update() { // write updated data to database
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("UPDATE ach_atom SET atom_mandatory='".$this->getMandatory()."',atom_ruleset='".$DBc->sqlEscape($this->getRuleset())."',atom_ruleset_parsed='".$DBc->sqlEscape($this->getRulesetParsed())."' WHERE atom_id='".$this->id."'");
|
||||
}
|
||||
|
||||
function insert() {
|
||||
function insert() { // insert atoms as new row
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_atom (atom_objective,atom_mandatory,atom_ruleset,atom_ruleset_parsed) VALUES ('".$this->getObjective()."','".$this->getMandatory()."','".$DBc->sqlEscape($this->getRuleset())."','".$DBc->sqlEscape($this->getRulesetParsed())."')");
|
||||
|
@ -125,7 +130,7 @@
|
|||
return $this->ruleset_parsed;
|
||||
}
|
||||
|
||||
private function parse() {
|
||||
private function parse() { // parsing the ruleset
|
||||
/*
|
||||
VALUE _money AS $money {
|
||||
|
||||
|
@ -219,7 +224,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#GRANT;#
|
||||
$match = array();
|
||||
preg_match_all("#GRANT;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->grant();';
|
||||
|
||||
//replace
|
||||
|
@ -229,7 +234,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#DENY;#
|
||||
$match = array();
|
||||
preg_match_all("#DENY;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->deny();';
|
||||
|
||||
//replace
|
||||
|
@ -239,7 +244,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#UNLOCK;#
|
||||
$match = array();
|
||||
preg_match_all("#UNLOCK;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->unlock();';
|
||||
|
||||
//replace
|
||||
|
@ -249,7 +254,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#RESET;#
|
||||
$match = array();
|
||||
preg_match_all("#RESET;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->reset_();';
|
||||
|
||||
//replace
|
||||
|
@ -259,7 +264,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#UNLOCK_ALL;#
|
||||
$match = array();
|
||||
preg_match_all("#UNLOCK_ALL;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->unlock_all();';
|
||||
|
||||
//replace
|
||||
|
@ -269,7 +274,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#RESET_ALL;#
|
||||
$match = array();
|
||||
preg_match_all("#RESET_ALL;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->reset_all();';
|
||||
|
||||
//replace
|
||||
|
@ -279,7 +284,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#FINAL VALUE;#
|
||||
$match = array();
|
||||
preg_match_all("#FINAL VALUE;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->unregisterValue($_IDENT,$_CB);';
|
||||
|
||||
//replace
|
||||
|
@ -289,7 +294,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#FINAL ENTITY;#
|
||||
$match = array();
|
||||
preg_match_all("#FINAL ENTITY;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->unregisterEntity($_IDENT,$_CB);';
|
||||
|
||||
//replace
|
||||
|
@ -298,7 +303,7 @@ function '.$func.'('.$match[2][$key].',$_P,$_CB) {
|
|||
#FINAL EVENT;#
|
||||
$match = array();
|
||||
preg_match_all("#FINAL EVENT;#",$this->ruleset,$match);
|
||||
foreach($match[0] as $key=>$elem) {
|
||||
foreach($match[0] as $elem) {
|
||||
$tmp = '$_P->unregisterEvent($_IDENT,$_CB);';
|
||||
|
||||
//replace
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<?php
|
||||
class AdmCategory extends AchCategory {
|
||||
/*function insertNode($n) {
|
||||
$n->setParent($this);
|
||||
$n->insert();
|
||||
$this->addChild($n);
|
||||
}*/
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# AdmDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
|
||||
function removeNode($id) {
|
||||
$res = $this->getChildDataByID($id);
|
||||
|
@ -50,13 +49,15 @@
|
|||
}
|
||||
return null;
|
||||
}
|
||||
#########################
|
||||
|
||||
function AdmCategory($id,$race,$cult = null,$civ = null) {
|
||||
parent::__construct($id,$race,$cult,$civ);
|
||||
}
|
||||
|
||||
protected function makeChild($d) {
|
||||
return new AdmAchievement($d,$this);
|
||||
$a = new AdmAchievement($d,$this);
|
||||
return $a;
|
||||
}
|
||||
|
||||
#@overrides AdmDispatcher::insertNode()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
class AdmMenuNode extends AchMenuNode implements ADM { #MISSING: da fehlt die komplette logik für sub-sub-menüs!!! DU VOLLHIRT!
|
||||
class AdmMenuNode extends AchMenuNode implements ADM {
|
||||
private $ach_count;
|
||||
|
||||
function AdmMenuNode($data,$parent) {
|
||||
|
@ -79,6 +79,7 @@
|
|||
global $DBc,$_USER;
|
||||
|
||||
$DBc->sqlQuery("UPDATE ach_category SET ac_parent=".mkn($this->getParentID()).",ac_order='".$this->getOrder()."',ac_image=".mkn($this->getImage()).",ac_dev='".$this->getDev()."' WHERE ac_id='".$this->getID()."'");
|
||||
#echo "<br>".$this->getImage()." =>UPDATE ach_category SET ac_parent=".mkn($this->getParentID()).",ac_order='".$this->getOrder()."',ac_image=".mkn($this->getImage()).",ac_dev='".$this->getDev()."' WHERE ac_id='".$this->getID()."'";
|
||||
|
||||
#MISSING: update lang entry
|
||||
$DBc->sqlQuery("INSERT IGNORE INTO ach_category_lang (acl_category,acl_lang,acl_name) VALUES ('".$this->getID()."','".$_USER->getLang()."','".$DBc->sqlEscape($this->getName())."') ON DUPLICATE KEY UPDATE acl_name='".$DBc->sqlEscape($this->getName())."'");
|
||||
|
@ -151,7 +152,6 @@
|
|||
$val = array();
|
||||
$iter = $this->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
#foreach($this->nodes as $elem) {
|
||||
$elem = $iter->getNext();
|
||||
$val[] = $elem->getOrder();
|
||||
}
|
||||
|
|
|
@ -1,25 +1,8 @@
|
|||
<?php
|
||||
class AdmMenu extends AchMenu {
|
||||
/*function insertNode($n) {
|
||||
$n->setParent($this);
|
||||
$n->insert();
|
||||
$this->addChild($n);
|
||||
}*/
|
||||
|
||||
/*function removeNode($id) {
|
||||
$res = $this->getChildDataByID($id);
|
||||
if($res != null) {
|
||||
$res->delete_me();
|
||||
$this->removeChild($id);
|
||||
}
|
||||
}*/
|
||||
|
||||
/*function updateNode($id) { // PROBABLY USELESS!
|
||||
$res = $this->getChildDataByID($id);
|
||||
if($res != null) {
|
||||
$res->update();
|
||||
}
|
||||
}*/
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# AdmDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function getPathID($path = "") {
|
||||
if($path != "") {
|
||||
|
@ -50,6 +33,7 @@
|
|||
}
|
||||
return null;
|
||||
}
|
||||
#########################
|
||||
|
||||
function AdmMenu($open) {
|
||||
parent::__construct($open);
|
||||
|
@ -113,7 +97,6 @@
|
|||
}
|
||||
|
||||
function getNode($id) { // try to find the MenuNode that has the given ID. Return null on failure.
|
||||
#echo "<br>getNode(".$id.")";
|
||||
$res = $this->getChildDataByID($id);
|
||||
if($res != null) {
|
||||
return $res;
|
||||
|
@ -146,14 +129,5 @@
|
|||
|
||||
return (max($val)+1);
|
||||
}
|
||||
|
||||
/*function unsetChild($id) { // remove child with given ID from nodes list; unset should destruct it.
|
||||
foreach($this->nodes as $key=>$elem) {
|
||||
if($elem->getID() == $id) {
|
||||
unset($this->nodes[$key]);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
?>
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
class AdmObjective extends AchObjective implements ADM {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# AdmDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function insertNode($n) {
|
||||
$n->setParent($this);
|
||||
$n->insert();
|
||||
|
@ -50,6 +54,7 @@
|
|||
}
|
||||
return null;
|
||||
}
|
||||
#########################
|
||||
|
||||
function AdmObjective($data,$parent) {
|
||||
parent::__construct($data,$parent);
|
||||
|
@ -67,6 +72,24 @@
|
|||
return new AdmAtom($d,$this);
|
||||
}
|
||||
|
||||
function getLang($lang) {
|
||||
global $DBc;
|
||||
|
||||
$res = $DBc->sqlQuery("SELECT * FROM ach_objective_lang WHERE aol_objective='".$this->getID()."' AND aol_lang='".$lang."'");
|
||||
|
||||
return $res[0]['aol_name'];
|
||||
}
|
||||
|
||||
function setLang($lang,$txt) {
|
||||
global $DBc,$_USER;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_objective_lang (aol_task,aol_lang,aol_name) VALUES ('".$this->getID()."','".$DBc->sqlEscape($lang)."','".$DBc->sqlEscape($txt)."') ON DUPLICATE KEY UPDATE aol_name='".$DBc->sqlEscape($txt)."'");
|
||||
|
||||
if($_USER->getLang() == $lang) {
|
||||
$this->name = $txt;
|
||||
}
|
||||
}
|
||||
|
||||
function delete_me() {
|
||||
global $DBc;
|
||||
|
||||
|
@ -84,7 +107,7 @@
|
|||
function update() {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("UPDATE ach_objective SET ao_condition='".$DBc->sqlEscape($this->getCondition())."',ao_value=".mkn($this->getValue()).",ao_display='".$DBc->sqlEscape($this->getDisplay())."',ao_metalink=".mkn($this->getMetaImage())." WHERE ao_id='".$this->getID()."'");
|
||||
$DBc->sqlQuery("UPDATE ach_objective SET ao_condition='".$DBc->sqlEscape($this->getCondition())."',ao_value=".mkn($this->getValue()).",ao_display='".$DBc->sqlEscape($this->getDisplay())."',ao_metalink=".mkn($this->getMetalink())." WHERE ao_id='".$this->getID()."'");
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_objective_lang (aol_objective,aol_lang,aol_name) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."') ON DUPLICATE KEY UPDATE aol_name='".$DBc->sqlEscape($this->getName())."'");
|
||||
}
|
||||
|
@ -92,7 +115,7 @@
|
|||
function insert() {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_objective (ao_perk,ao_condition,ao_value,ao_display,ao_metalink) VALUES ('".$this->getPerk()."','".$DBc->sqlEscape($this->getCondition())."',".mkn($this->getValue()).",'".$DBc->sqlEscape($this->getDisplay())."',".mkn($this->getMetaImage()).")");
|
||||
$DBc->sqlQuery("INSERT INTO ach_objective (ao_task,ao_condition,ao_value,ao_display,ao_metalink) VALUES ('".$this->getTask()."','".$DBc->sqlEscape($this->getCondition())."',".mkn($this->getValue()).",'".$DBc->sqlEscape($this->getDisplay())."',".mkn($this->getMetalink()).")");
|
||||
$id = $DBc->insertID();
|
||||
$this->setID($id);
|
||||
|
||||
|
@ -116,11 +139,14 @@
|
|||
}
|
||||
|
||||
function setMetalink($m) {
|
||||
$this->meta_image = $m;
|
||||
$this->metalink = $m;
|
||||
if($this->getDisplay() == "meta") {
|
||||
$this->name = "<i>name and image will load on refresh only!</i>";
|
||||
}
|
||||
}
|
||||
|
||||
function setPerk($p) {
|
||||
$this->perk = $p;
|
||||
function setTask($t) {
|
||||
$this->task = $t;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,181 +0,0 @@
|
|||
<?php
|
||||
class AdmPerk extends AchPerk implements ADM {
|
||||
function insertNode($n) {
|
||||
$n->setParent($this);
|
||||
$n->insert();
|
||||
$this->addChild($n);
|
||||
}
|
||||
|
||||
function removeNode($id) {
|
||||
$res = $this->getChildDataByID($id);
|
||||
if($res != null) {
|
||||
$res->delete_me();
|
||||
$this->removeChild($id);
|
||||
}
|
||||
}
|
||||
|
||||
function updateNode($id) { // PROBABLY USELESS!
|
||||
$res = $this->getChildDataByID($id);
|
||||
if($res != null) {
|
||||
$res->update();
|
||||
}
|
||||
}
|
||||
|
||||
function getPathID($path = "") {
|
||||
if($path != "") {
|
||||
$path = ";".$path;
|
||||
}
|
||||
$path = $this->getID().$path;
|
||||
if($this->parent != null) {
|
||||
return $this->parent->getPathID($path);
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getElementByPath($pid) {
|
||||
$tmp = explode(";",$pid);
|
||||
if($tmp[0] == $this->getID()) {
|
||||
if(sizeof($tmp) > 1) {
|
||||
$c = $this->getChildDataByID($tmp[1]);
|
||||
if($c != null) {
|
||||
unset($tmp[0]);
|
||||
return $c->getElementByPath(implode(";",$tmp));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected $condition;
|
||||
protected $condition_value;
|
||||
protected $porder;
|
||||
|
||||
function AdmPerk($data,$parent) {
|
||||
parent::__construct($data,$parent);
|
||||
|
||||
$this->condition = $data["ap_condition"];
|
||||
$this->condition_value = $data["ap_condition_value"];
|
||||
$this->porder = $data["ap_porder"];
|
||||
}
|
||||
|
||||
protected function makeChild($d) {
|
||||
return new AdmObjective($d,$this);
|
||||
}
|
||||
|
||||
function delete_me() {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("DELETE FROM ach_perk WHERE ap_id='".$this->getID()."'");
|
||||
$DBc->sqlQuery("DELETE FROM ach_player_perk WHERE app_perk='".$this->getID()."'");
|
||||
|
||||
$iter = $this->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
$curr->delete_me();
|
||||
$this->removeChild($curr->getID());
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("UPDATE ach_perk SET ap_parent=".mkn($this->getParentID()).",ap_value='".$DBc->sqlEscape($this->getValue())."',ap_condition='".$DBc->sqlEscape($this->getCondition())."',ap_condition_value=".mkn($this->getConditionValue()).",ap_dev='".$this->getDev()."',ap_porder='".$this->porder."' WHERE ap_id='".$this->getID()."'");
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_perk_lang (apl_perk,apl_lang,apl_name,apl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).") ON DUPLICATE KEY UPDATE apl_name='".$DBc->sqlEscape($this->getName())."',apl_template=".mkn($this->getTemplate())."");
|
||||
}
|
||||
|
||||
function insert() {
|
||||
global $DBc;
|
||||
|
||||
$this->dev = 1;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_perk (ap_achievement,ap_parent,ap_value,ap_condition,ap_condition_value,ap_dev,ap_porder) VALUES ('".$this->getAchievement()."',".mkn($this->getParentID()).",'".$DBc->sqlEscape($this->getValue())."','".$DBc->sqlEscape($this->getCondition())."',".mkn($this->getConditionValue()).",'1','".$this->porder."')");
|
||||
$id = $DBc->insertID();
|
||||
$this->setID($id);
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_perk_lang (apl_perk,apl_lang,apl_name,apl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).")");
|
||||
}
|
||||
|
||||
function setAchievement($a) {
|
||||
$this->achievement = $a;
|
||||
}
|
||||
|
||||
function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
function setTemplate($t) {
|
||||
$this->template = $t;
|
||||
}
|
||||
|
||||
function setValue($v) {
|
||||
$this->value = $v;
|
||||
}
|
||||
|
||||
function getCondition() {
|
||||
return $this->condition;
|
||||
}
|
||||
|
||||
function getConditionValue() {
|
||||
return $this->condition_value;
|
||||
}
|
||||
|
||||
function setCondition($c) {
|
||||
$this->condition = $c;
|
||||
}
|
||||
|
||||
function setConditionValue($v) {
|
||||
$this->condition_value = $v;
|
||||
}
|
||||
|
||||
function getPorder() {
|
||||
return $this->porder;
|
||||
}
|
||||
|
||||
function setPorder($p) {
|
||||
$this->porder = $p;
|
||||
}
|
||||
|
||||
private function reOrder() {
|
||||
//check if order is OK!
|
||||
|
||||
if($this->parent_id == null) {
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function setParentID($p) { #reordering must happen A) after insert B) when updating
|
||||
if($p == null || $p == "null") {
|
||||
//remove from ach list; insert as first!
|
||||
$this->parent_id = null;
|
||||
|
||||
#$this->parent->removeChild($this->id);
|
||||
#$iter = $this->parent->getIterator();
|
||||
#$this->parent->addOpen($this,$iter->getNext());
|
||||
}
|
||||
else {
|
||||
//remove from ach list; insert after parent
|
||||
#echo "--".$p."<br>";
|
||||
$this->parent_id = $p;
|
||||
|
||||
#$this->parent->removeChild($this->id);
|
||||
#$item = $this->parent->getChildByID($this->parent_id);
|
||||
#$tmp = $item->getChild();
|
||||
#if($tmp != null) {
|
||||
# $this->parent->addOpen($this,$tmp->getID());
|
||||
#}
|
||||
#else {
|
||||
# $this->parent->addOpen($this,null);
|
||||
#}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
198
code/web/app/app_achievements_admin/class/AdmTask_class.php
Normal file
198
code/web/app/app_achievements_admin/class/AdmTask_class.php
Normal file
|
@ -0,0 +1,198 @@
|
|||
<?php
|
||||
class AdmTask extends AchTask implements ADM {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# AdmDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function insertNode($n) {
|
||||
$n->setParent($this);
|
||||
$n->insert();
|
||||
$this->addChild($n);
|
||||
}
|
||||
|
||||
function removeNode($id) {
|
||||
$res = $this->getChildDataByID($id);
|
||||
if($res != null) {
|
||||
$res->delete_me();
|
||||
$this->removeChild($id);
|
||||
}
|
||||
}
|
||||
|
||||
function updateNode($id) { // PROBABLY USELESS!
|
||||
$res = $this->getChildDataByID($id);
|
||||
if($res != null) {
|
||||
$res->update();
|
||||
}
|
||||
}
|
||||
|
||||
function getPathID($path = "") {
|
||||
if($path != "") {
|
||||
$path = ";".$path;
|
||||
}
|
||||
$path = $this->getID().$path;
|
||||
if($this->parent != null) {
|
||||
return $this->parent->getPathID($path);
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
function getElementByPath($pid) {
|
||||
$tmp = explode(";",$pid);
|
||||
if($tmp[0] == $this->getID()) {
|
||||
if(sizeof($tmp) > 1) {
|
||||
$c = $this->getChildDataByID($tmp[1]);
|
||||
if($c != null) {
|
||||
unset($tmp[0]);
|
||||
return $c->getElementByPath(implode(";",$tmp));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
#########################
|
||||
|
||||
protected $condition;
|
||||
protected $condition_value;
|
||||
protected $torder;
|
||||
|
||||
function AdmTask($data,$parent) {
|
||||
parent::__construct($data,$parent);
|
||||
|
||||
$this->condition = $data["at_condition"];
|
||||
$this->condition_value = $data["at_condition_value"];
|
||||
$this->torder = $data["at_torder"];
|
||||
}
|
||||
|
||||
protected function makeChild($d) {
|
||||
return new AdmObjective($d,$this);
|
||||
}
|
||||
|
||||
function getLang($lang) {
|
||||
global $DBc;
|
||||
|
||||
$res = $DBc->sqlQuery("SELECT * FROM ach_task_lang WHERE atl_task='".$this->getID()."' AND atl_lang='".$lang."'");
|
||||
|
||||
return array(0=>$res[0]['atl_name'],1=>$res[0]['atl_template']);
|
||||
}
|
||||
|
||||
function setLang($lang,$txt,$tpl) {
|
||||
global $DBc,$_USER;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','".$DBc->sqlEscape($lang)."','".$DBc->sqlEscape($txt)."',".mkn($tpl).") ON DUPLICATE KEY UPDATE apl_name='".$DBc->sqlEscape($txt)."',apl_template=".mkn($tpl)."");
|
||||
|
||||
if($_USER->getLang() == $lang) {
|
||||
$this->name = $txt;
|
||||
$this->template = $tpl;
|
||||
}
|
||||
}
|
||||
|
||||
function delete_me() {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("DELETE FROM ach_task WHERE at_id='".$this->getID()."'");
|
||||
$DBc->sqlQuery("DELETE FROM ach_player_task WHERE apt_task='".$this->getID()."'");
|
||||
|
||||
$iter = $this->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
$curr->delete_me();
|
||||
$this->removeChild($curr->getID());
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("UPDATE ach_task SET at_parent=".mkn($this->getParentID()).",at_value='".$DBc->sqlEscape($this->getValue())."',at_condition='".$DBc->sqlEscape($this->getCondition())."',at_condition_value=".mkn($this->getConditionValue()).",at_dev='".$this->getDev()."',at_torder='".$this->torder."' WHERE at_id='".$this->getID()."'");
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).") ON DUPLICATE KEY UPDATE atl_name='".$DBc->sqlEscape($this->getName())."',atl_template=".mkn($this->getTemplate())."");
|
||||
}
|
||||
|
||||
function insert() {
|
||||
global $DBc;
|
||||
|
||||
$this->dev = 1;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_task (at_achievement,at_parent,at_value,at_condition,at_condition_value,at_dev,at_torder) VALUES ('".$this->getAchievement()."',".mkn($this->getParentID()).",'".$DBc->sqlEscape($this->getValue())."','".$DBc->sqlEscape($this->getCondition())."',".mkn($this->getConditionValue()).",'1','".$this->torder."')");
|
||||
$id = $DBc->insertID();
|
||||
$this->setID($id);
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_task_lang (atl_task,atl_lang,atl_name,atl_template) VALUES ('".$this->getID()."','en','".$DBc->sqlEscape($this->getName())."',".mkn($this->getTemplate()).")");
|
||||
}
|
||||
|
||||
function setAchievement($a) {
|
||||
$this->achievement = $a;
|
||||
}
|
||||
|
||||
function setName($name) {
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
function setTemplate($t) {
|
||||
$this->template = $t;
|
||||
}
|
||||
|
||||
function setValue($v) {
|
||||
$this->value = $v;
|
||||
}
|
||||
|
||||
function getCondition() {
|
||||
return $this->condition;
|
||||
}
|
||||
|
||||
function getConditionValue() {
|
||||
return $this->condition_value;
|
||||
}
|
||||
|
||||
function setCondition($c) {
|
||||
$this->condition = $c;
|
||||
}
|
||||
|
||||
function setConditionValue($v) {
|
||||
$this->condition_value = $v;
|
||||
}
|
||||
|
||||
function getTorder() {
|
||||
return $this->torder;
|
||||
}
|
||||
|
||||
function setTorder($t) {
|
||||
$this->torder = $t;
|
||||
}
|
||||
|
||||
function setParentID($p,$order = true) { #reordering must happen A) after insert B) when updating
|
||||
if($p == null || $p == "null") {
|
||||
|
||||
$this->parent_id = null;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
$this->parent_id = $p;
|
||||
|
||||
}
|
||||
|
||||
if($order == true) {
|
||||
|
||||
$iter = $this->parent->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->getID() == $this->id) {
|
||||
continue;
|
||||
}
|
||||
if($curr->getParentID() == $this->parent_id) {
|
||||
$curr->setParentID($this->id,false);
|
||||
$curr->update();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
class CSRAchievement extends AchAchievement implements CSR {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# CSRDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function grantNode($path,$player) {
|
||||
#echo "start: ".$path." id: ".$this->getID()."<br>";
|
||||
if(is_numeric($path)) {
|
||||
|
@ -63,13 +67,14 @@
|
|||
private function hasParent() {
|
||||
return ($this->parent != null);
|
||||
}
|
||||
#########################
|
||||
|
||||
function CSRAchievement($data,$parent) {
|
||||
parent::__construct($data,$parent);
|
||||
}
|
||||
|
||||
protected function makeChild($d) {
|
||||
return new CSRPerk($d,$this);
|
||||
return new CSRTask($d,$this);
|
||||
}
|
||||
|
||||
function grant($pid) {
|
||||
|
@ -94,11 +99,9 @@
|
|||
$this->parent->setChildOpen($this->id);
|
||||
}
|
||||
|
||||
function setPerkDone($id) {
|
||||
echo "perk<br>";
|
||||
function setTaskDone($id) {
|
||||
$this->setChildDone($id);
|
||||
|
||||
echo "ach<br>";
|
||||
|
||||
$this->parent->addChildDone($this->id);
|
||||
|
||||
|
@ -107,10 +110,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
function setPerkOpen($id) {
|
||||
echo "perk<br>";
|
||||
function setTaskOpen($id) {
|
||||
|
||||
$this->setChildOpen($id);
|
||||
echo "ach<br>";
|
||||
|
||||
|
||||
$this->parent->addChildOpen($this->id);
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
class CSRCategory extends AchCategory implements CSR {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# CSRDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function grantNode($path,$player) {
|
||||
#echo "start: ".$path." id: ".$this->getID()."<br>";
|
||||
if(is_numeric($path)) {
|
||||
|
@ -63,6 +67,7 @@
|
|||
private function hasParent() {
|
||||
return ($this->parent != null);
|
||||
}
|
||||
#########################
|
||||
|
||||
function CSRCategory($id,$race,$cult = null,$civ = null) {
|
||||
parent::__construct($id,$race,$cult,$civ);
|
||||
|
@ -80,32 +85,5 @@
|
|||
return false; // category can't deny!
|
||||
}
|
||||
|
||||
/*function setAchOpen($idx,$state) {
|
||||
if($state == false) {
|
||||
$this->unsetOpen($idx);
|
||||
if(!in_array($idx,$this->child_done)) {
|
||||
$this->child_done[] = $idx;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!in_array($idx,$this->child_open)) {
|
||||
$this->child_open[] = $idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setAchDone($idx,$state) {
|
||||
if($state == false) {
|
||||
$this->unsetDone($idx);
|
||||
if(!in_array($idx,$this->child_open)) {
|
||||
$this->child_open[] = $idx;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!in_array($idx,$this->child_done)) {
|
||||
$this->child_done[] = $idx;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<?php
|
||||
trait CSRDispatcher {
|
||||
function grantNode($path,$player) {
|
||||
#echo "start: ".$path." id: ".$this->getID()."<br>";
|
||||
if(is_numeric($path)) {
|
||||
//it's me (id == numeric)
|
||||
if($this->getID() == $path) {
|
||||
$this->grant($player);
|
||||
#echo "grant()<br>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -14,14 +12,14 @@
|
|||
$tmp = explode(";",$path);
|
||||
|
||||
$c = $this->getChildDataByID($tmp[1]);
|
||||
#echo "...".$tmp[1];
|
||||
|
||||
if($c != null) { // check if it's really own child
|
||||
unset($tmp[0]);
|
||||
$c->grantNode(implode(";",$tmp),$player);
|
||||
#echo "grantNode()<br>";
|
||||
|
||||
}
|
||||
}
|
||||
#echo "end<br>";
|
||||
|
||||
}
|
||||
|
||||
function denyNode($path,$player) {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
class CSRObjective extends AchObjective implements CSR {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# CSRDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function grantNode($path,$player) {
|
||||
#echo "start: ".$path." id: ".$this->getID()."<br>";
|
||||
if(is_numeric($path)) {
|
||||
|
@ -63,8 +67,7 @@
|
|||
private function hasParent() {
|
||||
return ($this->parent != null);
|
||||
}
|
||||
|
||||
#private $nodes;
|
||||
#########################
|
||||
|
||||
function CSRObjective($data,$parent) {
|
||||
parent::__construct($data,$parent);
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<?php
|
||||
class CSRPerk extends AchPerk implements CSR {
|
||||
class CSRTask extends AchTask implements CSR {
|
||||
#########################
|
||||
# PHP 5.3 compatible
|
||||
# CSRDispatcher_trait replaces this in PHP 5.4
|
||||
|
||||
function grantNode($path,$player) {
|
||||
#echo "start: ".$path." id: ".$this->getID()."<br>";
|
||||
if(is_numeric($path)) {
|
||||
|
@ -63,8 +67,9 @@
|
|||
private function hasParent() {
|
||||
return ($this->parent != null);
|
||||
}
|
||||
#########################
|
||||
|
||||
function CSRPerk($data,$parent) {
|
||||
function CSRTask($data,$parent) {
|
||||
parent::__construct($data,$parent);
|
||||
}
|
||||
|
||||
|
@ -75,10 +80,10 @@
|
|||
function grant($pid) {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("INSERT INTO ach_player_perk (app_perk,app_player,app_date) VALUES ('".$this->getID()."','".$pid."','".time()."')");
|
||||
$DBc->sqlQuery("INSERT INTO ach_player_task (apt_task,apt_player,apt_date) VALUES ('".$this->getID()."','".$pid."','".time()."')");
|
||||
$this->done = time();
|
||||
#echo $this->idx."<br>";
|
||||
$this->parent->setPerkDone($this->id);
|
||||
$this->parent->setTaskDone($this->id);
|
||||
|
||||
$iter = $this->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
|
@ -90,9 +95,9 @@
|
|||
function deny($pid) {
|
||||
global $DBc;
|
||||
|
||||
$DBc->sqlQuery("DELETE FROM ach_player_perk WHERE app_perk='".$this->getID()."' AND app_player='".$pid."'");
|
||||
$DBc->sqlQuery("DELETE FROM ach_player_task WHERE apt_task='".$this->getID()."' AND apt_player='".$pid."'");
|
||||
$this->done = 0;
|
||||
$this->parent->setPerkOpen($this->id);
|
||||
$this->parent->setTaskOpen($this->id);
|
||||
|
||||
$iter = $this->getIterator();
|
||||
while($iter->hasNext()) {
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
trait Dispatcher {
|
||||
function insertNode(&$n) {
|
||||
#MISSING: set this as parent
|
||||
$n->insert();
|
||||
$this->nodes[] = $n;
|
||||
}
|
||||
|
||||
function removeNode($id) {#NAMENSKONFLIKT!!
|
||||
$res = $this->getNode($id);
|
||||
if($res != null) {
|
||||
$res->delete_me();
|
||||
$this->removeNode($res);
|
||||
}
|
||||
}
|
||||
|
||||
function updateNode($id,$data) {
|
||||
$res = $this->getNode($id);
|
||||
if($res != null) {
|
||||
#MISSING: set new data
|
||||
#
|
||||
$res->update();
|
||||
}
|
||||
}
|
||||
|
||||
function getNode($id) {
|
||||
return $this->getIdx($id);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -42,6 +42,7 @@
|
|||
return false;
|
||||
}
|
||||
mysql_select_db($db,$this->DBc) or $this->error(mysql_error());
|
||||
return true;
|
||||
}
|
||||
|
||||
function resetStats() {
|
||||
|
@ -95,7 +96,7 @@
|
|||
else {
|
||||
return $res;
|
||||
}
|
||||
mysql_free_result($res);
|
||||
//mysql_free_result($res);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
|
|
@ -16,4 +16,6 @@
|
|||
$_CONF['char_mysql_user'] = "root";
|
||||
$_CONF['char_mysql_pass'] = "";
|
||||
$_CONF['char_mysql_database'] = "app_achievements";
|
||||
|
||||
$_CONF['langs'] = array('en','de','fr','es','ru');
|
||||
?>
|
|
@ -1,171 +0,0 @@
|
|||
<?php
|
||||
function adm_render_menu(&$menu,$sub = 0) {
|
||||
$html = "<style>
|
||||
.ach_menu {
|
||||
display:block;
|
||||
padding:2px;
|
||||
border:1px solid #000000;
|
||||
margin-bottom:2px;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
.ach_menu:hover {
|
||||
color:orange;
|
||||
}
|
||||
|
||||
.ach_mspan a {
|
||||
text-decoration:none;
|
||||
}
|
||||
</style>";
|
||||
|
||||
$html .= "<div style='display:block;background-color:#FFFFFF;padding:3px;margin-bottom:5px;color:#000000;'>
|
||||
<div style='display:block;text-align:right;'><a href='javascript:hs(\"new_main\",\"block\");'><img src='pic/b_insrow.png'></a></div>
|
||||
|
||||
<div style='display:none;' id='new_main'>
|
||||
<form method='post' action='?mode=menu&act=insert'>
|
||||
<fieldset>
|
||||
<legend>create new category</legend>
|
||||
<input type='hidden' name='ac_parent' value='NULL' />
|
||||
<table>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td><input type='text' name='acl_name' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>image</td>
|
||||
<td><input type='text' name='ac_image' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type='submit' value='create' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
if($_REQUEST['ac_id'] > 0 && $_REQUEST['confirm'] == "delete") {
|
||||
$curr = $menu->getNode($_REQUEST['ac_id']);
|
||||
$html .= "<div style='display:block;'>
|
||||
<fieldset>
|
||||
<legend>Are you sure you want to delete this category?</legend>";
|
||||
if($curr->hasAchievements()) {
|
||||
$html .= "<b>You may NOT DELETE this category since there are still achievements tied to it or one of its sub-categories!</b>";
|
||||
}
|
||||
else {
|
||||
$html .= "<b style='font-size:16px;'>".$curr->getName()."</b><p>";
|
||||
|
||||
if($curr->getParentID() == null) {
|
||||
$html .= "<b>WARNING:</b> Deleting this category will also delete ALL sub-categories!<br>";
|
||||
}
|
||||
$html .= "<a href='?mode=menu&act=delete&ac_id=".$_REQUEST['ac_id']."'><b>delete</b></a>";
|
||||
}
|
||||
$html .= "</fieldset>
|
||||
</div>";
|
||||
}
|
||||
|
||||
$html .= "</div>";
|
||||
|
||||
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 .= "<span class='ach_mspan'><table class='ach_menu'>
|
||||
<tr>";
|
||||
if($sub == 0) {
|
||||
$html .= "<td><img src='".$_CONF['image_url']."pic/menu/".$curr->getImage()."' /></td>";
|
||||
}
|
||||
$html .= "<td style='font-size:".(20-$sub)."px;font-weight:bold;' width='100%'>";
|
||||
if($curr->inDev()) {
|
||||
$html .= "<s>";
|
||||
}
|
||||
|
||||
$html .= $curr->getName();
|
||||
|
||||
if($curr->inDev()) {
|
||||
$html .= "</s>";
|
||||
}
|
||||
$html .= "</td>
|
||||
<td style='background-color:#FFFFFF;padding:3px;'><nobr><a href='?mode=menu&act=dev&state=".$curr->getDev()."&ac_id=".$curr->getID()."'><img src='pic/";
|
||||
if($curr->inDev()) {
|
||||
$html .= "red";
|
||||
}
|
||||
else {
|
||||
$html .= "green";
|
||||
}
|
||||
$html .= ".gif' /></a> <a href='javascript:hs(\"edit_m".$curr->getID()."\",\"block\");'><img src='pic/icon_edit.gif'></a>";
|
||||
|
||||
if($sub == 0) {
|
||||
$html .= " <a href='javascript:hs(\"ins_m".$curr->getID()."\",\"block\");'><img src='pic/b_insrow.png'></a>";
|
||||
}
|
||||
|
||||
$html .= " <a href='?mode=menu&confirm=delete&ac_id=".$curr->getID()."'><img src='pic/b_drop.png'></a></nobr></td>
|
||||
</tr>
|
||||
</table></span>";
|
||||
if($sub == 0) {
|
||||
$html .= "<div style='display:none;color:#000000;background-color:#FFFFFF;' id='ins_m".$curr->getID()."'>
|
||||
<form method='post' action='?mode=menu&act=insert'>
|
||||
<fieldset>
|
||||
<legend>create new sub-category</legend>
|
||||
<input type='hidden' name='ac_parent' value='".$curr->getID()."' />
|
||||
<input type='hidden' name='ac_image' value='NULL' />
|
||||
<table>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td><input type='text' name='acl_name' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type='submit' value='create' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>";
|
||||
}
|
||||
|
||||
$html .= "<div style='display:none;color:#000000;background-color:#FFFFFF;' id='edit_m".$curr->getID()."'>
|
||||
<form method='post' action='?mode=menu&act=update&ac_id=".$curr->getID()."'>
|
||||
<fieldset>
|
||||
<legend>edit category</legend>";
|
||||
if($sub != 0) {
|
||||
$html .= "<input type='hidden' name='ac_image' value='NULL' />";
|
||||
}
|
||||
$html .= "<table>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td><input type='text' name='acl_name' value='".$curr->getName()."' /></td>
|
||||
</tr>";
|
||||
if($sub == 0) {
|
||||
$html .= "<tr>
|
||||
<td>image</td>
|
||||
<td><input type='text' name='ac_image' value='".$curr->getImage()."' /></td>
|
||||
</tr>";
|
||||
}
|
||||
$html .= "<tr>
|
||||
<td> </td>
|
||||
<td><input type='submit' value='save' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>";
|
||||
|
||||
if(!$curr->isEmpty()) {
|
||||
$html .= "<div style='display:block;margin-left:25px;'>".ach_render_mnode($curr,($sub+4))."</div>";
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
?>
|
|
@ -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 .= "<span class='ach_mspan'><a href='?mode=ach&cat=".$curr->getID()."'><table class='ach_menu'>
|
||||
<tr>";
|
||||
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 .= "<option value='null' disabled='disabled'>".$n->getName()."</option>";
|
||||
|
||||
$m2 = $n->getIterator();
|
||||
while($m2->hasNext()) {
|
||||
$n2 = $m2->getNext();
|
||||
$html .= "<option value='null' disabled='disabled'> ".$n2->getName()."</option>";
|
||||
|
||||
//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 .= "<option value='".$res[$i]['aa_id']."'> ".$res[$i]['aal_name']."</option>";
|
||||
}
|
||||
}
|
||||
|
||||
//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 .= "<option value='".$res[$i]['aa_id']."'> ".$res[$i]['aal_name']."</option>";
|
||||
}
|
||||
}
|
||||
|
||||
$metalist = $html;
|
||||
|
||||
|
||||
|
||||
$html = "<style>
|
||||
.bw {
|
||||
background-color:#FFFFFF;
|
||||
|
@ -67,7 +98,7 @@
|
|||
<fieldset>
|
||||
<legend>Delete</legend>
|
||||
Are you sure you want to delete <b>".$tmp->getName()."</b><p>
|
||||
<b>Any nested Perks/Objective/Atoms will be removed, as well as any player progress connected!</b>
|
||||
<b>Any nested Tasks/Objective/Atoms will be removed, as well as any player progress connected!</b>
|
||||
<p>
|
||||
<a href='?mode=ach&cat=".$_REQUEST['cat']."&act=delete&id=".$_REQUEST['id']."'><b>delete</b></a>
|
||||
</fieldset>
|
||||
|
@ -94,6 +125,19 @@
|
|||
<td class='bw'>naming template:</td>
|
||||
<td><input type='text' name='aal_template' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>parent achievement:</td>
|
||||
<td>
|
||||
<select name='aa_parent'>
|
||||
<option value='null' selected='selected'>-- none --</option>";
|
||||
$iter = $cat->getOpen();
|
||||
while($iter->hasNext()) {
|
||||
$item = $iter->getNext();
|
||||
$html .= "<option value='".$item->getID()."'>".$item->getName()."</option>";
|
||||
}
|
||||
$html .= "</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>cult:</td>
|
||||
<td>
|
||||
|
@ -122,25 +166,29 @@
|
|||
<td class='bw'>image:</td>
|
||||
<td><input type='text' name='aa_image' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>sticky:</td>
|
||||
<td><input type='hidden' value='0' name='aa_sticky' /><input type='checkbox' name='aa_sticky' value='1'/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><hr /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>perk name:</td>
|
||||
<td><input type='text' name='apl_name' /></td>
|
||||
<td class='bw'>task name:</td>
|
||||
<td><input type='text' name='atl_name' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>naming template:</td>
|
||||
<td><input type='text' name='apl_template' /></td>
|
||||
<td><input type='text' name='atl_template' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>perk yubopoints:</td>
|
||||
<td><input type='text' name='ap_value' /></td>
|
||||
<td class='bw'>task yubopoints:</td>
|
||||
<td><input type='text' name='at_value' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>condition:</td>
|
||||
<td>
|
||||
<select name='ap_condition'>
|
||||
<select name='at_condition'>
|
||||
<option value='all' selected='selected'>all</option>
|
||||
<option value='any'>any</option>
|
||||
<option value='value'>by value</option>
|
||||
|
@ -149,7 +197,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>condition value:</td>
|
||||
<td><input type='text' name='ap_condition_value' /></td>
|
||||
<td><input type='text' name='at_condition_value' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><input type='submit' value='create' /></td>
|
||||
|
@ -165,27 +213,11 @@
|
|||
$html .= ach_render_tiebar($cat->getCurrentCult(),$cat->getCurrentCiv(),$cat);
|
||||
}
|
||||
|
||||
/*$iter = $cat->getDone();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $cat->getChildByIdx($iter->getNext());
|
||||
#$sz = sizeof($tmp);
|
||||
#for($i=0;$i<$sz;$i++) {
|
||||
#echo "A";
|
||||
if($curr->inDev()) {
|
||||
continue;
|
||||
}
|
||||
$html .= ach_render_achievement_done($curr);
|
||||
}*/
|
||||
|
||||
$iter = $cat->getOpen();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
#$sz = sizeof($tmp);
|
||||
#for($i=0;$i<$sz;$i++) {
|
||||
#echo "B";
|
||||
if($curr->inDev()) {
|
||||
#continue;
|
||||
}
|
||||
|
||||
$html .= ach_render_achievement_open($curr);
|
||||
}
|
||||
|
||||
|
@ -207,7 +239,15 @@
|
|||
<center><table width="100%" cellspacing="0" cellpadding="0">
|
||||
<tbody><tr>
|
||||
<td rowspan="2" valign="top"><img src="'.$_CONF['image_url'].'pic/icon/grey/'.$ach->getImage().'"></td>
|
||||
<td width="100%"><center><table><tr><td><span style="font-weight:bold;font-size:24px;color:#FFFFFF;"><a name="ach_'.$ach->getID().'">[ach:]</a>'.$ach->getName().'</span></td>';
|
||||
<td width="100%"><center><table><tr><td><span style="font-weight:bold;font-size:24px;color:#FFFFFF;"><a name="ach_'.$ach->getID().'">[ach:]</a>'.$ach->getName().'</span>';
|
||||
if($ach->getParentID() != null && $ach->getParentID() != "null") {
|
||||
#echo $ach->getParentID();
|
||||
$c = $ach->getParent();
|
||||
$p = $c->getChildDataByID($ach->getParentID());
|
||||
$html .= "<br><span style='font-size:11px;'>child of <b>".$p->getName()."</b></span>";
|
||||
}
|
||||
|
||||
$html .= '</td>';
|
||||
|
||||
$html .= "<td style='background-color:#FFFFFF;padding:3px;'><nobr><a href='?mode=ach&cat=".$_REQUEST['cat']."&act=dev&state=".$ach->getDev()."&id=".$ach->getPathID()."#ach_".$ach->getID()."'><img src='pic/";
|
||||
if($ach->inDev()) {
|
||||
|
@ -218,7 +258,7 @@
|
|||
}
|
||||
$html .= ".gif' /></a> <a href='javascript:hs(\"edit_ach_".$ach->getID()."\",\"block\");'><img src='pic/icon_edit.gif'></a>";
|
||||
|
||||
$html .= " <a href='javascript:hs(\"new_perk_".$ach->getID()."\",\"block\");'><img src='pic/b_insrow.png'></a>";
|
||||
$html .= " <a href='javascript:hs(\"new_task_".$ach->getID()."\",\"block\");'><img src='pic/b_insrow.png'></a>";
|
||||
|
||||
$html .= " <a href='javascript:hs(\"opts_ach_".$ach->getID()."\",\"block\");'><img src='pic/b_tblops.png'></a>";
|
||||
|
||||
|
@ -237,11 +277,31 @@
|
|||
<table>
|
||||
<tr>
|
||||
<td class='bw'>name:</td>
|
||||
<td><input type='text' name='aal_name' value=\"".$ach->getName()."\" /></td>
|
||||
<td><input type='text' name='aal_name' value='".htmlspecialchars($ach->getName(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>naming template:</td>
|
||||
<td><input type='text' name='aal_template' value=\"".$ach->getTemplate()."\" /></td>
|
||||
<td><input type='text' name='aal_template' value='".htmlspecialchars($ach->getTemplate(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>parent achievement:</td>
|
||||
<td>
|
||||
<select name='aa_parent'>
|
||||
<option value='null' selected='selected'>-- none --</option>";
|
||||
$p = $ach->getParent();
|
||||
$iter = $p->getOpen();
|
||||
while($iter->hasNext()) {
|
||||
$item = $iter->getNext();
|
||||
if($item->getID() != $ach->getID()) {
|
||||
$html .= "<option value='".$item->getID()."'";
|
||||
if($item->getID() == $ach->getParentID()) {
|
||||
$html .= " selected='selected'";
|
||||
}
|
||||
$html .= ">".$item->getName()."</option>";
|
||||
}
|
||||
}
|
||||
$html .= "</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>cult:</td>
|
||||
|
@ -269,7 +329,15 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>image:</td>
|
||||
<td><input type='text' name='aa_image' value='".$ach->getImage()."' /></td>
|
||||
<td><input type='text' name='aa_image' value='".htmlspecialchars($ach->getImage())."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>sticky:</td>
|
||||
<td><input type='hidden' value='0' name='aa_sticky' /><input type='checkbox' name='aa_sticky' value='1'";
|
||||
if($ach->isSticky()) {
|
||||
$html .= " checked='checked'";
|
||||
}
|
||||
$html .= "/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><input type='submit' value='save' /></td>
|
||||
|
@ -279,32 +347,36 @@
|
|||
</form>
|
||||
</div>";
|
||||
|
||||
$html .= "<div id='new_perk_".$ach->getID()."' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$ach->getID()."&act=perk_insert#ach_".$ach->getID()."'>
|
||||
$html .= "<div id='new_task_".$ach->getID()."' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$ach->getID()."&act=task_insert#ach_".$ach->getID()."'>
|
||||
<fieldset>
|
||||
<legend>add new perk</legend>
|
||||
<legend>add new task</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td class='bw'>name:</td>
|
||||
<td><input type='text' name='apl_name' /></td>
|
||||
<td><input type='text' name='atl_name' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>naming template:</td>
|
||||
<td><input type='text' name='apl_template' /></td>
|
||||
<td><input type='text' name='atl_template' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>yubopoints:</td>
|
||||
<td><input type='text' name='ap_value' /></td>
|
||||
<td><input type='text' name='at_value' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>parent:</td>
|
||||
<td>
|
||||
<select name='ap_parent'>
|
||||
<option value='null' selected='selected'>[set as main perk]</option>";
|
||||
<select name='at_parent'>
|
||||
<option value='null'>[set as base task]</option>";
|
||||
$iter = $ach->getOpen();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
$html .= "<option value='".$curr->getID()."'>".$curr->getName()."</option>";
|
||||
$html .= "<option value='".$curr->getID()."'";
|
||||
if(!$iter->hasNext()) {
|
||||
$html .= " selected='selected'";
|
||||
}
|
||||
$html .= ">".$curr->getDisplayName()."</option>";
|
||||
}
|
||||
|
||||
$html .= "</select>
|
||||
|
@ -313,7 +385,7 @@
|
|||
<tr>
|
||||
<td class='bw'>condition:</td>
|
||||
<td>
|
||||
<select name='ap_condition'>
|
||||
<select name='at_condition'>
|
||||
<option value='all' selected='selected'>all</option>
|
||||
<option value='any'>any</option>
|
||||
<option value='value'>by value</option>
|
||||
|
@ -322,7 +394,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>condition value:</td>
|
||||
<td><input type='text' name='ap_condition_value' /></td>
|
||||
<td><input type='text' name='at_condition_value' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><input type='submit' value='add' /></td>
|
||||
|
@ -364,7 +436,7 @@
|
|||
</form>
|
||||
</div>";
|
||||
|
||||
$html .= ach_render_perk_open($ach);
|
||||
$html .= ach_render_task_open($ach);
|
||||
$html .= '</td></tr></tbody></table></center>
|
||||
</td>
|
||||
<td style="background-image: url('.$_CONF['image_url'].'pic/bar_pending_r.png);"></td>
|
||||
|
@ -379,73 +451,70 @@
|
|||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_perk_open(&$ach) {
|
||||
#echo var_export($perk_list,true);
|
||||
function ach_render_task_open(&$ach) {
|
||||
global $metalist;
|
||||
|
||||
|
||||
|
||||
$html = "";
|
||||
|
||||
$perk_list = $ach->getOpen();
|
||||
while($perk_list->hasNext()) {
|
||||
$task_list = $ach->getOpen();
|
||||
while($task_list->hasNext()) {
|
||||
|
||||
$perk = $perk_list->getNext();
|
||||
$task = $task_list->getNext();
|
||||
|
||||
#$perk = $ach->getChild($perk_list[0]);
|
||||
|
||||
if($perk->inDev()) {
|
||||
#return $html;
|
||||
}
|
||||
|
||||
#if($perk->getName() != null) {
|
||||
$html .= "<table><tr><td><span style='color:#999999;font-weight:bold;display:block;'><a name='perk_".$perk->getID()."'>[perk:]</a>".$perk->getDisplayName()."</span></td>";
|
||||
$html .= "<table><tr><td><span style='color:#999999;font-weight:bold;display:block;'><a name='task_".$task->getID()."'>[task:]</a>".$task->getDisplayName()." (".$task->getValue().")</span></td>";
|
||||
|
||||
$html .= "<td style='background-color:#FFFFFF;padding:3px;'><nobr><a href='?mode=ach&cat=".$_REQUEST['cat']."&act=dev&state=".$perk->getDev()."&id=".$perk->getPathID()."#perk_".$perk->getID()."'><img src='pic/";
|
||||
if($perk->inDev()) {
|
||||
$html .= "<td style='background-color:#FFFFFF;padding:3px;'><nobr><a href='?mode=ach&cat=".$_REQUEST['cat']."&act=dev&state=".$task->getDev()."&id=".$task->getPathID()."#task_".$task->getID()."'><img src='pic/";
|
||||
if($task->inDev()) {
|
||||
$html .= "red";
|
||||
}
|
||||
else {
|
||||
$html .= "green";
|
||||
}
|
||||
$html .= ".gif' /></a> <a href='javascript:hs(\"edit_perk_".$perk->getID()."\",\"block\");'><img src='pic/icon_edit.gif'></a>";
|
||||
$html .= ".gif' /></a> <a href='javascript:hs(\"edit_task_".$task->getID()."\",\"block\");'><img src='pic/icon_edit.gif'></a>";
|
||||
|
||||
$html .= " <a href='javascript:hs(\"new_obj_".$perk->getID()."\",\"block\");'><img src='pic/b_insrow.png'></a>";
|
||||
$html .= " <a href='javascript:hs(\"new_obj_".$task->getID()."\",\"block\");'><img src='pic/b_insrow.png'></a>";
|
||||
|
||||
$html .= " <a href='?mode=ach&cat=".$_REQUEST['cat']."&confirm=delete&id=".$perk->getPathID()."'><img src='pic/b_drop.png'></a></nobr></td>
|
||||
$html .= " <a href='?mode=ach&cat=".$_REQUEST['cat']."&confirm=delete&id=".$task->getPathID()."'><img src='pic/b_drop.png'></a></nobr></td>
|
||||
</td></tr></table>";
|
||||
|
||||
$html .= "<div id='edit_perk_".$perk->getID()."' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$perk->getPathID()."&act=perk_update#perk_".$perk->getID()."'>
|
||||
$html .= "<div id='edit_task_".$task->getID()."' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$task->getPathID()."&act=task_update#task_".$task->getID()."'>
|
||||
<fieldset>
|
||||
<legend>edit perk</legend>
|
||||
<legend>edit task</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td class='bw'>name:</td>
|
||||
<td><input type='text' name='apl_name' value='".$perk->getName()."' /></td>
|
||||
<td><input type='text' name='atl_name' value='".htmlspecialchars($task->getName(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>naming template:</td>
|
||||
<td><input type='text' name='apl_template' value=\"".$perk->getTemplate()."\" /></td>
|
||||
<td><input type='text' name='atl_template' value='".htmlspecialchars($task->getTemplate(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>yubopoints:</td>
|
||||
<td><input type='text' name='ap_value' value='".$perk->getValue()."' /></td>
|
||||
<td><input type='text' name='at_value' value='".htmlspecialchars($task->getValue(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>parent:</td>
|
||||
<td>
|
||||
<select name='ap_parent'>
|
||||
<option value='null' selected='selected'>[set as main perk]</option>";
|
||||
$par = $perk->getParent();
|
||||
<select name='at_parent'>
|
||||
<option value='null' selected='selected'>[set as base task]</option>";
|
||||
$par = $task->getParent();
|
||||
$iter = $par->getOpen();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
if($curr->getID() == $perk->getID()) {
|
||||
if($curr->getID() == $task->getID()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$html .= "<option value='".$curr->getID()."'";
|
||||
if($curr->getID() == $perk->getParentID()) {
|
||||
if($curr->getID() == $task->getParentID()) {
|
||||
$html .= " selected='selected'";
|
||||
}
|
||||
$html .= ">".$curr->getName()."</option>";
|
||||
$html .= ">".$curr->getDisplayName()."</option>";
|
||||
}
|
||||
|
||||
$html .= "</select>
|
||||
|
@ -454,16 +523,16 @@
|
|||
<tr>
|
||||
<td class='bw'>condition:</td>
|
||||
<td>
|
||||
<select name='ap_condition'>
|
||||
<option value='all'"; if($perk->getCondition() == "all") { $html .= " selected='selected'"; } $html .= ">all</option>
|
||||
<option value='any'"; if($perk->getCondition() == "any") { $html .= " selected='selected'"; } $html .= ">any</option>
|
||||
<option value='value'"; if($perk->getCondition() == "value") { $html .= " selected='selected'"; } $html .= ">by value</option>
|
||||
<select name='at_condition'>
|
||||
<option value='all'"; if($task->getCondition() == "all") { $html .= " selected='selected'"; } $html .= ">all</option>
|
||||
<option value='any'"; if($task->getCondition() == "any") { $html .= " selected='selected'"; } $html .= ">any</option>
|
||||
<option value='value'"; if($task->getCondition() == "value") { $html .= " selected='selected'"; } $html .= ">by value</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>condition value:</td>
|
||||
<td><input type='text' name='ap_condition_value' value='".$perk->getConditionValue()."' /></td>
|
||||
<td><input type='text' name='ap_condition_value' value='".htmlspecialchars($task->getConditionValue(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><input type='submit' value='save' /></td>
|
||||
|
@ -473,8 +542,8 @@
|
|||
</form>
|
||||
</div>";
|
||||
|
||||
$html .= "<div id='new_obj_".$perk->getID()."' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$perk->getPathID()."&act=obj_insert#perk_".$perk->getID()."'>
|
||||
$html .= "<div id='new_obj_".$task->getID()."' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$task->getPathID()."&act=obj_insert#task_".$task->getID()."'>
|
||||
<fieldset>
|
||||
<legend>add new objective</legend>
|
||||
<table>
|
||||
|
@ -509,7 +578,43 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>metalink:</td>
|
||||
<td></td>
|
||||
<td>
|
||||
<select name='ao_metalink'>
|
||||
<option value=''> -- none --</option>";
|
||||
/*$m = $menu->getIterator();
|
||||
while($m->hasNext()) {
|
||||
$n = $m->getNext();
|
||||
$html .= "<option value='' disabled='disabled'>".$n->getName()."</option>";
|
||||
|
||||
$m2 = $n->getIterator();
|
||||
while($m2->hasNext()) {
|
||||
$n2 = $m2->getNext();
|
||||
$html .= "<option value='' disabled='disabled'> ".$n2->getName()."</option>";
|
||||
|
||||
//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 .= "<option value='".$res[$i]['aa_id']."'> ".$res[$i]['aal_name']."</option>";
|
||||
}
|
||||
}
|
||||
|
||||
//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 .= "<option value='".$res[$i]['aa_id']."'> ".$res[$i]['aal_name']."</option>";
|
||||
}
|
||||
}*/
|
||||
|
||||
$html .= $metalist;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$html .= "</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><input type='submit' value='add' /></td>
|
||||
|
@ -518,16 +623,16 @@
|
|||
</fieldset>
|
||||
</form>
|
||||
</div>";
|
||||
#}
|
||||
#if($perk->objDrawable()) {
|
||||
$html .= ach_render_obj_list($perk->getIterator());
|
||||
#}
|
||||
|
||||
$html .= ach_render_obj_list($task->getIterator());
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_obj_list($obj) {
|
||||
#return null;
|
||||
global $metalist;
|
||||
$html = "<center><table width='90%'>";
|
||||
|
||||
#$i = 0;
|
||||
|
@ -573,16 +678,16 @@
|
|||
$html .= " <a href='?mode=ach&cat=".$_REQUEST['cat']."&confirm=delete&id=".$elem->getPathID()."'><img src='pic/b_drop.png'></a></nobr></td>
|
||||
</td></tr></table>";
|
||||
|
||||
#$perk = $elem->getParent();
|
||||
|
||||
|
||||
$html .= "<div id='edit_obj_".$elem->getID()."' style='margin-bottom:3px;margin-top:3px;display:none;color:#000000;background-color:#FFFFFF;'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$elem->getPathID()."&act=obj_update#perk_".$elem->getPerk()."'>
|
||||
<form method='post' action='?mode=ach&cat=".$_REQUEST['cat']."&id=".$elem->getPathID()."&act=obj_update#task_".$elem->getTask()."'>
|
||||
<fieldset>
|
||||
<legend>edit objective</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td class='bw'>name:</td>
|
||||
<td><input type='text' name='aol_name' value='".$elem->getName()."' /></td>
|
||||
<td><input type='text' name='aol_name' value='".htmlspecialchars($elem->getName(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>type:</td>
|
||||
|
@ -607,11 +712,51 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>trigger value:</td>
|
||||
<td><input type='text' name='ao_value' value='".$elem->getValue()."' /></td>
|
||||
<td><input type='text' name='ao_value' value='".htmlspecialchars($elem->getValue(),ENT_QUOTES)."' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bw'>metalink:</td>
|
||||
<td></td>
|
||||
<td><select name='ao_metalink'>
|
||||
<option value=''> -- none --</option>";
|
||||
/*$m = $menu->getIterator();
|
||||
while($m->hasNext()) {
|
||||
$n = $m->getNext();
|
||||
$html .= "<option value='' disabled='disabled'>".$n->getName()."</option>";
|
||||
|
||||
$m2 = $n->getIterator();
|
||||
while($m2->hasNext()) {
|
||||
$n2 = $m2->getNext();
|
||||
$html .= "<option value='' disabled='disabled'> ".$n2->getName()."</option>";
|
||||
|
||||
//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 .= "<option value='".$res[$i]['aa_id']."'";
|
||||
if($res[$i]['aa_id'] == $elem->getMetalink()) {
|
||||
$html .= " selected='selected'";
|
||||
}
|
||||
$html .= "> ".$res[$i]['aal_name']."</option>";
|
||||
}
|
||||
}
|
||||
|
||||
//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 .= "<option value='".$res[$i]['aa_id']."'";
|
||||
if($res[$i]['aa_id'] == $elem->getMetalink()) {
|
||||
$html .= " selected='selected'";
|
||||
}
|
||||
$html .= "> ".$res[$i]['aal_name']."</option>";
|
||||
}
|
||||
}*/
|
||||
|
||||
$html .= str_replace("value='".$elem->getMetalink()."'","value='".$elem->getMetalink()."' selected='selected'",$metalist);
|
||||
|
||||
|
||||
|
||||
$html .= "</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><input type='submit' value='save' /></td>
|
||||
|
@ -658,7 +803,7 @@
|
|||
|
||||
function ach_render_obj_meta(&$obj) {
|
||||
global $_CONF;
|
||||
$html = "";
|
||||
|
||||
if($obj->isdone()) {
|
||||
$col = "#71BE02";
|
||||
$grey = "";
|
||||
|
@ -733,9 +878,8 @@
|
|||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) {
|
||||
global $_USER,$_CONF;
|
||||
global $_USER;
|
||||
|
||||
$html = "<style>
|
||||
.o {
|
||||
|
@ -743,10 +887,10 @@
|
|||
}
|
||||
</style>
|
||||
|
||||
<div style='display:block;text-align:center;'><form method='post' action='?cat=".$cat->getID()."' id='cc_form'>
|
||||
<div style='display:block;text-align:center;'><form method='post' action='?mode=ach&cat=".$cat->getID()."' id='cc_form'>
|
||||
<table>
|
||||
<tr>";
|
||||
if($cat->isTiedCult()) {
|
||||
if($cat->isTiedCultDev()) {
|
||||
$html.= "<td>
|
||||
<select name='cult' onchange='document.getElementById(\"cc_form\").submit();'>
|
||||
<option value='c_neutral'"; if($cult == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
||||
|
@ -755,7 +899,7 @@
|
|||
</select>
|
||||
</td>";
|
||||
}
|
||||
if($cat->isTiedCiv()) {
|
||||
if($cat->isTiedCivDev()) {
|
||||
$html.= "<td>
|
||||
<select name='civ' onchange='document.getElementById(\"cc_form\").submit();'>
|
||||
<option value='c_neutral'"; if($civ == "c_neutral") { $html.= " selected='selected'"; } $html .= ">".get_translation('ach_c_neutral',$_USER->getLang())."</option>
|
||||
|
|
|
@ -135,7 +135,6 @@ function catchTab(item,e){
|
|||
}
|
||||
|
||||
function ach_render_achievement_open(&$ach) {
|
||||
global $_CONF,$menu;
|
||||
|
||||
$open = explode(";",$_REQUEST['id']);
|
||||
|
||||
|
@ -146,30 +145,30 @@ function catchTab(item,e){
|
|||
|
||||
$html = "<div style='display: block; margin-bottom: 5px;'>
|
||||
<div style='display:block;font-size:22px;' class='bar'><a href='javascript:hs(\"ach_".$ach->getID()."\",\"block\");'>[+]</a> ".$ach->getName()." <span style='font-size:12px;'>(ties= race: ".$ach->getTieRace()."; civ: ".$ach->getTieCiv()."; cult: ".$ach->getTieCult().")</span></div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='ach_".$ach->getID()."'>".ach_render_perk_open($ach)."</div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='ach_".$ach->getID()."'>".ach_render_task_open($ach)."</div>
|
||||
</div>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_perk_open(&$ach) {
|
||||
function ach_render_task_open(&$ach) {
|
||||
$html = "";
|
||||
|
||||
$open = explode(";",$_REQUEST['id']);
|
||||
|
||||
$perk_list = $ach->getOpen();
|
||||
while($perk_list->hasNext()) {
|
||||
$task_list = $ach->getOpen();
|
||||
while($task_list->hasNext()) {
|
||||
|
||||
$perk = $perk_list->getNext();
|
||||
$task = $task_list->getNext();
|
||||
|
||||
$o = "none";
|
||||
if($open[2] == $perk->getID()) {
|
||||
if($open[2] == $task->getID()) {
|
||||
$o = "block";
|
||||
}
|
||||
|
||||
$html .= "<div style='display: block; margin-bottom: 5px;'>
|
||||
<div style='display:block;font-size:16px;' class='bar'><a href='javascript:hs(\"perk_".$perk->getID()."\",\"block\");'>[+]</a> ".$perk->getDisplayName()." <span style='font-size:12px;'>(condition= ".$perk->getCondition().": ".$perk->getConditionValue().")</span></div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='perk_".$perk->getID()."'>".ach_render_obj_list($perk->getIterator())."</div>
|
||||
<div style='display:block;font-size:16px;' class='bar'><a href='javascript:hs(\"task_".$task->getID()."\",\"block\");'>[+]</a> ".$task->getDisplayName()." <span style='font-size:12px;'>(condition= ".$task->getCondition().": ".$task->getConditionValue().")</span></div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='task_".$task->getID()."'>".ach_render_obj_list($task->getIterator())."</div>
|
||||
</div>";
|
||||
}
|
||||
|
||||
|
@ -179,15 +178,13 @@ function catchTab(item,e){
|
|||
function ach_render_obj_list($obj) {
|
||||
$html = "";
|
||||
|
||||
$open = explode(";",$_REQUEST['id']);
|
||||
|
||||
|
||||
while($obj->hasNext()) {
|
||||
$elem = $obj->getNext();
|
||||
|
||||
#$o = "none";
|
||||
#if($open[3] == $elem->getID()) {
|
||||
|
||||
$o = "block";
|
||||
#}
|
||||
|
||||
|
||||
$html .= "<div style='display: block; margin-bottom: 5px;'>
|
||||
<div style='display:block;' class='bar'><a href='javascript:hs(\"obj_".$elem->getID()."\",\"block\");' name='obj_".$elem->getID()."'>[+]</a> ".$elem->getDisplayName()." <span style='font-size:12px;'>(condition= ".$elem->getCondition().": ".$elem->getValue().")</span></div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
function csr_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 at_id=apt_task AND apt_player='".$_USER->getID()."'");
|
||||
|
||||
$html = "<div style='display:block;border-bottom:1px solid #000000;'><span style='font-size:32px;'>".$_USER->getName()." <img src='".$_CONF['image_url']."pic/yubo_done.png'> ".max(0,$res[0]['anz'])."</span></div>";
|
||||
|
||||
|
@ -94,6 +94,8 @@
|
|||
|
||||
function adm_render_mnode(&$menu,$sub) {
|
||||
global $_CONF;
|
||||
|
||||
$html = "";
|
||||
|
||||
$iter = $menu->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
|
@ -182,7 +184,7 @@
|
|||
'.$ach->getValueDone().'<br><img src="'.$_CONF['image_url'].'pic/yubo_done.png">
|
||||
</td>
|
||||
</tr><tr><td align="center" valign="top">';
|
||||
$html .= ach_render_perk_done($ach);
|
||||
$html .= ach_render_task_done($ach);
|
||||
$html .= '</td></tr></tbody></table></center>
|
||||
</td>
|
||||
<td style="background-image: url('.$_CONF['image_url'].'pic/bar_done_r.png);"></td>
|
||||
|
@ -217,7 +219,7 @@
|
|||
'.$ach->getValueOpen().'<br><img src="'.$_CONF['image_url'].'pic/yubo_pending.png">
|
||||
</td>
|
||||
</tr><tr><td align="center" valign="top">';
|
||||
$html .= ach_render_perk_open($ach);
|
||||
$html .= ach_render_task_open($ach);
|
||||
$html .= '</td></tr></tbody></table></center>
|
||||
</td>
|
||||
<td style="background-image: url('.$_CONF['image_url'].'pic/bar_pending_r.png);"></td>
|
||||
|
@ -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 .= "<span style='color:#999999;font-weight:bold;display:block;'>";
|
||||
|
||||
if($perk->getName() != null) {
|
||||
$html .= $perk->getName();
|
||||
if($task->getName() != null) {
|
||||
$html .= $task->getName();
|
||||
}
|
||||
else {
|
||||
$tml .= "[untitled]";
|
||||
$html .= "[untitled]";
|
||||
}
|
||||
$html .= " <a href='?mode=player&pid=".$_REQUEST['pid']."&cat=".$_REQUEST['cat']."&grant=".$perk->getPath()."'><b>Perk:</b> grant</a>";
|
||||
#if($perk->getName() != null) {
|
||||
$html .= "</span>";
|
||||
#}
|
||||
if($perk->objDrawable()) {
|
||||
$html .= ach_render_obj_list($perk->getIterator());
|
||||
$html .= " <a href='?mode=player&pid=".$_REQUEST['pid']."&cat=".$_REQUEST['cat']."&grant=".$task->getPath()."'><b>Task:</b> grant</a></span>";
|
||||
|
||||
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 .= "<div style='display:block;'><span style='color:#66CC00;font-weight:bold;'>".$perk->getName()."</span> ( ".date('d.m.Y',$perk->getDone())." ) <img src='".$_CONF['image_url']."pic/yubo_done.png' width='15px' /> ".$perk->getValue()." <a href='?mode=player&pid=".$_REQUEST['pid']."&cat=".$_REQUEST['cat']."&deny=".$perk->getPath()."'>Perk: deny</a></div>";
|
||||
$html .= "<div style='display:block;'><span style='color:#66CC00;font-weight:bold;'>".$task->getName()."</span> ( ".date('d.m.Y',$task->getDone())." ) <img src='".$_CONF['image_url']."pic/yubo_done.png' width='15px' /> ".$task->getValue()." <a href='?mode=player&pid=".$_REQUEST['pid']."&cat=".$_REQUEST['cat']."&deny=".$task->getPath()."'>Task: deny</a></div>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
@ -489,7 +485,7 @@
|
|||
}
|
||||
|
||||
function ach_render_tiebar($cult = "c_neutral", $civ = "c_neutral",&$cat) {
|
||||
global $_USER,$_CONF;
|
||||
global $_USER;
|
||||
|
||||
$html = "<style>
|
||||
.o {
|
||||
|
|
|
@ -22,12 +22,14 @@
|
|||
|
||||
function adm_render_mnode(&$menu,$sub) {
|
||||
global $_CONF;
|
||||
|
||||
$html = "";
|
||||
|
||||
$iter = $menu->getIterator();
|
||||
while($iter->hasNext()) {
|
||||
$curr = $iter->getNext();
|
||||
|
||||
$html .= "<span class='ach_mspan'><a href='?mode=atom&cat=".$curr->getID()."'><table class='ach_menu'>
|
||||
$html .= "<span class='ach_mspan'><a href='?mode=lang&cat=".$curr->getID()."'><table class='ach_menu'>
|
||||
<tr>";
|
||||
if($sub == 0) {
|
||||
$html .= "<td><img src='".$_CONF['image_url']."pic/menu/".$curr->getImage()."' /></td>";
|
||||
|
@ -74,7 +76,7 @@
|
|||
}
|
||||
|
||||
function ach_render_achievement_open(&$ach) {
|
||||
global $_CONF,$menu;
|
||||
global $_CONF;
|
||||
|
||||
$open = explode(";",$_REQUEST['id']);
|
||||
|
||||
|
@ -84,31 +86,91 @@
|
|||
}
|
||||
|
||||
$html = "<div style='display: block; margin-bottom: 5px;'>
|
||||
<div style='display:block;font-size:22px;' class='bar'><a href='javascript:hs(\"ach_".$ach->getID()."\",\"block\");'>[+]</a> ".$ach->getName()." <span style='font-size:12px;'>(ties= race: ".$ach->getTieRace()."; civ: ".$ach->getTieCiv()."; cult: ".$ach->getTieCult().")</span></div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='ach_".$ach->getID()."'>".ach_render_perk_open($ach)."</div>
|
||||
<div style='display:block;font-size:22px;' class='bar'><a href='javascript:hs(\"ach_".$ach->getID()."\",\"block\");'>[+]</a> ".$ach->getName()." <span style='font-size:12px;'>(ties= race: ".$ach->getTieRace()."; civ: ".$ach->getTieCiv()."; cult: ".$ach->getTieCult().")</span>
|
||||
|
||||
<div style='margin-left:35px;'>
|
||||
<form method='post' action='?mode=lang&cat=".$_REQUEST['cat']."&act=ach_save&id=".$ach->getPathID()."'>
|
||||
<table>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td style='color:#454545;'>name</td>
|
||||
<td style='color:#454545;'>template</td>
|
||||
</tr>";
|
||||
|
||||
foreach($_CONF['langs'] as $elem) {
|
||||
$tmp = $ach->getLang($elem);
|
||||
|
||||
$html .= "<tr>
|
||||
<td style='color:#454545;'>".$elem."</td>
|
||||
<td><input type='text' name='a_name[".$elem."]' style='width:270px;' value='".htmlspecialchars($tmp[0],ENT_QUOTES)."' /></td>
|
||||
<td><input type='text' name='a_tpl[".$elem."]' style='width:270px;' value='".htmlspecialchars($tmp[1],ENT_QUOTES)."' /></td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$html .= "<tr>
|
||||
<td> </td>
|
||||
<td colspan='2'><input type='submit' value='save' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='ach_".$ach->getID()."'>".ach_render_task_open($ach)."</div>
|
||||
</div>";
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_perk_open(&$ach) {
|
||||
function ach_render_task_open(&$ach) {
|
||||
global $_CONF;
|
||||
|
||||
$html = "";
|
||||
|
||||
$open = explode(";",$_REQUEST['id']);
|
||||
|
||||
$perk_list = $ach->getOpen();
|
||||
while($perk_list->hasNext()) {
|
||||
$task_list = $ach->getOpen();
|
||||
while($task_list->hasNext()) {
|
||||
|
||||
$perk = $perk_list->getNext();
|
||||
$task = $task_list->getNext();
|
||||
|
||||
$o = "none";
|
||||
if($open[2] == $perk->getID()) {
|
||||
if($open[2] == $task->getID()) {
|
||||
$o = "block";
|
||||
}
|
||||
|
||||
$html .= "<div style='display: block; margin-bottom: 5px;'>
|
||||
<div style='display:block;font-size:16px;' class='bar'><a href='javascript:hs(\"perk_".$perk->getID()."\",\"block\");'>[+]</a> ".$perk->getDisplayName()." <span style='font-size:12px;'>(condition= ".$perk->getCondition().": ".$perk->getConditionValue().")</span></div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='perk_".$perk->getID()."'>".ach_render_obj_list($perk->getIterator())."</div>
|
||||
<div style='display:block;font-size:16px;' class='bar'><a href='javascript:hs(\"task_".$task->getID()."\",\"block\");'>[+]</a> ".$task->getDisplayName()."
|
||||
|
||||
<div style='margin-left:35px;'>
|
||||
<form method='post' action='?mode=lang&cat=".$_REQUEST['cat']."&act=task_save&id=".$task->getPathID()."'>
|
||||
<table>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td style='color:#454545;'>name</td>
|
||||
<td style='color:#454545;'>template</td>
|
||||
</tr>";
|
||||
|
||||
foreach($_CONF['langs'] as $elem) {
|
||||
$tmp = $task->getLang($elem);
|
||||
|
||||
$html .= "<tr>
|
||||
<td style='color:#454545;'>".$elem."</td>
|
||||
<td><input type='text' name='t_name[".$elem."]' style='width:258px;' value='".htmlspecialchars($tmp[0],ENT_QUOTES)."' /></td>
|
||||
<td><input type='text' name='t_tpl[".$elem."]' style='width:258px;' value='".htmlspecialchars($tmp[1],ENT_QUOTES)."' /></td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$html .= "<tr>
|
||||
<td> </td>
|
||||
<td colspan='2'><input type='submit' value='save' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='task_".$task->getID()."'>".ach_render_obj_list($task->getIterator())."</div>
|
||||
</div>";
|
||||
}
|
||||
|
||||
|
@ -116,78 +178,52 @@
|
|||
}
|
||||
|
||||
function ach_render_obj_list($obj) {
|
||||
global $_CONF;
|
||||
|
||||
$html = "";
|
||||
|
||||
$open = explode(";",$_REQUEST['id']);
|
||||
|
||||
|
||||
while($obj->hasNext()) {
|
||||
$elem = $obj->getNext();
|
||||
|
||||
#$o = "none";
|
||||
#if($open[3] == $elem->getID()) {
|
||||
$o = "block";
|
||||
#}
|
||||
|
||||
|
||||
|
||||
|
||||
$html .= "<div style='display: block; margin-bottom: 5px;'>
|
||||
<div style='display:block;' class='bar'><a href='javascript:hs(\"obj_".$elem->getID()."\",\"block\");' name='obj_".$elem->getID()."'>[+]</a> ".$elem->getDisplayName()." <span style='font-size:12px;'>(condition= ".$elem->getCondition().": ".$elem->getValue().")</span></div>
|
||||
<div style='margin-left:25px;display:".$o.";' id='obj_".$elem->getID()."'>
|
||||
<div style='display:block;'><a href='javascript:hs(\"add_atom_".$elem->getID()."\",\"block\");'>add</a></div>
|
||||
<div style='display:none;' id='add_atom_".$elem->getID()."'>
|
||||
<form method='post' action='?mode=atom&cat=".$_REQUEST['cat']."&act=insert_atom&id=".$elem->getPathID()."#obj_".$elem->getID()."'>
|
||||
<fieldset>
|
||||
<legend>add atom trigger</legend>
|
||||
<div style='display:block;' class='bar'> ".$elem->getDisplayName()."</span>
|
||||
|
||||
<div style='margin-left:35px;'>
|
||||
<form method='post' action='?mode=lang&cat=".$_REQUEST['cat']."&act=obj_save&id=".$elem->getPathID()."'>
|
||||
<table>
|
||||
<tr>
|
||||
<td><textarea name='atom_ruleset' rows='6' cols='80' onkeydown='return catchTab(this,event);'></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type='hidden' name='atom_mandatory' value='0' /><input type='checkbox' name='atom_mandatory' value='1' /> mandatory</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type='submit' value='add' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
<hr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td style='color:#454545;'>name</td>
|
||||
</tr>";
|
||||
|
||||
foreach($_CONF['langs'] as $lang) {
|
||||
$tmp = $elem->getLang($lang);
|
||||
|
||||
$html .= "<tr>
|
||||
<td style='color:#454545;'>".$lang."</td>
|
||||
<td><input type='text' name='' style='width:246px;' value='".htmlspecialchars($tmp,ENT_QUOTES)."' /></td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$html .= "<tr>
|
||||
<td> </td>
|
||||
<td><input type='submit' value='save' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
".ach_render_atom_list($elem->getIterator())."
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function ach_render_atom_list($atom) {
|
||||
$html = "";
|
||||
|
||||
while($atom->hasNext()) {
|
||||
$elem = $atom->getNext();
|
||||
|
||||
$html .= "<form method='post' action='?mode=atom&cat=".$_REQUEST['cat']."&act=update_atom&id=".$elem->getPathID()."#obj_".$elem->getObjective()."'>
|
||||
<table>
|
||||
<tr>
|
||||
<td><textarea name='atom_ruleset' rows='6' cols='80' onkeydown='return catchTab(this,event);'>".$elem->getRuleset()."</textarea></td>
|
||||
<td valign='top' rowspan='3'><a href='?mode=atom&cat=".$_REQUEST['cat']."&act=delete&id=".$elem->getPathID()."#obj_".$elem->getObjective()."'>[X]</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div style='width:555px;overflow:scroll;'><pre>".$elem->getRulesetParsed()."</pre></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type='hidden' name='atom_mandatory' value='0' /><input type='checkbox' name='atom_mandatory' value='1'";
|
||||
if($elem->getMandatory() == 1) {
|
||||
$html .= " checked='checked'";
|
||||
}
|
||||
$html .= " /> mandatory</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2'><input type='submit' value='edit' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form><hr>";
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
?>
|
|
@ -144,12 +144,12 @@
|
|||
$html .= "<table>
|
||||
<tr>
|
||||
<td>name</td>
|
||||
<td><input type='text' name='acl_name' value='".$curr->getName()."' /></td>
|
||||
<td><input type='text' name='acl_name' value='".htmlspecialchars($curr->getName(),ENT_QUOTES)."' /></td>
|
||||
</tr>";
|
||||
if($sub == 0) {
|
||||
$html .= "<tr>
|
||||
<td>image</td>
|
||||
<td><input type='text' name='ac_image' value='".$curr->getImage()."' /></td>
|
||||
<td><input type='text' name='ac_image' value='".htmlspecialchars($curr->getImage(),ENT_QUOTES)."' /></td>
|
||||
</tr>";
|
||||
}
|
||||
$html .= "<tr>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<?php
|
||||
|
||||
$microstart = explode(' ',microtime());
|
||||
$start_time = $microstart[0] + $microstart[1];
|
||||
|
||||
error_reporting(E_ALL ^ E_NOTICE);
|
||||
ini_set("display_errors","1");
|
||||
|
||||
|
@ -49,8 +52,9 @@ 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/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");
|
||||
require_once($_CONF['app_achievements_path']."class/AchSummary_class.php");
|
||||
|
||||
require_once("class/ADM_inter.php");
|
||||
#require_once("class/AdmDispatcher_trait.php");
|
||||
|
@ -58,7 +62,7 @@ require_once("class/AdmMenu_class.php");
|
|||
require_once("class/AdmMenuNode_class.php");
|
||||
require_once("class/AdmCategory_class.php");
|
||||
require_once("class/AdmAchievement_class.php");
|
||||
require_once("class/AdmPerk_class.php");
|
||||
require_once("class/AdmTask_class.php");
|
||||
require_once("class/AdmObjective_class.php");
|
||||
require_once("class/AdmAtom_class.php");
|
||||
|
||||
|
@ -67,7 +71,7 @@ require_once("class/CSR_inter.php");
|
|||
#require_once("class/CSRMenu_class.php");
|
||||
require_once("class/CSRCategory_class.php");
|
||||
require_once("class/CSRAchievement_class.php");
|
||||
require_once("class/CSRPerk_class.php");
|
||||
require_once("class/CSRTask_class.php");
|
||||
require_once("class/CSRObjective_class.php");
|
||||
require_once("class/CSRAtom_class.php");
|
||||
|
||||
|
@ -76,7 +80,9 @@ $DBc = ryDB::getInstance("app_achievements_test");
|
|||
|
||||
function mkn($x) {
|
||||
global $DBc;
|
||||
if($x == null || strtolower($x) == "null") {
|
||||
#echo "<br>".$x." =>";
|
||||
if($x == null || strtolower($x) == "null" || $x == "") {
|
||||
#echo "NULL";
|
||||
return "NULL";
|
||||
}
|
||||
else {
|
||||
|
@ -86,7 +92,7 @@ function mkn($x) {
|
|||
|
||||
|
||||
$c = "<script type='text/javascript'>
|
||||
<!--
|
||||
|
||||
function hs(id,mod) {
|
||||
if(document.getElementById(id).style.display == 'none') {
|
||||
document.getElementById(id).style.display=mod;
|
||||
|
@ -170,35 +176,37 @@ $c .= "</div></td>
|
|||
if($open != 0) {
|
||||
$cat = new AdmCategory($open,'%','%','%');
|
||||
|
||||
if($_REQUEST['act'] == "insert_atom") {
|
||||
if($_REQUEST['act'] == "ach_save") {
|
||||
$ach = $cat->getElementByPath($_REQUEST['id']);
|
||||
|
||||
if(is_array($_REQUEST['a_name'])) {
|
||||
foreach($_REQUEST['a_name'] as $key=>$elem) {
|
||||
$ach->setLang($key,$_REQUEST['a_name'][$key],$_REQUEST['a_tpl'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "task_save") {
|
||||
$task = $cat->getElementByPath($_REQUEST['id']);
|
||||
|
||||
if(is_array($_REQUEST['t_name'])) {
|
||||
foreach($_REQUEST['t_name'] as $key=>$elem) {
|
||||
$task->setLang($key,$_REQUEST['t_name'][$key],$_REQUEST['t_tpl'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "obj_save") {
|
||||
$obj = $cat->getElementByPath($_REQUEST['id']);
|
||||
|
||||
if($obj != null) {
|
||||
$atom = new AdmAtom(array(),$obj);
|
||||
$atom->setRuleset($_REQUEST['atom_ruleset']);
|
||||
$atom->setMandatory($_REQUEST['atom_mandatory']);
|
||||
$atom->setObjective($obj->getID());
|
||||
|
||||
$obj->insertNode($atom);
|
||||
if(is_array($_REQUEST['o_name'])) {
|
||||
foreach($_REQUEST['o_name'] as $key=>$elem) {
|
||||
$obj->setLang($key,$_REQUEST['o_name'][$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "update_atom") {
|
||||
$atom = $cat->getElementByPath($_REQUEST['id']);
|
||||
|
||||
if($atom != null) {
|
||||
$atom->setRuleset($_REQUEST['atom_ruleset']);
|
||||
$atom->setMandatory($_REQUEST['atom_mandatory']);
|
||||
|
||||
$atom->update();
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "delete") {
|
||||
$elem = $cat->getElementByPath($_REQUEST['id']);
|
||||
$par = $elem->getParent();
|
||||
$par->removeNode($elem->getID());
|
||||
}
|
||||
|
||||
|
||||
$c .= atom_render_category($cat);
|
||||
}
|
||||
|
@ -364,12 +372,30 @@ $c .= "</div></td>
|
|||
if($open != 0) {
|
||||
$cat = new AdmCategory($open,$_REQUEST['race'],$_REQUEST['cult'],$_REQUEST['civ']);
|
||||
|
||||
$microstop = explode(' ',microtime());
|
||||
$stop_time = $microstop[0] + $microstop[1];
|
||||
|
||||
echo "<br>loading: ".round($stop_time - $start_time,3);
|
||||
|
||||
$start_time = $stop_time;
|
||||
|
||||
if($_REQUEST['act'] == "ach_move") {
|
||||
$ach = $cat->getChildDataByID($_REQUEST['id']);
|
||||
if($ach != null) {
|
||||
$ach->setCategory($_REQUEST['new_cat']);
|
||||
$ach->update();
|
||||
$cat->removeChild($ach->getID());
|
||||
|
||||
$iter = $cat->getOpen();
|
||||
while($iter->hasNext()) {
|
||||
$item = $iter->getNext();
|
||||
|
||||
if($ach->getID() == $item->getParentID()) {
|
||||
$item->setCategory($_REQUEST['new_cat']);
|
||||
$item->update();
|
||||
$cat->removeChild($item->getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -381,18 +407,20 @@ $c .= "</div></td>
|
|||
$ach->setTieCult($_REQUEST['aa_tie_cult']);
|
||||
$ach->setTieCiv($_REQUEST['aa_tie_civ']);
|
||||
$ach->setImage($_REQUEST['aa_image']);
|
||||
$ach->setParentID($_REQUEST['aa_parent']);
|
||||
$ach->setSticky($_REQUEST['aa_sticky']);
|
||||
|
||||
$cat->insertNode($ach);
|
||||
|
||||
$perk = new AdmPerk(array(),$ach);
|
||||
$perk->setAchievement($ach->getID());
|
||||
$perk->setName($_REQUEST['apl_name']);
|
||||
$perk->setTemplate($_REQUEST['apl_template']);
|
||||
$perk->setValue($_REQUEST['ap_value']);
|
||||
$perk->setCondition($_REQUEST['ap_condition']);
|
||||
$perk->setConditionValue($_REQUEST['ap_condition_value']);
|
||||
$task = new AdmTask(array(),$ach);
|
||||
$task->setAchievement($ach->getID());
|
||||
$task->setName($_REQUEST['atl_name']);
|
||||
$task->setTemplate($_REQUEST['atl_template']);
|
||||
$task->setValue($_REQUEST['at_value']);
|
||||
$task->setCondition($_REQUEST['at_condition']);
|
||||
$task->setConditionValue($_REQUEST['at_condition_value']);
|
||||
|
||||
$ach->insertNode($perk);
|
||||
$ach->insertNode($task);
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "ach_update") {
|
||||
|
@ -404,61 +432,63 @@ $c .= "</div></td>
|
|||
$ach->setTieCult($_REQUEST['aa_tie_cult']);
|
||||
$ach->setTieCiv($_REQUEST['aa_tie_civ']);
|
||||
$ach->setImage($_REQUEST['aa_image']);
|
||||
$ach->setParentID($_REQUEST['aa_parent']);
|
||||
$ach->setSticky($_REQUEST['aa_sticky']);
|
||||
|
||||
$ach->update();
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "perk_insert") {
|
||||
if($_REQUEST['act'] == "task_insert") {
|
||||
$ach = $cat->getChildDataByID($_REQUEST['id']);
|
||||
if($ach != null) {
|
||||
$perk = new AdmPerk(array(),$ach);
|
||||
$perk->setAchievement($ach->getID());
|
||||
$perk->setName($_REQUEST['apl_name']);
|
||||
$perk->setTemplate($_REQUEST['apl_template']);
|
||||
$perk->setValue($_REQUEST['ap_value']);
|
||||
#MISSING: parent
|
||||
$perk->setParentID($_REQUEST['ap_parent']);
|
||||
$perk->setCondition($_REQUEST['ap_condition']);
|
||||
$perk->setConditionValue($_REQUEST['ap_condition_value']);
|
||||
$task = new AdmTask(array(),$ach);
|
||||
$task->setAchievement($ach->getID());
|
||||
$task->setName($_REQUEST['atl_name']);
|
||||
$task->setTemplate($_REQUEST['atl_template']);
|
||||
$task->setValue($_REQUEST['at_value']);
|
||||
$task->setCondition($_REQUEST['at_condition']);
|
||||
$task->setConditionValue($_REQUEST['at_condition_value']);
|
||||
|
||||
$ach->insertNode($perk);
|
||||
$ach->orderPerks();
|
||||
$perk->update();
|
||||
$ach->insertNode($task);
|
||||
$task->setParentID($_REQUEST['at_parent']);
|
||||
$ach->orderTasks();
|
||||
$task->update();
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "perk_update") {
|
||||
$perk = $cat->getElementByPath($_REQUEST['id']);
|
||||
if($_REQUEST['act'] == "task_update") {
|
||||
$task = $cat->getElementByPath($_REQUEST['id']);
|
||||
|
||||
if($perk != null) {
|
||||
$perk->setName($_REQUEST['apl_name']);
|
||||
$perk->setTemplate($_REQUEST['apl_template']);
|
||||
$perk->setValue($_REQUEST['ap_value']);
|
||||
$perk->setParentID($_REQUEST['ap_parent']);
|
||||
$perk->setCondition($_REQUEST['ap_condition']);
|
||||
$perk->setConditionValue($_REQUEST['ap_condition_value']);
|
||||
if($task != null) {
|
||||
$task->setName($_REQUEST['atl_name']);
|
||||
$task->setTemplate($_REQUEST['atl_template']);
|
||||
$task->setValue($_REQUEST['at_value']);
|
||||
$task->setCondition($_REQUEST['at_condition']);
|
||||
$task->setConditionValue($_REQUEST['at_condition_value']);
|
||||
|
||||
$ach = $perk->getParent();
|
||||
$ach->orderPerks();
|
||||
$task->setParentID($_REQUEST['at_parent']);
|
||||
|
||||
$perk->update();
|
||||
$ach = $task->getParent();
|
||||
$ach->orderTasks();
|
||||
|
||||
$task->update();
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "obj_insert") {
|
||||
$perk = $cat->getElementByPath($_REQUEST['id']);
|
||||
$task = $cat->getElementByPath($_REQUEST['id']);
|
||||
|
||||
if($perk != null) {
|
||||
$obj = new AdmObjective(array(),$perk);
|
||||
if($task != null) {
|
||||
$obj = new AdmObjective(array(),$task);
|
||||
$obj->setName($_REQUEST['aol_name']);
|
||||
$obj->setCondition($_REQUEST['ao_condition']);
|
||||
$obj->setValue($_REQUEST['ao_value']);
|
||||
$obj->setDisplay($_REQUEST['ao_display']);
|
||||
$obj->setMetalink($_REQUEST['ao_metalink']);
|
||||
$obj->setPerk($perk->getID());
|
||||
$obj->setTask($task->getID());
|
||||
|
||||
$perk->insertNode($obj);
|
||||
$task->insertNode($obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,16 +508,42 @@ $c .= "</div></td>
|
|||
|
||||
if($_REQUEST['act'] == "delete") {
|
||||
$elem = $cat->getElementByPath($_REQUEST['id']);
|
||||
$par = $elem->getParent();
|
||||
$par->removeNode($elem->getID());
|
||||
if($elem != null) {
|
||||
$par = $elem->getParent();
|
||||
$par->removeNode($elem->getID());
|
||||
|
||||
if(get_class($elem) == "AdmAchievement") {
|
||||
$iter = $cat->getOpen();
|
||||
while($iter->hasNext()) {
|
||||
$item = $iter->getNext();
|
||||
|
||||
if($elem->getID() == $item->getParentID()) {
|
||||
$item->setParentID(null);
|
||||
$item->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_REQUEST['act'] == "dev") {
|
||||
$curr = $cat->getElementByPath($_REQUEST['id']);
|
||||
$curr->setInDev(($_REQUEST['state'] != 1));
|
||||
}
|
||||
|
||||
$microstop = explode(' ',microtime());
|
||||
$stop_time = $microstop[0] + $microstop[1];
|
||||
|
||||
echo "<br>manipulation: ".round($stop_time - $start_time,3);
|
||||
|
||||
$start_time = $stop_time;
|
||||
|
||||
$c .= adm_render_category($cat);
|
||||
|
||||
$microstop = explode(' ',microtime());
|
||||
$stop_time = $microstop[0] + $microstop[1];
|
||||
|
||||
echo "<br>rendering: ".round($stop_time - $start_time,3);
|
||||
}
|
||||
|
||||
#a:p:o:a
|
||||
|
@ -539,6 +595,7 @@ $c .= "</div></td>
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$c .= "<center><table>
|
||||
<tr>
|
||||
<td colspan='2' align='left'>".csr_render_yubopoints($user['id'])."</td>
|
||||
|
@ -552,11 +609,19 @@ $c .= "</div></td>
|
|||
$c .= "</div></td>
|
||||
<td width='645px' valign='top'>";
|
||||
|
||||
$open = $menu->getOpenCat();
|
||||
#$open = $menu->getOpenCat();
|
||||
|
||||
if($open != 0) {
|
||||
$c .= csr_render_category($cat);
|
||||
}
|
||||
else {
|
||||
$cat = new AchSummary($menu,8);
|
||||
$c .= ach_render_summary_header();
|
||||
}
|
||||
|
||||
if($open == 0) {
|
||||
$c .= ach_render_summary_footer($cat);
|
||||
}
|
||||
|
||||
$c .= "</td>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in a new issue