Changeset 1851 for trunk


Ignore:
Timestamp:
Feb 22, 2007, 9:20:30 PM (17 years ago)
Author:
rub
Message:

o Proposition: improved display of 'x images in y sub-categories' or 'x images in this category' for cases when categories contain both images and sub-categories
o Good idea of this new way for way confguest_access, but I kept last implementation for access methods (Could be useful on future development)

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/identification.php

    r1744 r1851  
    2929define('PHPWG_ROOT_PATH','./');
    3030include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
     31
     32// +-----------------------------------------------------------------------+
     33// | Check Access and exit when user status is not ok                      |
     34// +-----------------------------------------------------------------------+
     35check_status(ACCESS_NONE);
    3136
    3237//-------------------------------------------------------------- identification
  • trunk/include/category_cats.inc.php

    r1840 r1851  
    215215                                    $category['nb_images'],
    216216                                    $category['count_images'],
    217                                     $category['count_categories']
     217                                    $category['count_categories'],
     218                                    true,
     219                                    '<BR>'
    218220                                  ),
    219221          'DESCRIPTION' => @$comment,
     
    250252                                    $category['nb_images'],
    251253                                    $category['count_images'],
    252                                     $category['count_categories']
     254                                    $category['count_categories'],
     255                                    true,
     256                                    '<BR>'
    253257                                  ),
    254258
  • trunk/include/functions_category.inc.php

    r1840 r1851  
    387387 * @return string
    388388 */
    389 function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_categories, $short_message = true)
     389function get_display_images_count($cat_nb_images, $cat_count_images, $cat_count_categories, $short_message = true, $Separator = '\n')
    390390{
    391391  $display_text = '';
    392392
    393   if ($cat_count_images>0)
    394   {//at least one image direct or indirect
     393  if ($cat_count_images > 0)
     394  {
     395    if ($cat_nb_images > 0 and $cat_nb_images < $cat_count_images)
     396    {
     397      $display_text.= get_display_images_count($cat_nb_images, $cat_nb_images, 0, $short_message, $Separator).$Separator;
     398      $cat_count_images-= $cat_nb_images;
     399      $cat_nb_images = 0;
     400    }
     401   
     402    //at least one image direct or indirect
    395403    $display_text.= l10n_dec('image_available', 'images_available', $cat_count_images);
    396404
    397     if ($cat_count_categories==0 or $cat_nb_images>=$cat_count_images)
    398     {//no descendant categories or descendants do not contain images
     405    if ($cat_count_categories == 0 or $cat_nb_images == $cat_count_images)
     406    {
     407      //no descendant categories or descendants do not contain images
    399408      if (! $short_message)
    400409      {
  • trunk/include/functions_html.inc.php

    r1840 r1851  
    471471                    $category['count_images'],
    472472                    $category['count_categories'],
    473                     false
     473                    false,
     474                    ' / '
    474475                  ).'">';
    475476      // show total number of images
  • trunk/include/functions_user.inc.php

    r1850 r1851  
    436436
    437437  // if user is not an admin, locked categories are forbidden
    438   if ( $user_status!='administrator' and $user_status!='webmaster' )
     438  if (!is_admin($user_status))
    439439  {
    440440    $query = '
     
    982982function get_access_type_status($user_status='')
    983983{
    984   global $user;
     984  global $user, $conf;
    985985
    986986  if ($user_status == '' and isset($user['status']) )
     
    993993  {
    994994    case 'guest':
     995    {
     996      if
     997        (
     998          !isset($user) or
     999          ($user['id']==$conf['guest_id'] and !$conf['guest_access'])
     1000        )
     1001      {
     1002        $access_type_status = ACCESS_NONE;
     1003      }
     1004      else
     1005      {
     1006        $access_type_status = ACCESS_GUEST;
     1007      }
     1008      break;
     1009    }
    9951010    case 'generic':
    9961011    {
     
    10231038 * @return bool
    10241039*/
    1025 function is_autorize_status($access_type)
    1026 {
    1027   global $user, $conf;
    1028   if (
    1029       !isset($user) or
    1030       ($user['id']==$conf['guest_id'] and $conf['guest_access']==false)
    1031     )
    1032   {
    1033     return ACCESS_NONE>=$access_type;
    1034   }
    1035 
    1036   return (get_access_type_status() >= $access_type);
     1040function is_autorize_status($access_type, $user_status = '')
     1041{
     1042  return (get_access_type_status($user_status) >= $access_type);
    10371043}
    10381044
     
    10431049 * @return none
    10441050*/
    1045 function check_status( $access_type )
    1046 {
    1047   if (!is_autorize_status($access_type) )
     1051function check_status($access_type, $user_status = '')
     1052{
     1053  if (!is_autorize_status($access_type, $user_status))
    10481054  {
    10491055    access_denied();
     
    10551061 * @return bool
    10561062*/
    1057 function is_admin()
    1058 {
    1059   return is_autorize_status(ACCESS_ADMINISTRATOR);
     1063 function is_admin($user_status = '')
     1064{
     1065  return is_autorize_status(ACCESS_ADMINISTRATOR, $user_status);
    10601066}
    10611067
  • trunk/nbm.php

    r1806 r1851  
    2828
    2929
     30//--------------------------------------------------------------------- include
    3031define('PHPWG_ROOT_PATH','./');
    3132include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     33check_status(ACCESS_NONE);
    3234include_once(PHPWG_ROOT_PATH.'include/functions_notification.inc.php');
    3335include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
  • trunk/password.php

    r1809 r1851  
    3333include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
    3434include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
     35
     36// +-----------------------------------------------------------------------+
     37// | Check Access and exit when user status is not ok                      |
     38// +-----------------------------------------------------------------------+
     39check_status(ACCESS_NONE);
    3540
    3641// +-----------------------------------------------------------------------+
  • trunk/register.php

    r1818 r1851  
    2929define('PHPWG_ROOT_PATH','./');
    3030include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
     31
     32// +-----------------------------------------------------------------------+
     33// | Check Access and exit when user status is not ok                      |
     34// +-----------------------------------------------------------------------+
     35check_status(ACCESS_NONE);
     36
    3137//----------------------------------------------------------- user registration
    3238
  • trunk/search_rules.php

    r1537 r1851  
    4444define('PHPWG_ROOT_PATH','./');
    4545include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
     46check_status(ACCESS_NONE);
    4647include_once( PHPWG_ROOT_PATH.'include/functions_search.inc.php' );
    4748
  • trunk/ws.php

    r1849 r1851  
    2727
    2828include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
     29check_status(ACCESS_NONE);
    2930include_once(PHPWG_ROOT_PATH.'include/ws_core.inc.php');
    3031
Note: See TracChangeset for help on using the changeset viewer.