######################## sub _tests(;$) { #* # to test all pm::security functions #* my ($extended) = @_; # show extended data (optional) my $rv = ""; my $loggedin = pm::bc_chef::cookie_get("loggedin"); my $test = ""; my $test2 = ""; my $test3 = ""; my @atest = (); my %htest = {}; my $db = sql_connect("ns.db"); if ($db) { $rv .= pm::html::display_debug_code("get_phrase(\$db)", get_phrase($db)); $rv .= pm::html::display_debug_code("get_about_page(\$db)", get_about_page($db)); $rv .= pm::html::display_debug_code("get_home_page(\$db, \"\")", get_home_page($db, "")); $test = "SITE_NAME"; $rv .= pm::html::display_debug_one("get_constant(\$db, \"$test\")", get_constant($db, $test)); $test = pm::bc_chef::cookie_get("loggedin"); $rv .= pm::html::display_debug_one("user_exists(\$db, \"$test\")", user_exists($db, $test)); $test = "991B146AEC"; $rv .= pm::html::display_debug_one("msg_exists(\$db, \"$test\")", user_exists($db, $test)); $test = "31-1"; $rv .= pm::html::display_debug_one("get_city_name(\$db, \"$test\")", get_city_name($db, $test)); $rv .= pm::html::display_debug_one("get_country_name(\$db, \"$test\")", get_country_name($db, $test)); $test2 = "6132F16686"; #$test3 = "7EE22A4BBF"; $test3 = "1237EE22A4BBF"; @atest = (); push @atest, ($test2, $test3); $test = "select * from 'ccinfo' where ID = ? and UID = ?"; $rv .= pm::html::display_debug_one("sql_execute_bound(\$db, \"$test\", \\\@values)", sql_execute_bound($db, $test, \@atest)); $test = "Canada"; $rv .= pm::html::display_debug_one("get_country_id_byName(\$db, \"$test\")", get_country_id_byName($db, $test)); $rv .= pm::html::display_debug_one("get_profile_views_count(\$db, $loggedin)", get_profile_views_count($db, $loggedin)); $rv .= pm::html::display_debug_one("ipn_exists(\$db, \"$test\")", ipn_exists($db, $test)); $rv .= pm::html::display_debug_one("ban_exists(\$db, \"$test\")", ban_exists($test)); $rv .= pm::html::display_debug_one("ccid_exists(\$db, \"$test\")", ccid_exists($test)); $test = "index.pl"; $rv .= pm::html::display_debug_one("file_exists(\"$test\")", file_exists($test)); $test = "C8E0B9312F"; $rv .= pm::html::display_debug_one("fma_exists(\$db, \"$loggedin\", \"$test\")", fma_exists($db, $loggedin, $test)); $test = 3; $rv .= pm::html::display_debug_one("get_body_asWord(\$db, $test)", get_body_asWord($db, $test)); $test = "31-20"; $rv .= pm::html::display_debug_one("get_city_id(\"$test\")", get_city_id($test)); $rv .= pm::html::display_debug_one("get_city_name(\$db, \"$test\")", get_city_name($db, $test)); $test = "31-20"; $rv .= pm::html::display_debug_one("get_country_id(\"$test\")", get_country_id($test)); %htest = pm::user::get_user_stats($loggedin); $rv .= pm::html::display_debug_one("theme_exists(\$db, \"$htest{TID}\")", theme_exists($db, $htest{TID})); $rv .= pm::html::display_debug_one("get_default_theme()", get_default_theme()); $test = 1; $rv .= pm::html::display_debug_one("get_eye_clr_asWord(\$db, \"$test\")", get_eye_clr_asWord($db, $test)); $test++; $rv .= pm::html::display_debug_one("get_hair_clr_asWord(\$db, \"$test\")", get_hair_clr_asWord($db, $test)); $test++; $rv .= pm::html::display_debug_one("get_gender_asWord(\$db, \"$test\")", get_gender_asWord($db, $test)); $test++; $rv .= pm::html::display_debug_one("get_height_asWord(\$db, \"$test\")", get_height_asWord($db, $test)); $test++; $rv .= pm::html::display_debug_one("get_weight_asWord(\$db, \"$test\")", get_weight_asWord($db, $test)); $test++; $rv .= pm::html::display_debug_one("get_orientation_asWord(\$db, \"$test\")", get_orientation_asWord($db, $test)); $test = "31-20"; $rv .= pm::html::display_debug_one("get_location(\$db, \"$test\")", get_location($db, $test)); $rv .= pm::html::display_debug_one("get_profile_views_count(\$db, \"$loggedin\")", get_profile_views_count($db, $loggedin)); $test = "genders"; @atest = get_config($db, $test); $rv .= pm::html::display_debug_many("get_config(\$db, \"$test\")", \@atest, "
"); @atest = get_cities($db); $rv .= pm::html::display_debug_many("get_cities(\$db)", \@atest, ", ", 1); @atest = get_country_cities($db, "31"); $rv .= pm::html::display_debug_many("get_country_cities(\$db)", \@atest, ", ", 1); @atest = get_zodiacs($db); $rv .= pm::html::display_debug_many("get_zodiacs(\$db)", \@atest, ", ", 0); @atest = (); for (my $z = 1; $z <= 12; $z++) { push @atest, get_zodiac_icon($z); } $rv .= pm::html::display_debug_many("get_zodiac_icon([1..12])", \@atest, "", 0); $test = "203537B0FF"; $rv .= pm::html::display_debug_many("get_theme_data(\$db, \"$test\")", get_theme_data($db, $test), "
", 0); $test = "select value from 'zodiacs' order by ID"; $rv .= pm::html::display_debug_many("sql_execute(\$db, \"$test\")", sql_execute($db, $test), ", "); $test = "zodiacs"; @atest = get_config($db, $test); $rv .= pm::html::display_debug_many("get_config(\$db, \"$test\")", \@atest, ", "); @atest = get_countries($db); $rv .= pm::html::display_debug_many("get_countries(\$db)", \@atest, ", ", 1); @atest = get_errors($db); #push @atest, $test; #push @atest, \@atest; $rv .= pm::html::display_debug_large("get_errors(\$db)", \@atest, 1); @atest = get_constants($db); $rv .= pm::html::display_debug_large("get_constants(\$db)", \@atest, 1); sql_disconnect($db); } else { $rv .= "DB connection error!
\n"; } return $rv; # a scalar of the results of all tests #usage: print _tests(); }