public function getPrim($id, $fields) { $prim = $this->db->fetchRow("SELECT * FROM prims,primshapes WHERE prims.UUID=primshapes.UUID AND prims.UUID='{$id}' LIMIT 1"); if (!$fields) { return $prim; } $results = array(); // always returned $results['UUID'] = $prim['UUID']; foreach (explode(',', $fields) as $field) { if (array_key_exists($field, $prim)) { $results[$field] = $prim[$field]; } } return $results; }
public function edit($id, $firstName, $lastName, $email, $userLevel) { $user = $this->db->fetchRow("SELECT UUID FROM auth,useraccounts WHERE UUID=PrincipalID AND UUID='{$id}'"); if (!$user) { return false; } $this->db->update('useraccounts', array('FirstName' => $firstName, 'LastName' => $lastName, 'Email' => $email, 'UserLevel' => $userLevel), "PrincipalID=\"{$id}\""); return true; }
public function getRegion($id, $fields) { $region = $this->db->fetchRow("SELECT * FROM regions,regionsettings WHERE uuid=regionUUID AND uuid='{$id}' LIMIT 1"); if (!$region) { return null; } if (!$fields) { return $region; } $results = array('UUID' => $region['uuid']); // always returned foreach (explode(',', $fields) as $field) { if (array_key_exists($field, $region)) { $results[$field] = $region[$field]; } } return $results; }