Пример #1
0
function invoke_attributes($module, $file)
{
    global $attr_module;
    global $attr_function;
    $attr_module = $module;
    $comments = get_comment_blocks($file);
    $attributes = extract_attributes($comments);
    foreach ($attributes as $attribute) {
        $attr_function = $attribute['function'];
        eval($attribute['attribute']);
    }
}
Пример #2
0
function invoke_attributes($module, $file, $user)
{
    global $attr_module;
    global $attr_function;
    $attr_module = $module;
    $comments = get_comment_blocks($file);
    $attributes = extract_attributes($comments);
    $group_id = $user->get_user_group_ids(get_active_user_id());
    $allow_posts = false;
    $allow_categories = false;
    foreach ($group_id as $key => $value) {
        if ($user->get_group_by_id($value)->allow_posts == '1') {
            $allow_posts = true;
        }
        if ($user->get_group_by_id($value)->allow_categories == '1') {
            $allow_categories = true;
        }
    }
    foreach ($attributes as $attribute) {
        if ($attribute['function'] == 'add_post' && $allow_posts || $attribute['function'] == 'add_category' && $allow_categories) {
            $attr_function = $attribute['function'];
            eval($attribute['attribute']);
        } else {
            if ($attribute['function'] != 'add_post' && $attribute['function'] != 'add_category') {
                $attr_function = $attribute['function'];
                eval($attribute['attribute']);
            }
        }
    }
}