From 1495ac7913095ae8284c3501b7d4e6dd31a484ec Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sat, 14 Apr 2012 07:15:28 -0400
Subject: [PATCH] - More public methods, code cleanup

---
 program/include/rcube_spellchecker.php |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/program/include/rcube_spellchecker.php b/program/include/rcube_spellchecker.php
index a6f3913..8dfc3ea 100644
--- a/program/include/rcube_spellchecker.php
+++ b/program/include/rcube_spellchecker.php
@@ -61,7 +61,7 @@
         $this->lang   = $lang ? $lang : 'en';
 
         if ($this->engine == 'pspell' && !extension_loaded('pspell')) {
-            raise_error(array(
+            rcube::raise_error(array(
                 'code' => 500, 'type' => 'php',
                 'file' => __FILE__, 'line' => __LINE__,
                 'message' => "Pspell extension not available"), true, true);
@@ -535,7 +535,7 @@
     private function update_dict()
     {
         if (strcasecmp($this->options['dictionary'], 'shared') != 0) {
-            $userid = (int) $this->rc->user->ID;
+            $userid = $this->rc->get_user_id();
         }
 
         $plugin = $this->rc->plugins->exec_hook('spell_dictionary_save', array(
@@ -548,24 +548,24 @@
         if ($this->have_dict) {
             if (!empty($this->dict)) {
                 $this->rc->db->query(
-                    "UPDATE ".get_table_name('dictionary')
+                    "UPDATE ".$this->rc->db->table_name('dictionary')
                     ." SET data = ?"
-                    ." WHERE user_id " . ($plugin['userid'] ? "= ".$plugin['userid'] : "IS NULL")
+                    ." WHERE user_id " . ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                         ." AND " . $this->rc->db->quoteIdentifier('language') . " = ?",
                     implode(' ', $plugin['dictionary']), $plugin['language']);
             }
             // don't store empty dict
             else {
                 $this->rc->db->query(
-                    "DELETE FROM " . get_table_name('dictionary')
-                    ." WHERE user_id " . ($plugin['userid'] ? "= ".$plugin['userid'] : "IS NULL")
+                    "DELETE FROM " . $this->rc->db->table_name('dictionary')
+                    ." WHERE user_id " . ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                         ." AND " . $this->rc->db->quoteIdentifier('language') . " = ?",
                     $plugin['language']);
             }
         }
         else if (!empty($this->dict)) {
             $this->rc->db->query(
-                "INSERT INTO " .get_table_name('dictionary')
+                "INSERT INTO " .$this->rc->db->table_name('dictionary')
                 ." (user_id, " . $this->rc->db->quoteIdentifier('language') . ", data) VALUES (?, ?, ?)",
                 $plugin['userid'], $plugin['language'], implode(' ', $plugin['dictionary']));
         }
@@ -582,7 +582,7 @@
         }
 
         if (strcasecmp($this->options['dictionary'], 'shared') != 0) {
-            $userid = (int) $this->rc->user->ID;
+            $userid = $this->rc->get_user_id();
         }
 
         $plugin = $this->rc->plugins->exec_hook('spell_dictionary_get', array(
@@ -591,8 +591,8 @@
         if (empty($plugin['abort'])) {
             $dict = array();
             $this->rc->db->query(
-                "SELECT data FROM ".get_table_name('dictionary')
-                ." WHERE user_id ". ($plugin['userid'] ? "= ".$plugin['userid'] : "IS NULL")
+                "SELECT data FROM ".$this->rc->db->table_name('dictionary')
+                ." WHERE user_id ". ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                     ." AND " . $this->rc->db->quoteIdentifier('language') . " = ?",
                 $plugin['language']);
 

--
Gitblit v1.9.1