diff --git a/0.3-rc1/CHANGELOG b/0.3-rc1/CHANGELOG new file mode 100644 index 0000000..021812b --- /dev/null +++ b/0.3-rc1/CHANGELOG @@ -0,0 +1,8 @@ +0.1: +- initial release + +0.2 +- Renamed 'SpamProtecterManager' to 'SpamProtectorManager'. Note the typo with the 'er' + +0.3 (trunk) +- Updated Error Reporting to be a bit more verbose \ No newline at end of file diff --git a/0.3-rc1/INSTALL b/0.3-rc1/INSTALL new file mode 100644 index 0000000..933e455 --- /dev/null +++ b/0.3-rc1/INSTALL @@ -0,0 +1,38 @@ +SilverStripe SpamProtection Module 0.1 beta +======================================= + + +INSTALLATION +------------ + +1. Unzip this file (spamprotection-0.1.tar.gz) inside your SilverStripe installation directory. +It should be at the same level as 'jsparty', 'cms' and 'sapphire' modules. + +2. Ensure the directory name for the module is 'spamprotection'. + +3. Visit your SilverStripe site in a webbrowser and run www.yoursite.com/dev/build + +5. We now need to setup some basic features to get the module up and running. Open up _config.php +inside project directory (typically 'mysite/_config.php') with your favourite text editor. +Read the instructions below to setup the initial configuration of the module. + + +SETTING UP THE MODULE (in 'mysite/_config.php') +------------------------------------------------------ + +Before putting the following code in '_config.php', make sure you have a subclass of 'SpamProtectorField' installed or written. One +example of 'SpamProtector' subclass is 'MollomField'. + +SpamProtectorManager::set_spam_protector('MollomSpamProtector'); + + +UPDATING A FORM TO INCLUDE THE SPAM PROTECTOR FIELD +--------------------------------------------------- + +This following code should appear after the form creation. + +$protector = SpamProtectorManager::update_form($form, 'Message'); + +This code add an instance of a 'SpamProtectorField' class specified in SETTING UP THE MODULE section. The newly created field will have +MollomField field. The first parameter is a Form object in which the field will be added into and the second parameter tells +SpamProtectorManagor to place the new field before a field named 'Message'. diff --git a/0.3-rc1/README b/0.3-rc1/README new file mode 100644 index 0000000..5a899c4 --- /dev/null +++ b/0.3-rc1/README @@ -0,0 +1,30 @@ +############################################### +SpamProtection Module +############################################### + +Maintainer Contact +----------------------------------------------- +Saophalkun Ponlu + + +Will Rossiter + + +Requirements +----------------------------------------------- +SilverStripe 2.3 + +Documentation +----------------------------------------------- +http://doc.silverstripe.com/doku.php?id=modules:spamprotection + +Installation Instructions +----------------------------------------------- +See INSTALL + +Usage Overview +----------------------------------------------- +See INSTALL + +Known issues +----------------------------------------------- \ No newline at end of file diff --git a/0.3-rc1/_config.php b/0.3-rc1/_config.php new file mode 100644 index 0000000..15c5adc --- /dev/null +++ b/0.3-rc1/_config.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/0.3-rc1/code/EditableSpamProtectionField.php b/0.3-rc1/code/EditableSpamProtectionField.php new file mode 100644 index 0000000..649bd9a --- /dev/null +++ b/0.3-rc1/code/EditableSpamProtectionField.php @@ -0,0 +1,33 @@ +getFormField($this->Name, $this->Title, null); + } + } + return false; + } + + public function Icon() { + return 'spamprotection/images/' . strtolower($this->class) . '.png'; + } + + function showInReports() { + return false; + } +} diff --git a/0.3-rc1/code/SpamProtector.php b/0.3-rc1/code/SpamProtector.php new file mode 100644 index 0000000..2312e7f --- /dev/null +++ b/0.3-rc1/code/SpamProtector.php @@ -0,0 +1,23 @@ +spamFieldMapping = $array; + } + + /** + * Get the fields that are mapped via spam protection + * + * @return Array + */ + public function getFieldMapping() { + return $this->spamFieldMapping; + } +} \ No newline at end of file diff --git a/0.3-rc1/code/SpamProtectorManager.php b/0.3-rc1/code/SpamProtectorManager.php new file mode 100644 index 0000000..303a5ae --- /dev/null +++ b/0.3-rc1/code/SpamProtectorManager.php @@ -0,0 +1,95 @@ +getFormField("Captcha", $title, null, $form, $rightTitle); + + if($field) { + // update the mapping + $field->setFieldMapping($fieldsToSpamServiceMapping); + + // add the form field + if($before && $form->Fields()->fieldByName($before)) { + $form->Fields()->insertBefore($field, $before); + } + else { + $form->Fields()->push($field); + } + } + + } catch (Exception $e) { + return user_error("SpamProtectorManager::update_form(): '$protectorClass' is not correctly set up. " . $e, E_USER_WARNING); + } + } + + /** + * Send Feedback to the Spam Protection. The level of feedback + * will depend on the Protector class. + * + * @param DataObject The Object which you want to send feedback about. Must have a + * SessionID field. + * @param String Feedback on the $object usually 'spam' or 'ham' for non spam entries + */ + static function send_feedback($object, $feedback) { + $protectorClass = self::get_spam_protector(); + + if(!$protectorClass) return false; + + $protector = new $protectorClass(); + return $protector->sendFeedback($object, $feedback); + } +} \ No newline at end of file diff --git a/0.3-rc1/images/editablespamprotectionfield.png b/0.3-rc1/images/editablespamprotectionfield.png new file mode 100644 index 0000000..746b7ca Binary files /dev/null and b/0.3-rc1/images/editablespamprotectionfield.png differ diff --git a/0.3-rc1/lang/_manifest_exclude b/0.3-rc1/lang/_manifest_exclude new file mode 100644 index 0000000..e69de29 diff --git a/0.3-rc1/lang/en_US.php b/0.3-rc1/lang/en_US.php new file mode 100644 index 0000000..c226713 --- /dev/null +++ b/0.3-rc1/lang/en_US.php @@ -0,0 +1,16 @@ + \ No newline at end of file