1
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
"url_top_rated" => $site_sess->url(ROOT_PATH."top_rated.php"),
"lang_top_rated" => $lang['top_rated'],
$lang['top_rated'] = "Top Rated";
$lang['top_rated_desc'] = "Here is one photo from each category with the highest rank.";
<?php
/* --------- Most rated imade from each category on one page with paging ----------------- */
$templates_used = 'top_rated,thumbnail_bit';
$main_template = 'top_rated';
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_rated',
array(
$user_info[$user_table_fields['user_id']],
$cat_id,
$page,
$perpage,
isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
$config['template_dir'],
$config['language_dir']
)
);
if (!$cache_page_top_rated || !$content = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_top_rated) {
$old_session_mode = $site_sess->mode;
$site_sess->mode = 'get';
}
ob_start();
//-----------------------------------------------------
//--- Show Images -------------------------------------
//-----------------------------------------------------
$sql = "SELECT cat_id
FROM ".IMAGES_TABLE."
WHERE cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
GROUP BY cat_id";
$result = $site_db->query($sql);
$num_rows_all = mysql_num_rows($result);
$link_arg = $site_sess->url(ROOT_PATH."top_rated.php");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $perpage, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats()
));
$imgtable_width = ceil((intval($config['image_table_width'])) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", a.".$key;
}
}
$sql = "SELECT a.image_id, a.cat_id, a.user_id, a.image_description, a.image_keywords, a.image_date, a.image_active, a.image_media_file, a.image_thumb_file, a.image_download_url, a.image_allow_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_hits".$additional_sql.", a.image_name, c.cat_name
FROM (".IMAGES_TABLE." a, ".CATEGORIES_TABLE." c)
WHERE a.image_active = 1 AND a.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND a.image_votes != 0 AND a.image_rating = (SELECT MAX(image_rating)
FROM ".IMAGES_TABLE." b
WHERE a.cat_id= b.cat_id)
GROUP BY a.cat_id
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT $offset, $perpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$thumbnails = "";
$msg = $lang['no_images'];
}
else {
$thumbnails = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$thumbnails .= $site_template->parse_template("thumbnail_bit");
$thumbnails .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$thumbnails .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover > 0) {
for ($i = 0; $i < $leftover; $i++){
$thumbnails .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$thumbnails .= "</tr>\n";
}
}
$thumbnails .= "</table>\n";
} //end else
$site_template->register_vars("thumbnails", $thumbnails);
unset($thumbnails);
//-----------------------------------------------------
//--- Clickstream ------------- -----------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['top_rated']."</span>";
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"top_rated_desc" => $lang['top_rated_desc'],
"msg" => $msg,
"clickstream" => $clickstream,
));
$site_template->print_template($site_template->parse_template($main_template));
$content = ob_get_contents();
ob_end_clean();
if ($cache_page_top_rated) {
// 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');
?>
random_cat_image
random_image
{cat_name}
{lang_top_rated}
{upload_button}
{cat_description} (Hits: {cat_hits})
{top_rated_desc}
<a href="{url_top_rated}">{lang_top_rated}</a>
TYPE=MyISAM;
TYPE=MyISAM CHARACTER SET=cp1251;
function Db($db_host, $db_user, $db_password = "", $db_name = "", $db_pconnect = 0) {
$connect_handle = ($db_pconnect) ? "mysql_pconnect" : "mysql_connect";
if (!$this->connection = $connect_handle($db_host, $db_user, $db_password)) {
$this->error("Could not connect to the database server ($db_host, $db_user).", 1);
}
if ($db_name != "") {
if (!@mysql_select_db($db_name)) {
@mysql_close($this->connection);
$this->error("Could not select database ($db_name).", 1);
}
}
return $this->connection;
}
function Db($db_host, $db_user, $db_password = "", $db_name = "", $db_pconnect = 0) {
$connect_handle = ($db_pconnect) ? "mysql_pconnect" : "mysql_connect";
if (!$this->connection = $connect_handle($db_host, $db_user, $db_password)) {
$this->error("Could not connect to the database server ($db_host, $db_user).", 1);
}
mysql_query ("set character_set_client='cp1251'");
mysql_query ("set character_set_results='cp1251'");
mysql_query ("set collation_connection='cp1251_general_ci'");
if ($db_name != "") {
if (!@mysql_select_db($db_name)) {
@mysql_close($this->connection);
$this->error("Could not select database ($db_name).", 1);
}
}
return $this->connection;
}
$val = convert_special($val);
// $val = convert_special($val);
function convert_special($text) {
return strtr(
$text,
array(
"Ä" => "AE",
"Ö" => "OE",
"Ü" => "UE",
"ä" => "ae",
"ö" => "oe",
"ü" => "ue",
"ß" => "ss"
)
);
}
function convert_special($text) {
return strtr(
$text,
array(
"×" => "÷",
"Á" => "á",
"¨" => "Å",
"¸" => "å"
)
);
}
$sql = "SELECT c.comment_id, c.user_id AS comment_user_id,
c.response, c.comment_response,
if ($comment_row['comment_user_id'] != GUEST) {
if ($comment_row['comment_response'] != 0 && $comment_row['response'] != 0) {
$sql = "UPDATE ".COMMENTS_TABLE."
SET comment_response = ".$comment_row['comment_response']."
WHERE comment_response = ".$comment_row['comment_id'];
$site_db->query($sql);
}
elseif ($comment_row['response'] && $comment_row['comment_response'] == 0) {
$sql = "UPDATE ".COMMENTS_TABLE."
SET comment_response = 0
WHERE comment_response = ".$comment_row['comment_id'];
$site_db->query($sql);
}
elseif ($comment_row['comment_response'] && $comment_row['response'] == 0) {
$response_id = $comment_row['comment_response'];
while ($response_id != 0) {
$sql = "SELECT comment_id, user_id, comment_response
FROM ".COMMENTS_TABLE."
WHERE comment_id = $response_id";
$row = $site_db->query_firstrow($sql);
$response_id = $row['comment_response'];
$com_id = $row['comment_id'];
$sql = "DELETE FROM ".COMMENTS_TABLE."
WHERE comment_id = $com_id";
$site_db->query($sql);
update_comment_count($comment_row['image_id'], $row['user_id']);
}
}
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));
$response_to = (isset($HTTP_POST_VARS['response_to'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['response_to'])) : "";
if (!$error) {
$sql = "INSERT INTO ".COMMENTS_TABLE."
(image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
VALUES
($id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
$site_db->query($sql);
$commentid = $site_db->get_insert_id();
update_comment_count($id, $user_info['user_id']);
$msg = $lang['comment_success'];
if (!$error) {
if ($response_to) {
$response = 1;
} else {$response = 0;}
$sql = "INSERT INTO ".COMMENTS_TABLE."
(image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date, response)
VALUES
($id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().", '$response')";
$site_db->query($sql);
$commentid = $site_db->get_insert_id();
update_comment_count($id, $user_info['user_id']);
$msg = $lang['comment_success'];
if ($response_to) {
$sql = "UPDATE ".COMMENTS_TABLE."
SET comment_response = '$commentid'
WHERE comment_id = $response_to";
$site_db->query($sql);
}
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name,
c.comment_response, c.response,
WHERE c.image_id = $image_id
WHERE c.image_id = $image_id AND c.response = 0
$comment_user_info = $lang['userlevel_guest'];
$comment_headline = format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0);
$admin_links = "";
if ($user_info['user_level'] == ADMIN) {
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a> ";
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif ($is_image_owner) {
$admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a> ";
$admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
}
$responses = "";
$response_comment_id = "";
if ($comment_row[$i]['comment_response'] != 0) {
$bg_number = $bgcounter;
$response_bg = ($bg_number++ % 2 == 0) ? 1 : 2;
$responses .= "<br /><table width=\"90%\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" style=\"border: 1px solid #004C75;\">\n";
$response_row['comment_response'] = $comment_row[$i]['comment_response'];
while ($response_row['comment_response'] != 0) {
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS response_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date, c.comment_response".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name")."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
WHERE c.comment_id = ".$response_row['comment_response'];
$response_row = $site_db->query_firstrow($sql);
$response_user_name = format_text($response_row['response_user_name'], 2);
$response_user_info = $lang['userlevel_guest'];
$response_user_id = $response_row['user_id'];
$response_date = format_date($config['date_format']." ".$config['time_format'], $response_row['comment_date']);
$response_text = format_text($response_row['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']);
$response_comment_id = $response_row['comment_id'];
if (isset($response_row[$user_table_fields['user_name']]) && $response_user_id != GUEST) {
$response_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $response_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$response_user_id);
$response_user_name = "<a href=\"".$response_user_profile_link."\">".format_text($response_row[$user_table_fields['user_name']], 2)."</a>";
if (!isset($response_row[$user_table_fields['user_level']]) || (isset($response_row[$user_table_fields['user_level']]) && $response_row[$user_table_fields['user_level']] == USER)) {
$response_user_info = $lang['userlevel_user'];
}
elseif ($response_row[$user_table_fields['user_level']] == ADMIN) {
$response_user_info = $lang['userlevel_admin'];
}
}
$response_user_ip = ($user_info['user_level'] == ADMIN) ? $response_row['comment_ip'] : "";
$response_admin_links = "";
if ($user_info['user_level'] == ADMIN) {
$response_admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&comment_id=".$response_row['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a> ";
$response_admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&comment_id=".$response_row['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif ($is_image_owner) {
$response_admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&".URL_COMMENT_ID."=".$response_row['comment_id'])."\">".$lang['edit']."</a> ";
$response_admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&".URL_COMMENT_ID."=".$response_row['comment_id'])."\">".$lang['delete']."</a>";
}
$responses .= "<tr>\n<a name=\"comment".$response_comment_id."\"></a>\n<td class=\"commentrow".$response_bg."\">\n";
$responses .= "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
$responses .= "<tr>\n<td><b>".$lang['response'].$response_user_name."</b> (".$response_user_info.")</td>\n";
$responses .= "<td align=\"right\">".$response_date."</td>\n</tr>\n";
$responses .= "<tr>\n<td colspan=\"2\"><hr>\n".$response_text."</td>\n</tr>\n";
$responses .= "<tr>\n<td>".$response_user_ip."</td>\n";
$responses .= "<td align=\"right\">".$response_admin_links."</td>\n</tr>\n";
$responses .= "</table>\n</td>\n</tr>\n";
$response_bg = ($bg_number++ % 2 == 0) ? 1 : 2;
}
$responses .= "</table>\n";
}
$response_to_id = "";
if ($response_comment_id) {
$response_to_id .= $response_comment_id;
} else {
$response_to_id .= $comment_row[$i]['comment_id'];
}
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_headline" => $comment_headline,
"responses" => $responses,
"response_to_id" => $response_to_id,
"lang_post_response" => $lang['post_response'],
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";
$response_to = (isset($HTTP_POST_VARS['response_to']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['response_to'])), 2) : "";
"comment_text" => $comment_text,
"response_to" => $response_to,
"lang_clear" => $lang['clear'],
"lang_clear_desc" => $lang['clear_desc'],
//-----------------------------------------------------
//--- Mod Responses to Comment -------------------------
// ----------------------------------------------------
$lang['response'] = "Response: ";
$lang['post_response'] = "Post response";
$lang['clear'] = "Clear";
$lang['clear_desc'] = "<span class=\"small\"> - will saved as a new comment (not response)</span>";
$sql = "SELECT comment_id, image_id, user_id, user_name, comment_headline
FROM ".COMMENTS_TABLE."
WHERE comment_id IN ($comment_ids)";
$comment_result = $site_db->query($sql);
while ($comment_row = $site_db->fetch_array($comment_result)) {
$sql = "SELECT comment_id, image_id, user_id, user_name, comment_headline, response, comment_response
FROM ".COMMENTS_TABLE."
WHERE comment_id IN ($comment_ids)";
$comment_result = $site_db->query($sql);
while ($comment_row = $site_db->fetch_array($comment_result)) {
if ($comment_row['comment_response'] != 0 && $comment_row['response'] != 0) {
$sql = "UPDATE ".COMMENTS_TABLE."
SET comment_response = ".$comment_row['comment_response']."
WHERE comment_response = ".$comment_row['comment_id'];
$site_db->query($sql);
}
elseif ($comment_row['response'] && $comment_row['comment_response'] == 0) {
$sql = "UPDATE ".COMMENTS_TABLE."
SET comment_response = 0
WHERE comment_response = ".$comment_row['comment_id'];
$site_db->query($sql);
}
elseif ($comment_row['comment_response'] && $comment_row['response'] == 0) {
$response_id = $comment_row['comment_response'];
while ($response_id != 0) {
$sql = "SELECT comment_id, user_id, comment_response
FROM ".COMMENTS_TABLE."
WHERE comment_id = $response_id";
$row = $site_db->query_firstrow($sql);
$response_id = $row['comment_response'];
$com_id = $row['comment_id'];
$sql = "DELETE FROM ".COMMENTS_TABLE."
WHERE comment_id = $com_id";
$site_db->query($sql);
update_comment_count($comment_row['image_id'], $row['user_id']);
}
}
{comment_text}
{if responses}<br />{responses}<br />{endif responses}
<a href="#comment_form" onClick="get_link('{comment_headline}', '{response_to_id}')" /><b>{lang_post_response}</b></a>
<script language="javascript" type="text/javascript">
function get_link(headline, hidden_id){
document.commentform.comment_headline.value=headline
document.commentform.response_to.value=hidden_id
}
function clear_link() {
document.commentform.comment_headline.value=""
document.commentform.response_to.value=""
}
</script>
<a name="comment_form"></a>
<form name="commentform" action="{self}" method="post" onsubmit="postbutton.disabled=true;">
<input type="hidden" name="response_to" value="{response_to}" />
<input type="text" name="comment_headline" size="30" value="{comment_headline}" class="commentinput" />
<br /><a href="#comment_form" onClick="clear_link()">{lang_clear}</a>{lang_clear_desc}
if ($action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
if ($is_image_owner || $user_info['user_level'] == ADMIN) {
unset($row);
unset($spam_row);
}
else{
$msg .= $lang['comments_deactivated'];
}
Hi V@no
I managed to fix the issue but on the pagination it hasn't changedCode: [Select]3651 images(s) on 305 page(s).
$this->num_rows_all = $num_rows_all;
$this->new_format = number_format($num_rows_all, "", "", ",");
$replace_array = array(
$this->num_rows_all,
$replace_array = array(
$this->new_format,
here my changings ...
1. in the file details.php
after your ...Code: [Select]$comment_rank .= "+".$comment_row[$i]['is_good']." ".$comrate_good." ".$comrate_bad." ".$comment_row[$i]['is_bad']."-";
I added this...Code: [Select]$site_template->register_vars("comment_rank", $comment_rank);
... I think, you should post your [MOD] Rate Comments in a new thread in Mods & Plugins (Requests & Discussions) ...
... and then we will move this thread to Mods & Plugins (Releases & Support) ...
else {
$user_email = REPLACE_EMPTY;
$user_email_save = REPLACE_EMPTY;
$user_mailform_link = REPLACE_EMPTY;
$user_email_button = REPLACE_EMPTY;
}
// ----------------------------------- USER'S IMAGES TOP ----------------------------------
$user_images_top = "";
$most_value_array = array("image_rating", "image_hits", "image_comments", "image_downloads");
$most_value_image = "";
foreach ($most_value_array as $key) {
$additional_sql = "";
if ($key == "image_rating") {
$additional_sql .= "AND image_rating = (SELECT MAX(image_rating) ";
$most_value = $lang['most_rate'];
}
elseif ($key == "image_hits") {
$additional_sql .= "AND image_hits = (SELECT MAX(image_hits) ";
$most_value = $lang['most_hits'];
}
elseif ($key == "image_comments") {
$additional_sql .= "AND image_comments = (SELECT MAX(image_comments) ";
$most_value = $lang['most_comments'];
}
elseif ($key == "image_downloads") {
$additional_sql .= "AND image_downloads = (SELECT MAX(image_downloads) ";
$most_value = $lang['most_downloads'];
}
$sql = "SELECT image_id, cat_id, image_name, image_thumb_file, image_comments, image_downloads, image_rating, image_hits
FROM ".IMAGES_TABLE." a
WHERE user_id = $user_id AND image_active = 1 $additional_sql
FROM ".IMAGES_TABLE." b
WHERE a.user_id = b.user_id)
GROUP BY image_date";
$most_value_row = $site_db->query_firstrow($sql);
if ($most_value_row[$key] != 0 && !empty($most_value_row[$key])) {
$most_value_image .= "<td align=\"center\"><b>".$most_value." (".$most_value_row[$key].")</b><br>\n";
$most_value_image .= "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$most_value_row['image_id'])."\"><img src=\"".get_file_path($most_value_row['image_thumb_file'], "thumb", $most_value_row['cat_id'], 0, 1)."\" border=\"0\" alt=\"\" title=\"".$most_value_row['image_name']."\" /><br>\n";
$most_value_image .= $most_value_row['image_name']."</a><br></td>\n";
}
}
if ($most_value_image != "") {
$user_images_top .= "<table border=\"0\" cellpading=\"0\" cellspasing=\"0\">\n<tr>\n";
$user_images_top .= $most_value_image."</tr>\n</table>\n";
}
// ---------------------------------------------------------------------------------------
"user_name" => (isset($user_row['user_name'])) ? format_text($user_row['user_name'], 2) : REPLACE_EMPTY,
"user_images_top" => $user_images_top,
$lang['most_rate'] = "Most rated";
$lang['most_hits'] = "Most viewed";
$lang['most_comments'] = "Most commented";
$lang['most_downloads'] = "Most downloaded";
{if user_images_top}{user_images_top}{endif user_images_top}