3 * the __autoload automagic function for class initialization,
6 * @param string $className
9 function __autoload ($className) {
10 usingClass($className);
14 * returns true if the user's ip is in our list of debug ips
19 if (stristr(C_SYSTEM_DEBUG_IPS
, $_SERVER['REMOTE_ADDR']) && C_SYSTEM_DEBUG
)
25 if (!function_exists('usingClass')) {
27 * The php4 function for including the class file
29 * @param string $className
32 function usingClass($className) {
33 if (class_exists($className)) {
37 $classNameLow = strtolower($className);
39 if (is_file(IMPORTED_PATH
. $classNameLow . DIRECTORY_SEPARATOR
. $classNameLow.'.class.php')){
40 $classPath = IMPORTED_PATH
. $classNameLow . DIRECTORY_SEPARATOR
. $classNameLow.'.class.php';
41 } elseif (is_file(LIB_PATH
. $classNameLow . '.class.php')) {
42 $classPath = LIB_PATH
. $classNameLow . '.class.php';
44 trigger_error('Not found file containing '.$className.'.', E_USER_ERROR
);
50 if ( !class_exists($className) ) {
51 trigger_error('Unable to load class '.$className.' in file '.$classPath.'.class.php', E_USER_ERROR
);
58 * Dumb function for email validation
60 * @param string $address
63 function emailIsValid ($address) {
64 return (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $address));
67 function getDirFiles ( $dir ){
69 // usingClass('tsLog');
70 // $log = new tsLog();
74 trigger_error('Can not find : '.$dir);
77 if ( $root = @opendir
($dir) ){
78 while ($file = readdir($root)){
79 if($file == '.' ||
$file == '..'){continue;}
80 if( is_dir($dir.'/'.$file) ){
81 $files = array_merge($files, getDirFiles($dir.'/'.$file));
83 /*if ( stristr($file, 'tpl') )*/ $files[] = $dir.'/'.$file;
92 * Function for humanizing the microtime output (for php version < 5)
95 * @return float miliseconds
98 function microtime_float()
100 list($usec, $sec) = explode(" ", microtime());
101 return ((float)$usec +
(float)$sec);
104 function isDBLink($incData) {
105 if (sqlFactory
::validType(DB_TYPE
) && is_resource($incData) && stristr(get_resource_type($incData),DB_TYPE
)) {