From 55a18f1d17b7a4879e2fe8b11d2b3daf5e73e99f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 7 Mar 2012 09:08:05 -0600 Subject: [PATCH] routes for training --- ActivitySpamPlugin.php | 17 +++++++++++++++++ trainhamform.php | 3 +-- trainspamform.php | 3 +-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ActivitySpamPlugin.php b/ActivitySpamPlugin.php index 6950d54554..cb9477d1ad 100644 --- a/ActivitySpamPlugin.php +++ b/ActivitySpamPlugin.php @@ -194,6 +194,23 @@ class ActivitySpamPlugin extends Plugin return true; } + /** + * Map URLs to actions + * + * @param Net_URL_Mapper $m path-to-action mapper + * + * @return boolean hook value; true means continue processing, false means stop. + */ + + function onRouterInitialized($m) + { + $m->connect('main/train/spam', + array('action' => 'train', 'category' => 'spam')); + $m->connect('main/train/ham', + array('action' => 'train', 'category' => 'ham')); + return true; + } + function onPluginVersion(&$versions) { $versions[] = array('name' => 'ActivitySpam', diff --git a/trainhamform.php b/trainhamform.php index 71bd650a3f..410b3206b8 100644 --- a/trainhamform.php +++ b/trainhamform.php @@ -78,7 +78,6 @@ class TrainHamForm extends Form { function formData() { - $this->hidden('category', SpamFilter::HAM); $this->hidden('notice', $this->notice->id); } @@ -125,7 +124,7 @@ class TrainHamForm extends Form { function action() { - return common_local_url('train'); + return common_local_url('train', array('category' => 'ham')); } /** diff --git a/trainspamform.php b/trainspamform.php index 07942f4546..ecf7b04190 100644 --- a/trainspamform.php +++ b/trainspamform.php @@ -78,7 +78,6 @@ class TrainSpamForm extends Form { function formData() { - $this->hidden('category', SpamFilter::SPAM); $this->hidden('notice', $this->notice->id); } @@ -125,7 +124,7 @@ class TrainSpamForm extends Form { function action() { - return common_local_url('train'); + return common_local_url('train', array('category' => 'spam')); } /** -- 2.39.5