예제 #1
0
 public function pl($dir, $did, $cid = 0, $page = 1)
 {
     if (Pl_Modes == 1) {
         //友言
         return '<div id="uyan_frame"></div><script type="text/javascript" src="http://v2.uyan.cc/code/uyan.js?uid=' . Pl_Yy_Name . '"></script>';
     }
     if (Pl_Modes == 2) {
         //多说
         return "<div class='ds-thread' data-thread-key='" . $dir . "-" . $did . "'></div><script type='text/javascript'>var duoshuoQuery={short_name:\"" . Pl_Ds_Name . "\"};(function(){var ds=document.createElement('script');ds.type='text/javascript';ds.async=true;ds.src=(document.location.protocol=='https:'?'https:':'http:')+'//static.duoshuo.com/embed.js';ds.charset='UTF-8';(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(ds)})();</script>";
     }
     if (Pl_Modes == 3) {
         //畅言
         return "<div id='SOHUCS' sid='" . $dir . "-" . $did . "'></div><script>(function(){var appid='" . Pl_Cy_Id . "',conf='prod_28f42ecbb9691ec71b9dcc68742151c2';var doc=document,s=doc.createElement('script'),h=doc.getElementsByTagName('head')[0]||doc.head||doc.documentElement;s.type='text/javascript';s.charset='utf-8';s.src='http://assets.changyan.sohu.com/upload/changyan.js?conf='+conf+'&appid='+appid;h.insertBefore(s,h.firstChild)})()</script>";
     }
     if (Pl_Modes == 4) {
         //网站关闭评论
         return "<div id='cscms_pl' style='text-align:center;'><b>网站已经关闭了评论~!</b></div>";
     }
     if ($did == 0) {
         //参数错误
         return "<div id='cscms_pl' style='text-align:center;'><b>参数错误,数据ID为空~!</b></div>";
     }
     $data_content = '';
     //Token
     $this->load->helper('string');
     $token = random_string('alnum', 10);
     $_SESSION['pltoken'] = $token;
     //装载模板
     if ($dir == 'blog') {
         $skins = getzd('user', 'skins', getzd('blog', 'uid', $did));
         $this->load->get_templates('home', 0, $skins);
     } else {
         $this->load->get_templates($dir, 1);
     }
     $Mark_Text = $this->load->view('pl.html', '', true);
     //预先除了分页
     $pagenum = getpagenum($Mark_Text);
     preg_match_all('/{cscms:([\\S]+)\\s+(.*?pagesize=\\"([\\S]+)\\".*?)}([\\s\\S]+?){\\/cscms:\\1}/', $Mark_Text, $page_arr);
     if (!empty($page_arr) && !empty($page_arr[2])) {
         $field = $page_arr[1][0];
         //前缀名
         //组装SQL数据
         $arr['did'] = $did;
         $sql = "SELECT {field} FROM " . CS_SqlPrefix . "pl where dir='" . $dir . "'";
         $sqlstr = $this->skins->cscms_sql($page_arr[1][0], $page_arr[2][0], $page_arr[0][0], $page_arr[3][0], 'id', $arr, $cid, $sql);
         $nums = $this->db->query($sqlstr)->num_rows();
         //总数量
         $Arr = spanajaxpage($sqlstr, $nums, $page_arr[3][0], $pagenum, 'cscms_pl', $page);
         if ($nums == 0) {
             $data_content .= "";
         } else {
             $sorti = 1;
             $result_array = $this->db->query($Arr[0])->result_array();
             foreach ($result_array as $row2) {
                 $datatmp = $this->skins->cscms_skins($field, $page_arr[0][0], $page_arr[4][0], $row2, $sorti);
                 $sorti++;
                 $data_content .= $datatmp;
             }
         }
         $Mark_Text = page_mark($Mark_Text, $Arr);
         //分页解析
         $Mark_Text = str_replace($page_arr[0][0], $data_content, $Mark_Text);
     }
     unset($page_arr);
     $Mark_Text = str_replace("[pl:token]", $token, $Mark_Text);
     //表情
     $plfaces = "";
     for ($i = 1; $i <= 56; $i++) {
         $plfaces .= "<img style='cursor:pointer;' src=\"" . Web_Path . "packs/images/faces/e" . $i . ".gif\" onclick=\"\$('#cscms_pl_content').val(\$('#cscms_pl_content').val()+'[em:" . $i . "]');\$('#cscms_faces').hide();\" />";
     }
     $Mark_Text = str_replace("[pl:faces]", $plfaces, $Mark_Text);
     //判断登录
     $login = '******';
     if (Pl_Youke == 0) {
         if (!$this->CsdjUser->User_Login(1)) {
             $login = '******';
         }
     }
     $Mark_Text = str_replace("[pl:login]", $login, $Mark_Text);
     $Mark_Text = $this->skins->template_parse($Mark_Text, false);
     return $Mark_Text;
 }
예제 #2
0
 public function ajax()
 {
     $callback = $this->input->get('callback', true);
     $uid = intval($this->uri->segment(4));
     $page = intval($this->uri->segment(5));
     $data = $data_content = $aliasname = '';
     //模板
     $tpl = 'gbook-ajax.html';
     //URL地址
     $url = 'gbook/ajax/' . $uid;
     //当前会员
     $row = $this->CsdjDB->get_row_arr('user', '*', $uid);
     if (empty($row['nichen'])) {
         $row['nichen'] = $row['name'];
     }
     //装载模板
     $sid = defined('PLUBPATH') ? 1 : 0;
     $this->load->get_templates('home', $sid, $row['skins']);
     $Mark_Text = $this->load->view($tpl, '', true);
     $Mark_Text = $this->skins->cscms_common($Mark_Text, $row['skins']);
     //预先除了分页
     $pagenum = getpagenum($Mark_Text);
     preg_match_all('/{cscms:([\\S]+)\\s+(.*?pagesize=\\"([\\S]+)\\".*?)}([\\s\\S]+?){\\/cscms:\\1}/', $Mark_Text, $page_arr);
     if (!empty($page_arr) && !empty($page_arr[2])) {
         $field = $page_arr[1][0];
         //前缀名
         //组装SQL数据
         $arr['uid'] = $row['id'];
         $arr['uida'] = $row['id'];
         $sqlstr = $this->skins->cscms_sql($page_arr[1][0], $page_arr[2][0], $page_arr[0][0], $page_arr[3][0], 'id', $arr, '');
         $nums = $this->db->query($sqlstr)->num_rows();
         //总数量
         $Arr = spanajaxpage($sqlstr, $nums, $page_arr[3][0], $pagenum, 'cscms_home_gbook', $page);
         if ($nums == 0) {
             $data_content .= "";
         } else {
             $sorti = 1;
             $result_array = $this->db->query($Arr[0])->result_array();
             foreach ($result_array as $row2) {
                 $datatmp = $this->skins->cscms_skins($field, $page_arr[0][0], $page_arr[4][0], $row2, $sorti);
                 $sorti++;
                 $data_content .= $datatmp;
             }
         }
         $Mark_Text = page_mark($Mark_Text, $Arr);
         //分页解析
         $Mark_Text = str_replace($page_arr[0][0], $data_content, $Mark_Text);
     }
     unset($page_arr);
     //Token
     $this->load->helper('string');
     $token = random_string('alnum', 10);
     $_SESSION['gbooktoken'] = $token;
     $Mark_Text = str_replace("[gbook:token]", $token, $Mark_Text);
     //表情
     $plfaces = "";
     for ($i = 1; $i <= 56; $i++) {
         $plfaces .= "<img style='cursor:pointer;' src=\"" . Web_Path . "packs/images/faces/e" . $i . ".gif\" onclick=\"\$('#cscms_gbook_content').val(\$('#cscms_gbook_content').val()+'[em:" . $i . "]');\$('#cscms_faces').hide();\" />";
     }
     $Mark_Text = str_replace("[gbook:faces]", $plfaces, $Mark_Text);
     $Mark_Text = $this->skins->template_parse($Mark_Text, false);
     $Mark_Text = get_bm($Mark_Text, 'gbk', 'utf-8');
     echo $callback . "({str:" . json_encode($Mark_Text) . "})";
 }