1 <?php |
1 <?php |
2 |
2 |
3 /** |
3 /** |
4 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
4 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between |
5 * Version 1.0 (Banshee) |
5 * Version 1.0.1 (Loch Ness) |
6 * Copyright (C) 2006-2007 Dan Fuhry |
6 * Copyright (C) 2006-2007 Dan Fuhry |
7 * paths.php - The part of Enano that actually manages content. Everything related to page handling and namespaces is in here. |
7 * paths.php - The part of Enano that actually manages content. Everything related to page handling and namespaces is in here. |
8 * |
8 * |
9 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
9 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License |
10 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
10 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. |
79 $this->addAdminNode('General', 'Allowed file types', 'UploadAllowedMimeTypes'); |
79 $this->addAdminNode('General', 'Allowed file types', 'UploadAllowedMimeTypes'); |
80 $this->addAdminNode('General', 'Manage Plugins', 'PluginManager'); |
80 $this->addAdminNode('General', 'Manage Plugins', 'PluginManager'); |
81 $this->addAdminNode('General', 'Backup database', 'DBBackup'); |
81 $this->addAdminNode('General', 'Backup database', 'DBBackup'); |
82 $this->addAdminNode('Content', 'Manage Pages', 'PageManager'); |
82 $this->addAdminNode('Content', 'Manage Pages', 'PageManager'); |
83 $this->addAdminNode('Content', 'Edit page content', 'PageEditor'); |
83 $this->addAdminNode('Content', 'Edit page content', 'PageEditor'); |
|
84 $this->addAdminNode('Content', 'Manage page groups', 'PageGroups'); |
84 $this->addAdminNode('Appearance', 'Manage themes', 'ThemeManager'); |
85 $this->addAdminNode('Appearance', 'Manage themes', 'ThemeManager'); |
85 $this->addAdminNode('Users', 'Manage users', 'UserManager'); |
86 $this->addAdminNode('Users', 'Manage users', 'UserManager'); |
86 $this->addAdminNode('Users', 'Edit groups', 'GroupManager'); |
87 $this->addAdminNode('Users', 'Edit groups', 'GroupManager'); |
87 $this->addAdminNode('Users', 'COPPA support', 'COPPA'); |
88 $this->addAdminNode('Users', 'COPPA support', 'COPPA'); |
88 $this->addAdminNode('Users', 'Ban control', 'BanControl'); |
89 $this->addAdminNode('Users', 'Ban control', 'BanControl'); |
820 if($match_case) |
821 if($match_case) |
821 $search->match_case = true; |
822 $search->match_case = true; |
822 return $search; |
823 return $search; |
823 } |
824 } |
824 |
825 |
|
826 /** |
|
827 * Returns a list of groups that a given page is a member of. |
|
828 * @param string Page ID |
|
829 * @param string Namespace |
|
830 * @return array |
|
831 */ |
|
832 |
|
833 function get_page_groups($page_id, $namespace) |
|
834 { |
|
835 global $db, $session, $paths, $template, $plugins; // Common objects |
|
836 |
|
837 $page_id = $db->escape(sanitize_page_id($page_id)); |
|
838 if ( !isset($this->nslist[$namespace]) ) |
|
839 die('$paths->get_page_groups(): HACKING ATTEMPT'); |
|
840 |
|
841 $group_list = array(); |
|
842 |
|
843 // What linked categories have this page? |
|
844 $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g |
|
845 LEFT JOIN '.table_prefix.'categories AS c |
|
846 ON ( c.category_id = g.pg_target AND g.pg_type = ' . PAGE_GRP_CATLINK . ' ) |
|
847 WHERE c.page_id=\'' . $page_id . '\' AND c.namespace=\'' . $namespace . '\';'); |
|
848 if ( !$q ) |
|
849 $db->_die(); |
|
850 |
|
851 while ( $row = $db->fetchrow() ) |
|
852 { |
|
853 $group_list[] = $row['pg_id']; |
|
854 } |
|
855 |
|
856 // Static-page groups |
|
857 $q = $db->sql_query('SELECT g.pg_id FROM '.table_prefix.'page_groups AS g |
|
858 LEFT JOIN '.table_prefix.'page_group_members AS m |
|
859 ON ( g.pg_id = m.pg_id ) |
|
860 WHERE m.page_id=\'' . $page_id . '\' AND m.namespace=\'' . $namespace . '\' |
|
861 GROUP BY g.pg_id;'); |
|
862 |
|
863 if ( !$q ) |
|
864 $db->_die(); |
|
865 |
|
866 while ( $row = $db->fetchrow() ) |
|
867 { |
|
868 $group_list[] = $row['pg_id']; |
|
869 } |
|
870 |
|
871 // Tagging ain't implemented yet ;-) |
|
872 |
|
873 return $group_list; |
|
874 |
|
875 } |
|
876 |
825 } |
877 } |
826 |
878 |
827 ?> |
879 ?> |