Example #1
0
 function actionDeliveryDetailList()
 {
     //过滤语句
     $using = new class_using();
     $request = $using->safeUsing('request', 'controller:string,action:string');
     $this->_model =& FLEA::getSingleton('model_rep');
     //出货表
     $rep = $this->_model->find(array('ID' => $request['kcreport'], 'ID' => $request['actionDeliveryDetailList']));
     if ($rep) {
         $this->_model =& FLEA::getSingleton('model_grid');
         //表字段
         $grid = $this->_model->findAll(array('RepID' => $rep['ID']));
         //设置查询语句
         $dbo =& FLEA::getDBO();
         $this->sql = $rep['select FCustomerCode,FCustomerName,FDate,FSODate from v_delivery'];
         //查询条件-按日期查询
         ///此处可修改>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
         $cond = new class_conditions();
         $formdate = isset($request['formdate']) ? $request['formdate'] : date("Y-m-d");
         $todate = isset($request['todate']) ? $request['todate'] : date("Y-m-d");
         $FCustomer = isset($request['FCustomer']) ? trim($this->u2gbk($request['FCustomer'])) : null;
         $cond->between($formdate, $todate, 'FDate', 'D', 2);
         $cond->equal($FCustomer, 'FCustomerCode', 'S', ' and ');
         ///此处可修改<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
         //排序
         $order = new class_order($request);
         //获取当前页
         $page['cid'] = isset($request['pageNum']) && intval($request['pageNum']) > 0 ? intval($request['pageNum']) : 1;
         $page['size'] = isset($request['numPerPage']) && intval($request['numPerPage']) > 0 ? intval($request['numPerPage']) : 20;
         echo $this->sql;
         //获取SQL查询的全部记录
         $alldata = $dbo->getAll($this->sql . $cond->getWhere() . $order->getOrder());
         //获取SQL查询的记录总数
         $page['count'] = count($alldata);
         //$allFProfit =$this->_count($alldata,'FProfit');
         //$allFSaleAmount =$this->_count($alldata,'FSaleAmount');
         //记录偏移量
         $page['offset'] = ($page['cid'] - 1) * $page['size'] > $page['count'] ? $page['count'] : ($page['cid'] - 1) * $page['size'];
         $data = array_slice($alldata, $page['offset'], $page['size'], true);
         //处理查询结果
         if (isset($data)) {
             ///此处可修改>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
             $this->_smarty->assign('formdate', $formdate);
             $this->_smarty->assign('todate', $todate);
             $this->_smarty->assign('FCustomer', $FCustomer);
             ///此处可修改<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
             $this->_smarty->assign('orderField', $order->getField());
             $this->_smarty->assign('orderDirection', $order->getDirection());
             $this->_smarty->assign('page', $page);
             $this->_smarty->assign('data', $data);
             $this->_smarty->assign('grid', $grid);
             $this->_smarty->assign('alldata', $alldata);
             $this->_smarty->assign('allFProfit', $allFProfit);
             $this->_smarty->assign('allFSaleAmount', $allFSaleAmount);
             $this->_smarty->display('kc.DeliveryDetailList.htm');
         }
     } else {
         $this->_smarty->display('norepinfo.htm');
     }
 }
Example #2
0
 /**
  * 登录
  */
 function actionLogin()
 {
     do {
         /**
          * 验证用户名和密码是否正确
          */
         $modelSysUsers =& FLEA::getSingleton('Model_SysUsers');
         $user = $modelSysUsers->findByUsername($_POST['username']);
         if (!$user) {
             $msg = _T('ui_l_invalid_username');
             break;
         }
         if (!$modelSysUsers->checkPassword($_POST['password'], $user['password'])) {
             $msg = _T('ui_l_invalid_password');
             break;
         }
         /**
          * 登录成功,通过 RBAC 保存用户信息和角色
          */
         $data = array();
         $data['ADMIN'] = $user['username'];
         $rbac =& FLEA::getSingleton('FLEA_Rbac');
         /* @var $rbac FLEA_Rbac */
         $rbac->setUser($data, array('SYSTERM_ADMIN'));
         //重定向
         redirect(url('ZobAdmin'));
     } while (false);
     //登录发生错误,再次显示登录界面
     $ui =& FLEA::initWebControls();
     include APP_DIR . '/ZobLoginIndex.php';
 }
Example #3
0
/**
 * 根据应用程序设置 'urlMode' 分析 $_GET 参数
 *
 * 该函数由框架自动调用,应用程序不需要调用该函数。
 */
function ___uri_filter()
{
    static $firstTime = true;
    if (!$firstTime) {
        return;
    }
    $firstTime = false;
    $pathinfo = !empty($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : (!empty($_SERVER['ORIG_PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : '');
    $parts = explode('/', substr($pathinfo, 1));
    if (isset($parts[0]) && strlen($parts[0])) {
        $_GET[FLEA::getAppInf('controllerAccessor')] = $parts[0];
    }
    if (isset($parts[1]) && strlen($parts[1])) {
        $_GET[FLEA::getAppInf('actionAccessor')] = $parts[1];
    }
    $style = FLEA::getAppInf('urlParameterPairStyle');
    if ($style == '/') {
        for ($i = 2; $i < count($parts); $i += 2) {
            if (isset($parts[$i + 1])) {
                $_GET[$parts[$i]] = $parts[$i + 1];
            }
        }
    } else {
        for ($i = 2; $i < count($parts); $i++) {
            $p = $parts[$i];
            $arr = explode($style, $p);
            if (isset($arr[1])) {
                $_GET[$arr[0]] = $arr[1];
            }
        }
    }
    // 将 $_GET 合并到 $_REQUEST,
    // 有时需要使用 $_REQUEST 统一处理 url 中的 id=? 这样的参数
    $_REQUEST = array_merge($_REQUEST, $_GET);
}
Example #4
0
 function actionDeliveryDetail()
 {
     //过滤语句
     $using = new class_using();
     $request = $using->safeUsing('get', 'controller:string,action:string');
     //设置查询语句
     $dbo =& FLEA::getDBO();
     $this->sql = 'select FCustomerCode,FCustomerName,FDate,FAmount,FAllAmount from v_delivery';
     //查询条件-按日期查询
     $cond = new class_conditions();
     $formdate = isset($request['formdate']) ? $request['formdate'] : date("Y-m-d");
     $todate = isset($request['todate']) ? $request['todate'] : date("Y-m-d");
     $FCustomer = isset($request['FCustomer']) ? trim(rawurldecode($request['FCustomer'])) : null;
     $cond->equal($FCustomer, 'FCustomerCode', 'S', ' and ');
     $cond->between($formdate, $todate, 'fdate', 'D', 2);
     //排序
     $order = new class_order($request);
     //获取SQL查询的全部记录
     $alldata = $dbo->getAll($this->sql . $cond->getWhere() . $order->getOrder());
     $xls = new class_excel();
     $xls->addArray($this->gethead($alldata));
     $xls->addArray($this->getdata($alldata));
     $xls->addArray($this->getfoot($alldata));
     $xls->generateXML("DeliveryDetail");
 }
Example #5
0
 /**
  * 显示左侧菜单
  */
 function actionSidebar()
 {
     // 首先定义菜单
     $catalog = FLEA::loadFile('Config_Menu.php');
     // 借助 FLEA_Dispatcher_Auth 对用户角色和控制器 ACT 进行验证
     $dispatcher =& $this->_getDispatcher();
     include APP_DIR . '/ZobSidebar.php';
 }
Example #6
0
/**
 * 显示异常信息及调用堆栈
 *
 * @param FLEA_Exception $ex
 */
function __error_dump_trace($ex)
{
    echo '<strong>Exception: </strong>' . get_class($ex) . "<br />\n";
    if ($ex->getMessage() != '') {
        echo '<strong>Message: </strong>' . $ex->getMessage() . "<br />\n";
    }
    echo "<br />\n";
    if (!FLEA::getAppInf('displaySource')) {
        return;
    }
    $trace = $ex->getTrace();
    $ix = count($trace);
    foreach ($trace as $point) {
        $file = isset($point['file']) ? $point['file'] : null;
        $line = isset($point['line']) ? $point['line'] : null;
        $id = md5("{$file}({$line})");
        $function = isset($point['class']) ? "{$point['class']}::{$point['function']}" : $point['function'];
        $args = array();
        if (is_array($point['args']) && count($point['args']) > 0) {
            foreach ($point['args'] as $arg) {
                switch (gettype($arg)) {
                    case 'array':
                        $args[] = 'array(' . count($arg) . ')';
                        break;
                    case 'resource':
                        $args[] = gettype($arg);
                        break;
                    case 'object':
                        $args[] = get_class($arg);
                        break;
                    case 'string':
                        if (strlen($arg) > 30) {
                            $arg = substr($arg, 0, 27) . ' ...';
                        }
                        $args[] = "'{$arg}'";
                        break;
                    default:
                        $args[] = $arg;
                }
            }
        }
        $args = implode(", ", $args);
        echo <<<EOT
<hr />
<strong>Filename:</strong> <a href="javascript:switch_filedesc('{$id}');">{$file} [{$line}]</a><br />
#{$ix} {$function}({$args})
<div id="{$id}" class="filedesc" style="display: none;">
ARGS:
EOT;
        dump($point['args']);
        echo "SOURCE CODE: <br />\n";
        echo __error_show_source($file, $line);
        echo "\n</div>\n";
        echo "<br />\n";
        $ix--;
    }
}
 public function socketconn($ip, $port)
 {
     $_G = FLEA::getSingleton("Util_Msg");
     $this->socket = @fsockopen($ip, $port, $errNo, $errstr, 30);
     if (!$this->socket) {
         $_G->customshow("建立Socket连接失败", "socket", "Index", 3, 0);
         exit;
     }
 }
Example #8
0
 /**
  * 构造函数
  *
  * @return Controller_Default
  */
 function Controller_Default()
 {
     /**
      * FLEA::getSingleton() 会自动载入指定类的定义文件,并且返回该类的唯一一个实例
      */
     $this->_metas =& FLEA::getAppInf('metas');
     $this->_modelNews =& FLEA::getSingleton('Model_News');
     $this->_modelMessage =& FLEA::getSingleton('Model_Message');
     $this->_modelGoods =& FLEA::getSingleton('Model_Goods');
 }
Example #9
0
 function actionlookup()
 {
     $this->_model =& FLEA::getSingleton('model_depart');
     $departs = $this->_model->findAll();
     //通用生成树函数
     //@param:$arrs 树结构数组
     //@param:$keyparam  显示的字段 例如:array('code','name') ,节点将显示“ 编码-名称” 形式
     //@param:$$outparam 双击节点带回数值的字段
     function maketree($arrs, $keyparam, $outparam)
     {
         if (isset($arrs) && is_array($arrs)) {
             foreach ($arrs as $arr) {
                 echo '<li>';
                 echo '<a ';
                 if (isset($outparam) && is_array($outparam)) {
                     echo 'ondblclick=\'javascript:$.bringBack({';
                     for ($i = 0; $i < count($outparam); $i++) {
                         if ($i > 0) {
                             echo ',';
                         }
                         echo $outparam[$i] . ':"' . $arr[$outparam[$i]] . '"';
                     }
                     echo '})\' title="双击选中" ';
                 }
                 echo '>';
                 if (isset($keyparam) && is_array($keyparam)) {
                     for ($i = 0; $i < count($keyparam); $i++) {
                         if ($i > 0) {
                             echo '-';
                         }
                         echo $arr[$keyparam[$i]];
                     }
                 }
                 echo '</a>';
                 if (isset($arr['child'])) {
                     echo '<ul>';
                     maketree($arr['child'], $keyparam, $outparam);
                     echo '</ul>';
                 }
                 echo '</li>';
             }
         }
     }
     if (isset($departs)) {
         //生成部门树结构
         $tree = new class_tree($departs);
         $departs = $tree->leaf(0);
         //设置参数
         $this->_smarty->assign('arrs', $departs);
         $this->_smarty->assign('keyparam', array('code', 'name'));
         $this->_smarty->assign('outparam', array('id', 'code', 'name'));
         $this->_smarty->display('departlookup.htm');
     }
 }
Example #10
0
 /**
  * 构造函数
  *
  * @return Controller_Default
  */
 function Controller_About()
 {
     /**
      * FLEA::getSingleton() 会自动载入指定类的定义文件,并且返回该类的唯一一个实例
      */
     //$this->_modelAbout =& FLEA::getSingleton('Model_About');
     $this->_metas =& FLEA::getAppInf('metas');
     //$this->_metas['description'] = "辽宁万维医药有限公司关于万维";
     //$this->_metas['keywords'] = "辽宁万维医药,辽宁,吉林省,黑龙江省,关于万维";
     //$this->_metas['title'] = $this->_metas['title'] . "关于万维";
 }
Example #11
0
 /**
  * 构造函数
  *
  * @return Controller_Default
  */
 function Controller_News()
 {
     /**
      * FLEA::getSingleton() 会自动载入指定类的定义文件,并且返回该类的唯一一个实例
      */
     $this->_modelNews =& FLEA::getSingleton('Model_News');
     $this->_metas =& FLEA::getAppInf('metas');
     $this->_metas['description'] = "辽宁万维医药有限公司新闻中心";
     $this->_metas['keywords'] = "辽宁万维医药,辽宁,吉林省,黑龙江省,医药新闻";
     $this->_metas['title'] = $this->_metas['title'] . "新闻中心";
 }
Example #12
0
 /**
  * 列出所有的成员
  */
 function actionIndex()
 {
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 0;
     FLEA::loadClass('FLEA_Helper_Pager');
     $table =& $this->_modelMembers->getTable();
     $pager =& new FLEA_Helper_Pager($table, $page, 20, '', 'member_id');
     $pk = $table->primaryKey;
     $rowset = $pager->findAll();
     $this->_setBack();
     include APP_DIR . '/ZobMembersList.php';
 }
Example #13
0
 /**
  * 构造函数
  *
  * @return Controller_Default
  */
 function Controller_Products()
 {
     /**
      * FLEA::getSingleton() 会自动载入指定类的定义文件,并且返回该类的唯一一个实例
      */
     $this->_modelGoods =& FLEA::getSingleton('Model_Goods');
     $this->_metas =& FLEA::getAppInf('metas');
     $this->_metas['description'] = "辽宁万维医药经销渠道产品世界";
     $this->_metas['keywords'] = "辽宁万维医药,辽宁,吉林省,黑龙江省,医药产品,思清,柴芩清宁胶囊";
     $this->_metas['title'] = $this->_metas['title'] . "产品世界";
 }
Example #14
0
 /**
  * 构造函数
  *
  * @return Controller_Default
  */
 function Controller_Feedback()
 {
     /**
      * FLEA::getSingleton() 会自动载入指定类的定义文件,并且返回该类的唯一一个实例
      */
     $this->_modelMessage =& FLEA::getSingleton('Model_Message');
     $this->_metas =& FLEA::getAppInf('metas');
     $this->_metas['description'] = "辽宁万维医药经销渠道客户回馈";
     $this->_metas['keywords'] = "辽宁万维医药,辽宁,吉林省,黑龙江省,医药客户回馈";
     $this->_metas['title'] = $this->_metas['title'] . "客户回馈";
 }
 protected function setNav($aNav)
 {
     if (!is_array($aNav)) {
         $aNav = array($aNav);
     }
     $sessionKey = FLEA::getAppInf('RBACSessionKey');
     $username = $_SESSION[$sessionKey]['USERNAME'];
     $sNav = implode(" <span style='color:#FF0000;'>>></span> ", $aNav);
     $this->_V->assign("username", $username);
     $this->_V->assign("sNav", $sNav);
 }
Example #16
0
 /**
  * 删除指定的贴吧信息
  *
  * @param int $postId
  *
  * @return boolean
  */
 function removePost($postId)
 {
     $postId = (int) $postId;
     $post = $this->_tbPosts->find($postId);
     if (!$post) {
         FLEA::loadClass('Exception_DataNotFound');
         __THROW(new Exception_DataNotFound($postId));
         return false;
     }
     return $this->_tbPosts->removeByPkv($postId);
 }
Example #17
0
 /**
  * 构造函数
  *
  * 负责根据用户的 session 设置载入语言文件
  *
  * @return Controller_OfficeBase
  */
 function Controller_ZobBase()
 {
     if (isset($_SESSION['LANG'])) {
         $lang = $_SESSION['LANG'];
         $languages = FLEA::getAppInf('languages');
         if (in_array($lang, $languages, true)) {
             FLEA::setAppInf('defaultLanguage', $lang);
         }
     }
     load_language('ui, exception');
 }
Example #18
0
 /**
  * 构造函数
  *
  * @return Controller_Default
  */
 function Controller_Distribution()
 {
     /**
      * FLEA::getSingleton() 会自动载入指定类的定义文件,并且返回该类的唯一一个实例
      */
     //$this->_modelAbout =& FLEA::getSingleton('Model_Message');
     $this->_metas =& FLEA::getAppInf('metas');
     $this->_metas = FLEA::getAppInf('metas');
     $this->_metas['description'] = "辽宁万维医药经销渠道面向东三省招商";
     $this->_metas['keywords'] = "辽宁万维医药,辽宁,吉林省,黑龙江省,招商";
     $this->_metas['title'] = $this->_metas['title'] . "经销网络";
 }
/**
 * 权限认证失败时的错误处理
 *
 */
function onAuthFailedCallback($controller, $action)
{
    $sessionKey = FLEA::getAppInf('RBACSessionKey');
    $username = $_SESSION[$sessionKey]['USERNAME'];
    if (empty($username)) {
        $rurl = url('Default', 'Index');
        echo "<script language='javascript'>window.top.location.href='" . $rurl . "'</script>";
        // redirect(url('Default', 'Index'));
    } else {
        echo "你没有访问控制器" . $controller . "中" . $action . "方法的权限";
    }
}
Example #20
0
 /**
  * 构造函数
  *
  * @return FLEA_View_SmartTemplate
  */
 function FLEA_View_SmartTemplate()
 {
     parent::SmartTemplate();
     $viewConfig = FLEA::getAppInf('viewConfig');
     if (is_array($viewConfig)) {
         foreach ($viewConfig as $key => $value) {
             if (isset($this->{$key})) {
                 $this->{$key} = $value;
             }
         }
     }
 }
 function Controller_Prem()
 {
     $this->_M =& FLEA::getSingleton('Model_Prem');
     $this->_V =& $this->_getView();
     // 初始化消息对象
     FLEA::loadClass("Util_Msg");
     $this->_G = new Util_Msg();
     // 写入CSS,IMG,JS目录
     $this->_V->assign(FLEA::getAppInf("vdir"));
     // 初始化导航
     FLEA::loadClass("Util_Nav");
     $this->_N = new Util_Nav();
 }
 function isLogin()
 {
     $this->singleloginechek();
     //检测单点登录
     //$rbac =& get_singleton('FLEA_Com_RBAC');
     $sk = FLEA::getAppInf("RBACSessionKey");
     if (isset($_SESSION[$sk])) {
         return true;
     } else {
         return false;
     }
     //dump($rbac->getUser());
 }
 public function Controller_FLGL()
 {
     //$this->_M =& FLEA::getSingleton('Model_FLGL');
     $this->_V =& $this->_getView();
     // ЁУй╪╩╞оШо╒╤тоС
     FLEA::loadClass("Util_Msg");
     $this->_G = new Util_Msg();
     // п╢хКCSS,IMG,JSд©б╪
     $this->_V->assign(FLEA::getAppInf("vdir"));
     // ЁУй╪╩╞╣╪╨╫
     FLEA::loadClass("Util_Nav");
     $this->_N = new Util_Nav();
 }
Example #24
0
 function checkLogin()
 {
     if (!isset($this->_smarty)) {
         $this->initView();
     }
     $rbac =& FLEA::getSingleton('FLEA_Rbac');
     $user = $rbac->getUser();
     if (!$user) {
         redirect(url('login', 'index'));
     } else {
         $this->_smarty->assign('SE', $user);
     }
 }
 /**
  * 向浏览器发送文件内容
  *
  * @param string $serverPath 文件在服务器上的路径(绝对或者相对路径)
  * @param string $filename 发送给浏览器的文件名(尽可能不要使用中文)
  * @param string $mimeType 指示文件类型
  */
 function sendFile($serverPath, $filename, $mimeType = 'application/octet-stream')
 {
     header("Content-Type: {$mimeType}");
     $filename = '"' . htmlspecialchars($filename) . '"';
     $filesize = filesize($serverPath);
     $charset = FLEA::getAppInf('responseCharset');
     header("Content-Disposition: attachment; filename={$filename}; charset={$charset}");
     header('Pragma: cache');
     header('Cache-Control: public, must-revalidate, max-age=0');
     header("Content-Length: {$filesize}");
     readfile($serverPath);
     exit;
 }
 /**
  * 构造函数
  *
  * @return FLEA_View_Lite
  */
 function FLEA_View_Lite()
 {
     parent::Template_Lite();
     $viewConfig = FLEA::getAppInf('viewConfig');
     if (is_array($viewConfig)) {
         foreach ($viewConfig as $key => $value) {
             if (isset($this->{$key})) {
                 $this->{$key} = $value;
             }
         }
     }
     FLEA::loadClass('FLEA_View_SmartyHelper');
     new FLEA_View_SmartyHelper($this);
 }
Example #27
0
 function actionindex()
 {
     //设置标题
     $this->_title = '管理首页';
     $rbac =& FLEA::getSingleton('FLEA_Rbac');
     $user = $rbac->getUser();
     //模板赋值
     $this->_model =& FLEA::getSingleton('model_user');
     $_user = $this->_model->find($user['UID']);
     if (isset($_user)) {
         $this->_smarty->assign('RepAct', explode(',', $_user['RepAct']));
         $this->_smarty->assign('title', $this->_title);
         $this->_smarty->display('main.htm');
     }
 }
Example #28
0
 /**
  * 构造函数
  *
  * @param string $path 模板文件所在路径
  *
  * @return FLEA_View_Simple
  */
 function FLEA_View_Simple($path = null)
 {
     log_message('Construction FLEA_View_Simple', 'debug');
     $this->path = $path;
     $this->cacheLifetime = 900;
     $this->enableCache = true;
     $this->cacheDir = './cache';
     $viewConfig = (array) FLEA::getAppInf('viewConfig');
     $keys = array('templateDir', 'cacheDir', 'cacheLifeTime', 'enableCache');
     foreach ($keys as $key) {
         if (array_key_exists($key, $viewConfig)) {
             $this->{$key} = $viewConfig[$key];
         }
     }
 }
Example #29
0
 /**
  * 获取指定用户,及其权限信息
  *
  * @param array $conditions
  */
 function getUserWithPermissions($conditions)
 {
     $tableUsers =& FLEA::getSingleton($this->_tableClass['users']);
     /* @var $tableUsers FLEA_Acl_Table_Users */
     $user = $tableUsers->find($conditions);
     if (empty($user)) {
         return false;
     }
     // 取得用户所在用户组的层次数据
     $tableUserGroups =& FLEA::getSingleton($this->_tableClass['userGroups']);
     /* @var $tableUserGroups FLEA_Acl_Table_UserGroups */
     $rowset = $tableUserGroups->getPath($user['group']);
     // 找出用户组的单一路径
     FLEA::loadHelper('array');
     $ret = array_to_tree($rowset, 'user_group_id', 'parent_id', 'subgroups', true);
     $tree =& $ret['tree'];
     $refs =& $ret['refs'];
     $groupid = $user['user_group_id'];
     $path = array();
     while (isset($refs[$groupid])) {
         array_unshift($path, $refs[$groupid]);
         $groupid = $refs[$groupid]['parent_id'];
     }
     // 整理角色信息
     $userRoles = array();
     foreach ($path as $group) {
         $roles = $group['roles'];
         foreach ($roles as $role) {
             $roleid = $role['role_id'];
             if ($role['_join_is_include']) {
                 $userRoles[$roleid] = array('role_id' => $roleid, 'name' => $role['name']);
             } else {
                 unset($userRoles[$roleid]);
             }
         }
     }
     foreach ((array) $user['roles'] as $role) {
         $roleid = $role['role_id'];
         if ($role['_join_is_include']) {
             $userRoles[$roleid] = array('role_id' => $roleid, 'name' => $role['name']);
         } else {
             unset($userRoles[$roleid]);
         }
     }
     // 整理权限信息
     $user['roles'] = $userRoles;
     return $user;
 }
 /**
  * 从指定文件创建 Image 对象
  *
  * 对于上传的文件,由于其临时文件名中并没有包含扩展名。因此需要采用下面的方法创建 Image 对象:
  *
  * <code>
  * $ext = pathinfo($_FILES['postfile']['name'], PATHINFO_EXTENSION);
  * $image =& FLEA_Helper_Image::createFromFile($_FILES['postfile']['tmp_name'], $ext);
  * </code>
  *
  * @param string $filename
  * @param string $fileext
  *
  * @return FLEA_Helper_Image
  */
 function &createFromFile($filename, $fileext = null)
 {
     if (is_null($fileext)) {
         $fileext = pathinfo($filename, PATHINFO_EXTENSION);
     }
     $fileext = strtolower($fileext);
     $ext2functions = array('jpg' => 'imagecreatefromjpeg', 'jpeg' => 'imagecreatefromjpeg', 'png' => 'imagecreatefrompng', 'gif' => 'imagecreatefromgif');
     if (!isset($ext2functions[$fileext])) {
         FLEA::loadClass('FLEA_Exception_NotImplemented');
         __THROW(new FLEA_Exception_NotImplemented('imagecreatefrom' . $fileext));
         return false;
     }
     $handle = $ext2functions[$fileext]($filename);
     $img =& new FLEA_Helper_Image($handle);
     return $img;
 }