Block("DATA"); $now_date = date("Y-m-d"); $sql = "SELECT $db_table_trainer_article.*,$db_table_trainer_article_stats.TOTAL_REPLY,$db_table_trainer_article_stats.TOTAL_VIEW FROM $db_table_trainer_article LEFT JOIN $db_table_trainer_article_stats ON ($db_table_trainer_article.ARTICLE_ID = $db_table_trainer_article_stats.ARTICLE_ID) $other_sql ORDER BY $order_by limit $start_loop,$cfg_list_per_page"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $article_id = $row[ARTICLE_ID]; $sql2 = "SELECT USERNAME FROM $db_table_trainer WHERE ID = '$row[TRAINER_ID]'"; $result2 = mysql_query($sql2); while($row2 = mysql_fetch_array($result2)) { $name_show = "$row2[USERNAME]"; } mysql_free_result($result2); $last_update = ""; $sql2 = "SELECT DATE_ADD FROM $db_table_comment WHERE (CATEGORY = 'article' AND CONTENT_ID = '$article_id') ORDER BY DATE_ADD DESC LIMIT 0,1"; $result2 = mysql_query($sql2); while($row2 = mysql_fetch_array($result2)) { $last_update = Convert_YMDHMS_2_DMYHM_Name($row2[DATE_ADD]); } mysql_free_result($result2); if ($bgcolor == "#F9F9F9") { $bgcolor = "#FFFFF9"; } else { $bgcolor = "#F9F9F9"; } $allow_view = ""; if ($row[ALLOW_VIEW] == "member") { $allow_view = ""; } $icon_hot = ""; if ($row[TOTAL_VIEW] > $cfg_int_content_hot) { $icon_hot = ""; } $icon_new = ""; if (DateDiff($row[DATE_ADD],$now_date) < $cfg_int_content_new) { $icon_new = ""; } $article_privilege = $row["ARTICLE_PRIVILEGE"]; $article_extra = $row["ARTICLE_EXTRA"]; $icon_extra = ""; $arr_icon_extra = preg_split ("/,/",$article_privilege . $article_extra, -1, PREG_SPLIT_NO_EMPTY); foreach ($arr_icon_extra as $strTemp) { $icon_extra .= " "; } # Rating $rating_show = ""; $sql2 = "SELECT * FROM $db_table_trainer_article_stats WHERE ARTICLE_ID = '$article_id' LIMIT 0,1"; $result2 = mysql_query($sql2); while($row2 = mysql_fetch_array($result2)) { $total_view = $row2[TOTAL_VIEW]; $poll_Y = $row2[POLL_Y]; $poll_N = $row2[POLL_N]; } mysql_free_result($result2); $total_poll = $poll_Y + $poll_N; $poll_percent_Y = 0; $poll_percent_N = 0; if ($poll_Y > 0) { $poll_percent_Y = round(sprintf ("%.02f",(100 / $total_poll) * $poll_Y)); } if ($poll_N > 0) { $poll_percent_N = round(sprintf ("%.02f",(100 / $total_poll) * $poll_N)); } $rating_show = << $poll_percent_Y%  $poll_percent_N%  SiXhEaD; # /Rating $data = array( 'bgcolor' => $bgcolor, 'article_id' => $article_id, 'article_topic' => $row[ARTICLE_TOPIC], 'name_show' => $name_show, 'allow_view' => $allow_view, 'total_reply' => $row[TOTAL_REPLY], 'total_view' => $row[TOTAL_VIEW], 'last_update' => $last_update, 'icon_hot' => $icon_hot, 'icon_new' => $icon_new, 'icon_extra' => $icon_extra, 'rating_show' => $rating_show, ); $tp->Apply($data); } mysql_free_result($result); if ($trainer_id) { $sql = "SELECT * FROM $db_table_trainer WHERE ID = $trainer_id"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $fname = $row[FNAME]; $lname = $row[LNAME]; $category_name = "�������� $fname $lname"; } mysql_free_result($result); } else { $sql = "SELECT * FROM $db_table_trainer_article_category WHERE CATEGORY_ID = '$category_id'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $category_name = $row[CATEGORY_NAME]; } mysql_free_result($result); } mysql_close($db); # /Split Page $select_sort = " "; $select_sort = preg_replace("/&sort=$sort'/", "&sort=$sort'selected", $select_sort); $tp->Mix(); $HTML = $tp->Data(); $HTML = preg_replace("/\\$(\w+)/e","$$1",$HTML); echo $HTML; exit; ob_end_flush(); #### end of program #### ##################################################################### #### Start sub program. Don't touch anything below #### ?>