Example #1
0
 public function cert_view()
 {
     $cer_id = yf_empty(intval($_GET['cer_id']), "System Error");
     $info = Model('worker')->get_one_cert($cer_id);
     $this->assign("info", $info);
     $this->display('cert.html');
 }
Example #2
0
 /**
  * 添加版块内容
  */
 public function sumbit_content()
 {
     $this->admin_priv('addimage');
     $en_title = yf_empty($_POST['en_title'], '', true);
     $title = yf_empty($_POST['title'], Lang('标题不能为空'));
     $info['title'] = isset($_POST['title']) ? CH_SC . $title . DIG_EC . EN_SC . $en_title . DIG_EC : '';
     $en_des = yf_empty($_POST['en_description'], '', true);
     $info['description'] = isset($_POST['description']) ? CH_SC . $_POST['description'] . DIG_EC . EN_SC . $en_des . DIG_EC : '';
     $info['url'] = yf_empty($_POST['url'], '#', true);
     $info['ordering'] = yf_empty(intval($_POST['ordering']), 0, true);
     $info['block_id'] = yf_empty($_POST['block_id'], '', true);
     $info['pic_path'] = yf_empty($_POST['pic_path'], '', true);
     $data = array('error' => 1, 'content' => Lang('INVALID_OPERATION'));
     $info['created'] = yf_time();
     $result = Model('ad')->add_images($info);
     if ($result) {
         $data['error'] = 0;
         $data['content'] = Lang('SUCCESS_ADD');
     } else {
         $data['content'] = "添加失败";
     }
     $this->showMsg($data);
 }
Example #3
0
 /**
  * 更新规则数据
  */
 public function update_rule()
 {
     $this->admin_priv('edit_rule');
     $img_arr = array();
     $i = 0;
     foreach ($_POST as $k => $v) {
         $i++;
         if (strstr($k, 'field')) {
             $img_arr[$i]['title'] = $v[0];
             $img_arr[$i]['description'] = $v[1];
             $img_arr[$i]['url'] = $v[2];
             $img_arr[$i]['thumb'] = $v[3];
             $img_arr[$i]['id'] = $v[4];
         }
     }
     $id = yf_empty(intval($_POST['id']), '', true);
     $info['name'] = yf_empty($_POST['name'], '标题不能为空');
     $info['createtime'] = yf_time();
     //$info['status'] = isset($_POST['is_show'])?intval($_POST['is_show']):0;
     $data = array('error' => 0, 'content' => '');
     if ($_POST['type'] == 1) {
         $content = yf_empty($_POST['content'], '', true);
     } else {
         $content = $img_arr;
     }
     $result = Model('wxrule')->update_rule($info, $content, $id);
     if ($result) {
         $data['content'] = Lang('SUCCESS_EDIT');
         $data['url'] = "index.php?g=admin&m=wxrule&a=index";
     } else {
         $data['error'] = 1;
         $data['content'] = Lang('INVALID_OPERATION');
     }
     $this->showMsg($data);
 }
Example #4
0
 public function ordering()
 {
     $id = yf_empty(intval($_POST['id']), '', true);
     $val = yf_empty(intval($_POST['val']), '', true);
     $result = Model('kind')->ordering($val, $id);
     $this->showMsg($result);
 }
Example #5
0
 /**
  * 添加文章数据
  */
 public function new_art()
 {
     $this->admin_priv('add_news');
     $data = array('error' => 1, 'content' => '');
     $info['cat_id'] = yf_empty(intval($_POST['cat_id']), '', true);
     //自动截取summary
     if ($_POST['summary'] === '' && $_POST['content'] != '') {
         $_POST['summary'] = hy_substr(str_replace(PHP_EOL, '', strip_tags($_POST['content'])), 200);
     }
     if ($_POST['en_summary'] === '' && $_POST['en_content'] != '') {
         $_POST['en_summary'] = hy_substr(str_replace(PHP_EOL, '', strip_tags($_POST['en_content'])), 200);
     }
     $en_summary = yf_empty($_POST['en_summary'], "", true);
     $info['summary'] = isset($_POST['summary']) ? CH_SC . $_POST['summary'] . DIG_EC . EN_SC . $en_summary . DIG_EC : '';
     $en_title = yf_empty($_POST['en_title'], '', true);
     $en_author = yf_empty($_POST['en_author'], '', true);
     $en_content = yf_empty($_POST['en_content'], '', true);
     $title = yf_empty($_POST['title'], Lang('KEY_EMPTY'));
     $info['title'] = isset($_POST['title']) ? CH_SC . $title . DIG_EC . EN_SC . $en_title . DIG_EC : '';
     $info['abstract'] = yf_empty($_POST['abstract'], '', true);
     $info['flags'] = is_array($_POST['flags']) ? implode(',', $_POST['flags']) : $_POST['flags'];
     $info['keywords'] = yf_empty($_POST['keywords'], '', true);
     $info['author'] = isset($_POST['author']) ? CH_SC . $_POST['author'] . DIG_EC . EN_SC . $en_author . DIG_EC : '';
     $info['source'] = yf_empty($_POST['source'], '', true);
     $info['content'] = isset($_POST['content']) ? CH_SC . $_POST['content'] . DIG_EC . EN_SC . $en_content . DIG_EC : '';
     $info['ordering'] = yf_empty($_POST['ordering'], 0, true);
     $info['hits'] = yf_empty($_POST['hits'], 0, true);
     $info['source_url'] = yf_empty($_POST['source_url'], '', true);
     $info['page_title'] = yf_empty($_POST['page_title'], '', true);
     $info['created'] = empty($_POST['created']) ? yf_time() : strtotime($_POST['created']);
     $info['thumb'] = yf_empty($_POST['thumb'], '', true);
     $info['is_show'] = yf_empty($_POST['is_show'], 1, true);
     if (!empty($_POST['photo'])) {
         $photo = is_array($_POST['photo']) ? $_POST['photo'] : array($_POST['photo']);
     } else {
         $photo = array();
     }
     $info['form_id'] = yf_empty($_POST['form_id'], 0, true);
     $pattern = "/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/";
     preg_match_all($pattern, stripslashes($info['content']), $match);
     if ($match) {
         $file = array('name' => '', 'type' => 'image/png', 'tmp_name' => '', 'size' => '', 'error' => 0);
         //上传word图片-start
         foreach ($match[1] as $k => $v) {
             $pattern2 = '/^(file:\\/\\/).*$/';
             if (preg_match($pattern2, $v)) {
                 $file['name'] = basename($v);
                 $ex = explode(".", $file['name']);
                 $ext = end($ex);
                 switch ($ext) {
                     case "png":
                         $file['type'] = 'image/png';
                         break;
                     case "jpeg":
                         $file['type'] = 'image/jpeg';
                         break;
                     case "jpg":
                         $file['type'] = 'image/jpeg';
                         break;
                     case "gif":
                         $file['type'] = 'image/gif';
                         break;
                 }
                 $file['tmp_name'] = $v;
                 $thumb_url = Model('image')->upload_image($file, 'article/' . date('Ym'));
                 if ($thumb_url) {
                     $info['content'] = str_replace(addslashes($v), addslashes($thumb_url), $info['content']);
                 }
             } else {
                 //对于已经上传的图片,自动截取文章第一个图片为缩略图
                 if (empty($info['thumb'])) {
                     $info['thumb'] = $match[1][0];
                 }
             }
         }
         //上传word图片-end
     }
     if (Model('article')->create_art($info, $photo)) {
         $data['content'] = Lang('SUCCESS_ADD');
         $data['error'] = 0;
     } else {
         $data['content'] = Lang('INVALID_OPERATION');
     }
     $this->showMsg($data);
 }
Example #6
0
 /**
  * 显示菜单编辑页面
  */
 public function edit_menu()
 {
     $this->admin_priv('edit_wx_menu', 2);
     $id = yf_empty(intval($_GET['id']), '', true);
     $wm = Model('wxmenu');
     $wxmenu = $wm->get_wxmenu_info($id);
     //父类列表
     $menu_list = $wm->get_parent_menu();
     //规则列表
     $rule_list = Model('wxrule')->get_rule_list();
     $this->assign('rule_list', $rule_list);
     $this->assign('cat_list', $menu_list);
     $this->assign('wxmenu', $wxmenu);
     $this->assign("action", "update_menu");
     $this->display('wxmenu.html');
 }
Example #7
0
 /**
  * 显示商品类型列表
  */
 public function type_list()
 {
     $page = yf_empty(intval($_REQUEST['page']), 1, true);
     $art_list = Model('goods')->get_spec_list($page);
     $this->assign('art_list', $art_list['result']);
     $this->assign('art_page', $art_list['page']);
     $this->display('type_list.html');
 }
Example #8
0
 /**
  * 插入关键字信息
  */
 public function new_key()
 {
     $this->admin_priv('add_key');
     $info['keyword'] = yf_empty($_POST['keyword'], '关键字名称不能为空');
     $info['rid'] = yf_empty(intval($_POST['rule_id']), '', true);
     $info['status'] = yf_empty($_POST['status'], 1, true);
     $info['type'] = yf_empty($_POST['type'], 0, true);
     $data = array('error' => 1, 'content' => '');
     $res = Model('wxkey')->check_key($info['keyword']);
     if ($res['error'] == 0) {
         if (Model('wxkey')->create_key($info)) {
             $data['error'] = 0;
             $data['content'] = Lang('SUCCESS_ADD');
         } else {
             $data['content'] = Lang('INVALID_OPERATION');
         }
     }
     $this->showMsg($data);
 }
Example #9
0
 /**
  * 修改详细的权限功能
  */
 public function ud_act()
 {
     $res = array('error' => 0, 'content' => '编辑成功');
     $id = yf_empty($_POST['mod_id'], "系统错误");
     $info['mod_name'] = yf_empty($_POST['mod_name'], "权限功能不能为空");
     $info['mod_code'] = yf_empty($_POST['mod_code'], "权限标识不能为空");
     Model('admin')->ud_act($info, $id);
     $this->showMsg($res);
 }
Example #10
0
 public function del_send()
 {
     $res = array('error' => 1, 'content' => '系统错误');
     $send_id = yf_empty(intval($_POST['send_id']), "系统错误");
     $id = Model('attend')->del_send($send_id);
     if ($id) {
         $res = array('error' => 0, 'content' => '删除成功');
     }
     $this->showMsg($res);
 }
Example #11
0
 /**
  * 删除表单
  */
 public function del_form()
 {
     $this->admin_priv('del_form');
     $res = array('error' => 1, 'content' => '删除失败');
     $id = yf_empty(intval($_REQUEST['id']), '系统错误');
     $check = Model('forms')->del_form($id);
     if ($check) {
         $res = array('error' => 0, 'content' => '删除成功');
     }
     $this->showMsg($res);
 }
Example #12
0
 /**
  * 更新菜单栏目信息
  */
 public function update_menu()
 {
     $this->admin_priv('editmenu');
     $id = yf_empty(intval($_POST['id']), '', true);
     $info['parent_id'] = yf_empty(intval($_POST['parent_id']), 0, true);
     $info['name'] = yf_empty($_POST['name'], Lang('title_empty'));
     $en_name = yf_empty($_POST['en_name'], "", true);
     $info['name'] = CH_SC . $info['name'] . DIG_EC . EN_SC . $en_name . DIG_EC;
     $info['is_show'] = yf_empty(intval($_POST['is_show']), 0, true);
     $info['nav_pos'] = is_array($_POST['nav_pos']) ? implode(',', $_POST['nav_pos']) : $_POST['nav_pos'];
     $info['code'] = yf_empty(trim(strtolower($_POST['code'])), "栏目别名不能为空");
     $info['is_extend_links'] = yf_empty(intval($_POST['is_extend_links']), 0, true);
     $data = array('error' => 1, 'content' => '');
     if ($info['parent_id'] == $id) {
         $data['content'] = Lang('PARENT_ID_ERR');
         $this->showMsg($data);
     }
     if (hy_check($info['code'], 'un') == '#@_error') {
         $data['content'] = Lang('code_error');
         $this->showMsg($data);
     }
     if ($info['is_extend_links'] == 1) {
         $info['redirect_url'] = yf_empty($_POST['redirect_url'], "", true);
         if (hy_check($info['redirect_url'], 'u') == '#@_error' && $info['redirect_url'] != 'http://') {
             $data['content'] = Lang('url_error');
             $this->showMsg($data);
         }
         $info['type'] = '';
         $info['page_title'] = '';
         $info['keywords'] = '';
         $info['description'] = '';
     } else {
         $info['thumb'] = yf_empty($_POST['thumb'], '', true);
         $info['type'] = yf_empty($_POST['type'], '', true);
         $info['page_title'] = yf_empty($_POST['page_title'], '', true);
         $info['keywords'] = yf_empty($_POST['keywords'], '', true);
         $info['description'] = yf_empty($_POST['description'], '', true);
         $info['redirect_url'] = '';
     }
     if (Model('menu')->check_code($info['code'], $id)) {
         $result = Model('menu')->update_menu($info, $id);
         if ($result) {
             $data['error'] = 0;
             $data['content'] = Lang('SUCCESS_EDIT');
         } else {
             $data['content'] = Lang('INVALID_OPERATION');
         }
         $this->showMsg($data);
     } else {
         $data['content'] = Lang('CODE_REPEATING');
         $this->showMsg($data);
     }
 }
Example #13
0
 public function update_user()
 {
     $res = array('error' => 1, 'content' => '系统繁忙', 'url' => "index.php?g=mobile&m=index&a=index");
     $data['area_id'] = yf_empty(intval($_POST['area_id']), 0, true);
     $data['first'] = 1;
     if ($data['area_id'] == 0) {
         $data['first'] = 0;
     }
     $info['username'] = yf_empty($_POST['username'], "请输入姓名");
     $info['mobile'] = yf_empty($_POST['mobile'], "请输入手机");
     if (hy_check($info['mobile'], 'm') == '#@_error') {
         $res['content'] = "输入的手机格式不正确";
         $this->showMsg($res);
     }
     $id = Model('index')->update_info($data, $info, $_SESSION['wxid']);
     if ($id) {
         $res['error'] = 0;
         $res['content'] = "修改成功";
     }
     $this->showMsg($res);
 }
Example #14
0
 public function goods()
 {
     $id = yf_empty(intval($_GET['id']), 0, true);
     if ($id == 0) {
         header("Location:http://" . $_SERVER['HTTP_HOST'] . "/index.php?g=mobile&m=index&a=index");
         exit;
     }
     $config[c] = array('site_name' => '商品详情-' . Model('app')->get_cfg('site_name'));
     $this->assign_global($config);
     $goods = Model('store')->get_goods_info($id);
     //$jsdk = Model('store')->get_jsdk();
     Model('store')->update_goods_hits($id);
     $this->assign("goods", $goods);
     //$this->assign("jsdk", $jsdk);
     $this->display("goods.html");
 }
Example #15
0
 public function qrcode()
 {
     if ($_POST) {
         $url = yf_empty($_POST['url'], "请输入要生成二维码的链接");
         $size = yf_empty(intval($_POST['size']), 10, 'size');
         $name = yf_empty($_POST['name'], '', true);
         $status = yf_empty(intval($_POST['status']), 0, true);
         if ($status == 0) {
             $path = yf_qrcode($url, $size, true, $name);
             yf_down($path);
         } else {
             $path = yf_qrcode($url, $size);
             //	$this->assign("code", $path);
         }
     }
     $this->display("qrcode.html");
 }