本文整理汇总了PHP中IFilter::string方法的典型用法代码示例。如果您正苦于以下问题:PHP IFilter::string方法的具体用法?PHP IFilter::string怎么用?PHP IFilter::string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFilter
的用法示例。
在下文中一共展示了IFilter::string方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: member_filter
/**
* @brief 用户筛选
*/
function member_filter()
{
$search = IFilter::string(IReq::get('search'));
$keywords = IFilter::string(IReq::get('keywords'));
$where = ' 1 ';
if ($search && $keywords) {
$where .= " and {$search} like '%{$keywords}%' ";
}
$this->data['search'] = $search;
$this->data['keywords'] = $keywords;
$this->data['where'] = $where;
$tb_user_group = new IModel('user_group');
$data_group = $tb_user_group->query();
$data_group = is_array($data_group) ? $data_group : array();
$group = array();
foreach ($data_group as $value) {
$group[$value['id']] = $value['group_name'];
}
$this->data['group'] = $group;
$page = IReq::get('page');
$page = intval($page) ? intval($page) : 1;
$and = ' and ';
$where = 'm.status="1"' . $and;
$group_key = IFilter::string(IReq::get('group_key'));
$group_v = IFilter::act(IReq::get('group_value'), 'int');
if ($group_key && $group_v) {
if ($group_key == 'eq') {
$where .= "m.group_id='{$group_v}' {$and}";
} else {
$where .= "m.group_id!='{$group_v}' {$and} ";
}
}
$username_key = IFilter::string(IReq::get('username_key'));
$username_v = IFilter::act(IReq::get('username_value'), 'string');
if ($username_key && $username_v) {
if ($username_key == 'eq') {
$where .= "u.username='{$username_v}' {$and}";
} else {
$where .= 'u.username like "%' . $username_v . '%"' . $and;
}
}
$truename_key = IFilter::string(IReq::get('truename_key'));
$truename_v = IFilter::act(IReq::get('truename_value'), 'string');
if ($truename_key && $truename_v) {
if ($truename_key == 'eq') {
$where .= "m.true_name='{$truename_v}' {$and}";
} else {
$where .= 'm.true_name like "%' . $truename_v . '%"' . $and;
}
}
$mobile_key = IFilter::string(IReq::get('mobile_key'));
$mobile_v = IFilter::act(IReq::get('mobile_value'), 'string');
if ($mobile_key && $mobile_v) {
if ($mobile_key == 'eq') {
$where .= "m.mobile='{$mobile_v}' {$and} ";
} else {
$where .= 'm.mobile like "%' . $mobile_v . '%"' . $and;
}
}
$telephone_key = IFilter::string(IReq::get('telephone_key'));
$telephone_v = IFilter::act(IReq::get('telephone_value'), 'string');
if ($telephone_key && $telephone_v) {
if ($telephone_key == 'eq') {
$where .= "m.telephone='{$telephone_v}' {$and} ";
} else {
$where .= 'm.telephone like "%' . $telephone_v . '%"' . $and;
}
}
$email_key = IFilter::string(IReq::get('email_key'));
$email_v = IFilter::act(IReq::get('email_value'), 'string');
if ($email_key && $email_v) {
if ($email_key == 'eq') {
$where .= "u.email='{$email_v}' {$and} ";
} else {
$where .= 'u.email like "%' . $email_v . '%"' . $and;
}
}
$zip_key = IFilter::string(IReq::get('zip_key'));
$zip_v = IFilter::act(IReq::get('zip_value'), 'string');
if ($zip_key && $zip_v) {
if ($zip_key == 'eq') {
$where .= "m.zip='{$zip_v}' {$and} ";
} else {
$where .= 'm.zip like "%' . $zip_v . '%"' . $and;
}
}
$sex = intval(IReq::get('sex'));
if ($sex && $sex != '-1') {
$where .= 'm.sex=' . $sex . $and;
}
$point_key = IFilter::string(IReq::get('point_key'));
$point_v = intval(IReq::get('point_value'));
if ($point_key && $point_v) {
if ($point_key == 'eq') {
$where .= 'm.point= "' . $point_v . '"' . $and;
} elseif ($point_key == 'gt') {
$where .= 'm.point > "' . $point_v . '"' . $and;
//.........这里部分代码省略.........
示例2: member_list
/**
* @brief 会员列表
*/
function member_list()
{
$search = IFilter::string(IReq::get('search'));
$keywords = IFilter::string(IReq::get('keywords'));
$where = ' 1 ';
if ($search && $keywords) {
$where .= " and {$search} like '%{$keywords}%' ";
}
$this->data['search'] = $search;
$this->data['keywords'] = $keywords;
$this->data['where'] = $where;
$tb_user_group = new IModel('user_group');
$data_group = $tb_user_group->query();
$group = array();
foreach ($data_group as $value) {
$group[$value['id']] = $value['group_name'];
}
$this->data['group'] = $group;
$this->setRenderData($this->data);
$this->redirect('member_list');
}
示例3: message_send
/**
* @brief 发送信件
*/
function message_send()
{
$where = ' 1 ';
$tb_user_group = new IModel('user_group');
$tb_user = new IModel('user');
$data_group = $tb_user_group->query();
$data_group = is_array($data_group) ? $data_group : array();
$group = array();
foreach ($data_group as $value) {
$group[$value['id']] = $value['group_name'];
}
$and = ' and ';
$where = '`status`="1"' . $and;
$group_key = IFilter::act(IReq::get('group_key', 'post'), 'string');
$group_v = IFilter::act(IReq::get('group_value', 'post'), 'int');
if ($group_key && $group_v) {
if ($group_key == 'eq') {
$where .= "group_id='{$group_v}' {$and}";
} else {
$where .= "group_id!='{$group_v}' {$and} ";
}
}
$truename_key = IFilter::string(IReq::get('truename_key', 'post'));
$truename_v = IFilter::act(IReq::get('truename_value', 'post'), 'string');
if ($truename_key && $truename_v) {
if ($truename_key == 'eq') {
$where .= "true_name='{$truename_v}' {$and}";
} else {
$where .= 'true_name like "%' . $truename_v . '%"' . $and;
}
}
$mobile_key = IFilter::string(IReq::get('mobile_key', 'post'));
$mobile_v = IFilter::act(IReq::get('mobile_value', 'post'), 'string');
if ($mobile_key && $mobile_v) {
if ($mobile_key == 'eq') {
$where .= "mobile='{$mobile_v}' {$and} ";
} else {
$where .= 'mobile like "%' . $mobile_v . '%"' . $and;
}
}
$telephone_key = IFilter::string(IReq::get('telephone_key', 'post'));
$telephone_v = IFilter::act(IReq::get('telephone_value', 'post'), 'string');
if ($telephone_key && $telephone_v) {
if ($telephone_key == 'eq') {
$where .= "telephone='{$telephone_v}' {$and} ";
} else {
$where .= 'telephone like "%' . $telephone_v . '%"' . $and;
}
}
$username_key = IFilter::string(IReq::get('username_key', 'post'));
$username_v = IFilter::act(IReq::get('username_value', 'post'), 'string');
$user_ids = array();
if ($username_key && $username_v) {
if ($username_key == 'eq') {
$sql = "username='{$username_v}' ";
} else {
$sql = 'username like "%' . $username_v . '%"';
}
$tmp = $tb_user->query($sql);
if ($tmp) {
foreach ($tmp as $value) {
$user_ids[] = $value['id'];
}
}
}
$email_key = IFilter::string(IReq::get('email_key', 'post'));
$email_v = IFilter::act(IReq::get('email_value', 'post'), 'string');
if ($email_key && $email_v) {
if ($email_key == 'eq') {
$sql = "email='{$email_v}' ";
} else {
$sql = 'email like "%' . $email_v . '%"';
}
$tmp = $tb_user->query($sql);
if ($tmp) {
foreach ($tmp as $value) {
$user_ids[] = $value['id'];
}
}
}
if ($user_ids) {
$where .= "user_id IN (" . implode(',', $user_ids) . ") {$and}";
}
$zip_key = IFilter::string(IReq::get('zip_key', 'post'));
$zip_v = IFilter::act(IReq::get('zip_value', 'post'), 'string');
if ($zip_key && $zip_v) {
if ($zip_key == 'eq') {
$where .= "zip='{$zip_v}' {$and} ";
} else {
$where .= 'zip like "%' . $zip_v . '%"' . $and;
}
}
$sex = intval(IReq::get('sex', 'post'));
if ($sex && $sex != '-1') {
$where .= 'sex=' . $sex . $and;
}
$point_key = IFilter::string(IReq::get('point_key', 'post'));
//.........这里部分代码省略.........
示例4: role_edit_act
function role_edit_act()
{
$id = IFilter::act(IReq::get('id', 'post'));
$roleObj = new IModel('admin_role');
//要入库的数据
$dataArray = array('id' => $id, 'name' => IFilter::string(IReq::get('name', 'post')), 'rights' => null);
//检查权限码是否为空
$rights = IFilter::act(IReq::get('right', 'post'));
if (empty($rights) || $rights[0] == '') {
$this->roleRow = $dataArray;
$this->redirect('role_edit', false);
Util::showMessage('请选择要分配的权限');
}
//拼接权限码
$rightsArray = array();
$rightObj = new IModel('right');
$rightList = $rightObj->query('id in (' . join(",", $rights) . ')', '`right`');
foreach ($rightList as $key => $val) {
$rightsArray[] = trim($val['right'], ',');
}
$dataArray['rights'] = empty($rightsArray) ? '' : ',' . join(',', $rightsArray) . ',';
$roleObj->setData($dataArray);
if ($id) {
$where = 'id = ' . $id;
$roleObj->update($where);
} else {
$roleObj->add();
}
$this->redirect('role_list');
}
示例5: refer_reply
/**
* @brief 回复咨询信息
*/
function refer_reply()
{
$rid = intval(IReq::get('refer_id', 'post'));
$content = IReq::get('content');
if ($rid && $content) {
$content = IFilter::string($content, true);
$tb_refer = new IModel('refer');
$admin_id = $this->admin['admin_id'];
//管理员id
$data = array('answer' => $content, 'reply_time' => date('Y-m-d H:i:s'), 'admin_id' => $admin_id, 'status' => 1);
$tb_refer->setData($data);
$tb_refer->update("id=" . $rid);
}
$this->refer_list();
}
示例6: integral
function integral()
{
/*获取积分增减的记录日期时间段*/
$this->historyTime = IFilter::string(IReq::get('history_time', 'post'));
$defaultMonth = 3;
//默认查找最近3个月内的记录
$lastStamp = ITime::getTime(ITime::getNow('Y-m-d')) - 3600 * 24 * 30 * $defaultMonth;
$lastTime = ITime::getDateTime('Y-m-d', $lastStamp);
if ($this->historyTime != null && $this->historyTime != 'default') {
$historyStamp = ITime::getDateTime('Y-m-d', $lastStamp - 3600 * 24 * 30 * $this->historyTime);
$this->c_datetime = 'datetime >= "' . $historyStamp . '" and datetime < "' . $lastTime . '"';
} else {
$this->c_datetime = 'datetime >= "' . $lastTime . '"';
}
$memberObj = new IModel('member');
$where = 'user_id = ' . $this->user['user_id'];
$this->memberRow = $memberObj->getObj($where, 'point');
$this->redirect('integral', false);
}
示例7: ship_info_update
/**
* @brief 保存添加/修改发货信息
*/
public function ship_info_update()
{
// 获取POST数据
$id = IFilter::act(IReq::get('sid'), 'int');
$ship_name = IFilter::act(IReq::get('ship_name'));
$ship_user_name = IFilter::act(IReq::get('ship_user_name'));
$sex = IFilter::act(IReq::get('sex'), 'int');
$province = IFilter::act(IReq::get('province'), 'int');
$city = IFilter::act(IReq::get('city'), 'int');
$area = IFilter::act(IReq::get('area'), 'int');
$address = IFilter::act(IReq::get('address'));
$postcode = IFilter::act(IReq::get('postcode'), 'int');
$mobile = IFilter::act(IReq::get('mobile'));
$telphone = IFilter::act(IReq::get('telphone'));
$is_default = IFilter::act(IReq::get('is_default'), 'int');
//过滤string
$ship_name = IFilter::string($ship_name, true);
$ship_user_name = IFilter::string($ship_user_name, true);
$address = IFilter::string($address, true);
if ($telphone) {
$telphone = IFilter::string($telphone, true);
}
$tb_merch_ship_info = new IModel('merch_ship_info');
//判断是否已经有了一个默认地址
if (isset($is_default) && $is_default == 1) {
$tb_ship_info = new IQuery('merch_ship_info');
$tb_ship_info->fields = 'id,is_default';
$tb_ship_info->where = 'is_default=1';
$merch_ship_info = $tb_ship_info->find();
if (count($merch_ship_info) > 0) {
foreach ($merch_ship_info as $value) {
$sid = $value['id'];
$tb_merch_ship_info->setData(array('is_default' => 0));
$tb_merch_ship_info->update('id=' . $sid);
}
}
}
//设置存储数据
$arr['ship_name'] = $ship_name;
$arr['ship_user_name'] = $ship_user_name;
$arr['sex'] = $sex;
$arr['province'] = $province;
$arr['city'] = $city;
$arr['area'] = $area;
$arr['address'] = $address;
$arr['postcode'] = $postcode;
$arr['mobile'] = $mobile;
$arr['telphone'] = $telphone;
$arr['is_default'] = $is_default;
$arr['is_del'] = 1;
$tb_merch_ship_info->setData($arr);
//判断是添加还是修改
if ($id) {
$tb_merch_ship_info->update('id=' . $id);
} else {
$tb_merch_ship_info->add();
}
$this->redirect('ship_info_list');
}
示例8: ship_info_default
/**
* @brief 设置发货信息的默认值
*/
public function ship_info_default()
{
$id = IFilter::act(IReq::get('id'), 'int');
$default = IFilter::string(IReq::get('default'));
$tb_merch_ship_info = new IModel('merch_ship_info');
if ($default == 1) {
$tb_merch_ship_info->setData(array('is_default' => 0));
$tb_merch_ship_info->update("seller_id = 0");
}
$tb_merch_ship_info->setData(array('is_default' => $default));
$tb_merch_ship_info->update("id = " . $id . " and seller_id = 0");
$this->redirect('ship_info_list');
}
示例9: notify_filter
/**
* @brief 到货通知筛选
*/
function notify_filter()
{
$search = IReq::get('search');
$keywords = IReq::get('keywords');
$where = ' 1 ';
if ($search && $keywords) {
$where .= " and {$search} like '%{$keywords}%' ";
}
$this->data['search'] = $search;
$this->data['keywords'] = $keywords;
$this->data['where'] = $where;
$page = IReq::get('page');
$page = intval($page) ? intval($page) : 1;
$and = ' and ';
$where = '';
$goodsname_k = IFilter::string(IReq::get('goodsname_k'));
$goodsname_v = IFilter::string(IReq::get('goodsname_v'));
if ($goodsname_k && $goodsname_v) {
if ($goodsname_k == 'eq') {
$where .= 'goods.name="' . $goodsname_v . '"' . $and;
} else {
$where .= 'goods.name like "%' . $goodsname_v . '%"' . $and;
}
}
$username_k = IFilter::string(IReq::get('username_k'));
$username_v = IFilter::string(IReq::get('username_v'));
if ($username_k && $username_v) {
if ($username_k == 'eq') {
$where .= 'u.username="' . $username_v . '"' . $and;
} else {
$where .= 'u.username like "%' . $username_v . '%"' . $and;
}
}
$store_nums_k = IFilter::string(IReq::get('store_nums_k'));
$stror_nums_v = intval(IReq::get('store_nums_v')) ? intval(IReq::get('store_nums_v')) : 0;
if ($store_nums_k) {
if ($store_nums_k == 'gt') {
$where .= 'goods.store_nums > "' . $stror_nums_v . '"' . $and;
} elseif ($store_nums_k == 'eq') {
$where .= 'goods.store_nums = "' . $stror_nums_v . '"' . $and;
} else {
$where .= 'goods.store_nums < "' . $stror_nums_v . '"' . $and;
}
}
$email_k = IFilter::string(IReq::get('email_k'));
$email_v = IFilter::string(IReq::get('email_v'));
if ($email_k && $email_v) {
if ($email_k == 'gt') {
$where .= 'notify.email = "' . $email_v . '"' . $and;
} else {
$where .= 'notify.email like "%' . $email_v . '%"' . $and;
}
}
$regtimeBegin = IFilter::string(IReq::get('regtimeBegin'));
if ($regtimeBegin) {
$where .= 'notify.register_time > "' . $regtimeBegin . '"' . $and;
}
$regtimeEnd = IFilter::string(IReq::get('regtimeEnd'));
if ($regtimeEnd) {
$where .= 'notify.register_time < "' . $regtimeEnd . '"' . $and;
}
$status = intval(IReq::get('status'));
if ($status && $status != '-1') {
$where .= 'notify.notify_status = "' . $status . '"' . $and;
}
$where .= ' 1 ';
$query = new IQuery("notify_registry as notify");
$query->join = "join goods as goods on notify.goods_id = goods.id left join user as u on notify.user_id = u.id";
$query->fields = "notify.*,u.username,goods.name as goods_name,goods.store_nums";
$query->page = $page;
$query->where = $where;
$this->data['list_items'] = $query->find();
//debug($this->data['items']);
$this->data['pageBar'] = $query->getPageBar('/message/notify_filter/');
$this->setRenderData($this->data);
$this->redirect('notify_filter');
}
示例10: applySkin
function applySkin()
{
$skin = IFilter::string(IReq::get('skin'));
if ($skin != null) {
$data = array('skin' => $skin);
Config::edit('config/config.php', $data);
}
$this->clearCache();
$this->redirect('conf_ui');
}
示例11: applySkin
function applySkin()
{
$skin = IFilter::string(IReq::get('skin'));
$theme = IFilter::string(IReq::get('theme'));
if ($theme && $skin) {
Common::applySkin($theme, $skin);
}
$this->redirect('conf_ui');
}