compatibility.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // Copyright (C) ReloadCMS Development Team //
  4. // http://reloadcms.sf.net //
  5. // //
  6. // This program is distributed in the hope that it will be useful, //
  7. // but WITHOUT ANY WARRANTY, without even the implied warranty of //
  8. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
  9. // //
  10. // This product released under GNU General Public License v2 //
  11. ////////////////////////////////////////////////////////////////////////////////
  12. function user_check_right($username, $right) {
  13. global $system;
  14. return $system->checkForRight($right, $username);
  15. }
  16. function user_set_rights($username, $root, $rights) {
  17. global $system;
  18. if ($userdata = load_user_info($username)) {
  19. return $system->setRightsForUser($username, $rights, $root, (int) @$userdata['accesslevel']);
  20. } else {
  21. return false;
  22. }
  23. }
  24. function load_user_info($username) {
  25. global $system;
  26. return $system->getUserData($username);
  27. }
  28. function user_get_list($expr = '*') {
  29. global $system;
  30. return $system->getUserList($expr);
  31. }
  32. function user_change_field($username, $field, $value) {
  33. global $system;
  34. return $system->changeProfileField($username, $field, $value);
  35. }
  36. function user_delete($username) {
  37. global $system;
  38. return $system->deleteUser($username);
  39. }
  40. function user_register_in_cache($username, $usernick, $email, &$cache) {
  41. global $system;
  42. $cache = &$system->users_cache;
  43. return $cache->registerUser($username, $usernick, $email);
  44. }
  45. function user_remove_from_cache($username, &$cache) {
  46. global $system;
  47. $cache = &$system->users_cache;
  48. return $cache->removeUser($username);
  49. }
  50. function user_check_nick_in_cache($username, $usernick, &$cache) {
  51. global $system;
  52. $cache = &$system->users_cache;
  53. return $cache->checkField('nicks', $usernick);
  54. }
  55. function user_check_email_in_cache($username, $email, &$cache) {
  56. global $system;
  57. $cache = &$system->users_cache;
  58. return $cache->checkField('mails', $email);
  59. }
  60. function user_create_link($user, $nick, $target = '') {
  61. global $system;
  62. return $system->createLink($user, $nick, $target = '');
  63. }
  64. function show_window($title, $data, $align = 'left') {
  65. global $system;
  66. return $system->defineWindow($title, $data, $align);
  67. }
  68. function show_error($data) {
  69. return show_window('', '<span class="alert_error">' . $data . '</span>', 'center');
  70. }
  71. function show_warning($data) {
  72. return show_window('', '<span class="alert_warning">' . $data . '</span>', 'center');
  73. }
  74. function show_success($data) {
  75. return show_window('', '<span class="alert_success">' . $data . '</span>', 'center');
  76. }
  77. function show_info($data) {
  78. return show_window('', '<span class="alert_info">' . $data . '</span>', 'center');
  79. }