Skip to content

Commit

Permalink
bugfixes, name endpoints shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jbs1 committed Jun 28, 2018
1 parent bc1895a commit 0680308
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 28 deletions.
14 changes: 8 additions & 6 deletions ajax/corp-mem.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
<?php
require_once('../header.php');
require_once(__DIR__.'/../header.php');


header('Content-Type: application/json;charset=utf-8');

$api_corp = new Swagger\Client\Api\CorporationApi(null,$config);
$api_character = new Swagger\Client\Api\CharacterApi(null,$config);
$api_universe = new Swagger\Client\Api\UniverseApi(null,$config);

try {
if(empty($_SESSION['corpmem'])){
$corpmem = $api_corp->getCorporationsCorporationIdMembers(corpid(),$datasource);
$split_ids=array_chunk($corpmem,100);
$split_ids=array_chunk($corpmem,1000);
$chars=array();

foreach ($split_ids as $value){
$chars=array_merge($chars,$api_character->getCharactersNames(implode(",", array_values($value)), $datasource));
$chars=array_merge($chars,$api_universe->postUniverseNames(json_encode($value), $datasource));
}

$json=array();
foreach ($chars as $value){
$json[$value['character_id']] = $value['character_name'];
$json[$value['id']] = $value['name'];
}

$_SESSION['corpmem']=$json;//save in ses for caching
echo json_encode($_SESSION['corpmem']);
} else {
Expand Down
4 changes: 2 additions & 2 deletions ajax/get_contracts.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../header.php');
require_once(__DIR__.'/../header.php');

header('Content-Type: application/json;charset=utf-8');
$json=array();
Expand All @@ -14,7 +14,7 @@
}
}

print_r(json_encode(array($json,$result[2]['Expires'][0])));
print_r(json_encode(array($json,$result[2]['Expires'])));

} catch (Exception $e) {
print_r('Exception when calling ContractsApi->getCharactersCharacterIdContracts: '+$e->getMessage());
Expand Down
2 changes: 1 addition & 1 deletion ajax/get_contracts_finished.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../header.php');
require_once(__DIR__.'/../header.php');


header('Content-Type: application/json;charset=utf-8');
Expand Down
5 changes: 2 additions & 3 deletions ajax/get_payments.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../header.php');
require_once(__DIR__.'/../header.php');

header('Content-Type: application/json;charset=utf-8');
$json=array();
Expand All @@ -9,13 +9,12 @@
try {
$result = $wallet->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])));
print_r(json_encode(array($json,$result[2]['Expires'])));

} catch (Exception $e) {
echo 'Exception when calling WalletApi->getCorporationsCorporationIdWalletsDivisionJournal: ', $e->getMessage(), PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion ajax/get_payments_finished.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../header.php');
require_once(__DIR__.'/../header.php');


header('Content-Type: application/json;charset=utf-8');
Expand Down
2 changes: 1 addition & 1 deletion ajax/get_roles.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../header.php');
require_once(__DIR__.'/../header.php');

header('Content-Type: application/json;charset=utf-8');
$json=array();
Expand Down
3 changes: 1 addition & 2 deletions ajax/mail-messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
extra hidden input fields
*/


$messages=array(
['$api_universe = new Swagger\Client\Api\UniverseApi(null,$config);
$station=$api_universe->getUniverseStationsStationId($_GET["station"], $datasource);',
Expand All @@ -51,7 +50,7 @@
I have reviewed and approved your SRP requests.
You have been paid for the following losses:
".$_GET["reason"]." ".$_GET["value"]." Million
".(isset($_GET["reason"])?$var:\'[No loss recorded]\').": ".$_GET["value"]." Million
Please check your wallet.
Expand Down
4 changes: 2 additions & 2 deletions ajax/mailform.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once('../header.php');
require_once('mail-messages.php');
require_once(__DIR__.'/../header.php');
require_once(__DIR__.'/mail-messages.php');

if(!empty($messages[$_GET['textid']][0])){
eval($messages[$_GET['textid']][0]);
Expand Down
2 changes: 1 addition & 1 deletion ajax/sendmail.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('../header.php');
require_once(__DIR__.'/../header.php');

header('Content-Type: application/json;charset=utf-8');

Expand Down
2 changes: 1 addition & 1 deletion config.php.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$corpwallet_id = 0;

$scope = ['esi-mail.send_mail.v1', 'esi-corporations.read_corporation_membership.v1','esi-contracts.read_character_contracts.v1','esi-wallet.read_corporation_wallets.v1'];
$scope = ['esi-mail.send_mail.v1', 'esi-corporations.read_corporation_membership.v1','esi-contracts.read_character_contracts.v1','esi-wallet.read_corporation_wallets.v1','esi-characters.read_corporation_roles.v1'];

$provider = new jbs1\OAuth2\Client\Provider\EveOnline([
'clientId' => 'demoapp', // The client ID assigned to you by the provider
Expand Down
6 changes: 3 additions & 3 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
if(session_status() == PHP_SESSION_NONE){
session_start();
}
require_once('vendor/autoload.php');
require_once('config.php');
require_once('func.php');
require_once(__DIR__.'/vendor/autoload.php');
require_once(__DIR__.'/config.php');
require_once(__DIR__.'/func.php');

$datasource = "tranquility"; // string | The server name you would like data from

Expand Down
7 changes: 5 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('header.php');
require_once(__DIR__.'/header.php');

if(empty($_SESSION['token'])){//if not logged in redirect to
header('Location: oauth.php');
Expand Down Expand Up @@ -90,6 +90,9 @@
</li>
<li>
One of these roles is required for this feature: <strong>Accountant/Junior Accountant</strong>
</li>
<li>
The cache timer for wallets is <strong>1 hour</strong>. This means it is best to first make all payments ingame and then refresh the isk srp page.
</li></ul>
<li>Messages (indev):</li>
<ul><li>
Expand Down Expand Up @@ -144,7 +147,7 @@
</div>';

echo ' <div role="tabpanel" class="tab-pane" id="messagessrp">
<div class="input-group">
<div class="input-group" id="messagessrp-search-div">
<span class="input-group-addon" id="messagessrp-search-addon">Member-Search:</span>
<input type="text" class="form-control" id="messagessrp-search" placeholder="Character Name" aria-describedby="messagessrp-search-addon">
</div>
Expand Down
1 change: 0 additions & 1 deletion js/corp.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ $(function (){
},
complete: function(){
$('table#messagessrp-table').trigger('update-mem');
// $('table#isksrp-table').trigger('update-mem');
loader_stop(1);
}
});
Expand Down
2 changes: 1 addition & 1 deletion oauth.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('header.php');
require_once(__DIR__.'/header.php');

// If we don't have an authorization code then get one
if (!isset($_GET['code'])) {
Expand Down
2 changes: 1 addition & 1 deletion test.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once('header.php');
require_once(__DIR__.'/header.php');
header('Content-Type: application/json;charset=utf-8');

print_r(json_encode(array("session"=>$_SESSION,"cookie"=>$_COOKIE)));
Expand Down

0 comments on commit 0680308

Please sign in to comment.