/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2010, Tomasz Sowa * All rights reserved. * */ #ifndef headerfilecmslucorefs #define headerfilecmslucorefs #include "dirs.h" #include "mounts.h" #include "db.h" #include "request.h" #include "config.h" #include "users.h" #include "groups.h" #include "rebus.h" #include "loadavg.h" class Functions; class Templates; // file system class System { public: // contains current directories tree Dirs dirs; // mount points Mounts mounts; // users Users users; // groups Groups groups; // rebus (captcha) Rebus rebus; // load averages LoadAvg load_avg; // the time when the winix starts time_t system_start; void SetRequest(Request * prequest); void SetConfig(Config * pconfig); void SetDb(Db * pdb); void SetFunctions(Functions * pfunctions); void SetTemplates(Templates * ptemplates); void Init(); void RedirectTo(const Item & item, const char * postfix = 0); void RedirectTo(long item_id, const char * postfix = 0); void RedirectToLastDir(); void RedirectToLastItem(); // redirect to an item if exists or to the last directory void PrepareUrl(Item & item); bool CanChangeUser(const Item & item, long new_user_id); bool CanChangeGroup(const Item & item, long new_group_id); bool CanChangePrivileges(const Item & item, int new_priv); bool HasAccess(const Item & item, int mask); bool HasReadAccess(const Item & item); bool HasWriteAccess(const Item & item); bool HasReadWriteAccess(const Item & item); bool HasReadExecAccess(const Item & item); bool HasReadExecAccessToPath(long dir_id); bool DirsHaveReadExecPerm(); void CheckAccessToItems(std::vector & item_tab); bool CanUseHtml(long user_id); bool CanUseBBCode(long user_id); bool CanUseRaw(long user_id); bool IsMemberOfGroup(long user_id, const char * group_name); bool MakePath(const Item & item, std::string & path, bool create_dir); bool MakePath(Item & item, bool create_dir); // output path is: item.auth_path Error AddFile(Item & item); Error EditFile(Item & item, bool with_url = true); Error CheckSpecialFile(const Item & item); private: Request * request; Config * config; Db * db; Functions * functions; Templates * templates; std::string path; bool MakePathSimpleFs(std::string & path, long dir_id, bool create_dir); bool MakePathHashFs(std::string & path, long id, bool create_dir); }; #endif