function main() { global $_G; $id = intval($_GET['id']); if ($id < 1) { msg('ID不存在'); return false; } $cache_name = 'article_' . $id; $cache = memory('get', $cache_name); if (is_array($cache)) { $article = $cache; } else { $article = D(array('table' => 'article', 'and' => ' id = ' . $id . ' AND `hide`=0 ')); if (!$article[id]) { msg('抱歉,当前文章不存在或未审核'); } $up = D(array('and' => ' AND id <' . $id, 'table' => __CLASS__, 'order' => 'id DESC')); $down = D(array('and' => ' AND id >' . $id, 'table' => __CLASS__, 'order' => 'id ASC')); $article[up] = $up[id] ? '<a href="' . $up[id_url] . '">' . $up[title] . '</a>' : '没有了'; $article[down] = $down[id] ? '<a href="' . $down[id_url] . '">' . $down[title] . '</a>' : '没有了'; save_history(__CLASS__, $article[id]); DB::update('article', array('views' => $article[views] + 1), 'id=' . $article[id]); memory('set', $cache_name, $article); } $this->add(array('article' => $article)); seo($article['title'], $article['keywords'], $article['description']); $this->show($article['tpl']); }
public function detail() { $pid = I('get.pid', 0, 'intval'); $cachekey = 'product_detail_' . $pid; $data = S($cachekey); if (!$data) { $productsModel = D('Products'); $data['info'] = $productsModel->where("id='{$pid}'")->find(); if ($data['info']) { //获取产品相册 $data['gallerys'] = D('ProductsGallery')->where("pid='{$pid}'")->order('sort desc')->select(); } $data['cate'] = D('Cate')->getCate($data['info']['cateid'], 'id,name'); //获取产品 $data['attrs'] = $productsModel->get_attrs($data['info']['cateid'], $data['info']['id']); //获取相关产品 $related_products_id = D('Products_related')->where("products_id={$pid}")->select(); $product_ids = array($pid); if ($related_products_id) { foreach ($related_products_id as $val) { array_push($product_ids, (int) $val['related_products_id']); } } sort($product_ids); $data['related_attrs'] = D('ProductsAttr')->get_attrs($product_ids); //获取随机产品 $data['randlist'] = $this->_rand_product($pid, 6); //获取评论总数 $data['commnet_count'] = D('ProductsAsk')->where("products_id='{$pid}' AND status=1 AND type='Review'")->count(); //获取用户收藏数 $data['profav_total'] = 0; if ($this->member_Info['profav']) { $profav = explode(',', $this->member_Info['profav']); $data['profav_total'] = in_array($pid, $profav) ? 1 : 0; } S($cachekey, $data, 86400); } //记录浏览历史 save_history($pid); $this->assign('randlist', $data['randlist']); $this->assign('commnet_count', $data['commnet_count']); $this->assign('attrs', $data['attrs']); $this->assign('gallerys', $data['gallerys']); $this->assign('profav_total', $data['profav_total']); $this->assign('related_attrs', $data['related_attrs']); $this->assign('info', $data['info']); $this->assign('pid', $data['info']['id']); $this->assign('cate', $data['cate']); $this->display(); }
public function main() { global $_G; if (!$_GET['id']) { msg('兑换商品ID不存在'); return false; } $id = intval($_GET[id]); $goods = D(array('table' => 'duihuan', 'and' => 'id=' . $id, 'key' => 'duihuan_' . $id)); if (!$goods[id]) { msg('抱歉,未找到兑换商品'); return false; } $duihuan_apply = array(); if ($_G[uid]) { $duihuan_apply = D(array('table' => 'duihuan_apply', 'and' => 'uid=' . $_G[uid] . " AND duihuan_id=" . $id)); } $shop = $goods[shop]; save_history(__CLASS__, $id); $this->add(array('goods' => $goods, 'duihuan_apply' => $duihuan_apply, 'shop' => $shop)); seo($goods[title] . '- 商品兑换'); $this->show('duihuan/main'); }
public function main() { global $_G; $aid = $_GET['aid'] ? $_GET['aid'] : get_goods_id($_GET['itemid']); if ($aid && $aid < 1) { msg('抱歉ID不存在'); } if ($_GET['aid']) { $aid = intval($aid); $goods = D(array('and' => "aid = " . $aid, 'limit' => 1, 'all' => true, 'key' => 'goods_' . $aid)); } else { $goods = D(array('and' => "num_iid = '{$aid}'", 'limit' => 1, 'all' => true, 'key' => 'goods_' . $aid)); } if ($goods['status'] == 0 || $goods['status'] == 2) { msg('抱歉,当前商品 ' . $goods[status_text] . ' 暂时无法查看'); } if ($_G[mobile]) { $url = URL . 'a=go_pay&num_iid=' . $goods[num_iid]; _header("Location:" . $url); } $update = array(); if ($goods['aid'] > 0) { if (!$goods[keywords]) { $keyword = get_keywords($goods['title'] . $goods['ly']); if ($keyword) { $goods[keywords] = $keyword; $update[keywords] = $keyword; } } } if ($goods['fid']) { $channel = $_G['all_channel']['k' . $goods[fid]]; } $tpl = ''; if ($channel) { $tpl = trim($channel['goods_tpl']); } $_G['channel'] = $channel; if ($goods[fid]) { $_G[fid] = $goods[fid]; } if ($_G['setting']['get_message'] && !$goods['message']) { $message = top('m_taobao', 'get_message', $goods[num_iid]); if ($message) { $goods['message'] = $message; $update['message'] = $message; } } $up = D(array('and' => ' AND aid <' . $goods['aid'], 'table' => 'goods', 'order' => 'aid DESC')); $down = D(array('and' => ' AND aid >' . $goods['aid'], 'table' => 'goods', 'order' => 'aid ASC')); $goods[up] = $up[id] ? '<a href="' . $up[id_url] . '">' . $up[title] . '</a>' : '没有了'; $goods[down] = $down[id] ? '<a href="' . $down[id_url] . '">' . $down[title] . '</a>' : '没有了'; $this->add(array('goods' => $goods, 'up' => $up, 'down' => $down)); if ($goods['aid'] > 0 && $update) { $update[views] = $goods['views'] + 1; DB::update('goods', $update, 'aid=' . $goods['aid']); } save_history(__CLASS__, $goods['aid']); $title = $goods['seo_title'] ? $goods['seo_title'] : $goods['title']; seo($title, $goods['keywords'], $goods['description']); $this->show($tpl); }
<?php // needed require_once 'includes/iphoto2mac.php'; // specials $id = $_REQUEST['id']; if ($id == 'all') { // more complex $rolls = iPhoto::getRolls(); Globals::$History = array_keys($rolls); } else { if ($id == 'none') { // clear Globals::$History = array(); } else { // push value Globals::$History[] = $_REQUEST['id']; } } // save history save_history();
{ if (isset($_GET['cat'])) { if ($_GET['cat'] == "php") { include "includes/link_code.php"; } } } if (!isset($_GET['p'])) { include "includes/header.php"; include "pages/home.php"; } else { if (file_exists("pages/" . $_GET['p'] . ".php")) { include "includes/header.php"; insert_link_vercodigo(); include "pages/" . $_GET['p'] . ".php"; save_history($_GET['p']); //functions } elseif (file_exists("pages/" . $_GET['p'] . "/" . $_GET['p'] . ".php")) { if (file_exists("pages/" . $_GET['p'] . "/inc.php")) { include "pages/" . $_GET['p'] . "/inc.php"; } include "includes/header.php"; insert_link_vercodigo(); include "pages/" . $_GET['p'] . "/" . $_GET['p'] . ".php"; save_history($_GET['p']); //functions } else { include "includes/header.php"; include "pages/home.php"; } }