roundcubemail/program/lib/Roundcube/rcube_spellchecker.php
private function load_dict()
    {
        if (is_array($this->dict)) {
            return $this->dict;
        }

        if (strcasecmp($this->options['dictionary'], 'shared') != 0) {
            $userid = $this->rc->get_user_id();
        }

        $plugin = $this->rc->plugins->exec_hook('spell_dictionary_get', array(
            'userid' => $userid, 'language' => $this->lang, 'dictionary' => array()));

        if (empty($plugin['abort'])) {
            $dict = array();
            $sql_result = $this->rc->db->query(
                "SELECT `data` FROM " . $this->rc->db->table_name('dictionary', true)
                ." WHERE `user_id` ". ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                    ." AND `language` = ?",
                $plugin['language']);

            if ($sql_arr = $this->rc->db->fetch_assoc($sql_result)) {
                $this->have_dict = true;
                if (!empty($sql_arr['data'])) {
                    $dict = explode(' ', $sql_arr['data']);
                }
            }

            $plugin['dictionary'] = array_merge((array)$plugin['dictionary'], $dict);
        }

        if (!empty($plugin['dictionary']) && is_array($plugin['dictionary'])) {
            $this->dict = $plugin['dictionary'];
        }
        else {
            $this->dict = array();
        }

        return $this->dict;
    }
private function load_dict()
    {
        if (is_array($this->dict)) {
            return $this->dict;
        }

        if (strcasecmp($this->options['dictionary'], 'shared') != 0) {
            $userid = $this->rc->get_user_id();
        }

        $plugin = $this->rc->plugins->exec_hook('spell_dictionary_get', array(
            'userid' => $userid, 'language' => $this->lang, 'dictionary' => array()));

        if (empty($plugin['abort'])) {
            $dict = array();
            $sql_result = $this->rc->db->query(
                "SELECT `data` FROM " . $this->rc->db->table_name('dictionary', true)
                ." WHERE `user_id` ". ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                    ." AND `language` = ?",
                $plugin['language']);

            if ($sql_arr = $this->rc->db->fetch_assoc($sql_result)) {
                $this->have_dict = true;
                if (!empty($sql_arr['data'])) {
                    $dict = explode(' ', $sql_arr['data']);
                }
            }

            $plugin['dictionary'] = array_merge((array)$plugin['dictionary'], $dict);
        }

        if (!empty($plugin['dictionary']) && is_array($plugin['dictionary'])) {
            $this->dict = $plugin['dictionary'];
        }
        else {
            $this->dict = array();
        }

        return $this->dict;
    }
private function load_dict ( ) { if ( is_array ( $ this -> dict ) ) { return $ this -> dict ; } if ( strcasecmp ( $ this -> options [ 'dictionary' ] , 'shared' ) != 0 ) { $ userid = $ this -> rc -> get_user_id ( ) ; } $ plugin = $ this -> rc -> plugins -> exec_hook ( 'spell_dictionary_get' , array ( 'userid' => $ userid , 'language' => $ this -> lang , 'dictionary' => array ( ) ) ) ; if ( empty ( $ plugin [ 'abort' ] ) ) { $ dict = array ( ) ; $ sql_result = $ this -> rc -> db -> query ( "SELECT `data` FROM " . $ this -> rc -> db -> table_name ( 'dictionary' , true ) . " WHERE `user_id` " . ( $ plugin [ 'userid' ] ? "= " . $ this -> rc -> db -> quote ( $ plugin [ 'userid' ] ) : "IS NULL" ) . " AND `language` = ?" , $ plugin [ 'language' ] ) ; if ( $ sql_arr = $ this -> rc -> db -> fetch_assoc ( $ sql_result ) ) { $ this -> have_dict = true ; if ( ! empty ( $ sql_arr [ 'data' ] ) ) { $ dict = explode ( ' ' , $ sql_arr [ 'data' ] ) ; } } $ plugin [ 'dictionary' ] = array_merge ( ( array ) $ plugin [ 'dictionary' ] , $ dict ) ; } if ( ! empty ( $ plugin [ 'dictionary' ] ) && is_array ( $ plugin [ 'dictionary' ] ) ) { $ this -> dict = $ plugin [ 'dictionary' ] ; } else { $ this -> dict = array ( ) ; } return $ this -> dict ; }
Get dictionary from DB
Get dictionary from DB