summaryrefslogtreecommitdiff
path: root/plugins/enigma
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-06 12:23:27 +0200
committerAleksander Machniak <alec@alec.pl>2013-05-06 12:25:46 +0200
commit187cf5e1cdee87fb1d26599f93202222bb7b8a4b (patch)
tree4a7234c9aa38f71607be3ca861610b870e56ef8d /plugins/enigma
parent78c270c9f259c33b703cfb26b96b8dbb062db21e (diff)
Fix various PHP code bugs found using static analysis (#1489086)
Conflicts: plugins/enigma/enigma.php plugins/enigma/lib/enigma_engine.php
Diffstat (limited to 'plugins/enigma')
-rw-r--r--plugins/enigma/enigma.php3
-rw-r--r--plugins/enigma/lib/enigma_engine.php18
2 files changed, 9 insertions, 12 deletions
diff --git a/plugins/enigma/enigma.php b/plugins/enigma/enigma.php
index a4009ce26..257935518 100644
--- a/plugins/enigma/enigma.php
+++ b/plugins/enigma/enigma.php
@@ -47,6 +47,8 @@ class enigma extends rcube_plugin
$rcmail = rcmail::get_instance();
$this->rc = $rcmail;
+ $section = rcube_utils::get_input_value('_section', rcube_utils::INPUT_GET);
+
if ($this->rc->task == 'mail') {
// message parse/display hooks
$this->add_hook('message_part_structure', array($this, 'parse_structure'));
@@ -79,7 +81,6 @@ class enigma extends rcube_plugin
$this->register_action('plugin.enigma', array($this, 'preferences_ui'));
// grab keys/certs management iframe requests
- $section = get_input_value('_section', RCUBE_INPUT_GET);
if ($this->rc->action == 'edit-prefs' && preg_match('/^enigma(certs|keys)/', $section)) {
$this->load_ui();
$this->ui->init($section);
diff --git a/plugins/enigma/lib/enigma_engine.php b/plugins/enigma/lib/enigma_engine.php
index 89cb4b796..2e0e4646e 100644
--- a/plugins/enigma/lib/enigma_engine.php
+++ b/plugins/enigma/lib/enigma_engine.php
@@ -374,17 +374,15 @@ class enigma_engine
{
// @TODO: Handle big bodies using (temp) files
// @TODO: caching of verification result
-
- $sig = $this->pgp_driver->verify($msg_body, $sig_body);
+ $sig = $this->pgp_driver->verify($msg_body, $sig_body);
- if (($sig instanceof enigma_error) && $sig->getCode() != enigma_error::E_KEYNOTFOUND)
- raise_error(array(
+ if (($sig instanceof enigma_error) && $sig->getCode() != enigma_error::E_KEYNOTFOUND)
+ rcube::raise_error(array(
'code' => 600, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
- 'message' => "Enigma plugin: " . $error->getMessage()
+ 'message' => "Enigma plugin: " . $sig->getMessage()
), true, false);
-//print_r($sig);
return $sig;
}
@@ -399,11 +397,9 @@ class enigma_engine
{
// @TODO: Handle big bodies using (temp) files
// @TODO: caching of verification result
-
+ $key = ''; $pass = ''; // @TODO
$result = $this->pgp_driver->decrypt($msg_body, $key, $pass);
-//print_r($result);
-
if ($result instanceof enigma_error) {
$err_code = $result->getCode();
if (!in_array($err_code, array(enigma_error::E_KEYNOTFOUND, enigma_error::E_BADPASS)))
@@ -430,7 +426,7 @@ class enigma_engine
{
$this->load_pgp_driver();
$result = $this->pgp_driver->list_keys($pattern);
-
+
if ($result instanceof enigma_error) {
raise_error(array(
'code' => 600, 'type' => 'php',
@@ -438,7 +434,7 @@ class enigma_engine
'message' => "Enigma plugin: " . $result->getMessage()
), true, false);
}
-
+
return $result;
}