PluginProbe
User Access Manager / 2.3.2
User Access Manager v2.3.2
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | user-access-manager.php +68 -2852 0.7.0.12.3.2 View file →
@@ -1,2864 +1,80 @@
1 1 <?php
2 -/*
3 -Plugin Name: User Access Manager
4 -Plugin URI: http://www.gm-alex.de/projects/wordpress/plugins/user-access-manager/
5 -Author URI: http://www.gm-alex.de/
6 -Version: 0.7.0.1
7 -Author: Alexander Schneider
8 -Description: Manage the access to your posts and pages. <strong>Note:</strong> <em>If you activate the plugin your upload dir will protect by a '.htaccess' with a random password and all old downloads insert in a previous post/page will not work anymore. You have to update your posts/pages. If you use already a '.htaccess' file to protect your files the plugin will not overwrite the '.htaccess'.</em>
9 -
10 -Copyright 2008 Alexander Schneider (email : alexanderschneider85 [at] gmail DOT com)
2 +/**
3 + * Plugin Name: User Access Manager
4 + * Plugin URI: https://wordpress.org/plugins/user-access-manager/
5 + * Author URI: https://twitter.com/GM_Alex
6 + * Version: 2.3.2
7 + * Requires PHP: 8.0
8 + * Author: Alexander Schneider
9 + * Description: Manage the access to your posts, pages, categories and files.
10 + * Text Domain: user-access-manager
11 + *
12 + * user-access-manager.php
13 + *
14 + * The user access manager main file.
15 + *
16 + * PHP versions 5
17 + *
18 + * @author Alexander Schneider <alexanderschneider85@gmail.com>
19 + * @copyright 2008-2017 Alexander Schneider
20 + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
21 + * @version SVN: $id$
22 + * @link http://wordpress.org/extend/plugins/user-access-manager/
23 + */
11 24
12 - This program is free software; you can redistribute it and/or modify
13 - it under the terms of the GNU General Public License as published by
14 - the Free Software Foundation; either version 2 of the License, or
15 - (at your option) any later version.
25 +function initUam() {
26 + $basePath = __DIR__ . DIRECTORY_SEPARATOR;
16 27
17 - This program is distributed in the hope that it will be useful,
18 - but WITHOUT ANY WARRANTY; without even the implied warranty of
19 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 - GNU General Public License for more details.
28 + //Load language
29 + require_once $basePath . 'includes' . DIRECTORY_SEPARATOR . 'language.php';
30 + $locale = apply_filters('plugin_locale', get_locale(), 'user-access-manager');
31 + load_textdomain(
32 + 'user-access-manager',
33 + WP_LANG_DIR . DIRECTORY_SEPARATOR . 'user-access-manager' . DIRECTORY_SEPARATOR . 'user-access-manager-' . $locale . '.mo'
34 + );
35 + load_plugin_textdomain(
36 + 'user-access-manager',
37 + false,
38 + plugin_basename(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'languages'
39 + );
21 40
22 - You should have received a copy of the GNU General Public License
23 - along with this program; if not, write to the Free Software
24 - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
41 + //--- Check requirements ---
25 42
26 -*/
43 + //Check php version
44 + if (version_compare((string)phpversion(), '7.2') === -1) {
45 + add_action(
46 + 'admin_notices',
47 + function () {
48 + echo '<div id="message" class="error"><p><strong>'
49 + . sprintf(TXT_UAM_PHP_VERSION_TO_LOW, phpversion())
50 + . '</strong></p></div>';
51 + }
52 + );
27 53
28 -//DB
29 -global $wpdb;
30 -define('DB_ACCESSGROUP', $wpdb->prefix.'uam_accessgroups');
31 -define('DB_ACCESSGROUP_TO_POST', $wpdb->prefix.'uam_accessgroup_to_post');
32 -define('DB_ACCESSGROUP_TO_USER', $wpdb->prefix.'uam_accessgroup_to_user');
33 -define('DB_ACCESSGROUP_TO_CATEGORY', $wpdb->prefix.'uam_accessgroup_to_category');
34 -define('DB_ACCESSGROUP_TO_ROLE', $wpdb->prefix.'uam_accessgroup_to_role');
54 + return;
55 + }
35 56
36 -//PATH
37 -define('UAM_URLPATH', WP_CONTENT_URL.'/plugins/user-access-manager/');//define('UAM_URLPATH', WP_CONTENT_URL.'/plugins/'.plugin_basename( dirname(__FILE__)).'/' );
57 + //Check WordPress version
58 + global $wp_version;
38 59
39 -//###Lang###
60 + if (version_compare((string)$wp_version, '4.6') === -1) {
61 + add_action(
62 + 'admin_notices',
63 + function () use ($wp_version) {
64 + echo '<div id="message" class="error"><p><strong>'
65 + . sprintf(TXT_UAM_WORDPRESS_VERSION_TO_LOW, $wp_version)
66 + . '</strong></p></div>';
67 + }
68 + );
40 69
41 -if (!class_exists("UserAccessManager"))
42 -{
43 - class UserAccessManager
44 - {
45 - var $adminOptionsName = "uamAdminOptions";
46 - var $atAdminPanel = false;
47 -
48 - function UserAccessManager()
49 - { //constructor
50 -
51 - }
52 -
53 - function init()
54 - {
55 - echo load_plugin_textdomain('user-access-manager', 'wp-content/plugins/user-access-manager');
56 -
57 - //---Lang Settings---
58 - define('TXT_SETTINGS', __('Settings', 'user-access-manager'));
59 -
60 - define('TXT_POST_SETTING', __('Post settings', 'user-access-manager'));
61 - define('TXT_POST_SETTING_DESC', __('Set up the behaviour of locked posts', 'user-access-manager'));
62 - define('TXT_POST_TITLE', __('Post title', 'user-access-manager'));
63 - define('TXT_POST_TITLE_DESC', __('Displayed text as post title if user has no access', 'user-access-manager'));
64 - define('TXT_DISPLAY_POST_TITLE', __('Hide post titel', 'user-access-manager'));
65 - define('TXT_DISPLAY_POST_TITLE_DESC', sprintf(__('Selecting "Yes" will show the text which is defined at "%s" if user has no access.', 'user-access-manager'), TXT_POST_TITLE));
66 - define('TXT_POST_CONTENT', __('Post content', 'user-access-manager'));
67 - define('TXT_POST_CONTENT_DESC', __('Content displayed if user has no access', 'user-access-manager'));
68 - define('TXT_HIDE_POST', __('Hide complete posts', 'user-access-manager'));
69 - define('TXT_HIDE_POST_DESC', __('Selecting "Yes" will hide posts if the user has no access.', 'user-access-manager'));
70 - define('TXT_POST_COMMENT_CONTENT', __('Post commtent text', 'user-access-manager'));
71 - define('TXT_POST_COMMENT_CONTENT_DESC', __('Displayed text as post comment text if user has no access', 'user-access-manager'));
72 - define('TXT_DISPLAY_POST_COMMENT', __('Hide post comments', 'user-access-manager'));
73 - define('TXT_DISPLAY_POST_COMMENT_DESC', sprintf(__('Selecting "Yes" will show the text which is defined at "%s" if user has no access.', 'user-access-manager'), TXT_POST_COMMENT_CONTENT) );
74 -
75 - define('TXT_PAGE_SETTING', __('Page settings', 'user-access-manager'));
76 - define('TXT_PAGE_SETTING_DESC', __('Set up the behaviour of locked pages', 'user-access-manager'));
77 - define('TXT_PAGE_TITLE', __('Page title', 'user-access-manager'));
78 - define('TXT_PAGE_TITLE_DESC', __('Displayed text as page title if user has no access', 'user-access-manager'));
79 - define('TXT_DISPLAY_PAGE_TITLE', __('Hide page titel', 'user-access-manager'));
80 - define('TXT_DISPLAY_PAGE_TITLE_DESC', sprintf(__('Selecting "Yes" will show the text which is defined at "%s" if user has no access.', 'user-access-manager'), TXT_POST_TITLE));
81 - define('TXT_PAGE_CONTENT', __('Page content', 'user-access-manager'));
82 - define('TXT_PAGE_CONTENT_DESC', __('Content displayed if user has no access', 'user-access-manager'));
83 - define('TXT_HIDE_PAGE', __('Hide complete pages', 'user-access-manager'));
84 - define('TXT_HIDE_PAGE_DESC', __('Selecting "Yes" will hide pages if the user has no access. Pages will also hide in the navigation.', 'user-access-manager'));
85 -
86 - define('TXT_FILE_SETTING', __('File settings', 'user-access-manager'));
87 - define('TXT_FILE_SETTING_DESC', __('Set up the behaviour of files', 'user-access-manager'));
88 - define('TXT_LOCK_FILE', __('Lock files', 'user-access-manager'));
89 - define('TXT_LOCK_FILE_DESC', __('If you select "Yes" all files will locked by a .htaccess file and only users with access can download files.', 'user-access-manager'));
90 - define('TXT_DOWNLOAD_FILE_TYPE', __('Locked file types', 'user-access-manager'));
91 - define('TXT_DOWNLOAD_FILE_TYPE_DESC', __('Type in file types which you will lock if the post/page is locked. <b>Note:</b> If you use images, vids or something else in your posts which are directly shown there and not for download do not type these types in here, because this types will not work anymore.', 'user-access-manager'));
92 - define('TXT_DOWNLOAD_TYPE', __('Download type', 'user-access-manager'));
93 - define('TXT_DOWNLOAD_TYPE_DESC', __('Selecting the type for downloading. <strong>Note:</strong> For using fopen you need "safe_mode = off".', 'user-access-manager'));
94 - define('TXT_NORMAL', __('Normal', 'user-access-manager'));
95 - define('TXT_FOPEN', __('fopen', 'user-access-manager'));
96 -
97 - define('TXT_OTHER_SETTING', __('Other settings', 'user-access-manager'));
98 - define('TXT_OTHER_SETTING_DESC', __('Here you will find all other settings', 'user-access-manager'));
99 - define('TXT_REDIRECT', __('Redirect user', 'user-access-manager'));
100 - define('TXT_REDIRECT_DESC', __('Setup what happen if a user visit a post/page with no access.', 'user-access-manager'));
101 - define('TXT_REDIRECT_TO_BOLG', __('To blog startpage', 'user-access-manager'));
102 - define('TXT_REDIRECT_TO_PAGE', __('Custom page: ', 'user-access-manager'));
103 - define('TXT_REDIRECT_TO_URL', __('Custom URL: ', 'user-access-manager'));
104 - define('TXT_LOCK_RECURSIVE', __('Lock recursive', 'user-access-manager'));
105 - define('TXT_LOCK_RECURSIVE_DESC', __('Selecting "Yes" will lock all child posts/pages of a post/page if a user has no access to the parent page.', 'user-access-manager'));
106 - define('TXT_BLOG_ADMIN_HINT_TEXT', __('Admin hint text', 'user-access-manager'));
107 - define('TXT_BLOG_ADMIN_HINT_TEXT_DESC', __('The text which will shown behinde the post/page.', 'user-access-manager'));
108 - define('TXT_BLOG_ADMIN_HINT', __('Show admin hint at Posts', 'user-access-manager'));
109 - define('TXT_BLOG_ADMIN_HINT_DESC', sprintf(__('Selecting "Yes" will show the defined text at "%s" behinde the post/page to an logged in admin to show him which posts/pages are locked if he visits his blog.', 'user-access-manager'), TXT_BLOG_ADMIN_HINT_TEXT));
110 - define('TXT_CORE_MOD', __('Core modifications installed?', 'user-access-manager'));
111 - define('TXT_CORE_MOD_DESC', __('If you installed the core modifications activated this option.', 'user-access-manager'));
112 -
113 - define('TXT_YES', __('Yes', 'user-access-manager'));
114 - define('TXT_NO', __('No', 'user-access-manager'));
115 -
116 - define('TXT_UPDATE_SETTING', __('Update settings', 'user-access-manager'));
117 - define('TXT_UPDATE_SETTINGS', __('Settings updated.', 'user-access-manager'));
118 -
119 - //---Access groups---
120 -
121 - define('TXT_MANAGE_GROUP', __('Manage user access groups', 'user-access-manager'));
122 - define('TXT_GROUP_ROLE', __('Role affiliation', 'user-access-manager'));
123 - define('TXT_NAME', __('Name', 'user-access-manager'));
124 - define('TXT_DESCRIPTION', __('Description', 'user-access-manager'));
125 - define('TXT_POSTS', __('Posts', 'user-access-manager'));
126 - define('TXT_PAGES', __('Pages', 'user-access-manager'));
127 - define('TXT_CATEGORY', __('Categories', 'user-access-manager'));
128 - define('TXT_USERS', __('Users', 'user-access-manager'));
129 - define('TXT_DELETE', __('Delete', 'user-access-manager'));
130 - define('TXT_UPDATE_GROUP', __('Update group', 'user-access-manager'));
131 - define('TXT_ADD', __('Add', 'user-access-manager'));
132 - define('TXT_ADD_GROUP', __('Add access group', 'user-access-manager'));
133 - define('TXT_GROUP_NAME', __('Access group name', 'user-access-manager'));
134 - define('TXT_GROUP_NAME_DESC', __('The name is used to identify the access user group.', 'user-access-manager'));
135 - define('TXT_GROUP_DESC', __('Access group description', 'user-access-manager'));
136 - define('TXT_GROUP_DESC_DESC', __('The description of the group.', 'user-access-manager'));
137 - define('TXT_GROUP_ADDED', __('Group was added successfully.', 'user-access-manager'));
138 - define('TXT_DEL_GROUP', __('Group(s) was deleted successfully.', 'user-access-manager'));
139 - define('TXT_NONE', __('none', 'user-access-manager'));
140 - define('TXT_ACCESS_GROUP_EDIT_SUC', __('Access group edit successfully.', 'user-access-manager'));
141 -
142 - //---Misc---
143 - define('TXT_FULL_ACCESS', __('Full access', 'user-access-manager'));
144 - define('TXT_FULL_ACCESS_ADMIN', __('Full access (Administrator)', 'user-access-manager'));
145 - define('TXT_NO_GROUP', __('No group', 'user-access-manager'));
146 - define('TXT_SET_ACCESS', __('Set access', 'user-access-manager'));
147 -
148 - define('TXT_DATE', __('Date', 'user-access-manager'));
149 - define('TXT_TITLE', __('Title', 'user-access-manager'));
150 - define('TXT_GROUP_ACCESS', __('Group access', 'user-access-manager'));
151 - define('TXT_FULL_ACCESS', __('Full access', 'user-access-manager'));
152 - define('TXT_USERNAME', __('Username', 'user-access-manager'));
153 -
154 - define('TXT_MAIL', __('E-mail', 'user-access-manager'));
155 - define('TXT_ACCESS', __('Access', 'user-access-manager'));
156 - define('TXT_ADMIN_HINT', __('<strong>Note:</strong> An administrator has allways access to all posts/pages.', 'user-access-manager'));
157 -
158 - define('TXT_SET_POST_ACCESS', __('Set post access', 'user-access-manager'));
159 - define('TXT_SET_PAGE_ACCESS', __('Set page access', 'user-access-manager'));
160 - define('TXT_GROUPS', __('Access Groups', 'user-access-manager'));
161 - define('TXT_CREATE_GROUP_FIRST', __('Please create a access group first.', 'user-access-manager'));
162 - define('TXT_SET_USER_ACCESS', __('Set user access', 'user-access-manager'));
163 -
164 - define('TXT_SET_UP_USERGROUPS', __('Set up usergroups', 'user-access-manager'));
165 -
166 - define('TXT_ITSELF', __('itself', 'user-access-manager'));
167 - define('TXT_INFO', __('Info', 'user-access-manager'));
168 - define('TXT_GROUP_INFO', __('Group infos', 'user-access-manager'));
169 - define('TXT_GROUP_LOCK_INFO', __('Locked by', 'user-access-manager'));
170 - define('TXT_IS_ADMIN', __('User is Admin. Full access.', 'user-access-manager'));
171 - define('TXT_EXPAND', __('expand', 'user-access-manager'));
172 - define('TXT_EXPAND_ALL', __('expand all', 'user-access-manager'));
173 - }
174 -
175 - function install()
176 - {
177 - $this->create_htaccess();
178 - $this->create_htpasswd();
179 -
180 - global $wpdb;
181 - $uam_db_version = "1.0";
182 - require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
183 -
184 - $charset_collate = '';
70 + return;
71 + }
185 72
186 - if ( version_compare(mysql_get_server_info(), '4.1.0', '>=') )
187 - {
188 - if ( ! empty($wpdb->charset) )
189 - $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
190 - if ( ! empty($wpdb->collate) )
191 - $charset_collate .= " COLLATE $wpdb->collate";
192 - }
193 -
194 - if($wpdb->get_var("show tables like '".DB_ACCESSGROUP."'") != DB_ACCESSGROUP)
195 - {
196 - $sql = "CREATE TABLE " . DB_ACCESSGROUP . " (
197 - ID int(11) NOT NULL auto_increment,
198 - groupname tinytext NOT NULL,
199 - groupdesc text NOT NULL,
200 - PRIMARY KEY (ID)
201 - ) $charset_collate;";
202 -
203 - dbDelta($sql);
204 - }
205 -
206 - if($wpdb->get_var("show tables like '".DB_ACCESSGROUP_TO_POST."'") != DB_ACCESSGROUP_TO_POST)
207 - {
208 - $sql = "CREATE TABLE " . DB_ACCESSGROUP_TO_POST . " (
209 - post_id int(11) NOT NULL,
210 - group_id int(11) NOT NULL,
211 - PRIMARY KEY (post_id,group_id)
212 - ) $charset_collate;";
213 -
214 - dbDelta($sql);
215 - }
216 -
217 - if($wpdb->get_var("show tables like '".DB_ACCESSGROUP_TO_USER."'") != DB_ACCESSGROUP_TO_USER)
218 - {
219 - $sql = "CREATE TABLE " . DB_ACCESSGROUP_TO_USER . " (
220 - user_id int(11) NOT NULL,
221 - group_id int(11) NOT NULL,
222 - PRIMARY KEY (user_id,group_id)
223 - ) $charset_collate;";
224 -
225 - dbDelta($sql);
226 - }
227 -
228 - if($wpdb->get_var("show tables like '".DB_ACCESSGROUP_TO_CATEGORY."'") != DB_ACCESSGROUP_TO_CATEGORY)
229 - {
230 - $sql = "CREATE TABLE " . DB_ACCESSGROUP_TO_CATEGORY . " (
231 - category_id int(11) NOT NULL,
232 - group_id int(11) NOT NULL,
233 - PRIMARY KEY (category_id,group_id)
234 - ) $charset_collate;";
235 -
236 - dbDelta($sql);
237 - }
238 -
239 - if($wpdb->get_var("show tables like '".DB_ACCESSGROUP_TO_ROLE."'") != DB_ACCESSGROUP_TO_ROLE)
240 - {
241 - $sql = "CREATE TABLE " . DB_ACCESSGROUP_TO_ROLE . " (
242 - role_name varchar(255) NOT NULL,
243 - group_id int(11) NOT NULL,
244 - PRIMARY KEY (role_name,group_id)
245 - ) $charset_collate;";
246 -
247 - dbDelta($sql);
248 - }
249 -
250 - add_option("uam_db_version", $uam_db_version);
251 - }
252 -
253 - function uninstall()
254 - {
255 - global $wpdb;
256 - $wpdb->query("DROP TABLE ".DB_ACCESSGROUP.", ".DB_ACCESSGROUP_TO_POST.", ".DB_ACCESSGROUP_TO_USER);
257 - }
258 -
259 - function create_htaccess($create_new = false)
260 - {
261 - // Make .htaccess file to protect data
262 -
263 - // get url
264 - $wud = wp_upload_dir();
265 - $url = $DOCUMENT_ROOT.$wud['basedir']."/";
266 -
267 - if(!file_exists($url.".htaccess") || $create_new)
268 - {
269 - $areaname = "WP-Files";
270 -
271 - $uamOptions = $this->getAdminOptions();
272 -
273 - $file_types = $uamOptions['locked_file_types'];
274 -
275 - $file_types = str_replace(",", "|", $file_types);
276 -
277 - // make .htaccess and .htpasswd
278 - $htaccess_txt = "<FilesMatch '\.(".$file_types.")'>\n";
279 - $htaccess_txt .= "AuthType Basic"."\n";
280 - $htaccess_txt .= "AuthName \"".$areaname."\""."\n";
281 - $htaccess_txt .= "AuthUserFile ".$url.".htpasswd"."\n";
282 - $htaccess_txt .= "require valid-user"."\n";
283 - $htaccess_txt .= "</FilesMatch>\n";
284 -
285 -
286 - // save files
287 - $htaccess= fopen($url.".htaccess", "w");
288 - fwrite($htaccess, $htaccess_txt);
289 - fclose($htaccess);
290 - }
291 - }
292 -
293 - function create_htpasswd($create_new = false)
294 - {
295 - // get url
296 - $wud = wp_upload_dir();
297 - $url = $DOCUMENT_ROOT.$wud['basedir']."/";
298 -
299 - if(!file_exists($url.".htpasswd") || $create_new)
300 - {
301 - $user = "admin";
302 -
303 - # create password
304 - $array = array();
305 -
306 - $length = 10;
307 - $capitals = true;
308 -
309 - if($length < 8)
310 - $length = mt_rand(8,20);
311 -
312 - # numbers
313 - for($i=48;$i<58;$i++)
314 - $array[] = chr($i);
315 -
316 - # small
317 - for($i=97;$i<122;$i++)
318 - $array[] = chr($i);
319 -
320 - # capitals
321 - if($capitals)
322 - for($i=65;$i<90;$i++)
323 - $array[] = chr($i);
324 -
325 - # specialchar:
326 - if($specialSigns)
327 - {
328 - for($i=33;$i<47;$i++)
329 - $array[] = chr($i);
330 - for($i=59;$i<64;$i++)
331 - $array[] = chr($i);
332 - for($i=91;$i<96;$i++)
333 - $array[] = chr($i);
334 - for($i=123;$i<126;$i++)
335 - $array[] = chr($i);
336 - }
337 -
338 - mt_srand((double)microtime()*1000000);
339 - $password = '';
340 -
341 - for ($i=1; $i<=$length; $i++)
342 - {
343 - $rnd = mt_rand( 0, count($array)-1 );
344 - $password .= $array[$rnd];
345 - }
346 -
347 - // make .htpasswd
348 - $htpasswd_txt .= "$user:".md5($password)."\n";
349 -
350 - // save file
351 - $htpasswd= fopen($url.".htpasswd", "w");
352 - fwrite($htpasswd, $htpasswd_txt);
353 - fclose($htpasswd);
354 - }
355 - }
356 -
357 - function delete_htaccess_files()
358 - {
359 - $wud = wp_upload_dir();
360 - $url = $DOCUMENT_ROOT.$wud['basedir']."/";
361 - unlink($url.".htaccess");
362 - unlink($url.".htpasswd");
363 - }
364 -
365 - //Returns an array of admin options
366 - function getAdminOptions()
367 - {
368 - $uamAdminOptions = array( 'hide_post_title' => 'false',
369 - 'post_title' => 'No rights!',
370 - 'hide_post_comment' => 'false',
371 - 'post_comment_content' => 'Sorry no rights to view comments!',
372 - 'post_content' => 'Sorry no rights!',
373 - 'hide_post' => 'false',
374 - 'hide_page_title' => 'false',
375 - 'page_title' => 'No rights!',
376 - 'page_content' => 'Sorry you have no rights to view this page!',
377 - 'hide_page' => 'false',
378 - 'redirect' => 'false',
379 - 'uam_redirect_custom_page' => '',
380 - 'uam_redirect_custom_url' => '',
381 - 'lock_recursive' => 'true',
382 - 'lock_file' => 'true',
383 - 'download_type' => 'fopen',
384 - 'locked_file_types' => 'zip,rar,tar,gz,bz2',
385 - 'blog_admin_hint' => 'true',
386 - 'blog_admin_hint_text' => '[L]',
387 - 'core_mod' => 'false');
388 -
389 - $uamOptions = get_option($this->adminOptionsName);
390 - if (!empty($uamOptions)) {
391 - foreach ($uamOptions as $key => $option)
392 - $uamAdminOptions[$key] = $option;
393 - }
394 - update_option($this->adminOptionsName, $uamAdminOptions);
395 - return $uamAdminOptions;
396 - }
397 -
398 - //Prints out the admin page
399 - function printAdminPage()
400 - {
401 - global $wpdb;
402 -
403 - $uamOptions = $this->getAdminOptions();
404 -
405 - if (isset($_POST['update_uam_settings']))
406 - {
407 - if (isset($_POST['uam_hide_post_title']))
408 - {
409 - $uamOptions['hide_post_title'] = $_POST['uam_hide_post_title'];
410 - }
411 - if (isset($_POST['uam_post_title']))
412 - {
413 - $uamOptions['post_title'] = $_POST['uam_post_title'];
414 - }
415 - if (isset($_POST['uam_post_content']))
416 - {
417 - $uamOptions['post_content'] = $_POST['uam_post_content'];
418 - }
419 - if (isset($_POST['uam_hide_post']))
420 - {
421 - $uamOptions['hide_post'] = $_POST['uam_hide_post'];
422 - }
423 - if (isset($_POST['uam_hide_post_comment']))
424 - {
425 - $uamOptions['hide_post_comment'] = $_POST['uam_hide_post_comment'];
426 - }
427 - if (isset($_POST['uam_post_comment_content']))
428 - {
429 - $uamOptions['post_comment_content'] = $_POST['uam_post_comment_content'];
430 - }
431 - if (isset($_POST['uam_hide_page_title']))
432 - {
433 - $uamOptions['hide_page_title'] = $_POST['uam_hide_page_title'];
434 - }
435 - if (isset($_POST['uam_page_title']))
436 - {
437 - $uamOptions['page_title'] = $_POST['uam_page_title'];
438 - }
439 - if (isset($_POST['uam_page_content']))
440 - {
441 - $uamOptions['page_content'] = $_POST['uam_page_content'];
442 - }
443 - if (isset($_POST['uam_hide_page']))
444 - {
445 - $uamOptions['hide_page'] = $_POST['uam_hide_page'];
446 - }
447 - if (isset($_POST['uam_redirect']))
448 - {
449 - $uamOptions['redirect'] = $_POST['uam_redirect'];
450 - }
451 - if (isset($_POST['uam_redirect_custom_page']))
452 - {
453 - $uamOptions['redirect_custom_page'] = $_POST['uam_redirect_custom_page'];
454 - }
455 - if (isset($_POST['uam_redirect_custom_url']))
456 - {
457 - $uamOptions['redirect_custom_url'] = $_POST['uam_redirect_custom_url'];
458 - }
459 - if (isset($_POST['uam_lock_recursive']))
460 - {
461 - $uamOptions['lock_recursive'] = $_POST['uam_lock_recursive'];
462 - }
463 - if (isset($_POST['uam_blog_admin_hint']))
464 - {
465 - $uamOptions['blog_admin_hint'] = $_POST['uam_blog_admin_hint'];
466 - }
467 - if (isset($_POST['uam_blog_admin_hint_text']))
468 - {
469 - $uamOptions['blog_admin_hint_text'] = $_POST['uam_blog_admin_hint_text'];
470 - }
471 - if (isset($_POST['uam_core_mod']))
472 - {
473 - $uamOptions['core_mod'] = $_POST['uam_core_mod'];
474 - }
475 - if (isset($_POST['uam_lock_file']))
476 - {
477 - if($_POST['uam_lock_file'] == 'false')
478 - {
479 - if($uamOptions['lock_file'] != $_POST['uam_lock_file'])
480 - $this->delete_htaccess_files();
481 - }
482 - else
483 - {
484 - if($uamOptions['lock_file'] != $_POST['uam_lock_file'])
485 - $lock_file_changed = true;
486 - }
487 - $uamOptions['lock_file'] = $_POST['uam_lock_file'];
488 - }
489 - if (isset($_POST['uam_download_type']))
490 - {
491 - $uamOptions['download_type'] = $_POST['uam_download_type'];
492 - }
493 - if (isset($_POST['uam_locked_file_types']))
494 - {
495 - if($uamOptions['locked_file_types'] != $_POST['uam_locked_file_types'])
496 - $locked_file_types_changed = true;
497 - else
498 - $locked_file_types_changed = false;
499 -
500 - $uamOptions['locked_file_types'] = $_POST['uam_locked_file_types'];
501 - }
502 -
503 - update_option($this->adminOptionsName, $uamOptions);
504 -
505 - if(($locked_file_types_changed || $lock_file_changed) && $uamOptions['lock_file'] != 'false')
506 - {
507 - $this->create_htaccess(true);
508 - $this->create_htpasswd(true);
509 - }
510 - ?>
511 - <div class="updated"><p><strong><?php echo TXT_UPDATE_SETTINGS; ?></strong></p></div>
512 - <?php
513 - }
514 -
515 - $cur_admin_page = $_GET['page'];
516 - $action = $_GET['action'];
517 -
518 - if($_POST['action'] == 'addgroup')
519 - {
520 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP." (ID, groupname, groupdesc) VALUES(NULL, '".$_POST['access_group_name']."', '".$_POST['access_group_description']."')");
521 -
522 - $group_id = $wpdb->insert_id;
523 -
524 - $roles = $_POST['roles'];
525 - if($roles)
526 - {
527 - foreach($roles as $role)
528 - {
529 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_ROLE." (group_id, role_name) VALUES('".$group_id."', '".$role."')");
530 - }
531 - }
532 -
533 - $posts = $_POST['post'];
534 - if($posts)
535 - {
536 - foreach($posts as $post)
537 - {
538 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_POST." (group_id, post_id) VALUES('".$group_id."', '".$post."')");
539 - }
540 - }
541 -
542 - $pages = $_POST['page'];
543 - if($pages)
544 - {
545 - foreach($pages as $page)
546 - {
547 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_POST." (group_id, post_id) VALUES('".$group_id."', '".$page."')");
548 - }
549 - }
550 -
551 - $categories = $_POST['category'];
552 - if($categories)
553 - {
554 - foreach($categories as $category)
555 - {
556 - echo $category;
557 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_CATEGORY." (group_id, category_id) VALUES('".$group_id."', '".$category."')");
558 - }
559 - }
560 -
561 - $users = $_POST['user'];
562 - if($users)
563 - {
564 - foreach($users as $user)
565 - {
566 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_USER." (group_id, user_id) VALUES('".$group_id."', '".$user."')");
567 - }
568 - }
569 - ?>
570 - <div class="updated"><p><strong><?php echo TXT_GROUP_ADDED; ?></strong></p></div>
571 - <?php
572 - }
573 -
574 - if($_POST['action'] == 'delgroup')
575 - {
576 - $del_ids = $_POST['delete'];
577 - if($del_ids)
578 - {
579 - foreach($del_ids as $del_id)
580 - {
581 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP." WHERE ID = $del_id LIMIT 1");
582 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_POST." WHERE group_id = $del_id LIMIT 1");
583 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_USER." WHERE group_id = $del_id LIMIT 1");
584 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_CATEGORY." WHERE group_id = $del_id LIMIT 1");
585 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_ROLE." WHERE group_id = $del_id LIMIT 1");
586 - }
587 - ?>
588 - <div class="updated"><p><strong><?php echo TXT_DEL_GROUP; ?></strong></p></div>
589 - <?php
590 - }
591 - }
592 -
593 - if($_POST['action'] == 'update_group')
594 - {
595 - $wpdb->query(" UPDATE ".DB_ACCESSGROUP."
596 - SET groupname = '".$_POST['access_group_name']."', groupdesc = '".$_POST['access_group_description']."'
597 - WHERE ID = ".$_POST['access_group_id']);
598 -
599 - $group_id = $_POST['access_group_id'];
600 -
601 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_ROLE." WHERE group_id = ".$group_id);
602 - $roles = $_POST['roles'];
603 - if($roles)
604 - {
605 - foreach($roles as $role)
606 - {
607 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_ROLE." (group_id, role_name) VALUES('".$group_id."', '".$role."')");
608 - }
609 - }
610 -
611 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_POST." WHERE group_id = ".$group_id);
612 - $posts = $_POST['post'];
613 - if($posts)
614 - {
615 - foreach($posts as $post)
616 - {
617 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_POST." (group_id, post_id) VALUES('".$group_id."', '".$post."')");
618 - }
619 - }
620 -
621 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_PAGE." WHERE group_id = ".$group_id);
622 - $pages = $_POST['page'];
623 - if($pages)
624 - {
625 - foreach($pages as $page)
626 - {
627 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_POST." (group_id, post_id) VALUES('".$group_id."', '".$page."')");
628 - }
629 - }
630 -
631 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_CATEGORY." WHERE group_id = ".$group_id);
632 - $categories = $_POST['category'];
633 - if($categories)
634 - {
635 - foreach($categories as $category)
636 - {
637 - echo $category;
638 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_CATEGORY." (group_id, category_id) VALUES('".$group_id."', '".$category."')");
639 - }
640 - }
641 -
642 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_USER." WHERE group_id = ".$group_id);
643 - $users = $_POST['user'];
644 - if($users)
645 - {
646 - foreach($users as $user)
647 - {
648 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_USER." (group_id, user_id) VALUES('".$group_id."', '".$user."')");
649 - }
650 - }
651 - ?>
652 - <div class="updated"><p><strong><?php echo TXT_ACCESS_GROUP_EDIT_SUC; ?></strong></p></div>
653 - <?php
654 - }
655 -
656 - if($cur_admin_page == 'uam_usergroup' AND !$action)
657 - {
658 - $accessgroups = $wpdb->get_results("SELECT *
659 - FROM ".DB_ACCESSGROUP."
660 - ORDER BY ID", ARRAY_A);
661 - ?>
662 - <div class=wrap>
663 - <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
664 - <input type="hidden" value="delgroup" name="action"/>
665 - <h2><?php echo TXT_MANAGE_GROUP; ?></h2>
666 - <div class="tablenav">
667 - <div class="alignleft">
668 - <input type="submit" class="button-secondary delete" name="deleteit" value="<?php echo TXT_DELETE; ?>"/>
669 - </div>
670 - <br class="clear"/>
671 - </div>
672 - <br class="clear"/>
673 - <table class="widefat">
674 - <thead>
675 - <tr class="thead">
676 - <th scope="col"></th>
677 - <th scope="col"><?php echo TXT_NAME; ?></th>
678 - <th scope="col"><?php echo TXT_DESCRIPTION; ?></th>
679 - <th scope="col"><?php echo TXT_POSTS; ?></th>
680 - <th scope="col"><?php echo TXT_PAGES; ?></th>
681 - <th scope="col"><?php echo TXT_CATEGORY; ?></th>
682 - <th scope="col"><?php echo TXT_USERS; ?></th>
683 - <th></th>
684 - </tr>
685 - </thead>
686 - <tbody>
687 - <?php
688 - if($accessgroups)
689 - {
690 - foreach($accessgroups as $accessgroup)
691 - {
692 - $group_info = $this->get_usergroup_info($accessgroup['ID']);
693 - ?>
694 - <tr class="alternate" id="group-<?php echo $accessgroup['ID']; ?>">
695 - <th class="check-column" scope="row"><input type="checkbox" value="<?php echo $accessgroup['ID']; ?>" name="delete[]"/></th>
696 - <td><strong><a href="?page=<?php echo $cur_admin_page; ?>&action=edit_group&id=<?php echo $accessgroup['ID']; ?>"><?php echo $accessgroup['groupname']; ?></a></strong></td>
697 - <td><?php echo $accessgroup['groupdesc']; ?></td>
698 - <td>
699 - <?php
700 - if($group_info->posts)
701 - {
702 - $expandcontent = null;
703 - foreach($group_info->posts as $post)
704 - {
705 - $expandcontent .= "<li>".$post->post_title."</li>";
706 - }
707 - echo "<a class='uam_info_link'>".count($group_info->posts)." ".TXT_POSTS."</a>";;
708 - echo "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul>";
709 - }
710 - else
711 - {
712 - echo TXT_NONE;
713 - }
714 - ?>
715 - </td>
716 - <td>
717 - <?php
718 - if($group_info->pages)
719 - {
720 - $expandcontent = null;
721 - foreach($group_info->pages as $page)
722 - {
723 - $expandcontent .= "<li>".$page->post_title."</li>";
724 - }
725 - echo "<a class='uam_info_link'>".count($group_info->pages)." ".TXT_PAGES."</a>";
726 - echo "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul>";
727 - }
728 - else
729 - {
730 - echo TXT_NONE;
731 - }
732 - ?>
733 - </td>
734 - <td>
735 - <?php
736 - if($group_info->categories)
737 - {
738 - $expandcontent = null;
739 - foreach($group_info->categories as $categorie)
740 - {
741 - $expandcontent .= "<li>".$categorie->cat_name."</li>";
742 - }
743 - echo "<a class='uam_info_link'>".count($group_info->categories)." ".TXT_CATEGORY."</a>";
744 - echo "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul>";
745 - }
746 - else
747 - {
748 - echo TXT_NONE;
749 - }
750 - ?>
751 - </td>
752 - <td>
753 - <?php
754 - if($group_info->users)
755 - {
756 - $expandcontent = null;
757 - foreach($group_info->users as $user)
758 - {
759 - $expandcontent .= "<li>".$user->nickname."</li>";
760 - }
761 - echo "<a class='uam_info_link'>".count($group_info->users)." ".TXT_USERS."</a>";
762 - echo "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul>";
763 - }
764 - else
765 - {
766 - echo TXT_NONE;
767 - }
768 - ?>
769 - </td>
770 - <td>
771 - <a class="uam_info_link_all" href="#"><?php echo TXT_EXPAND_ALL; ?></a>
772 - </td>
773 - </tr>
774 - <?php
775 - }
776 - }
777 - ?>
778 - </tbody>
779 - </table>
780 - </form>
781 - </div>
782 - <div class="wrap">
783 - <h2><?php echo TXT_ADD_GROUP; ?></h2>
784 - <div id="ajax-response"/>
785 - <form class="add:the-list: validate" action="<?php echo $_SERVER["REQUEST_URI"]; ?>" method="post" id="addgroup" name="addgroup">
786 - <input type="hidden" value="addgroup" name="action"/>
787 - <input type="hidden" value="<?php echo $uamOptions['lock_recursive']; ?>" name="uam_lock_recursive" id="uam_set_lock_recursive"/>
788 - <table class="form-table">
789 - <tbody>
790 - <tr class="form-field form-required">
791 - <th valign="top" scope="row"><?php echo TXT_GROUP_NAME; ?></th>
792 - <td><input type="text" aria-required="true" size="40" value="" id="access_group_name" name="access_group_name"/><br/>
793 - <?php echo TXT_GROUP_NAME_DESC; ?></td>
794 -
795 - </tr>
796 - <tr class="form-field form-required">
797 - <th valign="top" scope="row"><?php echo TXT_GROUP_DESC; ?></th>
798 - <td><input type="text" aria-required="true" size="40" value="" id="access_group_description" name="access_group_description"/><br/>
799 - <?php echo TXT_GROUP_DESC_DESC; ?></td>
800 - </tr>
801 - <tr>
802 - <th valign="top" scope="row"><?php echo TXT_GROUP_ROLE; ?></th>
803 - <td>
804 - <ul>
805 - <?php
806 - global $wp_roles;
807 -
808 - foreach($wp_roles->role_names as $role => $name)
809 - {
810 - $checked = $wpdb->get_results(" SELECT *
811 - FROM ".DB_ACCESSGROUP_TO_ROLE."
812 - WHERE role_name = '".$role."'
813 - AND group_id = ".$group_id, ARRAY_A)
814 - ?>
815 - <li class="selectit">
816 - <input id="role-<?php echo $role; ?>" type="checkbox" <?php if($checked){ echo 'checked="checked"'; } ?>value="<?php echo $role; ?>" name="roles[]"/>
817 - <label for="role-<?php echo $role; ?>"><?php echo $role ?></label>
818 - </li>
819 - <?php
820 - }
821 - ?>
822 - </ul>
823 - </td>
824 - </tr>
825 - <tr>
826 - <?php
827 - $args = array('numberposts' => -1);
828 - $posts = get_posts($args);
829 - ?>
830 - <th valign="top" scope="row"><?php echo TXT_POSTS; if(count($posts) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; }?></th>
831 - <td>
832 - <?php
833 - echo "<strong>".count($posts)." ".TXT_POSTS."</strong>";
834 - if($posts)
835 - {
836 - echo "<ul class='uam_group_stuff'>";
837 - foreach($posts as $post)
838 - {
839 - $checked = $wpdb->get_results(" SELECT *
840 - FROM ".DB_ACCESSGROUP_TO_POST."
841 - WHERE post_id = ".$post->ID."
842 - AND group_id = ".$group_id, ARRAY_A);
843 - ?>
844 - <li class="selectit">
845 - <input id="post-<?php echo $post->ID; ?>" type="checkbox" value="<?php echo $post->ID; if($checked){ echo 'checked="checked"'; } ?>" name="post[]"/>
846 - <label for="post-<?php echo $post->ID; ?>"><strong><?php echo $post->post_title; ?></strong> - <?php echo $post->post_date; ?></label>
847 - <?php
848 -
849 - ?>
850 - </li>
851 - <?php
852 - }
853 - echo "</ul>";
854 - }
855 - ?>
856 - </td>
857 - </tr>
858 - <tr>
859 - <?php
860 - $posts = get_pages('sort_column=menu_order');
861 - ?>
862 - <th valign="top" scope="row"><?php echo TXT_PAGES; if(count($posts) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; } ?></th>
863 - <td>
864 - <?php
865 - echo "<strong>".count($posts)." ".TXT_PAGES."</strong>";
866 - if($posts)
867 - {
868 - echo "<ul class='uam_group_stuff'>";
869 - $deepness = 0;
870 -
871 - foreach($posts as $post)
872 - {
873 - $old_deepness = $deepness;
874 - $deepness = 0;
875 -
876 - if($post->post_parent != 0)
877 - {
878 - $cur_post = $post;
879 - $cur_id = $post->ID;
880 - while($cur_post->post_parent != 0)
881 - {
882 - $deepness++;
883 - $cur_parent_id = $cur_post->post_parent;
884 - $cur_post = & get_post($cur_parent_id);
885 - }
886 - }
887 -
888 - if($old_deepness > $deepness)
889 - {
890 - $count = abs($old_deepness - $deepness);
891 - for($i = 0; $i < $count; $i++)
892 - echo "</ul>";
893 - }
894 - elseif($old_deepness < $deepness)
895 - {
896 - $count = abs($old_deepness - $deepness);
897 - for($i = 0; $i < $count; $i++)
898 - echo "<ul class='uam_group_stuff_child'>";
899 - }
900 -
901 - $checked = $wpdb->get_results(" SELECT *
902 - FROM ".DB_ACCESSGROUP_TO_POST."
903 - WHERE post_id = ".$post->ID."
904 - AND group_id = ".$group_id, ARRAY_A);
905 - ?>
906 - <li class="selectit">
907 - <input id="post-<?php echo $post->ID; ?>" type="checkbox" value="<?php echo $post->ID; if($checked){ echo 'checked="checked"'; } ?>" name="page[]"/>
908 - <label for="post-<?php echo $post->ID; ?>"><strong><?php echo $post->post_title; ?></strong> - <?php echo $post->post_date; ?></label>
909 - </li>
910 - <?php
911 - }
912 - echo "</ul>";
913 - }
914 - ?>
915 - </td>
916 - </tr>
917 - <tr>
918 - <?php
919 - $categories = get_categories();
920 - ?>
921 - <th valign="top" scope="row"><?php echo TXT_CATEGORY; if(count($categories) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; } ?></th>
922 - <td>
923 - <?php
924 - echo "<strong>".count($categories)." ".TXT_CATEGORY."</strong>";
925 -
926 - function print_elements($category = 0, $deepness = 0)
927 - {
928 - global $wpdb;
929 -
930 - $args = array('child_of' => $category);
931 - $categories = get_categories($args);
932 -
933 - if($categories)
934 - {
935 - if($category == 0)
936 - echo "<ul class='uam_group_stuff'>";
937 - else
938 - echo "<ul>";
939 -
940 - foreach($categories as $cat)
941 - {
942 - if($cat->parent == $category)
943 - {
944 - $checked = $wpdb->get_results(" SELECT *
945 - FROM ".DB_ACCESSGROUP_TO_CATEGORY."
946 - WHERE category_id = ".$cat->term_id."
947 - AND group_id = ".$group_id, ARRAY_A);
948 - ?>
949 - <li class="selectit">
950 - <input id="category-<?php echo $cat->term_id; ?>" type="checkbox" name="category[]" value="<?php echo $cat->term_id; if($checked){ echo 'checked="checked"'; } ?>" />
951 - <label for="category-<?php echo $cat->term_id; ?>"><strong><?php echo $cat->cat_name; ?></strong></label>
952 - </li>
953 - <?php
954 - print_elements($cat->term_id, $deepness++);
955 - }
956 - }
957 - echo "</ul>";
958 - }
959 - }
960 -
961 - $callFkt = "print_elements";
962 - echo $callFkt();
963 - ?>
964 - </td>
965 - </tr>
966 - <tr>
967 - <?php
968 - $users = $wpdb->get_results(" SELECT ID
969 - FROM $wpdb->users
970 - ORDER BY ID", ARRAY_A);
971 - ?>
972 - <th valign="top" scope="row"><?php echo TXT_USERS; if(count($users) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; } ?></th>
973 - <td>
974 - <?php
975 - echo "<strong>".count($users)." ".TXT_USERS."</strong>";
976 - if($users)
977 - {
978 - echo "<ul class='uam_group_stuff'>";
979 - foreach($users as $user)
980 - {
981 - $cur_user = get_userdata($user['ID']);
982 - $checked = $wpdb->get_results(" SELECT *
983 - FROM ".DB_ACCESSGROUP_TO_USER."
984 - WHERE user_id = ".$cur_user->ID."
985 - AND group_id = ".$group_id, ARRAY_A);
986 - ?>
987 - <li class="selectit">
988 - <?php
989 - if($cur_user->{$wpdb->prefix."capabilities"}['administrator'] != 1)
990 - {
991 - ?>
992 - <input id="user-<?php echo $cur_user->ID; ?>" type="checkbox" value="<?php echo $cur_user->ID; if($checked){ echo 'checked="checked"'; } ?>" name="user[]"/>
993 - <label for="user-<?php echo $cur_user->ID; ?>"><strong><?php echo $cur_user->nickname; ?></strong> - <?php echo $cur_user->user_firstname." ".$cur_user->user_lastname; ?>
994 - <?php
995 - }
996 - else
997 - {
998 - ?>
999 - <strong><?php echo $cur_user->nickname; ?></strong> - <?php echo $cur_user->user_firstname." ".$cur_user->user_lastname; ?>
1000 - <?php
1001 - echo "(".TXT_IS_ADMIN.")";
1002 - }
1003 - ?>
1004 -
1005 - </li>
1006 - <?php
1007 - }
1008 - echo "</ul>";
1009 - }
1010 - ?>
1011 - </td>
1012 - </tr>
1013 - </tbody>
1014 - </table>
1015 - <p class="submit"><input type="submit" value="<?php echo TXT_ADD; ?>" name="submit" class="button"/></p>
1016 - </form>
1017 - </div>
1018 - <?php
1019 - }
1020 - elseif($cur_admin_page == 'uam_settings' AND !$action)
1021 - {
1022 - ?>
1023 - <div class=wrap>
1024 - <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?>">
1025 - <h2><?php echo TXT_SETTINGS; ?></h2>
1026 - <h3><?php echo TXT_POST_SETTING; ?></h3>
1027 - <p><?php echo TXT_POST_SETTING_DESC; ?></p>
1028 - <table class="form-table">
1029 - <tbody>
1030 - <tr valign="top">
1031 - <th scope="row">
1032 - <?php echo TXT_HIDE_POST; ?>
1033 - </th>
1034 - <td>
1035 - <label for="uam_hide_post_yes">
1036 - <input type="radio" id="uam_hide_post_yes" class="uam_hide_post" name="uam_hide_post" value="true" <?php if ($uamOptions['hide_post'] == "true") { echo 'checked="checked"'; }?> />
1037 - <?php echo TXT_YES; ?>
1038 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1039 - <label for="uam_hide_post_no">
1040 - <input type="radio" id="uam_hide_post_no" class="uam_hide_post" name="uam_hide_post" value="false" <?php if ($uamOptions['hide_post'] == "false") { echo 'checked="checked"'; }?>/>
1041 - <?php echo TXT_NO; ?>
1042 - </label>
1043 - <br />
1044 - <?php echo TXT_HIDE_POST_DESC; ?>
1045 - </td>
1046 - </tr>
1047 - </tbody>
1048 - </table>
1049 - <table class="form-table" id="uam_post_settings">
1050 - <tbody>
1051 - <tr valign="top">
1052 - <th scope="row">
1053 - <?php echo TXT_DISPLAY_POST_TITLE; ?>
1054 - </th>
1055 - <td>
1056 - <label for="uam_hide_post_title_yes">
1057 - <input type="radio" id="uam_hide_post_title_yes" name="uam_hide_post_title" value="true" <?php if ($uamOptions['hide_post_title'] == "true") { echo 'checked="checked"'; }?> />
1058 - <?php echo TXT_YES; ?>
1059 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1060 - <label for="uam_hide_post_title_no">
1061 - <input type="radio" id="uam_hide_post_title_no" name="uam_hide_post_title" value="false" <?php if ($uamOptions['hide_post_title'] == "false") { echo 'checked="checked"'; }?>/>
1062 - <?php echo TXT_NO; ?>
1063 - </label>
1064 - <br />
1065 - <?php echo TXT_DISPLAY_POST_TITLE_DESC; ?>
1066 - </td>
1067 - </tr>
1068 - <tr valign="top">
1069 - <th scope="row">
1070 - <?php echo TXT_POST_TITLE; ?>
1071 - </th>
1072 - <td>
1073 - <input name="uam_post_title" value="<?php echo $uamOptions['post_title']; ?>" />
1074 - <br />
1075 - <?php echo TXT_POST_TITLE_DESC; ?>
1076 - </td>
1077 - </tr>
1078 - <tr valign="top">
1079 - <th scope="row">
1080 - <?php echo TXT_POST_CONTENT; ?>
1081 - </th>
1082 - <td>
1083 - <textarea name="uam_post_content" style="width: 80%; height: 100px;"><?php echo apply_filters('format_to_edit',$uamOptions['post_content']); ?></textarea>
1084 - <br />
1085 - <?php echo TXT_POST_CONTENT_DESC; ?>
1086 - </td>
1087 - </tr>
1088 - <tr valign="top">
1089 - <th scope="row">
1090 - <?php echo TXT_DISPLAY_POST_COMMENT; ?>
1091 - </th>
1092 - <td>
1093 - <label for="uam_hide_post_comment_yes">
1094 - <input type="radio" name="uam_hide_post_comment" value="true" <?php if ($uamOptions['hide_post_comment'] == "true") { echo 'checked="checked"'; }?> />
1095 - <?php echo TXT_YES; ?>
1096 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1097 - <label for="uam_hide_post_comment_no">
1098 - <input type="radio"name="uam_hide_post_comment" value="false" <?php if ($uamOptions['hide_post_comment'] == "false") { echo 'checked="checked"'; }?>/>
1099 - <?php echo TXT_NO; ?>
1100 - </label>
1101 - <br />
1102 - <?php echo TXT_DISPLAY_POST_COMMENT_DESC; ?>
1103 - </td>
1104 - </tr>
1105 - <tr valign="top">
1106 - <th scope="row">
1107 - <?php echo TXT_POST_COMMENT_CONTENT; ?>
1108 - </th>
1109 - <td>
1110 - <input name="uam_post_comment_content" value="<?php echo $uamOptions['post_comment_content']; ?>" />
1111 - <br />
1112 - <?php echo TXT_POST_COMMENT_CONTENT_DESC; ?>
1113 - </td>
1114 - </tr>
1115 - </tbody>
1116 - </table>
1117 - <h3><?php echo TXT_PAGE_SETTING; ?></h3>
1118 - <p><?php echo TXT_PAGE_SETTING_DESC; ?></p>
1119 - <table class="form-table">
1120 - <tbody>
1121 - <tr>
1122 - <th>
1123 - <?php echo TXT_HIDE_PAGE; ?>
1124 - </th>
1125 - <td>
1126 - <label for="uam_hide_page_yes">
1127 - <input type="radio" id="uam_hide_page_yes" class="uam_hide_page" name="uam_hide_page" value="true" <?php if ($uamOptions['hide_page'] == "true") { echo 'checked="checked"'; }?> />
1128 - <?php echo TXT_YES; ?>
1129 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1130 - <label for="uam_hide_page_no">
1131 - <input type="radio" id="uam_hide_page_no" class="uam_hide_page" name="uam_hide_page" value="false" <?php if ($uamOptions['hide_page'] == "false") { echo 'checked="checked"'; }?>/>
1132 - <?php echo TXT_NO; ?>
1133 - </label>
1134 - <br />
1135 - <?php echo TXT_HIDE_PAGE_DESC; ?>
1136 - </td>
1137 - </tr>
1138 - </tbody>
1139 - </table>
1140 - <table class="form-table" id="uam_page_settings">
1141 - <tbody>
1142 - <tr valign="top">
1143 - <th scope="row">
1144 - <?php echo TXT_DISPLAY_PAGE_TITLE; ?>
1145 - </th>
1146 - <td>
1147 - <label for="uam_hide_page_title_yes">
1148 - <input type="radio" id="uam_hide_page_title_yes" name="uam_hide_page_title" value="true" <?php if ($uamOptions['hide_page_title'] == "true") { echo 'checked="checked"'; }?> />
1149 - <?php echo TXT_YES; ?>
1150 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1151 - <label for="uam_hide_page_title_no">
1152 - <input type="radio" id="uam_hide_page_title_no" name="uam_hide_page_title" value="false" <?php if ($uamOptions['hide_page_title'] == "false") { echo 'checked="checked"'; }?>/>
1153 - <?php echo TXT_NO; ?>
1154 - </label>
1155 - <br />
1156 - <?php echo TXT_DISPLAY_PAGE_TITLE_DESC; ?>
1157 - </td>
1158 - </tr>
1159 - <tr>
1160 - <th>
1161 - <?php echo TXT_PAGE_TITLE; ?>
1162 - </th>
1163 - <td>
1164 - <input name="uam_page_title" value="<?php echo $uamOptions['page_title']; ?>" />
1165 - <br />
1166 - <?php echo TXT_PAGE_TITLE_DESC; ?>
1167 - </td>
1168 - </tr>
1169 - <tr>
1170 - <th>
1171 - <?php echo TXT_PAGE_CONTENT; ?>
1172 - </th>
1173 - <td>
1174 - <textarea name="uam_page_content" style="width: 80%; height: 100px;"><?php echo apply_filters('format_to_edit',$uamOptions['page_content']); ?></textarea>
1175 - <br />
1176 - <?php echo TXT_PAGE_CONTENT_DESC; ?>
1177 - </td>
1178 - </tr>
1179 - </tbody>
1180 - </table>
1181 - <h3><?php echo TXT_FILE_SETTING; ?></h3>
1182 - <p><?php echo TXT_FILE_SETTING_DESC; ?></p>
1183 - <table class="form-table">
1184 - <tbody>
1185 - <tr>
1186 - <th>
1187 - <?php echo TXT_LOCK_FILE; ?>
1188 - </th>
1189 - <td>
1190 - <label for="uam_lock_file_yes">
1191 - <input type="radio" id="uam_lock_file_yes" class="uam_lock_file" name="uam_lock_file" value="true" <?php if ($uamOptions['lock_file'] == "true") { echo 'checked="checked"'; }?> />
1192 - <?php echo TXT_YES; ?>
1193 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1194 - <label for="uam_lock_file_no">
1195 - <input type="radio" id="uam_lock_file_no" class="uam_lock_file" name="uam_lock_file" value="false" <?php if ($uamOptions['lock_file'] == "false") { echo 'checked="checked"'; }?>/>
1196 - <?php echo TXT_NO; ?>
1197 - </label>
1198 - <br />
1199 - <?php echo TXT_LOCK_FILE_DESC; ?>
1200 - </td>
1201 - </tr>
1202 - </tbody>
1203 - </table>
1204 - <table class="form-table" id="uam_file_settings">
1205 - <tbody>
1206 - <tr>
1207 - <th>
1208 - <?php echo TXT_DOWNLOAD_FILE_TYPE; ?>
1209 - </th>
1210 - <td>
1211 - <input name="uam_locked_file_types" value="<?php echo $uamOptions['locked_file_types']; ?>" />
1212 - <br />
1213 - <?php echo TXT_DOWNLOAD_FILE_TYPE_DESC; ?>
1214 - </td>
1215 - </tr>
1216 - <tr>
1217 - <th>
1218 - <?php echo TXT_DOWNLOAD_TYPE; ?>
1219 - </th>
1220 - <td>
1221 - <label for="uam_download_type_normal">
1222 - <input type="radio" id="uam_download_type_normal" name="uam_download_type" value="normal" <?php if ($uamOptions['download_type'] == "normal") { echo 'checked="checked"'; }?> />
1223 - <?php echo TXT_NORMAL; ?>
1224 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1225 - <label for="uam_download_type_fopen">
1226 - <input type="radio" id="uam_download_type_fopen" name="uam_download_type" value="fopen" <?php if ($uamOptions['download_type'] == "fopen") { echo 'checked="checked"'; }?>/>
1227 - <?php echo TXT_FOPEN; ?>
1228 - </label>
1229 - <br />
1230 - <?php echo TXT_DOWNLOAD_TYPE_DESC; ?>
1231 - </td>
1232 - </tr>
1233 - </tbody>
1234 - </table>
1235 - <h3><?php echo TXT_OTHER_SETTING; ?></h3>
1236 - <p><?php echo TXT_OTHER_SETTING_DESC; ?></p>
1237 - <table class="form-table">
1238 - <tbody>
1239 - <tr>
1240 - <th>
1241 - <?php echo TXT_REDIRECT; ?>
1242 - </th>
1243 - <td>
1244 - <label for="uam_redirect_no">
1245 - <input type="radio" id="uam_redirect_no" name="uam_redirect" value="false" <?php if ($uamOptions['redirect'] == "false") { echo 'checked="checked"'; }?> />
1246 - <?php echo TXT_NO; ?>
1247 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1248 - <label for="uam_redirect_blog">
1249 - <input type="radio" id="uam_redirect_blog" name="uam_redirect" value="blog" <?php if ($uamOptions['redirect'] == "blog") { echo 'checked="checked"'; }?> />
1250 - <?php echo TXT_REDIRECT_TO_BOLG; ?>
1251 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1252 - <label for="uam_redirect_custom_page">
1253 - <input type="radio" id="uam_redirect_custom_p" name="uam_redirect" value="custom_page" <?php if ($uamOptions['redirect'] == "custom_page") { echo 'checked="checked"'; }?>/>
1254 - <?php echo TXT_REDIRECT_TO_PAGE; ?>
1255 - </label><input name="uam_redirect_custom_page" value="<?php echo $uamOptions['redirect_custom_page']; ?>" />&nbsp;&nbsp;&nbsp;&nbsp;
1256 - <label for="uam_redirect_custom_url">
1257 - <input type="radio" id="uam_redirect_custom_u" name="uam_redirect" value="custom_url" <?php if ($uamOptions['redirect'] == "custom_url") { echo 'checked="checked"'; }?>/>
1258 - <?php echo TXT_REDIRECT_TO_URL; ?>
1259 - </label><input name="uam_redirect_custom_url" value="<?php echo $uamOptions['redirect_custom_url']; ?>" />
1260 - <br />
1261 - <?php echo TXT_REDIRECT_DESC; ?>
1262 - </td>
1263 - </tr>
1264 - <tr>
1265 - <th>
1266 - <?php echo TXT_LOCK_RECURSIVE; ?>
1267 - </th>
1268 - <td>
1269 - <label for="uam_lock_recursive_yes">
1270 - <input type="radio" id="uam_lock_recursive_yes" name="uam_lock_recursive" value="true" <?php if ($uamOptions['lock_recursive'] == "true") { echo 'checked="checked"'; }?> />
1271 - <?php echo TXT_YES; ?>
1272 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1273 - <label for="uam_lock_recursive_no">
1274 - <input type="radio" id="uam_lock_recursive_no" name="uam_lock_recursive" value="false" <?php if ($uamOptions['lock_recursive'] == "false") { echo 'checked="checked"'; }?>/>
1275 - <?php echo TXT_NO; ?>
1276 - </label>
1277 - <br />
1278 - <?php echo TXT_LOCK_RECURSIVE_DESC; ?>
1279 - </td>
1280 - </tr>
1281 - <tr>
1282 - <th>
1283 - <?php echo TXT_BLOG_ADMIN_HINT; ?>
1284 - </th>
1285 - <td>
1286 - <label for="uam_blog_admin_hint_yes">
1287 - <input type="radio" id="uam_blog_admin_hint_yes" name="uam_blog_admin_hint" value="true" <?php if ($uamOptions['blog_admin_hint'] == "true") { echo 'checked="checked"'; }?> />
1288 - <?php echo TXT_YES; ?>
1289 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1290 - <label for="uam_blog_admin_hint_no">
1291 - <input type="radio" id="uam_blog_admin_hint_no" name="uam_blog_admin_hint" value="false" <?php if ($uamOptions['blog_admin_hint'] == "false") { echo 'checked="checked"'; }?>/>
1292 - <?php echo TXT_NO; ?>
1293 - </label>
1294 - <br />
1295 - <?php echo TXT_BLOG_ADMIN_HINT_DESC; ?>
1296 - </td>
1297 - </tr>
1298 - <tr>
1299 - <th>
1300 - <?php echo TXT_BLOG_ADMIN_HINT_TEXT; ?>
1301 - </th>
1302 - <td>
1303 - <input name="uam_blog_admin_hint_text" value="<?php echo $uamOptions['blog_admin_hint_text']; ?>" />
1304 - <br />
1305 - <?php echo TXT_BLOG_ADMIN_HINT_TEXT_DESC; ?>
1306 - </td>
1307 - </tr>
1308 - <?php
1309 - global $wp_version;
1310 -
1311 - if($wp_version < 2.8)
1312 - {
1313 - ?>
1314 - <tr>
1315 - <th>
1316 - <?php echo TXT_CORE_MOD; ?>
1317 - </th>
1318 - <td>
1319 - <label for="uam_core_mod_yes">
1320 - <input type="radio" id="uam_core_mod_yes" name="uam_core_mod" value="true" <?php if ($uamOptions['core_mod'] == "true") { echo 'checked="checked"'; }?> />
1321 - <?php echo TXT_YES; ?>
1322 - </label>&nbsp;&nbsp;&nbsp;&nbsp;
1323 - <label for="uam_core_mod_no">
1324 - <input type="radio" id="uam_core_mod_no" name="uam_core_mod" value="false" <?php if ($uamOptions['core_mod'] == "false") { echo 'checked="checked"'; }?>/>
1325 - <?php echo TXT_NO; ?>
1326 - </label>
1327 - <br />
1328 - <?php echo TXT_CORE_MOD_DESC; ?>
1329 - </td>
1330 - </tr>
1331 - <?php
1332 - }
1333 - ?>
1334 - </tbody>
1335 - </table>
1336 - <div class="submit">
1337 - <input type="submit" name="update_uam_settings" value="<?php echo TXT_UPDATE_SETTING; ?>" />
1338 - </div>
1339 - </form>
1340 - </div>
1341 - <?php
1342 - }
1343 - elseif($action == 'edit_group')
1344 - {
1345 - $group_id = $_GET['id'];
1346 - $accessgroup = $wpdb->get_row(" SELECT *
1347 - FROM ".DB_ACCESSGROUP."
1348 - WHERE ID = ".$group_id."
1349 - LIMIT 1", ARRAY_A);
1350 - ?>
1351 - <div class=wrap>
1352 - <form method="post" action="<?php echo reset(explode("?", $_SERVER["REQUEST_URI"]))."?page=".$_GET['page']; ?>">
1353 - <input type="hidden" value="update_group" name="action"/>
1354 - <input type="hidden" value="<?php echo $group_id; ?>" name="access_group_id"/>
1355 - <input type="hidden" value="<?php echo $uamOptions['lock_recursive']; ?>" name="uam_lock_recursive" id="uam_set_lock_recursive"/>
1356 - <table class="form-table">
1357 - <tbody>
1358 - <tr class="form-field form-required">
1359 - <th valign="top" scope="row"><?php echo TXT_GROUP_NAME; ?></th>
1360 - <td><input type="text" aria-required="true" size="40" value="<?php echo $accessgroup["groupname"];?>" id="access_group_name" name="access_group_name"/><br/>
1361 - <?php echo TXT_GROUP_NAME_DESC; ?></td>
1362 - </tr>
1363 - <tr class="form-field form-required">
1364 - <th valign="top" scope="row"><?php echo TXT_GROUP_DESC; ?></th>
1365 - <td><input type="text" aria-required="true" size="40" value="<?php echo $accessgroup["groupdesc"];?>" id="access_group_description" name="access_group_description"/><br/>
1366 - <?php echo TXT_GROUP_DESC_DESC; ?></td>
1367 - </tr>
1368 - <tr>
1369 - <th valign="top" scope="row"><?php echo TXT_GROUP_ROLE; ?></th>
1370 - <td>
1371 - <ul>
1372 - <?php
1373 - global $wp_roles;
1374 -
1375 - foreach($wp_roles->role_names as $role => $name)
1376 - {
1377 - $checked = $wpdb->get_results(" SELECT *
1378 - FROM ".DB_ACCESSGROUP_TO_ROLE."
1379 - WHERE role_name = '".$role."'
1380 - AND group_id = ".$group_id, ARRAY_A)
1381 - ?>
1382 - <li class="selectit">
1383 - <input id="role-<?php echo $role; ?>" type="checkbox" <?php if($checked){ echo 'checked="checked"'; } ?>value="<?php echo $role; ?>" name="roles[]"/>
1384 - <label for="role-<?php echo $role; ?>"><?php echo $role ?></label>
1385 - </li>
1386 - <?php
1387 - }
1388 - ?>
1389 - </ul>
1390 - </td>
1391 - </tr>
1392 - <tr>
1393 - <?php
1394 - $args = array('numberposts' => -1);
1395 - $posts = get_posts($args);
1396 - ?>
1397 - <th valign="top" scope="row"><?php echo TXT_POSTS; if(count($posts) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; }?></th>
1398 - <td>
1399 - <?php
1400 - echo "<strong>".count($posts)." ".TXT_POSTS."</strong>";
1401 - if($posts)
1402 - {
1403 - echo "<ul class='uam_group_stuff'>";
1404 - foreach($posts as $post)
1405 - {
1406 - $checked = $wpdb->get_results(" SELECT *
1407 - FROM ".DB_ACCESSGROUP_TO_POST."
1408 - WHERE post_id = ".$post->ID."
1409 - AND group_id = ".$group_id, ARRAY_A);
1410 - ?>
1411 - <li class="selectit">
1412 - <input id="post-<?php echo $post->ID; ?>" type="checkbox" value="<?php echo $post->ID; if($checked){ echo 'checked="checked"'; } ?>" name="post[]"/>
1413 - <label for="post-<?php echo $post->ID; ?>"><strong><?php echo $post->post_title; ?></strong> - <?php echo $post->post_date; ?></label>
1414 - <?php
1415 -
1416 - ?>
1417 - </li>
1418 - <?php
1419 - }
1420 - echo "</ul>";
1421 - }
1422 - ?>
1423 - </td>
1424 - </tr>
1425 - <tr>
1426 - <?php
1427 - $posts = get_pages('sort_column=menu_order');
1428 - ?>
1429 - <th valign="top" scope="row"><?php echo TXT_PAGES; if(count($posts) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; } ?></th>
1430 - <td>
1431 - <?php
1432 - echo "<strong>".count($posts)." ".TXT_PAGES."</strong>";
1433 - if($posts)
1434 - {
1435 - echo "<ul class='uam_group_stuff'>";
1436 - $deepness = 0;
1437 -
1438 - foreach($posts as $post)
1439 - {
1440 - $old_deepness = $deepness;
1441 - $deepness = 0;
1442 -
1443 - if($post->post_parent != 0)
1444 - {
1445 - $cur_post = $post;
1446 - $cur_id = $post->ID;
1447 - while($cur_post->post_parent != 0)
1448 - {
1449 - $deepness++;
1450 - $cur_parent_id = $cur_post->post_parent;
1451 - $cur_post = & get_post($cur_parent_id);
1452 - }
1453 - }
1454 -
1455 - if($old_deepness > $deepness)
1456 - {
1457 - $count = abs($old_deepness - $deepness);
1458 - for($i = 0; $i < $count; $i++)
1459 - echo "</ul>";
1460 - }
1461 - elseif($old_deepness < $deepness)
1462 - {
1463 - $count = abs($old_deepness - $deepness);
1464 - for($i = 0; $i < $count; $i++)
1465 - echo "<ul class='uam_group_stuff_child'>";
1466 - }
1467 -
1468 - $checked = $wpdb->get_results(" SELECT *
1469 - FROM ".DB_ACCESSGROUP_TO_POST."
1470 - WHERE post_id = ".$post->ID."
1471 - AND group_id = ".$group_id, ARRAY_A);
1472 - ?>
1473 - <li class="selectit">
1474 - <input id="post-<?php echo $post->ID; ?>" type="checkbox" value="<?php echo $post->ID; if($checked){ echo 'checked="checked"'; } ?>" name="page[]"/>
1475 - <label for="post-<?php echo $post->ID; ?>"><strong><?php echo $post->post_title; ?></strong> - <?php echo $post->post_date; ?></label>
1476 - </li>
1477 - <?php
1478 - }
1479 - echo "</ul>";
1480 - }
1481 - ?>
1482 - </td>
1483 - </tr>
1484 - <tr>
1485 - <?php
1486 - $categories = get_categories();
1487 - ?>
1488 - <th valign="top" scope="row"><?php echo TXT_CATEGORY; if(count($categories) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; } ?></th>
1489 - <td>
1490 - <?php
1491 - echo "<strong>".count($categories)." ".TXT_CATEGORY."</strong>";
1492 -
1493 - function print_elements($category = 0, $deepness = 0)
1494 - {
1495 - global $wpdb;
1496 -
1497 - $args = array('child_of' => $category);
1498 - $categories = get_categories($args);
1499 -
1500 - if($categories)
1501 - {
1502 - if($category == 0)
1503 - echo "<ul class='uam_group_stuff'>";
1504 - else
1505 - echo "<ul>";
1506 -
1507 - foreach($categories as $cat)
1508 - {
1509 - if($cat->parent == $category)
1510 - {
1511 - $checked = $wpdb->get_results(" SELECT *
1512 - FROM ".DB_ACCESSGROUP_TO_CATEGORY."
1513 - WHERE category_id = ".$cat->term_id."
1514 - AND group_id = ".$group_id, ARRAY_A);
1515 - ?>
1516 - <li class="selectit">
1517 - <input id="category-<?php echo $cat->term_id; ?>" type="checkbox" name="category[]" value="<?php echo $cat->term_id; if($checked){ echo 'checked="checked"'; } ?>" />
1518 - <label for="category-<?php echo $cat->term_id; ?>"><strong><?php echo $cat->cat_name; ?></strong></label>
1519 - </li>
1520 - <?php
1521 - print_elements($cat->term_id, $deepness++);
1522 - }
1523 - }
1524 - echo "</ul>";
1525 - }
1526 - }
1527 -
1528 - $callFkt = "print_elements";
1529 - echo $callFkt();
1530 - ?>
1531 - </td>
1532 - </tr>
1533 - <tr>
1534 - <?php
1535 - $users = $wpdb->get_results(" SELECT ID
1536 - FROM $wpdb->users
1537 - ORDER BY ID", ARRAY_A);
1538 - ?>
1539 - <th valign="top" scope="row"><?php echo TXT_USERS; if(count($users) > 0){ echo " <label>(<a class='selectit uam_group_stuff_link'>".TXT_EXPAND."</a>)</label>"; } ?></th>
1540 - <td>
1541 - <?php
1542 - echo "<strong>".count($users)." ".TXT_USERS."</strong>";
1543 - if($users)
1544 - {
1545 - echo "<ul class='uam_group_stuff'>";
1546 - foreach($users as $user)
1547 - {
1548 - $cur_user = get_userdata($user['ID']);
1549 - $checked = $wpdb->get_results(" SELECT *
1550 - FROM ".DB_ACCESSGROUP_TO_USER."
1551 - WHERE user_id = ".$cur_user->ID."
1552 - AND group_id = ".$group_id, ARRAY_A);
1553 - ?>
1554 - <li class="selectit">
1555 - <?php
1556 - if($cur_user->{$wpdb->prefix."capabilities"}['administrator'] != 1)
1557 - {
1558 - ?>
1559 - <input id="user-<?php echo $cur_user->ID; ?>" type="checkbox" value="<?php echo $cur_user->ID; if($checked){ echo 'checked="checked"'; } ?>" name="user[]"/>
1560 - <label for="user-<?php echo $cur_user->ID; ?>"><strong><?php echo $cur_user->nickname; ?></strong> - <?php echo $cur_user->user_firstname." ".$cur_user->user_lastname; ?>
1561 - <?php
1562 - }
1563 - else
1564 - {
1565 - ?>
1566 - <strong><?php echo $cur_user->nickname; ?></strong> - <?php echo $cur_user->user_firstname." ".$cur_user->user_lastname; ?>
1567 - <?php
1568 - echo "(".TXT_IS_ADMIN.")";
1569 - }
1570 - ?>
1571 -
1572 - </li>
1573 - <?php
1574 - }
1575 - echo "</ul>";
1576 - }
1577 - ?>
1578 - </td>
1579 - </tr>
1580 - </tbody>
1581 - </table>
1582 - <p class="submit"><input type="submit" value="<?php echo TXT_UPDATE_GROUP; ?>" name="submit" class="button"/></p>
1583 - </form>
1584 - </div>
1585 - <?php
1586 - }
1587 - }//End function printAdminPage()
1588 -
1589 - function get_usergroups_for_post($ID)
1590 - {
1591 - global $wpdb;
1592 -
1593 - $access = $this->get_access($ID);
1594 -
1595 - $post_usergroups = array();
1596 -
1597 - if($access->restricted_by_posts || $access->restricted_by_categories)
1598 - {
1599 - if($access->restricted_by_posts)
1600 - {
1601 - foreach($access->restricted_by_posts as $cur_id)
1602 - {
1603 - $usergroups = $wpdb->get_results(" SELECT ag.groupname
1604 - FROM ".DB_ACCESSGROUP." ag, ".DB_ACCESSGROUP_TO_POST." agtp
1605 - WHERE agtp.post_id = ".$cur_id."
1606 - AND ag.ID = agtp.group_id
1607 - GROUP BY ag.groupname", ARRAY_A);
1608 -
1609 - if($usergroups)
1610 - {
1611 - foreach($usergroups as $usergroup)
1612 - {
1613 - $cur_usergroup = $post_usergroups[$usergroup['groupname']];
1614 -
1615 - $cur_usergroup->name = $usergroup['groupname'];
1616 -
1617 - if($cur_id != $ID)
1618 - {
1619 - $posts = $cur_usergroup->posts;
1620 -
1621 - $lock_post = & get_post($cur_id);
1622 - $posts[] = $lock_post->ID;
1623 - $cur_usergroup->posts = $posts;
1624 - }
1625 - else
1626 - {
1627 - $cur_usergroup->itself = true;
1628 - }
1629 -
1630 - $post_usergroups[$usergroup['groupname']] = $cur_usergroup;
1631 - }
1632 - }
1633 - }
1634 - }
1635 -
1636 - if($access->restricted_by_categories)
1637 - {
1638 - foreach($access->restricted_by_categories as $cur_id)
1639 - {
1640 - $usergroups = $wpdb->get_results(" SELECT ag.groupname
1641 - FROM ".DB_ACCESSGROUP." ag, ".DB_ACCESSGROUP_TO_CATEGORY." agtc
1642 - WHERE agtc.category_id = ".$cur_id."
1643 - AND ag.ID = agtc.group_id
1644 - GROUP BY ag.groupname", ARRAY_A);
1645 -
1646 - if($usergroups)
1647 - {
1648 - foreach($usergroups as $usergroup)
1649 - {
1650 - $cur_usergroup = $post_usergroups[$usergroup['groupname']];
1651 -
1652 - $cur_usergroup->name = $usergroup['groupname'];
1653 -
1654 - $categories = $cur_usergroup->categories;
1655 -
1656 - $lock_cat = & get_category($cur_id);
1657 - $categories[] = $lock_cat->term_id;
1658 - $cur_usergroup->categories = $categories;
1659 -
1660 - $post_usergroups[$usergroup['groupname']] = $cur_usergroup;
1661 - }
1662 - }
1663 - }
1664 - }
1665 - }
1666 -
1667 - return $post_usergroups;
1668 - }
1669 -
1670 - function get_usergroup_info($groupid)
1671 - {
1672 - global $wpdb;
1673 -
1674 - $db_users = $wpdb->get_results(" SELECT *
1675 - FROM ".DB_ACCESSGROUP_TO_USER."
1676 - WHERE group_id = ".$groupid."
1677 - ORDER BY user_id", ARRAY_A);
1678 -
1679 - $db_posts = $wpdb->get_results(" SELECT *
1680 - FROM ".DB_ACCESSGROUP_TO_POST."
1681 - WHERE group_id = ".$groupid."
1682 - ORDER BY post_id", ARRAY_A);
1683 -
1684 - $db_categories = $wpdb->get_results(" SELECT *
1685 - FROM ".DB_ACCESSGROUP_TO_CATEGORY."
1686 - WHERE group_id = ".$groupid."
1687 - ORDER BY category_id", ARRAY_A);
1688 -
1689 - if($db_posts)
1690 - {
1691 - foreach($db_posts as $db_post)
1692 - {
1693 - $cur_id = $db_post['post_id'];
1694 - $cur_post = & get_post($cur_id);
1695 - if($cur_post->post_type == 'post')
1696 - {
1697 - $info->posts[] = $cur_post;
1698 - }
1699 - elseif($cur_post->post_type == 'page')
1700 - {
1701 - $info->pages[] = $cur_post;
1702 - }
1703 - }
1704 - }
1705 -
1706 - if($db_categories)
1707 - {
1708 - foreach($db_categories as $db_categorie)
1709 - {
1710 - $info->categories[] = get_category($db_categorie['category_id']);
1711 - }
1712 - }
1713 -
1714 - if($db_users)
1715 - {
1716 - $expandcontent = null;
1717 - foreach($db_users as $db_user)
1718 - {
1719 - $info->users[] = get_userdata($db_user['user_id']);
1720 - }
1721 - }
1722 -
1723 - return $info;
1724 - }
1725 -
1726 - function get_usergroup_info_html($group_id, $style = null)
1727 - {
1728 - $link = '<a class="uam_group_info_link">('.TXT_INFO.')</a>';
1729 -
1730 - $group_info = $this->get_usergroup_info($group_id);
1731 -
1732 - $content = "<ul class='uam_group_info'";
1733 -
1734 - if(style != null)
1735 - $content .= " style='".$style."' ";
1736 -
1737 - $content .= "><li class='uam_group_info_head'>".TXT_GROUP_INFO.":</li>";
1738 -
1739 - if($group_info->posts)
1740 - {
1741 - $expandcontent = null;
1742 - foreach($group_info->posts as $post)
1743 - {
1744 - $expandcontent .= "<li>".$post->post_title."</li>";
1745 - }
1746 - $content .= "<li><a class='uam_info_link'>".count($group_info->posts)." ".TXT_POSTS."</a>";
1747 - $content .= "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul></li>";
1748 - }
1749 - else
1750 - {
1751 - $content .= "<li>".TXT_NONE." ".TXT_POSTS."</li>";
1752 - }
1753 -
1754 - if($group_info->pages)
1755 - {
1756 - $expandcontent = null;
1757 - foreach($group_info->pages as $page)
1758 - {
1759 - $expandcontent .= "<li>".$page->post_title."</li>";
1760 - }
1761 - $content .= "<li><a class='uam_info_link'>".count($group_info->pages)." ".TXT_PAGES."</a>";
1762 - $content .= "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul></li>";
1763 - }
1764 - else
1765 - {
1766 - $content .= "<li>".TXT_NONE." ".TXT_PAGES."</li>";
1767 - }
1768 -
1769 - if($group_info->categories)
1770 - {
1771 - $expandcontent = null;
1772 - foreach($group_info->categories as $categorie)
1773 - {
1774 - $expandcontent .= "<li>".$categorie->cat_name."</li>";
1775 - }
1776 - $content .= "<li><a class='uam_info_link'>".count($group_info->categories)." ".TXT_CATEGORY."</a>";
1777 - $content .= "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul></li>";
1778 - }
1779 - else
1780 - {
1781 - $content .= "<li>".TXT_NONE." ".TXT_CATEGORY."</li>";
1782 - }
1783 - if($group_info->users)
1784 - {
1785 - $expandcontent = null;
1786 - foreach($group_info->users as $user)
1787 - {
1788 - $expandcontent .= "<li>".$user->nickname."</li>";
1789 - }
1790 - $content .= "<li><a class='uam_info_link'>".count($group_info->users)." ".TXT_USERS."</a>";
1791 - $content .= "<ul class='uam_info_content expand_deactive'>".$expandcontent."</ul></li>";
1792 - }
1793 - else
1794 - {
1795 - $content .= "<li>".TXT_NONE." ".TXT_USERS."</li>";
1796 - }
1797 - $content .= "</ul>";
1798 -
1799 - $result->link = $link;
1800 - $result->content = $content;
1801 -
1802 - return $result;
1803 - }
1804 -
1805 - function add_post_columns_header($defaults)
1806 - {
1807 - $defaults['uam_access'] = __('Access');
1808 - return $defaults;
1809 - }
1810 -
1811 - function add_post_column($column_name, $id)
1812 - {
1813 - if( $column_name == 'uam_access' )
1814 - {
1815 - $usergroups = $this->get_usergroups_for_post($id);
1816 - if($usergroups)
1817 - {
1818 - echo "<ul>";
1819 - foreach($usergroups as $usergroup)
1820 - {
1821 - $output = "<li><a class='uma_user_access_group'>".$usergroup->name. "</a>";
1822 - $output .= "<ul class='uma_user_access_group_from'>";
1823 -
1824 - if($usergroup->itself)
1825 - $output .= "<li>".TXT_ITSELF."</li>";
1826 -
1827 - if($usergroup->posts)
1828 - {
1829 - foreach($usergroup->posts as $cur_id)
1830 - {
1831 - $cur_post = & get_post($cur_id);
1832 - $output .= "<li>$cur_post->post_title [$cur_post->post_type]</li>";
1833 - }
1834 - }
1835 -
1836 - if($usergroup->categories)
1837 - {
1838 - foreach($usergroup->categories as $cur_id)
1839 - {
1840 - $cur_category = & get_category($cur_id);
1841 - $output .= "<li>$cur_category->name [category]</li>";
1842 - }
1843 - }
1844 -
1845 - $output = substr($output, 0, -2);
1846 -
1847 - $output .= "</ul></li>";
1848 - echo $output;
1849 - }
1850 - echo "</ul>";
1851 - }
1852 - else
1853 - {
1854 - echo TXT_FULL_ACCESS;
1855 - }
1856 - }
1857 - }
1858 -
1859 - function edit_post_content($post)
1860 - {
1861 - global $wpdb;
1862 - $accessgroups = $wpdb->get_results("SELECT *
1863 - FROM ".DB_ACCESSGROUP."
1864 - ORDER BY groupname", ARRAY_A);
1865 -
1866 - $recursive_set = $this->get_usergroups_for_post($post->ID);
1867 -
1868 - if($accessgroups)
1869 - {
1870 - foreach($accessgroups as $accessgroup)
1871 - {
1872 - $checked = $wpdb->get_results(" SELECT *
1873 - FROM ".DB_ACCESSGROUP_TO_POST."
1874 - WHERE post_id = ".$post->ID."
1875 - AND group_id = ".$accessgroup['ID'], ARRAY_A);
1876 -
1877 - $set_recursive = $recursive_set[$accessgroup['groupname']];
1878 - ?>
1879 - <p>
1880 - <label for="uam_accesssgroup-<?php echo $accessgroup['ID'];?>" class="selectit" >
1881 - <input type="checkbox" id="uam_accesssgroup-<?php echo $accessgroup['ID'];?>" <?php if($checked || $set_recursive->posts || $set_recursive->categories){ echo 'checked="checked"'; } if($set_recursive->posts || $set_recursive->categories){echo 'disabled=""';} ?>value="<?php echo $accessgroup['ID']; ?>" name="accessgroups[]"/>
1882 - <?php echo $accessgroup['groupname']; ?>
1883 - </label>
1884 - <?php
1885 - $group_info_html = $this->get_usergroup_info_html($accessgroup['ID']);
1886 -
1887 - echo $group_info_html->link;
1888 -
1889 - if($set_recursive->posts || $set_recursive->categories)
1890 - echo '&nbsp;<a class="uam_group_lock_info_link">[LR]</a>';
1891 -
1892 - echo $group_info_html->content;
1893 -
1894 - if($set_recursive->posts || $set_recursive->categories)
1895 - {
1896 - $recursive_info = '<ul class="uam_group_lock_info"><li class="uam_group_lock_info_head">'.TXT_GROUP_LOCK_INFO.':</li>';
1897 - if($set_recursive->posts)
1898 - {
1899 - foreach($set_recursive->posts as $cur_id)
1900 - {
1901 - $cur_post = & get_post($cur_id);
1902 - $recursive_info .= "<li>$cur_post->post_title [$cur_post->post_type]</li>";
1903 - }
1904 - }
1905 -
1906 - if($set_recursive->categories)
1907 - {
1908 - foreach($set_recursive->categories as $cur_id)
1909 - {
1910 - $cur_category = & get_category($cur_id);
1911 - $recursive_info .= "<li>$cur_category->name [".TXT_CATEGORY."]</li>";
1912 - }
1913 - }
1914 - $recursive_info .= "</ul>";
1915 - echo $recursive_info;
1916 - }
1917 - ?>
1918 - </p>
1919 - <?php
1920 - }
1921 - }
1922 - else
1923 - {
1924 - echo "<p><a href='admin.php?page=uam_usergroup'>";
1925 - echo TXT_CREATE_GROUP_FIRST;
1926 - echo "</a></p>";
1927 - }
1928 - }
1929 -
1930 - function save_postdata($post_id)
1931 - {
1932 - global $wpdb;
1933 - $accessgroups = $_POST['accessgroups'];
1934 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_POST." WHERE post_id = $post_id");
1935 - if($accessgroups)
1936 - {
1937 - foreach($accessgroups as $accessgroup)
1938 - {
1939 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_POST." (post_id,group_id) VALUES(".$post_id.", ".$accessgroup.")");
1940 - }
1941 - }
1942 - }
1943 -
1944 - function remove_postdata($post_id)
1945 - {
1946 - global $wpdb;
1947 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_POST." WHERE post_id = $post_id");
1948 - }
1949 -
1950 - function add_user_columns_header($defaults)
1951 - {
1952 - $defaults['uam_access'] = __('Access');
1953 - return $defaults;
1954 - }
1955 -
1956 - function add_user_column($column_name, $id)
1957 - {
1958 - global $wpdb;
1959 -
1960 - if( $column_name == 'uam_access' )
1961 - {
1962 - $usergroups = $wpdb->get_results(" SELECT ag.groupname
1963 - FROM ".DB_ACCESSGROUP." ag, ".DB_ACCESSGROUP_TO_USER." agtp
1964 - WHERE agtp.user_id = ".$id."
1965 - AND ag.ID = agtp.group_id
1966 - GROUP BY ag.groupname", ARRAY_A);
1967 -
1968 - if($usergroups)
1969 - {
1970 - $content .= "<ul>";
1971 - foreach($usergroups as $usergroup)
1972 - {
1973 - $content .= "<li>".$usergroup['groupname']."</li>";
1974 - }
1975 - $content .= "</ul>";
1976 - }
1977 - else
1978 - {
1979 - $content = TXT_NO_GROUP;
1980 - }
1981 - return $content;
1982 - }
1983 - }
1984 -
1985 - function show_user_profile()
1986 - {
1987 - global $wpdb, $current_user;
1988 -
1989 - $user_id = $_GET['user_id'];
1990 - $cur_userdata = get_userdata($current_user->ID);
1991 - $cur_edit_userdata = get_userdata($user_id);
1992 -
1993 - if($cur_userdata->{$wpdb->prefix."capabilities"}['administrator'] == 1)
1994 - {
1995 - $accessgroups = $wpdb->get_results("SELECT *
1996 - FROM ".DB_ACCESSGROUP."
1997 - ORDER BY groupname", ARRAY_A);
1998 -
1999 - ?>
2000 - <h3><?php echo TXT_GROUPS; ?></h3>
2001 - <table class="form-table">
2002 - <tbody>
2003 - <tr>
2004 - <th>
2005 - <label for="usergroups"><?php echo TXT_SET_UP_USERGROUPS; ?></label>
2006 - </th>
2007 - <td>
2008 - <?php
2009 - if($cur_edit_userdata->{$wpdb->prefix."capabilities"}['administrator'] != 1)
2010 - {
2011 - if($accessgroups)
2012 - {
2013 - foreach($accessgroups as $accessgroup)
2014 - {
2015 - $checked = $wpdb->get_results(" SELECT *
2016 - FROM ".DB_ACCESSGROUP_TO_USER."
2017 - WHERE user_id = ".$user_id."
2018 - AND group_id = ".$accessgroup['ID'], ARRAY_A)
2019 - ?>
2020 - <p style="margin:6px 0;">
2021 - <label for="uam_accesssgroup-<?php echo $accessgroup['ID'];?>" class="selectit" >
2022 - <input type="checkbox" id="uam_accesssgroup-<?php echo $accessgroup['ID'];?>" <?php if($checked){ echo 'checked="checked"'; } ?> value="<?php echo $accessgroup['ID']; ?>" name="accessgroups[]"/>
2023 - <?php echo $accessgroup['groupname']; ?>
2024 - </label>
2025 - <?php
2026 - $group_info_html = $this->get_usergroup_info_html($accessgroup['ID'], "padding: 0 0 0 32px");
2027 -
2028 - echo $group_info_html->link;
2029 - echo $group_info_html->content;
2030 - echo "</p>";
2031 - }
2032 - }
2033 - else
2034 - {
2035 - echo "<a href='admin.php?page=uam_usergroup'>";
2036 - echo TXT_CREATE_GROUP_FIRST;
2037 - echo "</a>";
2038 - }
2039 - }
2040 - else
2041 - {
2042 - echo TXT_ADMIN_HINT;
2043 - }
2044 - ?>
2045 - </td>
2046 - </tr>
2047 - </tbody>
2048 - </table>
2049 - <?php
2050 - }
2051 - }
2052 -
2053 - function save_userdata($user_id)
2054 - {
2055 - global $wpdb, $current_user;
2056 -
2057 - $cur_userdata = get_userdata($current_user->ID);
2058 -
2059 - if($cur_userdata->{$wpdb->prefix."capabilities"}['administrator'] == 1)
2060 - {
2061 - $accessgroups = $_POST['accessgroups'];
2062 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_USER." WHERE user_id = $user_id");
2063 - if($accessgroups)
2064 - {
2065 - foreach($accessgroups as $accessgroup)
2066 - {
2067 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_USER." (user_id,group_id) VALUES(".$user_id.", ".$accessgroup.")");
2068 - }
2069 - }
2070 - }
2071 - }
2072 -
2073 - function remove_userdata($user_id)
2074 - {
2075 - global $wpdb, $current_user;
2076 -
2077 - $cur_userdata = get_userdata($current_user->ID);
2078 -
2079 - if($cur_userdata->{$wpdb->prefix."capabilities"}['administrator'] == 1)
2080 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_USER." WHERE user_id = $user_id");
2081 - }
2082 -
2083 - function add_category_columns_header($defaults)
2084 - {
2085 - $defaults['uam_access'] = __('Access');
2086 - return $defaults;
2087 - }
2088 -
2089 - function add_category_column($column_name, $id)
2090 - {
2091 - global $wpdb;
2092 -
2093 - if( $column_name == 'uam_access' )
2094 - {
2095 - $usergroups = $wpdb->get_results(" SELECT ag.groupname
2096 - FROM ".DB_ACCESSGROUP." ag, ".DB_ACCESSGROUP_TO_CATEGORY." agtc
2097 - WHERE agtc.category_id = ".$id."
2098 - AND ag.ID = agtc.group_id
2099 - GROUP BY ag.groupname", ARRAY_A);
2100 -
2101 - if($usergroups)
2102 - {
2103 - $content .= "<ul>";
2104 - foreach($usergroups as $usergroup)
2105 - {
2106 - $content .= "<li>".$usergroup['groupname']."</li>";
2107 - }
2108 - $content .= "</ul>";
2109 - }
2110 - else
2111 - {
2112 - $content = TXT_NO_GROUP;
2113 - }
2114 - return $content;
2115 - }
2116 - }
2117 -
2118 - function show_cat_edit_form($cat)
2119 - {
2120 - global $wpdb, $current_user;
2121 -
2122 - $cat_id = $cat->cat_ID;
2123 -
2124 - $accessgroups = $wpdb->get_results("SELECT *
2125 - FROM ".DB_ACCESSGROUP."
2126 - ORDER BY groupname", ARRAY_A);
2127 -
2128 - if($_GET['action'] == 'edit')
2129 - {
2130 - ?>
2131 - <table class="form-table">
2132 - <tbody>
2133 - <tr>
2134 - <th>
2135 - <label for="description"><?php echo TXT_SET_UP_USERGROUPS; ?></label>
2136 - </th>
2137 - <td>
2138 - <?php
2139 - if($accessgroups)
2140 - {
2141 - $recursive_set = $this->get_usergroups_for_post($cat_id);
2142 -
2143 - foreach($accessgroups as $accessgroup)
2144 - {
2145 - $checked = $wpdb->get_results(" SELECT *
2146 - FROM ".DB_ACCESSGROUP_TO_CATEGORY."
2147 - WHERE category_id = ".$cat_id."
2148 - AND group_id = ".$accessgroup['ID'], ARRAY_A)
2149 -
2150 - //$set_recursive = $recursive_set[$accessgroup['groupname']];
2151 - ?>
2152 - <p style="margin:6px 0;">
2153 - <label for="uam_accesssgroup-<?php echo $accessgroup['ID'];?>" class="selectit" >
2154 - <input type="checkbox" id="uam_accesssgroup-<?php echo $accessgroup['ID'];?>" <?php if($checked){ echo 'checked="checked"'; } ?> value="<?php echo $accessgroup['ID']; ?>" name="accessgroups[]"/>
2155 - <?php echo $accessgroup['groupname']; ?>
2156 - </label>
2157 - <?php
2158 - $group_info_html = $this->get_usergroup_info_html($accessgroup['ID'], "padding:0 0 0 32px;");
2159 -
2160 - echo $group_info_html->link;
2161 -
2162 - if($set_recursive->posts || $set_recursive->categories)
2163 - echo '&nbsp;<a class="uam_group_lock_info_link">[LR]</a>';
2164 -
2165 - echo $group_info_html->content;
2166 -
2167 - if($set_recursive->posts || $set_recursive->categories)
2168 - {
2169 - $recursive_info = '<ul class="uam_group_lock_info" style="padding:0 0 0 32px;"><li class="uam_group_lock_info_head">'.TXT_GROUP_LOCK_INFO.':</li>';
2170 - if($set_recursive->posts)
2171 - {
2172 - foreach($set_recursive->posts as $cur_id)
2173 - {
2174 - $cur_post = & get_post($cur_id);
2175 - $recursive_info .= "<li>$cur_post->post_title [$cur_post->post_type]</li>";
2176 - }
2177 - }
2178 -
2179 - if($set_recursive->categories)
2180 - {
2181 - foreach($set_recursive->categories as $cur_id)
2182 - {
2183 - $cur_category = & get_category($cur_id);
2184 - $recursive_info .= "<li>$cur_category->name [".TXT_CATEGORY."]</li>";
2185 - }
2186 - }
2187 - $recursive_info .= "</ul>";
2188 - echo $recursive_info;
2189 - }
2190 - echo "</p>";
2191 - }
2192 - }
2193 - else
2194 - {
2195 - echo "<a href='admin.php?page=uam_usergroup'>";
2196 - echo TXT_CREATE_GROUP_FIRST;
2197 - echo "</a>";
2198 - }
2199 - ?>
2200 - </td>
2201 - </tr>
2202 - </tbody>
2203 - </table>
2204 - <style type="text/css">
2205 - .submit {
2206 - display: none;
2207 - position: absolute;
2208 - }
2209 - </style>
2210 - <p class="submit" style="display:block;">
2211 - <input class="button-primary" type="submit" value="Update Category" name="submit"/>
2212 - </p>
2213 - <?php
2214 - }
2215 - }
2216 -
2217 - function add_styles()
2218 - {
2219 - wp_enqueue_style('UserAccessManager', UAM_URLPATH."css/uma_admin.css", false, '1.0', 'screen' );
2220 - }
2221 -
2222 - function add_scripts()
2223 - {
2224 - wp_enqueue_script('UserAccessManager', UAM_URLPATH .'js/functions.js', array('jquery'), '1.0' );
2225 - }
2226 -
2227 - function save_categorydata($category_id)
2228 - {
2229 - global $wpdb;
2230 -
2231 - $accessgroups = $_POST['accessgroups'];
2232 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_CATEGORY." WHERE category_id = $category_id");
2233 - if($accessgroups)
2234 - {
2235 - foreach($accessgroups as $accessgroup)
2236 - {
2237 - $wpdb->query("INSERT INTO ".DB_ACCESSGROUP_TO_CATEGORY." (category_id,group_id) VALUES(".$category_id.", ".$accessgroup.")");
2238 - }
2239 - }
2240 - }
2241 -
2242 - function remove_categorydata($category_id)
2243 - {
2244 - global $wpdb;
2245 -
2246 - $wpdb->query("DELETE FROM ".DB_ACCESSGROUP_TO_CATEGORY." WHERE category_id = $category_id");
2247 - }
2248 -
2249 - function get_access($post_id)
2250 - {
2251 - global $wpdb;
2252 -
2253 - $cur_id = $post_id;
2254 - $cur_post = & get_post($cur_id);
2255 - $cur_categories = get_the_category($cur_id);
2256 -
2257 - $uamOptions = $this->getAdminOptions();
2258 -
2259 -
2260 - //check categories access
2261 - foreach($cur_categories as $cur_category)
2262 - {
2263 - if($uamOptions['lock_recursive'] == 'true')
2264 - {
2265 - $cur_id = $cur_category->term_id;
2266 - while($cur_id != 0)
2267 - {
2268 - $restricted_access_by_cat = $wpdb->get_results(" SELECT *
2269 - FROM ".DB_ACCESSGROUP_TO_CATEGORY."
2270 - WHERE category_id = ".$cur_id, ARRAY_A);
2271 - if($restricted_access_by_cat)
2272 - $restricted_by_categories[] = $cur_category->term_id;
2273 -
2274 - $cur_id = $cur_category->parent;
2275 - $cur_category = get_the_category($cur_id);
2276 - }
2277 - }
2278 - elseif($uamOptions['lock_recursive'] == 'false')
2279 - {
2280 - $restricted_access_by_cat = $wpdb->get_results(" SELECT *
2281 - FROM ".DB_ACCESSGROUP_TO_CATEGORY."
2282 - WHERE category_id = ".$cur_category->term_id, ARRAY_A);
2283 - if($restricted_access_by_cat)
2284 - $restricted_by_categories[] = $cur_category->term_id;
2285 - }
2286 - }
2287 -
2288 - //check posts access
2289 - if($uamOptions['lock_recursive'] == 'true')
2290 - {
2291 - $cur_id = $cur_post->ID;
2292 - while($cur_id != 0)
2293 - {
2294 - $restricted_access_by_post = $wpdb->get_results(" SELECT *
2295 - FROM ".DB_ACCESSGROUP_TO_POST."
2296 - WHERE post_id = ".$cur_post->ID, ARRAY_A);
2297 - if($restricted_access_by_post)
2298 - $restricted_by_posts[] = $cur_post->ID;
2299 -
2300 - $cur_id = $cur_post->post_parent;
2301 - $cur_post = & get_post($cur_id);
2302 - }
2303 - }
2304 - elseif($uamOptions['lock_recursive'] == 'false')
2305 - {
2306 - if( $cur_post->post_type != 'attachment')
2307 - {
2308 - $restricted_access_by_post = $wpdb->get_results(" SELECT *
2309 - FROM ".DB_ACCESSGROUP_TO_POST."
2310 - WHERE post_id = ".$cur_post->ID, ARRAY_A);
2311 - }
2312 - else
2313 - {
2314 - $restricted_access_by_post = $wpdb->get_results(" SELECT *
2315 - FROM ".DB_ACCESSGROUP_TO_POST."
2316 - WHERE post_id = ".$cur_post->post_parent, ARRAY_A);
2317 - }
2318 - if($restricted_access_by_post)
2319 - $restricted_by_posts[] = $cur_post->ID;
2320 - }
2321 -
2322 - $access->restricted_by_categories = $restricted_by_categories;
2323 - $access->restricted_by_posts = $restricted_by_posts;
2324 -
2325 - return $access;
2326 - }
2327 -
2328 - function check_access($post_id = null)
2329 - {
2330 - global $wpdb, $current_user;
2331 -
2332 - $access = $this->get_access($post_id);
2333 -
2334 - if($access->restricted_by_posts || $access->restricted_by_categories)
2335 - {
2336 - if(is_user_logged_in())
2337 - {
2338 - $cur_userdata = get_userdata($current_user->ID);
2339 -
2340 - if($cur_userdata->{$wpdb->prefix."capabilities"}['administrator'] != 1)
2341 - {
2342 - if($access->restricted_by_categories)
2343 - {
2344 - foreach($access->restricted_by_categories as $cur_cat_id)
2345 - {
2346 - $user_access = $wpdb->get_results(" SELECT *
2347 - FROM ".DB_ACCESSGROUP_TO_CATEGORY." atc, ".DB_ACCESSGROUP_TO_USER." atu
2348 - WHERE atc.category_id = ".$cur_cat_id."
2349 - AND atc.group_id = atu.group_id
2350 - AND atu.user_id = ".$current_user->ID, ARRAY_A);
2351 - if($user_access)
2352 - return true;
2353 -
2354 - $access_roles = $wpdb->get_results("SELECT atr.role_name
2355 - FROM ".DB_ACCESSGROUP_TO_CATEGORY." atc, ".DB_ACCESSGROUP_TO_ROLE." atr
2356 - WHERE atc.category_id = ".$cur_cat_id."
2357 - AND atc.group_id = atr.group_id", ARRAY_A);
2358 -
2359 - if($access_roles)
2360 - {
2361 - foreach($access_roles as $access_role)
2362 - {
2363 - if($cur_userdata->wp_capabilities[$access_role['role_name']] == 1)
2364 - return true;
2365 - }
2366 - }
2367 - }
2368 - }
2369 -
2370 - if($access->restricted_by_posts)
2371 - {
2372 - foreach($access->restricted_by_posts as $cur_post_id)
2373 - {
2374 - $user_access = $wpdb->get_results(" SELECT *
2375 - FROM ".DB_ACCESSGROUP_TO_POST." atp, ".DB_ACCESSGROUP_TO_USER." atu
2376 - WHERE atp.post_id = ".$cur_post_id."
2377 - AND atp.group_id = atu.group_id
2378 - AND atu.user_id = ".$current_user->ID, ARRAY_A);
2379 - if($user_access)
2380 - return true;
2381 -
2382 - $access_roles = $wpdb->get_results("SELECT atr.role_name
2383 - FROM ".DB_ACCESSGROUP_TO_POST." atp, ".DB_ACCESSGROUP_TO_ROLE." atr
2384 - WHERE atp.post_id = ".$cur_post_id."
2385 - AND atp.group_id = atr.group_id", ARRAY_A);
2386 - if($access_roles)
2387 - {
2388 - foreach($access_roles as $access_role)
2389 - {
2390 - if($cur_userdata->wp_capabilities[$access_role['role_name']] == 1)
2391 - return true;
2392 - }
2393 - }
2394 - }
2395 - }
2396 -
2397 - if(!$user_access)
2398 - return false;
2399 - }
2400 - else
2401 - {
2402 - return true;
2403 - }
2404 - }
2405 - else
2406 - {
2407 - return false;
2408 - }
2409 - }
2410 - else
2411 - {
2412 - return true;
2413 - }
2414 - }
2415 -
2416 - function show_post($posts = array())
2417 - {
2418 - $no_posts = count($posts);
2419 - $uamOptions = $this->getAdminOptions();
2420 -
2421 - for($i=0; $i < $no_posts; $i++)
2422 - {
2423 - if( ($uamOptions['hide_post'] == 'true' && $posts[$i]->post_type == "post") || ($uamOptions['hide_page'] == 'true' && $posts[$i]->post_type == "page") )
2424 - {
2425 - if($this->check_access($posts[$i]->ID))
2426 - {
2427 - $posts[$i]->post_title .= $this->admin_output($posts[$i]->ID);
2428 - $show_posts[] = $posts[$i];
2429 - }
2430 - }
2431 - else
2432 - {
2433 - if(!$this->check_access($posts[$i]->ID))
2434 - {
2435 - if($posts[$i]->post_type == "post")
2436 - {
2437 - if($uamOptions['hide_post_title'] == 'true')
2438 - $posts[$i]->post_title = $uamOptions['post_title'];
2439 -
2440 - $posts[$i]->post_content = $uamOptions['post_content'];
2441 -
2442 - if($uamOptions['allow_comments_locked'] == 'false')
2443 - $posts[$i]->comment_status == 'close';
2444 - }
2445 - elseif($posts[$i]->post_type == "page")
2446 - {
2447 - if($uamOptions['hide_page_title'] == 'true')
2448 - $posts[$i]->post_title = $uamOptions['page_title'];
2449 -
2450 - $posts[$i]->post_content = $uamOptions['page_content'];
2451 - }
2452 - }
2453 - $posts[$i]->post_title .= $this->admin_output($posts[$i]->ID);
2454 - $show_posts[] = $posts[$i];
2455 - }
2456 - }
2457 -
2458 - $posts = $show_posts;
2459 -
2460 - return $posts;
2461 - }
2462 -
2463 - function show_comment($comments = array())
2464 - {
2465 - $no_comments = count($comments);
2466 - $uamOptions = $this->getAdminOptions();
2467 -
2468 - for($i=0; $i < $no_comments; $i++)
2469 - {
2470 - if($uamOptions['hide_post_comment'] == 'true')
2471 - {
2472 - if($this->check_access($comments[$i]->comment_post_ID))
2473 - {
2474 - $show_comments[] = $comments[$i];
2475 - }
2476 - }
2477 - else
2478 - {
2479 - if(!$this->check_access($comments[$i]->comment_post_ID))
2480 - {
2481 - $comments[$i]->comment_content = $uamOptions['post_comment_content'];
2482 - }
2483 - $show_comments[] = $comments[$i];
2484 - }
2485 -
2486 - }
2487 -
2488 - $comments = $show_comments;
2489 -
2490 - return $comments;
2491 - }
2492 -
2493 - function show_page($pages = array())
2494 - {
2495 - $no_pages = count($pages);
2496 - $uamOptions = $this->getAdminOptions();
2497 -
2498 - for($i=0; $i < $no_pages; $i++)
2499 - {
2500 - if($uamOptions['hide_page'] == 'true')
2501 - {
2502 - if($this->check_access($pages[$i]->ID))
2503 - {
2504 - $pages[$i]->post_title .= $this->admin_output($pages[$i]->ID);
2505 - $show_pages[] = $pages[$i];
2506 - }
2507 - }
2508 - else
2509 - {
2510 - if(!$this->check_access($pages[$i]->ID))
2511 - {
2512 - if($uamOptions['hide_page_title'] == 'true')
2513 - $pages[$i]->post_title = $uamOptions['page_title'];
2514 -
2515 - $pages[$i]->post_content = $uamOptions['page_content'];
2516 - }
2517 - $pages[$i]->post_title .= $this->admin_output($pages[$i]->ID);
2518 - $show_pages[] = $pages[$i];
2519 - }
2520 -
2521 - }
2522 -
2523 - $pages = $show_pages;
2524 -
2525 - return $pages;
2526 - }
2527 -
2528 - function show_category($categories)
2529 - {
2530 - if(!$this->atAdminPanel)
2531 - {
2532 - $uamOptions = $this->getAdminOptions();
2533 - if($uamOptions['hide_post'] == 'true' || $uamOptions['hide_page'] == 'true')
2534 - {
2535 - $args = array( 'numberposts' => -1);
2536 - $posts = get_posts($args);
2537 -
2538 - foreach($categories as $category)
2539 - {
2540 - $count = 0;
2541 -
2542 - if($posts)
2543 - {
2544 - foreach($posts as $cur_post)
2545 - {
2546 - $post_cat_ids = array();
2547 - $post_cats = get_the_category($cur_post->ID);
2548 - foreach($post_cats as $post_cat)
2549 - {
2550 - $post_cat_ids[] = $post_cat->term_id;
2551 - }
2552 -
2553 - if(in_array($category->term_id, $post_cat_ids) )
2554 - {
2555 - if( ($uamOptions['hide_post'] == 'true' && $cur_post->post_type == "post") || ($uamOptions['hide_page'] == 'true' && $cur_post->post_type == "page") )
2556 - {
2557 - if($this->check_access($cur_post->ID))
2558 - $count++;
2559 - }
2560 - else
2561 - {
2562 - $count++;
2563 - }
2564 - }
2565 - }
2566 - }
2567 -
2568 - if($count != 0)
2569 - {
2570 - $category->count = $count;
2571 - $show_categories[] = $category;
2572 - }
2573 - elseif($category->taxonomy == "link_category")
2574 - {
2575 - $show_categories[] = $category;
2576 - }
2577 -
2578 - $categories = $show_categories;
2579 - }
2580 - }
2581 - }
2582 -
2583 - return $categories;
2584 - }
2585 -
2586 - function show_title($title, $post = null)
2587 - {
2588 - if(!$this->check_access($post->ID) && $post != null)
2589 - {
2590 - if($post->post_type == "post")
2591 - $title = $uamOptions['post_title'];
2592 - elseif($post->post_type == "page")
2593 - $title = $uamOptions['page_title'];
2594 - }
2595 - return $title;
2596 - }
2597 -
2598 - function show_next_previous_post($sql)
2599 - {
2600 - $uamOptions = $this->getAdminOptions();
2601 -
2602 - $posts = get_posts();
2603 - foreach($posts as $post)
2604 - {
2605 - if(!$this->check_access($post->ID))
2606 - $excluded_posts[] = $post->ID;
2607 - }
2608 - if($excluded_posts)
2609 - {
2610 - $excluded_posts_str = implode(",", $excluded_posts);
2611 - $sql .= "AND ID NOT IN($excluded_posts_str)";
2612 - }
2613 -
2614 - return $sql;
2615 - }
2616 -
2617 - function admin_output($post_id)
2618 - {
2619 - global $wpdb;
2620 - if(!$this->atAdminPanel)
2621 - {
2622 - $uamOptions = $this->getAdminOptions();
2623 -
2624 - if($uamOptions['blog_admin_hint'] == 'true')
2625 - {
2626 - global $current_user;
2627 - $cur_userdata = get_userdata($current_user->ID);
2628 -
2629 - $access = $this->get_access($post_id);
2630 - if($cur_userdata->{$wpdb->prefix."capabilities"}['administrator'] == 1 && ($access->restricted_by_posts || $access->restricted_by_categories))
2631 - {
2632 - $output = "&nbsp;".$uamOptions['blog_admin_hint_text'];
2633 - }
2634 - return $output;
2635 - }
2636 - }
2637 - }
2638 -
2639 - function redirect_user()
2640 - {
2641 - global $wp_query;
2642 -
2643 - if(!$this->check_access() && $uamOptions['redirect'] != 'false')
2644 - {
2645 - $uamOptions = $this->getAdminOptions();
2646 -
2647 - if($uamOptions['redirect'] == 'blog' || $uamOptions['redirect'] == 'custom_page')
2648 - {
2649 - $host = $_SERVER['HTTP_HOST'];
2650 - $uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
2651 -
2652 - if($uamOptions['redirect'] == 'blog')
2653 - $extra = '';
2654 - elseif($uamOptions['redirect'] == 'custom_page')
2655 - $extra = $uamOptions['redirect_custom_page'];
2656 -
2657 - $url = "http://".$host.$uri."/".$extra;
2658 - }
2659 - elseif( $uamOptions['redirect'] == 'custom_url')
2660 - {
2661 - $url = $uamOptions['redirect_custom_url'];
2662 - }
2663 -
2664 -
2665 - $cur_posts = $wp_query->get_posts();
2666 -
2667 - $post_to_show = false;
2668 -
2669 - foreach($cur_posts as $cur_post)
2670 - {
2671 - if($this->check_access())
2672 - {
2673 - $post_to_show = true;
2674 - break;
2675 - }
2676 - }
2677 -
2678 - if($url != "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"] && !$post_to_show)
2679 - {
2680 - header("Location: $url");
2681 - exit;
2682 - }
2683 - }
2684 - elseif(isset($_GET['getfile']))
2685 - {
2686 - $cur_id = $_GET['getfile'];
2687 - $cur_post = & get_post($cur_id);
2688 -
2689 - if ($cur_post->post_type == 'attachment' && $this->check_access($cur_post->ID))
2690 - {
2691 - $file = str_replace("http://".$_SERVER['HTTP_HOST']."/", "", $cur_post->guid);
2692 - $filename = basename($file);
2693 -
2694 - if (file_exists($file))
2695 - {
2696 - $len = filesize($file);
2697 - header('content-type: '.$cur_post->post_mime_type);
2698 - header('content-length: '.$len);
2699 - header('content-disposition: attachment; filename='.basename($file));
2700 -
2701 - if($uamOptions['download_type'] == 'fopen')
2702 - {
2703 - $fp=fopen($file, 'rb');
2704 -
2705 - while ( ! feof($fp) )
2706 - {
2707 - set_time_limit(30);
2708 - $buffer = fread($fp, 1024);
2709 - echo $buffer;
2710 - }
2711 - exit;
2712 - }
2713 - else
2714 - {
2715 - readfile($file);
2716 - exit;
2717 - }
2718 - }
2719 - else
2720 - {
2721 - echo 'Error: File not found';
2722 - }
2723 - }
2724 - }
2725 - }
2726 -
2727 - function get_file($URL, $ID)
2728 - {
2729 - $uamOptions = $this->getAdminOptions();
2730 -
2731 - if($uamOptions['lock_file'] == 'true')
2732 - {
2733 - $cur_id = $ID;
2734 - $cur_post = & get_post($cur_id);
2735 - $cur_parent_id = $cur_post->post_parent;
2736 - $cur_parent = & get_post($cur_parent_id);
2737 -
2738 - $type = explode("/", $cur_post->post_mime_type);
2739 - $type = $type[1];
2740 -
2741 -
2742 -
2743 - $file_types = $uamOptions['locked_file_types'];
2744 - $file_types = explode(",", $file_types);
2745 -
2746 - if(in_array($type, $file_types))
2747 - {
2748 - if(strpos($cur_parent->guid, "?"))
2749 - $char = "&";
2750 - else
2751 - $char = "?";
2752 -
2753 - $URL = $cur_parent->guid.$char.'getfile='.$cur_post->ID;
2754 - }
2755 - }
2756 - return $URL;
2757 - }
2758 - }
73 + //Defines
74 + require_once $basePath.'vendor/autoload.php';
75 + require_once $basePath.'init.php';
76 + global $userAccessManager;
77 + $userAccessManager = initUserAccessManger();
2759 78 }
2760 79
2761 -if (class_exists("UserAccessManager"))
2762 -{
2763 - $userAccessManager = new UserAccessManager();
2764 -}
2765 -
2766 -//Initialize the admin panel
2767 -if (!function_exists("UserAccessManager_AP")) {
2768 - function UserAccessManager_AP()
2769 - {
2770 - global $userAccessManager, $wp_version;
2771 -
2772 - $userAccessManager->atAdminPanel = true;
2773 -
2774 - if (!isset($userAccessManager))
2775 - {
2776 - return;
2777 - }
2778 - if (function_exists('add_menu_page'))
2779 - {
2780 - add_menu_page('User Access Manager', 'Access Manager', 9, 'uam_usergroup', array(&$userAccessManager, 'printAdminPage'), UAM_URLPATH."/gfx/icon.png");
2781 - }
2782 - if (function_exists('add_submenu_page'))
2783 - {
2784 - add_submenu_page('uam_usergroup', TXT_MANAGE_GROUP, TXT_MANAGE_GROUP, 9, 'uam_usergroup', array(&$userAccessManager, 'printAdminPage'));
2785 - add_submenu_page('uam_usergroup', TXT_SETTINGS, TXT_SETTINGS, 9, 'uam_settings', array(&$userAccessManager, 'printAdminPage'));
2786 - }
2787 - if( function_exists( 'add_meta_box' ))
2788 - {
2789 - add_meta_box( 'uma_post_access', 'Access', array(&$userAccessManager, 'edit_post_content'), 'post', 'side' );
2790 - add_meta_box( 'uma_post_access', 'Access', array(&$userAccessManager, 'edit_post_content'), 'page', 'side' );
2791 - }
2792 -
2793 - //Admin actions
2794 - add_action('manage_posts_custom_column', array(&$userAccessManager, 'add_post_column'), 10, 2);
2795 - add_action('manage_pages_custom_column', array(&$userAccessManager, 'add_post_column'), 10, 2);
2796 - add_action('save_post', array(&$userAccessManager, 'save_postdata'));
2797 - add_action('delete_post', array(&$userAccessManager, 'remove_postdata'));
2798 -
2799 - add_action('edit_user_profile', array(&$userAccessManager, 'show_user_profile'));
2800 - add_action('profile_update', array(&$userAccessManager, 'save_userdata'));
2801 - add_action('delete_user', array(&$userAccessManager, 'remove_userdata'));
2802 -
2803 - add_action('edit_category_form', array(&$userAccessManager, 'show_cat_edit_form'));
2804 - add_action('edit_category', array(&$userAccessManager, 'save_categorydata'));
2805 - add_action('delete_category', array(&$userAccessManager, 'remove_categorydata'));
2806 -
2807 - add_action('wp_print_scripts', array(&$userAccessManager, 'add_scripts') );
2808 - add_action('wp_print_styles', array(&$userAccessManager, 'add_styles') );
2809 -
2810 -
2811 - //Admin filters
2812 - add_filter('manage_posts_columns', array(&$userAccessManager, 'add_post_columns_header'));
2813 - add_filter('manage_pages_columns', array(&$userAccessManager, 'add_post_columns_header'));
2814 -
2815 - $uamOptions = $userAccessManager->getAdminOptions();
2816 -
2817 - if($wp_version >= 2.8 || $uamOptions['core_mod'] == 'true')
2818 - {
2819 - add_filter('manage_users_columns', array(&$userAccessManager, 'add_user_columns_header'), 10);
2820 - add_filter('manage_users_custom_column', array(&$userAccessManager, 'add_user_column'), 10, 2);
2821 - add_filter('manage_categories_columns', array(&$userAccessManager, 'add_category_columns_header'));
2822 - add_filter('manage_categories_custom_column', array(&$userAccessManager, 'add_category_column'), 10, 2);
2823 -
2824 - //add_action('edit_category_add_form_before_button', array(&$userAccessManager, 'show_cat_add_form'), 9);
2825 - //add_action('created_term', array(&$userAccessManager, 'save_categorydata'), 9);
2826 - }
2827 - }
2828 -}
2829 -
2830 -//Actions and Filters
2831 -if (isset($userAccessManager))
2832 -{
2833 - add_action('init', array(&$userAccessManager, 'init'));
2834 - $uamOptions = $userAccessManager->getAdminOptions();
2835 -
2836 - //install
2837 - if(function_exists('register_activation_hook'))
2838 - register_activation_hook(__FILE__, array(&$userAccessManager, 'install'));
2839 - if(function_exists('register_uninstall_hook'))
2840 - register_uninstall_hook(__FILE__, array(&$userAccessManager, 'uninstall'));
2841 - elseif(function_exists('register_deactivation_hook'))
2842 - register_deactivation_hook(__FILE__, array(&$userAccessManager, 'uninstall'));
2843 -
2844 - //Actions
2845 - add_action('admin_menu', 'UserAccessManager_AP');
2846 -
2847 - //add_action('wp_head', array(&$userAccessManager, 'add_head_content'), 1);
2848 -
2849 - if($uamOptions['redirect'] != 'false' || isset($_GET['getfile']))
2850 - add_action('template_redirect', array(&$userAccessManager, 'redirect_user'));
2851 -
2852 - //Filters
2853 - add_filter('wp_get_attachment_url', array(&$userAccessManager, 'get_file'), 10, 2);
2854 - add_filter('the_posts', array(&$userAccessManager, 'show_post'));
2855 - add_filter('comments_array', array(&$userAccessManager, 'show_comment'));
2856 - add_filter('get_pages', array(&$userAccessManager, 'show_page'));
2857 - add_filter('get_terms', array(&$userAccessManager, 'show_category'));
2858 - add_filter('get_next_post_where', array(&$userAccessManager, 'show_next_previous_post'));
2859 - add_filter('get_previous_post_where', array(&$userAccessManager, 'show_next_previous_post'));
2860 - add_filter('get_previous_post_where', array(&$userAccessManager, 'show_next_previous_post'));
2861 - add_filter('the_title', array(&$userAccessManager, 'show_title'), 10, 2);
2862 -}
2863 -
2864 -?>
80 +add_action('init', 'initUam', 0);