Exemplo n.º 1
0
 public function add()
 {
     //关闭数据库缓存
     $this->db->cache_off();
     $token = $this->input->post('token', TRUE);
     $add['neir'] = $this->input->post('neir', TRUE);
     $add['neir'] = filter(get_bm($add['neir']));
     if (User_BookFun == 0) {
         $error = '10000';
     } elseif (!isset($_SESSION['gbooktoken']) || $token != $_SESSION['gbooktoken']) {
         $error = '10001';
     } elseif (empty($add['neir'])) {
         $error = '10002';
     } else {
         $add['uidb'] = isset($_SESSION['cscms__id']) ? intval($_SESSION['cscms__id']) : 0;
         $add['cid'] = 1;
         $add['ip'] = getip();
         $add['addtime'] = time();
         $ids = $this->CsdjDB->get_insert('gbook', $add);
         if (intval($ids) == 0) {
             $error = '10003';
             //失败
         } else {
             //摧毁token
             unset($_SESSION['token']);
             $error = '10004';
         }
     }
     $data['error'] = $error;
     echo json_encode($data);
 }
Exemplo n.º 2
0
 public function picding()
 {
     $callback = $this->input->get('callback', true);
     $ac = $this->uri->segment(3);
     //ac
     $id = intval($this->uri->segment(4));
     //ID
     $ding = $this->cookie->get_cookie("picding_id_" . $id);
     if ($id == 0) {
         $error = 'ID为空';
     } elseif (!$this->CsdjUser->User_Login(1)) {
         $error = '您还没有登录';
     } elseif (!empty($ding) && date('Y-m-d', $ding) == date('Y-m-d')) {
         $error = '您今天已经赞过了';
     } else {
         $row = $this->CsdjDB->get_row('pic_type', 'dhits,chits', $id);
         if (!$row) {
             $error = '数据不存在';
         } else {
             //记住cookie
             $this->cookie->set_cookie("picding_id_" . $id, time(), time() + 86400);
             //增加顶人气
             if ($ac == 'ding') {
                 $updata['dhits'] = $row->dhits + 1;
             } else {
                 $updata['chits'] = $row->chits + 1;
             }
             $this->CsdjDB->get_update('pic_type', $id, $updata);
             $error = 'ok';
         }
     }
     $error = get_bm($error, 'gbk', 'utf-8');
     echo $callback . "({msg:" . json_encode($error) . "})";
 }
Exemplo n.º 3
0
 /**
  * 直接获取ip实际地址
  */
 public function address($ip)
 {
     if ($ip == '127.0.0.1') {
         return '本机IP';
     }
     $this->set($ip);
     return get_bm($this->address);
 }
Exemplo n.º 4
0
 function str($url = '', $code = 'utf-8')
 {
     $neir = htmlall($url);
     if (!empty($neir)) {
         if ($code != 'utf-8') {
             $neir = get_bm($neir);
         }
     }
     return $neir;
 }
Exemplo n.º 5
0
 public function log()
 {
     $ac = $this->uri->segment(4);
     $user = $this->uri->segment(5);
     $this->load->model('CsdjUser');
     $callback = $this->input->get('callback', true);
     //判断会员是否关闭
     if (User_Mode == 0) {
         $Mark_Text = get_bm(User_No_info, 'gbk', 'utf-8');
         echo $callback . "({str:" . json_encode($Mark_Text) . "})";
         exit;
     }
     $ucid = 'logout';
     $login = $this->CsdjUser->User_Login(1);
     $template = !$login ? 'ulogin.html' : 'uinfo.html';
     if (!empty($ac) && is_file(FCPATH . 'plugins/' . $ac . '/config/site.php')) {
         $skins = '';
         if (!empty($user)) {
             if (!defined('HOMEPATH')) {
                 define('HOMEPATH', 'home');
             }
             $skins = Home_Fs == 1 ? getzd('user', 'skins', $user, 'name') : getzd('user', 'skins', $user);
         }
         $this->load->get_templates($ac, 1, $skins, 1);
     } elseif ($ac == 'home') {
         if (!defined('HOMEPATH')) {
             define('HOMEPATH', 'home');
         }
         $skins = Home_Fs == 1 ? getzd('user', 'skins', $user, 'name') : getzd('user', 'skins', $user);
         $this->load->get_templates($ac, 0, $skins, 1);
     } elseif ($ac != 'index') {
         $this->load->get_templates($ac);
     }
     $Mark_Text = $this->load->view($template, '', true);
     $Mark_Text = str_replace("{cscms:logadd}", "cscms_logadd();", $Mark_Text);
     $Mark_Text = str_replace("{cscms:logout}", "cscms_logout();", $Mark_Text);
     if (defined('HOMEPATH')) {
         $Mark_Text = $this->skins->cscms_common($Mark_Text, $skins);
     }
     if ($login) {
         $row = $this->CsdjDB->get_row_arr('user', '*', $_SESSION['cscms__id']);
         if (empty($row['nichen'])) {
             $row['nichen'] = $row['name'];
         }
         $Mark_Text = $this->skins->cscms_skins('user', $Mark_Text, $Mark_Text, $row);
         $ucid = $row['uid'];
     }
     $Mark_Text = $this->skins->template_parse($Mark_Text, false);
     //同步UC,解决高速浏览器不兼容
     if (User_Uc_Mode == 1) {
         $Mark_Text .= "<iframe marginwidth=\"0\" marginheight=\"0\" src=\"" . site_url('api/ulog/uclog') . "?uid=" . $ucid . "\" frameborder=\"0\" width=\"1\" scrolling=\"no\" height=\"1\" leftmargin=\"0\" topmargin=\"0\"></iframe>";
     }
     $Mark_Text = get_bm($Mark_Text, 'gbk', 'utf-8');
     echo $callback . "({str:" . json_encode($Mark_Text) . "})";
 }
Exemplo n.º 6
0
 public function get_url($url)
 {
     $arr = htmlall($url);
     if (empty($arr)) {
         admin_msg(L('curl_err'), @$_SERVER['HTTP_REFERER'], 'no');
         //获取远程失败
     } else {
         $arr = json_decode($arr, true);
         $arr = get_bm($arr);
         if ($arr['status'] == 0) {
             admin_msg($arr['msg'], @$_SERVER['HTTP_REFERER'], 'no');
             //错误状态
         } else {
             return $arr['msg'];
         }
     }
 }
Exemplo n.º 7
0
 public function qiandao()
 {
     $callback = $this->input->get('callback', true);
     $err = 1002;
     $str = L('ajax_03');
     if ($this->CsdjUser->User_Login(1)) {
         $row = $this->db->query("select qdts,qdtime from " . CS_SqlPrefix . "user where id=" . $_SESSION['cscms__id'] . "")->row();
         if (date('Y-m-d', $row->qdtime) == date('Y-m-d')) {
             //今天已经签到
             $err = 1001;
             $str = L('ajax_04');
         } elseif ($row->qdtime < time() - 86400) {
             //未连续签到
             $this->db->query("update " . CS_SqlPrefix . "user set qdts=1,qdtime='" . time() . "',cion=cion+" . User_Cion_Qd . ",jinyan=jinyan+" . User_Jinyan_Qd . " where id=" . $_SESSION['cscms__id'] . "");
         } else {
             $this->db->query("update " . CS_SqlPrefix . "user set qdts=1,qdtime='" . time() . "',cion=cion+" . User_Cion_Qd . ",jinyan=jinyan+" . User_Jinyan_Qd . " where id=" . $_SESSION['cscms__id'] . "");
         }
     } else {
         $err = 1000;
     }
     echo $callback . "({error:" . $err . ",str:" . json_encode(get_bm($str, 'gbk', 'utf-8')) . "})";
 }
Exemplo n.º 8
0
 public function edit()
 {
     $ac = $this->input->get('ac', true);
     $op = $this->input->get('op', true);
     $do = $this->input->get('do', true);
     $dir = $this->input->get('dirs', true);
     $file = $this->input->get('file');
     $exts = strtolower(trim(strrchr($file, '.'), '.'));
     if ($op != 'home' && $op != 'user' && $op != 'mobile') {
         $op = 'skins';
     }
     if (empty($dir) || empty($file)) {
         admin_msg(L('plub_01'), 'javascript:history.back();', 'no');
     }
     if ($exts != 'html' && $exts != 'css' && $exts != 'js') {
         admin_msg(L('tpl_08'), 'javascript:history.back();', 'no');
     }
     if (empty($ac)) {
         $skin_dir = CSCMS . 'tpl/' . $op . '/' . $dir . '/';
     } else {
         if (!empty($op)) {
             $skin_dir = FCPATH . 'plugins/' . $ac . '/tpl/' . $op . '/' . $dir . '/';
         } else {
             $skin_dir = FCPATH . 'plugins/' . $ac . '/tpl/skins/' . $dir . '/';
         }
     }
     $skin_dir .= $file;
     $skin_dir = str_replace("//", "/", $skin_dir);
     if (!file_exists($skin_dir)) {
         admin_msg(L('tpl_09'), 'javascript:history.back();', 'no');
     }
     $this->load->helper('file');
     if ($do == 'add') {
         $html = $this->input->post('html');
         //写文件
         if (!write_file($skin_dir, $html)) {
             admin_msg(L('tpl_10'), 'javascript:history.back();', 'no');
         } else {
             $parr = explode('/', $file);
             $path = '';
             for ($j = 0; $j < count($parr) - 1; $j++) {
                 $path .= $parr[$j] . '/';
             }
             if (substr($path, -1) == '/') {
                 $path = substr($path, 0, -1);
             }
             admin_msg(L('tpl_11'), site_url('skin/show') . "?ac=" . $ac . "&op=" . $op . "&dirs=" . $dir . "&path=" . $path);
         }
     } else {
         $html = get_bm(read_file($skin_dir));
         $data['savelink'] = site_url('skin/edit') . "?ac=" . $ac . "&do=add&op=" . $op . "&dirs=" . $dir . "&file=" . $file;
         $data['path'] = empty($ac) ? str_replace(CSCMS . 'tpl', '', $skin_dir) : str_replace(FCPATH . 'plugins/' . $ac, '', $skin_dir);
         $data['html'] = str_replace('</textarea>', '&lt;/textarea&gt;', $html);
         $this->load->view('skin_edit.html', $data);
     }
 }
Exemplo n.º 9
0
 public function add()
 {
     $callback = $this->input->get('callback', true);
     $token = $this->input->get_post('token', TRUE);
     $add['uida'] = (int) $this->input->get_post('uid', TRUE);
     $add['neir'] = $this->input->get_post('neir', TRUE);
     $add['neir'] = facehtml(filter(get_bm($add['neir'])));
     //转化回复
     preg_match_all('/' . L('gbook_02') . '@(.*)@:/i', $add['neir'], $bs);
     if (!empty($bs[0][0]) && !empty($bs[1][0])) {
         $uid = getzd('user', 'id', $bs[1][0], 'name');
         $nichen = getzd('user', 'nichen', $bs[1][0], 'name');
         $ulink = userlink('index', $uid, $bs[1][0]);
         if (empty($nichen)) {
             $nichen = $bs[1][0];
         }
         $b = L('gbook_02') . '<a target="_blank" href="' . $ulink . '">@' . $nichen . '@</a>:';
         $add['neir'] = str_replace($bs[0][0], $b, $add['neir']);
     }
     unset($bs);
     if ($add['uida'] == 0) {
         $error = '10000';
     } elseif (!isset($_SESSION['gbooktoken']) || $token != $_SESSION['gbooktoken']) {
         $error = '10001';
     } elseif (isset($_SESSION['gbookaddtime']) && time() < $_SESSION['gbookaddtime'] + 30) {
         $error = '10006';
     } elseif (empty($add['neir'])) {
         $error = '10002';
     } elseif (empty($_SESSION['cscms__id'])) {
         $error = '10003';
     } else {
         $add['uidb'] = $_SESSION['cscms__id'];
         $add['fid'] = intval($this->input->get_post('fid'));
         $add['ip'] = getip();
         $add['addtime'] = time();
         $ids = $this->CsdjDB->get_insert('gbook', $add);
         if (intval($ids) == 0) {
             $error = '10004';
             //失败
         } else {
             //摧毁token
             unset($_SESSION['token']);
             $error = '10005';
             $_SESSION['gbookaddtime'] = time();
             //发送通知
             $addm['uida'] = $add['uida'];
             $addm['uidb'] = $_SESSION['cscms__id'];
             $addm['name'] = L('gbook_03');
             $addm['neir'] = vsprintf(L('ajax_04'), array($_SESSION['cscms__name']));
             $addm['addtime'] = time();
             $this->CsdjDB->get_insert('msg', $addm);
         }
     }
     echo $callback . "({error:" . $error . "})";
 }
Exemplo n.º 10
0
function caiji($spurl = '', $sid = 0)
{
    $str['error'] = 'no';
    if (!empty($spurl) && substr($spurl, 0, 7) == 'http://') {
        if (strpos($spurl, 'ku6.com') !== FALSE) {
            $neir = htmlall($spurl);
            if (!empty($neir)) {
                $str['name'] = str_substr('<title>', ' 在线观看', $neir);
                $str['pic'] = str_substr('cover: "', '"', $neir);
                $str['url'] = str_substr("snyu_page_params='vid=", '&category=', $neir);
                $str['laiy'] = "ku6";
            }
        } elseif (strpos($spurl, '56.com') !== FALSE) {
            $neir = htmlall($spurl, 'utf-8');
            if (!empty($neir)) {
                $str['name'] = str_substr('<title>', '-', $neir);
                $str['pic'] = str_substr('img":"', '",', $neir);
                $str['pic'] = str_replace("\\", "", $str['pic']);
                $str['url'] = str_substr(',"EnId":"', '"', $neir);
                $str['laiy'] = "56";
            }
        } elseif (strpos($spurl, 'youku.com') !== FALSE) {
            $neir = htmlall($spurl, 'utf-8');
            if (!empty($neir)) {
                $str['name'] = str_substr('<span id="subtitle">', '</span>', $neir);
                $str['pic'] = str_substr('&pics=', '&site=优酷', $neir);
                preg_match('/http:\\/\\/v.youku.com\\/v_show\\/id_\\s*([0-9a-zA-Z]+).html/', $spurl, $vid);
                if (!empty($vid) && !empty($vid[1])) {
                    $str['url'] = $vid[1];
                }
                $str['laiy'] = "youku";
            }
        } elseif (strpos($spurl, 'tudou.com') !== FALSE) {
            $neir = htmlall($spurl, 'utf-8');
            if (!empty($neir)) {
                $str['name'] = str_substr(",kw: '", "'", $neir);
                $str['pic'] = str_substr(",pic: '", "'", $neir);
                $str['url'] = str_substr(",icode: '", "'", $neir);
                $str['url'] = trim($str['url']);
                $str['laiy'] = "tudou";
            }
        } elseif (strpos($spurl, 'sohu.com') !== FALSE) {
            $neir = HtmlUp($spurl);
            if (!empty($neir)) {
                $str['name'] = str_substr('<title>', ' -', $neir);
                $str['pic'] = str_substr('var cover="', '";', $neir);
                $str['url'] = str_substr('var vid="', '";', $neir);
                $str['laiy'] = "sohu";
            }
        } elseif (strpos($spurl, 'sina.com.cn') !== FALSE) {
            $neir = htmlall($spurl, 'utf-8');
            if (!empty($neir)) {
                $str['name'] = str_substr("\t\ttitle:'", "',", $neir);
                $str['pic'] = str_substr("pic:'", "'", $neir);
                $str['url'] = str_substr("\t\tvid:'", "'", $neir);
                $str['laiy'] = "sina";
            }
        } elseif (strpos($spurl, 'qq.com') !== FALSE) {
            $neir = htmlall($spurl, 'utf-8');
            if (!empty($neir)) {
                $str['name'] = str_substr('title : "', '"', $neir);
                $str['pic'] = str_substr('pic :"', '",', $neir);
                $str['url'] = str_substr('vid:"', '"', $neir);
                $str['laiy'] = "qq";
            }
        } elseif (strpos($spurl, 'pps.tv') !== FALSE) {
            $neir = HtmlUp($spurl);
            if (!empty($neir)) {
                $str['name'] = str_substr("<meta name='description' content=", '">', $neir);
                $str['name'] = substr($str['name'], 1);
                $str['pic'] = str_substr('"sharepic":"', '",', $neir);
                $str['pic'] = str_replace("\\", "", $str['pic']);
                $str['url'] = str_substr('"url_key":"', '",', $neir);
                $str['laiy'] = "pps";
            }
        } elseif (strpos($spurl, 'letv.com') !== FALSE) {
            $neir = htmlall($spurl, 'utf-8');
            if (!empty($neir)) {
                $str['name'] = str_substr('title:"', '",', $neir);
                $str['pic'] = str_substr('{pic:"', '",url', $neir);
                $str['url'] = str_substr('vid:', ',', $neir);
                $str['laiy'] = "letv";
            }
        } elseif (strpos($spurl, 'yinyuetai.com') !== FALSE) {
            $neir = htmlall($spurl, 'utf-8');
            if (!empty($neir)) {
                $str['name'] = str_substr('title : "', '",', $neir);
                $str['pic'] = str_substr('<meta property="og:image" content="', '"/>', $neir);
                preg_match('/http:\\/\\/v.yinyuetai.com\\/video\\/\\s*([0-9]+)/', $spurl, $vid);
                $str['url'] = @$vid[1];
                $str['laiy'] = "yyt";
            }
        }
    }
    if (empty($str['url'])) {
        $str['error'] = 'no';
    } else {
        $str['error'] = 'ok';
    }
    if (!empty($str['name'])) {
        $str['name'] = get_bm($str['name'], 'gbk', 'utf-8');
    }
    if ($sid == 0) {
        $str = json_encode($str);
    }
    return $str;
}
Exemplo n.º 11
0
 public function vodpfenadd()
 {
     $callback = $this->input->get('callback', true);
     $id = intval($this->uri->segment(3));
     //ID
     $fen = intval($this->uri->segment(4));
     //分
     $pfen = $this->cookie->get_cookie("vodpfen_id_" . $id);
     if ($id == 0 || $fen == 0) {
         $error = '参数错误';
     } elseif (!$this->CsdjUser->User_Login(1)) {
         $error = '您还没有登录';
     } elseif (!empty($pfen)) {
         $error = '您已经评过分了';
     } else {
         $row = $this->CsdjDB->get_row('vod', 'phits,pfen', $id);
         if (!$row) {
             $error = '数据不存在';
         } else {
             //记住cookie
             $this->cookie->set_cookie("vodpfen_id_" . $id, 'ok', time() + 86400 * 30);
             //增加评分、人气
             $updata['phits'] = $row->phits + 1;
             $updata['pfen'] = $row->pfen + $fen;
             $this->CsdjDB->get_update('vod', $id, $updata);
             $error = 'ok';
         }
     }
     $error = get_bm($error, 'gbk', 'utf-8');
     echo $callback . "({msg:" . json_encode($error) . "})";
 }
Exemplo n.º 12
0
    public function index()
    {
        $this->CsdjUser->User_Login();
        $id = (int) $this->uri->segment(4);
        //订单ID
        if ($id == 0) {
            msg_url(L('pay_01'), spacelink('pay'));
        }
        $row = $this->CsdjDB->get_row('pay', '*', $id);
        if (!$row || $row->uid != $_SESSION['cscms__id']) {
            msg_url(L('pay_02'), spacelink('pay'));
        }
        if (defined('MOBILE')) {
            //手机支付
            require_once CSCMSPATH . "pay/alipay_wap/alipay.config.php";
            require_once CSCMSPATH . "pay/alipay_wap/lib/alipay_submit.class.php";
            $format = "xml";
            $v = "2.0";
            $req_id = date('Ymdhis');
            $notify_url = site_url("pay/alipay/notify_url");
            $call_back_url = site_url("pay/alipay/return_url");
            $merchant_url = site_url("user/pay/lists");
            $seller_email = CS_Alipay_Name;
            $out_trade_no = $row->dingdan;
            $subject = L('pay_03', array($_SESSION['cscms__name']));
            $total_fee = $row->rmb;
            $req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
            //构造要请求的参数数组,无需改动
            $para_token = array("service" => "alipay.wap.trade.create.direct", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
            //建立请求
            $alipaySubmit = new AlipaySubmit($alipay_config);
            $html_text = $alipaySubmit->buildRequestHttp($para_token);
            $html_text = urldecode($html_text);
            $para_html_text = $alipaySubmit->parseResponse($html_text);
            $request_token = $para_html_text['request_token'];
            $req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
            //构造要请求的参数数组,无需改动
            $parameter = array("service" => "alipay.wap.auth.authAndExecute", "partner" => trim($alipay_config['partner']), "sec_id" => trim($alipay_config['sign_type']), "format" => $format, "v" => $v, "req_id" => $req_id, "req_data" => $req_data, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
            //建立请求
            $alipaySubmit = new AlipaySubmit($alipay_config);
            $html_text = $alipaySubmit->buildRequestForm($parameter, 'get', L('pay_04'));
            echo $html_text;
        } elseif (CS_Alipay_JK == 1) {
            //双功能
            require_once CSCMSPATH . "pay/alipay_trade/alipay.config.php";
            require_once CSCMSPATH . "pay/alipay_trade/lib/alipay_submit.class.php";
            $payment_type = "1";
            $notify_url = site_url("pay/alipay/notify_url");
            $return_url = site_url("pay/alipay/return_url");
            $seller_email = CS_Alipay_Name;
            $out_trade_no = $row->dingdan;
            $subject = L('pay_03', array($_SESSION['cscms__name']));
            $price = $row->rmb;
            $quantity = "1";
            $logistics_fee = "0.00";
            $logistics_type = "EXPRESS";
            $logistics_payment = "SELLER_PAY";
            $body = $subject;
            $show_url = '';
            $receive_name = '';
            $receive_address = '';
            $receive_zip = '';
            $receive_phone = '';
            $receive_mobile = '';
            //构造要请求的参数数组,无需改动
            $parameter = array("service" => "trade_create_by_buyer", "partner" => trim($alipay_config['partner']), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "price" => $price, "quantity" => $quantity, "logistics_fee" => $logistics_fee, "logistics_type" => $logistics_type, "logistics_payment" => $logistics_payment, "body" => $body, "show_url" => $show_url, "receive_name" => $receive_name, "receive_address" => $receive_address, "receive_zip" => $receive_zip, "receive_phone" => $receive_phone, "receive_mobile" => $receive_mobile, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
            //建立请求
            $alipaySubmit = new AlipaySubmit($alipay_config);
            $html_text = $alipaySubmit->buildRequestForm($parameter, "get", L('pay_02'));
            echo $html_text;
        } elseif (CS_Alipay_JK == 2) {
            //即时到账
            require_once CSCMSPATH . "pay/alipay_direct/alipay.config.php";
            require_once CSCMSPATH . "pay/alipay_direct/lib/alipay_submit.class.php";
            $payment_type = "1";
            $notify_url = site_url("pay/alipay/notify_url");
            $return_url = site_url("pay/alipay/return_url");
            $seller_email = CS_Alipay_Name;
            $out_trade_no = $row->dingdan;
            $subject = L('pay_03', array($_SESSION['cscms__name']));
            $total_fee = $row->rmb;
            $body = $subject;
            $show_url = '';
            $anti_phishing_key = '';
            $exter_invoke_ip = '';
            //构造要请求的参数数组,无需改动
            $parameter = array("service" => "create_direct_pay_by_user", "partner" => trim($alipay_config['partner']), "payment_type" => $payment_type, "notify_url" => $notify_url, "return_url" => $return_url, "seller_email" => $seller_email, "out_trade_no" => $out_trade_no, "subject" => $subject, "total_fee" => $total_fee, "body" => $body, "show_url" => $show_url, "anti_phishing_key" => $anti_phishing_key, "exter_invoke_ip" => $exter_invoke_ip, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
            //建立请求
            $alipaySubmit = new AlipaySubmit($alipay_config);
            $html_text = $alipaySubmit->buildRequestForm($parameter, "get", L('pay_02'));
            echo $html_text;
        } else {
            //手动充值
            echo '
  				 <FORM accept-charset="gbk" action="https://shenghuo.alipay.com/send/payment/fill.htm" method="post" id="form1" name="form1" onsubmit="document.charset=\'gbk\';">
  				 <INPUT type="hidden" name="optEmail" value="' . CS_Alipay_Name . '">
  				 <INPUT type="hidden" name="payAmount" value="' . $row->rmb . '">
  				 <INPUT type="hidden" name="title" value="' . get_bm('utf-8', 'gbk', L('pay_03', array($_SESSION['cscms__name']))) . '">
  				 <INPUT type="hidden" name="memo" value="' . get_bm('utf-8', 'gbk', L('pay_05') . $_SESSION['cscms__name'] . L('pay_06') . $row->dingdan) . '">
  				 <script language="javascript">document.form1.submit();</script>
 				 </form>';
        }
    }
Exemplo n.º 13
0
 public function qq_callback($log_state = '')
 {
     $state = $this->ci->input->get_post('state', TRUE, TRUE);
     $code = $this->ci->input->get('code', TRUE);
     if (empty($state) || empty($code)) {
         msg_url('登录失败,返回参数错误~!', spacelink('login'));
     }
     if ($state != $log_state) {
         msg_url('非法登录~!', spacelink('login'));
     }
     //获取ACCSEE_TOTEN
     $token_url = "https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&" . "client_id=" . CS_Qqid . "&redirect_uri=" . urlencode($this->redirect_uri) . "&client_secret=" . CS_Qqkey . "&code=" . $code;
     $response = $this->get_url_contents($token_url);
     if (strpos($response, "callback") !== false) {
         msg_url('登入失败,没获取到access_token!', spacelink('login'));
     }
     $params = array();
     parse_str($response, $params);
     $access_token = $params['access_token'];
     $refresh_token = $params['refresh_token'];
     $expire_at = $params['expire_at'];
     //获取OPENID
     $graph_url = "https://graph.qq.com/oauth2.0/me?access_token=" . $access_token;
     $str = $this->get_url_contents($graph_url);
     if (strpos($str, "callback") !== false) {
         $lpos = strpos($str, "(");
         $rpos = strrpos($str, ")");
         $str = substr($str, $lpos + 1, $rpos - $lpos - 1);
     }
     $user = json_decode($str);
     if (isset($user->error)) {
         msg_url('获取openid失败!', spacelink('login'));
     }
     $qqid = $user->openid;
     //获取用户信息
     $get_user_info = "https://graph.qq.com/user/get_user_info?" . "access_token=" . $access_token . "&oauth_consumer_key=" . CS_Qqid . "&openid=" . $qqid . "&format=json";
     $info = $this->get_url_contents($get_user_info);
     $arr = json_decode($info, true);
     //查看数据库是否存在
     $row = $this->ci->db->query("SELECT id,uid,nickname,avatar FROM " . CS_SqlPrefix . "useroauth where oid='" . $qqid . "' and cid=1")->row();
     if ($row) {
         $_SESSION['denglu__id'] = $row->id;
         $_SESSION['denglu__name'] = $row->nickname;
         $_SESSION['denglu__logo'] = $row->avatar;
         return $row->uid;
     } else {
         $add['cid'] = 1;
         $add['nickname'] = get_bm($arr['nickname']);
         $add['avatar'] = $arr['figureurl_2'];
         $add['oid'] = $qqid;
         $add['access_token'] = $access_token;
         $add['refresh_token'] = $refresh_token;
         $add['expire_at'] = $expire_at;
         $ids = $this->ci->CsdjDB->get_insert('useroauth', $add);
         $_SESSION['denglu__id'] = intval($ids);
         $_SESSION['denglu__name'] = $add['nickname'];
         $_SESSION['denglu__logo'] = $add['avatar'];
         return 0;
     }
 }
Exemplo n.º 14
0
 public function type_init()
 {
     $id = intval($this->input->get('id'));
     $rowc = $this->db->query("SELECT fid FROM " . CS_SqlPrefix . "vod_list where id=" . $id . "")->row();
     if ($rowc->fid > 0) {
         $id = $rowc->fid;
     }
     $type = $this->input->get('type', true);
     $sql_string = "SELECT id,name FROM " . CS_SqlPrefix . "vod_type where cid=" . $id . " order by xid asc";
     $query = $this->db->query($sql_string);
     $data = array();
     $i = 0;
     foreach ($query->result() as $row) {
         $data[$i]['name'] = get_bm($row->name, 'gbk', 'utf-8');
         $data[$i]['chk'] = getqx($row->name, $type) == 'ok' ? 'true' : 'false';
         $i++;
     }
     echo json_encode($data);
 }
Exemplo n.º 15
0
 public function fav_add()
 {
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Cache-Control: no-cache, must-revalidate");
     header("Pragma: no-cache");
     //if(empty($_SERVER['HTTP_REFERER'])){exit('QQ:848769359');}
     if (!$this->CsdjUser->User_Login(1)) {
         $str = 'login';
     }
     $id = intval($this->input->get_post('id', TRUE));
     $callback = $this->input->get('callback', true);
     $fav['did'] = $id;
     if ($id > 0) {
         $row = $this->db->query("SELECT name,cid FROM " . CS_SqlPrefix . "dance where id='" . $id . "' and yid=0 and hid=0")->row();
         if (!$row) {
             $str = L('dance_10');
         } else {
             $fav['name'] = $row->name;
             $fav['cid'] = $row->cid;
             //判断是否已经收藏
             $rowv = $this->db->query("SELECT id FROM " . CS_SqlPrefix . "dance_fav where sid=1 and did='" . $id . "' and uid=" . $_SESSION['cscms__id'] . "")->row();
             if ($rowv) {
                 //删除收藏
                 $this->db->query("delete from " . CS_SqlPrefix . "dance_fav where id='" . $rowv->id . "'");
                 $this->db->query("update " . CS_SqlPrefix . "dance set shits=shits-1,dhits=dhits-1 where id='" . $id . "'");
                 $str = 'del';
             } else {
                 $fav['uid'] = $_SESSION['cscms__id'];
                 $fav['addtime'] = time();
                 $res = $this->CsdjDB->get_insert('dance_fav', $fav);
                 if ($res > 0) {
                     //增加收藏人气
                     $this->db->query("update " . CS_SqlPrefix . "dance set shits=shits+1,dhits=dhits+1 where id='" . $id . "'");
                     $str = 'ok';
                 } else {
                     $str = L('dance_21');
                 }
             }
         }
     }
     $str = get_bm($str, 'gbk', 'utf-8');
     echo $callback . "({str:" . json_encode($str) . "})";
 }
Exemplo n.º 16
0
 public function fav()
 {
     $callback = $this->input->get('callback', true);
     $did = (int) $this->uri->segment(4);
     //ID
     if ($did == 0) {
         $error = L('ajax_03');
     } elseif (!$this->CsdjUser->User_Login(1)) {
         $error = L('ajax_04');
     } else {
         $rowd = $this->CsdjDB->get_row('dance', 'id,name,cid,shits', $did);
         if (!$rowd) {
             $error = L('ajax_09');
         } else {
             //判断是否收藏
             $row = $this->db->query("SELECT id FROM " . CS_SqlPrefix . "dance_fav where did=" . $did . " and uid=" . $_SESSION['cscms__id'] . " and sid=1")->row();
             if ($row) {
                 //已收藏则解除
                 $this->CsdjDB->get_del('dance_fav', $row->id);
                 $error = 'del';
             } else {
                 //新增
                 $add['did'] = $did;
                 $add['cid'] = $rowd->cid;
                 $add['name'] = $rowd->name;
                 $add['did'] = $did;
                 $add['uid'] = $_SESSION['cscms__id'];
                 $add['addtime'] = time();
                 $this->CsdjDB->get_insert('dance_fav', $add);
                 //增加收藏人气
                 $updata['shits'] = $rowd->shits + 1;
                 $this->CsdjDB->get_update('dance', $did, $updata);
                 //判断动态是否存在
                 $rows = $this->db->query("SELECT id FROM " . CS_SqlPrefix . "dt where did=" . $did . " and uid=" . $_SESSION['cscms__id'] . " and dir='dance' and link='" . linkurl('play', 'id', $did, 0, 'dance') . "'")->row();
                 if (!$rows) {
                     //增加动态
                     $add2['dir'] = 'dance';
                     $add2['uid'] = $_SESSION['cscms__id'];
                     $add2['did'] = $did;
                     $add2['name'] = $rowd->name;
                     $add2['link'] = linkurl('play', 'id', $did, 0, 'dance');
                     $add2['title'] = L('ajax_10');
                     $add2['addtime'] = time();
                     $this->CsdjDB->get_insert('dt', $add2);
                 }
                 $error = 'ok';
             }
         }
     }
     echo $callback . "({error:" . json_encode(get_bm($error, 'gbk', 'utf-8')) . "})";
 }
Exemplo n.º 17
0
 public function albumfav()
 {
     $callback = $this->input->get('callback', true);
     $id = intval($this->uri->segment(3));
     //方式
     if ($id == 0) {
         $error = L('dance_03');
     } elseif (!$this->CsdjUser->User_Login(1)) {
         $error = L('dance_04');
     } else {
         $row = $this->CsdjDB->get_row('dance_topic', 'cid,name,shits', $id);
         if (!$row) {
             $error = L('dance_23');
         } else {
             //判断是否收藏
             $rows = $this->db->query("SELECT id FROM " . CS_SqlPrefix . "dance_fav where did=" . $id . " and uid=" . $_SESSION['cscms__id'] . " and sid=2")->row();
             if ($rows) {
                 $error = L('dance_06');
             } else {
                 $add['did'] = $id;
                 $add['sid'] = 2;
                 $add['cid'] = $row->cid;
                 $add['uid'] = $_SESSION['cscms__id'];
                 $add['name'] = $row->name;
                 $add['addtime'] = time();
                 $this->CsdjDB->get_insert('dance_fav', $add);
                 //增加收藏人气
                 $updata['shits'] = $row->shits + 1;
                 $this->CsdjDB->get_update('dance_topic', $id, $updata);
                 //增加动态
                 $add2['dir'] = 'dance';
                 $add2['uid'] = $_SESSION['cscms__id'];
                 $add2['did'] = $id;
                 $add2['name'] = $row->name;
                 $add2['link'] = linkurl('topic', 'show', 1, 1, 'dance');
                 $add2['title'] = L('dance_24');
                 $add2['addtime'] = time();
                 $this->CsdjDB->get_insert('dt', $add2);
                 $error = 'ok';
             }
         }
     }
     $error = get_bm($error, 'gbk', 'utf-8');
     echo $callback . "({msg:" . json_encode($error) . "})";
 }
Exemplo n.º 18
0
 public function check()
 {
     $field = $this->input->get_post('field', TRUE, TRUE);
     //需要查询的字段
     $data = $this->input->get_post('param', TRUE, TRUE);
     //需要查询的字段
     if (empty($field) || empty($data)) {
         exit('{"status":"n","info":"' . get_bm(L('reg_27')) . '"}');
     }
     //判断保留用户名
     $ymext = explode('|', Home_Ymext);
     if ($field == 'name' && in_array($data, $ymext)) {
         exit('{"status":"n","info":"' . get_bm(L('reg_28')) . '"}');
     }
     //判断用户名格式
     if ($field == 'name' && !is_username($data)) {
         exit('{"status":"n","info":"' . get_bm(L('reg_29')) . '"}');
     }
     //判断邮箱格式
     if ($field == 'email' && !is_email($data)) {
         exit('{"status":"n","info":"' . get_bm(L('reg_30')) . '"}');
     }
     //判断手机号码格式
     if ($field == 'tel' && !preg_match('/^1([0-9]{9})/', $data)) {
         exit('{"status":"n","info":"' . get_bm(L('reg_31')) . '"}');
     }
     //判断需要查询的字段是否存在
     if (!$this->db->field_exists($field, CS_SqlPrefix . 'user')) {
         exit('{"status":"n","info":"' . get_bm(L('reg_32')) . '"}');
     }
     //查询数据库
     $row = $this->CsdjDB->get_row('user', 'id', $data, $field);
     if ($row) {
         exit('{"status":"n","info":"' . get_bm(L('reg_33')) . '"}');
     } else {
         exit('{"status":"y","info":""}');
     }
 }
Exemplo n.º 19
0
 public function add()
 {
     $callback = $this->input->get('callback', true);
     $token = $this->input->get_post('token', TRUE);
     $add['dir'] = $this->input->get_post('dir', TRUE);
     $add['content'] = $this->input->get_post('neir', TRUE);
     $add['content'] = facehtml(filter(get_bm($add['content'])));
     //转化回复
     $hf = 0;
     preg_match_all('/回复@(.*)@:/i', $add['content'], $bs);
     if (!empty($bs[0][0]) && !empty($bs[1][0])) {
         $uid = getzd('user', 'id', $bs[1][0], 'name');
         $nichen = getzd('user', 'nichen', $bs[1][0], 'name');
         $ulink = userlink('index', $uid, $bs[1][0]);
         if (empty($nichen)) {
             $nichen = $bs[1][0];
         }
         $b = '回复<a target="_blank" href="' . $ulink . '">@' . $nichen . '@</a>:';
         $add['content'] = str_replace($bs[0][0], $b, $add['content']);
         $hf = 1;
     }
     unset($bs);
     $add['did'] = intval($this->input->get_post('did'));
     if (Pl_Modes == 3) {
         $error = '10000';
     } elseif ($add['did'] == 0) {
         $error = '10001';
     } elseif (!isset($_SESSION['pltoken']) || $token != $_SESSION['pltoken']) {
         $error = '10002';
     } elseif (isset($_SESSION['pladdtime']) && time() < $_SESSION['pladdtime'] + 60) {
         $error = '10007';
     } elseif (empty($add['content'])) {
         $error = '10003';
     } elseif (Pl_Youke == 0 && empty($_SESSION['cscms__id'])) {
         //关闭游客评论
         $error = '10004';
     } else {
         $add['uid'] = isset($_SESSION['cscms__id']) ? intval($_SESSION['cscms__id']) : 0;
         $add['user'] = isset($_SESSION['cscms__name']) ? $_SESSION['cscms__name'] : '游客';
         $add['cid'] = intval($this->input->get_post('cid'));
         $add['fid'] = intval($this->input->get_post('fid'));
         $add['ip'] = getip();
         $add['addtime'] = time();
         $ids = $this->CsdjDB->get_insert('pl', $add);
         if (intval($ids) == 0) {
             $error = '10005';
             //失败
         } else {
             //摧毁token
             unset($_SESSION['token']);
             $error = '10006';
             $_SESSION['pladdtime'] = time();
             //发送通知
             if ($add['dir'] != 'singer') {
                 $dirname = getzd('plugins', 'name', $add['dir'], 'dir');
                 if ($add['dir'] == 'dance') {
                     $link = linkurl('play', 'id', $add['did'], 1, 'dance');
                 } elseif ($add['dir'] != 'blog') {
                     $link = linkurl('show', 'id', $add['did'], 1, $add['dir']);
                 }
                 if ($add['dir'] == 'pic') {
                     $dataname = getzd('pic_type', 'name', $add['did']);
                     $pluid = getzd('pic_type', 'uid', $add['did']);
                 } elseif ($add['dir'] == 'blog') {
                     $pluid = getzd('blog', 'uid', $add['did']);
                     $dataname = getzd('blog', 'neir', $add['did']);
                     $dirname = '说说';
                     $username = getzd('user', 'name', $pluid);
                     $link = userlink('blog', $pluid, $username, $add['did']);
                 } else {
                     $dataname = getzd($add['dir'], 'name', $add['did']);
                     $pluid = getzd($add['dir'], 'uid', $add['did']);
                 }
                 if ($hf == 0) {
                     $pltitle = vsprintf(L('pl_01'), array($dirname));
                     $plneir = vsprintf(L('pl_03'), array($_SESSION['cscms__name'], $dirname, $link, $dataname));
                 } else {
                     $pltitle = L('pl_02');
                     $plneir = vsprintf(L('pl_04'), array($_SESSION['cscms__name'], $link, $dataname));
                     $pluid = $uid;
                 }
                 if ($pluid > 0) {
                     $addm['uida'] = $pluid;
                     $addm['uidb'] = $_SESSION['cscms__id'];
                     $addm['name'] = $pltitle;
                     $addm['neir'] = $plneir;
                     $addm['addtime'] = time();
                     $this->CsdjDB->get_insert('msg', $addm);
                 }
             }
         }
     }
     echo $callback . "({error:" . $error . "})";
 }