diff --git a/app/.htaccess b/app/.htaccess old mode 100644 new mode 100755 diff --git a/app/Config/Schema/i18n.php b/app/Config/Schema/i18n.php old mode 100644 new mode 100755 diff --git a/app/Config/Schema/i18n.sql b/app/Config/Schema/i18n.sql old mode 100644 new mode 100755 diff --git a/app/Config/Schema/schema_0.2.1.1.php b/app/Config/Schema/schema_0.2.1.1.php old mode 100644 new mode 100755 diff --git a/app/Config/Schema/sessions.php b/app/Config/Schema/sessions.php old mode 100644 new mode 100755 diff --git a/app/Config/Schema/sessions.sql b/app/Config/Schema/sessions.sql old mode 100644 new mode 100755 diff --git a/app/Config/acl.ini.php b/app/Config/acl.ini.php old mode 100644 new mode 100755 diff --git a/app/Config/acl.php b/app/Config/acl.php old mode 100644 new mode 100755 diff --git a/app/Config/email.php b/app/Config/email.php old mode 100644 new mode 100755 diff --git a/app/Console/Command/PasswordShell.php b/app/Console/Command/PasswordShell.php old mode 100644 new mode 100755 diff --git a/app/Console/cake.bat b/app/Console/cake.bat old mode 100644 new mode 100755 diff --git a/app/Console/cake.php b/app/Console/cake.php old mode 100644 new mode 100755 diff --git a/app/Console/shell/migrate_0.2.1.1-0.2.2.sh b/app/Console/shell/migrate_0.2.1.1-0.2.2.sh old mode 100644 new mode 100755 diff --git a/app/Controller/Component/SecureAuthComponent.php b/app/Controller/Component/SecureAuthComponent.php old mode 100644 new mode 100755 diff --git a/app/Controller/Component/empty b/app/Controller/Component/empty old mode 100644 new mode 100755 diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index 357c73b2c..b34bf3cd2 100755 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -365,10 +365,6 @@ class EventsController extends AppController { // LATER do this with $this->validator()->remove('event_id'); unset($this->Event->Attribute->validate['event_id']); unset($this->Event->Attribute->validate['value']['unique']); // otherwise gives bugs because event_id is not set - - // thing a 'pull from server' sets ServersController.php:176 - // Event.info is appended from the publishing side, given the need to have Server.url - $data['Event']['private'] = true; } if (isset($data['Event']['uuid'])) { // TODO here we should start RESTful dialog @@ -408,9 +404,7 @@ class EventsController extends AppController { if ($this->Event->saveAssociated($data, array('validate' => true, 'fieldList' => $fieldList))) { if (!empty($data['Event']['published']) && 1 == $data['Event']['published']) { // call __sendAlertEmail if published was set in the request - if (!$fromXml) { - $this->__sendAlertEmail($this->Event->getId()); - } + $this->__sendAlertEmail($this->Event->getId()); } return true; } else { @@ -595,7 +589,9 @@ class EventsController extends AppController { private function __deleteEventFromServers($uuid) { // get a list of the servers $this->loadModel('Server'); - $servers = $this->Server->find('all', array()); + $servers = $this->Server->find('all', array( + 'conditions' => array('Server.push' => true) + )); // iterate over the servers and upload the event if(empty($servers)) @@ -822,7 +818,7 @@ class EventsController extends AppController { } catch (Exception $e){ // catch errors like expired PGP keys $this->log($e->getMessage()); - return $e->getMessage(); + // no need to return here, as we want to send out mails to the other users if GPG encryption fails for a single user } // If you wish to send multiple emails using a loop, you'll need // to reset the email fields using the reset method of the Email component. @@ -973,6 +969,7 @@ class EventsController extends AppController { } catch (Exception $e){ // catch errors like expired PGP keys $this->log($e->getMessage()); + // no need to return here, as we want to send out mails to the other users if GPG encryption fails for a single user } } else { $bodyEncSig = $bodySigned; diff --git a/app/Controller/PagesController.php b/app/Controller/PagesController.php old mode 100644 new mode 100755 diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php index 39f0a075c..25b56b694 100644 --- a/app/Controller/ServersController.php +++ b/app/Controller/ServersController.php @@ -237,7 +237,15 @@ class ServersController extends AppController { } else { $event['Event']['private'] = true; } - $event['Event']['info'] .= "\n Imported from " . $this->Server->data['Server']['url']; + + // check if the event already exist (using the uuid) + $existingEventCount = $this->Event->find('count', array('conditions' => array('Event.uuid' => $event['Event']['uuid']))); + if ($existingEventCount == 0) { + // add data for newly imported events + $event['Event']['private'] = true; + $event['Event']['info'] .= "\n Imported from " . $this->Server->data['Server']['url']; + } + $eventsController = new EventsController(); try { $result = $eventsController->_add($event, $this->Auth, $fromXml = true, $this->Server->data['Server']['organization']); diff --git a/app/LICENSE b/app/LICENSE old mode 100644 new mode 100755 diff --git a/app/Lib/empty b/app/Lib/empty old mode 100644 new mode 100755 diff --git a/app/Locale/eng/LC_MESSAGES/empty b/app/Locale/eng/LC_MESSAGES/empty old mode 100644 new mode 100755 diff --git a/app/Model/Behavior/empty b/app/Model/Behavior/empty old mode 100644 new mode 100755 diff --git a/app/Model/Bruteforce.php b/app/Model/Bruteforce.php old mode 100644 new mode 100755 diff --git a/app/Model/Datasource/empty b/app/Model/Datasource/empty old mode 100644 new mode 100755 diff --git a/app/Model/Event.php b/app/Model/Event.php index b81216e88..1b78a02a2 100644 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -588,11 +588,19 @@ class Event extends AppModel { } $eventIds = array(); - foreach ($eventArray['response']['Event'] as &$event) { - if (1 != $event['published']) { - continue; // do not keep non-published events + // different actions if it's only 1 event or more + // only one event. + if (isset($eventArray['response']['Event']['id'])) { + $eventIds[] = $eventArray['response']['Event']['id']; + } + else { + // multiple events, iterate over the array + foreach ($eventArray['response']['Event'] as &$event) { + if (1 != $event['published']) { + continue; // do not keep non-published events + } + $eventIds[] = $event['id']; } - $eventIds[] = $event['id']; } return $eventIds; } diff --git a/app/Plugin/empty b/app/Plugin/empty old mode 100644 new mode 100755 diff --git a/app/README.sysop.txt b/app/README.sysop.txt old mode 100644 new mode 100755 diff --git a/app/README.vhost.txt b/app/README.vhost.txt old mode 100644 new mode 100755 diff --git a/app/Vendor/empty b/app/Vendor/empty old mode 100644 new mode 100755 diff --git a/app/View/Elements/empty b/app/View/Elements/empty old mode 100644 new mode 100755 diff --git a/app/View/Emails/html/default.ctp b/app/View/Emails/html/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Emails/text/default.ctp b/app/View/Emails/text/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Errors/error400.ctp b/app/View/Errors/error400.ctp old mode 100644 new mode 100755 diff --git a/app/View/Errors/error500.ctp b/app/View/Errors/error500.ctp old mode 100644 new mode 100755 diff --git a/app/View/Events/text.ctp b/app/View/Events/text.ctp old mode 100644 new mode 100755 diff --git a/app/View/Helper/AppHelper.php b/app/View/Helper/AppHelper.php old mode 100644 new mode 100755 diff --git a/app/View/Layouts/Emails/html/default.ctp b/app/View/Layouts/Emails/html/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/Emails/text/default.ctp b/app/View/Layouts/Emails/text/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/ajax.ctp b/app/View/Layouts/ajax.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/error.ctp b/app/View/Layouts/error.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/flash.ctp b/app/View/Layouts/flash.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/js/default.ctp b/app/View/Layouts/js/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/rss/default.ctp b/app/View/Layouts/rss/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/text/default.ctp b/app/View/Layouts/text/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Layouts/xml/default.ctp b/app/View/Layouts/xml/default.ctp old mode 100644 new mode 100755 diff --git a/app/View/Scaffolds/empty b/app/View/Scaffolds/empty old mode 100644 new mode 100755 diff --git a/app/View/Servers/pull.ctp b/app/View/Servers/pull.ctp old mode 100644 new mode 100755 diff --git a/app/View/Servers/push.ctp b/app/View/Servers/push.ctp old mode 100644 new mode 100755 diff --git a/app/View/Whitelists/admin_add.ctp b/app/View/Whitelists/admin_add.ctp old mode 100644 new mode 100755 diff --git a/app/View/Whitelists/admin_view.ctp b/app/View/Whitelists/admin_view.ctp old mode 100644 new mode 100755 diff --git a/app/files/empty b/app/files/empty old mode 100644 new mode 100755 diff --git a/app/index.php b/app/index.php old mode 100644 new mode 100755 diff --git a/build/Makefile b/build/Makefile old mode 100644 new mode 100755 diff --git a/build/patches/app_Config_bootstrap.php.diff b/build/patches/app_Config_bootstrap.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_Config_core.php.diff b/build/patches/app_Config_core.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_Config_database.php.diff b/build/patches/app_Config_database.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_Config_email.php.diff b/build/patches/app_Config_email.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_Config_routes.php.diff b/build/patches/app_Config_routes.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_Controller_AppController.php.diff b/build/patches/app_Controller_AppController.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_Controller_PagesController.php.diff b/build/patches/app_Controller_PagesController.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_View_Helper_AppHelper.php.diff b/build/patches/app_View_Helper_AppHelper.php.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_View_Layouts_Emails_html_default.ctp.diff b/build/patches/app_View_Layouts_Emails_html_default.ctp.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_View_Layouts_Emails_text_default.ctp.2.1.3.diff b/build/patches/app_View_Layouts_Emails_text_default.ctp.2.1.3.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_View_Layouts_Emails_text_default.ctp.diff b/build/patches/app_View_Layouts_Emails_text_default.ctp.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_View_Layouts_default.ctp.diff b/build/patches/app_View_Layouts_default.ctp.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_webroot_css_cake.generic.css.diff b/build/patches/app_webroot_css_cake.generic.css.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_webroot_css_cake.generic.css.unclean.diff b/build/patches/app_webroot_css_cake.generic.css.unclean.diff old mode 100644 new mode 100755 diff --git a/build/patches/app_webroot_index.php.diff b/build/patches/app_webroot_index.php.diff old mode 100644 new mode 100755 diff --git a/plugins/empty b/plugins/empty old mode 100644 new mode 100755