/** * Returns the current server URI including protocol, domain and protocol as a * string. * * @return string */ function get_server() { $server = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != '' ? 'https://' : 'http://'; $server .= get_domain(); $server .= isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80 ? ':' . $_SERVER['SERVER_PORT'] : ''; return $server; }
public function index() { $user_id = intval($GLOBALS['user_info']['id']); if (!$user_id) { app_redirect(url("index")); } //返利列表 $page = intval($_REQUEST['p']) > 0 ? intval($_REQUEST['p']) : 1; $referrals_count = $GLOBALS['db']->getRow("select count(*) as count,sum(score) as total_score from " . DB_PREFIX . "referrals where user_id= " . $user_id . " "); if ($referrals_count) { $page_size = ACCOUNT_PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; $sql = "select r.*,u.create_time as register_time from " . DB_PREFIX . "referrals as r " . " left join " . DB_PREFIX . "user as u on u.id=r.user_id " . " where user_id=" . $user_id . " order by id desc limit " . $limit; $referrals_list = $GLOBALS['db']->getAll($sql); $page = new Page($referrals_count['count'], $page_size); //初始化分页类 $p = $page->show(); $GLOBALS['tmpl']->assign("pages", $p); } //邀请连接 $referrals_url = get_domain() . APP_ROOT . "/"; if ($GLOBALS['user_info']) { $referrals_url .= "?ref=" . base64_encode(intval($user_id)); } $GLOBALS['tmpl']->assign("referrals_url", $referrals_url); $GLOBALS['tmpl']->assign('referrals_list', $referrals_list); $GLOBALS['tmpl']->assign('referrals_count', $referrals_count); $GLOBALS['tmpl']->assign("page_title", "我的邀请"); $GLOBALS['tmpl']->display("referrals_index.html"); }
public function index() { $page = intval($_REQUEST['p']); if ($page == 0) { $page = 1; } $limit = ($page - 1) * app_conf("PAGE_SIZE") . "," . app_conf("PAGE_SIZE"); $result = get_invite_list($limit, $GLOBALS['user_info']['id']); $GLOBALS['tmpl']->assign("list", $result['list']); $page = new Page($result['count'], app_conf("PAGE_SIZE")); //初始化分页对象 $p = $page->show(); $GLOBALS['tmpl']->assign('pages', $p); $total_referral_money = $GLOBALS['db']->getOne("select sum(money) from " . DB_PREFIX . "referrals where user_id = " . $GLOBALS['user_info']['id'] . " and pay_time > 0"); $total_referral_score = $GLOBALS['db']->getOne("select sum(score) from " . DB_PREFIX . "referrals where user_id = " . $GLOBALS['user_info']['id'] . " and pay_time > 0"); $GLOBALS['tmpl']->assign("total_referral_money", $total_referral_money); $GLOBALS['tmpl']->assign("total_referral_score", $total_referral_score); $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['UC_INVITE']); $GLOBALS['tmpl']->assign("inc_file", "inc/uc/uc_invite_index.html"); $share_url = get_domain() . APP_ROOT . "/"; if ($GLOBALS['user_info']) { $share_url .= "?r=" . base64_encode(intval($GLOBALS['user_info']['id'])); } $GLOBALS['tmpl']->assign("share_url", $share_url); $GLOBALS['tmpl']->display("uc.html"); }
/** * Get a well formed URL equivalent to the current URL. Reads direct from the environment and does no clever mapping at all. This function should rarely be used. * * @return URLPATH The URL */ function get_self_url_easy() { $protocol = tacit_https() ? 'https' : 'http'; if (!isset($_SERVER['HTTP_HOST'])) { $domain = get_domain(); } else { $domain = $_SERVER['HTTP_HOST']; } $colon_pos = strpos($domain, ':'); if ($colon_pos !== false) { $domain = substr($domain, 0, $colon_pos); } $self_url = $protocol . '://' . $domain; $port = ocp_srv('SERVER_PORT'); if ($port != '' && $port != '80') { $self_url .= ':' . $port; } $s = ocp_srv('PHP_SELF'); if (substr($s, 0, 1) != '/') { $self_url .= '/'; } $self_url .= $s; if (array_key_exists('QUERY_STRING', $_SERVER) && $_SERVER['QUERY_STRING'] != '') { $self_url .= '?' . $_SERVER['QUERY_STRING']; } return $self_url; }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $data_vid = trim($payment_info['config']['chinabank_account']); $data_orderid = $payment_notice['notice_sn']; $data_vamount = $money; $data_vmoneytype = 'CNY'; $data_vpaykey = trim($payment_info['config']['chinabank_key']); $data_vreturnurl = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=Chinabank'; $data_notify_url = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Chinabank'; $MD5KEY = $data_vamount . $data_vmoneytype . $data_orderid . $data_vid . $data_vreturnurl . $data_vpaykey; $MD5KEY = strtoupper(md5($MD5KEY)); $payLinks = '<form style="text-align:center;" method=post action="https://pay3.chinabank.com.cn/PayGate" id="jumplink">'; $payLinks .= "<input type=HIDDEN name='v_mid' value='" . $data_vid . "'>"; $payLinks .= "<input type=HIDDEN name='v_oid' value='" . $data_orderid . "'>"; $payLinks .= "<input type=HIDDEN name='v_amount' value='" . $data_vamount . "'>"; $payLinks .= "<input type=HIDDEN name='v_moneytype' value='" . $data_vmoneytype . "'>"; $payLinks .= "<input type=HIDDEN name='v_url' value='" . $data_vreturnurl . "'>"; $payLinks .= "<input type=HIDDEN name='v_md5info' value='" . $MD5KEY . "'>"; $payLinks .= "<input type=HIDDEN name='remark1' value=''>"; $payLinks .= "<input type=HIDDEN name='remark2' value='[url:=" . $data_notify_url . "]'>"; $payLinks .= "正在连接支付接口...</form>"; $payLinks .= '<script type="text/javascript">document.getElementById("jumplink").submit();</script>'; return $payLinks; }
public function show() { $item_id = I("item_id"); $login_user = session("login_user"); $uid = $login_user['uid'] ? $login_user['uid'] : 0; $this->checkItemVisit($uid, $item_id); $item = D("Item")->where("item_id = '{$item_id}' ")->find(); //获取所有父目录id为0的页面 $pages = D("Page")->where("cat_id = '0' and item_id = '{$item_id}' ")->order(" `order` asc ")->select(); //获取所有目录 $catalogs = D("Catalog")->where("item_id = '{$item_id}' ")->order(" `order` asc ")->select(); if ($catalogs) { foreach ($catalogs as $key => &$catalog) { $temp = D("Page")->where("cat_id = '{$catalog['cat_id']}' ")->order(" `order` asc ")->select(); $catalog['pages'] = $temp ? $temp : array(); } } $share_url = get_domain() . __APP__ . '/' . $item_id; $ItemPermn = $this->checkItemPermn($uid, $item_id); $ItemCreator = $this->checkItemCreator($uid, $item_id); $this->assign("ItemPermn", $ItemPermn); $this->assign("ItemCreator", $ItemCreator); $this->assign("share_url", $share_url); $this->assign("catalogs", $catalogs); $this->assign("pages", $pages); $this->assign("item", $item); $this->assign("login_user", $login_user); $this->display(); }
function execute(&$request) { /* Set the Breadcrumbs bit */ k4_bread_crumbs($request['template'], $request['dba'], 'L_MARKFORUMREAD'); if (isset($_REQUEST['id']) && intval($_REQUEST['id']) > 0) { $forums = $request['dba']->executeQuery("SELECT * FROM " . K4FORUMS . " WHERE forum_id = " . intval($_REQUEST['id'])); if ($forums->numrows() == 0) { $action = new K4InformationAction(new K4LanguageElement('L_FORUMDOESNTEXIST'), 'content', FALSE); return $action->execute($request); } } else { $forums = $request['dba']->executeQuery("SELECT * FROM " . K4FORUMS); } $cookiestr = ''; $cookieinfo = get_forum_cookies(); while ($forums->next()) { $forum = $forums->current(); $cookieinfo[$forum['forum_id']] = time(); } foreach ($cookieinfo as $key => $val) { $cookiestr .= ',' . $key . ',' . $val; } setcookie(K4FORUMINFO, trim($cookiestr, ','), time() + 2592000, get_domain()); $action = new K4InformationAction(new K4LanguageElement('L_MARKEDFORUMREAD', $forum['name']), 'content', TRUE, referer(), 3); return $action->execute($request); }
public function get_payment_code($payment_notice_id) { define('REAL_APP_ROOT', str_replace('/mapi', "", APP_ROOT)); $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $payment_notice['notice_sn']; $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $sql = "select name " . "from " . DB_PREFIX . "deal " . "where id =" . intval($payment_notice['deal_id']); $title_name = $GLOBALS['db']->getOne($sql); $subject = $order_sn; //$data_return_url = get_domain().APP_ROOT.'/../shop.php?ctl=payment&act=response&class_name=Walipay'; //$notify_url = get_domain().APP_ROOT.'/../shop.php?ctl=payment&act=notify&class_name=Walipay'; $notify_url = get_domain() . REAL_APP_ROOT . "/alipay_web/alipayapi.php?order_id=" . intval($payment_notice['order_id']) . "&out_trade_no=" . $order_sn; //."&out_trade_no={$data.walipay.out_trade_no}"; $pay = array(); $pay['subject'] = $title_name; $pay['body'] = $subject; $pay['total_fee'] = $money; $pay['total_fee_format'] = format_price($money); $pay['out_trade_no'] = $payment_notice['notice_sn']; $pay['notify_url'] = $notify_url; $pay['partner'] = $payment_info['config']['alipay_partner']; //合作商户ID $pay['seller'] = $payment_info['config']['alipay_account']; //账户ID $pay['key'] = $payment_info['config']['alipay_key']; //支付宝(RSA)公钥 $pay['is_wap'] = 1; $pay['pay_code'] = 'walipay'; //,支付宝;mtenpay,财付通;mcod,货到付款 return $pay; }
public function index() { global $tmpl; $directory = APP_ROOT_PATH . "dh/"; $read_api = true; $dir = @opendir($directory); $apis = array(); while (false !== ($file = @readdir($dir))) { if (preg_match("/^.*?\\.php\$/", $file)) { $tmp = (require_once $directory . $file); if ($tmp) { $apis[] = $tmp; } } } @closedir($dir); unset($read_api); $contents_html = '<table>'; foreach ($apis as $k => $v) { foreach ($v['info'] as $kk => $vv) { $contents_html .= "<tr><td style='padding:10px 25px 10px 5px;'>"; $contents_html .= $vv['name'] . ":</td><td style='padding:10px 5px 10px 5px;'><input type='text' style='width:350px;' class='f-input' value='" . get_domain() . APP_ROOT . "/dh/" . $vv['url'] . "' /></td>"; $contents_html .= "</tr>"; } } $contents_html .= '</table>'; $GLOBALS['tmpl']->assign("page_title", $GLOBALS['lang']['API_LIST']); $GLOBALS['tmpl']->assign("page_keyword", $GLOBALS['lang']['API_LIST']); $GLOBALS['tmpl']->assign("page_description", $GLOBALS['lang']['API_LIST']); $article['title'] = $GLOBALS['lang']['API_LIST']; $article['content'] = $contents_html; $GLOBALS['tmpl']->assign("article", $article); $GLOBALS['tmpl']->display("article.html"); }
public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['user_login_status'] = 1; $root['response_code'] = 1; //$root['show_err'] = get_domain(); //输出支付方式 $payment_list = $GLOBALS['db']->getAll("select id,class_name,name,description,logo,total_amount,config from " . DB_PREFIX . "payment order by sort desc"); foreach ($payment_list as $k => $v) { $payment_list[$k]['logo'] = get_domain() . $v['logo']; } $root['payment_list'] = $payment_list; } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $data_vid = trim($payment_info['config']['chinabank_account']); $data_orderid = $payment_notice['notice_sn']; $data_vamount = $money; $data_vmoneytype = 'CNY'; $data_vpaykey = trim($payment_info['config']['chinabank_key']); $data_vreturnurl = get_domain() . APP_ROOT . '/shop.php?ctl=payment&act=response&class_name=Chinabank'; $data_notify_url = get_domain() . APP_ROOT . '/shop.php?ctl=payment&act=notify&class_name=Chinabank'; $MD5KEY = $data_vamount . $data_vmoneytype . $data_orderid . $data_vid . $data_vreturnurl . $data_vpaykey; $MD5KEY = strtoupper(md5($MD5KEY)); $payLinks = '<form style="text-align:center;" method=post action="https://pay3.chinabank.com.cn/PayGate" target="_blank">'; $payLinks .= "<input type=HIDDEN name='v_mid' value='" . $data_vid . "'>"; $payLinks .= "<input type=HIDDEN name='v_oid' value='" . $data_orderid . "'>"; $payLinks .= "<input type=HIDDEN name='v_amount' value='" . $data_vamount . "'>"; $payLinks .= "<input type=HIDDEN name='v_moneytype' value='" . $data_vmoneytype . "'>"; $payLinks .= "<input type=HIDDEN name='v_url' value='" . $data_vreturnurl . "'>"; $payLinks .= "<input type=HIDDEN name='v_md5info' value='" . $MD5KEY . "'>"; $payLinks .= "<input type=HIDDEN name='remark1' value=''>"; $payLinks .= "<input type=HIDDEN name='remark2' value='[url:=" . $data_notify_url . "]'>"; if (!empty($payment_info['logo'])) { $payLinks .= "<input type='image' src='" . APP_ROOT . $payment_info['logo'] . "' style='border:solid 1px #ccc;'><div class='blank'></div>"; } $payLinks .= "<input type='submit' class='paybutton' value='前往网银在线支付'>"; $payLinks .= "</form>"; $code = '<div style="text-align:center">' . $payLinks . '</div>'; $code .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>"; return $code; }
public function __construct($api) { $api['config'] = unserialize($api['config']); $this->api = $api; //回调地址要用urlencode编码 $this->redirback = urlencode(get_domain() . APP_ROOT . "/api_callback.php?c=Qq"); }
public function index() { $filenamezip = APP_ROOT_PATH . "public/mobile_goods_down_region_conf.zip"; if (!file_exists($filenamezip)) { $sql = "select id,pid,name,'' as postcode,'' as py from " . DB_PREFIX . "delivery_region"; $list = $GLOBALS['db']->getAll($sql); $root = array(); $root['return'] = 1; $region_list = ""; foreach ($list as $item) { $sql = "insert into region_conf(id,pid,name,postcode,py) values('{$item['id']}','{$item['pid']}','{$item['name']}','{$item['postcode']}','{$item['py']}');"; if ($region_list == "") { $region_list = $sql; } else { $region_list = $region_list . "\n" . $sql; } } $ziper = new zipfile(); $ziper->addFile($region_list, "region_conf.txt"); $ziper->output($filenamezip); } $root = array(); $root['return'] = 1; if (file_exists($filenamezip)) { $root['file_exists'] = 1; } else { $root['file_exists'] = 0; } $sql = "select count(*) as num from " . DB_PREFIX . "delivery_region"; $root['region_num'] = $GLOBALS['db']->getOne($sql); //配置地区数量 $root['file_url'] = get_domain() . APP_ROOT . "/../public/mobile_goods_down_region_conf.zip"; $root['file_size'] = abs(filesize($filenamezip)); output($root); }
function check_image_url($url = false, $facebook_id = false, $google_picture_link = false, $twitter_picture_link = false, $imgur_img_type = false) { if ($url != false) { // ถ้าลิ้งค์รูปเป็นลิ้งค์ของ imgur.com if (get_domain($url) == "imgur.com") { if ($imgur_img_type == "original") { return $url; // รูปดั้งเดิม } else { // หาไอดีรูป เพื่อทำ thumbnail $array = parse_url($url); $imgThumb = substr($array['path'], 1, -4) . 'b'; $imgType = substr($url, strrpos($url, ".") + 1); return "http://i.imgur.com/" . $imgThumb . "." . $imgType; } } else { return $url; } // return site_url("media/timthumb/timthumb.php?src=".$url."&zc=1&w=120&h=120"); } elseif ($facebook_id != false) { return "https://graph.facebook.com/" . $facebook_id . "/picture?type=large"; // return site_url("media/timthumb/timthumb.php?src=https://graph.facebook.com/".$facebook_id."/picture?type=large&zc=1&w=120&h=120"); } elseif ($google_picture_link != false) { return "{$google_picture_link}"; } elseif ($twitter_picture_link != false) { return $twitter_picture_link; } }
function Tencent() { require_once APP_ROOT_PATH . 'system/api_login/Tencent/Tencent.php'; OAuth::init($GLOBALS['m_config']['tencent_app_key'], $GLOBALS['m_config']['tencent_app_secret']); $openid = trim($GLOBALS['request']['openid']); $openkey = trim($GLOBALS['request']['openkey']); if ($GLOBALS['m_config']['tencent_bind_url'] == "") { $app_url = get_domain() . APP_ROOT . "/api_callback.php?c=Tencent"; } else { $app_url = $GLOBALS['m_config']['tencent_bind_url']; } $access_token = trim($GLOBALS['request']['access_token']); es_session::set("t_access_token", $access_token); es_session::set("t_openid", $openid); es_session::set("t_openkey", $openkey); if (es_session::get("t_access_token") || es_session::get("t_openid") && es_session::get("t_openkey")) { $r = Tencent::api('user/info'); $r = json_decode($r, true); $name = $r['data']['name']; if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "user where tencent_id = '" . $name . "'") == 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set t_access_token ='" . $access_token . "',t_openkey = '" . $openkey . "',t_openid = '" . $openid . "', tencent_id = '" . $name . "' where id =" . intval($GLOBALS['user_info']['id'])); } elseif (intval($GLOBALS['db']->getOne("select id from " . DB_PREFIX . "user where tencent_id = '" . $name . "'")) == intval($GLOBALS['user_info']['id'])) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set t_access_token ='" . $access_token . "',t_openkey = '" . $openkey . "',t_openid = '" . $openid . "', tencent_id = '" . $name . "' where id =" . intval($GLOBALS['user_info']['id'])); } else { $root['return'] = 0; $root['info'] = "该微博帐号已被其他会员绑定"; output($root); } } $root['return'] = 1; $root['info'] = "绑定成功"; $root['login_type'] = "Tencent"; output($root); }
public function index() { $root = array(); $root['return'] = 1; $page = intval($GLOBALS['request']['page']); //分页 $city_name = strim($GLOBALS['request']['city_name']); //城市名称 $page = $page == 0 ? 1 : $page; $page_size = PAGE_SIZE; $limit = ($page - 1) * $page_size . "," . $page_size; //检查用户,用户密码 $user = $GLOBALS['user_info']; $user_id = intval($user['id']); $url = get_domain() . APP_ROOT; $share_url = str_replace("sjmapi", "wap", $url); if ($user_id) { $share_url .= "?r=" . base64_encode(intval($user_id)); } $root['share_url'] = $share_url; $root['city_name'] = $city_name; $root['page_title'] = "邀请链接"; //fwb 2014-08-27 output($root); }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $sql = "select name " . "from " . DB_PREFIX . "deal_order_item " . "where order_id =" . intval($payment_notice['order_id']); $title_name = $GLOBALS['db']->getOne($sql); $subject = msubstr($title_name, 0, 40); //$data_return_url = get_domain().APP_ROOT.'/../payment.php?act=return&class_name=Malipay'; $notify_url = get_domain() . APP_ROOT . '/../shop.php?ctl=payment&act=response&class_name=Malipay'; $pay = array(); $pay['subject'] = $subject; $pay['body'] = $title_name; $pay['total_fee'] = $money; $pay['total_fee_format'] = format_price($money); $pay['out_trade_no'] = $payment_notice['notice_sn']; $pay['notify_url'] = $notify_url; $pay['partner'] = $payment_info['config']['alipay_partner']; //合作商户ID $pay['seller'] = $payment_info['config']['alipay_account']; //账户ID $pay['rsa_alipay_public'] = $payment_info['config']['alipay_rsa_public']; //支付宝(RSA)公钥 $pay['pay_code'] = 'malipay'; //,支付宝;mtenpay,财付通;mcod,货到付款 $order_spec = ''; $order_spec .= 'partner="' . $pay['partner'] . '"'; //合作商户ID $order_spec .= '&seller="' . $pay['seller'] . '"'; //账户ID $order_spec .= '&out_trade_no="' . $pay['out_trade_no'] . '"'; $order_spec .= '&subject="' . $pay['subject'] . '"'; $order_spec .= '&body="' . $pay['body'] . '"'; $order_spec .= '&total_fee="' . $pay['total_fee'] . '"'; $order_spec .= '¬ify_url="' . $pay['notify_url'] . '"'; $pay['order_spec'] = $order_spec; $sign = $this->sign($order_spec); $pay['sign'] = urlencode($sign); $pay['sign_type'] = 'RSA'; /* $pubkey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC6IQ/HH06GbTIhKNN/YSQXxllnP7cNERMuN16GgZDfuf9NrY/Bw2ZINkq1RMNlbP66Vu5y0gwYPC/7PbO5l6pbnl3N4rw5VY3U6rtIC0f8ADDLrIZwShYUitaFq+Ao7rhk/GbpfSD7vgnugQz74fVewi17S3Apujq4U4LAxFmVowIDAQAB'; $pubkey = $this->getPublicKeyFromX509($pubkey); $res = openssl_pkey_get_public($pubkey); $sign = base64_decode($sign); $verify = openssl_verify($order_spec, $sign, $res); if ($verify == 1) { $pay['openssl_verify'] = 'ok'; }else{ $pay['openssl_verify'] = 'error'; } */ // // print_r($payment_info['config']); // print_r($pay);exit; return $pay; }
function __construct($id = 1) { // Get the Quest (Skill) based on the id if (is_numeric($id)) { $domain_row = get_domain($id); $this->build($domain_row); } }
/** * Gets the default value for the config option. * * @return ?string The default value (NULL: option is disabled) */ function get_default() { $staff_address = get_option('staff_address'); $website_email = 'website@' . get_domain(); if (substr($staff_address, -strlen(get_domain()) - 1) == '@' . get_domain()) { $website_email = $staff_address; } return $website_email; }
public function index() { $root = array(); $ajax = intval($_REQUEST['ajax']); $root['ajax'] = $ajax; $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $comment['deal_id'] = intval($_REQUEST['id']); $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $comment['deal_id'] . " and is_delete = 0 and is_effect = 1 "); if (!$deal_info) { $root['info'] = "该项目暂时不能评论"; output($root); } if (!check_ipop_limit(get_client_ip(), "deal_savedealcomment", 3)) { $root['info'] = "提交太快"; } output($root); $comment['content'] = strim($_REQUEST['content']); $comment['user_id'] = intval($GLOBALS['user_info']['id']); $comment['create_time'] = NOW_TIME; $comment['user_name'] = $GLOBALS['user_info']['user_name']; $comment['pid'] = intval($_REQUEST['pid']); $comment['deal_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal where id = " . $comment['deal_id'])); $comment['reply_user_id'] = intval($GLOBALS['db']->getOne("select user_id from " . DB_PREFIX . "deal_comment where id = " . $comment['pid'])); $comment['deal_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['deal_user_id'])); $comment['reply_user_name'] = $GLOBALS['db']->getOne("select user_name from " . DB_PREFIX . "user where id = " . intval($comment['reply_user_id'])); $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_comment", $comment); $comment['id'] = $GLOBALS['db']->insert_id(); $GLOBALS['db']->query("update " . DB_PREFIX . "deal set comment_count = comment_count+1 where id = " . $comment['deal_id']); if (intval($_REQUEST['syn_weibo']) == 1) { $weibo_info = array(); $weibo_info['content'] = $comment['content'] . " " . get_domain() . url("deal#show", array("id" => $comment['deal_id'])); $img = $GLOBALS['db']->getOne("select image from " . DB_PREFIX . "deal where id = " . intval($comment['deal_id'])); if ($img) { $weibo_info['img'] = APP_ROOT_PATH . "/" . $img; } syn_weibo($weibo_info); } if ($ajax == 1) { $data['status'] = 1; ajax_return($data); } else { showSuccess("发表成功"); } } else { $root['user_login_status'] = 0; output($root); } }
public function show() { $page_id = I("page_id"); $page = D("Page")->where(" page_id = '{$page_id}' ")->find(); if (!$page) { header("location:" . U("Home/Item/index")); return; } $item_id = $page["item_id"]; $login_user = $this->checkLogin(); $this->checkItemVisit($login_user['uid'], $item_id); $item = D("Item")->where("item_id = '{$item_id}' and status = 1 ")->find(); if (!$item) { header("location:" . U("Home/Item/index")); return; } //获取所有父目录id为0的页面 $pages = D("Page")->where("cat_id = '0' and item_id = '{$item_id}' and status = 1 ")->order(" `order` asc ")->select(); //获取所有目录 $catalogs = D("Catalog")->where("item_id = '{$item_id}' and status = 1 ")->order(" `order` asc ")->select(); if ($catalogs) { foreach ($catalogs as $key => &$catalog) { $temp = D("Page")->where("cat_id = '{$catalog['cat_id']}' and status = 1 ")->order(" `order` asc ")->select(); $catalog['pages'] = $temp ? $temp : array(); } } $item_url = get_domain() . __APP__ . '?m=Home&c=Item&a=show&item_id=' . $item_id; $page_url = get_domain() . __APP__ . '?m=Home&c=Page&a=show&page_id=' . $page_id; $ItemPermn = $this->checkItemPermn($login_user['uid'], $item_id); $ItemCreator = $this->checkItemCreator($login_user['uid'], $item_id); $this->assign("webtitle", $item['item_name'] . ': ' . $page['page_title']); $this->assign("ItemPermn", $ItemPermn); $this->assign("ItemCreator", $ItemCreator); $this->assign("share_url", $item_url); $this->assign("page_url", $page_url); $this->assign("catalogs", $catalogs); $this->assign("pages", $pages); $this->assign("item", $item); $this->assign("login_user", $login_user); import("Vendor.Parsedown.Parsedown"); $Parsedown = new \Parsedown(); //重新转义回来。因为Parsedown会把代码块里的代码也解析称html实体 //$page['page_content'] = htmlspecialchars_decode($Parsedown->text($page['page_content'])); $page['page_content'] = $Parsedown->text(htmlspecialchars_decode($page['page_content'])); //$page['page_content'] = $this->fixMobileHtmlContent($page['page_content'], 750, 0); $this->assign("singlepage", $page); //如果在搜索结果中展示则更换纯净模板 $in_search = I("in_search"); if ($in_search) { $this->display('show_in_search'); } else { $this->display(); } }
/** * Finds the Top Level Domain, this could be "com", "dk" etc. * For more information about TLD's see: http://en.wikipedia.org/wiki/Tld * * @param string $url the url to find the top level domain for. * @return string the top level domain found, else an empty string */ function get_tld($url) { $tld = ""; $domain = get_domain($url); if ($domain != "") { preg_match('/[^.]+$/', $domain, $matches); /*echo "tld: \n"; print_r($matches);*/ $tld = $matches[0]; } return $tld; }
/** * 获取自定义二级域名 * * @author Garbin * @return string 成功 * false 失败 */ function get_subdomain() { $curr_url_info = parse_url(get_domain()); $main_url_info = parse_url(SITE_URL); $curr_domain = strtolower($curr_url_info['host']); $main_domain = strtolower($main_url_info['host']); if ($curr_domain == $main_domain) { /* 当前域名不是二级域名 */ return false; } $tmp = explode('.', $curr_domain); return $tmp[0]; }
function __ngettext($single, $plural, $number, $domain = 'elgg') { // Domain loader $i18n = get_domain($domain); if ($i18n != null) { return $i18n->n__gettext($single, $plural, $number); } else { if ($number != 1) { return $plural; } else { return $single; } } }
public function callback() { es_session::start(); $aliapy_config['partner'] = $this->api['config']['app_key']; $aliapy_config['key'] = $this->api['config']['app_secret']; $aliapy_config['return_url'] = get_domain() . APP_ROOT . "/api_callback.php?c=Taobao"; $aliapy_config['sign_type'] = 'MD5'; $aliapy_config['input_charset'] = 'utf-8'; $aliapy_config['transport'] = 'http'; require_once APP_ROOT_PATH . "system/api_login/taobao/alipay_notify.class.php"; unset($_GET['c']); $alipayNotify = new AlipayNotify($aliapy_config); $verify_result = $alipayNotify->verifyReturn(); if ($verify_result) { //验证成功 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 $user_id = $_GET['user_id']; //支付宝用户id $token = $_GET['token']; //授权令牌 $real_name = $_GET['real_name']; //执行商户的业务程序 $msg['id'] = $user_id; $msg['name'] = $real_name; $msg['field'] = 'taobao_id'; es_session::set("api_user_info", $msg); if (!$msg['name']) { app_redirect(url("index")); } $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where taobao_id = '" . $msg['id'] . "' and taobao_id <> ''"); if ($user_data) { require_once APP_ROOT_PATH . "system/libs/user.php"; auto_do_login_user($user_data['user_name'], $user_data['user_pwd'], $from_cookie = false); es_session::delete("api_user_info"); app_recirect_preview(); } else { $this->create_user(); app_redirect(url("shop", "user#stepone")); } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } else { //验证失败 //如要调试,请看alipay_notify.php页面的return_verify函数,比对sign和mysign的值是否相等,或者检查$veryfy_result有没有返回true echo "验证失败"; } }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $data_return_url = get_domain() . APP_ROOT . '/shop.php?ctl=payment&act=response&class_name=Tenpay'; $cmd_no = '1'; /* 获得订单的流水号,补零到10位 */ $sp_billno = $payment_notice_id; $spbill_create_ip = $_SERVER['REMOTE_ADDR']; /* 交易日期 */ $today = to_date($payment_notice['create_time'], 'Ymd'); /* 将商户号+年月日+流水号 */ $bill_no = str_pad($payment_notice_id, 10, 0, STR_PAD_LEFT); $transaction_id = $payment_info['config']['tencentpay_id'] . $today . $bill_no; /* 银行类型:支持纯网关和财付通 */ $bank_type = '0'; $desc = $order_sn . "payment_notice:[" . $payment_notice['notice_sn'] . "]"; $attach = $payment_info['config']['tencentpay_sign']; /* 返回的路径 */ $return_url = $data_return_url; /* 总金额 */ $total_fee = $money * 100; /* 货币类型 */ $fee_type = '1'; /* 重写自定义签名 */ //$payment['magic_string'] = abs(crc32($payment['magic_string'])); /* 数字签名 */ $sign_text = "cmdno=" . $cmd_no . "&date=" . $today . "&bargainor_id=" . $payment_info['config']['tencentpay_id'] . "&transaction_id=" . $transaction_id . "&sp_billno=" . $sp_billno . "&total_fee=" . $total_fee . "&fee_type=" . $fee_type . "&return_url=" . $return_url . "&attach=" . $attach . "&spbill_create_ip=" . $spbill_create_ip . "&key=" . $payment_info['config']['tencentpay_key']; $sign = strtoupper(md5($sign_text)); /* 交易参数 */ $parameter = array('cmdno' => $cmd_no, 'date' => $today, 'bank_type' => $bank_type, 'desc' => $desc, 'purchaser_id' => '', 'bargainor_id' => $payment_info['config']['tencentpay_id'], 'transaction_id' => $transaction_id, 'sp_billno' => $sp_billno, 'total_fee' => $total_fee, 'fee_type' => $fee_type, 'return_url' => $return_url, 'attach' => $attach, 'spbill_create_ip' => $spbill_create_ip, 'sign' => $sign); // $payLinks = '<form style="text-align:center;" action="https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi" target="_blank" style="margin:0px;padding:0px" >'; foreach ($parameter as $key => $val) { $payLinks .= "<input type='hidden' name='{$key}' value='{$val}' />"; } if (!empty($payment_info['logo'])) { $payLinks .= "<input type='image' src='" . APP_ROOT . $payment_info['logo'] . "' style='border:solid 1px #ccc;'><div class='blank'></div>"; } $payLinks .= "<input type='submit' class='paybutton' value='前往财付通支付'></form>"; $code = '<div style="text-align:center">' . $payLinks . '</div>'; $code .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>"; return $code; }
public function index() { $rss = new UniversalFeedCreator(); $rss->useCached(); // use cached version if age<1 hour $rss->title = app_conf("SHOP_TITLE") . " - " . app_conf("SHOP_SEO_TITLE"); $rss->description = app_conf("SHOP_SEO_TITLE"); //optional $rss->descriptionTruncSize = 500; $rss->descriptionHtmlSyndicated = true; $rss->link = get_domain() . APP_ROOT; $rss->syndicationURL = get_domain() . APP_ROOT; //optional $image->descriptionTruncSize = 500; $image->descriptionHtmlSyndicated = true; $domain = app_conf("PUBLIC_DOMAIN_ROOT") == '' ? get_domain() . $GLOBALS['IMG_APP_ROOT'] : app_conf("PUBLIC_DOMAIN_ROOT"); $city = get_current_deal_city(); $city_id = $city['id']; $deal_list = get_deal_list(app_conf("DEAL_PAGE_SIZE"), 0, 0, array(DEAL_ONLINE), " buy_type <> 1 or ( is_shop = 1 and is_effect =1 and is_delete = 0 and buy_type <> 1)"); $deal_list = $deal_list['list']; foreach ($deal_list as $data) { $item = new FeedItem(); if ($data['uname'] != '') { $gurl = url("shop", "goods", array("id" => $data['uname'])); } else { $gurl = url("shop", "goods", array("id" => $data['id'])); } $data['url'] = $gurl; $item->title = msubstr($data['name'], 0, 30); $item->link = get_domain() . $data['url']; $data['description'] = str_replace($GLOBALS['IMG_APP_ROOT'] . "./public/", $domain . "/public/", $data['description']); $data['description'] = str_replace("./public/", $domain . "/public/", $data['description']); $data['img'] = str_replace("./public/", $domain . "/public/", $data['img']); $item->description = "<img src='" . $data['img'] . "' /><br />" . $data['brief'] . "<br /> <a href='" . get_domain() . $data['url'] . "' target='_blank' >" . $GLOBALS['lang']['VIEW_DETAIL'] . "</a>"; //optional $item->descriptionTruncSize = 500; $item->descriptionHtmlSyndicated = true; if ($data['end_time'] != 0) { $item->date = date('r', $data['end_time']); } $item->source = $data['url']; $item->author = app_conf("SHOP_TITLE"); $rss->addItem($item); } $rss->saveFeed($format = "RSS0.91", $filename = APP_ROOT_PATH . "public/runtime/app/tpl_caches/rss.xml"); }
function SincerityGoldUnfreeze($user_id, $platformNo, $freezeRequestNo, $deal_id, $post_url, $sys = 'pc') { //$pWebUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=SincerityGoldUnfreeze&from=".$_REQUEST['from'];//web方式返回 //$pS2SUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=SincerityGoldUnfreeze&from=".$_REQUEST['from'];//s2s方式返回 $yeepay_log = array(); $yeepay_log['code'] = 'UNFREEZE'; $yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s'); $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log); $requestNo = $GLOBALS['db']->insert_id(); $data = array(); $data['platformNo'] = $platformNo; // 商户编号 $data['freezeRequestNo'] = $freezeRequestNo; $data['expired'] = NOW_TIME; //到期自劢解冻时间 // $strxml = SincerityGoldUnfreezeXml($data,$pWebUrl,$pS2SUrl); /* 请求参数 */ $req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo='" . $data['platformNo'] . "'>" . "<freezeRequestNo>" . $data['freezeRequestNo'] . "</freezeRequestNo>" . "</request>"; /* 签名数据 */ $sign = cfca($req); /* 调用账户查询服务 */ $service = "UNFREEZE"; $ch = curl_init($post_url . "/bhaexter/bhaController"); curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign))); $resultStr = curl_exec($ch); if (empty($resultStr)) { //$err_count ++ ; } else { require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($resultStr); $str3Req = $str3ParaInfo['response']; $result['pErrCode'] = $str3Req["code"]; $result['pErrMsg'] = $str3Req["description"]; if ($str3Req["code"] == 1) { //操作成功 $where = " platformUserNo=" . $user_id . " and deal_id =" . $deal_id . " and requestNo=" . $freezeRequestNo; $data['status'] = 2; $data['create_time'] = NOW_TIME; if (isset($str3Req['description'])) { $data['description'] = $str3Req["description"]; } $GLOBALS['db']->autoExecute(DB_PREFIX . "money_freeze", $data, 'UPDATE', $where); showIpsInfo('诚意金解冻成功', get_domain() . APP_ROOT . '/m.php?m=UserFreeze&a=index&'); } } }
public function get_payment_code($payment_notice_id) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id); $order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']); $money = round($payment_notice['money'], 2); $payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id'])); $payment_info['config'] = unserialize($payment_info['config']); $data_return_url = get_domain() . APP_ROOT . '/shop.php?ctl=payment&act=response&class_name=Yeepay'; $data_merchant_id = trim($payment_info['config']['yeepay_account']); $data_order_id = $payment_notice['notice_sn']; $data_amount = $money; $message_type = 'Buy'; $data_cur = 'CNY'; $product_id = ''; $product_cat = ''; $product_desc = ''; $address_flag = '0'; $data_pay_key = trim($payment_info['config']['yeepay_key']); $data_pay_account = trim($payment_info['config']['yeepay_account']); $mct_properties = $payment_notice['notice_sn']; $def_url = $message_type . $data_merchant_id . $data_order_id . $data_amount . $data_cur . $product_id . $product_cat . $product_desc . $data_return_url . $address_flag . $mct_properties; $MD5KEY = $this->HmacMd5($def_url, $data_pay_key); $code = "\n<form action='https://www.yeepay.com/app-merchant-proxy/node' method='post' target='_blank'>\n"; $code .= "<input type='hidden' name='p0_Cmd' value='" . $message_type . "'>\n"; $code .= "<input type='hidden' name='p1_MerId' value='" . $data_merchant_id . "'>\n"; $code .= "<input type='hidden' name='p2_Order' value='" . $data_order_id . "'>\n"; $code .= "<input type='hidden' name='p3_Amt' value='" . $data_amount . "'>\n"; $code .= "<input type='hidden' name='p4_Cur' value='" . $data_cur . "'>\n"; $code .= "<input type='hidden' name='p5_Pid' value='" . $product_id . "'>\n"; $code .= "<input type='hidden' name='p6_Pcat' value='" . $product_cat . "'>\n"; $code .= "<input type='hidden' name='p7_Pdesc' value='" . $product_desc . "'>\n"; $code .= "<input type='hidden' name='p8_Url' value='" . $data_return_url . "'>\n"; $code .= "<input type='hidden' name='p9_SAF' value='" . $address_flag . "'>\n"; $code .= "<input type='hidden' name='pa_MP' value='" . $mct_properties . "'>\n"; $code .= "<input type='hidden' name='pd_FrpId' value=''>\n"; $code .= "<input type='hidden' name='pd_NeedResponse' value='1'>\n"; $code .= "<input type='hidden' name='hmac' value='" . $MD5KEY . "'>\n"; if (!empty($payment_info['logo'])) { $code .= "<input type='image' src='" . APP_ROOT . $payment_info['logo'] . "' style='border:solid 1px #ccc;'><div class='blank'></div>"; } $code .= "<input type='submit' class='paybutton' value='前往易宝在线支付'>"; $code .= "</form>\n"; $code .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>"; return $code; }
public function index() { $this->load->library('form_validation'); $this->load->helper('form'); $this->form_validation->set_rules('username', 'lang:setup_dialogue_username', 'callback_check_credentials'); $this->form_validation->set_message('check_credidentials', lang('login_incorrect')); if ($this->form_validation->run() == false) { $data['title'] = lang('login'); $this->Page->build($data, 'login'); } else { $username = $this->input->post('username'); $password = $this->input->post('password'); $key = hash('sha256', $username . 'heat' . hash('sha256', $password)); $cookie = array('name' => 'login_key', 'value' => $key, 'expire' => 60 * 60, 'domain' => '.' . get_domain(), 'path' => '/', 'prefix' => ''); set_cookie($cookie); redirect($this->input->get('from')); } }