• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP execute_action函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中execute_action函数的典型用法代码示例。如果您正苦于以下问题:PHP execute_action函数的具体用法?PHP execute_action怎么用?PHP execute_action使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: action_log

/**
 * 记录行为日志,并执行该行为的规则
 * @param string $action 行为标识
 * @param string $model 触发行为的模型名
 * @param int $record_id 触发行为的记录id
 * @param int $user_id 执行行为的用户id
 * @return boolean
 */
function action_log($action = null, $model = null, $record_id = null, $user_id = null)
{
    //参数检查
    if (empty($action) || empty($model) || empty($record_id)) {
        return '参数不能为空';
    }
    if (empty($user_id)) {
        $user_id = is_login();
    }
    //查询行为,判断是否执行
    $action_info = apiCall(\Admin\Api\ActionApi::GET_INFO, array(array("name" => $action)));
    if ($action_info['status'] && is_array($action_info['info']) && $action_info['info']['status'] != 1) {
        return '该行为被禁用或删除';
    }
    $action_info = $action_info['info'];
    //插入行为日志
    $data['action_id'] = $action_info['id'];
    $data['user_id'] = $user_id;
    $data['action_ip'] = ip2long(get_client_ip());
    $data['model'] = $model;
    $data['record_id'] = $record_id;
    $data['create_time'] = NOW_TIME;
    //解析日志规则,生成日志备注
    if (!empty($action_info['log'])) {
        if (preg_match_all('/\\[(\\S+?)\\]/', $action_info['log'], $match)) {
            //匹配[],获取[]里的字符串
            $log['user'] = $user_id;
            $log['record'] = $record_id;
            $log['model'] = $model;
            $log['time'] = NOW_TIME;
            $log['data'] = array('user' => $user_id, 'model' => $model, 'record' => $record_id, 'time' => NOW_TIME);
            $replace = array();
            foreach ($match[1] as $value) {
                $param = explode('|', $value);
                //分割字符串通过|
                if (isset($param[1])) {
                    $replace[] = call_user_func($param[1], $log[$param[0]]);
                    //调用函数
                } else {
                    $replace[] = $log[$param[0]];
                }
            }
            $data['remark'] = str_replace($match[0], $replace, $action_info['log']);
        } else {
            $data['remark'] = $action_info['log'];
        }
    } else {
        //未定义日志规则,记录操作url
        $data['remark'] = '操作url:' . $_SERVER['REQUEST_URI'];
    }
    $result = apiCall(\Admin\Api\ActionLogApi::ADD, array($data));
    if (!$result['status']) {
        LogRecord("记录操作日志失败!", $result['info']);
    }
    //    M('ActionLog','common_')->add($data);
    if (!empty($action_info['rule'])) {
        //解析行为
        $rules = parse_action($action, $user_id);
        //执行行为
        $res = execute_action($rules, $action_info['id'], $user_id);
    }
}
开发者ID:h136799711,项目名称:baseItboye,代码行数:70,代码来源:function.php


示例2: action_log

/**
 * 记录行为日志,并执行该行为的规则
 *
 * @param string $action
 *            行为标识
 * @param string $model
 *            触发行为的模型名
 * @param int $record_id
 *            触发行为的记录id
 * @param int $user_id
 *            执行行为的用户id
 * @return boolean
 * @author huajie <[email protected]>
 */
function action_log($action = null, $model = null, $record_id = null, $user_id = null)
{
    // 参数检查
    if (empty($action) || empty($model) || empty($record_id)) {
        return '参数不能为空';
    }
    if (empty($user_id)) {
        $user_id = is_login();
    }
    // 查询行为,判断是否执行
    $action_info = M('Action')->getByName($action);
    if ($action_info['status'] != 1) {
        return '该行为被禁用或删除';
    }
    // 插入行为日志
    $data['action_id'] = $action_info['id'];
    $data['user_id'] = $user_id;
    $data['action_ip'] = ip2long(get_client_ip());
    $data['model'] = $model;
    $data['record_id'] = $record_id;
    $data['create_time'] = NOW_TIME;
    // 解析日志规则,生成日志备注
    if (!empty($action_info['log'])) {
        if (preg_match_all('/\\[(\\S+?)\\]/', $action_info['log'], $match)) {
            $log['user'] = $user_id;
            $log['record'] = $record_id;
            $log['model'] = $model;
            $log['time'] = NOW_TIME;
            $log['data'] = array('user' => $user_id, 'model' => $model, 'record' => $record_id, 'time' => NOW_TIME);
            foreach ($match[1] as $value) {
                $param = explode('|', $value);
                if (isset($param[1])) {
                    $replace[] = call_user_func($param[1], $log[$param[0]]);
                } else {
                    $replace[] = $log[$param[0]];
                }
            }
            $data['remark'] = str_replace($match[0], $replace, $action_info['log']);
        } else {
            $data['remark'] = $action_info['log'];
        }
    } else {
        // 未定义日志规则,记录操作url
        $data['remark'] = '操作url:' . $_SERVER['REQUEST_URI'];
    }
    M('ActionLog')->add($data);
    if (!empty($action_info['rule'])) {
        // 解析行为
        $rules = parse_action($action, $user_id);
        // 执行行为
        $res = execute_action($rules, $action_info['id'], $user_id);
    }
}
开发者ID:PunkAvail,项目名称:ThinkWechat,代码行数:67,代码来源:function.php


示例3: action_log

/**
 * 记录行为日志,并执行该行为的规则
 * @param string $action 行为标识
 * @param string $model 触发行为的模型名
 * @param int $record_id 触发行为的记录id
 * @param int $user_id 执行行为的用户id
 * @return boolean
 * @author huajie <[email protected]>
 */
function action_log($action = null, $model = null, $record_id = null, $user_id = null)
{
    //参数检查
    if (empty($action) || empty($model) || empty($record_id)) {
        return '参数不能为空';
    }
    if (empty($user_id)) {
        $user_id = is_login();
    }
    //查询行为,判断是否执行
    $action_info = M('Action')->getByName($action);
    if ($action_info['status'] != 1) {
        return '该行为被禁用或删除';
    }
    //插入行为日志
    $data['action_id'] = $action_info['id'];
    $data['user_id'] = $user_id;
    $data['action_ip'] = ip2long(get_client_ip());
    $data['model'] = $model;
    $data['record_id'] = $record_id;
    $data['create_time'] = NOW_TIME;
    //系统日志记录操作url参数
    $data['remark'] = '操作url:' . $_SERVER['REQUEST_URI'];
    M('ActionLog')->add($data);
    if (!empty($action_info['rule'])) {
        //解析行为
        $rules = parse_action($action, $user_id);
        //执行行为
        $res = execute_action($rules, $action_info['id'], $user_id);
    }
}
开发者ID:commiunty,项目名称:Mytest,代码行数:40,代码来源:function.php


示例4: required_param

    $cmid = required_param('cmid', PARAM_INT);
    $userid = required_param('user', PARAM_INT);
    $filenum = required_param('cn', PARAM_INT);
    $vmsession = required_param('sesseionkey', PARAM_FILE);
    $data = required_param('record_data', PARAM_RAW);
    return array($cmid, $userid, $filenum, $vmsession, $data);
}
/* The function is executed which is passed by get */
function execute_action($valid_parameters, $DB)
{
    $getdata = received_get_data();
    if ($getdata && isset($getdata['methodname'])) {
        $postdata = received_post_data();
        if ($postdata) {
            $function_list = unserialize(Functions_list);
            if (in_array($getdata['methodname'], $function_list)) {
                //call_user_func($getdata['methodname'], $getdata, $postdata, $valid_parameters, $DB);
                $getdata['methodname']($getdata, $postdata, $valid_parameters, $DB);
            } else {
                throw new Exception('There is no ' . $getdata['methodname'] . ' method to execute.');
            }
        }
    } else {
        throw new Exception('There is no method to execute.');
    }
}
set_header();
exit_if_request_is_options();
$validparams = validate_request();
execute_action($validparams, $DB);
开发者ID:vidyamantra,项目名称:moodle-mod_congrea,代码行数:30,代码来源:webapi.php


示例5: os_add_meta

function os_add_meta()
{
    execute_action("os_add_meta");
}
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:4,代码来源:Hook.php


示例6: handleHttpRequest

 /**
  * Get and handle HTTP request
  *
  * @param void
  * @return null
  */
 function handleHttpRequest()
 {
     $request = $this->router->match(ANGIE_PATH_INFO, ANGIE_QUERY_STRING);
     if (is_error($request)) {
         handle_fatal_error($request);
     } else {
         $execute =& execute_action($request);
         if (is_error($execute)) {
             handle_fatal_error($execute);
         }
         // if
     }
     // if
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:20,代码来源:AngieApplication.class.php


示例7: run_action

 public function run_action($action)
 {
     return execute_action($action);
 }
开发者ID:kalliste,项目名称:kalliste-php-framework,代码行数:4,代码来源:app.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP execute_delayed_write_query函数代码示例发布时间:2022-05-15
下一篇:
PHP executeSqlQuery函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap