public static function checkLogin($user, $password) { return AmemberRest::checkAccessByLoginPass($user, $password); }
public static function findAffiliate($searchterm = null) { $users = AmemberRest::getUsers(); $match_fields = ['fullname', 'login', 'email']; $affiliates = []; foreach ($users as $user) { if (gettype($user) !== "array") { continue; } $user['fullname'] = $user['name_l'] ? $user['name_f'] . ' ' . $user['name_l'] : $user['name_f']; if (array_key_exists('is_affiliate', $user) && ($user['is_affiliate'] == 1 || $user['is_affiliate'] == 2)) { $record = ['user_id' => $user['user_id'], 'affiliate_id' => $user['aff_id'], 'login' => $user['login'], 'fullname' => $user['fullname'], 'email' => $user['email']]; if ($searchterm !== null) { foreach ($match_fields as $fieldname) { if (array_key_exists($fieldname, $user) && stripos($user[$fieldname], $searchterm) !== false) { $record['matched_field'] = $fieldname; $affiliates[] = $record; break; } } } else { $affiliates[] = $record; } } } return $affiliates; }