Code Duplication    Length = 10-11 lines in 6 locations

admin/actions/categories.php 1 location

@@ 227-236 (lines=10) @@
224
225
        $destname = '';
226
        $res1     = OledrionUtility::uploadFile(0, OLEDRION_PICTURES_PATH);
227
        if ($res1 === true) {
228
            if (OledrionUtility::getModuleOption('resize_others')) { // Eventuellement on redimensionne l'image
229
                OledrionUtility::resizePicture(OLEDRION_PICTURES_PATH . '/' . $destname, OLEDRION_PICTURES_PATH . '/' . $destname, OledrionUtility::getModuleOption('images_width'), OledrionUtility::getModuleOption('images_height'), true);
230
            }
231
            $item->setVar('cat_imgurl', basename($destname));
232
        } else {
233
            if ($res1 !== false) {
234
                echo $res1;
235
            }
236
        }
237
238
        $res = $h_oledrion_cat->insert($item);
239
        if ($res) {

admin/actions/delivery.php 1 location

@@ 167-176 (lines=10) @@
164
        }
165
        $destname = '';
166
        $res1     = OledrionUtility::uploadFile(0, OLEDRION_PICTURES_PATH);
167
        if ($res1) {
168
            if (OledrionUtility::getModuleOption('resize_others')) { // Eventuellement on redimensionne l'image
169
                OledrionUtility::resizePicture(OLEDRION_PICTURES_PATH . '/' . $destname, OLEDRION_PICTURES_PATH . '/' . $destname, OledrionUtility::getModuleOption('images_width'), OledrionUtility::getModuleOption('images_height'), true);
170
            }
171
            $item->setVar('delivery_image', basename($destname));
172
        } else {
173
            if ($res1 !== false) {
174
                echo $res1;
175
            }
176
        }
177
        $res = $h_oledrion_delivery->insert($item);
178
179
        $delivery_id = $item->getVar('delivery_id');

admin/actions/manufacturers.php 1 location

@@ 172-181 (lines=10) @@
169
        // Upload des fichiers
170
        for ($i = 1; $i <= 5; ++$i) {
171
            $res1 = OledrionUtility::uploadFile($i - 1, OLEDRION_PICTURES_PATH);
172
            if ($res1 === true) {
173
                if (OledrionUtility::getModuleOption('resize_others')) { // Eventuellement on redimensionne l'image
174
                    OledrionUtility::resizePicture(OLEDRION_PICTURES_PATH . '/' . $destname, OLEDRION_PICTURES_PATH . 'l' . $destname, OledrionUtility::getModuleOption('images_width'), OledrionUtility::getModuleOption('images_height'), true);
175
                }
176
                $item->setVar('manu_photo' . $i, basename($destname));
177
            } else {
178
                if ($res1 !== false) {
179
                    echo $res1;
180
                }
181
            }
182
        }
183
184
        $res = $h_oledrion_manufacturer->insert($item);

admin/actions/packing.php 1 location

@@ 144-153 (lines=10) @@
141
        }
142
        $destname = '';
143
        $res1     = OledrionUtility::uploadFile(0, OLEDRION_PICTURES_PATH);
144
        if ($res1) {
145
            if (OledrionUtility::getModuleOption('resize_others')) { // Eventuellement on redimensionne l'image
146
                OledrionUtility::resizePicture(OLEDRION_PICTURES_PATH . '/' . $destname, OLEDRION_PICTURES_PATH . '/' . $destname, OledrionUtility::getModuleOption('images_width'), OledrionUtility::getModuleOption('images_height'), true);
147
            }
148
            $item->setVar('packing_image', basename($destname));
149
        } else {
150
            if ($res1 !== false) {
151
                echo $res1;
152
            }
153
        }
154
        $res = $h_oledrion_packing->insert($item);
155
        if ($res) {
156
            OledrionUtility::updateCache();

admin/actions/payment.php 1 location

@@ 165-174 (lines=10) @@
162
        }
163
        $destname = '';
164
        $res1     = OledrionUtility::uploadFile(0, OLEDRION_PICTURES_PATH);
165
        if ($res1) {
166
            if (OledrionUtility::getModuleOption('resize_others')) { // Eventuellement on redimensionne l'image
167
                OledrionUtility::resizePicture(OLEDRION_PICTURES_PATH . '/' . $destname, OLEDRION_PICTURES_PATH . '/' . $destname, OledrionUtility::getModuleOption('images_width'), OledrionUtility::getModuleOption('images_height'), true);
168
            }
169
            $item->setVar('payment_image', basename($destname));
170
        } else {
171
            if ($res1 !== false) {
172
                echo $res1;
173
            }
174
        }
175
        $res = $h_oledrion_payment->insert($item);
176
        if ($res) {
177
            OledrionUtility::updateCache();

admin/actions/products.php 1 location

@@ 749-759 (lines=11) @@
746
        $destname    = '';
747
        $mainPicture = '';
748
        $res1        = OledrionUtility::uploadFile(0, OLEDRION_PICTURES_PATH);
749
        if ($res1 === true) {
750
            $mainPicture = $destname;
751
            if (OledrionUtility::getModuleOption('resize_main')) { // On redimensionne l'image principale
752
                OledrionUtility::resizePicture(OLEDRION_PICTURES_PATH . '/' . $destname, OLEDRION_PICTURES_PATH . '/' . $destname, OledrionUtility::getModuleOption('images_width'), OledrionUtility::getModuleOption('images_height'), true);
753
            }
754
            $item->setVar('product_image_url', basename($destname));
755
        } else {
756
            if ($res1 !== false) {
757
                echo $res1;
758
            }
759
        }
760
761
        $indiceAttached = 2;
762
        // Upload de la vignette