Ejemplo n.º 1
0
 public function user()
 {
     $role_list = array_column_5(D('Role')->select(), 'name', 'id');
     $this->assign('user_can_regist', get_opinion('user_can_regist', true, 1));
     $this->assign('new_user_role', gen_opinion_list($role_list, get_opinion('new_user_role', true, 5)));
     $this->display();
 }
Ejemplo n.º 2
0
 /**
  * 获取当前主题的模板列表
  * @return array
  */
 public function getTplList()
 {
     if (S("post_tpl")) {
         return S("post_tpl");
     }
     $tpl_static_path = WEB_ROOT . 'Public/' . get_kv('home_theme') . '/';
     if (file_exists($tpl_static_path . 'theme.xml')) {
         $theme = simplexml_load_file($tpl_static_path . '/theme.xml');
         $tpl_type = object_to_array($theme->post);
         $tpl_type_list = array_column_5($tpl_type, 'name', 'tpl');
     } else {
         $tpl_type_list = get_opinion('post_tpl');
     }
     S("post_tpl", $tpl_type_list, 600);
     return $tpl_type_list;
 }
Ejemplo n.º 3
0
 public function getThemeInstalledNameList()
 {
     $this->theme_installed = array_keys(array_column_5($this->theme_list_installed, 'theme_name', 'theme_name'));
     return $this->theme_installed;
 }
Ejemplo n.º 4
0
 /**
  * 编辑链接
  * @param $id
  */
 public function editlink($id)
 {
     if (IS_POST) {
         $data = I('post.');
         if ($_FILES['img']['size'] != 0) {
             $config = array("savePath" => 'Links/', "maxSize" => 1000000, "exts" => array('jpg', 'bmp', 'png', 'jpeg'), "subName" => array('date', 'Y/m-d'));
             $upload = new Upload($config);
             $info = $upload->upload();
             if (!$info) {
                 // 上传错误提示错误信息
                 $this->error($upload->getError());
             } else {
                 // 上传成功 获取上传文件信息
                 $file_path_full = $info['img']['fullpath'];
                 $image = new \Think\Image();
                 $image->open($file_path_full);
                 $image->thumb(200, 150)->save($file_path_full);
                 $img_url = $info['img']['urlpath'];
                 // $img_url = "http://" . $_SERVER['SERVER_NAME'] . str_replace('index.php', '', __APP__) . $file_path_full;
                 unset($data['img']);
                 $data['link_img'] = $img_url;
             }
         }
         if (D('Links', 'Logic')->where(array('link_id' => $id))->save($data)) {
             $this->success('链接编辑成功', U('Admin/Custom/links', array('id' => $data['link_group_id'])));
         } else {
             $this->error('链接编辑失败', U('Admin/Custom/links', array('id' => $data['link_group_id'])));
         }
     } else {
         $this->form_url = U('Admin/Custom/editlink', array('id' => $id));
         $link = D('Links', 'Logic')->detail($id);
         $link_groups = D('Link_group', 'Logic')->select();
         $link_group_select = array_column_5($link_groups, 'link_group_name', 'link_group_id');
         $this->assign('link_group', gen_opinion_list($link_group_select, $link['link_group_id']));
         $this->assign('imgurl', $link['link_img']);
         $this->assign('link', $link);
         // print_array($this->link);
         $this->action = '编辑链接';
         $this->buttom = '编辑';
         $this->display('addlink');
     }
 }