diff --git a/include/application.php b/include/application.php
index d501fc8..a242314 100644
--- a/include/application.php
+++ b/include/application.php
@@ -994,6 +994,11 @@ class Application {
/* If no errors occured we return the number of moved children */
return $iCount;
}
+
+ function allowAnonymousSubmissions()
+ {
+ return FALSE;
+ }
}
function get_vendor_from_keywords($sKeywords)
diff --git a/include/application_queue.php b/include/application_queue.php
index a47edd1..0e1d519 100644
--- a/include/application_queue.php
+++ b/include/application_queue.php
@@ -314,6 +314,11 @@ class application_queue
{
$this->oApp->objectDisplayAddItemHelp();
}
+
+ function allowAnonymousSubmissions()
+ {
+ return application::allowAnonymousSubmissions();
+ }
}
?>
diff --git a/include/distribution.php b/include/distribution.php
index 20aa389..b849278 100644
--- a/include/distribution.php
+++ b/include/distribution.php
@@ -615,6 +615,11 @@ class distribution {
{
return $this->iDistributionId;
}
+
+ function allowAnonymousSubmissions()
+ {
+ return FALSE;
+ }
}
?>
diff --git a/include/maintainer.php b/include/maintainer.php
index 31f0215..4198b8a 100644
--- a/include/maintainer.php
+++ b/include/maintainer.php
@@ -667,6 +667,11 @@ class maintainer
return TRUE;
}
+
+ function allowAnonymousSubmissions()
+ {
+ return FALSE;
+ }
}
?>
diff --git a/include/objectManager.php b/include/objectManager.php
index 073a7df..df970eb 100644
--- a/include/objectManager.php
+++ b/include/objectManager.php
@@ -330,6 +330,19 @@ class ObjectManager
echo html_back_link(1, $sBackLink);
}
+ function handle_anonymous_submission()
+ {
+ $oObject = new $this->sClass();
+ if($oObject->allowAnonymousSubmissions() || $_SESSION['current']->isLoggedIn())
+ return;
+
+ util_show_error_page_and_exit("You need to be logged in. If you don’t have an ".
+ "account you can register ".
+ "now, it only takes a few seconds.");
+ }
+
+
/* View an entry */
function view($sBackLink)
{
@@ -401,6 +414,8 @@ class ObjectManager
$oObject->update();
} else
{
+ $this->handle_anonymous_submission();
+
$oObject->create();
}
break;
diff --git a/include/screenshot.php b/include/screenshot.php
index b84a377..c6074cf 100644
--- a/include/screenshot.php
+++ b/include/screenshot.php
@@ -639,6 +639,11 @@ class Screenshot {
/* STUB */
return TRUE;
}
+
+ function allowAnonymousSubmissions()
+ {
+ return FALSE;
+ }
}
?>
diff --git a/include/testData.php b/include/testData.php
index 4d3cfa1..cc24ea3 100644
--- a/include/testData.php
+++ b/include/testData.php
@@ -1005,6 +1005,11 @@ class testData{
return TRUE;
}
}
+
+ function allowAnonymousSubmissions()
+ {
+ return FALSE;
+ }
}
?>
diff --git a/include/testData_queue.php b/include/testData_queue.php
index e7352e0..fc37593 100644
--- a/include/testData_queue.php
+++ b/include/testData_queue.php
@@ -168,6 +168,11 @@ class testData_queue
{
return $this->oTest->objectMakeLink();
}
+
+ function allowAnonymousSubmissions()
+ {
+ return testData::allowAnonymousSubmissions();
+ }
}
?>
diff --git a/include/vendor.php b/include/vendor.php
index b321417..15d61db 100644
--- a/include/vendor.php
+++ b/include/vendor.php
@@ -308,6 +308,11 @@ class Vendor {
return $oRow->count;
}
+
+ function allowAnonymousSubmissions()
+ {
+ return FALSE;
+ }
}
?>
diff --git a/include/version.php b/include/version.php
index 4169de3..9ad08fa 100644
--- a/include/version.php
+++ b/include/version.php
@@ -1416,6 +1416,11 @@ class Version {
/* Return the number of updated objects if everything was successful */
return $iCount;
}
+
+ function allowAnonymousSubmissions()
+ {
+ return FALSE;
+ }
}
?>
diff --git a/include/version_queue.php b/include/version_queue.php
index 66ef456..b9cbe64 100644
--- a/include/version_queue.php
+++ b/include/version_queue.php
@@ -222,6 +222,11 @@ class version_queue
{
return $this->oVersion->objectMoveChildren($iNewId);
}
+
+ function allowAnonymousSubmissions()
+ {
+ return version::allowAnonymousSubmissions();
+ }
}
?>
diff --git a/objectManager.php b/objectManager.php
index 7ee5fc5..f859548 100644
--- a/objectManager.php
+++ b/objectManager.php
@@ -62,6 +62,9 @@ $sErrors = $oObject->processForm($aClean);
if($oObject->iId && $aClean['sAction'] == "delete")
$oObject->delete_entry();
+if($aClean['sAction'] == "add")
+ $oObject->handle_anonymous_submission();
+
/* Provided the necessary values are present, an object's children may be moved
without any confirmation */
if($oObject->iId && $aClean['sAction'] == "moveChildren" && $aClean['iNewId'])
diff --git a/unit_test/test_om_objects.php b/unit_test/test_om_objects.php
index 50cab56..fb4e8fc 100644
--- a/unit_test/test_om_objects.php
+++ b/unit_test/test_om_objects.php
@@ -122,7 +122,8 @@ function test_object_methods()
{
test_start(__FUNCTION__);
- $aTestMethods = array("canEdit",
+ $aTestMethods = array("allowAnonymousSubmissions",
+ "canEdit",
"display",
"getOutputEditorValues",
"objectGetEntries",