From bc1895a2a5660d16f21936cec5dda4eda2f36446 Mon Sep 17 00:00:00 2001 From: Jeremy Byron Schulz Date: Sun, 20 May 2018 02:00:03 +0200 Subject: [PATCH] isk srp v1 --- README.md | 2 +- ajax/corp-mem.php | 2 +- ajax/get_contracts.php | 3 +- ...inished.php => get_contracts_finished.php} | 0 ajax/get_payments.php | 24 ++++++ ajax/get_payments_finished.php | 13 ++++ ajax/get_roles.php | 17 ++++ ajax/mail-messages.php | 4 +- ajax/sendmail.php | 10 ++- config.php.template | 4 +- func.php | 6 +- index.php | 25 +++--- js/corp.js | 2 +- js/srp-hull.js | 9 ++- js/srp-isk.js | 78 +++++++++++++------ 15 files changed, 146 insertions(+), 53 deletions(-) rename ajax/{contracts-finished.php => get_contracts_finished.php} (100%) create mode 100644 ajax/get_payments.php create mode 100644 ajax/get_payments_finished.php create mode 100644 ajax/get_roles.php diff --git a/README.md b/README.md index 6b5e9ef..e92ce29 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Hosted here: http://eve-stuff.com/index.php # EVE-srpmail -This is a small and simple tool to make the tedious task of of writing SRP mails easier for officers. +This is a small and simple tool to make the tedious task of writing SRP mails easier for officers. This works for all corporations not just EVE uni as it pulls the infos about the corps and chars dynamically from the API. Nothing will be save on the server itself for longer than the session. As of now it only works if contracts are in stations not in citadels. diff --git a/ajax/corp-mem.php b/ajax/corp-mem.php index 8d9bfd5..2e00dd9 100644 --- a/ajax/corp-mem.php +++ b/ajax/corp-mem.php @@ -9,7 +9,7 @@ try { if(empty($_SESSION['corpmem'])){ - $corpmem = $api_corp->getCorporationsCorporationIdMembers(corpid(charid()),$datasource); + $corpmem = $api_corp->getCorporationsCorporationIdMembers(corpid(),$datasource); $split_ids=array_chunk($corpmem,100); $chars=array(); diff --git a/ajax/get_contracts.php b/ajax/get_contracts.php index 17db6f3..1b5784e 100644 --- a/ajax/get_contracts.php +++ b/ajax/get_contracts.php @@ -3,14 +3,13 @@ header('Content-Type: application/json;charset=utf-8'); $json=array(); -$cid=corpid(charid()); $contracts = new Swagger\Client\Api\ContractsApi(null,$config); try { $result = $contracts->getCharactersCharacterIdContractsWithHttpInfo(charid(), $datasource); foreach ($result[0] as $row) { - if(($row->getDateIssued()->getTimestamp()>strtotime('-6 hour'))&&($row->getStatus()=="outstanding"||$row->getStatus()=="finished")&&$row->getIssuerId()==charid()&&$row->getAvailability()=="personal"&&$row->getType()=="item_exchange"&&corpid($row->getAssigneeId())==$cid){ + if(($row->getDateIssued()->getTimestamp()>strtotime('-6 hour'))&&($row->getStatus()=="outstanding"||$row->getStatus()=="finished")&&$row->getIssuerId()==charid()&&$row->getAvailability()=="personal"&&$row->getType()=="item_exchange"&&getcorpid($row->getAssigneeId())==corpid()){ array_unshift($json,json_decode(strval($row)));//avoids protected property problems } } diff --git a/ajax/contracts-finished.php b/ajax/get_contracts_finished.php similarity index 100% rename from ajax/contracts-finished.php rename to ajax/get_contracts_finished.php diff --git a/ajax/get_payments.php b/ajax/get_payments.php new file mode 100644 index 0000000..6ae75b8 --- /dev/null +++ b/ajax/get_payments.php @@ -0,0 +1,24 @@ +getCorporationsCorporationIdWalletsDivisionJournalWithHttpInfo(corpid(), $corpwallet_id, $datasource); + foreach ($result[0] as $row) { + + if (($row->getDate()->getTimestamp()>strtotime('-6 hour'))&&$row->getRefType()=="corporation_account_withdrawal"&&$row->getContextIdType()=="character_id"&&$row->getContextId()==charid()&&$row->getFirstPartyId()!=$row->getSecondPartyId()&&$row->getAmount()<=0) { + array_unshift($json,json_decode(strval($row)));//avoids protected property problems + + } + } + print_r(json_encode(array($json,$result[2]['Expires'][0]))); + +} catch (Exception $e) { + echo 'Exception when calling WalletApi->getCorporationsCorporationIdWalletsDivisionJournal: ', $e->getMessage(), PHP_EOL; +} + +?> \ No newline at end of file diff --git a/ajax/get_payments_finished.php b/ajax/get_payments_finished.php new file mode 100644 index 0000000..9dab364 --- /dev/null +++ b/ajax/get_payments_finished.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/ajax/get_roles.php b/ajax/get_roles.php new file mode 100644 index 0000000..6205d3a --- /dev/null +++ b/ajax/get_roles.php @@ -0,0 +1,17 @@ +getCharactersCharacterIdRoles(charid(), $datasource); + print_r(strval($result)); +} catch (Exception $e) { + echo 'Exception when calling CharacterApi->getCharactersCharacterIdRoles: ', $e->getMessage(), PHP_EOL; +} + +?> \ No newline at end of file diff --git a/ajax/mail-messages.php b/ajax/mail-messages.php index 58df970..8775239 100644 --- a/ajax/mail-messages.php +++ b/ajax/mail-messages.php @@ -51,7 +51,7 @@ I have reviewed and approved your SRP requests. You have been paid for the following losses: - +".$_GET["reason"]." ".$_GET["value"]." Million Please check your wallet. @@ -61,7 +61,7 @@ 'ISK SRP Message', 'isk_mail_form', false, -'' +'echo "";' ], ['', 'echo "Hello, diff --git a/ajax/sendmail.php b/ajax/sendmail.php index 733ffef..bedcd05 100644 --- a/ajax/sendmail.php +++ b/ajax/sendmail.php @@ -29,7 +29,15 @@ $x = sizeof($_COOKIE['finished_contracts']);//index for new contract setcookie("finished_contracts[$x]",$_POST["contractid"],time()+60*60*24,'/'); } - break; + break; + case 'isk': + if(!isset($_COOKIE['finished_payments'])){ + setcookie('finished_payments[0]',$_POST["paymentid"],time()+60*60*24,'/'); + }elseif (!in_array($_POST["paymentid"], $_COOKIE['finished_payments'])){ + $x = sizeof($_COOKIE['finished_payments']);//index for new contract + setcookie("finished_payments[$x]",$_POST["paymentid"],time()+60*60*24,'/'); + } + break; } } diff --git a/config.php.template b/config.php.template index 292b409..81496e7 100644 --- a/config.php.template +++ b/config.php.template @@ -1,7 +1,7 @@ 'demoapp', // The client ID assigned to you by the provider diff --git a/func.php b/func.php index d9be1c4..a39ab61 100644 --- a/func.php +++ b/func.php @@ -21,7 +21,11 @@ function charid(){ return $_SESSION['charinfo']['CharacterID']; } -function corpid($charid){ +function corpid(){ + return $_SESSION['charinfo']['CorporationID']; +} + +function getcorpid($charid){ global $config; $api_instance = new Swagger\Client\Api\CharacterApi(null,$config); try { diff --git a/index.php b/index.php index bc3d50b..105dfc8 100644 --- a/index.php +++ b/index.php @@ -27,10 +27,7 @@ '; - echo ' - - @@ -41,7 +38,6 @@ '; - echo 'SRP Mailer '; @@ -91,6 +87,9 @@
  • ISK SRP (indev):
  • Messages (indev):