PHP Classes

File: config.inc.php

Recommend this page to a friend!
  Classes of Bimal Poudel   MySQL access class   config.inc.php   Download  
File: config.inc.php
Role: Auxiliary script
Content type: text/plain
Description: basic application configurations
Class: MySQL access class
MySQL database access wrapper
Author: By
Last change:
Date: 15 years ago
Size: 1,280 bytes
 

Contents

Class file image Download
<?php
// Fixes the magic quotes
function fix_slashes($arr = "")
{
    if(
is_null($arr) || empty($arr))
        return(
null);
   
# 'fix_slashes'
    # __FUNCTION__
    # __METHOD__
   
return(is_array($arr) ? array_map(__FUNCTION__, $arr) : stripslashes($arr));
}

if(
get_magic_quotes_gpc())
{
   
$_POST = fix_slashes($_POST);
   
$_GET = fix_slashes($_GET);
   
$_REQUEST = fix_slashes($_REQUEST);
}

/**
* Define, from where the classes can be read, without including the files.
* __CLASSES_ROOT__ defined already in parent: config.inc.php
* Built as a part of config page only, to shorten the file size limit per page.
*/
function __autoload($class_name='')
{
    if(
class_exists($class_name))
    {
        return(
true);
    }

   
$class_file=dirname(__FILE__)."/class.{$class_name}.inc.php";
    if(
file_exists($class_file))
    {
        require_once(
$class_file);
    }
    else
    {
        die(
"Class definition file: <em>{$class_file}</em> does not exist. Class: <strong>{$class_name}</strong>.");
    }

   
/**
    * Now check, if there was the class defined in the file.
    */
   
if (!class_exists($class_name, false))
    {
        die(
"Error loading the class properly in: <strong>{$class_file}</strong>. Expected class name: <em>{$class_name}</em> did not exist.");
    }

    return(
false);
}
# __autoload()

?>