delete_value('current_poll_content'); $Cache->delete_value('current_poll_result', true); if (mysql_affected_rows() != 1) stderr($lang_index['std_error'], $lang_index['std_vote_not_counted']); //add karma KPS("+",$pollvote_bonus,$userid); header("Location: " . get_protocol_prefix() . "$BASEURL/"); die; } else stderr($lang_index['std_error'], $lang_index['std_option_unselected']); } } stdhead($lang_index['head_home']); begin_main_frame(); // ------------- start: recent news ------------------// print("

".$lang_index['text_recent_news'].(get_user_class() >= $newsmanage_class ? " - [".$lang_index['text_news_page']."]" : "")."

"); $Cache->new_page('recent_news', 86400, true); if (!$Cache->get_page()){ $res = sql_query("SELECT * FROM news ORDER BY added DESC LIMIT ".(int)$maxnewsnum_main) or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) { $Cache->add_whole_row(); print("
\n"); $Cache->end_whole_row(); $news_flag = 0; while($array = mysql_fetch_array($res)) { $Cache->add_row(); $Cache->add_part(); if ($news_flag < 1) { print("\"Show/Hide\" " . date("Y.m.d",strtotime($array['added'])) . " - " ."". $array['title'] . ""); print("
".format_comment($array["body"],0)."
"); $news_flag = $news_flag + 1; } else { print("
\"Show/Hide\" " . date("Y.m.d",strtotime($array['added'])) . " - " ."". $array['title'] . "
"); print("
".format_comment($array["body"],0)."
"); } $Cache->end_part(); $Cache->add_part(); print("   [".$lang_index['text_e']."]"); print(" [".$lang_index['text_d']."]"); $Cache->end_part(); $Cache->end_row(); } $Cache->break_loop(); $Cache->add_whole_row(); print("
\n"); $Cache->end_whole_row(); } $Cache->cache_page(); } echo $Cache->next_row(); while($Cache->next_row()){ echo $Cache->next_part(); if (get_user_class() >= $newsmanage_class) echo $Cache->next_part(); } echo $Cache->next_row(); // ------------- end: recent news ------------------// // ------------- start: hot and classic movies ------------------// if ($showextinfo['imdb'] == 'yes' && ($showmovies['hot'] == "yes" || $showmovies['classic'] == "yes")) { $type = array('hot', 'classic'); foreach($type as $type_each) { if($showmovies[$type_each] == 'yes' && (!isset($CURUSER) || $CURUSER['show' . $type_each] == 'yes')) { $Cache->new_page($type_each.'_resources', 900, true); if (!$Cache->get_page()) { $Cache->add_whole_row(); $imdbcfg = new imdb_config(); $res = sql_query("SELECT * FROM torrents WHERE picktype = " . sqlesc($type_each) . " AND seeders > 0 AND url != '' ORDER BY id DESC LIMIT 30") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) { $movies_list = ""; $count = 0; $allImdb = array(); while($array = mysql_fetch_array($res)) { $pro_torrent = get_torrent_promotion_append($array[sp_state],'word'); if ($imdb_id = parse_imdb_id($array["url"])) { if (array_search($imdb_id, $allImdb) !== false) { //a torrent with the same IMDb url already exists continue; } $allImdb[]=$imdb_id; $photo_url = $imdbcfg->photodir . $imdb_id. $imdbcfg->imageext; if (file_exists($photo_url)) $thumbnail = "\"poster\""; else continue; } else continue; $thumbnail = "" . (addslashes($array['name'] . $pro_torrent)) . "
".(addslashes($array['small_descr'])) .""). "', 'trail', true, 'delay', 0,'lifetime',5000,'styleClass','niceTitle','maxWidth', 600);\">" . $thumbnail . "
"; $movies_list .= $thumbnail; $count++; if ($count >= 9) break; } ?>

end_whole_row(); $Cache->cache_page(); } echo $Cache->next_row(); } } } // ------------- end: hot and classic movies ------------------// // ------------- start: funbox ------------------// if ($showfunbox_main == "yes" && (!isset($CURUSER) || $CURUSER['showfb'] == "yes")){ // Get the newest fun stuff if (!$row = $Cache->get_value('current_fun_content')){ $result = sql_query("SELECT fun.*, IF(ADDTIME(added, '1 0:0:0') < NOW(),true,false) AS neednew FROM fun WHERE status != 'banned' AND status != 'dull' ORDER BY added DESC LIMIT 1") or sqlerr(__FILE__,__LINE__); $row = mysql_fetch_array($result); $Cache->cache_value('current_fun_content', $row, 1043); } if (!$row) //There is no funbox item { print("

".$lang_index['text_funbox'].(get_user_class() >= $newfunitem_class ? " - [".$lang_index['text_new_fun']."]" : "")."

"); } else { $totalvote = $Cache->get_value('current_fun_vote_count'); if ($totalvote == ""){ $totalvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])); $Cache->cache_value('current_fun_vote_count', $totalvote, 756); } $funvote = $Cache->get_value('current_fun_vote_funny_count'); if ($funvote == ""){ $funvote = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND vote='fun'"); $Cache->cache_value('current_fun_vote_funny_count', $funvote, 756); } //check whether current user has voted $funvoted = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND userid=".sqlesc($CURUSER['id'])); print ("

".$lang_index['text_funbox']); if ($CURUSER) { print("".(get_user_class() >= $log_class ? " - [".$lang_index['text_more_fun']."]": "").($row['neednew'] && get_user_class() >= $newfunitem_class ? " - [".$lang_index['text_new_fun']."]" : "" ).( ($CURUSER['id'] == $row['userid'] || get_user_class() >= $funmanage_class) ? " - [".$lang_index['text_edit']."]" : "").(get_user_class() >= $funmanage_class ? " - [".$lang_index['text_delete']."] - [".$lang_index['text_ban']."]" : "").""); } print("

"); print("
"); print("

\n"); if ($CURUSER) { $funonclick = " onclick=\"funvote(".$row['id'].",'fun'".")\""; $dullonclick = " onclick=\"funvote(".$row['id'].",'dull'".")\""; print("".$funvote."".$lang_index['text_out_of'].$totalvote.$lang_index['text_people_found_it'].($funvoted ? "" : "".$lang_index['text_your_opinion']."   ")."".$lang_index['text_vote_accepted'].""); } print("
"); } } // ------------- end: funbox ------------------// // ------------- start: shoutbox ------------------// if ($showshoutbox_main == "yes") { ?>

-

\n"); print("

\n"); print("
\n"); print(" "); if ($CURUSER['hidehb'] != 'yes' && $showhelpbox_main =='yes') print(""); print("
\n"); print(smile_row("shbox","shbox_text")); print("
"); } // ------------- end: shoutbox ------------------// // ------------- start: latest forum posts ------------------// /* if ($showlastxforumposts_main == "yes" && $CURUSER) { $res = sql_query("SELECT posts.id AS pid, posts.userid AS userpost, posts.added, topics.id AS tid, topics.subject, topics.forumid, topics.views, forums.name FROM posts, topics, forums WHERE posts.topicid = topics.id AND topics.forumid = forums.id AND minclassread <=" . sqlesc(get_user_class()) . " ORDER BY posts.id DESC LIMIT 5") or sqlerr(__FILE__,__LINE__); if(mysql_num_rows($res) != 0) { print("

".$lang_index['text_last_five_posts']."

"); print(""); while ($postsx = mysql_fetch_assoc($res)) { print(""); } print("
".$lang_index['col_topic_title']."".$lang_index['col_view']."".$lang_index['col_author']."".$lang_index['col_posted_at']."
".htmlspecialchars($postsx["subject"])."
".$lang_index['text_in']."".htmlspecialchars($postsx["name"])."
".$postsx["views"]."" . get_username($postsx["userpost"]) ."".gettime($postsx["added"])."
"); } } */ // ------------- end: latest forum posts ------------------// // ------------- start: latest torrents ------------------// if ($showlastxtorrents_main == "yes") { $result = sql_query("SELECT * FROM torrents where visible='yes' ORDER BY added DESC LIMIT 5") or sqlerr(__FILE__, __LINE__); if(mysql_num_rows($result) != 0 ) { print ("

".$lang_index['text_last_five_torrent']."

"); print (""); while( $row = mysql_fetch_assoc($result) ) { print (""); } print ("
".$lang_index['col_name']."".$lang_index['col_seeder']."".$lang_index['col_leecher']."
" . htmlspecialchars($row['name']) . "" . $row['seeders'] . "" . $row['leechers'] . "
"); } } // ------------- end: latest torrents ------------------// // ------------- start: polls ------------------// if ($CURUSER && $showpolls_main == "yes") { // Get current poll if (!$arr = $Cache->get_value('current_poll_content')){ $res = sql_query("SELECT * FROM polls ORDER BY id DESC LIMIT 1") or sqlerr(__FILE__, __LINE__); $arr = mysql_fetch_array($res); $Cache->cache_value('current_poll_content', $arr, 7226); } if (!$arr) $pollexists = false; else $pollexists = true; print("

".$lang_index['text_polls']); if (get_user_class() >= $pollmanage_class) { print(" - [".$lang_index['text_new']."]\n"); if ($pollexists) { print(" - [".$lang_index['text_edit']."]\n"); print(" - [".$lang_index['text_delete']."]"); print(" - [".$lang_index['text_detail']."]"); } print(""); } print("

"); if ($pollexists) { $pollid = intval($arr["id"] ?? 0); $question = $arr["question"]; $o = array($arr["option0"], $arr["option1"], $arr["option2"], $arr["option3"], $arr["option4"], $arr["option5"], $arr["option6"], $arr["option7"], $arr["option8"], $arr["option9"], $arr["option10"], $arr["option11"], $arr["option12"], $arr["option13"], $arr["option14"], $arr["option15"], $arr["option16"], $arr["option17"], $arr["option18"], $arr["option19"]); print("
\n"); print("
"); print("

".$question."

\n"); // Check if user has already voted $res = sql_query("SELECT selection FROM pollanswers WHERE pollid=".sqlesc($pollid)." AND userid=".sqlesc($CURUSER["id"])) or sqlerr(); $voted = mysql_fetch_assoc($res); if ($voted) //user has already voted { $uservote = $voted["selection"]; $Cache->new_page('current_poll_result', 3652, true); if (!$Cache->get_page()) { // we reserve 255 for blank vote. $res = sql_query("SELECT selection FROM pollanswers WHERE pollid=".sqlesc($pollid)." AND selection < 20") or sqlerr(); $tvotes = mysql_num_rows($res); $vs = array(); $os = array(); // Count votes while ($arr2 = mysql_fetch_row($res)) { if (!isset($vs[$arr2[0]])) { $vs[$arr2[0]] = 0; } $vs[$arr2[0]] ++; } reset($o); for ($i = 0; $i < count($o); ++$i){ if ($o[$i]) $os[$i] = array($vs[$i] ?? 0, $o[$i], $i);//field 1: options vote count, field 2: option name, field 3: option index } function srt($a,$b) { if ($a[0] > $b[0]) return -1; if ($a[0] < $b[0]) return 1; return 0; } // now os is an array like this: array(array(123, "Option 1", 1), array(45, "Option 2", 2)) $Cache->add_whole_row(); print("\n"); $Cache->end_whole_row(); $i = 0; while (isset($os[$i])) { $a = $os[$i]; if ($tvotes == 0) $p = 0; else $p = round($a[0] / $tvotes * 100); $Cache->add_row(); $Cache->add_part(); print("\n"); $Cache->end_part(); $Cache->end_row(); ++$i; } $Cache->break_loop(); $Cache->add_whole_row(); print("
" . $a[1] . "  \"\"end_part(); $Cache->add_part(); print(" src=\"pic/trans.gif\" style=\"width: " . ($p * 3) ."px;\" alt=\"\" />\"\" $p%
\n"); $tvotes = number_format($tvotes); print("

".$lang_index['text_votes']." ".$tvotes."

\n"); $Cache->end_whole_row(); $Cache->cache_page(); } echo $Cache->next_row(); $i = 0; while($Cache->next_row()){ echo $Cache->next_part(); if ($i == $uservote) echo "class=\"sltbar\""; else echo "class=\"unsltbar\""; echo $Cache->next_part(); $i++; } echo $Cache->next_row(); } else //user has not voted yet { print("
\n"); $i = 0; while ($a = $o[$i]) { print("".$a."
\n"); ++$i; } print("
"); print("".$lang_index['radio_blank_vote']."
\n"); print("

"); } print("
"); if ($voted && get_user_class() >= $log_class) print("

".$lang_index['text_previous_polls']."

\n"); print("
"); } } // ------------- end: polls ------------------// // ------------- start: stats ------------------// if ($showstats_main == "yes") { ?>

new_page('stats_users', 3000, true); if (!$Cache->get_page()){ $Cache->add_whole_row(); $registered = number_format(get_row_count("users")); $unverified = number_format(get_row_count("users", "WHERE status='pending'")); $totalonlinetoday = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 86400))))); $totalonlineweek = number_format(get_row_count("users","WHERE last_access >= ". sqlesc(date("Y-m-d H:i:s",(TIMENOW - 604800))))); $VIP = number_format(get_row_count("users", "WHERE class=".UC_VIP)); $donated = number_format(get_row_count("users", "WHERE donor = 'yes'")); $warned = number_format(get_row_count("users", "WHERE warned='yes'")); $disabled = number_format(get_row_count("users", "WHERE enabled='no'")); $registered_male = number_format(get_row_count("users", "WHERE gender='Male'")); $registered_female = number_format(get_row_count("users", "WHERE gender='Female'")); ?> ",$donated); ?> ",$warned); twotd($lang_index['row_banned_users']." \"disabled\"",$disabled); ?> end_whole_row(); $Cache->cache_page(); } echo $Cache->next_row(); ?> new_page('stats_torrents', 1800, true); if (!$Cache->get_page()){ $Cache->add_whole_row(); $torrents = number_format(get_row_count("torrents")); $dead = number_format(get_row_count("torrents", "WHERE visible='no'")); $seeders = get_row_count("peers", "WHERE seeder='yes'"); $leechers = get_row_count("peers", "WHERE seeder='no'"); if ($leechers == 0) $ratio = 0; else $ratio = round($seeders / $leechers * 100); $activewebusernow = get_row_count("users","WHERE last_access >= ".sqlesc(date("Y-m-d H:i:s",(TIMENOW - 900)))); $activewebusernow=number_format($activewebusernow); $activetrackerusernow = number_format(get_single_value("peers","COUNT(DISTINCT(userid))")); $peers = number_format($seeders + $leechers); $seeders = number_format($seeders); $leechers = number_format($leechers); $totaltorrentssize = mksize(get_row_sum("torrents", "size")); $totaluploaded = get_row_sum("users","uploaded"); $totaldownloaded = get_row_sum("users","downloaded"); $totaldata = $totaldownloaded+$totaluploaded; ?> end_whole_row(); $Cache->cache_page(); } echo $Cache->next_row(); ?> new_page('stats_classes', 4535, true); if (!$Cache->get_page()){ $Cache->add_whole_row(); $peasants = number_format(get_row_count("users", "WHERE class=".UC_PEASANT)); $users = number_format(get_row_count("users", "WHERE class=".UC_USER)); $powerusers = number_format(get_row_count("users", "WHERE class=".UC_POWER_USER)); $eliteusers = number_format(get_row_count("users", "WHERE class=".UC_ELITE_USER)); $crazyusers = number_format(get_row_count("users", "WHERE class=".UC_CRAZY_USER)); $insaneusers = number_format(get_row_count("users", "WHERE class=".UC_INSANE_USER)); $veteranusers = number_format(get_row_count("users", "WHERE class=".UC_VETERAN_USER)); $extremeusers = number_format(get_row_count("users", "WHERE class=".UC_EXTREME_USER)); $ultimateusers = number_format(get_row_count("users", "WHERE class=".UC_ULTIMATE_USER)); $nexusmasters = number_format(get_row_count("users", "WHERE class=".UC_NEXUS_MASTER)); ?> ",$peasants); twotd(get_user_class_name(UC_USER,false,false,true),$users); ?> end_whole_row(); $Cache->cache_page(); } echo $Cache->next_row(); ?>
 
 

" . trim($uptimeresult) . ""); print("
"); } } // ------------- end: tracker load ------------------// // ------------- start: disclaimer ------------------// ?>

".$lang_index['text_links']); if (get_user_class() >= $applylink_class) print(" - [".$lang_index['text_apply_for_link']."]"); if (get_user_class() >= $linkmanage_class) { print(""); print(" - [".$lang_index['text_manage_links']."]\n"); print(""); } print(""); $Cache->new_page('links', 86400, false); if (!$Cache->get_page()){ $Cache->add_whole_row(); $res = sql_query("SELECT * FROM links ORDER BY id ASC") or sqlerr(__FILE__, __LINE__); if (mysql_num_rows($res) > 0) { $links = ""; while($array = mysql_fetch_array($res)) { $links .= "" . $array['name'] . "     "; } print("
".trim($links)."
"); } $Cache->end_whole_row(); $Cache->cache_page(); } echo $Cache->next_row(); // ------------- end: links ------------------// // ------------- start: browser, client and code note ------------------// ?>

<?php echo PROJECTNAME?>
delete_value('user_'.$CURUSER["id"].'_unread_news_count'); end_main_frame(); stdfoot(); ?>