From: Alexander Meteiko Date: Mon, 10 May 2010 12:59:20 +0000 (+0300) Subject: indexpage_url is added (admin/base.html) X-Git-Tag: 0.5~356 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=e7aecb0700cdeb4b9538f83565fee942fab0f6a0;p=ipf.git indexpage_url is added (admin/base.html) --- diff --git a/ipf/admin/model.php b/ipf/admin/model.php index 5300788..a1aa762 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -372,6 +372,7 @@ class IPF_Admin_Model{ '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); } @@ -422,6 +423,7 @@ class IPF_Admin_Model{ '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); } @@ -444,6 +446,7 @@ class IPF_Admin_Model{ '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); } @@ -568,6 +571,7 @@ class IPF_Admin_Model{ 'search_value' => $this->search_value, 'lapp'=>$lapp, 'lmodel'=>$lmodel, + 'indexpage_url'=>IPF::get('indexpage_url','/'), ); return IPF_Shortcuts::RenderToResponse('admin/items.html', $context, $request); } diff --git a/ipf/admin/templates/admin/base.html b/ipf/admin/templates/admin/base.html index 5116e64..a48e736 100644 --- a/ipf/admin/templates/admin/base.html +++ b/ipf/admin/templates/admin/base.html @@ -20,11 +20,11 @@
- {block breadcrumbs}{/block} + {block breadcrumbs}{/block} {block content}{/block}
diff --git a/ipf/admin/views.php b/ipf/admin/views.php index 103a8af..86fcefb 100644 --- a/ipf/admin/views.php +++ b/ipf/admin/views.php @@ -48,6 +48,7 @@ function IPF_Admin_Views_Index($request, $match){ '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); } @@ -212,7 +213,7 @@ function IPF_Admin_Views_ChangePassword($request, $match){ '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); } @@ -246,6 +247,7 @@ function IPF_Admin_Views_Login($request, $match){ '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); } @@ -255,6 +257,7 @@ function IPF_Admin_Views_Logout($request, $match){ $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); } @@ -267,25 +270,25 @@ function cmp($a, $b){ } 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){ @@ -303,26 +306,26 @@ 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; @@ -331,38 +334,38 @@ function IPF_Admin_Views_FileBrowser($request, $match){ 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); } @@ -370,23 +373,24 @@ function IPF_Admin_Views_FileBrowser($request, $match){ 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); } @@ -394,14 +398,14 @@ function IPF_Admin_Views_FileBrowser($request, $match){ 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); }