Пример #1
0
             $sql = "INSERT INTO " . IMAGES_TABLE . "\r\n  \t\t\t\t\t\t\t\t\t\t(cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments" . $additional_field_sql . ")\r\n  \t\t\t\t\t\t\t\t\t\tVALUES\r\n  \t\t\t\t\t\t\t\t\t\t({$cat_id}, {$user_id}, '{$image_name}', '{$image_description}', '{$image_keywords}', {$image_date}, {$image_active}, '" . addslashes($image_media_file) . "', '" . addslashes($image_thumb_file) . "', '{$image_download_url}', {$image_allow_comments}" . $additional_value_sql . ")";
             $result = $site_db->query($sql);
             $image_id = $site_db->get_insert_id();
         }
     }
 } else {
     $log[] = $lang['file_not_found'];
 }
 if ($result) {
     $search_words = array();
     foreach ($search_match_fields as $image_column => $match_column) {
         if (isset($HTTP_POST_VARS[$image_column . '_' . $i])) {
             $search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column . '_' . $i]);
         }
     }
     add_searchwords($image_id, $search_words);
     $log[] = $lang['image_add_success'] . ": <b><a target=\"_blank\" href=\"" . $site_sess->url(ROOT_PATH . "details.php?image_id=" . $image_id) . "\">" . format_text($image_name) . "</a></b>";
     //ensure that rescaned images wont get same info as already added ones.
     $n++;
 } else {
     $log[] = $lang['cni_error'];
 }
 $log[] = "";
 unset($HTTP_POST_VARS['image_name_' . $i]);
 unset($HTTP_POST_VARS['image_media_file_' . $i]);
 unset($HTTP_POST_VARS['image_thumb_file_' . $i]);
 unset($HTTP_POST_VARS['image_name_' . $i]);
 unset($HTTP_POST_VARS['cat_id_' . $i]);
 unset($HTTP_POST_VARS['old_cat_id_' . $i]);
 unset($HTTP_POST_VARS['user_id_' . $i]);
 unset($HTTP_POST_VARS['image_description_' . $i]);
            $batchend = $max;
        }
        $batchcount++;
        echo "Fulltext Indexing ({$batchstart} to {$batchend}): ";
        flush();
        $sql = "SELECT *\n            FROM " . IMAGES_TABLE . "\n            WHERE image_id\n            BETWEEN {$batchstart} AND {$batchend}";
        $result = $site_db->query($sql);
        if ($row = $site_db->fetch_array($result)) {
            do {
                $search_words = array();
                foreach ($search_match_fields as $image_column => $match_column) {
                    if (isset($row[$image_column])) {
                        $search_words[$image_column] = $row[$image_column];
                    }
                }
                add_searchwords($row['image_id'], $search_words);
                echo ".";
                flush();
            } while ($row = $site_db->fetch_array($result));
        }
        $site_db->free_result($result);
        $counter += $batchsize;
        print " <b>OK</b><br />\n";
    }
    next_step("finish", "Update complete");
}
?>
<br />
    </td>
  </tr>
</table>