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')); } echo L('pay_18'); }
public function return_url() { $this->CsdjUser->User_Login(); $v_oid = $this->input->get('v_oid', TRUE, TRUE); $v_pstatus = $this->input->get('v_pstatus', TRUE, TRUE); $v_pstring = $this->input->get('v_pstring', TRUE, TRUE); $v_amount = $this->input->get('v_amount', TRUE, TRUE); $v_moneytype = $this->input->get('v_moneytype', TRUE, TRUE); $v_md5str = $this->input->get('v_md5str', TRUE, TRUE); $key = CS_Wypay_Key; //重新计算md5的值 $md5string = strtoupper(md5($v_oid . $v_pstatus . $v_amount . $v_moneytype . $key)); //拼凑加密串 //支付状态验证 if ($v_md5str == $md5string && $v_pstatus == "20") { msg_url(L('pay_07') . $v_oid, spacelink('pay')); } else { //验证支付失败 msg_url(L('pay_09'), spacelink('pay')); } }
public function pic() { //模板 $tpl = 'web-pic.html'; //URL地址 $url = 'web/pic'; //当前会员 $row = $this->CsdjDB->get_row_arr('user', '*', $_SESSION['cscms__id']); if (empty($row['nichen'])) { $row['nichen'] = $row['name']; } //装载模板 $title = L('web_02'); $ids['uid'] = $_SESSION['cscms__id']; $ids['uida'] = $_SESSION['cscms__id']; $Mark_Text = $this->CsdjTpl->user_list($row, $url, 1, $tpl, $title, 'id', '', $ids, true, false); //会员版块导航 $Mark_Text = $this->skins->cscmsumenu($Mark_Text, $_SESSION['cscms__id']); $Mark_Text = $this->skins->labelif($Mark_Text); //提交地址 $Mark_Text = str_replace("[user:bgpicsave]", spacelink('web,picsave'), $Mark_Text); echo $Mark_Text; }
public function save() { $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url('非法提交~!', 'javascript:history.back();'); } //检测发表权限 $zuid = getzd('user', 'zid', $_SESSION['cscms__id']); $rowu = $this->CsdjDB->get_row('userzu', 'aid,sid', $zuid); if (!$rowu || $rowu->aid == 0) { msg_url('您所在会员组没有权限发表歌曲~!', 'javascript:history.back();'); } //检测发表数据是否需要审核 $music['yid'] = $rowu->sid == 1 ? 0 : 1; //必填字段 $music['name'] = $this->input->post('name', TRUE, TRUE); $music['cid'] = intval($this->input->post('cid')); $music['purl'] = $this->input->post('purl', TRUE, TRUE); //检测必须字段 if ($music['cid'] == 0) { msg_url('请选择歌曲分类~!', 'javascript:history.back();'); } if (empty($music['name'])) { msg_url('歌曲名称不能为空~!', 'javascript:history.back();'); } if (empty($music['purl'])) { msg_url('歌曲地址不能为空~!', 'javascript:history.back();'); } //选填字段 if (substr($music['purl'], 0, 7) != 'http://') { $music['purl'] = str_replace('//', '/', '/attachment/music/' . $music['purl']); } $music['tid'] = intval($this->input->post('tid')); $music['cion'] = intval($this->input->post('cion')); $music['text'] = str_replace("\r\n", "<br>", str_encode($_POST['text'])); $music['lrc'] = $this->input->post('lrc', TRUE, TRUE); $music['pic'] = $this->input->post('pic', TRUE, TRUE); $music['tags'] = $this->input->post('tags', TRUE, TRUE); $music['zc'] = $this->input->post('zc', TRUE, TRUE); $music['zq'] = $this->input->post('zq', TRUE, TRUE); $music['bq'] = $this->input->post('bq', TRUE, TRUE); $music['hy'] = $this->input->post('hy', TRUE, TRUE); $music['durl'] = $music['purl']; $music['uid'] = $_SESSION['cscms__id']; $music['addtime'] = time(); $singer = $this->input->post('singer', TRUE, TRUE); //判断歌手是否存在 if (!empty($singer)) { $row = $this->CsdjDB->get_row('singer', 'id', $singer, 'name'); if ($row) { $music['singerid'] = $row->id; } } //获取大小、音质、时长 if (substr($music['purl'], 0, 7) != 'http://' && UP_Mode == 1) { if (UP_Pan == '') { $params['filename'] = FCPATH . $music['purl']; } else { $params['filename'] = UP_Pan . $music['purl']; } $this->load->library('mp3file', $params); $arr = $this->mp3file->get_metadata(); $music['dx'] = !empty($arr['Filesize']) ? formatsize($arr['Filesize']) : ''; $music['yz'] = !empty($arr['Bitrate']) ? $arr['Bitrate'] . ' Kbps' : ''; $music['sc'] = !empty($arr['Length mm:ss']) ? $arr['Length mm:ss'] : ''; } //增加到数据库 $did = $this->CsdjDB->get_insert('dance', $music); if (intval($did) == 0) { msg_url('歌曲发布失败,请稍候再试~!', 'javascript:history.back();'); } //摧毁token unset($_SESSION['token']); //增加动态 $dt['dir'] = 'dance'; $dt['uid'] = $_SESSION['cscms__id']; $dt['did'] = $did; $dt['yid'] = $music['yid']; $dt['title'] = '发布了歌曲'; $dt['name'] = $music['name']; $dt['link'] = linkurl('play', 'id', $did, 1, 'dance'); $dt['addtime'] = time(); $this->CsdjDB->get_insert('dt', $dt); //如果免审核,则给会员增加相应金币、积分 if ($music['yid'] == 0) { $addhits = getzd('user', 'addhits', $_SESSION['cscms__id']); if ($addhits < User_Nums_Add) { $this->db->query("update " . CS_SqlPrefix . "user set cion=cion+" . User_Cion_Add . ",jinyan=jinyan+" . User_Jinyan_Add . ",addhits=addhits+1 where id=" . $_SESSION['cscms__id'] . ""); } msg_url('恭喜您,歌曲发布成功~!', spacelink('dance', 'dance')); } else { msg_url('恭喜您,歌曲发布成功,请等待管理员审核~!', spacelink('dance/verify', 'dance')); } }
public function return_url() { $this->CsdjUser->User_Login(); $partner = CS_Tenpay_ID; $key = CS_Tenpay_Key; require_once CSCMSPATH . "pay/tenpay/ResponseHandler.class.php"; $resHandler = new ResponseHandler(); $resHandler->setKey($key); //通知id $notify_id = $this->input->get('notify_id', TRUE, TRUE); //商户订单号 $out_trade_no = $this->input->get('out_trade_no', TRUE, TRUE); //财付通订单号 $transaction_id = $this->input->get('transaction_id', TRUE, TRUE); //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee $discount = $this->input->get('discount', TRUE, TRUE); //支付结果 $trade_statess = $_GET['trade_state']; //交易模式,1即时到账 $trade_mode = $this->input->get('trade_mode', TRUE, TRUE); //判断签名 if ($resHandler->isTenpaySign()) { if ("1" == $trade_mode) { if ("0" == $trade_statess) { msg_url(L('pay_07') . $out_trade_no, spacelink('pay')); } else { msg_url(L('pay_09'), spacelink('pay')); } } elseif ("2" == $trade_mode) { if ("0" == $trade_statess) { msg_url(L('pay_19'), spacelink('pay')); } else { msg_url(L('pay_09'), spacelink('pay')); } } } else { msg_url(L('pay_09'), spacelink('pay')); } }
public function reg_save() { //注册开关 if (User_Reg == 0) { msg_url(L('reg_35'), Web_Path); } if (!isset($_SESSION['denglu__id'])) { msg_url(L('open_09'), spacelink('login')); } $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url(L('open_16'), 'javascript:history.back();'); } $userpass2 = $this->input->post('repassword', TRUE, TRUE); $userinfo['code'] = random_string('alnum', 6); $userinfo['name'] = $this->input->post('username', TRUE, TRUE); $userinfo['pass'] = $this->input->post('userpass', TRUE, TRUE); $userinfo['nichen'] = $this->input->post('usernichen', TRUE); $userinfo['email'] = $this->input->post('useremail', TRUE, TRUE); $userinfo['tel'] = $this->input->post('usertel', TRUE, TRUE); $userinfo['regip'] = getip(); $userinfo['cion'] = User_Cion_Reg; $userinfo['jinyan'] = User_Jinyan_Reg; $userinfo['addtime'] = time(); $userinfo['yid'] = 0; if ($userinfo['nichen'] == "0") { $userinfo['nichen'] = ''; } if (!is_username($userinfo['name'])) { msg_url(L('reg_04'), 'javascript:history.back();'); } if (!is_userpass($userinfo['pass'])) { msg_url(L('reg_05'), 'javascript:history.back();'); } if ($userinfo['pass'] != $userpass2) { msg_url(L('reg_34'), 'javascript:history.back();'); } if (!empty($userinfo['nichen']) && !is_username($userinfo['nichen'], 1)) { msg_url(L('reg_06'), 'javascript:history.back();'); } if (!is_email($userinfo['email'])) { msg_url(L('reg_07'), 'javascript:history.back();'); } //判断保留用户名 $ymext = explode('|', Home_Ymext); if (in_array($userinfo['name'], $ymext)) { msg_url(L('reg_08'), 'javascript:history.back();'); } //判断同一IP注册时间限制 if (User_RegIP > 0) { $row = $this->db->query("SELECT addtime FROM " . CS_SqlPrefix . "user where regip='" . $userinfo['regip'] . "' order by id desc")->row(); if ($row && $row->addtime + 3600 * User_RegIP > time()) { msg_url(L('reg_09'), 'javascript:history.back();'); } } //判断用户名是否注册 $username = $this->CsdjDB->get_row('user', 'id', $userinfo['name'], 'name'); if ($username) { msg_url(L('reg_10'), 'javascript:history.back();'); } //判断邮箱是否注册 $useremail = $this->CsdjDB->get_row('user', 'id', $userinfo['email'], 'email'); if ($useremail) { msg_url(L('reg_11'), 'javascript:history.back();'); } //下面选填字段 $userinfo['qq'] = $this->input->post('userqq', TRUE); $userinfo['sex'] = intval($this->input->post('usersex', TRUE)); $userinfo['city'] = $this->input->post('usercity', TRUE); $userinfo['skins'] = Home_Skins; $userinfo['qianm'] = ''; if (!empty($userinfo['tel'])) { if (!is_tel($userinfo['tel'])) { msg_url(L('reg_12'), 'javascript:history.back();'); } //判断手机号码是否注册 $usertel = $this->CsdjDB->get_row('user', 'id', $userinfo['tel'], 'tel'); if ($usertel) { msg_url(L('reg_13'), 'javascript:history.back();'); } } //判断手机强制验证 if (User_Tel == 1) { if (empty($userinfo['tel'])) { msg_url(L('reg_12'), 'javascript:history.back();'); } $telcode = intval($this->input->post('telcode', TRUE)); if ($telcode == 0 || $telcode != $_SESSION['tel_code']) { msg_url(L('reg_14'), 'javascript:history.back();'); } } //是否需要人工验证 if (User_RegFun == 1) { $userinfo['yid'] = 1; $title = L('reg_15'); } //是否需要邮件验证 if (User_RegEmailFun == 1) { $userinfo['yid'] = 2; $title = L('reg_16', array($userinfo['email'])); } //--------------------------- Ucenter --------------------------- if (User_Uc_Mode == 1) { include CSCMS . 'lib/Cs_Ucenter.php'; include CSCMSPATH . 'uc_client/client.php'; $uid = uc_user_register($userinfo['name'], $userinfo['pass'], $userinfo['email']); if ($uid > 0) { $userinfo['uid'] = $uid; } } //--------------------------- Ucenter End --------------------------- //密码加密 $userinfo['pass'] = md5(md5($userinfo['pass']) . $userinfo['code']); $regid = $this->CsdjDB->get_insert('user', $userinfo); if (intval($regid) == 0) { msg_url(L('reg_17'), 'javascript:history.back();'); } //修改第三方登录UID $this->db->query("update " . CS_SqlPrefix . "useroauth set uid=" . $regid . " where id=" . $_SESSION['denglu__id'] . ""); //摧毁token unset($_SESSION['token']); unset($_SESSION['denglu__id']); $this->load->model('CsdjEmail'); if (User_RegEmailFun == 1) { //发送激活邮件 $key = md5($regid . $userinfo['name'] . $userinfo['pass'] . $userinfo['yid']); $Msgs['username'] = $userinfo['name']; $Msgs['url'] = userurl(site_url('user/reg/verify')) . "?key=" . $key . "&username="******"user_id", $regid, time() + 86400); $this->cookie->set_cookie("user_login", $user_login, time() + 86400); msg_url(L('reg_21'), userurl(site_url('user/space')), 'ok'); } else { msg_url(L('reg_21') . $title . '~!', userurl(site_url('user/login')), 'ok'); } }
public function save() { //检测发表权限 $zuid = getzd('user', 'zid', $_SESSION['cscms__id']); $rowu = $this->CsdjDB->get_row('userzu', 'mid', $zuid); if ($rowu->mid == 0) { msg_url(L('msg_07'), 'javascript:history.back();'); } $user = $this->input->post('user', true, true); $name = $this->input->post('name', true, true); $neir = $this->input->post('neir', true, true); if (empty($user)) { msg_url(L('msg_09'), 'javascript:history.back();'); } $uid = getzd('user', 'id', $user, 'name'); if (intval($uid) == 0) { msg_url(L('msg_10'), 'javascript:history.back();'); } if (empty($name)) { msg_url(L('msg_11'), 'javascript:history.back();'); } if (empty($neir)) { msg_url(L('msg_12'), 'javascript:history.back();'); } $add['uida'] = $uid; $add['uidb'] = $_SESSION['cscms__id']; $add['name'] = $name; $add['neir'] = $neir; $add['addtime'] = time(); $this->CsdjDB->get_insert('msg', $add); msg_url(L('msg_13'), spacelink('msg')); }
public function save() { $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url('非法提交~!', 'javascript:history.back();'); } //检测发表权限 $zuid = getzd('user', 'zid', $_SESSION['cscms__id']); $rowu = $this->CsdjDB->get_row('userzu', 'aid,sid', $zuid); if ($rowu->aid == 0) { msg_url('您所在会员组没有权限创建专辑~!', 'javascript:history.back();'); } //检测发表数据是否需要审核 $album['yid'] = $rowu->sid == 1 ? 0 : 1; //必填字段 $album['name'] = $this->input->post('name', TRUE, TRUE); $album['cid'] = intval($this->input->post('cid')); $album['pic'] = $this->input->post('pic', TRUE, TRUE); $album['neir'] = str_replace("\r\n", "<br>", str_encode(trim($_POST['neir']))); //检测必须字段 if ($album['cid'] == 0) { msg_url('请选择专辑分类~!', 'javascript:history.back();'); } if (empty($album['name'])) { msg_url('专辑名称不能为空~!', 'javascript:history.back();'); } if (empty($album['pic'])) { msg_url('专辑图片不能为空~!', 'javascript:history.back();'); } if (empty($album['neir'])) { msg_url('专辑介绍不能为空~!', 'javascript:history.back();'); } //选填字段 $album['yuyan'] = $this->input->post('yuyan', TRUE, TRUE); $album['diqu'] = $this->input->post('diqu', TRUE, TRUE); $album['tags'] = $this->input->post('tags', TRUE, TRUE); $album['fxgs'] = $this->input->post('fxgs', TRUE, TRUE); $album['year'] = $this->input->post('year', TRUE, TRUE); $album['uid'] = $_SESSION['cscms__id']; $album['addtime'] = time(); $singer = $this->input->post('singer', TRUE, TRUE); //判断歌手是否存在 if (!empty($singer)) { $row = $this->CsdjDB->get_row('singer', 'id', $singer, 'name'); if ($row) { $album['singerid'] = $row->id; } } //增加到数据库 $did = $this->CsdjDB->get_insert('dance_topic', $album); if (intval($did) == 0) { msg_url('专辑制作失败,请稍候再试~!', 'javascript:history.back();'); } //摧毁token unset($_SESSION['token']); //增加动态 $dt['dir'] = 'dance'; $dt['uid'] = $_SESSION['cscms__id']; $dt['did'] = $did; $dt['yid'] = $album['yid']; $dt['title'] = '制作了专辑'; $dt['name'] = $album['name']; $dt['link'] = linkurl('topic/show', 'id', $did, 1, 'dance'); $dt['addtime'] = time(); $this->CsdjDB->get_insert('dt', $dt); //如果免审核,则给会员增加相应金币、积分 if ($album['yid'] == 0) { $addhits = getzd('user', 'addhits', $_SESSION['cscms__id']); if ($addhits < User_Nums_Add) { $this->db->query("update " . CS_SqlPrefix . "user set cion=cion+" . User_Cion_Add . ",jinyan=jinyan+" . User_Jinyan_Add . ",addhits=addhits+1 where id=" . $_SESSION['cscms__id'] . ""); } msg_url('恭喜您,专辑制作成功~!', spacelink('album', 'dance')); } else { msg_url('恭喜您,专辑制作成功,请等待管理员审核~!', spacelink('album/verify', 'dance')); } }
function userpage($sqlstr, $nums, $pagesize, $pagenum, $url, $pages = 1, $dir = '') { if (substr($url, -1) != '/') { $url .= '/'; } $znums = $nums; if ($nums == 0) { $nums = 1; } $pagejs = ceil($nums / $pagesize); //总页数 if ($pages == 0) { $pages = 1; } if ($pages > $pagejs) { $pages = $pagejs; } $sqlstr .= " LIMIT " . $pagesize * ($pages - 1) . "," . $pagesize; $str = ""; $first = spacelink($url . '1', $dir); if ($pages == 1) { $pageup = spacelink($url . '1', $dir); } else { $pageup = spacelink($url . ($pages - 1), $dir); } if ($pagejs > $pages) { $pagenext = spacelink($url . ($pages + 1), $dir); } else { $pagenext = spacelink($url . $pagejs, $dir); } $last = spacelink($url . $pagejs, $dir); $pagelist = "<select onchange=javascript:window.location=this.options[this.selectedIndex].value;>\r\n<option value='0'>跳转</option>\r\n"; for ($k = 1; $k <= $pagejs; $k++) { $pagelist .= "<option value='" . spacelink($url . $k, $dir) . "'>第" . $k . "页</option>\r\n"; } $pagelist .= "</select>"; if ($pagejs <= $pagenum) { for ($i = 1; $i <= $pagejs; $i++) { if ($i == $pages) { $str .= "<a href='" . spacelink($url . $i, $dir) . "' class='on'>" . $i . "</a>"; } else { $str .= "<a href='" . spacelink($url . $i, $dir) . "'>" . $i . "</a>"; } } } else { if ($pages >= $pagenum) { for ($i = $pages - intval($pagenum / 2); $i <= $pages + intval($pagenum / 2); $i++) { if ($i <= $pagejs) { if ($i == $pages) { $str .= "<a href='" . spacelink($url . $i, $dir) . "' class='on'>" . $i . "</a>"; } else { $str .= "<a href='" . spacelink($url . $i, $dir) . "'>" . $i . "</a>"; } } } if ($i <= $pagejs) { $str .= "<a href='" . spacelink($url . $pagejs, $dir) . "'>" . $pagejs . "</a>"; } } else { for ($i = 1; $i <= $pagenum; $i++) { if ($i == $pages) { $str .= "<a href='" . spacelink($url . $i, $dir) . "' class='on'>" . $i . "</a>"; } else { $str .= "<a href='" . spacelink($url . $i, $dir) . "'>" . $i . "</a>"; } } if ($i <= $pagejs) { $str .= "<a href='" . spacelink($url . $pagejs, $dir) . "'>" . $pagejs . "</a>"; } } } $arr = array($sqlstr, $first, $last, $pageup, $pagenext, $pages, $pagejs, $pagesize, $str, $pagelist, $znums); return $arr; }
public function log() { $callback = $this->input->get('callback', true); if (!$this->CsdjUser->User_Login(1)) { $str['error'] = 'no'; } else { $str['error'] = 'ok'; $nichen = getzd('user', 'nichen', $_SESSION['cscms__id']); $str['nichen'] = '<a style="color:#888999;" href="' . spacelink('space') . '" target="_blank">' . get_bm($nichen, 'gbk', 'utf-8') . '</a>'; //收藏总数 $favnums = $this->db->query("SELECT id FROM " . CS_SqlPrefix . "dance_fav where uid=" . $_SESSION['cscms__id'] . "")->num_rows(); $str['favnums'] = $favnums; } echo $callback . "(" . json_encode($str) . ")"; }
public function return_url() { $this->CsdjUser->User_Login(); if (defined('MOBILE')) { //手机支付 require_once CSCMSPATH . "pay/alipay_wap/alipay.config.php"; require_once CSCMSPATH . "pay/alipay_wap/lib/alipay_notify.class.php"; $alipayNotify = new AlipayNotify($alipay_config); $verify_result = $alipayNotify->verifyReturn(); if ($verify_result) { //验证成功 //商户订单号 $out_trade_no = $this->input->get('out_trade_no', true, true); //支付宝交易号 $trade_no = $this->input->get('trade_no', true, true); //交易状态 $trade_status = $this->input->get('trade_status', true, true); if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') { msg_url(L('pay_07') . $out_trade_no, spacelink('pay')); } else { echo L('pay_08') . $trade_status; } } else { msg_url(L('pay_09'), spacelink('pay')); } } elseif (CS_Alipay_JK == 1) { //双功能 require_once CSCMSPATH . "pay/alipay_trade/alipay.config.php"; require_once CSCMSPATH . "pay/alipay_trade/lib/alipay_notify.class.php"; //计算得出通知验证结果 $alipayNotify = new AlipayNotify($alipay_config); $verify_result = $alipayNotify->verifyReturn(); if ($verify_result) { //验证成功 //商户订单号 $out_trade_no = $this->input->get('out_trade_no', true, true); //支付宝交易号 $trade_no = $this->input->get('trade_no', true, true); //交易状态 $trade_status = $this->input->get('trade_status', true, true); if ($trade_status == 'WAIT_SELLER_SEND_GOODS') { //付款成功,没有发货 msg_url(L('pay_10') . $out_trade_no, spacelink('pay')); } elseif ($trade_status == 'TRADE_FINISHED') { //交易完成 msg_url(L('pay_07') . $out_trade_no, spacelink('pay')); } else { echo L('pay_08') . $trade_status; } } else { msg_url(L('pay_09'), spacelink('pay')); } } elseif (CS_Alipay_JK == 2) { //即时到账 require_once CSCMSPATH . "pay/alipay_direct/alipay.config.php"; require_once CSCMSPATH . "pay/alipay_direct/lib/alipay_notify.class.php"; $alipayNotify = new AlipayNotify($alipay_config); $verify_result = $alipayNotify->verifyReturn(); if ($verify_result) { //验证成功 //商户订单号 $out_trade_no = $this->input->get('out_trade_no', true, true); //支付宝交易号 $trade_no = $this->input->get('trade_no', true, true); //交易状态 $trade_status = $this->input->get('trade_status', true, true); if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') { msg_url(L('pay_07') . $out_trade_no, spacelink('pay')); } else { echo L('pay_08') . $trade_status; } } else { msg_url(L('pay_09'), spacelink('pay')); } } }
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; } }
public function index($a1, $a2 = 0, $a3 = 0, $a4 = 0) { if (intval($a1) > 0) { $id = intval($a1); //ID $zu = intval($a2); //组 $ji = intval($a3); //集数 } else { $id = intval($a2); //ID $zu = intval($a3); //组 $ji = intval($a4); //集数 } $login = '******'; //判断ID if ($id == 0) { msg_url('出错了,ID不能为空!', Web_Path); } //获取数据 $row = $this->CsdjDB->get_row_arr('vod', '*', $id); if (!$row || $row['yid'] > 0 || $row['hid'] > 0) { msg_url('出错了,该数据不存在或者没有审核!', Web_Path); } if (empty($row['purl'])) { msg_url('该视频播放地址不正确!', Web_Path); } //判断运行模式,生成则跳转至静态页面 $html = config('Html_Uri'); if (config('Web_Mode') == 3 && $html['play']['check'] == 1 && !defined('MOBILE')) { //获取静态路径 $Htmllink = VodPlayUrl('play', $id, $zu, $ji); header("Location: " . $Htmllink); exit; } //判断收费 if ($row['vip'] > 0 || $row['level'] > 0 || $row['cion'] > 0) { if (!$this->CsdjUser->User_Login(1)) { msg_url('观看这部视频需要登录,请先登录!', spacelink('login')); } $rowu = $this->CsdjDB->get_row_arr('user', 'vip,level,cion', $_SESSION['cscms__id']); } //判断会员组下载权限 if ($row['vip'] > 0 && $row['uid'] != $_SESSION['cscms__id']) { if ($row['vip'] > $rowu['vip']) { msg_url('抱歉,您所在的会员组不能观看该视频,请先升级!', 'javascript:window.close();'); } } //判断会员等级下载权限 if ($row['level'] > 0 && $row['uid'] != $_SESSION['cscms__id']) { if ($row['level'] > $rowu['level']) { msg_url('抱歉,您等级不够,不能观看该视频!', 'javascript:window.close();'); } } //判断金币下载 $down = 0; if ($row['cion'] > 0 && $row['uid'] != $_SESSION['cscms__id']) { //判断是否下载过 $did = $id . '-' . $zu . '-' . $ji; $rowd = $this->db->query("SELECT id,addtime FROM " . CS_SqlPrefix . "vod_look where did='" . $did . "' and uid='" . $_SESSION['cscms__id'] . "' and sid=0")->row_array(); if ($rowd) { $down = 1; //数据已经存在 $downtime = User_Downtime * 3600 + $rowd['addtime']; if ($downtime > time()) { $down = 2; //在多少时间内不重复扣币 } } //判断会员组下载权限 $rowz = $this->db->query("SELECT id,did FROM " . CS_SqlPrefix . "userzu where id='" . $rowu['vip'] . "'")->row_array(); if ($rowz && $rowz['did'] == 1) { //有免费下载权限 $down = 2; //该会员下载不收费 } if ($down < 2) { //判断扣币 if ($row['cion'] > $rowu['cion']) { msg_url('这部视频观看每集需要' . $row['cion'] . '个金币,您的当前金币不够,请先充值!', 'javascript:window.close();'); } else { //扣币 $edit['cion'] = $rowu['cion'] - $row['cion']; $this->CsdjDB->get_update('user', $_SESSION['cscms__id'], $edit); //写入消费记录 $add2['title'] = '观看视频《' . $row['name'] . '》- 第' . ($ji + 1) . '集'; $add2['uid'] = $_SESSION['cscms__id']; $add2['nums'] = $row['cion']; $add2['ip'] = getip(); $add2['dir'] = 'vod'; $add2['addtime'] = time(); $this->CsdjDB->get_insert('spend', $add2); //判断分成 if (User_DownFun == 1 && $row['uid'] > 0) { //分成比例 $bi = User_Downcion < 10 ? '0.0' . User_Downcion : '0.' . User_Downcion; $scion = intval($row['cion'] * $bi); if ($scion > 0) { $this->db->query("update " . CS_SqlPrefix . "user set cion=cion+" . $scion . " where id=" . $row['uid'] . ""); //写入分成记录 $add3['title'] = '视频《' . $row['name'] . '》- 第' . ($ji + 1) . '集 - 观看分成'; $add3['uid'] = $row['uid']; $add3['dir'] = 'vod'; $add3['nums'] = $scion; $add3['ip'] = getip(); $add3['addtime'] = time(); $this->CsdjDB->get_insert('income', $add3); } } } } //增加观看记录 if ($down == 0) { $add['name'] = $row['name']; $add['cid'] = $row['cid']; $add['sid'] = 0; $add['did'] = $did; $add['uid'] = $_SESSION['cscms__id']; $add['cion'] = $row['cion']; $add['addtime'] = time(); $this->CsdjDB->get_insert('vod_look', $add); } } //摧毁部分需要超级链接字段数组 $rows = $row; //先保存数组保留下面使用 unset($row['zhuyan']); unset($row['daoyan']); unset($row['yuyan']); unset($row['diqu']); unset($row['tags']); unset($row['year']); unset($row['pfen']); unset($row['phits']); //获取当前分类下二级分类ID $arr['cid'] = getChild($row['cid']); $arr['uid'] = $row['uid']; $arr['singerid'] = $row['singerid']; $arr['tags'] = $rows['tags']; $skins = $row['skins']; if (empty($skins) || $skins == 'play.html') { $skins = getzd('vod_list', 'skins3', $row['cid']); } if (empty($skins)) { $skins = 'play.html'; } //装载模板并输出 $Mark_Text = $this->CsdjTpl->plub_show('vod', $row, $arr, TRUE, $skins, $row['name'], $row['name']); //评论 $Mark_Text = str_replace("[vod:pl]", get_pl('vod', $id), $Mark_Text); //分类地址、名称 $Mark_Text = str_replace("[vod:zu]", $zu + 1, $Mark_Text); $Mark_Text = str_replace("[vod:ji]", $ji + 1, $Mark_Text); $Mark_Text = str_replace("[vod:link]", LinkUrl('show', 'id', $row['id'], 1, 'vod'), $Mark_Text); $Mark_Text = str_replace("[vod:playlink]", VodPlayUrl('play', $id, $zu, $ji), $Mark_Text); $Mark_Text = str_replace("[vod:classlink]", LinkUrl('lists', 'id', $row['cid'], 1, 'vod'), $Mark_Text); $Mark_Text = str_replace("[vod:classname]", $this->CsdjDB->getzd('vod_list', 'name', $row['cid']), $Mark_Text); //主演、导演、标签、年份、地区、语言加超级连接 $Mark_Text = str_replace("[vod:zhuyan]", SearchLink($rows['zhuyan'], 'zhuyan'), $Mark_Text); $Mark_Text = str_replace("[vod:daoyan]", SearchLink($rows['daoyan'], 'daoyan'), $Mark_Text); $Mark_Text = str_replace("[vod:yuyan]", SearchLink($rows['yuyan'], 'yuyan'), $Mark_Text); $Mark_Text = str_replace("[vod:diqu]", SearchLink($rows['diqu'], 'diqu'), $Mark_Text); $Mark_Text = str_replace("[vod:tags]", SearchLink($rows['tags']), $Mark_Text); $Mark_Text = str_replace("[vod:year]", SearchLink($rows['year'], 'year'), $Mark_Text); //评分 $Mark_Text = str_replace("[vod:pfen]", getpf($rows['pfen'], $rows['phits']), $Mark_Text); $Mark_Text = str_replace("[vod:pfenbi]", getpf($rows['pfen'], $rows['phits'], 2), $Mark_Text); //解析播放地址 $Mark_Text = Vod_Playlist($Mark_Text, 'play', $id, $row['purl']); //播放器 $Data_Arr = explode("#cscms#", $row['purl']); if ($zu >= count($Data_Arr)) { $zu = 0; } $DataList_Arr = explode("\n", $Data_Arr[$zu]); $Dataurl_Arr = explode('$', $DataList_Arr[$ji]); $xpurl = ""; //下集播放地址 $laiyuan = str_replace("\r", "", @$Dataurl_Arr[2]); //来源 $url = $Dataurl_Arr[1]; //地址 $pname = $Dataurl_Arr[0]; //当前集数 $Mark_Text = str_replace("[vod:qurl]", $url, $Mark_Text); $Mark_Text = str_replace("[vod:laiy]", $laiyuan, $Mark_Text); $Mark_Text = str_replace("[vod:ji]", $pname, $Mark_Text); //手机播放地址 if (substr($url, 0, 7) == 'http://') { $wapurl = $url; } else { $wapurl = 'http://download.chshcms.com/mp4/' . $laiyuan . '/' . cs_base64_encode($url) . '/cscms.mp4'; } $Mark_Text = str_replace("[vod:wapurl]", $wapurl, $Mark_Text); if (count($DataList_Arr) > $ji + 1) { $DataNext = $DataList_Arr[$ji + 1]; $DataNextArr = explode('$', $DataNext); if (count($DataNextArr) == 2) { $DataNext = $DataNextArr[1]; } $xurl = VodPlayUrl('play', $id, $zu, $ji + 1); $Dataurl_Arr2 = explode('$', $DataList_Arr[$ji + 1]); $xpurl = @$Dataurl_Arr2[1]; //下集播放地址 } else { $DataNext = $DataList_Arr[$ji]; $DataNextArr = explode('$', $DataNext); if (count($DataNextArr) == 2) { $DataNext = $DataNextArr[1]; } $xurl = '#'; $xpurl = ''; //下集播放地址 } if ($ji == 0) { $surl = '#'; } else { $surl = VodPlayUrl('play', $id, $zu, $ji - 1); } $psname = ''; for ($j = 0; $j < count($Data_Arr); $j++) { $jis = ''; $Ji_Arr = explode("\n", $Data_Arr[$j]); for ($k = 0; $k < count($Ji_Arr); $k++) { $Ly_Arr = explode('$', $Ji_Arr[$k]); $jis .= $Ly_Arr[0] . '$$' . @$Ly_Arr[2] . '===='; } $psname .= substr($jis, 0, -4) . '#cscms#'; } $player_arr = str_replace("\r", "", substr($psname, 0, -7)); if ($laiyuan == 'xgvod' || $laiyuan == 'jjvod' || $laiyuan == 'yyxf' || $laiyuan == 'bdhd' || $laiyuan == 'qvod') { $xpurl = str_replace("+", "__", base64_encode($xpurl)); $url = str_replace("+", "__", base64_encode($url)); } else { $xpurl = escape($xpurl); $url = escape($url); } $player = "<script type='text/javascript' src='" . hitslink('play/form', 'vod') . "'></script><script type='text/javascript'>var cs_playlink='" . VodPlayUrl('play', $id, $zu, $ji, 1) . "';var cs_did='" . $id . "';var player_name='" . $player_arr . "';var cs_pid='" . $ji . "';var cs_zid='" . $zu . "';var cs_vodname='" . $row['name'] . " - " . $pname . "';var cs_root='" . Web_Path . "';var cs_width=" . CS_Play_sw . ";var cs_height=" . CS_Play_sh . ";var cs_surl='" . $surl . "';var cs_xurl='" . $xurl . "';var cs_url='" . $url . "';var cs_xpurl='" . $xpurl . "';var cs_laiy='" . $laiyuan . "';var cs_adloadtime='" . CS_Play_AdloadTime . "';</script><iframe border=\"0\" name=\"cscms_vodplay\" id=\"cscms_vodplay\" src=\"" . Web_Path . "packs/vod_player/play.html\" marginwidth=\"0\" framespacing=\"0\" marginheight=\"0\" noresize=\"\" vspale=\"0\" style=\"z-index: 9998;\" frameborder=\"0\" height=\"" . (CS_Play_sh + 30) . "\" scrolling=\"no\" width=\"100%\"></iframe>"; $Mark_Text = str_replace("[vod:player]", $player, $Mark_Text); $Mark_Text = str_replace("[vod:surl]", $surl, $Mark_Text); $Mark_Text = str_replace("[vod:xurl]", $xurl, $Mark_Text); //增加人气 $Mark_Text = hits_js($Mark_Text, hitslink('hits/ids/' . $id, 'vod')); echo $Mark_Text; $this->cache->end(); //由于前面不是直接输出,所以这里需要加入写缓存 }
public function pass() { //模板 $tpl = 'edit-pass.html'; //URL地址 $url = 'edit/pass'; //当前会员 $row = $this->CsdjDB->get_row_arr('user', '*', $_SESSION['cscms__id']); if (empty($row['nichen'])) { $row['nichen'] = $row['name']; } //装载模板 $title = L('edit_12'); $ids['uid'] = $_SESSION['cscms__id']; $ids['uida'] = $_SESSION['cscms__id']; $Mark_Text = $this->CsdjTpl->user_list($row, $url, 1, $tpl, $title, 'id', '', $ids, true, false); //会员版块导航 $Mark_Text = $this->skins->cscmsumenu($Mark_Text, $_SESSION['cscms__id']); $Mark_Text = $this->skins->labelif($Mark_Text); //token $token = random_string('alnum', 10); $_SESSION['token'] = $token; $Mark_Text = str_replace("[user:token]", $token, $Mark_Text); //提交地址 $Mark_Text = str_replace("[user:passsave]", spacelink('edit,pass_save'), $Mark_Text); echo $Mark_Text; }
public function changesave() { $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url(L('pay_06'), 'javascript:history.back();'); } $rmb = intval($this->input->post('rmb')); if ($rmb < 1 || $rmb > 99999) { msg_url(L('pay_21'), 'javascript:history.back();'); } //判断余额是否够 $urmb = getzd('user', 'rmb', $_SESSION['cscms__id']); if ($urmb < $rmb) { msg_url(L('pay_22', array($rmb)), 'javascript:history.back();'); } $cion = $rmb * User_RmbToCion; //修改入库 $this->db->query("update " . CS_SqlPrefix . "user set rmb=rmb-" . $rmb . ",cion=cion+" . $cion . " where id=" . $_SESSION['cscms__id'] . ""); //写入消费记录 $add2['title'] = L('pay_23', array($cion)); $add2['uid'] = $_SESSION['cscms__id']; $add2['dir'] = 'user'; $add2['nums'] = $rmb; $add2['sid'] = 1; $add2['ip'] = getip(); $add2['addtime'] = time(); $this->CsdjDB->get_insert('spend', $add2); //发送通知 $add['uida'] = $_SESSION['cscms__id']; $add['uidb'] = 0; $add['name'] = L('pay_24'); $add['neir'] = L('pay_25', array($rmb, $cion)); $add['addtime'] = time(); $this->CsdjDB->get_insert('msg', $add); msg_url(L('pay_26', array($cion)), spacelink('pay/change')); }
public function return_url() { require_once CSCMSPATH . "pay/yeepay/yeepayCommon.php"; $return = getCallBackValue($r0_Cmd, $r1_Code, $r2_TrxId, $r3_Amt, $r4_Cur, $r5_Pid, $r6_Order, $r7_Uid, $r8_MP, $r9_BType, $hmac); $bRet = CheckHmac($r0_Cmd, $r1_Code, $r2_TrxId, $r3_Amt, $r4_Cur, $r5_Pid, $r6_Order, $r7_Uid, $r8_MP, $r9_BType, $hmac); if ($bRet) { if ($r1_Code == "1") { if ($r9_BType == "1") { $out_trade_no = $this->input->get_post('r6_Order', true, true); $row = $this->CsdjDB->get_row('pay', '*', $out_trade_no, 'dingdan'); if ($row && $row->pid != 1) { //增加金钱 $this->db->query("update " . CS_SqlPrefix . "user set rmb=rmb+" . $row->rmb . " where id=" . $row->uid . ""); //改变状态 $this->db->query("update " . CS_SqlPrefix . "pay set pid=1 where id=" . $row->id . ""); //发送通知 $add['uida'] = $row->uid; $add['uidb'] = 0; $add['name'] = L('pay_11'); $add['neir'] = L('pay_17', array($row->rmb, $out_trade_no)); $add['addtime'] = time(); $this->CsdjDB->get_insert('msg', $add); } msg_url(L('pay_07') . $out_trade_no, spacelink('pay')); } elseif ($r9_BType == "2") { msg_url(L('pay_09'), spacelink('pay')); } } else { msg_url(L('pay_09'), spacelink('pay')); } } }
public function cscms_skins($field, $str, $label, $row, $sorti = 1, $autoarr = array()) { preg_match_all('/\\[' . $field . ':\\s*([0-9a-zA-Z\\_\\-]+)([\\s]*[link|ulink|dir|level|zd|len|style]*)[=]??([\\d0-9a-zA-Z\\,\\{\\}\\/\\-\\\\:\\s]*)\\]/', $str, $field_arr); if (!empty($field_arr)) { //判断是否嵌套二级 preg_match('/{cscmstype:([\\S]+)\\s+(.*?)}([\\s\\S]+?){\\/cscmstype:\\1}/', $label, $type_arr); if (!empty($type_arr)) { $label = $this->cscms_sql_to($type_arr[1], $type_arr[2], $type_arr[0], $type_arr[3], $label, $row['id']); } unset($type_arr); for ($i = 0; $i < count($field_arr[0]); $i++) { $type = $field_arr[1][$i]; if (array_key_exists($type, $row) && trim($field_arr[2][$i]) != 'zd') { if ($type == 'addtime') { $label = str_replace('[' . $field . ':' . $type . ']', date('Y-m-d H:i:s', $row[$type]), $label); } else { $label = str_replace('[' . $field . ':' . $type . ']', $row[$type], $label); } //判断自定义标签 if (!empty($field_arr[2][$i]) && !empty($field_arr[3][$i])) { //格式化时间 if (trim($field_arr[2][$i]) == 'style' && trim($field_arr[3][$i]) == 'time') { $label = str_replace($field_arr[0][$i], datetime($row[$type]), $label); //获取IP地区 } elseif (trim($field_arr[2][$i]) == 'style' && trim($field_arr[3][$i]) == 'city') { $ci =& get_instance(); $ci->load->library('ip'); $label = str_replace($field_arr[0][$i], $ci->ip->address($row[$type]), $label); //自定义时间 } elseif (trim($field_arr[2][$i]) == 'style') { $label = str_replace($field_arr[0][$i], date(str_replace('f', 'i', $field_arr[3][$i]), $row[$type]), $label); //图片地址 } elseif (trim($field_arr[2][$i]) == 'dir') { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $pic = piclink($lall[0], $row[$type], $lass); $label = str_replace($field_arr[0][$i], $pic, $label); } //字符截取 if (trim($field_arr[2][$i]) == 'len') { $label = str_replace($field_arr[0][$i], sub_str(str_checkhtml($row[$type]), $field_arr[3][$i]), $label); } } } else { //外部字段 switch ($type) { //序 case 'i': $label = str_replace($field_arr[0][$i], $sorti, $label); break; //序 //序 case 'addres': if (trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i]) && array_key_exists($field_arr[3][$i], $row)) { $zd = $field_arr[3][$i]; $ci =& get_instance(); $ci->load->library('ip'); $label = str_replace($field_arr[0][$i], $ci->ip->address($row[$zd]), $label); } break; //数据统计 //数据统计 case 'count': if (trim($field_arr[2][$i]) == 'zdy' && !empty($field_arr[3][$i])) { $count = 0; $arr = explode(',', $field_arr[3][$i]); $table = $arr[0]; $czd = empty($arr[1]) ? 'id' : $arr[1]; $szd = empty($arr[2]) ? 'id' : $arr[2]; if (array_key_exists($szd, $row)) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $uid = !empty($row[$szd]) ? $row[$szd] : (!empty($row['uid']) ? $row['uid'] : 0); if (!empty($table) && $ci->db->table_exists(CS_SqlPrefix . $table) && $ci->db->field_exists($czd, CS_SqlPrefix . $table)) { if (!empty($arr[3]) && (!empty($arr[4]) || (int) $arr[4] == 0)) { if ($ci->db->field_exists($arr[3], CS_SqlPrefix . $table)) { $count = $ci->db->query("SELECT id FROM " . CS_SqlPrefix . $table . " where " . $czd . "='" . $uid . "' and " . $arr[3] . "='" . $arr[4] . "'")->num_rows(); } } else { $count = $ci->db->query("SELECT id FROM " . CS_SqlPrefix . $table . " where " . $czd . "='" . $uid . "'")->num_rows(); } } } $label = str_replace($field_arr[0][$i], $count, $label); } break; //会员信息 //会员信息 case 'user': if (($field == 'user' or array_key_exists('uid', $row) or array_key_exists('uidb', $row)) && trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i])) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $ziduan = $field_arr[3][$i]; $zdneir = ($field == 'gbook' or $field == 'pl') ? '游客' : 'null'; if ($field == 'user') { $uid = $row['id']; } else { $lall = explode(",", $ziduan); if (!empty($lall[1])) { $uid = !empty($lall[1]) ? $lall[1] : 0; $ziduan = $lall[1]; } else { if (!empty($row['uid'])) { $uid = $row['uid']; } else { $uid = !empty($row['uidb']) ? $row['uidb'] : 0; } } } $czd = $ziduan == 'nichen' ? $ziduan . ',name' : $ziduan; if ($ci->db->field_exists($ziduan, CS_SqlPrefix . 'user')) { $rowu = $ci->db->query("SELECT " . $czd . " FROM " . CS_SqlPrefix . "user where id='" . $uid . "'")->row(); if ($rowu) { $zdneir = $field_arr[3][$i] == 'nichen' && empty($rowu->{$ziduan}) ? $rowu->name : $rowu->{$ziduan}; } } if ($ziduan == 'logo') { if ($uid == 0) { $zdneir = ''; } $zdneir = piclink('logo', $zdneir); } if ($ziduan == 'zid') { if ($zdneir == 0) { $zdneir = 1; } $zdneir = getzd('userzu', 'name', $zdneir); } if ($ziduan == 'qianm') { if (empty($zdneir)) { $zdneir = '暂时没有签名...'; } } if ($ziduan == 'city') { if (empty($zdneir)) { $zdneir = '保密'; } } $label = str_replace($field_arr[0][$i], $zdneir, $label); //会员等级 } elseif (($field == 'user' or array_key_exists('uid', $row) or array_key_exists('uidb', $row)) && trim($field_arr[2][$i]) == 'level' && !empty($field_arr[3][$i])) { $zdneir = ''; if ($field == 'user') { $uid = $row['id']; } else { $uid = !empty($row['uid']) ? $row['uid'] : (!empty($row['uidb']) ? $row['uidb'] : 0); } $jinyan = getzd('user', 'jinyan', $uid); if ($field_arr[3][$i] == '1') { //星星数 $zdneir = getlevel($jinyan, 1); } if ($field_arr[3][$i] == '2') { //下个级别需要经验 $zdneir = getlevel($jinyan, 2); } if ($field_arr[3][$i] == '3') { //下个级别剩余经验 $zdneir = getlevel($jinyan, 3); } if ($field_arr[3][$i] == '4') { //剩余百分比 $zdneir = getlevel($jinyan, 4); } if ($field_arr[3][$i] == '5') { //名称 $zdneir = getlevel($jinyan, 5); } $label = str_replace($field_arr[0][$i], $zdneir, $label); } break; //歌手信息 //歌手信息 case 'singer': if (array_key_exists('singerid', $row) && trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i])) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $zdneir = 'null'; if ($ci->db->table_exists(CS_SqlPrefix . 'singer')) { //歌手表存在 $ziduan = $field_arr[3][$i]; if ($ci->db->field_exists($ziduan, CS_SqlPrefix . 'singer')) { $rows = $ci->db->query("SELECT " . $ziduan . " FROM " . CS_SqlPrefix . "singer where id='" . $row['singerid'] . "'")->row(); if ($rows) { $zdneir = $rows->{$ziduan}; } } if ($ziduan == 'pic') { if ($row['singerid'] == 0) { $zdneir = ''; } $zdneir = piclink('singer', $zdneir); } } $label = str_replace($field_arr[0][$i], $zdneir, $label); } break; //版块链接 //版块链接 case 'murl': if (array_key_exists('dir', $row)) { $link = cscmslink($row['dir']); $label = str_replace($field_arr[0][$i], $link, $label); } break; //网站链接 //网站链接 case 'url': //全局 if (array_key_exists('id', $row) && trim($field_arr[2][$i]) == 'link' && !empty($field_arr[3][$i])) { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $link = linkurl($lall[0], $lass, $row['id']); $label = str_replace($field_arr[0][$i], $link, $label); } //会员 if ((array_key_exists('uid', $row) || array_key_exists('uidb', $row) || $field == 'user') && trim($field_arr[2][$i]) == 'ulink' && !empty($field_arr[3][$i])) { $ci =& get_instance(); if (!isset($ci->db)) { $ci->load->database(); } $link = ''; if ($field == 'user') { if (array_key_exists('id', $row) && array_key_exists('name', $row)) { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $link = userlink($lall[0], $row['id'], $row['name'], $lass); } } else { $uid = !empty($row['uid']) ? $row['uid'] : (!empty($row['uidb']) ? $row['uidb'] : 0); $rowu = $ci->db->query("SELECT id,name FROM " . CS_SqlPrefix . "user where id='" . $uid . "'")->row(); if (!$rowu) { $link = 'http://' . Web_Url . Web_Path; } else { $lall = explode(",", $field_arr[3][$i]); $lass = count($lall) > 1 ? $lall[1] : ''; $link = userlink($lall[0], $rowu->id, $rowu->name, $lass); } } $label = str_replace($field_arr[0][$i], $link, $label); } //会员中心... if (trim($field_arr[2][$i]) == 'userlink' && !empty($field_arr[3][$i])) { $link = spacelink($field_arr[3][$i]); $label = str_replace($field_arr[0][$i], $link, $label); } //自定义URL,板块,字段,参数,参数... if (trim($field_arr[2][$i]) == 'zdy' && !empty($field_arr[3][$i])) { $lall = explode(",", $field_arr[3][$i]); if (!array_key_exists($lall[1], $row) || $row[$lall[1]] == 0) { $link = 'http://' . Web_Url . Web_Path; } else { $lass = count($lall) > 3 ? $lall[3] : ''; $link = linkurl($lall[2], $lass, $row[$lall[1]], 1, $lall[0]); } $label = str_replace($field_arr[0][$i], $link, $label); } break; } } } } unset($field_arr); return $label; }
public function save() { $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url('非法提交~!', 'javascript:history.back();'); } //检测发表权限 $zuid = getzd('user', 'zid', $_SESSION['cscms__id']); $rowu = $this->CsdjDB->get_row('userzu', 'aid,sid', $zuid); if (!$rowu || $rowu->aid == 0) { msg_url('您所在会员组没有权限上传图片~!', 'javascript:history.back();'); } //检测发表数据是否需要审核 $pic['yid'] = $rowu->sid == 1 ? 0 : 1; //选填字段 $pic['content'] = str_replace("\r\n", "<br>", str_encode($_POST['content'])); $pic['uid'] = $_SESSION['cscms__id']; $pic['addtime'] = time(); $name = $this->input->post('name', TRUE, TRUE); //必填字段 $pic['sid'] = intval($this->input->post('sid')); $pic['cid'] = intval($this->input->post('cid')); $pic['pic'] = $this->input->post('pic', TRUE, TRUE); //检测必须字段 if ($pic['cid'] == 0) { msg_url('请选择图片分类~!', 'javascript:history.back();'); } if ($pic['sid'] == 0) { msg_url('请选择图片所属相册~!', 'javascript:history.back();'); } if (empty($pic['pic'])) { msg_url('图片地址不能为空~!', 'javascript:history.back();'); } //增加到数据库 $did = $this->CsdjDB->get_insert('pic', $pic); if (intval($did) == 0) { msg_url('图片上传失败,请稍候再试~!', 'javascript:history.back();'); } //摧毁token unset($_SESSION['token']); //增加动态 $dt['dir'] = 'pic'; $dt['uid'] = $_SESSION['cscms__id']; $dt['did'] = $pic['sid']; $dt['yid'] = $pic['yid']; $dt['title'] = '上传了图片到' . $name; $dt['name'] = $name; $dt['link'] = linkurl('show', 'id', $pic['sid'], 1, 'pic'); $dt['addtime'] = time(); $this->CsdjDB->get_insert('dt', $dt); //如果免审核,则给会员增加相应金币、积分 if ($pic['yid'] == 0) { $addhits = getzd('user', 'addhits', $_SESSION['cscms__id']); if ($addhits < User_Nums_Add) { $this->db->query("update " . CS_SqlPrefix . "user set cion=cion+" . User_Cion_Add . ",jinyan=jinyan+" . User_Jinyan_Add . ",addhits=addhits+1 where id=" . $_SESSION['cscms__id'] . ""); } msg_url('恭喜您,图片上传成功~!', spacelink('pic', 'pic')); } else { msg_url('恭喜您,图片上传成功,请等待管理员审核~!', spacelink('pic', 'pic') . '/index/0/1'); } }
public function save() { $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url('非法提交~!', 'javascript:history.back();'); } //检测发表权限 $zuid = getzd('user', 'zid', $_SESSION['cscms__id']); $rowu = $this->CsdjDB->get_row('userzu', 'aid,sid', $zuid); if (!$rowu || $rowu->aid == 0) { msg_url('您所在会员组没有权限发表视频~!', 'javascript:history.back();'); } //检测发表数据是否需要审核 $vod['yid'] = $rowu->sid == 1 ? 0 : 1; //选填字段 $vod['cion'] = intval($this->input->post('cion')); $vod['dcion'] = intval($this->input->post('dcion')); $vod['text'] = str_replace("\r\n", "<br>", str_encode($_POST['text'])); $vod['pic'] = $this->input->post('pic', TRUE, TRUE); $vod['tags'] = $this->input->post('tags', TRUE, TRUE); $vod['daoyan'] = $this->input->post('daoyan', TRUE, TRUE); $vod['zhuyan'] = $this->input->post('zhuyan', TRUE, TRUE); $vod['yuyan'] = $this->input->post('yuyan', TRUE, TRUE); $vod['diqu'] = $this->input->post('diqu', TRUE, TRUE); $vod['year'] = $this->input->post('year', TRUE, TRUE); $vod['info'] = $this->input->post('info', TRUE, TRUE); $vod['uid'] = $_SESSION['cscms__id']; $vod['addtime'] = time(); $down = $this->input->post('down', TRUE, TRUE); $durl = $this->input->post('durl', TRUE, TRUE); //必填字段 $vod['name'] = $this->input->post('name', TRUE, TRUE); $vod['cid'] = intval($this->input->post('cid')); $play = $this->input->post('play', TRUE, TRUE); $purl = $this->input->post('purl', TRUE, TRUE); //检测必须字段 if ($vod['cid'] == 0) { msg_url('请选择视频分类~!', 'javascript:history.back();'); } if (empty($vod['name'])) { msg_url('视频名称不能为空~!', 'javascript:history.back();'); } if (empty($play)) { msg_url('视频播放来源不能为空~!', 'javascript:history.back();'); } if (empty($purl)) { msg_url('视频播放地址不能为空~!', 'javascript:history.back();'); } //播放地址组合 if ($play != 'flv' && $play != 'media') { if (substr($purl, 0, 7) != 'http://') { msg_url('视频播放地址不正确~!', 'javascript:history.back();'); } $arr = caiji($purl, 1); $form = $arr['laiy']; $purl = $arr['url']; if (empty($vod['pic'])) { $vod['pic'] = $arr['pic']; } $vod['purl'] = '第01集$' . $purl . '$' . $form; } else { $vod['purl'] = '第01集$' . $purl . '$' . $play; } //下载地址组合 if (!empty($down) && !empty($durl)) { $vod['durl'] = '第01集$' . $durl . '$' . $down; } $singer = $this->input->post('singer', TRUE, TRUE); //判断歌手是否存在 if (!empty($singer)) { $row = $this->CsdjDB->get_row('singer', 'id', $singer, 'name'); if ($row) { $vod['singerid'] = $row->id; } } //增加到数据库 $did = $this->CsdjDB->get_insert('vod', $vod); if (intval($did) == 0) { msg_url('视频发布失败,请稍候再试~!', 'javascript:history.back();'); } //摧毁token unset($_SESSION['token']); //增加动态 $dt['dir'] = 'vod'; $dt['uid'] = $_SESSION['cscms__id']; $dt['did'] = $did; $dt['yid'] = $vod['yid']; $dt['title'] = '发布了视频'; $dt['name'] = $vod['name']; $dt['link'] = linkurl('show', 'id', $did, 1, 'vod'); $dt['addtime'] = time(); $this->CsdjDB->get_insert('dt', $dt); //如果免审核,则给会员增加相应金币、积分 if ($vod['yid'] == 0) { $addhits = getzd('user', 'addhits', $_SESSION['cscms__id']); if ($addhits < User_Nums_Add) { $this->db->query("update " . CS_SqlPrefix . "user set cion=cion+" . User_Cion_Add . ",jinyan=jinyan+" . User_Jinyan_Add . ",addhits=addhits+1 where id=" . $_SESSION['cscms__id'] . ""); } msg_url('恭喜您,视频发布成功~!', spacelink('vod', 'vod')); } else { msg_url('恭喜您,视频发布成功,请等待管理员审核~!', spacelink('vod/verify', 'vod')); } }
public function save() { $token = $this->input->post('token', TRUE); if ($token != $_SESSION['token']) { msg_url('非法提交~!', 'javascript:history.back();'); } //检测发表权限 $zuid = getzd('user', 'zid', $_SESSION['cscms__id']); $rowu = $this->CsdjDB->get_row('userzu', 'aid,sid', $zuid); if (!$rowu || $rowu->aid == 0) { msg_url('您所在会员组没有权限发表文章~!', 'javascript:history.back();'); } //检测发表数据是否需要审核 $news['yid'] = $rowu->sid == 1 ? 0 : 1; //选填字段 $news['cion'] = intval($this->input->post('cion')); $news['pic'] = $this->input->post('pic', TRUE, TRUE); $news['tags'] = $this->input->post('tags', TRUE, TRUE); $news['info'] = $this->input->post('info', TRUE, TRUE); $news['uid'] = $_SESSION['cscms__id']; $news['addtime'] = time(); //必填字段 $news['name'] = $this->input->post('name', TRUE, TRUE); $news['cid'] = intval($this->input->post('cid')); $news['content'] = remove_xss($this->input->post('content')); //检测必须字段 if ($news['cid'] == 0) { msg_url('请选择文章分类~!', 'javascript:history.back();'); } if (empty($news['name'])) { msg_url('文章名称不能为空~!', 'javascript:history.back();'); } if (empty($news['content'])) { msg_url('文章内容不能为空~!', 'javascript:history.back();'); } //截取概述 $news['info'] = sub_str(str_checkhtml($news['content']), 120); //增加到数据库 $did = $this->CsdjDB->get_insert('news', $news); if (intval($did) == 0) { msg_url('文章发布失败,请稍候再试~!', 'javascript:history.back();'); } //摧毁token unset($_SESSION['token']); //增加动态 $dt['dir'] = 'news'; $dt['uid'] = $_SESSION['cscms__id']; $dt['did'] = $did; $dt['yid'] = $news['yid']; $dt['title'] = '发布了文章'; $dt['name'] = $news['name']; $dt['link'] = linkurl('show', 'id', $did, 1, 'news'); $dt['addtime'] = time(); $this->CsdjDB->get_insert('dt', $dt); //如果免审核,则给会员增加相应金币、积分 if ($news['yid'] == 0) { $addhits = getzd('user', 'addhits', $_SESSION['cscms__id']); if ($addhits < User_Nums_Add) { $this->db->query("update " . CS_SqlPrefix . "user set cion=cion+" . User_Cion_Add . ",jinyan=jinyan+" . User_Jinyan_Add . ",addhits=addhits+1 where id=" . $_SESSION['cscms__id'] . ""); } msg_url('恭喜您,文章发布成功~!', spacelink('news', 'news')); } else { msg_url('恭喜您,文章发布成功,请等待管理员审核~!', spacelink('news/verify', 'news')); } }