/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2010, Tomasz Sowa * All rights reserved. * */ #ifndef headerfilecmslucoresystem #define headerfilecmslucoresystem #include #include "dirs.h" #include "mounts.h" #include "db/db.h" #include "request.h" #include "config.h" #include "users.h" #include "groups.h" #include "rebus.h" #include "loadavg.h" #include "synchro.h" #include "thumb.h" #include "notify/notify.h" // 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; // notifications (by emails) Notify notify; // thumbnails (special thread) Thumb thumb; // the time when the winix starts time_t system_start; void SetRequest(Request * prequest); void SetConfig(Config * pconfig); void SetDb(Db * pdb); void SetSynchro(Synchro * psynchro); void Init(); void RedirectTo(const Item & item, const wchar_t * postfix = 0); void RedirectTo(long item_id, const wchar_t * postfix = 0); void RedirectToLastDir(); void RedirectToLastItem(); // redirect to an item if exists or to the last directory 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 wchar_t * group_name); // creating item.file_path and item.file_fs (the mountpoint where the item is located) bool CreateNewFile(Item & item); bool MakeFilePath(const Item & item, std::wstring & path, bool thumb = false, bool create_dir = false, int chmod = 0755); Error AddFile(Item & item, int notify_code = 0); Error EditFile(Item & item, bool with_url = true, int notify_code = 0); // converting GMT time to local time (different for each user) time_t LocalTime(time_t gmt_time); tm LocalTime(const tm * ptm); tm LocalTime(const tm & ptm); private: Request * request; Config * config; Db * db; Synchro * synchro; std::wstring path; bool CreateNewFileSimpleFs(Item & item); bool CreateNewFileHashFs(Item & item); }; #endif