b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (0.9.x) [ class tree: admin ] [ index: admin ] [ all elements ]

Source for file _blogs_permissions.form.php

Documentation is available at _blogs_permissions.form.php

  1. <?php
  2. /**
  3.  * Displays blog properties form
  4.  *
  5.  * b2evolution - {@link http://b2evolution.net/}
  6.  * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
  7.  * @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
  8.  *
  9.  * @package admin
  10.  */
  11. if!defined('DB_USER') ) die'Please, do not access this page directly.' );
  12. ?>
  13. <form action="b2blogs.php" class="fform" method="post" name="FormPerm">
  14.     <input type="hidden" name="action" value="update" />
  15.     <input type="hidden" name="tab" value="perm" />
  16.     <input type="hidden" name="blog" value="<?php echo $blog?>" />
  17.  
  18.     <fieldset>
  19.         <legend><?php echo T_('User permissions'?></legend>
  20.         <table class="grouped" cellspacing="0">
  21.             <tr>
  22.                 <th rowspan="2"><?php /* TRANS: table header for user list */ echo T_('Login '?></th>
  23.                 <th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Is<br />member'?></th>
  24.                 <th colspan="5" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Can post/edit with following statuses:'?></th>
  25.                 <th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Delete<br />posts'?></th>
  26.                 <th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Edit<br />comts'?></th>
  27.                 <th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Edit<br />cats'?></th>
  28.                 <th rowspan="2" class="checkright"><?php /* TRANS: SHORT table header on TWO lines */ echo T_('Edit<br />blog'?></th>
  29.                 <th rowspan="2" class="checkright">&nbsp;</th>
  30.             </tr>
  31.             <tr>
  32.                 <th class="checkright"><?php echo T_('Published'?></th>
  33.                 <th class="checkright"><?php echo T_('Protected'?></th>
  34.                 <th class="checkright"><?php echo T_('Private'?></th>
  35.                 <th class="checkright"><?php echo T_('Draft'?></th>
  36.                 <th class="checkright"><?php echo T_('Deprecated'?></th>
  37.             </tr>
  38.             <tr class="group">
  39.                 <td colspan="12">
  40.                     <strong><?php echo T_('Members'?></strong>
  41.                 </td>
  42.             </tr>
  43.             <?php
  44.                 $query "SELECT ID, user_login, bloguser_perm_poststatuses, bloguser_ismember,
  45.                                                     bloguser_perm_comments, bloguser_perm_delpost, bloguser_perm_cats,
  46.                                                     bloguser_perm_properties
  47.                                     FROM $tableusers INNER JOIN $tableblogusers
  48.                                                     ON ID = bloguser_user_ID
  49.                                     WHERE bloguser_blog_ID = $blog
  50.                                     ORDER BY user_login";
  51.                 $rows $DB->get_results$queryARRAY_A );
  52.                 $members array();
  53.                 $i 0;  // incemental counter (for "check all" span IDs)
  54.                 ifcount($rows) ) foreach$rows as $loop_row )
  55.                 {    // Go through users:
  56.                     $members[$loop_row['ID'];
  57.                     $perm_post explode','$loop_row['bloguser_perm_poststatuses');
  58.                     ?>
  59.                     <tr <?php if$i%== 1echo 'class="odd"'?>>
  60.                         <td><?php echo format_to_output$loop_row['user_login']'htmlbody' )?></td>
  61.                         <td class="center">
  62.                             <input id="checkallspan_state_<?php echo $i ?>" type="checkbox" name="blog_ismember_<?php echo $loop_row['ID'?>"
  63.                                 checked="checked" onclick="setcheckallspan(<?php echo $i ?>, this.checked)"
  64.                                 value="1" title="<?php echo T_('Permission to read protected posts'?>" />
  65.                         </td>
  66.                         <td class="center">
  67.                             <input type="checkbox" name="blog_perm_published_<?php echo $loop_row['ID'?>"
  68.                                 <?php ifin_array'published'$perm_post ) ) ?>
  69.                                 checked="checked"
  70.                                 <?php ?>
  71.                                 value="1" title="<?php echo T_('Permission to post into this blog with private status'?>" />
  72.                         </td>
  73.                         <td class="center">
  74.                             <input type="checkbox" name="blog_perm_protected_<?php echo $loop_row['ID'?>"
  75.                                 <?php ifin_array'protected'$perm_post ) ) ?>
  76.                                 checked="checked"
  77.                                 <?php ?>
  78.                                 value="1" title="<?php echo T_('Permission to post into this blog with protected status'?>" />
  79.                         </td>
  80.                         <td class="center">
  81.                             <input type="checkbox" name="blog_perm_private_<?php echo $loop_row['ID'?>"
  82.                                 <?php ifin_array'private'$perm_post ) ) ?>
  83.                                 checked="checked"
  84.                                 <?php ?>
  85.                                 value="1" title="<?php echo T_('Permission to post into this blog with private status'?>" />
  86.                         </td>
  87.                         <td class="center">
  88.                             <input type="checkbox" name="blog_perm_draft_<?php echo $loop_row['ID'?>"
  89.                                 <?php ifin_array'draft'$perm_post ) ) ?>
  90.                                 checked="checked"
  91.                                 <?php ?>
  92.                                 value="1" title="<?php echo T_('Permission to post into this blog with draft status'?>" />
  93.                         </td>
  94.                         <td class="center">
  95.                             <input type="checkbox" name="blog_perm_deprecated_<?php echo $loop_row['ID'?>"
  96.                                 <?php ifin_array'deprecated'$perm_post ) ) ?>
  97.                                 checked="checked"
  98.                                 <?php ?>
  99.                                 value="1" title="<?php echo T_('Permission to post into this blog with deprecated status'?>" />
  100.                         </td>
  101.                         <td class="center">
  102.                             <input type="checkbox" name="blog_perm_delpost_<?php echo $loop_row['ID'?>"
  103.                                 <?php if$loop_row['bloguser_perm_delpost'!= 0  ?>
  104.                                 checked="checked"
  105.                                 <?php ?>
  106.                                 value="1" title="<?php echo T_('Permission to delete posts in this blog'?>" />
  107.                         </td>
  108.                         <td class="center">
  109.                             <input type="checkbox" name="blog_perm_comments_<?php echo $loop_row['ID'?>"
  110.                                 <?php if$loop_row['bloguser_perm_comments'!= 0  ?>
  111.                                 checked="checked"
  112.                                 <?php ?>
  113.                                 value="1" title="<?php echo T_('Permission to edit comments in this blog'?>" />
  114.                         </td>
  115.                         <td class="center">
  116.                             <input type="checkbox" name="blog_perm_cats_<?php echo $loop_row['ID'?>"
  117.                                 <?php if$loop_row['bloguser_perm_cats'!= 0  ?>
  118.                                 checked="checked"
  119.                                 <?php ?>
  120.                                 value="1" title="<?php echo T_('Permission to edit categories for this blog'?>" />
  121.                         </td>
  122.                         <td class="center">
  123.                             <input type="checkbox" name="blog_perm_properties_<?php echo $loop_row['ID'?>"
  124.                                 <?php if$loop_row['bloguser_perm_properties'!= 0  ?>
  125.                                 checked="checked"
  126.                                 <?php ?>
  127.                                 value="1" title="<?php echo T_('Permission to edit blog properties'?>" />
  128.                         </td>
  129.                         <td class="center">
  130.                             <a href="javascript:toggleall(document.FormPerm, <?php echo $loop_row['ID'].', '.$i ?>);" title="<?php echo T_('(un)selects all checkboxes using Javascript'?>">
  131.                                 <span id="checkallspan_<?php echo $i ?>" class="checkall"><?php echo T_('(un)check all')?></span>
  132.                             </a>
  133.                         </td>
  134.                     </tr>
  135.                     <?php
  136.                     $i++;
  137.                 }
  138.                 ?>
  139.             <tr class="group">
  140.                 <td colspan="12">
  141.                     <strong><?php echo T_('Non members'?></strong>
  142.                 </td>
  143.             </tr>
  144.                 <?php
  145.                 $query "SELECT ID, user_login
  146.                                     FROM $tableusers ";
  147.                 ifcount$members ) )
  148.                 {
  149.                     $query .= "WHERE ID NOT IN (".implode','$members .") ";
  150.                 }
  151.                 $query .= "ORDER BY user_login";
  152.                 $rows $DB->get_results$queryARRAY_A );
  153.                 ifcount($rows) ) foreach$rows as $loop_row )
  154.                 {    // Go through users:
  155.                     ?>
  156.                     <tr <?php if$i%== 1echo 'class="odd"'?>>
  157.                         <td><?php echo format_to_output$loop_row['user_login']'htmlbody' )?></td>
  158.                         <td class="center">
  159.                             <input id="checkallspan_state_<?php echo $i ?>" type="checkbox" name="blog_ismember_<?php echo $loop_row['ID'?>"
  160.                                 onclick="setcheckallspan(<?php echo $i ?>, this.checked)"
  161.                                 value="1" title="<?php echo T_('Permission to read protected posts'?>" />
  162.                         </td>
  163.                         <td class="center">
  164.                             <input type="checkbox" name="blog_perm_published_<?php echo $loop_row['ID'?>"
  165.                                 value="1" title="<?php echo T_('Permission to post into this blog with private status'?>" />
  166.                         </td>
  167.                         <td class="center">
  168.                             <input type="checkbox" name="blog_perm_protected_<?php echo $loop_row['ID'?>"
  169.                                 value="1" title="<?php echo T_('Permission to post into this blog with protected status'?>" />
  170.                         </td>
  171.                         <td class="center">
  172.                             <input type="checkbox" name="blog_perm_private_<?php echo $loop_row['ID'?>"
  173.                                 value="1" title="<?php echo T_('Permission to post into this blog with private status'?>" />
  174.                         </td>
  175.                         <td class="center">
  176.                             <input type="checkbox" name="blog_perm_draft_<?php echo $loop_row['ID'?>"
  177.                                 value="1" title="<?php echo T_('Permission to post into this blog with draft status'?>" />
  178.                         </td>
  179.                         <td class="center">
  180.                             <input type="checkbox" name="blog_perm_deprecated_<?php echo $loop_row['ID'?>"
  181.                                 value="1" title="<?php echo T_('Permission to post into this blog with deprecated status'?>" />
  182.                         </td>
  183.                         <td class="center">
  184.                             <input type="checkbox" name="blog_perm_delpost_<?php echo $loop_row['ID'?>"
  185.                                 value="1" title="<?php echo T_('Permission to delete posts in this blog'?>" />
  186.                         </td>
  187.                         <td class="center">
  188.                             <input type="checkbox" name="blog_perm_comments_<?php echo $loop_row['ID'?>"
  189.                                 value="1" title="<?php echo T_('Permission to edit comments in this blog'?>" />
  190.                         </td>
  191.                         <td class="center">
  192.                             <input type="checkbox" name="blog_perm_cats_<?php echo $loop_row['ID'?>"
  193.                                 value="1" title="<?php echo T_('Permission to edit categories for this blog'?>" />
  194.                         </td>
  195.                         <td class="center">
  196.                             <input type="checkbox" name="blog_perm_properties_<?php echo $loop_row['ID'?>"
  197.                                 value="1" title="<?php echo T_('Permission to edit blog properties'?>" />
  198.                         </td>
  199.                         <td class="center">
  200.                             <a href="javascript:toggleall(document.FormPerm, <?php echo $loop_row['ID'].', '.$i ?>);">
  201.                                 <span id="checkallspan_<?php echo $i ?>" class="checkall"><?php echo T_('(un)check all')?></span>
  202.                             </a>
  203.                         </td>
  204.                     </tr>
  205.                     <?php
  206.                     $i++;
  207.                 }
  208.             ?>
  209.         </table>
  210.         <br />
  211.     </fieldset>
  212.  
  213.     <?php 
  214.         // warning if a user withdraws own permission to edit the blog's properties
  215.         form_submit( ( $current_User->ID != 'onclick="if( document.FormPerm.blog_perm_properties_'.$current_User->ID.'.checked == false) return( confirm(\''/* TRANS: Warning this is a javascript string */ T_('Warning! You are about to remove your own permission to edit this blog!\nYou won\\\'t have access to its properties any longer if you do that!').'\') );"' '' )
  216.     ?>
  217.  
  218. </form>

Documentation generated on Tue, 20 May 2008 01:52:22 +0200 by phpDocumentor 1.4.2