added ticket parser: plugins/ticket/ticketparser.h plugins/ticket/ticketparser.cpp
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@663 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
07511a2eb0
commit
33057acd62
|
@ -177,6 +177,7 @@ Error Mounts::ReadMounts(const std::string & mounts)
|
|||
}
|
||||
|
||||
CalcCurMount();
|
||||
plugin.Call(WINIX_FSTAB_CHANGED);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <string.h>
|
||||
#include "plugin.h"
|
||||
#include "pluginmsg.h"
|
||||
|
||||
|
@ -195,6 +196,29 @@ int old_current_plugin;
|
|||
|
||||
|
||||
|
||||
bool Plugin::HasPlugin(const char * name)
|
||||
{
|
||||
if( *name == 0 )
|
||||
return false;
|
||||
|
||||
for(size_t i=0 ; i<plugins.size() ; ++i)
|
||||
{
|
||||
if( plugins[i].plugin_name && strcmp(plugins[i].plugin_name, name) == 0 )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Plugin::HasPlugin(const std::string & name)
|
||||
{
|
||||
return HasPlugin(name.c_str());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Plugin::Call(int message, Slots::iterator & slot)
|
||||
{
|
||||
if( !SetPointers(info) )
|
||||
|
|
|
@ -139,6 +139,9 @@ public:
|
|||
void LoadPlugins(const std::string & plugins_dir, const std::vector<std::string> & plugins);
|
||||
void UnloadPlugins();
|
||||
|
||||
bool HasPlugin(const char * name);
|
||||
bool HasPlugin(const std::string & name);
|
||||
|
||||
void Call(int message);
|
||||
void Call(int message, void * p1_);
|
||||
void Call(int message, void * p1_, void * p2_);
|
||||
|
|
|
@ -59,5 +59,10 @@
|
|||
// if you do not select it then it will be choosen by winix
|
||||
#define WINIX_SELECT_DEFAULT_FUNCTION 3011
|
||||
|
||||
// /etc/fstab has been changed
|
||||
// now we have new mount points
|
||||
#define WINIX_FSTAB_CHANGED 3012
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -107,7 +107,8 @@ void Emacs::MakePost()
|
|||
|
||||
if( adding )
|
||||
{
|
||||
request->is_item = true;
|
||||
request->is_item = true; // !! moze lepiej nie ustawiac is_item? (bo jak wystapi blad np dodania do bazy danych
|
||||
// to formularz edycji zmieni sie z 'dodaj' na 'edytuj'
|
||||
request->item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask
|
||||
request->status = system->AddFile(request->item);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
|
||||
|
||||
<p>{reload_select}:</p>
|
||||
<a href="[doc_base_url][dir]reload/templates">{reload_templates}</a>
|
||||
<ul>
|
||||
<li><a href="[doc_base_url][dir]reload/templates">{reload_templates}</a></li>
|
||||
|
||||
[if winix_has_plugin "ticket"]
|
||||
<li><a href="[doc_base_url][dir]reload/tickets">{reload_tickets}</a></li>
|
||||
[end]
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
[if winix_has_plugin "stats"]
|
||||
|
||||
<!--
|
||||
Statistics since: [stats_from],
|
||||
global: all: [stats_all],
|
||||
|
@ -11,3 +13,5 @@
|
|||
Yahoo: [stats_item_yahoo],
|
||||
Bing: [stats_item_bing]
|
||||
-->
|
||||
|
||||
[end]
|
||||
|
|
|
@ -119,8 +119,9 @@ priv_change_all = Change subdirectories as well
|
|||
priv_change_current_dir = Change also the current directory
|
||||
|
||||
reload_header = Reload
|
||||
reload_select = What to reload:
|
||||
reload_templates = templates
|
||||
reload_select = Choose an item to reload
|
||||
reload_templates = html templates
|
||||
reload_tickets = tickets config files
|
||||
|
||||
|
||||
rm_file_header = Are you sure you want to delete the file?
|
||||
|
|
|
@ -122,7 +122,8 @@ priv_change_current_dir = Zmie
|
|||
|
||||
reload_header = Prze³aduj
|
||||
reload_select = Wybierz pozycjê
|
||||
reload_templates = templates
|
||||
reload_templates = szablony html
|
||||
reload_tickets = pliki konfiguracyjne ticketów
|
||||
|
||||
|
||||
rm_file_header = Czy napewno chcesz usun±æ podan± pozycjê?
|
||||
|
|
|
@ -33,7 +33,9 @@ void signal_term(int)
|
|||
{
|
||||
plugin.Call(WINIX_CLOSE);
|
||||
app.Close();
|
||||
log << log1 << "winix stopped" << logend << logsave;
|
||||
|
||||
log.PutDate(log1);
|
||||
log << "winix stopped" << logend << logsave;
|
||||
|
||||
// !! sprawdzic czemu ta flaga zatrzymania nie dzialala
|
||||
// i sprobowac pozbyc sie tego exita tutaj
|
||||
|
@ -101,7 +103,8 @@ int main(int argv, char ** argc)
|
|||
signal(SIGTERM, signal_term);
|
||||
signal(SIGINT, signal_term);
|
||||
|
||||
log << log1 << "winix started" << logend << logsavenow;
|
||||
log.PutDate(log1);
|
||||
log << "winix started" << logend << logsavenow;
|
||||
|
||||
// !! wywalic to sprawdzanie
|
||||
//log << log2 << "checking for table consistency:" << logend;
|
||||
|
@ -112,7 +115,9 @@ int main(int argv, char ** argc)
|
|||
|
||||
plugin.Call(WINIX_CLOSE);
|
||||
app.Close();
|
||||
log << log1 << "winix stopped" << logend << logsave;
|
||||
|
||||
log.PutDate(log1);
|
||||
log << "winix stopped" << logend << logsave;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -3,20 +3,21 @@
|
|||
createticket.o: createticket.h tdb.h ticket.h ../../db/dbbase.h
|
||||
createticket.o: ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
createticket.o: ../../core/textstream.h ../../core/error.h ../../core/log.h
|
||||
createticket.o: ticketinfo.h ../../core/item.h ../../core/system.h
|
||||
createticket.o: ../../core/dirs.h ../../core/item.h ../../core/dircontainer.h
|
||||
createticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
createticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h
|
||||
createticket.o: ../../core/thread.h ../../core/dircontainer.h
|
||||
createticket.o: ../../core/ugcontainer.h ../../core/request.h
|
||||
createticket.o: ../../core/requesttypes.h ../../core/session.h
|
||||
createticket.o: ../../core/error.h ../../core/user.h ../../core/plugindata.h
|
||||
createticket.o: ../../core/rebus.h ../../core/config.h
|
||||
createticket.o: ../../core/confparser.h ../../core/htmlfilter.h
|
||||
createticket.o: ../../core/mounts.h ../../core/mount.h
|
||||
createticket.o: ../../core/mountparser.h ../../core/users.h
|
||||
createticket.o: ../../core/ugcontainer.h ../../core/lastcontainer.h
|
||||
createticket.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
|
||||
createticket.o: ticketinfo.h ticketparser.h ticketconf.h ../../core/item.h
|
||||
createticket.o: ../../core/system.h ../../core/dirs.h ../../core/item.h
|
||||
createticket.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
|
||||
createticket.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h
|
||||
createticket.o: ../../core/user.h ../../core/group.h ../../core/thread.h
|
||||
createticket.o: ../../core/dircontainer.h ../../core/ugcontainer.h
|
||||
createticket.o: ../../core/request.h ../../core/requesttypes.h
|
||||
createticket.o: ../../core/session.h ../../core/error.h ../../core/user.h
|
||||
createticket.o: ../../core/plugindata.h ../../core/rebus.h
|
||||
createticket.o: ../../core/config.h ../../core/confparser.h
|
||||
createticket.o: ../../core/htmlfilter.h ../../core/mounts.h
|
||||
createticket.o: ../../core/mount.h ../../core/mountparser.h
|
||||
createticket.o: ../../core/users.h ../../core/ugcontainer.h
|
||||
createticket.o: ../../core/lastcontainer.h ../../core/groups.h
|
||||
createticket.o: ../../core/group.h ../../core/loadavg.h
|
||||
createticket.o: ../../functions/functionbase.h ../../core/request.h
|
||||
createticket.o: ../../core/config.h ../../core/notify.h
|
||||
createticket.o: ../../templatesnotify/templatesnotify.h
|
||||
|
@ -42,10 +43,10 @@ createticket.o: ../../functions/upload.h ../../functions/uptime.h
|
|||
createticket.o: ../../functions/who.h ../../core/htmlfilter.h
|
||||
editticket.o: editticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
editticket.o: ../../db/dbtextstream.h ../../core/textstream.h
|
||||
editticket.o: ../../core/error.h ../../core/log.h ticketinfo.h
|
||||
editticket.o: ../../core/item.h ../../core/system.h ../../core/dirs.h
|
||||
editticket.o: ../../core/item.h ../../core/dircontainer.h ../../db/db.h
|
||||
editticket.o: ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
editticket.o: ../../core/error.h ../../core/log.h ticketinfo.h ticketparser.h
|
||||
editticket.o: ticketconf.h ../../core/item.h ../../core/system.h
|
||||
editticket.o: ../../core/dirs.h ../../core/item.h ../../core/dircontainer.h
|
||||
editticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
editticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h
|
||||
editticket.o: ../../core/thread.h ../../core/dircontainer.h
|
||||
editticket.o: ../../core/ugcontainer.h ../../core/request.h
|
||||
|
@ -81,10 +82,10 @@ editticket.o: ../../functions/uptime.h ../../functions/who.h
|
|||
editticket.o: ../../core/htmlfilter.h
|
||||
funticket.o: funticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
funticket.o: ../../db/dbtextstream.h ../../core/textstream.h
|
||||
funticket.o: ../../core/error.h ../../core/log.h ticketinfo.h
|
||||
funticket.o: ../../core/item.h ../../core/system.h ../../core/dirs.h
|
||||
funticket.o: ../../core/item.h ../../core/dircontainer.h ../../db/db.h
|
||||
funticket.o: ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
funticket.o: ../../core/error.h ../../core/log.h ticketinfo.h ticketparser.h
|
||||
funticket.o: ticketconf.h ../../core/item.h ../../core/system.h
|
||||
funticket.o: ../../core/dirs.h ../../core/item.h ../../core/dircontainer.h
|
||||
funticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
funticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h
|
||||
funticket.o: ../../core/thread.h ../../core/dircontainer.h
|
||||
funticket.o: ../../core/ugcontainer.h ../../core/request.h
|
||||
|
@ -103,17 +104,17 @@ funticket.o: ../../templates/localefilter.h ../../core/locale.h
|
|||
funticket.o: ../../core/system.h
|
||||
init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/error.h
|
||||
init.o: ../../core/log.h funticket.h ticketinfo.h ../../core/item.h
|
||||
init.o: ../../core/system.h ../../core/dirs.h ../../core/item.h
|
||||
init.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
|
||||
init.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h ../../core/user.h
|
||||
init.o: ../../core/group.h ../../core/thread.h ../../core/dircontainer.h
|
||||
init.o: ../../core/ugcontainer.h ../../core/request.h
|
||||
init.o: ../../core/requesttypes.h ../../core/session.h ../../core/error.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/mounts.h ../../core/mount.h ../../core/mountparser.h
|
||||
init.o: ../../core/users.h ../../core/ugcontainer.h
|
||||
init.o: ../../core/log.h funticket.h ticketinfo.h ticketparser.h ticketconf.h
|
||||
init.o: ../../core/item.h ../../core/system.h ../../core/dirs.h
|
||||
init.o: ../../core/item.h ../../core/dircontainer.h ../../db/db.h
|
||||
init.o: ../../db/dbbase.h ../../db/dbitemquery.h ../../db/dbitemcolumns.h
|
||||
init.o: ../../core/user.h ../../core/group.h ../../core/thread.h
|
||||
init.o: ../../core/dircontainer.h ../../core/ugcontainer.h
|
||||
init.o: ../../core/request.h ../../core/requesttypes.h ../../core/session.h
|
||||
init.o: ../../core/error.h ../../core/user.h ../../core/plugindata.h
|
||||
init.o: ../../core/rebus.h ../../core/config.h ../../core/confparser.h
|
||||
init.o: ../../core/htmlfilter.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 ../../functions/functionbase.h
|
||||
init.o: ../../core/request.h ../../core/config.h ../../core/notify.h
|
||||
|
@ -143,42 +144,43 @@ 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
|
||||
readticket.o: readticket.h ticket.h ticketinfo.h ../../core/item.h
|
||||
readticket.o: ../../core/system.h ../../core/dirs.h ../../core/item.h
|
||||
readticket.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
|
||||
readticket.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h
|
||||
readticket.o: ../../core/user.h ../../core/group.h ../../core/thread.h
|
||||
readticket.o: ../../core/error.h ../../core/log.h ../../core/dircontainer.h
|
||||
readticket.o: ../../core/ugcontainer.h ../../core/request.h
|
||||
readticket.o: ../../core/requesttypes.h ../../core/session.h
|
||||
readticket.o: ../../core/error.h ../../core/user.h ../../core/plugindata.h
|
||||
readticket.o: ../../core/rebus.h ../../core/config.h ../../core/confparser.h
|
||||
readticket.o: ../../core/htmlfilter.h ../../core/mounts.h ../../core/mount.h
|
||||
readticket.o: ../../core/mountparser.h ../../core/users.h
|
||||
readticket.o: ../../core/ugcontainer.h ../../core/lastcontainer.h
|
||||
readticket.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
|
||||
readticket.o: tdb.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
readticket.o: ../../db/dbtextstream.h ../../core/textstream.h
|
||||
readticket.o: ../../core/request.h
|
||||
readticket.o: readticket.h ticket.h ticketinfo.h ticketparser.h ticketconf.h
|
||||
readticket.o: ../../core/item.h ../../core/system.h ../../core/dirs.h
|
||||
readticket.o: ../../core/item.h ../../core/dircontainer.h ../../db/db.h
|
||||
readticket.o: ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
readticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h
|
||||
readticket.o: ../../core/thread.h ../../core/error.h ../../core/log.h
|
||||
readticket.o: ../../core/dircontainer.h ../../core/ugcontainer.h
|
||||
readticket.o: ../../core/request.h ../../core/requesttypes.h
|
||||
readticket.o: ../../core/session.h ../../core/error.h ../../core/user.h
|
||||
readticket.o: ../../core/plugindata.h ../../core/rebus.h ../../core/config.h
|
||||
readticket.o: ../../core/confparser.h ../../core/htmlfilter.h
|
||||
readticket.o: ../../core/mounts.h ../../core/mount.h ../../core/mountparser.h
|
||||
readticket.o: ../../core/users.h ../../core/ugcontainer.h
|
||||
readticket.o: ../../core/lastcontainer.h ../../core/groups.h
|
||||
readticket.o: ../../core/group.h ../../core/loadavg.h tdb.h ../../db/dbbase.h
|
||||
readticket.o: ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
readticket.o: ../../core/textstream.h ../../core/request.h
|
||||
tdb.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
tdb.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/error.h
|
||||
tdb.o: ../../core/log.h ../../core/log.h
|
||||
templates.o: ../../../ezc/src/ezc.h ticketinfo.h ticket.h ../../core/item.h
|
||||
templates.o: ../../core/system.h ../../core/dirs.h ../../core/item.h
|
||||
templates.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
|
||||
templates.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h
|
||||
templates.o: ../../core/user.h ../../core/group.h ../../core/thread.h
|
||||
templates.o: ../../core/error.h ../../core/log.h ../../core/dircontainer.h
|
||||
templates.o: ../../core/ugcontainer.h ../../core/request.h
|
||||
templates.o: ../../core/requesttypes.h ../../core/session.h
|
||||
templates.o: ../../core/error.h ../../core/user.h ../../core/plugindata.h
|
||||
templates.o: ../../core/rebus.h ../../core/config.h ../../core/confparser.h
|
||||
templates.o: ../../core/htmlfilter.h ../../core/mounts.h ../../core/mount.h
|
||||
templates.o: ../../core/mountparser.h ../../core/users.h
|
||||
templates.o: ../../core/ugcontainer.h ../../core/lastcontainer.h
|
||||
templates.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h
|
||||
templates.o: tdb.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
templates.o: ../../db/dbtextstream.h ../../core/textstream.h editticket.h
|
||||
templates.o: ../../../ezc/src/ezc.h ticketinfo.h ticket.h ticketparser.h
|
||||
templates.o: ticketconf.h ../../core/item.h ../../core/system.h
|
||||
templates.o: ../../core/dirs.h ../../core/item.h ../../core/dircontainer.h
|
||||
templates.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
templates.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h
|
||||
templates.o: ../../core/thread.h ../../core/error.h ../../core/log.h
|
||||
templates.o: ../../core/dircontainer.h ../../core/ugcontainer.h
|
||||
templates.o: ../../core/request.h ../../core/requesttypes.h
|
||||
templates.o: ../../core/session.h ../../core/error.h ../../core/user.h
|
||||
templates.o: ../../core/plugindata.h ../../core/rebus.h ../../core/config.h
|
||||
templates.o: ../../core/confparser.h ../../core/htmlfilter.h
|
||||
templates.o: ../../core/mounts.h ../../core/mount.h ../../core/mountparser.h
|
||||
templates.o: ../../core/users.h ../../core/ugcontainer.h
|
||||
templates.o: ../../core/lastcontainer.h ../../core/groups.h
|
||||
templates.o: ../../core/group.h ../../core/loadavg.h tdb.h ../../db/dbbase.h
|
||||
templates.o: ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
templates.o: ../../core/textstream.h editticket.h
|
||||
templates.o: ../../functions/functionbase.h ../../core/request.h
|
||||
templates.o: ../../core/config.h ../../core/notify.h
|
||||
templates.o: ../../templatesnotify/templatesnotify.h ../../core/mount.h
|
||||
|
@ -209,9 +211,11 @@ templates.o: ../../templates/patterncacher.h ../../core/item.h
|
|||
templates.o: ../../templates/ckeditorgetparser.h
|
||||
templates.o: ../../core/httpsimpleparser.h ../../core/log.h
|
||||
templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
|
||||
ticketinfo.o: ticketinfo.h ticket.h ../../core/item.h ../../core/system.h
|
||||
ticketinfo.o: ../../core/dirs.h ../../core/item.h ../../core/dircontainer.h
|
||||
ticketinfo.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
ticketconf.o: ticketconf.h
|
||||
ticketinfo.o: ticketinfo.h ticket.h ticketparser.h ticketconf.h
|
||||
ticketinfo.o: ../../core/item.h ../../core/system.h ../../core/dirs.h
|
||||
ticketinfo.o: ../../core/item.h ../../core/dircontainer.h ../../db/db.h
|
||||
ticketinfo.o: ../../db/dbbase.h ../../db/dbitemquery.h
|
||||
ticketinfo.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h
|
||||
ticketinfo.o: ../../core/thread.h ../../core/error.h ../../core/log.h
|
||||
ticketinfo.o: ../../core/dircontainer.h ../../core/ugcontainer.h
|
||||
|
@ -224,4 +228,5 @@ ticketinfo.o: ../../core/users.h ../../core/ugcontainer.h
|
|||
ticketinfo.o: ../../core/lastcontainer.h ../../core/groups.h
|
||||
ticketinfo.o: ../../core/group.h ../../core/loadavg.h tdb.h ../../db/dbbase.h
|
||||
ticketinfo.o: ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
ticketinfo.o: ../../core/textstream.h
|
||||
ticketinfo.o: ../../core/textstream.h ../../core/log.h
|
||||
ticketparser.o: ticketparser.h ticketconf.h ../../core/log.h
|
||||
|
|
|
@ -1 +1 @@
|
|||
o = createticket.o editticket.o funticket.o init.o readticket.o tdb.o templates.o ticketinfo.o
|
||||
o = createticket.o editticket.o funticket.o init.o readticket.o tdb.o templates.o ticketconf.o ticketinfo.o ticketparser.o
|
||||
|
|
|
@ -55,6 +55,8 @@ void AddMounts(PluginInfo & info)
|
|||
|
||||
ticket_info.mount_type_ticket = m.AddMountType("ticket");
|
||||
ticket_info.mount_par_ticket = m.AddMountPar("ticket");
|
||||
ticket_info.mount_par_ticket_conf = m.AddMountPar("ticket_conf");
|
||||
|
||||
ticket_info.mount_par_ticket_type = m.AddMountPar("ticket_type");
|
||||
ticket_info.mount_par_ticket_type_default = m.AddMountPar("ticket_type_default");
|
||||
ticket_info.mount_par_ticket_status = m.AddMountPar("ticket_status");
|
||||
|
@ -69,6 +71,24 @@ void AddMounts(PluginInfo & info)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void FstabChanged(PluginInfo & info)
|
||||
{
|
||||
ticket_info.ReadTicketConf(true);
|
||||
}
|
||||
|
||||
|
||||
void ContentMake(PluginInfo & info)
|
||||
{
|
||||
if( info.request->function == &info.functions->fun_reload )
|
||||
{
|
||||
if( info.request->IsParam("tickets") )
|
||||
ticket_info.ReadTicketConf();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AddEzcFunctions(PluginInfo & info);
|
||||
|
||||
} // namespace Ticket
|
||||
|
@ -83,6 +103,8 @@ using namespace Ticket;
|
|||
plugin.Assign(WINIX_CREATE_FUNCTIONS, AddFunctions);
|
||||
plugin.Assign(WINIX_SELECT_DEFAULT_FUNCTION, SelectDefaultFunction);
|
||||
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
|
||||
plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged);
|
||||
plugin.Assign(WINIX_CONTENT_MAKE, ContentMake);
|
||||
|
||||
tdb.SetConn(info.db->GetConn());
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#include <limits>
|
||||
#include "ticketconf.h"
|
||||
|
||||
|
||||
TicketConf::TicketItem::TicketItem()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void TicketConf::TicketItem::Clear()
|
||||
{
|
||||
id = 0;
|
||||
name.clear();
|
||||
type = TypeInteger;
|
||||
integer_min = std::numeric_limits<int>::min();
|
||||
integer_max = std::numeric_limits<int>::max();
|
||||
select.clear();
|
||||
select_default = 0;
|
||||
}
|
||||
|
||||
void TicketConf::Clear()
|
||||
{
|
||||
tab.clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef headerfile_winix_plugins_ticket_ticketconf
|
||||
#define headerfile_winix_plugins_ticket_ticketconf
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
|
||||
|
||||
struct TicketConf
|
||||
{
|
||||
struct TicketItem
|
||||
{
|
||||
struct Select
|
||||
{
|
||||
std::string name;
|
||||
int id;
|
||||
};
|
||||
|
||||
|
||||
TicketItem();
|
||||
void Clear();
|
||||
|
||||
enum Type { TypeInteger, TypeSelect };
|
||||
|
||||
int id;
|
||||
|
||||
std::string name;
|
||||
Type type;
|
||||
|
||||
// used when type is TypeInteger
|
||||
int integer_min, integer_max;
|
||||
|
||||
// used when type is TypeSelect
|
||||
std::vector<Select> select;
|
||||
size_t select_default;
|
||||
};
|
||||
|
||||
typedef std::vector<TicketItem> Table;
|
||||
Table tab;
|
||||
|
||||
void Clear();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#include <ctime>
|
||||
#include "ticketinfo.h"
|
||||
#include "core/error.h"
|
||||
|
||||
#include "core/log.h"
|
||||
|
||||
|
||||
namespace Ticket
|
||||
|
@ -81,4 +81,124 @@ std::vector<Ticket>::iterator i;
|
|||
}
|
||||
|
||||
|
||||
|
||||
void TicketInfo::MarkAllConfToDelete()
|
||||
{
|
||||
ConfTab::iterator i = conf_tab.begin();
|
||||
|
||||
for( ; i!=conf_tab.end() ; ++i)
|
||||
i->second.to_delete = true;
|
||||
}
|
||||
|
||||
|
||||
void TicketInfo::DeleteAllMarkedConf()
|
||||
{
|
||||
ConfTab::iterator inext;
|
||||
ConfTab::iterator i = conf_tab.begin();
|
||||
|
||||
while( i != conf_tab.end() )
|
||||
{
|
||||
inext = i;
|
||||
++inext;
|
||||
|
||||
if( i->second.to_delete )
|
||||
{
|
||||
log << log3 << "Ticket: deleting ticket conf for dir id: " << i->first << logend;
|
||||
conf_tab.erase(i);
|
||||
}
|
||||
|
||||
i = inext;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TicketInfo::GetConfContent(const std::string & path)
|
||||
{
|
||||
long path_dir_id;
|
||||
|
||||
if( system->dirs.AnalyzePath(path, path_dir_id, path_dir, path_file) != 0 )
|
||||
{
|
||||
log << log1 << "Ticket: there is no file: " << path << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
Error err = db->GetItem(path_dir_id, path_file, item_conf);
|
||||
|
||||
if( err == WINIX_ERR_NO_ITEM )
|
||||
{
|
||||
log << log1 << "Ticket: there is no file: " << path << " in the database" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( err != WINIX_ERR_OK )
|
||||
{
|
||||
log << log1 << "Ticket: db problem with fetching: " << path << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TicketInfo::ParseTicketConf(long mount_dir_id, const std::string & path)
|
||||
{
|
||||
log << log3 << "Ticket: parsing conf file: " << path << logend;
|
||||
|
||||
int code = ticket_parser.Parse(item_conf.content, conf_tab[mount_dir_id].conf);
|
||||
conf_tab[mount_dir_id].file_name = path;
|
||||
|
||||
return code == WINIX_TICKET_ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
// if skip_existing_configs is true then only new config files will be parsed
|
||||
void TicketInfo::ReadTicketConf(Mounts & mounts, bool skip_existing_configs)
|
||||
{
|
||||
Mounts::MountTab::const_iterator i;
|
||||
const Mounts::MountTab * mtab = mounts.GetMountTab();
|
||||
|
||||
// loop through all mount points
|
||||
for(i=mtab->begin() ; i!=mtab->end() ; ++i)
|
||||
{
|
||||
const Mount & mount = i->second;
|
||||
|
||||
if( mount.param[mount_par_ticket_conf].defined &&
|
||||
mount.param[mount_par_ticket_conf].arg.size() == 1 )
|
||||
{
|
||||
const std::string & file_name = mount.param[mount_par_ticket_conf].arg[0];
|
||||
ConfTab::iterator c = conf_tab.find(mount.dir_id);
|
||||
bool exists = (c != conf_tab.end() && c->second.file_name == file_name);
|
||||
|
||||
if( exists )
|
||||
c->second.to_delete = false;
|
||||
|
||||
if( !(skip_existing_configs && exists) )
|
||||
{
|
||||
if( GetConfContent(file_name) )
|
||||
{
|
||||
if( !ParseTicketConf(mount.dir_id, file_name) )
|
||||
conf_tab[mount.dir_id].to_delete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( exists )
|
||||
c->second.to_delete = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if skip_existing_configs is true then only new config files will be parsed
|
||||
void TicketInfo::ReadTicketConf(bool skip_existing_configs)
|
||||
{
|
||||
MarkAllConfToDelete();
|
||||
ReadTicketConf(system->mounts, skip_existing_configs);
|
||||
DeleteAllMarkedConf();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include "ticket.h"
|
||||
#include "ticketparser.h"
|
||||
#include "core/item.h"
|
||||
#include "core/system.h"
|
||||
#include "db/db.h"
|
||||
|
@ -24,6 +25,19 @@ namespace Ticket
|
|||
{
|
||||
|
||||
|
||||
struct TicketConfWrap
|
||||
{
|
||||
bool to_delete;
|
||||
std::string file_name;
|
||||
TicketConf conf;
|
||||
|
||||
TicketConfWrap()
|
||||
{
|
||||
to_delete = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TicketInfo
|
||||
{
|
||||
public:
|
||||
|
@ -42,10 +56,18 @@ public:
|
|||
bool is_ticket;
|
||||
Ticket ticket;
|
||||
std::vector<Ticket> ticket_tab;
|
||||
|
||||
// <dir_id, TicketConfWrap>
|
||||
typedef std::map<long, TicketConfWrap> ConfTab;
|
||||
ConfTab conf_tab;
|
||||
|
||||
|
||||
|
||||
int mount_type_ticket;
|
||||
|
||||
int mount_par_ticket;
|
||||
int mount_par_ticket_conf;
|
||||
|
||||
int mount_par_ticket_type;
|
||||
int mount_par_ticket_type_default;
|
||||
int mount_par_ticket_status;
|
||||
|
@ -59,15 +81,25 @@ public:
|
|||
|
||||
int mount_par_createticket_on;
|
||||
|
||||
|
||||
void ReadTicketConf(bool skip_existing_configs = false);
|
||||
|
||||
|
||||
private:
|
||||
TDb * tdb;
|
||||
Db * db;
|
||||
System * system;
|
||||
TicketParser ticket_parser;
|
||||
Item item_conf;
|
||||
std::string path_dir;
|
||||
std::string path_file;
|
||||
|
||||
static bool SortTicketsFun(const Ticket & t1, const Ticket & t2);
|
||||
bool GetConfContent(const std::string & path);
|
||||
bool ParseTicketConf(long mount_dir_id, const std::string & path);
|
||||
void ReadTicketConf(Mounts & mounts, bool skip_existing_configs);
|
||||
void MarkAllConfToDelete();
|
||||
void DeleteAllMarkedConf();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,308 @@
|
|||
#include "ticketparser.h"
|
||||
#include "core/log.h"
|
||||
|
||||
|
||||
bool TicketParser::IsWhite(int c)
|
||||
{
|
||||
return (c==' ' || c=='\t' || c==13);
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::SkipLine()
|
||||
{
|
||||
while( *pchar!=0 && *pchar!=10 )
|
||||
pchar += 1;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::SkipWhite()
|
||||
{
|
||||
while( IsWhite(*pchar) || *pchar=='#' )
|
||||
{
|
||||
if( *pchar=='#' )
|
||||
SkipLine();
|
||||
else
|
||||
pchar += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::SkipWhiteLines()
|
||||
{
|
||||
while( IsWhite(*pchar) || *pchar == 10 || *pchar=='#' )
|
||||
{
|
||||
if( *pchar=='#' )
|
||||
SkipLine();
|
||||
else
|
||||
pchar += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadTextQuoted(std::string & text)
|
||||
{
|
||||
pchar += 1;
|
||||
|
||||
while( *pchar!=0 && *pchar!=10 && *pchar!='\"' )
|
||||
{
|
||||
if( *pchar == '\\' )
|
||||
pchar += 1;
|
||||
|
||||
text += *pchar;
|
||||
pchar += 1;
|
||||
}
|
||||
|
||||
if( *pchar == '\"' )
|
||||
pchar += 1;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadTextSimple(std::string & text, bool comma_separator)
|
||||
{
|
||||
while( *pchar!=0 && *pchar!=10 && !IsWhite(*pchar) && *pchar!='(' && *pchar!=')' &&
|
||||
(!comma_separator || *pchar!=',' ) )
|
||||
{
|
||||
text += *pchar;
|
||||
pchar += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadText(std::string & text, bool comma_separator)
|
||||
{
|
||||
SkipWhite();
|
||||
text.clear();
|
||||
|
||||
if( *pchar == '\"' )
|
||||
ReadTextQuoted(text);
|
||||
else
|
||||
ReadTextSimple(text, comma_separator);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void TicketParser::CheckId(int & id, bool & def)
|
||||
{
|
||||
if( *pchar != '(' )
|
||||
return;
|
||||
|
||||
// dont set id and def here
|
||||
// there are only changed if exists
|
||||
pchar += 1;
|
||||
|
||||
while( *pchar!=0 && *pchar!=10 && *pchar!=')' )
|
||||
{
|
||||
ReadText(id_str, true);
|
||||
|
||||
if( id_str == "def" )
|
||||
def = true;
|
||||
else
|
||||
id = atoi(id_str.c_str());
|
||||
|
||||
if( *pchar == ',' )
|
||||
pchar += 1;
|
||||
}
|
||||
|
||||
if( *pchar == ')' )
|
||||
pchar += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool TicketParser::ReadItemType()
|
||||
{
|
||||
ReadText(type);
|
||||
|
||||
if( type.empty() )
|
||||
return false;
|
||||
|
||||
if( type == "integer" )
|
||||
item.type = TicketConf::TicketItem::TypeInteger;
|
||||
else
|
||||
if( type == "select" )
|
||||
item.type = TicketConf::TicketItem::TypeSelect;
|
||||
else
|
||||
{
|
||||
error = WINIX_TICKET_ERR_UKNOWN_TYPE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::SetItemId()
|
||||
{
|
||||
int id;
|
||||
bool def;
|
||||
|
||||
id = (!pconf->tab.empty()) ? pconf->tab.back().id + 1 : 0;
|
||||
CheckId(id, def);
|
||||
|
||||
item.id = id;
|
||||
}
|
||||
|
||||
|
||||
bool TicketParser::ReadItemName()
|
||||
{
|
||||
ReadText(item.name);
|
||||
|
||||
if( item.name.empty() )
|
||||
{
|
||||
error = WINIX_TICKET_ERR_NO_ITEM_NAME;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadItemInteger()
|
||||
{
|
||||
ReadText(int_min);
|
||||
ReadText(int_max);
|
||||
|
||||
if( !int_min.empty() )
|
||||
item.integer_min = atoi(int_min.c_str());
|
||||
|
||||
if( !int_max.empty() )
|
||||
item.integer_max = atoi(int_max.c_str());
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadItemSelect()
|
||||
{
|
||||
bool def;
|
||||
|
||||
while( *pchar!=0 && *pchar!=10 )
|
||||
{
|
||||
ReadText(select.name);
|
||||
select.id = (!item.select.empty()) ? item.select.back().id + 1 : 0;
|
||||
def = false;
|
||||
CheckId(select.id, def);
|
||||
|
||||
if( !select.name.empty() )
|
||||
{
|
||||
item.select.push_back(select);
|
||||
|
||||
if( def )
|
||||
item.select_default = item.select.size() - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TicketParser::CheckEndLine()
|
||||
{
|
||||
SkipWhite();
|
||||
|
||||
if( *pchar != 0 && *pchar != 10 )
|
||||
{
|
||||
error = WINIX_TICKET_ERR_SYNTAX_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TicketParser::ReadItem()
|
||||
{
|
||||
SkipWhiteLines();
|
||||
item.Clear();
|
||||
|
||||
if( !ReadItemType() )
|
||||
return false;
|
||||
|
||||
SetItemId();
|
||||
|
||||
if( !ReadItemName() )
|
||||
return false;
|
||||
|
||||
if( item.type == TicketConf::TicketItem::TypeInteger )
|
||||
ReadItemInteger();
|
||||
else
|
||||
ReadItemSelect();
|
||||
|
||||
if( !CheckEndLine() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItemInteger(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: integer"
|
||||
<< ", item_name: " << item.name
|
||||
<< ", item_id: " << item.id
|
||||
<< ", min: " << item.integer_min
|
||||
<< ", max: " << item.integer_max
|
||||
<< logend;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItemSelect(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: select"
|
||||
<< ", item_name: " << item.name
|
||||
<< ", item_id: " << item.id
|
||||
<< ", options: ";
|
||||
|
||||
for(size_t i=0 ; i<item.select.size() ; ++i)
|
||||
{
|
||||
log << item.select[i].name << "(" << item.select[i].id;
|
||||
|
||||
if( item.select_default == i )
|
||||
log << ", def";
|
||||
|
||||
log << ")";
|
||||
|
||||
if( i+1 < item.select.size() )
|
||||
log << ", ";
|
||||
}
|
||||
|
||||
log << logend;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItem(TicketConf::TicketItem & item)
|
||||
{
|
||||
if( item.type == TicketConf::TicketItem::TypeInteger )
|
||||
LogItemInteger(item);
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeSelect )
|
||||
LogItemSelect(item);
|
||||
}
|
||||
|
||||
|
||||
int TicketParser::Parse(const char * str, TicketConf & conf)
|
||||
{
|
||||
pchar = str;
|
||||
pconf = &conf;
|
||||
error = WINIX_TICKET_ERR_OK;
|
||||
conf.Clear();
|
||||
|
||||
while( ReadItem() )
|
||||
{
|
||||
conf.tab.push_back(item);
|
||||
LogItem(item);
|
||||
}
|
||||
|
||||
if( error != WINIX_TICKET_ERR_OK )
|
||||
{
|
||||
log << log1 << "TicketParser: some errors occured during parsing the config (clearing the table)";
|
||||
conf.Clear();
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int TicketParser::Parse(const std::string & str, TicketConf & conf)
|
||||
{
|
||||
return Parse(str.c_str(), conf);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#ifndef headerfile_winix_plugins_ticket_ticketparser
|
||||
#define headerfile_winix_plugins_ticket_ticketparser
|
||||
|
||||
|
||||
#include "ticketconf.h"
|
||||
|
||||
#define WINIX_TICKET_ERR_OK 0
|
||||
#define WINIX_TICKET_ERR_UKNOWN_TYPE 1
|
||||
#define WINIX_TICKET_ERR_NO_ITEM_NAME 2
|
||||
#define WINIX_TICKET_ERR_SYNTAX_ERROR 3
|
||||
|
||||
|
||||
|
||||
class TicketParser
|
||||
{
|
||||
public:
|
||||
|
||||
int Parse(const char * str, TicketConf & conf);
|
||||
int Parse(const std::string & str, TicketConf & conf);
|
||||
|
||||
private:
|
||||
|
||||
TicketConf * pconf;
|
||||
const char * pchar;
|
||||
int error; // last error code
|
||||
TicketConf::TicketItem item;
|
||||
std::string type;
|
||||
std::string id_str;
|
||||
std::string int_min, int_max;
|
||||
TicketConf::TicketItem::Select select;
|
||||
|
||||
bool IsWhite(int c);
|
||||
void SkipWhite();
|
||||
void SkipWhiteLines();
|
||||
void SkipLine();
|
||||
void ReadTextQuoted(std::string & text);
|
||||
void ReadTextSimple(std::string & text, bool comma_separator);
|
||||
void ReadText(std::string & text, bool comma_separator = false);
|
||||
|
||||
void CheckId(int & id, bool & def);
|
||||
void SetItemId();
|
||||
bool CheckEndLine();
|
||||
|
||||
bool ReadItemType();
|
||||
bool ReadItemName();
|
||||
void ReadItemInteger();
|
||||
void ReadItemSelect();
|
||||
bool ReadItem();
|
||||
|
||||
void LogItemInteger(TicketConf::TicketItem & item);
|
||||
void LogItemSelect(TicketConf::TicketItem & item);
|
||||
void LogItem(TicketConf::TicketItem & item);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -389,10 +389,11 @@ winix.o: ../core/dircontainer.h ../core/request.h ../core/mounts.h
|
|||
winix.o: ../core/mount.h ../core/mountparser.h ../core/users.h
|
||||
winix.o: ../core/ugcontainer.h ../core/lastcontainer.h ../core/groups.h
|
||||
winix.o: ../core/group.h ../core/loadavg.h ../core/sessionmanager.h
|
||||
winix.o: ../core/sessioncontainer.h ../core/system.h ../functions/functions.h
|
||||
winix.o: ../functions/functionbase.h ../core/notify.h
|
||||
winix.o: ../templatesnotify/templatesnotify.h ../core/mount.h
|
||||
winix.o: ../templates/misc.h ../functions/functionparser.h
|
||||
winix.o: ../core/sessioncontainer.h ../core/system.h ../core/plugin.h
|
||||
winix.o: ../core/pluginmsg.h ../core/sessionmanager.h
|
||||
winix.o: ../functions/functions.h ../functions/functionbase.h
|
||||
winix.o: ../core/notify.h ../templatesnotify/templatesnotify.h
|
||||
winix.o: ../core/mount.h ../templates/misc.h ../functions/functionparser.h
|
||||
winix.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
|
||||
winix.o: ../functions/privchanger.h ../functions/chown.h
|
||||
winix.o: ../functions/ckeditor.h ../functions/cp.h
|
||||
|
@ -404,4 +405,4 @@ winix.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
|
|||
winix.o: ../functions/run.h ../functions/subject.h ../functions/funthread.h
|
||||
winix.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h
|
||||
winix.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
|
||||
winix.o: ../core/htmlfilter.h
|
||||
winix.o: ../core/htmlfilter.h ../templates/templates.h
|
||||
|
|
|
@ -368,6 +368,7 @@ void Templates::CreateFunctions()
|
|||
ezc_functions.Insert("winix_function", winix_function);
|
||||
ezc_functions.Insert("winix_function_is", winix_function_is);
|
||||
ezc_functions.Insert("winix_function_param_is", winix_function_param_is);
|
||||
ezc_functions.Insert("winix_has_plugin", winix_has_plugin);
|
||||
ezc_functions.Insert("winix_loadavg_now", winix_loadavg_now);
|
||||
ezc_functions.Insert("winix_loadavg_1", winix_loadavg_1);
|
||||
ezc_functions.Insert("winix_loadavg_5", winix_loadavg_5);
|
||||
|
|
|
@ -299,6 +299,7 @@ namespace TemplatesFunctions
|
|||
void winix_function(Info & i);
|
||||
void winix_function_is(Info & i);
|
||||
void winix_function_param_is(Info & i);
|
||||
void winix_has_plugin(Info & i);
|
||||
void winix_loadavg_now(Info & i);
|
||||
void winix_loadavg_1(Info & i);
|
||||
void winix_loadavg_5(Info & i);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <ctime>
|
||||
#include "templates.h"
|
||||
#include "core/request.h"
|
||||
#include "core/plugin.h"
|
||||
#include "functions/functions.h"
|
||||
|
||||
|
||||
|
@ -59,6 +60,23 @@ void winix_function_param_is(Info & i)
|
|||
}
|
||||
|
||||
|
||||
void winix_has_plugin(Info & i)
|
||||
{
|
||||
size_t exist = 0;
|
||||
|
||||
if( i.params.empty() )
|
||||
return;
|
||||
|
||||
for(size_t a=0 ; a<i.params.size() ; ++a)
|
||||
{
|
||||
if( plugin.HasPlugin(i.params[a]) )
|
||||
++exist;
|
||||
}
|
||||
|
||||
i.res = (exist == i.params.size());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void winix_loadavg_now(Info & i)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue