InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName); $category_obj->table_name = "idx_category"; $category_obj->link_table_name = "idx_link"; $category_obj->number_of_columns = $cat_columns; $category_obj->number_of_subcats = $max_sub_cat; //$category_obj->default_image = $theme_path.$cat_default_image; $category_obj->default_image = $cat_default_image; //$category_obj->image_path = $theme_path."images/"; $category_obj->image_path = "themes/".$theme_name."/images/"; $category_obj->number_of_links_format = $number_of_links_format; $category_obj->cat_font_face = $cat_font_face; $category_obj->cat_font_size = $cat_font_size; $category_obj->cat_link_style = $cat_link_style; $category_obj->subcat_font_face = $subcat_font_face; $category_obj->subcat_font_size = $subcat_font_size; $category_obj->subcat_link_style = $subcat_link_style; $category_obj->cat_table_width = $cat_table_width; $category_obj->cat_cellspacing = $cat_cellspacing; $category_obj->show_subcat = true; $category_obj->parent = 0; $category = $category_obj->Display(); // show new links // get date $query = "select distinct date, last_updated from idx_link where new = 1"; $result = $conn->Execute($query); if($result) $num_rows = $result->RecordCount(); $i=0; while($i<$num_rows) { $result->Move($i); $date = $result->Fields("date"); $last_updated = $result->Fields("last_updated"); // compare which is the most recently $date = mktime(0,0,0,substr($date,5,2),substr($date,8,2),substr($date,0,4)); $last_updated = mktime(0,0,0,substr($last_updated,5,2),substr($last_updated,8,2),substr($last_updated,0,4)); if($date>$last_updated) $dates[] = $date; else $dates[] = $last_updated; $i++; } // remove duplicate entry $new_dates = array(); $i=0; while($iInitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName); $new_links_obj->table_name = "idx_link"; $new_links_obj->category_table_name = "idx_category"; $new_links_obj->max_rows = $main_new_links; $new_links_obj->template = $msg["10001"]; $new_links_obj->new_link_number = 1; $i=0; while($iquery = "select * from idx_link where (new = 1 and (date = '$date' or last_updated = '$date'))"; $new_links .= $new_links_obj->Display(); $i++; } // show hot links $hot_links_obj = new clsLink; $hot_links_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName); $hot_links_obj->query = "select * from idx_link where hot = 1 order by hits desc"; $hot_links_obj->table_name = "idx_link"; $hot_links_obj->category_table_name = "idx_category"; $hot_links_obj->max_rows = $main_hot_links; $hot_links_obj->template = $msg["10002"]; $hot_links_obj->enable_cache = false; $hot_links = $hot_links_obj->Display(); // show login box $users_obj = new clsUsers; $users_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName); $users_obj->table_name = "idx_users"; $users_obj->login_box_with_form_template = $msg["10003"]; $users_obj->login_box_with_username_template = $msg["10004"]; $login_box = $users_obj->DisplayLoginBox(); DisplayTemplate($theme_path."index.html","\$category,\$new_links,\$hot_links,\$login_box"); } // --------------- // main program // --------------- $conn = ConnectDB(); $title = $titles["1101"]; $theme_name = GetTheme($COOKIE_USERNAME); if(empty($theme_name)) $theme_name = "default"; $theme_path = $theme_path.$theme_name."/"; include($theme_path."msg.php"); DisplayTemplate($theme_path."header.html","\$title,\$cat"); ShowMainPage(); DisplayTemplate($theme_path."footer.html","\$novar"); ?>