Changeset 25728


Ignore:
Timestamp:
11/26/13 21:48:08 (6 years ago)
Author:
mistic100
Message:

feature 2999: documentation of functions_user.inc.php (move two functions to functions_category.inc.php)

Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r25658 r25728  
    481481} 
    482482 
     483/** 
     484 * Get computed array of categories, that means cache data of all categories 
     485 * available for the current user (count_categories, count_images, etc.). 
     486 * 
     487 * @param array &$userdata 
     488 * @param int $filter_days number of recent days to filter on or null 
     489 * @return array 
     490 */ 
     491function get_computed_categories(&$userdata, $filter_days=null) 
     492{ 
     493  $query = 'SELECT c.id AS cat_id, id_uppercat'; 
     494  // Count by date_available to avoid count null 
     495  $query .= ', 
     496  MAX(date_available) AS date_last, COUNT(date_available) AS nb_images 
     497FROM '.CATEGORIES_TABLE.' as c 
     498  LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id 
     499  LEFT JOIN '.IMAGES_TABLE.' AS i 
     500    ON ic.image_id = i.id 
     501      AND i.level<='.$userdata['level']; 
     502 
     503  if ( isset($filter_days) ) 
     504  { 
     505    $query .= ' AND i.date_available > '.pwg_db_get_recent_period_expression($filter_days); 
     506  } 
     507 
     508  if ( !empty($userdata['forbidden_categories']) ) 
     509  { 
     510    $query.= ' 
     511  WHERE c.id NOT IN ('.$userdata['forbidden_categories'].')'; 
     512  } 
     513 
     514  $query.= ' 
     515  GROUP BY c.id'; 
     516 
     517  $result = pwg_query($query); 
     518 
     519  $userdata['last_photo_date'] = null; 
     520  $cats = array(); 
     521  while ($row = pwg_db_fetch_assoc($result)) 
     522  { 
     523    $row['user_id'] = $userdata['id']; 
     524    $row['nb_categories'] = 0; 
     525    $row['count_categories'] = 0; 
     526    $row['count_images'] = (int)$row['nb_images']; 
     527    $row['max_date_last'] = $row['date_last']; 
     528    if ($row['date_last'] > $userdata['last_photo_date']) 
     529    { 
     530      $userdata['last_photo_date'] = $row['date_last']; 
     531    } 
     532 
     533    $cats[$row['cat_id']] = $row; 
     534  } 
     535 
     536  foreach ($cats as $cat) 
     537  { 
     538    if ( !isset( $cat['id_uppercat'] ) ) 
     539      continue; 
     540 
     541    $parent = & $cats[ $cat['id_uppercat'] ]; 
     542    $parent['nb_categories']++; 
     543 
     544    do 
     545    { 
     546      $parent['count_images'] += $cat['nb_images']; 
     547      $parent['count_categories']++; 
     548 
     549      if ((empty($parent['max_date_last'])) or ($parent['max_date_last'] < $cat['date_last'])) 
     550      { 
     551        $parent['max_date_last'] = $cat['date_last']; 
     552      } 
     553 
     554      if ( !isset( $parent['id_uppercat'] ) ) 
     555        break; 
     556      $parent = & $cats[$parent['id_uppercat']]; 
     557    } 
     558    while (true); 
     559    unset($parent); 
     560  } 
     561 
     562  if ( isset($filter_days) ) 
     563  { 
     564    foreach ($cats as $category) 
     565    { 
     566      if (empty($category['max_date_last'])) 
     567      { 
     568        remove_computed_category($cats, $category); 
     569      } 
     570    } 
     571  } 
     572  return $cats; 
     573} 
     574 
     575/** 
     576 * Removes a category from computed array of categories and updates counters. 
     577 * 
     578 * @param array &$cats 
     579 * @param array $cat category to remove 
     580 */ 
     581function remove_computed_category(&$cats, $cat) 
     582{ 
     583  if ( isset($cats[$cat['id_uppercat']]) ) 
     584  { 
     585    $parent = &$cats[ $cat['id_uppercat'] ]; 
     586    $parent['nb_categories']--; 
     587 
     588    do 
     589    { 
     590      $parent['count_images'] -= $cat['nb_images']; 
     591      $parent['count_categories'] -= 1+$cat['count_categories']; 
     592 
     593      if ( !isset($cats[$parent['id_uppercat']]) ) 
     594      { 
     595        break; 
     596      } 
     597      $parent = &$cats[$parent['id_uppercat']]; 
     598    } 
     599    while (true); 
     600  } 
     601 
     602  unset($cats[$cat['cat_id']]); 
     603} 
     604 
    483605?> 
  • trunk/include/functions_user.inc.php

    r25633 r25728  
    2222// +-----------------------------------------------------------------------+ 
    2323 
    24 // validate_mail_address: 
    25 //   o verifies whether the given mail address has the 
    26 //     right format. ie someone@domain.com "someone" can contain ".", "-" or 
    27 //     even "_". Exactly as "domain". The extension doesn't have to be 
    28 //     "com". The mail address can also be empty. 
    29 //   o check if address could be empty 
    30 //   o check if address is not used by a other user 
    31 // If the mail address doesn't correspond, an error message is returned. 
    32 // 
     24/** 
     25 * @package functions\user 
     26 */ 
     27 
     28 
     29/** 
     30 * Checks if an email is well formed and not already in use. 
     31 * 
     32 * @param int $user_id 
     33 * @param string $mail_address 
     34 * @return string|void error message or nothing 
     35 */ 
    3336function validate_mail_address($user_id, $mail_address) 
    3437{ 
     
    6366} 
    6467 
    65 // validate_login_case: 
    66 //   o check if login is not used by a other user 
    67 // If the login doesn't correspond, an error message is returned. 
    68 // 
     68/** 
     69 * Checks if a login is not already in use. 
     70 * Comparision is case insensitive. 
     71 * 
     72 * @param string $login 
     73 * @return string|void error message or nothing 
     74 */ 
    6975function validate_login_case($login) 
    7076{ 
     
    8894} 
    8995/** 
    90  * For test on username case sensitivity 
    91  * 
    92  * @param : $username typed in by user for identification 
    93  * 
    94  * @return : $username found in database 
    95  * 
     96 * Searches for user with the same username in different case. 
     97 * 
     98 * @param string $username typically typed in by user for identification 
     99 * @return string $username found in database 
    96100 */ 
    97101function search_case_username($username) 
     
    122126 
    123127/** 
    124  * create a new user 
     128 * Creates a new user. 
     129 * 
    125130 * @param string $login 
    126131 * @param string $password 
    127132 * @param string $mail_adress 
    128133 * @param bool $notify_admin 
    129  * @param &array $errors 
     134 * @param array &$errors populated with error messages 
    130135 * @param bool $notify_user 
    131  * @return int|bool 
     136 * @return int|false user id or false 
    132137 */ 
    133138function register_user($login, $password, $mail_address, $notify_admin=true, &$errors = array(), $notify_user=false) 
     
    286291} 
    287292 
    288 function build_user( $user_id, $use_cache ) 
     293/** 
     294 * Fetches user data from database. 
     295 * Same that getuserdata() but with additional tests for guest. 
     296 * 
     297 * @param int $user_id 
     298 * @param boolean $user_cache 
     299 * @return array 
     300 */ 
     301function build_user($user_id, $use_cache=true) 
    289302{ 
    290303  global $conf; 
     
    309322 
    310323/** 
    311  * find informations related to the user identifier 
    312  * 
    313  * @param int user identifier 
    314  * @param boolean use_cache 
    315  * @param array 
    316  */ 
    317 function getuserdata($user_id, $use_cache) 
     324 * Finds informations related to the user identifier. 
     325 * 
     326 * @param int $user_id 
     327 * @param boolean $use_cache 
     328 * @return array 
     329 */ 
     330function getuserdata($user_id, $use_cache=false) 
    318331{ 
    319332  global $conf; 
     
    504517} 
    505518 
    506 /* 
    507  * deletes favorites of the current user if he's not allowed to see them 
    508  * 
    509  * @return void 
     519/** 
     520 * Deletes favorites of the current user if he's not allowed to see them. 
    510521 */ 
    511522function check_user_favorites() 
     
    527538    ON f.image_id = ic.image_id 
    528539  WHERE f.user_id = '.$user['id'].' 
    529 '.get_sql_condition_FandF 
    530   ( 
    531     array 
    532       ( 
     540  '.get_sql_condition_FandF( 
     541      array( 
    533542        'forbidden_categories' => 'ic.category_id', 
    534       ), 
    535     'AND' 
    536   ).' 
     543        ), 
     544      'AND' 
     545    ).' 
    537546;'; 
    538547  $authorizeds = array_from_query($query, 'image_id'); 
     
    558567 
    559568/** 
    560  * calculates the list of forbidden categories for a given user 
     569 * Calculates the list of forbidden categories for a given user. 
    561570 * 
    562571 * Calculation is based on private categories minus categories authorized to 
    563572 * the groups the user belongs to minus the categories directly authorized 
    564  * to the user. The list contains at least -1 to be compliant with queries 
     573 * to the user. The list contains at least 0 to be compliant with queries 
    565574 * such as "WHERE category_id NOT IN ($forbidden_categories)" 
    566575 * 
    567  * @param int user_id 
    568  * @param string user_status 
    569  * @return string forbidden_categories 
     576 * @param int $user_id 
     577 * @param string $user_status 
     578 * @return string comma separated ids 
    570579 */ 
    571580function calculate_permissions($user_id, $user_status) 
     
    632641} 
    633642 
    634  
    635 /*update counters with a category removal*/ 
    636 function remove_computed_category(&$cats, $cat) 
    637 { 
    638   if ( isset( $cats[$cat['id_uppercat']] ) ) 
    639   { 
    640     $parent = & $cats[ $cat['id_uppercat'] ]; 
    641     $parent['nb_categories']--; 
    642  
    643     do 
    644     { 
    645  
    646       $parent['count_images'] -= $cat['nb_images']; 
    647       $parent['count_categories'] -= 1+$cat['count_categories']; 
    648  
    649       if ( !isset( $cats[$parent['id_uppercat']] ) ) 
    650         break; 
    651       $parent = & $cats[$parent['id_uppercat']]; 
    652     } 
    653     while (true); 
    654   } 
    655  
    656   unset($cats[$cat['cat_id']]); 
    657 } 
    658  
    659 /** 
    660  * get computed array of categories 
    661  * 
    662  * @param array userdata 
    663  * @param int filter_days number of recent days to filter on or null 
    664  * @return array 
    665  */ 
    666 function get_computed_categories(&$userdata, $filter_days=null) 
    667 { 
    668   $query = 'SELECT c.id AS cat_id, id_uppercat'; 
    669   // Count by date_available to avoid count null 
    670   $query .= ', 
    671   MAX(date_available) AS date_last, COUNT(date_available) AS nb_images 
    672 FROM '.CATEGORIES_TABLE.' as c 
    673   LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id 
    674   LEFT JOIN '.IMAGES_TABLE.' AS i 
    675     ON ic.image_id = i.id 
    676       AND i.level<='.$userdata['level']; 
    677  
    678   if ( isset($filter_days) ) 
    679   { 
    680     $query .= ' AND i.date_available > '.pwg_db_get_recent_period_expression($filter_days); 
    681   } 
    682  
    683   if ( !empty($userdata['forbidden_categories']) ) 
    684   { 
    685     $query.= ' 
    686   WHERE c.id NOT IN ('.$userdata['forbidden_categories'].')'; 
    687   } 
    688  
    689   $query.= ' 
    690   GROUP BY c.id'; 
    691  
    692   $result = pwg_query($query); 
    693  
    694   $userdata['last_photo_date'] = null; 
    695   $cats = array(); 
    696   while ($row = pwg_db_fetch_assoc($result)) 
    697   { 
    698     $row['user_id'] = $userdata['id']; 
    699     $row['nb_categories'] = 0; 
    700     $row['count_categories'] = 0; 
    701     $row['count_images'] = (int)$row['nb_images']; 
    702     $row['max_date_last'] = $row['date_last']; 
    703     if ($row['date_last'] > $userdata['last_photo_date']) 
    704     { 
    705       $userdata['last_photo_date'] = $row['date_last']; 
    706     } 
    707  
    708     $cats[$row['cat_id']] = $row; 
    709   } 
    710  
    711   foreach ($cats as $cat) 
    712   { 
    713     if ( !isset( $cat['id_uppercat'] ) ) 
    714       continue; 
    715  
    716     $parent = & $cats[ $cat['id_uppercat'] ]; 
    717     $parent['nb_categories']++; 
    718  
    719     do 
    720     { 
    721       $parent['count_images'] += $cat['nb_images']; 
    722       $parent['count_categories']++; 
    723  
    724       if ((empty($parent['max_date_last'])) or ($parent['max_date_last'] < $cat['date_last'])) 
    725       { 
    726         $parent['max_date_last'] = $cat['date_last']; 
    727       } 
    728  
    729       if ( !isset( $parent['id_uppercat'] ) ) 
    730         break; 
    731       $parent = & $cats[$parent['id_uppercat']]; 
    732     } 
    733     while (true); 
    734     unset($parent); 
    735   } 
    736  
    737   if ( isset($filter_days) ) 
    738   { 
    739     foreach ($cats as $category) 
    740     { 
    741       if (empty($category['max_date_last'])) 
    742       { 
    743         remove_computed_category($cats, $category); 
    744       } 
    745     } 
    746   } 
    747   return $cats; 
    748 } 
    749  
    750 /** 
    751  * returns user identifier thanks to his name, false if not found 
    752  * 
    753  * @param string username 
    754  * @param int user identifier 
     643/** 
     644 * Returns user identifier thanks to his name. 
     645 * 
     646 * @param string $username 
     647 * @param int|false 
    755648 */ 
    756649function get_userid($username) 
     
    778671} 
    779672 
     673/** 
     674 * Returns user identifier thanks to his email. 
     675 * 
     676 * @param string $email 
     677 * @param int|false 
     678 */ 
    780679function get_userid_by_email($email) 
    781680{ 
     
    803702} 
    804703 
    805 /* 
    806  * Returns a array with default user value 
    807  * 
    808  * @param convert_str allows to convert string value if necessary 
    809  */ 
    810 function get_default_user_info($convert_str = true) 
     704/** 
     705 * Returns a array with default user valuees. 
     706 * 
     707 * @param convert_str ceonferts 'true' and 'false' into booleans 
     708 * @return array 
     709 */ 
     710function get_default_user_info($convert_str=true) 
    811711{ 
    812712  global $cache, $conf; 
     
    859759} 
    860760 
    861 /* 
    862  * Returns a default user value 
    863  * 
    864  * @param value_name: name of value 
    865  * @param sos_value: value used if don't exist value 
    866  */ 
    867 function get_default_user_value($value_name, $sos_value) 
     761/** 
     762 * Returns a default user value. 
     763 * 
     764 * @param string $value_name 
     765 * @param mixed $default 
     766 * @return mixed 
     767 */ 
     768function get_default_user_value($value_name, $default) 
    868769{ 
    869770  $default_user = get_default_user_info(true); 
    870771  if ($default_user === false or empty($default_user[$value_name])) 
    871772  { 
    872     return $sos_value; 
     773    return $default; 
    873774  } 
    874775  else 
     
    878779} 
    879780 
    880 /* 
    881  * Returns the default template value 
    882  * 
     781/** 
     782 * Returns the default theme. 
     783 * If the default theme is not available it returns the first available one. 
     784 * 
     785 * @return string 
    883786 */ 
    884787function get_default_theme() 
     
    891794 
    892795  // let's find the first available theme 
    893   $active_themes = get_pwg_themes(); 
    894   foreach (array_keys(get_pwg_themes()) as $theme_id) 
    895   { 
    896     return $theme_id; 
    897   } 
    898 } 
    899  
    900 /* 
    901  * Returns the default language value 
    902  * 
     796  $active_themes = array_keys(get_pwg_themes()); 
     797  return $active_themes[0]; 
     798} 
     799 
     800/** 
     801 * Returns the default language. 
     802 * 
     803 * @return string 
    903804 */ 
    904805function get_default_language() 
     
    908809 
    909810/** 
    910   * Returns true if the browser language value is set into param $lang 
    911   * 
    912   */ 
     811 * Tries to find the browser language among available languages. 
     812 * @todo : try to match 'fr_CA' before 'fr' 
     813 * 
     814 * @param string &$lang 
     815 * @return bool 
     816 */ 
    913817function get_browser_language(&$lang) 
    914818{ 
     
    926830 
    927831/** 
    928  * add user informations based on default values 
    929  * 
    930  * @param int user_id / array of user_if 
    931  * @param array of values used to override default user values 
    932  */ 
    933 function create_user_infos($arg_id, $override_values = null) 
     832 * Creates user informations based on default values. 
     833 * 
     834 * @param int|int[] $user_ids 
     835 * @param array $override_values values used to override default user values 
     836 */ 
     837function create_user_infos($user_ids, $override_values=null) 
    934838{ 
    935839  global $conf; 
    936840 
    937   if (is_array($arg_id)) 
    938   { 
    939     $user_ids = $arg_id; 
    940   } 
    941   else 
    942   { 
    943     $user_ids = array(); 
    944     if (is_numeric($arg_id)) 
    945     { 
    946       $user_ids[] = $arg_id; 
    947     } 
     841  if (!is_array($user_ids)) 
     842  { 
     843    $user_ids = array($user_ids); 
    948844  } 
    949845 
     
    1000896 
    1001897/** 
    1002  * returns the auto login key or false on error 
    1003  * @param int user_id 
    1004  * @param time_t time 
    1005  * @param string [out] username 
    1006 */ 
     898 * Returns the auto login key for an user or false if the user is not found. 
     899 * 
     900 * @param int $user_id 
     901 * @param int $time 
     902 * @param string &$username fille with corresponding username 
     903 * @return string|false 
     904 */ 
    1007905function calculate_auto_login_key($user_id, $time, &$username) 
    1008906{ 
     
    1025923} 
    1026924 
    1027 /* 
    1028  * Performs all required actions for user login 
    1029  * @param int user_id 
    1030  * @param bool remember_me 
    1031  * @return void 
    1032 */ 
     925/** 
     926 * Performs all required actions for user login. 
     927 * 
     928 * @param int $user_id 
     929 * @param bool $remember_me 
     930 */ 
    1033931function log_user($user_id, $remember_me) 
    1034932{ 
     
    1080978} 
    1081979 
    1082 /* 
    1083  * Performs auto-connexion when cookie remember_me exists 
    1084  * @return true/false 
    1085 */ 
    1086 function auto_login() { 
     980/** 
     981 * Performs auto-connection when cookie remember_me exists. 
     982 * 
     983 * @return bool 
     984 */ 
     985function auto_login() 
     986{ 
    1087987  global $conf; 
    1088988 
     
    11101010 
    11111011/** 
    1112  * hashes a password, with the PasswordHash class from phpass security 
    1113  * library. We use an "pwg_" prefix because function password_hash is 
    1114  * planned for PHP 5.5. Code inspired from Wordpress. 
    1115  * 
    1116  * @param string $password Plain text user password to hash 
    1117  * @return string The hash string of the password 
     1012 * Hashes a password with the PasswordHash class from phpass security library. 
     1013 * @since 2.5 
     1014 * 
     1015 * @param string $password plain text 
     1016 * @return string 
    11181017 */ 
    11191018function pwg_password_hash($password) 
     
    11351034 
    11361035/** 
    1137  * Verifies a password, with the PasswordHash class from phpass security 
    1138  * library. We use an "pwg_" prefix because function password_verify is 
    1139  * planned for PHP 5.5. Code inspired from Wordpress. 
    1140  * 
    1141  * @param string $password Plain text user password to hash 
     1036 * Verifies a password, with the PasswordHash class from phpass security library. 
     1037 * If the hash is 'old' (assumed MD5) the hash is updated in database, used for 
     1038 * migration from Piwigo 2.4. 
     1039 * @since 2.5 
     1040 * 
     1041 * @param string $password plain text 
    11421042 * @param string $hash may be md5 or phpass hashed password 
    1143  * @param integer $account_id only useful to update password hash from md5 to phpass 
    1144  * @return string The hash string of the password 
     1043 * @param integer $user_id only useful to update password hash from md5 to phpass 
     1044 * @return bool 
    11451045 */ 
    11461046function pwg_password_verify($password, $hash, $user_id=null) 
     
    11921092 
    11931093/** 
    1194  * Tries to login a user given username and password (must be MySql escaped) 
    1195  * return true on success 
     1094 * Tries to login a user given username and password (must be MySql escaped). 
     1095 * 
     1096 * @param string $username 
     1097 * @param string $password 
     1098 * @param bool $remember_me 
     1099 * @return bool 
    11961100 */ 
    11971101function try_log_user($username, $password, $remember_me) 
     
    12021106add_event_handler('try_log_user', 'pwg_login', EVENT_HANDLER_PRIORITY_NEUTRAL, 4); 
    12031107 
     1108/** 
     1109 * Default method for user login, can be overwritten with 'try_log_user' trigger. 
     1110 * @see try_log_user() 
     1111 * 
     1112 * @param string $username 
     1113 * @param string $password 
     1114 * @param bool $remember_me 
     1115 * @return bool 
     1116 */ 
    12041117function pwg_login($success, $username, $password, $remember_me) 
    12051118{ 
     
    12311144} 
    12321145 
    1233 /** Performs all the cleanup on user logout */ 
     1146/** 
     1147 * Performs all the cleanup on user logout. 
     1148 */ 
    12341149function logout_user() 
    12351150{ 
     
    12481163} 
    12491164 
    1250 /* 
    1251  * Return user status used in this library 
     1165/** 
     1166 * Return user status. 
     1167 * 
     1168 * @param string $user_status used if $user not initialized 
    12521169 * @return string 
    1253 */ 
    1254 function get_user_status($user_status) 
     1170 */ 
     1171function get_user_status($user_status='') 
    12551172{ 
    12561173  global $user; 
     
    12711188} 
    12721189 
    1273 /* 
    1274  * Return access_type definition of user 
    1275  * Test does with user status 
    1276  * @return bool 
    1277 */ 
     1190/** 
     1191 * Return ACCESS_* value for a given $status. 
     1192 * 
     1193 * @param string $user_status used if $user not initialized 
     1194 * @return int one of ACCESS_* constants 
     1195 */ 
    12781196function get_access_type_status($user_status='') 
    12791197{ 
     
    13181236} 
    13191237 
    1320 /* 
    1321  * Return if user have access to access_type definition 
    1322  * Test does with user status 
     1238/** 
     1239 * Returns if user has access to a particular ACCESS_* 
     1240 * 
     1241 * @return int $access_type one of ACCESS_* constants 
     1242 * @param string $user_status used if $user not initialized 
    13231243 * @return bool 
    1324 */ 
    1325 function is_autorize_status($access_type, $user_status = '') 
     1244 */ 
     1245function is_autorize_status($access_type, $user_status='') 
    13261246{ 
    13271247  return (get_access_type_status($user_status) >= $access_type); 
    13281248} 
    13291249 
    1330 /* 
    1331  * Check if user have access to access_type definition 
    1332  * Stop action if there are not access 
    1333  * Test does with user status 
    1334  * @return none 
    1335 */ 
    1336 function check_status($access_type, $user_status = '') 
     1250/** 
     1251 * Abord script if user has no access to a particular ACCESS_* 
     1252 * 
     1253 * @return int $access_type one of ACCESS_* constants 
     1254 * @param string $user_status used if $user not initialized 
     1255 */ 
     1256function check_status($access_type, $user_status='') 
    13371257{ 
    13381258  if (!is_autorize_status($access_type, $user_status)) 
     
    13421262} 
    13431263 
    1344 /* 
    1345  * Return if user is generic 
     1264/** 
     1265 * Returns if user is generic. 
     1266 * 
     1267 * @param string $user_status used if $user not initialized 
    13461268 * @return bool 
    1347 */ 
    1348  function is_generic($user_status = '') 
     1269 */ 
     1270function is_generic($user_status='') 
    13491271{ 
    13501272  return get_user_status($user_status) == 'generic'; 
    13511273} 
    13521274 
    1353 /* 
    1354  * Return if user is only a guest 
     1275/** 
     1276 * Returns if user is a guest. 
     1277 * 
     1278 * @param string $user_status used if $user not initialized 
    13551279 * @return bool 
    1356 */ 
    1357  function is_a_guest($user_status = '') 
     1280 */ 
     1281function is_a_guest($user_status='') 
    13581282{ 
    13591283  return get_user_status($user_status) == 'guest'; 
    13601284} 
    13611285 
    1362 /* 
    1363  * Return if user is, at least, a classic user 
     1286/** 
     1287 * Returns if user is, at least, a classic user. 
     1288 * 
     1289 * @param string $user_status used if $user not initialized 
    13641290 * @return bool 
    1365 */ 
    1366  function is_classic_user($user_status = '') 
     1291 */ 
     1292function is_classic_user($user_status='') 
    13671293{ 
    13681294  return is_autorize_status(ACCESS_CLASSIC, $user_status); 
    13691295} 
    13701296 
    1371 /* 
    1372  * Return if user is, at least, an administrator 
     1297/** 
     1298 * Returns if user is, at least, an administrator. 
     1299 * 
     1300 * @param string $user_status used if $user not initialized 
    13731301 * @return bool 
    1374 */ 
    1375  function is_admin($user_status = '') 
     1302 */ 
     1303function is_admin($user_status='') 
    13761304{ 
    13771305  return is_autorize_status(ACCESS_ADMINISTRATOR, $user_status); 
    13781306} 
    13791307 
    1380 /* 
    1381  * Return if user is, at least, a webmaster 
     1308/** 
     1309 * Returns if user is a webmaster. 
     1310 * 
     1311 * @param string $user_status used if $user not initialized 
    13821312 * @return bool 
    1383 */ 
    1384  function is_webmaster($user_status = '') 
     1313 */ 
     1314function is_webmaster($user_status='') 
    13851315{ 
    13861316  return is_autorize_status(ACCESS_WEBMASTER, $user_status); 
    13871317} 
    13881318 
    1389 /* 
     1319/** 
    13901320 * Adviser status is depreciated from piwigo 2.2 
    13911321 * @return false 
    1392 */ 
     1322 */ 
    13931323function is_adviser() 
    13941324{ 
     
    13991329} 
    14001330 
    1401 /* 
    1402  * Return if current user can edit/delete/validate a comment 
    1403  * @param action edit/delete/validate 
     1331/** 
     1332 * Returns if current user can edit/delete/validate a comment. 
     1333 * 
     1334 * @param string $action edit/delete/validate 
     1335 * @param int $comment_author_id 
    14041336 * @return bool 
    14051337 */ 
     
    14401372} 
    14411373 
    1442 /* 
     1374/** 
    14431375 * Return mail address as display text 
    14441376 * @return string 
    1445 */ 
     1377 */ 
    14461378function get_email_address_as_display_text($email_address) 
    14471379{ 
     
    14581390} 
    14591391 
    1460 /* 
    1461  * Compute sql where condition with restrict and filter data. "FandF" means 
    1462  * Forbidden and Filters. 
    1463  * 
    1464  * @param array condition_fields: read function body 
    1465  * @param string prefix_condition: prefixes sql if condition is not empty 
    1466  * @param boolean force_one_condition: use at least "1 = 1" 
    1467  * 
    1468  * @return string sql where/conditions 
     1392/** 
     1393 * Compute sql WHERE condition with restrict and filter data. 
     1394 * "FandF" means Forbidden and Filters. 
     1395 * 
     1396 * @param array $condition_fields one witch fields apply each filter 
     1397 *    - forbidden_categories 
     1398 *    - visible_categories 
     1399 *    - forbidden_images 
     1400 *    - visible_images 
     1401 * @param string $prefix_condition prefixes query if condition is not empty 
     1402 * @param boolean $force_one_condition use at least "1 = 1" 
     1403 * @return string 
    14691404 */ 
    14701405function get_sql_condition_FandF( 
     
    15581493} 
    15591494 
    1560 /** @return the sql condition to show recent photos/albums based on user preferences and latest available photo.*/ 
     1495/**  
     1496 * Returns sql WHERE condition for recent photos/albums for current user. 
     1497 * 
     1498 * @param string $db_field 
     1499 * @return string 
     1500 */ 
    15611501function get_recent_photos_sql($db_field) 
    15621502{ 
     
    15721512 
    15731513/** 
    1574  * search an available activation_key 
     1514 * Returns a unique activation key. 
    15751515 * 
    15761516 * @return string 
Note: See TracChangeset for help on using the changeset viewer.