added: plugins_dir to config

small changes in makefiles


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@643 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2010-08-17 22:32:47 +00:00
parent eec0ddf466
commit 3b655f39e1
15 changed files with 73 additions and 29 deletions

View File

@ -5,16 +5,16 @@ CXX = g++
endif
ifndef CXXFLAGS
#CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER
CXXFLAGS = -fPIC -Wall -pedantic -O0 -g -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER
CXXFLAGS = -fPIC -Wall -pedantic -O2 -I/usr/local/include -I/home/tomek/roboczy/winix -I/home/tomek/roboczy/ezc/src -L/usr/local/lib -DEZC_USE_WINIX_LOGGER
endif
export CXX
export CXXFLAGS
all: winix
winix: FORCE
@ -30,6 +30,7 @@ winix: FORCE
$(CXX) -o winix $(CXXFLAGS) main/*.o /home/tomek/roboczy/winix/winix.so
clean:
@cd core ; $(MAKE) -e clean
@cd functions ; $(MAKE) -e clean
@ -54,9 +55,24 @@ depend:
@cd ../ezc/src ; $(MAKE) -e depend
@cd main ; $(MAKE) -e depend
#install: all
# mkdir -p bin
# rm -f bin/winix.so
# rm -f bin/winix
# cp winix.so bin/
# cp winix bin/
install: all
# binaries
mkdir -p /usr/local/winix/bin
mkdir -p /usr/local/winix/lib
cp winix.so /usr/local/winix/lib/
# use the full path with winix.so (we have to recompile winix with a new path to winix.so)
$(CXX) -o /usr/local/winix/bin/winix $(CXXFLAGS) main/*.o /usr/local/winix/lib/winix.so
# html templates
mkdir -p /usr/local/winix/html
cp -rf html/ /usr/local/winix/html/
find /usr/local/winix/html/ -type d -name ".svn" | xargs -I foo rm -fr foo
# locales
mkdir -p /usr/local/winix/locale
cp -rf locale/ /usr/local/winix/locale/
find /usr/local/winix/locale/ -type d -name ".svn" | xargs -I foo rm -fr foo
# plugins
mkdir -p /usr/local/winix/plugins
find plugins/ -name "*.so" | xargs -I foo cp foo /usr/local/winix/plugins/
# removed provileges for others
find /usr/local/winix -exec chmod o-r,o-x,o-w "{}" "+"

View File

@ -74,7 +74,7 @@ bool App::CreateFCGISocket()
int s = FCGX_OpenSocket(sock, 10);
int s = FCGX_OpenSocket(sock, 100);
if( s < 0 )
{

View File

@ -161,6 +161,8 @@ void Config::AssignValues(bool stdout_is_closed)
editors_html_safe_mode = Bool("editors_html_safe_mode", true);
editors_html_safe_mode_skip_root = Bool("editors_html_safe_mode_skip_root", true);
plugins_dir = Text("plugins_dir", "/usr/local/winix/plugins");
NoLastSlash(plugins_dir);
parser.ListText("plugins", plugin_file);
}

View File

@ -103,7 +103,13 @@ public:
// if the output is shorter than this value then it will not be compressed
int compression_page_min_size;
// plugins directory
// default: /usr/local/winix/plugins
std::string plugins_dir;
// plugins
// you can provide either a relative path (plugins_dir will be used)
// or a full path to a plugin
std::vector<std::string> plugin_file;
// should the html code be cleaned by the html filter

View File

@ -109,12 +109,22 @@ return res;
}
void Plugin::LoadPlugins(const std::vector<std::string> & plugins)
void Plugin::LoadPlugins(const std::string & plugins_dir, const std::vector<std::string> & plugins)
{
size_t i;
for(i=0 ; i<plugins.size() ; ++i)
LoadPlugin(plugins[i]);
for(size_t i=0 ; i<plugins.size() ; ++i)
{
if( !plugins[i].empty() && plugins[i][0] == '/' )
{
LoadPlugin(plugins[i]);
}
else
{
temp_path = plugins_dir;
temp_path += '/';
temp_path += plugins[i];
LoadPlugin(plugins[i]);
}
}
}

View File

@ -136,7 +136,7 @@ public:
void LoadPlugin(const char * filename);
void LoadPlugin(const std::string & filename);
void LoadPlugins(const std::vector<std::string> & plugins);
void LoadPlugins(const std::string & plugins_dir, const std::vector<std::string> & plugins);
void UnloadPlugins();
void Call(int message);
@ -167,6 +167,7 @@ private:
Templates * templates;
SessionManager * session_manager;
std::string temp_path;
struct PluginsItem
{

View File

@ -21,8 +21,9 @@ CreateThread::CreateThread()
// returning true if we can create a thread in the current directory
bool CreateThread::HasAccess()
bool CreateThread::HasAccess(bool check_root)
{
if( request->dir_tab.empty() )
return false;
@ -36,7 +37,7 @@ bool CreateThread::HasAccess()
if( !system->mounts.pmount || system->mounts.pmount->type != Mount::thread )
return false;
if( request->session && request->session->puser && request->session->puser->super_user )
if( !check_root && request->session && request->session->puser && request->session->puser->super_user )
// super can create thread regardless of the restrictcreatethread option
return true;
@ -50,6 +51,11 @@ return false;
}
bool CreateThread::HasAccess()
{
return HasAccess(false);
}
bool CreateThread::FunCreateThreadCheckAbuse()
{

View File

@ -23,6 +23,7 @@ class CreateThread : public FunctionBase
public:
CreateThread();
bool HasAccess(bool check_root);
bool HasAccess();
void MakePost();

View File

@ -27,7 +27,7 @@ void CreateTicket::Clear()
}
// returning true if we can create a ticket in the current directory
bool CreateTicket::HasAccess()
bool CreateTicket::HasAccess(bool check_root)
{
if( request->dir_tab.empty() )
return false;
@ -44,7 +44,7 @@ bool CreateTicket::HasAccess()
// checking for par_createticket_on mount option
if( request->session && request->session->puser && request->session->puser->super_user )
if( !check_root && request->session && request->session->puser && request->session->puser->super_user )
// super can create tickets regardless of the createticket_on option
return true;
@ -58,7 +58,10 @@ return false;
}
bool CreateTicket::HasAccess()
{
return HasAccess(false);
}
bool CreateTicket::FunCreateTicketCheckAbuse()
{

View File

@ -24,6 +24,7 @@ public:
CreateTicket();
void Clear();
bool HasAccess(bool check_root);
bool HasAccess();
void MakePost();

View File

@ -1,7 +1,6 @@
[if-one item_is]<h1>{edit}</h1>[else]<h1>{add}</h1>[end]
[include "err_abuse.html"]
[include "error.html"]
<form id="additem" method="post" action="[doc_base_url][dir][if-one item_is][item_url]/[end]ckeditor">
<fieldset>

View File

@ -49,7 +49,7 @@ void signal_term(int)
void print_syntax()
{
std::cout << "Syntax:" << std::endl;
std::cout << " cmslu.fcgi config_file" << std::endl;
std::cout << " winix config_file" << std::endl;
}
@ -93,7 +93,7 @@ int main(int argv, char ** argc)
// load plugins before loading sessions - session_manager.LoadSessions()
// because some of the plugins can init its own sessions dates
plugin.LoadPlugins(app.config.plugin_file);
plugin.LoadPlugins(app.config.plugins_dir, app.config.plugin_file);
if( !app.Init() )
return 1;

View File

@ -350,6 +350,7 @@ line-height: 1.5em;
p.withnext {
margin: 1em 0 0 0;
width: 520px;
}

View File

@ -173,8 +173,7 @@ void thread_tab_last_item_user(Info & i)
void thread_can_create(Info & i)
{
//i.res = request->CanCreateThread(true);
i.res = true; // temporarily
i.res = functions->fun_createthread.HasAccess(true);
}

View File

@ -61,8 +61,7 @@ void ticket_item_print_content(Info & i)
void ticket_can_create(Info & i)
{
//i.res = request->CanCreateTicket(true);
i.res = functions->fun_createticket.HasAccess();
i.res = functions->fun_createticket.HasAccess(true);
}