function logout_f() { $my_realname = $_SESSION["admin_realname"]; unset($_SESSION["admin_id"], $_SESSION[SYS_CHECKED_SESSION_ID], $_SESSION["admin_realname"], $_SESSION["admin_name"]); $logout_success = sys_eval($this->lang["logout_success"], $my_realname); error($logout_success, $this->url("login")); }
function list_f() { if (!$_SESSION["user_id"]) { error($this->lang["please_login"], $this->url("login")); } $page_url = $this->url("order,list"); $offset = $this->trans_lib->int(SYS_PAGEID); $psize = defined("SYS_PSIZE") ? SYS_PSIZE : 20; $keywords = $this->trans_lib->safe("keywords"); $rslist = $this->checkout_m->get_list($_SESSION["user_id"], $keywords, $offset, $psize); $this->tpl->assign("rslist", $rslist); $total = $this->checkout_m->get_count($_SESSION["user_id"], $keywords); $this->tpl->assign("total", $total); $this->tpl->assign("sitetitle", $this->lang["order"] . " - " . $this->lang["usercp"]); $leader[0] = array("title" => $this->lang["usercp"], "url" => $this->url("usercp")); $leader[1] = array("title" => $this->lang["order"], "url" => $this->url("order,list")); if ($keywords) { $leader[2] = array("title" => sys_eval($this->lang["keywords"], array("kw" => $keywords))); $page_url .= "keywords=" . rawurlencode($keywords); } $this->tpl->assign("leader", $leader); $pagelist = $this->page_lib->page($page_url, $total, false, false); $this->tpl->assign("pagelist", $pagelist); $this->tpl->display("order_list." . $this->tpl->ext); }
function phpok($var, $vartext = "") { if (!$var) { return false; } $app = sys_init(); $app->load_lib("phpok"); $app->phpok_lib->langid($_SESSION["sys_lang_id"]); $app->load_model("phpok"); $app->phpok_m->langid($_SESSION["sys_lang_id"]); $rs = $app->phpok_m->get_one_sign($var); if (!$rs) { return false; } $in_var = array(); if ($rs["vartext"]) { $varlist = explode(",", $rs["vartext"]); foreach ($varlist as $key => $value) { $in_var[$value] = $app->trans_lib->safe($value); } } $app->phpok_lib->set_rs($rs); //合并传过来的数组 if ($vartext) { if (is_array($vartext) && count($vartext) > 0) { $in_var = array_merge($in_var, $vartext); } else { $varlist = explode("&", $vartext); $v_list = array(); foreach ($varlist as $key => $value) { $v = explode("=", $value); $v_list[$v[0]] = $v[1]; } $in_var = array_merge($in_var, $v_list); } } if (!$rs["typetext"]) { return false; } $content = sys_eval($rs["typetext"], $in_var); $content = sys_format_content($content); //格式化内容代码信息 return array("title" => $rs["title"], "content" => $content); }
function index_f() { $sn = $this->trans_lib->safe("sn"); $paycode = "alipay"; $pass = $this->trans_lib->safe("pass"); $rs = $this->payment_m->get_one_code($paycode); if (!$rs) { error($this->lang["alipay_not_rs"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"user_id"]) { if (!$pass || $pass != $order_rs["pass"]) { error($this->lang["alipay_not_popedom"], $this->url("index")); } } else { if ($_SESSION["user_id"] != $order_rs["uid"]) { error($this->lang["alipay_not_popedom"], $this->url("index")); } } $this->tpl->assign("order_rs", $order_rs); if ($order_rs["pay_status"]) { error($this->lang["alipay_paystatus_ok"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"price"] < 0.001) { error($this->lang["alipay_free"], $this->url("checkout,info", "sn=" . $sn . "&pass="******"id"]); //判断是否是客 //加载alipay付款类 $return_url = $this->sys_config["siteurl"] . site_url("alipay,return", "sn=" . $sn . "&pass="******"pass"]); $show_url = $this->sys_config["siteurl"] . site_url("checkout,info", "sn=" . $sn . "&pass="******"pass"]); $notify_url = $this->sys_config["siteurl"] . site_url("alipay,notify", "sn=" . $sn . "&pass="******"pass"]); $order_rs["pdate"] = date("Y-m-d H:i:s", $order_rs["postdate"]); $parameter = array("service" => "create_direct_pay_by_user", "partner" => $f_rs["partner"], "return_url" => $return_url, "notify_url" => $notify_url, "_input_charset" => $f_rs["charset"], "subject" => sys_eval($this->lang["alipay_order_title"], $order_rs), "body" => sys_eval($this->lang["alipay_order_body"], $order_rs), "out_trade_no" => $order_rs["sn"], "total_fee" => floatval($order_rs["price"]), "payment_type" => "1", "seller_email" => $f_rs["seller_email"], "show_url" => $show_url); include_once LIBS . "payment/alipay_service.php"; //加载alipay_server操作类 $alipay = new alipay_service($parameter, $f_rs["code"], "MD5"); $link = $alipay->create_url(); sys_header($link); }
function error($msg = "", $url = "", $time = 2) { $app = sys_init(); //哪果没有内容 if (!$msg && !$url) { exit("error: false"); } //如果没有内容提示,则直接跳转 if (!$msg) { sys_header($url); } //如果有内容提示跳转 $app->tpl->assign("msg", $msg); $app->tpl->assign("error_url", $url); if ($url) { $error_note = sys_eval($app->lang["error_note"], $time); $app->tpl->assign("error_note", $error_note); } $app->tpl->assign("time", $time); //毫秒级,在JS中应用 $app->tpl->assign("micro_time", $time * 1000); $app->tpl->display("error." . $app->tpl->ext); exit; }
function phpok($var, $vartext = "") { if (!$var) { return false; } $app = sys_init(); $app->load_lib("phpok"); $app->phpok_lib->langid($_SESSION["sys_lang_id"]); $app->load_model("phpok"); $app->phpok_m->langid($_SESSION["sys_lang_id"]); $rs = $app->phpok_m->get_one_sign($var); if (!$rs) { return false; } $in_var = array(); if ($rs["vartext"]) { $varlist = explode(",", $rs["vartext"]); foreach ($varlist as $key => $value) { $in_var[$value] = $app->trans_lib->safe($value); } } $app->phpok_lib->set_rs($rs); $app->phpok_lib->thumbtype($rs["inpic"]); //指定小图类型 //获取所有字段信息 if ($rs["mid"]) { $mid = $rs["mid"]; $in_var["mid"] = $rs["mid"]; } if ($rs["cid"]) { $cid = $rs["cid"]; $in_var["cid"] = $rs["cid"]; } //如果系统有设置主题标签 if ($rs["extsign"] && $rs["maxcount"] == 1) { $in_var["ts"] = $rs["extsign"]; } //合并传过来的数组 if ($vartext) { if (is_array($vartext) && count($vartext) > 0) { $in_var = array_merge($in_var, $vartext); } else { $varlist = explode("&", $vartext); $v_list = array(); foreach ($varlist as $key => $value) { $v = explode("=", $value); $v_list[$v[0]] = $v[1]; } $in_var = array_merge($in_var, $v_list); } } //执行内容信息 if ($rs["intype"] == "sql") { if (!$rs["typetext"]) { return false; } $get_type = $rs["maxcount"] == 1 ? "get_one" : "get_all"; $sql = sys_eval($rs["typetext"], $in_var); //参数替换值 //过滤html代码 $sql = str_replace("<div>", "", $sql); $sql = str_replace("</div>", "", $sql); return $app->phpok_lib->exec_sql($sql, $get_type); } elseif ($rs["intype"] == "sign") { //增加父级缓存信息数 if ($rs["datatype"] == "cate") { $cache_key = md5("cate:" . serialize($in_var)); $rslist = $app->cache_lib->cache_read($cache_key); if (!$rslist) { $rslist = $app->phpok_lib->cate_sql($in_var); if ($rslist) { $app->cache_lib->cache_write($cache_key, $rslist); } } } else { $cache_key = md5("list:" . serialize($in_var) . "-phpok-" . serialize($rs)); $rslist = $app->cache_lib->cache_read($cache_key); if (!$rslist) { $rslist = $app->phpok_lib->list_sql($in_var, $rs["maxcount"], $rs["orderby"]); if ($rslist) { $app->cache_lib->cache_write($cache_key, $rslist); } } } return $rslist; } else { if (!$rs["typetext"]) { return false; } $content = sys_eval($rs["typetext"], $in_var); $content = sys_format_content($content); //格式化内容代码信息 return array("title" => $rs["title"], "content" => $content); } }
function info_f() { $sn = $this->trans_lib->safe("sn"); $pass = $this->trans_lib->safe("pass"); $rs = $this->checkout_m->get_one_sn($sn, $pass); if (!$rs) { error($this->lang["checkout_not_rs"], $this->url("index")); } if (!$_SESSION["user_id"]) { if (!$pass || $pass != $rs["pass"]) { error($this->lang["checkout_not_popedom"], $this->url("index")); } } else { if ($_SESSION["user_id"] != $rs["uid"]) { error($this->lang["checkout_not_popedom"], $this->url("index")); } } $this->tpl->assign("rs", $rs); //产品信息 $rslist = $this->checkout_m->get_products($rs["id"], $this->sys_config["cart_thumb"]); $this->tpl->assign("rslist", $rslist); //地址信息 $address = $this->checkout_m->get_address($rs["id"]); $this->tpl->assign("address", $address); //导航及头部菜单 $this->tpl->assign("sitetitle", sys_eval($ths->lang["checkout_info_title"], $rs)); $leader[0] = array("title" => $this->lang["checkout"], "url" => $this->url("order,list")); $leader[1] = array("title" => sys_eval($this->lang["checkout_title_2"], $rs)); $this->tpl->assign("leader", $leader); $print = $this->trans_lib->int("print"); if ($rs["pay_status"] && $rs["pay_type"]) { $pay_rs = $this->checkout_m->pay_one($rs["pay_type"]); if ($pay_rs) { $this->tpl->assign("pay_rs", $pay_rs); } } else { $pay_rslist = $this->checkout_m->pay_list(); $this->tpl->assign("pay_rslist", $pay_rslist); } if ($price) { $this->tpl->display("order_print." . $this->tpl->ext); } else { $this->tpl->display("order_info." . $this->tpl->ext); } }