Ejemplo n.º 1
0
 function edit_action() {
 	chkpw('template_edit');
     if (front::post('submit')) {
         unset(front::$post['submit']);
         help::$_var[config::get('template_dir') .'_template_note'] = front::$post;
         help::save();
     }
     $dir = ROOT .'/template/'.config::get('template_dir');
     $_dir = dir($dir);
     while ($file = $_dir->read()) {
         if (!preg_match('/^\./',$file) &&is_dir($dir .'/'.$file) &&!preg_match('/[#@]/',$file)  &&!preg_match('/^_/',$file)) {
             $this->view->tps[$file] = '<b>'.$file .'</b>';
             $__dir = dir($dir .'/'.$file);
             while ($_file = $__dir->read()) {
                 if (!preg_match('/^\./',$_file)) {
                     if ($file=='skin'&&!preg_match('/\.(css|js)$/',$_file))
                         continue;
                     $_file = str_replace('.','_',$_file);
                     if (is_dir($dir .'/'.$file .'/'.$_file)){
                         $this->view->tps[$file .'/'.$_file] = "&nbsp;&nbsp;└<b>".$_file .'</b>';
                     }else{
                         $this->view->tps[$file .'/'.$_file] = "&nbsp;&nbsp;└".$_file;
                     }
                 }
             }
         }elseif (!preg_match('/^\./',$file) &&is_file($dir .'/'.$file)) {
             $file = str_replace('.','_',$file);
             $tps[$file] = $file;
         }
     }
     //$this->view->tps = array_merge($tps,$this->view->tps);
     $tps_arr = array_merge($tps,$this->view->tps);
     //分页
     /*$limit = 20;
     if(!front::get('page'))
         $page = 1;
     else
         $page = front::get('page');
     $total = ceil(count($tps_arr)/$limit);
     if($page < 1) $page = 1;
     if($page > $total) $page = $total;
     $start = ($page-1) * $limit;
     $end = $start+$limit-1;
     $tmp = range($start,$end);
     $list_tps_arr = array();
     $i = 0;
     foreach($tps_arr as $k => $v){
     	if(in_array($i++,$tmp)){
     	    $list_tps_arr[$k] = $v;
             }
     }*/
     $this->view->tps = $tps_arr;
     //$this->view->link_str = listPage($total,$limit,$page);
 }