Esempio n. 1
0
 public function contact()
 {
     $_username = get_cookie('_username');
     if (isset($GLOBALS['submit'])) {
         checkcode($GLOBALS['checkcode']);
         $model_r = $this->db->get_one('model', array('m' => 'guestbook'));
         $formdata = '';
         require get_cache_path('guestbook_add', 'model');
         $form_add = new form_add($model_r['modelid']);
         $formdata = $form_add->execute($GLOBALS['form']);
         $formdata['master_data']['publisher'] = $_username;
         $formdata['master_data']['addtime'] = SYS_TIME;
         $formdata['master_data']['ip'] = get_ip();
         $formdata['master_data']['status'] = 9;
         $this->db->insert($formdata['master_table'], $formdata['master_data']);
         //执行更新
         require get_cache_path('guestbook_update', 'model');
         $form_update = new form_update($model_r['modelid']);
         $form_update->execute($formdata);
         MSG('您的留言已提交,我们将尽快给您回复', HTTP_REFERER, 3000);
     } else {
         $model_r = $this->db->get_one('model', array('m' => 'guestbook'));
         require get_cache_path('guestbook_form', 'model');
         $form_build = new form_build($model_r['modelid']);
         $formdata = $form_build->execute();
         $field_list = '';
         if (is_array($formdata['0'])) {
             foreach ($formdata['0'] as $field => $info) {
                 if ($info['powerful_field']) {
                     continue;
                 }
                 if ($info['formtype'] == 'powerful_field') {
                     foreach ($formdata['0'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                     foreach ($formdata['1'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                 }
                 $field_list[] = $info;
             }
         }
         include T('guestbook', 'contact');
     }
 }
Esempio n. 2
0
 /**
  * 回复
  */
 public function reply()
 {
     $id = $GLOBALS['id'];
     $reply_user = get_cookie('wz_name');
     if (isset($GLOBALS['submit'])) {
         $status = 9;
         if (!empty($GLOBALS['reply_user'])) {
             $reply_user = remove_xss($GLOBALS['reply_user']);
         }
         $this->db->update('guestbook', array('status' => $status, 'reply' => $GLOBALS['reply'], 'replytime' => SYS_TIME, 'reply_user' => $reply_user), array('id' => $id));
         $r = $this->db->get_one('guestbook', array('id' => $id));
         $mr = $this->db->get_one('member', array('username' => $r['publisher']));
         //邮箱有验证状态时发送邮件通知
         if ($mr['ischeck_email']) {
             load_function('preg_check');
             $config = get_cache('sendmail');
             $password = decode($config['password']);
             //load_function('sendmail');
             $subject = '有人回复了您的提问,请登录查询';
             $message = "提问内容:" . $r['title'] . "<br>详细回复请登录:<br><a href='" . WEBURL . "index.php?m=guestbook&f=myissue&v=listing' target='_blank'>" . WEBURL . 'index.php?m=guestbook&f=myissue&v=listing</a> 查看';
             $mail = load_class('sendmail');
             $mail->setServer($config['smtp_server'], $config['smtp_user'], $password);
             //设置smtp服务器,普通连接方式
             $mail->setFrom($config['send_email']);
             //设置发件人
             $mail->setReceiver($mr['email']);
             //设置收件人,多个收件人,调用多次
             $mail->setMail($subject, $message);
             //设置邮件主题、内容
             $mail->sendMail();
             //发送
         }
         MSG(L('operation success'), $GLOBALS['forward']);
     } else {
         load_class('form');
         $r = $this->db->get_one('guestbook', array('id' => $id));
         $model_r = $this->db->get_one('model', array('m' => 'guestbook'));
         require get_cache_path('guestbook_form', 'model');
         $form_build = new form_build($model_r['modelid']);
         $formdata = $form_build->execute($r);
         include $this->template('reply');
     }
 }
Esempio n. 3
0
 /**
  * 编辑用户
  */
 public function edit()
 {
     $uid = (int) $GLOBALS['uid'];
     if ($uid) {
         $member = $this->db->get_one('member', '`uid`=' . $uid, '*');
     }
     if (empty($member)) {
         MSG(L('user not_exists'));
     }
     if (isset($GLOBALS['submit'])) {
         $GLOBALS['info']['factor'] = $member['factor'];
         $GLOBALS['info']['username'] = $member['username'];
         if (!$this->member->edit($GLOBALS['info'], $uid)) {
             MSG(L('operation_failure'));
         }
         $modelid = (int) $GLOBALS['info']['modelid'];
         //	判断是否有变更用户模型
         if ($modelid != $member['modelid']) {
             //	判断新的模型是否有用户数据
             if (!$this->db->get_one($this->model[$modelid]['attr_table'], 'uid=' . $uid, 'uid')) {
                 $this->db->insert($this->model[$modelid]['attr_table'], array('uid' => $uid));
             } else {
                 //	删除旧模型的数据
                 $this->db->query('DELETE FROM `wz_' . $this->model[$member['modelid']]['attr_table'] . '` WHERE `uid`=' . $uid);
             }
         }
         //	判断模型是否有设置字段
         $formdata = isset($GLOBALS['form']) ? $GLOBALS['form'] : '';
         if ($formdata) {
             require get_cache_path('member_add', 'model');
             $form = new form_add($modelid);
             $formdata = $form->execute($formdata);
             if ($formdata['attr_table']) {
                 $this->db->update($formdata['attr_table'], $formdata['attr_data'], '`uid`=' . $uid);
             }
             //执行更新
             require get_cache_path('member_update', 'model');
             $form_update = new form_update($modelid);
             $form_update->execute($formdata);
         }
         MSG(L('operation_success') . '<script>$("#u_' . $uid . ' td", top.window.frames["iframeid"].document).css("background-color", "#EFD04C");top.dialog.get(window).close().remove();</script>');
     } else {
         if (isset($GLOBALS['modelid']) && $GLOBALS['modelid'] != $member['modelid']) {
             $modelid = (int) $GLOBALS['modelid'];
         } else {
             $modelid = $member['modelid'];
         }
         //	判断是否有模型id参数
         if ($modelid) {
             require get_cache_path('member_form', 'model');
             $form_build = new form_build($modelid);
             $formdata = $form_build->execute($member);
         }
         $group = $this->group;
         include $this->template('member_edit', M);
     }
 }
Esempio n. 4
0
 /**
  * 信息发布
  */
 public function newinfo()
 {
     $memberinfo = $this->memberinfo;
     if ($memberinfo['ischeck_mobile'] == 0) {
         MSG('您的手机还未验证!请先验证!', 'index.php?m=member&f=index&v=edit_mobile', 3000);
     }
     $cid = $memberinfo['glpp'];
     if (!$cid) {
         MSG('您的账户没有绑定到品牌,请联系客服!');
     }
     $uid = $memberinfo['uid'];
     if (isset($GLOBALS['submit'])) {
         $cate_config = get_cache('category_' . $cid, 'content');
         if (!$cate_config) {
             MSG(L('category not exists'));
         }
         //如果设置了modelid,那么则按照设置的modelid。共享模型添加必须数据必须指定该值。
         if (isset($GLOBALS['modelid']) && is_numeric($GLOBALS['modelid'])) {
             $modelid = $GLOBALS['modelid'];
         } else {
             $modelid = $cate_config['modelid'];
         }
         $formdata = $GLOBALS['form'];
         $formdata['title'] = remove_xss($formdata['title']);
         //添加数据之前,将用户提交的数据按照字段的配置,进行处理
         require get_cache_path('content_add', 'model');
         $form_add = new form_add($modelid);
         $formdata = $form_add->execute($formdata);
         //插入时间,更新时间,如果用户设置了时间。则按照用户设置的时间
         $addtime = empty($formdata['addtime']) ? SYS_TIME : strtotime($formdata['addtime']);
         $formdata['master_data']['addtime'] = $formdata['master_data']['updatetime'] = $addtime;
         //如果是共享模型,那么需要在将字段modelid增加到数据库
         if ($formdata['master_table'] == 'content_share') {
             $formdata['master_data']['modelid'] = $modelid;
         }
         $formdata['master_data']['cid'] = $cid;
         //默认状态 status ,9为通过审核,1-4为审核的工作流,0为回收站
         $formdata['master_data']['status'] = 1;
         //如果 route为 0 默认,1,加密,2外链 ,3,自定义 例如:wuzhicms-diy-url-example 用户,不能不需要自己写后缀。程序自动补全。
         $formdata['master_data']['route'] = 0;
         $formdata['master_data']['publisher'] = $memberinfo['username'];
         //echo $formdata['master_table'];exit;
         if (empty($formdata['master_data']['remark']) && isset($formdata['attr_data']['content'])) {
             $formdata['master_data']['remark'] = mb_strcut(strip_tags($formdata['attr_data']['content']), 0, 255);
         }
         //处理前台特殊字段
         $formdata['master_data']['type'] = 2;
         //团购类型
         $id = $this->db->insert($formdata['master_table'], $formdata['master_data']);
         //生成url
         $urlclass = load_class('url', 'content', $cate_config);
         $urls = $urlclass->showurl(array('id' => $id, 'cid' => $cid, 'addtime' => $addtime, 'page' => 1, 'route' => $formdata['master_data']['route']));
         $this->db->update($formdata['master_table'], array('url' => $urls['url']), array('id' => $id));
         if (!empty($formdata['attr_table'])) {
             $formdata['attr_data']['id'] = $id;
             // print_r($formdata['attr_data']);exit;
             $this->db->insert($formdata['attr_table'], $formdata['attr_data']);
         }
         $formdata['master_data']['url'] = $urls['url'];
         //执行更新
         require get_cache_path('content_update', 'model');
         $form_update = new form_update($modelid);
         $data = $form_update->execute($formdata);
         //统计表加默认数据
         $this->db->insert('content_rank', array('cid' => $cid, 'id' => $id, 'updatetime' => SYS_TIME));
         MSG('信息发布成功,我们将在24小时内进行审核!');
     } else {
         $categorys = get_cache('category', 'content');
         load_function('content', 'content');
         $mec = get_mec($memberinfo['mecid']);
         $model_r = get_cache('field_2', 'model');
         load_function('template');
         $status = 1;
         require get_cache_path('content_form', 'model');
         $form_build = new form_build(2);
         $form_build->cid = $cid;
         $category = get_cache('category', 'content');
         $form_build->extdata['catname'] = '';
         $form_build->extdata['type'] = '0';
         $formdata = $form_build->execute();
         load_class('form');
         $show_formjs = 1;
         $show_dialog = 1;
         $field_list = '';
         if (is_array($formdata['0'])) {
             foreach ($formdata['0'] as $field => $info) {
                 if ($info['powerful_field'] || $info['ban_contribute'] == 0) {
                     continue;
                 }
                 if ($info['formtype'] == 'powerful_field') {
                     foreach ($formdata['0'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                     foreach ($formdata['1'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                 }
                 $field_list[] = $info;
             }
         }
         include T('content', 'member_postinfo_newinfo');
     }
 }
Esempio n. 5
0
 public function edit()
 {
     if (!isset($GLOBALS['id'])) {
         MSG(L('parameter_error'));
     }
     $id = intval($GLOBALS['id']);
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : 0;
     $cate_config = get_cache('category_' . $cid, 'content');
     if (!$cate_config) {
         MSG(L('category not exists'));
     }
     //如果设置了modelid,那么则按照设置的modelid。共享模型添加必须数据必须指定该值。
     if (isset($GLOBALS['modelid']) && is_numeric($GLOBALS['modelid'])) {
         $modelid = $GLOBALS['modelid'];
     } else {
         $modelid = $cate_config['modelid'];
     }
     if (isset($GLOBALS['submit']) || isset($GLOBALS['submit2'])) {
         $formdata = $GLOBALS['form'];
         //插入时间,更新时间,如果用户设置了时间。则按照用户设置的时间
         $addtime = empty($formdata['addtime']) ? SYS_TIME : strtotime($formdata['addtime']);
         //添加数据之前,将用户提交的数据按照字段的配置,进行处理
         require get_cache_path('content_add', 'model');
         $form_add = new form_add($modelid);
         $formdata = $form_add->execute($formdata);
         $formdata['master_data']['addtime'] = $addtime;
         $formdata['master_data']['updatetime'] = SYS_TIME;
         //如果是共享模型,那么需要在将字段modelid增加到数据库
         if ($formdata['master_table'] == 'content_share') {
             $formdata['master_data']['modelid'] = $modelid;
         }
         $formdata['master_data']['cid'] = $cid;
         //默认状态 status ,9为通过审核,1-4为审核的工作流,0为回收站
         $formdata['master_data']['status'] = isset($GLOBALS['form']['status']) ? intval($GLOBALS['form']['status']) : 9;
         //非超级管理员,验证该栏目是否设置了审核
         if ($cate_config['workflowid'] && $_SESSION['role'] != 1 && in_array($formdata['master_data']['status'], array(9, 8))) {
             $formdata['master_data']['status'] = 1;
         }
         //如果 route为 0 默认,1,加密,2外链 ,3,自定义 例如:wuzhicms-diy-url-example 用户,不能不需要自己写后缀。程序自动补全。
         $formdata['master_data']['route'] = intval($GLOBALS['form']['route']);
         //标题样式
         $title_css = preg_match('/([a-z0-9]+)/i', $GLOBALS['title_css']) ? $GLOBALS['title_css'] : '';
         $formdata['master_data']['css'] = $title_css;
         if ($cate_config['type']) {
             $urls['url'] = $cate_config['url'];
         } elseif ($formdata['master_data']['route'] > 1) {
             //外部链接/或者自定义链接
             $urls['url'] = remove_xss($GLOBALS['url']);
         } else {
             //生成url
             $urlclass = load_class('url', 'content', $cate_config);
             $productid = 0;
             if (isset($formdata['master_data']['productid'])) {
                 $productid = $formdata['master_data']['productid'];
             }
             $urls = $urlclass->showurl(array('id' => $id, 'cid' => $cid, 'addtime' => $addtime, 'page' => 1, 'route' => $formdata['master_data']['route'], 'productid' => $productid));
         }
         $formdata['master_data']['url'] = $urls['url'];
         if (empty($formdata['master_data']['remark']) && isset($formdata['attr_data']['content'])) {
             $formdata['master_data']['remark'] = mb_strcut(strip_tags($formdata['attr_data']['content']), 0, 255);
         }
         $this->db->update($formdata['master_table'], $formdata['master_data'], array('id' => $id));
         if (!empty($formdata['attr_table'])) {
             $this->db->update($formdata['attr_table'], $formdata['attr_data'], array('id' => $id));
         }
         //执行更新
         require get_cache_path('content_update', 'model');
         $form_update = new form_update($modelid);
         $formdata['master_data']['id'] = $id;
         $form_update->execute($formdata);
         //生成静态
         if ($cate_config['showhtml'] && $formdata['master_data']['status'] == 9) {
             $data = $this->db->get_one($formdata['master_table'], array('id' => $id));
             if (!empty($formdata['attr_table'])) {
                 $attrdata = $this->db->get_one($formdata['attr_table'], array('id' => $id));
                 $data = array_merge($data, $attrdata);
             }
             //上一页
             $data['previous_page'] = $this->db->get_one($formdata['master_table'], "`cid` = '{$cid}' AND `id`<'{$id}' AND `status`=9", '*', 0, 'id DESC');
             //下一页
             $data['next_page'] = $this->db->get_one($formdata['master_table'], "`cid`= '{$cid}' AND `id`>'{$id}' AND `status`=9", '*', 0, 'id ASC');
             $this->html = load_class('html', 'content');
             $this->html->set_category($cate_config);
             $this->html->set_categorys();
             $this->html->load_formatcache();
             $this->html->show($data, 1, 1, $urls['root']);
             $loadhtml = true;
         } else {
             $loadhtml = false;
         }
         //生成相关栏目列表
         if ($cate_config['listhtml']) {
             if ($loadhtml == false) {
                 $this->html = load_class('html', 'content');
                 $this->html->set_category($cate_config);
                 $this->html->set_categorys();
                 $loadhtml = true;
             }
             for ($i = 1; $i < 6; $i++) {
                 $cateurls = $urlclass->listurl(array('cid' => $cid, 'page' => $i));
                 $this->html->listing($cateurls['root'], $i);
                 if ($GLOBALS['result_lists'] == 0) {
                     break;
                 }
             }
         }
         //生成首页
         if ($loadhtml) {
             $this->html->index();
         } else {
             $this->html = load_class('html', 'content');
             $this->html->set_categorys();
             $this->html->index();
         }
         //编辑操作日志
         $this->editor_logs('edit', $formdata['master_data']['title'], $urls['url'], "?m=content&f=content&v=edit&id={$id}&cid={$cid}");
         //设置返回地址
         $forward = isset($GLOBALS['submit2']) ? HTTP_REFERER : '?m=content&f=content&v=listing&type=' . $GLOBALS['type'] . '&cid=' . $cid . $this->su();
         MSG(L('update success'), $forward, 1000);
     } else {
         $models = get_cache('model_content', 'model');
         $model_r = $models[$modelid];
         $master_table = $model_r['master_table'];
         $data = $this->db->get_one($master_table, array('id' => $id));
         if ($model_r['attr_table']) {
             $attr_table = $model_r['attr_table'];
             if ($data['modelid']) {
                 $modelid = $data['modelid'];
                 $attr_table = $models[$modelid]['attr_table'];
             }
             $attrdata = $this->db->get_one($attr_table, array('id' => $id));
             $data = array_merge($data, $attrdata);
         }
         load_function('template');
         load_function('content', 'content');
         $status = isset($GLOBALS['status']) ? intval($GLOBALS['status']) : 9;
         require get_cache_path('content_form', 'model');
         $form_build = new form_build($modelid);
         $form_build->cid = $cid;
         $category = get_cache('category', 'content');
         $form_build->extdata['catname'] = $cate_config['name'];
         $form_build->extdata['type'] = $cate_config['type'];
         $formdata = $form_build->execute($data);
         load_class('form');
         $show_formjs = 1;
         $show_dialog = 1;
         include $this->template('content_edit');
     }
 }
Esempio n. 6
0
 /**
  * 审核机构
  */
 public function check()
 {
     $uid = (int) $GLOBALS['uid'];
     if ($uid) {
         $member = $this->db->get_one('member', '`uid`=' . $uid, '*');
     }
     if (empty($member)) {
         MSG(L('user not_exists'));
     }
     if (isset($GLOBALS['submit'])) {
         $modelid = 23;
         //	判断模型是否有设置字段
         $formdata = isset($GLOBALS['form']) ? $GLOBALS['form'] : '';
         if ($formdata) {
             require get_cache_path('member_add', 'model');
             $form = new form_add($modelid);
             $formdata = $form->execute($formdata);
             $formdata['master_data']['checkmec'] = 1;
             $formdata['master_data']['mecid'] = intval($GLOBALS['mecid']);
             $this->db->update('member', $formdata['master_data'], array('uid' => $uid));
             if ($formdata['attr_table'] && !empty($formdata['attr_data'])) {
                 $this->db->update($formdata['attr_table'], $formdata['attr_data'], '`uid`=' . $uid);
             }
             //执行更新
             require get_cache_path('member_update', 'model');
             $form_update = new form_update($modelid);
             $form_update->execute($formdata);
         }
         MSG('审核通过', $GLOBALS['forward']);
     } else {
         if (isset($GLOBALS['modelid']) && $GLOBALS['modelid'] != $member['modelid']) {
             $modelid = (int) $GLOBALS['modelid'];
         } else {
             $modelid = $member['modelid'];
         }
         //	判断是否有模型id参数
         if ($modelid) {
             require get_cache_path('member_form', 'model');
             $form_build = new form_build($modelid);
             $formdata = $form_build->execute($member);
         }
         $group = $this->group;
         $show_dialog = 1;
         $show_formjs = 1;
         include $this->template('member_mec_check');
     }
 }
Esempio n. 7
0
 /**
  * 个人资料修改
  */
 public function profile()
 {
     $point_config = get_cache('point_config');
     $seo_title = '个人信息';
     $memberinfo = $this->memberinfo;
     $uid = $this->memberinfo['uid'];
     $groups = $this->groups;
     $modelid = $memberinfo['modelid'];
     $model_r = $this->db->get_one('model', array('modelid' => $modelid));
     $data = $this->db->get_one($model_r['attr_table'], array('uid' => $uid));
     if ($data) {
         $data = array_merge($memberinfo, $data);
     } else {
         $data = $memberinfo;
     }
     if (isset($GLOBALS['submit'])) {
         checkcode($GLOBALS['checkcode']);
         $formdata = '';
         require get_cache_path('member_add', 'model');
         $form_add = new form_add($modelid);
         if (empty($GLOBALS['form'])) {
             MSG('参数错误');
         }
         $formdata = $form_add->execute($GLOBALS['form']);
         /**
                     if(is_tel($GLOBALS['mobile'])) {
                         $formdata['master_data']['mobile'] = $GLOBALS['mobile'];
         
                     }
         **/
         $this->db->update($formdata['master_table'], $formdata['master_data'], array('uid' => $uid));
         if (!empty($formdata['attr_table']) && !empty($formdata['attr_data'])) {
             $this->db->update($formdata['attr_table'], $formdata['attr_data'], array('uid' => $uid));
         }
         //执行更新
         require get_cache_path('member_update', 'model');
         $form_update = new form_update($modelid);
         $formdata['master_data']['uid'] = $uid;
         $form_update->execute($formdata);
         MSG(L('operation_success'), HTTP_REFERER);
     } else {
         require get_cache_path('member_form', 'model');
         $form_build = new form_build($modelid);
         $formdata = $form_build->execute($data);
         //print_r($formdata);
         $field_list = '';
         if (is_array($formdata['0'])) {
             foreach ($formdata['0'] as $field => $info) {
                 if ($info['powerful_field']) {
                     continue;
                 }
                 if ($info['formtype'] == 'powerful_field') {
                     foreach ($formdata['0'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                     foreach ($formdata['1'] as $_fm => $_fm_value) {
                         if ($_fm_value['powerful_field']) {
                             $info['form'] = str_replace('{' . $_fm . '}', $_fm_value['form'], $info['form']);
                         }
                     }
                 }
                 $field_list[] = $info;
             }
         }
         $groupid = $memberinfo['groupid'];
         $points = $memberinfo['points'];
         if ($groupid == 3) {
             $next_group = 6;
             $nextpoints = $groups[$next_group]['points'] - $points;
         } elseif ($groupid == 6) {
             $next_group = 7;
             $nextpoints = $groups[$next_group]['points'] - $points;
         } elseif ($groupid == 7) {
             $next_group = 8;
             $nextpoints = $groups[$next_group]['points'] - $points;
         } elseif ($groupid == 8) {
             $next_group = 9;
             $nextpoints = $groups[$next_group]['points'] - $points;
         } elseif ($groupid == 9) {
             $next_group = 9;
             $nextpoints = 0;
         }
         $dir = substr(md5($this->uid), 0, 2) . '/' . $this->uid . '/';
         $upurl = base64_encode(WEBURL . '/index.php?m=member&v=avatar&uid=' . $this->uid);
         include T('member', 'profile');
     }
 }