843 |
843 |
844 $group_list = array(); |
844 $group_list = array(); |
845 |
845 |
846 // What linked categories have this page? |
846 // What linked categories have this page? |
847 $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g |
847 $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g |
848 LEFT JOIN '.table_prefix.'categories AS c |
848 LEFT JOIN '.table_prefix.'categories AS c |
849 ON ( c.category_id = g.pg_target AND g.pg_type = ' . PAGE_GRP_CATLINK . ' ) |
849 ON ( ( c.category_id = g.pg_target AND g.pg_type = ' . PAGE_GRP_CATLINK . ' ) OR c.category_id IS NULL ) |
850 WHERE c.page_id=\'' . $page_id . '\' AND c.namespace=\'' . $namespace . '\';'); |
850 LEFT JOIN '.table_prefix.'page_group_members AS m |
|
851 ON ( ( g.pg_id = m.pg_id AND g.pg_type = ' . PAGE_GRP_NORMAL . ' ) OR ( m.pg_id IS NULL ) ) |
|
852 LEFT JOIN '.table_prefix.'tags AS t |
|
853 ON ( ( t.tag_name = g.pg_target AND pg_type = ' . PAGE_GRP_TAGGED . ' ) OR t.tag_name IS NULL ) |
|
854 WHERE |
|
855 ( c.page_id=\'' . $page_id . '\' AND c.namespace=\'' . $namespace . '\' ) OR |
|
856 ( t.page_id=\'' . $page_id . '\' AND t.namespace=\'' . $namespace . '\' ) OR |
|
857 ( m.page_id=\'' . $page_id . '\' AND m.namespace=\'' . $namespace . '\' );'); |
851 if ( !$q ) |
858 if ( !$q ) |
852 $db->_die(); |
859 $db->_die(); |
853 |
860 |
854 while ( $row = $db->fetchrow() ) |
861 while ( $row = $db->fetchrow() ) |
855 { |
862 { |
856 $group_list[] = $row['pg_id']; |
863 $group_list[] = $row['pg_id']; |
857 } |
864 } |
858 |
865 |
859 $db->free_result(); |
866 $db->free_result(); |
860 |
867 |
|
868 /* |
861 // Static-page groups |
869 // Static-page groups |
862 $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g |
870 $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g |
863 LEFT JOIN '.table_prefix.'page_group_members AS m |
871 LEFT JOIN '.table_prefix.'page_group_members AS m |
864 ON ( g.pg_id = m.pg_id ) |
872 ON ( g.pg_id = m.pg_id ) |
865 WHERE m.page_id=\'' . $page_id . '\' AND m.namespace=\'' . $namespace . '\' |
873 WHERE m.page_id=\'' . $page_id . '\' AND m.namespace=\'' . $namespace . '\' |
871 while ( $row = $db->fetchrow() ) |
879 while ( $row = $db->fetchrow() ) |
872 { |
880 { |
873 $group_list[] = $row['pg_id']; |
881 $group_list[] = $row['pg_id']; |
874 } |
882 } |
875 |
883 |
876 // Tagging ain't implemented yet ;-) |
884 // Tag groups |
|
885 |
|
886 $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g |
|
887 LEFT JOIN '.table_prefix.'tags AS t |
|
888 ON ( t.tag_name = g.pg_target AND pg_type = ' . PAGE_GRP_TAGGED . ' ) |
|
889 WHERE t.page_id = \'' . $page_id . '\' AND t.namespace = \'' . $namespace . '\';'); |
|
890 if ( !$q ) |
|
891 $db->_die(); |
|
892 |
|
893 while ( $row = $db->fetchrow() ) |
|
894 { |
|
895 $group_list[] = $row['pg_id']; |
|
896 } |
|
897 */ |
877 |
898 |
878 return $group_list; |
899 return $group_list; |
879 |
900 |
880 } |
901 } |
881 |
902 |