<commit_before><?php
// vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker:             
// +-------------------------------------------------------------------------+
// | Author: <NAME> <<EMAIL>>                      |
// +-------------------------------------------------------------------------+
// $Id$
// ---------------------------------------------------------------------------

class Configuration extends Model 
{    
    // {{{ Properties

    var $tableName = 'core_configuration';

    // }}}    
    // {{{ setVar
    function setVar($name, $value, $namespace = Null)
    {
        if ($namespace == Null) {
            $namespace = $this->uri->router->fetch_module();
        }

        $this->db->select('value');
        $query = $this->db->getwhere($this->tableName, Array('name' => $name, 'namespace' => $namespace));

        // Serialize value
        if (get_magic_quotes_gpc() == True) {
            $value = serialize($value);
        } else {
            $value = serialize(addslashes($value));
        }        

        if ($query->num_rows() == 0){
            $this->db->insert($this->tableName, Array('name' => $name, 'namespace' => $namespace, 'value' => $value));<commit_msg>Database should be loaded in configuration model.<commit_after><?php
// vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker:             
// +-------------------------------------------------------------------------+
// | Author: <NAME> <<EMAIL>>                      |
// +-------------------------------------------------------------------------+
// $Id$
// ---------------------------------------------------------------------------

class Configuration extends Model 
{    
    // {{{ Properties

    var $tableName = 'core_configuration';

    // }}}
    // {{{ Constructor
    function Configuration()
    {
        parent::Model();

        $this->load->database();
    }
    // }}}
    // {{{ setVar
    function setVar($name, $value, $namespace = Null)
    {
        if ($namespace == Null) {
            $namespace = $this->uri->router->fetch_module();
        }

        $this->db->select('value');
        $query = $this->db->getwhere($this->tableName, Array('name' => $name, 'namespace' => $namespace));

        // Serialize value
        if (get_magic_quotes_gpc() == True) {
            $value = serialize($value);
        } else {
            $value = serialize(addslashes($value));
        }        

        if ($query->num_rows() == 0){
            $this->db->insert($this->tableName, Array('name' => $name, 'namespace' => $namespace, 'value' => $value));
{'fraction_non_alphanumeric': 0.3269230769230769, 'fraction_numerical': 0.002307692307692308, 'mean_word_length': 1.2461139896373057, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3495054', 'n_tokens_mistral': 663, 'n_tokens_neox': 649, 'n_words': 124}