$size = getimagesize($file); if (preg_match('/(png|jpg|jpeg|gif)/', $mime, $match)) { $match[0] = $match[0] == 'jpeg' ? 'jpg' : $match[0]; $new_name = $file . '.' . $match[0]; chmod($file, chmod_writable()); rename($file, $new_name); chmod($new_name, chmod_writable()); } $file_name = preg_replace('/..\\/images\\/logos\\//', '', $file); $new_file_name = preg_replace('/..\\/images\\/logos\\//', '', $new_name); if ($file_name == $v4config['skinDir']) { $db->insert('CubeCart_logo', array('status' => 1, 'filename' => $new_file_name, 'mimetype' => $mime, 'width' => $size[0], 'height' => $size[1])); } } } build_logos($new_file_name); ## Remap category images if ($indexes = $db->select('CubeCart_category', array('cat_id', 'cat_image'))) { foreach ($indexes as $index) { if (empty($index['cat_image'])) { continue; } $filename = basename($index['cat_image']); $filepath = str_replace($filename, '', $index['cat_image']); unset($where); if (empty($filepath)) { $where = "`filepath` IS NULL AND `filename` = '{$filename}'"; } else { $where['filepath'] = $filepath; $where['filename'] = $filename; }
$active_currencies = array_merge(array('AUD', 'CAD', 'EUR', 'GBP', 'JPY', 'USD'), array($config['default_currency'])); foreach ($fx as $code => $rate) { $value = $base / (1 / $rate); $active_currency = in_array($code, $active_currencies) ? true : false; $GLOBALS['db']->update('CubeCart_currency', array('value' => $value, 'lastUpdated' => $updated, 'active' => $active_currency), array('code' => $code), true); } } } catch (Exception $e) { trigger_error('Error parsing ECB Exchange Rates.', E_USER_WARNING); } $default_docs = array(0 => array('doc_name' => $strings['setup']['default_doc_title_welcome'], 'doc_content' => $strings['setup']['default_doc_content_welcome'], 'doc_order' => 1, 'doc_lang' => $config['default_language'], 'doc_home' => 1, 'doc_terms' => 0), 1 => array('doc_name' => $strings['setup']['default_doc_title_about'], 'doc_content' => $strings['setup']['default_doc_content'], 'doc_order' => 2, 'doc_lang' => $config['default_language'], 'doc_home' => 0, 'doc_terms' => 0), 2 => array('doc_name' => $strings['setup']['default_doc_title_terms'], 'doc_content' => $strings['setup']['default_doc_content'], 'doc_order' => 3, 'doc_lang' => $config['default_language'], 'doc_home' => 0, 'doc_terms' => 1), 3 => array('doc_name' => $strings['setup']['default_doc_title_privacy'], 'doc_content' => $strings['setup']['default_doc_content'], 'doc_order' => 4, 'doc_lang' => $config['default_language'], 'doc_home' => 0, 'doc_terms' => 0), 4 => array('doc_name' => 'Returns Policy', 'doc_content' => $strings['setup']['default_doc_content'], 'doc_order' => 5, 'doc_lang' => $config['default_language'], 'doc_home' => 0, 'doc_terms' => 0)); foreach ($default_docs as $default_doc) { $GLOBALS['db']->insert('CubeCart_documents', $default_doc); } $contact_form = base64_encode(json_encode(array('status' => 1, 'email' => $_SESSION['setup']['admin']['email'], 'description' => ''))); $GLOBALS['db']->insert('CubeCart_config', array('name' => 'Contact_Form', 'array' => $contact_form)); // Install email templates based on all languages if (is_array($languages)) { foreach ($languages as $code => $lang) { $language->importEmail('email_' . $code . '.xml'); } } // Set version number $GLOBALS['db']->insert('CubeCart_history', array('version' => CC_VERSION, 'time' => time())); build_logos(); $_SESSION['setup']['complete'] = true; httpredir('index.php'); } } $GLOBALS['smarty']->assign('MODE_INSTALL', true); }