コード例 #1
0
ファイル: language.php プロジェクト: siddht1/abantecart-src
 /**
  * @param array $data
  */
 protected function _write_missing_definition($data)
 {
     $update_data = array();
     if ($this->is_admin) {
         $this->loader->model('localisation/language_definitions');
         $model = $this->registry->get('model_localisation_language_definitions');
         $model->addLanguageDefinition($data);
     } else {
         foreach ($data as $key => $val) {
             $update_data[$this->db->escape($key)] = $this->db->escape($val);
         }
         if (!$this->_is_definition_in_db($update_data)) {
             $sql = "INSERT INTO " . DB_PREFIX . "language_definitions\n                                (`" . implode("`, `", array_keys($update_data)) . "`)\n                                VALUES ('" . implode("', '", $update_data) . "') ";
             $this->db->query($sql);
             $this->cache->remove('localization');
             $this->cache->remove('storefront_menu');
         }
     }
     if ($this->registry->get('config')->get('warn_lang_text_missing')) {
         $this->registry->get('messages')->saveNotice('Missing language definition "' . $data['language_key'] . '" was loaded for "' . $this->available_languages[$this->code]['name'] . '" language', 'Missing language definition with key "' . $data['language_key'] . '" for block "' . $data['block'] . '" was automatically added. Please check this at #admin#rt=localisation/language_definitions to see or change value.');
     }
 }
コード例 #2
0
ファイル: install.php プロジェクト: siddht1/abantecart-src
 public function RunSQL($data)
 {
     $db = new ADB($data['db_driver'], $data['db_host'], $data['db_user'], $data['db_password'], $data['db_name']);
     $file = DIR_APP_SECTION . 'abantecart_database.sql';
     if ($sql = file($file)) {
         $query = '';
         foreach ($sql as $line) {
             $tsl = trim($line);
             if ($sql != '' && substr($tsl, 0, 2) != "--" && substr($tsl, 0, 1) != '#') {
                 $query .= $line;
                 if (preg_match('/;\\s*$/', $line)) {
                     $query = str_replace("DROP TABLE IF EXISTS `ac_", "DROP TABLE IF EXISTS `" . $data['db_prefix'], $query);
                     $query = str_replace("CREATE TABLE `ac_", "CREATE TABLE `" . $data['db_prefix'], $query);
                     $query = str_replace("INSERT INTO `ac_", "INSERT INTO `" . $data['db_prefix'], $query);
                     $query = str_replace("ON `ac_", "ON `" . $data['db_prefix'], $query);
                     $db->query($query);
                     //no silence mode! if error - will throw to exception
                     $query = '';
                 }
             }
         }
         $db->query("SET CHARACTER SET utf8;");
         $db->query("SET @@session.sql_mode = 'MYSQL40';");
         $db->query("INSERT INTO `" . $data['db_prefix'] . "users`\n\t\t\t\tSET user_id = '1',\n\t\t\t\t\tuser_group_id = '1',\n\t\t\t\t\temail = '" . $db->escape($data['email']) . "',\n\t\t\t\t    username = '******'username']) . "',\n\t\t\t\t    password = '******'password'])) . "',\n\t\t\t\t    status = '1',\n\t\t\t\t    date_added = NOW();");
         $db->query("UPDATE `" . $data['db_prefix'] . "settings` SET value = '" . $db->escape($data['email']) . "' WHERE `key` = 'store_main_email'; ");
         $db->query("UPDATE `" . $data['db_prefix'] . "settings` SET value = '" . $db->escape(HTTP_ABANTECART) . "' WHERE `key` = 'config_url'; ");
         $db->query("INSERT INTO `" . $data['db_prefix'] . "settings` SET `group` = 'config', `key` = 'install_date', value = NOW(); ");
         $db->query("UPDATE `" . $data['db_prefix'] . "products` SET `viewed` = '0';");
         //process triggers
         //$this->create_triggers($db, $data['db_name']);
         //run descructor and close db-connection
         unset($db);
     }
     //clear cache dir in case of reinstall
     $cache = new ACache();
     $cache->remove('*');
 }
コード例 #3
0
ファイル: install.php プロジェクト: siddht1/abantecart-src
 public function _load_demo_data()
 {
     $reg = $this->_prepare_registry();
     $db = $reg->get('db');
     $db->query("SET NAMES 'utf8'");
     $db->query("SET CHARACTER SET utf8");
     $file = DIR_APP_SECTION . 'abantecart_sample_data.sql';
     if ($sql = file($file)) {
         $query = '';
         foreach ($sql as $line) {
             $tsl = trim($line);
             if ($sql != '' && substr($tsl, 0, 2) != "--" && substr($tsl, 0, 1) != '#') {
                 $query .= $line;
                 if (preg_match('/;\\s*$/', $line)) {
                     $query = str_replace("DROP TABLE IF EXISTS `ac_", "DROP TABLE IF EXISTS `" . DB_PREFIX, $query);
                     $query = str_replace("CREATE TABLE `ac_", "CREATE TABLE `" . DB_PREFIX, $query);
                     $query = str_replace("INSERT INTO `ac_", "INSERT INTO `" . DB_PREFIX, $query);
                     $result = $db->query($query);
                     if (!$result || $db->error) {
                         die($db->error . '<br>' . $query);
                     }
                     $query = '';
                 }
             }
         }
         $db->query("SET CHARACTER SET utf8");
         $db->query("SET @@session.sql_mode = 'MYSQL40'");
     }
     //clear earlier created cache by AConfig and ALanguage classes in previous step
     $cache = new ACache();
     $cache->remove('*');
     return null;
 }