deleteRecord($_GET['id'], $params); $get_params = get_params(array('action', 'id'), '?'); if ( $action_result > 0 ) $get_params .= ( !empty($get_params) ? '&' : '?' ) . 'error=' . $action_result; } return $get_params; } //------------------------------------------------------------------------------------- // MANAGE_ERROR_STRING // Genera los textos de error a partir del codigo de error suministrado. function manage_error_string( $error, $reg_errors = '' ) { global $LNG; $error_codes = array(); $error_string = ''; for ( $i=0; $i 0 ) $error_string .= '
  • ' . $LNG['error'][$i][$error_codes[$i]] . '
  • '; } if ( is_array($reg_errors) ) { while ( list($i) = each($reg_errors) ) $error_string .= '
  • ' . $reg_errors[$i]['name'] . ': ' . $LNG['reg_error'][$reg_errors[$i]['code']] . '
  • '; } return $error_string; } //------------------------------------------------------------------------------------- // CHECK_NUM_OF_PAGE function check_num_of_page( $page = 1 ) { $page = ereg_replace("[^0-9]", '', $page); settype($page, "integer"); if ( $page < 1 ) return 1; else return $page; } //------------------------------------------------------------------------------------- // GENERATE_SELECT_FIELD function generate_select_field($options = '', $name, $selected = '', $required = true, $params = '') { $select_field = ''; $select_field .= '' . "\n"; return $select_field; } //------------------------------------------------------------------------------------- // HTML_SPECIAL_CHARS function html_special_chars( &$record, $exclude = '' ) { if ( !is_array($exclude) ) $exclude = array(); if ( is_array($record) ) { while ( list($id) = each($record) ) { if ( !is_array($record[$id]) ) { if ( !in_array($id, $exclude) ) $record[$id] = htmlspecialchars($record[$id]); } else html_special_chars( $record[$id], $exclude ); } reset($record); } else htmlspecialchars($record); } //------------------------------------------------------------------------------------- // FORMAT_RECORD function format_record( &$record ) { if ( is_array($record) ) { while ( list($id) = each($record) ) if ( !is_array($record[$id]) ) $record[$id] = addslashes($record[$id]); reset($record); } else addslashes($record); } //------------------------------------------------------------------------------------- // STRIP_SLASHES function strip_slashes(&$record) { if ( is_array($record) ) { while ( list($id) = each($record) ) if ( !is_array($record[$id]) ) $record[$id] = stripslashes($record[$id]); reset($record); } else stripslashes($record); } //------------------------------------------------------------------------------------- // REMOVE_STR function remove_str( &$record ) { $record = ereg_replace("[^0-9]", '', $record); } //------------------------------------------------------------------------------------- // GET_INT function get_int( $value = 0 ) { $new_value = $value; if ( ereg("^[-]?([0-9]+)\.([0-9]+)$", $value, $regs) ) $new_value = ( $regs[2] > 0 ? number_format($value, 2 , '.', '') : intval($value) ); if ( $new_value > 0 || $new_value < 0 ) return $new_value; } //------------------------------------------------------------------------------------- // INCLUDE_FILE_CONTENT function include_file_content($file, $br = false) { if ( @file_exists($file) ) { $fh = fopen( $file, "r"); if ( $fh ) { while ( $line = fread($fh, 1024) ) { if ( $br ) { $line = ereg_replace(";\r\n", '; ', $line); $line = ereg_replace("{\r\n", '{ ', $line); $line = ereg_replace(' +', ' ', $line); $line = ereg_replace("[\r\n]+", "\r\n", $line); } echo $line; } fclose($fh); } } } //------------------------------------------------------------------------------------- // SUM_HOURS function sum_hours( $hour1 = 0.00, $hour2 = 0.00 ) { $hours = 0; $minutes = 0; ereg("^([0-9]+)\.([0-9]{1,2})$", $hour1, $hour_1); ereg("^([0-9]+)\.([0-9]{1,2})$", $hour2, $hour_2); if ( !$hour_1 ) $hour_1 = array($hour1, $hour1, 0); if ( !$hour_2 ) $hour_2 = array($hour2, $hour2, 0); $hours = ( $hour_1[1] + $hour_2[1]) + floor( ( $hour_1[2] + $hour_2[2] ) / 60 ); $minutes = ( $hour_1[2] + $hour_2[2] ) % 60; return $hours . '.' . $minutes; } //------------------------------------------------------------------------------------- // MONTH_LIST function month_list( $startDate, $endDate ) { $groupMonths = array(); if ( $startDate < $endDate ) { $sMonth = date('m', $startDate); $sYear = date('Y', $startDate); $eMonth = date('m', $endDate); $eYear = date('Y', $endDate); for ( $i = $sMonth, $year = $sYear; $year <= $eYear; $i++ ) { if ( $i > $eMonth && $year == $eYear ) break; $key = $year . date('m', mktime(0, 0, 0, $i, 1, $year) ); $groupMonths[$key] = date('Y - F', mktime(0, 0, 0, $i, 1, $year) ); if ( $i == 12 ) { $i = 0; $year++; } } } return $groupMonths; } function getFileImages( $dir ) { $iconList = array(); $handle=@opendir($dir); if ($handle) { while (($file = readdir($handle))!==false) { //if ($file != "." && $file != ".." && exif_imagetype($dir . $file)) $iconList[] = $file; if ($file != "." && $file != "..") $iconList[] = $file; } } closedir($handle); return $iconList; } ?>