当前位置: 首页>>代码示例>>PHP>>正文


PHP module_security::filter_data_set方法代码示例

本文整理汇总了PHP中module_security::filter_data_set方法的典型用法代码示例。如果您正苦于以下问题:PHP module_security::filter_data_set方法的具体用法?PHP module_security::filter_data_set怎么用?PHP module_security::filter_data_set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在module_security的用法示例。


在下文中一共展示了module_security::filter_data_set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_users

 public static function get_users($search = array(), $mysql = false)
 {
     // limit based on customer id
     /*if(!isset($_REQUEST['customer_id']) || !(int)$_REQUEST['customer_id']){
     			return array();
     		}*/
     // build up a custom search sql query based on the provided search fields
     $sql = "SELECT *,u.user_id AS id ";
     $sql .= ", u.name AS name ";
     $from = " FROM `" . _DB_PREFIX . "user` u ";
     $where = " WHERE 1 ";
     $where .= " AND ( (u.customer_id = 0 OR u.customer_id IS NULL) AND (u.vendor_id = 0 OR u.vendor_id IS NULL)) ";
     if (isset($search['generic']) && $search['generic']) {
         $str = mysql_real_escape_string($search['generic']);
         $where .= " AND ( ";
         $where .= " u.name LIKE '%{$str}%' OR ";
         $where .= " u.email LIKE '%{$str}%' OR ";
         $where .= " u.phone LIKE '%{$str}%' OR ";
         $where .= " u.mobile LIKE '%{$str}%' ";
         $where .= ' ) ';
     }
     if (isset($search['customer_id']) && $search['customer_id']) {
         /*$str = mysql_real_escape_string($search['customer_id']);
         		$where .= " AND u.customer_id = '$str'";
                    $sql .= " , c.primary_user_id AS is_primary ";
                    $from .= " LEFT JOIN `"._DB_PREFIX."customer` c ON u.customer_id = c.customer_id ";*/
         set_error('Bad usage of get_user() - please report this error.');
         return array();
     }
     if (isset($search['security_role_id']) && (int) $search['security_role_id'] > 0) {
         $str = (int) $search['security_role_id'];
         $from .= " LEFT JOIN `" . _DB_PREFIX . "user_role` ur ON u.user_id = ur.user_id";
         $where .= " AND ur.security_role_id = {$str}";
     }
     foreach (array('email') as $key) {
         if (isset($search[$key]) && $search[$key] !== '' && $search[$key] !== false) {
             $str = mysql_real_escape_string($search[$key]);
             $where .= " AND u.`{$key}` LIKE '{$str}'";
         }
     }
     foreach (array('is_staff', 'split_hours') as $key) {
         if (isset($search[$key]) && $search[$key] !== '' && $search[$key] !== false) {
             $str = mysql_real_escape_string($search[$key]);
             $where .= " AND u.`{$key}` = '{$str}'";
         }
     }
     if (class_exists('module_customer', false)) {
         switch (module_user::get_user_data_access()) {
             case _USER_ACCESS_ALL:
                 // all user accounts.
                 break;
             case _USER_ACCESS_ME:
                 $where .= " AND u.`user_id` = " . (int) module_security::get_loggedin_id();
                 break;
             case _USER_ACCESS_CONTACTS:
                 $where .= " AND u.`customer_id` > 0 ";
                 break;
         }
         /*switch(module_customer::get_customer_data_access()){
               case _CUSTOMER_ACCESS_ALL:
                   // all customers! so this means all jobs!
                   break;
               case _CUSTOMER_ACCESS_CONTACTS:
               case _CUSTOMER_ACCESS_TASKS:
               case _CUSTOMER_ACCESS_STAFF:
                   $valid_customer_ids = module_security::get_customer_restrictions();
                   if(count($valid_customer_ids)){
                       $where .= " AND u.customer_id IN ( ";
                       foreach($valid_customer_ids as $valid_customer_id){
                           $where .= (int)$valid_customer_id.", ";
                       }
                       $where = rtrim($where,', ');
                       $where .= " )";
                   }
           }*/
     }
     $group_order = ' GROUP BY u.user_id ORDER BY u.name';
     // stop when multiple company sites have same region
     $sql = $sql . $from . $where . $group_order;
     if ($mysql) {
         return query($sql);
     }
     $result = qa($sql);
     module_security::filter_data_set("user", $result);
     return $result;
     //		return get_multiple("user",$search,"user_id","fuzzy","name");
 }
开发者ID:sgh1986915,项目名称:php-crm,代码行数:87,代码来源:user.php


注:本文中的module_security::filter_data_set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。