You are here

function file_validate_number in Node Gallery 6.2

File

./node_gallery.pages.inc, line 669
Node gallery pages.

Code

function file_validate_number($file, $max_number, $temp_count) {
  global $user;
  $errors = array();
  if ($user->uid != 1) {
    $current_number = db_result(db_query("SELECT COUNT(*) FROM {files} WHERE uid = %d and status = %d", $user->uid, FILE_STATUS_PERMANENT));
    if ($temp_count > 0) {
      $current_number += $temp_count;
    }
    if ($current_number > $max_number && $max_number != '0') {
      $errors[] = t("You can only upload a maximum of %num images.", array(
        '%num' => $max_number,
      ));
    }
  }
  return $errors;
}