includes/pageutils.php
changeset 512 13532b0a223f
parent 511 f88c8c79d784
child 513 c15fbf197a54
equal deleted inserted replaced
511:f88c8c79d784 512:13532b0a223f
  1645                 'id' => $row['pg_id'],
  1645                 'id' => $row['pg_id'],
  1646                 'name' => $row['pg_name']
  1646                 'name' => $row['pg_name']
  1647               );
  1647               );
  1648           }
  1648           }
  1649           break;
  1649           break;
       
  1650         case 'seltarget_id':
       
  1651           if ( !is_int($parms['target_id']) )
       
  1652           {
       
  1653             return Array(
       
  1654               'mode' => 'error',
       
  1655               'error' => 'Expected parameter target_id type int'
       
  1656               );
       
  1657           }
       
  1658           $q = $db->sql_query('SELECT target_id, target_type, page_id, namespace, rules FROM ' . table_prefix . "acl WHERE rule_id = {$parms['target_id']};");
       
  1659           if ( !$q )
       
  1660             return Array(
       
  1661               'mode' => 'error',
       
  1662               'error' => $db->get_error()
       
  1663               );
       
  1664           if ( $db->numrows() < 1 )
       
  1665             return Array(
       
  1666               'mode' => 'error',
       
  1667               'error' => "No rule with ID {$parms['target_id']} found"
       
  1668               );
       
  1669             $parms = $db->fetchrow();
       
  1670             $db->free_result();
       
  1671             
       
  1672             // regenerate page selection
       
  1673             $parms['page_id'] = ( isset($parms['page_id']) ) ? $parms['page_id'] : false;
       
  1674             $parms['namespace'] = ( isset($parms['namespace']) ) ? $parms['namespace'] : false;
       
  1675             $page_id =& $parms['page_id'];
       
  1676             $namespace =& $parms['namespace'];
       
  1677             $page_where_clause      = ( empty($page_id) || empty($namespace) ) ? 'AND a.page_id IS NULL AND a.namespace IS NULL' : 'AND a.page_id=\'' . $db->escape($page_id) . '\' AND a.namespace=\'' . $db->escape($namespace) . '\'';
       
  1678             $page_where_clause_lite = ( empty($page_id) || empty($namespace) ) ? 'AND page_id IS NULL AND namespace IS NULL' : 'AND page_id=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $db->escape($namespace) . '\'';
       
  1679             
       
  1680             // From here, let the seltarget handler take over
  1650         case 'seltarget':
  1681         case 'seltarget':
  1651           $return['mode'] = 'seltarget';
  1682           $return['mode'] = 'seltarget';
  1652           $return['acl_types'] = $perms_obj->acl_types;
  1683           $return['acl_types'] = $perms_obj->acl_types;
  1653           $return['acl_deps'] = $perms_obj->acl_deps;
  1684           $return['acl_deps'] = $perms_obj->acl_deps;
  1654           $return['acl_descs'] = $perms_obj->acl_descs;
  1685           $return['acl_descs'] = $perms_obj->acl_descs;