| @@ 60-113 (lines=54) @@ | ||
| 57 | * @param $event_picture1 |
|
| 58 | * @param $event_picture2 |
|
| 59 | */ |
|
| 60 | public static function extcal_loadImg(&$REQUEST, &$event_picture1, &$event_picture2) |
|
| 61 | { |
|
| 62 | /////////////////////////////////////////////////////////////////////////////// |
|
| 63 | $uploaddir_event = XOOPS_ROOT_PATH . '/uploads/extcal/'; |
|
| 64 | $uploadurl_event = XOOPS_URL . '/uploads/extcal/'; |
|
| 65 | //$picture = ''; |
|
| 66 | for ($j = 1; $j < 3; ++$j) { |
|
| 67 | $delimg = @$REQUEST['delimg_' . $j . '']; |
|
| 68 | $delimg = isset($delimg) ? (int)$delimg : 0; |
|
| 69 | if (0 == $delimg && !empty($REQUEST['xoops_upload_file'][$j])) { |
|
| 70 | $upload = new \XoopsMediaUploader($uploaddir_event, [ |
|
| 71 | 'image/gif', |
|
| 72 | 'image/jpeg', |
|
| 73 | 'image/pjpeg', |
|
| 74 | 'image/x-png', |
|
| 75 | 'image/png', |
|
| 76 | 'image/jpg', |
|
| 77 | ], 3145728, null, null); |
|
| 78 | if ($upload->fetchMedia($REQUEST['xoops_upload_file'][$j])) { |
|
| 79 | $upload->setPrefix('event_'); |
|
| 80 | $upload->fetchMedia($REQUEST['xoops_upload_file'][$j]); |
|
| 81 | if (!$upload->upload()) { |
|
| 82 | $errors = $upload->getErrors(); |
|
| 83 | redirect_header('javascript:history.go(-1)', 3, $errors); |
|
| 84 | } else { |
|
| 85 | if (1 == $j) { |
|
| 86 | $event_picture1 = $upload->getSavedFileName(); |
|
| 87 | } elseif (2 == $j) { |
|
| 88 | $event_picture2 = $upload->getSavedFileName(); |
|
| 89 | } |
|
| 90 | } |
|
| 91 | } elseif (!empty($REQUEST['file' . $j])) { |
|
| 92 | if (1 == $j) { |
|
| 93 | $event_picture1 = $REQUEST['file' . $j]; |
|
| 94 | } elseif (2 == $j) { |
|
| 95 | $event_picture2 = $REQUEST['file' . $j]; |
|
| 96 | } |
|
| 97 | } |
|
| 98 | } else { |
|
| 99 | $url_event = XOOPS_ROOT_PATH . '/uploads/extcal/' . $REQUEST['file' . $j]; |
|
| 100 | if (1 == $j) { |
|
| 101 | $event_picture1 = ''; |
|
| 102 | } elseif (2 == $j) { |
|
| 103 | $event_picture2 = ''; |
|
| 104 | } |
|
| 105 | if (is_file($url_event)) { |
|
| 106 | chmod($url_event, 0777); |
|
| 107 | unlink($url_event); |
|
| 108 | } |
|
| 109 | } |
|
| 110 | } |
|
| 111 | //exit; |
|
| 112 | /////////////////////////////////////////////////////////////////////////////// |
|
| 113 | } |
|
| 114 | ||
| 115 | /******************************************************************* |
|
| 116 | * |
|
| @@ 47-100 (lines=54) @@ | ||
| 44 | * @param $event_picture1 |
|
| 45 | * @param $event_picture2 |
|
| 46 | */ |
|
| 47 | function extcal_loadImg(&$REQUEST, &$event_picture1, &$event_picture2) |
|
| 48 | { |
|
| 49 | /////////////////////////////////////////////////////////////////////////////// |
|
| 50 | $uploaddir_event = XOOPS_ROOT_PATH . '/uploads/extcal/'; |
|
| 51 | $uploadurl_event = XOOPS_URL . '/uploads/extcal/'; |
|
| 52 | //$picture = ''; |
|
| 53 | for ($j = 1; $j < 3; ++$j) { |
|
| 54 | $delimg = @$REQUEST['delimg_' . $j . '']; |
|
| 55 | $delimg = isset($delimg) ? (int)$delimg : 0; |
|
| 56 | if (0 == $delimg && !empty($REQUEST['xoops_upload_file'][$j])) { |
|
| 57 | $upload = new \XoopsMediaUploader($uploaddir_event, [ |
|
| 58 | 'image/gif', |
|
| 59 | 'image/jpeg', |
|
| 60 | 'image/pjpeg', |
|
| 61 | 'image/x-png', |
|
| 62 | 'image/png', |
|
| 63 | 'image/jpg', |
|
| 64 | ], 3145728, null, null); |
|
| 65 | if ($upload->fetchMedia($REQUEST['xoops_upload_file'][$j])) { |
|
| 66 | $upload->setPrefix('event_'); |
|
| 67 | $upload->fetchMedia($REQUEST['xoops_upload_file'][$j]); |
|
| 68 | if (!$upload->upload()) { |
|
| 69 | $errors = $upload->getErrors(); |
|
| 70 | redirect_header('javascript:history.go(-1)', 3, $errors); |
|
| 71 | } else { |
|
| 72 | if (1 == $j) { |
|
| 73 | $event_picture1 = $upload->getSavedFileName(); |
|
| 74 | } elseif (2 == $j) { |
|
| 75 | $event_picture2 = $upload->getSavedFileName(); |
|
| 76 | } |
|
| 77 | } |
|
| 78 | } elseif (!empty($REQUEST['file' . $j])) { |
|
| 79 | if (1 == $j) { |
|
| 80 | $event_picture1 = $REQUEST['file' . $j]; |
|
| 81 | } elseif (2 == $j) { |
|
| 82 | $event_picture2 = $REQUEST['file' . $j]; |
|
| 83 | } |
|
| 84 | } |
|
| 85 | } else { |
|
| 86 | $url_event = XOOPS_ROOT_PATH . '/uploads/extcal/' . $REQUEST['file' . $j]; |
|
| 87 | if (1 == $j) { |
|
| 88 | $event_picture1 = ''; |
|
| 89 | } elseif (2 == $j) { |
|
| 90 | $event_picture2 = ''; |
|
| 91 | } |
|
| 92 | if (is_file($url_event)) { |
|
| 93 | chmod($url_event, 0777); |
|
| 94 | unlink($url_event); |
|
| 95 | } |
|
| 96 | } |
|
| 97 | } |
|
| 98 | //exit; |
|
| 99 | /////////////////////////////////////////////////////////////////////////////// |
|
| 100 | } |
|
| 101 | ||
| 102 | /******************************************************************* |
|
| 103 | * |
|