ActiveDirectory
[ class tree: ActiveDirectory ] [ index: ActiveDirectory ] [ all elements ]

Source for file Common.php

Documentation is available at Common.php

  1. <?php
  2. /**
  3.  * Project: ActiveDirectory :: Control Active Directory with ldap or ldaps
  4.  * File:    ActiveDirectory.php
  5.  *
  6.  * Copyright (c) 2018, JoungKyun.Kim <http://oops.org>
  7.  *
  8.  * LICENSE: BSD
  9.  *
  10.  * ActiveDirectory pear package support to control Microsoft Active Directory
  11.  * with ldap or ldaps protocol.
  12.  *
  13.  * @category   System
  14.  * @package    ActiveDirectory
  15.  * @author     JoungKyun.Kim <http://oops.org>
  16.  * @copyright  (c) 2018 JoungKyun.Kim
  17.  * @license    BSD License
  18.  * @link       http://pear.oops.org/package/ActiveDirectory
  19.  * @filesource
  20.  */
  21.  
  22.  
  23. /**
  24.  * ActiveDirectory_Common :: Common APIs
  25.  * @package ActiveDirectory
  26.  */
  27. {
  28.     // {{{ properties
  29.     const UNIXDEF 11644473600;
  30.     // }}}
  31.  
  32.     // {{{ (void) ActiveDirectory_Common::convert_to_unixtime (&$sec)
  33.     /**
  34.      * NT timestamp를 UNIX timestamp로 변환
  35.      *
  36.      * @access  public
  37.      * @param   int      NT timestamp
  38.      */
  39.     
  40. public
  41.     function convert_to_unixtime (&$sec{
  42.         $sec = (integer) (($sec 10000000self::UNIXDEF);
  43.     }
  44.     // }}}
  45.  
  46.     // {{{ (void) ActiveDirectory_Common::convert_to_nttime (&$sec, $oztime = false)
  47.     /**
  48.      * UNIX timestamp를 NT timestamp로 변환
  49.      *
  50.      * @access  public
  51.      * @param   int     Unix timestamp
  52.      */
  53.     
  54. public
  55.     function convert_to_nttime (&$sec$oztime false{
  56.         if $oztime !== false )
  57.             $sec date ('YmdHis'$sec'.0Z';
  58.         else
  59.             $sec ($sec self::UNIXDEF10000000;
  60.     }
  61.     // }}}
  62.  
  63.     // {{{ (void) ActiveDirectory_Common::convert_to_0Ztime (&$sec)
  64.     /**
  65.      * UNIX timestamp를 NT 0Z 표현으로 변환
  66.      *
  67.      * @access  public
  68.      * @param   int     Unix timestamp
  69.      */
  70.     
  71. public
  72.     function convert_to_0Ztime (&$time{
  73.         $this->convert_to_nttime ($timetrue);
  74.     }
  75.     // }}}
  76.  
  77.     // {{{ (void) ActiveDirectory_Common::convert_to_unixtime_from_0Ztime (&$sec)
  78.     /**
  79.      * NT 0Z 표현을 UNIX teimstamp로 변환
  80.      *
  81.      * @access  public
  82.      * @return  void 
  83.      * @param   string  0Z time
  84.      */
  85.     
  86. public
  87.     function convert_to_unixtime_from_0Ztime (&$time{
  88.         $time mktime (
  89.             substr ($time82),
  90.             substr ($time102),
  91.             substr ($time122),
  92.             substr ($time42),
  93.             substr ($time62),
  94.             substr ($time04)
  95.         );
  96.     }
  97.     // }}}
  98.  
  99.     // {{{ (void) ActiveDirectory_Common::set_array (&$v) {
  100.     /**
  101.      * 주어진 변수가 array가 아니면 array로 선언한다.
  102.      *
  103.      * @access protected
  104.      * @return void 
  105.      */
  106.     
  107. protected
  108.     function set_array (&$v{
  109.         if $v || is_array ($v) )
  110.             $v array ();
  111.     }
  112.     // }}}
  113.  
  114.     // {{{ (void) ActiveDirectory_Common::fix_charset (&$v) {
  115.     /**
  116.      * 변수 값의 문자셋 처리
  117.      *
  118.      * @access protected
  119.      * @return void 
  120.      */
  121.     
  122. protected
  123.     function fix_charset (&$v{
  124.         if $this->charset == 'utf-8' )
  125.             return;
  126.  
  127.         if is_resource ($v|| is_numeric ($v) )
  128.             return;
  129.  
  130.         if is_array ($v|| is_object ($v) ) {
  131.             $types gettype ($v);
  132.             foreach $v as $k => $val {
  133.                 $this->fix_charset ($val);
  134.                 if $types == 'object' )
  135.                     $v->$k $val;
  136.                 else
  137.                     $v[$k$val;
  138.             }
  139.             return;
  140.         }
  141.  
  142.         if preg_match ('/[^\x00-\x7f]/'$v) )
  143.             $v iconv ('utf-8'$this->charset$v);
  144.     }
  145.     // }}}
  146. }
  147.  
  148. /*
  149.  * Local variables:
  150.  * tab-width: 4
  151.  * c-basic-offset: 4
  152.  * End:
  153.  * vim: set filetype=php noet sw=4 ts=4 fdm=marker:
  154.  * vim600: noet sw=4 ts=4 fdm=marker
  155.  * vim<600: noet sw=4 ts=4
  156.  */
  157. ?>

Documentation generated on Tue, 14 May 2019 01:59:40 +0900 by phpDocumentor 1.4.4