} $db->sql_freeresult($result); // Sync Thumbnails (make sure all non-existent thumbnails are deleted) - the other way around // Get all Posts/PM's with the Thumbnail Flag NOT set // Go through all of them and make sure the Thumbnail does NOT exist. If it does exist, delete it $sql = "SELECT attach_id, physical_filename, thumbnail FROM " . ATTACHMENTS_DESC_TABLE . " WHERE thumbnail = 0"; $result = $db->sql_query($sql); echo '<br />'; $i = 0; while ($row = $db->sql_fetchrow($result)) { @flush(); echo '.'; if ($i % 50 == 0) { echo '<br />'; } if (thumbnail_exists(basename($row['physical_filename']))) { $info .= sprintf($lang['Sync_thumbnail_resetted'], $row['physical_filename']) . '<br />'; unlink_attach(basename($row['physical_filename']), MODE_THUMBNAIL); } $i++; } $db->sql_freeresult($result); $cache->destroy('config'); @flush(); die('<br /><br /><br />' . $lang['Attach_sync_finished'] . '<br /><br />' . $info); exit; } // Quota Limit Settings if ($submit && $mode == 'quota') { // Change Quota Limit $quota_change_list = request_var('quota_change_list', array(0));
$logo_src = $logo_path . $_SESSION['brand'] . ".jpg"; } else { $logo_src = $logo_path . $_SESSION['brand'] . ".gif"; } echo " <tr>\n<td colspan='{$num_columns}'><img src='{$logo_src}' border='0' alt='" . $_SESSION['brand'] . " logo'></td>\n</tr>\n"; } } $cell_num = 0; while ($row1 = @mysql_fetch_array($result1)) { $cell_num++; if ($cell_num == 1) { echo " <tr>\n"; } echo " <td><a href='product.php?id=" . $row1['id'] . "'>"; if (thumbnail_exists($image_fullpath, $row1['item_num'], 1)) { $image_src = $image_path . thumbnail_exists($image_fullpath, $row1['item_num'], 1); $image_info = getimagesize($image_src); echo "<img src='{$image_src}' " . $image_info[3] . " border='0' alt='" . $row1['id'] . "' /></a>\n"; } else { if (photo_exists($image_fullpath, $row1['item_num'], 1)) { $image_src = $image_path . photo_exists($image_fullpath, $row1['item_num'], 1); $image_info = getimagesize($image_src); echo "<img src='{$image_src}' " . $image_info[3] . " border='0' alt='" . $row1['id'] . "' /></a>\n"; } else { echo "<img src='images/no_image.jpg' width='200' height='150' border='0' alt='No image available' /></a>\n"; } } echo "<br />\n"; echo "<a href='product.php?id=" . $row1['id'] . "' class='product_link'>\n"; $arr_field_limits = explode(',', $field_limits); if (!empty($row1[3])) {
$num_rows = $db->sql_numrows($result); for ($i = 0; $i < $num_rows; $i++) { $extension = strtolower(trim($rows[$i]['extension'])); $allowed_extensions[] = $extension; $download_mode[$extension] = $rows[$i]['download_mode']; } // disallowed ? if (!in_array($attachment['extension'], $allowed_extensions) && $user->data['user_level'] != ADMIN) { message_die(GENERAL_MESSAGE, sprintf($lang['Extension_disabled_after_posting'], $attachment['extension'])); } $download_mode = intval($download_mode[$attachment['extension']]); if ($thumbnail) { include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'includes/functions_admin.' . PHP_EXT; include_once IP_ROOT_PATH . ATTACH_MOD_PATH . 'includes/functions_thumbs.' . PHP_EXT; $thumbnail_path = THUMB_DIR . '/t_' . $attachment['physical_filename']; if (!thumbnail_exists(basename($thumbnail_path))) { if (!intval($config['allow_ftp_upload'])) { $source = $upload_dir . '/' . basename($attachment['physical_filename']); $dest_file = @amod_realpath($upload_dir); $dest_file .= '/' . $thumbnail_path; } else { $source = $attachment['physical_filename']; $dest_file = $thumbnail_path; } if (!create_thumbnail($source, $dest_file, $attachment['mimetype'])) { $thumbnail = 0; } else { $attachment['physical_filename'] = $thumbnail_path; } } }
/** * Sync Thumbnail (if a thumbnail is no longer there, delete it) */ function check_thumbnail($attachment_data, $upload_dir) { global $config, $user, $lang; if (!thumbnail_exists(basename($attachment_data['physical_filename']))) { if (!intval($config['allow_ftp_upload'])) { $source_file = $upload_dir . '/' . basename($attachment_data['physical_filename']); $dest_file = @amod_realpath($upload_dir); $dest_file .= '/' . THUMB_DIR . '/t_' . basename($attachment_data['physical_filename']); } else { $source_file = $attachment_data['physical_filename']; $dest_file = THUMB_DIR . '/t_' . basename($attachment_data['physical_filename']); } if (create_thumbnail($source_file, $dest_file, $attachment_data['mimetype'])) { return 1; } } return 0; }