! Sorry, boredPHP Code:
<?php
/**
#######################################################################
# Miscellaneous Class - For use with RVS
#######################################################################
# @copyright The original creator of this script (Invent!) reserves
# the right to be able to cease any use of this panel by
# anyone at any time. The copyright must also stay intact
# on every page the panel uses.
# @author Invent!/Simon Fletcher
# @version 1 (BETA)
#######################################################################
**/
class misc
{
/**
### Print Headers function
### This is used to print all the information that goes in the <head> tags of any document.
**/
function printHeaders()
{
$db = new db; # Initializes the Database class for use with queries, etc.
$query = $db->query( "SELECT `head`, `meta`, `css`, `js` FROM `configuraton`" ); # Grabs all configuration data.
$fetch = $db->fetch( $query ); # Fetches the data found in the Query.
$returns .= $fetch["head"]; # Grabs header data such as DOCTYPE, TITLE, etc.
$returns .= $fetch["meta"]; # Grabs meta data such as Robots information, etc.
$returns .= $fetch["extcss"]; # Grabs external CSS data such as links to external stylesheets.
$returns .= $fetch["intcss"]; # Grabs internal CSS data such as quick styles.
$returns .= $fetch["extjs"]; # Grabs external JS data such as links to external javascript files.
$returns .= $fetch["intjs"]; # Grabs internal JS data such as fixes etc.
return $returns; # Returns all the header data back to the script
}
/**
### Cleaning function
### This is used to clean specified variables so they are fit to be used in an SQL Query, etc.
**/
function clean( $variable )
{
$variable = htmlspecialchars( $variable, ENT_QUOTES); # Converts html markup into entities.
if( get_magic_quotes_gpc( ) )
{
$variable = stripslashes( $variable ); # Removes all slashes added because of form submittion (This could be a potential security risk without
# the added use of mysql_real_escape_string, do not keep this if you remove that cleaning line!
}
$variable = htmlentities( $variable ); # Does the same job as htmlspecialchars except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.
$variable = mysql_real_escape_string( $variable ); # Cleans a variable completely so it can be used in an SQL Query
return $variable; # Output the cleaned variable back to the script
}
/**
### Encrypting function
### This is used to encrypt specified variables so they are safe to be stored in SQL Tables, etc.
**/
function encrypt( $variable )
{
$salt = "jDu3Jop92xN" # Random variable to make the MD5 Encryption harder, customize this if you so wish.
$variable = md5( $variable.$salt ) # MD5 Encrypts the variable with an added salt (see above).
$variable = mcrypt_ecb( MCRYPT_3DES, $salt, $variable, MCRYPT_ENCRYPT ); # Mcrypts the variable using the salt
$variable = md5( $variable ); # To be on the safe side :P
return $variable; # Output the encrypted variable back to the script
}
}
?>