• [Mod] Toplist altered 5 0 5 1
Currently:  

Author Topic: [Mod] Toplist altered  (Read 234638 times)

0 Members and 1 Guest are viewing this topic.

Offline OtusDesign

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [Mod] Toplist altered
« Reply #180 on: July 15, 2008, 02:32:36 PM »
Thanks for rapid reply, I try this but I have error. My top.php is
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: top.php                                              *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 'top';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

$cache_id create_cache_id(
  
'page.top',
  array(
    
$user_info[$user_table_fields['user_id']],
    
$cat_id,
    
$config['template_dir'],
    
$config['language_dir']
  )
);

if (!
$cache_page_top || !$content get_cache_file($cache_id)) {
if (
$cache_page_top) {
  
// Always append session id if cache is enabled
  
$old_session_mode $site_sess->mode;
  
$site_sess->mode 'get';
}

ob_start();

$cat_match_sql = ($cat_id && check_permission("auth_viewcat"$cat_id)) ? "AND i.cat_id = '$cat_id' " "";
$register_array = array();

$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");

// Rating
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name".get_user_table_field(", u.""user_name").", i.image_thumb_file
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_rating DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_rating_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_rating_thumb_'.$i] = (isset($top_list[$i]['image_id']) && !empty($top_list[$i]['image_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\"><img src=\"data/thumbnails/".$top_list[$i]['cat_id']."/".$top_list[$i]['image_thumb_file']."\" width=\"200\" height=\"150\" border=\"0\" alt=\"\" /></a>" format_text(trim($top_list[$i]['image_name']), 2);

    
$register_array['image_rating_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_rating_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_rating_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_rating_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_rating_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
  }
  else {
    
$register_array['image_rating_'.$i] = "--";
    
$register_array['image_rating_user_'.$i] = "--";
    
$register_array['image_rating_cat_'.$i] = "--";
    
$register_array['image_rating_number_'.$i] = "--";
    
$register_array['image_rating_thumb_'.$i] = "--";
  }
}
// Votes
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_votes DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_votes_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_votes_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_votes_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_votes_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_votes_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_votes_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
  }
  else {
    
$register_array['image_votes_'.$i] = "--";
    
$register_array['image_votes_user_'.$i] = "--";
    
$register_array['image_votes_cat_'.$i] = "--";
    
$register_array['image_votes_number_'.$i] = "--";
  }
}

// Hits
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_hits, c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_hits DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_hits_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_hits_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_hits_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_hits_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_hits_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_hits_number_'.$i] = "<b>".$top_list[$i]['image_hits']."</b>";
  }
  else {
    
$register_array['image_hits_'.$i] = "--";
    
$register_array['image_hits_user_'.$i] = "--";
    
$register_array['image_hits_cat_'.$i] = "--";
    
$register_array['image_hits_number_'.$i] = "--";
  }
}

// Downloads
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_downloads, c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_downloads DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_downloads_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_downloads_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_downloads_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_downloads_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_downloads_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_downloads_number_'.$i] = "<b>".$top_list[$i]['image_downloads']."</b>";
  }
  else {
    
$register_array['image_downloads_'.$i] = "--";
    
$register_array['image_downloads_user_'.$i] = "--";
    
$register_array['image_downloads_cat_'.$i] = "--";
    
$register_array['image_downloads_number_'.$i] = "--";
  }
}

$site_template->register_vars($register_array);

//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if (
$cat_id && isset($cat_cache[$cat_id])) {
  
$clickstream .= get_category_path($cat_id1).$config['category_separator'];
}
$clickstream .= $lang['top_images']."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream,
  
"lang_top_image_hits" => $lang['top_image_hits'],
  
"lang_top_image_downloads" => $lang['top_image_downloads'],
  
"lang_top_image_rating" => $lang['top_image_rating'],
  
"lang_top_image_votes" => $lang['top_image_votes']
));
$site_template->print_template($site_template->parse_template($main_template));

$content ob_get_contents();
ob_end_clean();

if (
$cache_page_top) {
  
// Reset session mode
  
$site_sess->mode $old_session_mode;

  
save_cache_file($cache_id$content);
}

// end if get_cache_file()

echo $content;

include(
ROOT_PATH.'includes/page_footer.php');
?>
How to add this code and where

Offline Bob

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
Re: [Mod] Toplist altered
« Reply #181 on: July 15, 2008, 02:49:54 PM »
Test it:


Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: top.php                                              *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 'top';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

$cache_id create_cache_id(
  
'page.top',
  array(
    
$user_info[$user_table_fields['user_id']],
    
$cat_id,
    
$config['template_dir'],
    
$config['language_dir']
  )
);

if (!
$cache_page_top || !$content get_cache_file($cache_id)) {
if (
$cache_page_top) {
  
// Always append session id if cache is enabled
  
$old_session_mode $site_sess->mode;
  
$site_sess->mode 'get';
}

ob_start();

$cat_match_sql = ($cat_id && check_permission("auth_viewcat"$cat_id)) ? "AND i.cat_id = '$cat_id' " "";
$register_array = array();

$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");

// Rating
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name".get_user_table_field(", u.""user_name").", i.image_thumb_file
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_rating DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_rating_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" target=\"blank\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_rating_thumb_'.$i] = (isset($top_list[$i]['image_id']) && !empty($top_list[$i]['image_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" target=\"blank\"><img src=\"data/thumbnails/".$top_list[$i]['cat_id']."/".$top_list[$i]['image_thumb_file']."\" width=\"200\" height=\"150\" border=\"0\" alt=\"\" /></a>" format_text(trim($top_list[$i]['image_name']), 2);

    
$register_array['image_rating_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_rating_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\" target=\"blank\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_rating_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_rating_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\" target=\"blank\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_rating_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
  }
  else {
    
$register_array['image_rating_'.$i] = "--";
    
$register_array['image_rating_user_'.$i] = "--";
    
$register_array['image_rating_cat_'.$i] = "--";
    
$register_array['image_rating_number_'.$i] = "--";
    
$register_array['image_rating_thumb_'.$i] = "--";
  }
}
// Votes
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_votes DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_votes_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" target=\"blank\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_votes_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_votes_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\" target=\"blank\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_votes_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_votes_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\" target=\"blank\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_votes_number_'.$i] = "<b>".$top_list[$i]['image_rating']."</b> (".$top_list[$i]['image_votes']." ".$lang['votes'].")";
  }
  else {
    
$register_array['image_votes_'.$i] = "--";
    
$register_array['image_votes_user_'.$i] = "--";
    
$register_array['image_votes_cat_'.$i] = "--";
    
$register_array['image_votes_number_'.$i] = "--";
  }
}

// Hits
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_hits, c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_hits DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_hits_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" target=\"blank\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_hits_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_hits_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\" target=\"blank\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_hits_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_hits_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\" target=\"blank\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_hits_number_'.$i] = "<b>".$top_list[$i]['image_hits']."</b>";
  }
  else {
    
$register_array['image_hits_'.$i] = "--";
    
$register_array['image_hits_user_'.$i] = "--";
    
$register_array['image_hits_cat_'.$i] = "--";
    
$register_array['image_hits_number_'.$i] = "--";
  }
}

// Downloads
$sql "SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_downloads, c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id NOT IN (
$cat_id_sql) AND i.cat_id = c.cat_id
        
$cat_match_sql
        ORDER BY i.image_downloads DESC, i.image_name ASC
        LIMIT 10"
;
$result $site_db->query($sql);
$top_list = array();
$i 1;
while (
$row $site_db->fetch_array($result)) {
  
$top_list[$i] = $row;
  
$i++;
}
$site_db->free_result();

for (
$i 1$i <= 10$i++) {
  if (isset(
$top_list[$i])) {
    
$register_array['image_downloads_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" target=\"blank\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    
$register_array['image_downloads_openwindow_'.$i] = (check_permission("auth_viewimage"$top_list[$i]['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$top_list[$i]['image_id'])."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".format_text($top_list[$i]['image_name'])."</a>" format_text($top_list[$i]['image_name']);
    if (isset(
$top_list[$i][$user_table_fields['user_name']]) && $top_list[$i]['user_id'] != GUEST) {
      
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$top_list[$i]['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$top_list[$i]['user_id'];
      
$register_array['image_downloads_user_'.$i] = "<a href=\"".$site_sess->url($user_profile_link)."\" target=\"blank\">".format_text($top_list[$i][$user_table_fields['user_name']])."</a>";
    }
    else {
      
$register_array['image_downloads_user_'.$i] = $lang['userlevel_guest'];
    }
    
$register_array['image_downloads_cat_'.$i] = "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$top_list[$i]['cat_id'])."\" target=\"blank\">".format_text($top_list[$i]['cat_name'])."</a>";
    
$register_array['image_downloads_number_'.$i] = "<b>".$top_list[$i]['image_downloads']."</b>";
  }
  else {
    
$register_array['image_downloads_'.$i] = "--";
    
$register_array['image_downloads_user_'.$i] = "--";
    
$register_array['image_downloads_cat_'.$i] = "--";
    
$register_array['image_downloads_number_'.$i] = "--";
  }
}

$site_template->register_vars($register_array);

//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if (
$cat_id && isset($cat_cache[$cat_id])) {
  
$clickstream .= get_category_path($cat_id1).$config['category_separator'];
}
$clickstream .= $lang['top_images']."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream,
  
"lang_top_image_hits" => $lang['top_image_hits'],
  
"lang_top_image_downloads" => $lang['top_image_downloads'],
  
"lang_top_image_rating" => $lang['top_image_rating'],
  
"lang_top_image_votes" => $lang['top_image_votes']
));
$site_template->print_template($site_template->parse_template($main_template));

$content ob_get_contents();
ob_end_clean();

if (
$cache_page_top) {
  
// Reset session mode
  
$site_sess->mode $old_session_mode;

  
save_cache_file($cache_id$content);
}

// end if get_cache_file()

echo $content;

include(
ROOT_PATH.'includes/page_footer.php');
?>


Please Post your Url

Offline OtusDesign

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [Mod] Toplist altered
« Reply #182 on: July 15, 2008, 02:54:51 PM »
YESSSS its solved because of you Bob. I don't want to give my url now, after prepared I will show everybody  8)
Thanks a million Bob  :thumbup:

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: [Mod] Toplist altered
« Reply #183 on: July 15, 2008, 03:15:21 PM »
Woher bekomme ich denn die Topliste?

Wieder mal was falsch gelesen  :lol: 8) :oops:
Hat sich erledigt, es handelt sich um die Top10... ^^

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [Mod] Toplist altered
« Reply #184 on: May 15, 2009, 06:28:58 AM »
Quote from: M@2T
I have found in the code the "width" & "height" variables, is there a way to set the width and have the hight set proportionaly? so that the image will not be streched?
I'm not gonna post changes for original code, just for this fix:
http://4homepages.de/forum/viewtopic.php?p=13855#13855

So, in that fix, replace changes in step 2. to this:
Code: [Select]
  if (empty($top_list[$i]['image_thumb_file'])) {
   $thumb_file = ICON_PATH."/".get_file_extension($top_list[$i]['image_media_file']).".gif";
}else {
   $thumb_file = (is_remote($top_list[$i]['image_thumb_file'])) ? $top_list[$i]['image_thumb_file'] : THUMB_PATH."/".$top_list[$i]['cat_id']."/".$top_list[$i]['image_thumb_file'];
}
      $thumb_info = @getimagesize($thumb_file);
      $width = $thumb_info[0];
      $height = $thumb_info[1];
      $dimension = 48;
      $ratio = $width / $height;
      if ($ratio > 1) {
        $new_width = $dimension;
        $new_height = floor(($dimension/$width) * $height);
      }else {
        $new_width = floor(($dimension/$height) * $width);
        $new_height = $dimension;
      }
then, changee width=\"48\" to width=\"$new_width\"
same for height.
Repeat for each section.


Id like to set these porportionately too... but the link you posted in this answer is broken... Can you explain how to do this porportionately?

Thanks!
As long as I can finish my site before I die.

Offline SprinterMadl

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • Sprintermadl´s OnlineSite
Re: [Mod] Toplist altered
« Reply #185 on: June 06, 2009, 04:31:15 PM »
So. ich hab jetzt glaub ich ca. 3 Stunden gebraucht um mich in diesen Thread "einzuarbeiten", und die Schnipsel zu "installieren".

Ich gehör mit Sicherheit nicht zu denen die zu faul zum suchen sind, oder alles vorgekaut bekommen wollen, bin auch in der Lage ne Weile zu suchen bis ich das finde was ich brauche, bevor ich einen Thread auf machen, oder hier antworte.

Aber Dieser hier ist mal wieder das beste Beispiel, momentan 13 Seiten, und überall liegen Schnipsel rum, für nen Newbie ist es hier unmöglich sich Informationen zu holen und zu verarbeiten, ohne blöde Fragen zu stellen.
Gruß SprinterMadl


Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [Mod] Toplist altered
« Reply #186 on: October 12, 2009, 01:28:29 PM »
servus!

also wenn du den input von UFO aus diesem Thread hier befolgst, bekommst du ohne probleme die "10 meisten Kommentare" zum Laufen => Link
was brauchst du sonst noch?

gruss, bergblume

Offline zakaria666

  • Full Member
  • ***
  • Posts: 211
    • View Profile
Re: [Mod] Toplist altered
« Reply #187 on: August 11, 2010, 01:23:31 AM »
@Vano

I have finally fixed this, this is the first MOD i think i tried to do but was scared and i finally did.

If u click this link Vano, http://www.4homepages.de/forum/index.php?topic=2544.75 u will be directed to another page in this topic, please look at the 3 rd which is yours, u r trying to help someone with the proportionality of images in the top, i tried to click that link but the link is dead. Is there another link which u can show me to fix this proportionality issue i have.

God bless u vano and thanks again for a great help and MOD

Offline V@nо

  • Addicted member
  • ******
  • Posts: 1.223
    • View Profile
Re: [Mod] Toplist altered
« Reply #188 on: August 11, 2010, 02:24:17 AM »
Yes, an old link from the times when we used phpbb forum software.
Link fixed now.

P.S.
In case you didn't know, each reply has a unique address which you can find by hovering over headline. You can use these links instead of saying which post from the top you mean.

for example: http://www.4homepages.de/forum/index.php?topic=2544.msg22107#msg22107
Your first three "must do" before you ask a question:
If I asked you to PM me, I meant PM to my primary account, this account doesn't accept PMs.

Offline zakaria666

  • Full Member
  • ***
  • Posts: 211
    • View Profile
Re: [Mod] Toplist altered
« Reply #189 on: August 11, 2010, 02:46:09 PM »
@ Vano,

Thank u so much for the advice, its funny u mentioned it because i have spent hours trying to find out how it worked  :P and al i had to really do was to click on the header title.

1)
Sir i did exactly like u said and thank u for fixing the link, it was much appreciated. I have done it, but below is an image of what it looks like, i just wanted to know sir, is this how is suppose to look. The images up are all dummy images and some images are not in proportion to others, as u can see from the image below. I followed ur advice in proportionality



2)
and also one more thing sir in this link http://www.4homepages.de/forum/index.php?topic=2544.msg22107#msg22107 you are just missing 1 more parenthesis at the end inside the code. Sorry if i am wrong.

Thank u again Vano for great help and god bless u sir.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Toplist altered
« Reply #190 on: August 11, 2010, 04:03:06 PM »
It seems it's resizes by height...

Since this topic pretty much messed up, what code do you use, from witch reply?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline zakaria666

  • Full Member
  • ***
  • Posts: 211
    • View Profile
Re: [Mod] Toplist altered
« Reply #191 on: August 11, 2010, 04:23:41 PM »
Hello Vano

Im so so sorry sir, but u said that "what code do i size, from which reply", please do not be angry sir but i did not understand what u mean by this. But i assume u r saying to me show u the code tht i used for this. If i am wrong please i apologize.

Below is the code i used to bring the images on toplist to proportion..

 
Code: [Select]
if (empty($top_list[$i]['image_thumb_file'])) {
  $thumb_file = ICON_PATH."/".get_file_extension($top_list[$i]['image_media_file']).".gif";
}else {
  $thumb_file = (is_remote($top_list[$i]['image_thumb_file'])) ? $top_list[$i]['image_thumb_file'] : THUMB_PATH."/".$top_list[$i]['cat_id']."/".$top_list[$i]['image_thumb_file'];
}
      $thumb_info = @getimagesize($thumb_file);
      $width = $thumb_info[0];
      $height = $thumb_info[1];
      $dimension = 48;
      $ratio = $width / $height;
      if ($ratio > 1) {
        $new_width = $dimension;
        $new_height = floor(($dimension/$width) * $height);
      }else {
        $new_width = floor(($dimension/$height) * $width);
        $new_height = $dimension;
      }

Sorry if this is not what u are asking of me sir.

Thank u vano

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Toplist altered
« Reply #192 on: August 11, 2010, 04:48:16 PM »
actually I said "use", not "size" ;) wanted you to point out at the reply with the code of this mod you are using, but it's ok now, don't worry about it.

Looking at your screenshot, the images are proportional and resized properly, maintaining 48 pixels width or height which ever is larger.
If you want it always maintain 48 pixels width then replace
Code: [Select]
     if ($ratio > 1) {
        $new_width = $dimension;
        $new_height = floor(($dimension/$width) * $height);
      }else {
        $new_width = floor(($dimension/$height) * $width);
        $new_height = $dimension;
      }

with:
Code: [Select]
       $new_width = $dimension;
        $new_height = floor(($dimension/$width) * $height);
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline zakaria666

  • Full Member
  • ***
  • Posts: 211
    • View Profile
Re: [Mod] Toplist altered
« Reply #193 on: August 11, 2010, 05:12:59 PM »
@VAno,

Im so very sorry, i should have read ur post more carefully, how can i confuse size with use  :P

Vano i want to thank u again, i have tremandous admiration for u. Im very glad that u r not working for google or microsoft or apple because they will not appreciate ur work like we do. To many good and amazing programmers like u are very scarce and just make companies billions each year. Its very nice to see at least 1 like ur self helping out the community and have made an amazing software which i highly respect and i for one am very appreciative for it. I have through every post said thank u to u, but like i said, no words can show how much gratitude i hold for ur help.

thank u so much vano