| @@ 386-395 (lines=10) @@ | ||
| 383 | * @param int $tid ID of template which permissions should be retrieved for. |
|
| 384 | * @return int Current permissions set, or 0 if no permissions are set. |
|
| 385 | */ |
|
| 386 | function group_get_permissions ($gid, $tid) |
|
| 387 | { |
|
| 388 | debug_write_log(DEBUG_TRACE, '[group_get_permissions]'); |
|
| 389 | debug_write_log(DEBUG_DUMP, '[group_get_permissions] $gid = ' . $gid); |
|
| 390 | debug_write_log(DEBUG_DUMP, '[group_get_permissions] $tid = ' . $tid); |
|
| 391 | ||
| 392 | $rs = dal_query('groups/gpget.sql', $gid, $tid); |
|
| 393 | ||
| 394 | return ($rs->rows == 0 ? 0 : $rs->fetch('perms')); |
|
| 395 | } |
|
| 396 | ||
| 397 | /** |
|
| 398 | * Sets permissions of specified group for specified template. |
|
| @@ 2548-2557 (lines=10) @@ | ||
| 2545 | * @param int $account_id Account ID. |
|
| 2546 | * @return bool TRUE if account is subscribed, FALSE otherwise. |
|
| 2547 | */ |
|
| 2548 | function is_record_subscribed ($record_id, $account_id) |
|
| 2549 | { |
|
| 2550 | debug_write_log(DEBUG_TRACE, '[is_record_subscribed]'); |
|
| 2551 | debug_write_log(DEBUG_DUMP, '[is_record_subscribed] $record_id = ' . $record_id); |
|
| 2552 | debug_write_log(DEBUG_DUMP, '[is_record_subscribed] $account_id = ' . $account_id); |
|
| 2553 | ||
| 2554 | $rs = dal_query('records/fndsubsc.sql', $record_id, $account_id); |
|
| 2555 | ||
| 2556 | return ($rs->rows != 0); |
|
| 2557 | } |
|
| 2558 | ||
| 2559 | /** |
|
| 2560 | * Checks whether a specified record has reached critical age. |
|
| @@ 2622-2632 (lines=11) @@ | ||
| 2619 | * @param int $id Record ID. |
|
| 2620 | * @return int ID of original record if specified one was cloned from it, 0 otherwise. |
|
| 2621 | */ |
|
| 2622 | function is_record_cloned ($id) |
|
| 2623 | { |
|
| 2624 | debug_write_log(DEBUG_TRACE, '[is_record_cloned]'); |
|
| 2625 | debug_write_log(DEBUG_DUMP, '[is_record_cloned] $id = ' . $id); |
|
| 2626 | ||
| 2627 | $rs = dal_query('events/fnd.sql', |
|
| 2628 | $id, |
|
| 2629 | EVENT_RECORD_CLONED); |
|
| 2630 | ||
| 2631 | return ($rs->rows == 0 ? 0 : $rs->fetch('event_param')); |
|
| 2632 | } |
|
| 2633 | ||
| 2634 | /** |
|
| 2635 | * Calculates number of days since the last event of specified record. |
|