Пример #1
0
    $smarty->assign('region', $region);
    $sql = "select a.district_id, a.district_name,a.province,a.city,a.county,a.sort,a.is_show, b.region_name as city_name, c.region_name as county_name from " . $GLOBALS['ecs']->table('virtual_goods_district') . " as a left join " . $GLOBALS['ecs']->table('region') . " as b on b.region_id = a.city" . " left join " . $GLOBALS['ecs']->table('region') . " as c on c.region_id = a.county  where district_id = {$district_id}";
    $district = $GLOBALS['db']->getRow($sql);
    $smarty->assign('district', $district);
    $smarty->assign('district_id', $district_id);
    $smarty->display('virtual_district_info.htm');
}
/* 添加商圈模板赋值 */
if ($_REQUEST['act'] == 'insert_district') {
    $district_id = empty($_REQUEST['district_id']) ? '' : intval($_REQUEST['district_id']);
    $province = empty($_REQUEST['add_province']) ? '' : intval($_REQUEST['add_province']);
    $city = empty($_REQUEST['add_city']) ? '' : intval($_REQUEST['add_city']);
    $county = empty($_REQUEST['add_county']) ? '' : intval($_REQUEST['add_county']);
    $is_show = empty($_REQUEST['is_show']) ? '' : intval($_REQUEST['is_show']);
    $district_name = empty($_REQUEST['district_name']) ? '' : trim($_REQUEST['district_name']);
    $sort = empty($_REQUEST['sort']) ? '1' : inval($_REQUEST['$sort']);
    if ($district_id == '') {
        $sql = "INSERT INTO " . $GLOBALS['ecs']->table('virtual_goods_district') . " (district_name, province, city,county,sort,is_show)  VALUES ('{$district_name}','{$province}','{$city}','{$county}','{$sort}','{$is_show}') ";
    } else {
        $sql = "UPDATE " . $GLOBALS['ecs']->table('virtual_goods_district') . "  set district_name = '{$district_name}', province = '{$province}',city ='{$city}',county='{$county}', sort='{$sort}',is_show='{$is_show}' where district_id = {$district_id}";
    }
    $GLOBALS['db']->query($sql);
    if ($GLOBALS['db']->errno() == 0) {
        $link[0] = array('text' => '继续添加新商圈', 'href' => 'virtual_goods.php?act=add_district');
        $link[1] = array('text' => '返回商圈列表', 'href' => 'virtual_goods.php?act=district');
        sys_msg('恭喜你,商圈添加成功', 0, $link);
    } else {
        make_json_error($GLOBALS['db']->errorMsg());
    }
}
/* 获取区域列表 */
Пример #2
0
 public function doWebDispatch()
 {
     global $_W, $_GPC;
     $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
     if ($operation == 'display') {
         $list = pdo_fetchall("SELECT * FROM " . tablename('hx_zhongchou_dispatch') . " WHERE weid = '{$_W['uniacid']}' ORDER BY displayorder DESC");
     } elseif ($operation == 'post') {
         $id = intval($_GPC['id']);
         if (checksubmit('submit')) {
             $data = array('weid' => $_W['uniacid'], 'displayorder' => intval($_GPC['dispatch_name']), 'dispatchtype' => intval($_GPC['dispatchtype']), 'dispatchname' => $_GPC['dispatchname'], 'express' => $_GPC['express'], 'firstprice' => $_GPC['firstprice'], 'firstweight' => $_GPC['firstweight'], 'secondprice' => $_GPC['secondprice'], 'secondweight' => $_GPC['secondweight'], 'description' => $_GPC['description'], 'enabled' => inval($_GPC['enabled']));
             if (!empty($id)) {
                 pdo_update('hx_zhongchou_dispatch', $data, array('id' => $id));
             } else {
                 pdo_insert('hx_zhongchou_dispatch', $data);
                 $id = pdo_insertid();
             }
             message('更新配送方式成功!', $this->createWebUrl('dispatch', array('op' => 'display')), 'success');
         }
         //修改
         $dispatch = pdo_fetch("SELECT * FROM " . tablename('hx_zhongchou_dispatch') . " WHERE id = '{$id}' and weid = '{$_W['uniacid']}'");
         $express = pdo_fetchall("select * from " . tablename('hx_zhongchou_express') . " WHERE weid = '{$_W['uniacid']}' ORDER BY displayorder DESC");
     } elseif ($operation == 'delete') {
         $id = intval($_GPC['id']);
         $dispatch = pdo_fetch("SELECT id  FROM " . tablename('hx_zhongchou_dispatch') . " WHERE id = '{$id}' AND weid=" . $_W['uniacid'] . "");
         if (empty($dispatch)) {
             message('抱歉,配送方式不存在或是已经被删除!', $this->createWebUrl('dispatch', array('op' => 'display')), 'error');
         }
         pdo_delete('hx_zhongchou_dispatch', array('id' => $id));
         message('配送方式删除成功!', $this->createWebUrl('dispatch', array('op' => 'display')), 'success');
     } else {
         message('请求方式不存在');
     }
     include $this->template('dispatch', TEMPLATE_INCLUDEPATH, true);
 }
 /**
  * Finds whether a variable $value is less than $number
  *
  * @param mixed $value
  * @param int $number
  * @return bool
  */
 public static function isLess($value, $number)
 {
     return inval($value) < intval($number);
 }
 /**
  *
  */
 public function hasLock($name)
 {
     $r = $this->selectOne("SELECT IS_FREE_LOCK('lck_{$name}', 10) AS r", 'r');
     return !inval($r);
 }
Пример #5
0
 /**
  * Parse un fichier de configuration
  * @exception Minz_PermissionDeniedException si le CONF_PATH_NAME n'est pas accessible
  * @exception Minz_BadConfigurationException si CONF_PATH_NAME mal formaté
  */
 private static function parseFile()
 {
     $ini_array = (include DATA_PATH . self::CONF_PATH_NAME);
     if (!is_array($ini_array)) {
         throw new Minz_PermissionDeniedException(DATA_PATH . self::CONF_PATH_NAME, Minz_Exception::ERROR);
     }
     // [general] est obligatoire
     if (!isset($ini_array['general'])) {
         throw new Minz_BadConfigurationException('[general]', Minz_Exception::ERROR);
     }
     $general = $ini_array['general'];
     // salt est obligatoire
     if (!isset($general['salt'])) {
         if (isset($general['sel_application'])) {
             //v0.6
             $general['salt'] = $general['sel_application'];
         } else {
             throw new Minz_BadConfigurationException('salt', Minz_Exception::ERROR);
         }
     }
     self::$salt = $general['salt'];
     if (isset($general['environment'])) {
         switch ($general['environment']) {
             case 'silent':
                 self::$environment = Minz_Configuration::SILENT;
                 break;
             case 'development':
                 self::$environment = Minz_Configuration::DEVELOPMENT;
                 break;
             case 'production':
                 self::$environment = Minz_Configuration::PRODUCTION;
                 break;
             default:
                 if ($general['environment'] >= 0 && $general['environment'] <= 2) {
                     // fallback 0.7-beta
                     self::$environment = $general['environment'];
                 } else {
                     throw new Minz_BadConfigurationException('environment', Minz_Exception::ERROR);
                 }
         }
     }
     if (isset($general['base_url'])) {
         self::$base_url = $general['base_url'];
     }
     if (isset($general['use_url_rewriting'])) {
         self::$use_url_rewriting = $general['use_url_rewriting'];
     }
     if (isset($general['title'])) {
         self::$title = $general['title'];
     }
     if (isset($general['language'])) {
         self::$language = $general['language'];
     }
     if (isset($general['cache_enabled'])) {
         self::$cache_enabled = $general['cache_enabled'];
         if (CACHE_PATH === false && self::$cache_enabled) {
             throw new FileNotExistException('CACHE_PATH', Minz_Exception::ERROR);
         }
     }
     if (isset($general['delay_cache'])) {
         self::$delay_cache = inval($general['delay_cache']);
     }
     if (isset($general['default_user'])) {
         self::$default_user = $general['default_user'];
     }
     if (isset($general['auth_type'])) {
         self::_authType($general['auth_type']);
     }
     if (isset($general['allow_anonymous'])) {
         self::$allow_anonymous = (bool) $general['allow_anonymous'] && $general['allow_anonymous'] !== 'no';
     }
     if (isset($general['allow_anonymous_refresh'])) {
         self::$allow_anonymous_refresh = (bool) $general['allow_anonymous_refresh'] && $general['allow_anonymous_refresh'] !== 'no';
     }
     // Base de données
     if (isset($ini_array['db'])) {
         $db = $ini_array['db'];
         if (empty($db['host'])) {
             throw new Minz_BadConfigurationException('host', Minz_Exception::ERROR);
         }
         if (empty($db['user'])) {
             throw new Minz_BadConfigurationException('user', Minz_Exception::ERROR);
         }
         if (!isset($db['password'])) {
             throw new Minz_BadConfigurationException('password', Minz_Exception::ERROR);
         }
         if (empty($db['base'])) {
             throw new Minz_BadConfigurationException('base', Minz_Exception::ERROR);
         }
         if (!empty($db['type'])) {
             self::$db['type'] = $db['type'];
         }
         self::$db['host'] = $db['host'];
         self::$db['user'] = $db['user'];
         self::$db['password'] = $db['password'];
         self::$db['base'] = $db['base'];
         if (isset($db['prefix'])) {
             self::$db['prefix'] = $db['prefix'];
         }
     }
 }
Пример #6
0
	/**
	 *  Deletes a category
	 *
	 *  @param  -   int     $id     The id
	 */
	function delete_category($id) {
        $id = intval($id);
		$sql = "SELECT id FROM ".Rsys :: getTable("item")." WHERE category_id=".inval($id)."";
		$result = Database::query($sql);
		if (Database::num_rows($result) == 0) {
			$sql2 = "DELETE FROM ".Rsys :: getTable("category")." WHERE id =".intval($id)."";
			Database::query($sql2);
			return 0;
		} else {
			return Database::num_rows($result);
		}

	}