[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] filemanager/inc hook_admin.inc.php, 1.6 class.uifilem
From: |
ceb |
Subject: |
[Phpgroupware-cvs] filemanager/inc hook_admin.inc.php, 1.6 class.uifilemanager.inc.php, 1.30 class.bofilemanager.inc.php, 1.22 |
Date: |
Sat, 9 Apr 2005 02:19:00 +0200 |
Update of filemanager/inc
Modified Files:
Branch: MAIN
hook_admin.inc.php lines: +2 -2
class.uifilemanager.inc.php lines: +74 -24
class.bofilemanager.inc.php lines: +62 -8
Log Message:
update
====================================================
Index: filemanager/inc/hook_admin.inc.php
diff -u filemanager/inc/hook_admin.inc.php:1.5
filemanager/inc/hook_admin.inc.php:1.6
--- filemanager/inc/hook_admin.inc.php:1.5 Sun Jan 23 21:33:14 2005
+++ filemanager/inc/hook_admin.inc.php Sat Apr 9 00:19:32 2005
@@ -14,7 +14,7 @@
// Only Modify the $file and $title variables.....
$file = Array
(
- 'edit quota' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.admin')
+ 'site configuration' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.admin')
);
//Do not modify below this line
display_section($appname,$appname,$file);
====================================================
Index: filemanager/inc/class.uifilemanager.inc.php
diff -u filemanager/inc/class.uifilemanager.inc.php:1.29
filemanager/inc/class.uifilemanager.inc.php:1.30
--- filemanager/inc/class.uifilemanager.inc.php:1.29 Sun Feb 20 17:09:49 2005
+++ filemanager/inc/class.uifilemanager.inc.php Sat Apr 9 00:19:32 2005
@@ -522,15 +522,19 @@
//_debug_array($this->bofilemanager->settings);
+ $link_data = array
+ (
+ 'menuaction' =>
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
+ 'path' =>
$this->bofilemanager->path
+ );
+
foreach($this->bofilemanager->file_attributes as
$attribute => $translation)
{
if ($this->bofilemanager->settings[$attribute])
{
+ $link_data['sortby'] = $attribute;
$file_attributes[] = array('widget'=>
array('type' => 'link','caption' => lang($attribute),
-
'href' =>
$GLOBALS['phpgw']->link('/index.php', array(
-
'menuaction' =>
$this->bofilemanager->appname.'.ui'.$this->bofilemanager->appname.'.index',
-
'path'=>$this->bofilemanager->path,
-
'sortby' => $attribute))),
+
'href' =>
$GLOBALS['phpgw']->link('/index.php',$link_data)),
'help' => array('widget' => array('type' => 'help','onClick'
=> $this->bofilemanager->build_help($attribute))));
}
}
@@ -581,9 +585,8 @@
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,$file_icon)));
if ($file['mime_type']=='Directory')
{
-
$href = $GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
$this->bofilemanager->appname.'.ui'.
-
$this->bofilemanager->appname.'.index',
-
'path'
=> $this->bofilemanager->path . $this->bofilemanager->dispsep . $file['name']));
+
$link_data['path'] = $this->bofilemanager->path .
$this->bofilemanager->dispsep . $file['name'];
+
$href = $GLOBALS['phpgw']->link('/index.php',$link_data);
}
else
{
@@ -598,11 +601,11 @@
'href' => $href,'onClick' => $onClick));
if($mime_parts[0] == 'text')
{
-
$href['menuaction'] =
$this->bofilemanager->appname.'.uiaction_edit.edit';
-
$href['edit_file'] = urlencode($file['name']);
+
$link_data['menuaction'] =
$this->bofilemanager->appname.'.uiaction_edit.edit';
+
$link_data['edit_file'] = urlencode($file['name']);
$file_output[$i]['name']['edit'] = array('widget' => array( 'type' =>
'image',
'src' =>
$GLOBALS['phpgw']->common->image($this->bofilemanager->appname,'pencil'),
-
'link' =>
$GLOBALS['phpgw']->link('/index.php', $href)));
+
'link' =>
$GLOBALS['phpgw']->link('/index.php',$link_data)));
}
}
break;
@@ -1015,27 +1018,46 @@
function admin()
{
- $val = $_POST['set_quota'];
-
+ $val = $_POST['set_quota'];
+ $values = $_POST['values'];
$config = CreateObject('phpgwapi.config','filemanager');
$config->read_repository();
// Check if the Values match the following pattern
0,1,10,unlimited
- if (empty($val) || ereg("^[ 0-9]+(,[ 0-9]+)*$",$val))
+
+ if ($_POST['save'])
{
- if ($_POST['save'])
+ if (empty($val) || ereg("^[ 0-9]+(,[
0-9]+)*$",$val))
{
$config->value('set_quota', '0,' . $val
. ',unlimited');
- $config->save_repository();
+ }
+ else
+ {
+ $error[] = lang('erroneous input! check
quota value!');
+ }
+
+ if ($values['script_path'])
+ {
+ $doc_root =
get_var('DOCUMENT_ROOT',Array('GLOBAL','SERVER'));
+ if
(substr($values['script_path'],0,strlen($doc_root)) == $doc_root)
+ {
+ $error[] = lang('the directory
to store additional action scripts must be outside of the webservers
documentroot');
+ }
+ else
+ {
+
$config->value('script_path',$values['script_path']);
+ }
+ }
+
$config->value('check_files',$values['check_files']);
+
$config->value('check_interval',$values['check_interval']);
+ $config->save_repository();
+
+ if(!is_array($error))
+ {
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
}
}
- else
- {
- $error = lang('erroneous input! check quota
value!');
- }
-
- if ($_POST['cancel'])
+ elseif($_POST['cancel'])
{
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
}
@@ -1085,7 +1107,7 @@
}
$sstr = '0,';
- $estr .= ', ' . lang('unlimited');
+ $estr .= ',' . lang('unlimited');
$data = array();
$table_head = array('table_col' => array('colspan' =>
'2','align' => 'left','widget' => array('type' => 'label','caption' =>
lang('edit quota'))));
@@ -1095,11 +1117,39 @@
$var[] = array('widget' => array('type' =>
'text','name' => 'set_quota','value' => $str,'caption_start' => $sstr,'caption'
=> $estr));
$table_rows[] = array('table_col' => $var);
+ $var = array();
+ $var[] = array('class' => 'th','colspan' =>
'2','widget' => array('type' => 'label','caption' => lang('user menu action
scripts')));
+ $table_rows[] = array('table_col' => $var);
+
+ $var = array();
+ $var[] = array('widget' => array('type' =>
'label','caption' => lang('absolute path to directory for storing additional
action scripts')));
+ $var[] = array('widget' => array('type' =>
'text','name' => 'values[script_path]','value' => $items['script_path']));
+ $table_rows[] = array('table_col' => $var);
+
+ $var = array();
+ $var[] = array('class' => 'th','colspan' =>
'2','widget' => array('type' => 'label','caption' => lang('periodically check
for new files')));
+ $table_rows[] = array('table_col' => $var);
+
+ $var = array();
+ $var[] = array('widget' => array('type' =>
'label','caption' => lang('enable periodically check for new files')));
+ $var[] = array('widget' => array('type' =>
'checkbox','name' => 'values[check_files]','value' => 'True', 'checked' =>
($items['check_files']?True:False)));
+ $table_rows[] = array('table_col' => $var);
+
+ $var = array();
+ $var[] = array('widget' => array('type' =>
'label','caption' => lang('interval')));
+ $var[] = array('widget' => array('type' =>
'text','name' => 'values[check_interval]','value' =>
$items['check_interval'],'size' => 3,'caption' => lang('minutes')));
+ $table_rows[] = array('table_col' => $var);
+
$table_footer = array('table_col' =>
$this->display_buttons());
+ if(is_array($error))
+ {
+ $errormsg = explode('<br />',$error);
+ }
+
$data = array
(
- 'error' => $error,
+ 'error' => $errormsg,
'action_url' =>
$GLOBALS['phpgw']->link('/index.php','menuaction=filemanager.uifilemanager.admin'),
'table' => array('width' =>
'50%','table_head' => $table_head ,'table_row' => $table_rows,'table_footer' =>
$table_footer)
);
====================================================
Index: filemanager/inc/class.bofilemanager.inc.php
diff -u filemanager/inc/class.bofilemanager.inc.php:1.21
filemanager/inc/class.bofilemanager.inc.php:1.22
--- filemanager/inc/class.bofilemanager.inc.php:1.21 Sat Feb 12 01:07:35 2005
+++ filemanager/inc/class.bofilemanager.inc.php Sat Apr 9 00:19:32 2005
@@ -15,7 +15,7 @@
class bofilemanager
{
var $access_add = False;
- var $rootdir;
+ var $basedir;
var $fakebase;
var $appname;
var $settings;
@@ -104,14 +104,14 @@
//_debug_array($this->fileman);
- $this->rootdir = $GLOBALS['phpgw']->vfs->basedir;
+ $this->basedir = $GLOBALS['phpgw']->vfs->basedir;
$this->fakebase = $GLOBALS['phpgw']->vfs->fakebase;
$this->appname =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->settings =
$GLOBALS['phpgw_info']['user']['preferences'][$this->appname];
- if(stristr($this->rootdir,PHPGW_SERVER_ROOT))
+ if(stristr($this->basedir,PHPGW_SERVER_ROOT))
{
- $this->filesdir =
substr($this->rootdir,strlen(PHPGW_SERVER_ROOT));
+ $this->filesdir =
substr($this->basedir,strlen(PHPGW_SERVER_ROOT));
}
else
{
@@ -1175,9 +1175,63 @@
srand((double)microtime() * 1000000);
if($this->params['update'] || rand(0,19) == 4)
{
- $GLOBALS['phpgw']->vfs->update_real(array(
- 'string' => $this->bofilemanager->path,
- 'relatives' =>Array(RELATIVE_NONE)));
+ $dir_files = $this->get_dirfiles();
+ $sql_files = $this->get_sqlfiles();
+ $this->sync_files($dir_files,$sql_files);
+
$GLOBALS['phpgw']->vfs->update_real(array('string' => $this->path,'relatives'
=> array(RELATIVE_NONE)));
+ }
+ }
+
+ function get_dirfiles()
+ {
+ $basedir = $this->basedir . $this->path;
+ $dir = opendir($basedir);
+
+ $files = array();
+ $i = 0;
+ while ($file = readdir($dir))
+ {
+ if ($file != '.' && $file != '..')
+ {
+ $files[$i] = $file;
+ ++$i;
+ }
+ }
+ return $files;
+ }
+
+ function get_sqlfiles()
+ {
+ $ls_array = $GLOBALS['phpgw']->vfs->ls(array(
+ 'string' => $this->path,
+ 'relatives' => array
(RELATIVE_NONE),
+ 'checksubdirs' => False,
+ 'nofiles' => False));
+
+ $files = array();
+ if(is_array($ls_array))
+ {
+ $i = 0;
+ foreach($ls_array as $key => $file)
+ {
+ $files[$i] = $file['name'];
+ ++$i;
+ }
+ }
+ return $files;
+ }
+
+ function sync_files($dir_files,$sql_files)
+ {
+ if (is_array($sql_files))
+ {
+ $array_difference =
array_diff($sql_files,$dir_files);
+ sort($array_difference);
+ for($i=0;$i<count($array_difference);++$i)
+ {
+ //echo $array_difference[$i];
+
@$GLOBALS['phpgw']->vfs->delete(array('string' => $array_difference[$i]));
+ }
}
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] filemanager/inc hook_admin.inc.php, 1.6 class.uifilemanager.inc.php, 1.30 class.bofilemanager.inc.php, 1.22,
ceb <=