<?php // // $Id: products.post.php 7538 2009-05-27 15:55:45Z lexa $ // if (!defined('AREA')) { die('Access denied'); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { return; } if ($mode == 'update') { // Assign attachments files for products $attachments = fn_get_attachments('product', $_REQUEST['product_id'], 'M', CART_LANGUAGE, empty($_REQUEST['rev']['product']) ? null : $_REQUEST['rev']['product'], empty($_REQUEST['rev_id']['product']) ? null : $_REQUEST['rev_id']['product']); Registry::set('navigation.tabs.attachments', array('title' => fn_get_lang_var('attachments'), 'js' => true)); $view->assign('attachments', $attachments); }
// Update attachments // if ($mode == 'update') { if (!empty($_REQUEST['attachment_data'])) { fn_update_attachments($_REQUEST['attachment_data'], $_REQUEST['attachment_id'], $_REQUEST['object_type'], $_REQUEST['object_id']); } } return array(CONTROLLER_STATUS_OK); // redirect should be performed via redirect_url always } if ($mode == 'getfile') { if (!empty($_REQUEST['attachment_id']) && !empty($_REQUEST['object_type']) && !empty($_REQUEST['object_id'])) { $data = fn_get_attachment($_REQUEST['attachment_id'], $_REQUEST['object_type'], $_REQUEST['object_id']); if (!empty($data['path'])) { fn_get_file($data['path']); } } exit; } elseif ($mode == 'delete') { fn_delete_attachments(array($_REQUEST['attachment_id']), $_REQUEST['object_type'], $_REQUEST['object_id']); $attachments = fn_get_attachments($_REQUEST['object_type'], $_REQUEST['object_id']); if (empty($attachments)) { $view->display('addons/attachments/views/attachments/manage.tpl'); } exit; } elseif ($mode == 'update') { // Assign attachments files for products $attachments = fn_get_attachments($_REQUEST['object_type'], $_REQUEST['object_id']); Registry::set('navigation.tabs.attachments', array('title' => fn_get_lang_var('attachments'), 'js' => true)); $view->assign('attachments', $attachments); }
<?php /*************************************************************************** * * * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ use Tygh\Registry; if (!defined('BOOTSTRAP')) { die('Access denied'); } if ($mode == 'view') { // Assign attachments files for products $product_id = !empty($_REQUEST['product_id']) ? intval($_REQUEST['product_id']) : 0; $attachments = fn_get_attachments('product', $product_id); if (!empty($attachments)) { Tygh::$app['view']->assign('attachments_data', $attachments); } }
<?php /*************************************************************************** * * * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ use Tygh\Registry; if (!defined('BOOTSTRAP')) { die('Access denied'); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { return; } if ($mode == 'update') { // Assign attachments files for products $attachments = fn_get_attachments('product', $_REQUEST['product_id'], 'M', DESCR_SL); Registry::set('navigation.tabs.attachments', array('title' => __('attachments'), 'js' => true)); Tygh::$app['view']->assign('attachments', $attachments); }
if ($_SERVER['REQUEST_METHOD'] == 'POST') { // // Create/update attachments // if ($mode == 'update') { if (!empty($_REQUEST['attachment_data'])) { fn_update_attachments($_REQUEST['attachment_data'], $_REQUEST['attachment_id'], $_REQUEST['object_type'], $_REQUEST['object_id'], 'M', null, DESCR_SL); } } if ($mode == 'delete') { fn_delete_attachments(array($_REQUEST['attachment_id']), $_REQUEST['object_type'], $_REQUEST['object_id']); $attachments = fn_get_attachments($_REQUEST['object_type'], $_REQUEST['object_id']); if (empty($attachments)) { Tygh::$app['view']->display('addons/attachments/views/attachments/manage.tpl'); } exit; } return array(CONTROLLER_STATUS_OK); // redirect should be performed via redirect_url always } if ($mode == 'getfile') { if (!empty($_REQUEST['attachment_id'])) { fn_get_attachment($_REQUEST['attachment_id']); } exit; } elseif ($mode == 'update') { // Assign attachments files for products $attachments = fn_get_attachments($_REQUEST['object_type'], $_REQUEST['object_id'], 'M', DESCR_SL); Registry::set('navigation.tabs.attachments', array('title' => __('attachments'), 'js' => true)); Tygh::$app['view']->assign('attachments', $attachments); }