. * --------------------------------------------------------------------- */ /** * Class used to manage Auth mail config */ class AuthMail extends CommonDBTM { // From CommonDBTM public $dohistory = true; static $rightname = 'config'; static function getTypeName($nb = 0) { return _n('Mail server', 'Mail servers', $nb); } function prepareInputForUpdate($input) { if (isset($input['mail_server']) && !empty($input['mail_server'])) { $input["connect_string"] = Toolbox::constructMailServerConfig($input); } return $input; } static function canCreate() { return static::canUpdate(); } static function canPurge() { return static::canUpdate(); } function prepareInputForAdd($input) { if (isset($input['mail_server']) && !empty($input['mail_server'])) { $input["connect_string"] = Toolbox::constructMailServerConfig($input); } return $input; } function defineTabs($options = []) { $ong = []; $this->addDefaultFormTab($ong); $this->addStandardTab(__CLASS__, $ong, $options); $this->addStandardTab('Log', $ong, $options); return $ong; } function rawSearchOptions() { $tab = []; $tab[] = [ 'id' => 'common', 'name' => __('Email server') ]; $tab[] = [ 'id' => '1', 'table' => $this->getTable(), 'field' => 'name', 'name' => __('Name'), 'datatype' => 'itemlink', 'massiveaction' => false ]; $tab[] = [ 'id' => '2', 'table' => $this->getTable(), 'field' => 'id', 'name' => __('ID'), 'datatype' => 'number', 'massiveaction' => false ]; $tab[] = [ 'id' => '3', 'table' => $this->getTable(), 'field' => 'host', 'name' => __('Server'), 'datatype' => 'string' ]; $tab[] = [ 'id' => '4', 'table' => $this->getTable(), 'field' => 'connect_string', 'name' => __('Connection string'), 'massiveaction' => false, 'datatype' => 'string' ]; $tab[] = [ 'id' => '6', 'table' => $this->getTable(), 'field' => 'is_active', 'name' => __('Active'), 'datatype' => 'bool' ]; $tab[] = [ 'id' => '19', 'table' => $this->getTable(), 'field' => 'date_mod', 'name' => __('Last update'), 'datatype' => 'datetime', 'massiveaction' => false ]; $tab[] = [ 'id' => '16', 'table' => $this->getTable(), 'field' => 'comment', 'name' => __('Comments'), 'datatype' => 'text' ]; return $tab; } /** * Print the auth mail form * * @param integer $ID ID of the item * @param array $options Options * * @return void|boolean (display) Returns false if there is a rights error. */ function showForm($ID, $options = []) { if (!Config::canUpdate()) { return false; } if (empty($ID)) { $this->getEmpty(); } else { $this->getFromDB($ID); } $options['colspan'] = 1; $this->showFormHeader($options); echo "