/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2010, Tomasz Sowa * All rights reserved. * */ #ifndef headerfilecmslucoreapp #define headerfilecmslucoreapp #include #include #include #include #include #include #include #include #include "config.h" #include "system.h" #include "mounts.h" #include "request.h" #include "sessionmanager.h" #include "notify.h" #include "db/db.h" #include "functions/functions.h" #include "templates/templates.h" #include "templatesnotify/templatesnotify.h" #include "compress.h" #include "htmlfilter.h" #include "getparser.h" #include "postparser.h" #include "cookieparser.h" #include "postmultiparser.h" #include "acceptencodingparser.h" class App { public: App(); bool Init(); void Start(); void Close(); bool DropPrivileges(); void LogUserGroups(); bool Demonize(); // configuration read from a config file Config config; // current request Request request; // users sessions SessionManager session_manager; // notifications (by emails) Notify notify; // database Db db; DbConn db_conn; /* model */ // file system System system; // false at the beginning // !! moze to do loggera dac? bool stdout_is_closed; /* controllers (note that the whole app object is actually a controller too) */ // functions (ls, cat, emacs, ...) Functions functions; /* view */ Templates templates; TemplatesNotify templates_notify; private: enum Header { h_200, h_404, h_403 }; GetParser get_parser; PostParser post_parser; PostMultiParser post_multi_parser; CookieParser cookie_parser; AcceptEncodingParser accept_encoding_parser; Compress compress; HTMLFilter html_filter; std::wstring clean_html, html_with_debug; bool CreateFCGISocket(); void ProcessRequestThrow(); void ProcessRequest(); bool BaseUrlRedirect(); void DeleteAllPluginsData(); void MakePage(); void Make(); void SaveSessionsIfNeeded(); // !! wywalic do managara sesji?? void LogAccess(); void ReadRequest(); void SendAnswer(); void SetEnv(const char * & env, const char * name); void ReadEnvVariables(); void ReadGetPostVars(); void CheckIE(); void CheckKonqueror(); void CheckRequestMethod(); void CheckFCGIRole(); void SetHtmlFilterConf(); void PrepareSessionCookie(); void AddDebugInfo(std::wstring & out); void FilterCompressSend(bool compressing, const std::wstring & source_ref); void SendHeaders(bool compressing, Header header); bool IsCompressionAllowed(const std::wstring & source); bool CanSendContent(Header header); void LogUser(const char * msg, uid_t id); void LogGroup(const char * msg, gid_t id, bool put_logend = true); void LogUsers(); void LogEffectiveGroups(std::vector & tab); void LogGroups(); bool DropPrivileges(const std::string & user, uid_t uid, gid_t gid, bool additional_groups); // !! dodac do session managera? time_t last_sessions_save; }; #endif