added support for UTF-8
now the UTF-8 is a default charset git-svn-id: svn://ttmath.org/publicrep/winix/trunk@677 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -1,28 +1,31 @@
|
||||
# DO NOT DELETE
|
||||
|
||||
bot.o: bot.h
|
||||
init.o: ../../core/log.h ../../core/request.h ../../core/requesttypes.h
|
||||
init.o: ../../core/session.h ../../core/item.h ../../core/error.h
|
||||
init.o: ../../core/log.h ../../core/user.h ../../core/plugindata.h
|
||||
init.o: ../../core/rebus.h ../../core/config.h ../../core/confparser.h
|
||||
init.o: ../../core/htmlfilter.h ../../core/config.h ../../db/db.h
|
||||
init.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
init.o: ../../core/textstream.h ../../core/error.h ../../db/dbitemquery.h
|
||||
init.o: ../../core/item.h ../../db/dbitemcolumns.h ../../core/user.h
|
||||
init.o: ../../core/group.h ../../core/thread.h ../../core/dircontainer.h
|
||||
init.o: ../../core/ugcontainer.h bot.h stats.h templates.h
|
||||
init.o: ../../core/plugin.h ../../core/pluginmsg.h ../../core/request.h
|
||||
init.o: ../../core/system.h ../../core/dirs.h ../../core/dircontainer.h
|
||||
init.o: ../../core/mounts.h ../../core/mount.h ../../core/mountparser.h
|
||||
init.o: ../../core/users.h ../../core/ugcontainer.h
|
||||
init.o: ../../core/log.h ../../core/textstream.h ../../core/misc.h
|
||||
init.o: ../../core/item.h ../../core/request.h ../../core/requesttypes.h
|
||||
init.o: ../../core/session.h ../../core/error.h ../../core/log.h
|
||||
init.o: ../../core/user.h ../../core/plugindata.h ../../core/rebus.h
|
||||
init.o: ../../core/config.h ../../core/confparser.h ../../core/htmlfilter.h
|
||||
init.o: ../../core/config.h ../../db/db.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/error.h
|
||||
init.o: ../../db/dbitemquery.h ../../core/item.h ../../db/dbitemcolumns.h
|
||||
init.o: ../../core/user.h ../../core/group.h ../../core/thread.h
|
||||
init.o: ../../core/dircontainer.h ../../core/ugcontainer.h bot.h stats.h
|
||||
init.o: templates.h ../../core/plugin.h ../../core/pluginmsg.h
|
||||
init.o: ../../core/request.h ../../core/system.h ../../core/dirs.h
|
||||
init.o: ../../core/dircontainer.h ../../core/mounts.h ../../core/mount.h
|
||||
init.o: ../../core/mountparser.h ../../core/users.h ../../core/ugcontainer.h
|
||||
init.o: ../../core/lastcontainer.h ../../core/groups.h ../../core/group.h
|
||||
init.o: ../../core/loadavg.h ../../core/sessionmanager.h
|
||||
init.o: ../../core/sessioncontainer.h ../../functions/functions.h
|
||||
init.o: ../../functions/functionbase.h ../../core/system.h
|
||||
init.o: ../../core/notify.h ../../templatesnotify/templatesnotify.h
|
||||
init.o: ../../../ezc/src/ezc.h ../../core/mount.h ../../core/locale.h
|
||||
init.o: ../../templates/misc.h ../../templates/localefilter.h
|
||||
init.o: ../../core/locale.h ../../functions/functionparser.h
|
||||
init.o: ../../../ezc/src/ezc.h ../../../ezc/src/utf8.h
|
||||
init.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h
|
||||
init.o: ../../../ezc/src/stringconv.h ../../../ezc/src/functions.h
|
||||
init.o: ../../../ezc/src/funinfo.h ../../core/mount.h ../../templates/misc.h
|
||||
init.o: ../../templates/localefilter.h ../../templates/locale.h
|
||||
init.o: ../../core/confparser.h ../../functions/functionparser.h
|
||||
init.o: ../../functions/adduser.h ../../functions/cat.h
|
||||
init.o: ../../functions/chmod.h ../../functions/privchanger.h
|
||||
init.o: ../../functions/chown.h ../../functions/ckeditor.h
|
||||
@@ -38,12 +41,15 @@ init.o: ../../functions/template.h ../../functions/tinymce.h
|
||||
init.o: ../../functions/uname.h ../../functions/upload.h
|
||||
init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h
|
||||
init.o: ../../core/htmlfilter.h ../../templates/templates.h
|
||||
init.o: ../../templates/misc.h ../../templates/patterncacher.h
|
||||
init.o: ../../core/item.h ../../templates/ckeditorgetparser.h
|
||||
init.o: ../../core/httpsimpleparser.h ../../core/log.h
|
||||
init.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
|
||||
init.o: statssession.h ../../core/plugindata.h
|
||||
stats.o: stats.h ../../core/config.h ../../core/log.h
|
||||
init.o: ../../templates/patterncacher.h ../../core/item.h
|
||||
init.o: ../../templates/ckeditorgetparser.h ../../core/httpsimpleparser.h
|
||||
init.o: ../../core/log.h ../../templates/indexpatterns.h
|
||||
init.o: ../../core/sessionmanager.h statssession.h ../../core/plugindata.h
|
||||
stats.o: stats.h ../../core/config.h ../../core/log.h ../../core/textstream.h
|
||||
stats.o: ../../core/misc.h ../../core/item.h ../../../ezc/src/ezc.h
|
||||
stats.o: ../../../ezc/src/utf8.h ../../../ezc/src/generator.h
|
||||
stats.o: ../../../ezc/src/pattern.h ../../../ezc/src/stringconv.h
|
||||
stats.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h
|
||||
templates.o: templates.h ../../core/plugin.h ../../core/pluginmsg.h
|
||||
templates.o: ../../core/log.h ../../core/plugindata.h ../../core/config.h
|
||||
templates.o: ../../core/confparser.h ../../core/htmlfilter.h
|
||||
@@ -62,11 +68,15 @@ templates.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
|
||||
templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
|
||||
templates.o: ../../core/session.h ../../functions/functions.h
|
||||
templates.o: ../../functions/functionbase.h ../../core/request.h
|
||||
templates.o: ../../core/requesttypes.h ../../core/config.h
|
||||
templates.o: ../../core/system.h ../../core/notify.h
|
||||
templates.o: ../../templatesnotify/templatesnotify.h ../../../ezc/src/ezc.h
|
||||
templates.o: ../../core/mount.h ../../core/locale.h ../../templates/misc.h
|
||||
templates.o: ../../templates/localefilter.h ../../core/locale.h
|
||||
templates.o: ../../core/requesttypes.h ../../core/textstream.h
|
||||
templates.o: ../../core/misc.h ../../core/config.h ../../core/system.h
|
||||
templates.o: ../../core/notify.h ../../templatesnotify/templatesnotify.h
|
||||
templates.o: ../../../ezc/src/ezc.h ../../../ezc/src/utf8.h
|
||||
templates.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h
|
||||
templates.o: ../../../ezc/src/stringconv.h ../../../ezc/src/functions.h
|
||||
templates.o: ../../../ezc/src/funinfo.h ../../core/mount.h
|
||||
templates.o: ../../templates/misc.h ../../templates/localefilter.h
|
||||
templates.o: ../../templates/locale.h ../../core/confparser.h
|
||||
templates.o: ../../functions/functionparser.h ../../functions/adduser.h
|
||||
templates.o: ../../functions/cat.h ../../functions/chmod.h
|
||||
templates.o: ../../functions/privchanger.h ../../functions/chown.h
|
||||
@@ -84,9 +94,8 @@ templates.o: ../../functions/template.h ../../functions/tinymce.h
|
||||
templates.o: ../../functions/uname.h ../../functions/upload.h
|
||||
templates.o: ../../functions/uptime.h ../../functions/who.h
|
||||
templates.o: ../../functions/vim.h ../../core/htmlfilter.h
|
||||
templates.o: ../../templates/templates.h ../../templates/misc.h
|
||||
templates.o: ../../templates/patterncacher.h ../../core/item.h
|
||||
templates.o: ../../templates/ckeditorgetparser.h
|
||||
templates.o: ../../templates/templates.h ../../templates/patterncacher.h
|
||||
templates.o: ../../core/item.h ../../templates/ckeditorgetparser.h
|
||||
templates.o: ../../core/httpsimpleparser.h ../../core/log.h
|
||||
templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
|
||||
templates.o: ../../core/misc.h stats.h
|
||||
|
@@ -44,7 +44,10 @@ bool Bot::IsYahoo()
|
||||
|
||||
bool Bot::IsBing()
|
||||
{
|
||||
return BrowserNameHas("msnbot") && BrowserNameHas("+http://search.msn.com/msnbot.htm");
|
||||
if( BrowserNameHas("msnbot") && BrowserNameHas("+http://search.msn.com/msnbot.htm") )
|
||||
return true;
|
||||
|
||||
return BrowserNameHas("bingbot") && BrowserNameHas("+http://www.bing.com/bingbot.htm");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
|
||||
extern "C" void Init(PluginInfo &);
|
||||
const char plugin_name[] = "stats";
|
||||
const wchar_t plugin_name[] = L"stats";
|
||||
|
||||
|
||||
namespace Stats
|
||||
|
@@ -7,10 +7,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include "stats.h"
|
||||
#include "core/log.h"
|
||||
#include <ctime>
|
||||
|
||||
#include "ezc.h"
|
||||
|
||||
|
||||
namespace Stats
|
||||
@@ -67,18 +67,19 @@ void Stats::ReadStats()
|
||||
if( stats_file.empty() )
|
||||
return;
|
||||
|
||||
std::ifstream file(stats_file.c_str());
|
||||
Ezc::WideToUTF8(stats_file, astats_file);
|
||||
std::ifstream file(astats_file.c_str());
|
||||
|
||||
if( !file )
|
||||
{
|
||||
log << log1 << "Stats: I cannot open a file: " << stats_file << logend;
|
||||
log << log1 << "Stats: I cannot open a file: " << astats_file << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
ReadStats(file);
|
||||
file.close();
|
||||
|
||||
log << log3 << "Stats: statistics loaded from: " << stats_file
|
||||
log << log3 << "Stats: statistics loaded from: " << astats_file
|
||||
<< " (" << stats_tab.size() << " items)" << logend;
|
||||
}
|
||||
|
||||
@@ -117,18 +118,19 @@ void Stats::SaveStats()
|
||||
if( stats_file.empty() )
|
||||
return;
|
||||
|
||||
std::ofstream file(stats_file.c_str());
|
||||
Ezc::WideToUTF8(stats_file, astats_file);
|
||||
std::ofstream file(astats_file.c_str());
|
||||
|
||||
if( !file )
|
||||
{
|
||||
log << log1 << "Stats: I cannot open a file: " << stats_file << logend;
|
||||
log << log1 << "Stats: I cannot open a file: " << astats_file << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
SaveStats(file);
|
||||
file.close();
|
||||
|
||||
log << log3 << "Stats: statistics saved to: " << stats_file << logend;
|
||||
log << log3 << "Stats: statistics saved to: " << astats_file << logend;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,8 +149,8 @@ void Stats::PeriodicSave()
|
||||
|
||||
void Stats::ReadConfig(Config * config)
|
||||
{
|
||||
stats_file = config->Text("stats_file");
|
||||
req_save_freq = config->Int("stats_req_save_freq", req_save_freq);
|
||||
stats_file = config->Text(L"stats_file");
|
||||
req_save_freq = config->Int(L"stats_req_save_freq", req_save_freq);
|
||||
|
||||
if( stats_file.empty() )
|
||||
{
|
||||
|
@@ -32,7 +32,8 @@ struct Stats
|
||||
void RemoveItem(long id);
|
||||
|
||||
// file name for reading/saving statistics
|
||||
std::string stats_file;
|
||||
std::wstring stats_file;
|
||||
std::string astats_file;
|
||||
|
||||
// when the statistics start
|
||||
time_t stats_start;
|
||||
|
@@ -15,64 +15,66 @@
|
||||
|
||||
namespace Stats
|
||||
{
|
||||
using TemplatesFunctions::Info;
|
||||
|
||||
extern long current_item_id;
|
||||
extern Stats stats;
|
||||
|
||||
|
||||
void stats_from(Ezc::Info & i)
|
||||
void stats_from(Info & i)
|
||||
{
|
||||
i.out << DateToStrWithoutHours(stats.stats_start);
|
||||
|
||||
}
|
||||
|
||||
void stats_all(Ezc::Info & i)
|
||||
void stats_all(Info & i)
|
||||
{
|
||||
i.out << stats.global_all;
|
||||
}
|
||||
|
||||
|
||||
void stats_unique(Ezc::Info & i)
|
||||
void stats_unique(Info & i)
|
||||
{
|
||||
i.out << stats.global_unique;
|
||||
}
|
||||
|
||||
|
||||
void stats_google(Ezc::Info & i)
|
||||
void stats_google(Info & i)
|
||||
{
|
||||
i.out << stats.global_google;
|
||||
}
|
||||
|
||||
|
||||
void stats_yahoo(Ezc::Info & i)
|
||||
void stats_yahoo(Info & i)
|
||||
{
|
||||
i.out << stats.global_yahoo;
|
||||
}
|
||||
|
||||
|
||||
void stats_bing(Ezc::Info & i)
|
||||
void stats_bing(Info & i)
|
||||
{
|
||||
i.out << stats.global_bing;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void stats_item_all(Ezc::Info & i)
|
||||
void stats_item_all(Info & i)
|
||||
{
|
||||
i.out << stats.stats_tab[current_item_id].all;
|
||||
}
|
||||
|
||||
|
||||
void stats_item_google(Ezc::Info & i)
|
||||
void stats_item_google(Info & i)
|
||||
{
|
||||
i.out << stats.stats_tab[current_item_id].google;
|
||||
}
|
||||
|
||||
void stats_item_yahoo(Ezc::Info & i)
|
||||
void stats_item_yahoo(Info & i)
|
||||
{
|
||||
i.out << stats.stats_tab[current_item_id].yahoo;
|
||||
}
|
||||
|
||||
void stats_item_bing(Ezc::Info & i)
|
||||
void stats_item_bing(Info & i)
|
||||
{
|
||||
i.out << stats.stats_tab[current_item_id].bing;
|
||||
}
|
||||
@@ -82,7 +84,8 @@ void stats_item_bing(Ezc::Info & i)
|
||||
|
||||
void CreateFunctions(PluginInfo & info)
|
||||
{
|
||||
Ezc::Functions * fun = reinterpret_cast<Ezc::Functions*>(info.p1);
|
||||
typedef Ezc::Functions<TextStream<std::wstring> > Fun;
|
||||
Fun * fun = reinterpret_cast<Fun*>(info.p1);
|
||||
|
||||
fun->Insert("stats_from", stats_from);
|
||||
|
||||
|
Reference in New Issue
Block a user