True,
'update_quota' => True,
'load_quota' => True,
'quota' => True,
'removeFolder' => True,
'folders' => True
);
function vfs_functions(){
}
function folders(){
$GLOBALS['phpgw_info']['flags'] = array
(
'currentapp' => 'filemanager',
'noheader' => False,
'nonavbar' => False,
'nofooter' => False,
'noappheader' => False,
'enable_browser_class' => True
);
$GLOBALS['phpgw']->common->phpgw_header();
include('load_lang.php');
echo "";
echo "";
echo "";
$t = $GLOBALS['phpgw']->template;
$t->set_file(array('config_list' => 'config_folders.tpl'));
$t->set_block('config_list','body','body');
$vars[lang_directory]=lang('directory');
$vars[lang_search]=lang('search');
$vars[lang_remove]=lang('remove');
$t->set_var($vars);
$t->pparse('out','body');
$GLOBALS['phpgw']->common->phpgw_footer();
$GLOBALS['phpgw']->common->phpgw_exit();
}
function removeFolder(){
$GLOBALS['phpgw_info']['flags'] = array
(
'currentapp' => 'filemanager',
'noheader' => True,
'nonavbar' => True,
'nofooter' => True,
'noappheader' => True,
'enable_browser_class' => True
);
$bo = CreateObject('filemanager.bofilemanager');
$name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir']));
if (strlen($name) < 2)
return false;
$bo->vfs->delete(array(
'string' => $name,
'relatives' => array(RELATIVE_NONE)
));
/* Clean the log */
$GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs WHERE directory = \''.$name.'\'',__LINE__,__FILE__);
if ($GLOBALS['phpgw']->db->Error)
echo "Erro";
else
{
$GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs_quota WHERE directory = \''.$name.'\'',__LINE__,__FILE__);
if (!$GLOBALS['phpgw']->db->Error)
echo lang('directory removed sucessfully');
else
echo "Erro";
}
return;
}
function quota(){
$GLOBALS['phpgw_info']['flags'] = array
(
'currentapp' => 'filemanager',
'noheader' => False,
'nonavbar' => False,
'nofooter' => False,
'noappheader' => False,
'enable_browser_class' => True
);
$GLOBALS['phpgw']->common->phpgw_header();
include('load_lang.php');
echo "";
echo "";
echo "";
$t = $GLOBALS['phpgw']->template;
$t->set_file(array('config_list' => 'config_quota.tpl'));
$t->set_block('config_list','body','body');
$vars[lang_directory]=lang('directory');
$vars[lang_search]=lang('search');
$vars[lang_save]=lang('save');
$t->set_var($vars);
$t->pparse('out','body');
$GLOBALS['phpgw']->common->phpgw_footer();
$GLOBALS['phpgw']->common->phpgw_exit();
}
function search_dir(){
$GLOBALS['phpgw_info']['flags'] = array
(
'currentapp' => 'filemanager',
'noheader' => True,
'nonavbar' => True,
'nofooter' => True,
'noappheader' => True,
'enable_browser_class' => True
);
$name = $GLOBALS['phpgw']->db->db_addslashes($_GET['name']);
$GLOBALS['phpgw']->db->query('SELECT DISTINCT directory FROM phpgw_vfs WHERE directory like \'%'.$name.'%\' LIMIT 20',__LINE__,__FILE__);
while ($GLOBALS['phpgw']->db->next_record()){
$val = $GLOBALS['phpgw']->db->row();
echo "";
}
}
function update_quota(){
$GLOBALS['phpgw_info']['flags'] = array
(
'currentapp' => 'filemanager',
'noheader' => True,
'nonavbar' => True,
'nofooter' => True,
'noappheader' => True,
'enable_browser_class' => True
);
$name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['dir']));
$size = ($_GET['val'])*1;
/* See if quota exists or not */
$query = "SELECT count(directory) FROM phpgw_vfs_quota WHERE directory = '".$name."' LIMIT 1";
if ($GLOBALS['phpgw']->db->query($query) && $GLOBALS['phpgw']->db->next_record())
$val = $GLOBALS['phpgw']->db->row();
else
{
echo $GLOBALS['phpgw']->db->error;
return false;
}
if ($val['count'] == '1')
{
$GLOBALS['phpgw']->db->query('UPDATE phpgw_vfs_quota SET quota_size = '.$size.' WHERE directory = \''.$name.'\'',__LINE__,__FILE__);
if ($GLOBALS['phpgw']->db->Error)
echo "Erro";
else
echo lang('entry updated sucessfully');
}
else
{
/*preferences does not exist*/
$query = "INSERT INTO phpgw_vfs_quota values ('".$name."',".$size.")";
if (!$GLOBALS['phpgw']->db->query($query))
echo $GLOBALS['phpgw']->db->error;
else
echo lang('entry updated sucessfully');
}
return;
}
function load_quota(){
$GLOBALS['phpgw_info']['flags'] = array
(
'currentapp' => 'filemanager',
'noheader' => True,
'nonavbar' => True,
'nofooter' => True,
'noappheader' => True,
'enable_browser_class' => True
);
$name = $GLOBALS['phpgw']->db->db_addslashes(base64_decode($_GET['name']));
$GLOBALS['phpgw']->db->query('SELECT quota_size FROM phpgw_vfs_quota WHERE directory = \''.$name.'\' LIMIT 1',__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
$val =$GLOBALS['phpgw']->db->row();
echo $val['quota_size'];
return;
}
}
?>