diff options
author | Andy Wermke <andy@dev.next-step-software.com> | 2013-04-04 16:10:23 +0200 |
---|---|---|
committer | Andy Wermke <andy@dev.next-step-software.com> | 2013-04-04 16:10:23 +0200 |
commit | 92cd7f34b07e86062f2c024039e3309768b48ce6 (patch) | |
tree | 63b9f39280ebcab80742d9f2b4db6a139c1791e1 /plugins/database_attachments | |
parent | 029d18f13bcf01aa2f1f08dbdfc6400c081bf7cb (diff) | |
parent | 443b92a7ee19e321b350750240e0fc54ec5be357 (diff) |
Merge branch 'master' of https://github.com/roundcube/roundcubemail
Diffstat (limited to 'plugins/database_attachments')
-rw-r--r-- | plugins/database_attachments/database_attachments.php | 10 | ||||
-rw-r--r-- | plugins/database_attachments/tests/DatabaseAttachments.php | 23 |
2 files changed, 28 insertions, 5 deletions
diff --git a/plugins/database_attachments/database_attachments.php b/plugins/database_attachments/database_attachments.php index 079f4e567..2511dbbb2 100644 --- a/plugins/database_attachments/database_attachments.php +++ b/plugins/database_attachments/database_attachments.php @@ -46,7 +46,7 @@ class database_attachments extends filesystem_attachments $data = base64_encode($data); $status = $rcmail->db->query( - "INSERT INTO ".get_table_name('cache') + "INSERT INTO ".$rcmail->db->table_name('cache') ." (created, user_id, cache_key, data)" ." VALUES (".$rcmail->db->now().", ?, ?, ?)", $_SESSION['user_id'], @@ -82,7 +82,7 @@ class database_attachments extends filesystem_attachments $data = base64_encode($args['data']); $status = $rcmail->db->query( - "INSERT INTO ".get_table_name('cache') + "INSERT INTO ".$rcmail->db->table_name('cache') ." (created, user_id, cache_key, data)" ." VALUES (".$rcmail->db->now().", ?, ?, ?)", $_SESSION['user_id'], @@ -106,7 +106,7 @@ class database_attachments extends filesystem_attachments $args['status'] = false; $rcmail = rcmail::get_instance(); $status = $rcmail->db->query( - "DELETE FROM ".get_table_name('cache') + "DELETE FROM ".$rcmail->db->table_name('cache') ." WHERE user_id = ?" ." AND cache_key = ?", $_SESSION['user_id'], @@ -139,7 +139,7 @@ class database_attachments extends filesystem_attachments $sql_result = $rcmail->db->query( "SELECT data" - ." FROM ".get_table_name('cache') + ." FROM ".$rcmail->db->table_name('cache') ." WHERE user_id=?" ." AND cache_key=?", $_SESSION['user_id'], @@ -161,7 +161,7 @@ class database_attachments extends filesystem_attachments $prefix = $this->cache_prefix . $args['group']; $rcmail = rcmail::get_instance(); $rcmail->db->query( - "DELETE FROM ".get_table_name('cache') + "DELETE FROM ".$rcmail->db->table_name('cache') ." WHERE user_id = ?" ." AND cache_key LIKE '{$prefix}%'", $_SESSION['user_id']); diff --git a/plugins/database_attachments/tests/DatabaseAttachments.php b/plugins/database_attachments/tests/DatabaseAttachments.php new file mode 100644 index 000000000..f260737ab --- /dev/null +++ b/plugins/database_attachments/tests/DatabaseAttachments.php @@ -0,0 +1,23 @@ +<?php + +class DatabaseAttachments_Plugin extends PHPUnit_Framework_TestCase +{ + + function setUp() + { + include_once dirname(__FILE__) . '/../database_attachments.php'; + } + + /** + * Plugin object construction test + */ + function test_constructor() + { + $rcube = rcube::get_instance(); + $plugin = new database_attachments($rcube->api); + + $this->assertInstanceOf('database_attachments', $plugin); + $this->assertInstanceOf('rcube_plugin', $plugin); + } +} + |