Changeset 444136
- Timestamp:
- 09/27/2011 10:22:23 AM (15 years ago)
- Location:
- capa
- Files:
-
- 7 edited
- 1 copied
-
tags/0.5.8.2 (copied) (copied from capa/tags/0.5.8.1)
-
tags/0.5.8.2/capa-options.php (modified) (6 diffs)
-
tags/0.5.8.2/capa.php (modified) (6 diffs)
-
tags/0.5.8.2/readme.txt (modified) (2 diffs)
-
trunk/capa-options.php (modified) (11 diffs)
-
trunk/capa.php (modified) (6 diffs)
-
trunk/css/capa-style.css (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
capa/tags/0.5.8.2/capa-options.php
r391586 r444136 24 24 25 25 // DEV Variable 26 define('CAPA_DBUG', FALSE); 26 27 $menu_slug = (CAPA_DBUG) ? __FILE__ : 'capa/capa-options'; 27 28 28 /**29 /** 29 30 TODO 30 31 - 26.0001 verhindert, dass ein anderes Plugin den Platz stiehlt. - Notloesung; Aendern … … 38 39 39 40 // Global Subpage 40 $page['global'] = add_submenu_page( __FILE__, __('CaPa › General Settings','capa'), __('CaPa Settings','capa'), 'manage_options', $menu_slug, 'capa_global_page');41 $page['global'] = add_submenu_page($menu_slug, __('CaPa › General Settings','capa'), __('CaPa Settings','capa'), 'manage_options', $menu_slug, 'capa_global_page'); 41 42 42 43 // Roles Subpage 43 $page['roles'] = add_submenu_page( __FILE__, __('CaPa › User Roles','capa'), __('User Roles','capa'), 'manage_options', 'capa-roles-page', 'capa_sublevel_roles');44 $page['roles'] = add_submenu_page($menu_slug, __('CaPa › User Roles','capa'), __('User Roles','capa'), 'manage_options', 'capa/capa-roles-page', 'capa_sublevel_roles'); 44 45 45 46 // Support Subpage 46 $page['help'] = add_submenu_page(__FILE__, __('CaPa › Support','capa'), __('CaPa Support','capa'), 'manage_options', 'capa-support-page', 'capa_sublevel_support'); 47 47 $page['help'] = add_submenu_page($menu_slug, __('CaPa › Support','capa'), __('CaPa Support','capa'), 'manage_options', 'capa/capa-support-page', 'capa_sublevel_support'); 48 48 49 49 // Add Help … … 71 71 echo (function_exists('screen_icon')) ? screen_icon('options-general') : NULL; 72 72 73 echo '<h2 style="margin-bottom:15px;">' . __('CaPa » General settings','capa') . '<br><span class="description" style="line-height:0.5em;">'. __('These settings define the display of the CaPa protected content on your blog.','capa'). '</span></h2>';73 echo '<h2 style="margin-bottom:15px;">' . __('CaPa » General settings','capa') . '<br><span class="description">'. __('These settings define the display of the CaPa protected content on your blog.','capa'). '</span></h2>'; 74 74 75 75 echo '<form name="capa_protect" method="post">'; … … 297 297 298 298 echo '<a name="capa-scroll-category"></a>'; 299 echo '<h2 style="margin-bottom:15px;">' . _n('Category visibility','Categories visibility',count($categorys),'capa') . '<br><span class="description" style="line-height:0.5em;">'. __('Select which categories are available for each user role.','capa'). '</span></h2>';299 echo '<h2 style="margin-bottom:15px;">' . _n('Category visibility','Categories visibility',count($categorys),'capa') . '<br><span class="description">'. __('Select which categories are available for each user role.','capa'). '</span></h2>'; 300 300 301 301 echo ' … … 379 379 380 380 echo '<a name="capa-scroll-page"></a>'; 381 echo '<h2 style="margin-bottom:15px;">' . _n('Page visibility', 'Pages visibility', count($pages),'capa') . '<br><span class="description" style="line-height:0.5em;">'. __('Select which pages are available for each user role.','capa'). '</span></h2>';381 echo '<h2 style="margin-bottom:15px;">' . _n('Page visibility', 'Pages visibility', count($pages),'capa') . '<br><span class="description">'. __('Select which pages are available for each user role.','capa'). '</span></h2>'; 382 382 383 383 echo ' … … 451 451 452 452 echo '<a name="capa-scroll-redirect"></a>'; 453 echo '<h2 style="margin-bottom:15px;">' . _n('Redirect', 'Redirects', 0,'capa') . '<br><span class="description" style="line-height:0.5em;">'. __('Select which pages are available for each user role.','capa'). '</span></h2>';453 echo '<h2 style="margin-bottom:15px;">' . _n('Redirect', 'Redirects', 0,'capa') . '<br><span class="description">'. __('Select which pages are available for each user role.','capa'). '</span></h2>'; 454 454 455 455 echo ' -
capa/tags/0.5.8.2/capa.php
r398346 r444136 4 4 Plugin URI: http://www.smatern.de/category/coding/capa/ 5 5 Description: CaPa provides Category & Pages protection on a roles & user basis. 6 Version: 0.5.8. 16 Version: 0.5.8.2 7 7 Author: S. Matern 8 8 Author URI: http://www.smatern.de … … 576 576 577 577 // In case sql is for the attachments 578 $fld_id = (strpos($sql,'attachment')) ? 'post_parent' : 'ID'; 579 578 $fld_id = (strpos($sql, "post_type = 'attachment'")) ? 'post_parent' : 'ID'; 580 579 581 580 if(sizeof($ids) > 0){ 582 $sql .= " AND ".$fld_id." IN (".implode(",",$ids).( ($capa_protect_show_only_allowed_attachments && $capa_protect_show_unattached_files) ? ', 0' : ', -1').")";581 $sql .= " AND ".$fld_id." IN (".implode(",",$ids).( ($capa_protect_show_only_allowed_attachments && $capa_protect_show_unattached_files) ? ', 0' : ', -1' ).")"; 583 582 }else{ 584 583 $sql .= " AND ".$fld_id." IN ('".(($capa_protect_show_unattached_files) ? "0" : "-1")."')"; … … 889 888 890 889 $all_category_tax_ids = capa_protect::_get_taxonomy_ids(); 891 $all_category_tax_ids = array_flip($all_category_tax_ids['category']);890 $all_category_tax_ids = (isset($all_category_tax_ids['category'])) ? array_flip($all_category_tax_ids['category']) : array(); 892 891 893 892 if ($current_user && isset($current_user->allcaps['manage_categories']) && !isset($current_user->caps['editor'])){ … … 1205 1204 $taxonomy_ids[$row['taxonomy']][$row['term_taxonomy_id']] = $row['term_id']; 1206 1205 } 1206 1207 1207 return $taxonomy_ids; 1208 1209 1208 } 1210 1209 … … 1343 1342 */ 1344 1343 function filter_wpdb_query($param){ 1344 1345 1345 global $current_user; 1346 1346 … … 1557 1557 1558 1558 1559 // SQLFILTER::function get_var ( case of unattached file count ) 1560 # SELECT COUNT( * ) FROM $wpdb->posts 1561 # WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 1562 // DEV 1563 if(strpos($param, "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1") !== FALSE){ 1564 global $capa_protect_show_unattached_files; 1565 1566 if(!$capa_protect_show_unattached_files){ 1567 $param .= ' AND post_parent NOT IN (0)'; 1568 } 1569 } 1570 1571 1559 1572 return $param; 1560 1573 } -
capa/tags/0.5.8.2/readme.txt
r398346 r444136 4 4 Tags: restrict, restriction, category, categories, page, pages, protect, comments, security, Post, admin, plugin, posts, invisible, hide comments, comments private, hide comments from non-members, members, membership, sicherheit, begrenzung 5 5 Requires at least: 2.7.1 6 Tested up to: 3. 1.37 Stable tag: 0.5.8. 16 Tested up to: 3.2.1 7 Stable tag: 0.5.8.2 8 8 9 9 Protects Categories, Pages and Posts for specific users & anonymous visitor … … 61 61 62 62 == Changelog == 63 64 = v0.5.8.2 = 65 * Bugfix "Search No Result" 66 * Bugfix "Notice Error CAPA_DBUG" 67 * Bugfix "Warning array_flip" 63 68 64 69 = v0.5.8.1 = -
capa/trunk/capa-options.php
r391586 r444136 23 23 24 24 25 // DEV Variable 26 $menu_slug = (CAPA_DBUG) ? __FILE__ : 'capa/capa-options'; 27 28 /** 29 TODO 30 - 26.0001 verhindert, dass ein anderes Plugin den Platz stiehlt. - Notloesung; Aendern 25 // DEV Variable 26 define('CAPA_DBUG', TRUE); 27 $menu_slug = (CAPA_DBUG) ? __FILE__ : 'capa/capa-options'; 28 29 /** 30 TODO 31 - 26.0001 verhindert, dass ein anderes Plugin den Platz stiehlt. - Notloesung; Aendern 31 32 */ 32 33 33 // Add Capa Separator34 $menu['26.0001'] = array( '', 'manage_options', 'separator-capa', '', 'wp-menu-separator' );35 36 // Add CaPa Menu ( after the CaPa Separator and before Appearance) :37 add_menu_page( __('CaPa','capa'), 'CaPa', 'manage_options', $menu_slug, 'capa_global_page', 'div', '26.0002');38 39 // Global Subpage40 $page['global'] = add_submenu_page(__FILE__, __('CaPa › General Settings','capa'), __('CaPa Settings','capa'), 'manage_options', $menu_slug, 'capa_global_page');41 42 // Roles Subpage43 $page['roles'] = add_submenu_page(__FILE__, __('CaPa › User Roles','capa'), __('User Roles','capa'), 'manage_options', 'capa-roles-page', 'capa_sublevel_roles');44 45 // Support Subpage46 $page['help'] = add_submenu_page(__FILE__, __('CaPa › Support','capa'), __('CaPa Support','capa'), 'manage_options', 'capa-support-page', 'capa_sublevel_support');34 // Add Capa Separator 35 $menu['26.0001'] = array( '', 'manage_options', 'separator-capa', '', 'wp-menu-separator' ); 36 37 // Add CaPa Menu ( after the CaPa Separator and before Appearance) : 38 add_menu_page( __('CaPa','capa'), 'CaPa', 'manage_options', $menu_slug, 'capa_global_page', 'div', '26.0002'); 39 40 // Global Subpage 41 $page['global'] = add_submenu_page($menu_slug, __('CaPa › General Settings','capa'), __('CaPa Settings','capa'), 'manage_options', $menu_slug, 'capa_global_page'); 42 43 // Roles Subpage 44 $page['roles'] = add_submenu_page($menu_slug, __('CaPa › User Roles','capa'), __('User Roles','capa'), 'manage_options', 'capa/capa-roles-page', 'capa_sublevel_roles'); 45 46 // Support Subpage 47 $page['help'] = add_submenu_page($menu_slug, __('CaPa › Support','capa'), __('CaPa Support','capa'), 'manage_options', 'capa/capa-support-page', 'capa_sublevel_support'); 47 48 48 49 … … 55 56 56 57 } 57 58 58 59 59 } … … 71 71 echo (function_exists('screen_icon')) ? screen_icon('options-general') : NULL; 72 72 73 echo '<h2 style="margin-bottom:15px;">' . __('CaPa » General settings','capa') . '<br><span class="description" style="line-height: 0.5em;">'. __('These settings define the display of the CaPa protected content on your blog.','capa'). '</span></h2>';73 echo '<h2 style="margin-bottom:15px;">' . __('CaPa » General settings','capa') . '<br><span class="description" style="line-height:1.5em;">'. __('These settings define the display of the CaPa protected content on your blog.','capa'). '</span></h2>'; 74 74 75 75 echo '<form name="capa_protect" method="post">'; … … 242 242 } 243 243 244 245 // capa_sublevel_roles() display custom Roles and there settings/restrict 246 function capa_custom_roles(){ 247 // Check if POST isnt empty 248 ($_POST) ? capa_handle_action() : NULL ; 249 250 echo '<div class="wrap">'; 251 // For WP < 27 252 echo (function_exists('screen_icon')) ? screen_icon('users') : NULL; 253 echo '<h2 style="margin-bottom:15px;">' . __('CaPa » Custom Roles','capa') . '</h2>'; 254 255 echo '<ul class="subsubsub" style="float:none;">'; 256 echo '<li><a href="#capa-scroll-settings">'.__('Settings', 'capa').'</a> | </li>'; 257 echo '<li><a href="#capa-scroll-add">'.__('Create/Modify Custom Role', 'capa').'</a></li>'; # | 258 echo '</ul>'; 259 260 echo '<form name="capa_protect" method="post">'; 261 262 // -------------------------------------------------------------- 263 // ---- Categories Custom Role --- // 264 // -------------------------------------------------------------- 265 266 echo '<a name="capa-scroll-settings"></a>'; 267 echo '<h2 style="margin-bottom:15px;">' . _n('Category visibility','Categories visibility',count($categorys),'capa') . '<br><span class="description" style="line-height:1.5em;">'. __('Select which categories are available for each custom role.','capa'). '</span></h2>'; 268 269 $odd[0] = ''; 270 $odd[1] = ' class="alternate"'; 271 272 $_custom_roles = get_option('wp_user_roles'); 273 // Remove Standard Roles 274 unset($_custom_roles['administrator'], $_custom_roles['editor'], $_custom_roles['author'], $_custom_roles['contributor'], $_custom_roles['subscriber']); 275 276 $categorys = get_categories( array('sort_column' => 'menu_order','hide_empty'=>0, 'child_of'=>0, 'hierarchical'=>0) );; 277 $pages = get_pages(array('sort_column' => 'menu_order')); 278 279 foreach($_custom_roles as $obj=>$values){ 280 $_role[$obj] = $values['name']; 281 $category_check_role[$obj] = get_option("capa_protect_cat_role_".$obj); 282 $page_check_role[$obj] = get_option("capa_protect_pag_role_".$obj); 283 } 284 285 286 $_thead = $_tfoot = null; 287 foreach( $_role as $obj=>$name){ 288 $_thead .= '<th>'.$name.'</th>'; 289 } 290 291 foreach( $_role as $obj=>$name){ 292 $_tfoot .= '<th> <input type="checkbox" id="check-cat-'.$obj.'" onclick="capa_check(\'capa_protect_cat['.$obj.'][]\',\'check-cat-'.$obj.'\');"> </th>'; 293 } 294 295 echo ' 296 <table class="widefat fixed capa-table"> 297 <thead> 298 <tr><th> </th>'.$_thead.'</tr> 299 </thead> 300 <tfoot> 301 <tr> <th> '. __('check/uncheck','capa') .' </th>'.$_tfoot.'</tr> 302 </tfoot> 303 304 <tbody class="capa-tbody"> 305 '; 306 307 foreach ( $categorys as $id=>$cat ) { 308 $raw_order[$cat->term_id] = $id; 309 $search[$cat->term_id] = $cat->category_parent; 310 } 311 312 // Get children-lvl 313 foreach($categorys as $id=>$cat){ 314 $lvl['cat'][$cat->term_id] = capa_find_lvl($cat->term_id,$search); 315 } 316 317 // Get category menu_order 318 ob_start(); 319 wp_category_checklist(); 320 $cat_output = ob_get_contents(); 321 ob_end_clean(); 322 323 preg_match_all("#category-(?P<id>(\d+))'( |>)#isU",$cat_output, $sort_order, PREG_PATTERN_ORDER); 324 $sort_order = $sort_order['id']; 325 $i = 0; 326 327 foreach ($sort_order as $key=>$id){ 328 echo '<tr style="text-align:center;" '.$odd[($i%2)].'>'; 329 echo '<th><input type="hidden" id="empty-'.$categorys[$raw_order[$id]]->slug.'" name="empty" value="0" readonly><label onclick="capa_check_slug(\''.$categorys[$raw_order[$id]]->slug.'-'.$categorys[$raw_order[$id]]->term_id.'\',\'empty-'.$categorys[$raw_order[$id]]->slug.'\');">'. str_repeat( '<span style="color:#21759B;">›</span> ', $lvl['cat'][$categorys[$raw_order[$id]]->term_id] ). $categorys[$raw_order[$id]]->cat_name .'</label></th>'; 330 331 foreach($_role as $obj=>$name){ 332 echo '<td><input class="category_id_role '.$categorys[$raw_order[$id]]->slug.'-'.$categorys[$raw_order[$id]]->term_id.'" type="checkbox" name="capa_protect_cat['.$obj.'][]" value="'.$categorys[$raw_order[$id]]->term_id.'" '. ((isset($category_check_role[$obj][$categorys[$raw_order[$id]]->term_id])) ? 'checked' : NULL).'></td>'; 333 } 334 echo '</tr>'; 335 $i++; 336 } 337 338 echo ' 339 </tbody> 340 </table> 341 '; 342 343 echo '<br>'; 344 345 346 // -------------------------------------------------------------- 347 // ---- Pages --- // 348 // -------------------------------------------------------------- 349 if($pages){ 350 351 echo '<a name="capa-scroll-page"></a>'; 352 echo '<h2 style="margin-bottom:15px;">' . _n('Page visibility', 'Pages visibility', count($pages),'capa') . '<br><span class="description" style="line-height:1.5em;">'. __('Select which pages are available for each custom role.','capa'). '</span></h2>'; 353 354 355 $_thead = $_tfoot = null; 356 357 foreach( $_role as $obj => $name){ 358 $_thead .= '<th>'.$name.'</th>'; 359 } 360 361 foreach( $_role as $obj => $name){ 362 $_tfoot .= '<th> <input type="checkbox" id="check-pag-'.$obj.'" onclick="capa_check(\'capa_protect_pag['.$obj.'][]\',\'check-pag-'.$obj.'\');"> </th>'; 363 } 364 365 echo ' 366 <table class="widefat fixed capa-table"> 367 <thead> 368 <tr><th> </th>'.$_thead.'</tr> 369 </thead> 370 <tfoot> 371 <tr><th> '. __('check/uncheck','capa') .' </th>'.$_tfoot.'</tr> 372 </tfoot> 373 374 375 <tbody class="capa-tbody"> 376 '; 377 $i = 0; 378 379 foreach ( $pages as $id=>$page ) { 380 $search[$page->ID] = $page->post_parent; 381 } 382 foreach($pages as $id=>$page){ 383 $lvl['page'][$page->ID] = capa_find_lvl($page->ID,$search); 384 } 385 386 foreach ($pages as $page){ 387 388 echo '<tr style="text-align:center;" '.$odd[($i%2)].'>'; 389 echo '<th><input type="hidden" id="empty-'.$page->post_name.'" name="empty" value="0" readonly><label onclick="capa_check_slug(\''.$page->post_name.'-'.$page->ID.'\',\'empty-'.$page->post_name.'\');">'. str_repeat( '<span style="color:#21759B;">›</span> ', $lvl['page'][$page->ID] ). $page->post_title .'</label></th>'; 390 391 foreach($_role as $obj => $name){ 392 echo '<td><input class="page_id_role '.$page->post_name.'-'.$page->ID.'" type="checkbox" name="capa_protect_pag['.$obj.'][]" value="'.$page->ID.'" '.((isset($page_check_role[$obj][$page->ID])) ? 'checked' : NULL).'></td>'; 393 } 394 395 echo '</tr>'; 396 $i++; 397 } 398 399 echo ' 400 </tbody> 401 </table> 402 '; 403 } 404 405 406 echo ' 407 <p class="submit" style="float:left; margin-right:10px;"> 408 <button type="submit" name="submit" class="button-primary" value="update custom role options" >'. __('Update custom roles settings','capa') .'</button> 409 </p> 410 <p class="submit"> 411 <button type="submit" name="submit" class="button" value="reset custom role" >'. __('Reset custom roles','capa').'</button> 412 </p> 413 '; 414 415 416 echo "<br>"; 417 // -------------------------------------------------------------- 418 // ---- Create Custom Role --- // 419 // -------------------------------------------------------------- 420 421 echo '<a name="capa-scroll-add"></a>'; 422 echo '<h2 style="margin-bottom:15px;">' . __('Create/Modify Custom Role','capa') . '<br><span class="description" style="line-height:1.5em;">'. __('Create a new custom role or modify.','capa'). '</span></h2>'; 423 424 global $current_user; 425 426 // Get only allowed capabilities 427 $_capabilities = $current_user->allcaps; 428 429 $_tmp = null; 430 431 foreach($_capabilities as $obj=>$value){ 432 if($value){ 433 // Dont show levels or custom caps from other plugins ( which values arent exactly bool ) 434 if( strpos( $obj, 'level' ) !== FALSE || !is_bool($value) ) continue; 435 436 $_tmp .= '<li><input type="checkbox" name="'.$obj.'" id="cap-'.$obj.'"><label for="cap-'.$obj.'">'.ucfirst(str_replace('_',' ',$obj)).'</label></li>'; 437 } 438 } 439 440 $_capabilites = '<ul id="capa-capabilities">'.$_tmp.'</ul>'; 441 442 echo ' 443 <table class="form-table capa-form-table"> 444 <tr> 445 <th scope="row">'.__('Custom role name','capa').'</th> 446 <td> 447 <label> 448 <input name="role-name" type="text"> 449 </label> 450 </td> 451 </tr> 452 453 <tr> 454 <th scope="row">'.__('Capabilities','capa').'</th> 455 <td> 456 '.$_capabilites.' 457 </td> 458 </tr> 459 460 461 </table> 462 '; 463 464 465 echo ' 466 <p class="submit" style="float:left; margin-right:10px;"> 467 <button type="submit" name="submit" class="button-primary" value="create custom role" >'. __('Create custom role','capa') .'</button> 468 </p> 469 </form>'; 470 471 } 472 244 473 // capa_sublevel_roles() displays the page content for the roles submenu 245 474 function capa_sublevel_roles() { … … 297 526 298 527 echo '<a name="capa-scroll-category"></a>'; 299 echo '<h2 style="margin-bottom:15px;">' . _n('Category visibility','Categories visibility',count($categorys),'capa') . '<br><span class="description" style="line-height: 0.5em;">'. __('Select which categories are available for each user role.','capa'). '</span></h2>';528 echo '<h2 style="margin-bottom:15px;">' . _n('Category visibility','Categories visibility',count($categorys),'capa') . '<br><span class="description" style="line-height:1.5em;">'. __('Select which categories are available for each user role.','capa'). '</span></h2>'; 300 529 301 530 echo ' … … 379 608 380 609 echo '<a name="capa-scroll-page"></a>'; 381 echo '<h2 style="margin-bottom:15px;">' . _n('Page visibility', 'Pages visibility', count($pages),'capa') . '<br><span class="description" style="line-height: 0.5em;">'. __('Select which pages are available for each user role.','capa'). '</span></h2>';610 echo '<h2 style="margin-bottom:15px;">' . _n('Page visibility', 'Pages visibility', count($pages),'capa') . '<br><span class="description" style="line-height:1.5em;">'. __('Select which pages are available for each user role.','capa'). '</span></h2>'; 382 611 383 612 echo ' … … 451 680 452 681 echo '<a name="capa-scroll-redirect"></a>'; 453 echo '<h2 style="margin-bottom:15px;">' . _n('Redirect', 'Redirects', 0,'capa') . '<br><span class="description" style="line-height: 0.5em;">'. __('Select which pages are available for each user role.','capa'). '</span></h2>';682 echo '<h2 style="margin-bottom:15px;">' . _n('Redirect', 'Redirects', 0,'capa') . '<br><span class="description" style="line-height:1.5em;">'. __('Select which pages are available for each user role.','capa'). '</span></h2>'; 454 683 455 684 echo ' … … 525 754 } 526 755 756 757 758 527 759 // capa_subleve_debug() displays information for an better help 528 760 function capa_sublevel_support() { … … 663 895 } 664 896 665 666 897 function capa_handle_action() { 667 898 global $_POST; … … 710 941 } 711 942 943 if($_POST['submit'] == 'reset custom role'){ 944 945 $_custom_roles = get_option('wp_user_roles'); 946 // Remove Standard Roles 947 unset($_custom_roles['administrator'], $_custom_roles['editor'], $_custom_roles['author'], $_custom_roles['contributor'], $_custom_roles['subscriber']); 948 949 foreach($_custom_roles as $obj=>$values){ 950 delete_option("capa_protect_cat_role_".$obj); 951 delete_option("capa_protect_pag_role_".$obj); 952 } 953 954 // Show Update Message 955 echo '<div id="message" class="updated fade"><p><strong>'.__('Custom Role Settings are reset.','capa').'</strong></p></div>'; 956 957 } 958 712 959 713 960 if($_POST['submit'] == 'Update general settings'){ … … 883 1130 } 884 1131 1132 1133 if($_POST['submit'] == 'update custom role options'){ 1134 1135 $_custom_roles = get_option('wp_user_roles'); 1136 // Remove Standard Roles 1137 unset($_custom_roles['administrator'], $_custom_roles['editor'], $_custom_roles['author'], $_custom_roles['contributor'], $_custom_roles['subscriber']); 1138 1139 // CATEGORY 1140 if(isset($_POST['capa_protect_cat']) && is_array($_POST['capa_protect_cat'])){ 1141 foreach($_POST['capa_protect_cat'] as $role=>$value){ 1142 foreach($value as $id=>$wert){ 1143 $tmp['cat'][$role][$wert] = TRUE; 1144 } 1145 } 1146 1147 foreach($_custom_roles as $obj=>$value){ 1148 if(isset($tmp['cat'][$obj])){ 1149 update_option('capa_protect_cat_role_'.$obj, $tmp['cat'][$obj]); 1150 }else{ 1151 delete_option('capa_protect_cat_role_'.$obj); 1152 } 1153 } 1154 } 1155 1156 // PAGE 1157 if(isset($_POST['capa_protect_pag']) && is_array($_POST['capa_protect_pag'])){ 1158 foreach($_POST['capa_protect_pag'] as $role=>$value){ 1159 foreach($value as $id=>$wert){ 1160 $tmp['pag'][$role][$wert] = TRUE; 1161 } 1162 } 1163 1164 foreach($_custom_roles as $obj=>$value){ 1165 if(isset($tmp['pag'][$obj])){ 1166 update_option('capa_protect_pag_role_'.$obj, $tmp['pag'][$obj]); 1167 }else{ 1168 delete_option('capa_protect_pag_role_'.$obj); 1169 } 1170 } 1171 } 1172 1173 // Show Update Message 1174 echo '<div id="message" class="updated fade"><p><strong>'.__('Custom Role Settings saved.','capa').'</strong></p></div>'; 1175 } 885 1176 886 1177 if($_POST['submit'] == 'Send Help'){ -
capa/trunk/capa.php
r398346 r444136 4 4 Plugin URI: http://www.smatern.de/category/coding/capa/ 5 5 Description: CaPa provides Category & Pages protection on a roles & user basis. 6 Version: 0.5.8. 16 Version: 0.5.8.2 7 7 Author: S. Matern 8 8 Author URI: http://www.smatern.de … … 576 576 577 577 // In case sql is for the attachments 578 $fld_id = (strpos($sql,'attachment')) ? 'post_parent' : 'ID'; 579 578 $fld_id = (strpos($sql, "post_type = 'attachment'")) ? 'post_parent' : 'ID'; 580 579 581 580 if(sizeof($ids) > 0){ 582 $sql .= " AND ".$fld_id." IN (".implode(",",$ids).( ($capa_protect_show_only_allowed_attachments && $capa_protect_show_unattached_files) ? ', 0' : ', -1').")";581 $sql .= " AND ".$fld_id." IN (".implode(",",$ids).( ($capa_protect_show_only_allowed_attachments && $capa_protect_show_unattached_files) ? ', 0' : ', -1' ).")"; 583 582 }else{ 584 583 $sql .= " AND ".$fld_id." IN ('".(($capa_protect_show_unattached_files) ? "0" : "-1")."')"; … … 889 888 890 889 $all_category_tax_ids = capa_protect::_get_taxonomy_ids(); 891 $all_category_tax_ids = array_flip($all_category_tax_ids['category']);890 $all_category_tax_ids = (isset($all_category_tax_ids['category'])) ? array_flip($all_category_tax_ids['category']) : array(); 892 891 893 892 if ($current_user && isset($current_user->allcaps['manage_categories']) && !isset($current_user->caps['editor'])){ … … 1205 1204 $taxonomy_ids[$row['taxonomy']][$row['term_taxonomy_id']] = $row['term_id']; 1206 1205 } 1206 1207 1207 return $taxonomy_ids; 1208 1209 1208 } 1210 1209 … … 1343 1342 */ 1344 1343 function filter_wpdb_query($param){ 1344 1345 1345 global $current_user; 1346 1346 … … 1557 1557 1558 1558 1559 // SQLFILTER::function get_var ( case of unattached file count ) 1560 # SELECT COUNT( * ) FROM $wpdb->posts 1561 # WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 1562 // DEV 1563 if(strpos($param, "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1") !== FALSE){ 1564 global $capa_protect_show_unattached_files; 1565 1566 if(!$capa_protect_show_unattached_files){ 1567 $param .= ' AND post_parent NOT IN (0)'; 1568 } 1569 } 1570 1571 1559 1572 return $param; 1560 1573 } -
capa/trunk/css/capa-style.css
r391586 r444136 75 75 border-bottom:1px solid #DFDFDF 76 76 } 77 78 #capa-capabilities li{ 79 display: inline-block; 80 width: 200px; 81 } 82 #capa-capabilities label{ 83 padding: 3px 0px 0px 10px; 84 } -
capa/trunk/readme.txt
r398346 r444136 4 4 Tags: restrict, restriction, category, categories, page, pages, protect, comments, security, Post, admin, plugin, posts, invisible, hide comments, comments private, hide comments from non-members, members, membership, sicherheit, begrenzung 5 5 Requires at least: 2.7.1 6 Tested up to: 3. 1.37 Stable tag: 0.5.8. 16 Tested up to: 3.2.1 7 Stable tag: 0.5.8.2 8 8 9 9 Protects Categories, Pages and Posts for specific users & anonymous visitor … … 61 61 62 62 == Changelog == 63 64 = v0.5.8.2 = 65 * Bugfix "Search No Result" 66 * Bugfix "Notice Error CAPA_DBUG" 67 * Bugfix "Warning array_flip" 63 68 64 69 = v0.5.8.1 =
Note: See TracChangeset
for help on using the changeset viewer.