public function __construct(array $data) { $fields = UserUtils::getTableFields(); foreach ($fields as $f => $default) { if (!isset($data[$f])) { Core::throwError("User data is incomplete. Field {$f} is missing."); $data[$f] = $default; } } // Special case: Birthday -> Parse it into chunks if (strpos($data['birth'], '-') === false) { $data['birth'] = '0000-00-00'; } $bday = explode('-', $data['birth']); $data['birthday'] = intval($bday[2]); $data['birthmonth'] = intval($bday[1]); $data['birthyear'] = intval($bday[0]); $this->data = $data; $this->acl = null; }
public function __construct() { $this->data = UserUtils::getTableFields(); }