$echo .= '</div>'; if(is_array($videos)){ $echo .= '<div class="prodVideos">'; foreach($videos as $video){ $echo .= '<a href="'.$video.'" target="blank"> <img src="/images/video_play.png"> <span class="name">'.$video.'</span> </a>'; } $echo .= '</div>'; } $echo .= '</div>'; } echo $echo; break; case 'DeleteUploadedImage': $Images = new Images(); // var_dump($GLOBALS['PATH_root'].$_POST['src']); if($Images->remove($GLOBALS['PATH_root'].$_POST['src'])){ $echo = true; }else{ $echo = false; } echo json_encode($echo); break; default: break; } exit(); }
} } $tpl->Assign('promo', $Supplier->GetPromoCodes($_SESSION['member']['id_user'])); $tpl->Assign('code', $Users->GetUsersByPromoSupplier($_SESSION['member']['id_user'])); $parsed_res = array('issuccess' => true, 'html' => $tpl->Parse($GLOBALS['PATH_tpl'] . 'promo_codes.tpl')); } elseif (isset($cabinet_page) && $cabinet_page == "editproduct") { $GLOBALS['IERA_LINKS'][] = array('title' => 'Товары на модерации', 'url' => _base_url . '/cabinet/productsonmoderation/'); $header = "Добавление товара"; $GLOBALS['IERA_LINKS'][] = array('title' => $header, 'url' => _base_url . '/cabinet/editproduct/'); $tpl->Assign('units', $Unit->GetUnitsList()); $Images = new Images(); //Физическое удаление файлов if (isset($_POST['removed_images'])) { foreach ($_POST['removed_images'] as $k => $path) { if ($Products->CheckPhotosOnModeration($path)) { $Images->remove($GLOBALS['PATH_root'] . str_replace('/files/', 'files/', $path)); } } } // elseif(isset($_GET['remove']) == true){ // if($Products->CheckPhotosOnModeration($_POST['image'])){ // $Images->remove($GLOBALS['PATH_root']."files/".$_SESSION['member']['email']."/".$_POST['image']); // } // echo str_replace($GLOBALS['PATH_root'], '/', $GLOBALS['PATH_root']."files/".$_SESSION['member']['email']."/".$_POST['image']); // exit(0); // } if (isset($_GET['validate']) == true) { $Images->validate($_FILES, $GLOBALS['PATH_root'] . "files/" . $_SESSION['member']['email'] . "/"); exit(0); } elseif (isset($_GET['upload']) == true) { $path = isset($_REQUEST['path']) ? !strpos($_REQUEST['path'], $GLOBALS['PATH_global_root']) ? $_REQUEST['path'] : $GLOBALS['PATH_global_root'] . $_REQUEST['path'] : $GLOBALS['PATH_global_root'] . 'temp/';
exit; } $Unit = new Unit(); $Products = new Products(); $Images = new Images(); $Users = new Users(); $header = "Редактирование товара на модерации"; array_push($GLOBALS['IERA_LINKS'], array('url' => '/adm/product_moderation', 'title' => 'Товары на модерации')); array_push($GLOBALS['IERA_LINKS'], array('url' => '/adm/moderation_edit_product', 'title' => $header)); $tpl->Assign('units', $Unit->GetUnitsList()); if (isset($_POST['smb'])) { //Физическое удаление файлов if (isset($_POST['removed_images'])) { foreach ($_POST['removed_images'] as $k => $path) { if ($Products->CheckPhotosOnModeration($path)) { $Images->remove($GLOBALS['PATH_root'] . '..' . $path); } } } $Products->AddSupplierProduct($_POST); } $tpl->Assign('header', $header); $list = $Products->GetProductOnModeration($id); $Users->SetFieldsById($list['id_supplier']); $supplier_email = $Users->fields['email']; //Загрузка фото на сервер if (isset($_GET['upload']) == true) { $res = $Images->upload($_FILES, $GLOBALS['PATH_global_root'] . "files/" . $supplier_email . "/"); echo str_replace($GLOBALS['PATH_global_root'], '/', $res); exit(0); }
$_POST['images_visible'][0] = 1; } require_once $GLOBALS['PATH_block'] . 't_fnc.php'; // для ф-ции проверки формы if (isset($_POST['price']) && $_POST['price'] == "") { $_POST['price'] = 0; } list($err, $errm) = Product_form_validate(); if (!$err) { if (isset($_POST['images']) && !empty($_POST['images'])) { $to_resize = array(); //Физическое удалание файлов if (isset($_POST['removed_images']) && !empty($_POST['removed_images'])) { foreach ($_POST['removed_images'] as $path) { if (file_exists(str_replace('\\/', '/', $GLOBALS['PATH_global_root'] . $path)) && $Products->CheckImages($path)) { $Images->remove(str_replace('\\/', '/', $GLOBALS['PATH_global_root'] . $path)); } } } //Добавление фото foreach ($_POST['images'] as $k => &$image) { if (strpos($image, '/temp/') !== false) { $Images = new Images(); $path = $GLOBALS['PATH_product_img'] . 'original/' . date('Y') . '/' . date('m') . '/' . date('d') . '/'; $Images->checkStructure($path); $file = pathinfo($GLOBALS['PATH_global_root'] . $image); if (strpos($file['filename'], $_POST['art']) === false) { $file['filename'] = $_POST['art']; if (!empty(glob($GLOBALS['PATH_product_img'] . 'original/*/*/*/' . $file['filename'] . '.*'))) { $file['filename'] .= '-' . GenerateNewImageName($file['filename']); }