public function update_library() { if (Loader::helper("validation/token")->validate('update_library')) { if ($this->post('activeLibrary')) { $scl = SystemAntispamLibrary::getByHandle($this->post('activeLibrary')); if (is_object($scl)) { $scl->activate(); Config::save('ANTISPAM_NOTIFY_EMAIL', $this->post('ANTISPAM_NOTIFY_EMAIL')); Config::save('ANTISPAM_LOG_SPAM', $this->post('ANTISPAM_LOG_SPAM')); if ($scl->hasOptionsForm() && $this->post('ccm-submit-submit')) { $controller = $scl->getController(); $controller->saveOptions($this->post()); } $this->redirect('/dashboard/system/permissions/antispam', 'saved'); } else { $this->error->add(t('Invalid anti-spam library.')); } } else { SystemAntispamLibrary::deactivateAll(); } } else { $this->error->add(Loader::helper('validation/token')->getErrorMessage()); } $this->view(); }
public static function getListByPackage($pkg) { $db = Loader::db(); $saslHandles = $db->GetCol('select saslHandle from SystemAntispamLibraries where pkgID = ? order by saslHandle asc', array($pkg->getPackageID())); $libraries = array(); foreach ($saslHandles as $saslHandle) { $sasl = SystemAntispamLibrary::getByHandle($saslHandle); $libraries[] = $sasl; } return $libraries; }