Beispiel #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');
     }
 }
Beispiel #2
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');
     }
 }
$cid = 32;
$cate_config = get_cache('category_' . $cid, 'content');
if (!$cate_config) {
    MSG(L('category not exists'));
}
$categorys = get_cache('category', 'content');
$createhtml = load_class('html', 'content');
$urlclass = load_class('url', 'content', $cate_config);
$urlclass->set_category($cate_config);
$urlclass->set_categorys($categorys);
//如果设置了modelid,那么则按照设置的modelid。共享模型添加必须数据必须指定该值。
$modelid = $cate_config['modelid'];
require get_cache_path('content_add', 'model');
$form_add = new form_add($modelid);
require get_cache_path('content_update', 'model');
$form_update = new form_update($modelid);
$result = $db->get_list('collect_url', array('status' => 0), '*', 0, 1000, 0, 'id DESC');
//todo 标题为空时或者长度验证不通过时,处理方式
foreach ($result as $rs) {
    $url = $rs['url'];
    $formdata = get_content($url, $config);
    print_r($formdata);
    if (strlen($formdata['title']) < 3) {
        continue;
    }
    $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') {
Beispiel #4
0
 /**
  * 重新从keyword里创建tag,删除tag_data表,重置tag表的number为0
  *
  * @author tuzwu
  */
 public function create()
 {
     if (output($GLOBALS, 'dosubmit') && output($GLOBALS, 'create_confirm') == '五指CMS') {
         $page = max(1, output($GLOBALS, 'page'));
         $modelid = output($GLOBALS, 'modelid');
         if ($page <= 1 && !$modelid) {
             $this->db->query('TRUNCATE TABLE wz_tag_data');
             $r = $this->db->update('tag', array('number' => 0), $where = array());
             //重新计数
         }
         $model = get_cache('model_content', 'model');
         $model_key = array_keys($model);
         sort($model_key);
         $model_num = count($model_key);
         $modelid = $modelid ? $modelid : $model_key[0];
         //没有modelid表示第一次运行,从第一个模型开始
         $pagesize = 50;
         //每次处理50个文章
         $where = $model[$modelid]['share_model'] == 1 ? array('modelid' => $modelid) : '';
         $lists = $this->db->get_list($model[$modelid]['master_table'], $where, $field = 'keywords,cid,id' . ($where ? ',modelid' : ''), 0, $pagesize, $page);
         $page_num = ceil($this->db->number / $pagesize);
         require get_cache_path('content_update', 'model');
         $form_update = new form_update($modelid);
         foreach ($lists as $k => $v) {
             $formdata['master_data'] = array('id' => $v['id'], 'cid' => $v['cid'], 'modelid' => $v['modelid'] ? $v['modelid'] : $modelid, 'keywords' => $v['keywords']);
             $form_update->execute($formdata);
             //这里会调用keyword方法进行tag+1/入库处理等
         }
         if ($page_num <= $page && $modelid == $model_key[$model_num - 1]) {
             $url = link_url(array('v' => 'listing'));
             MSG(L('operation_success'), $url, 3000);
             //完成更新
         } else {
             if ($page_num > $page) {
                 $page += 1;
             } else {
                 $page = $GLOBALS['page'] = 1;
                 //页数从1开始,主要方便get_list执行;
                 $modelid = $model_key[array_search($modelid, $model_key) + 1];
                 //下一个模型
             }
         }
         $url = link_url(array('page' => $page, 'modelid' => $modelid, 'create_confirm' => '五指CMS', 'dosubmit' => 1));
         MSG(L('next_round') . 'modelid:' . $modelid . '-page_num:' . $page_num . '-page:' . $page, $url, 2000);
     } else {
         include $this->template(V, M);
     }
 }
Beispiel #5
0
 /**
  * 信息发布
  */
 public function newinfo()
 {
     $memberinfo = $this->memberinfo;
     if ($memberinfo['ischeck_mobile'] == 0) {
         MSG('您的手机还未验证!请先验证!', 'index.php?m=member&f=index&v=edit_mobile', 3000);
     }
     $uid = $memberinfo['uid'];
     if (isset($GLOBALS['submit'])) {
         $cid = 69;
         $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'] = intval($formdata['renshu']) . '人    预算' . intval($formdata['yusuan']) . '元/人    预计体检时间:' . $formdata['tjtime'];
         //添加数据之前,将用户提交的数据按照字段的配置,进行处理
         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']['province'] = remove_xss($GLOBALS['LK3_1']);
         $formdata['master_data']['city'] = remove_xss($GLOBALS['LK3_2']);
         $formdata['master_data']['area'] = remove_xss($GLOBALS['LK3_3']);
         $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));
         //扣除积分
         $point_config = get_cache('point_config');
         if ($point_config['cominfoadd']) {
             $credit_api = load_class('credit_api', 'credit');
             $credit_api->handle($uid, '-', $point_config['cominfoadd'], '发布信息扣除积分<br>' . $formdata['title']);
         }
         MSG('信息发布成功,我们将在24小时内进行审核!');
     } else {
         $categorys = get_cache('category', 'content');
         include T('content', 'member_cominfo_newinfo');
     }
 }
Beispiel #6
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);
     }
 }
Beispiel #7
0
 /**
  * 信息发布
  */
 public function newinfo()
 {
     $memberinfo = $this->memberinfo;
     if ($memberinfo['ischeck_mobile'] == 0) {
         MSG('您的手机还未验证!请先验证!', 'index.php?m=member&f=index&v=edit_mobile', 3000);
     }
     $uid = $memberinfo['uid'];
     if (isset($GLOBALS['submit'])) {
         $cid = 70;
         $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);
         }
         $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']);
         $endtime = mktime(0, 0, 0, date('m') + 3, date('d'), date('Y'));
         $endtime = date('Y-m-d', $endtime);
         load_class('form');
         $endtime = WUZHI_form::calendar('endtime', $endtime);
         $editor = WUZHI_form::editor('form[content]', 'content', '', 'basic');
         include T('content', 'member_mecinfo_newinfo');
     }
 }
Beispiel #8
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');
     }
 }
Beispiel #9
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');
     }
 }
Beispiel #10
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');
     }
 }