Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
public function importProcess() { $x72 = "\154o\147"; $x73 = "..
Decoded Output download
<? 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();
$error = false;
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");
$error = true;
}catch(Exception $x57) {
Mage::$x72(" failed -->" . $x49, null, "MassStockUpate.log");
Mage::$x72($x57->getMessage(), null, "MassStockUpate.log");
$error = true;
}
}
if($error) {
Mage::$x72("--> MySql Rollback", null, "MassStockUpate.log");
$x55->rollback();
return false;
}
Mage::$x72("--> MySql Commit", null, "MassStockUpate.log");
$x55->commit();
$this->setImportedAt(Mage::getSingleton("core/date")->gmtDate("Y-m-d H:i:s"))->save();
$x40->open(['path' => $x52]);
$x40->rm($x51);
return true;
} ?>
Did this file decode correctly?
Original Code
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();
$error = false;
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");
$error = true;
}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::$x72($x57->getMessage(), null, "MassStockUpate.log");
$error = true;
}
}
if($error) {
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");
$x55->rollback();
return false;
}
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"))->save();
$x40->open(['path' => $x52]);
$x40->rm($x51);
return true;
}
Function Calls
None |
Stats
MD5 | 2a013430b233feec607082255919920d |
Eval Count | 0 |
Decode Time | 45 ms |