wrote this file. * As long as you retain this notice you can do whatever you want with this * software. If we meet some day, and you think this stuff is worth it, you can * buy me a beer in return. * Sandino Araico Sánchez * --END LICENSE--------------------------------------------------------------- * --LICENCIA EN ESPAÑOL MEXICANO---------------------------------------------- * "LA LICENCIA BEER-WARE" (traducción al español de la revisión 42-sandino-3): * Sandino Araico Sánchez escribió éste archivo. * Siempre y cuando usted retenga éste aviso (en español y en inglés) usted * puede hacer cualquier cosa con éste software. Si algún día nos encontramos y * usted piensa que éste software vale la pena, usted puede invitarme una * cerveza en recompensa. * Sandino Araico Sánchez * --FIN DE LICENCIA----------------------------------------------------------- */ # Changelog: # 2000-09-09 Sandino Araico Sánchez - Simple Misc Functions # 2001-02-21 Sandino Araico Sánchez - tiempo en segundos con microsegundos # 2001-09-17 Sandino Araico Sánchez - s-true() y s-false() # 2001-12-11 Sandino Araico Sánchez - s_time_0, s_time_1 y s_time_delta # 2002-01-05 Sandino Araico Sánchez - s_rand_pw() # 2002-01-29 Sandino Araico Sánchez - s_fopen() # 2002-03-14 Sandino Araico Sánchez - s_check_dir() if(!defined("__S__EXTENDED")) { define ("__S__EXTENDED",1); #--------------------------------------------------------------------- //Parametros #--------------------------------------------------------------------- // Esta función es necesaria para no hacer nada function s_null(){} // Tomada del manual de PHP http://www.php.net/manual/en/function.microtime.php function s_time() { return doubleval(ereg_replace('^0\.([0-9]*) ([0-9]*)$','\\2.\\1',microtime())); } function s_time_0() { if(!defined('__HOPP_TIME_0_')) define('__HOPP_TIME_0_',s_time()); } function s_time_1() { if(!defined('__HOPP_TIME_1_')) define('__HOPP_TIME_1_',s_time()); } function s_time_delta() { # s_log('__HOPP_TIME_0_: '.__HOPP_TIME_0_."\t".'__HOPP_TIME_1_: '.__HOPP_TIME_1_); if(!defined('__HOPP_TIME_0_')) return; if(!defined('__HOPP_TIME_1_')) s_time_1(); return (__HOPP_TIME_1_ - __HOPP_TIME_0_); } function s_time_delta_html_comment() { $var=''; s_log($var); return $var; } function s_true() { return 1; } function s_false() { return 0; } function s_rand_pw($PW_LEN=32) { return s_rand_pw_md5($PW_LEN); } function s_rand_pw_md5($PW_LEN=32) { if(!defined('__S__RAND_SEED__')) { define('__S__RAND_SEED__',1); srand(s_time()); } return substr(md5(rand()),0,$PW_LEN); } function s_fopen($file_name, $mode) { if(!file_exists($file_name)) return; $file=fopen($file_name,$mode); return $file; } function s_check_dir($dirname, $mode=0700) { s_log("dirname: $dirname"); if(empty($dirname)||($dirname=='/')) return 0; if(file_exists($dirname)) return is_dir($dirname); if(s_check_dir(dirname($dirname))) return mkdir($dirname, $mode); return 0; } #--------------------------------------------------------------------- } //__S__EXTENDED ?>