You are here

function _photos_rename in Album Photos 7.3

Same name and namespace in other branches
  1. 6.2 photos.module \_photos_rename()

Rename file with random name.

3 calls to _photos_rename()
photos_swfu_upload in photos_swfu/photos_swfu.module
Upload photos with SWFUpload.
photos_upload_form_submit in inc/photos.edit.inc
Submit upload form.
_photos_unzip in ./photos.module
Unzip.

File

./photos.module, line 2154
Implementation of photos.module.

Code

function _photos_rename($name = 0, $ext = 0) {
  if (variable_get('photos_rname', 0)) {
    if ($name) {
      $name_parts = explode('.', $name);
      return round(rand(15770, 967049700)) . REQUEST_TIME . '.' . ($ext ? $ext : end($name_parts));
    }
    if (!empty($_FILES['files'])) {
      foreach ($_FILES['files']['name'] as $field => $filename) {
        $filename_parts = explode('.', $filename);
        $_FILES['files']['name'][$field] = round(rand(15770, 967049700)) . REQUEST_TIME . '.' . ($ext ? $ext : end($filename_parts));
      }
    }
  }
  elseif ($name) {
    return $name;
  }
}