$item->unsetNew(); $add = false; } else { $item = $h_myshop_cat->create(true); $add = true; } $opRedirect = 'categories'; $item->setVars($_POST); if (isset($_POST['delpicture']) && intval($_POST['delpicture']) == 1) { $item->deletePicture(); } $destname = ''; $res1 = myshop_utils::uploadFile(0, MYSHOP_PICTURES_PATH); if ($res1 === true) { if (myshop_utils::getModuleOption('resize_others')) { myshop_utils::resizePicture(MYSHOP_PICTURES_PATH . DIRECTORY_SEPARATOR . $destname, MYSHOP_PICTURES_PATH . DIRECTORY_SEPARATOR . $destname, myshop_utils::getModuleOption('images_width'), myshop_utils::getModuleOption('images_height'), true); } $item->setVar('cat_imgurl', basename($destname)); } else { if ($res1 !== false) { echo $res1; } } $res = $h_myshop_cat->insert($item); if ($res) { myshop_utils::updateCache(); if ($add) { $notification_handler =& xoops_gethandler('notification'); $tags['CATEGORY_NAME'] = $item->getVar('cat_title'); $tags['CATEGORY_URL'] = MYSHOP_URL . 'category.php?cat_cid=' . $item->getVar('cat_cid'); $tags['X_MODULE_URL'] = MYSHOP_URL;
$indiceAttached = 2; if (!myshop_utils::getModuleOption('create_thumbs')) { $destname = ''; $res2 = myshop_utils::uploadFile(1, MYSHOP_PICTURES_PATH); if ($res2 === true) { $item->setVar('product_thumb_url', basename($destname)); } else { if ($res2 !== false) { echo $res2; } } } else { $indiceAttached = 1; if (xoops_trim($mainPicture) != '') { $thumbName = MYSHOP_THUMBS_PREFIX . $mainPicture; myshop_utils::resizePicture(MYSHOP_PICTURES_PATH . DIRECTORY_SEPARATOR . $mainPicture, MYSHOP_PICTURES_PATH . DIRECTORY_SEPARATOR . $thumbName, myshop_utils::getModuleOption('thumbs_width'), myshop_utils::getModuleOption('thumbs_height'), true); $item->setVar('product_thumb_url', $thumbName); } } // Download $destname = ''; $res3 = myshop_utils::uploadFile($indiceAttached, MYSHOP_ATTACHED_FILES_PATH); if ($res3 === true) { $item->setVar('product_attachment', basename($destname)); } else { if ($res3 !== false) { echo $res3; } } $res = $h_myshop_products->insert($item); if ($res) {