@@ 2852-2861 (lines=10) @@ | ||
2849 | * @param int $permissions User permissions (see also {@link record_get_permissions}). |
|
2850 | * @return bool TRUE if comment can be posted, FALSE otherwise. |
|
2851 | */ |
|
2852 | function can_comment_be_added ($record, $permissions) |
|
2853 | { |
|
2854 | debug_write_log(DEBUG_TRACE, '[can_comment_be_added]'); |
|
2855 | ||
2856 | return (get_user_level() != USER_LEVEL_GUEST && |
|
2857 | !$record['is_suspended'] && |
|
2858 | !$record['is_locked'] && |
|
2859 | !is_record_frozen($record) && |
|
2860 | ($permissions & (PERMIT_ADD_COMMENTS | PERMIT_CONFIDENTIAL_COMMENTS))); |
|
2861 | } |
|
2862 | ||
2863 | /** |
|
2864 | * Checks whether specified permissions allow to attach file to specified record. |
|
@@ 2870-2884 (lines=15) @@ | ||
2867 | * @param int $permissions User permissions (see also {@link record_get_permissions}). |
|
2868 | * @return bool TRUE if file can be attached, FALSE otherwise. |
|
2869 | */ |
|
2870 | function can_file_be_attached ($record, $permissions) |
|
2871 | { |
|
2872 | debug_write_log(DEBUG_TRACE, '[can_file_be_attached]'); |
|
2873 | ||
2874 | if (ATTACHMENTS_ENABLED == 0) |
|
2875 | { |
|
2876 | return FALSE; |
|
2877 | } |
|
2878 | ||
2879 | return (get_user_level() != USER_LEVEL_GUEST && |
|
2880 | !$record['is_suspended'] && |
|
2881 | !$record['is_locked'] && |
|
2882 | !is_record_frozen($record) && |
|
2883 | ($permissions & PERMIT_ATTACH_FILES)); |
|
2884 | } |
|
2885 | ||
2886 | /** |
|
2887 | * Checks whether specified permissions allow to remove attached file from specified record. |
|
@@ 2893-2906 (lines=14) @@ | ||
2890 | * @param int $permissions User permissions (see also {@link record_get_permissions}). |
|
2891 | * @return bool TRUE if attached file can be removed, FALSE otherwise. |
|
2892 | */ |
|
2893 | function can_file_be_removed ($record) |
|
2894 | { |
|
2895 | debug_write_log(DEBUG_TRACE, '[can_file_be_removed]'); |
|
2896 | ||
2897 | if (ATTACHMENTS_ENABLED == 0) |
|
2898 | { |
|
2899 | return FALSE; |
|
2900 | } |
|
2901 | ||
2902 | return (get_user_level() != USER_LEVEL_GUEST && |
|
2903 | !$record['is_suspended'] && |
|
2904 | !$record['is_locked'] && |
|
2905 | !is_record_frozen($record)); |
|
2906 | } |
|
2907 | ||
2908 | /** |
|
2909 | * Checks whether specified permissions allow to add subrecord to specified record. |