!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/wincloud_gateway/node_modules/@buffetjs/core/src/components/Error/   drwxr-xr-x
Free 13.06 GB of 57.97 GB (22.54%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     index.js (2.26 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/**
 *
 * Error
 *
 */

import React, { useEffect, useReducer, useRef } from 'react';
import PropTypes from 'prop-types';
import { isEmpty } from 'lodash';

import { createYupSchema } from '@buffetjs/utils';
import reducer from './reducer';

function Error({
  children,
  inputError,
  translatedErrors,
  type,
  validations,
  value,
}) {
  const [state, dispatch] = useReducer(reducer, {
    error: false,
    canCheck: !isEmpty(value),
  });

  const ref = useRef();

  useEffect(() => {
    dispatch({
      type: 'SET_ERROR',
      error: inputError,
    });
  }, [inputError]);

  const { error, canCheck } = state;

  const resetError = () => {
    if (!ref.current) {
      return;
    }

    dispatch({
      type: 'SET_ERROR',
      error: null,
    });
  };

  const setError = (message) => {
    if (!ref.current) {
      return;
    }

    dispatch({
      type: 'SET_ERROR',
      error: message,
    });
  };

  const handleBlur = async ({ target }) => {
    if (canCheck) {
      try {
        await createYupSchema(type, validations, translatedErrors).validate(
          target.value,
        );
        resetError();
      } catch (err) {
        const { message } = err;
        setError(message);
      }
    }
  };

  if (children) {
    return (
      <>
        {children({
          canCheck,
          dispatch,
          error,
          onBlur: handleBlur,
        })}
        <span style={{ display: 'none' }} ref={ref} />
      </>
    );
  }
}

Error.defaultProps = {
  children: () => {},
  translatedErrors: {
    date: 'This is not a date',
    email: 'This is not an email',
    string: 'This is not a string',
    number: 'This is not a number',
    json: 'This is not a JSON',
    max: 'This is too high',
    maxLength: 'This is too long',
    min: 'This is too small',
    minLength: 'This is too short',
    required: 'This value is required',
    regex: 'This does not match the format',
    uppercase: 'This must be a upper case string',
  },
  type: null,
  validations: {},
  value: null,
};

Error.propTypes = {
  children: PropTypes.func,
  translatedErrors: PropTypes.objectOf(PropTypes.string),
  type: PropTypes.string,
  validations: PropTypes.objectOf(PropTypes.any),
  value: PropTypes.any, // eslint-disable-line react/forbid-prop-types
};

export default Error;

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.1079 ]--