2010-08-10 18:12:50 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2012-01-08 04:59:51 +01:00
|
|
|
* Copyright (c) 2010-2012, Tomasz Sowa
|
2010-08-10 18:12:50 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-01-23 15:15:30 +01:00
|
|
|
#ifndef headerfile_winix_functions_functions
|
|
|
|
#define headerfile_winix_functions_functions
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "functionbase.h"
|
|
|
|
#include "functionparser.h"
|
|
|
|
#include "adduser.h"
|
|
|
|
#include "cat.h"
|
|
|
|
#include "chmod.h"
|
|
|
|
#include "chown.h"
|
2010-08-10 19:05:19 +02:00
|
|
|
#include "ckeditor.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "cp.h"
|
|
|
|
#include "default.h"
|
|
|
|
#include "download.h"
|
|
|
|
#include "emacs.h"
|
2012-01-08 04:59:51 +01:00
|
|
|
#include "env.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "last.h"
|
|
|
|
#include "login.h"
|
|
|
|
#include "logout.h"
|
2011-01-05 22:24:11 +01:00
|
|
|
#include "ln.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "ls.h"
|
2012-01-06 13:07:23 +01:00
|
|
|
#include "man.h"
|
2011-11-25 05:51:55 +01:00
|
|
|
#include "meta.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "mkdir.h"
|
2011-06-21 23:24:49 +02:00
|
|
|
#include "mount.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "mv.h"
|
2011-06-13 03:06:10 +02:00
|
|
|
#include "nicedit.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "node.h"
|
2011-06-27 23:38:19 +02:00
|
|
|
#include "passwd.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "priv.h"
|
2012-02-28 22:09:44 +01:00
|
|
|
#include "pw.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "reload.h"
|
|
|
|
#include "rm.h"
|
|
|
|
#include "run.h"
|
2011-08-02 02:10:45 +02:00
|
|
|
#include "sort.h"
|
2010-12-07 19:18:45 +01:00
|
|
|
#include "specialdefault.h"
|
2010-10-23 16:54:44 +02:00
|
|
|
#include "stat.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "subject.h"
|
2010-08-13 22:04:57 +02:00
|
|
|
#include "template.h"
|
2010-08-10 19:05:19 +02:00
|
|
|
#include "tinymce.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "uname.h"
|
|
|
|
#include "upload.h"
|
2010-08-10 22:43:38 +02:00
|
|
|
#include "uptime.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "who.h"
|
2010-11-04 17:46:19 +01:00
|
|
|
#include "vim.h"
|
2010-08-14 19:56:07 +02:00
|
|
|
#include "core/htmlfilter.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Templates;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Functions
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Fun::AddUser fun_adduser;
|
|
|
|
Fun::Cat fun_cat;
|
|
|
|
Fun::Chmod fun_chmod;
|
|
|
|
Fun::Chown fun_chown;
|
2010-08-10 19:05:19 +02:00
|
|
|
Fun::Ckeditor fun_ckeditor;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Cp fun_cp;
|
|
|
|
Fun::Default fun_default;
|
|
|
|
Fun::Download fun_download;
|
|
|
|
Fun::Emacs fun_emacs;
|
2012-01-08 04:59:51 +01:00
|
|
|
Fun::Env fun_env;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Last fun_last;
|
|
|
|
Fun::Login fun_login;
|
|
|
|
Fun::Logout fun_logout;
|
2011-01-05 22:24:11 +01:00
|
|
|
Fun::Ln fun_ln;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Ls fun_ls;
|
2012-01-06 13:07:23 +01:00
|
|
|
Fun::Man fun_man;
|
2011-11-25 05:51:55 +01:00
|
|
|
Fun::Meta fun_meta;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Mkdir fun_mkdir;
|
2011-06-21 23:24:49 +02:00
|
|
|
Fun::Mount fun_mount;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Mv fun_mv;
|
2011-06-13 03:06:10 +02:00
|
|
|
Fun::Nicedit fun_nicedit;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Node fun_node;
|
2011-06-27 23:38:19 +02:00
|
|
|
Fun::Passwd fun_passwd;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Priv fun_priv;
|
2012-02-28 22:09:44 +01:00
|
|
|
Fun::Pw fun_pw;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Reload fun_reload;
|
|
|
|
Fun::Rm fun_rm;
|
|
|
|
Fun::Run fun_run;
|
2011-08-02 02:10:45 +02:00
|
|
|
Fun::Sort fun_sort;
|
2010-12-07 19:18:45 +01:00
|
|
|
Fun::SpecialDefault fun_special_default;
|
2010-10-23 16:54:44 +02:00
|
|
|
Fun::Stat fun_stat;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Subject fun_subject;
|
2010-08-13 22:04:57 +02:00
|
|
|
Fun::Template fun_template;
|
2010-08-10 19:05:19 +02:00
|
|
|
Fun::Tinymce fun_tinymce;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Uname fun_uname;
|
|
|
|
Fun::Upload fun_upload;
|
2010-08-10 22:43:38 +02:00
|
|
|
Fun::Uptime fun_uptime;
|
2010-08-10 18:12:50 +02:00
|
|
|
Fun::Who fun_who;
|
2010-11-04 17:46:19 +01:00
|
|
|
Fun::Vim fun_vim;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
typedef std::map<std::wstring, FunctionBase*> Table;
|
2010-08-13 22:04:57 +02:00
|
|
|
typedef Table::iterator Iterator;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-11-04 17:46:19 +01:00
|
|
|
void Init();
|
2010-08-10 18:12:50 +02:00
|
|
|
void Parse();
|
2010-08-13 22:04:57 +02:00
|
|
|
size_t FunctionsSize();
|
|
|
|
|
|
|
|
Iterator Begin();
|
|
|
|
Iterator End();
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
void CheckFunctionAndSymlink();
|
|
|
|
void MakeFunction();
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
void SetConfig(Config * pconfig);
|
2011-01-23 15:15:30 +01:00
|
|
|
void SetCur(Cur * pcur);
|
2010-08-10 18:12:50 +02:00
|
|
|
void SetDb(Db * pdb);
|
|
|
|
void SetSystem(System * psystem);
|
|
|
|
void SetTemplates(Templates * ptemplates);
|
2010-12-06 01:25:46 +01:00
|
|
|
void SetSynchro(Synchro * psynchro);
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
FunctionBase * Find(const std::wstring & function_name);
|
2010-08-12 21:10:12 +02:00
|
|
|
Error CheckSpecialFile(const Item & item);
|
|
|
|
void PrepareUrl(Item & item);
|
2010-08-10 18:12:50 +02:00
|
|
|
void SetDefaultFunction();
|
|
|
|
|
|
|
|
void CheckGetPostTimes(time_t difference = 10);
|
|
|
|
|
2010-10-19 02:31:20 +02:00
|
|
|
bool CheckAbuse();
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
// !! dac lepsze nazwy
|
2010-08-14 19:56:07 +02:00
|
|
|
void ReadItemFilterHtml(Item & item);
|
2010-11-21 01:19:17 +01:00
|
|
|
void ReadItemContent(Item & item, const std::wstring & content_type);
|
2010-08-10 18:12:50 +02:00
|
|
|
void ReadItemContentWithType(Item & item);
|
2010-09-30 22:58:20 +02:00
|
|
|
|
|
|
|
// if item.url is not empty and there is not a post variable "url"
|
|
|
|
// then the item.url will not be changed
|
|
|
|
// (the same is for item.subject and "subject" post variable)
|
|
|
|
void ReadItem(Item & item, Item::Type item_type);
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
void SetUser(Item & item);
|
|
|
|
|
2010-09-29 23:24:34 +02:00
|
|
|
void Add(FunctionBase * fun);
|
|
|
|
void Add(FunctionBase & fun);
|
|
|
|
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
private:
|
|
|
|
|
|
|
|
Config * config;
|
2011-01-23 15:15:30 +01:00
|
|
|
Cur * cur;
|
2010-08-10 18:12:50 +02:00
|
|
|
Db * db;
|
|
|
|
System * system;
|
2010-12-06 01:25:46 +01:00
|
|
|
Synchro * synchro;
|
2010-08-10 18:12:50 +02:00
|
|
|
Templates * templates;
|
|
|
|
|
2010-11-21 01:19:17 +01:00
|
|
|
std::wstring temp;
|
2010-08-14 19:56:07 +02:00
|
|
|
HTMLFilter html_filter;
|
2011-01-05 22:24:11 +01:00
|
|
|
std::wstring link_to_temp;
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2010-11-04 17:46:19 +01:00
|
|
|
void CreateFunctions();
|
|
|
|
void InitFunctions();
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
void SetObjects(FunctionBase * fun);
|
|
|
|
void SetDefaultFunctionForFile();
|
|
|
|
void SetDefaultFunctionForDir();
|
|
|
|
|
2010-09-30 22:58:20 +02:00
|
|
|
void ReadItemUrlSubject(Item & item, Item::Type item_type);
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
Table table;
|
|
|
|
|
|
|
|
FunctionParser function_parser;
|
2011-01-05 22:24:11 +01:00
|
|
|
|
|
|
|
void CheckFunctionFollowDir(bool was_default_function);
|
|
|
|
void CheckFunctionFollowSymlink(bool was_default_function);
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
};
|
|
|
|
|
2011-01-05 22:24:11 +01:00
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
#endif
|