deepmob Posted January 1, 2009 Share Posted January 1, 2009 Hi friends, I want to modify the mihalism image host's viewer template, i want to add image view counter which shows me that how many times the image has been shown, this is the code of the templete <?php // ======================================== \ // Package: Mihalism Multi Host // Version: 4.0.0 // Copyright (c) 2007, 2008 Mihalism, Inc. // License: http://www.gnu.org/licenses/gpl.txt GNU Public License // ======================================== / require_once "./source/includes/data.php"; $mmhclass->templ->page_title = "{$mmhclass->info->config['site_name']} » Image Viewer"; if ($mmhclass->funcs->is_null($mmhclass->input->get_vars['file']) == true) { $mmhclass->templ->error("Please select an image file to continue.", true); } elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].basename($mmhclass->input->get_vars['file'])) == false) { $mmhclass->templ->error("The requested image file <b>{$mmhclass->input->get_vars['file']}</b> does not exist.", true); } elseif ($mmhclass->image->is_image($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].basename($mmhclass->input->get_vars['file'])) == false || in_array($mmhclass->image->file_extension($mmhclass->input->get_vars['file']), array("jpg", "jpeg", "ico", "bmp", "gif", "png")) == false) { $mmhclass->templ->error("The requested image file could not be displayed. Click <a href=\"download.php?file={$mmhclass->input->get_vars['file']}\">here</a> to download the requested image file.", true); } else { $filename = basename($mmhclass->input->get_vars['file']); $rating_info = $mmhclass->db->fetch_array($mmhclass->db->query("SELECT * FROM `mmh_file_ratings` WHERE `filename` = '{$filename}';")); $file_info = $mmhclass->image->get_image_info($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename); if ($mmhclass->input->get_vars['act'] == "rate_it" && $mmhclass->funcs->is_null($mmhclass->input->post_vars['rating_id']) == false) { $mmhclass->templ->templ_globals['new_file_rating'] = true; if (in_array($mmhclass->input->server_vars['remote_addr'], preg_split("/\|/", $rating_info['voted_by'])) == true) { $new_rating_html = $mmhclass->templ->error("Your IP address has already placed a rating on this image.", false); } else { if ($mmhclass->funcs->is_null($rating_info['rating_id']) == true) { $mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');"); } $mmhclass->db->query("UPDATE `mmh_file_ratings` SET `total_rating` = `total_rating` + {$mmhclass->input->post_vars['rating_id']}, `total_votes` = `total_votes` + 1, `voted_by` = '{$rating_info['voted_by']}|{$mmhclass->input->server_vars['remote_addr']}' WHERE `filename` = '{$filename}';"); $new_rating_html = $mmhclass->templ->message("Your rating has been successfully submitted. Below is the updated image rating. <br /><br /> <img src=\"index.php?module=rating&file={$filename}\" alt=\"File Rating\" />", false); } } $mmhclass->templ->templ_globals['file_info'] = $file_info; $mmhclass->templ->templ_vars[] = array( "UPLOAD_PATH" => $mmhclass->info->config['upload_path'], "FILENAME" => $filename, "IMAGE_WIDTH" => $file_info['width'], "IMAGE_HEIGHT" => $file_info['height'], "FILE_EXTENSION" => $mmhclass->image->file_extension($filename), "HIDDEN_COMMENT" => $file_info['comment'], "MIME_TYPE" => $file_info['mime'], "DATE_UPLOADED" => date($mmhclass->info->config['date_format'], $file_info['mtime']), "TOTAL_FILESIZE" => $mmhclass->image->format_filesize($file_info['bits']), "TOTAL_RATINGS" => $mmhclass->funcs->format_number($rating_info['total_votes']), "FILE_LINKS" => $mmhclass->templ->file_results($filename), "NEW_RATING_HTML" => $new_rating_html, ); $mmhclass->templ->output("viewer"); } ?> hope you guys get my problem. thanks Link to comment https://forums.phpfreaks.com/topic/139084-mihalism-image-host-modification/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.