Esempio n. 1
0
 /**
  * 新窗口打开下载
  */
 public function filedown()
 {
     $downfile = decode($GLOBALS['str']);
     $downloadtype = intval(substr($downfile, 0, 1));
     $downfile = substr($downfile, 1);
     if (!$downloadtype) {
         $downfile = private_file($downfile);
     }
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : 0;
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : 0;
     $siteconfigs = $this->siteconfigs;
     $categorys = get_cache('category', 'content');
     //查询数据
     if ($cid && $id) {
         $category = get_cache('category_' . $cid, 'content');
         $models = get_cache('model_content', 'model');
         $model_r = $models[$category['modelid']];
         $master_table = $model_r['master_table'];
         $data = $this->db->get_one($master_table, array('id' => $id));
         if (!$data || $data['status'] != 9) {
             MSG('信息不存在或者未通过审核!');
         }
         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);
         }
         require get_cache_path('content_format', 'model');
         $form_format = new form_format($model_r['modelid']);
         $data = $form_format->execute($data);
         foreach ($data as $_key => $_value) {
             if ($_key == 'downfile') {
                 continue;
             }
             ${$_key} = $_value['data'];
         }
         $_groupid = get_cookie('_groupid');
         if (!empty($groups)) {
             $groups_arr = explode(',', $groups);
             if (!in_array($_groupid, $groups_arr)) {
                 MSG('您所在到会员组没有下载权限');
             }
         }
         $seo_title = $title . '下载_' . $siteconfigs['sitename'];
     } else {
         $seo_title = '文件下载_' . $siteconfigs['sitename'];
     }
     include T('content', 'download', TPLID);
 }
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
function main()
{
    // start timer
    $timeparts = explode(' ', microtime());
    $starttime = $timeparts[1] . substr($timeparts[0], 1);
    // find source image
    if (isset($_GET['src'])) {
        $image = get_image_path($_GET['src']);
    } else {
        header('HTTP/1.1 400 Bad Request');
        die('Error: no image was specified');
    }
    // extract arguments from query string
    if (defined('WIDTH') && defined('HEIGHT')) {
        // prep cache path
        $cache = get_cache_path($image);
        // compute image if needed
        $result = dispatch($image, $cache);
    } elseif (!defined('WIDTH') && !defined('HEIGHT')) {
        $cache = $image;
        $result = 0;
    } else {
        header('HTTP/1.1 400 Bad Request');
        die("ERROR: Both width and height need to be provided");
    }
    if (DEBUG == 1) {
        // show source image for comparison
        render(end(explode('/', $image)), true, 'img');
        echo "<br/>";
    }
    // end timer
    $timeparts = explode(' ', microtime());
    $endtime = $timeparts[1] . substr($timeparts[0], 1);
    $elapsed = bcsub($endtime, $starttime, 6);
    dprint("<br/>Script execution time (s): " . $elapsed);
    // serve out results
    render($cache, DEBUG == 1 ? true : false, FORMAT);
    // log results
    $lf = fopen(LOG_PATH, 'a');
    $logstring = date(DATE_RFC822) . "\n" . $_SERVER["QUERY_STRING"] . "\n{$elapsed} s\n\n";
    fwrite($lf, $logstring);
    fclose($lf);
}
Esempio n. 4
0
function main()
{
    // start timer
    $timeparts = explode(' ', microtime());
    $starttime = $timeparts[1] . substr($timeparts[0], 1);
    // find source image
    if (isset($_GET['src'])) {
        $image = get_image_path($_GET['src']);
    } else {
        header('HTTP/1.1 400 Bad Request');
        die('Error: no image was specified');
    }
    // extract the commands from the query string
    // eg.: cmd=resize(....)+flip+blur(...)
    if (isset($_GET['cmd'])) {
        preg_match_all('/\\+*(([a-z\\-]+[0-9]*)(\\(([^\\)]*)\\))?)\\+*/', $_GET['cmd'], $cmds, PREG_SET_ORDER);
        // prep cache path
        $cache = get_cache_path($image, $cmds, FORMAT);
        // compute image if needed
        $result = dispatch($image, $cache, $cmds);
    } else {
        $cache = $image;
        $result = 0;
    }
    if (DEBUG == 1) {
        // show source image for comparison
        render(end(explode('/', $image)), true, 'img');
        echo "<br/>";
    }
    // end timer
    $timeparts = explode(' ', microtime());
    $endtime = $timeparts[1] . substr($timeparts[0], 1);
    $elapsed = bcsub($endtime, $starttime, 6);
    dprint("<br/>Script execution time (s): " . $elapsed);
    // serve out results
    render($cache, DEBUG == 1 ? true : false, FORMAT);
    // log results
    $lf = fopen(LOG_PATH, 'a');
    $logstring = date(DATE_RFC822) . "\n" . $_SERVER["QUERY_STRING"] . "\n{$elapsed} s\n\n";
    fwrite($lf, $logstring);
    fclose($lf);
}
Esempio n. 5
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);
     }
 }
Esempio n. 6
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');
     }
 }
Esempio n. 7
0
/**
 * 获取缓存内容
 * @param $filename 文件名
 * @param string $dir 读取目录名,文件缓存路径:/caches/$dir
 * @return mixed|string
 */
function get_cache($filename, $dir = '_cache_')
{
    $file = get_cache_path($filename, $dir);
    if (!file_exists($file)) {
        return '';
    }
    $data = (include $file);
    return $data;
}
Esempio n. 8
0
 public function show()
 {
     load_function('common', 'member');
     $siteconfigs = $this->siteconfigs;
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : MSG(L('parameter_error'));
     $categorys = get_cache('category', 'content');
     //查询数据
     $models = get_cache('model_guestbook', 'model');
     $model_r = $models[15];
     $master_table = $model_r['master_table'];
     $data = $this->db->get_one($master_table, array('id' => $id));
     require get_cache_path('content_format', 'model');
     $form_format = new form_format($model_r['modelid']);
     $data = $form_format->execute($data);
     foreach ($data as $_key => $_value) {
         ${$_key} = $_value['data'];
     }
     $_template = TPLID . ':show';
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : 'default';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $seo_title = $title . '_' . $siteconfigs['sitename'];
     $seo_keywords = !empty($keywords) ? implode(',', $keywords) : '';
     $seo_description = $remark;
     $this->db->update($master_table, "`hits`=(`hits`+1)", array('id' => $id));
     include T('guestbook', 'show');
 }
Esempio n. 9
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. 10
0
$db = load_class('db');
$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增加到数据库
Esempio n. 11
0
 public function load_formatcache()
 {
     require get_cache_path('content_format', 'model');
     $this->form_format = new form_format($this->category['modelid']);
 }
Esempio n. 12
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');
     }
 }
Esempio n. 13
0
function get_cache_file($url)
{
    return get_cache_path() . '/' . amr_get_cache_filename($url);
}
Esempio n. 14
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. 15
0
 /**
  * 内容预览
  */
 public function view()
 {
     load_function('content', 'content');
     $siteconfigs = get_cache('siteconfigs');
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : MSG(L('parameter_error'));
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : MSG(L('parameter_error'));
     $categorys = get_cache('category', 'content');
     //查询数据
     $category = get_cache('category_' . $cid, 'content');
     if (empty($category)) {
         MSG('栏目不存在');
     }
     $models = get_cache('model_content', 'model');
     $model_r = $models[$category['modelid']];
     $siteid = $category['siteid'];
     $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);
     } else {
         $modelid = $model_r['modelid'];
     }
     $model_r = $models[$modelid];
     require get_cache_path('content_format', 'model');
     $form_format = new form_format($modelid);
     $data = $form_format->execute($data);
     foreach ($data as $_key => $_value) {
         ${$_key} = $_value['data'];
     }
     if ($template) {
         $_template = $template;
     } elseif ($model_r['template']) {
         $template_set = unserialize($model_r['template_set']);
         $_template = $template_set[$siteid];
     } else {
         $_template = TPLID . ':show';
     }
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : '1';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $elasticid = elasticid($cid);
     $seo_title = $title . '_' . $category['name'] . '_' . $siteconfigs['sitename'];
     $seo_keywords = !empty($keywords) ? implode(',', $keywords) : '';
     $seo_description = $remark;
     //上一页
     $previous_page = $this->db->get_one($master_table, "`cid` = '{$cid}' AND `id`<'{$id}' AND `status`=9", '*', 0, 'id DESC');
     //下一页
     $next_page = $this->db->get_one($master_table, "`cid`= '{$cid}' AND `id`>'{$id}' AND `status`=9", '*', 0, 'id ASC');
     include T('content', $_template, $project_css);
     include $this->template('check_foot');
 }
function prepare_markdown_template($path = null)
{
    if (is_null($path)) {
        $path = get_cache_path(settings('mde_template_filename'));
    }
    if (!file_exists($path) || filemtime($path) < filemtime(settings('user_config_filename'))) {
        $html5_quick_template = get_demo_builder_file_path(settings('html5_quick_template'));
        $mde_opts = settings('mde_settings');
        $opts = array_merge(settings(), $mde_opts);
        $opts['settings'] = array_merge(settings('hqt_settings'), $mde_opts['hqt_settings']);
        $ctt = get_view($html5_quick_template, $opts);
        if (false === file_put_contents($path, $ctt)) {
            throw new ErrorException(sprintf('Cannot write template file "%s"!', $path));
        }
    }
    return true;
}
Esempio n. 17
0
 /**
  * 内容页面
  * url规则 /index.php?v=show&cid=24&id=79
  */
 public function show()
 {
     $siteconfigs = $this->siteconfigs;
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : MSG(L('parameter_error'));
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : MSG(L('parameter_error'));
     if ($cid == 0) {
         MSG(L('parameter_error'));
     }
     $categorys = get_cache('category', 'content');
     //查询数据
     $category = get_cache('category_' . $cid, 'content');
     $models = get_cache('model_content', 'model');
     if (!$category) {
         MSG(L('parameter_error'));
     }
     $model_r = $models[$category['modelid']];
     if (!$model_r) {
         MSG(L('parameter_error'));
     }
     $master_table = $model_r['master_table'];
     $data = $this->db->get_one($master_table, array('id' => $id));
     if (!$data || $data['status'] != 9) {
         MSG('信息不存在或者未通过审核!');
     }
     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);
     } else {
         $modelid = $model_r['modelid'];
     }
     $data_r = $data;
     $urlrule = $category['showurl'];
     if ($category['showhtml']) {
         $urlrules = explode('|', $urlrule);
         $urlrule = WWW_PATH . $urlrules[0] . '|' . WWW_PATH . $urlrules[1];
     }
     require get_cache_path('content_format', 'model');
     $form_format = new form_format($modelid);
     $data = $form_format->execute($data);
     foreach ($data as $_key => $_value) {
         ${$_key} = $_value['data'];
     }
     if ($template) {
         $_template = $template;
     } elseif ($category['show_template']) {
         $_template = $category['show_template'];
     } elseif ($model_r['template']) {
         $_template = TPLID . ':' . $model_r['template'];
     } else {
         $_template = TPLID . ':show';
     }
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : 'default';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $addtime = $data_r['addtime'];
     $elasticid = elasticid($cid);
     $seo_title = $title . '_' . $category['name'] . '_' . $siteconfigs['sitename'];
     $seo_keywords = !empty($keywords) ? implode(',', $keywords) : '';
     $seo_description = $remark;
     //上一页
     $previous_page = $this->db->get_one($master_table, "`cid`= '{$cid}' AND `id`>'{$id}' AND `status`=9", '*', 0, 'id ASC');
     //下一页
     $next_page = $this->db->get_one($master_table, "`cid` = '{$cid}' AND `id`<'{$id}' AND `status`=9", '*', 0, 'id DESC');
     //手动分页
     $CONTENT_POS = strpos($content, '_wuzhicms_page_tag_');
     if (!empty($content) && $CONTENT_POS !== false) {
         $page = max($GLOBALS['page'], 1);
         $contents = array_filter(explode('_wuzhicms_page_tag_', $content));
         $pagetotal = count($contents);
         $content = $contents[$page - 1];
         $tmp_year = date('Y', $addtime);
         $tmp_month = date('m', $addtime);
         $tmp_day = date('d', $addtime);
         $content_pages = pages($pagetotal, $page, 1, $urlrule, array('categorydir' => $category['parentdir'], 'year' => $tmp_year, 'month' => $tmp_month, 'day' => $tmp_day, 'catdir' => $category['catdir'], 'cid' => $cid, 'id' => $id));
     } else {
         $content_pages = '';
     }
     include T('content', $_template, $project_css);
 }
load_user_config();
$cfg = settings('user_config');
// request args
if (!IS_CLI) {
    settings(array('arg_ln' => isset($_GET['ln']) ? $_GET['ln'] : settings('default_language'), 'arg_page' => isset($_GET['page']) ? $_GET['page'] : settings('default_page'), 'arg_action' => isset($_GET['action']) ? $_GET['action'] : null));
}
// distribute
if (is_null($action = settings('arg_action'))) {
    $content = load_page(settings('arg_page'));
    echo $content;
} else {
    switch ($action) {
        case 'template':
            $path = settings('output_path');
            if (empty($path)) {
                $path = get_cache_path(settings('mde_template_filename'));
            }
            $unlinked = file_exists($path) ? unlink($path) : true;
            if ($unlinked && prepare_markdown_template($path)) {
                ok(sprintf('template file created at "%s"', $path));
            } else {
                error(sprintf('template file NOT created! (check user rights on file "%s")', $path));
            }
            break;
        case 'flush':
            if (flush_cache()) {
                ok(sprintf('app-cache has been flushed at "%s"', settings('temporary_directory')));
            } else {
                error(sprintf('app-cache has NOT been flushed! (check user rights on directory "%s")', settings('temporary_directory')));
            }
            break;
Esempio n. 19
0
 public function delete()
 {
     $modelid = intval($GLOBALS['modelid']);
     $r = $this->db->get_one('model', array('modelid' => $modelid));
     if ($r) {
         $this->db->delete('model', array('modelid' => $modelid));
         $this->db->delete('model_field', array('modelid' => $modelid));
         if ($r['share_model'] == 0) {
             $this->db->query("DROP TABLE " . $this->db->tablepre . $r['master_table']);
         }
         if ($r['attr_table']) {
             $this->db->query("DROP TABLE " . $this->db->tablepre . $r['attr_table']);
         }
         $path = get_cache_path('field_' . $modelid, 'model');
         if (file_exists($path)) {
             @unlink($path);
         }
     }
     MSG(L('delete success'), '?m=core&f=model&v=model_listing' . $this->su());
 }
Esempio n. 20
0
 /**
  * 查看用户信息
  */
 public function view()
 {
     $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['modelid']) && $GLOBALS['modelid'] != $member['modelid']) {
         $modelid = (int) $GLOBALS['modelid'];
     } else {
         $modelid = $member['modelid'];
     }
     //	判断是否有模型id参数
     if ($modelid) {
         require get_cache_path('content_format', 'model');
         $form_format = new form_format($modelid);
         $data = $form_format->execute($member);
     }
     $fields = $form_format->fields;
     $fields['mobile']['name'] = '手机';
     $fields['email']['name'] = 'email';
     $fields['username']['name'] = '用户名';
     $fields['truename']['name'] = '真是姓名';
     $fields['money']['name'] = '拥有金额';
     $fields['points']['name'] = '积分';
     $fields['identity_card']['name'] = '身份证号';
     $fields['address']['name'] = '地址';
     $fields['livecity']['name'] = '居住城市';
     $group = $this->group;
     include $this->template('member_view', M);
 }
Esempio n. 21
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');
     }
 }