本文整理汇总了PHP中IFilter类的典型用法代码示例。如果您正苦于以下问题:PHP IFilter类的具体用法?PHP IFilter怎么用?PHP IFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exchangcard
function exchangcard()
{
$this->checkmemberlogin();
$card = trim(IFilter::act(IReq::get('card')));
$password = trim(IFilter::act(IReq::get('password')));
if (empty($card)) {
$this->message('充值卡号不能为空');
}
if (empty($password)) {
$this->message('充值卡密码不能为空');
}
$checkinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "card where card ='" . $card . "' and card_password = '" . $password . "' and uid =0 and status = 0");
if (empty($checkinfo)) {
$this->message('充值卡不存在或者已使用');
}
$arr['uid'] = $this->member['uid'];
$arr['status'] = 1;
$arr['username'] = $this->member['username'];
$this->mysql->update(Mysite::$app->config['tablepre'] . 'card', $arr, "card ='" . $card . "' and card_password = '" . $password . "' and uid =0 and status = 0");
//`$key`
$this->mysql->update(Mysite::$app->config['tablepre'] . 'member', '`cost`=`cost`+' . $checkinfo['cost'], "uid ='" . $this->member['uid'] . "' ");
$allcost = $this->member['cost'] + $checkinfo['cost'];
$this->memberCls->addlog($this->member['uid'], 2, 1, $checkinfo['cost'], '充值卡充值', '使用充值卡' . $checkinfo['card'] . '充值' . $checkinfo['cost'] . '元', $allcost);
$this->success('兑换成功');
}
示例2: smarty_function_load_data
function smarty_function_load_data($params, &$smarty)
{
(!isset($params['table']) || empty($params['table'])) && exit('`table` is empty!');
// $Mconfig = include(hopedir."config/hopeconfig.php");
// print_r($Mconfig);
$type = isset($params['type']) ? $params['type'] : 'list';
//total 总数量 one list 3个分类
$fileds = isset($params['fileds']) ? $params['fileds'] : '*';
$where = isset($params['where']) ? $params['where'] : '';
$where = empty($where) ? '' : ' where ' . $where;
$orderby = isset($params['orderby']) ? 'order by ' . $params['orderby'] : '';
$limit = isset($params['limit']) ? 'LIMIT 0,' . $params['limit'] : 'LIMIT 0,1';
if (!class_exists('mysql_class')) {
include hopedir . "lib/core/extend/mysql_class.php";
//core\extend
$mysql = new mysql_class();
} else {
$mysql = new mysql_class();
}
$page = intval(IFilter::act(IReq::get('page')));
$pagesize = intval(IFilter::act(IReq::get('pagesize')));
$pagesize = isset($params['pagesize']) ? $params['pagesize'] : $pagesize;
$pagesize = empty($pagesize) ? 10 : $pagesize;
// $db = $class::factory(array('table' => $params['table']));
//var_dump($params);
if (!empty($params['assign'])) {
//把数据赋值给变量$params['assign'],这样前端就可以使用这个变量了(例如可以结合foreach输出一个列表等)
// $smarty->assign($params['assign'], $db->get_block_list(array($params['where']), $params['limit']));
if ($type == 'total') {
$result = $mysql->counts("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . " " . $where . " " . $orderby . " " . $limit . "");
} elseif ($type == 'one') {
$result = $mysql->select_one("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . " " . $where . " " . $orderby . " " . $limit . "");
} else {
if (isset($params['showpage']) && $params['showpage'] == true) {
if (!class_exists('page')) {
include hopedir . "lib/core/extend/page.php";
//core\extend
$pageclass = new page();
} else {
$pageclass = new page();
}
$pageclass->setpage($page, $pagesize);
$result['list'] = $mysql->getarr("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . " " . $where . " " . $orderby . " limit " . $pageclass->startnum() . ", " . $pageclass->getsize() . "");
$shuliang = $mysql->counts("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . " " . $where . " ");
$pageclass->setnum($shuliang);
if (isset($params['pagetype'])) {
$result['pagecontent'] = $pageclass->ajaxbar($params['pagetype']);
} else {
$result['pagecontent'] = $pageclass->getpagebar();
}
} else {
$result['list'] = $mysql->getarr("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . " " . $where . " " . $orderby . " " . $limit . "");
}
}
/*
$result['list'] = array();
$result['pagecontent'] = ''; */
$smarty->assign($params['assign'], $result);
}
}
示例3: filter
private static function filter($variable, IFilter $filter = null)
{
if ($filter === null) {
return $variable;
}
return $filter->run($variable);
}
示例4: getSendData
/**
* @see paymentplugin::getSendData()
*/
public function getSendData($payment)
{
$defaultbank = IFilter::act(IReq::get('defaultbank'));
$return = array();
//基本参数
$return['service'] = 'create_direct_pay_by_user';
$return['partner'] = $payment['M_PartnerId'];
$return['seller_email'] = $payment['M_Email'];
$return['_input_charset'] = 'utf-8';
$return['payment_type'] = 1;
$return['return_url'] = $this->callbackUrl;
$return['notify_url'] = $this->serverCallbackUrl;
$return['defaultbank'] = $defaultbank;
$return['paymethod'] = 'bankPay';
//业务参数
$return['subject'] = $payment['R_Name'];
$return['out_trade_no'] = $payment['M_OrderNO'];
$return['total_fee'] = number_format($payment['M_Amount'], 2, '.', '');
//除去待签名参数数组中的空值和签名参数
$para_filter = $this->paraFilter($return);
//对待签名参数数组排序
$para_sort = $this->argSort($para_filter);
//生成签名结果
$mysign = $this->buildMysign($para_sort, $payment['M_PartnerKey']);
//签名结果与签名方式加入请求提交参数组中
$return['sign'] = $mysign;
$return['sign_type'] = 'MD5';
return $return;
}
示例5: savesingle
function savesingle()
{
$id = IReq::get('uid');
$data['addtime'] = strtotime(IReq::get('addtime') . ' 00:00:00');
$data['title'] = IReq::get('title');
$data['content'] = IReq::get('content');
$data['code'] = IReq::get('code');
$data['seo_key'] = IFilter::act(IReq::get('seo_key'));
$data['seo_content'] = IFilter::act(IReq::get('seo_content'));
if (empty($id)) {
$link = IUrl::creatUrl('adminpage/single/module/addsingle');
if (empty($data['content'])) {
$this->message('单页内容不能为空', $link);
}
if (empty($data['title'])) {
$this->message('单页标题不能为空', $link);
}
$this->mysql->insert(Mysite::$app->config['tablepre'] . 'single', $data);
} else {
$link = IUrl::creatUrl('single/addsingle/id/' . $id);
if (empty($data['content'])) {
$this->message('单页内容不能为空', $link);
}
if (empty($data['title'])) {
$this->message('单页标题不能为空', $link);
}
$this->mysql->update(Mysite::$app->config['tablepre'] . 'single', $data, "id='" . $id . "'");
}
$link = IUrl::creatUrl('adminpage/single/module/singlelist');
$this->success('操作成功', $link);
}
示例6: adminupload
public function adminupload()
{
$func = IFilter::act(IReq::get('func'));
$obj = IReq::get('obj');
$uploaddir = IFilter::act(IReq::get('dir'));
if (is_array($_FILES) && isset($_FILES['imgFile'])) {
$uploaddir = empty($uploaddir) ? 'goods' : $uploaddir;
$json = new Services_JSON();
$uploadpath = 'upload/' . $uploaddir . '/';
$filepath = '/upload/' . $uploaddir . '/';
$upload = new upload($uploadpath, array('gif', 'jpg', 'jpge', 'doc', 'png'));
//upload 自动生成压缩图片
$file = $upload->getfile();
if ($upload->errno != 15 && $upload->errno != 0) {
echo "<script>parent." . $func . "(true,'" . $obj . "','" . json_encode($upload->errmsg()) . "');</script>";
} else {
echo "<script>parent." . $func . "(false,'" . $obj . "','" . $filepath . $file[0]['saveName'] . "');</script>";
}
exit;
}
$data['obj'] = $obj;
$data['uploaddir'] = $uploaddir;
$data['func'] = $func;
Mysite::$app->setdata($data);
}
示例7: login
/**
* @brief 商家登录动作
*/
public function login()
{
$seller_name = IFilter::act(IReq::get('username'));
$password = IReq::get('password');
$message = '';
if ($seller_name == '') {
$message = '登录名不能为空';
} else {
if ($password == '') {
$message = '密码不能为空';
} else {
$sellerObj = new IModel('seller');
$sellerRow = $sellerObj->getObj('seller_name = "' . $seller_name . '" and is_del = 0 and is_lock = 0');
if ($sellerRow && $sellerRow['password'] == md5($password)) {
$dataArray = array('login_time' => ITime::getDateTime());
$sellerObj->setData($dataArray);
$where = 'id = ' . $sellerRow["id"];
$sellerObj->update($where);
//存入私密数据
ISafe::set('seller_id', $sellerRow['id']);
ISafe::set('seller_name', $sellerRow['seller_name']);
ISafe::set('seller_pwd', $sellerRow['password']);
$this->redirect('/seller/index');
} else {
$message = '用户名与密码不匹配';
}
}
}
if ($message != '') {
$this->redirect('index', false);
Util::showMessage($message);
}
}
示例8: _attribute_update
/**
* @brief 商品属性添加/修改
* @param array $attribute 表字段 数组格式,如Array ([name] => Array ( [0] => '' )
* [show_type] => Array ( [0] => '' )
* [value] => Array ( [0] => '' )
* [is_seach] => Array ( [0] => 1 ))
* @param int $model_id 模型编号
*/
public function _attribute_update($attribute, $model_id)
{
//初始化attribute商品模型属性表类对象
$attributeObj = new IModel('attribute');
$len = count($attribute['name']);
$ids = "";
for ($i = 0; $i < $len; $i++) {
if (IValidate::required($attribute['name'][$i]) && IValidate::required($attribute['value'][$i])) {
$options = str_replace(',', ',', $attribute['value'][$i]);
$type = isset($attribute['is_search'][$i]) ? $attribute['is_search'][$i] : 0;
//设置商品模型扩展属性 字段赋值
$filedData = array("model_id" => intval($model_id), "type" => IFilter::act($attribute['show_type'][$i]), "name" => IFilter::act($attribute['name'][$i]), "value" => rtrim(IFilter::act($options), ','), "search" => IFilter::act($type));
$attributeObj->setData($filedData);
$id = intval($attribute['id'][$i]);
if ($id) {
//更新商品模型扩展属性
$attributeObj->update("id = " . $id);
} else {
//新增商品模型扩展属性
$id = $attributeObj->add();
}
$ids .= $id . ',';
}
}
if ($ids) {
$ids = trim($ids, ',');
//删除商品模型扩展属性
$where = "model_id = {$model_id} and id not in (" . $ids . ") ";
$attributeObj->del($where);
}
}
示例9: brand_save
/**
* @brief 保存品牌
*/
function brand_save()
{
$brand_id = IFilter::act(IReq::get('brand_id'), 'int');
$name = IFilter::act(IReq::get('name'));
$sort = IFilter::act(IReq::get('sort'), 'int');
$url = IFilter::act(IReq::get('url'));
$description = IFilter::act(IReq::get('description'), 'text');
$tb_brand = new IModel('brand');
$brand = array('name' => $name, 'sort' => $sort, 'url' => $url, 'description' => $description);
if (isset($_FILES['logo']['name']) && $_FILES['logo']['name'] != '') {
$uploadObj = new PhotoUpload();
$uploadObj->setIterance(false);
$photoInfo = $uploadObj->run();
if (isset($photoInfo['logo']['img']) && file_exists($photoInfo['logo']['img'])) {
$brand['logo'] = $photoInfo['logo']['img'];
}
}
$tb_brand->setData($brand);
if ($brand_id) {
$where = "id=" . $brand_id;
$tb_brand->update($where);
} else {
$tb_brand->add();
}
$this->brand_list();
}
示例10: resolveView
/**
* @brief 解析视图路径
* @param string $viewPath 视图名称
*/
public function resolveView($viewPath)
{
$viewPath = IFilter::act($viewPath, 'filename');
//分割模板目录的层次
$view = strtr($viewPath, '-', '/');
$this->view = $this->basePath = $this->getController()->getViewFile($view);
}
示例11: getNoticeList
public function getNoticeList()
{
$page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
$query = new IQuery('announcement');
$query->order = 'id desc';
$query->page = $page;
return $query;
}
示例12: getHelpListByCatId
public function getHelpListByCatId($catId)
{
$page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
$query = new IQuery('help');
$query->where = "cat_id = " . $catId;
$query->order = 'sort desc,id desc';
$query->page = $page;
return $query;
}
示例13: getArticleListByCatid
public function getArticleListByCatid($category_id)
{
$page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
$query = new IQuery('article');
$query->where = 'category_id = ' . $category_id . ' and visibility = 1';
$query->order = 'id desc';
$query->page = $page;
return $query;
}
示例14: getSellerList
public function getSellerList()
{
$page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
$query = new IQuery('seller');
$query->where = 'is_del = 0';
$query->order = 'id desc';
$query->page = $page;
return $query;
}
示例15: help_del
public static function help_del($id)
{
if (!is_array($id)) {
$id = array($id);
}
$id = IFilter::act($id, 'int');
$id = implode(",", $id);
$tb_help = new IModel("help");
$tb_help->del("id IN ({$id})");
return array('flag' => true, 'data' => 'success');
}