equal
deleted
inserted
replaced
1 <?php |
1 <?php |
2 /* |
2 /* |
3 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
3 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
4 * Version 1.0 (Banshee) |
4 * Version 1.0.1 (Loch Ness) |
5 * Copyright (C) 2006-2007 Dan Fuhry |
5 * Copyright (C) 2006-2007 Dan Fuhry |
6 * pageutils.php - a class that handles raw page manipulations, used mostly by AJAX requests or their old-fashioned form-based counterparts |
6 * pageutils.php - a class that handles raw page manipulations, used mostly by AJAX requests or their old-fashioned form-based counterparts |
7 * |
7 * |
8 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
8 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
9 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
9 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
1695 'id' => $row['group_id'], |
1695 'id' => $row['group_id'], |
1696 'name' => $row['group_name'], |
1696 'name' => $row['group_name'], |
1697 ); |
1697 ); |
1698 } |
1698 } |
1699 $db->free_result(); |
1699 $db->free_result(); |
|
1700 $return['page_groups'] = Array(); |
|
1701 $q = $db->sql_query('SELECT pg_id,pg_name FROM '.table_prefix.'page_groups ORDER BY pg_name ASC;'); |
|
1702 if ( !$q ) |
|
1703 return Array( |
|
1704 'mode' => 'error', |
|
1705 'error' => $db->get_error() |
|
1706 ); |
|
1707 while ( $row = $db->fetchrow() ) |
|
1708 { |
|
1709 $return['page_groups'][] = Array( |
|
1710 'id' => $row['pg_id'], |
|
1711 'name' => $row['pg_name'] |
|
1712 ); |
|
1713 } |
1700 break; |
1714 break; |
1701 case 'seltarget': |
1715 case 'seltarget': |
1702 $return['mode'] = 'seltarget'; |
1716 $return['mode'] = 'seltarget'; |
1703 $return['acl_types'] = $perms_obj->acl_types; |
1717 $return['acl_types'] = $perms_obj->acl_types; |
1704 $return['acl_deps'] = $perms_obj->acl_deps; |
1718 $return['acl_deps'] = $perms_obj->acl_deps; |
1737 $return['target_id'] = intval($row['user_id']); |
1751 $return['target_id'] = intval($row['user_id']); |
1738 $return['current_perms'] = $session->acl_merge($perms_obj->acl_types, $session->string_to_perm($row['rules'])); |
1752 $return['current_perms'] = $session->acl_merge($perms_obj->acl_types, $session->string_to_perm($row['rules'])); |
1739 } |
1753 } |
1740 $db->free_result(); |
1754 $db->free_result(); |
1741 // Eliminate types that don't apply to this namespace |
1755 // Eliminate types that don't apply to this namespace |
1742 if ( $namespace ) |
1756 if ( $namespace && $namespace != '__PageGroup' ) |
1743 { |
1757 { |
1744 foreach ( $return['current_perms'] AS $i => $perm ) |
1758 foreach ( $return['current_perms'] AS $i => $perm ) |
1745 { |
1759 { |
1746 if ( ( $page_id != null && $namespace != null ) && ( !in_array ( $namespace, $session->acl_scope[$i] ) && !in_array('All', $session->acl_scope[$i]) ) ) |
1760 if ( ( $page_id != null && $namespace != null ) && ( !in_array ( $namespace, $session->acl_scope[$i] ) && !in_array('All', $session->acl_scope[$i]) ) ) |
1747 { |
1761 { |
1784 $return['target_id'] = intval($row['group_id']); |
1798 $return['target_id'] = intval($row['group_id']); |
1785 $return['current_perms'] = $session->acl_merge($session->acl_types, $session->string_to_perm($row['rules'])); |
1799 $return['current_perms'] = $session->acl_merge($session->acl_types, $session->string_to_perm($row['rules'])); |
1786 } |
1800 } |
1787 $db->free_result(); |
1801 $db->free_result(); |
1788 // Eliminate types that don't apply to this namespace |
1802 // Eliminate types that don't apply to this namespace |
1789 if ( $namespace ) |
1803 if ( $namespace && $namespace != '__PageGroup' ) |
1790 { |
1804 { |
1791 foreach ( $return['current_perms'] AS $i => $perm ) |
1805 foreach ( $return['current_perms'] AS $i => $perm ) |
1792 { |
1806 { |
1793 if ( ( $page_id != false && $namespace != false ) && ( !in_array ( $namespace, $session->acl_scope[$i] ) && !in_array('All', $session->acl_scope[$i]) ) ) |
1807 if ( ( $page_id != false && $namespace != false ) && ( !in_array ( $namespace, $session->acl_scope[$i] ) && !in_array('All', $session->acl_scope[$i]) ) ) |
1794 { |
1808 { |