diff --git a/html/stats_info.html b/html/stats_info.html index 502e617..b73ff45 100755 --- a/html/stats_info.html +++ b/html/stats_info.html @@ -4,8 +4,10 @@ unique: [stats_unique], Google: [stats_google], Yahoo: [stats_yahoo], + Bing: [stats_bing], this page: all: [stats_item_all], Google: [stats_item_google], Yahoo: [stats_item_yahoo] + Bing: [stats_item_bing] --> diff --git a/plugins/stats/bot.cpp b/plugins/stats/bot.cpp index 1bacdcb..37c3069 100755 --- a/plugins/stats/bot.cpp +++ b/plugins/stats/bot.cpp @@ -31,7 +31,7 @@ bool Bot::BrowserNameHas(const char * name) bool Bot::IsGoogle() { - return BrowserNameHas("Googlebot") && BrowserNameHas("www.google.com"); + return BrowserNameHas("Googlebot") && BrowserNameHas("+http://www.google.com/bot.html"); } @@ -42,4 +42,10 @@ bool Bot::IsYahoo() } +bool Bot::IsBing() +{ + return BrowserNameHas("msnbot") && BrowserNameHas("+http://search.msn.com/msnbot.htm"); +} + + } // namespace diff --git a/plugins/stats/bot.h b/plugins/stats/bot.h index d2f30dd..029f178 100755 --- a/plugins/stats/bot.h +++ b/plugins/stats/bot.h @@ -22,7 +22,7 @@ struct Bot bool IsGoogle(); bool IsYahoo(); - + bool IsBing(); private: diff --git a/plugins/stats/init.cpp b/plugins/stats/init.cpp index 6c94f9b..41c6fd5 100755 --- a/plugins/stats/init.cpp +++ b/plugins/stats/init.cpp @@ -67,6 +67,12 @@ void UpdateStats(PluginInfo & info, Stats::ItemStats & item_stats) stats.global_yahoo += 1; item_stats.yahoo += 1; } + + if( bot.IsBing() ) + { + stats.global_bing += 1; + item_stats.bing += 1; + } } diff --git a/plugins/stats/stats.cpp b/plugins/stats/stats.cpp index 03ef512..0337f71 100755 --- a/plugins/stats/stats.cpp +++ b/plugins/stats/stats.cpp @@ -39,6 +39,7 @@ void Stats::ReadStats(std::ifstream & file) file >> global_unique; file >> global_google; file >> global_yahoo; + file >> global_bing; size_t len; file >> len; @@ -52,6 +53,7 @@ void Stats::ReadStats(std::ifstream & file) file >> s.all; file >> s.google; file >> s.yahoo; + file >> s.bing; stats_tab.insert( std::make_pair(item_id, s) ); } @@ -91,6 +93,7 @@ void Stats::SaveStats(std::ofstream & file) file << global_unique << ' '; file << global_google << ' '; file << global_yahoo << ' '; + file << global_bing << ' '; file << std::endl; file << stats_tab.size() << std::endl; @@ -103,6 +106,7 @@ void Stats::SaveStats(std::ofstream & file) file << i->second.all << ' '; file << i->second.google << ' '; file << i->second.yahoo << ' '; + file << i->second.bing << ' '; file << std::endl; } } diff --git a/plugins/stats/stats.h b/plugins/stats/stats.h index 409fe50..3203980 100755 --- a/plugins/stats/stats.h +++ b/plugins/stats/stats.h @@ -42,7 +42,7 @@ struct Stats int global_google; int global_yahoo; - + int global_bing; // statistics for files/dirs @@ -51,12 +51,14 @@ struct Stats int all; int google; int yahoo; + int bing; ItemStats() { all = 0; google = 0; yahoo = 0; + bing = 0; } }; diff --git a/plugins/stats/templates.cpp b/plugins/stats/templates.cpp index c4c9072..f312a6b 100755 --- a/plugins/stats/templates.cpp +++ b/plugins/stats/templates.cpp @@ -49,6 +49,13 @@ void stats_yahoo(Ezc::Info & i) } +void stats_bing(Ezc::Info & i) +{ + i.out << stats.global_bing; +} + + + void stats_item_all(Ezc::Info & i) { i.out << stats.stats_tab[current_item_id].all; @@ -65,6 +72,11 @@ void stats_item_yahoo(Ezc::Info & i) i.out << stats.stats_tab[current_item_id].yahoo; } +void stats_item_bing(Ezc::Info & i) +{ + i.out << stats.stats_tab[current_item_id].bing; +} + @@ -78,10 +90,12 @@ void CreateFunctions(PluginInfo & info) fun->Insert("stats_unique", stats_unique); fun->Insert("stats_google", stats_google); fun->Insert("stats_yahoo", stats_yahoo); + fun->Insert("stats_bing", stats_bing); fun->Insert("stats_item_all", stats_item_all); fun->Insert("stats_item_google", stats_item_google); fun->Insert("stats_item_yahoo", stats_item_yahoo); + fun->Insert("stats_item_bing", stats_item_bing); }