當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IFilter類代碼示例

本文整理匯總了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('兌換成功');
 }
開發者ID:snamper,項目名稱:xiaoshuhaochi,代碼行數:25,代碼來源:method.php

示例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);
    }
}
開發者ID:snamper,項目名稱:xiaoshuhaochi,代碼行數:60,代碼來源:function.load_data.php

示例3: filter

 private static function filter($variable, IFilter $filter = null)
 {
     if ($filter === null) {
         return $variable;
     }
     return $filter->run($variable);
 }
開發者ID:educask,項目名稱:EducaskCore,代碼行數:7,代碼來源:Request.php

示例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;
 }
開發者ID:xzdesk,項目名稱:iwebshop.com,代碼行數:32,代碼來源:bank_alipay.php

示例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);
 }
開發者ID:snamper,項目名稱:xiaoshuhaochi,代碼行數:31,代碼來源:adminmethod.php

示例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);
 }
開發者ID:snamper,項目名稱:xiaoshuhaochi,代碼行數:25,代碼來源:adminmethod.php

示例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);
     }
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:36,代碼來源:systemseller.php

示例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);
     }
 }
開發者ID:zhendeguoke1008,項目名稱:shop,代碼行數:39,代碼來源:model.php

示例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();
 }
開發者ID:Wen1750686723,項目名稱:utao,代碼行數:29,代碼來源:brand.php

示例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);
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:11,代碼來源:view_action.php

示例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;
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:8,代碼來源:notice.php

示例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;
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:9,代碼來源:help.php

示例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;
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:9,代碼來源:article.php

示例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;
 }
開發者ID:yongge666,項目名稱:sunupedu,代碼行數:9,代碼來源:seller.php

示例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');
 }
開發者ID:chenyongze,項目名稱:iwebshop,代碼行數:11,代碼來源:sitehelp.php


注:本文中的IFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。