Detect filenames in upload parameters

@param mixed $input The data or file name to parse

@return null|string
7994
protected function _buildBinaryBody($input)
  {
    if (// is it a file, a readable one?
      @file_exists($input)
      && @is_readable($input)
    ) {
      // try to read the file
      $data = @file_get_contents($input);
      if ($data !== false && strlen($data) !== 0) {
        return $data;
      }
    } elseif (// is it a remote file?
      filter_var($input, FILTER_VALIDATE_URL)
      && preg_match('/^https?:\/\//', $input)
    ) {
      $data = $this->_fetchRemoteFile($input);
      if ($data !== false) {
        return $data;
      }
    }
    return $input;
  }
113672
public static function file($input)
    {
        if (Symphony::Log()) {
            Symphony::Log()->pushDeprecateWarningToLog('MD5::file()', 'PBKDF2::hash()', array(
                'message-format' => __('The use of `%s` is strongly discouraged due to severe security flaws.'),
            ));
        }
        return md5_file($input);
    }
735766
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }
        $filename = preg_replace('/ /', '\\ ', $filename);
        $bin = $this->_settings['sass'] . ' ' . $filename;
        $return = $this->_runCmd($bin, '', array('PATH' => $this->_settings['path']));
        return $return;
    }
106695
private function findMatchingToken($input)
    {
        // Check with all tokenDefinitions
        foreach ($this->tokenDefinitions as $tokenDefinition) {
            $token = $tokenDefinition->match($input);

            // Return the first token that was matched.
            if ($token) {
                return $token;
            }
        }

        // Return null if no tokens were matched.

        return null;
    }
1191238
public function apiStore($input)
    {
        $savedFile = app(FileService::class)->saveClone($input['location'], 'public/images');

        if (!$savedFile) {
            return false;
        }

        $input['is_published'] = 1;
        $input['location'] = $savedFile['name'];
        $input['storage_location'] = config('cms.storage-location');
        $input['original_name'] = $savedFile['original'];

        $image = $this->model->create($input);
        $image->setCaches();

        return $image;
    }
518559
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }

        $tmpFile = tempnam(TMP, 'TYPESCRIPT');
        $cmd = $this->_settings['typescript'] . " " . escapeshellarg($filename) . " --out " . $tmpFile;
        $this->_runCmd($cmd, null);
        $output = file_get_contents($tmpFile);
        unlink($tmpFile);
        return $output;
    }
118260
public function withInput(array $input = null)
    {
        $input = $input ?: $this->request->input();

        $this->session->flashInput(array_filter($input, function ($value)
        {
            return ! $value instanceof SymfonyUploadedFile;
        }));

        return $this;
    }
1125187
public function preparePeoplesDataForInsert($input) {

        $data = [];

        $data['user_id']       = null;  // Set users up as PEOPLES in the admin
        $data['title']         = $input['first_name']." ".$input['surname'];
        $data['salutation']    = "";
        $data['first_name']    = $input['first_name'];
        $data['middle_name']   = "";
        $data['surname']       = $input['surname'];
        $data['position']      = "";
        $data['description']   = "";
        $data['comments']      = "Created by front-end subscription to an email list";

        $data['birthday']      = null;
        $data['anniversary']   = null;

        $data['created_at']    = Carbon::now();
        $data['created_by']    = $this->userRepository->getFirstAmongEqualsUserID();
        $data['updated_at']    = Carbon::now();
        $data['updated_by']    = $this->userRepository->getFirstAmongEqualsUserID();

        $data['profile']       = null;
        $data['featured_image'] = null;

        return $data;
    }
914396
protected function determineInputFiles()
    {
        if (empty($this->route->getParameters()->files))
        {
            $this->setNotReady("No input files found.", null, 404);
            return;
        }

        if (is_array($this->route->getParameters()->files))
        {
            foreach ($this->route->getParameters()->files as $file)
            {
                $this->addFileObject((string) $file);
            }
        }
        else
        {
            $this->addFileObject((string) $this->route->getParameters()->files);
        }
    }
1065363
private function parseFields($input)
    {
        if (is_array($input)) {
            return $input;
        }

        $fields = [];
        foreach (explode(' ', $input) as $value) {
            $elements = explode(':', $value);
            $name = $elements[0];
            if (strlen($name)) {
                $type = isset($elements[1]) ? $elements[1] : 'string';
                preg_match_all('/(.*)\((.*)\)/', $type, $matches);
                $type = isset($matches[1][0]) ? $matches[1][0] : $type;
                $length = isset($matches[2][0]) ? $matches[2][0] : null;

                $fields[$name] = ['fieldName' => $name, 'type' => $type, 'length' => $length];
            }
        }

        return $fields;
    }
233136
public function decode($input)
    {
        $parts = explode('.', $input);

        foreach ($parts as &$part) {
            if (strpos($part, static::PREFIX) === 0) {
                $part = $this->_decodePart(
                    substr($part, strlen(static::PREFIX))
                );
            }
        }

        return implode('.', $parts);
    }
611022
public function getLibraryFiles($input)
    {
        // assume the result is the same string as the input
        $result = array($input);

        // just change if method for changing/translation exists
        if (method_exists($this, 'getRequiredLibraryFiles')) {
            $result = $this->getRequiredLibraryFiles($input);
        }

        // and finally return the resulting string
        return $result;
    }
1105127
public function withInput(array $input = null)
	{
		$input = $input ?: $this->request->input();

		$this->session->flashInput($data = array_filter($input, $callback = function (&$value) use (&$callback)
		{
			if (is_array($value))
			{
				$value = array_filter($value, $callback);
			}

			return ! $value instanceof UploadedFile;
		}));

		return $this;
	}
779383
private function captureUserAndPassword(Input $input)
    {
        $text = trim(preg_replace('|\W+|', ' ', $input->text));

        return explode(' ', $text);
    }
1294459
public function store($input)
    {
        $savedFile = $input['location'];

        if (!$savedFile) {
            Cms::notification('Image could not be saved.', 'danger');

            return false;
        }

        if (!isset($input['is_published'])) {
            $input['is_published'] = 0;
        } else {
            $input['is_published'] = 1;
        }

        $input['location'] = CryptoService::decrypt($savedFile['name']);
        $input['storage_location'] = config('cms.storage-location');
        $input['original_name'] = $savedFile['original'];

        $image = $this->model->create($input);
        $image->setCaches();

        return $image;
    }
906141
private function getUserData(array $input, string $name)
    {
        if (stripos($name, '[') !== false) {
            $names = explode('[', str_replace(']', '', $name));

            $ref = &$input;
            $leave = false;

            while ($leave == false) {
                $key = array_shift($names);

                if ($key === '') {
                    $leave = true;
                } elseif (is_null($key)) {
                    $leave = true;
                } else {
                    $ref = &$ref[$key];
                }
            }

            if (is_array($ref) && array_key_exists(0, $ref) && (is_null($ref[0]) || $ref[0] === '')) {
                $ref = [];
            }

            return $ref;
        } else {
            return $input[$name] ?? null;
        }
    }
1169420
private function parseFilename($filename) {
    if (defined('DRUPAL_ROOT') && stripos($filename, DRUPAL_ROOT) === 0) {
      return substr($filename, strpos($filename, DRUPAL_ROOT) + strlen(DRUPAL_ROOT) + 1);
    }
    else {
      return $filename;
    }
  }