-
-
Save Adjokip/22910db12d9533628b4d3964730796c2 to your computer and use it in GitHub Desktop.
checkJobs.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function checkJobs($jobsArray, $db) { | |
$return = array(); | |
foreach ($jobsArray as $remote_server_id => $jobs) { | |
foreach ($jobs as $jobId => $job) { | |
if (!isset($job['action'])) continue; | |
$hasAccess = ($db->isAdmin($_SESSION['user_id'])) ? $db->getGameHome($job['home_id']) : $db->getUserGameHome($_SESSION['user_id'], $job['home_id']); | |
if (!$hasAccess) continue; | |
if (array_key_exists('home_id', $job) && array_key_exists('ip', $job) && array_key_exists('port', $job) && hasValue($job['home_id']) && hasValue($job['ip']) && hasValue($job['port'])) { | |
$job['uniqueStr'] = $job['home_id']."_".$job['ip']."_".$job['port']; | |
} elseif(hasValue($job['home_id'])) { | |
$job['uniqueStr'] = $job['home_id']; | |
} | |
$job['job_id'] = $jobId; | |
$job['r_server_id'] = $remote_server_id; | |
$return[] = $job; | |
} | |
} | |
return $return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment