GeneralSection.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\Setting\Sections;
  3. use ThurData\Servers\KerioEmail\App\Traits\FormExtendedTrait;
  4. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Sections\FreeFieldsSection;
  5. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  6. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  7. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\BaseField;
  8. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  9. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  10. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  11. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Textarea;
  12. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Info;
  13. use ThurData\Servers\KerioEmail\Core\Helper\DnsHelper;
  14. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\RawSection;
  15. /**
  16. *
  17. * Created by PhpStorm.
  18. * User: ThurData
  19. * Date: 12.11.19
  20. * Time: 13:39
  21. * Class GeneralSection
  22. */
  23. class GeneralSection extends FreeFieldsSection
  24. {
  25. protected $id = 'generalSection';
  26. protected $name = 'generalSection';
  27. use FormExtendedTrait;
  28. public function initContent()
  29. {
  30. $maildomain = $this->getRequestValue('actionElementId');
  31. $dns = new DnsHelper();
  32. $info = new RawSection();
  33. if($dns->selfDns($maildomain)) {
  34. $infodns = new Info('infodns');
  35. $infodns->setId('infodns');
  36. $infodns->setName('infodns');
  37. $infodns->setTitle($maildomain);
  38. $infodns->setDescription('infodnsmessage');
  39. $info->addField($infodns);
  40. } else {
  41. $infoextdns = new Info('infoextdns');
  42. $infoextdns->setId('infoextdns');
  43. $infoextdns->setName('infoextdns');
  44. $infoextdns->setTitle($maildomain);
  45. $infoextdns->setDescription('infoextdnsmessage');
  46. $info->addField($infoextdns);
  47. }
  48. $this->addSection($info);
  49. $mxthurdata = new Text('mxthurdata');
  50. $mxthurdata->addHtmlAttribute('readonly','true');
  51. $mxthurdata->setDescription('description');
  52. $mxactive = new Text('mxactive');
  53. $mxactive->addHtmlAttribute('readonly','true');
  54. $mxactive->setDescription('description');
  55. $this->generateDoubleSection([$mxthurdata, $mxactive]);
  56. $spfthurdata = new Text('spfthurdata');
  57. $spfthurdata->addHtmlAttribute('readonly','true');
  58. $spfthurdata->setDescription('description');
  59. $spf = new Text('spf');
  60. $spf->addHtmlAttribute('readonly','true');
  61. $spf->setDescription('description');
  62. $this->generateDoubleSection([$spfthurdata, $spf]);
  63. $dmarcthurdata = new Text('dmarcthurdata');
  64. $dmarcthurdata->addHtmlAttribute('readonly','true');
  65. $dmarcthurdata->setDescription('description');
  66. $dmarc = new Text('dmarc');
  67. $dmarc->addHtmlAttribute('readonly','true');
  68. $dmarc->setDescription('description');
  69. $this->generateDoubleSection([$dmarcthurdata, $dmarc]);
  70. $dkimname = new Text('dkimname');
  71. $dkimname->addHtmlAttribute('readonly','true')->addHtmlAttribute('border', 0);
  72. $dkimname->setDescription('description');
  73. $this->generateDoubleSection([$dkimname]);
  74. $dkimthurdata = new Text('dkimthurdata');
  75. $dkimthurdata->addHtmlAttribute('readonly','true');
  76. $dkimthurdata->setDescription('description');
  77. $dkim = new Text('dkim');
  78. $dkim->addHtmlAttribute('readonly','true');
  79. $this->generateDoubleSection([$dkimthurdata, $dkim]);
  80. $this->generateDoubleSection([new Hidden('infomaildomain'), new Hidden('id')]);
  81. $this->generateDoubleSection([new Hidden('selfdns'), new Hidden('dnsok')]);
  82. }
  83. }