Author: ralfbecker
New Revision: 55453
URL: http://svn.stylite.de/viewvc/egroupware?rev=55453&view=rev
Log:
fix PHP Fatal class egw_sharing not found and replaced all api calls with new namespaced classes
Modified:
trunk/filemanager/inc/class.filemanager_ui.inc.php
— trunk/filemanager/inc/class.filemanager_ui.inc.php (original)
+++ trunk/filemanager/inc/class.filemanager_ui.inc.php Mon Mar 21 11:06:54 2016
@@ -10,6 +10,9 @@
+use EGroupware\Api;
+use EGroupware\Api\Vfs;
+
/**
- Filemanage user interface class
*/
@@ -53,13 +56,13 @@
$_GET = etemplate::array_stripslashes($_GET);
}
// do we have root rights
-
static::$merge_prop_namespace = Vfs::DEFAULT_PROP_NAMESPACE.$GLOBALS['egw_info']['flags']['currentapp'];
}
/**
@@ -93,7 +96,7 @@
*/
public static function get_view()
{
@@ -142,7 +145,7 @@
‘caption’ => lang(‘Edit settings’),
‘group’ => $group,
‘allowOnMultiple’ => false,
@@ -210,7 +213,7 @@
}
else
{
@@ -238,15 +241,15 @@
switch($scope)
{
case ‘self’:
-
while($dir = egw_vfs::dirname($currentpath))
-
{
-
$props = egw_vfs::propfind($dir, static::$merge_prop_namespace);
-
while($dir = Vfs::dirname($currentpath))
-
{
-
$props = Vfs::propfind($dir, static::$merge_prop_namespace);
if(!empty($props))
{
// found prop in parent directory
@@ -271,7 +274,7 @@
if (!is_array($content))
{
$content = array(
@@ -293,7 +296,7 @@
‘row_modified’ => ‘mtime’,
‘parent_id’ => ‘dir’,
‘is_parent’ => ‘mime’,
-
'is_parent_value'=> Vfs::DIR_MIME_TYPE,
'favorites' => true,
'placeholder_actions' => array('mkdir','file_drop_mail','file_drop_move','file_drop_copy','file_drop_symlink')
);
@@ -319,19 +322,19 @@
switch($path)
{
case ‘…’:
@@ -341,10 +344,6 @@
}
$view = static::get_view();
-
if (strpos($view,'::') !== false && version_compare(PHP_VERSION,'5.3.0','<'))
-
{
-
$view = explode('::',$view);
-
}
call_user_func($view,$content,$msg);
}
@@ -367,15 +366,15 @@
else
{
// config user & password
-
$is_setup = Api\Session::user_pw_hash($user,$password) === $GLOBALS['egw_info']['server']['config_hash'];
// or vfs root user from setup >> configuration
$is_root = $is_setup || $GLOBALS['egw_info']['server']['vfs_root_user'] &&
in_array($user,preg_split('/, */',$GLOBALS['egw_info']['server']['vfs_root_user'])) &&
$GLOBALS['egw']->auth->authenticate($user, $password, 'text');
}
-
//echo "<p>".__METHOD__."('$user','$password',$is_setup) user_pw_hash(...)='".egw_session::user_pw_hash($user,$password)."', config_hash='{$GLOBALS['egw_info']['server']['config_hash']}' --> returning ".array2string($is_root)."</p>\n";
-
egw_session::appsession('is_setup','filemanager',$is_setup);
-
return egw_session::appsession('is_root','filemanager',egw_vfs::$is_root = $is_root);
-
//echo "<p>".__METHOD__."('$user','$password',$is_setup) user_pw_hash(...)='".Api\Session::user_pw_hash($user,$password)."', config_hash='{$GLOBALS['egw_info']['server']['config_hash']}' --> returning ".array2string($is_root)."</p>\n";
-
Api\Cache::setSession('filemanager', 'is_setup',$is_setup);
-
return Api\Cache::setSession('filemanager', 'is_root',Vfs::$is_root = $is_root);
}
/**
@@ -386,7 +385,7 @@
*/
function listview(array $content=null,$msg=null)
{
@@ -421,11 +420,11 @@
if (isset($content[‘nm’][‘selected’])) unset($content[‘nm’][‘selected’]);
}
unset($content[‘nm’][‘rows’]);
@@ -448,10 +447,10 @@
foreach(isset($content[‘upload’][0]) ? $content[‘upload’] : array($content[‘upload’]) as $upload)
{
// encode chars which special meaning in url/vfs (some like / get removed!)
-
(egw_vfs::is_writable($content['nm']['path']) || egw_vfs::is_writable($to)) &&
-
copy($upload['tmp_name'],egw_vfs::PREFIX.$to))
-
(Vfs::is_writable($content['nm']['path']) || Vfs::is_writable($to)) &&
-
copy($upload['tmp_name'],Vfs::PREFIX.$to))
{
$upload_success[] = $upload['name'];
}
@@ -496,7 +495,7 @@
}
// if initial load is done via GET request (idots template or share.php)
// get_rows cant call app.filemanager.set_readonly, so we need to do that here
-
$content['initial_path_readonly'] = !Vfs::is_writable($content['nm']['path']);
$tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm']));
}
@@ -512,11 +511,11 @@
// check if user specified a valid startpath in his prefs --> use it
if (($path = $GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']) &&
@@ -564,10 +563,10 @@
++$errs;
}
}
-
elseif (!egw_vfs::is_dir($path))
-
{
-
$to = egw_vfs::concat($dir,egw_vfs::basename($path));
-
if ($path != $to && egw_vfs::copy($path,$to))
-
elseif (!Vfs::is_dir($path))
-
{
-
$to = Vfs::concat($dir,Vfs::basename($path));
-
if ($path != $to && Vfs::copy($path,$to))
{
++$files;
}
@@ -579,7 +578,7 @@
else
{
$len = strlen(dirname($path));
@@ -587,11 +586,11 @@
++$errs;
continue;
}
@@ -611,8 +610,8 @@
case ‘move’:
foreach($selected as $path)
{
-
$to = egw_vfs::is_dir($dir) || count($selected) > 1 ? egw_vfs::concat($dir,egw_vfs::basename($path)) : $dir;
-
if ($path != $to && egw_vfs::rename($path,$to))
-
$to = Vfs::is_dir($dir) || count($selected) > 1 ? Vfs::concat($dir,Vfs::basename($path)) : $dir;
-
if ($path != $to && Vfs::rename($path,$to))
{
++$files;
}
@@ -630,8 +629,8 @@
case ‘symlink’: // symlink given files to $dir
foreach((array)$selected as $target)
{
-
$link = egw_vfs::concat($dir, egw_vfs::basename($target));
-
if (!egw_vfs::stat($dir) || ($ok = egw_vfs::mkdir($dir,0,true)))
-
$link = Vfs::concat($dir, Vfs::basename($target));
-
if (!Vfs::stat($dir) || ($ok = Vfs::mkdir($dir,0,true)))
{
if(!$ok)
{
@@ -639,12 +638,12 @@
continue;
}
}
-
if ($target[0] != '/') $target = egw_vfs::concat($dir, $target);
-
if (!egw_vfs::stat($target))
-
{
-
return lang('Link target %1 not found!', egw_vfs::decodePath($target));
-
}
-
if ($target != $link && egw_vfs::symlink($target, $link))
-
if ($target[0] != '/') $target = Vfs::concat($dir, $target);
-
if (!Vfs::stat($target))
-
{
-
return lang('Link target %1 not found!', Vfs::decodePath($target));
-
}
-
if ($target != $link && Vfs::symlink($target, $link))
{
++$files;
}
@@ -655,27 +654,27 @@
}
if (count((array)$selected) == 1)
{
-
return $files ? lang('Symlink to %1 created.', egw_vfs::decodePath($target)) :
-
lang('Error creating symlink to target %1!', egw_vfs::decodePath($target));
-
return $files ? lang('Symlink to %1 created.', Vfs::decodePath($target)) :
-
lang('Error creating symlink to target %1!', Vfs::decodePath($target));
}
$ret = lang('%1 elements linked.', $files);
if ($errs)
{
$ret = lang('%1 errors linking (%2)!',$errs, $ret);
}
-
$dst = egw_vfs::concat($dir, is_array($selected) ? $selected[0] : $selected);
-
if (egw_vfs::mkdir($dst, null, STREAM_MKDIR_RECURSIVE))
-
$dst = Vfs::concat($dir, is_array($selected) ? $selected[0] : $selected);
-
if (Vfs::mkdir($dst, null, STREAM_MKDIR_RECURSIVE))
{
return lang("Directory successfully created.");
}
return lang("Error while creating directory.");
case 'saveaszip':
-
Vfs::download_zip($selected);
-
exit;
default:
list($action, $settings) = explode('_', $action, 2);
@@ -683,7 +682,7 @@
{
case ‘document’:
if (!$settings) $settings = $GLOBALS[‘egw_info’][‘user’][‘preferences’][‘filemanager’][‘default_document’];
-
$document_merge = new filemanager_merge(Vfs::decodePath($dir));
$msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']);
if($msg) return $msg;
$errs = count($selected);
@@ -706,12 +705,12 @@
{
$dirs = $files = $errs = 0;
// we first delete all selected links (and files)
@@ -730,20 +729,20 @@
if (preg_match(’/^/?(home|apps|)/*$/’,$path))
{
$errs++;
-
return lang("Cautiously rejecting to remove folder '%1'!",Vfs::decodePath($path));
}
}
// now we use find to loop through all files and dirs: (selected only contains dirs now)
// - depth=true to get first the files and then the dir containing it
// - hidden=true to also return hidden files (eg. Thumbs.db), as we cant delete non-empty dirs
// - show-deleted=false to not (finally) deleted versioned files
-
foreach(egw_vfs::find($selected,array('depth'=>true,'hidden'=>true,'show-deleted'=>false)) as $path)
-
{
-
if (($is_dir = egw_vfs::is_dir($path) && !egw_vfs::is_link($path)) && egw_vfs::rmdir($path,0))
-
foreach(Vfs::find($selected,array('depth'=>true,'hidden'=>true,'show-deleted'=>false)) as $path)
-
{
-
if (($is_dir = Vfs::is_dir($path) && !Vfs::is_link($path)) && Vfs::rmdir($path,0))
{
++$dirs;
}
@@ -780,7 +779,7 @@
// do NOT store query, if hierarchical data / children are requested
if (!$query[‘csv_export’])
{
@@ -797,11 +796,11 @@
}
}
// be tolerant with (in previous versions) not correct urlencoded pathes
-
if (!Vfs::stat($query['path'],true) || !Vfs::is_dir($query['path']) || !Vfs::check_access($query['path'],Vfs::READABLE))
{
// only redirect, if it would be to some other location, gives redirect-loop otherwise
if ($query['path'] != ($path = static::get_home_dir()))
@@ -810,7 +809,7 @@
// an appropriate message
egw::redirect_link(’/index.php’,array(‘menuaction’=>‘filemanager.filemanager_ui.index’,
‘path’ => $path,
@@ -858,20 +857,20 @@
{
$vfs_options[‘mime’] = $query[‘col_filter’][‘mime’];
}
-
foreach(Vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'],$vfs_options,true) as $path => $row)
{
//echo $path; _debug_array($row);
$dir = dirname($path);
if (!isset($dir_is_writable[$dir]))
{
@@ -887,7 +886,7 @@
}
$all_cfs = in_array(‘customfields’,$cols_to_show) && $cols_to_show[count($cols_to_show)-1][0] != ‘#’;
if ($path2n && (in_array(‘comment’,$cols_to_show) || in_array(‘customfields’,$cols_to_show)) &&
@@ -902,8 +901,8 @@
}
}
// tell client-side if directory is writeable or not
-
$response = egw_json_response::get();
-
$response->call('app.filemanager.set_readonly', $query['path'], !egw_vfs::is_writable($query['path']));
-
$response = Api\Json\Response::get();
-
$response->call('app.filemanager.set_readonly', $query['path'], !Vfs::is_writable($query['path']));
//_debug_array($readonlys);
if ($GLOBALS['egw_info']['flags']['currentapp'] == 'projectmanager')
@@ -916,7 +915,7 @@
$GLOBALS[‘egw_info’][‘flags’][‘css’] .= “\n\t\t\n\t\t”.’’."\n\t\t\n\t\t\t";
}
@@ -938,39 +937,39 @@
if (!($path = str_replace(array(’#’,’?’),array(’%23’,’%3F’),$_GET[‘path’])) || // ?, # need to stay encoded!
// actions enclose pathes containing comma with “
($path[0] == '”’ && substr($path,-1) == ‘"’ && !($path = substr(str_replace(’""’,’"’,$path),1,-1))) ||
@@ -982,7 +981,7 @@
{
$content[‘perms’][$name] = ($content[‘mode’] >> $shift) & $mask;
}
@@ -997,13 +996,13 @@
unset($content[‘sudo’]);
}
// need to check ‘setup’ button (submit button in sudo popup), as some browsers (eg. chrome) also fill the hidden field
-
if ($button == 'sudo' && Vfs::$is_root || $button == 'setup' && $content['sudo']['user'])
{
$msg = $this->sudo($button == 'setup' ? $content['sudo']['user'] : '',$content['sudo']['passwd']) ?
lang('Root access granted.') : ($button == 'setup' && $content['sudo']['user'] ?
lang('Wrong username or password!') : lang('Root access stopped.'));
unset($content['sudo']);
@@ -1014,12 +1013,12 @@
if (isset($content[$name]) && ($old_value != $content[$name] ||
// do not check for modification, if modify_subs is checked!
$content[‘modify_subs’] && in_array($name,array(‘uid’,‘gid’,‘perms’))) &&
-
$to = egw_vfs::concat(egw_vfs::dirname($path),$content['name']);
-
if (file_exists(egw_vfs::PREFIX.$to) && $content['confirm_overwrite'] !== $to)
-
$to = Vfs::concat(Vfs::dirname($path),$content['name']);
-
if (file_exists(Vfs::PREFIX.$to) && $content['confirm_overwrite'] !== $to)
{
$tpl->set_validation_error('name',lang("There's already a file with that name!").'<br />'.
lang('To overwrite the existing file store again.',lang($button)));
@@ -1027,18 +1026,18 @@
if ($button == ‘save’) $button = ‘apply’;
continue;
}
-
$msg .= lang('Renamed %1 to %2.',Vfs::decodePath(basename($path)),Vfs::decodePath(basename($to))).' ';
$content['old']['name'] = $content[$name];
$path = $to;
$content['mime'] = mime_magic::filename2mime($path); // recheck mime type
-
$msg .= lang('Rename of %1 to %2 failed!',egw_vfs::decodePath(basename($path)),egw_vfs::decodePath(basename($to))).' ';
-
if (egw_vfs::deny_script($to))
-
$msg .= lang('Rename of %1 to %2 failed!',Vfs::decodePath(basename($path)),Vfs::decodePath(basename($to))).' ';
-
if (Vfs::deny_script($to))
{
$msg .= lang('You are NOT allowed to upload a script!').' ';
}
@@ -1057,7 +1056,7 @@
‘val’ => (!empty($content[$name]) ? $content[$name] : null),
),
);
@@ -1076,12 +1075,12 @@
{
if ($name == ‘perms’)
{
-
$changed = egw_vfs::find($path,array('type'=>'d'),$cmd,array($value));
-
$changed += egw_vfs::find($path,array('type'=>'f'),$cmd,array($value & 0666)); // no execute for files
-
$changed = Vfs::find($path,array('type'=>'d'),$cmd,array($value));
-
$changed += Vfs::find($path,array('type'=>'f'),$cmd,array($value & 0666)); // no execute for files
}
else
{
@@ -1120,7 +1119,7 @@
}
if ($props)
{
@@ -1140,7 +1139,7 @@
{
list($ino_owner) = each($content[‘eacl’][‘delete’]);
list(, $owner) = explode(’-’,$ino_owner,2); // $owner is a group and starts with a minus!
@@ -1150,7 +1149,7 @@
}
else
{
@@ -1158,18 +1157,18 @@
egw_framework::refresh_opener($msg, ‘filemanager’, $refresh_path ? $refresh_path : $path, ‘edit’, null, ‘&path=[^&]*’);
if ($button == ‘save’) egw_framework::window_close();
}
-
Vfs::parse_url(Vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs')) // no uid, gid or perms in oldvfs
{
if (!$content['gid']) $content['ro_gid_root'] = 'root';
foreach($content['perms'] as $name => $value)
@@ -1177,18 +1176,18 @@
$readonlys[‘perms[’.$name.’]’] = true;
}
}
-
$readonlys['name'] = $path == '/' || !Vfs::is_writable(Vfs::dirname($path));
-
$readonlys['comment'] = !Vfs::is_writable($path);
$readonlys['tabs']['filemanager.file.preview'] = $readonlys['tabs']['filemanager.file.perms'] = $content['is_link'];
// if neither owner nor is writable --> disable save&apply
-
$readonlys['button[save]'] = $readonlys['button[apply]'] = !$content['is_owner'] && !Vfs::is_writable($path);
-
-
if (!($cfs = Api\Storage\Customfields::get('filemanager')))
{
$readonlys['tabs']['custom'] = true;
}
@@ -1204,12 +1203,12 @@
5 => lang(‘Display of content’),
0 => lang(‘No access’),
);
-
$eacl['path'] = rtrim(Vfs::parse_url($eacl['path'],PHP_URL_PATH),'/');
$readonlys['delete['.$eacl['ino'].'-'.$eacl['owner'].']'] = $eacl['ino'] != $content['ino'] ||
$eacl['path'] != $content['path'] || !$content['is_owner'];
}
@@ -1243,7 +1242,7 @@
$content[‘mergeapp_effective’] = null;
}
// mergeapp select options
@@ -1268,7 +1267,7 @@
$preserve[‘old’][’#’.$name] = (string)$content[’#’.$name];
}
}
-
if (Vfs::$is_root)
{
$tpl->setElementAttribute('sudouser', 'label', 'Logout');
$tpl->setElementAttribute('sudouser', 'help','Log out as superuser');
@@ -1282,7 +1281,7 @@
$tpl->setElementAttribute(‘sudouser’, ‘help’,‘Enter setup user and password to get root rights’);
$tpl->setElementAttribute(‘sudouser’, ‘onclick’,‘app.filemanager.set_sudoButton(widget,“logout”)’);
}
-
if (($extra_tabs = Vfs::getExtraInfo($path,$content)))
{
// add to existing tabs in template
$tpl->setElementAttribute('tabs', 'add_tabs', true);
@@ -1311,7 +1310,7 @@
}
}
egw_framework::window_focus();
-
$GLOBALS['egw_info']['flags']['app_header'] = lang('Preferences').' '.Vfs::decodePath($path);
$tpl->exec('filemanager.filemanager_ui.file',$content,$sel_options,$readonlys,$preserve,2);
}
@@ -1327,11 +1326,11 @@
public static function ajax_action($action, $selected, $dir=null, $props=null)
{
// do we have root rights, need to run here too, as method is static and therefore does NOT run __construct
-
if (egw_session::appsession('is_root','filemanager'))
-
{
-
egw_vfs::$is_root = true;
-
}
-
$response = egw_json_response::get();
-
if (Api\Cache::getSession('filemanager', 'is_root'))
-
{
-
Vfs::$is_root = true;
-
}
-
$response = Api\Json\Response::get();
$arr = array(
'msg' => '',
@@ -1349,9 +1348,9 @@
$script_error = 0;
foreach($selected as $tmp_name => &$data)
{
-
$path = egw_vfs::concat($dir, egw_vfs::encodePathComponent($data['name']));
-
-
if(egw_vfs::deny_script($path))
-
$path = Vfs::concat($dir, Vfs::encodePathComponent($data['name']));
-
-
if(Vfs::deny_script($path))
{
if (!isset($script_error))
{
@@ -1361,11 +1360,11 @@
++$arr[‘errs’];
unset($selected[$tmp_name]);
}
@@ -1380,7 +1379,7 @@
$tmp_path = ini_get(‘upload_tmp_dir’).’/’.basename($tmp_name);
}
-
if (Vfs::copy_uploaded($tmp_path, $path, $props, false))
{
++$arr['files'];
$uploaded[] = $data['name'];
@@ -1408,16 +1407,16 @@
case ‘link’:
// First upload
$arr = static::ajax_action(‘upload’, $selected, $dir, $props);
-
$app_dir = Api\Link::vfs_path($props['entry']['app'],$props['entry']['id'],'',true);
foreach($arr['uploaded'] as $file)
{
-
$target=egw_vfs::concat($dir,egw_vfs::encodePathComponent($file['name']));
-
if (egw_vfs::file_exists($target) && $app_dir)
-
{
-
if (!egw_vfs::file_exists($app_dir)) egw_vfs::mkdir($app_dir);
-
$target=Vfs::concat($dir,Vfs::encodePathComponent($file['name']));
-
if (Vfs::file_exists($target) && $app_dir)
-
{
-
if (!Vfs::file_exists($app_dir)) Vfs::mkdir($app_dir);
error_log("Symlinking $target to $app_dir");
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs