includes/pageutils.php
changeset 1153 124ebcbb6a31
parent 1121 bf5adc446018
child 1175 1e2c9819ede3
equal deleted inserted replaced
1152:e3fb74e3e74e 1153:124ebcbb6a31
  1924               'mode'  => 'list_existing',
  1924               'mode'  => 'list_existing',
  1925               'key'   => acl_list_draw_key(),
  1925               'key'   => acl_list_draw_key(),
  1926               'rules' => array()
  1926               'rules' => array()
  1927             );
  1927             );
  1928           
  1928           
       
  1929           $acl_columns = 'a.' . implode(', a.', $db->columns_in(table_prefix . 'acl'));
       
  1930           $users_columns = 'u.' . implode(', u.', $db->columns_in(table_prefix . 'users'));
       
  1931           $groups_columns = 'g.' . implode(', g.', $db->columns_in(table_prefix . 'groups'));
       
  1932           $pg_columns = 'p.' . implode(', p.', array('pg_id', 'pg_type', 'pg_name', 'pg_target'));
       
  1933           
  1929           $q = $db->sql_query("SELECT a.rule_id, u.username, g.group_name, a.target_type, a.target_id, a.page_id, a.namespace, a.rules, p.pg_name\n"
  1934           $q = $db->sql_query("SELECT a.rule_id, u.username, g.group_name, a.target_type, a.target_id, a.page_id, a.namespace, a.rules, p.pg_name\n"
  1930                   . "  FROM " . table_prefix . "acl AS a\n"
  1935                   . "  FROM " . table_prefix . "acl AS a\n"
  1931                   . "  LEFT JOIN " . table_prefix . "users AS u\n"
  1936                   . "  LEFT JOIN " . table_prefix . "users AS u\n"
  1932                   . "    ON ( (a.target_type = " . ACL_TYPE_USER . " AND a.target_id = u.user_id) OR (u.user_id IS NULL) )\n"
  1937                   . "    ON ( (a.target_type = " . ACL_TYPE_USER . " AND a.target_id = u.user_id) OR (u.user_id IS NULL) )\n"
  1933                   . "  LEFT JOIN " . table_prefix . "groups AS g\n"
  1938                   . "  LEFT JOIN " . table_prefix . "groups AS g\n"
  1934                   . "    ON ( (a.target_type = " . ACL_TYPE_GROUP . " AND a.target_id = g.group_id) OR (g.group_id IS NULL) )\n"
  1939                   . "    ON ( (a.target_type = " . ACL_TYPE_GROUP . " AND a.target_id = g.group_id) OR (g.group_id IS NULL) )\n"
  1935                   . "  LEFT JOIN " . table_prefix . "page_groups as p\n"
  1940                   . "  LEFT JOIN " . table_prefix . "page_groups as p\n"
  1936                   . "    ON ( (a.namespace = '__PageGroup' AND a.page_id = p.pg_id) OR (p.pg_id IS NULL) )\n"
  1941                   . "    ON ( (a.namespace = '__PageGroup' AND a.page_id = CAST(p.pg_id AS CHAR)) OR (p.pg_id IS NULL) )\n"
  1937                   . "  WHERE ( a.target_type = " . ACL_TYPE_USER . " OR a.target_type = " . ACL_TYPE_GROUP . " )\n"
  1942                   . "  WHERE ( a.target_type = " . ACL_TYPE_USER . " OR a.target_type = " . ACL_TYPE_GROUP . " )\n"
  1938                   . "  GROUP BY a.rule_id\n"
  1943                   . "  GROUP BY a.rule_id, $acl_columns, $users_columns, $groups_columns, $pg_columns\n"
  1939                   . "  ORDER BY a.target_type ASC, a.rule_id ASC;"
  1944                   . "  ORDER BY a.target_type ASC, a.rule_id ASC;"
  1940                 );
  1945                 );
  1941           
  1946           
  1942           if ( !$q )
  1947           if ( !$q )
  1943             $db->_die();
  1948             $db->_die();