Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php class Wyomind_Massstockupdate_Model_Import extends Mage_Core_Model_Abstract { ..

Decoded Output download

<?php 
class Wyomind_Massstockupdate_Model_Import extends Mage_Core_Model_Abstract 
{ 
    public $_warnings = []; 
    public $_notices = []; 
    public $_sql = []; 
    public $_columns = []; 
    public $_products = []; 
    public $_stocks = []; 
    public $_autoInc = 0; 
    public $_tables = []; 
    public $_total = false; 
    public $_is_in_stock = false; 
    public $x3e = false; 
    public $_output = []; 
    public $x3f = []; 
     
    protected $_parseError = []; 
     
    /** 
     *  
     * @var array 
     */ 
    protected $_evalLines; 
     
    public function _construct() 
    { 
        parent::_construct(); 
        $this->_init("massstockupdate/import"); 
    } 
     
    protected function _beforeSave() 
    { 
        $x40 = new Varien_Io_File(); 
        $x41 = $x40->getCleanPath(Mage::getBaseDir() . "/" . $this->getFilePath()); 
         
        if(!$x40->fileExists($x41, false)) { 
           
            Mage::throwException(Mage::helper("massstockupdate")->__("Wrong file path. '%s' is not a file.", $x41)); 
         
        } 
         
        if(stristr($this->getFilePath(), ".csv") === false) { 
         
            Mage::throwException(Mage::helper("massstockupdate")->__("Wrong file. '%s' is not a csv file.", $x41)); 
         
        } 
         
        if(!is_readable($x41)) { 
             
            Mage::throwException(Mage::helper("massstockupdate")->__("Please make sure that '%s' is readable by web-server.", $x41)); 
         
        } 
         
        return parent::_beforeSave(); 
    } 
     
    public function x82() 
    { 
        $this->_warnings = array(); 
        $this->_notices  = array(); 
        $this->_sql      = array(); 
        $this->_columns  = array(); 
        $this->_products = array(); 
        $this->_stocks   = array(); 
        $this->_autoInc  = 0; 
        $this->_tables   = array(); 
        $this->_total    = false; 
        $this->_output   = array(); 
    } 
     
    public function importProcess() 
    { 
        $x72 = "log"; 
        $x73 = "trim"; 
        $x74 = "json_decode"; 
        $x75 = "in_array"; 
        $x76 = "array_splice"; 
        $x77 = "array_unshift"; 
        $x78 = "str_replace"; 
        $x79 = "count"; 
        $x7a = "implode"; 
         
        Mage::$x72("-------------------- IMPORTATION PROCESS ---------------", null, "MassStockUpate.log"); 
        $this->x82(); 
        $x40 = new Varien_Io_File(); 
        $x41 = $x40->getCleanPath(Mage::getBaseDir() . "/" . $this->getFilePath()); 
        $x40->streamOpen($x41, "r"); 
        Mage::$x72("--> File opened : " . $x41, null, "MassStockUpate.log"); 
        $x42 = Mage::getModel("catalog/product")->getCollection()->addAttributeToSelect("sku"); 
         
        foreach ($x42 as $x43) { 
            if(!empty($x43->getSku())) { 
                $this->_products[$x73($x43->getSku())] = $x43->getId(); 
            } 
        } 
         
        Mage::$x72("--> Products collected", null, "MassStockUpate.log"); 
        if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory")) { 
            $x44 = Mage::getModel("advancedinventory/advancedinventoryproduct")->getCollection(); 
            foreach ($x44 as $x45) { 
                $this->_stocks[$x45->getProductId()] = $x45->getId(); 
            } 
            ; 
            Mage::$x72("--> Local stocks collected (Advanced Inventory)", null, "MassStockUpate.log"); 
        } 
         
        $x47                     = Mage::getSingleton("core/resource"); 
        $x48                     = $x47->getConnection("core_read"); 
        $this->_tables["csi"] = Mage::getSingleton("core/resource")->getTableName("cataloginventory_stock_item"); 
        if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory")) { 
            $this->_tables["aip"] = Mage::getSingleton("core/resource")->getTableName("advancedinventory_product"); 
            $this->_tables["ai"]     = Mage::getSingleton("core/resource")->getTableName("advancedinventory"); 
            $x49                        = "SELECT MAX(id) AS INC FROM " . $this->_tables["aip"] . " ;"; 
            $x4a                        = $x48->fetchAll($x49); 
            $this->_autoInc             = $x4a[0]["INC"]; 
            Mage::$x72("--> Max increment found #" . $x4a[0]["INC"] . "(Advanced Inventory)", null, "MassStockUpate.log"); 
        } 
         
        $x4c = $x74($this->getMapping()); 
        foreach ($x4c->columns as $x4d => $x4e) { 
            if (!$x75($x4e->id, array( 
                "not-used", 
                "total", 
                "is_in_stock", 
                "manage_local_stock" 
            ))) { 
                $this->_columns[] = $x4e->id; 
            } elseif ($x75($x4e->id, array( 
                "total" 
            ))) { 
                $this->_columns[] = "total"; 
                $this->_total     = $x4d + 1; 
            } elseif ($x75($x4e->id, array( 
                "is_in_stock" 
            ))) { 
                $this->_columns[]   = "is_in_stock"; 
                $this->_is_in_stock = $x4d + 1; 
            } elseif ($x75($x4e->id, array( 
                "manage_local_stock" 
            ))) { 
                $this->_columns[]          = "manage_local_stock"; 
                $this->_manage_local_stock = $x4d + 1; 
            } else { 
                $this->_columns[] = false; 
            } 
        } 
        Mage::$x72("--> Column mapping analyzed", null, "MassStockUpate.log"); 
         
        //Fix for array to string conversion 
        //No demo mode 
        $this->_demo = false; 
         
        Mage::$x72("--> Preparing MySql queries", null, "MassStockUpate.log"); 
        $x4f = $this->getSkuOffset() - 1; 
        $x50 = new Varien_Io_File(); 
        $x50->setAllowCreateFolders(true); 
        $x51 = "MassStockUpdate.tmp.sql"; 
        $x52 = "var/tmp"; 
        $x41 = $x40->getCleanPath(Mage::getBaseDir() . '/' . $x52); 
        if (!$x50->fileExists($x41, false)) { 
            Mage::throwException(Mage::helper('massstockupdate')->__('Please create the specified folder "%s".', $x41)); 
        } 
        if (!$x50->isWriteable($x41)) { 
            Mage::throwException(Mage::helper('massstockupdate')->__('Please make sure that "%s" is writable by web-server.', $x41)); 
        } 
        $x50->open(array( 
            'path' => $x52 
        )); 
        $x50->streamOpen($x51, 'w'); 
        if ($this->getAutoSetTotal() == 2) { 
            $x50->streamWrite("ALTER TABLE `" . $this->_tables["ai"] . "` DROP FOREIGN KEY `CONST_advancedinventory_localstock_id`; 
"); 
        } 
        if ($this->getFileEnclosure() != "none") { 
             
            while (false !== ($x53 = $x40->streamReadCsv($this->getFileSeparator(), $this->getFileEnclosure()))) { 
                $x54 = $x76($x53, $x4f, 1); 
                $x77($x53, $x54[0]); 
                $this->x83($x53); 
                foreach ($this->_sql as $x49) { 
                    $x50->streamWrite($x78(array( 
                        "
", 
                        "  " 
                    ), array( 
                        " ", 
                        "" 
                    ), $x73($x49)) . "
"); 
                } 
            } 
             
        } else { 
             
            while (false !== ($x53 = $x40->streamReadCsv($this->getFileSeparator()))) { 
                $x54 = $x76($x53, $x4f, 1); 
                $x77($x53, $x54[0]); 
                $this->x83($x53); 
                foreach ($this->_sql as $x49) { 
                    $x50->streamWrite($x78(array( 
                        "
", 
                        "  " 
                    ), array( 
                        " ", 
                        " " 
                    ), $x73($x49)) . "
"); 
                } 
            } 
             
        } 
        Mage::$x72("--> File closed : " . $x41, null, "MassStockUpate.log"); 
        $x40->streamClose(); 
        if ($this->getAutoSetTotal() == 2) { 
            $x50->streamWrite("ALTER  TABLE `" . $this->_tables["ai"] . "` ADD CONSTRAINT `CONST_advancedinventory_localstock_id` FOREIGN KEY (localstock_id) REFERENCES " . $this->_tables["aip"] . " (id) ON UPDATE CASCADE ON DELETE CASCADE;"); 
        } 
        $x50->streamClose(); 
        if ($x79($this->_warnings)) 
            Mage::getSingleton("core/session")->addError($x7a("<br>", ($this->_warnings))); 
        if (Mage::getStoreConfig("massstockupdate/settings/report_debug")) { 
            Mage::getSingleton("core/session")->addWarning("Debug mode enabled.No data have been updated.<br>MassStockUpate.log file has been created (log files must be enabled in system > configuration > developer)."); 
            return; 
        } 
        $x55 = Mage::getSingleton("core/resource")->getConnection("core_write"); 
        $x55->beginTransaction(); 
        $x56 = true; 
        Mage::$x72("--> Executing MySql queries", null, "MassStockUpate.log"); 
        $x40 = new Varien_Io_File(); 
        $x40->streamOpen($x41 . $x51, "r"); 
        while (false !== ($x49 = $x40->streamRead(102400))) { 
            try { 
                $x55->exec($x49); 
            } 
            catch (Mage_Core_Exception $x57) { 
                Mage::$x72(" failed -->" . $x49, null, "MassStockUpate.log"); 
                $x56 = false; 
            } 
            catch (Exception $x57) { 
                Mage::$x72(" failed -->" . $x49, null, "MassStockUpate.log"); 
                Mage::getSingleton("core/session")->addError($x57->getMessage()); 
                $x56 = false; 
            } 
        } 
        if (!$x56) { 
            Mage::$x72("--> MySql Rollback", null, "MassStockUpate.log"); 
            Mage::getSingleton("core/session")->addError(Mage::helper("massstockupdate")->__("Error while processing. Rollback happened.")); 
            $x55->rollback(); 
            return false; 
        } else { 
            Mage::$x72("--> MySql Commit", null, "MassStockUpate.log"); 
            $x55->commit(); 
            $this->setImportedAt(Mage::getSingleton("core/date")->gmtDate("Y-m-d H:i:s")); 
            $this->save(); 
            Mage::getSingleton('index/indexer')->getProcessByCode('cataloginventory_stock'); 
            Mage::$x72("--> Stock re-indexed", null, "MassStockUpate.log"); 
            $x40->open(array( 
                'path' => $x52 
            )); 
            $x40->rm($x51); 
            return true; 
        } 
    } 
     
    private function x83($x58) 
    { 
        $x72        = "log"; 
        $x75        = "in_array"; 
        $x77        = "array_unshift"; 
        $x79        = "count"; 
        $x7a        = "implode"; 
        $x7b        = "is_numeric"; 
        $x7c        = "array_push"; 
        $x7d        = "strtolower"; 
        $x7e        = "strstr"; 
        $x7f        = "explode"; 
        $x80        = "addslashes"; 
         
        $this->_sql = []; 
        foreach($x58 as $x59 => $x5a) { 
 
            $x58[$x59] = trim($x5a); 
     
        } 
         
        if($this->getUseCustomRules()) { 
             
            /** 
             * Commented by Vitapur 
             */ 
            //eval(str_replace('$C[', '$x58[', $this->getCustomRules())); 
             
            /** 
             * Added by Vitapur 
             */ 
            foreach($this->getEvalLines() as $l => $line) { 
                 
                try { 
                     
                    eval(str_replace('$C[', '$x58[', $line.';')); 
                     
                }catch(ParseError $e) { 
                  
                    if(!isset($this->_parseError[$l])) { 
                     
                        $this->_parseError[$l] = true; 
                         
                        Mage::$x72('--> Custom rules parse error at line '.($l + 1).': '.$line, null, "MassStockUpate.log"); 
                     
                    } 
                     
                } 
                 
            } 
             
        } 
         
        $x5c = array(); 
        $x5d = array(); 
        if (isset($this->_products[$x58[0]])) { 
            $x5e = $this->_products[$x58[0]]; 
            if (isset($this->_stocks[$x5e])) { 
                $x5f = $this->_stocks[$x5e]; 
            } else { 
                $this->_autoInc++; 
                $x5f = $this->_autoInc; 
            } 
            $x5c["ID"]                = $x5e; 
            $x60                         = true; 
            $x5c["status"]   = $x60; 
            $x5c["total"] = 0; 
            $x5c["in_stock"]    = null; 
            $x61                         = 0; 
            foreach ($x58 as $x4d => $x62) { 
                if (isset($this->_columns[$x4d - 1]) && $x4d > 0) { 
                    if (!$this->_total) { 
                        if ($x7b($x62) && $x60) { 
                            if ($this->_columns[$x4d - 1] != "total" && $this->_columns[$x4d - 1] != "is_in_stock" && ($this->_columns[$x4d - 1] == "used" || $x7b($this->_columns[$x4d - 1]))) 
                                $x5c["total"] += $x62; 
                            $x60 = true; 
                        } 
                    } else { 
                        if ($this->_total && $this->_columns[$x4d - 1] == "total") { 
                            $x5c["total"] = $x62; 
                            if ($x7b($x62)) 
                                $x60 = true; 
                            else 
                                $x60 = false; 
                        } 
                    } 
                    if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory") && $x60) { 
                        if ($x7b($x62) && $x7b($this->_columns[$x4d - 1])) { 
                            $x63 = " REPLACE INTO `" . $this->_tables["ai"] . "` (`id`, `localstock_id`,`place_id`,`quantity_in_stock`,`product_id`,`backorder_allowed`,`use_config_setting_for_backorders`) values(
                                   IF((SELECT count(`id`) FROM `" . $this->_tables["ai"] . "` AS a WHERE `place_id`=" . $this->_columns[$x4d - 1] . " AND  `product_id`=" . $x5e . ")=1,(SELECT `id` FROM " . $this->_tables["ai"] . " AS a WHERE `place_id`=" . $this->_columns[$x4d - 1] . " AND `product_id`=" . $x5e . "),NULL) ,$x5f," . $this->_columns[$x4d - 1] . ",$x62,$x5e,(SELECT `backorder_allowed` FROM `" . $this->_tables["ai"] . "` AS `b` WHERE `place_id`=" . $this->_columns[$x4d - 1] . " AND `product_id`=" . $x5e . "),(SELECT `use_config_setting_for_backorders` FROM `" . $this->_tables["ai"] . "` AS `c` WHERE `place_id`=" . $this->_columns[$x4d - 1] . " AND `product_id`=" . $x5e . ")); "; 
                            $x7c($this->_sql, $x63); 
                            $x5d[] = "-IFNULL((SELECT `quantity_in_stock` FROM `" . $this->_tables["ai"] . "` WHERE `place_id`=" . $this->_columns[$x4d - 1] . " AND  `product_id`=" . $x5e . " ),0)"; 
                        } 
                    } 
                    if (!$this->getAutoSetInstock()) { 
                        if ($this->_is_in_stock && $this->_columns[$x4d - 1] == "is_in_stock") { 
                            if ($x75($x7d($x62), array( 
                                "1", 
                                "true", 
                                "yes", 
                                "on", 
                                "in stock", 
                                "instock", 
                                "available" 
                            ))) 
                                $x5c["in_stock"] = true; 
                            else 
                                $x5c["in_stock"] = false; 
                        } 
                    } else { 
                        if ($x5c["total"] > 0) 
                            $x5c["in_stock"] = true; 
                        else 
                            $x5c["in_stock"] = false; 
                    } 
                    if ($this->_manage_local_stock && $this->_columns[$x4d - 1] == "manage_local_stock") { 
                        if ($x75($x7d($x62), array( 
                            "1", 
                            "true", 
                            "yes", 
                            "on", 
                            "in stock", 
                            "instock", 
                            "available" 
                        ))) 
                            $x5c["manage_local_stock"] = 1; 
                        else 
                            $x5c["manage_local_stock"] = 0; 
                    } else { 
                        $x5c["manage_local_stock"] = 1; 
                    } 
                    if ($x7e($this->_columns[$x4d - 1], "attribute")) { 
                        $x64 = ($x7f('-', $this->_columns[$x4d - 1])); 
                        $x65 = Mage::getSingleton("core/resource")->getTableName("catalog_product_entity_" . $x64[3]); 
                        $x63 = "UPDATE `$x65` SET `value`='" . $x80($x62) . "' WHERE `entity_id`='" . $x5e . "' AND `attribute_id`='" . $x64[2] . "';"; 
                        $x7c($this->_sql, $x63); 
                    } 
                    $x5c[$x61]["value"] = $x62; 
                    $x5c[$x61]["code"]  = $this->_columns[$x4d - 1]; 
                    $x61++; 
                } 
            } 
            ; 
            $x5c["status"] = $x60; 
            $x66                       = $x5c["total"]; 
            if ($this->getAutoSetTotal() == 2) { 
                if ($x79($x5d)) 
                    $x66 = "(SELECT (IFNULL(SUM(`quantity_in_stock`),0)" . $x7a('', $x5d) . "+$x66) FROM " . $this->_tables["ai"] . " WHERE `product_id`=$x5e)"; 
                else { 
                    $x60 = false; 
                } 
            } 
            $x67 = $x5c["in_stock"]; 
            if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory")) { 
                if ($x60) { 
                    $x63 = "REPLACE INTO `" . $this->_tables["aip"] . "` values($x5f,$x5e," . $x5c["manage_local_stock"] . ",$x66); "; 
                    $x77($this->_sql, $x63); 
                } 
            } 
            if (($x60)) { 
                if ($x67 === true || $x67 === false) { 
                    $x68 = ", `is_in_stock`"; 
                    $x69 = ($x67) ? ',1' : ',0'; 
                    if ($this->getAutoSetTotal() == 2) { 
                        $x69 = " , IF ($x66>0,1,0)"; 
                    } 
                } else { 
                    $x68 = null; 
                    $x69 = null; 
                } 
                $x63 = "REPLACE INTO `" . $this->_tables["csi"] . "` (`item_id`,`product_id`,`qty`,`stock_id` $x68) VALUES ( IF((SELECT COUNT(`item_id`) FROM `" . $this->_tables["csi"] . "` as `csi` WHERE `product_id`=$x5e)=1, (SELECT `item_id` FROM `" . $this->_tables["csi"] . "` as `csi` WHERE `product_id`=$x5e),NULL) ,$x5e,$x66,1 $x69); "; 
                $x77($this->_sql, $x63); 
            } 
            if ($x60) 
                $this->_notices[] = "SKU <i>$x58[0]</i> has been updated"; 
            else { 
                Mage::$x72("* Product #" . $x58[0] . " has been ignored due to some non consistent data.", null, "MassStockUpate.log"); 
                $this->_warnings[] = "SKU <i>$x58[0]</i> has been ignored due to some non consistent data."; 
            } 
            $this->_output[] = $x5c; 
        } else { 
            Mage::$x72("* Product #" . $x58[0] . " doesn't exist. Product has been ignored.", null, "MassStockUpate.log"); 
            $this->_warnings[] = "SKU <i>$x58[0]</i> doesn't exist. Product has been ignored."; 
        } 
         
    } 
     
    protected function getEvalLines() { 
         
        if(is_null($this->_evalLines)) { 
         
            $this->_evalLines = explode(';',$this->getCustomRules()); 
         
        } 
             
        return $this->_evalLines; 
         
    } 
     
    function backup() 
    { 
        $x72                           = "log"; 
        $x77                           = "array_unshift"; 
        $x7a                           = "implode"; 
        $x7c                           = "array_push"; 
        $x81                           = "time"; 
        $x49                           = array(); 
        $x6a                           = array(); 
        $x6b                           = array(); 
        $x47                           = Mage::getSingleton("core/resource"); 
        $x48                           = $x47->getConnection("core_read"); 
        $this->_tables["csi"]       = Mage::getSingleton("core/resource")->getTableName("cataloginventory_stock_item"); 
        $this->_tables["cpe"] = Mage::getSingleton("core/resource")->getTableName("catalog_product_entity"); 
        $x7c($x49, "LEFT JOIN `" . $this->_tables["cpe"] . "` AS `cpe` ON `cpe`.`entity_id`=`csi`.`product_id`"); 
        if (Mage::helper("core")->isModuleEnabled("Wyomind_Advancedinventory")) { 
            $x6a[]                  = null; 
            $x6b[]                  = null; 
            $this->_tables["ai"] = Mage::getSingleton("core/resource")->getTableName("advancedinventory"); 
            $x6c                    = Mage::getModel("pointofsale/pointofsale")->getPlaces(); 
            foreach ($x6c as $x43) { 
                $x7c($x49, "LEFT JOIN `" . $this->_tables["ai"] . "` AS `ai_" . $x43->getPlaceId() . "` ON `ai_" . $x43->getPlaceId() . "`.`product_id`=`cpe`.`entity_id` AND `ai_" . $x43->getPlaceId() . "`.`place_id`=" . $x43->getPlaceId() . ""); 
                $x6a[] = "ai_" . $x43->getPlaceId() . ".`quantity_in_stock` AS `ai_stock_" . $x43->getPlaceId() . "`"; 
            } 
        } 
        $x77($x49, "SELECT  `cpe`.`sku` " . $x7a(', ', $x6a) . ", `csi`.`qty`,`csi`.`is_in_stock` FROM `" . $this->_tables["csi"] . "` AS `csi`"); 
        $x7c($x49, "WHERE `sku` IS NOT NULL " . $x7a(" AND ", $x6b) . ""); 
        Mage::$x72("-------------------- BACKUP PROCESS --------------------", null, "MassStockUpate.log"); 
        Mage::$x72("---> MySql request : " . $x7a(' ', $x49), null, "MassStockUpate.log"); 
        $x58 = $x48->fetchAll($x7a(" ", $x49)); 
        $x40 = new Varien_Io_File(); 
        $x40->setAllowCreateFolders(true); 
        $x6d = Mage::getStoreConfig("massstockupdate/import/backup_file") . "-" . $x81() . ".csv"; 
        $x6e = Mage::getStoreConfig("massstockupdate/import/backup_dir"); 
        if (!Mage::getStoreConfig("massstockupdate/settings/report_debug")) { 
            $x40->open(array( 
                "path" => Mage::getBaseDir() . "/" . $x6e 
            )); 
            if ($x40->fileExists($x6d) && !$x40->isWriteable($x6d)) { 
                Mage::throwException(Mage::helper("ordersexporttool")->__("File '%s' cannot be saved. Please, make sure the directory %s' is writeable by web server.", $x6d, $this->getPath())); 
            } 
            $x40->streamOpen($x6d, "w"); 
            foreach ($x58 as $x6f) { 
                $x40->streamWriteCsv($x6f, "; "); 
            } 
            $x40->streamClose(); 
            Mage::getSingleton("core/session")->addSuccess(Mage::helper("massstockupdate")->__("Backup created :  '%s'.", $x6e . $x6d)); 
        } 
        Mage::$x72("---> DONE : " . $x6e . $x6d, null, "MassStockUpate.log"); 
        return; 
    } 
} ?>

Did this file decode correctly?

Original Code

<?php
class Wyomind_Massstockupdate_Model_Import extends Mage_Core_Model_Abstract
{
    public $_warnings = [];
    public $_notices = [];
    public $_sql = [];
    public $_columns = [];
    public $_products = [];
    public $_stocks = [];
    public $_autoInc = 0;
    public $_tables = [];
    public $_total = false;
    public $_is_in_stock = false;
    public $x3e = false;
    public $_output = [];
    public $x3f = [];
    
    protected $_parseError = [];
    
    /**
     * 
     * @var array
     */
    protected $_evalLines;
    
    public function _construct()
    {
        parent::_construct();
        $this->_init("\x6da\x73\163\163\164o\143\153\x75p\144at\x65/i\155\160or\x74");
    }
    
    protected function _beforeSave()
    {
        $x40 = new Varien_Io_File();
        $x41 = $x40->getCleanPath(Mage::getBaseDir() . "\57" . $this->getFilePath());
        
        if(!$x40->fileExists($x41, false)) {
          
            Mage::throwException(Mage::helper("m\x61ss\x73\x74\157c\x6b\x75\x70d\141\164\145")->__("\x57\x72\157n\147\40fi\x6ce\40\160\141\x74h. \x27\45s\x27 \x69\x73 \156\x6f\164\x20a\x20\x66i\154\x65\56", $x41));
        
        }
        
        if(stristr($this->getFilePath(), ".csv") === false) {
        
            Mage::throwException(Mage::helper("m\x61ss\x73\x74\157c\x6b\x75\x70d\141\164\145")->__("W\162\157\156\147\40\146\151\154\x65. \x27%\x73\47\40\x69\x73 no\x74 a \x63\x73v\x20\146\151\154\x65.", $x41));
        
        }
        
        if(!is_readable($x41)) {
            
            Mage::throwException(Mage::helper("m\x61ss\x73\x74\157c\x6b\x75\x70d\141\164\145")->__("\x50\x6ce\x61se\x20\x6dak\145\40\x73ure t\x68\141\x74\40\47\x25s\47\40is \162\x65\x61\144\x61\x62\154\145\x20\142\x79 w\145\142-\x73\x65r\166\145r.", $x41));
        
        }
        
        return parent::_beforeSave();
    }
    
    public function x82()
    {
        $this->_warnings = array();
        $this->_notices  = array();
        $this->_sql      = array();
        $this->_columns  = array();
        $this->_products = array();
        $this->_stocks   = array();
        $this->_autoInc  = 0;
        $this->_tables   = array();
        $this->_total    = false;
        $this->_output   = array();
    }
    
    public function importProcess()
    {
        $x72 = "\154o\147";
        $x73 = "\164rim";
        $x74 = "j\x73\157n_\144\x65\x63\x6f\x64e";
        $x75 = "\151\156\x5f\x61\x72\x72\x61\x79";
        $x76 = "\x61\162\162\141\171\x5f\x73pl\x69c\145";
        $x77 = "array\x5fun\x73\x68if\164";
        $x78 = "s\x74\162_\x72\145\x70\154\x61\143e";
        $x79 = "\143ou\x6et";
        $x7a = "i\155p\154\x6fd\145";
        
        Mage::$x72("\x2d-\55-\55\x2d-\55--\55\55\x2d\55-\55-\x2d-\55\x20\x49\x4d\x50\117\122TA\x54\111O\116\40\x50\x52\x4f\103\x45\123\123 ---\55-\55\55-\x2d\x2d-\55\55\x2d\x2d", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        $this->x82();
        $x40 = new Varien_Io_File();
        $x41 = $x40->getCleanPath(Mage::getBaseDir() . "\57" . $this->getFilePath());
        $x40->streamOpen($x41, "\x72");
        Mage::$x72("\55-\76\40\x46i\154e\x20\157\x70\x65\156\x65\x64 :\40" . $x41, null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        $x42 = Mage::getModel("\143\x61\x74a\154\x6fg/\160ro\144\x75c\164")->getCollection()->addAttributeToSelect("\x73k\x75");
        
        foreach ($x42 as $x43) {
            if(!empty($x43->getSku())) {
                $this->_products[$x73($x43->getSku())] = $x43->getId();
            }
        }
        
        Mage::$x72("\55\x2d>\40\x50\162o\x64uct\163\40\143\157l\x6ce\x63\x74e\144", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        if (Mage::helper("\x63o\x72\145")->isModuleEnabled("\127y\157\155i\156d\137Ad\x76an\x63\145\144\151\x6e\166ent\157r\x79")) {
            $x44 = Mage::getModel("\141d\166\x61\x6e\x63\145d\151\x6e\166en\x74o\162\x79/\141\144\x76an\143\x65\144\x69\x6ev\x65\156\x74o\x72\171\x70\x72\x6f\x64u\143\164")->getCollection();
            foreach ($x44 as $x45) {
                $this->_stocks[$x45->getProductId()] = $x45->getId();
            }
            ;
            Mage::$x72("-\x2d\76 Lo\143\x61\x6c \x73t\x6f\143\153\163 \x63\157\x6c\154\145\143\x74\145\144\x20\50\101\144\x76\141nc\x65\144\40Inv\145\x6e\164o\162y\x29", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        }
        
        $x47                     = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce");
        $x48                     = $x47->getConnection("core_\x72e\141\x64");
        $this->_tables["cs\151"] = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getTableName("\x63\x61t\141\x6co\x67\x69n\x76en\x74\157ry\137s\x74\x6fc\153\137\x69tem");
        if (Mage::helper("\x63o\x72\145")->isModuleEnabled("\127y\157\155i\156d\137Ad\x76an\x63\145\144\151\x6e\166ent\157r\x79")) {
            $this->_tables["a\x69\160"] = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getTableName("\x61dv\x61n\x63\145\x64\151n\166\145\x6et\x6f\x72\x79_\x70\x72od\165\x63t");
            $this->_tables["a\151"]     = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getTableName("\x61\x64v\141\x6e\x63\145\x64\x69n\166e\156t\x6f\162\171");
            $x49                        = "\123\105\x4c\x45\103T\40MAX\50i\144)\x20\101S\40\111NC F\122\x4fM\x20" . $this->_tables["a\x69\160"] . "\40\x3b";
            $x4a                        = $x48->fetchAll($x49);
            $this->_autoInc             = $x4a[0]["\x49N\x43"];
            Mage::$x72("\55->\40\115a\x78\x20\x69\x6e\143\162em\x65\156t \146\157\x75\x6e\144\x20\x23" . $x4a[0]["\x49N\x43"] . "\x28A\144v\141\x6e\x63ed\40\x49n\166\145\156\164\157r\x79\x29", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        }
        
        $x4c = $x74($this->getMapping());
        foreach ($x4c->columns as $x4d => $x4e) {
            if (!$x75($x4e->id, array(
                "\156ot-u\x73\x65\x64",
                "\x74\x6f\x74\x61\154",
                "\x69\163\x5f\x69\156\x5fs\164o\143\x6b",
                "\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b"
            ))) {
                $this->_columns[] = $x4e->id;
            } elseif ($x75($x4e->id, array(
                "\x74\x6f\x74\x61\154"
            ))) {
                $this->_columns[] = "\x74\x6f\x74\x61\154";
                $this->_total     = $x4d + 1;
            } elseif ($x75($x4e->id, array(
                "\x69\163\x5f\x69\156\x5fs\164o\143\x6b"
            ))) {
                $this->_columns[]   = "\x69\163\x5f\x69\156\x5fs\164o\143\x6b";
                $this->_is_in_stock = $x4d + 1;
            } elseif ($x75($x4e->id, array(
                "\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b"
            ))) {
                $this->_columns[]          = "\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b";
                $this->_manage_local_stock = $x4d + 1;
            } else {
                $this->_columns[] = false;
            }
        }
        Mage::$x72("\x2d\55\76\x20\x43\157\x6c\x75m\156\40\x6da\x70\160\151n\147 \141naly\172\145\x64", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        
        //Fix for array to string conversion
        //No demo mode
        $this->_demo = false;
        
        Mage::$x72("\x2d\55>\x20\120\x72e\x70\141r\x69\156\x67\x20\115y\123\x71\154 q\165\145r\151\145\163", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        $x4f = $this->getSkuOffset() - 1;
        $x50 = new Varien_Io_File();
        $x50->setAllowCreateFolders(true);
        $x51 = "\x4d\141s\x73S\164\x6f\143\x6b\x55\x70\144\141\x74\x65\x2et\155\x70\56\x73\x71l";
        $x52 = "v\x61\x72\x2f\164mp";
        $x41 = $x40->getCleanPath(Mage::getBaseDir() . '/' . $x52);
        if (!$x50->fileExists($x41, false)) {
            Mage::throwException(Mage::helper('massstockupdate')->__('Please create the specified folder "%s".', $x41));
        }
        if (!$x50->isWriteable($x41)) {
            Mage::throwException(Mage::helper('massstockupdate')->__('Please make sure that "%s" is writable by web-server.', $x41));
        }
        $x50->open(array(
            'path' => $x52
        ));
        $x50->streamOpen($x51, 'w');
        if ($this->getAutoSetTotal() == 2) {
            $x50->streamWrite("AL\x54E\x52\x20\x54\x41\102\114\x45\40\x60" . $this->_tables["a\151"] . "\x60 D\122\x4f\x50\40\106\x4f\x52\105\x49\107N \x4b\105Y\40\x60C\117\116\x53\x54\x5f\141d\x76\x61\156\x63\x65\144\151\156\166\x65nt\157\x72\x79_\x6c\x6f\x63al\163\x74\157ck_\x69d\x60; \x0a");
        }
        if ($this->getFileEnclosure() != "n\x6f\156e") {
            
            while (false !== ($x53 = $x40->streamReadCsv($this->getFileSeparator(), $this->getFileEnclosure()))) {
                $x54 = $x76($x53, $x4f, 1);
                $x77($x53, $x54[0]);
                $this->x83($x53);
                foreach ($this->_sql as $x49) {
                    $x50->streamWrite($x78(array(
                        "\x0a",
                        "\40 "
                    ), array(
                        "\40",
                        ""
                    ), $x73($x49)) . "\x0a");
                }
            }
            
        } else {
            
            while (false !== ($x53 = $x40->streamReadCsv($this->getFileSeparator()))) {
                $x54 = $x76($x53, $x4f, 1);
                $x77($x53, $x54[0]);
                $this->x83($x53);
                foreach ($this->_sql as $x49) {
                    $x50->streamWrite($x78(array(
                        "\x0a",
                        "\40 "
                    ), array(
                        "\40",
                        "\40"
                    ), $x73($x49)) . "\x0a");
                }
            }
            
        }
        Mage::$x72("\x2d-\x3e\40F\x69\154e\x20\x63\154\x6fs\145\x64\40\72 " . $x41, null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        $x40->streamClose();
        if ($this->getAutoSetTotal() == 2) {
            $x50->streamWrite("\x41L\x54\105\x52\40\40\x54\x41B\114\105 \x60" . $this->_tables["a\151"] . "\x60\x20\x41\104\104 \103\117\116\123\124R\101INT \x60\x43ONST_\141\144\x76\x61nced\x69n\166en\x74\x6f\x72\171\137l\x6f\143al\x73\x74o\x63k_\x69\144\x60 F\117\122E\x49\107\x4e KEY (l\157\x63\141\154s\164\157c\153\137\x69\x64\x29\x20R\105FER\105N\x43\x45S\x20" . $this->_tables["a\x69\160"] . " \x28\151\144\51\x20\x4f\x4e \125\x50\x44A\x54\105 \103\101\x53\103\101\x44E\x20\x4fN \104E\114\x45T\105 \x43\x41S\x43\101DE\73");
        }
        $x50->streamClose();
        if ($x79($this->_warnings))
            Mage::getSingleton("c\157r\145\57\x73\x65s\163\151\x6f\156")->addError($x7a("\74\142\x72\76", ($this->_warnings)));
        if (Mage::getStoreConfig("m\x61sss\164o\x63\153u\x70d\141\x74\x65\x2fs\x65t\x74\x69n\x67s\x2f\x72\x65p\157\162\x74\x5f\144\x65\x62\165\147")) {
            Mage::getSingleton("c\157r\145\57\x73\x65s\163\151\x6f\156")->addWarning("\x44e\x62u\x67 \x6d\x6f\x64\x65 \145\x6e\x61\x62\x6c\145\144\56\x4e\x6f\40d\x61\x74a\x20h\x61ve\40be\145n \165pd\141t\x65d.\74\x62\x72\x3eM\141\x73\x73\123\164\x6f\143\153Up\141t\x65\x2e\154\157g\x20\x66il\145\40\x68\141\163\40\142e\145\x6e\x20c\162e\x61\164\x65d\40\x28\154\x6f\x67\40f\151\154\x65\163\x20m\x75s\x74\40\x62\145\x20e\x6e\141\x62le\x64\x20\x69\156\x20s\171\163\x74\145m \x3e\x20co\156fi\x67\x75\162\141\164i\157n\x20> dev\x65\154\x6f\x70e\162\x29\56");
            return;
        }
        $x55 = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getConnection("\143\157\162\x65\137\167\x72\151\164e");
        $x55->beginTransaction();
        $x56 = true;
        Mage::$x72("--> E\170e\x63uti\156g\x20\115\171\123\x71\154\x20\x71\x75e\162\151\145s", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        $x40 = new Varien_Io_File();
        $x40->streamOpen($x41 . $x51, "\x72");
        while (false !== ($x49 = $x40->streamRead(102400))) {
            try {
                $x55->exec($x49);
            }
            catch (Mage_Core_Exception $x57) {
                Mage::$x72(" \146\141\151l\145\144\40\x2d-\x3e" . $x49, null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
                $x56 = false;
            }
            catch (Exception $x57) {
                Mage::$x72(" \146\141\151l\145\144\40\x2d-\x3e" . $x49, null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
                Mage::getSingleton("c\157r\145\57\x73\x65s\163\151\x6f\156")->addError($x57->getMessage());
                $x56 = false;
            }
        }
        if (!$x56) {
            Mage::$x72("\55-\x3e MyS\x71\154\40\x52o\154l\142ack", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
            Mage::getSingleton("c\157r\145\57\x73\x65s\163\151\x6f\156")->addError(Mage::helper("m\x61ss\x73\x74\157c\x6b\x75\x70d\141\164\145")->__("E\162r\x6fr \x77\x68i\154e \160\162\x6f\143es\x73\x69\x6eg\56 \122\157\x6c\154ba\x63k\40ha\160p\x65\156\145\144\56"));
            $x55->rollback();
            return false;
        } else {
            Mage::$x72("\55\x2d>\40M\171\x53ql\40C\x6f\x6d\x6d\151\x74", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
            $x55->commit();
            $this->setImportedAt(Mage::getSingleton("cor\x65/\144\141\164e")->gmtDate("\131-\155-d H:\x69:\163"));
            $this->save();
            Mage::getSingleton('index/indexer')->getProcessByCode('cataloginventory_stock');
            Mage::$x72("\55->\40\123t\157c\x6b\40re\x2d\151n\x64e\x78\145\144", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
            $x40->open(array(
                'path' => $x52
            ));
            $x40->rm($x51);
            return true;
        }
    }
    
    private function x83($x58)
    {
        $x72        = "\154\157g";
        $x75        = "\x69\156\137a\162\162\141y";
        $x77        = "\x61\x72ra\x79\x5f\x75n\x73h\151\x66\164";
        $x79        = "\143\157u\156t";
        $x7a        = "\x69\x6dp\154ode";
        $x7b        = "is\137\x6eu\x6d\x65\x72\x69\x63";
        $x7c        = "\x61\162\162a\x79\x5fp\165\163\x68";
        $x7d        = "\x73\164rt\157\x6cowe\162";
        $x7e        = "\163t\162\x73t\162";
        $x7f        = "\x65x\160\154\x6fde";
        $x80        = "\141\144\x64s\154a\163h\x65s";
        
        $this->_sql = [];
        foreach($x58 as $x59 => $x5a) {

            $x58[$x59] = trim($x5a);
    
        }
        
        if($this->getUseCustomRules()) {
            
            /**
             * Commented by Vitapur
             */
            //eval(str_replace('$C[', '$x58[', $this->getCustomRules()));
            
            /**
             * Added by Vitapur
             */
            foreach($this->getEvalLines() as $l => $line) {
                
                try {
                    
                    eval(str_replace('$C[', '$x58[', $line.';'));
                    
                }catch(ParseError $e) {
                 
                    if(!isset($this->_parseError[$l])) {
                    
                        $this->_parseError[$l] = true;
                        
                        Mage::$x72('--> Custom rules parse error at line '.($l + 1).': '.$line, null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
                    
                    }
                    
                }
                
            }
            
        }
        
        $x5c = array();
        $x5d = array();
        if (isset($this->_products[$x58[0]])) {
            $x5e = $this->_products[$x58[0]];
            if (isset($this->_stocks[$x5e])) {
                $x5f = $this->_stocks[$x5e];
            } else {
                $this->_autoInc++;
                $x5f = $this->_autoInc;
            }
            $x5c["\x49D"]                = $x5e;
            $x60                         = true;
            $x5c["\x73ta\164\x75\163"]   = $x60;
            $x5c["\x74\x6f\x74\x61\154"] = 0;
            $x5c["\x69\156_\163tock"]    = null;
            $x61                         = 0;
            foreach ($x58 as $x4d => $x62) {
                if (isset($this->_columns[$x4d - 1]) && $x4d > 0) {
                    if (!$this->_total) {
                        if ($x7b($x62) && $x60) {
                            if ($this->_columns[$x4d - 1] != "\x74\x6f\x74\x61\154" && $this->_columns[$x4d - 1] != "\x69\163\x5f\x69\156\x5fs\164o\143\x6b" && ($this->_columns[$x4d - 1] == "\x75\x73e\144" || $x7b($this->_columns[$x4d - 1])))
                                $x5c["\x74\x6f\x74\x61\154"] += $x62;
                            $x60 = true;
                        }
                    } else {
                        if ($this->_total && $this->_columns[$x4d - 1] == "\x74\x6f\x74\x61\154") {
                            $x5c["\x74\x6f\x74\x61\154"] = $x62;
                            if ($x7b($x62))
                                $x60 = true;
                            else
                                $x60 = false;
                        }
                    }
                    if (Mage::helper("\x63o\x72\145")->isModuleEnabled("\127y\157\155i\156d\137Ad\x76an\x63\145\144\151\x6e\166ent\157r\x79") && $x60) {
                        if ($x7b($x62) && $x7b($this->_columns[$x4d - 1])) {
                            $x63 = " \122\105P\x4c\101C\105\x20IN\x54\x4f \140" . $this->_tables["a\151"] . "\x60 \50\x60id\140\54\x20`\x6c\x6fc\x61\x6c\x73t\x6f\143\x6b_i\x64\140,\140p\154a\143\145_\151\x64\x60\x2c`qu\x61\156\x74\151\164\x79\137\151n\137\x73\x74\157\x63\153`,`p\162o\x64uc\164_id`\54\140b\x61c\x6b\157r\144\x65r\x5f\x61l\154\157\167\145\x64\x60\x2c\140u\163\145\137c\x6f\156fi\x67\x5f\163\145\x74ti\x6e\147\x5ff\157\x72_\x62\141\x63ko\162\x64\145\162s`\x29\40v\141\x6cue\163\x28\x0d \x20\x20 \40\x20\40\x20\x20\40\x20 \x20 \x20\40\x20 \x20 \40\40 \40\x20\40 \40\x20 \40 \x20\40\40\x49F\x28\50SE\114\105\x43\x54\40c\x6f\x75nt(\x60i\x64\x60\51 \106\122O\x4d\40`" . $this->_tables["a\151"] . "`\x20\101\123 \141\x20\127H\x45R\105\x20\x60\x70l\x61\143e\137\151\x64\140\x3d" . $this->_columns[$x4d - 1] . " \x41\x4e\104\x20\40\140\x70r\x6f\144u\143\164\137\x69\144\x60=" . $x5e . "\51\75\61\x2c\50S\105\x4c\x45\x43\x54 \x60\x69d\140\40F\x52O\x4d\x20" . $this->_tables["a\151"] . " \101S\x20a\40\127\110\x45\x52\105 `\x70\x6c\x61\x63\x65_\151\144`=" . $this->_columns[$x4d - 1] . " A\x4eD \x60p\162\x6f\x64\165\143\x74_\x69\144`\x3d" . $x5e . "),NULL) ,$x5f," . $this->_columns[$x4d - 1] . ",$x62,$x5e,(SELECT `backorder_allowed` FROM `" . $this->_tables["a\151"] . "\x60\x20A\123\40\x60\142\x60\40\127H\x45\122\x45 \x60\x70\154a\x63e\x5f\151d`\75" . $this->_columns[$x4d - 1] . " A\x4eD \x60p\162\x6f\x64\165\143\x74_\x69\144`\x3d" . $x5e . "\51\54\50S\x45\x4cE\x43\x54\40\x60\x75\x73\145_\x63\x6f\156\146\x69\147\x5fse\164\x74\151\x6eg\x5f\146\157r_\x62ac\x6bo\x72de\x72\x73\140\x20\x46\122\117\115 \x60" . $this->_tables["a\151"] . "\x60\x20A\123\40`c`\x20\127H\105\x52E \x60p\154\x61\x63\145\137\x69\144\x60=" . $this->_columns[$x4d - 1] . " A\x4eD \x60p\162\x6f\x64\165\143\x74_\x69\144`\x3d" . $x5e . "\x29); ";
                            $x7c($this->_sql, $x63);
                            $x5d[] = "\x2d\111\x46\x4eUL\x4c\50(\x53E\x4c\x45CT\x20\x60\161\165\x61nti\164\171\137i\x6e\137s\x74\157\x63\x6b` \x46\x52\x4f\x4d\x20\x60" . $this->_tables["a\151"] . "` \x57\x48\105R\x45\x20`\x70l\x61\143\145\x5f\x69\x64\140=" . $this->_columns[$x4d - 1] . " \x41\x4e\104\x20\40\140\x70r\x6f\144u\143\164\137\x69\144\x60=" . $x5e . "\40),\x30)";
                        }
                    }
                    if (!$this->getAutoSetInstock()) {
                        if ($this->_is_in_stock && $this->_columns[$x4d - 1] == "\x69\163\x5f\x69\156\x5fs\164o\143\x6b") {
                            if ($x75($x7d($x62), array(
                                "\61",
                                "\x74\x72\x75\x65",
                                "y\145\x73",
                                "\x6f\156",
                                "\x69\x6e\x20\x73\164oc\x6b",
                                "i\x6e\x73\x74o\x63k",
                                "\x61v\141i\x6ca\142\154e"
                            )))
                                $x5c["\x69\156_\163tock"] = true;
                            else
                                $x5c["\x69\156_\163tock"] = false;
                        }
                    } else {
                        if ($x5c["\x74\x6f\x74\x61\154"] > 0)
                            $x5c["\x69\156_\163tock"] = true;
                        else
                            $x5c["\x69\156_\163tock"] = false;
                    }
                    if ($this->_manage_local_stock && $this->_columns[$x4d - 1] == "\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b") {
                        if ($x75($x7d($x62), array(
                            "\61",
                            "\x74\x72\x75\x65",
                            "y\145\x73",
                            "\x6f\156",
                            "\x69\x6e\x20\x73\164oc\x6b",
                            "i\x6e\x73\x74o\x63k",
                            "\x61v\141i\x6ca\142\154e"
                        )))
                            $x5c["\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b"] = 1;
                        else
                            $x5c["\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b"] = 0;
                    } else {
                        $x5c["\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b"] = 1;
                    }
                    if ($x7e($this->_columns[$x4d - 1], "a\x74tr\151\142\x75\x74e")) {
                        $x64 = ($x7f('-', $this->_columns[$x4d - 1]));
                        $x65 = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getTableName("\x63a\164al\x6f\x67_\160r\x6f\x64u\143t_e\156t\151ty_" . $x64[3]);
                        $x63 = "UPDATE `$x65` SET `value`='" . $x80($x62) . "\x27 W\110\105RE\40\x60ent\151\x74y\137\151d\140\75\47" . $x5e . "\x27\x20\101ND\x20\140at\x74ri\x62\165\x74\x65\137\151\x64\x60\75\x27" . $x64[2] . "\47\73";
                        $x7c($this->_sql, $x63);
                    }
                    $x5c[$x61]["v\x61lu\145"] = $x62;
                    $x5c[$x61]["\143\x6fde"]  = $this->_columns[$x4d - 1];
                    $x61++;
                }
            }
            ;
            $x5c["\x73ta\164\x75\163"] = $x60;
            $x66                       = $x5c["\x74\x6f\x74\x61\154"];
            if ($this->getAutoSetTotal() == 2) {
                if ($x79($x5d))
                    $x66 = "\50S\105\x4c\105\103\x54 \50I\106\116U\114\x4c\50S\x55\115\50`\x71\x75a\x6e\164\151\x74\171_i\x6e\137\x73\x74o\143\153`\x29\54\x30\51" . $x7a('', $x5d) . "+$x66) FROM " . $this->_tables["a\151"] . " WHERE `product_id`=$x5e)";
                else {
                    $x60 = false;
                }
            }
            $x67 = $x5c["\x69\156_\163tock"];
            if (Mage::helper("\x63o\x72\145")->isModuleEnabled("\127y\157\155i\156d\137Ad\x76an\x63\145\144\151\x6e\166ent\157r\x79")) {
                if ($x60) {
                    $x63 = "\122E\120L\x41\x43E \x49\116\x54\117 \x60" . $this->_tables["a\x69\160"] . "` values($x5f,$x5e," . $x5c["\x6d\141n\141\x67\x65\x5fl\x6fc\141\x6c_\163\x74\x6fc\x6b"] . ",$x66); ";
                    $x77($this->_sql, $x63);
                }
            }
            if (($x60)) {
                if ($x67 === true || $x67 === false) {
                    $x68 = ",\40\x60\151\163_\151n\137st\157c\153\x60";
                    $x69 = ($x67) ? ',1' : ',0';
                    if ($this->getAutoSetTotal() == 2) {
                        $x69 = " , IF ($x66>0,1,0)";
                    }
                } else {
                    $x68 = null;
                    $x69 = null;
                }
                $x63 = "\122E\120L\x41\x43E \x49\116\x54\117 \x60" . $this->_tables["cs\151"] . "` (`item_id`,`product_id`,`qty`,`stock_id` $x68) VALUES ( IF((SELECT COUNT(`item_id`) FROM `" . $this->_tables["cs\151"] . "` as `csi` WHERE `product_id`=$x5e)=1, (SELECT `item_id` FROM `" . $this->_tables["cs\151"] . "` as `csi` WHERE `product_id`=$x5e),NULL) ,$x5e,$x66,1 $x69); ";
                $x77($this->_sql, $x63);
            }
            if ($x60)
                $this->_notices[] = "SKU <i>$x58[0]</i> has been updated";
            else {
                Mage::$x72("\52\40\x50\x72od\165ct\x20\x23" . $x58[0] . "\x20\150\141\x73 \x62\145e\156 \151\x67no\x72ed \144\x75\x65 \x74\157 \x73\x6f\155e\x20non\x20\x63\157\156\163\151s\164\x65\x6e\x74\x20\144\x61t\141\56", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
                $this->_warnings[] = "SKU <i>$x58[0]</i> has been ignored due to some non consistent data.";
            }
            $this->_output[] = $x5c;
        } else {
            Mage::$x72("\52\40\x50\x72od\165ct\x20\x23" . $x58[0] . "\x20\x64oe\163n't \x65\170\151\163t\x2e P\x72\157\x64u\x63\x74 h\141\x73\40\142\145\145\156\40\x69\147\x6eo\162e\144.", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
            $this->_warnings[] = "SKU <i>$x58[0]</i> doesn't exist. Product has been ignored.";
        }
        
    }
    
    protected function getEvalLines() {
        
        if(is_null($this->_evalLines)) {
        
            $this->_evalLines = explode(';',$this->getCustomRules());
        
        }
            
        return $this->_evalLines;
        
    }
    
    function backup()
    {
        $x72                           = "\154o\x67";
        $x77                           = "a\x72ra\x79\x5fun\x73\150\x69f\164";
        $x7a                           = "im\160lo\x64\x65";
        $x7c                           = "\141rray\137push";
        $x81                           = "t\x69\155\x65";
        $x49                           = array();
        $x6a                           = array();
        $x6b                           = array();
        $x47                           = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce");
        $x48                           = $x47->getConnection("core_\x72e\141\x64");
        $this->_tables["cs\151"]       = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getTableName("\x63\x61t\141\x6co\x67\x69n\x76en\x74\157ry\137s\x74\x6fc\153\137\x69tem");
        $this->_tables["\x63\x70\145"] = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getTableName("c\141ta\154\157\147_pr\x6fdu\x63t\x5f\145\156ti\164y");
        $x7c($x49, "\114\x45F\124\40J\117\111\116\40\x60" . $this->_tables["\x63\x70\145"] . "\140 \101\123 \140\x63pe\x60 \117\116\40\140\x63\160e\x60\x2e\140\145nt\x69\164\171\x5f\151\144`\x3d\140\143s\x69`.`p\x72\157\x64u\x63\164_i\144\x60");
        if (Mage::helper("\x63o\x72\145")->isModuleEnabled("\127y\157\155i\156d\137Ad\x76an\x63\145\144\151\x6e\166ent\157r\x79")) {
            $x6a[]                  = null;
            $x6b[]                  = null;
            $this->_tables["a\151"] = Mage::getSingleton("\143o\162\x65\x2f\x72es\157\165\x72ce")->getTableName("\x61\x64v\141\x6e\x63\145\x64\x69n\166e\156t\x6f\162\171");
            $x6c                    = Mage::getModel("\160\x6f\151n\164\157fs\141\x6c\145\x2f\160\x6fi\x6e\164ofs\x61l\145")->getPlaces();
            foreach ($x6c as $x43) {
                $x7c($x49, "\114\x45F\124\40J\117\111\116\40\x60" . $this->_tables["a\151"] . "`\x20A\x53\40\x60\x61i\x5f" . $x43->getPlaceId() . "\x60\x20O\x4e\x20`\x61i\x5f" . $x43->getPlaceId() . "\x60\56\140\x70\162o\144\165\x63\x74_\151\x64`\75`c\x70\x65\x60\x2e\x60\x65\x6e\x74\151\x74y\137i\x64`\40\101ND\40\140\x61\151_" . $x43->getPlaceId() . "\x60\x2e`place_id\x60\x3d" . $x43->getPlaceId() . "");
                $x6a[] = "a\x69\137" . $x43->getPlaceId() . "\x2e\x60\x71\x75\x61n\164it\171\137\151n\x5f\163t\x6f\x63\153` \101\123 \x60\141i\137\163\x74o\143\x6b_" . $x43->getPlaceId() . "`";
            }
        }
        $x77($x49, "\123E\x4c\105CT \x20\140c\160\x65`.`sk\x75\140\40" . $x7a(', ', $x6a) . "\54 \x60c\x73\x69\140.\140\161\164\x79\140,`\x63\163\151\140.\140\x69\x73\137in\137\163\x74o\x63\153\140\x20\x46R\117M \x60" . $this->_tables["cs\151"] . "`\x20\x41S\40`\143\163\x69\140");
        $x7c($x49, "\127H\x45\122\x45 \140sk\x75\140\x20\111\x53 \116OT \x4e\125\114\x4c\40" . $x7a("\40A\x4eD\x20", $x6b) . "");
        Mage::$x72("\x2d\55-\x2d-\x2d\x2d----\x2d\55-\55\55--\55- B\x41\x43\x4b\125P \120R\x4fC\x45S\x53\x20\x2d\x2d-\x2d\x2d\55\x2d\55\55--\x2d\55\55-\55\55--\55", null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        Mage::$x72("\55\55-\76\40\115\x79\123q\154\40\162\x65q\x75\145s\164 :\x20" . $x7a(' ', $x49), null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        $x58 = $x48->fetchAll($x7a("\40", $x49));
        $x40 = new Varien_Io_File();
        $x40->setAllowCreateFolders(true);
        $x6d = Mage::getStoreConfig("\155a\x73\163\163\x74o\143\153u\160d\x61\164\x65\x2fim\x70\x6frt\x2f\x62\141ck\165p\x5f\x66\151l\x65") . "-" . $x81() . "\x2ec\163\x76";
        $x6e = Mage::getStoreConfig("\x6das\x73s\x74\x6f\x63\x6bu\x70\x64\141\x74\145\57\151\155\160\x6f\162t\x2fba\143k\165p\137\144\x69\x72");
        if (!Mage::getStoreConfig("m\x61sss\164o\x63\153u\x70d\141\x74\x65\x2fs\x65t\x74\x69n\x67s\x2f\x72\x65p\157\162\x74\x5f\144\x65\x62\165\147")) {
            $x40->open(array(
                "\x70a\x74h" => Mage::getBaseDir() . "\57" . $x6e
            ));
            if ($x40->fileExists($x6d) && !$x40->isWriteable($x6d)) {
                Mage::throwException(Mage::helper("\x6f\162\x64\145\162\x73\x65\x78po\162\164\x74o\157\154")->__("\106\x69l\145\x20\x27\45\163' ca\x6en\x6f\x74\x20\x62e \x73av\x65d\56 \x50\x6c\145\141se\54\x20ma\153\145 \163\x75\162e th\x65\x20\144i\162\145c\164\x6f\162\171\40%s\x27\40\151\163 \167\162\x69\x74\x65a\142l\145\x20\142\171\40w\x65\142\x20\163\x65rve\x72\x2e", $x6d, $this->getPath()));
            }
            $x40->streamOpen($x6d, "\167");
            foreach ($x58 as $x6f) {
                $x40->streamWriteCsv($x6f, "; ");
            }
            $x40->streamClose();
            Mage::getSingleton("c\157r\145\57\x73\x65s\163\151\x6f\156")->addSuccess(Mage::helper("m\x61ss\x73\x74\157c\x6b\x75\x70d\141\164\145")->__("\102\141c\153\165p \x63\162e\141\164\x65d\40\72 \x20'%\x73\x27.", $x6e . $x6d));
        }
        Mage::$x72("--\55\76\x20\104ON\x45\40\x3a\40" . $x6e . $x6d, null, "Ma\x73s\123t\x6f\x63\x6b\125\x70\141\164\145\x2e\154\157g");
        return;
    }
}

Function Calls

None

Variables

None

Stats

MD5 d1a57cfe1e2ba9174f173a4164e0bcad
Eval Count 0
Decode Time 51 ms