/** * 获取推荐商品列表 */ public function get_recommend_goods_listOp() { $recommend_goods_list = Model('goods_class')->getGoodsClassListByParentId(0); if ($recommend_goods_list) { $model_goods = Model('goods'); foreach ($recommend_goods_list as $k => $v) { $goods_list = $model_goods->getGeneralGoodsOnlineList(array('gc_id_1' => $v['gc_id']), 'goods_id,goods_name,goods_price,goods_promotion_price,goods_promotion_type,distribution_price,goods_storage,goods_marketprice,goods_image', 6, 'goods_salenum desc'); if ($goods_list) { foreach ($goods_list as $kk => $vv) { if ($vv['goods_promotion_type'] > 0) { $goods_list[$kk]['goods_price'] = $vv['goods_promotion_price']; } elseif ($vv['distribution_price'] > 0) { $goods_list[$kk]['goods_price'] = $vv['distribution_price']; } $goods_list[$kk]['img_url'] = thumb($vv, 360); $goods_list[$kk]['discount'] = sprintf('%0.1f', $goods_list[$kk]['goods_price'] / $vv['goods_marketprice'] * 10); } $recommend_goods_list[$k]['list'] = $goods_list; } else { unset($recommend_goods_list[$k]); } } } output_data(array('recommend_goods_list' => $recommend_goods_list)); }
/** * Make thumbnail * * Usage: * {pyro:getpost:mkthumb src="/uploads/file/file.jpg" w="200" h="200"} * * @param int * @return string */ function mkthumb() { $file = $this->attribute('src', 'String'); $w = $this->attribute('w', 'Number'); $h = $this->attribute('h', 'Number'); return thumb(site_url() . $file, $w, $h); }
/** * 获取收藏列表 * @return [type] [description] */ public function getListOp() { $fav_type = $_GET["fav_type"]; $size = 10; $page = intval($_GET['page']); $page = $page <= 0 ? 1 : $page; if (!in_array($fav_type, array('goods', 'store'))) { output_error("未知收藏类型"); } $favorites_model = Model('favorites'); $condition = array(); $condition['member_id'] = $this->member_info['member_id']; $condition['fav_type'] = $fav_type; $favorites_list = $favorites_model->getFavoritesList($condition, "*", true, 'log_id desc', ($page - 1) * $size . ',' . $size); if (!empty($favorites_list)) { foreach ($favorites_list as $key => $value) { if ($fav_type == 'goods') { $extends_goods = Model('goods')->getGoodsInfo(array('goods_id' => $value['fav_id']), '*'); $favorites_list[$key]['goods_img'] = thumb($extends_goods, 360); $favorites_list[$key]['goods_state'] = $extends_goods['goods_state']; $favorites_list[$key]['is_presell'] = $extends_goods['is_presell']; $favorites_list[$key]['goods_type'] = $extends_goods['goods_type']; $favorites_list[$key]['goods_price'] = $extends_goods['goods_price']; $favorites_list[$key]['goods_marketprice'] = $extends_goods['goods_marketprice']; $favorites_list[$key]['goods_discount'] = round($extends_goods['goods_price'] / $extends_goods['goods_marketprice'] * 10, 1); } } } $fav_count = Model()->table('favorites')->where($condition)->count(); $data_info = array(); $data_info['thispage'] = $page; $data_info['totalpage'] = ceil($fav_count / $size); output_data(array('data' => $favorites_list, 'data_info' => $data_info)); }
public function init() { $siteurl = siteurl(SITEID); if(empty($this->rssid)) { $catid = $_GET['catid'] ? intval($_GET['catid']) : '0'; $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid] ? $siteids[$catid] : 1; $CATEGORYS = getcache('category_content_'.$siteid,'commons'); $subcats = subcat($catid,0,1,$siteid); foreach ($CATEGORYS as $r) if($r['parentid'] == 0) $channel[] = $r; include template('content','rss'); } else { $CATEGORYS = getcache('category_content_'.$this->siteid,'commons'); $SITEINFO = getcache('sitelist','commons'); $CAT = $CATEGORYS[$this->rssid]; if(count($CAT) == 0) showmessage(L('missing_part_parameters'),'blank'); $siteid = $CAT['siteid']; $sitedomain = $SITEINFO[$siteid]['domain']; //获取站点域名 $MODEL = getcache('model','commons'); $modelid = $CAT['modelid']; $encoding = CHARSET; $about = SITE_PROTOCOL.SITE_URL; $title = $CAT['catname']; $description = $CAT['description']; $content_html = $CAT['content_ishtml']; $image_link = "<![CDATA[".$CAT['image']."]]> "; $category = ''; $cache = 60; $rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache); $publisher = ''; $creator = SITE_PROTOCOL.SITE_URL; $date = date('r'); $rssfile->addDCdata($publisher, $creator, $date); $ids = explode(",",$CAT['arrchildid']); if(count($ids) == 1 && in_array($this->rssid, $ids)) { $sql .= "`catid` = '$this->rssid' AND `status` = '99'"; } else { $sql .= get_sql_catid('category_content_'.$siteid,$this->rssid)." AND `status` = '99'"; } if(empty($MODEL[$modelid]['tablename'])) showmessage(L('missing_part_parameters'),'blank'); $this->db->table_name = $this->db->db_tablepre.$MODEL[$modelid]['tablename']; $info = $this->db->select($sql,'`title`, `description`, `url`, `inputtime`, `thumb`, `keywords`','0,20','id DESC'); foreach ($info as $r) { //添加项目 if(!empty($r['thumb'])) $img = "<img src=".thumb($r['thumb'], 150, 150)." border='0' /><br />";else $img = ''; $about = $link = (strpos($r['url'], 'http://') !== FALSE || strpos($r['url'], 'https://') !== FALSE) ? "<![CDATA[".$r['url']."]]> " : (($content_html == 1) ? "<![CDATA[".substr($sitedomain,0,-1).$r['url']."]]> " : "<![CDATA[".substr(APP_PATH,0,-1).$r['url']."]]> "); $title = "<![CDATA[".$r['title']."]]> "; $description = "<![CDATA[".$img.$r['description']."]]> "; $subject = ''; $date = date('Y-m-d H:i:s' , $r['inputtime']); $author = $ZLCMS['sitename'].' '.SITE_PROTOCOL.SITE_URL; $comments = '';//注释; $rssfile->addItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image); } $version = '2.00'; $rssfile->outputRSS($version); } }
/** * 发布的活动列表 */ public function bundling_listOp() { $model_bundling = Model('p_bundling'); // 更新套装状态 $where = array(); $where['store_id'] = $_SESSION['store_id']; $where['bl_quota_endtime'] = array('lt', TIMESTAMP); $model_bundling->editBundlingQuotaClose($where); // 检查是否已购买套餐 $where = array(); $where['store_id'] = $_SESSION['store_id']; $bundling_quota = $model_bundling->getBundlingQuotaInfo($where); Tpl::output('bundling_quota', $bundling_quota); if (!empty($bundling_quota)) { // 计算已经发布活动、剩余活动数量 $bundling_published = $model_bundling->getBundlingCount(array('store_id' => $_SESSION['store_id'])); $bundling_surplus = intval(C('promotion_bundling_sum')) - intval($bundling_published); Tpl::output('bundling_published', $bundling_published); Tpl::output('bundling_surplus', $bundling_surplus); // 查询活动 $where = array(); $where['store_id'] = $_SESSION['store_id']; if ($_GET['bundling_name'] != '') { $where['bl_name'] = array('like', '%' . trim($_GET['bundling_name']) . '%'); } if (is_numeric($_GET['state'])) { $where['bl_state'] = $_GET['state']; } $bundling_list = $model_bundling->getBundlingList($where, '*', 'bl_id desc', 10, 0, $bundling_published); $bundling_list = array_under_reset($bundling_list, 'bl_id'); Tpl::output('show_page', $model_bundling->showpage(2)); if (!empty($bundling_list)) { $blid_array = array_keys($bundling_list); $bgoods_array = $model_bundling->getBundlingGoodsList(array('bl_id' => array('in', $blid_array), 'bl_appoint' => 1), 'bl_id,goods_id,count(*) as count', 'bl_appoint desc', 'bl_id'); $bgoods_array = array_under_reset($bgoods_array, 'goods_id'); if (!empty($bgoods_array)) { $goodsid_array = array_keys($bgoods_array); $goods_array = Model('goods')->getGoodsList(array('goods_id' => array('in', $goodsid_array)), 'goods_id,goods_image'); $goods_array = array_under_reset($goods_array, 'goods_id'); } $bgoods_array = array_under_reset($bgoods_array, 'bl_id'); foreach ($bundling_list as $key => $val) { $bundling_list[$key]['goods_id'] = $bgoods_array[$val['bl_id']]['goods_id']; $bundling_list[$key]['count'] = $bgoods_array[$val['bl_id']]['count']; $bundling_list[$key]['img'] = thumb($goods_array[$bgoods_array[$val['bl_id']]['goods_id']], 60); } } Tpl::output('list', $bundling_list); // 状态数组 $state_array = array(0 => Language::get('bundling_status_0'), 1 => Language::get('bundling_status_1')); Tpl::output('state_array', $state_array); } $this->profile_menu('bundling_list', 'bundling_list'); Tpl::showpage('store_promotion_bundling.list'); }
function view($group) { global $url, $home; requirelogin(); $group = protect($group); $group = resolvegroup($group); $owner = mysql_query("SELECT `login` FROM accounts WHERE `id`='{$group['owner']}'"); $owner = mysql_fetch_array($owner); $owner = $owner['login']; $output = '<h3>' . $group['title'] . '</h3> <p>' . bbcode($group['desc']) . '<hr size="1"> <b>' . t("Criado por") . '</b> ' . url("user/profile/{$owner}", $owner) . '</p>'; section($output, t("Grupo")); $members = null; if (estounogrupo($group['id'])) { $members .= url("groups/participacao/{$group['url']}", t("[sair do grupo]")) . '<br>'; } else { $members .= url("groups/participacao/{$group['url']}", t("[participar]")) . '<br>'; } $qry = mysql_query("SELECT a.login AS l, a.foto AS f FROM groups_join g LEFT JOIN accounts a ON g.account=a.id WHERE g.group='{$group['id']}' LIMIT 100"); if (mysql_numrows($qry) != 0) { while ($row = mysql_fetch_array($qry)) { $members .= '<div class="row"><p> ' . url("user/profile/{$row['l']}", '<img src="' . $url . '/upload/' . thumb($row[f]) . '">') . '<br> ' . url("user/profile/{$row['l']}", $row[l]) . ' </p></div>'; } } else { $members .= t("Não há membros."); } section($members, t("Membros")); if (estounogrupo($group['id'])) { // show shoutbox $output = '<form method="post" action="' . $home . 'groups/writesbpost"> <input type="hidden" name="group" value="' . $group['id'] . '"> <label for="content">Escrever</label><br/> <textarea name="content" id="content" rows="5" cols="25"></textarea> <br/><input type="submit" value="' . t("Enviar") . '"></form><br/>'; $qry = mysql_query("SELECT * FROM groups_shoutbox WHERE `id_group`='{$group['id']}' ORDER BY id DESC LIMIT 30"); if (mysql_numrows($qry) == 0) { $output .= infobox(t("Não há itens na shoutbox deste grupo."), false); } else { while ($row = mysql_fetch_array($qry)) { $user = mysql_fetch_array(mysql_query("SELECT login FROM accounts WHERE `id`='{$row['owner']}'")); $output .= '<p> ' . url("user/profile/{$user['login']}", $user['login']) . ': ' . bbcode($row['text']); if ($group['owner'] == $_SESSION['id'] or $row['owner'] == $_SESSION['id'] or is_admin()) { $output .= '<br/>' . url("groups/remsb/{$row['id']}", t("[remover]")); } $output .= '</p><hr size="1">'; } } section($output, t("Shoutbox do grupo")); } }
public function __construct($image, $args = array()) { $this->image = $image; $this->thumb = thumb($image, $args); $this->to_path = $this->thumb()->dir() . '/' . $this->toFilename(); $this->to_name = $this->removeExtension(); $this->to_url = $this->toUrl(); if (!file_exists($this->to_path)) { $this->compressImage(); } }
/** * imgsrc Plugin * * @author Marijn Tijhuis <*****@*****.**> * @author Jonathan van Wunnik <*****@*****.**> * @version 1.0.0 */ function bgimage($image = false, $options = array()) { if (!$image) { return; } // Default key values $defaults = array('width' => null, 'height' => null, 'crop' => null, 'cropratio' => null, 'class' => '', 'alt' => '', 'quality' => c::get('thumbs.quality', 92), 'lazyload' => c::get('lazyload', false)); // Merge defaults and options $options = array_merge($defaults, $options); // Without resrc, maximize thumb width, for speedier loading of page! if (c::get('resrc') == false) { if (!isset($options['width'])) { $thumbwidth = c::get('thumbs.width.default', 800); } else { $thumbwidth = $options['width']; } } else { // If resrc is enabled, use original image width $thumbwidth = $image->width(); } // If no crop variable is defined *and* no cropratio // is set, the crop variable is set to false if (!isset($options['crop']) && !isset($options['cropratio'])) { $options['crop'] = false; } // When a cropratio is set, calculate the ratio based height if (isset($options['cropratio'])) { // If cropratio is a fraction string (e.g. 1/2), convert to decimal if (strpos($options['cropratio'], '/') !== false) { list($numerator, $denominator) = str::split($options['cropratio'], '/'); $options['cropratio'] = $numerator / $denominator; } // Calculate new thumb height based on cropratio $thumbheight = round($thumbwidth * $options['cropratio']); // If a cropratio is set, the crop variable is always set to true $options['crop'] = true; // Manual set (crop)ratio $ratio = $options['cropratio']; } else { // Intrinsic image's ratio $ratio = 1 / $image->ratio(); // Max. height of image $thumbheight = round($thumbwidth * $ratio); } // Create thumb url (create a new thumb object) $options['thumburl'] = thumb($image, array('width' => $thumbwidth, 'height' => $thumbheight, 'quality' => $options['quality'], 'crop' => $options['crop']), false); // Add more values to options array, for use in template $options['customwidth'] = $options['width']; $options['customquality'] = $options['quality']; $options['ratio'] = $ratio; // Return template HTML return tpl::load(__DIR__ . DS . 'template/bgimage.php', $options); }
public function cover_img($as = false) { $cover_img = $this->files()->find($this->cover()); if ($cover_img) { if ($as) { $cover_thumb = thumb($cover_img, array("width" => 400, "height" => 250, "blur" => true)); return brick('div')->attr('style', "background-image:url(" . $cover_thumb->url() . ");")->addClass('story__cover'); } return $cover_img->url(); } return false; }
function modules() { global $url; $output = '<p>' . url("comu/newmodule", "Novo módulo") . '</p>'; $qry = mysql_query("SELECT * FROM comunidade WHERE tipo='m' ORDER BY id DESC"); while ($row = mysql_fetch_array($qry)) { $output .= '<p class="row">'; $output .= url("comu/viewtheme/{$row['id']}", $row['nome']); $output .= '<img src="' . $url . '/upload/' . thumb($row['imagem']) . '" width="100">'; $output .= '</p>'; } section($output, 'Módulos'); }
/** * 获取收藏列表 * @param int $uid 用户uid */ public function getLists($uid) { $map = array('user_id' => $uid); $lists = $this->where($map)->select(); $product = array(); foreach ($lists as $key => $value) { $product = M('FxProduct')->field('product_name, thumb')->where(array('product_id' => $value['product']))->find(); $lists[$key]['title'] = msubstr($product['product_name'], 0, 15); $lists[$key]['thumb'] = thumb($product['thumb']); $lists[$key]['url'] = U('Index/product', array('id' => $value['product'])); $lists[$key]['del_url'] = U('collect', array('type' => 2, 'product_id' => $value['product'])); } return $lists; }
/** *�༭��Ʒ * @param int $id * @return string */ function editHouse($id) { $arr = $_POST; $arr['update_time'] = date("Y-m-d H:i:s"); $sql = "select house_id from tg_host_house where id={$id}"; $row = fetchOne($sql); //��house_id������album_id $album_id = $row['house_id']; $path = "../uploads/House_Album/user_id_" . $album_id; //����û�жϾ��ϴ�ͼƬ���ļ��У�ͼƬ��ݲ�һ���ɹ�������ݿ� $uploadFiles = uploadFile($path); if (is_array($uploadFiles) && $uploadFiles) { foreach ($uploadFiles as $key => $uploadFile) { thumb($path . "/" . $uploadFile['name'], "../image_50/user_id_" . $album_id . "/" . $uploadFile['name'], 50, 50); } } //����host_house����� $where = "house_id={$id}"; $res = update("tg_host_house", $arr, $where); //ע�⣺����ֻ�ܸ�����ݱ������е��ֶΣ����post�����ݸ�table����ֶβ�ƥ�䣬����ʧ�ܣ����� $house_id = $row['house_id']; //����ȡ�� house_id ����Ӧ album_id $sql_img = "select i.album_id from tg_house_img as i left join tg_host_house h on h.house_id=i.album_id where i.album_id={$house_id}"; $row_img = fetchOne($sql_img); //��img_path ��ӵ� tg_house_img�� if ($res && $house_id) { if ($uploadFiles && is_array($uploadFiles)) { foreach ($uploadFiles as $uploadFile) { $arr1['album_id'] = $house_id; $arr1['img_path'] = $uploadFile['name']; //print_r($arr1['img_path']);exit; addAlbum($arr1); } } $mes = "<p>Edit success!</p><a href='listHouse.php' target='mainFrame'>View house list</a>"; } else { if (is_array($uploadFiles) && $uploadFiles) { foreach ($uploadFiles as $uploadFile) { if (file_exists("../image_50/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name'])) { unlink("../image_50/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name']); } if (file_exists("../uploads/House_Album/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name'])) { unlink("../uploads/House_Album/user_id_" . $_SESSION['user_id'] . "/" . $uploadFile['name']); } } } $mes = "<p>Failed!</p><a href='listHouse.php' target='mainFrame'>Edit again</a>"; } return $mes; }
public function picture($imageFile, $ruleSet, $options, $attributes) { $markup = ''; foreach ($ruleSet as $rule) { $id = 'img' . random(); if ($rule['mediaRule']) { echo "\n <style scoped>\n #" . $id . " { display: none; }\n\n @media only screen and " . $rule['mediaRule'] . " {\n #" . $id . " { display: block; }\n }\n </style>\n "; } echo '<img id="' . $id . '" src="' . $imageFile . thumb($rule . dimensions[0], $rule . dimensions[1], $options) . '" ' . $attributes . '>'; } return $markup; }
/** * Figure Plugin * * @author Marijn Tijhuis <*****@*****.**> * @author Jonathan van Wunnik <*****@*****.**> * @version 1.0.0 */ function figure($image = false, $options = array()) { if (!$image) { return; } // default key values $defaults = array('crop' => null, 'cropratio' => null, 'class' => '', 'alt' => '', 'caption' => null, 'lazyload' => c::get('lazyload', false)); // merge defaults and options $options = array_merge($defaults, $options); // without resrc, maximize thumb width, for speedier loading of page! if (c::get('resrc') == false) { $thumbwidth = c::get('thumb.dev.width', 800); } else { // with resrc use maximum (original) image width $thumbwidth = null; } // if no crop variable is defined *and* no cropratio // is set, the crop variable is set to false if (!isset($options['crop']) && !isset($options['cropratio'])) { $options['crop'] = false; } // when a cropratio is set, calculate the ratio based height if (isset($options['cropratio'])) { // if resrc is enabled (and therefor $thumbwidth is not set (e.g. `null`), // to use max width of image!), set thumbwidth to width of original image if (!isset($thumbwidth)) { $thumbwidth = $image->width(); } // if cropratio is a fraction string (e.g. 1/2), convert to decimal // if(!is_numeric($options['cropratio'])) { if (strpos($options['cropratio'], '/') !== false) { list($numerator, $denominator) = str::split($options['cropratio'], '/'); $options['cropratio'] = $numerator / $denominator; } // calculate new thumb height based on cropratio $thumbheight = round($thumbwidth * $options['cropratio']); // if a cropratio is set, the crop variable is always set to true $options['crop'] = true; } else { $thumbheight = null; // max height of image } // Create thumb url (create a new thumb object) $options['thumburl'] = thumb($image, array('width' => $thumbwidth, 'height' => $thumbheight, 'crop' => $options['crop']), false); // Add image object to options array, for use in template $options['image'] = $image; // Return template HTML return tpl::load(__DIR__ . DS . 'template.php', $options); }
public function test_thumb($param) { $url = $this->input->get("url"); $w = (int) $this->input->get("w"); $h = (int) $this->input->get("h"); // echo $url; echo "<br>"; $th = thumb($url, $w, $h); echo $th . "<hr>"; echo "<img src='{$th}' />"; echo "<hr/><pre>" . __FILE__ . " L:" . __LINE__; var_dump($th); echo "</pre><hr/>"; die; }
public function indexOp(){ $model_mb_ad = Model('mb_ad'); $model_mb_home = Model('mb_home'); $datas = array(); //广告 $adv_list = array(); $mb_ad_list = $model_mb_ad->getMbAdList(array(), null, 'link_sort asc'); foreach ($mb_ad_list as $value) { $adv = array(); $adv['image'] = $value['link_pic_url']; $adv['keyword'] = $value['link_keyword']; $adv_list[] = $adv; } //首页 $home_type1_list = array(); $home_type2_list = array(); //$mb_home_list = $model_mb_home->getMbHomeList(array(), null, 'h_sort asc'); // @tsh $advList=array(); $list=Model('adv')->getList(array('ap_id'=>373)); foreach($list as $v){ $advContent=unserialize($v['adv_content']); $advContent['keyword']=$v['adv_title']; $advContent['image']=UPLOAD_SITE_URL.'/shop/adv/'.$advContent['adv_pic']; $advList[]=$advContent; } $datas['adv_list'] = $advList; $mb_home_list=Model('goods')->select(); foreach ($mb_home_list as $value) { $home = array(); $home['image'] = thumb($value,160); $home['title'] = $value['goods_name']; $home['desc'] = $value['goods_jingle']; $home['keyword1'] = ''; $home_type1_list[] = $home; } $datas['home1'] = $home_type1_list; $datas['home2'] = $home_type1_list; output_data($datas); }
public function section($id = 0) { $id = round($id); $info = $this->data['info'] = $this->Data->Information($id); if (!$this->data['info']) { return $this->error(); } $headers['head-title'] = $info->title . ' | ' . $this->config->item('client', 'app'); $headers['title'] = $info->title; $headers['description'] = $headers['keywords'] = strip_tags($info->text); if ($info->file) { $headers['og:image'] = thumb($info->file, 650, 498); } $this->data['headers'] = $headers; $this->load->view('section/static', $this->data); }
function autothumbhook($file) { if (!c::get('autothumb.enabled', false) || !$file->isImage()) { return; } try { $height = c::get('autothumb.height', 500); $quality = c::get('autothumb.quality', 70); $dimensions = clone $file->dimensions(); $dimensions->fitHeight($height); $thumb = thumb($file, ['width' => $dimensions->width(), 'height' => $dimensions->height(), 'quality' => $quality]); echo $thumb->root(); } catch (Exception $e) { return response::error($e->getMessage()); } }
/** * 异步查询购物车 */ public function ajax_loadOp() { $model_cart = Model('cart'); if ($_SESSION['member_id']) { //登录后 $cart_list = $model_cart->listCart('db', array('buyer_id' => $_SESSION['member_id'])); $cart_array = array(); if (!empty($cart_list)) { foreach ($cart_list as $k => $cart) { $cart_array['list'][$k]['cart_id'] = $cart['cart_id']; $cart_array['list'][$k]['goods_id'] = $cart['goods_id']; $cart_array['list'][$k]['goods_name'] = $cart['goods_name']; $cart_array['list'][$k]['goods_price'] = $cart['goods_price']; $cart_array['list'][$k]['goods_image'] = thumb($cart, 60); $cart_array['list'][$k]['goods_num'] = $cart['goods_num']; $cart_array['list'][$k]['goods_url'] = urlShop('goods', 'index', array('goods_id' => $cart['goods_id'])); } } } else { //登录前 $cart_list = $model_cart->listCart('cookie'); foreach ($cart_list as $key => $cart) { $value = array(); $value['cart_id'] = $cart['goods_id']; $value['goods_name'] = $cart['goods_name']; $value['goods_price'] = $cart['goods_price']; $value['goods_num'] = $cart['goods_num']; $value['goods_image'] = thumb($cart, 60); $value['goods_url'] = urlShop('goods', 'index', array('goods_id' => $cart['goods_id'])); $cart_array['list'][] = $value; } } setNcCookie('cart_goods_num', $model_cart->cart_goods_num, 2 * 3600); $cart_array['cart_all_price'] = ncPriceFormat($model_cart->cart_all_price); $cart_array['cart_goods_num'] = $model_cart->cart_goods_num; if ($_GET['type'] == 'html') { Tpl::output('cart_list', $cart_array); Tpl::showpage('cart_mini', 'null_layout'); } else { $cart_array = strtoupper(CHARSET) == 'GBK' ? Language::getUTF8($cart_array) : $cart_array; $json_data = json_encode($cart_array); if (isset($_GET['callback'])) { $json_data = $_GET['callback'] == '?' ? '(' . $json_data . ')' : $_GET['callback'] . "({$json_data});"; } exit($json_data); } }
/** *编辑商品 * @param int $id * @return string */ function editPro($id) { $arr = $_POST; $path = "./uploads"; $uploadFiles = uploadFile($path); if (is_array($uploadFiles) && $uploadFiles) { foreach ($uploadFiles as $key => $uploadFile) { thumb($path . "/" . $uploadFile['name'], "../image_50/" . $uploadFile['name'], 50, 50); thumb($path . "/" . $uploadFile['name'], "../image_220/" . $uploadFile['name'], 220, 220); thumb($path . "/" . $uploadFile['name'], "../image_350/" . $uploadFile['name'], 350, 350); thumb($path . "/" . $uploadFile['name'], "../image_800/" . $uploadFile['name'], 800, 800); } } $where = "id={$id}"; $res = update("imooc_pro", $arr, $where); $pid = $id; if ($res && $pid) { //判断是否有图片上传 if ($uploadFiles && is_array($uploadFiles)) { foreach ($uploadFiles as $uploadFile) { $arr1['pid'] = $pid; $arr1['albumPath'] = $uploadFile['name']; addAlbum($arr1); } } $mes = "<p>编辑成功!</p><a href='listPro.php' target='mainFrame'>查看商品列表</a>"; } else { if (is_array($uploadFiles) && $uploadFiles) { foreach ($uploadFiles as $uploadFile) { if (file_exists("../image_800/" . $uploadFile['name'])) { unlink("../image_800/" . $uploadFile['name']); } if (file_exists("../image_50/" . $uploadFile['name'])) { unlink("../image_50/" . $uploadFile['name']); } if (file_exists("../image_220/" . $uploadFile['name'])) { unlink("../image_220/" . $uploadFile['name']); } if (file_exists("../image_350/" . $uploadFile['name'])) { unlink("../image_350/" . $uploadFile['name']); } } } $mes = "<p>编辑失败!</p><a href='listPro.php' target='mainFrame'>重新编辑</a>"; } return $mes; }
/** * 客户购买商品列表 */ public function goods_listOp() { $model_stat = Model('stat'); $goods_list = array(); $condition['store_id'] = $this->store_info['store_id']; if (is_numeric($_POST['member_id'])) { $condition['buyer_id'] = intval($_POST['member_id']); } $goods_list = $model_stat->statByStatordergoods($condition, 'store_id,goods_name,goods_image,goods_num,goods_price,order_add_time', $this->page); if (!empty($goods_list)) { foreach ($goods_list as $key => $val) { $goods_list[$key]['gooods_image'] = thumb($val, '240'); } } $page_count = $model_stat->gettotalpage(); output_data(array('goods_list' => $goods_list), mobile_page($page_count)); }
/** * 添加记录 * @return string */ function post() { if (getPostNumByUid($_SESSION['uid']) >= maxPost) { $msg = "你的记录总数达到上限 (" . maxPost . "条),已不能继续发布记录. <br>若有疑问请联系管理员:huang_hao521@163.com"; return $msg; } $arr = $_POST; array_splice($arr, 1, 1); //删除数组中注册不需要用到的submit和verify元素 $arr['date'] = date("Y-m-j" . " " . "H:i:s"); //匹配数据库中的datetime时间格式 $arr['uid'] = $_SESSION['uid']; // 判断是否有记录图片都没有 if (empty($arr['post']) && empty($_FILES['postImage']['name'])) { $msg = "填写内容或添加图片后再添加!<meta http-equiv='refresh' content='1;url=user.php'/>"; return $msg; exit; } $res = insert("zhx_post", $arr); if ($res) { $pmsg = "记录发布成功!"; } $pid = getInsertId(); //获取记录pid用来插入图片 // return print_r($arr); //若有图片添加,则上传图片 if (!empty($_FILES['postImage']['name'])) { // print_r($uploadFile);exit; $uploadFile = uploadFile("images/uploads/postImage/"); if ($uploadFile && is_array($uploadFile)) { $album['image'] = $uploadFile[0]['name']; thumb("images/uploads/postImage/" . $album['image'], "images/uploads/postImage_500/" . $album['image'], 500); $album['pid'] = $pid; insert("zhx_album", $album); $imsg = "添加图片成功!"; } else { $imsg = "添加图片失败!"; } } $msg = $pmsg . " " . @$imsg . "<meta http-equiv='refresh' content='1;url=user.php'/>"; return $msg; }
public function save_face() { $this->uid = session('home_member_id'); if (IS_POST) { if ($_FILES) { $file = $_FILES['img']; $filename = $file["tmp_name"]; if ($file['error'] > 0) { //是否存在文件 echo json_encode(array('status' => 0, 'info' => '上传图片不存在')); exit; } $img_folder = 'icon/'; if (!file_exists($img_folder)) { mkdir($img_folder, '0777'); } $img = $img_folder . $this->uid . '_avatar_big' . "." . 'jpg'; //big,small middle if (!move_uploaded_file($filename, $img)) { echo json_encode(array('status' => 0, 'info' => '上传图片不存在')); exit; } else { $middle = thumb($img, 120, 120, 'M'); $small = thumb($img, 48, 48, 'S'); rename($img_folder . 'M' . $this->uid . '_avatar_big' . "." . 'jpg', $img_folder . $this->uid . '_avatar_middle' . "." . 'jpg'); rename($img_folder . 'S' . $this->uid . '_avatar_big' . "." . 'jpg', $img_folder . $this->uid . '_avatar_small' . "." . 'jpg'); } $img = 'http://' . $_SERVER['SERVER_NAME'] . '/' . __ROOT__ . '/' . $img_folder . $this->uid . '_avatar_big' . "." . 'jpg'; echo json_encode(array('status' => 1, 'info' => '上传成功', 'img' => $img)); exit; } else { echo json_encode(array('status' => 0, 'info' => '上传失败')); exit; } } else { echo json_encode(array('status' => 0, 'info' => '提交错误')); exit; //$this->display('Index/save_face'); } }
function post() { global $url; requirelogin(); $me = $_SESSION['id']; $query = substr(protect($_POST['query']), 0, 16); if (strlen($query) < 3) { # isso não é um coração... infobox(t("Termos de busca muito pequenos.", true, true)); } if ($_POST['usuarios']) { $qry = mysql_query("SELECT `foto`,`login` FROM accounts WHERE `login` LIKE '%{$query}%' OR `nome` LIKE '%{$query}%'"); if (mysql_numrows($qry) == 0) { $usuarios = t("Nenhum resultado!"); } else { $usuarios = null; while ($row = mysql_fetch_array($qry)) { $usuarios .= "\n" . '<p><div class="row"> <img src="' . $url . '/upload/' . thumb($row['foto']) . '"><br> ' . url("user/profile/{$row['login']}", $row['login']) . ' </div></p>'; } } section($usuarios, t("Buscando usuários.")); } if ($_POST['grupos']) { $qry = mysql_query("SELECT `title`,`url` FROM groups WHERE `title` LIKE '%{$query}%' OR `desc` LIKE '%{$query}%'"); if (mysql_numrows($qry) == 0) { $grupos = t("Nenhum resultado!"); } else { $grupos = null; while ($row = mysql_fetch_array($qry)) { $grupos .= "\n" . '<p><div class="row"> ' . url("groups/view/{$row['url']}", $row['title']) . ' </div></p>'; } } section($grupos, t("Buscando grupos.")); } }
function minigallery($params) { /** * Default values set them to your preferences. **/ $defaults = array('width' => 200, 'height' => 200, 'crop' => false, 'quality' => 100, 'rel' => "gallery", 'titles' => "", 'fancybox' => "true", 'class' => ""); global $site; $options = array_merge($defaults, $params); $files = $params['minigallery']; $titles = $options['titles']; $fancybox = $options['fancybox']; $page = $this->obj ? $this->obj : $site->pages()->active(); // explode images and titles $filesArr = explode("|", $files); $titlesArr = explode("|", $titles); // html output $output = "<span class=\"minigallery"; $output .= $options['class'] ? " " . $options['class'] : ""; $output .= "\">"; foreach ($filesArr as $key => $img) { $currentImage = $page->images()->find($img); if ($fancybox == "true") { $output .= "<a href=\"" . $currentImage->url() . "\" class=\"fancybox\" rel=\"" . $options['rel'] . "\""; // is there a title? if (count($titlesArr) > 0 && isset($titlesArr[$key]) && $titlesArr[$key] != "") { $output .= " title= \"" . $titlesArr[$key] . "\" "; } $output .= ">"; } // call thumb method $output .= thumb($currentImage, array('width' => $options['width'], 'height' => $options['height'], 'crop' => $options['crop'], 'quality' => $options['quality'])); if ($fancybox == "true") { $output .= "</a>"; } } $output .= "</span>"; return $output; }
/** * 订单 */ public function index() { $map = array('user_id' => $this->user_info['user_id']); $status = I('status'); if (!empty($status)) { $map['status'] = $status; $souso['status'] = $status; } $lists = M('FxOrder')->where($map)->select(); foreach ($lists as $key => $value) { $order_info = unserialize($value['order_info']); $product = array_pop($order_info['cart']); $lists[$key]['thumb'] = thumb($product['thumb']); $lists[$key]['num'] = $order_info['count_num']; $lists[$key]['url'] = U('show', array('order_id' => $value['order_id'])); $lists[$key]['status_text'] = get_fx_order_status($value['status']); } // echo '<pre>'; // print_r($lists); // echo '</pre>'; $this->assign('lists', $lists); $this->assign('souso', $souso); $this->display(); }
var_dump($pages); } if (is_array($pages)) { $i = 0; $__LIST__ = $pages; if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $page) { $mod = $i % 2; ++$i; ?> <div class="block"> <div class="thumb"> <img src="<?php echo thumb($page['thumb'], 160, 160); ?> "> </div> <div class="details"> <div class="title"> <?php echo $page['title']; ?> </div> <div class="brief"> <?php echo trim(strip_tags($page['content'])); ?> </div> </div>
/** * ajax获取商品列表 */ public function get_goods_list_ajaxOp() { $common_id = $_GET['commonid']; if ($common_id <= 0) { echo 'false'; exit; } $model_goods = Model('goods'); $goodscommon_list = $model_goods->getGoodeCommonInfoByID($common_id, 'spec_name,store_id'); if (empty($goodscommon_list) || $goodscommon_list['store_id'] != $_SESSION['store_id']) { echo 'false'; exit; } $goods_list = $model_goods->getGoodsList(array('store_id' => $_SESSION['store_id'], 'goods_commonid' => $common_id), 'goods_id,goods_spec,store_id,goods_price,goods_serial,goods_storage_alarm,goods_storage,goods_image'); if (empty($goods_list)) { echo 'false'; exit; } $spec_name = array_values((array) unserialize($goodscommon_list['spec_name'])); foreach ($goods_list as $key => $val) { $goods_spec = array_values((array) unserialize($val['goods_spec'])); $spec_array = array(); foreach ($goods_spec as $k => $v) { $spec_array[] = '<div class="goods_spec">' . $spec_name[$k] . L('nc_colon') . '<em title="' . $v . '">' . $v . '</em>' . '</div>'; } $goods_list[$key]['goods_image'] = thumb($val, '60'); $goods_list[$key]['goods_spec'] = implode('', $spec_array); $goods_list[$key]['alarm'] = $val['goods_storage_alarm'] != 0 && $val['goods_storage'] <= $val['goods_storage_alarm'] ? 'style="color:red;"' : ''; $goods_list[$key]['url'] = urlShop('goods', 'index', array('goods_id' => $val['goods_id'])); } /** * 转码 */ if (strtoupper(CHARSET) == 'GBK') { Language::getUTF8($goods_list); } echo json_encode($goods_list); }
?> <?php foreach ($output['list'] as $val) { $goods = $output['goods_list'][$val['order_goods_id']]; ?> <tr class="bd-line"> <td></td> <td class="w50"><div class="pic-thumb"><a target="_blank" href="<?php echo urlShop('goods', 'index', array('goods_id' => $goods['goods_id'])); ?> "> <img src="<?php echo thumb($goods, 60); ?> " onMouseOver="toolTip('<img src=<?php echo thumb($goods, 240); ?> >')" onMouseOut="toolTip()" /></a></div></td> <td class="tl"><dl class="goods-name"> <dt><a target="_blank" href="<?php echo urlShop('goods', 'index', array('goods_id' => $goods['goods_id'])); ?> "><?php echo $goods['goods_name']; ?> </a></dt> <dd>商家:<?php echo $val['accused_name']; ?> </dd> </dl></td>