public function index() { //得到最新的经营方针 $list = M("policy")->field("text")->limit(1)->order("date desc")->select(); //得到最新信息 $infolist = M("infopublish")->field("id,title")->limit(5)->order("startdt desc")->select(); //得到Menu //select a.id,if(b.coun>0,'true','false') cc from sii_menu a //left join (select pid ,count(1) coun from sii_menu group by pid) b //on a.id=b.pid if (!session('uid')) { $menulist = M("menu")->table("__MENU__ a")->join("(select pid ,count(1) coun from __MENU__ group by pid) b on(a.id=b.pid)")->field("a.*,if(b.coun>0,'true','false') cc")->select(); } else { $menulist = M("menu")->table("__MENU__ a")->join("(select pid ,count(1) coun from __MENU__ group by pid) b on(a.id=b.pid)")->field("a.*,if(b.coun>0,'true','false') cc")->select(); } //$menubta = new BuildTreeArray($menulist,'id','pid',0); //$menudata = $menubta->getTreeArray(); //$menupids=array_column($menulist,'pid'); //var_dump($menupids); //die(); //$this->assign('menupidlist',$menupids); $this->assign('menulist', $menulist); $this->assign('infolist', $infolist); $this->assign('Policy', html_out($list[0]["text"])); $this->display(); }
public function get_remote_image() { $content = $_POST['content']; if (empty($content)) { $this->msg('没有获取到内容!', 0); } //文件路径 $file_path = __ROOTDIR__ . '/upload/' . date('Y-m') . '/' . date('d') . '/'; //文件URL路径 $file_url = __ROOTURL__ . '/upload/' . date('Y-m') . '/' . date('d') . '/'; $body = html_out($content); $img_array = array(); preg_match_all("/(src|SRC)=[\"|'| ]{0,}(http:\\/\\/(.*)\\.(gif|jpg|jpeg|bmp|png))/isU", $body, $img_array); $img_array = array_unique($img_array[2]); set_time_limit(0); $milliSecond = date("dHis") . '_'; if (!is_dir($file_path)) { @mkdir($file_path, 0777, true); } foreach ($img_array as $key => $value) { $value = trim($value); $ext = explode('.', $value); $ext = end($ext); $get_file = @Http::doGet($value, 5); $rndFileName = $file_path . $milliSecond . $key . '.' . $ext; $fileurl = $file_url . $milliSecond . $key . '.' . $ext; if ($get_file) { $status = @file_put_contents($rndFileName, $get_file); if ($status) { $body = str_replace($value, $fileurl, $body); } } } $this->msg($body, 1); }
/** * 获取数据 * * @see PluginWechatController::show() */ public function show($fromusername, $info) { $articles = array('type' => 'text', 'content' => '暂时不能绑定'); $media = array(); $config = unserialize($info['config']); // 素材 if (!empty($config['media_id'])) { $media = model('Base')->model->table('wechat_media')->field('id, title, file, file_name, type, content, add_time, article_id, link')->where('id = ' . $config['media_id'])->find(); // 单图文 if (empty($media['article_id'])) { $media['content'] = strip_tags(html_out($media['content'])); } } if (!empty($media)) { $articles = array(); // 数据 $articles['type'] = 'news'; $articles['content'][0]['Title'] = $media['title']; $articles['content'][0]['Description'] = $media['content']; // 不是远程图片 if (!preg_match('/(http:|https:)/is', $media['file'])) { $articles['content'][0]['PicUrl'] = __URL__ . '/' . $media['file']; } else { $articles['content'][0]['PicUrl'] = $media['file']; } $articles['content'][0]['Url'] = html_out($media['link']); // 积分赠送 $this->give_point($fromusername, $info); } return $articles; }
/** * 编辑活动 */ public function edit() { $id = I('id'); if (IS_POST) { $data = I('data'); if ($_FILES['act_banner']['name']) { $result = $this->ectouchUpload('act_banner', 'banner_image'); if ($result['error'] > 0) { $this->message($result['message'], NULL, 'error'); } /* 生成banner链接 */ $data2['act_banner'] = substr($result['message']['act_banner']['savepath'], 2) . $result['message']['act_banner']['savename']; $this->model->table('touch_activity')->data($data2)->where('act_id=' . $id)->update(); } $this->message(L('edit_favourable_ok'), url('index')); } /* 查询附表信息 */ $touch_result = $this->model->table('touch_activity')->where('act_id=' . $id)->find(); $favourable = model('GoodsBase')->favourable_info($id); /* 附表信息不存在则生成 */ if (empty($touch_result)) { $data['act_id'] = $id; $this->model->table('touch_activity')->data($data)->insert(); } else { $favourable['act_banner'] = $touch_result['act_banner']; $favourable['act_content'] = html_out($touch_result['act_content']); } /* 模板赋值 */ $this->assign('favourable', $favourable); $this->assign('ur_here', L('edit_favourable')); $this->assign('action_link', array('text' => L('06_goods_brand_list'), 'href' => url('index'))); $this->display(); }
public function index() { //从languages目录下获取语言项文件 - 默认是前台模板语言包 $lang_arr = array(); $lang_path = APP_PATH . 'default/language/' . C('lang'); $lang_dir = @opendir($lang_path); while ($file = @readdir($lang_dir)) { if (substr($file, -3) == "php") { $filename = substr($file, 0, -4); $language_files = L('language_files'); $lang_arr[$filename] = $file . ' - ' . @$language_files[$filename]; } } ksort($lang_arr); @closedir($lang_dir); // print_r($lang_arr); /* 获得需要操作的语言包文件 */ $lang_file = isset($_POST['lang_file']) ? trim($_POST['lang_file']) : ''; if ($lang_file == 'common') { $file_path = $lang_path . '/common.php'; } else { $file_path = $lang_path . '/user.php'; } $file_attr = ''; if (file_mode_info($file_path) < 7) { $file_attr = $lang_file . '.php:' . L('file_attribute'); } /* 搜索的关键字 */ $keyword = !empty($_POST['keyword']) ? trim(stripslashes($_POST['keyword'])) : ''; /* 调用函数 */ $language_arr = $this->get_language_item_list($file_path, $keyword); foreach ($language_arr as $key => $value) { $language_arr[$key]['item_content'] = html_out($language_arr[$key]['item_content']); } // echo '<pre>'; // print_r($language_arr); // echo '</pre>'; /* 模板赋值 */ $this->assign('ur_here', L('edit_languages')); $this->assign('keyword', $keyword); //关键字 $this->assign('action_link', array()); $this->assign('file_attr', $file_attr); //文件权限 $this->assign('lang_arr', $lang_arr); //语言文件列表 $this->assign('file_path', $file_path); //语言文件 $this->assign('lang_file', $lang_file); //语言文件 $this->assign('language_arr', $language_arr); //需要编辑的语言项列表 // assign_query_info(); $this->display('language_list'); }
public function index() { $cid = intval($_GET['cid']); if (empty($cid)) { $this->error404(); } //读取栏目信息 $info = model('category')->info($cid); if (!is_array($info)) { $this->error404(); } //模块自动纠正 model('category')->model_jump($info['mid'], 'pages'); /*hook*/ $this->plus_hook('category', 'index', $info); $this->info = $this->plus_hook_replace('category', 'index_replace', $this->info); /*hook end*/ //位置导航 $this->nav = array_reverse(model('category')->nav($info['cid'])); //查询单页内容 $content = model('pages')->content($info['cid']); if (empty($content['content'])) { $content['content'] = '暂无内容'; } $info['content'] = html_out($content['content']); //读取内容替换 $content = model('content')->format_content($info['content']); //URL路径 $model_info = model('category')->model_info($info['mid']); $url = model('category')->url_format($model_info['url_category_page'], $cid, $info['urlname']); $page = new Page(); $content = $page->contentPage(html_out($content), "<hr class=\"ke-pagebreak\" />", $url, 10, 4); //文章分页 $info['content'] = $content['content']; $this->page = $content['page']; $this->info = $info; //查询上级栏目信息 $this->parent_category = model('category')->info($this->info['pid']); if (empty($this->parent_category)) { $this->parent_category = array("cid" => "0", "pid" => "0", "mid" => "0", "name" => "无上级栏目"); } //MEDIA信息 $this->common = model('pageinfo')->media($this->info['name'], $this->info['keywords'], $this->info['description']); //获取顶级栏目信息 $this->top_category = model('category')->info($this->nav[0]['cid']); $this->display($info['class_tpl']); }
/** * 编辑文章 */ public function edit() { $id = I('id'); if (IS_POST) { $data = I('data'); $data['content'] = I('post.content'); //更新数据库 $touch_result = $this->model->table('touch_article')->where('article_id=' . $id)->find(); if (!empty($touch_result)) { $this->model->table('touch_article')->data($data)->where('article_id=' . $id)->update(); } clear_all_files(); $this->message(L('articleedit_succeed'), url('index')); } $article = $this->model->table('touch_article')->field('*')->where(array('article_id' => $id))->find(); $article['content'] = html_out($article['content']); /* 模板赋值 */ $this->assign('cat_select', model('ArticleBase')->article_cat_list(0, $article['cat_id'])); $this->assign('article', $article); $this->assign('ur_here', L('articlecat_edit')); $this->display(); }
public function index() { $cid = intval($_GET['cid']); if (empty($cid)) { $this->error404(); } //读取栏目信息 $info = model('category')->info($cid); if (empty($info)) { $this->error404(); } //模块自动纠正 model('category')->model_jump($info['mid'], 'jump'); /*hook*/ $this->plus_hook('jump', 'index', $info); /*hook end*/ //读取附加表 $jump = model('jump')->info($cid); $link = $this->return_tpl(html_out($jump['url'])); header("HTTP/1.1 301 Moved Permanently"); header("Location: " . $link . ""); exit; }
/** * 获得文章分类下的文章列表 * * @access public * @param integer $cat_id * @param integer $page * @param integer $size * @return array */ public function get_cat_articles($cat_id, $page = 1, $size = 20, $requirement = '') { // 取出所有非0的文章 if ($cat_id == '-1') { $cat_str = 'cat_id > 0'; } else { $cat_str = get_article_children($cat_id); } $condition = 'is_open = 1 AND ' . $cat_str; // 增加搜索条件,如果有搜索内容就进行搜索 if ($requirement != '') { $condition .= ' AND title like \'%' . $requirement . '%\''; } $limit = ($page - 1) * $size . ',' . $size; //liugu--添加content $list = $this->select($condition, 'article_id, title, author, add_time,cat_id, content,file_url, open_type', ' article_id DESC', $limit); $i = 1; $arr = array(); if (is_array($list)) { foreach ($list as $vo) { $article_id = $vo['article_id']; $arr[$article_id]['id'] = $article_id; $arr[$article_id]['index'] = $i; $arr[$article_id]['title'] = $vo['title']; $arr[$article_id]['short_title'] = C('article_title_length') > 0 ? sub_str($vo['title'], C('article_title_length')) : $vo['title']; $arr[$article_id]['author'] = empty($vo['author']) || $vo['author'] == '_SHOPHELP' ? C('shop_name') : $vo['author']; $arr[$article_id]['url'] = $vo['open_type'] != 1 ? build_uri('article/info', array('aid' => $article_id)) : trim($vo['file_url']); $arr[$article_id]['add_time'] = date(C('date_format'), $vo['add_time']); $arr[$article_id]['cat_id'] = $vo['cat_id']; //liugu--添加content $arr[$article_id]['content'] = html_out($vo['content']); //liugu--添加content $i++; } } return $arr; }
/** * 删除品牌 */ public function del() { $id = I('id'); /* 删除该品牌的图标 */ $sql = "SELECT a.brand_logo,b.brand_banner,b.brand_content FROM " . $this->model->pre . "brand as a left join " . $this->model->pre . "touch_brand as b on a.brand_id = b.brand_id WHERE a.brand_id = '$id'"; $result = $this->model->query($sql); $brand_logo = $result[0]['brand_logo']; $brand_banner = $result[0]['brand_banner']; $brand_content = html_out($result[0]['brand_content']); //删除编辑器中的附件 preg_match_all("/(src|href)\=\"\/(.*?)\"/i", $brand_content, $match); if (is_array($match[2])) { foreach ($match[2] as $vo) { $index = strpos($vo, 'data/'); @unlink(ROOT_PATH . substr($vo, $index)); } } //删除logo if (!empty($brand_logo)) { $index = strpos($brand_logo, 'data/'); @unlink(ROOT_PATH . substr($brand_logo, $index)); } //删除广告位 if (!empty($brand_banner)) { $index = strpos($brand_banner, 'data/'); @unlink(ROOT_PATH . substr($brand_banner, $index)); } //更新商品的品牌编号 $this->model->table('goods')->data('brand_id=0')->where('brand_id=' . $id)->update(); //删除品牌 $condition['brand_id'] = $id; $this->model->table('brand')->where($condition)->delete(); $this->model->table('touch_brand')->where($condition)->delete(); clear_all_files(); $this->message(L('drop_succeed'), url('index')); }
<input type="submit" class="btn btn-warning" value="Покинуть комнату"> </form> </div> <br><br><br> </div> <div class="row text-center"> <form id="mes_form" class="form-group text-center"> <div> <table> <tr> <td> <input type="text" id="input_mes" size="70" maxlength="250" placeholder="Введите сообщение" class="form-control"> </td> <td> <label style="font-size: large; font-weight: bold" for id="send"> <?php html_out($_SESSION['name']); ?> </label> <input type="submit" class="btn btn-primary" id="send" value="Отправить сообщение"> </td> </tr> </table> </div> </form> </div> <?php } else { ?> <div class="col-lg-4 text-right"> <p><?php include $_SERVER['DOCUMENT_ROOT'] . '/reg_log/logout.inc.html.php';
<?php session_start(); ?> <select class="form-control" id="users_on" form="add_form" name="users[]" multiple required size='2'> <?php foreach ($res_user_select as $row) { ?> <?php if ($_SESSION['name'] == $row['user']) { ?> <option class="form-control" disabled><?php html_out($row['user']); ?> </option> <?php } else { ?> <option class="form-control" value="<?php html_out($row['user']); ?> "><?php html_out($row['user']); ?> </option> <?php } } ?> </select>
public function get_field_html($info, $data = null) { $info['default'] = html_out($info['default']); if (!empty($data)) { $info['default'] = $data; } $html = ''; switch ($info['type']) { case '1': $html .= ' <tr> <td align="right">' . $info['name'] . '</td> <td> <input name="' . $info['field'] . '" type="text" class="text_value" id="' . $info['field'] . '" value="' . $info['default'] . '" '; if (!empty($info['must'])) { $html .= ' reg="\\S" msg="' . $info['name'] . '不能为空!" '; } $html .= '/> </td> <td>' . $info['tip'] . '</td> </tr> '; break; case '2': $html .= ' <tr> <td align="right">' . $info['name'] . '</td> <td><textarea name="' . $info['field'] . '" class="text_textarea" id="' . $info['field'] . '" >' . $info['default'] . '</textarea> </td> <td>' . $info['tip'] . '</td> </tr> '; break; case '3': $html .= ' <tr> <td align="right">' . $info['name'] . '</td> <td colspan="2"><textarea name="' . $info['field'] . '" style="width:100%; height:350px;" id="' . $info['field'] . '">' . $info['default'] . '</textarea> ' . module('editor')->get_editor_upload($info['field'] . '_upload', 'editor_' . $info['field']) . ' <input type="button" id="' . $info['field'] . '_upload" class="button_small" style="margin-top:10px;" value="上传图片和文件到编辑器" /> </td> </tr> '; $html .= module('editor')->get_editor($info['field'], true); break; case '4': $html .= ' <tr> <td align="right">' . $info['name'] . '</td> <td> <input name="' . $info['field'] . '" type="text" class="text_value" style="width:200px; float:left" id="' . $info['field'] . '" value="' . $info['default'] . '" '; if (!empty($info['must'])) { $html .= ' reg="\\S" msg="' . $info['name'] . '不能为空!" '; } $html .= '/> <input type="button" id="' . $info['field'] . '_botton" class="button_small" value="选择文件" /> </td> <td>' . $info['tip'] . '</td> </tr> '; $html .= module('editor')->get_file_upload($info['field'] . '_botton', $info['field'], true); break; case '10': $html .= ' <tr> <td align="right">' . $info['name'] . '</td> <td> <input name="' . $info['field'] . '" type="text" class="text_value" style="width:200px; float:left" id="' . $info['field'] . '" value="' . $info['default'] . '" '; if (!empty($info['must'])) { $html .= ' reg="\\S" msg="' . $info['name'] . '不能为空!" '; } $html .= '/> <input type="button" id="' . $info['field'] . '_botton" class="button_small" value="选择图片" /> </td> <td>' . $info['tip'] . '</td> </tr> '; $html .= module('editor')->get_image_upload($info['field'] . '_botton', $info['field'], true); break; case '5': $html .= ' <tr> <td align="right">' . $info['name'] . '</td> <td colspan="2"> <input type="button" id="' . $info['field'] . '_button" class="button_small" value="上传多图" /> <div class="fn_clear"></div> <div class="images"> <ul id="' . $info['field'] . '_list" class="images_list">'; if (!empty($data)) { $info['default'] = unserialize($info['default']); if (!empty($info['default'])) { foreach ($info['default'] as $value) { $html .= "<li>\r\n <div class='pic' id='images_button'>\r\n <img src='" . $value['url'] . "' width='125' height='105' />\r\n <input id='" . $info['field'] . "[]' name='" . $info['field'] . "[]' type='hidden' value='" . $value['url'] . "' />\r\n <input id='" . $info['field'] . "_original[]' name='" . $info['field'] . "_original[]' type='hidden' value='" . $value['original'] . "' />\r\n </div>\r\n <div class='title'>标题: <input name='" . $info['field'] . "_title[]' type='text' id='" . $info['field'] . "_title[]' value='" . $value['title'] . "' /></div>\r\n <div class='title'>排序: <input id='" . $info['field'] . "_order[]' name='" . $info['field'] . "_order[]' value='" . $value['order'] . "' type='text' style='width:50px;' /> <a href='javascript:void(0);' onclick='\$(this).parent().parent().remove()'>删除</a></div>\r\n </li>"; } } } $html .= "</ul>\r\n <div style='clear:both'></div>\r\n </div>\r\n </td>\r\n </tr>\r\n "; $html .= module('editor')->get_images_upload($info['field'], $ajax = true); break; case '6': $html .= '<tr>'; $html .= '<td align="right">'; $html .= $info['name']; $html .= '</td>'; $html .= '<td>'; $select_list = '<select name="' . $info['field'] . '" id="' . $info['field'] . '">'; $list = explode("\n", html_out($info['config'])); foreach ($list as $key) { $value = explode('|', $key); $select_list .= '<option '; if ($info['default'] == $value[1]) { $select_list .= 'selected="selected" '; } $select_list .= ' value="' . $value[1] . '">' . $value[0] . '</option>'; } $select_list .= '</select>'; $html .= $select_list; $html .= '</td>'; $html .= '<td>'; $html .= $info['tip']; $html .= '</td>'; $html .= '</tr>'; break; case '7': $config = explode("\n", $info['config']); if (empty($config[0])) { $config[0] = 'Y-m-d H:i:s'; } if (empty($config[1])) { $config[1] = 'yyyy-MM-dd HH:mm:ss'; } if ($data) { $info['default'] = date($config[0], intval($info['default'])); } else { $info['default'] = date($config[0]); } $html .= '<tr>'; $html .= '<td align="right">'; $html .= $info['name']; $html .= '</td>'; $html .= '<td>'; $html .= '<input name="' . $info['field'] . '" id="' . $info['field'] . '" type="text" class="text_value" style="width:210px; float:left" value="' . $info['default'] . '"'; if ($info['must'] == 1) { $html .= ' reg="\\S" msg="' . $info['name'] . '不能为空" '; } $html .= '/><div id="' . $info['field'] . '_button" class="time"></div></td>'; $html .= '<td>'; $html .= $info['tip']; $html .= '</td>'; $html .= '</tr>'; $html .= '<script>'; $html .= "\$('#" . $info['field'] . "_button').calendar({ id:'#" . $info['field'] . "',format:'" . $config[1] . "'});"; $html .= '</script>'; break; case '8': $html .= '<tr>'; $html .= '<td align="right">'; $html .= $info['name']; $html .= '</td>'; $html .= '<td>'; $list = explode("\n", html_out($info['config'])); foreach ($list as $key) { $value = explode('|', $key); $select_list .= '<input name="' . $info['field'] . '" type="radio" value="' . $value[1] . '" '; if ($info['default'] == '') { $info['default'] = 1; } if ($info['default'] == $value[1]) { $select_list .= 'checked="checked" '; } $select_list .= ' /> ' . $value[0] . ' '; } $html .= $select_list; $html .= '</td>'; $html .= '<td>'; $html .= $info['tip']; $html .= '</td>'; $html .= '</tr>'; break; case '9': $html .= '<tr>'; $html .= '<td align="right">'; $html .= $info['name']; $html .= '</td>'; $html .= '<td>'; $list = explode("\n", html_out($info['config'])); if (!empty($data)) { $default = unserialize($info['default']); } else { $default = explode('|', $info['default']); } foreach ($list as $key) { $value = explode('|', $key); $select_list .= '<input name="' . $info['field'] . '[]" type="checkbox" value="' . $value[1] . '" '; if ($default != '') { if (in_array($value[1], $default)) { $select_list .= 'checked="checked" '; } } $select_list .= ' /> ' . $value[0] . ' '; } $html .= $select_list; $html .= '</td>'; $html .= '<td>'; $html .= $info['tip']; $html .= '</td>'; $html .= '</tr>'; break; } return $html; }
background-color: lightskyblue; } </style> </head> <body> <div class="container"> <div class="row text-center"> <img src="/img/logo.png"> </div> <div class="row"> <h1 class="h1 text-center">Общайтесь прямо сейчас!</h1> <?php if (isset($loginError) && $loginError != '') { ?> <p class="h3 text-center"><?php html_out($loginError); ?> </p> <?php } ?> <div class="col-lg-4 text-center"></div> <div class="col-lg-4 text-center"> <form role="form" class="form-group" action="" method="post"> <h3 class="panel-heading">Пожалуйста авторизируйтесь, чтобы войти в чат.</h3> <div> <label for="name">Введите Ваше имя: </label> <input class="form-control" placeholder="Введите имя" type="text" name="name" id="name" required > </div> <div> <label for="password">Введите пароль: </label>
</head> <body> <div class="container"> <div class="row text-center"> <img src="/img/logo.png"> </div> <div class="row"> <h1 class="h1 text-center">Общайтесь прямо сейчас!</h1> <div class="col-lg-4 text-center"></div> <div class="col-lg-4 text-center"> <p class="h4">Введите корректные данные для регистрации в чате!</p> <?php if (isset($regError)) { ?> <br/><p class="h3 has-error text-center"><?php html_out($regError); ?> </p><br/> <?php } ?> <form role="form" class="form-group" action="?" method="post"> <div> <label for="name">Введите Ваше имя: </label> <input class="form-control" placeholder="Введите желаемое имя" type="text" name="name" id="name" required> </div> <div> <label for="password">Введите пароль: </label> <input class="form-control" type="password" placeholder="Введите пароль" name="password" id="password" required > </div> <div>
public function index() { $aid = intval($_GET['aid']); if (empty($aid)) { $this->error404(); } $info = model('content')->info($aid); if (!is_array($info) || $info['status'] == 0) { $this->error404(); } //判断跳转 if (!empty($info['url'])) { $link = $this->display(html_out($info['url']), true, false); header("HTTP/1.1 301 Moved Permanently"); header("Location: " . $link . ""); exit; } //查询栏目的信息 $this->category = model('category')->info($info['cid']); //模块自动纠正 model('content')->model_jump($this->category['mid'], 'content'); $model_info = model('category')->model_info($this->category['mid']); //位置导航 $this->nav = array_reverse(model('category')->nav($this->category['cid'])); //查询上级栏目信息 $this->parent_category = model('category')->info($this->category['pid']); if (!$this->parent_category) { $this->parent_category = array("cid" => "0", "pid" => "0", "mid" => "0", "name" => "无上级栏目"); } //获取顶级栏目信息 $this->top_category = model('category')->info($this->nav[0]['cid']); //读取完整内容信息 $info = model('content')->model_content($info['aid'], $this->category['expand']); //更新访问计数 model('content')->views_content($info['aid'], $info['views']); //读取内容信息 $info_content = model('content')->info_content($info['aid']); if (empty($info_content['content'])) { $info_content['content'] = '暂无内容'; } $content = $info_content['content']; //读取内容替换 if (!empty($content)) { $content = model('content')->format_content($content); } //自动增加TAG链接 if (!empty($content) && $info['taglink']) { $content = model('content')->tag_link($content, $info['aid']); } //MEDIA信息 $this->common = model('pageinfo')->media($info['title'] . ' - ' . $this->category['name'], $info['keywords'], $info['description']); //内容分页 $url = model('content')->url_format($model_info['url_content_page'], $aid, $this->category['urlname'], $info); $page = new Page(); $content = $page->contentPage(html_out($content), "<hr class=\"ke-pagebreak\" />", $url, 10, 4); //文章分页 $info['content'] = $content['content']; $this->page = $content['page']; /*hook*/ $this->plus_hook('content', 'index', $this->info); $this->info = $this->plus_hook_replace('content', 'index_replace', $this->info); /*hook end*/ $this->info = $info; //上下篇 $prev = model('content')->prev_content($aid, $this->category['cid'], $this->category['expand']); $this->assign('prev', $prev); //下一篇 $next = model('content')->next_content($aid, $this->category['cid'], $this->category['expand']); $this->assign('next', $next); if (empty($info['tpl'])) { $this->display($this->category['content_tpl']); } else { $this->display($info['tpl']); } }
/** * 删除专题 */ public function del() { $id = I('id'); if (!$id) { $this->redirect(url('index')); } /* 删除该品牌的图标 */ $topic = $this->model->table('touch_topic')->field('*')->where('topic_id = ' . $id)->find(); $topic_img = $topic['topic_img']; $title_pic = $topic['title_pic']; $intro = html_out($topic['intro']); //删除编辑器中的附件 $match = array(); preg_match_all("/(src|href)\\=\"\\/(.*?)\"/i", $intro, $match); if (is_array($match[2])) { foreach ($match[2] as $vo) { $index = strpos($vo, 'data/'); @unlink(ROOT_PATH . substr($vo, $index)); } } //删除logo if (!empty($topic_img)) { $index = strpos($topic_img, 'data/'); @unlink(ROOT_PATH . substr($topic_img, $index)); } //删除分类图标 if (!empty($title_pic)) { $index = strpos($title_pic, 'data/'); @unlink(ROOT_PATH . substr($title_pic, $index)); } //删除品牌 $this->model->table('touch_topic')->where(array('topic_id' => $id))->delete(); clear_all_files(); $this->message(L('succed'), url('index')); }
function view_list() { global $now_date, $time_offset, $input; $title = 'User Reputation Manager'; $html = "<h2>View Reputation Comments</h2>"; $html .= "<p>This page allows you to search for reputation comments left by / for specific users over the specified date range.</p>"; $html .= "<form action='reputation_ad.php' name='list_form' method='post'>\r\n\t\t\t\t<input name='mode' value='list' type='hidden' />\r\n\t\t\t\t<input name='dolist' value='1' type='hidden' />"; $html .= "<table width='500px' cellpadding='5px'>"; $html .= "<tr><td width='20%'>Left For</td><td width='80%'><input type='text' name='leftfor' value='' size='35' maxlength='250' tabindex='1' /></td></tr>"; $html .= "<tr><td colspan='2'><div>To limit the comments left for a specific user, enter the username here. Leave this field empty to receive comments left for every user.</div></td></tr>"; $html .= "<tr><td>Left By</td><td><input type='text' name='leftby' value='' size='35' maxlength='250' tabindex='2' /></td></tr>"; $html .= "<tr><td colspan='2'><div>To limit the comments left by a specific user, enter the username here. Leave this field empty to receive comments left by every user.</div></td></tr>"; $html .= "<tr><td>Start Date</td><td>\r\n\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Month<br /><select name='start[month]' tabindex='3'>" . get_month_dropdown(1) . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Day<br /><input type='text' name='start[day]' value='" . ($now_date['mday'] + 1) . "' size='4' maxlength='2' tabindex='3' /></span>\n\t\t\t\t<span>Year<br /><input type='text' name='start[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='3' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>Select a start date for this report. Select a month, day, and year. The selected statistic must be no older than this date for it to be included in the report.</div></td></tr>"; $html .= "<tr><td>End Date</td><td>\n\t\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Month<br /><select name='end[month]' class='textinput' tabindex='4'>" . get_month_dropdown() . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>Day<br /><input type='text' class='textinput' name='end[day]' value='" . $now_date['mday'] . "' size='4' maxlength='2' tabindex='4' /></span>\n\t\t\t\t<span>Year<br /><input type='text' class='textinput' name='end[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='4' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>Select an end date for this report. Select a month, day, and year. The selected statistic must not be newer than this date for it to be included in the report. You can use this setting in conjunction with the 'Start Date' setting to create a window of time for this report.</div></td></tr>"; $html .= "<tr><td colspan='2' align='center'><input type='submit' value='Search' accesskey='s' id='button' tabindex='5' /> <input type='reset' value='Reset' accesskey='r' id='button' tabindex='6' /></td></tr>"; $html .= "</table></form>"; //print $html; exit; // I hate work, but someone has to do it! if (isset($input['dolist'])) { $links = ""; $input['orderby'] = isset($input['orderby']) ? $input['orderby'] : ''; //$cond = ''; //experiment $who = isset($input['who']) ? (int) $input['who'] : 0; $user = isset($input['user']) ? $input['user'] : 0; $first = isset($input['page']) ? intval($input['page']) : 0; $cond = $who ? "r.whoadded=" . sqlesc($who) : ''; $start = isset($input['startstamp']) ? intval($input['startstamp']) : mktime(0, 0, 0, $input['start']['month'], $input['start']['day'], $input['start']['year']) + $time_offset; $end = isset($input['endstamp']) ? intval($input['endstamp']) : mktime(0, 0, 0, $input['end']['month'], $input['end']['day'] + 1, $input['end']['year']) + $time_offset; if (!$start) { $start = time() - 3600 * 24 * 30; } if (!$end) { $end = time(); } if ($start >= $end) { stderr('Time', 'Start date is after the end date.'); } if (!empty($input['leftby'])) { $left_b = @mysql_query("SELECT id FROM users WHERE username = "******"r.whoadded=" . $who; } if (!empty($input['leftfor'])) { $left_f = @mysql_query("SELECT id FROM users WHERE username = "******" AND" : "") . " r.userid=" . $user; } if ($start) { $cond .= ($cond ? " AND" : "") . " r.dateadd >= {$start}"; } if ($end) { $cond .= ($cond ? " AND" : "") . " r.dateadd <= {$end}"; } switch ($input['orderby']) { case 'leftbyuser': $order = 'leftby.username'; $orderby = 'leftbyuser'; break; case 'leftforuser': $order = 'leftfor.username'; $orderby = 'leftforuser'; break; default: $order = 'r.dateadd'; $orderby = 'dateadd'; } $css = "style='font-weight: bold;color: #ffffff;background-color: #0055A4;padding: 5px;'"; $html = "<h2>Reputation Comments</h2>"; $table_header = "<table width='80%' cellpadding='5' border='1'><tr {$css}>"; $table_header .= "<td width='5%'>ID</td>"; $table_header .= "<td width='20%><a href='reputation_ad.php?mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftbyuser&startstamp={$start}&endstamp={$end}&page={$first}'>Left By</a></td>"; $table_header .= "<td width='20%'><a href='reputation_ad.php?mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftforuser&startstamp={$start}&endstamp={$end}&page={$first}'>Left For</a></td>"; $table_header .= "<td width='17%'><a href='reputation_ad.php?mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=date&startstamp={$start}&endstamp={$end}&page={$first}'>Date</a></td>"; $table_header .= "<td width='5%'>Point</td>"; $table_header .= "<td width='23%'>Reason</td>"; $table_header .= "<td width='10%'>Controls</td></tr>"; $html .= $table_header; // do the count for pager etc $query = mysql_query("SELECT COUNT(*) AS cnt FROM reputation r WHERE {$cond}"); //print_r($input); exit; $total = mysql_fetch_assoc($query); if (!$total['cnt']) { $html .= "<tr><td colspan='7' align='center'>No Matches Found!</td></tr>"; } // do the pager thang! $deflimit = 10; $links = "<span style=\"background: #F0F5FA; border: 1px solid #072A66;padding: 1px 3px 1px 3px;\">{$total['cnt']} Records</span>"; if ($total['cnt'] > $deflimit) { require_once "include/pager_alternative.php"; $links = pager(array('TOTAL_POSS' => $total['cnt'], 'PER_PAGE' => $deflimit, 'CUR_ST_VAL' => $first, 'L_SINGLE' => "", 'BASE_URL' => "reputation_ad.php?mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby={$orderby}&startstamp={$start}&endstamp={$end}")); } // mofo query! $query = mysql_query("SELECT r.*, p.topicid, leftfor.id as leftfor_id, \r\n\t\t\t\t\t\t\t\t\tleftfor.username as leftfor_name, leftby.id as leftby_id, \r\n\t\t\t\t\t\t\t\t\tleftby.username as leftby_name \r\n\t\t\t\t\t\t\t\t\tFROM reputation r \r\n\t\t\t\t\t\t\t\t\tleft join posts p on p.id=r.postid \r\n\t\t\t\t\t\t\t\t\tleft join users leftfor on leftfor.id=r.userid \r\n\t\t\t\t\t\t\t\t\tleft join users leftby on leftby.id=r.whoadded \r\n\t\t\t\t\t\t\t\t\tWHERE {$cond} ORDER BY {$order} LIMIT {$first},{$deflimit}"); if (!mysql_num_rows($query)) { stderr('DB ERROR', 'Nothing here'); } while ($r = mysql_fetch_assoc($query)) { $r['dateadd'] = date("M j, Y, g:i a", $r['dateadd']); $html .= "<tr><td>#{$r['reputationid']}</td>"; $html .= "<td><a href='userdetails.php?id={$r['leftby_id']}' target='_blank'>{$r['leftby_name']}</a></td>"; $html .= "<td><a href='userdetails.php?id={$r['leftfor_id']}' target='_blank'>{$r['leftfor_name']}</a></td>"; $html .= "<td>{$r['dateadd']}</td>"; $html .= "<td align='right'>{$r['reputation']}</td>"; $html .= "<td><a href='forums.php?action=viewtopic&topicid={$r['topicid']}&page=p{$r['postid']}#{$r['postid']}' target='_blank'>{$r['reason']}</a></td>"; $html .= "<td><span class='btn'><a href='reputation_ad.php?mode=editrep&reputationid={$r['reputationid']}'>Edit</a></span> <span class='btn'><a href='reputation_ad.php?mode=dodelrep&reputationid={$r['reputationid']}'>Delete</a></span></td>"; } $html .= "</table>"; $html .= "<br /><div>{$links}</div>"; } html_out($html, $title); }
/** * 关键词自动回复 */ public function reply_keywords() { $list = $this->model->table('wechat_reply')->field('id, rule_name, content, media_id, reply_type')->where('type = "keywords" and wechat_id =' . $this->wechat_id)->order('add_time desc')->select(); foreach ((array) $list as $key => $val) { // 内容不是文本 if (!empty($val['media_id'])) { $media = $this->model->table('wechat_media')->field('title, file, file_name, type, content, add_time, article_id')->where('id = ' . $val['media_id'])->find(); $media['content'] = strip_tags(html_out($media['content'])); if (!empty($media['article_id'])) { $artids = explode(',', $media['article_id']); foreach ($artids as $v) { $list[$key]['medias'][] = $this->model->table('wechat_media')->field('title, file, add_time')->where('id = ' . $v)->find(); } } else { $list[$key]['media'] = $media; } } $keywords = $this->model->table('wechat_rule_keywords')->field('rule_keywords')->where('rid = ' . $val['id'])->order('id desc')->select(); $list[$key]['rule_keywords'] = $keywords; // 编辑关键词时显示 if (!empty($keywords)) { $rule_keywords = array(); foreach ($keywords as $k => $v) { $rule_keywords[] = $v['rule_keywords']; } $rule_keywords = implode(',', $rule_keywords); $list[$key]['rule_keywords_string'] = $rule_keywords; } } $this->assign('list', $list); $this->display(); }
function view_list() { global $now_date, $time_offset, $input, $lang; $title = $lang['rep_ad_view_title']; $html = "<div class='row'><div class='col-md-12'>"; $html = "<h2>{$lang['rep_ad_view_view']}</h2>"; $html .= "<p>{$lang['rep_ad_view_page']}</p>"; $html .= "<form action='staffpanel.php?tool=reputation_ad' name='list_form' method='post'>\n\t\t\t\t<input name='mode' value='list' type='hidden' />\n\t\t\t\t<input name='dolist' value='1' type='hidden' />"; $html .= "<table class='table table-bordered'>"; $html .= "<tr><td width='20%'>{$lang['rep_ad_view_for']}</td><td width='80%'><input type='text' name='leftfor' value='' size='35' maxlength='250' tabindex='1' /></td></tr>"; $html .= "<tr><td colspan='2'><div>{$lang['rep_ad_view_for_txt']}</div></td></tr>"; $html .= "<tr><td>{$lang['rep_ad_view_by']}</td><td><input type='text' name='leftby' value='' size='35' maxlength='250' tabindex='2' /></td></tr>"; $html .= "<tr><td colspan='2'><div>{$lang['rep_ad_view_by_txt']}</div></td></tr>"; $html .= "<tr><td>{$lang['rep_ad_view_start']}</td><td>\n\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_month']}<br /><select name='start[month]' tabindex='3'>" . get_month_dropdown(1) . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_day']}<br /><input type='text' name='start[day]' value='" . ($now_date['mday'] + 1) . "' size='4' maxlength='2' tabindex='3' /></span>\n\t\t\t\t<span>{{$lang['rep_ad_view_year']}}<br /><input type='text' name='start[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='3' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>{{$lang['rep_ad_view_start_select']}}</div></td></tr>"; $html .= "<tr><td>{$lang['rep_ad_view_end']}</td><td>\n\t\t\t<div>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_month']}<br /><select name='end[month]' class='textinput' tabindex='4'>" . get_month_dropdown() . "</select></span>\n\t\t\t\t<span style='padding-right:5px; float:left;'>{$lang['rep_ad_view_day']}<br /><input type='text' class='textinput' name='end[day]' value='" . $now_date['mday'] . "' size='4' maxlength='2' tabindex='4' /></span>\n\t\t\t\t<span>{$lang['rep_ad_view_year']}<br /><input type='text' class='textinput' name='end[year]' value='" . $now_date['year'] . "' size='4' maxlength='4' tabindex='4' /></span>\n\t\t\t</div></td></tr>"; $html .= "<tr><td class='tdrow2' colspan='2'><div class='desctext'>{$lang['rep_ad_view_end_select']}</div></td></tr>"; $html .= "<tr><td colspan='2' align='center'><input type='submit' value='{$lang['rep_ad_view_search']}' accesskey='s' class='btn' tabindex='5' /> <input type='reset' value='{$lang['rep_ad_view_reset']}' accesskey='r' class='btn' tabindex='6' /></td></tr>"; $html .= "</table></form>"; $html .= "</div></div>"; //echo $html; exit; // I hate work, but someone has to do it! if (isset($input['dolist'])) { $links = ""; $input['orderby'] = isset($input['orderby']) ? $input['orderby'] : ''; //$cond = ''; //experiment $who = isset($input['who']) ? (int) $input['who'] : 0; $user = isset($input['user']) ? $input['user'] : 0; $first = isset($input['page']) ? intval($input['page']) : 0; $cond = $who ? "r.whoadded=" . sqlesc($who) : ''; $start = isset($input['startstamp']) ? intval($input['startstamp']) : mktime(0, 0, 0, $input['start']['month'], $input['start']['day'], $input['start']['year']) + $time_offset; $end = isset($input['endstamp']) ? intval($input['endstamp']) : mktime(0, 0, 0, $input['end']['month'], $input['end']['day'] + 1, $input['end']['year']) + $time_offset; if (!$start) { $start = TIME_NOW - 3600 * 24 * 30; } if (!$end) { $end = TIME_NOW; } if ($start >= $end) { stderr($lang['rep_ad_view_err1'], $lang['rep_ad_view_err2']); } if (!empty($input['leftby'])) { $left_b = @sql_query("SELECT id FROM users WHERE username = "******"r.whoadded=" . $who; } if (!empty($input['leftfor'])) { $left_f = @sql_query("SELECT id FROM users WHERE username = "******" AND" : "") . " r.userid=" . $user; } if ($start) { $cond .= ($cond ? " AND" : "") . " r.dateadd >= {$start}"; } if ($end) { $cond .= ($cond ? " AND" : "") . " r.dateadd <= {$end}"; } switch ($input['orderby']) { case 'leftbyuser': $order = 'leftby.username'; $orderby = 'leftbyuser'; break; case 'leftforuser': $order = 'leftfor.username'; $orderby = 'leftforuser'; break; default: $order = 'r.dateadd'; $orderby = 'dateadd'; } $css = "style='font-weight: bold;color: #ffffff;background-color: #0055A4;padding: 5px;'"; $html = "<div class='row'><div class='col-md-12'><h2>{$lang['rep_ad_view_cmts']}</h2>"; $table_header = "<table class='table table-bordered'><tr {$css}>"; $table_header .= "<td width='5%'>{$lang['rep_ad_view_id']}</td>"; $table_header .= "<td width='20%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftbyuser&startstamp={$start}&endstamp={$end}&page={$first}'>{$lang['rep_ad_view_by']}</a></td>"; $table_header .= "<td width='20%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=leftforuser&startstamp={$start}&endstamp={$end}&page={$first}'>{$lang['rep_ad_view_for']}</a></td>"; $table_header .= "<td width='17%'><a href='staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby=date&startstamp={$start}&endstamp={$end}&page={$first}'>{$lang['rep_ad_view_date']}</a></td>"; $table_header .= "<td width='5%'>{$lang['rep_ad_view_point']}</td>"; $table_header .= "<td width='23%'>{$lang['rep_ad_view_reason']}</td>"; $table_header .= "<td width='10%'>{$lang['rep_ad_view_controls']}</td></tr>"; $html .= $table_header; // do the count for pager etc $query = sql_query("SELECT COUNT(*) AS cnt FROM reputation r WHERE {$cond}"); //echo_r($input); exit; $total = mysqli_fetch_assoc($query); if (!$total['cnt']) { $html .= "<tr><td colspan='7' align='center'>{$lang['rep_ad_view_none_found']}</td></tr>"; } // do the pager thang! $deflimit = 10; $links = "<span style=\"background: #F0F5FA; border: 1px solid #072A66;padding: 1px 3px 1px 3px;\">{$total['cnt']} {$lang['rep_ad_view_records']}</span>"; if ($total['cnt'] > $deflimit) { require_once INCL_DIR . 'pager_functions.php'; $links = pager_rep(array('count' => $total['cnt'], 'perpage' => $deflimit, 'start_value' => $first, 'url' => "staffpanel.php?tool=reputation_ad&mode=list&dolist=1&who=" . intval($who) . "&user="******"&orderby={$orderby}&startstamp={$start}&endstamp={$end}")); } // mofo query! $query = sql_query("SELECT r.*, p.topic_id, leftfor.id as leftfor_id, \n\t\t\t\t\t\t\t\t\tleftfor.username as leftfor_name, leftby.id as leftby_id, \n\t\t\t\t\t\t\t\t\tleftby.username as leftby_name \n\t\t\t\t\t\t\t\t\tFROM reputation r \n\t\t\t\t\t\t\t\t\tleft join posts p on p.id=r.postid \n\t\t\t\t\t\t\t\t\tleft join users leftfor on leftfor.id=r.userid \n\t\t\t\t\t\t\t\t\tleft join users leftby on leftby.id=r.whoadded \n\t\t\t\t\t\t\t\t\tWHERE {$cond} ORDER BY {$order} LIMIT {$first},{$deflimit}"); if (!mysqli_num_rows($query)) { stderr($lang['rep_ad_view_err3'], $lang['rep_ad_view_err5']); } while ($r = mysqli_fetch_assoc($query)) { $r['dateadd'] = date("M j, Y, g:i a", $r['dateadd']); $html .= "<tr><td>#{$r['reputationid']}</td>"; $html .= "<td><a href='userdetails.php?id={$r['leftby_id']}' target='_blank'>{$r['leftby_name']}</a></td>"; $html .= "<td><a href='userdetails.php?id={$r['leftfor_id']}' target='_blank'>{$r['leftfor_name']}</a></td>"; $html .= "<td>{$r['dateadd']}</td>"; $html .= "<td align='right'>{$r['reputation']}</td>"; $html .= "<td><a href='forums.php?action=viewtopic&topicid={$r['topic_id']}&page=p{$r['postid']}#{$r['postid']}' target='_blank'>" . htmlsafechars($r['reason']) . "</a></td>"; $html .= "<td><a href='staffpanel.php?tool=reputation_ad&mode=editrep&reputationid={$r['reputationid']}'><span class='btn'>{$lang['rep_ad_view_edit']}</span></a> <a href='reputation_ad.php?mode=dodelrep&reputationid={$r['reputationid']}'><span class='btn'>{$lang['rep_ad_view_delete']}</span></a></td></tr>"; } $html .= "</table>"; $html .= "<br /><div>{$links}</div>"; $html .= "</div></div>"; } html_out($html, $title); }
/** * 获得指定的文章的详细信息 * * @access private * @param integer $article_id * @return array */ function get_article_info($article_id) { /* 获得文章的信息 */ $sql = "SELECT a.*, IFNULL(AVG(r.comment_rank), 0) AS comment_rank " . "FROM " . $this->pre . "touch_article AS a " . "LEFT JOIN " . $this->pre . "comment AS r ON r.id_value = a.article_id AND comment_type = 1 " . "WHERE a.is_open = 1 AND a.article_id = '{$article_id}' GROUP BY a.article_id"; $row = $this->row($sql); if ($row !== false) { $row['comment_rank'] = ceil($row['comment_rank']); // 用户评论级别取整 $row['add_time'] = local_date(L('date_format'), $row['add_time']); // 修正添加时间显示 $row['content'] = html_out($row['content']); /* 作者信息如果为空,则用网站名称替换 */ if (empty($row['author']) || $row['author'] == '_SHOPHELP') { $row['author'] = L('shop_name'); } } return $row; }
/** * 专题详情 */ public function index() { $topic = $this->model->table('touch_topic')->field('*')->where('topic_id =' . $this->id)->find(); $topic['intro'] = html_out($topic['intro']); $topic['data'] = addcslashes($topic['data'], "'"); $tmp = @unserialize($topic["data"]); $arr = (array) $tmp; $goods_id = array(); foreach ($arr as $key => $value) { foreach ($value as $k => $val) { $opt = explode('|', $val); $arr[$key][$k] = $opt[1]; $goods_id[] = $opt[1]; } } $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' . "IFNULL(mp.user_price, g.shop_price * '{$_SESSION['discount']}') AS shop_price, g.promote_price, " . 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . 'FROM ' . $this->model->pre . 'goods AS g ' . 'LEFT JOIN ' . $this->model->pre . 'member_price AS mp ' . "ON mp.goods_id = g.goods_id AND mp.user_rank = '{$_SESSION['user_rank']}' " . "WHERE " . db_create_in($goods_id, 'g.goods_id'); $res = $this->model->query($sql); $sort_goods_arr = array(); foreach ($res as $row) { if ($row['promote_price'] > 0) { $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); $row['promote_price'] = $promote_price > 0 ? price_format($promote_price) : ''; } else { $row['promote_price'] = ''; } if ($row['shop_price'] > 0) { $row['shop_price'] = price_format($row['shop_price']); } else { $row['shop_price'] = ''; } $row['url'] = build_uri('goods/index', array('id' => $row['goods_id']), $row['goods_name']); $row['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']); $row['short_name'] = C('goods_name_length') > 0 ? sub_str($row['goods_name'], C('goods_name_length')) : $row['goods_name']; $row['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); $row['short_style_name'] = add_style($row['short_name'], $row['goods_name_style']); $row['sales_count'] = model('GoodsBase')->get_sales_count($row['goods_id']); $row['sc'] = model('GoodsBase')->get_goods_collect($row['goods_id']); $row['mysc'] = 0; // 检查是否已经存在于用户的收藏夹 if ($_SESSION['user_id']) { unset($where); // 用户自己有没有收藏过 $where['goods_id'] = $row['goods_id']; $where['user_id'] = $_SESSION['user_id']; $rs = $this->model->table('collect_goods')->where($where)->count(); $row['mysc'] = $rs; } $row['promotion'] = model('GoodsBase')->get_promotion_show($row['goods_id']); $row['comment_count'] = model('Comment')->get_goods_comment($row['goods_id'], 0); //商品总评论数量 $row['favorable_count'] = model('Comment')->favorable_comment($row['goods_id'], 0); //获得商品好评数量 foreach ($arr as $key => $value) { foreach ($value as $val) { if ($val == $row['goods_id']) { $key = $key == 'default' ? L('all_goods') : $key; $sort_goods_arr[$key][] = $row; } } } } $this->assign('sort_goods_arr', $sort_goods_arr); // 商品列表 $this->assign('topic', $topic); // 专题信息 $this->assign('tile', $topic['title']); $this->assign('show_asynclist', C('show_asynclist')); $templates = empty($topic['template']) ? 'topic.dwt' : $topic['template']; $this->display($templates); }
public function tag_link($content, $aid) { $taglist = $this->model->field('A.*')->table('tags', 'A')->add_table('tags_relation', 'B', 'B.tid=A.id')->where('B.aid=' . $aid)->select(); $content = html_out($content); if (!empty($taglist)) { foreach ($taglist as $export) { if (!empty($export['name'])) { $content = preg_replace("/(?!<[^>]+)" . preg_quote($export['name'], '/') . "(?![^<]*>)/", '<a href="' . __INDEX__ . '/tags-' . $export['name'] . '/" target="_blank">' . $export['name'] . '</a>', $content, 1); } } } return $content; }
/** * 获取插件配置信息 * * @param string $code * @return multitype:unknown */ private function get_config($code = '') { // 默认公众号信息 $config = array(); $wxid = model('Base')->model->table('wechat')->field('id')->where('default_wx = 1')->getOne(); if (!empty($wxid)) { $plugin_config = model('Base')->model->table('wechat_extend')->field('config')->where('wechat_id = ' . $wxid . ' and command = "' . $code . '" and enable = 1')->getOne(); if (!empty($plugin_config)) { $config = unserialize($plugin_config); // 素材 if (!empty($config['media_id'])) { $media = model('Base')->model->table('wechat_media')->field('id, title, file, file_name, type, content, add_time, article_id, link')->where('id = ' . $config['media_id'])->find(); // 单图文 if (empty($media['article_id'])) { $media['content'] = strip_tags(html_out($media['content'])); $config['media'] = $media; } } // url处理 if (!empty($config['plugin_url'])) { $config['plugin_url'] = html_out($config['plugin_url']); } // 奖品处理 if (is_array($config['prize_level']) && is_array($config['prize_count']) && is_array($config['prize_prob']) && is_array($config['prize_name'])) { foreach ($config['prize_level'] as $key => $val) { $config['prize'][] = array('prize_level' => $val, 'prize_name' => $config['prize_name'][$key], 'prize_count' => $config['prize_count'][$key], 'prize_prob' => $config['prize_prob'][$key]); } } } } return $config; }
/** * 关键词回复 * * @param string $keywords * @return boolean */ private function keywords_reply($keywords) { $endrs = false; $sql = 'SELECT r.content, r.media_id, r.reply_type FROM ' . $this->model->pre . 'wechat_reply r LEFT JOIN ' . $this->model->pre . 'wechat_rule_keywords k ON r.id = k.rid WHERE k.rule_keywords = "' . $keywords . '" and r.wechat_id = ' . $this->wechat_id . ' order by r.add_time desc LIMIT 1'; $result = $this->model->query($sql); if (!empty($result)) { // 素材回复 if (!empty($result[0]['media_id'])) { $mediaInfo = $this->model->table('wechat_media')->field('id, title, content, digest, file, type, file_name, article_id, link')->where('id = ' . $result[0]['media_id'])->find(); // 回复数据重组 if ($result[0]['reply_type'] == 'image' || $result[0]['reply_type'] == 'voice') { // 上传多媒体文件 $rs = $this->weObj->uploadMedia(array('media' => '@' . ROOT_PATH . $mediaInfo['file']), $result[0]['reply_type']); $replyData = array('ToUserName' => $this->weObj->getRev()->getRevFrom(), 'FromUserName' => $this->weObj->getRev()->getRevTo(), 'CreateTime' => time(), 'MsgType' => $rs['type'], ucfirst($rs['type']) => array('MediaId' => $rs['media_id'])); // 回复 $this->weObj->reply($replyData); $endrs = true; } elseif ('video' == $result[0]['reply_type']) { // 上传多媒体文件 $rs = $this->weObj->uploadMedia(array('media' => '@' . ROOT_PATH . $mediaInfo['file']), $result[0]['reply_type']); $replyData = array('ToUserName' => $this->weObj->getRev()->getRevFrom(), 'FromUserName' => $this->weObj->getRev()->getRevTo(), 'CreateTime' => time(), 'MsgType' => $rs['type'], ucfirst($rs['type']) => array('MediaId' => $rs['media_id'], 'Title' => $replyInfo['media']['title'], 'Description' => strip_tags($replyInfo['media']['content']))); // 回复 $this->weObj->reply($replyData); $endrs = true; } elseif ('news' == $result[0]['reply_type']) { // 图文素材 $articles = array(); if (!empty($mediaInfo['article_id'])) { $artids = explode(',', $mediaInfo['article_id']); foreach ($artids as $key => $val) { $artinfo = $this->model->table('wechat_media')->field('id, title, file, content, link')->where('id = ' . $val)->find(); //$artinfo['content'] = strip_tags(html_out($artinfo['content'])); $articles[$key]['Title'] = $artinfo['title']; $articles[$key]['Description'] = $artinfo['digest']; $articles[$key]['PicUrl'] = __URL__ . '/' . $artinfo['file']; $articles[$key]['Url'] = empty($artinfo['link']) ? __HOST__ . url('article/wechat_news_info', array('id' => $artinfo['id'])) : strip_tags(html_out($artinfo['link'])); } } else { $articles[0]['Title'] = $mediaInfo['title']; //$articles[0]['Description'] = strip_tags(html_out($mediaInfo['content'])); $articles[0]['Description'] = $mediaInfo['digest']; $articles[0]['PicUrl'] = __URL__ . '/' . $mediaInfo['file']; $articles[0]['Url'] = empty($mediaInfo['link']) ? __HOST__ . url('article/wechat_news_info', array('id' => $mediaInfo['id'])) : strip_tags(html_out($mediaInfo['link'])); } // 回复 $this->weObj->news($articles)->reply(); //记录用户操作信息 $this->record_msg($this->weObj->getRev()->getRevTo(), '图文信息', 1); $endrs = true; } } else { // 文本回复 $result[0]['content'] = html_out($result[0]['content']); $this->weObj->text($result[0]['content'])->reply(); //记录用户操作信息 $this->record_msg($this->weObj->getRev()->getRevTo(), $result[0]['content'], 1); $endrs = true; } } return $endrs; }
/** * 订单详情 */ public function order_detail() { $order_id = isset($_GET['order_id']) ? intval($_GET['order_id']) : 0; // 订单详情 $order = model('Users')->get_order_detail($order_id, $this->user_id); if ($order['order_status'] == OS_UNCONFIRMED) { $order['handler'] = "<a class=\"btn btn-info ect-colorf\" href=\"" . url('user/cancel_order', array('order_id' => $order['order_id'])) . "\" onclick=\"if (!confirm('" . L('confirm_cancel') . "')) return false;\">" . L('cancel') . "</a>"; } else { if ($order['order_status'] == OS_SPLITED) { /* 对配送状态的处理 */ if ($order['shipping_status'] == SS_SHIPPED) { @($order['handler'] = "<a class=\"btn btn-info ect-colorf\" href=\"" . url('user/affirm_received', array('order_id' => $order['order_id'])) . "\" onclick=\"if (!confirm('" . L('confirm_received') . "')) return false;\">" . L('received') . "</a>"); } elseif ($order['shipping_status'] == SS_RECEIVED) { @($order['handler'] = '<a class="btn btn-info ect-colorf" type="button" href="javascript:void(0);">' . L('ss_received') . '</a>'); } else { if ($order['pay_status'] == PS_UNPAYED) { @($order['handler'] = "<a class=\"btn btn-infoect-colorf\" href=\"" . url('user/cancel_order', array('order_id' => $order['order_id'])) . "\">" . L('pay_money') . "</a>"); } else { // @$order['handler'] = "<a class=\"btn btn-info ect-colorf\" href=\"javascript:void(0);\">" . L('view_order') . "</a>"; } } } else { $order['handler'] = '<a class="btn btn-info ect-colorf" type="button" href="javascript:void(0);">' . L('os.' . $order['order_status']) . '</a>'; } } if ($order === false) { ECTouch::err()->show(L('back_home_lnk'), './'); exit; } // 订单商品 $goods_list = model('Order')->order_goods($order_id); foreach ($goods_list as $key => $value) { $goods_list[$key]['market_price'] = price_format($value['market_price'], false); $goods_list[$key]['goods_price'] = price_format($value['goods_price'], false); $goods_list[$key]['subtotal'] = price_format($value['subtotal'], false); $goods_list[$key]['tags'] = model('ClipsBase')->get_tags($value['goods_id']); $goods_list[$key]['goods_thumb'] = get_image_path($order_id, $value['goods_thumb']); } // 设置能否修改使用余额数 if ($order['order_amount'] > 0) { if ($order['order_status'] == OS_UNCONFIRMED || $order['order_status'] == OS_CONFIRMED) { $user = model('Order')->user_info($order['user_id']); if ($user['user_money'] + $user['credit_line'] > 0) { $this->assign('allow_edit_surplus', 1); $this->assign('max_surplus', sprintf(L('max_surplus'), $user['user_money'])); } } } // 未发货,未付款时允许更换支付方式 if ($order['order_amount'] > 0 && $order['pay_status'] == PS_UNPAYED && $order['shipping_status'] == SS_UNSHIPPED) { $payment_list = model('Order')->available_payment_list(false, 0, true); // 过滤掉当前支付方式和余额支付方式 if (is_array($payment_list)) { foreach ($payment_list as $key => $payment) { // 兼容过滤ecjia支付方式 if (substr($payment['pay_code'], 0, 4) == 'pay_') { unset($payment_list[$key]); } if ($payment['pay_id'] == $order['pay_id'] || $payment['pay_code'] == 'balance') { unset($payment_list[$key]); } } } $this->assign('payment_list', $payment_list); } $order['pay_desc'] = html_out($order['pay_desc']); // 订单 支付 配送 状态语言项 $order['order_status'] = L('os.' . $order['order_status']); $order['pay_status'] = L('ps.' . $order['pay_status']); $order['shipping_status'] = L('ss.' . $order['shipping_status']); // 如果是银行汇款或货到付款 则显示支付描述 $payment = model('Order')->payment_info($order['pay_id']); if ($payment['pay_code'] == 'bank' || $payment['pay_code'] == 'cod') { $this->assign('pay_desc', $payment['pay_desc']); } $this->assign('title', L('order_detail')); $this->assign('order', $order); $this->assign('goods_list', $goods_list); $this->display('user_order_detail.dwt'); }
<h2 class="h2 text-center">Сообщения</h2> <?php foreach ($res_mes as $row) { ?> <p style="font: message-box; font-size: medium"><b style='color: green'>'<?php html_out($row['name']); ?> ': </b><?php html_out($row['text']); ?> </p> <?php } ?> </div> <div id="user_list" class="col-lg-3 text-left" style="background-color: #d9edf7; min-height: 500px; border: solid;"> <h2 class="h2 text-center">Пользователи</h2> <?php foreach ($res_user as $row) { ?> <p style="font: message-box; font-size: medium"><a href='?user_name=<?php html_out($row['name']); ?> '><?php html_out($row['name']); ?> </a></p> <?php } ?> </div>