/** * Generate a date attribute and it's potential dependencies * @param array $generated array of all generated attributes * @param string $attribute the name of the attribute to generate * @access protected **/ protected function generate_date(&$generated, $attribute) { $pattern = $this->attributes[$attribute]; if ($pattern[0] == '%') { $inner_attr = substr($pattern, 1, -1); $this->generate_extra($generated, $inner_attr); $generated[$attribute] = $generated[$inner_attr]; } else { $generated[$attribute] = of_date_upd_format($pattern, true); } }
/** * Retrieve all necessary user data. * Be carefull, there is no verification on parameters. * @param $user_id A user unique identifier. * @param $domain_id A domain identifier. * @param $force Force to perform the SQL request. * @return Array A associative array where keys are sql field, or false. */ function getUserDataFromId ($user_id, $domain_id, $force = false) { global $obm; if (is_null($user_id)) return false; if (!is_null($this->_db_userData) && !$force) return $this->_db_userData; $backup['obm_domain_id'] = $obm['domain_id']; $obm['domain_id'] = $domain_id; $usr_q = run_query_user_detail($user_id); $user = Array(); foreach ($this->_sqlMap as $key => $key_obm) { if (substr($key, 0, strpos($key, '_')) != "userobm") continue; switch ($key) { case 'userobm_datebegin': $value = of_date_upd_format($usr_q->f($key_obm),true); break; case 'userobm_account_dateexp': $value = of_date_upd_format($usr_q->f($key_obm),true); break; case 'userobm_mail_server_id': $value = $usr_q->f('mailserver_id'); break; case 'userobm_mail_server_hostname': $value = $usr_q->f('mailserver_hostname'); break; case 'userobm_vacation_datebegin': $value = of_date_upd_format($usr_q->f($key), true); break; case 'userobm_vacation_dateend': $value = of_date_upd_format($usr_q->f($key), true); break; case 'userobm_vacation_message': $value = stripslashes($usr_q->f($key)); break; case 'userobm_samba_home': $value = addslashes($usr_q->f($key)); break; case 'userobm_samba_home_drive': $value = trim($usr_q->f($key)); break; default: $value = $usr_q->f($key); break; } $user[$key_obm] = $value; } $this->_db_userData = $user; $obm['domain_id'] = $backup['obm_domain_id']; unset($backup); return $user; }