'perms'=>$this->getPerms($request),
'lmodel'=>$lmodel,
'admin_title' => IPF::get('admin_title'),
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse($this->_getAddTemplate(), $context, $request);
}
'perms'=>$this->getPerms($request),
'lmodel'=>$lmodel,
'admin_title' => IPF::get('admin_title'),
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse($this->_getChangeTemplate(), $context, $request);
}
'affected'=>array(),
'ipf_referrer'=>@$request->GET['ipf_referrer'],
'admin_title' => IPF::get('admin_title'),
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse('admin/delete.html', $context, $request);
}
'search_value' => $this->search_value,
'lapp'=>$lapp,
'lmodel'=>$lmodel,
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse('admin/items.html', $context, $request);
}
'app_list' => $app_list,
'admin_log' => $admin_log,
'admin_title' => IPF::get('admin_title'),
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse('admin/index.html', $context, $request);
}
'lapp'=>$lapp,
'lmodel'=>$lmodel,
'admin_title' => IPF::get('admin_title'),
-
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse('admin/changepassword.html', $context, $request);
}
'page_title' => IPF::get('admin_title'),
'form' => $form,
'admin_title' => IPF::get('admin_title'),
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse('admin/login.html', $context, $request);
}
$context = array(
'page_title' => IPF::get('admin_title'),
'admin_title' => IPF::get('admin_title'),
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse('admin/logout.html', $context, $request);
}
}
function dir_recursive($dir, $path=DIRECTORY_SEPARATOR, $level=''){
- $dirtree = array();
- if ($level=='')
- $dirtree[] = array('path'=>'', 'name'=>'Root Folder');
- $dd = array();
+ $dirtree = array();
+ if ($level=='')
+ $dirtree[] = array('path'=>'', 'name'=>'Root Folder');
+ $dd = array();
if ($dh = @opendir($dir)) {
while (($file = readdir($dh)) !== false) {
- if (($file=='.') || ($file=='..')) continue;
- if (filetype($dir . $file)=='dir')
- $dd[] = $file;
+ if (($file=='.') || ($file=='..')) continue;
+ if (filetype($dir . $file)=='dir')
+ $dd[] = $file;
}
- closedir($dh);
- sort($dd);
- foreach($dd as $file){
- $dirtree[] = array('path'=>$path.$file, 'name'=>$level.$file);
- $dirtree = array_merge($dirtree, dir_recursive($dir.$file.DIRECTORY_SEPARATOR, $path.$file.DIRECTORY_SEPARATOR, $level.'--'));
- }
+ closedir($dh);
+ sort($dd);
+ foreach($dd as $file){
+ $dirtree[] = array('path'=>$path.$file, 'name'=>$level.$file);
+ $dirtree = array_merge($dirtree, dir_recursive($dir.$file.DIRECTORY_SEPARATOR, $path.$file.DIRECTORY_SEPARATOR, $level.'--'));
+ }
}
return $dirtree;
- //print_r($dirtree);
+ //print_r($dirtree);
}
function IPF_Admin_Views_FileBrowser($request, $match){
$dir = $upload_path.$curr_dir;
if ($request->method=="GET"){
- if (@$request->GET['delete']){
- $del = $dir.$request->GET['delete'];
- @IPF_Utils::removeDirectories($del);
- }
+ if (@$request->GET['delete']){
+ $del = $dir.$request->GET['delete'];
+ @IPF_Utils::removeDirectories($del);
+ }
}
if ($request->method=="POST"){
- if (@$request->POST['new_folder']!='')
- @mkdir($dir.$request->POST['new_folder']);
-
- if (@$request->POST['new_name']!='')
- @rename($dir.$request->POST['old_name'], $dir.$request->POST['new_name']);
-
- if (@$request->POST['action']=='move'){
- @rename($dir.$request->POST['old_name'], $upload_path.$request->POST['move'].DIRECTORY_SEPARATOR.$request->POST['old_name']);
- }
- if (@$_FILES['file']){
- $uploadfile = $dir . basename($_FILES['file']['name']);
- @move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);
- }
+ if (@$request->POST['new_folder']!='')
+ @mkdir($dir.$request->POST['new_folder']);
+
+ if (@$request->POST['new_name']!='')
+ @rename($dir.$request->POST['old_name'], $dir.$request->POST['new_name']);
+
+ if (@$request->POST['action']=='move'){
+ @rename($dir.$request->POST['old_name'], $upload_path.$request->POST['move'].DIRECTORY_SEPARATOR.$request->POST['old_name']);
+ }
+ if (@$_FILES['file']){
+ $uploadfile = $dir . basename($_FILES['file']['name']);
+ @move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile);
+ }
}
$id = 1;
if ($dh = @opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file=='.')
- continue;
- if (($curr_dir=='') && ($file=='..'))
- continue;
- if (filetype($dir . $file)=='dir'){
- $dirs[] = array('id'=>$id, 'name'=>$file);
- $id++;
- }
- else{
-
- $sx = getimagesize($dir.$file);
- if ($sx){
- $image = '1';
- $type = str_replace('image/','',$sx['mime']).' '.$sx[0].'x'.$sx[1];
- if ($sx[0]<=200){
- $zw = $sx[0];
- $zh = $sx[1];
- }
- else {
- $zw = 200;
- $prop = (float)$sx[1] / (float)$sx[0];
- $zh = (int)(200.0 * $prop);
- }
- }
- else {
- $image = '0';
- $type = 'binary';
- $zw = 200;
- $zh = 150;
- }
- $files[] = array('id'=>$id, 'name'=>$file, 'image'=>$image, 'type'=>$type, 'zw'=>$zw, 'zh'=>$zh, 'size'=>filesize($dir . $file));
- $id++;
- }
+ continue;
+ if (($curr_dir=='') && ($file=='..'))
+ continue;
+ if (filetype($dir . $file)=='dir'){
+ $dirs[] = array('id'=>$id, 'name'=>$file);
+ $id++;
+ }
+ else{
+
+ $sx = getimagesize($dir.$file);
+ if ($sx){
+ $image = '1';
+ $type = str_replace('image/','',$sx['mime']).' '.$sx[0].'x'.$sx[1];
+ if ($sx[0]<=200){
+ $zw = $sx[0];
+ $zh = $sx[1];
+ }
+ else {
+ $zw = 200;
+ $prop = (float)$sx[1] / (float)$sx[0];
+ $zh = (int)(200.0 * $prop);
+ }
+ }
+ else {
+ $image = '0';
+ $type = 'binary';
+ $zw = 200;
+ $zh = 150;
+ }
+ $files[] = array('id'=>$id, 'name'=>$file, 'image'=>$image, 'type'=>$type, 'zw'=>$zw, 'zh'=>$zh, 'size'=>filesize($dir . $file));
+ $id++;
+ }
}
closedir($dh);
}
usort(&$files, 'cmp');
$dirtree = dir_recursive($upload_path);
-
+
$pth = explode(DIRECTORY_SEPARATOR,$curr_dir);
$path = array();
$cd = '/admin/filebrowser/';
foreach($pth as $p){
- $cd.=$p.DIRECTORY_SEPARATOR;
- $path[] = array('cd'=>$cd, 'name'=>$p);
+ $cd.=$p.DIRECTORY_SEPARATOR;
+ $path[] = array('cd'=>$cd, 'name'=>$p);
}
$context = array(
'page_title' => __('File Browser'),
'dirtree' => $dirtree,
'dirs' => $dirs,
- 'files' => $files,
- 'path' => $path,
+ 'files' => $files,
+ 'path' => $path,
'upload_url' => $upload_url,
- 'curr_dir' => $curr_dir,
+ 'curr_dir' => $curr_dir,
+ 'indexpage_url'=>IPF::get('indexpage_url','/'),
);
return IPF_Shortcuts::RenderToResponse('admin/filebrowser.html', $context, $request);
}
function IPF_Admin_Views_FileBrowserRename($request, $match){
$ca = IPF_Admin_App::checkAdminAuth($request);
if ($ca!==true) return $ca;
-
+
$old_name = @$request->POST['old_value'];
- $name = @$request->POST['value'];
- $curr_dir = @$request->POST['curr_dir'];
- if ($name=='')
+ $name = @$request->POST['value'];
+ $curr_dir = @$request->POST['curr_dir'];
+ if ($name=='')
$name==$old_name;
else
- $name = $name;
+ $name = $name;
return new IPF_HTTP_Response($name);
}