Ejemplo n.º 1
0
 public static function mveProcessImages($store_data)
 {
     $skin_name = $store_data['skin_name'];
     $exclude_files = array('.htaccess', 'index.php');
     $img_path_info = Registry::get('config.storage.images');
     fn_copy($store_data['path'] . '/images', $img_path_info['dir'] . '/' . $img_path_info['prefix'], true, $exclude_files);
     $logos_exist = db_get_array("SELECT image_id FROM ?:images_links WHERE object_type = 'logos'");
     if (!$logos_exist) {
         $root_manifest = parse_ini_file($store_data['path'] . '/skins/' . $skin_name . '/manifest.ini', true);
         $layout_id = db_get_field("SELECT layout_id FROM ?:bm_layouts WHERE is_default = '1'");
         $root_company_logo_path = $store_data['path'] . '/skins/' . $skin_name . '/customer/images/' . $root_manifest['Customer_logo']['filename'];
         General::createLogo(0, $layout_id, $root_manifest['Customer_logo']['filename'], $root_company_logo_path, 'theme', 'Customer_logo');
         $root_company_favicon_img_path = $store_data['path'] . '/skins/' . $skin_name . '/customer/images/icons/favicon.ico';
         General::createLogo(0, $layout_id, 'favicon.ico', $root_company_favicon_img_path, 'favicon');
         $root_company_mail_img_path = $store_data['path'] . '/skins/' . $skin_name . '/mail/images/' . $root_manifest['Mail_logo']['filename'];
         General::createLogo(0, 0, $root_manifest['Mail_logo']['filename'], $root_company_mail_img_path, 'mail', 'Mail_logo');
         if (isset($root_manifest['Gift_certificate_logo'])) {
             $root_company_gc_img_path = $store_data['path'] . '/skins/' . $skin_name . '/mail/images/' . $root_manifest['Gift_certificate_logo']['filename'];
             General::createLogo(0, 0, $root_manifest['Gift_certificate_logo']['filename'], $root_company_gc_img_path, 'gift_cert', 'Gift_certificate_logo');
         }
         $company_data = db_get_array("SELECT company_id, logos FROM ?:companies");
         foreach ($company_data as $company) {
             $manifest = !empty($company['logos']) ? unserialize($company['logos']) : array();
             $theme_img_path = !empty($manifest['Customer_logo']) ? $store_data['path'] . '/images/' . $manifest['Customer_logo']['filename'] : $root_company_logo_path;
             $theme_name = !empty($manifest['Customer_logo']) ? $manifest['Customer_logo']['filename'] : $root_manifest['Customer_logo']['filename'];
             General::createLogo($company['company_id'], 0, fn_basename($theme_name), $theme_img_path, 'theme', 'Customer_logo');
             $mail_img_path = !empty($manifest['Mail_logo']) ? $store_data['path'] . '/images/' . $manifest['Mail_logo']['filename'] : $root_company_mail_img_path;
             $mail_logo_name = !empty($manifest['Mail_logo']) ? $manifest['Mail_logo']['filename'] : $root_manifest['Mail_logo']['filename'];
             General::createLogo($company['company_id'], 0, fn_basename($mail_logo_name), $mail_img_path, 'mail', 'Mail_logo');
             if (isset($root_manifest['Gift_certificate_logo'])) {
                 $gc_img_path = !empty($manifest['Gift_certificate_logo']) ? $store_data['path'] . '/images/' . $manifest['Gift_certificate_logo']['filename'] : $root_company_gc_img_path;
                 $gc_name = !empty($manifest['Gift_certificate_logo']) ? $manifest['Gift_certificate_logo']['filename'] : $root_manifest['Gift_certificate_logo']['filename'];
                 General::createLogo($company['company_id'], 0, fn_basename($gc_name), $gc_img_path, 'gift_cert', 'Gift_certificate_logo');
             }
         }
         db_query("DELETE FROM ?:common_descriptions WHERE object_holder IN ('Customer_logo', 'Mail_logo', 'Admin_logo', 'Gift_certificate_logo')");
     }
     return true;
 }
Ejemplo n.º 2
0
 protected function _processImages($skin_name)
 {
     $store_data = $this->store_data;
     $img_path_info = Registry::get('config.storage.images');
     fn_copy($store_data['path'] . '/images', $img_path_info['dir'] . '/' . $img_path_info['prefix'], true, $this->exclude_files);
     //process logos
     $logos_exist = db_get_array("SELECT image_id FROM ?:images_links WHERE object_type = 'logos'");
     if (!$logos_exist) {
         $companies = db_get_fields("SELECT company_id FROM ?:companies");
         foreach ($companies as $company_id) {
             $layout_id = db_get_field("SELECT layout_id FROM ?:bm_layouts WHERE is_default = '1' AND company_id = ?i", $company_id);
             $manifest_path = $store_data['path'] . '/stores/' . $company_id . '/skins/' . $skin_name . '/manifest.ini';
             if (!file_exists($manifest_path)) {
                 //hack for the upgrade from PRO versions.
                 $manifest_path = $store_data['path'] . '/skins/' . $skin_name . '/manifest.ini';
             }
             $manifest = parse_ini_file($manifest_path, true);
             $theme_img_path = $store_data['path'] . '/stores/' . $company_id . '/skins/' . $skin_name . '/customer/images/' . $manifest['Customer_logo']['filename'];
             if (!file_exists($theme_img_path)) {
                 $theme_img_path = $store_data['path'] . '/skins/' . $skin_name . '/customer/images/' . $manifest['Customer_logo']['filename'];
             }
             General::createLogo($company_id, $layout_id, $manifest['Customer_logo']['filename'], $theme_img_path, 'theme', 'Customer_logo');
             $favicon_img_path = $store_data['path'] . '/stores/' . $company_id . '/skins/' . $skin_name . '/customer/images/icons/favicon.ico';
             if (!file_exists($favicon_img_path)) {
                 $favicon_img_path = $store_data['path'] . '/skins/' . $skin_name . '/customer/images/icons/favicon.ico';
             }
             General::createLogo($company_id, $layout_id, 'favicon.ico', $favicon_img_path, 'favicon');
             $mail_img_path = $store_data['path'] . '/stores/' . $company_id . '/skins/' . $skin_name . '/mail/images/' . $manifest['Mail_logo']['filename'];
             if (!file_exists($mail_img_path)) {
                 $mail_img_path = $store_data['path'] . '/skins/' . $skin_name . '/mail/images/' . $manifest['Mail_logo']['filename'];
             }
             General::createLogo($company_id, 0, $manifest['Mail_logo']['filename'], $mail_img_path, 'mail', 'Mail_logo');
             if (isset($manifest['Gift_certificate_logo'])) {
                 $gc_img_path = $store_data['path'] . '/stores/' . $company_id . '/skins/' . $skin_name . '/mail/images/' . $manifest['Gift_certificate_logo']['filename'];
                 if (!file_exists($gc_img_path)) {
                     $gc_img_path = $store_data['path'] . '/skins/' . $skin_name . '/mail/images/' . $manifest['Gift_certificate_logo']['filename'];
                 }
                 General::createLogo($company_id, 0, $manifest['Gift_certificate_logo']['filename'], $gc_img_path, 'gift_cert', 'Gift_certificate_logo');
             }
         }
         db_query("DELETE FROM ?:common_descriptions WHERE object_holder IN ('Customer_logo', 'Mail_logo', 'Admin_logo', 'Gift_certificate_logo')");
     }
     return true;
 }