public function show() { $offset = $this->input['offset'] ? $this->input['offset'] : 0; $count = $this->input['count'] ? intval($this->input['count']) : 20; $condition = $this->get_condition(); $orderby = ' ORDER BY t1.order_id DESC,t1.id DESC '; $limit = ' LIMIT ' . $offset . ' , ' . $count; $ret = $this->mode->show($condition, $orderby, $limit); $size = '270x170/'; if (!empty($ret)) { foreach ($ret as $k => $v) { if ($v['title']) { $v['title'] = hg_cutchars($v['title'], 8); } if ($v['start_time'] > TIMENOW) { $v['cheap_status'] = '未开始'; $v['cheap_color'] = 0; } else { if ($v['start_time'] < TIMENOW && $v['end_time'] > TIMENOW) { $v['cheap_status'] = '进行中'; $v['cheap_color'] = 1; } else { if ($v['end_time'] < TIMENOW) { $v['cheap_status'] = '已结束'; $v['cheap_color'] = 2; } } } $v['time_now'] = TIMENOW; $v['indexpic_url'] = hg_material_link($v['host'], $v['dir'], $v['filepath'], $v['filename'], $size); $this->addItem($v); } $this->output(); } }
/** * * 视频数据获取默认方法 */ public function show() { $ret = array(); if ($this->input['cid']) { /*查询出该频道的信息*/ $sql = "SELECT n.* , u.username FROM " . DB_PREFIX . "network_station AS n LEFT JOIN " . DB_PREFIX . "user AS u ON n.user_id = u.id WHERE n.id = '" . intval($this->input['cid']) . "'"; $arr = $this->db->query_first($sql); //如果存在LOGO if ($arr['logo']) { $arr['logo_url'] = UPLOAD_URL . LOGO_DIR . ceil($arr['user_id'] / NUM_IMG) . "/" . $arr['logo']; } else { $arr['logo_url'] = UPLOAD_URL . LOGO_DIR . "0.gif"; } $arr['brief'] = hg_cutchars($arr['brief'], 21); $arr['create_time'] = date('Y-m-d', $arr['create_time']); $arr['update_time'] = date('Y-m-d', $arr['update_time']); $ret['channel'] = $arr; } //分页参数设置 $offset = $this->input['offset'] ? $this->input['offset'] : 0; $count = $this->input['count'] ? intval($this->input['count']) : 24; $data_limit = ' LIMIT ' . $offset . ' , ' . $count; $sql = "SELECT v.* , u.username FROM " . DB_PREFIX . "video AS v LEFT JOIN " . DB_PREFIX . "user AS u ON v.user_id = u.id WHERE 1 "; //获取查询条件 $condition = $this->get_condition(); $sql = $sql . $condition . $data_limit; $q = $this->db->query($sql); $this->setXmlNode('video_info', 'video'); while ($row = $this->db->fetch_array($q)) { $row['title'] = hg_cutchars($row['title'], 8); $row['create_time'] = date('Y-m-d H:i:s', $row['create_time']); $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']); $row['toff'] = date('i:s', $row['toff']); $row['state_tags'] = $this->settings['video_state'][$row['state']]; if ($this->settings['rewrite']) { $row['link'] = SNS_VIDEO . "video-" . $row['id'] . ".html"; } else { $row['link'] = SNS_VIDEO . "video_play.php?id=" . $row['id']; } switch (intval($row['is_show'])) { case 0: $row['audit'] = 0; break; case 1: $row['audit'] = 0; break; case 2: $row['audit'] = 1; break; default: break; } $row['is_show_tags'] = $this->settings['video_type'][$row['is_show']]; $row['copyright'] = $this->settings['video_copyright'][$row['copyright']]; $ret['video'][] = $row; } $this->addItem($ret); $this->output(); }
public function create() { $data = array('title' => trim($this->input['title']), 'subtitle' => trim($this->input['subtitle']), 'keywords' => str_replace(' ', ',', trim($this->input['keywords'])), 'brief' => trim($this->input['brief']), 'author' => trim($this->input['author']), 'source' => trim($this->input['source']), 'sort_id' => intval($this->input['sort_id']), 'appid' => intval($this->user['appid']), 'appname' => trim($this->user['display_name']), 'indexpic' => trim($this->input['indexpic']), 'pic' => trim($this->input['pic']), 'video' => trim($this->input['video']), 'material_ids' => trim($this->input['material_ids']), 'source_url' => trim($this->input['source_url']), 'create_time' => TIMENOW, 'org_id' => $this->user['org_id'], 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name'], 'ip' => hg_getip(), 'update_time' => TIMENOW); $content = trim($this->input['content']); if (!$content) { $this->errorOutput("内容不能为空"); } $data['title'] = $data['title'] ? $data['title'] : hg_cutchars($content, 20); $d_forward = array(); //记录直接转发数据 //获取转发配置 if ($data['sort_id']) { $set_id = array(); $config = $this->gather->get_config_by_sortId($data['sort_id']); if ($config[$data['sort_id']] && is_array($config[$data['sort_id']])) { foreach ($config[$data['sort_id']] as $val) { $set_id[$val['id']] = $val['app_name']; if ($val['is_open'] && $val['is_relay']) { $d_forward[] = $val['id']; } } } if (!empty($set_id)) { $data['set_id'] = serialize($set_id); } } //插入主表 $id = $this->gather->insert_gather($data); //插入内容表 $ret = $this->gather->insert_content($content, $id); $data['id'] = $id; $data['content'] = $ret; //有直接转发数据插入直接转发队列 if (!empty($d_forward)) { if (!$this->input['is_plan']) { $res = $this->forward->forward($id); if ($res && $res[$id]) { $set_url = serialize($res[$id]); $this->gather->update_set_url($set_url, $id); } } else { foreach ($d_forward as $setid) { $this->gather->insert_gather_plan($id, $setid); } } } $this->addItem($data); $this->output(); }
break; case 7: break; default: $style = ' class="cus_pad"'; break; } {/code} <li{$style}><a title="{$value['username']}" href="<?php echo hg_build_link("user.php", array('user_id' => $value['id'])); ?> "><img src="{$value['middle_avatar']}" width="50" height="50" /></a><a title="{$value['username']}" href="<?php echo hg_build_link("user.php", array('user_id' => $value['id'])); ?> "><?php echo hg_cutchars($value['username'], 4, " "); ?> </a></li> {code} $i++; {/code} {/foreach} </ul> {/if} </div> <div class="g_bre3"></div> <div style="text-align:center;"> {code} echo hg_advert('google_2'); echo hg_advert('baidu_1'); {/code}
$null_text = "暂未上传视频"; $null_type = 1; $null_url = $_SERVER['HTTP_REFERER']; {/code} {template:unit/null} {else} <ul class="video"> {foreach $video as $key => $value} <li class="cus_pad"><a target="_blank" href="<?php echo hg_build_link(SNS_VIDEO . "video_play.php", array('id' => $value['id'])); ?> "><img title="{$value['title']}" src="{$value['schematic']}" width="144" height="108" /></a><a title="{$value['title']}" target="_blank" href="<?php echo hg_build_link(SNS_VIDEO . "video_play.php", array('id' => $value['id'])); ?> "><?php echo hg_cutchars($value['title'], 10, ' '); ?> </a><span class="txt">播放:<strong>{$value['play_count']}</strong></span><span class="txt">评论:<strong>{$value['comment_count']}</strong></span></li> {/foreach} </ul> <div class="clear"></div> {/if} {$showpages} <div class="clear"></div> </div> <div class="con_bottom clear"></div> </div> </div> {template:unit/my_right_menu} </div> {template:foot}
public function create() { //添加爆料主表 $data = array('title' => addslashes(trim($this->input['title'])), 'brief' => addslashes(trim($this->input['brief'])), 'appid' => $this->user['appid'], 'client' => $this->user['display_name'], 'longitude' => trim($this->input['longitude']), 'latitude' => trim($this->input['latitude']), 'create_time' => TIMENOW, 'user_id' => $this->input['user_name'] ? 0 : $this->user['user_id'], 'user_name' => addslashes($this->input['user_name']) ? addslashes($this->input['user_name']) : addslashes($this->user['user_name']), 'audit' => 1, 'sort_id' => trim(urldecode($this->input['sort_id']))); $content = addslashes(trim(urldecode($this->input['content']))); if (!$content) { $this->errorOutput('请输入投稿内容'); } if (!$data['sort_id']) { $data['sort_id'] = 0; } else { //获取该分类下的发布栏目 $sortInfor = $this->con->getSortInfor($data['sort_id']); if (!empty($sortInfor)) { $data['column_id'] = addslashes($sortInfor[$data['sort_id']]['column_id']); } } if (!$data['title']) { $data['title'] = hg_cutchars($content, 20); } if (!$data['brief']) { $data['brief'] = hg_cutchars($content, 100); } $contribute_id = $this->con->add_content($data); //添加内容表 $body = array('id' => $contribute_id, 'text' => $content); $this->con->add_contentbody($body); //用户信息 $userinfo = array(); $userinfo = array('con_id' => intval($contribute_id), 'tel' => $this->input['tel'], 'email' => addslashes($this->input['email']), 'addr' => addslashes($this->input['addr'])); if ($this->input['user_name']) { $userinfo = array('con_id' => intval($contribute_id), 'tel' => $this->input['tel'], 'email' => addslashes($this->input['email']), 'addr' => addslashes($this->input['addr'])); } elseif ($this->user['user_id'] && !$this->input['user_name']) { $return = $this->con->get_userinfo_by_id($this->user['user_id']); if (!empty($return)) { $userinfo = array('con_id' => intval($contribute_id), 'tel' => $return['mobile'], 'email' => $return['email'], 'addr' => $return['address']); } } if (!empty($userinfo)) { $this->con->user_info($userinfo); } //图片上传 if ($_FILES['photos']) { $count = count($_FILES['photos']['error']); for ($i = 0; $i < $count; $i++) { if ($_FILES['photos']['error'][$i] == 0) { $pics = array(); foreach ($_FILES['photos'] as $k => $v) { $pics['Filedata'][$k] = $_FILES['photos'][$k][$i]; } //插入图片服务器 $ret = $this->con->uploadToPicServer($pics, $contribute_id); //准备入库数据 $arr = array('content_id' => $contribute_id, 'mtype' => $ret['type'], 'original_id' => $ret['id'], 'host' => $ret['host'], 'dir' => $ret['dir'], 'material_path' => $ret['filepath'], 'pic_name' => $ret['filename']); $id = $this->con->upload($arr); //默认第一张图片为索引图 if (!$indexpic) { $indexpic = $this->con->update_indexpic($id, $contribute_id); } } } } //视频上传 if ($_FILES['videofile']) { //上传视频服务器 $videodata = $this->con->uploadToVideoServer($_FILES, $data['title'], $data['brief']); //有视频没有图片时,将视频截图上传作为索引图 if (!$indexpic) { $url = $videodata['img']['host'] . $videodata['img']['dir'] . $videodata['img']['filepath'] . $videodata['img']['filename']; $material = $this->con->localMaterial($url, $contribute_id); $arr = array('content_id' => $contribute_id, 'mtype' => $material['type'], 'original_id' => $material['id'], 'host' => $material['host'], 'dir' => $material['dir'], 'material_path' => $material['filepath'], 'pic_name' => $material['filename']); $indexpic = $this->con->upload($arr); $this->con->update_indexpic($indexpic, $contribute_id); } //视频入库 $arr = array('content_id' => $contribute_id, 'mtype' => $videodata['type'], 'host' => $videodata['protocol'] . $videodata['host'], 'dir' => $videodata['dir'], 'vodid' => $videodata['id'], 'filename' => $videodata['file_name']); $this->con->upload($arr); } //转发爆料 if ($contribute_id) { $this->con->send_contribute($contribute_id, $flag = 1); } $this->addItem($contribute_id); $this->output(); }
/** * 获得专辑中的视频 * @param $album_id * @param $page * @param $count * @return $ret 专辑信息 */ public function get_album_video() { $count = $this->count; $page = $this->page; $album_id = $this->input['album_id'] ? $this->input['album_id'] : 0; $disabled = $this->input['album_video'] ? '' : 'disabled'; $html = ''; if (!$album_id) { $html = ''; } else { $album_video = $this->mVideo->get_album_video($album_id, $page, $count); $html = '<h3> <a href="javascript:void(0);" onclick="edit_album_info(' . $album_video['id'] . ');">修改专辑信息</a> <a target="_blank" href="user_album_video.php?id=' . $album_video['id'] . '&user_id=' . $album_video['user_id'] . '">播放专辑</a> <input type="hidden" id="album_id" value="' . $album_video['id'] . '"/> <input type="hidden" id="album_name" value="' . $album_video['name'] . '"/> <input type="hidden" id="album_brief" value="' . $album_video['brief'] . '"/> <input type="hidden" id="album_sort" value="' . $album_video['sort_id'] . '"/> <input type="hidden" id="album_total" value="' . $album_video['video']['total'] . '"/> <span class="blod">专辑:<a title="' . $album_video['name'] . '" style="color: #000000; cursor: pointer; float: none; padding: 0; text-decoration: none;">' . hg_cutchars($album_video['name'], 8, " ") . '</a></span> <span style="margin-left:30px;">共' . ($album_video['video']['total'] ? $album_video['video']['total'] : 0) . '个视频</span> </h3><div class="show_info_tips show_info">'; if ($album_video) { $data['totalpages'] = $album_video['video']['total']; unset($album_video['video']['total']); $data['perpage'] = $count; $data['curpage'] = $this->input['pp']; $data['onclick'] = 'onclick="album_page_show(this,4);"'; $showpages = hg_build_pagelinks($data); } $html .= '<div class="video_cp clear"><input type="button" value="添加视频" onclick="add_album_video(' . $album_id . ');"/><input name="get" type="button" onclick="del_album_video();" value="删除视频" ' . $disabled . '/><input name="get" onclick="move_album_show(' . $album_id . ');" type="button" value="移动到专辑" ' . $disabled . '/> ' . $showpages . '</div> <div class="video_list" id="video_list clear"> <table width="100%" cellspacing=0 cellpadding=0> <tr><th width="100px">序号</th><th>视频名称</th><th>添加时间</th><th>会员</th><th>播放次数</th><th>管理</th></tr> '; if ($album_video['video'] && is_array($album_video['video'])) { $i = 1; foreach ($album_video['video'] as $key => $value) { $tr .= '<tr> <td width="100px"><input name="vch" type="checkbox" value="' . $value['id'] . '" onclick="check_list(this,4);"/>' . $i . '</td> <td><a target="_blank" title="' . $value['title'] . '" href="' . hg_build_link('video_play.php', array('id' => $value['id'])) . '"><img src="' . $value['schematic'] . '"/></a> <a target="_blank" title="' . $value['title'] . '" href="' . hg_build_link('video_play.php', array('id' => $value['id'])) . '">' . hg_cutchars($value['title'], 6, " ") . '</a> </td> <td>' . $value['create_time'] . '</td> <td><a target="_blank" title="' . $value['user']['username'] . '" href="' . hg_build_link('user.php', array('id' => $value['user']['id'])) . '">' . hg_cutchars($value['user']['username'], 5, " ") . '</a></td> <td>' . $value['play_count'] . '</td> <td> <a href="javascript:void(0);" onclick="edit_album_cover(' . $value['id'] . ',' . $album_video['id'] . ');">设为封面</a>|<a href="javascript:void(0);" onclick="del_album_video(' . $value['id'] . ');">移除</a> </td> </tr>'; $i++; } } $html .= $tr . '</table> </div> <div><a class="f_r" onclick="return_album();" href="javascript:void(0);">返回列表</a></div> <div class="video_cp clear"><input type="button" value="添加视频" onclick="add_album_video(' . $album_id . ');"/><input name="get" type="button" onclick="del_album_video();" value="删除视频" ' . $disabled . '/><input name="get" type="button" onclick="move_album_show(' . $album_id . ');" value="移动到专辑" ' . $disabled . '/>' . $showpages . '</div> </div>'; } echo $html; exit; }
<div class="right_window con-left"> <div id="album_info" class="station_content"> <h3 class="con_top"><a href="<?php echo hg_build_link("upload.php"); ?> ">+上传视频</a><a href="javascript:void(0);"onclick="create_album(1);">+创建专辑</a>我的专辑</h3> <div class="show_info"> <div class="album"> <ul class="album_ul"> {if $album_info} {foreach $album_info as $key => $value} <li class="album_li" onmousemove="album_mouse({$value['id']},0)" onmouseout="album_mouse({$value['id']},1)"> <a href="javascript:void(0);" onclick="manage_album_video({$value['id']});"><img src="{$value['cover']}"/></a> <div id="album_na_{$value['id']}" class="album_na"> <a href="javascript:void(0);" onclick="manage_album_video({$value['id']});"><?php echo hg_cutchars($value['name'], 8, " "); ?> ({$value['video_count']})</a> </div> <div id="album_ma_{$value['id']}" class="album_ma" style="display:none;"> <!-- <a target="_blank" href="<?php echo hg_build_link('user_album_video.php', array('id' => $value['id'], 'user_id' => $value['user_id'])); ?> ">预览</a>--> <a href="javascript:void(0);" onclick="del_album({$value['id']});">删除</a> <a href="javascript:void(0);" onclick="edit_album_info({$value['id']});">编辑</a> </div> </li> {/foreach} {else} <li>
{foreach $station_info as $key => $value} <li class="search_li"> <ul class="search_result"> <li><a target="_blank" href="<?php echo hg_build_link(SNS_VIDEO . "station_play.php", array("sta_id" => $value['id'])); ?> "><img src="{$value['small']}"/></a></li> <li>名称:<a target="_blank" href="<?php echo hg_build_link(SNS_VIDEO . "station_play.php", array("sta_id" => $value['id'])); ?> "><?php echo hg_match_red(hg_cutchars($value['web_station_name'], 7, " "), $name); ?> </a></li> <li>标签:<?php echo $value['tags'] ? hg_tags(hg_cutchars($value['tags'], 7, " "), $name, "station_search.php") : "暂无"; ?> </li> <li>点击次数:{$value['click_count']}</li> </ul> </li> {/foreach} </ul> {$showpages} {/if} </div> <div class="con_bottom clear"></div> {/if} </div> </div> {template:unit/my_right_menu}
public function getProduct($page) { //获取接口数据 $data = $this->getXcpw($page); //hg_pre($data);exit(); if ($data['dtsource']) { $count = $data['recordcount'] ? $data['recordcount'] : 0; $totalpage = $data['totalpages'] ? $data['totalpages'] : 0; $perpage = $data['totalperpage'] ? $data['totalperpage'] : 0; //获取抓取纪录 $sql = 'SELECT * FROM ' . DB_PREFIX . 'xcpw_show'; $query = $this->db->query($sql); $record = array(); while ($row = $this->db->fetch_array($query)) { $record[$row['xc_id']] = $row['show_id']; } //获取索引图纪录 $sql = 'SELECT s.id as sid,s.index_id,s.status,m.* FROM ' . DB_PREFIX . 'show s LEFT JOIN ' . DB_PREFIX . 'material m ON s.index_id = m.id'; $query = $this->db->query($sql); $m_record = array(); while ($row = $this->db->fetch_array($query)) { $m_record[$row['sid']] = $row['id']; $st[$row['sid']] = $row['status']; } //hg_pre($m_record);exit(); $num = 0; $number = $count - ($page - 1) * $perpage; if ($number >= $perpage) { $num = $perpage; } else { $num = $number; } if ($num > 0) { for ($i = 0; $i < $num; $i++) { $insert_id = ''; $material_id = ''; $price_ids = ''; $low_price = 0; $show_id = ''; $temp = $data['dtsource'][$num - ($i + 1)]; if ($temp && is_array($temp) && !empty($temp)) { if (in_array($temp['id'], array_keys($record))) { $show_id = $record[$temp['id']]; } if (!$show_id || $show_id && $st[$show_id] == 0) { $state = ''; switch ($temp['state']) { case 0: $state = 0; break; case 1: $state = 1; break; case 2: $state = 2; break; case 3: $state = 3; break; case 10: $state = 10; break; } //商品信息处理 $arr = array('id' => $show_id, 'title' => $temp['name'], 'brief' => $temp['brief'], 'venue' => $temp['host'], 'address' => $temp['address'], 'show_time' => $temp['time_notes'], 'start_time' => strtotime($temp['start_time_str']), 'end_time' => strtotime($temp['end_time_str']), 'price_notes' => addslashes($temp['price_notes']), 'goods_total' => intval($temp['goods_total']), 'goods_total_left' => intval($temp['goods_total_left']), 'sale_state' => $state, 'appid' => $this->user['appid'], 'client' => $this->user['display_name'], 'create_time' => TIMENOW, 'update_time' => TIMENOW, 'user_id' => $temp['create_userid'], 'user_name' => $temp['create_username']); if (!$arr['brief'] && $temp['notes']) { $arr['brief'] = hg_cutchars(strip_tags($temp['notes']), 100); } $sql = 'REPLACE INTO ' . DB_PREFIX . 'show SET '; foreach ($arr as $kk => $vv) { $sql .= $kk . '="' . addslashes($vv) . '",'; } $sql = rtrim($sql, ','); $this->db->query($sql); $insert_id = $this->db->insert_id(); //索引图处理 if ($temp['logo']['original']) { $url = 'http://' . $this->settings['App_xcpw']['host'] . '/' . $temp['logo']['original']; $res = $this->material->localMaterial($url, $insert_id); //入素材库 if (!empty($res)) { $res = $res[0]; $materials = array('show_id' => $res['cid'], 'index_url' => serialize(array('host' => $res['host'], 'dir' => $res['dir'], 'filepath' => $res['filepath'], 'filename' => $res['filename'])), 'type' => $res['type'], 'original_id' => $res['id'], 'create_time' => TIMENOW, 'user_id' => $this->user['user_id'], 'user_name' => $this->user['user_name']); if (!in_array($show_id, array_keys($m_record))) { $sql = 'INSERT INTO ' . DB_PREFIX . 'material SET '; foreach ($materials as $key => $val) { $sql .= $key . '="' . addslashes($val) . '",'; } $sql = rtrim($sql, ','); $this->db->query($sql); $material_id = $this->db->insert_id(); } else { $sql = 'UPDATE ' . DB_PREFIX . 'material SET '; foreach ($materials as $key => $val) { $sql .= $key . '="' . addslashes($val) . '",'; } $sql = rtrim($sql, ','); $sql .= ' WHERE show_id = ' . $show_id; $this->db->query($sql); $material_id = $m_record[$show_id]; } } } //内容处理 if ($temp['notes']) { $content = $this->notesManage($temp['notes'], $insert_id); $sql = 'REPLACE INTO ' . DB_PREFIX . 'content (id,content) VALUES(' . $insert_id . ',"' . addslashes($content) . '")'; $this->db->query($sql); } if ($material_id) { // 更新主表信息 $sql = 'UPDATE ' . DB_PREFIX . 'show SET index_id =' . $material_id . ',low_price = ' . $low_price . ',order_id=' . $insert_id . ' WHERE id = ' . $insert_id; $this->db->query($sql); } //纪录数据关系 if (!$show_id) { $sql = 'INSERT INTO ' . DB_PREFIX . 'xcpw_show (xc_id,show_id) VALUES(' . $temp['id'] . ',' . $insert_id . ')'; $this->db->query($sql); } } } } } else { return false; } } else { return false; } return true; }
public function create() { $content = addslashes(trim($this->input['content'])); if (!$content) { $this->errorOutput('请输入报料内容'); } $data = array('title' => addslashes(trim($this->input['title'])), 'brief' => addslashes(trim($this->input['brief'])), 'appid' => $this->user['appid'], 'client' => $this->user['display_name'], 'audit' => 1, 'sort_id' => intval($this->input['sort_id']), 'org_id' => $this->user['org_id'], 'is_m2o' => 1, 'user_id' => $this->input['user_name'] ? 0 : $this->user['user_id'], 'user_name' => $this->input['user_name'] ? addslashes($this->input['user_name']) : addslashes($this->user['user_name']), 'create_time' => TIMENOW, 'ip' => $this->user['ip'], 'baidu_longitude' => trim($this->input['baidu_longitude']), 'baidu_latitude' => trim($this->input['baidu_latitude']), 'event_time' => strtotime($this->input['event_time']), 'event_address' => trim($this->input['event_address']), 'event_suggest' => trim($this->input['event_suggest']), 'event_user_name' => trim($this->input['event_user_name']), 'event_user_tel' => trim($this->input['event_user_tel']), 'is_follow' => intval($this->input['is_follow'])); if (!$data['sort_id']) { $data['sort_id'] = 0; } if (!$data['title']) { $data['title'] = hg_cutchars($content, 20); } if (!$data['brief']) { $data['brief'] = hg_cutchars($content, 100); } //如果百度坐标存在的话,就转换为GPS坐标也存起来 if ($data['baidu_longitude'] && $data['baidu_latitude']) { $gps = $this->contribute->FromBaiduToGpsXY($data['baidu_longitude'], $data['baidu_latitude']); $data['GPS_longitude'] = $gps['GPS_x']; $data['GPS_latitude'] = $gps['GPS_y']; } /**************权限控制开始**************/ //节点权限 if ($data['sort_id'] && $this->user['group_type'] > MAX_ADMIN_TYPE) { $sql = 'SELECT id, parents FROM ' . DB_PREFIX . 'sort WHERE id = ' . $data['sort_id']; $sort = $this->db->query_first($sql); $nodes['nodes'][$sort['id']] = $sort['parents']; } $nodes['_action'] = 'manage'; $this->verify_content_prms($nodes); //创建数据后的审核状态 if ($this->user['group_type'] > MAX_ADMIN_TYPE) { if ($this->user['prms']['default_setting']['create_content_status'] == 1) { $data['audit'] = 1; } elseif ($this->user['prms']['default_setting']['create_content_status'] == 2) { $data['audit'] = 2; } } /**************权限控制结束**************/ //添加爆料主表 $contributeId = $this->contribute->add_content($data); if (!intval($contributeId)) { $this->errorOutput('数据库插入失败'); } //添加内容表 $body = array('id' => $contributeId, 'text' => $content); $this->contribute->add_contentbody($body); $userinfo = array(); //用户信息 $userinfo['con_id'] = intval($contributeId); $userinfo['tel'] = addslashes($this->input['tel']); $userinfo['email'] = addslashes($this->input['email']); $userinfo['addr'] = addslashes($this->input['addr']); if (!empty($userinfo)) { $this->contribute->user_info($userinfo); } //视频上传 if ($_FILES['videofile']) { $video = array(); //检测视频服务器 if (!$this->settings['App_mediaserver']) { $this->errorOutput('视频服务器未安装!'); } //获取视频服务器上传配置 $videoConfig = $this->contribute->getVideoConfig(); if (!$videoConfig) { $this->errorOutput('获取允许上传的视频类型失败!'); } $count = count($_FILES['videofile']['name']); for ($i = 0; $i <= $count; $i++) { if ($_FILES['videofile']['name'][$i]) { if ($_FILES['videofile']['error'][$i] > 0) { $this->errorOutput('视频异常'); } $filetype = ''; $filetype = strtolower(strrchr($_FILES['videofile']['name'][$i], '.')); if (!in_array($filetype, $videoConfig['type'])) { $this->errorOutput('只允许上传' . $videoConfig['hit'] . '格式的视频'); } foreach ($_FILES['videofile'] as $k => $v) { $video['videofile'][$k] = $_FILES['videofile'][$k][$i]; } $videos[] = $video; } } if (!empty($videos)) { //循环上传视频 foreach ($videos as $val) { $videodata = ''; //上传视频服务器 $videodata = $this->contribute->uploadToVideoServer($val, $data['title'], $data['brief']); if (!$videodata) { $this->errorOutput('视频服务器错误!'); } $info[] = $videodata; //有视频没有图片时,将视频截图上传作为索引图 if (!$indexpic) { $url = $videodata['img']['host'] . $videodata['img']['dir'] . $videodata['img']['filepath'] . $videodata['img']['filename']; $material = $this->contribute->localMaterial($url, $contributeId); if ($material) { $arr = array('content_id' => $contributeId, 'mtype' => $material['type'], 'original_id' => $material['id'], 'host' => $material['host'], 'dir' => $material['dir'], 'material_path' => $material['filepath'], 'pic_name' => $material['filename'], 'is_vod_pic' => 1); $indexpic = $this->contribute->upload($arr); $this->contribute->update_indexpic($indexpic, $contributeId); } } //视频入库 $arr = array('content_id' => $contributeId, 'mtype' => $videodata['type'], 'host' => $videodata['protocol'] . $videodata['host'], 'dir' => $videodata['dir'], 'vodid' => $videodata['id'], 'filename' => $videodata['file_name']); $this->contribute->upload($arr); } } } //图片上传 if ($_FILES['photos']) { $photos = array(); //检测图片服务器 if (!$this->settings['App_material']) { $this->errorOutput('图片服务器未安装!'); } //获取图片服务器上传配置 $PhotoConfig = $this->contribute->getPhotoConfig(); if (!$PhotoConfig) { $this->errorOutput('获取允许上传的图片类型失败!'); } $count = count($_FILES['photos']['name']); for ($i = 0; $i <= $count; $i++) { if ($_FILES['photos']['name'][$i]) { if ($_FILES['photos']['error'][$i] > 0) { $this->errorOutput('图片异常'); } if (!in_array($_FILES['photos']['type'][$i], $PhotoConfig['type'])) { $this->errorOutput('只允许上传' . $PhotoConfig['hit'] . '格式的图片'); } if ($_FILES['photos']['size'][$i] > 100000000) { $this->errorOutput('只允许上传100M以下的图片!'); } foreach ($_FILES['photos'] as $k => $v) { $photo['Filedata'][$k] = $_FILES['photos'][$k][$i]; } $photos[] = $photo; } } if (!empty($photos)) { //循环插入图片服务器 foreach ($photos as $val) { $PhotoInfor = $this->contribute->uploadToPicServer($val, $contributeId); if (empty($PhotoInfor)) { $this->errorOutput('图片服务器错误!'); } $temp = array('content_id' => $contributeId, 'mtype' => $PhotoInfor['type'], 'original_id' => $PhotoInfor['id'], 'host' => $PhotoInfor['host'], 'dir' => $PhotoInfor['dir'], 'material_path' => $PhotoInfor['filepath'], 'pic_name' => $PhotoInfor['filename'], 'imgwidth' => $PhotoInfor['imgwidth'], 'imgheight' => $PhotoInfor['imgheight']); //插入数据库 $PhotoId = $this->contribute->upload($temp); //默认第一张图片为索引图 if (!$indexpic) { $indexpic = $this->contribute->update_indexpic($PhotoId, $contributeId); } } } } /**************权限控制开始**************/ if ($data['audit'] == 2) { $this->contribute->send_contribute($contributeId); //审核视频 $this->contribute->video_audit($contributeId, 1); } /**************权限控制结束**************/ //添加日志 $sql = 'SELECT * FROM ' . DB_PREFIX . 'content WHERE id = ' . $contributeId; $ret = $this->db->query_first($sql); $this->addLogs('添加报料', '', $ret, $ret['title'], $contributeId, $ret['sort_id']); $this->addItem($contributeId); $this->output(); }
/** * 增加投稿 */ function create() { //添加爆料主表 $data = array('title' => trim(urldecode($this->input['title'])), 'brief' => addslashes(trim(urldecode($this->input['brief']))), 'appid' => $this->user['appid'], 'client' => $this->user['display_name'], 'longitude' => trim(urldecode($this->input['longitude'])), 'latitude' => trim(urldecode($this->input['latitude'])), 'create_time' => TIMENOW, 'user_id' => $this->input['user_name'] ? 0 : $this->user['user_id'], 'user_name' => addslashes($this->input['user_name']) ? addslashes($this->input['user_name']) : addslashes($this->user['user_name']), 'audit' => 1, 'sort_id' => trim(urldecode($this->input['sort_id'])), 'org_id' => $this->user['org_id']); $content = addslashes(trim(urldecode($this->input['content']))); if (!$content) { $this->errorOutput('请输入投稿内容'); } /**************权限控制开始**************/ //节点权限 if ($data['sort_id']) { $sql = 'SELECT id, parents FROM ' . DB_PREFIX . 'sort WHERE id = ' . $data['sort_id']; $sort = $this->db->query_first($sql); $nodes['nodes']['reporter_node'][$sort['id']] = $sort['parents']; } else { $nodes['nodes']['reporter_node'] = array(0 => 0); } $this->verify_content_prms($nodes); //创建数据后的审核状态 if ($this->user['group_type'] > MAX_ADMIN_TYPE) { if ($this->user['prms']['default_setting']['create_content_status'] == 1) { $data['audit'] = 1; } elseif ($this->user['prms']['default_setting']['create_content_status'] == 2) { $data['audit'] = 2; } } /**************权限控制结束**************/ if (!$data['sort_id']) { $data['sort_id'] = 0; } else { //获取该分类下的发布栏目 $sortInfor = $this->con->getSortInfor($data['sort_id']); if (!empty($sortInfor)) { $data['column_id'] = addslashes($sortInfor[$data['sort_id']]['column_id']); } } if (!$data['title']) { $data['title'] = hg_cutchars($content, 20); } if (!$data['brief']) { $data['brief'] = hg_cutchars($content, 100); } $contribute_id = $this->con->add_content($data); /****************添加日志*****************/ if ($contribute_id) { $sql = 'SELECT * FROM ' . DB_PREFIX . 'content WHERE id = ' . $contribute_id; $ret = $this->db->query_first($sql); $this->addLogs('添加报料', '', $ret); } /****************添加日志****************/ //添加内容表 $body = array('id' => $contribute_id, 'text' => $content); $this->con->add_contentbody($body); $userinfo = array(); //用户信息 if ($this->input['user_name']) { $userinfo = array('con_id' => intval($contribute_id), 'tel' => $this->input['tel'], 'email' => addslashes($this->input['email']), 'addr' => addslashes($this->input['addr'])); } elseif ($this->user['user_id'] && !$this->input['user_name']) { $return = $this->con->get_userinfo_by_id($this->user['user_id']); if (!empty($return)) { $userinfo = array('con_id' => intval($contribute_id), 'tel' => $return['mobile'], 'email' => $return['email'], 'addr' => $return['address']); } } if (!empty($userinfo)) { $this->con->user_info($userinfo); } //图片上传 if ($_FILES['photos']) { $count = count($_FILES['photos']['error']); for ($i = 0; $i <= $count; $i++) { if ($_FILES['photos']['error'][$i] === 0) { $pics = array(); foreach ($_FILES['photos'] as $k => $v) { $pics['Filedata'][$k] = $_FILES['photos'][$k][$i]; } //插入图片服务器 $ret = $this->con->uploadToPicServer($pics, $contribute_id); //准备入库数据 $arr = array('content_id' => $contribute_id, 'mtype' => $ret['type'], 'original_id' => $ret['id'], 'host' => $ret['host'], 'dir' => $ret['dir'], 'material_path' => $ret['filepath'], 'pic_name' => $ret['filename']); $id = $this->con->upload($arr); //默认第一张图片为索引图 if (!$indexpic) { $indexpic = $this->con->update_indexpic($id, $contribute_id); } } } } //视频上传 if ($_FILES['videofile']) { //上传视频服务器 $videodata = $this->con->uploadToVideoServer($_FILES, $data['title'], $data['brief']); //有视频没有图片时,将视频截图上传作为索引图 if (!$indexpic) { $url = $videodata['img']['host'] . $videodata['img']['dir'] . $videodata['img']['filepath'] . $videodata['img']['filename']; $material = $this->con->localMaterial($url, $contribute_id); $arr = array('content_id' => $contribute_id, 'mtype' => $material['type'], 'original_id' => $material['id'], 'host' => $material['host'], 'dir' => $material['dir'], 'material_path' => $material['filepath'], 'pic_name' => $material['filename']); $indexpic = $this->con->upload($arr); $this->con->update_indexpic($indexpic, $contribute_id); } //视频入库 $arr = array('content_id' => $contribute_id, 'mtype' => $videodata['type'], 'host' => $videodata['protocol'] . $videodata['host'], 'dir' => $videodata['dir'], 'vodid' => $videodata['id'], 'filename' => $videodata['file_name']); $this->con->upload($arr); } if ($contribute_id) { $this->con->send_contribute($contribute_id, $flag = 1); } $this->addItem($contribute_id); $this->output(); }
if (!$config) { return false; } $this->autoReply = $config['auto_reply']; $this->replyCon = $config['reply_content']; $this->token = $config['token']; } /** * 接受用户发送的微信消息 */ public function accept() { if (isset($_GET["echostr"])) { $checkResult = $this->checkSignature(); if ($checkResult) { echo $_GET["echostr"]; exit; } } //获取POST数据 $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; //处理POST数据 if (!empty($postStr)) { //解析收到的数据 $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $fromUserName = trim($postObj->FromUserName); $toUserName = trim($postObj->ToUserName); $createTime = intval($postObj->CreateTime); $msgType = trim($postObj->MsgType); $msgId = intval($postObj->MsgId); $text = isset($postObj->Content) ? trim($postObj->Content) : ''; $picUrl = isset($postObj->PicUrl) ? trim($postObj->PicUrl) : ''; $latitude = isset($postObj->Location_X) ? floatval($postObj->Location_X) : -1; $longitude = isset($postObj->Location_Y) ? floatval($postObj->Location_Y) : -1; $scale = isset($postObj->Scale) ? intval($postObj->Scale) : -1; $location = isset($postObj->Label) ? trim($postObj->Label) : ''; $title = isset($postObj->Title) ? trim($postObj->Title) : ''; $description = isset($postObj->Description) ? trim($postObj->Description) : ''; $url = isset($postObj->Url) ? trim($postObj->Url) : ''; $data = array('fromUserName' => $fromUserName, 'toUserName' => $toUserName, 'createTime' => $createTime, 'msgType' => $msgType, 'msgId' => $msgId); if (!empty($text)) { $data['brief'] = hg_cutchars($text, 100); } if (!empty($picUrl)) { $data['picUrl'] = $picUrl; } if ($latitude != -1) { $data['latitude'] = $latitude; } if ($longitude != -1) { $data['longitude'] = $longitude; } if ($scale != -1) { $data['scale'] = $scale; } if (!empty($location)) { $data['location'] = $location; } if (!empty($title)) { $data['title'] = $title; } if (!empty($description)) { $data['description'] = $description; } if (!empty($url)) { $data['url'] = $url; } $info = $this->weixin->create('message', $data); if ($data['msgType'] == 'text') { $textData = array('id' => $info['id'], 'content' => $text); $this->weixin->create('text_data', $textData); } //设置自动回复信息 if ($this->autoReply) { //默认回复文本信息 $fromUsername = $data['fromUserName']; $toUsername = $data['toUserName'];
/** * * 获取文章详细内容 */ public function show() { $id = $this->input['id'] ? intval($this->input['id']) : -1; if ($pubdate = trim(urldecode($this->input['pre']))) { //以日期为标准 前一篇文章 $condition = 'cm.pubdate < ' . $pubdate; } else { if ($pubdate = trim(urldecode($this->input['next']))) { //以日期为标准 后一篇文章 $condition = 'cm.pubdate > ' . $pubdate; } else { $condition = ''; } } //符合html标记 不全 $allow_tags = array('<a>', '<p>', '<br>'); $liv_proc = array('android' => 'httplive://'); $img_event = array(1 => 'showImg', 2 => 'livAndroid.showImg'); if ($id > 0 || $condition != '') { //有ID则以ID查询覆盖时间条件 否则已时间条件查询文章详细信息 if ($id > 0) { $condition = 'cm.id = ' . $id; } $sql = "SELECT cm.id,cm.pubdate,cm.modeid, cm.columnid,cm.contentid,mat.materialid,mat.filepath,mat.filename, mat.thumbfile, col.columnid,col.colname\r\n\t\t\t\tFROM " . DB_PREFIX . "contentmap cm \r\n\t\t\t\t\tleft join " . DB_PREFIX . "material mat \r\n\t\t\t\t\t\ton mat.materialid = cm.indexpic \r\n\t\t\t\t\tleft join " . DB_PREFIX . "column col\r\n\t\t\t\t\t\ton cm.columnid=col.columnid\r\n\t\t\t\t\tWHERE {$condition} \r\n\t\t\t\t\t\tand cm.status=3\r\n\t\t\t\t\t\tand cm.siteid=" . $this->site['siteid']; if ($this->input['debug']) { echo $sql; } //exit($sql); $r = $this->db->query_first($sql); if (!$r) { $this->errorOutput('内容不存在或已被删除'); } $msql = 'SELECT ma.*, c.modesign FROM ' . DB_PREFIX . 'mode_apply ma LEFT JOIN ' . DB_PREFIX . 'contentmode c ON ma.colmodeid=c.colmodeid WHERE ma.applyid=' . $r['modeid']; $mode = $this->db->query_first($msql); if ($r) { $csql = 'SELECT COUNT(*) AS count FROM ' . DB_PREFIX . 'comment WHERE contentid=' . $id; $c = $this->db->query_first($csql); } $r['indexpic'] = $this->getimageurl($r, 'filename'); $r['picurl'] = $r['indexpic']; $modec = $this->db->query_first('SELECT * FROM ' . DB_PREFIX . $mode['modesign'] . ' WHERE ' . $mode['modesign'] . 'id=' . $r['contentid']); $r = $r + $modec; if ($modec['subtitle']) { $r['brief'] = hg_cutchars($modec['subtitle'], 30, ''); } if (!$r['videoid']) { $r['videoid'] = $r['vid']; } if ($r['videoid']) { include_once ROOT_PATH . 'lib/class/curl.class.php'; $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir']); $curl->initPostData(); $curl->addRequestData('a', 'detail'); $curl->addRequestData('id', $r['videoid']); $video_info = $curl->request('vod.php'); $video_info = $video_info[0]; if ($video_info) { $curl->addRequestData('a', 'updateclick'); $curl->request('vod.php'); $r['video'] = array('host' => rtrim($video_info['hostwork'], '/') . '/', 'dir' => '', 'filepath' => $video_info['video_path'], 'filename' => str_replace('.mp4', '.m3u8', $video_info['video_filename']), 'is_audio' => $video_info['is_audio']); $r['vodurl'] = $video_info['vodurl']; $r['vodid'] = $video_info['vodid']; } $r['newcontent'] = $modec['comment']; } else { $r['vodurl'] = ''; $r['vodid'] = 0; } //内容转存于body表中 取出并拼接 $weburl = $this->site['weburl']; if ($mode['bodyfield']) { $content = $this->getAllContent($r['articleid'], $r['modeid']); @eval('$content = "' . addslashes($content) . ' " ;'); $r['newcontent'] = $content; } $r['pubdate'] = date('Y-m-d H:i:s', $r['pubdate']); $r['comment_count'] = intval($c['count']); $pics = array(); if ($r['newcontent']) { //获取内容中存在的所有图片 preg_match_all("/<img\\s+.*?\\s*src\\s*=\\s*[\\'\"]([^\\'\">\\s]*)[\\'\"]\\s*[^>]*>/is", $r['newcontent'], $imgs); if ($imgs[1]) { $i = 0; foreach ($imgs[1] as $v) { //$hg_pics[] = '<div class="img" onclick="' . $img_event[$this->input['source']] . '(\'' . $v . '\');" ><img src="' . $v . '" width="70" /><span class="img_show"></span></div>'; $v = explode('liv_loadfile/', $v); if (defined('CMS_IMG_DOMAIN') && CMS_IMG_DOMAIN && $v[0] == $this->site['weburl'] && $v[1]) { $pic = array('host' => CMS_IMG_DOMAIN, 'dir' => '', 'filepath' => '', 'filename' => $v[1]); $pics[$i]['pic'] = $pic; $i++; } else { if (!$v[1]) { $v[1] = ''; $idir = ''; } else { $idir = 'liv_loadfile/'; } $pic = array('host' => $v[0], 'dir' => $idir, 'filepath' => '', 'filename' => $v[1]); $pics[$i]['pic'] = $pic; $i++; } } } } else { $r['newcontent'] = $r['brief']; } if ($this->input['debug'] == 1) { print_r($r); } $imgcnt = count($hg_pics); //内容内嵌图片集合 以|分割的字符串 if ($imgcnt > 0) { $allimg = '<div class="cont_img_show" style="width:100px;float:right;" align="absmiddle">' . implode('', $hg_pics) . '</div>'; } if ($liv_proc[$this->input['client']]) { //$r['vedio'] = str_replace('http://', $liv_proc[$this->input['client']], $r['vedio']); } $r['newcontent'] = $allimg . strip_tags($r['newcontent'], implode('', $allow_tags)); $r['newcontent'] = str_replace(array("\r", "\n"), '', $r['newcontent']); $r['content'] = str_replace(array('<a ', '<A '), '<a target="_blank" ', $r['newcontent']); $r['column_name'] = $r['colname']; $r['material'] = $pics; $r['content_url'] = $this->site['weburl'] . 'location.php?id=' . $r['id']; unset($r['colname']); $this->setXmlNode('contents', 'content'); if (is_array($r) && $r) { $this->addItem($r); $this->output(); } else { $this->errorOutput('内容不存在或已被删除'); } } else { $this->errorOutput('未传入查询ID或文章发布日期'); } }
?> " ><img title="<?php echo $v['username']; ?> " style="border: 1px solid silver; height: 50px;padding: 2px;width: 50px;" src="<?php echo $v['middle_avatar']; ?> " /></a> <a title="<?php echo $v['username']; ?> " href="<?php echo hg_build_link(SNS_UCENTER . 'user.php', array('user_id' => $v['id'])); ?> "><?php echo hg_cutchars($v['username'], 3, '...', 1); ?> </a> <div class="close-concern"> <?php if ($this->user['id'] == $v['id']) { } else { if ($v['is_friend'] == 1) { ?> <p><span class="been-concern">√已关注</span> </p> <?php } else { ?> <p id="<?php echo 'add_' . $v['id'];
/** * * 获取文章列表数据 */ public function show() { //如果存在缓存直接读取缓存数据 $liv_proc = array('android' => 'httplive://'); $filename = 'vod_' . urldecode($this->input['columnid']) ? urldecode($this->input['columnid']) : 0; $output_fields = $this->show_fields(); $this->setXmlNode('vods', 'vod'); $limit_img = urldecode($this->input['limitimg']); $imgtype = urldecode($this->input['imgtype']); $imgtype = $imgtype ? $imgtype : 'small_thumbfile'; $offset = $this->input['offset'] ? intval($this->input['offset']) : 0; if (!$offset && !intval($this->input['sinceid']) && !intval($this->input['oldestid']) && !$limit_img && ($cache_file = $this->cache->readCache($filename))) { foreach ($cache_file as $key => $value) { $temp = array(); foreach ($output_fields as $v) { if (isset($value[$v])) { $temp[$v] = $value[$v]; } } $this->addItem($temp); } $this->output(); } //分页参数设置 $count = $this->input['count'] ? intval($this->input['count']) : 20; $data_limit = ' LIMIT ' . $offset . ' , ' . $count; $sql = "SELECT cm.id,cm.contentid, a.loadfile as materialid, a.*,cm.pubdate,ma.*,col.colname, cm.columnid\r\n\t\t\t\tFROM " . DB_PREFIX . "contentmap cm \r\n\t\t\t\t\tleft join " . DB_PREFIX . "vod a \r\n\t\t\t\t\t\ton cm.contentid = a.vodid \r\n\t\t\t\t\tleft join " . DB_PREFIX . "column col\r\n\t\t\t\t\t\ton cm.columnid=col.columnid\r\n\t\t\t\t\tleft join " . DB_PREFIX . "material ma\r\n\t\t\t\t\t\ton a.loadfile=ma.materialid\r\n\t\t\t\t\tWHERE cm.modeid=5 and cm.status=3\r\n\t\t\t\t\t\tand cm.siteid=" . $this->site['siteid'] . $where; //获取查询条件; $condition = $this->get_condition() . ' ORDER BY cm.istop DESC, cm.pubdate desc'; $sql = $sql . $condition . $data_limit; $q = $this->db->query($sql); $artlists = array(); $vids = array(); while (false !== ($row = $this->db->fetch_array($q))) { $row['imgurl'] = $this->getimageurl($row, $imgtype); $row['pubdate'] = date('Y-m-d h:i:s', $row['pubdate']); if ($row['starttime']) { $row['starttime'] = date('Y-m-d', $row['starttime']); } else { $row['starttime'] = ''; } if ($row['vid']) { $vids[] = $row['vid']; $row['is_video'] = 1; } else { $row['is_video'] = 0; } $row['brief'] = hg_cutchars($row['comment'], 38, ''); $artlists[] = $row; } if ($this->input['sinceid']) { arsort($artlists); } $vodinfos = array(); if ($vids) { include_once ROOT_PATH . 'lib/class/curl.class.php'; $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir']); $curl->initPostData(); foreach ($vids as $k => $vid) { $curl->addRequestData('id[' . $k . ']', $vid); } $video_info = $curl->request('vod.php'); foreach ($video_info as $v) { $vodinfos[$v['id']] = $v; } } $cache_data = array(); foreach ($artlists as $v) { $v['vodid'] = $vodinfos[$v['vid']]['vodid']; $v['vodurl'] = $vodinfos[$v['vid']]['vodurl']; //是否需要显示 row中包含的字段过多 $temp = array(); foreach ($output_fields as $vv) { if (isset($v[$vv])) { $temp[$vv] = $v[$vv]; } } $cache_data[] = $temp; $this->addItem($temp); } $this->cache->buildCache($filename, serialize($cache_data)); $this->output(); }
?> :</a> <?php if (is_array($programe)) { // $num = $total; $num = 1; foreach ($programe as $kp => $vp) { ?> <a style="color:#333;" title="<?php echo $vp['programe_name']; ?> " href="<?php echo $url . "#" . $vp['id']; ?> "><?php echo hg_cutchars($vp['programe_name'], 8, ".."); ?> </a> <?php $num++; } } ?> </li> <li> <?php if (is_array($video)) { ?> <ul class="pre" id="pre_<?php echo $v['id']; ?>
<td>回复/阅读</td> <td>最后发表</td> </tr> {foreach $topic_list as $key => $value} <tr class="con_tr"> <td> {$value['flag']} <span title="由 {$value['user_name']} 于 {$value['pub_time']} 发起, {$value['click_count']}次阅读, {$value['post_count']}篇回复"> <a href="<?php echo SNS_TOPIC . $value['topic_link']; ?> " {$value['style']}> <?php echo hg_cutchars($value['title'], 15, '…', true); ?> </a>{$value['cons']}</span> </td> <td> <span style="font-size:14px;float: left;"><a href="<?php echo SNS_TOPIC . $value['group_link']; ?> ">{$value['group_name']}</a></span> <div class="author"> {$value['avatar']} {$value['user_link']} <span class="times">{$value['pub_time']}</span> </div> </td> <td>{code} echo ($value['post_count']){/code}/{code} echo $value['click_count'];{/code}</td>
/** * * @Description * @author Kin * @date 2013-6-6 下午03:50:51 * @see outerUpdateBase::create() */ public function create() { //检测社区黑名单 $this->check_black(); if (!intval($this->input['sort_id'])) { $this->errorOutput(NO_SORT_ID); } //限制发帖时间 if ($this->user['user_id']) { $condition = ' AND member_id=' . $this->user['user_id'] . ''; $latest_info = $this->sh->getSeekhelplist($condition, ' ORDER BY order_id DESC', 0, 1, $this->input['sort_id']); if ($latest_info[0]) { if ($latest_info[0]['create_time'] + LIMIT_POSTING_TIME >= TIMENOW) { $this->errorOutput(POSTING_FAST); } if ($latest_info[0]['content'] == trim($this->input['content'])) { $this->errorOutput(CONTENT_EXIST); } } } $data = array('title' => trim($this->input['title']), 'status' => 0, 'appid' => $this->user['appid'], 'appname' => $this->user['display_name'], 'baidu_longitude' => trim($this->input['baidu_longitude']), 'baidu_latitude' => trim($this->input['baidu_latitude']), 'GPS_longitude' => trim($this->input['GPS_longitude']), 'GPS_latitude' => trim($this->input['GPS_latitude']), 'location' => trim($this->input['location']), 'sort_id' => intval($this->input['sort_id']), 'section_id' => intval($this->input['section_id']), 'account_id' => intval($this->input['account_id']), 'org_id' => $this->user['org_id'], 'member_id' => $this->user['user_id'], 'tel' => trim($this->input['tel']), 'create_time' => TIMENOW, 'comment_latest_time' => TIMENOW, 'ip' => $this->user['ip']); $content = trim($this->input['content']); if (empty($content)) { $this->errorOutput(NO_CONTENT); } if ($data['section_id']) { $sectionInfo = $this->section->detail($data['section_id']); if (!$sectionInfo) { $this->errorOutput(NO_SECTION); } } //会员黑名单验证 if ($data['member_id']) { include_once ROOT_PATH . 'lib/class/members.class.php'; $obj = new members(); $res = $obj->check_blacklist($data['member_id']); if ($res[$data['member_id']]['isblack']) { //$this->addItem_withkey('error', "您的评论被屏蔽,请联系管理员!"); //$this->addItem_withkey('msg', "您的评论被屏蔽,请联系管理员!"); //$this->output(); $this->errorOutput(IS_BLACK_MEMBER); } } //分类异常处理 $data['sort_id'] = $this->sh->sortException($data['sort_id']); if (defined('SEEKHELP_STATUS') && SEEKHELP_STATUS && !$_FILES['photos'] && !$_FILES['video']) { $data['status'] = 1; } if (defined('SEEKHELP_MATERIAL_STATUS') && SEEKHELP_MATERIAL_STATUS && ($_FILES['photos'] || $_FILES['video'])) { $data['status'] = 1; } if ($this->input['app_id']) { $app_id = $this->input['app_id']; $appconfig = $this->appconfig->detail($app_id); if ($appconfig['seekhelp_audit'] == 0) { $data['status'] = 1; } else { $data['status'] = 0; } } //屏蔽字验证 if ($this->settings['App_banword'] && defined('IS_BANWORD') && IS_BANWORD) { require_once ROOT_PATH . 'lib/class/banword.class.php'; $this->banword = new banword(); $str = $data['title'] . $content; $banword = $this->banword->exists($str); if ($banword && is_array($banword)) { $banword_title = ''; $banword_content = ''; foreach ($banword as $key => $val) { if (strstr($data['title'], $val['banname'])) { $banword_title .= $val['banname'] . ','; } if (strstr($content, $val['banname'])) { $banword_content .= $val['banname'] . ','; } } $banword_title = $banword_title ? rtrim($banword_title, ',') : ''; $banword_content = $banword_content ? rtrim($banword_content, ',') : ''; if ($banword_title || $banword_content) { $banwords = array('title' => $banword_title, 'content' => $banword_content); $data['status'] = 0; //含有屏蔽字直接未审 $data['banword'] = serialize($banwords); } } } //如果百度坐标存在的话,就转换为GPS坐标也存起来 if ($data['baidu_longitude'] && $data['baidu_latitude'] && !$data['GPS_longitude'] && !$data['GPS_latitude']) { $gps = $this->sh->FromBaiduToGpsXY($data['baidu_longitude'], $data['baidu_latitude']); $data['GPS_longitude'] = $gps['GPS_x']; $data['GPS_latitude'] = $gps['GPS_y']; } //如果GPS坐标存在的话,就转换为百度坐标也存起来 if (!$data['baidu_longitude'] && !$data['baidu_latitude'] && $data['GPS_longitude'] && $data['GPS_latitude']) { $baidu = $this->sh->FromGpsToBaiduXY($data['GPS_longitude'], $data['GPS_latitude']); $data['baidu_longitude'] = $baidu['x']; $data['baidu_latitude'] = $baidu['y']; } if (!$data['title']) { $data['title'] = hg_cutchars($content, 100); } if (!$data['title']) { $this->errorOutput('请输入内容'); } //初始化的数据 $is_img = 0; $is_video = 0; $is_reply = 0; //添加求助信息 $seekhelpInfor = $this->sh->add_seekhelp($data); if (!$seekhelpInfor['id']) { $this->errorOutput('数据库插入失败'); } $id = $seekhelpInfor['id']; //添加描述 if ($content) { $contentInfor = $this->sh->add_content($content, $id); if (!$contentInfor) { $this->errorOutput('数据库插入失败'); } $data['content'] = $contentInfor; } //图片上传 if ($_FILES['photos']) { $photos = array(); //检测图片服务器 if (!$this->settings['App_material']) { $this->errorOutput('图片服务器未安装!'); } //获取图片服务器上传配置 // $PhotoConfig = $this->sh->getPhotoConfig(); // if (!$PhotoConfig) // { // $this->errorOutput('获取允许上传的图片类型失败!'); // } $count = count($_FILES['photos']['name']); for ($i = 0; $i < $count; $i++) { if ($_FILES['photos']['name'][$i]) { if ($_FILES['photos']['error'][$i] > 0) { $this->errorOutput('图片上传异常'); } /* if (!in_array($_FILES['photos']['type'][$i], $PhotoConfig['type'])) { $this->errorOutput('只允许上传'.$PhotoConfig['hit'].'格式的图片'); } */ if ($_FILES['photos']['size'][$i] > 100000000) { $this->errorOutput('只允许上传100M以下的图片!'); } foreach ($_FILES['photos'] as $k => $v) { $photo['Filedata'][$k] = $_FILES['photos'][$k][$i]; } $photos[] = $photo; } } if (!empty($photos)) { //循环插入图片服务器 foreach ($photos as $val) { $PhotoInfor = $this->sh->uploadToPicServer($val, $id); if (empty($PhotoInfor)) { $this->errorOutput('图片服务器错误!'); } $temp = array('cid' => $id, 'type' => $PhotoInfor['type'], 'original_id' => $PhotoInfor['id'], 'host' => $PhotoInfor['host'], 'dir' => $PhotoInfor['dir'], 'filepath' => $PhotoInfor['filepath'], 'filename' => $PhotoInfor['filename'], 'imgwidth' => $PhotoInfor['imgwidth'], 'imgheight' => $PhotoInfor['imgheight'], 'mark' => 'img'); //插入数据库 $ret_pic = $this->sh->upload_pic($temp); if ($ret_pic) { $data['pic'][] = $ret_pic; } else { $this->errorOutput('图片入库失败'); } } $is_img = 1; } } //视频上传 if ($_FILES['video']) { $videos = array(); //检测视频服务器 if (!$this->settings['App_mediaserver']) { $this->errorOutput('视频服务器未安装!'); } //获取视频服务器上传配置 $videoConfig = $this->sh->getVideoConfig(); if (!$videoConfig) { $this->errorOutput('获取允许上传的视频类型失败!'); } $count = count($_FILES['video']['name']); for ($i = 0; $i < $count; $i++) { if ($_FILES['video']['name'][$i]) { if ($_FILES['video']['error'][$i] > 0) { $this->errorOutput('视频上传异常'); } /* $filetype = strtolower(strrchr($_FILES['video']['name'][$i], '.')); if (!in_array($filetype, $videoConfig['type'])) { $this->errorOutput('只允许上传'.$videoConfig['hit'].'格式的视频'); } */ foreach ($_FILES['video'] as $k => $v) { $video['videofile'][$k] = $_FILES['video'][$k][$i]; } $videos[] = $video; } } if (!empty($videos)) { foreach ($videos as $videoInfor) { //上传视频服务器 $videodata = $this->sh->uploadToVideoServer($videoInfor, $data['title'], '', 2); if (!$videodata) { $this->errorOutput('视频服务器错误!'); } //视频入库 $arr = array('cid' => $id, 'type' => $videodata['type'], 'host' => $videodata['protocol'] . $videodata['host'], 'dir' => $videodata['dir'], 'original_id' => $videodata['id'], 'filename' => $videodata['file_name'], 'mark' => 'video'); $ret_vod = $this->sh->upload_vod($arr); if ($ret_vod) { $data['video'][] = $ret_vod; } else { $this->errorOutput('视频入库失败'); } } $is_video = 1; } } //更新主表回复,图片,视频纪录 $status = array('is_reply' => 0, 'is_img' => $is_img, 'is_video' => $is_video); $ret_status = $this->sh->update_status($status, $id); if ($ret_status) { $data['is_reply'] = $ret_status['is_reply']; $data['is_img'] = $ret_status['is_img']; $data['is_video'] = $ret_status['is_video']; } if ($data['status']) { $this->SetTimeline($id); //更新会员统计 $this->updateMemberCount($data['member_id'], 'create'); } $data['id'] = $id; $this->addItem($data); $this->output(); }
public function get_block_content_html() { $data = array(); $str = ''; $block_id = intval($this->input['block_id']); // $line_num = intval($this->input['line_num']); $pic_width = urldecode($this->input['pic_width']); $pic_height = urldecode($this->input['pic_height']); $title_num = urldecode($this->input['title_num']); $brief_num = urldecode($this->input['brief_num']); if (!$block_id) { $result = array('error' => '未传区块'); $this->addItem($result); $this->output(); } //取区块信息 $block_data = $this->obj->get_block_first($block_id); //取区块每行内容 $content_data = $this->block_set->get_block_content($block_id, $block_data['line_num']); //取区块每行信息 $line_data = $this->block_set->get_block_line($block_id); //父标签 $str = "<" . $block_data['father_tag'] . " style='"; if ($block_data['width']) { $str .= "width:" . $block_data['width'] . "px;"; } if ($block_data['height']) { $str .= "height:" . $block_data['height'] . "px;"; } $str .= "'>"; //每行 foreach ($line_data as $k => $v) { if (!empty($content_data[$k])) { foreach ($content_data[$k] as $kk => $vv) { $title = $title_num ? hg_cutchars($vv['title'], $title_num, '') : $vv['title']; $brief = $brief_num ? hg_cutchars($vv['brief'], $brief_num, '') : $vv['brief']; $outlink = $vv['outlink']; if (!empty($vv['indexpic'])) { $pic_data = unserialize($vv['indexpic']); $indexpic = $pic_data['host'] . $pic_data['dir']; if ($pic_width && !$pic_height) { $indexpic .= $pic_width . "x" . "0/"; } else { if ($pic_width && $pic_height) { $indexpic .= $pic_width . "x" . $pic_height . "/"; } } $indexpic .= $pic_data['filepath'] . $pic_data['filename']; } $loop_body = $v['loop_body'] ? $v['loop_body'] : $block_data['loop_body']; // print_r($loop_body);exit; eval("\$li_data = \"{$loop_body}\";"); //生成样式 $style = " style='"; if ($v['width']) { $style .= "width:" . $v['width'] . "px;"; } if ($v['height']) { $style .= "height:" . $v['height'] . "px;"; } $style .= "'"; if (!($insert_i = stripos($v['loop_body'], '>'))) { $result = array('error' => '未找到区块样式的标识'); $this->addItem($result); $this->output(); } //插入样式 $str .= str_insert($li_data, $insert_i, $style); } } } $str .= "</" . $block_data['father_tag'] . ">"; $this->addItem($str); $this->output(); }
$p_id = $value['id']; {/code} <li id="p_show_{$value['id']}" onmouseover="edit_del({$value['id']},1);" onmouseout="edit_del({$value['id']},0);"> <div class="program_time"> <img src="<?php echo RESOURCE_DIR; ?> img/play_default.png"/><?php echo hg_toff_time($value['start_time'], $value['end_time']); ?> </div> <div class="program_name"><a target="_blank" title="{$value['programe_name']}" id="program_name_{$value['id']}"href="<?php echo hg_build_link('station_play.php', array('sta_id' => $value['sta_id'], 'user_id' => $value['user_id'])); ?> "><?php echo hg_cutchars($value['programe_name'], 10, " "); ?> </a></div> <div class="program_manage" id="p_{$value['id']}"> <a href="javascript:void(0);" onclick="program({$sta_id},{$value['id']},1);">编辑</a> <a href="javascript:void(0);" onclick="program({$sta_id},{$value['id']},2);">删除</a> {if $i!=1} <a href="javascript:void(0);" onclick="program({$sta_id},{$value['id']},3);">上移</a> {/if} {if $i!=$count} <a href="javascript:void(0);" onclick="program({$sta_id},{$value['id']},4);">下移</a> {/if} </div> </li> <li id="p_edit_{$value['id']}" style="display:none"> <ul>
"><?php echo hg_cutchars($value['title'], 19, " "); ?> </a> <p>播放:{$value['play_count']}</p> <p>评论:{$value['comment_count']}</p> </div> {else} <div class="ottv mars"><a title="{$value['title']}" href="<?php echo hg_build_link("video_play.php", array('id' => $value['id'])); ?> "><img src="{$value['schematic']}" width="122" height="91" /></a><a style="height: 14px;*height: 12px;overflow: hidden; width: 120px;" title="{$value['title']}" href="<?php echo hg_build_link("video_play.php", array('id' => $value['id'])); ?> "><?php echo hg_cutchars($value['title'], 19, " "); ?> </a> <p>播放:{$value['play_count']}</p> <p>评论:{$value['comment_count']}</p> </div> {/if} {code} $i++; {/code} {/foreach} {/if} </div> <div class="gsub1 clear"><img src="<?php echo RESOURCE_DIR; ?>
echo $this->lang['topic_follow']; ?> <strong>(<span id="liv_topic_follow_num"><?php echo count($topic_follow); ?> </span>)</strong> </div> <div class="wb-block1"> <ul class="topic clear"> <?php if ($topic_follow) { foreach ($topic_follow as $key => $value) { ?> <li class="topic_li" onmouseover="this.className='topic_li_hover'" onmouseout="this.className='topic_li'"> <?php $title = '<a title="' . $value['title'] . '" href="' . hg_build_link('k.php', array('q' => $value['title'])) . '">' . hg_cutchars($value['title'], 10, " ") . '</a>'; echo $title; ?> <a class="close" href="javascript:void(0);" onclick="del_Topic_Follow('<?php echo $value['topic_id']; ?> ',this)"></a> <div class="hidden" id="topic_<?php echo $value['topic_id']; ?> "><?php echo $value['title']; ?> </div> </li> <?php
public function search_video() { $id = $this->user['id']; if (!$id) { $this->check_login(); } $station = $this->mVideo->get_user_station($id); $sta_id = $this->input['sta_id'] ? $this->input['sta_id'] : ($station['id'] ? $station['id'] : 0); $count = 15; $page = (intval($this->input['pp']) ? intval($this->input['pp']) : 0) / $count; $type = $this->input['type'] ? $this->input['type'] : 1; $html = '<ul class="video_title">'; $error = ""; $title = $this->input['title'] ? $this->input['title'] : ""; $video_info = $this->mVideo->video_search($title, $page, $count); if (!$video_info) { $error = '<li><img align="absmiddle" src="' . RESOURCE_DIR . 'img/error.gif" alt="" title="">关键字不为空</li>'; } if (count($video_info) == 1) { $error = '<li><img align="absmiddle" src="' . RESOURCE_DIR . 'img/error.gif" alt="" title="">关键字“<b style="color:red;">' . $title . '</b>”没有相关视频</li>'; } $html .= '<li><a href="javascript:void(0);" onclick="tab_video(1);">我的视频</a></li> <li><a href="javascript:void(0);" onclick="tab_video(2);">我的收藏</a></li> <li class="video_title_now"><a href="javascript:void(0);">搜索</a></li> <li style="width: auto; margin: 0pt; padding-top: 6px;"><input type="text" id="video_search" style="width: 110px; float: left;" value="' . $title . '"/> <input type="button" value="GO" id="bt_0" style="float: left;" onclick="search_video(this);"/></li>'; $video_info['total'] = $video_info[count($video_info) - 1]; $html .= '</ul> <ul class="video-list">' . $error; $li = ""; if ($video_info) { $data['totalpages'] = $video_info['total']; unset($video_info['total']); unset($video_info[count($video_info) - 1]); $data['perpage'] = $count; $data['curpage'] = $this->input['pp']; $data['pagelink'] = hg_build_link('', array('sta_id' => $sta_id)); $data['onclick'] = 'onclick="page_show(this,3);"'; $showpages = hg_build_pagelinks($data); foreach ($video_info as $key => $value) { $li .= '<li><span>·</span> <a href="javascript:void(0);" onclick="add_program(' . $value['id'] . ',' . $sta_id . ',' . $value['toff'] . ')">' . hg_cutchars($value['title'], 10, "..") . '</a><span id="v_' . $value['id'] . '" style="display:none;">' . $value['title'] . '</span><img src="' . RESOURCE_DIR . 'img/play_bt.jpg"/> </li>'; } } $html .= $li . "</ul>" . $showpages; echo $html; exit; }
{foreach $video_info as $key => $value} <li class="search_li"> <ul class="search_result"> <li><a target="_blank" href="<?php echo hg_build_link("video_play.php", array("id" => $value['id'])); ?> "><img src="{$value['schematic']}"/></a></li> <li>名称:<a target="_blank" href="<?php echo hg_build_link("video_play.php", array("id" => $value['id'])); ?> "><?php echo hg_match_red(hg_cutchars($value['title'], 7, " "), $name); ?> </a></li> <li>标签:<?php echo $value['tags'] ? hg_tags(hg_cutchars($value['tags'], 7, " "), $name) : "暂无"; ?> </li> <li>播发次数:{$value['play_count']}</li> </ul> </li> {/foreach} </ul> {$showpages} {/if} </div> <div class="con_bottom clear"></div> {/if} </div> </div>
public function get_sketch_map() { if (!$this->input['id']) { return false; } $sql = "SELECT * FROM " . DB_PREFIX . "vote_question WHERE id = " . intval($this->input['id']); $ret = $this->db->query_first($sql); $pictures_info = unserialize($ret['pictures_info']); $srcPath = $pictures_info['filepath'] . $pictures_info['filename']; //获取当前脚本名称 $url = $_SERVER['PHP_SELF']; $scriptname = end(explode('/', $url)); $scriptname = explode('.', $scriptname); $scriptname = $scriptname[0]; $newName = $scriptname . '_' . $ret['id'] . ".png"; $title = array(); $title[] = hg_cutchars($ret['title'], 20); $sql = "SELECT * FROM " . DB_PREFIX . "question_option WHERE vote_question_id = " . intval($this->input['id']) . " ORDER BY id ASC"; $q = $this->db->query($sql); while ($r = $this->db->fetch_array($q)) { $arr = $r['title'] . '_' . $r['single_total']; $title[] = $arr; } $title = implode(',', $title); $url = $this->material->create_sketch_map($srcPath, $newName, $title, 'vote_question'); $this->addItem($url); $this->output(); }
<a title="<?php echo $value['web_station_name']; ?> " href="<?php echo hg_build_link(SNS_VIDEO . "station_play.php", array('sta_id' => $value['id'])); ?> "><img src="<?php echo $value['small']; ?> "/></a><br/> <a title="<?php echo $value['web_station_name']; ?> " href="<?php echo hg_build_link(SNS_VIDEO . "station_play.php", array('sta_id' => $value['id'])); ?> "><?php echo hg_cutchars($value['web_station_name'], 5, " "); ?> </a> </li> <?php } ?> </ul> <div class="clear1"></div> </div> </div> </div> <?php }
echo fetch_picture_path($v, PHOTO_SIZE3); ?> " /> <div class="albums_title"> <a title="<?php echo $v['albums_name']; ?> " href="<?php echo ALBUMS_URL; ?> ?m=albums&albums_id=<?php echo $v['albums_id']; ?> &a=albums_view" ><?php echo hg_cutchars($v['albums_name'], 5, '...'); ?> </a> </div> </div> </li> <?php } ?> </ul> <?php } else { echo hg_show_null(" ", "暂未创建相册", 1); } ?>
{ $words = "分享"; $action = ' onclick = "showMyGroups('.$v['id'].')"'; } $tong = '| <a title="分享到讨论区" href="javascript:void(0);" id="thr_'.$v['id'].'" '.$action.' >'.$words.'</a>'; {/code} {else} {code} $link = "javascript:void(0);"; $tar = ''; {/code} {/if} <tr height="72px" id="video_info_{$v['id']}" align="center" class="video_list"> <td><span><img id="video_img_{$v['id']}" style="width:67px;height:50px;display:inline-block;" src="{$v['schematic']}" title="{$v['title']}" /></span></td> <td><a href="{$link}" title="{$v['title']}" {$tar} style="margin-left:10px;" id="video_name_{$v['id']}"><?php echo hg_cutchars($v['title'], 6, " "); ?> </a></td> <td> {if $v['state'] == 0} {code} echo '<span style="color:blue;">转码中...</span>'; {/code} {else} {code} switch($v['is_show']) { case 0 : echo '<span style="color:blue;">待审核...</span>';break; case 1 : echo '<span style="color:red;">未通过审核</span>';break; case 2 : echo '<span style="color:green;">已发布</pan>';break; case 3 : echo '<span style="color:green;">推荐中</span>';break;
<li>暂无视频<a target="_blank" href="upload.php">上传</a></li> <?php } else { foreach ($video_info as $key => $value) { ?> <li><span>·</span><a href="javascript:void(0);" onclick="add_program(<?php echo $value['id']; ?> ,<?php echo $sta_id; ?> ,<?php echo $value['toff']; ?> )"><?php echo hg_cutchars($value['title'], 10, ".."); ?> </a><span id="v_<?php echo $value['id']; ?> " style="display:none;"><?php echo $value['title']; ?> </span><img src="<?php echo RESOURCE_DIR; ?> img/play_bt.jpg"/></li> <?php } } ?>