Back to index

awl  0.53
Namespaces | Functions
AWLUtilities.php File Reference

Go to the source code of this file.

Namespaces

namespace  awl
 Authentication handling class.

Functions

if(!function_exists('dbg_error_log'))
if(!function_exists('fatal'))
if(!function_exists('trace_bug'))
if(!function_exists('apache_request_headers'))
if(!function_exists('dbg_log_array'))
if(!function_exists("session_simple_md5"))
if(!function_exists("session_salted_md5"))
if(!function_exists("session_salted_sha1"))
if(!function_exists("session_validate_password"))
if(!function_exists("replace_uri_params"))
if(!function_exists("uuid"))
if(!function_exists("translate"))
if(!function_exists("clone")&&version_compare(phpversion(), '5.0')
< 0) if(!function_exists("quoted_printable_encode"))
if(!function_exists("check_by_regex"))
if(!function_exists("param_to_global"))
if(!function_exists("get_fields"))
if(!function_exists("force_utf8")) 
olson_from_tzstring ($tzstring)
 Try and extract something like "Pacific/Auckland" or "America/Indiana/Indianapolis" if possible.
if(!function_exists("deprecated"))
if(!function_exists("gzdecode")) 
awl_version ()
 Return the AWL version.

Function Documentation

if (!function_exists("deprecated")) if (!function_exists("gzdecode")) awl_version ( )

Return the AWL version.

Definition at line 675 of file AWLUtilities.php.

                       {
  global $c;
$c->awl_library_version = 0.53;
  return $c->awl_library_version;
}
if (!function_exists('dbg_error_log')) if (!function_exists('fatal')) if (!function_exists('trace_bug')) if (!function_exists('apache_request_headers')) if (!function_exists('dbg_log_array')) if (!function_exists("session_simple_md5")) if (!function_exists("session_salted_md5")) if (!function_exists("session_salted_sha1")) if (!function_exists("session_validate_password")) if (!function_exists("replace_uri_params")) if (!function_exists("uuid")) if (!function_exists("translate")) if (!function_exists("clone")&&version_compare(phpversion(), '5.0')< 0) if (!function_exists("quoted_printable_encode")) if (!function_exists("check_by_regex")) if (!function_exists("param_to_global")) if (!function_exists("get_fields")) if (!function_exists("force_utf8")) olson_from_tzstring ( tzstring)

Try and extract something like "Pacific/Auckland" or "America/Indiana/Indianapolis" if possible.

Definition at line 584 of file AWLUtilities.php.

                                          {
  global $c;
  
  if ( function_exists('timezone_identifiers_list') && in_array($tzstring,timezone_identifiers_list()) ) return $tzstring;
  if ( preg_match( '{((Antarctica|America|Africa|Atlantic|Asia|Australia|Indian|Europe|Pacific)/(([^/]+)/)?[^/]+)$}', $tzstring, $matches ) ) {
//    dbg_error_log( 'INFO', 'Found timezone "%s" from string "%s"', $matches[1], $tzstring );
    return $matches[1];
  }
  switch( $tzstring ) {
    case 'New Zealand Standard Time': case 'New Zealand Daylight Time':
         return 'Pacific/Auckland';
         break;
    case 'Central Standard Time':     case 'Central Daylight Time':     case 'US/Central':
         return 'America/Chicago';
         break;
    case 'Eastern Standard Time':     case 'Eastern Daylight Time':     case 'US/Eastern':
    case '(UTC-05:00) Eastern Time (US & Canada)':
         return 'America/New_York';
         break;
    case 'Pacific Standard Time':     case 'Pacific Daylight Time':     case 'US/Pacific':
         return 'America/Los_Angeles';
         break;
    case 'Mountain Standard Time':    case 'Mountain Daylight Time':    case 'US/Mountain':    case 'Mountain Time':
         return 'America/Denver';
         // The US 'Mountain Time' can in fact be America/(Denver|Boise|Phoenix|Shiprock) which
         // all vary to some extent due to differing DST rules.
         break;
    case '(GMT-07.00) Arizona':
         return 'America/Phoenix';
         break;
    default:
         if ( isset($c->timezone_translations) && is_array($c->timezone_translations) 
                      && !empty($c->timezone_translations[$tzstring]) )
           return $c->timezone_translations[$tzstring];      
  }
  return null;
}

if ( !function_exists("deprecated") ) {
  function deprecated( $method ) {
    global $c;
    if ( isset($c->dbg['ALL']) || isset($c->dbg['deprecated']) ) {
      $stack = debug_backtrace();
      array_shift($stack);
      if ( preg_match( '{/inc/iCalendar.php$}', $stack[0]['file'] ) && $stack[0]['line'] > __LINE__ ) return;
      @error_log( sprintf( $c->sysabbr.':DEPRECATED: Call to deprecated method "%s"', $method));
      foreach( $stack AS $k => $v ) {
        @error_log( sprintf( $c->sysabbr.':  ==>  called from line %4d of %s', $v['line'], $v['file']));
      }
    }
  }
}


if ( !function_exists("gzdecode") ) {
  function gzdecode( $instring ) {
    global $c;
    if ( !isset($c->use_pipe_gunzip) || $c->use_pipe_gunzip ) {
      $descriptorspec = array(
         0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
         1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
         2 => array("file", "/dev/null", "a") // stderr is discarded
      );
      $process = proc_open('gunzip',$descriptorspec, $pipes);
      if ( is_resource($process) ) {
        fwrite($pipes[0],$instring);
        fclose($pipes[0]);
        
        $outstring = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        
        proc_close($process);
        return $outstring;
      }
      return '';
    }
    else {
      $g=tempnam('./','gz');
      file_put_contents($g,$instring);
      ob_start();
      readgzfile($g);
      $d=ob_get_clean();
      unlink($g);
      return $d;
    }
  }
}

Here is the caller graph for this function: