function m_updateCompInfo() { if (!isset($this->request['bill_state_id']) || empty($this->request['bill_state_id'])) { $this->request['bill_state_id'] = ""; } else { $this->request['bill_state'] = ""; } #FILE UPLOADING START if ($this->libFunc->checkImageUpload("image1") && $_FILES["image1"]["tmp_name"] != "") { $fileUpload = new FileUpload(); $fileUpload->source = $_FILES["image1"]["tmp_name"]; $fileUpload->target = $this->imagePath . "company/" . $_FILES["image1"]["name"]; $newName1 = $fileUpload->upload(); $fileUpload->resampleImage($this->imagePath . "company/" . $newName1, 250, 250, 100); // [/DRK] if ($newName1 != false) { $image1 = $newName1; } } else { $this->obDb->query = "SELECT vLogo FROM " . COMPANYSETTINGS; $logo = $this->obDb->fetchQuery(); $image1 = $logo[0]->vLogo; } #INSERTING COMPANY DETAILS $this->obDb->query = "UPDATE " . COMPANYSETTINGS . " SET \n\t\tvCname ='" . $this->libFunc->m_addToDB($this->request['storeName']) . "',\n\t\tvAddress ='" . $this->libFunc->m_addToDB($this->request['storeAddress']) . "',\n\t\tvCity ='" . $this->libFunc->m_addToDB($this->request['storeCity']) . "',\n\t\tvState='" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',\n\t\tvStateName='" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',\n\t\tvCountry='" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',\n\t\tvZip='" . $this->libFunc->m_addToDB($this->request['storeZip']) . "',\n\t\tvFax ='" . $this->libFunc->m_addToDB($this->request['storeFax']) . "',\n\t\tvPhone ='" . $this->libFunc->m_addToDB($this->request['storePhone']) . "',\n\t\tvFreePhone ='" . $this->libFunc->m_addToDB($this->request['storeTollFree']) . "',\n\t\tvVatNumber ='" . $this->libFunc->m_addToDB($this->request['vatNumber']) . "',\n\t\tvRNumber ='" . $this->libFunc->m_addToDB($this->request['companyNumber']) . "',\n\t\tvSlogan ='" . $this->libFunc->m_addToDB($this->request['companySlogan']) . "',\n\t\tvLogo ='" . $image1 . "'"; $this->obDb->updateQuery(); $this->libFunc->m_mosRedirect(SITE_URL . "admin/adminindex.php?action=settings.company&msg=1"); }
function m_uploadImage() { $fileUpload = new FileUpload(); if ($this->request['type'] == "product") { $this->obDb->query = "SELECT iProdid_PK,vTitle,vImage1,vImage2,vImage3,tImages,vDownloadablefile "; $this->obDb->query .= " FROM " . PRODUCTS . " where iProdid_PK ='" . $this->request['id'] . "'"; $this->imagePath = $this->imagePath . "product/"; } elseif ($this->request['type'] == "content") { $this->obDb->query = "SELECT iContentId_PK,vTitle,vImage1,vImage2,vImage3 FROM " . CONTENTS; $this->obDb->query .= " WHERE iContentId_PK ='" . $this->request['id'] . "'"; $this->imagePath = $this->imagePath . "content/"; } else { $this->obDb->query = "SELECT iDeptId_PK,vTitle,vImage1,vImage2,vImage3 FROM " . DEPARTMENTS; $this->obDb->query .= " WHERE iDeptId_PK ='" . $this->request['id'] . "'"; $this->imagePath = $this->imagePath . "department/"; } $rsImage = $this->obDb->fetchQuery(); if ($this->libFunc->checkImageUpload("image1")) { if (is_file($this->imagePath . $rsImage[0]->vImage1)) { $fileUpload->deleteFile($this->imagePath . $rsImage[0]->vImage1); } $fileUpload->source = $_FILES["image1"]["tmp_name"]; $fileUpload->target = $this->imagePath . $_FILES["image1"]["name"]; $newName1 = $fileUpload->upload(); if ($newName1 != false) { $image1 = $newName1; // if ($this->libFunc->ifSet($this->request, "resample")) { // This section is used by product, dept and content: switch ($this->request['type']) { case "product": $fileUpload->resampleImage($this->imagePath . $newName1, UPLOAD_SMIMAGEWIDTH, UPLOAD_SMIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION); break; case "dept": $fileUpload->resampleImage($this->imagePath . $newName1, UPLOAD_DEPTSMIMAGEWIDTH, UPLOAD_DEPTSMIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION); break; case "content": $fileUpload->resampleImage($this->imagePath . $newName1, UPLOAD_CONTENTSMIMAGEWIDTH, UPLOAD_CONTENTSMIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION); break; } } // [/DRK] } $imagename = "image1"; } else { $image1 = $rsImage[0]->vImage1; $imagename = $this->request['current_image']; } if ($this->libFunc->checkImageUpload("image2")) { if (is_file($this->imagePath . $rsImage[0]->vImage2)) { $fileUpload->deleteFile($this->imagePath . $rsImage[0]->vImage2); } $fileUpload->source = $_FILES["image2"]["tmp_name"]; $fileUpload->target = $this->imagePath . $_FILES["image2"]["name"]; $newName2 = $fileUpload->upload(); if ($newName2 != false) { $image2 = $newName2; // if ($this->libFunc->ifSet($this->request, "resample")) { // This section is used by product and dept: switch ($this->request['type']) { case "product": $fileUpload->resampleImage($this->imagePath . $newName2, UPLOAD_MDIMAGEWIDTH, UPLOAD_MDIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION); break; case "dept": $fileUpload->resampleImage($this->imagePath . $newName2, UPLOAD_DEPTMDIMAGEWIDTH, UPLOAD_DEPTMDIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION); break; } } // [/DRK] } $imagename = "image2"; } else { $image2 = $rsImage[0]->vImage2; $imagename = $this->request['current_image']; } if ($this->libFunc->checkImageUpload("image3")) { if (is_file($this->imagePath . $rsImage[0]->vImage3)) { $fileUpload->deleteFile($this->imagePath . $rsImage[0]->vImage3); } $fileUpload->source = $_FILES["image3"]["tmp_name"]; $fileUpload->target = $this->imagePath . $_FILES["image3"]["name"]; $newName3 = $fileUpload->upload(); if ($newName3 != false) { $image3 = $newName3; if ($this->libFunc->ifSet($this->request, "resample")) { $fileUpload->resampleImage($this->imagePath . $newName3, UPLOAD_LGIMAGEWIDTH, UPLOAD_LGIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION); } } $imagename = "image3"; } else { $image3 = $rsImage[0]->vImage3; $imagename = $this->request['current_image']; } if ($this->request['type'] == "product") { if ($this->libFunc->checkFileUpload("image4")) { if (is_file($this->imagePath . "../files/" . $rsImage[0]->vDownloadablefile)) { $fileUpload->deleteFile($this->imagePath . "../files/" . $rsImage[0]->vDownloadablefile); } $fileUpload->source = $_FILES["image4"]["tmp_name"]; $fileUpload->target = $this->imagePath . "../files/" . $_FILES["image4"]["name"]; $newName4 = $fileUpload->upload(); if ($newName4 != false) { $image4 = $newName4; } $imagename = "image4"; } else { $image4 = $rsImage[0]->vDownloadablefile; $imagename = $this->request['current_image']; } } if ($this->request['type'] == "product") { $extraimages = explode(",", $rsImage[0]->tImages); $countExtraImage = count($extraimages); if (substr($this->request['current_image'], 0, -1) == 'extraimage') { $j = substr($this->request['current_image'], -1); $t = $j - 1; if ($this->libFunc->checkImageUpload("extraimage" . $j)) { if (is_file($this->imagePath . $extraimages[$t])) { $fileUpload->deleteFile($this->imagePath . $extraimages[$t]); } $fileUpload->source = $_FILES["extraimage" . $j]["tmp_name"]; $fileUpload->target = $this->imagePath . $_FILES["extraimage" . $j]["name"]; $newName[$j] = $fileUpload->upload(); if ($newName[$j] != false) { $image[$j] = $newName[$j]; } $imagename = "extraimage" . $j; } else { $image[$j] = $extraimages[$t]; $imagename = $this->request['current_image']; } $extraimages[$t] = $image[$j]; } $imageString = ""; for ($i = 0; $i < 6; $i++) { $imageString .= $extraimages[$i] . ","; } } //---- if ($this->request['type'] == "product") { $this->obDb->query = "UPDATE " . PRODUCTS . " SET \n\t\t\t\t\t\t `vImage1`='{$image1}', `vImage2`='{$image2}', `vImage3`='{$image3}',`tImages`= '" . $imageString . "', vDownloadablefile='{$image4}',\n\t\t\t\t\t\t `tmEditDate`='" . time() . "', `iAdminUser` ='" . $_SESSION['uid'] . "' where iProdId_PK = " . $this->request['id']; } elseif ($this->request['type'] == "content") { $this->obDb->query = "UPDATE " . CONTENTS . " SET \n\t\t\t\t\t\t `vImage1`='{$image1}', `vImage2`='{$image2}', `vImage3`='{$image3}',\n\t\t\t\t\t\t `tmEditDate`='" . time() . "', `vAdminUser` ='" . $_SESSION['uid'] . "' where iContentId_PK = " . $this->request['id']; } else { $this->obDb->query = "UPDATE " . DEPARTMENTS . " SET \n\t\t\t\t\t\t `vImage1`='{$image1}', `vImage2`='{$image2}', `vImage3`='{$image3}',\n\t\t\t\t\t\t `tmEditDate`='" . time() . "', `vAdminUser` ='" . $_SESSION['uid'] . "' where iDeptId_PK = " . $this->request['id']; } $this->obDb->updateQuery(); if (!isset($imagename)) { $imagename = 'image1'; } $str = SITE_URL . "ecom/adminindex.php?action=ec_show.dspUploadFrm&status=1&image={$imagename}&id=" . $this->request['id'] . "&type=" . $this->request['type']; $this->libFunc->m_mosRedirect($str); }