Example #1
0
}
$db = cge_utils::get_db();
$taboptarray = array('mysql' => 'TYPE=MyISAM');
$dict = NewDataDictionary($db);
// tables
$flds = "id   I KEY AUTO,\n         code C(2) KEY,\n         name C(50),\n         sorting I DEFAULT 0";
$sqlarray = $dict->CreateTableSQL(CGEXTENSIONS_TABLE_COUNTRIES, $flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
$sqlarray = $dict->CreateTableSQL(CGEXTENSIONS_TABLE_STATES, $flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
$flds = "id I KEY AUTO,\n         key1 C(255),\n         key2 C(255),\n         key3 C(255),\n         key4 C(255),\n         data X,\n         type C(20),\n         expiry C(20),\n         create_date " . CMS_ADODB_DT . ",\n         modified_date " . CMS_ADODB_DT;
$sqlarray = $dict->CreateTableSQL(CGEXTENSIONS_TABLE_ASSOCDATA, $flds, $taboptarray);
$dict->ExecuteSQLArray($sqlarray);
// default content
\CGExtensions\internals::reset_countries();
\CGExtensions\internals::reset_states();
// Preferences
$this->SetPreference('imageextensions', 'jpg,png,gif');
$this->SetPreference('thumbnailsize', 75);
$this->SetPreference('watermark_text', get_site_preference('sitename', 'CMSMS Site'));
$this->SetPreference('watermark_textsize', 12);
$this->SetPreference('watermark_angle', 0);
$this->SetPreference('watermark_font', 'ARIAL.TTF');
$this->SetPreference('watermark_bgcolor', '#FFFFFF');
$this->SetPreference('watermark_textcolor', '#000000');
$this->SetPreference('watermark_transparent', 1);
// templates
$this->ResetErrorTemplate();
$fn = dirname(__FILE__) . '/templates/orig_sortablelist_template.tpl';
if (file_exists($fn)) {
    $template = @file_get_contents($fn);
                        if (isset($params['submit_countries'])) {
                            $this->_current_tab = 'countries';
                            $countries = $parse_text_options($params['country_list']);
                            if (count($countries)) {
                                $query = 'TRUNCATE TABLE ' . CGEXTENSIONS_TABLE_COUNTRIES;
                                $db->Execute($query);
                                $query = 'INSERT INTO ' . CGEXTENSIONS_TABLE_COUNTRIES . ' (code,name,sorting) VALUES (?,?,?)';
                                $sorting = 1;
                                foreach ($countries as $code => $name) {
                                    $db->Execute($query, array($code, $name, $sorting++));
                                }
                            }
                        } else {
                            if (isset($params['reset_countries'])) {
                                $this->_current_tab = 'countries';
                                \CGExtensions\internals::reset_countries();
                            } else {
                                if (isset($params['submit'])) {
                                    $this->_current_tab = 'general';
                                    $this->SetPreference('assume_memory_limit', trim($params['assume_memory_limit']));
                                    $this->SetPreference('alloweduploadfiles', trim($params['alloweduploadfiles']));
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
if ($this->CheckPermission('Modify Modules')) {