public function __construct() { parent::__construct(); $this->s_db = Loader::model('poster_space_model'); $this->db = Loader::model('poster_model'); $this->M = String::htmlspecialchars(S('common/poster')); }
/** * 申请友情链接 */ public function register() { if (isset($_POST['dosubmit'])) { if ($_POST['name'] == "") { showmessage(L('sitename_noempty'), U('link/index/register')); } if ($_POST['url'] == "") { showmessage(L('siteurl_not_empty'), U('link/index/register')); } if (!in_array($_POST['linktype'], array('0', '1'))) { $_POST['linktype'] = '0'; } $link_db = Loader::model('link_model'); $_POST['logo'] = String::htmlspecialchars($_POST['logo']); if ($_POST['linktype'] == '0') { $sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url']); } else { $sql = array('typeid' => $_POST['typeid'], 'linktype' => $_POST['linktype'], 'name' => $_POST['name'], 'url' => $_POST['url'], 'logo' => $_POST['logo']); } $link_db->insert($sql); showmessage(L('add_success'), U('link/index')); } else { $setting = S('common/link'); if (isset($setting['is_post']) && $setting['is_post'] == '0') { showmessage(L('suspend_application'), HTTP_REFERER); } $this->type = Loader::model('type_model'); $types = $this->type->get_types(); // 获取站点下所有友情链接分类 $SEO = seo('', L('application_links'), '', ''); include template('link', 'register'); } }
public function encode($text, $textType = "") { if (is_object($text)) { return $text; } return String::htmlspecialchars($text); }
/** * 首页 友情链接分类 循环 . * * @param * $data */ public function type_lists($data) { if (!in_array($data['listorder'], array('desc', 'asc'))) { $data['listorder'] = 'desc'; } $sql = array('application' => APP); $r = $this->type_db->where($sql)->order('listorder ' . $data['listorder'])->limit($data['limit'])->select(); return String::htmlspecialchars($r); }
public function encode($text, $textType = "") { if (is_object($text)) { return $text; } $textType = Converter::initTextType($textType); if ($textType == Converter::HTML) { return $text; } return String::htmlspecialchars($text); }
public function init() { if (isset($_GET['typeid'])) { $where = array('typeid' => intval($_GET['typeid'])); } else { $where = array(); } $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1; $infos = $this->db->where($where)->order('listorder DESC,linkid DESC')->listinfo($page, 15); $pages = $this->db->pages; $types = $this->db2->where(array('application' => APP))->order('typeid DESC')->listinfo(); $types = String::htmlspecialchars($types); $type_arr = array(); foreach ($types as $typeid => $type) { $type_arr[$type['typeid']] = $type['name']; } $big_menu = big_menu('?app=link&controller=link&action=add', 'add', L('link_add'), 700, 450); include $this->view('link_list'); }
/** * 查看系统短消息 */ public function read_group() { if ((!isset($_GET['group_id']) || empty($_GET['group_id'])) && (!isset($_POST['group_id']) || empty($_POST['group_id']))) { return false; } // 查询消息详情 $infos = $this->message_group_db->getby_id($_GET['group_id']); $infos = String::htmlspecialchars($infos); if (!is_array($infos)) { showmessage(L('message_not_exist'), 'blank'); } // 检查查看表是否有记录,无则向message_data 插入浏览记录 $check = $this->message_data_db->where(array('userid' => $this->_userid, 'group_message_id' => $_GET['group_id']))->select(); if (!$check) { $this->message_data_db->insert(array('userid' => $this->_userid, 'group_message_id' => $_GET['group_id'])); } include template('message', 'read_group'); }
/** * 统计广告展示次数 * * @param intval $spaceid 广告版位ID * @param intval $id 广告ID * @return boolen */ protected function show_stat($spaceid = 0, $id = 0) { $M = String::htmlspecialchars(S('common/poster')); if ($M['enablehits'] == 0) { return true; } $spaceid = intval($spaceid); $id = intval($id); if (!$id) { return false; } if (!$spaceid) { $r = $this->db->where(array('id' => $id))->field('spaceid')->find(); $spaceid = $r['spaceid']; } $ip = IP; $ip_area = Loader::lib('lib/lib_ip'); $area = $ip_area->get($ip); $username = cookie('username') ? cookie('username') : ''; $this->db->where(array('id' => $id))->update(array('hits' => '+1')); $this->s_db->insert(array('pid' => $id, 'spaceid' => $spaceid, 'username' => $username, 'area' => $area, 'ip' => $ip, 'referer' => HTTP_REFERER, 'clicktime' => TIME, 'type' => 0)); return true; }