function is_uploaded_file($file_name) { if (!($tmp_file = @get_cfg_var('upload_tmp_dir'))) { $tmp_file = tempnam('', ''); $deleted = @unlink($tmp_file); $tmp_file = dirname($tmp_file); } $tmp_file .= '/' . get_basefile($file_name); return preg_replace('#/+#', '/', $tmp_file) == $file_name ? 1 : 0; }
$file_name = $regs[1]; $file_extension = $regs[2]; $file['file_name'] = $file_name . ($size ? "_" . $size : "") . "." . $file_extension; $file['file_path'] = dirname($image_row['image_download_url']) . "/" . $file['file_name']; } else { $file['file_path'] = $image_row['image_download_url']; $remote_url = 1; } } elseif (is_remote_file($image_row['image_media_file'])) { preg_match("/(.+)\\.(.+)/", get_basefile($image_row['image_media_file']), $regs); $file_name = $regs[1]; $file_extension = $regs[2]; $file['file_name'] = $file_name . ($size ? "_" . $size : "") . "." . $file_extension; $file['file_path'] = dirname($image_row['image_media_file']) . "/" . $file['file_name']; } else { preg_match("/(.+)\\.(.+)/", get_basefile($image_row['image_media_file']), $regs); $file_name = $regs[1]; $file_extension = $regs[2]; $file['file_name'] = $file_name . ($size ? "_" . $size : "") . "." . $file_extension; $file['file_path'] = is_local_file($image_row['image_media_file']) ? dirname($image_row['image_media_file']) . "/" . $file['file_name'] : MEDIA_PATH . "/" . $image_row['cat_id'] . "/" . $file['file_name']; } if ($user_info['user_level'] != ADMIN) { $sql = "UPDATE " . IMAGES_TABLE . "\n SET image_downloads = image_downloads + 1\n WHERE image_id = {$image_id}"; $site_db->query($sql); } if (!empty($file['file_path'])) { @set_time_limit(120); if ($remote_url) { redirect($file['file_path']); } if ($action == "zip" && !preg_match("/\\.zip\$/i", $file['file_name']) && function_exists("gzcompress") && function_exists("crc32")) {
include ROOT_PATH . 'includes/upload.php'; $site_upload = new Upload(); // Upload Media file if (!empty($HTTP_POST_FILES['media_file']['tmp_name']) && $HTTP_POST_FILES['media_file']['tmp_name'] != "none") { $new_name = $site_upload->upload_file("media_file", "media", $upload_cat); if (!$new_name) { $msg .= ($msg != "" ? "<br />" : "") . "<b>" . $lang['file_upload_error'] . ": " . $new_name . "</b><br />" . $site_upload->get_upload_errors(); $uploaderror = 1; } } else { $new_name = $remote_media_file; } // Upload thumb file $new_thumb_name = ""; if (!empty($HTTP_POST_FILES['thumb_file']['tmp_name']) && $HTTP_POST_FILES['thumb_file']['tmp_name'] != "none" && !$uploaderror) { $new_thumb_name = $site_upload->upload_file("thumb_file", "thumb", $upload_cat, get_basefile($new_name)); if (!$new_thumb_name) { $msg .= ($msg != "" ? "<br />" : "") . "<b>" . $lang['thumb_upload_error'] . ": " . $new_thumb_name . "</b><br />" . $site_upload->get_upload_errors(); @unlink(MEDIA_TEMP_PATH . "/" . $new_name); $uploaderror = 1; } } elseif (check_remote_thumb($remote_thumb_file)) { $new_thumb_name = $remote_thumb_file; } elseif ($config['auto_thumbnail'] == 1 && !empty($new_name) && !$uploaderror && (!empty($HTTP_POST_FILES['media_file']['tmp_name']) && $HTTP_POST_FILES['media_file']['tmp_name'] != "none" || is_remote($new_name))) { if ($direct_upload) { if (is_remote($new_name)) { $src = $new_name; $thumb = create_unique_filename(THUMB_PATH . "/" . $cat_id, filterFileName($new_name)); } else { $src = MEDIA_PATH . "/" . $cat_id . "/" . $new_name; $thumb = $new_name;
* --------------------------------------------------------------- * * This script is NOT freeware! Please read the Copyright Notice * * (Licence.txt) for further information. * * * *************************************************************************/ $nozip = 1; define('IN_CP', 1); define('ROOT_PATH', './../'); require 'admin_global.php'; include ROOT_PATH . 'includes/db_utils.php'; $default_tables = array(CATEGORIES_TABLE, COMMENTS_TABLE, GROUP_ACCESS_TABLE, GROUP_MATCH_TABLE, GROUPS_TABLE, IMAGES_TABLE, IMAGES_TEMP_TABLE, LIGHTBOXES_TABLE, POSTCARDS_TABLE, SESSIONS_TABLE, SESSIONVARS_TABLE, SETTINGS_TABLE, USERS_TABLE, WORDLIST_TABLE, WORDMATCH_TABLE); if ($action == "") { $action = "modifybackups"; } if (isset($HTTP_GET_VARS['file']) || isset($HTTP_POST_VARS['file'])) { $file = isset($HTTP_GET_VARS['file']) ? get_basefile(trim($HTTP_GET_VARS['file'])) : get_basefile(trim($HTTP_POST_VARS['file'])); if (0 !== stripos(realpath(ROOT_PATH . DATABASE_DIR . "/" . $file), realpath(ROOT_PATH . DATABASE_DIR))) { $file = ""; } } else { $file = ""; } if ($action == "downloadbackup") { $size = @filesize(ROOT_PATH . DATABASE_DIR . "/" . $file); header("Content-type: application/x-unknown"); header("Content-length: {$size}\n"); header("Content-Disposition: attachment; filename={$file}\n"); readfile(ROOT_PATH . DATABASE_DIR . "/" . $file); exit; } if ($action == "showbackup") {
function get_file_name($file_name) { if (preg_match("#(.+)\\.(.+)#", get_basefile($file_name), $regs)) { return $regs[1]; } return false; }
$new_name = $site_upload->upload_file($file, "media", $cat_id); if (!$new_name) { $log[] = "<b>" . $lang['file_upload_error'] . ": " . $HTTP_POST_FILES[$file]['name'] . "</b><br />" . $site_upload->get_upload_errors(); $uploaderror = 1; } else { $log[] = "<b>" . $lang['file_upload_success'] . ": " . $new_name . "</b>"; } } else { $new_name = $remote_file; } //Upload Thumbnail if exists $thumb_file = "thumb_file_" . $i; $remote_thumb_file = trim($HTTP_POST_VARS['remote_thumb_file_' . $i]); $new_thumb_name = ""; if (!empty($HTTP_POST_FILES[$thumb_file]['tmp_name']) && $HTTP_POST_FILES[$thumb_file]['tmp_name'] != "none" && !$uploaderror) { $new_thumb_name = $site_upload->upload_file($thumb_file, "thumb", $cat_id, get_basefile($new_name)); if (!$new_thumb_name) { $log[] = "<b>" . $lang['thumb_upload_error'] . ": " . $HTTP_POST_FILES[$thumb_file]['name'] . "</b><br />" . $site_upload->get_upload_errors(); @unlink(MEDIA_PATH . "/" . $cat_id . "/" . $new_name); $log[] = $lang['error_image_deleted']; $uploaderror = 1; } else { $log[] = "<b>" . $lang['thumb_upload_success'] . ": " . $new_thumb_name . "</b>"; } } else { $new_thumb_name = $remote_thumb_file; } //Save to Database if (!$uploaderror) { $image_description = un_htmlspecialchars(trim($HTTP_POST_VARS['image_description_' . $i])); $image_keywords = un_htmlspecialchars(trim($HTTP_POST_VARS['image_keywords_' . $i]));
* --------------------------------------------------------------- * * This script is NOT freeware! Please read the Copyright Notice * * (Licence.txt) for further information. * * * *************************************************************************/ $templates_used = 'home,category_bit,whos_online,thumbnail_bit'; $main_template = 'home'; define('GET_CACHES', 1); define('ROOT_PATH', './'); define('MAIN_SCRIPT', __FILE__); define('GET_USER_ONLINE', 1); include ROOT_PATH . 'global.php'; require ROOT_PATH . 'includes/sessions.php'; $user_access = get_permission(); if (isset($HTTP_GET_VARS['template']) || isset($HTTP_POST_VARS['template'])) { $template = isset($HTTP_GET_VARS['template']) ? get_basefile(stripslashes($HTTP_GET_VARS['template'])) : get_basefile(stripslashes($HTTP_POST_VARS['template'])); if (!file_exists(TEMPLATE_PATH . "/" . $template . "." . $site_template->template_extension)) { $template = ""; } else { $main_template = $template; } } else { $template = ""; } include ROOT_PATH . 'includes/page_header.php'; if (!empty($template)) { $clickstream = "<a href=\"" . $site_sess->url(ROOT_PATH . "index.php") . "\">" . $lang['home'] . "</a>" . $config['category_separator'] . str_replace("_", " ", ucfirst($template)); $site_template->register_vars("clickstream", $clickstream); $site_template->print_template($site_template->parse_template($main_template)); include ROOT_PATH . 'includes/page_footer.php'; }