winix/functions/reload.cpp

70 lines
1.0 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2014, Tomasz Sowa
* All rights reserved.
*
*/
#include "reload.h"
#include "templates/templates.h"
namespace Winix
{
namespace Fun
{
Reload::Reload()
{
fun.url = L"reload";
fun.privileges = 07000;
}
bool Reload::HasAccess()
{
return cur->session->puser && cur->session->puser->super_user;
}
void Reload::FunReloadTemplates()
{
log << log1 << "Content: reloading html templates" << logend;
templates->ReadTemplates();
// reload notify after templates (notify uses locales from templates)
system->notify.ReadTemplates();
}
void Reload::MakeGet()
{
// !! temporarily only an admin has access
if( !cur->session->puser || !cur->session->puser->super_user )
{
log << log1 << "Content: Only an admin has access to reload function" << logend;
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
return;
}
if( cur->request->IsParam(L"templates") )
FunReloadTemplates();
}
} // namespace
} // namespace Winix