Exemplo n.º 1
0
 public function save_importer()
 {
     if (!Loader::helper('validation/token')->validate('save_importer')) {
         $this->error->add(t('Invalid Token.'));
         return;
     }
     $miID = $this->post('miID');
     $mi = MailImporter::getByID($miID);
     if (is_object($mi)) {
         $mi->update($this->post());
         $this->redirect('/dashboard/system/mail/importers', 'importer_updated');
     }
 }
Exemplo n.º 2
0
 public function add($args, $pkg = null)
 {
     $db = Loader::db();
     extract($args);
     if ($miPort < 1) {
         $miPort = 0;
     }
     if ($miIsEnabled != 1) {
         $miIsEnabled = 0;
     }
     if ($miEncryption == '') {
         $miEncryption = null;
     }
     if (!$miConnectionMethod) {
         $miConnectionMethod = 'POP';
     }
     $pkgID = $pkg == null ? 0 : $pkg->getPackageID();
     $db->Execute('insert into MailImporters (miHandle, miServer, miUsername, miPassword, miEncryption, miIsEnabled, miEmail, miPort, miConnectionMethod, pkgID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($miHandle, Loader::helper('security')->sanitizeString($miServer), $miUsername, $miPassword, $miEncryption, $miIsEnabled, Loader::helper('security')->sanitizeString($miEmail), $miPort, $miConnectionMethod, $pkgID));
     $miID = $db->Insert_ID();
     return MailImporter::getByID($miID);
 }