MivaScript Functions

Name -- Syntax / Description
abs
abs( number )
Returns the absolute value of number.
Returns the absolute value of number.
acos
acos( number )
Returns the arccosine of number. The results are returned in radians.
Returns the results in radians.
asciichar
asciichar( number )
Returns the character corresponding to ascii character code in number. (number must 0 to 255).
Returns the ascii character code
asciivalue
asciivalue( character )
Returns the ASCII numeric value for character (character must be a single character).
asin
asin( number )
Returns the arcsine of number. The results are returned in radians.
Returns the reaults in radians.
atan
atan( number )
Returns the arctangent of number. The results are returned in radians.
Returns the results in radians.
atan2
atan2( x, y )
Returns the arctangent of y/x. This is similar to atan(), but the signs of y and x are taken into account when computing the quadrant of the result. The results are returned in radians.
Returns the results in radians.
bf_decrypt
bf_decrypt( key, encrypted, plaintext var )
Blowfish decryption
Returns 1 on success, 0 on error
  • key = the encryption key in ECB mode. the key must be 16 characters.
  • plaintext = the text thats encrypted
  • encrypted = if sucessful it will contain the results
bf_encrypt
bf_encrypt( key, plaintext, encrypted var )
Blowfish encryption
Returns 1 on success, 0 on error
  • key = the encryption key in ECB mode. The key must be 16 characters.
  • plaintext = the text thats encrypted
  • encrypted = if sucessful it will contain the results
ceil
ceil( number )
Returns the smallest integer greater than or equal to number
Returns the results as an integer.
cos
cos( number )
Returns the cosine of number. The argument should be expressed in radians.
Returns the results in radians.
cosh
cosh( number )
Returns the hyperbolic cosine of number. The argument should be expressed in radians.
Returns the hyperbolic cosine.
crypto_base64_decode
crypto_base64_decode( data )
Decodes and returns Base-64 decodes data.
Returns the decrypted data
  • data = the information to decode
crypto_base64_encode
crypto_base64_encode( data )
Encodes and returns Base-64 encoded data.
Returns the encrypted data
  • data = the information to encode
crypto_cipher_block_size
crypto_cipher_block_size( ciphername )
Programatically determine the block size attribute of the cipher specified by "ciphername".
returns the numeric size, in bytes, or -1 if an invalid "ciphername" is specified.
  • ciphername = an OpenSSL cipher identifier, such as "aes-128-cbc" or "rc2-ofb".
crypto_cipher_iv_length
crypto_cipher_iv_length( ciphername )
Programatically determine the iv_length attribute of the cipher specified by "ciphername".
returns the numeric size, in bytes, or -1 if an invalid "ciphername" is specified.
  • ciphername = an OpenSSL cipher identifier, such as "aes-128-cbc" or "rc2-ofb".
crypto_cipher_key_length
crypto_cipher_key_length( ciphername )
Programatically determine the key_length attribute of the cipher specified by "ciphername".
returns the numeric size, in bytes, or -1 if an invalid "ciphername" is specified.
  • ciphername = an OpenSSL cipher identifier, such as "aes-128-cbc" or "rc2-ofb".
crypto_cipher_mode
crypto_cipher_mode( ciphername )
Returns the block mode of operation of the cipher specified by "ciphername."
  • where ciphername = an OpenSSL cipher identifier, such as "aes-128-cbc" or "rc2-ofb"
crypto_digest_block_size
crypto_digest_block_size( digestname )
Programatically determines the block_size attribute of the digest algorithm specified by "digestname".
Returns the numeric size, in bytes, or -1 if an invalid "digestname" is specified.
  • digestname = an OpenSSL digest identifier, such as "sha256" or "md5".
crypto_digest_size
crypto_digest_size( digestname )
Programatically determines the digest_size attribute of the digest algorithm specified by "digestname".
Returns the numeric size, in bytes, or -1 if an invalid "digestname" is specified.
  • digestname = an OpenSSL digest identifier, such as "sha256" or "md5".
crypto_evp_decrypt
crypto_evp_decrypt( ciphername, key, iv, encrypted, plaintext var )
Decrypts "plaintext" using the block cipher specified by "ciphername", placing the decrypted data into "plaintext".
Return 1 on success, 0 on failure.
  • ciphername = The OpenSSL identifier of the cipher, such as "bf-cbc" or "des-ede3-cbc".
  • key = The key used for encryption.
  • iv = The initialization vector used for encryption. returned by crypto_cipher_iv_length().
  • encrypted = The ciphertext to be decrypted
  • plaintext = [output] Receives the plaintext
crypto_evp_digest
crypto_evp_digest( digestname, buffer var, digest var )
Calculates the digest of "buffer" using digest algorithm "digestname", placing the calculated digest in "digest". The digest output is always in raw binary format, use miva_hex_encode() or crypto_base64_encode() if other output formats are desired.
Returns 1 on success or 0 if an invalid or unsupported "digestname" is specified.
  • digestname = an OpenSSL digest identifier, such as "sha256" or "md5". buffer =
  • digest =
crypto_evp_encrypt
crypto_evp_encrypt( ciphername, key, iv, plaintext, encrypted var )
Encrypts "plaintext" using the block cipher specified by "ciphername", placing the encrypted data into "encrypted".
returns 1 on success, 0 on failure
  • ciphername = The OpenSSL identifier of the cipher, such as "bf-cbc" or "des-ede3-cbc".
  • key = The encryption key. Must be exactly the number of bytes required by the cipher, as returned by crypto_cipher_key_length.
  • iv = An initialization vector, if required by the cipher. Must be exactly the number of bytes required by the cipher, as returned by crypto_cipher_iv_length.
  • plaintext = The text to be encrypted
  • encrypted = [output] Receives the cipher text
crypto_evp_encrypt_auth
crypto_evp_encrypt_auth( ciphername, key, iv, aad, plaintext, encrypted var, tag var )
Encrypt the data in "plaintext" using the ciphername, key, and initial vector, returning the encrypted data in "encrypted" and a tag value in "tag" to be used to ensure that the ciphertext and AAD are not tampered with in transit.
Returns 1 on success, 0 on failure
  • ciphername = Name of cipher to use. An example is "aes-256-gcm"
  • key = Key value
  • iv = Initial vector
  • aad = Additional authenticated data
  • plaintext = Plaintext to encrypt
  • encrypted = Resulting encrypted value
  • tag = tag value
crypto_evp_hmac
crypto_evp_hmac( digestname, key, buffer var, digest var )
Calculates the HMAC of "buffer" using digest algorithm "digestname" and key "key", placing the HMAC in "digest". The HMAC output is always in raw binary format, use miva_hex_encode() or crypto_base64_encode() if other output formats are desired.
Returns 1 on success or 0 if an invalid or unsupported "digestname" is specified.
  • digestname = an OpenSSL digest identifier, such as "sha256" or "md5".
  • buffer = The data that will be process.
  • digest = The result of the HMAC function.
crypto_hmac_md5
crypto_hmac_md5( buffer var, key, format, result var )
Performs an HMAC-MD5 on "buffer" using key "key", storing the result in "result".
Returns 1 on success, 0 on error.
  • buffer = the data that will be processed.
  • key = the encryption key
  • format = on of the literal string "hex" or "binary"
  • result = the return data.
crypto_hmac_sha1
crypto_hmac_sha1( value, key, output_format, output)
Calculates an HMAC SHA-1 (Hash-based Message Authentication Code) of value
returns: 1 on success, 0 on failure (including OpenSSL not being available)
  • value = value to hash by reference
  • key = key to use to calculate the hmac
  • output_format = 'hex' or 'binary'
  • output = hmac_sha1 hash value.
crypto_hmac_sha256
crypto_hmac_sha256( buffer var, key, format, result var )
Calculates an HMAC SHA-256 (Hash-based Message Authentication Code) of buffer
Returns 1 on success, 0 on error or if on an unsuported platform.
  • buffer = value to hash
  • key = binary key to use to calculate the hmac
  • format = "binary" or "hex"
  • result = a variable used to store the results.
crypto_last_error
crypto_last_error()
Returns the error text from the last SSL error, or other internal errors in the crypto suite of functions. Use crypto_last_ssl_error() instead to get the code of the last SSL error. ⇨ Version 5.32 -- Previously if the crypto error originated from Miva Empresa, the returned error was always the same. If the crypto error was from OpenSSL then it would be lost after calling the function. Modified to always return the last crypto error.
Returns error text.
crypto_last_ssl_error
crypto_last_ssl_error()
Returns the Integer value of the last SSL error code. Use crypto_last_error() instead to get the text of the last SSL error.
Returns error code.
crypto_library_version
crypto_library_version( info )
crypto_md5
crypto_md5( buffer )
Calculates the MD5 hash of a string.
Returns the MD5 hash value.
  • buffer = the data to be hashed.
crypto_md5_file
crypto_md5_file( file, location, hash var )
Calculates the md5 hash of a file
Returns 1 on success, 0 on failure.
  • file = Name of file to calculate the hash of
  • location = Location either "script" or "data"
  • hash = MD5 hash value
crypto_pbkdf1
crypto_pbkdf1( digestname, password, salt, iterations, dklen, dk var )
Derives a key of "dklen" bytes using PBKDF1 from PKCS #5.
Returns 1 on success or 0 on error.
  • digestname = The digest algorithm to use. Must be one of "md2", "md5" or "sha1". password = The password from which a key is to be derived.
  • salt = Exactly 8 bytes of random data that are used as a salt.
  • iterations = The number of iterations to perform.
  • dklen = The desired output length of the derived key. May not be longer than the output digest size of the specified digest algorithm.
  • dk = [output] Receives the derived key. The output is in raw binary.
crypto_pbkdf2
crypto_pbkdf2( digestname, password, salt, iterations, dklen, dk var )
Derives a key of "dklen" bytes using PBKDF2 from PKCS #5.
Returns 1 on success or 0 on error.
  • digestname = The digest algorithm to use. May be any of the digests supported by the installed OpenSSL version.
  • password = The password from which a key is to be derived.
  • salt = Random data of any length that is used to salt the derivation. RFC 2898 recommends a minimum salt length of 8 bytes.
  • iterations = The number of iterations to perform. RFC 2898 recommends at least 1000 iterations.
  • dklen = The desired output length of the derived key. May be any positive value.
  • dk = [output] Receives the derived key. The output is in raw binary.
crypto_rand_bytes
crypto_rand_bytes( n )
Generates n random bytes.
Returns a string of bytes
  • n = the number of bytes
crypto_rand_set_rand_engine
crypto_rand_set_rand_engine( engine )
Specify the random number generating engine to use.
Return value: 1 on success, 0 on failure.
  • engine = Name of the random number generator engine to use.
crypto_sha1
crypto_sha1( buffer var, format, result var )
Returns an SHA1 hash of buffer. Secure Hash Algorithm
Returns 1 on success, 0 on failure. (including OpenSSL not being available)
  • buffer = value to hash by reference
  • output_format = 'hex' or 'binary'. Anything else will result in binary output.
  • output = returned sha1 hash value.
crypto_sha256
crypto_sha256( buffer var, format, result var )
Returns an SHA256 hash of buffer. Secure Hash Algorithm. May not be available on platforms running versions of OpenSSL Older than v0.9.8.
Returns 1 on success, 0 on failure. (including OpenSSL not being available)
  • buffer = value to hash by reference
  • output_format = 'hex' or 'binary'. Anything else will result in binary output.
  • output = returned sha1 hash value.
crypto_xor
crypto_xor( buffer var, dest var )
Efficiently performs a byte-by-byte XOR of buffer and dest, storing the resulting data in "dest". If "buffer" is longer than "dest", any extra bytes are ignored.
Returns nothing.
  • buffer = the data that will be processed.
  • dest = the data that will processed against buffer and will contain the results.
decodeattribute
decodeattribute( attribute )
Returns a copy of string (which is usually a URL) converted from URL-encoded format to ordinary text. This function is the opposite of encodeattribute.
Returns the results as a URL-decoded string.
decodeentities
decodeentities( string )
Returns a copy of string in which all HTML entities have been converted to their plain text equivalents (for example, & is converted to &). This function is the opposite of encodeentities.
Returns an entity decoded string.
dir
dir( path, location, entries var )
Reads a directory list in path.
Returns the number of files found or 0 (zero) if none are found. The parameter entries returns an array of file names found.
  • path = The path to a directory relative to the location
  • location = "data" or "script"
  • entries = array of resultant file names
encodeattribute
encodeattribute( attribute )
Returns a copy of string (which is usually a URI or part of an URI ) in URI-encoded format. Special characters such as space, tilde (~), and the plus sign are converted to hexadecimal %nn format. This function is the opposite of decodeattribute.
Returns a URI encoded string
encodeentities
encodeentities( string )
Returns a copy of string in which all characters have been converted to their HTML entity equivalents, where applicable (for example, & is converted to "&"). This function is the opposite of decodeentities.
Returns an entity encoded string.
encodejavascriptstring
encodejavascriptstring( string )
Encodes "string" in a format suitable for use inside a JavaScript quoted string declaration, honoring the current character set.
Returns the encoded string.
  • string = the string that will be encoded.
evp_pkey_derive
evp_pkey_derive( privkey var, peer var, key var )
Given structure references to a EVP PKEY structure with a secret key and a peer public key, derive a shared secret key and return the text in "key".
Returns 1 on success, 0 on failure
  • privkey = EVP PKEY structure reference
  • peer = EVP PKEY structure reference
  • key = Returned text of shared secret key
evp_pkey_free
evp_pkey_free( key var )
Remove an EVP_PKEY structure from internal memory. The passed EVP_PKEY structure reference is unchanged on failure (invalid reference) or set to 0 on success.
Returns 1 on success, 0 on failure
  • key = EVP_PKEY structure reference
evp_pkey_load_mem
evp_pkey_load_mem( data, format, passphrase, pkey var )
Given a EVP PKEY structure in the given format and a passphrase, verifies the PKEY structure and stores it in internal storage, and returns a reference to the internal storage. ⇨ Version 5.32 -- now supports the DER and PEM formats.
Returns 1 on success, 0 on failure
  • data = EVP PKEY structure text
  • format = Format of the PKEY structure text. Only "pkcs12" is supported
  • passphrase = Passphrase for the PKEY structure
  • pkey = Structure reference
evp_pkey_load_pubkey_mem
evp_pkey_load_pubkey_mem( data, format, pkey var )
Given EVP PKEY information in the given format, parse and load the public key from it and return a reference to the internal storage.
Returns 1 on success, 0 on failure
  • data = EVP PKEY text
  • format = Format of the EVP PKEY text. Valid values are "pem" and "der"
  • pkey = Structure reference to internal storage
exp
exp( number )
Returns the constant e (approximately 2.71828) Raised to the power number.
fchmod
fchmod( path, mode )
Changes a files or directory permissions.
Returns 1 if sucessful, 0 if fails
  • path = fully qualified path to the file
  • mode_number = ( nnnn decimal number) or '0nnnn' (octal string)
fcopy
fcopy( source, destination )
Copies a file in the data directory.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
fdelete
fdelete( path )
Deletes a file in the data directory. See sdelete()
Returns 1 if sucessful, 0 if fails
  • path = fully qualified path of the file to delete
fexists
fexists( path )
Tests if the file named in path exists in the data directory.
Returns 1 if the file exsists else 0.
  • path = the fully qualified path to the file
file_append
file_append( path, location, outputdata var )
Appends data to the end of the file in path.
Returns length of outputdata or -1 on error. file_append() will not create a file, but return -1 if the file does not exist.
  • path = fully qualified path to the file
  • location = location of the output file - 'data' or 'script'
  • outputdata = string variable containing the data to append
file_create
file_create( path, location, outputdata var )
Creates and appends data to the file in path.
Returns length of outputdata or -1 on error. file_create() will not append to an existing file, but return -1 if the file exists.
  • path = fully qualified path to the file
  • location = location of the output file - 'data' or 'script'
  • outputdata = string variable containing the data to append
file_read
file_read( path, location, inputdata var )
Reads a file.
Returns length of inputdata or -1 on error or file does not exist.
  • path = fully qualified path to the file
  • location = location of the input file - 'data' or 'script'
  • inputdata = string variable containing the data read
file_read_bytes
file_read_bytes( path, location, offset, length, data )
Reads a portion of the file specified by "path" and "location" into "data". Returns the number of bytes read, which may be less than "length", if an attempt was made to read past the end of the file, or -1 on error.
Returns the number of bytes read from the file. The file data is returned in "data".
  • path = The name or filepath of the file to open relative to the directory specified by "location"
  • location = One of "script" or "data"
  • offset = The zero-based offset at which to begin reading
  • length = The number of bytes to read. If < 0, the entire file after "offset" is read.
  • data = The variable in which to store the file data
file_touch
file_touch( file, location )
Updates the modification time of the specified file.
Return value: 0 on success, -1 on failure.
  • file = File name.
  • location = File location. "script" or "data", defaulting to "data" if any other value.
fisdir
fisdir( path )
Tests if the file named in path is a directory.
Returns 1 if the path is a directory else 0.
  • path = the fully qualified path to the directory
floor
floor( number )
Returns the largest integer less than or equal to number
fmkdir
fmkdir( path )
Creates a directory specified by path in the data directory.
Returns 1 if sucessful, 0 if fails
  • path = the fully qualified path to the directory
fmod
fmod( x, y )
Returns the remainder of number1/number2; number1, number2, and the result are all floating point numbers.
fmode
fmode( path )
Returns the permissions mode of path in the data directory.
Returns the permissions mode or -1 if the file does not exist
  • path = the fully qualified path to the file or directory
frename
frename( source, destination )
Rename source file to destination file. Can rename or move a file in the data directory.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
fscopy
fscopy( data_source,script_destination )
Copies a file from data directory to the scripts directory.
Returns 1 if sucessful, 0 if fails
  • data_source = source file fully qualified path
  • scripts_destination = destination file fully qualified path
fsize
fsize( path )
Get the size of a file in the data directory
Returns the file size in bytes or -1 if the file does not exist.
  • path = the fully qualified path to the file
fsrename
fsrename( source, destination )
Rename data directory source file to script directory destination file. Can rename or move a file.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
fssymlink
fssymlink( source, destination )
This function creates a symbolic link from a file in the data directory to the scripts directory (Available on UNIX file systems only)
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path in the data directory
  • destination = destination file fully qualified path in the scripts directory
fsymlink
fsymlink( source, destination )
(Unix only) Creates a symbolic link to the file in the data directory.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
ftime
ftime( path )
Gets the last modified time for the file in data directory.
Returns time_t since a file in the was last modified or -1 if the file does not exist.
  • path = the fully qualified path to the file
gdClearLastError
gdClearLastError()
gdImageAABlend
gdImageAABlend( im )
gdImageAlpha
gdImageAlpha( im, c )
gdImageAlphaBlending
gdImageAlphaBlending( im, alphaBlendingArg )
gdImageArc
gdImageArc( im, cx, cy, w, h, s, e, color )
gdImageBlue
gdImageBlue( im, c )
gdImageBoundsSafe
gdImageBoundsSafe( im, x, y )
gdImageColorAllocate
gdImageColorAllocate( im, r, g, b )
gdImageColorAllocateAlpha
gdImageColorAllocateAlpha( im, r, g, b, a )
gdImageColorClosest
gdImageColorClosest( im, r, g, b )
gdImageColorClosestAlpha
gdImageColorClosestAlpha( im, r, g, b, a )
gdImageColorClosestHWB
gdImageColorClosestHWB( im, r, g, b )
gdImageColorDeallocate
gdImageColorDeallocate( im, color )
gdImageColorExact
gdImageColorExact( im, r, g, b )
gdImageColorExactAlpha
gdImageColorExactAlpha( im, r, g, b, a )
gdImageColorResolve
gdImageColorResolve( im, r, g, b )
gdImageColorResolveAlpha
gdImageColorResolveAlpha( im, r, g, b, a )
gdImageColorsTotal
gdImageColorsTotal( im )
gdImageColorTransparent
gdImageColorTransparent( im, color )
gdImageCompare
gdImageCompare( im1, im2 )
gdImageCopy
gdImageCopy( dst, src, dstX, dstY, srcX, srcY, w, h )
gdImageCopyMerge
gdImageCopyMerge( dst, src, dstX, dstY, srcX, srcY, w, h, pct )
gdImageCopyMergeGray
gdImageCopyMergeGray( dst, src, dstX, dstY, srcX, srcY, w, h, pct )
gdImageCopyResampled
gdImageCopyResampled( dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH )
gdImageCopyResized
gdImageCopyResized( dst, src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, srcH )
gdImageCopyRotated
gdImageCopyRotated( dst, src, dstX, dstY, srcX, srcY, srcWidth, srcHeight, angle )
gdImageCreate
gdImageCreate( sx, sy )
gdImageCreateFromGd
gdImageCreateFromGd( filename, location )
gdImageCreateFromGd2
gdImageCreateFromGd2( filename, location )
gdImageCreateFromGd2Mem
gdImageCreateFromGd2Mem( data var )
gdImageCreateFromGd2Part
gdImageCreateFromGd2Part( filename, location, srcx, srcy, w, h )
gdImageCreateFromGd2PartMem
gdImageCreateFromGd2PartMem( data var, srcx, srcy, w, h )
gdImageCreateFromGdMem
gdImageCreateFromGdMem( data var )
gdImageCreateFromGif
gdImageCreateFromGif( filename, location )
gdImageCreateFromGifMem
gdImageCreateFromGifMem( data var )
gdImageCreateFromJpeg
gdImageCreateFromJpeg( filename, location )
gdImageCreateFromJpegMem
gdImageCreateFromJpegMem( data var )
gdImageCreateFromPng
gdImageCreateFromPng( filename, location )
gdImageCreateFromPngMem
gdImageCreateFromPngMem( data var )
gdImageCreateFromWBMP
gdImageCreateFromWBMP( filename, location )
gdImageCreateFromWBMPMem
gdImageCreateFromWBMPMem( data var )
gdImageCreatePaletteFromTrueColor
gdImageCreatePaletteFromTrueColor( im, ditherFlag, colorsWanted )
gdImageCreateTrueColor
gdImageCreateTrueColor( sx, sy )
gdImageDashedLine
gdImageDashedLine( im, x1, y1, x2, y2, color )
gdImageDestroy
gdImageDestroy( im )
gdImageEllipse
gdImageEllipse( im, cx, cy, w, h, color )
gdImageFill
gdImageFill( im, x, y, color )
gdImageFilledArc
gdImageFilledArc( im, cx, cy, w, h, s, e, color, style )
gdImageFilledEllipse
gdImageFilledEllipse( im, cx, cy, w, h, color )
gdImageFilledPolygon
gdImageFilledPolygon( im, points var, n, color )
gdImageFilledRectangle
gdImageFilledRectangle( im, x1, y1, x2, y2, color )
gdImageFillToBorder
gdImageFillToBorder( im, x, y, border, color )
gdImageGetClip
gdImageGetClip( im, x1P var, y1P var, x2P var, y2P var )
gdImageGetInterlaced
gdImageGetInterlaced( im )
gdImageGetPixel
gdImageGetPixel( im, x, y )
gdImageGetTransparent
gdImageGetTransparent( im )
gdImageGetTrueColorPixel
gdImageGetTrueColorPixel( im, x, y )
gdImageGif
gdImageGif( im, filename, location )
gdImageGifAnimAdd
gdImageGifAnimAdd( im, out, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm )
gdImageGifAnimAddMem
gdImageGifAnimAddMem( im, ctx, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm )
gdImageGifAnimAddOutput
gdImageGifAnimAddOutput( im, LocalCM, LeftOfs, TopOfs, Delay, Disposal, previm )
gdImageGifAnimBegin
gdImageGifAnimBegin( im, filename, location, GlobalCM, Loops )
gdImageGifAnimBeginMem
gdImageGifAnimBeginMem( im, GlobalCM, Loops )
gdImageGifAnimBeginOutput
gdImageGifAnimBeginOutput( im, GlobalCM, Loops )
gdImageGifAnimEnd
gdImageGifAnimEnd( out )
gdImageGifAnimEndMem
gdImageGifAnimEndMem( ctx, output var )
gdImageGifAnimEndOutput
gdImageGifAnimEndOutput()
gdImageGifMem
gdImageGifMem( im, output var )
gdImageGifOutput
gdImageGifOutput( im )
gdImageGreen
gdImageGreen( im, c )
gdImageInterlace
gdImageInterlace( im, interlaceArg )
gdImageJpeg
gdImageJpeg( im, filename, location, quality )
gdImageJpegMem
gdImageJpegMem( im, output var, quality )
gdImageJpegOutput
gdImageJpegOutput( im, quality )
gdImageLine
gdImageLine( im, x1, y1, x2, y2, color )
gdImageOpenPolygon
gdImageOpenPolygon( im, points var, n, color )
gdImagePaletteCopy
gdImagePaletteCopy( dst, src )
gdImagePalettePixel
gdImagePalettePixel( im, x, y )
gdImagePng
gdImagePng( im, filename, location )
gdImagePngMem
gdImagePngMem( im, output var )
gdImagePngOutput
gdImagePngOutput( im )
gdImagePolygon
gdImagePolygon( im, points var, n, color )
gdImageRectangle
gdImageRectangle( im, x1, y1, x2, y2, color )
gdImageRed
gdImageRed( im, c )
gdImageSaveAlpha
gdImageSaveAlpha( im, saveAlphaArg )
gdImageSetAntiAliased
gdImageSetAntiAliased( im, c )
gdImageSetAntiAliasedDontBlend
gdImageSetAntiAliasedDontBlend( im, color, dont_blend )
gdImageSetBrush
gdImageSetBrush( im, brush )
gdImageSetClip
gdImageSetClip( im, x1, y1, x2, y2 )
gdImageSetPixel
gdImageSetPixel( im, x, y, color )
gdImageSetStyle
gdImageSetStyle( im, style var, n )
gdImageSetThickness
gdImageSetThickness( im, thickness )
gdImageSetTile
gdImageSetTile( im, tile )
gdImageSharpen
gdImageSharpen( im, pct )
gdImageSquareToCircle
gdImageSquareToCircle( im, radius )
gdImageStringFT
gdImageStringFT( im, brect var, fg, fontlist, ptsize, angle, x, y, string )
This will append a string of text to an image.
Returns an error message
gdImageStringFTCircle
gdImageStringFTCircle(
    im, cx, cy, radius, textRadius, fillPortion, font, points, top, bottom, fgcolor )
gdImageSX
gdImageSX( im )
gdImageSY
gdImageSY( im )
gdImageTrueColor
gdImageTrueColor( im )
gdImageTrueColorPixel
gdImageTrueColorPixel( im, x, y )
gdImageTrueColorToPalette
gdImageTrueColorToPalette( im, ditherFlag, colorsWanted )
gdImageWBMP
gdImageWBMP( im, fg, filename, location )
gdImageWBMPMem
gdImageWBMPMem( im, fg, output var )
gdImageWBMPOutput
gdImageWBMPOutput( im, fg )
gdLastError
gdLastError()
gdTrueColor
gdTrueColor( r, g, b )
gdTrueColorAlpha
gdTrueColorAlpha( r, g, b, a )
gettoken
gettoken( delimited_string, characters, position_num )
Returns the nth number token (i.e. substring) of a delimited_string using characters as token separators. A null string is returned if there is no nth token. Common delimiter characters are comma, tab, linefeeds, pipe but are not limited to these.
Returns the position_num token (i.e. substring) of a delimited_string delimited by characters.
  • delimited_string = A string delimited by a character or characters
  • characters = the delimiter character or characters
  • position_num = the position of the substring you want to return
glosub
glosub( target_string, search, replace )
Global substitution returns a copy of string in which all instances of string search have been replaced by string replace. (Note: to represent a backslash () in replace, use '\\').
Returns string where all instances of search have been replaced.
  • target_string = the target string
  • search = the sub-string that will be search ed for
  • replace = the replacement string
glosub_array
glosub_array( string, search_array, replace_array )
Works like glosub(), but search_array and replace_array are iterated through, each value in search_array found in the string is replaced by the corresponding value in replace_array
Return Value: string is returned with all found values replaced.
  • string = the target
  • search_array = an array of strings that will be searched for
  • replace_array = an array of the replacement strings
indexof
indexof( search_string, target_string var, start_number )
Returns the position of the first occurrence of search_string within the target_string beginning at the start_number position. The search is CASE SENSITIVE sensitive. If not found, the functions return 0. The offset parameter and returned string offset are 1-based. For speed, target_string is passed by reference .
Returns the 1 based offset_number of search_string within the target_string. The search is case sensitive.
  • search_string = the string that will be searched for
  • target_string = the string that will be searched
  • start_number = the 1 based starting offset withing the target_string where the search will begin
indexofi
indexofi( search_string, target_string var, start_number )
Returns the position of the first occurrence of search_string within the target_string beginning at the start_number position. The search is CASE IN-SENSITIVE. If not found, the functions return 0. The offset parameter and returned string offset are 1-based. For speed, target_string is passed by reference
Returns the 1 based offset_number of search_string within the target_string. The search is case in-sensitive.
  • search_string = the string that will be searched for
  • target_string = the string that will be searched
  • start_number = the 1 based starting offset withing the target_string where the search will begin
indexofl
indexofl( needle, haystack var, offset )
Search from the end of the haystack for needle, starting at the offset position.
Return value: Index of found value, or 0 if not found.
  • needle var = Value to search for.
  • haystack var = Text to search.
  • offset = integer offset to start at.
indexofli
indexofli( needle, haystack var, offset )
Search without regard to case from the end of the haystack for needle, starting at the offset position.
Return value: Index of found value, or 0 if not found.
  • needle var = Value to search for.
  • haystack var = Text to search.
  • offset = integer offset to start at.
int
int( number )
Returns integer portion of number (removes the decimal and any digits to the right of it)
isalnum
isalnum( string )
Test if all characters are either alphabetic or digits
Returns 1 if true, 0 if false
  • string = the characters tested
isalpha
isalpha( string )
Test if all characters are alphabetic.
Returns 1 if true, 0 if false
  • string = the characters tested
isascii
isascii( string )
Test if all characters are ASCII characters (those with decimal value between 0 and 127).
Returns 1 if true, 0 if false
  • string = the characters tested
iscntrl
iscntrl( string )
Test if all characters are control characters (those with decimal value between 0 and 31, or 127).
Returns 1 if true, 0 if false
  • string = the characters tested
isdigit
isdigit( string )
Test if all characters are digits in the range 0-9.
Returns 1 if true, 0 if false
  • string = the characters tested
isgraph
isgraph( string )
Test if all characters are graphic (see isprint) characters (those with decimal value between 33 and 127).
Returns 1 if true, 0 if false
  • string = the characters tested
islower
islower( string )
Test if all characters are lowercase letters,
Returns 1 if true, 0 if false
  • string = the characters tested
isprint
isprint( string )
Test if all characters are printable (same as graphic characters, with the addition of the space character).
Returns 1 if true, 0 if false
  • string = the characters tested
ispunct
ispunct( string )
Test if all characters are whitespace (space, tab, vertical tab, newline, form feed) characters.
Returns 1 if true, 0 if false
  • string = the characters tested
isspace
isspace( string )
Test if all characters are whitespace (space, tab, vertical tab, newline, form feed) characters.
Returns 1 if true, 0 if false
  • string = the characters tested
isupper
isupper( string )
Test if all characters are uppercase letters.
Returns 1 if true, 0 if false
  • string = the characters tested
isxdigit
isxdigit( string )
Test if all characters are hexadecimal digits (a-f, A-F, 0-9).
Returns 1 if true, 0 if false
  • string = the characters tested
keyword_extract
keyword_extract( string, keywords var )
Given a string, will extract keywords from it. Skipping SGML tags and stemming words (e.g., "running" becomes "run", but "bring" is not changed), the unique list of keywords are placed in the keywords as an array. Also, some common english words (the articles, "for" "are", etc.) are removed. Note that there are some words may stem unexpectedly (e.g., "has" transforms to "ha").
Populates the keywords array and returns number of elements.
keyword_extract_merge
keyword_extract_merge( string, weight )
Extracts keywords as described in keyword_extract, but inserts them into a persistent array initialized by keyword_extract_merge_init. The weight value passed in is associated with the results from the current string being analyzed. Return null.
Returns null.
keyword_extract_merge_init
keyword_extract_merge_init()
Initializes persistent storage for a multiple calls to keyword_merge_extract. Note that this persistent storage is usable for multiple calls within a running Miva Script program, and is deleted by the VM at the end of program execution.
Returns null.
keyword_extract_merge_results
keyword_extract_merge_results( keywords var )
Returns results from one or more keyword_extract_merge calls, storing them as an aggregate in "keywords".
Returns null.
keyword_in
keyword_in( keywords_array var, search_string )
Performs a keyword_extract() on the string parameter, and determines if the value in the keywords parameter is contained in the keyword list, and returns a boolean 1 or 0 to signify that the keyword is or is not in the string. If the keywords parameter is an array of strings, checks each value in the array, and returns an array of booleans specifying whether the array element is or is not in the string.
If keywords is an array, returns an array of booleans specifying if a given keyword element is in the keyword list. -- If keywords is a string, returns a boolean specifying if the given keyword is in the keyword list.
len
len( string )
Returns the number of characters in string.
The length of string.
  • string = a literal string value embedded in single quotes or an expression that evaluates as a string.
len_var
len_var( string var )
Returns the number of characters in string. This function is identical to len() but its parameter is passed by reference, improving performance when dealing with large strings.
the length of the string
  • string = a literal string value embedded in single quotes or an expression that evaluates as a string.
log
log( number )
Returns the natural logarithm (base e, approximately 2.71828) of number.
log10
log10( number )
Returns the base 10 logarithm of number
ltrim
ltrim( string )
Returns a copy of string with all space characters removed from the left end. ⇨ Version 5.32 -- Will now trim whitespace from arrays and structures. Previously the functions would convert arrays and structures to serialized data and then trim it. Arrays and structures are now iterated and all values within are trimmed appropriately.
makesessionid
makesessionid()
Returns a 128-bit unique ID.
max
max( a, b )
Compares and returns the higher of two values.
Returns the higher value of a or b
  • a = string or numeric value, b = string or numeric value
min
min( a, b )
Compares and returns the lower of two values.
Returns the smaller value of a or b
  • a = string or numeric value, b = string or numeric value
miva_array_binarysearch
miva_array_binarysearch( key, array var, callback, data var )
Performs a binary search for "key" in "array". "array" must have been previously sorted.
Returns the index of "key" in "array" or 0 if no match was found.
  • key = The value that will be searched for.
  • array var = The array that will be searched.
  • callback = The name of a callback function. See below.
  • data var = Optional data that is passed through to the callback function
miva_array_clear
miva_array_clear( array var, start, count )
Removes "count" elements from "array", starting at position "start". The elements are removed from the array, but the array is not collapsed.
Returns the number of elements remaining in the array.
  • array = The array that will be altered.
  • start = the starting index numbert
  • count = the number of elements that will be cleared
miva_array_collapse
miva_array_collapse( aggregate var )
Collapses the array_variable making the indices sequential starting at 1. Returns the number of elements in the array.
miva_array_copy
miva_array_copy( source var, sstart, scount, dest var, dpos )
Copies "scount" elements from "source" into "dest", starting with "sstart" and placing the elements at "dpos". Existing elements in "dest" are overwritten.
Returns the number of elements in the "dest" array after the copy.
  • source = The source array from which records will be copied
  • sstart = The source starting index
  • scount = The number of source records to copy.
  • dest = The destination array that will receive the copied records.
  • dpos = The starting index within the destination array. Overlapping elements in "dest" are overwritten.
miva_array_copy_ref
miva_array_copy_ref( source var, sstart, scount, dest var, dpos )
Copies "scount" elements from "source" into "dest", starting with "sstart" and placing the elements at "dpos". Existing elements in "dest" are overwritten.
Returns the number of elements in the "dest" array after the copy.
  • source = The source array from which records will be copied
  • sstart = The source starting index
  • scount = The number of source records to copy.
  • dest = The destination array that will receive the copied records.
  • dpos = The starting index within the destination array. Overlapping elements in "dest" are overwritten.
miva_array_delete
miva_array_delete( array var, start, count )
Removes "count" elements from "array", starting at position "start". The array is collapsed after the elements are removed.
Returns the number of elements remaining in the array.
  • array = The array that will be altered.
  • start = the starting index numbert
  • count = the number of elements that will be cleared
miva_array_deserialize
miva_array_deserialize( string )
Reverses miva_array_serialize(). Returns an aggregate array repopulated to match the original.
miva_array_elements
miva_array_elements( aggregate var )
Returns the number of elements in the array_variable that were actually used.
miva_array_filter
miva_array_filter( array var, offset, element var, filter_expression, output var )
Iterate through an array starting at a given offset, execute a filter expression against each element, and copy the member to a new output array. See also miva_array_filter_ref.
Return value: Count of output array elements.
  • array var = Source array of structures.
  • offset = index in the array to start filtering from.
  • element var = Name of a variable to reference in the filter expression.
  • filter_expression = Text of an expression to execute based on the individual array element.
  • output var = Output array of all structures that tested true in the filter expression.
miva_array_filter_ref
miva_array_filter_ref( array var, offset, element var, filter_expression, output var )
Iterate through an array starting at a given offset, execute a filter expression against each element, and create a new member with references to the members in the output array. See also miva_array_filter.
Return value: Count of output array elements.
  • array var = Source array of structures.
  • offset = index in the array to start filtering from.
  • element var = Name of a variable to reference in the filter expression.
  • filter_expression = Text of an expression to execute based on the individual array element.
  • output var = Output array of all structures that tested true in the filter expression.
miva_array_find
miva_array_find( needle, haystack var, offset )
Performs a sequential search for "needle" in array "haystack", starting at "offset". Comparison is equivalent to the EQ operator. (i.e. looks for an exact match). Haystack must be a simple array( no members), or contain no more than 1 member.
Returns the index of "needle" in "haystack" or 0 if the element was not found.
  • needle = value to search for
  • haystack var = the simple array to search
  • offset = the starting index position
miva_array_insert
miva_array_insert( array var, element, pos )
Inserts single element "element" into "array" at position "pos". If "pos" = -1, the element is inserted at the end of "array".
Returns the number of elements in "array" after the insertion.
  • array = The array tro which the records will be inserted
  • element = the record that will be inserted
  • pos = the index where the element will be inserted.
miva_array_insert_ref
miva_array_insert_ref( array var, element var, pos )
Inserts single element "element" into "array" at position "pos".
Returns the number of elements in "array" after the insertion.
  • array = The array tro which the records will be inserted
  • element = the record that will be inserted
  • pos = the index where the element will be inserted.
miva_array_insert_var
miva_array_insert_var( array var, element var, pos )
Inserts single element "element" into "array" at position "pos".
Returns the number of elements in "array" after the insertion.
  • array = The array tro which the records will be inserted
  • element = the record that will be inserted
  • pos = the index where the element will be inserted.
miva_array_max
miva_array_max( aggregate var )
Return the maximum array_variable index used.
miva_array_merge
miva_array_merge( source var, sstart, scount, dest var, dpos )
Copies "scount" elements from "source" into "dest", starting with "sstart" and inserting the elements at "dpos". Existing elements in "dest" past "dpos" are pushed forward by "scount" elements.
Returns the number of elements in the "dest" array after the merge.
  • source = The source array from which records will be copied
  • sstart = The source starting index
  • scount = The number of source records to copy.
  • dest = The destination array that will receive the copied records.
  • dpos = The starting index within the destination array. Existing elements in "dest" past "dpos" are pushed forward by "scount" elements.
miva_array_merge_ref
miva_array_merge_ref( source var, sstart, scount, dest var, dpos )
Copies "scount" elements from "source" into "dest", starting with "sstart" and inserting the elements at "dpos". Existing elements in "dest" past "dpos" are pushed forward by "scount" elements.
Returns the number of elements in the "dest" array after the merge.
  • source = The source array from which records will be copied
  • sstart = The source starting index
  • scount = The number of source records to copy.
  • dest = The destination array that will receive the copied records.
  • dpos = The starting index within the destination array. Existing elements in "dest" past "dpos" are pushed forward by "scount" elements.
miva_array_min
miva_array_min( aggregate var )
Return the minumum array_variable index used.
miva_array_next
miva_array_next( aggregate var, index )
miva_array_pop
miva_array_pop( array var )
Removes and returns the last element of "array".
Returns the number of elements remaining in "array".
  • array = the array where the record will be remove.
miva_array_pop_ref
miva_array_pop_ref( array var, element var )
Makes "element" a reference to the last element of "array", then removes it from the array.
Returns the number of elements remaining in "array".
  • array = the array where the record will be remove.
miva_array_previous
miva_array_previous( aggregate var, index )
miva_array_search
miva_array_search( array var, offset, element var, filter_expr )
Performs an sequential search in "array", starting at "offset". Comparison is made by evaluating "filter_expr" for each element. This allows you to specify the comparison type.
Returns the index of the first element in "array" for which filter_expr evaluated as true, or 0 if no elements met this condition.
  • array var = the array that will be searched
  • offset = the starting index for the search
  • element var = a variable name used to reference individual array records. See Example 1
  • filter_expr = an expression similar to the EXPR attribute to MvFILTER. See Example 2
miva_array_serialize
miva_array_serialize( aggregate var )
Returns a string representation of the array and any subarrays. Can be used to store an entire array in a database for later retreival.
miva_array_shift
miva_array_shift( array var )
Removes and returns the first element of "array".
Returns the first element of "array".
  • array = the array where the record will be remove.
miva_array_shift_ref
miva_array_shift_ref( array var, element var )
Makes "element" a reference to the first element of "array", then removes it from the array.
Returns the number of elements remaining in "array".
  • array = the array where the record will be remove
  • element = a reference to the element that was removed.
miva_array_sort
miva_array_sort( aggregate var, callback, data var )
This function will sort an array structure
Returns the number of array elements in the aggregate array structure after sorting.
  • Aggregate: The array that will be sorted. (the aggregate will be physically altered on return)
  • Callback: The name of a user function that must exist in your program, defined as Callback(left var, right var, data var)
  • Data: Not directly used in the miva_array_sort(), the value will be passed to the Callback function.
miva_async_sleep
miva_async_sleep( until, semfile, semlocation )
Sleep until the "until" time, or the modified time on the file described by semfile and semlocation is changed.
Return Value: None
  • until = time_t (seconds since 1-JAN-1970) set in the future, the time to sleep until
  • semfile = file name to watch
  • semlocation = location of the file to watch. "script" or "data", defaulting to "data" if any other value.
miva_cdata_encode
miva_cdata_encode( text )
Create one or more CDATA tags with the provided text, splitting any data with "]]>" into two CDATA tags with "]]" at the end of one CDATA tag, and ">" as the first value of the next CDATA tag.
Return value: Text quoted within one or more CDATA tags.
  • text = String to encode
miva_closelog
miva_closelog()
Closes the connection to the log file and otherwise eliminates the effect of the last call to miva_openlog. Will cause any subsequent calls to miva_setlogmask and miva_writelog to fail until miva_openlog is called again.
Returns 1 on success, 0 on error
miva_csv_encode
miva_csv_encode( text, delimiter )
Takes a string of text and a delimiter, and returns a string with appropriately doubled quotes or escaped delimiters, suitable for including in a CSV record.
Returns: An appropriately escaped or quoted string, or a copy of the original string if no quotes or delimiters were found.
  • text = String to escape
  • delimiter = separation character (for example, a "," for a comma-separated list).
miva_element_exists
miva_element_exists( array var, index )
Tests if an element exists where: array is an array and index is index number being tested.
Returns 1 if the element found else 0
miva_getvarlist
miva_getvarlist( scope )
Returns a comma-separated list of the names of all currently defined variables where: scope = the string literal "l", "g", "s" (i.e. local, global, system)
miva_hex_decode
miva_hex_decode( data )
Convert "data" to hexadecimal notation.
returns the resulting decoded data
  • data = the hex data to decode.
miva_hex_encode
miva_hex_encode( data )
Convert "data" to hexadecimal notation.
returns the resulting encoded data.
  • data = the value to encode.
miva_html_strip
miva_html_strip( text, allowed_tags )
Removes HTML tags from a given string.
Return value: Text string with all HTML tags except those listed in allowed_tags removed.
  • text = String to remove HTML tags from.
  • allowed_tags = A comma-separated list of tags that will not be stripped from the string.
miva_ieee754_normalize
miva_ieee754_normalize( significant_digits, value )
Normalize the value to IEEE 754 specifications, to the given number of significant digits.
Return value: The normalized value to the specified significant digits
  • significant_digits = Number of digits to normalize the value to.
  • value = Floating point value to normalize.
miva_json_decode
miva_json_decode( data, output var )
Decodes a block of JSON data in "data", returning the parsed aggregate value in "output".
Returns 1 on success, 0 on error.
  • data = The block of JSON encoded data that will be decoded
  • output var = The function assigns the parsed aggregate to "output" as a structured array.
miva_json_decode_last_error
miva_json_decode_last_error()
Returns a text description of the most recent parsing error encountered by miva_json_decode()
Returns a text description of the most recent parsing error.
miva_lockfile
miva_lockfile( path, location )
Creates and locks a lockfile. Similar to the behavior of MvLOCKFILE without the closing /MvLOCKFILE behavior. It also creates the exact filename, rather than appending ".lck" to the filename as MvLOCKFILE does.
Returns 1 if sucessful, -1 if fails
  • path = fully qualified path to the file
  • location = location of the file - 'data' or 'script'
  • Use fdelete() or sdelete() to delete the lockfile.
miva_member_exists
miva_member_exists( structure var, member )
Tests if a member exists where: "structure" is a data structure and "member" is the name of a structure member being tested. Returns 0 or 1.
Returns 1 if found else returns 0
  • structure: A data structure or structured array that is tested. It is passed by reference to the function.
  • member: The literal member name or a variable that evaluates as the member name.
miva_openlog
miva_openlog( ident, logopt, facility )
Opens a connection to the log file and sets default behavior for all subsequent miva_writelog calls.
Returns 1 on success, 0 on error
  • ident = a string that will be prepended to all subsequent log messages. May be the empty string.
  • logopt = a string containing a list of options. Each option may be any of the words listed below. Commas and/or spaces separate the options. An empty string is permitted.
  • facility = The default facility code for subsequent messages. May be any one of the words listed below.
miva_output_flush
miva_output_flush()
Writes the HTTP headers and any other output to the browser. Subsequent calls will write the output, but not the headers.
miva_output_header
miva_output_header( header, value )
Sets an HTTP header name-value pair.
miva_setdefaultdatabase
miva_setdefaultdatabase( database )
This function takes a string as a parameter which specifies the type of database to which the miva_defaultdatabase system variable is set.
miva_setdefaultlanguage
miva_setdefaultlanguage( language )
miva_setlanguage
miva_setlanguage( language )
miva_setlogmask
miva_setlogmask( maskpri )
Causes all subsequent calls to miva_writelog to be ignored unless they specify a priority that is included in the maskpri argument. Will return failure unless the miva log is open.
Returns 1 on success, 0 on error
  • maskpri = a string containing a list of priorities. Each priority may be any of the words listed below. Commas and/or spaces separate the priorities. An empty string is permitted but means that all subsequent miva_writelog calls will be ignored.
miva_setprocessname
miva_setprocessname( name )
Set the process name (where possible) and alters the s.process_name variable.
Return value: None.
  • name = Text to set the process name to.
miva_sleep
miva_sleep( msecs )
Delays the running application for msecs milliseconds or until the global timeout expires, whichever is shorter.
Return Value: None
  • msecs = the number of milliseconds to delay
miva_splitstring
miva_splitstring( string, sep, output var, flags )
Splits a string into chunks in an array, using the separator parameter as the point to split the string. Returns the number of elements in the output array.
Returns: The number of elements in the output array.
  • string = The input string
  • sep = A single character that will be used to split the string into multiple elements (for example a comma or space)
  • output var = The array of elements returned
  • flags = A comma separated list of any of the following keywords
    trim : removes extra space around the left and right sides of all elements
    ltrim : removes extra space around the left side of all elements
    rtrim : removes extra space around the right side of all elements
    lower : converts all elements to lowercase
    upper : converts all elements to uppercase
    insensitive : searches for the sep input parameter using a case-insensitive search
miva_struct_members
miva_struct_members( struct var, members var )
This function retreives the member / field names of a data structure.
Returns the number of member names found. Important: A member name will be returned even if its value is null.
  • struct = the structure or structured array that will be processed
  • members = The array populated with the members names found in structure
miva_struct_merge
miva_struct_merge( source var, dest var )
Copy the structure members from source into dest, if the member does not exist in dest. See also miva_struct_merge_ref.
Return value: 0 on success, -1 on failure.
  • source - Structure to copy into dest.
  • dest - Destination structure.
miva_struct_merge_ref
miva_struct_merge_ref( source var, dest var )
Make references of the structure members from source in dest, if the member does not exist in dest. Similar to miva_struct_merge, but makes references into original structure rather than copies.
Return value: None.
  • source - Structure to copy into dest.
  • dest - Destination structure.
miva_template_compile
miva_template_compile( signat, source var, sourceitems var, target, errors var )
Compiles the contents of a string into a page template file.
Returns 1 if compilation succeeds, 0 if error occured.
  • signat = Any text. The md5 hash value of this text will bestored in the MVC file.
  • source = The source to compile into a template file.
  • sourceitems = array of valid item names.The compiler will return an error if an mvt:item tag has a "name" attribute that is not in this list.
  • target = The name of the file (relative to the script directory) to put the .mvc file.
  • errors = If the function returns 0, this will contain error text.
miva_template_compile_dump
miva_template_compile_dump( source var, errors var )
miva_template_compile_itemlist
miva_template_compile_itemlist( signat, source var, sourceitems var, target, errors var )
miva_variable_type
miva_variable_type( variable )
Return a string representation of the variable type e.g. "INTEGER", "DOUBLE", "ARRAY", etc...
Returns the variable type
  • variable = a variable name
miva_variable_value
miva_variable_value( string )
Returns the value of a variable where expression is the literal name of the variable.
miva_writelog
miva_writelog( priority, message )
Writes a message to the log with the specified priority. Will return failure unless the miva log is open.
Returns 1 on success, 0 on error
  • priority = a string containing a list of words. These words may be either a facility code (see miva_openlog) or a priority code (see miva_setlogmask). Commas and/or spaces separate the words. The facility may be omitted in which case the default will be assumed (see miva_openlog). If the priority is omitted or has been disabled via a call to miva_setlogmask, then the miva_writelog call will be ignored.
  • message = a string that will be written to the log.
mktime_t
mktime_t( year, month, dayofmonth, hours, minutes, seconds, timezone )
Returns the s.time_t value for the time specified. time_zone can be the keyword 'local'
padl
padl( string, length, character )
Returns a string length characters long, consisting of string padded on the left with as many instances of padcharacter as are needed to make up the full length.
padr
padr( string, length, character )
Returns a string length characters long, consisting of string padded on the right with as many instances of padcharacter as are needed to make up the full length.
pkcs7_free
pkcs7_free( pkcs7 var )
Remove a pkcs7 structure from internal memory. The passed pkcs7 structure reference is unchanged on failure (invalid reference) or set to 0 on success.
Returns 1 on success, 0 on failure
  • pkcs7 = PKCS7 structure reference
pkcs7_get_certs
pkcs7_get_certs( pkcs7 var, x509s var )
Given a structure reference such as returned from pkcs7_load_mem, return certificate references for the x509 certificates that are embedded therein.
Returns Count of array elements returned, -1 on failure
  • pkcs7 = Structure reference
  • x509s = Array of x509 certificate references
pkcs7_load_mem
pkcs7_load_mem( cert, format, pkcs7 var )
Load a list of PKCS7 structures in the specified format into memory, and return a structure reference that refers to the structure(s) in internal storage.
Returns 1 on success, 0 on failure
  • cert = Text of a list of pkcs7 structures
  • format = Format of the structure(s) passed in. Valid values are "der", "pem", or "pkcs12", with "der" used if the format is missing or any other values are passed
  • pkcs7 = Structure array reference. On success, this will be neither zero nor null
pkcs7_verify
pkcs7_verify( pkcs7 var, root_x509 var, content )
Given a pkcs7 structure reference and root x509 certificate reference, verify the pkcs7 structure and the signed content (if provided).
Returns 1 on success, 0 on failure
  • pkcs7 = PKCS7 structure reference
  • root_x509 = Root x509 certificate reference
  • content = Optional content if not present in the PKCS structure
power
power( number, matissa )
Raises number to a a power (for example, power(12,2)=144)
random
random( max )
Returns a random number less than or equal to maximum
rnd
rnd( value, precision )
Works like the ROUND operator, rounding number up or down to number_of_places after the decimal
rsa_free
rsa_free( rsa var )
Frees memory associated with a previously loaded RSA keypair.
Returns 1 on success, 0 on error.
  • rsa = a handle returned by one of the rsa_load_xxx functions
rsa_generate_keypair
rsa_generate_keypair( pubkey_file, privkey_file, bits, e, passphrase )
Generates an RSA keypair, saving the public key in pubkey_file, the private key in privkey_file, and encrypting the private key with passphrase.
Returns 1 on success, 0 on error.
  • pubkey_file = The name of the file in which the generated public key is stored
  • privkey_file = The name of the file in which the generated private key is stored
  • bits = The RSA modulus size, in bits
  • e = The public key exponent. Must be an odd number, typically 3, 17 or 65537
  • passphrase = The passphrase used to encrypt the private key
rsa_generate_keypair_mem
rsa_generate_keypair_mem( pubkey var, privkey var, bits, e, passphrase )
Generates an RSA keypair, returning the public and private keys in variables, and encrypting the private key with passphrase.
Returns 1 on success, 0 on error.
  • pubkey = The variable which receives the generated public key
  • privkey = The variable which receives the generated private key
  • bits = The RSA modulus size, in bits
  • e = The public key exponent. Must be an odd number, typically 3, 17 or 65537
  • passphrase = The passphrase used to encrypt the private key
rsa_generate_keypair_mem_cipher
rsa_generate_keypair_mem_cipher( pubkey var, privkey var, bits, e, passphrase, ciphername )
Behaves identical to the legacy counterpart rsa_generate_keypair_mem() except that it allows the caller to specify the cipher used to encrypt the private key (the legacy function always uses des-ede3-cbc).
Returns 1 on success or 0 on error.
  • pubkey = The variable which receives the generated public key
  • privkey = The variable which receives the generated private key
  • bits = The RSA modulus size, in bits
  • e = The public key exponent. Must be an odd number, typically 3, 17 or 65537
  • passphrase = The passphrase used to encrypt the private key
  • ciphername = an OpenSSL cipher identifier, such as "aes-128-cbc"
rsa_load_privatekey
rsa_load_privatekey( privkey_file, rsa var, passphrase )
Load an encrypted RSA private key from a PKCS#8 file specified by privkey_file, and decrypt it using passphrase.
Returns 1 on success, 0 on error.
  • privkey_file = The name of the file containing the encrypted private key
  • rsa = A variable which receives an internal reference to the loaded RSA key
  • passphrase = The passphrase used to decrypt the private key
rsa_load_privatekey_engine
rsa_load_privatekey_engine( engine, key_id, rsa var )
Load an encryption key based on a key id.
Return value: 1 on success, 0 on failure.
  • engine = Name of the encryption engine to use.
  • key_id = identifier of the key to load
  • rsa = RSA private key associated with the engine and key ID.
rsa_load_privatekey_mem
rsa_load_privatekey_mem( privkey, rsa var, passphrase )
Loads an encrypted RSA private key from a memory buffer containing PKCS#8 data
Returns 1 on success, 0 on error.
  • privkey = The encrypted private key information in PKCS#8 format
  • rsa = A variable which receives an internal reference to the loaded RSA key
  • passphrase = The passphrase used to decrypt the private key
rsa_load_publickey
rsa_load_publickey( pubkey_file, rsa var )
Load an RSA public key from a PKCS#1 file specified by "pubkey_file".
Returns 1 on success, 0 on error.
  • pubkey_file = The name of the file containing the public key
  • rsa = A variable which receives an internal reference to the loaded RSA key
rsa_load_publickey_engine
rsa_load_publickey_engine( engine, key_id, rsa var )
Load an encryption key based on a key id.
Return value: 1 on success, 0 on failure.
  • engine = Name of the encryption engine to use.
  • key_id = identifier of the key to load
  • rsa = RSA public key associated with the engine and key ID.
rsa_load_publickey_mem
rsa_load_publickey_mem( pubkey, rsa var )
Loads an RSA public key from a memory buffer containing PKCS#1 data
Returns 1 on success, 0 on error.
  • pubkey = The public key in PKCS#1 format
  • rsa = A variable which receives an internal reference to the loaded RSA key
rsa_private_decrypt
rsa_private_decrypt( rsa, encrypted, plaintext var )
Decrypts data previously encrypted using the public key portion of an RSA keypair.
Returns 1 on success, 0 on error.
  • rsa = The internal reference to the RSA private key used for decryption
  • encrypted = The encrypted ciphertext, in raw binary format
  • plaintext = A variable which receives the decrypted plaintext
rsa_private_encrypt
rsa_private_encrypt( rsa, plaintext, encrypted var )
Encrypts data using the private key portion of an RSA keypair.
Returns 1 on success, 0 on error.
  • rsa = The internal reference to the RSA private key used for encryption
  • plaintext = The data to be encrypted
  • encrypted = A variable which receives the encrypted ciphertext in raw binary format
rsa_public_decrypt
rsa_public_decrypt( rsa, encrypted, plaintext var )
Decrypts data previously encrypted using the private key portion of an RSA keypair.
Returns 1 on success, 0 on error.
  • rsa = The internal reference to the RSA public key used for decryption
  • encrypted = The encrypted ciphertext, in raw binary format
  • plaintext = A variable which receives the decrypted plaintext
rsa_public_encrypt
rsa_public_encrypt( rsa, plaintext, encrypted var )
Encrypts data using the public key portion of an RSA keypair.
Returns 1 on success, 0 on error.
  • rsa = The internal reference to the RSA public key used for encryption
  • plaintext = The data to be encrypted
  • encrypted = A variable which receives the encrypted ciphertext in raw binary format
rsa_save_privatekey
rsa_save_privatekey( privkey_file, rsa var, passphrase )
Encrypts and writes a previously loaded RSA private key to a file in PKCS#8 format
Returns 1 on success, 0 on error.
  • privkey_file = The name of the file in which the private key is to be stored
  • rsa = The internal reference to the RSA private key to be saved
  • passphrase = The passphrase used to encrypt the private key
rsa_save_privatekey_mem
rsa_save_privatekey_mem( privkey var, rsa var, passphrase )
Encrypts a previously loaded RSA private key and stores it into a variable in PKCS#8 format
Returns 1 on success, 0 on error.
  • privkey = The variable which will receive the encrypted private key
  • rsa = The internal reference to the RSA private key to be saved
  • passphrase = The passphrase used to encrypt the private key
rsa_save_privatekey_mem_cipher
rsa_save_privatekey_mem_cipher( privkey var, rsa var, passphrase, ciphername )
Behaves identical to the legacy counterpart rsa_save_privatekey_mem() except that it allows the caller to specify the cipher used to encrypt the private key (the legacy function always uses des-ede3-cbc).
  • ciphername = an OpenSSL cipher identifier that specifies the cipher to be used. Note that OpenSSL only permits a subset of its supported ciphers to be used for RSA key encryption. For example, only CBC mode ciphers are permitted.
rsa_sign
rsa_sign( rsa, buffer, signature var )
Generates a digital signature using SHA1 and an RSA private key
Returns 1 on success, 0 on failure. Requires OpenSSL 0.9.7 or greater.
  • rsa = The internal reference to the RSA private key to be used
  • buffer = The data to be signed
  • signature = A variable which receives the signature in raw binary format
rsa_verify
rsa_verify( rsa, buffer, signature )
Verifies a digital signature previously generated by rsa_sign
Returns 1 on success, 0 on verification failure or error. Requires OpenSSL 0.9.7 or greater.
  • rsa = The internal reference to the RSA public key used for verification
  • buffer = The data for which the signature is to be verified
  • signature = The signature to verify, in raw binary format
rtrim
rtrim( string )
Returns a copy of string with all space characters removed from the right end. ⇨ Version 5.32. Will now trim whitespace from arrays and structures. Previously the functions would convert arrays and structures to serialized data and then trim it. Arrays and structures are now iterated and all values within are trimmed appropriately.
schmod
schmod( path, mode )
Changes a files or directory permissions.
Returns 1 if sucessful, 0 if fails
  • path = fully qualified path to the file
  • mode_number = ( nnnn decimal number) or '0nnnn' (octal string)
scopy
scopy( source, destination )
Copies a file in the scripts directory.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
sdelete
sdelete( path )
Deletes a file in the scripts directory. See See fdelete()
Returns 1 if sucessful, 0 if fails
  • path = fully qualified path of the file to delete
sexists
sexists( path )
Tests if the file named in path exists in the scripts directory.
Returns 1 if the file exsists else 0.
  • path = the fully qualified path to the file.
sfcopy
sfcopy( source, destination )
Copies a file from the scripts directory to the data directory.
Returns 1 if sucessful, 0 if fails
  • scripts_source = source file fully qualified path in the scripts folder
  • data_destination = destination file fully qualified path in the data folder
sfrename
sfrename( source, destination )
Rename source file to destination file. Can rename or move a file in the scripts directory.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
sfsymlink
sfsymlink( source, destination )
This function creates a symbolic from a file in the scripts directory to the data directory (Available on UNIX file systems only)
Returns 1 if sucessful, 0 if fails
  • source - source file fully qualified path in the scripts directory
  • destination = destination file fully qualified path in the data directory
sin
sin( number )
Returns the sine of number. The argument should be expressed in radians.
sinh
sinh( number )
Returns the hyperbolic sine of number. The argument should be expressed in radians.
sisdir
sisdir( path )
Tests if the file named in path is a directory.
Returns 1 if the path is a directory else 0.
  • path = the fully qualified path to the directory
slugify
slugify( data )
Use this function to create friendly (human-readable) URLs. It takes characters that are forbidden in URIs and either converts them to a valid ASCII character or remove them completely. It adds a hyphen (-) in place of all space characters. For example, the product "Dodger Blue Baseball Hat!" becomes "Dodger-Blue-Baseball-Hat" which is now URI friendly.
A URL friendly string.
smkdir
smkdir( path )
Creates a directory specified by path in the scripts directory.
Returns 1 if sucessful, 0 if fails
  • path = the fully qualified path to the directory
smode
smode( path )
Returns the permissions mode of path in the scripts directory.
Returns the permissions mode or -1 if the file does not exist
  • path = the fully qualified path to the file or directory
sqrt
sqrt( number )
Returns the square root of number.
srandom
srandom( seed )
Allows a script to reseed the random number generator used by random()
srename
srename( source, destination )
Rename source file to destination file. Can rename or move a file in the scripts directory.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
ssize
ssize( path )
Get the size of a file in the scripts directory
Returns the file size in bytes or -1 if the file does not exist.
  • path = the fully qualified path to the file
ssymlink
ssymlink( source, destination )
(Unix only) Creates a symbolic link to the file in the scripts directory.
Returns 1 if sucessful, 0 if fails
  • source = source file fully qualified path
  • destination = destination file fully qualified path
stime
stime( path )
Gets the last modified time for the file in scripts directory.
Returns time_t since a file in the was last modified or -1 if the file does not exist.
  • path = the fully qualified path to the file
substring
substring( string, position, length )
Returns the substring of string, beginning at position start, length characters long.
substring_var
substring_var( string var, position, length )
Returns the substring of string, beginning at position start, length characters long. This function is identical to substring() but its first parameter is passed by reference, improving performance when dealing with large strings.
tan
tan( number )
Returns the tangent of number. The argument should be expressed in radians.
tanh
tanh( number )
Returns the hyperbolic tangent of number. The argument should be expressed in radians.
tar_create
tar_create( file, file_loc, dir, dir_loc, flags )
Creates a compressed Unix style tar file.
Return 1 on success 0 on failure
  • file = target output file
  • location = location of the output file - 'data' or 'script'
  • dir = source directory to create a tarball of
  • dir_loc = location of the source file - 'data' or 'script' defaulting to data
  • flags = may be an empty string or 'compress' which will cause the output .tar file to be bzip2 encoded.
tar_directory
tar_directory( file, location, desc var )
Return information about a tar file.
Number of files in output array, 0 on error
  • filepath = File name and path within the location
  • location = Either "script" or "data". Anything else defaults to "data".
  • desc (out) = An array of structures, one array element for each item in the tar file, with the following members assigned:
  • NAME: Text
tar_extract
tar_extract( file, file_loc, dir, dir_loc )
Unpacks a tar file to a specified directory.
Returns 1 on success 0 on failure
  • file = the path and file name
  • tar_location = source 'data' or 'script'
  • dir = destination directory to extract the tar file to
  • dir_location = destination 'data' or 'script'
timezone
timezone()
Returns an integer which is the number of hours behind or ahead of GMT (not accounting for Daylight Time)
time_t_dayofmonth
time_t_dayofmonth( time_t, time_zone )
Returns the current day of the month as a number. The time_zone parameter can be the keyword 'local' which uses the server timezone.
time_t_dayofweek
time_t_dayofweek( time_t, time_zone )
Returns the current day of the week as a number (Sunday=1). time_zone can be the keyword 'local'
time_t_dayofyear
time_t_dayofyear( time_t, time_zone )
Returns the number of days since the beginning of the year, including today. time_zone can be the keyword 'local'
time_t_hour
time_t_hour( time_t, time_zone )
Returns current hour (using a 24-hour clock). time_zone can be the keyword 'local'
time_t_min
time_t_min( time_t, time_zone )
Returns the current minute in the hour. time_zone can be the keyword 'local'
time_t_month
time_t_month( time_t, time_zone )
Returns the current month as a number. time_zone can be the keyword 'local'
time_t_sec
time_t_sec( time_t, time_zone )
Returns the current second in the minute. time_zone can be the keyword 'local'
time_t_year
time_t_year( time_t, time_zone )
Returns the current year, time_zone can be the keyword 'local'
tokenize
tokenize( string, variables )
Returns the string, concatenated with the value of each token contained in replacements. Replacements is an array of structures, each with a token and a value.
tolower
tolower( string )
Returns a copy of string in lower case.
toupper
toupper( string )
Returns a copy of string in upper case.
trim
trim( string )
Returns the value of string with leading and trailing spaces removed. ⇨ Version 5.32. Will now trim whitespace from arrays and structures. Previously the functions would convert arrays and structures to serialized data and then trim it. Arrays and structures are now iterated and all values within are trimmed appropriately.
wdownload
wdownload( url, filepath, location, callback, callbackdata var )
Downloads and stores a file from a URL. Acts as a front end to wget()
Returns -1 if fails, returns the server response code: Possible examples 200 = success, 301 = moved, 404 = not found.
  • url = file to retrieve
  • filepath = where destination file should be stored
  • location = destination 'data' or 'script'.callback_fn = the name of a callback function in current Miva Script file
  • callback_fn( size, total, data var ): a user defined user function that returns 1 to continue, 0 to abort.
  • callbackdata var = opaque data that is passed as the data parameter to each call of callback_fn
wget
wget( url, filepath, location )
Downloads and stores a file from a URL. Note: If an error occurs, the error message will be stored instead.
Returns -1 if fails, returns the server response code: Possible examples 200 = success, 301 = moved, 404 = not found.
  • url = file to retrieve
  • filepath = where destination file should be stored
  • location = destination 'data' or 'script'.
x509_create
x509_create( cert, x509 var )
Create an X509 Certificate from the PEM format data in "cert" where cert = PEM format certificate, x509 =Index into an internal array of certificates.
Returns 1 on sucess, 0 on error.
x509_digest
x509_digest( x509 var, digestname, digest var )
Return the digest of the given certificate referred to by the certificate reference, using the specified hash algorithm.
Returns 1 on success, 0 on failure
  • x509 = Certificate reference returned from functions such as x509_load_mem
  • digestname = Hash algorithm name, such as "md5" or "sha256". Supported digest algorithms will vary between OpenSSL installations
  • digest = Hash value of the certificate
x509_free
x509_free( rsa var )
Deletes an x509 from the internal array of x509 certificates where x509 = Index into internal array of x509 certificates.
Returns 1 on success, 0 on error.
x509_get_extensions
x509_get_extensions( certref var, extensions var )
Return X509 extension information for the certificate referred to by the certificate reference.
Returns 1 on success, 0 on failure
  • certref = Certificate reference returned from functions such as x509_load_mem
  • extensions = Structure with members named for the entry names (e.g., "data", "oid", etc.)
x509_get_issuer_name
x509_get_issuer_name( certref var, issuername var )
Return X509 issuer information for the certificate referred to by the certificate reference.
Returns 1 on success, 0 on failure
  • certref = Certificate reference returned from functions such as x509_load_mem
  • issuername = Structure with members named for the entry names (e.g., "commonName", "countryName", etc.)
x509_get_subject_name
x509_get_subject_name( certref var, subjectname var )
Return X509 name information for the certificate referred to by the certificate reference.
Returns 1 on success, 0 on failure
  • certref = Certificate reference returned from functions such as x509_load_mem
  • subjectname = Structure with members named for the entry names (e.g., "commonName", "countryName", etc.)
x509_load
x509_load( cert, x509 var )
Load an X509 Certificate from the file specified by "cert" where cert = File containing an x509 certificate, x509 = Index into an internal array of certificates.
Returns 1 on sucess, 0 on error.
x509_load_mem
x509_load_mem( cert, x509 var )
Loads and parses the text of an x509 certificate, and gives a certificate reference that refers to the certificate in internal storage.
Returns 1 on success, 0 on failure
  • cert = Text of the certificate
  • x509 = Certificate reference. On success, this will be neither zero nor null
x509_pubkey_digest
x509_pubkey_digest( x509 var, digestname, digest var )
Return the digest of the public key portion of the given certificate referred to by the certificate reference, using the specified hash algorithm.
Returns 1 on success, 0 on failure
  • x509 = Certificate reference returned from functions such as x509_load_mem
  • digestname = Hash algorithm name, such as "md5" or "sha256". Supported digest algorithms will vary between OpenSSL installations
  • digest = Hash value of the public key of the certificate
x509_rsa_publickey
x509_rsa_publickey( x509 var, rsa var )
Extracts the RSA public key from the X509 specified by "x509" and stores it in "rsa" where x509 = Index into internal array of x509 certificates, rsa =Index into internal array of RSA public keys.
Returns 1 on success, 0 on error.
x509_verify
x509_verify( x509 var, trusted_certs )
Verifies that the X509 certificate specified by "x509" was issued by one of the X509 certificates (in PEM format) in "trusted_certs", where x509 = Index into internal array of certificates, trusted_certs = Certificates (in PEM text format) to find the x50
Returns 1 on successful find, 0 if certificate isn't in trusted_certs, or other error.
xml_parse
xml_parse( filepath, location, output var )
Parces an XML file.
Returns 1 on success, 0 on error
  • filepath = Location of the file to parse
  • location = either 'script' or 'data'
  • output = xml file parsed into an aggregate structure defined below:
    The variable has one structure member with the name of the root tag as the member name.
xml_parse_error
xml_parse_error( lineno var, error var )
Retrieves error information for xml_parse(), xml_parse_section(), and xml_parse_section_init()
Returns null
  • lineno = line number of the XML file the error occurred (if applicable)
  • errortext = text of the error
xml_parse_section
xml_parse_section( output var, eof var )
Return a section of XML
Returns 1 on success, 0 on failure.
  • output = Parsed XML output, same format as xml_parse()
  • eof = boolean "end of file".
xml_parse_section_getstate
xml_parse_section_getstate( target var )
Retrieves parse state information from a xml_parse_section session.
Returns 1 on success, 0 on failure.
  • target = output aggregate
xml_parse_section_init
xml_parse_section_init( filepath, location, level )
Initializes a xml_parse_section session.
Returns 1 on success, 0 on failure.
  • filepath = source file path (same as xml_parse)
  • location = 'script' or 'data'
  • level = level (not including the root) to return a "section" of parsed XML output.
xml_parse_section_setstate
xml_parse_section_setstate( source var )
Sets internal parse state information for a xml_parse_section session.
Returns 1 on success, 0 on failure.
  • source = input aggregate
xml_parse_set_colon_replacement
xml_parse_set_colon_replacement( colon )
xml_parse_var
xml_parse_var( var var, output var )
file_overwrite
file_overwrite( path, location, data var )
Replaces the file in path if it exists. If will not create the file if it does not exist.
Returns the length of data written or -1 on error
  • path = fully qualified path to the file
  • location = 'data' or 'script'
  • data = string variable containing the data to write
miva_joinstring
miva_joinstring( input var, join_with, flags )
Joins a simple array and outputs a string seperated by the join_with character or characters. If the input parameter is an array, then a string is returned with each array element's value separated by the join_with parameter along with any modifications made via the flags parameter. If the input parameter is a string, then a string is returned alongside any modifications made via the flags parameter. If the input parameter is a structure, an empty string is returned
Returns : The joined string.
  • input = The input string, variable or simple array.
  • join_with = The string that will seperate array elements
  • flags = A comma separated list of any of the following keywords escape : Escapes the join_with characters. If the join_with characters exists in the elements value. insensitive : When combined with the escape flag, it will search for the join_with characters in an insensitive fashion.
file_set_time
file_set_time( path, location, modified )
Updates the modification time of the specified file to the time_t value in modified.
Return value: 0 on success, -1 on failure.
  • path = complete path and file name.
  • location = File location. "script" or "data", defaulting to "data" if any other value.
  • modified = the time_t timestamp value.
crypto_next_error
crypto_next_error()
A string value containing the appropriate crypto error
  • Parameters: None
crypto_clear_error
crypto_clear_error()
Clear out all crypto errors.
  • Parameters: None
crypto_evp_sign
crypto_evp_sign( digestname, privkey, buffer, signature var )
1 on success, 0 on failure
  • digestname = Hash algorithm name, such as "md5" or "sha256". Supported digest algorithms will vary between OpenSSL installations
  • privkey = EVP PKEY structure reference
  • buffer = The data to sign
  • signature = The signed output signature
crypto_evp_verify
crypto_evp_verify( digestname, pubkey, buffer, signature )
1 on success, 0 on failure
  • digestname - Hash algorithm name, such as "md5" or "sha256". Supported digest algorithms will vary between OpenSSL installations
  • pubkey - EVP PKEY structure reference
  • buffer - The data to verify
  • signature - The signature to verify
evp_pkey_load_pubkey_x509
evp_pkey_load_pubkey_x509( x509 var, pkey var )
Loads a PKEY reference from an x509 public key reference
1 on success, 0 on failure
  • x509 = Certificate reference returned from functions such as x509_load_mem
  • pkey = Structure reference
redis_connect
redis_connect( ip, port, conn_id var )
Connects to Redis on the specified IP / hostname and port.
Returns 1 on success, 0 on failure
  • ip / hostname = The IP address or hostname of the server Redis is on
  • port = The port number to connect on
  • conn_id = An output value containing an reference ID which is associated to the internal Redis connection.
redis_disconnect
redis_disconnect( conn_id )
Disconnects the specified instance from the Redis server
Returns 1 on success, 0 on failure
  • conn_id = The internal reference ID
redis_last_error
redis_last_error()
Gets the last error message resulting from a redis command.
Returns the last error message.
redis_append
redis_append( conn_id, key, value )
View documentation on redis.io: redis_append(...)
redis_auth
redis_auth( conn_id, password )
View documentation on redis.io: redis_auth(...)
redis_bgsave
redis_bgsave( conn_id )
View documentation on redis.io: redis_bgsave(...)
redis_bitcount
redis_bitcount( conn_id, key, options var )
View documentation on redis.io: redis_bitcount(...)
redis_bitfield
redis_bitfield( conn_id, key, options var, output var )
View documentation on redis.io: redis_bitfield(...)
redis_bitop
redis_bitop( conn_id, operation, destkey, key )
View documentation on redis.io: redis_bitop(...)
redis_bitpos
redis_bitpos( conn_id, key, bit, options var )
View documentation on redis.io: redis_bitpos(...)
redis_blpop
redis_blpop( conn_id, key, timeout, output var )
View documentation on redis.io: redis_blpop(...)
redis_brpop
redis_brpop( conn_id, key, timeout, output var )
View documentation on redis.io: redis_brpop(...)
redis_brpoplpush
redis_brpoplpush( conn_id, source, destination, timeout )
View documentation on redis.io: redis_brpoplpush(...)
redis_client_getname
redis_client_getname( conn_id )
View documentation on redis.io: redis_client_getname(...)
redis_client_kill
redis_client_kill( conn_id, options var )
View documentation on redis.io: redis_client_kill(...)
redis_client_list
redis_client_list( conn_id )
View documentation on redis.io: redis_client_list(...)
redis_client_pause
redis_client_pause( conn_id, timeout )
View documentation on redis.io: redis_client_pause(...)
redis_client_setname
redis_client_setname( conn_id, name )
View documentation on redis.io: redis_client_setname(...)
redis_command
redis_command( conn_id, output var )
View documentation on redis.io: redis_command(...)
redis_command_count
redis_command_count( conn_id )
View documentation on redis.io: redis_command_count(...)
redis_command_getkeys
redis_command_getkeys( conn_id, input var, output var )
View documentation on redis.io: redis_command_getkeys(...)
redis_command_info
redis_command_info( conn_id, command_name, output var )
View documentation on redis.io: redis_command_info(...)
redis_config_get
redis_config_get( conn_id, parameter, output var )
View documentation on redis.io: redis_config_get(...)
redis_config_resetstat
redis_config_resetstat( conn_id )
View documentation on redis.io: redis_config_resetstat(...)
redis_config_rewrite
redis_config_rewrite( conn_id )
View documentation on redis.io: redis_config_rewrite(...)
redis_config_set
redis_config_set( conn_id, parameter, value )
View documentation on redis.io: redis_config_set(...)
redis_dbsize
redis_dbsize( conn_id )
View documentation on redis.io: redis_dbsize(...)
redis_debug_object
redis_debug_object( conn_id, key )
View documentation on redis.io: redis_debug_object(...)
redis_debug_segfault
redis_debug_segfault( conn_id )
View documentation on redis.io: redis_debug_segfault(...)
redis_decr
redis_decr( conn_id, key )
View documentation on redis.io: redis_decr(...)
redis_decrby
redis_decrby( conn_id, key, decrement )
View documentation on redis.io: redis_decrby(...)
redis_del
redis_del( conn_id, key )
View documentation on redis.io: redis_del(...)
redis_discard
redis_discard( conn_id )
View documentation on redis.io: redis_discard(...)
redis_dump
redis_dump( conn_id, key )
View documentation on redis.io: redis_dump(...)
redis_echo
redis_echo( conn_id, message )
View documentation on redis.io: redis_echo(...)
redis_eval
redis_eval( conn_id, script, key, arg )
View documentation on redis.io: redis_eval(...)
redis_eval_array
redis_eval_array( conn_id, script, key, arg, output var )
View documentation on redis.io: redis_eval_array(...)
redis_evalsha
redis_evalsha( conn_id, sha1, key, arg )
View documentation on redis.io: redis_evalsha(...)
redis_evalsha_array
redis_evalsha_array( conn_id, sha1, key, arg, output var )
View documentation on redis.io: redis_evalsha_array(...)
redis_exec
redis_exec( conn_id, output var )
View documentation on redis.io: redis_exec(...)
redis_exists
redis_exists( conn_id, key )
View documentation on redis.io: redis_exists(...)
redis_expire
redis_expire( conn_id, key, seconds )
View documentation on redis.io: redis_expire(...)
redis_expireat
redis_expireat( conn_id, key, timestamp )
View documentation on redis.io: redis_expireat(...)
redis_flushall
redis_flushall( conn_id )
View documentation on redis.io: redis_flushall(...)
redis_flushdb
redis_flushdb( conn_id )
View documentation on redis.io: redis_flushdb(...)
redis_geoadd
redis_geoadd( conn_id, key, longitude, latitude, member )
View documentation on redis.io: redis_geoadd(...)
redis_geodist
redis_geodist( conn_id, key, member1, member2, options var )
View documentation on redis.io: redis_geodist(...)
redis_geohash
redis_geohash( conn_id, key, member, output var )
View documentation on redis.io: redis_geohash(...)
redis_geopos
redis_geopos( conn_id, key, member, output var )
View documentation on redis.io: redis_geopos(...)
redis_georadius
redis_georadius( conn_id, key, longitude, latitude, radius, unit, options var, output var )
View documentation on redis.io: redis_georadius(...)
redis_georadiusbymember
redis_georadiusbymember( conn_id, key, member, radius, unit, options var, output var )
View documentation on redis.io: redis_georadiusbymember(...)
redis_georadiusbymemberstore
redis_georadiusbymemberstore( conn_id, key, member, latitude, radius, unit, store_key )
View documentation on redis.io: redis_georadiusbymemberstore(...)
redis_georadiusbymemberstoredist
redis_georadiusbymemberstoredist( conn_id, key, member, latitude, radius, unit, storedist_key )
View documentation on redis.io: redis_georadiusbymemberstoredist(...)
redis_georadiusstore
redis_georadiusstore( conn_id, key, longitude, latitude, radius, unit, store_key, count )
View documentation on redis.io: redis_georadiusstore(...)
redis_georadiusstoredist
redis_georadiusstoredist( conn_id, key, longitude, latitude, radius, unit, storedist_key, count )
View documentation on redis.io: redis_georadiusstoredist(...)
redis_get
redis_get( conn_id, key )
View documentation on redis.io: redis_get(...)
redis_getbit
redis_getbit( conn_id, key, offset )
View documentation on redis.io: redis_getbit(...)
redis_getrange
redis_getrange( conn_id, key, start, end )
View documentation on redis.io: redis_getrange(...)
redis_getset
redis_getset( conn_id, key, value )
View documentation on redis.io: redis_getset(...)
redis_hdel
redis_hdel( conn_id, key, field )
View documentation on redis.io: redis_hdel(...)
redis_hexists
redis_hexists( conn_id, key, field )
View documentation on redis.io: redis_hexists(...)
redis_hget
redis_hget( conn_id, key, field )
View documentation on redis.io: redis_hget(...)
redis_hgetall
redis_hgetall( conn_id, key, output var )
View documentation on redis.io: redis_hgetall(...)
redis_hincrby
redis_hincrby( conn_id, key, field, increment )
View documentation on redis.io: redis_hincrby(...)
redis_hincrbyfloat
redis_hincrbyfloat( conn_id, key, field, increment )
View documentation on redis.io: redis_hincrbyfloat(...)
redis_hkeys
redis_hkeys( conn_id, key, output var )
View documentation on redis.io: redis_hkeys(...)
redis_hlen
redis_hlen( conn_id, key )
View documentation on redis.io: redis_hlen(...)
redis_hmget
redis_hmget( conn_id, key, field, output var )
View documentation on redis.io: redis_hmget(...)
redis_hmset
redis_hmset( conn_id, key, field, value )
View documentation on redis.io: redis_hmset(...)
redis_hscan
redis_hscan( conn_id, key, cursor, options var, output var )
View documentation on redis.io: redis_hscan(...)
redis_hset
redis_hset( conn_id, key, field, value )
View documentation on redis.io: redis_hset(...)
redis_hsetnx
redis_hsetnx( conn_id, key, field, value )
View documentation on redis.io: redis_hsetnx(...)
redis_hstrlen
redis_hstrlen( conn_id, key, field )
View documentation on redis.io: redis_hstrlen(...)
redis_hvals
redis_hvals( conn_id, key, output var )
View documentation on redis.io: redis_hvals(...)
redis_incr
redis_incr( conn_id, key )
View documentation on redis.io: redis_incr(...)
redis_incrby
redis_incrby( conn_id, key, increment )
View documentation on redis.io: redis_incrby(...)
redis_incrbyfloat
redis_incrbyfloat( conn_id, key, increment )
View documentation on redis.io: redis_incrbyfloat(...)
redis_info
redis_info( conn_id )
View documentation on redis.io: redis_info(...)
redis_info_section
redis_info_section( conn_id, section )
View documentation on redis.io: redis_info_section(...)
redis_keys
redis_keys( conn_id, pattern, output var )
View documentation on redis.io: redis_keys(...)
redis_lastsave
redis_lastsave( conn_id )
View documentation on redis.io: redis_lastsave(...)
redis_lindex
redis_lindex( conn_id, key, index )
View documentation on redis.io: redis_lindex(...)
redis_linsert_after
redis_linsert_after( conn_id, key, pivot, value )
View documentation on redis.io: redis_linsert_after(...)
redis_linsert_before
redis_linsert_before( conn_id, key, pivot, value )
View documentation on redis.io: redis_linsert_before(...)
redis_llen
redis_llen( conn_id, key )
View documentation on redis.io: redis_llen(...)
redis_lpop
redis_lpop( conn_id, key )
View documentation on redis.io: redis_lpop(...)
redis_lpush
redis_lpush( conn_id, key, value )
View documentation on redis.io: redis_lpush(...)
redis_lpushx
redis_lpushx( conn_id, key, value )
View documentation on redis.io: redis_lpushx(...)
redis_lrange
redis_lrange( conn_id, key, start, stop, output var )
View documentation on redis.io: redis_lrange(...)
redis_lrem
redis_lrem( conn_id, key, count, value )
View documentation on redis.io: redis_lrem(...)
redis_lset
redis_lset( conn_id, key, index, value )
View documentation on redis.io: redis_lset(...)
redis_ltrim
redis_ltrim( conn_id, key, start, stop )
View documentation on redis.io: redis_ltrim(...)
redis_mget
redis_mget( conn_id, key, output var )
View documentation on redis.io: redis_mget(...)
redis_migrate
redis_migrate( conn_id, host, port, key, destination_db, timeout, options var )
View documentation on redis.io: redis_migrate(...)
redis_move
redis_move( conn_id, key, db )
View documentation on redis.io: redis_move(...)
redis_mset
redis_mset( conn_id, key, value )
View documentation on redis.io: redis_mset(...)
redis_msetnx
redis_msetnx( conn_id, key, value )
View documentation on redis.io: redis_msetnx(...)
redis_multi
redis_multi( conn_id )
View documentation on redis.io: redis_multi(...)
redis_object_encoding
redis_object_encoding( conn_id, key )
View documentation on redis.io: redis_object_encoding(...)
redis_object_idletime
redis_object_idletime( conn_id, key )
View documentation on redis.io: redis_object_idletime(...)
redis_object_refcount
redis_object_refcount( conn_id, key )
View documentation on redis.io: redis_object_refcount(...)
redis_persist
redis_persist( conn_id, key )
View documentation on redis.io: redis_persist(...)
redis_pexpire
redis_pexpire( conn_id, key, milliseconds )
View documentation on redis.io: redis_pexpire(...)
redis_pexpireat
redis_pexpireat( conn_id, key, milliseconds_timestamp )
View documentation on redis.io: redis_pexpireat(...)
redis_pfadd
redis_pfadd( conn_id, key, element )
View documentation on redis.io: redis_pfadd(...)
redis_pfcount
redis_pfcount( conn_id, key )
View documentation on redis.io: redis_pfcount(...)
redis_pfmerge
redis_pfmerge( conn_id, destkey, sourcekey )
View documentation on redis.io: redis_pfmerge(...)
redis_ping
redis_ping( conn_id )
View documentation on redis.io: redis_ping(...)
redis_ping_message
redis_ping_message( conn_id, message )
View documentation on redis.io: redis_ping_message(...)
redis_pttl
redis_pttl( conn_id, key )
View documentation on redis.io: redis_pttl(...)
redis_quit
redis_quit( conn_id )
View documentation on redis.io: redis_quit(...)
redis_randomkey
redis_randomkey( conn_id )
View documentation on redis.io: redis_randomkey(...)
redis_rename
redis_rename( conn_id, key, newkey )
View documentation on redis.io: redis_rename(...)
redis_renamenx
redis_renamenx( conn_id, key, newkey )
View documentation on redis.io: redis_renamenx(...)
redis_restore
redis_restore( conn_id, key, ttl, serialized_value, options var )
View documentation on redis.io: redis_restore(...)
redis_role
redis_role( conn_id, output var )
View documentation on redis.io: redis_role(...)
redis_rpop
redis_rpop( conn_id, key )
View documentation on redis.io: redis_rpop(...)
redis_rpoplpush
redis_rpoplpush( conn_id, source, destination )
View documentation on redis.io: redis_rpoplpush(...)
redis_rpush
redis_rpush( conn_id, key, value )
View documentation on redis.io: redis_rpush(...)
redis_rpushx
redis_rpushx( conn_id, key, value )
View documentation on redis.io: redis_rpushx(...)
redis_sadd
redis_sadd( conn_id, key, member )
View documentation on redis.io: redis_sadd(...)
redis_save
redis_save( conn_id )
View documentation on redis.io: redis_save(...)
redis_scan
redis_scan( conn_id, cursor, options var, output var )
View documentation on redis.io: redis_scan(...)
redis_scard
redis_scard( conn_id, key )
View documentation on redis.io: redis_scard(...)
redis_script_exists
redis_script_exists( conn_id, sha1, output var )
View documentation on redis.io: redis_script_exists(...)
redis_script_flush
redis_script_flush( conn_id )
View documentation on redis.io: redis_script_flush(...)
redis_script_kill
redis_script_kill( conn_id )
View documentation on redis.io: redis_script_kill(...)
redis_script_load
redis_script_load( conn_id, script )
View documentation on redis.io: redis_script_load(...)
redis_sdiff
redis_sdiff( conn_id, key, output var )
View documentation on redis.io: redis_sdiff(...)
redis_sdiffstore
redis_sdiffstore( conn_id, destination, key )
View documentation on redis.io: redis_sdiffstore(...)
redis_select
redis_select( conn_id, index )
View documentation on redis.io: redis_select(...)
redis_set
redis_set( conn_id, key, value, options var )
View documentation on redis.io: redis_set(...)
redis_setbit
redis_setbit( conn_id, key, offset, value )
View documentation on redis.io: redis_setbit(...)
redis_setrange
redis_setrange( conn_id, key, offset, value )
View documentation on redis.io: redis_setrange(...)
redis_shutdown
redis_shutdown( conn_id )
View documentation on redis.io: redis_shutdown(...)
redis_shutdown_nosave
redis_shutdown_nosave( conn_id )
View documentation on redis.io: redis_shutdown_nosave(...)
redis_shutdown_save
redis_shutdown_save( conn_id )
View documentation on redis.io: redis_shutdown_save(...)
redis_sinter
redis_sinter( conn_id, key, output var )
View documentation on redis.io: redis_sinter(...)
redis_sinterstore
redis_sinterstore( conn_id, destination, key )
View documentation on redis.io: redis_sinterstore(...)
redis_sismember
redis_sismember( conn_id, key, member )
View documentation on redis.io: redis_sismember(...)
redis_slowlog_get
redis_slowlog_get( conn_id, output var )
View documentation on redis.io: redis_slowlog_get(...)
redis_slowlog_get_count
redis_slowlog_get_count( conn_id, count, output var )
View documentation on redis.io: redis_slowlog_get_count(...)
redis_slowlog_len
redis_slowlog_len( conn_id )
View documentation on redis.io: redis_slowlog_len(...)
redis_slowlog_reset
redis_slowlog_reset( conn_id )
View documentation on redis.io: redis_slowlog_reset(...)
redis_smembers
redis_smembers( conn_id, key, output var )
View documentation on redis.io: redis_smembers(...)
redis_smove
redis_smove( conn_id, source, destination, member )
View documentation on redis.io: redis_smove(...)
redis_sort
redis_sort( conn_id, key, options var, output var )
View documentation on redis.io: redis_sort(...)
redis_sortstore
redis_sortstore( conn_id, key, destination, options var )
View documentation on redis.io: redis_sortstore(...)
redis_spop
redis_spop( conn_id, key )
View documentation on redis.io: redis_spop(...)
redis_spop_count
redis_spop_count( conn_id, key, count, output var )
View documentation on redis.io: redis_spop_count(...)
redis_srandmember
redis_srandmember( conn_id, key )
View documentation on redis.io: redis_srandmember(...)
redis_srandmember_count
redis_srandmember_count( conn_id, key, count, output var )
View documentation on redis.io: redis_srandmember_count(...)
redis_srem
redis_srem( conn_id, key, member )
View documentation on redis.io: redis_srem(...)
redis_sscan
redis_sscan( conn_id, key, cursor, options var, output var )
View documentation on redis.io: redis_sscan(...)
redis_strlen
redis_strlen( conn_id, key )
View documentation on redis.io: redis_strlen(...)
redis_sunion
redis_sunion( conn_id, key, output var )
View documentation on redis.io: redis_sunion(...)
redis_sunionstore
redis_sunionstore( conn_id, destination, key )
View documentation on redis.io: redis_sunionstore(...)
redis_time
redis_time( conn_id, output var )
View documentation on redis.io: redis_time(...)
redis_touch
redis_touch( conn_id, key )
View documentation on redis.io: redis_touch(...)
redis_ttl
redis_ttl( conn_id, key )
View documentation on redis.io: redis_ttl(...)
redis_type
redis_type( conn_id, key )
View documentation on redis.io: redis_type(...)
redis_unwatch
redis_unwatch( conn_id )
View documentation on redis.io: redis_unwatch(...)
redis_watch
redis_watch( conn_id, key )
View documentation on redis.io: redis_watch(...)
redis_zadd
redis_zadd( conn_id, key, score, member, options var )
View documentation on redis.io: redis_zadd(...)
redis_zcard
redis_zcard( conn_id, key )
View documentation on redis.io: redis_zcard(...)
redis_zcount
redis_zcount( conn_id, key, min, max )
View documentation on redis.io: redis_zcount(...)
redis_zincrby
redis_zincrby( conn_id, key, increment, member )
View documentation on redis.io: redis_zincrby(...)
redis_zinterstore
redis_zinterstore( conn_id, destination, key, options var )
View documentation on redis.io: redis_zinterstore(...)
redis_zlexcount
redis_zlexcount( conn_id, key, min, max )
View documentation on redis.io: redis_zlexcount(...)
redis_zrange
redis_zrange( conn_id, key, start, stop, options var, output var )
View documentation on redis.io: redis_zrange(...)
redis_zrangebylex
redis_zrangebylex( conn_id, key, min, max, options var, output var )
View documentation on redis.io: redis_zrangebylex(...)
redis_zrangebyscore
redis_zrangebyscore( conn_id, key, min, max, options var, output var )
View documentation on redis.io: redis_zrangebyscore(...)
redis_zrank
redis_zrank( conn_id, key, member )
View documentation on redis.io: redis_zrank(...)
redis_zrem
redis_zrem( conn_id, key, member )
View documentation on redis.io: redis_zrem(...)
redis_zremrangebylex
redis_zremrangebylex( conn_id, key, min, max )
View documentation on redis.io: redis_zremrangebylex(...)
redis_zremrangebyrank
redis_zremrangebyrank( conn_id, key, start, stop )
View documentation on redis.io: redis_zremrangebyrank(...)
redis_zremrangebyscore
redis_zremrangebyscore( conn_id, key, min, max )
View documentation on redis.io: redis_zremrangebyscore(...)
redis_zrevrange
redis_zrevrange( conn_id, key, start, stop, options var, output var )
View documentation on redis.io: redis_zrevrange(...)
redis_zrevrangebylex
redis_zrevrangebylex( conn_id, key, max, min, options var, output var )
View documentation on redis.io: redis_zrevrangebylex(...)
redis_zrevrangebyscore
redis_zrevrangebyscore( conn_id, key, max, min, optoins var, output var )
View documentation on redis.io: redis_zrevrangebyscore(...)
redis_zrevrank
redis_zrevrank( conn_id, key, member )
View documentation on redis.io: redis_zrevrank(...)
redis_zscan
redis_zscan( conn_id, key, cursor, options var, output var )
View documentation on redis.io: redis_zscan(...)
redis_zscore
redis_zscore( conn_id, key, member )
View documentation on redis.io: redis_zscore(...)
redis_zunionstore
redis_zunionstore( conn_id, destination, key, options var )
View documentation on redis.io: redis_zunionstore(...)
miva_struct_member_callback
miva_struct_member_callback( struct var, function, data var )
This function can be used to dynamically populate structure members as they are accessed.
Return Value: Empty
  • struct = The structure that had the member accessed
  • function = a string containing the callback function name that will be triggered when a member does not exist in the structure (if the callback function is empty, the callback will be disabled)
  • data = The data that will be passed to the callback function
User Annotations: mivascript-functions