Пример #1
0
     $image_name = un_htmlspecialchars(trim($HTTP_POST_VARS['image_name_' . $i]));
     $cat_id = intval($HTTP_POST_VARS['cat_id_' . $i]);
     $user_id = intval($HTTP_POST_VARS['user_id_' . $i]) != 0 ? intval($HTTP_POST_VARS['user_id_' . $i]) : $user_info['user_id'];
     $remote_file = trim($HTTP_POST_VARS['remote_file_' . $i]);
     $remote_thumb_file = trim($HTTP_POST_VARS['remote_thumb_file_' . $i]);
     $image_download_url = trim($HTTP_POST_VARS['image_download_url_' . $i]);
     if ($image_name == "") {
         $error['image_name_' . $i] = 1;
     }
     if ($cat_id == 0) {
         $error['cat_id_' . $i] = 1;
     }
     if ((empty($HTTP_POST_FILES['file_' . $i]['tmp_name']) || $HTTP_POST_FILES['file_' . $i]['tmp_name'] == "none") && $remote_file == "" || $remote_file != "" && !check_remote_media($remote_file) && !check_local_media($remote_file)) {
         $error['file_' . $i] = 1;
     }
     if ($remote_thumb_file != "" && !check_remote_thumb($remote_thumb_file) && !check_local_thumb($remote_thumb_file)) {
         $error['remote_thumb_file_' . $i] = 1;
     }
     if ($image_download_url != "" && !is_remote($image_download_url) && !is_local_file($image_download_url)) {
         $error['image_download_url_' . $i] = 1;
     }
     if (!empty($additional_image_fields)) {
         foreach ($additional_image_fields as $key => $val) {
             if (isset($HTTP_POST_VARS[$key . '_' . $i]) && intval($val[2]) == 1 && trim($HTTP_POST_VARS[$key . '_' . $i]) == "") {
                 $error[$key . '_' . $i] = 1;
             }
         }
     }
 }
 if (empty($error)) {
     for ($i = 1; $i <= $num_newimages; $i++) {
Пример #2
0
 $old_thumb_file_name = trim($HTTP_POST_VARS['old_thumb_file_name']);
 $image_download_url = trim($HTTP_POST_VARS['image_download_url']);
 $delete_thumb_file = isset($HTTP_POST_VARS['delete_thumb_file']) && $HTTP_POST_VARS['delete_thumb_file'] == 1 ? 1 : 0;
 if ($image_name == "") {
     $error['image_name'] = 1;
 }
 if ($cat_id == 0) {
     $error['cat_id'] = 1;
 }
 if ($image_download_url != "" && !is_remote($image_download_url) && !is_local_file($image_download_url)) {
     $error['image_download_url'] = 1;
 }
 if ((empty($HTTP_POST_FILES['file']['tmp_name']) || $HTTP_POST_FILES['file']['tmp_name'] == "none") && $remote_file != "" && !check_remote_media($remote_file) && !check_local_media($remote_file)) {
     $error['remote_file'] = 1;
 }
 if ((empty($HTTP_POST_FILES['thumb_file']['tmp_name']) || $HTTP_POST_FILES['thumb_file']['tmp_name'] == "none") && $remote_thumb_file != "" && !check_remote_thumb($remote_thumb_file) && !check_local_thumb($remote_thumb_file)) {
     $error['remote_thumb_file'] = 1;
 }
 if (!empty($additional_image_fields)) {
     foreach ($additional_image_fields as $key => $val) {
         if (isset($HTTP_POST_VARS[$key]) && intval($val[2]) == 1 && trim($HTTP_POST_VARS[$key]) == "") {
             $error[$key] = 1;
         }
     }
 }
 if (!empty($HTTP_POST_FILES['file']['tmp_name']) && $HTTP_POST_FILES['file']['tmp_name'] != "none" && !$error) {
     unset($HTTP_POST_VARS['remote_file']);
     @rename(MEDIA_TEMP_PATH . "/" . $old_file_name, MEDIA_TEMP_PATH . "/" . $old_file_name . ".bak");
     $new_name = $site_upload->upload_file("file", "media", 0);
     if (!$new_name) {
         $error_msg .= $lang['file_upload_error'] . ": <b>" . $HTTP_POST_FILES['file']['name'] . "</b><br />" . $site_upload->get_upload_errors();