示例#1
0
 function saveSource()
 {
     $this->system->setConf('system.theme_last_modified', time());
     $this->begin('index.php?ctl=system/tmpimage&act=detail&p[0]=' . $_POST['id']);
     $oImg = $this->system->loadModel('resources/tmpimage');
     unSafeVar($_POST);
     $this->end($oImg->saveSource($_POST), __('样式文件保存成功'));
 }
示例#2
0
文件: kernel.php 项目: noikiy/MyShop
 function kernel()
 {
     error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
     $GLOBALS['system'] =& $this;
     if (get_magic_quotes_gpc()) {
         unSafeVar($_GET);
         unSafeVar($_POST);
         unSafeVar($_COOKIE);
     }
     if (!defined('CORE_INCLUDE_DIR')) {
         define('CORE_INCLUDE_DIR', CORE_DIR . ((!defined('SHOP_DEVELOPER') || !constant('SHOP_DEVELOPER')) && version_compare(PHP_VERSION, '5.0', '>=') ? '/include_v5' : '/include'));
     }
     set_include_path(CORE_INCLUDE_DIR . PATH_SEPARATOR . '.' . PATH_SEPARATOR . CORE_DIR . '/lib/pear');
     require 'defined.php';
     $this->model_dir = (!defined('SHOP_DEVELOPER') || !constant('SHOP_DEVELOPER')) && version_compare(PHP_VERSION, '5.0', '>=') ? 'model_v5' : 'model';
     if (constant('WITH_MEMCACHE')) {
         $this->init_memcache();
         //review: 错误信息
     }
     if (defined('IN_INSTALLER')) {
         $this->cache = new nocache();
     } else {
         $this->__metadata = unserialize(file_get_contents(HOME_DIR . '/fdata.php'));
         if (isset($this->__metadata['GTASK_REMINDER']) && $this->__metadata['GTASK_REMINDER'] > 0 && time() > $this->__metadata['GTASK_REMINDER']) {
             $goods =& $this->loadModel('trading/goods');
             $goods->flush_gtask();
         }
         if (constant('WITHOUT_CACHE')) {
             $this->cache = new nocache();
         } else {
             require 'cachemgr.php';
             if (constant('WITH_MEMCACHE')) {
                 require PLUGIN_DIR . '/functions/cache_memcache.php';
                 $this->cache = new cache_memcache();
             } elseif (defined('CACHE_METHOD')) {
                 require PLUGIN_DIR . '/functions/' . CACHE_METHOD . '.php';
                 $cache_method = CACHE_METHOD;
                 $this->cache = new $cache_method();
             } elseif (php_sapi_name() == 'isapi') {
                 require 'secache.php';
                 require 'secache_no_flock.php';
                 $this->cache = new secache_no_flock();
             } else {
                 require 'secache.php';
                 $this->cache = new secache();
             }
         }
     }
     require 'setmgr.php';
     $this->__setting = new setmgr();
     $this->set_timezone(SERVER_TIMEZONE);
 }
示例#3
0
 function update()
 {
     unSafeVar($_POST);
     unset($_POST['goods']['vars'], $_POST['goods']['spec_desc']);
     $goods = $_POST['goods'];
     $goods['name'] = trim($_POST['goods']['name']);
     $goods['image_default'] = $_POST['image_default'];
     $this->goods_id = $goods['goods_id'];
     $gd = $this->system->loadModel('utility/magickwand');
     if ($gd->magickwand_loaded) {
         $loaded = true;
     } else {
         $gd = $this->system->loadModel('utility/gdimage');
         $loaded = $gd->gd_loaded;
     }
     $this->pagedata['gd_loaded'] = $loaded;
     $this->pagedata['pic_bar'] = $_POST['pic_bar'];
     /*
     if($_POST['vars']){
         $goods['products'] = array(1);
         $spec['bn'] = $_POST['bn'];
         $spec['price'] = $_POST['price'];
         $spec['store'] = $_POST['store'];
         $spec['mprice'] = $_POST['mprice'];
         $spec['vars'] = $_POST['vars'];
         $spec['val'] = $_POST['val'];
         $spec['idata'] = $_POST['idata'];
         $spec['idataInfo'] = $_POST['idataInfo'];
         $this->pagedata['spec'] = &$spec;    //商品规格
     }
     */
     foreach ($_POST['adjunct']['name'] as $key => $name) {
         $aItem['name'] = $name;
         $aItem['type'] = $_POST['adjunct']['type'][$key];
         $aItem['min_num'] = $_POST['adjunct']['min_num'][$key];
         $aItem['max_num'] = $_POST['adjunct']['max_num'][$key];
         $aItem['set_price'] = $_POST['adjunct']['set_price'][$key];
         $aItem['price'] = $_POST['adjunct']['price'][$key];
         if ($aItem['type'] == 'goods') {
             $aItem['items']['product_id'] = $_POST['adjunct']['items'][$key];
         } else {
             $aItem['items'] = $_POST['adjunct']['items'][$key];
         }
         //.'&dis_goods[]='.$aData['goods_id']
         $goods['adjunct'][] = $aItem;
     }
     $this->pagedata['goods'] =& $goods;
     foreach ($_POST['linkid'] as $k => $id) {
         $aLinkType[$id] = array('manual' => $_POST['linktype'][$k]);
     }
     $this->pagedata['goods']['glink']['items'] = $_POST['linkid'];
     $this->pagedata['goods']['glink']['moreinfo'] = $aLinkType;
     $this->pagedata['goods']['keywords'] = $_POST['keywords']['keyword'];
     $this->_editor($_POST['goods']['type_id']);
     $this->pagedata['goods']['taged'] = space_split(stripslashes($_POST['tags']));
     $this->pagedata['goodsbn_display_switch'] = $this->system->getConf('goodsbn.display.switch');
     $this->setView('product/detail/page.html');
     $this->output();
 }
示例#4
0
 function insertWg($widgets_type, $domid, $theme)
 {
     header('Content-Type: text/html;charset=utf-8');
     error_reporting(E_ERROR | E_WARNING | E_PARSE);
     //todo
     unSafeVar($_POST);
     $widgets = $this->system->loadModel('content/widgets');
     $set = array('widgets_type' => $widgets_type, 'title' => $_POST['__wg']['title'], 'border' => $_POST['__wg']['border'], 'tpl' => $_POST['__wg']['tpl'], 'domid' => $_POST['__wg']['domid'], 'classname' => $_POST['__wg']['classname']);
     unset($_POST['__wg']);
     $set['params'] = $_POST;
     $set['_domid'] = $domid;
     $i = is_array($_SESSION['_tmp_wg']) ? count($_SESSION['_tmp_wg']) : 0;
     $_SESSION['_tmp_wg'][$i] = $set;
     $data = $widgets->adminWgBorder(array('title' => $set['title'], 'domid' => $set['domid'], 'border' => $set['border'], 'widgets_type' => $set['widgets_type'], 'html' => $widgets->fetch($set, true), 'border' => $set['border']), $theme, true);
     echo $data;
 }
示例#5
0
 function update()
 {
     unSafeVar($_POST);
     $goods = $_POST['goods'];
     $goods['name'] = trim($_POST['goods']['name']);
     $goods['image_default'] = $_POST['image_default'];
     $this->goods_id = $goods['goods_id'];
     $gd =& $this->system->loadModel('utility/magickwand');
     if ($gd->magickwand_loaded) {
         $loaded = true;
     } else {
         $gd =& $this->system->loadModel('utility/gdimage');
         $loaded = $gd->gd_loaded;
     }
     $this->pagedata['gd_loaded'] = $loaded;
     $this->pagedata['pic_bar'] = $_POST['pic_bar'];
     /*
     if($_POST['vars']){
         $goods['products'] = array(1);
         $spec['bn'] = $_POST['bn'];
         $spec['price'] = $_POST['price'];
         $spec['store'] = $_POST['store'];
         $spec['mprice'] = $_POST['mprice'];
         $spec['vars'] = $_POST['vars'];
         $spec['val'] = $_POST['val'];
         $spec['idata'] = $_POST['idata'];
         $spec['idataInfo'] = $_POST['idataInfo'];
         $this->pagedata['spec'] = &$spec;    //商品规格
     }
     */
     if ($_POST['bn'] && is_array($_POST['bn'])) {
         foreach ($_POST['bn'] as $gk => $gbn) {
             $goods['products'][$gk] = array('bn' => $gbn, 'cost' => $_POST['cost'][$gk], 'weight' => $_POST['weight'][$gk], 'store' => $_POST['store'][$gk], 'price' => $_POST['price'][$gk]);
             foreach ($_POST['mprice'] as $memlvid => $mprice) {
                 $goods['products'][$gk]['mprice'][$memlvid] = $mprice[$gk];
             }
             $goodsProps = array();
             foreach ($_POST['val'] as $valSpecId => $valSpec) {
                 $goodsProps['spec'][$valSpecId] = urldecode($valSpec[$gk]);
                 $goodsProps['spec_private_value_id'][$valSpecId] = $_POST['pSpecId'][$valSpecId][$gk];
                 $goodsProps['spec_value_id'][$valSpecId] = $_POST['specVId'][$valSpecId][$gk];
             }
             $goods['products'][$gk]['props'] = $goodsProps;
         }
     }
     foreach ($_POST['adjunct']['name'] as $key => $name) {
         $aItem['name'] = $name;
         $aItem['type'] = $_POST['adjunct']['type'][$key];
         $aItem['min_num'] = $_POST['adjunct']['min_num'][$key];
         $aItem['max_num'] = $_POST['adjunct']['max_num'][$key];
         $aItem['set_price'] = $_POST['adjunct']['set_price'][$key];
         $aItem['price'] = $_POST['adjunct']['price'][$key];
         if ($aItem['type'] == 'goods') {
             $aItem['items']['product_id'] = $_POST['adjunct']['items'][$key];
         } else {
             $aItem['items'] = $_POST['adjunct']['items'][$key];
         }
         //.'&dis_goods[]='.$aData['goods_id']
         $goods['adjunct'][] = $aItem;
     }
     if ($goods['spec_desc']) {
         $goods['spec_desc'] = unserialize(urldecode($goods['spec_desc']));
     }
     //做类型转换
     $oGType = $this->system->loadModel('goods/gtype');
     if (!$oGType->typeTransform($_POST['oldTypeId'], $_POST['goods']['type_id'], $goods, $_POST)) {
         echo 'false';
         exit;
     }
     if (!empty($_POST['vars'])) {
         if ($oGType->specTransformState == 'different' || $oGType->specTransformState == 'same') {
             foreach ($_POST['vars'] as $dk => $dv) {
                 $_POST['specname'][$dk]['spec_name'] = $dv;
             }
         } else {
             foreach ($_POST['vars'] as $dk => $dv) {
                 $_POST['specname'][$oGType->specTransformHash[$dk]['spec_id']]['spec_name'] = $dv;
             }
         }
     }
     $this->pagedata['goods'] =& $goods;
     foreach ($_POST['linkid'] as $k => $id) {
         $aLinkType[$id] = array('manual' => $_POST['linktype'][$k]);
     }
     $this->pagedata['goods']['glink']['items'] = $_POST['linkid'];
     $this->pagedata['goods']['glink']['moreinfo'] = $aLinkType;
     $this->pagedata['goods']['keywords'] = $_POST['keywords']['keyword'];
     foreach ($goods as $gk => $gv) {
         if (substr($gk, 0, 2) == 'p_') {
             $this->pagedata['goods'][$gk] = $gv;
         }
     }
     if ($goods['spec_desc']) {
         $objSpec = $this->system->loadModel('goods/specification');
         $specDescKeys = array_keys($goods['spec_desc']);
         if (!empty($specDescKeys) && $specDesckeys[0]) {
             $aSpec = $objSpec->getListByIdArray($specDescKeys);
         }
         $this->pagedata['specname'] = $aSpec;
         $aSpecImg = array();
         $gimage = $this->system->loadModel('goods/gimage');
         foreach ($aSpec as $asv) {
             if ($asv['spec_type'] == 'image') {
                 foreach ($objSpec->getValueList($asv['spec_id']) as $svk => $svv) {
                     $aSpecImg[$svk] = $gimage->getUrl($svv['spec_image']);
                 }
             }
         }
         $this->pagedata['goods']['spec_value_image'] = $aSpecImg;
         $tmpGoods = array();
         $specDefaultPic = $this->system->getConf('spec.default.pic');
         if (is_array($goods['spec_desc'])) {
             foreach ($goods['spec_desc'] as $key => $val) {
                 $tmpRow = $objSpec->getFieldById($key, array('spec_name', 'spec_type', 'spec_show_type'));
                 $tmpGoods['spec_desc'][$key]['name'] = $tmpRow['spec_name'];
                 foreach ($val as $k => $v) {
                     if (empty($val[$k]['spec_image']) || is_null($val[$k]['spec_image'])) {
                         $tValue = $objSpec->getValueById($val[$k]['spec_value_id'], array('spec_image'));
                         $val[$k]['spec_image'] = $tValue['spec_image'];
                     }
                     if (empty($val[$k]['spec_image']) || is_null($val[$k]['spec_image'])) {
                         $val[$k]['spec_image'] = $specDefaultPic;
                     }
                     $goods['spec_desc'][$key][$k]['spec_type'] = $tmpRow['spec_type'];
                     $val[$k]['spec_type'] = $tmpRow['spec_type'];
                     $val[$k]['spec_goods_images'] = $key . "@" . $v['spec_goods_images'] . "|" . $k;
                     $spec_type = $tmpRow['spec_type'];
                 }
                 $tmpGoods['spec_desc'][$key]['value'] = $val;
             }
             $this->pagedata['goods']['specVdesc'] = $tmpGoods['spec_desc'];
         }
     }
     $this->pagedata['specname'] = $_POST['specname'];
     $this->pagedata['goods']['spec_desc_str'] = urlencode(serialize($goods['spec_desc']));
     $this->_editor($_POST['goods']['type_id']);
     $this->pagedata['goods']['taged'] = space_split($_POST['tags']);
     $this->pagedata['goodsbn_display_switch'] = $this->system->getConf('goodsbn.display.switch');
     if ($_POST['supplier_id']) {
         $this->pagedata['command_id'] = $_POST['command_id'];
         $this->pagedata['object_id'] = $_POST['object_id'];
         $this->pagedata['supplier_id'] = $_POST['supplier_id'];
     }
     if ($_POST['commandType']) {
         $this->pagedata['commandtype'] = $_POST['commandType'];
     }
     $this->display('product/detail/page.html');
 }
示例#6
0
function unSafeVar(&$data)
{
    if (is_array($data)) {
        foreach ($data as $key => $value) {
            unSafeVar($data[$key]);
        }
    } else {
        $data = stripslashes($data);
    }
}