创建版本
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
/**
|
||||
* openssl AES加密解密
|
||||
*
|
||||
* @author Hawind <hawind@qq.com>
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
class AES
|
||||
{
|
||||
/**
|
||||
* openssl aes 加密
|
||||
*/
|
||||
public static function crypto_encrypt($data, $key, $options = OPENSSL_RAW_DATA)
|
||||
{
|
||||
$iv = substr($key, 0, -16);
|
||||
$encrypted = openssl_encrypt($data, 'aes-256-cbc', $key, $options, $iv);
|
||||
return $encrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
* openssl aes 解密
|
||||
*/
|
||||
public static function crypto_decrypt($data, $key, $options = OPENSSL_RAW_DATA)
|
||||
{
|
||||
$iv = substr($key, 0, -16);
|
||||
return openssl_decrypt($data, 'aes-256-cbc', $key, $options, $iv);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加密.
|
||||
*
|
||||
* @param mixed $contents 要加密的内容
|
||||
* @param string $encryptKey 加密的Key,长度为14,24,32
|
||||
*
|
||||
* @return string 已加密的内容
|
||||
*/
|
||||
public static function encrypt($data, $key)
|
||||
{
|
||||
$iv = openssl_random_pseudo_bytes(16);
|
||||
$encrypted = [
|
||||
base64_encode($iv),
|
||||
openssl_encrypt($data, 'aes-256-cbc', $key, 0, $iv)
|
||||
];
|
||||
return base64_encode(json_encode($encrypted));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密.
|
||||
*
|
||||
* @param string $data 已加密的内容
|
||||
* @param string $key 解密Key
|
||||
*
|
||||
* @return string 已解密的内容
|
||||
*/
|
||||
public static function decrypt($data, $key)
|
||||
{
|
||||
$encrypt = json_decode(base64_decode($data), true);
|
||||
$iv = base64_decode($encrypt[0]);
|
||||
$decrypted = openssl_decrypt($encrypt[1], 'aes-256-cbc', $key, 0, $iv);
|
||||
return $decrypted;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
class Base32
|
||||
{
|
||||
public static $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
|
||||
|
||||
/**
|
||||
* Test if an encoded string is compatible with this encoder/decoder
|
||||
*
|
||||
* @param string $data The encoded string.
|
||||
* @return boolean Returns true if the encoded string is compatible, otherwise false.
|
||||
*/
|
||||
public static function isValid($data)
|
||||
{
|
||||
return ((strlen($data) % 8) === 0 && preg_match("/^[".Base32::$charset."]+=*$/i", $data) === 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a string of raw data
|
||||
*
|
||||
* @param string $data String of raw data to encode.
|
||||
* @return string Returns the encoded string.
|
||||
*/
|
||||
public static function encode($data)
|
||||
{
|
||||
$encoded = null;
|
||||
|
||||
if ($data) {
|
||||
$binString = '';
|
||||
// 'AB' => 01000001 01000010
|
||||
foreach (str_split($data) as $char) {
|
||||
$binString .= str_pad(decbin(ord($char)), 8, 0, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
// 01000001 01000010 => 01000 00101 00001 00000 => 'IFBA'
|
||||
for ($offset = 0; $offset < strlen($binString); $offset += 5) {
|
||||
$chunk = str_pad(substr($binString, $offset, 5), 5, 0, STR_PAD_RIGHT);
|
||||
$encoded .= Base32::$charset[bindec($chunk)];
|
||||
}
|
||||
|
||||
// 'IFBA' => 'IFBA===='
|
||||
if (strlen($encoded) % 8) {
|
||||
$encoded .= str_repeat('=', 8 - (strlen($encoded) % 8));
|
||||
}
|
||||
}
|
||||
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode an encoded string
|
||||
*
|
||||
* @param string $data String of encoded data to decode.
|
||||
* @return string Returns the decoded string.
|
||||
* @throws given string is not valid for this encoder/decoder.
|
||||
*/
|
||||
public static function decode($data)
|
||||
{
|
||||
$decoded = null;
|
||||
|
||||
if ($data) {
|
||||
if (!Base32::isValid($data)) {
|
||||
throw new \Exception('Invalid base32 string');
|
||||
}
|
||||
|
||||
// 'ifba====' => 'IFBA'
|
||||
$data = rtrim(strtoupper($data), '=');
|
||||
|
||||
$binString = '';
|
||||
// 'IFBA' => 01000 00101 00001 00000
|
||||
foreach (str_split($data) as $char) {
|
||||
$binString .= str_pad(decbin(strpos(Base32::$charset, $char)), 5, 0, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
// 01000 00101 00001 00000 => 01000001 01000010
|
||||
// Assuming it's safe to drop the trailing bits, as if this is a
|
||||
// valid Base32 string, they'll be padding zeros anyway.
|
||||
$binString = substr($binString, 0, (floor(strlen($binString) / 8) * 8));
|
||||
|
||||
// 01000001 01000010 => 'AB'
|
||||
for ($offset = 0; $offset < strlen($binString); $offset += 8) {
|
||||
$chunk = str_pad(substr($binString, $offset, 8), 8, 0, STR_PAD_RIGHT);
|
||||
$decoded .= chr(bindec($chunk));
|
||||
}
|
||||
}
|
||||
return $decoded;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
use Session;
|
||||
|
||||
class Captcha
|
||||
{
|
||||
//显示验证码
|
||||
public static function make($key = 'captcha')
|
||||
{
|
||||
header('Content-type:image/png');
|
||||
//创建图片
|
||||
$im = imagecreate(80, 30);
|
||||
//第一次对imagecolorallocate()的调用会给基于调色板的图像填充背景色
|
||||
$bg = imagecolorallocate($im, 255, 255, 255);
|
||||
//验证码使用字体
|
||||
$font_style = public_path('assets/fonts/milkcocoa.ttf');
|
||||
//字符
|
||||
$text_char = 'BCEFGHJKMPQRTVWXY2346789';
|
||||
//字符间隔
|
||||
$text_spac = 16;
|
||||
|
||||
$auth_code = '';
|
||||
|
||||
//产生随机字符
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$font_color = imagecolorallocate($im, mt_rand(50, 200), mt_rand(0, 155), mt_rand(0, 155));
|
||||
$text_str = $text_char[mt_rand(0, 23)];
|
||||
imagettftext($im, 24, mt_rand(0, 20) - mt_rand(0, 25), 5 + $i * $text_spac, mt_rand(25, 30), $font_color, $font_style, $text_str);
|
||||
$auth_code .= $text_str;
|
||||
}
|
||||
|
||||
//用户和用户输入验证码做比较
|
||||
Session::put($key, $auth_code);
|
||||
|
||||
//干扰点
|
||||
for ($i = 0; $i < 250; $i++) {
|
||||
imagesetpixel($im, rand(0, 130), rand(0, 145), $font_color);
|
||||
imagesetpixel($im, rand(0, 130), rand(0, 145), $font_color);
|
||||
}
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
}
|
||||
|
||||
public static function check($key, $value)
|
||||
{
|
||||
return Session::has($key) && Session::get($key) === strtoupper($value) ? true : false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
use Gdoo\Calendar\Sabre\Connector;
|
||||
|
||||
class DAV
|
||||
{
|
||||
public static function caldav($uri)
|
||||
{
|
||||
// Backends
|
||||
$authBackend = new Connector\Auth();
|
||||
$calendarBackend = new Connector\Share\CalDAV();
|
||||
$principalBackend = new Connector\Principal();
|
||||
|
||||
// Directory structure
|
||||
$tree = array(
|
||||
new \Sabre\CalDAV\Principal\Collection($principalBackend),
|
||||
new \Sabre\CalDAV\CalendarRootNode($principalBackend, $calendarBackend),
|
||||
);
|
||||
|
||||
$base_url = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||
|
||||
$server = new \Sabre\DAV\Server($tree);
|
||||
|
||||
$server->setBaseUri($base_url.'/'.$uri);
|
||||
|
||||
// Server Plugins
|
||||
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, 'SabreDAV'));
|
||||
$server->addPlugin(new \Sabre\CalDAV\Plugin());
|
||||
$server->addPlugin(new \Sabre\DAVACL\Plugin());
|
||||
$server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
|
||||
// Support for html frontend
|
||||
$server->addPlugin(new \Sabre\DAV\Browser\Plugin(false));
|
||||
|
||||
$server->debugExceptions = false;
|
||||
$server->exec();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
use DB;
|
||||
|
||||
class Dialog
|
||||
{
|
||||
public static $items = [
|
||||
'user' => [
|
||||
'title' => '用户',
|
||||
'table' => 'user',
|
||||
'field' => 'name',
|
||||
'url' => 'user/user/dialog',
|
||||
],
|
||||
'role' => [
|
||||
'title' => '角色',
|
||||
'table' => 'role',
|
||||
'field' => 'name',
|
||||
'url' => 'user/role/dialog',
|
||||
],
|
||||
'department' => [
|
||||
'title' => '部门',
|
||||
'table' => 'department',
|
||||
'field' => 'name',
|
||||
'url' => 'user/department/dialog',
|
||||
],
|
||||
'supplier' => [
|
||||
'title' => '供应商',
|
||||
'table' => 'supplier',
|
||||
'join' => 'user',
|
||||
'field' => 'user.name',
|
||||
'url' => 'supplier/supplier/dialog',
|
||||
],
|
||||
'customer' => [
|
||||
'title' => '客户',
|
||||
'table' => 'customer',
|
||||
'join' => 'user',
|
||||
'field' => 'user.name',
|
||||
'url' => 'customer/customer/dialog',
|
||||
],
|
||||
'customer_contact' => [
|
||||
'title' => '客户联系人',
|
||||
'table' => 'customer_contact',
|
||||
'join' => 'user',
|
||||
'field' => 'user.name',
|
||||
'url' => 'customer/contact/dialog',
|
||||
],
|
||||
'supplier_product' => [
|
||||
'title' => '商品',
|
||||
'table' => 'product',
|
||||
'field' => 'name',
|
||||
'url' => 'supplier/product/dialog',
|
||||
],
|
||||
'product' => [
|
||||
'title' => '产品',
|
||||
'table' => 'product',
|
||||
'field' => 'name',
|
||||
'url' => 'product/product/dialog',
|
||||
],
|
||||
'promotion' => [
|
||||
'title' => '促销',
|
||||
'table' => 'promotion',
|
||||
'field' => 'id',
|
||||
'url' => 'promotion/promotion/dialog',
|
||||
],
|
||||
'region' => [
|
||||
'title' => '销售团队',
|
||||
'table' => 'customer_region',
|
||||
'field' => 'name',
|
||||
'url' => 'customer/region/dialog',
|
||||
],
|
||||
'hr' => [
|
||||
'title' => '人事档案',
|
||||
'table' => 'hr',
|
||||
'field' => 'name',
|
||||
'url' => 'hr/hr/dialog',
|
||||
],
|
||||
'logistics' => [
|
||||
'title' => '物流',
|
||||
'table' => 'logistics',
|
||||
'field' => 'name',
|
||||
'url' => 'order/logistics/dialog',
|
||||
],
|
||||
];
|
||||
|
||||
public static function text($item, $value)
|
||||
{
|
||||
$dialog = self::$items[$item];
|
||||
|
||||
$rows = '';
|
||||
|
||||
if ($value) {
|
||||
$ids = explode(',', $value);
|
||||
|
||||
$table = $dialog['table'];
|
||||
$join = $dialog['join'];
|
||||
|
||||
if ($join) {
|
||||
$rows = DB::table($table)
|
||||
->LeftJoin('user', 'user.id', '=', $table.'.user_id')
|
||||
->whereIn($table.'.id', $ids)
|
||||
->pluck($dialog['field'])->implode(',');
|
||||
} else {
|
||||
$rows = DB::table($table)
|
||||
->whereIn('id', $ids)
|
||||
->pluck($dialog['field'])->implode(',');
|
||||
}
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function show($key, $data, $multi = 0, $readonly = 0)
|
||||
{
|
||||
$id = $key.'_id';
|
||||
$name = $key.'_name';
|
||||
|
||||
if ($readonly == 0) {
|
||||
$html[] = '<div class="select-group input-group">';
|
||||
} else {
|
||||
$html[] = '<div class="select-group">';
|
||||
}
|
||||
|
||||
if ($readonly == 0) {
|
||||
$arrow = $multi == 1 ? 'icon-group' : 'icon-user';
|
||||
$option = "dialogShow('$id','$name','$multi');";
|
||||
$html[] = '<div class="form-control input-sm" onclick="'.$option .'" id="'.$name.'">'.$data[$name].'</div>';
|
||||
|
||||
$html[] = '<div class="input-group-btn">';
|
||||
$html[] = '<button type="button" onclick="'.$option .'" class="btn btn-sm btn-default"><i class="icon '.$arrow.'"></i></button>';
|
||||
$html[] = '</div>';
|
||||
} else {
|
||||
$html[] = '<div class="form-control input-sm" id="'.$name.'">'.$data[$name].'</div>';
|
||||
}
|
||||
$html[] = '<input type="hidden" id="'.$id.'" name="'.$id.'" value="'.$data[$id].'">';
|
||||
$html[] = '</div>';
|
||||
return join("\n", $html);
|
||||
}
|
||||
|
||||
public static function user($item, $name, $value = '', $multi = 0, $readonly = 0, $width = 'auto')
|
||||
{
|
||||
$rows = '';
|
||||
|
||||
$dialog = self::$items[$item];
|
||||
|
||||
if ($value) {
|
||||
$ids = explode(',', $value);
|
||||
|
||||
$table = $dialog['table'];
|
||||
$join = $dialog['join'];
|
||||
|
||||
if ($join) {
|
||||
$rows = DB::table($table)
|
||||
->LeftJoin('user', 'user.id', '=', $table.'.user_id')
|
||||
->whereIn($table.'.id', $ids)
|
||||
->pluck($dialog['field'])->implode(',');
|
||||
} else {
|
||||
$rows = DB::table($table)
|
||||
->whereIn('id', $ids)
|
||||
->pluck($dialog['field'])->implode(',');
|
||||
}
|
||||
}
|
||||
|
||||
$id = str_replace(['[',']'], ['_',''], $name);
|
||||
|
||||
if ($readonly == 0) {
|
||||
$width = is_numeric($width) ? 'width:'.$width.'px;' : '';
|
||||
$html[] = '<div class="select-group input-group">';
|
||||
} else {
|
||||
$html[] = '<div class="select-group">';
|
||||
}
|
||||
|
||||
if ($readonly == 0) {
|
||||
$html[] = '<input class="form-control input-sm" data-toggle="dialog-view" data-title="'.$dialog['title'].'" readonly="readonly" data-url="'.$dialog['url'].'" data-id="'.$id.'" data-multi="'.$multi.'" value="'.$rows.'" style="'.$width.'cursor:pointer;" id="'.$id.'_text" />';
|
||||
$html[] = '<div class="input-group-btn">';
|
||||
$html[] = '<a data-toggle="dialog-clear" data-id="'.$id.'" class="btn btn-sm btn-default"><i class="fa fa-times"></i></a>';
|
||||
$html[] = '</div>';
|
||||
} else {
|
||||
$html[] = '<div class="form-control input-sm" id="'.$id.'_text">'.$rows.'</div>';
|
||||
}
|
||||
$html[] = '<input type="hidden" id="'.$id.'" name="'.$name.'" value="'.$value.'">';
|
||||
$html[] = '</div>';
|
||||
return join("\n", $html);
|
||||
}
|
||||
|
||||
public static function search($data, $query)
|
||||
{
|
||||
$params = [];
|
||||
parse_str($query, $params);
|
||||
|
||||
$defaultParams = [
|
||||
'prefix' => 1,
|
||||
'multi' => 0,
|
||||
'readonly' => 0,
|
||||
'width' => '100%',
|
||||
'title' => '',
|
||||
'url' => 'index/api/dialog',
|
||||
];
|
||||
|
||||
$params = array_merge($defaultParams, $params);
|
||||
extract($params);
|
||||
|
||||
$_id = str_replace(['[',']'], ['_',''], $id);
|
||||
$_name = str_replace(['[',']'], ['_',''], $name);
|
||||
|
||||
$jq = '';
|
||||
foreach ($params as $key => $value) {
|
||||
$jq .= ' data-'.$key.'="'. $value.'"';
|
||||
}
|
||||
|
||||
$params['id'] = str_replace(['[',']'], ['_',''], $id);
|
||||
$params['name'] = str_replace(['[',']'], ['_',''], $name);
|
||||
|
||||
$e[] = '<div class="select-group input-group">';
|
||||
$e[] = '<input class="form-control input-sm" style="width:'.$params['width'].';cursor:pointer;" readonly="readonly" data-toggle="dialog-view"'.$jq.' name="'.$name.'" value="'.$data[$name].'" id="'.$params['id'].'_text" />';
|
||||
$e[] = '<div class="input-group-btn">';
|
||||
$e[] = '<a data-toggle="dialog-clear" data-id="'.$params['id'].'" class="btn btn-sm btn-default"><i class="fa fa-times"></i></a>';
|
||||
$e[] = '</div>';
|
||||
$e[] = '<input type="hidden" id="'.$params['id'].'" name="'.$id.'" value="'.$data[$id].'">';
|
||||
$e[] = '</div>';
|
||||
return join("\n", $e);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher as BaseEventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class EventDispatcher extends BaseEventDispatcher
|
||||
{
|
||||
protected function doDispatch($listeners, $eventName, GenericEvent $event)
|
||||
{
|
||||
foreach ($listeners as $listener) {
|
||||
if ($event->isPropagationStopped()) {
|
||||
break;
|
||||
}
|
||||
$arguments = \call_user_func($listener, $event->getArguments(), $eventName, $this);
|
||||
$event->setArguments($arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class Hook
|
||||
{
|
||||
public static function listen($tag, $class)
|
||||
{
|
||||
$object = with(new $class);
|
||||
$methods = get_class_methods($object);
|
||||
foreach ($methods as $method) {
|
||||
app('dispatcher')->addListener($tag.'.'.$method, [$object, $method]);
|
||||
}
|
||||
unset($object);
|
||||
}
|
||||
|
||||
public static function fire($tag, $data = [])
|
||||
{
|
||||
$event = new GenericEvent();
|
||||
$event->setArguments($data);
|
||||
$event = app('dispatcher')->dispatch($event, $tag);
|
||||
return $event->getArguments();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
/**
|
||||
* 作者:Wang
|
||||
* 创建时间:2006-12-18
|
||||
* 修改时间:2012-11-22
|
||||
* 类名:Image
|
||||
* 功能:生成多种类型的缩略图
|
||||
*/
|
||||
|
||||
/**
|
||||
* 演示
|
||||
* $img = new Image();
|
||||
* $img->cut('imgx.jpg', 400, 280, 3, false);
|
||||
* // 图片水印
|
||||
* // $img->mark('logo1.png', '', 3);
|
||||
* // 文字水印
|
||||
* $img->mark('FV.Zone Test', 40, 3, 2, 2, 5, 5, '#ffffff', '#000000', 80, 20);
|
||||
* // $img->save('ss.jpg');
|
||||
* // $img->show();
|
||||
* echo $img->msg();
|
||||
*/
|
||||
|
||||
class Image
|
||||
{
|
||||
public $srcw;
|
||||
|
||||
public $srch;
|
||||
|
||||
public $destw;
|
||||
|
||||
public $desth;
|
||||
|
||||
// 原图类型
|
||||
public $type;
|
||||
|
||||
// 生成的数据
|
||||
public $cache;
|
||||
|
||||
public $image;
|
||||
|
||||
public $mime;
|
||||
|
||||
// 将16进制的颜色转换成10进制的(R, G, B)
|
||||
public function hexdec($color)
|
||||
{
|
||||
$color = ltrim($color, '#');
|
||||
$match = str_split($color, 2);
|
||||
if (count($match) == 3) {
|
||||
$rgb['r'] = hexdec($match[0]);
|
||||
$rgb['g'] = hexdec($match[1]);
|
||||
$rgb['b'] = hexdec($match[2]);
|
||||
}
|
||||
return $rgb;
|
||||
}
|
||||
|
||||
// 水印函数
|
||||
public function mark($source, $alpha = 100, $seat = 1, $type = 1, $font_type = 3, $font_x = 10, $font_y = 10, $font_bgcolor = '#ffffff', $font_color = '#000000', $font_w = 80, $font_h = 20)
|
||||
{
|
||||
// 图片水印
|
||||
if ($type == 1) {
|
||||
list($w, $h, $t) = getimagesize($source);
|
||||
// 水印图片大于原图
|
||||
if ($w > $this->srcw || $h > $this->srch) {
|
||||
throw new Exception('水印图片大于原图。');
|
||||
}
|
||||
switch ($t) {
|
||||
case 1:
|
||||
$water = imagecreatefromgif($source);
|
||||
break;
|
||||
case 2:
|
||||
$water = imagecreatefromjpeg($source);
|
||||
break;
|
||||
case 3:
|
||||
$water = imagecreatefrompng($source);
|
||||
imagesavealpha($water, true);
|
||||
break;
|
||||
}
|
||||
|
||||
// 文字水印
|
||||
} else {
|
||||
|
||||
// 文字水印大于原图
|
||||
if ($font_w > $this->srcw || $font_h > $this->srch) {
|
||||
throw new Exception('文字水印大于原图。');
|
||||
}
|
||||
|
||||
// 创建一个真彩色图片
|
||||
$water = imagecreatetruecolor($font_w, $font_h);
|
||||
|
||||
// 转换文字颜色值
|
||||
$font_color = $this->hexdec($font_color);
|
||||
|
||||
// 转换背景颜色值
|
||||
$font_bgcolor = $this->hexdec($font_bgcolor);
|
||||
|
||||
$color = imagecolorallocate($water, $font_color['r'], $font_color['g'], $font_color['b']);
|
||||
$bgcolor = imagecolorallocate($water, $font_bgcolor['r'], $font_bgcolor['g'], $font_bgcolor['b']);
|
||||
|
||||
// 背景色填充
|
||||
imagefill($water, 0, 0, $bgcolor);
|
||||
|
||||
// 绘制文字
|
||||
imageString($water, $font_type, $font_x, $font_y, $source, $color);
|
||||
$w = $font_w;
|
||||
$h = $font_h;
|
||||
}
|
||||
|
||||
switch ($seat) {
|
||||
case 1:
|
||||
$x = 10;
|
||||
$y = 0;
|
||||
break;
|
||||
case 2:
|
||||
$x = ($this->destw - $w)/2;
|
||||
$y = ($this->desth - $h)/2;
|
||||
break;
|
||||
case 3:
|
||||
$x = $this->destw - $w - 10;
|
||||
$y = $this->desth - $h - 10;
|
||||
break;
|
||||
default:
|
||||
$x = 10;
|
||||
$y = 0;
|
||||
}
|
||||
// png 24位,真彩色不需要透明设置
|
||||
if ($t == 3) {
|
||||
imagecopy($this->cache, $water, $x, $y, 0, 0, $w, $h);
|
||||
} else {
|
||||
imagecopymerge($this->cache, $water, $x, $y, 0, 0, $w, $h, $alpha);
|
||||
}
|
||||
}
|
||||
|
||||
public function crop($file, $width, $height, $mode, $center)
|
||||
{
|
||||
// 原文件不存在
|
||||
if (!is_file($file)) {
|
||||
throw new Exception('原文件不存在。');
|
||||
}
|
||||
$temp = getimagesize($file);
|
||||
$this->srcw = $srcw = $temp[0];
|
||||
$this->srch = $srch = $temp[1];
|
||||
$this->type = $temp[2];
|
||||
|
||||
// 1=gif 2=jpg 3=png
|
||||
$this->mime = $temp['mime'];
|
||||
switch ($this->type) {
|
||||
case 1:
|
||||
$image = imagecreatefromgif($file);
|
||||
break;
|
||||
case 2:
|
||||
$image = imagecreatefromjpeg($file);
|
||||
break;
|
||||
case 3:
|
||||
$image = imagecreatefrompng($file);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$image) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (function_exists('imageantialias')) {
|
||||
imageantialias($image, true);
|
||||
}
|
||||
|
||||
// 原始宽高比大于目标宽高比, 则取目标
|
||||
$this->image = $image;
|
||||
$destw = $w = $width;
|
||||
$desth = $h = $height;
|
||||
$srcx = $srcy = 0;
|
||||
|
||||
// 按宽度等比例缩放
|
||||
switch ($mode) {
|
||||
case 1:
|
||||
$desth = ceil($srch / $srcw * $destw);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$destw = ceil($srcw / $srch * $desth);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// 原始宽高比目标宽高大,调整原始复制宽度
|
||||
if ($srcw/$srch > $w/$h) {
|
||||
$oldw = $srcw;
|
||||
$srcw = ceil($w / $h * $srch);
|
||||
if ($center) {
|
||||
$srcx = ceil(($oldw - $srcw)/2);
|
||||
}
|
||||
} else {
|
||||
// 调整原始复制高度
|
||||
$oldh = $srch;
|
||||
$srch = ceil($h / $w * $srcw);
|
||||
if ($center) {
|
||||
$srcy = ceil(($oldh - $srch)/2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->destw = $destw;
|
||||
$this->desth = $desth;
|
||||
$this->cache = imagecreatetruecolor($destw, $desth);
|
||||
|
||||
if (function_exists('imagecopyresampled')) {
|
||||
imagecopyresampled($this->cache, $image, 0, 0, $srcx, $srcy, $destw, $desth, $srcw, $srch);
|
||||
} else {
|
||||
imagecopyresized($this->cache, $image, 0, 0, $srcx, $srcy, $destw, $desth, $srcw, $srch);
|
||||
}
|
||||
}
|
||||
|
||||
public function save($path, $quality = 100)
|
||||
{
|
||||
switch ($this->type) {
|
||||
case 1:
|
||||
imagegif($this->cache, $path);
|
||||
break;
|
||||
case 2:
|
||||
imagejpeg($this->cache, $path, $quality);
|
||||
break;
|
||||
case 3:
|
||||
imagepng($this->cache, $path);
|
||||
break;
|
||||
}
|
||||
if ($this->image) {
|
||||
imageDestroy($this->image);
|
||||
}
|
||||
}
|
||||
|
||||
public function display($quality = 100)
|
||||
{
|
||||
header("Content-type: $this->mime");
|
||||
|
||||
switch ($this->type) {
|
||||
case 1:
|
||||
imagegif($this->cache, $path);
|
||||
break;
|
||||
case 2:
|
||||
imagejpeg($this->cache, $path, $quality);
|
||||
break;
|
||||
case 3:
|
||||
imagepng($this->cache, $path);
|
||||
break;
|
||||
}
|
||||
imageDestroy($this->image);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
// 极光推送的类
|
||||
// 文档见:http://docs.jpush.cn/display/dev/Push-API-v3
|
||||
|
||||
/* 使用示例
|
||||
$pushObj = new Jpush();
|
||||
//组装需要的参数
|
||||
//$receive = 'all'; //全部
|
||||
//$receive = array('tag'=>array('2401','2588','9527')); //标签
|
||||
$receive = array('alias'=>array('93d78b73611d886a74*****88497f501')); //别名
|
||||
$content = '这是一个测试的推送数据....测试....Hello World...';
|
||||
$m_type = 'http';
|
||||
$m_txt = 'http://www.iqujing.com/';
|
||||
$m_time = '600'; //离线保留时间
|
||||
|
||||
//调用推送,并处理
|
||||
$result = $pushObj->push($receive,$content,$m_type,$m_txt,$m_time);
|
||||
if($result){
|
||||
$res_arr = json_decode($result, true);
|
||||
if(isset($res_arr['error'])){ //如果返回了error则证明失败
|
||||
echo $res_arr['error']['message']; //错误信息
|
||||
echo $res_arr['error']['code']; //错误码
|
||||
return false;
|
||||
}else{
|
||||
//处理成功的推送......
|
||||
echo '推送成功.....';
|
||||
return true;
|
||||
}
|
||||
}else{ //接口调用失败或无响应
|
||||
echo '接口调用失败或无响应';
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
class JPush
|
||||
{
|
||||
// 待发送的应用程序(appKey)
|
||||
private $app_key = '';
|
||||
// 主密码
|
||||
private $master_secret = '';
|
||||
// 推送的地址
|
||||
private $url = "https://api.jpush.cn/v3/push";
|
||||
|
||||
// 若实例化的时候传入相应的值则按新的相应值进行
|
||||
public function __construct($app_key, $master_secret)
|
||||
{
|
||||
$this->app_key = $app_key;
|
||||
$this->master_secret = $master_secret;
|
||||
}
|
||||
|
||||
/* $receiver 接收者的信息
|
||||
all 字符串 该产品下面的所有用户. 对app_key下的所有用户推送消息
|
||||
tag(20个)Array标签组(并集): tag=>array('昆明','北京','曲靖','上海');
|
||||
tag_and(20个)Array标签组(交集): tag_and=>array('广州','女');
|
||||
alias(1000)Array别名(并集): alias=>array('93d78b73611d886a74*****88497f501','606d05090896228f66ae10d1*****310');
|
||||
registration_id(1000)注册ID设备标识(并集): registration_id=>array('20effc071de0b45c1a**********2824746e1ff2001bd80308a467d800bed39e');
|
||||
*/
|
||||
|
||||
// $content 推送的内容。
|
||||
// $m_type 推送附加字段的类型(可不填) http,tips,chat....
|
||||
// $m_txt 推送附加字段的类型对应的内容(可不填) 可能是url,可能是一段文字。
|
||||
// $m_time 保存离线时间的秒数默认为一天(可不传)单位为秒
|
||||
public function send($receiver = 'all', $content = '', $extras = array(), $time = '86400')
|
||||
{
|
||||
$base64 = base64_encode("$this->app_key:$this->master_secret");
|
||||
$header = array("Authorization:Basic $base64",'Content-Type:application/json');
|
||||
$data = array();
|
||||
|
||||
// 目标用户终端手机的平台类型 android, ios, winphone
|
||||
$data['platform'] = 'all';
|
||||
// 目标用户
|
||||
$data['audience'] = $receiver;
|
||||
|
||||
$data['notification'] = array(
|
||||
// 统一的模式--标准模式
|
||||
'alert' => $content,
|
||||
// 安卓自定义
|
||||
'android' => array(
|
||||
'alert' => $content,
|
||||
'title' => '',
|
||||
'builder_id' => 1,
|
||||
'extras' => $extras,
|
||||
),
|
||||
// ios的自定义
|
||||
'ios' => array(
|
||||
// 'alert' => $content,
|
||||
'badge' => '1',
|
||||
'sound' => 'default',
|
||||
// 'extras' => $extras,
|
||||
),
|
||||
);
|
||||
|
||||
// 苹果自定义---为了弹出值方便调测
|
||||
$data['message'] = array(
|
||||
'msg_content' => $content,
|
||||
'extras' => $extras,
|
||||
);
|
||||
|
||||
// 附加选项
|
||||
$data['options'] = array(
|
||||
'sendno' => time(),
|
||||
// 保存离线时间的秒数默认为一天
|
||||
'time_to_live' => $time,
|
||||
// 指定 APNS 通知发送环境:0开发环境,1生产环境。
|
||||
'apns_production' => 1,
|
||||
);
|
||||
$param = json_encode($data);
|
||||
$res = $this->post($param, $header);
|
||||
|
||||
if ($res) {
|
||||
// 得到返回值 -- 成功已否后面判断
|
||||
return $res;
|
||||
} else {
|
||||
// 未得到返回值--返回失败
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 推送的Curl方法
|
||||
public function post($data = '', $header = '')
|
||||
{
|
||||
if (empty($data)) {
|
||||
return false;
|
||||
}
|
||||
$ch = curl_init();
|
||||
// 初始化curl
|
||||
curl_setopt($ch, CURLOPT_URL, $this->url);
|
||||
// 抓取指定网页
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
// 设置header
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
// 要求结果为字符串且输出到屏幕上
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
// post提交方式
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
// 增加 HTTP Header(头)里的字段
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
||||
// 终止从服务端进行验证
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
// 运行curl
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
/**
|
||||
* JSON Web Token implementation, based on this spec:
|
||||
* http://tools.ietf.org/html/draft-ietf-oauth-json-web-token-06
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Authentication
|
||||
* @package Authentication_JWT
|
||||
* @author Neuman Vong <neuman@twilio.com>
|
||||
* @author Anant Narayanan <anant@php.net>
|
||||
* @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD
|
||||
* @link https://github.com/firebase/php-jwt
|
||||
*/
|
||||
class JWT
|
||||
{
|
||||
public static $methods = array(
|
||||
'HS256' => array('hash_hmac', 'SHA256'),
|
||||
'HS512' => array('hash_hmac', 'SHA512'),
|
||||
'HS384' => array('hash_hmac', 'SHA384'),
|
||||
'RS256' => array('openssl', 'SHA256'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Decodes a JWT string into a PHP object.
|
||||
*
|
||||
* @param string $jwt The JWT
|
||||
* @param string|Array|null $key The secret key, or map of keys
|
||||
* @param bool $verify Don't skip verification process
|
||||
*
|
||||
* @return object The JWT's payload as a PHP object
|
||||
* @throws UnexpectedValueException Provided JWT was invalid
|
||||
* @throws DomainException Algorithm was not provided
|
||||
*
|
||||
* @uses jsonDecode
|
||||
* @uses urlsafeB64Decode
|
||||
*/
|
||||
public static function decode($jwt, $key = null, $verify = true)
|
||||
{
|
||||
$tks = explode('.', $jwt);
|
||||
if (count($tks) != 3) {
|
||||
throw new UnexpectedValueException('Wrong number of segments');
|
||||
}
|
||||
list($headb64, $bodyb64, $cryptob64) = $tks;
|
||||
if (null === ($header = JWT::jsonDecode(JWT::urlsafeB64Decode($headb64)))) {
|
||||
throw new UnexpectedValueException('Invalid segment encoding');
|
||||
}
|
||||
if (null === $payload = JWT::jsonDecode(JWT::urlsafeB64Decode($bodyb64))) {
|
||||
throw new UnexpectedValueException('Invalid segment encoding');
|
||||
}
|
||||
$sig = JWT::urlsafeB64Decode($cryptob64);
|
||||
if ($verify) {
|
||||
if (empty($header->alg)) {
|
||||
throw new DomainException('Empty algorithm');
|
||||
}
|
||||
if (is_array($key)) {
|
||||
if (isset($header->kid)) {
|
||||
$key = $key[$header->kid];
|
||||
} else {
|
||||
throw new DomainException('"kid" empty, unable to lookup correct key');
|
||||
}
|
||||
}
|
||||
if (!JWT::verify("$headb64.$bodyb64", $sig, $key, $header->alg)) {
|
||||
throw new UnexpectedValueException('Signature verification failed');
|
||||
}
|
||||
// Check token expiry time if defined.
|
||||
if (isset($payload->exp) && time() >= $payload->exp) {
|
||||
throw new UnexpectedValueException('Expired Token');
|
||||
}
|
||||
}
|
||||
return $payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts and signs a PHP object or array into a JWT string.
|
||||
*
|
||||
* @param object|array $payload PHP object or array
|
||||
* @param string $key The secret key
|
||||
* @param string $algo The signing algorithm. Supported
|
||||
* algorithms are 'HS256', 'HS384' and 'HS512'
|
||||
*
|
||||
* @return string A signed JWT
|
||||
* @uses jsonEncode
|
||||
* @uses urlsafeB64Encode
|
||||
*/
|
||||
public static function encode($payload, $key, $algo = 'HS256', $keyId = null)
|
||||
{
|
||||
$header = array('typ' => 'JWT', 'alg' => $algo);
|
||||
if ($keyId !== null) {
|
||||
$header['kid'] = $keyId;
|
||||
}
|
||||
$segments = array();
|
||||
$segments[] = JWT::urlsafeB64Encode(JWT::jsonEncode($header));
|
||||
$segments[] = JWT::urlsafeB64Encode(JWT::jsonEncode($payload));
|
||||
$signing_input = implode('.', $segments);
|
||||
|
||||
$signature = JWT::sign($signing_input, $key, $algo);
|
||||
$segments[] = JWT::urlsafeB64Encode($signature);
|
||||
|
||||
return implode('.', $segments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign a string with a given key and algorithm.
|
||||
*
|
||||
* @param string $msg The message to sign
|
||||
* @param string|resource $key The secret key
|
||||
* @param string $method The signing algorithm. Supported algorithms
|
||||
* are 'HS256', 'HS384', 'HS512' and 'RS256'
|
||||
*
|
||||
* @return string An encrypted message
|
||||
* @throws DomainException Unsupported algorithm was specified
|
||||
*/
|
||||
public static function sign($msg, $key, $method = 'HS256')
|
||||
{
|
||||
if (empty(self::$methods[$method])) {
|
||||
throw new DomainException('Algorithm not supported');
|
||||
}
|
||||
list($function, $algo) = self::$methods[$method];
|
||||
switch ($function) {
|
||||
case 'hash_hmac':
|
||||
return hash_hmac($algo, $msg, $key, true);
|
||||
case 'openssl':
|
||||
$signature = '';
|
||||
$success = openssl_sign($msg, $signature, $key, $algo);
|
||||
if (!$success) {
|
||||
throw new DomainException("OpenSSL unable to sign data");
|
||||
} else {
|
||||
return $signature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify a signature with the mesage, key and method. Not all methods
|
||||
* are symmetric, so we must have a separate verify and sign method.
|
||||
* @param string $msg the original message
|
||||
* @param string $signature
|
||||
* @param string|resource $key for HS*, a string key works. for RS*, must be a resource of an openssl public key
|
||||
* @param string $method
|
||||
* @return bool
|
||||
* @throws DomainException Invalid Algorithm or OpenSSL failure
|
||||
*/
|
||||
public static function verify($msg, $signature, $key, $method = 'HS256')
|
||||
{
|
||||
if (empty(self::$methods[$method])) {
|
||||
throw new DomainException('Algorithm not supported');
|
||||
}
|
||||
list($function, $algo) = self::$methods[$method];
|
||||
switch ($function) {
|
||||
case 'openssl':
|
||||
$success = openssl_verify($msg, $signature, $key, $algo);
|
||||
if (!$success) {
|
||||
throw new DomainException("OpenSSL unable to verify data: " . openssl_error_string());
|
||||
} else {
|
||||
return $signature;
|
||||
}
|
||||
// no break
|
||||
case 'hash_hmac':
|
||||
default:
|
||||
return $signature === hash_hmac($algo, $msg, $key, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a JSON string into a PHP object.
|
||||
*
|
||||
* @param string $input JSON string
|
||||
*
|
||||
* @return object Object representation of JSON string
|
||||
* @throws DomainException Provided string was invalid JSON
|
||||
*/
|
||||
public static function jsonDecode($input)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
|
||||
/* In PHP >=5.4.0, json_decode() accepts an options parameter, that allows you to specify that large ints (like Steam
|
||||
* Transaction IDs) should be treated as strings, rather than the PHP default behaviour of converting them to floats.
|
||||
*/
|
||||
$obj = json_decode($input, false, 512, JSON_BIGINT_AS_STRING);
|
||||
} else {
|
||||
/* Not all servers will support that, however, so for older versions we must manually detect large ints in the JSON
|
||||
* string and quote them (thus converting them to strings) before decoding, hence the preg_replace() call.
|
||||
*/
|
||||
$max_int_length = strlen((string) PHP_INT_MAX) - 1;
|
||||
$json_without_bigints = preg_replace('/:\s*(-?\d{'.$max_int_length.',})/', ': "$1"', $input);
|
||||
$obj = json_decode($json_without_bigints);
|
||||
}
|
||||
|
||||
if (function_exists('json_last_error') && $errno = json_last_error()) {
|
||||
JWT::_handleJsonError($errno);
|
||||
} elseif ($obj === null && $input !== 'null') {
|
||||
throw new DomainException('Null result with non-null input');
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a PHP object into a JSON string.
|
||||
*
|
||||
* @param object|array $input A PHP object or array
|
||||
*
|
||||
* @return string JSON representation of the PHP object or array
|
||||
* @throws DomainException Provided object could not be encoded to valid JSON
|
||||
*/
|
||||
public static function jsonEncode($input)
|
||||
{
|
||||
$json = json_encode($input);
|
||||
if (function_exists('json_last_error') && $errno = json_last_error()) {
|
||||
JWT::_handleJsonError($errno);
|
||||
} elseif ($json === 'null' && $input !== null) {
|
||||
throw new DomainException('Null result with non-null input');
|
||||
}
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a string with URL-safe Base64.
|
||||
*
|
||||
* @param string $input A Base64 encoded string
|
||||
*
|
||||
* @return string A decoded string
|
||||
*/
|
||||
public static function urlsafeB64Decode($input)
|
||||
{
|
||||
$remainder = strlen($input) % 4;
|
||||
if ($remainder) {
|
||||
$padlen = 4 - $remainder;
|
||||
$input .= str_repeat('=', $padlen);
|
||||
}
|
||||
return base64_decode(strtr($input, '-_', '+/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode a string with URL-safe Base64.
|
||||
*
|
||||
* @param string $input The string you want encoded
|
||||
*
|
||||
* @return string The base64 encode of what you passed in
|
||||
*/
|
||||
public static function urlsafeB64Encode($input)
|
||||
{
|
||||
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create a JSON error.
|
||||
*
|
||||
* @param int $errno An error number from json_last_error()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function _handleJsonError($errno)
|
||||
{
|
||||
$messages = array(
|
||||
JSON_ERROR_DEPTH => 'Maximum stack depth exceeded',
|
||||
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
|
||||
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON'
|
||||
);
|
||||
throw new DomainException(
|
||||
isset($messages[$errno])
|
||||
? $messages[$errno]
|
||||
: 'Unknown JSON error: ' . $errno
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
use Gdoo\User\Models\User;
|
||||
use Gdoo\Customer\Models\Customer;
|
||||
|
||||
class License
|
||||
{
|
||||
public static function check($type)
|
||||
{
|
||||
$data = [
|
||||
'user' => 9999,
|
||||
'customer' => 9999,
|
||||
];
|
||||
|
||||
if ($type == 'user') {
|
||||
$count = User::group('user')->count('id');
|
||||
if ($count > $data['user']) {
|
||||
abort_error('无法新建用户授权许可不足。');
|
||||
}
|
||||
} else if ($type == 'customer') {
|
||||
$count = Customer::count('id');
|
||||
if ($count > $data['customer']) {
|
||||
abort_error('无法新建客户授权许可不足。');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置演示表,操作时候进行判断
|
||||
*/
|
||||
public static function demoCheck($table = null)
|
||||
{
|
||||
if (env('DEMO_VERSION') == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$demoDatas = ['user','system_log'];
|
||||
|
||||
if (in_array($table, $demoDatas)) {
|
||||
return;
|
||||
}
|
||||
|
||||
abort_error('演示模式,不允许本操作。');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
use DB;
|
||||
use Request;
|
||||
|
||||
trait LogRecord
|
||||
{
|
||||
// 注意,必须以 boot 开头
|
||||
public static function bootLogRecord()
|
||||
{
|
||||
foreach(static::getModelEvents() as $event) {
|
||||
static::$event(function ($model) use($event) {
|
||||
$model->setRemind($model, $event);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static function getModelEvents()
|
||||
{
|
||||
if (isset(static::$recordEvents)) {
|
||||
return static::$recordEvents;
|
||||
}
|
||||
return ['created', 'updated', 'deleted'];
|
||||
}
|
||||
|
||||
public function setRemind($model, $event)
|
||||
{
|
||||
$data = [
|
||||
'node' => Request::module(),
|
||||
'uri' => Request::module().'.'.Request::controller().'.'.Request::action(),
|
||||
'table' => $model->getTable(),
|
||||
'table_id' => (int)$model['id'],
|
||||
'action' => $event,
|
||||
];
|
||||
|
||||
if($event == 'created') {
|
||||
$data['original'] = json_encode($model, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
if($event == 'updated') {
|
||||
|
||||
$original = $model->getOriginal();
|
||||
$dirty = $model->getDirty();
|
||||
|
||||
// 软删除动作
|
||||
if(isset($dirty['deleted_by'])) {
|
||||
$data['action'] = 'trashed';
|
||||
} else {
|
||||
// 更新动作
|
||||
$_original = [];
|
||||
foreach ($dirty as $k => $v) {
|
||||
$_original[$k] = $original[$k];
|
||||
}
|
||||
$data['original'] = json_encode($_original, JSON_UNESCAPED_UNICODE);
|
||||
$data['dirty'] = json_encode($dirty, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
// DB::table('action_log')->insert($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,989 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
class Pinyin
|
||||
{
|
||||
/**
|
||||
* 汉字ASCII码库
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $lib = [
|
||||
['a',-20319],
|
||||
['ai',-20317],
|
||||
['an',-20304],
|
||||
['ang',-20295],
|
||||
['ao',-20292],
|
||||
['ba',-20283],
|
||||
['bai',-20265],
|
||||
['ban',-20257],
|
||||
['bang',-20242],
|
||||
['bao',-20230],
|
||||
['bei',-20051],
|
||||
['ben',-20036],
|
||||
['beng',-20032],
|
||||
['bi',-20026],
|
||||
['bian',-20002],
|
||||
['biao',-19990],
|
||||
['bie',-19986],
|
||||
['bin',-19982],
|
||||
['bing',-19976],
|
||||
['bo',-19805],
|
||||
['bu',-19784],
|
||||
['ca',-19775],
|
||||
['cai',-19774],
|
||||
['can',-19763],
|
||||
['cang',-19756],
|
||||
['cao',-19751],
|
||||
['ce',-19746],
|
||||
['ceng',-19741],
|
||||
['cha',-19739],
|
||||
['chai',-19728],
|
||||
['chan',-19725],
|
||||
['chang',-19715],
|
||||
['chao',-19540],
|
||||
['che',-19531],
|
||||
['chen',-19525],
|
||||
['cheng',-19515],
|
||||
['chi',-19500],
|
||||
['chong',-19484],
|
||||
['chou',-19479],
|
||||
['chu',-19467],
|
||||
['chuai',-19289],
|
||||
['chuan',-19288],
|
||||
['chuang',-19281],
|
||||
['chui',-19275],
|
||||
['chun',-19270],
|
||||
['chuo',-19263],
|
||||
['ci',-19261],
|
||||
['cong',-19249],
|
||||
['cou',-19243],
|
||||
['cu',-19242],
|
||||
['cuan',-19238],
|
||||
['cui',-19235],
|
||||
['cun',-19227],
|
||||
['cuo',-19224],
|
||||
['da',-19218],
|
||||
['dai',-19212],
|
||||
['dan',-19038],
|
||||
['dang',-19023],
|
||||
['dao',-19018],
|
||||
['de',-19006],
|
||||
['deng',-19003],
|
||||
['di',-18996],
|
||||
['dian',-18977],
|
||||
['diao',-18961],
|
||||
['die',-18952],
|
||||
['ding',-18783],
|
||||
['diu',-18774],
|
||||
['dong',-18773],
|
||||
['dou',-18763],
|
||||
['du',-18756],
|
||||
['duan',-18741],
|
||||
['dui',-18735],
|
||||
['dun',-18731],
|
||||
['duo',-18722],
|
||||
['e',-18710],
|
||||
['en',-18697],
|
||||
['er',-18696],
|
||||
['fa',-18526],
|
||||
['fan',-18518],
|
||||
['fang',-18501],
|
||||
['fei',-18490],
|
||||
['fen',-18478],
|
||||
['feng',-18463],
|
||||
['fo',-18448],
|
||||
['fou',-18447],
|
||||
['fu',-18446],
|
||||
['ga',-18239],
|
||||
['gai',-18237],
|
||||
['gan',-18231],
|
||||
['gang',-18220],
|
||||
['gao',-18211],
|
||||
['ge',-18201],
|
||||
['gei',-18184],
|
||||
['gen',-18183],
|
||||
['geng',-18181],
|
||||
['gong',-18012],
|
||||
['gou',-17997],
|
||||
['gu',-17988],
|
||||
['gua',-17970],
|
||||
['guai',-17964],
|
||||
['guan',-17961],
|
||||
['guang',-17950],
|
||||
['gui',-17947],
|
||||
['gun',-17931],
|
||||
['guo',-17928],
|
||||
['ha',-17922],
|
||||
['hai',-17759],
|
||||
['han',-17752],
|
||||
['hang',-17733],
|
||||
['hao',-17730],
|
||||
['he',-17721],
|
||||
['hei',-17703],
|
||||
['hen',-17701],
|
||||
['heng',-17697],
|
||||
['hong',-17692],
|
||||
['hou',-17683],
|
||||
['hu',-17676],
|
||||
['hua',-17496],
|
||||
['huai',-17487],
|
||||
['huan',-17482],
|
||||
['huang',-17468],
|
||||
['hui',-17454],
|
||||
['hun',-17433],
|
||||
['huo',-17427],
|
||||
['ji',-17417],
|
||||
['jia',-17202],
|
||||
['jian',-17185],
|
||||
['jiang',-16983],
|
||||
['jiao',-16970],
|
||||
['jie',-16942],
|
||||
['jin',-16915],
|
||||
['jing',-16733],
|
||||
['jiong',-16708],
|
||||
['jiu',-16706],
|
||||
['ju',-16689],
|
||||
['juan',-16664],
|
||||
['jue',-16657],
|
||||
['jun',-16647],
|
||||
['ka',-16474],
|
||||
['kai',-16470],
|
||||
['kan',-16465],
|
||||
['kang',-16459],
|
||||
['kao',-16452],
|
||||
['ke',-16448],
|
||||
['ken',-16433],
|
||||
['keng',-16429],
|
||||
['kong',-16427],
|
||||
['kou',-16423],
|
||||
['ku',-16419],
|
||||
['kua',-16412],
|
||||
['kuai',-16407],
|
||||
['kuan',-16403],
|
||||
['kuang',-16401],
|
||||
['kui',-16393],
|
||||
['kun',-16220],
|
||||
['kuo',-16216],
|
||||
['la',-16212],
|
||||
['lai',-16205],
|
||||
['lan',-16202],
|
||||
['lang',-16187],
|
||||
['lao',-16180],
|
||||
['le',-16171],
|
||||
['lei',-16169],
|
||||
['leng',-16158],
|
||||
['li',-16155],
|
||||
['lia',-15959],
|
||||
['lian',-15958],
|
||||
['liang',-15944],
|
||||
['liao',-15933],
|
||||
['lie',-15920],
|
||||
['lin',-15915],
|
||||
['ling',-15903],
|
||||
['liu',-15889],
|
||||
['long',-15878],
|
||||
['lou',-15707],
|
||||
['lu',-15701],
|
||||
['lv',-15681],
|
||||
['luan',-15667],
|
||||
['lue',-15661],
|
||||
['lun',-15659],
|
||||
['luo',-15652],
|
||||
['ma',-15640],
|
||||
['mai',-15631],
|
||||
['man',-15625],
|
||||
['mang',-15454],
|
||||
['mao',-15448],
|
||||
['me',-15436],
|
||||
['mei',-15435],
|
||||
['men',-15419],
|
||||
['meng',-15416],
|
||||
['mi',-15408],
|
||||
['mian',-15394],
|
||||
['miao',-15385],
|
||||
['mie',-15377],
|
||||
['min',-15375],
|
||||
['ming',-15369],
|
||||
['miu',-15363],
|
||||
['mo',-15362],
|
||||
['mou',-15183],
|
||||
['mu',-15180],
|
||||
['na',-15165],
|
||||
['nai',-15158],
|
||||
['nan',-15153],
|
||||
['nang',-15150],
|
||||
['nao',-15149],
|
||||
['ne',-15144],
|
||||
['nei',-15143],
|
||||
['nen',-15141],
|
||||
['neng',-15140],
|
||||
['ni',-15139],
|
||||
['nian',-15128],
|
||||
['niang',-15121],
|
||||
['niao',-15119],
|
||||
['nie',-15117],
|
||||
['nin',-15110],
|
||||
['ning',-15109],
|
||||
['niu',-14941],
|
||||
['nong',-14937],
|
||||
['nu',-14933],
|
||||
['nv',-14930],
|
||||
['nuan',-14929],
|
||||
['nue',-14928],
|
||||
['nuo',-14926],
|
||||
['o',-14922],
|
||||
['ou',-14921],
|
||||
['pa',-14914],
|
||||
['pai',-14908],
|
||||
['pan',-14902],
|
||||
['pang',-14894],
|
||||
['pao',-14889],
|
||||
['pei',-14882],
|
||||
['pen',-14873],
|
||||
['peng',-14871],
|
||||
['pi',-14857],
|
||||
['pian',-14678],
|
||||
['piao',-14674],
|
||||
['pie',-14670],
|
||||
['pin',-14668],
|
||||
['ping',-14663],
|
||||
['po',-14654],
|
||||
['pu',-14645],
|
||||
['qi',-14630],
|
||||
['qia',-14594],
|
||||
['qian',-14429],
|
||||
['qiang',-14407],
|
||||
['qiao',-14399],
|
||||
['qie',-14384],
|
||||
['qin',-14379],
|
||||
['qing',-14368],
|
||||
['qiong',-14355],
|
||||
['qiu',-14353],
|
||||
['qu',-14345],
|
||||
['quan',-14170],
|
||||
['que',-14159],
|
||||
['qun',-14151],
|
||||
['ran',-14149],
|
||||
['rang',-14145],
|
||||
['rao',-14140],
|
||||
['re',-14137],
|
||||
['ren',-14135],
|
||||
['reng',-14125],
|
||||
['ri',-14123],
|
||||
['rong',-14122],
|
||||
['rou',-14112],
|
||||
['ru',-14109],
|
||||
['ruan',-14099],
|
||||
['rui',-14097],
|
||||
['run',-14094],
|
||||
['ruo',-14092],
|
||||
['sa',-14090],
|
||||
['sai',-14087],
|
||||
['san',-14083],
|
||||
['sang',-13917],
|
||||
['sao',-13914],
|
||||
['se',-13910],
|
||||
['sen',-13907],
|
||||
['seng',-13906],
|
||||
['sha',-13905],
|
||||
['shai',-13896],
|
||||
['shan',-13894],
|
||||
['shang',-13878],
|
||||
['shao',-13870],
|
||||
['she',-13859],
|
||||
['shen',-13847],
|
||||
['sheng',-13831],
|
||||
['shi',-13658],
|
||||
['shou',-13611],
|
||||
['shu',-13601],
|
||||
['shua',-13406],
|
||||
['shuai',-13404],
|
||||
['shuan',-13400],
|
||||
['shuang',-13398],
|
||||
['shui',-13395],
|
||||
['shun',-13391],
|
||||
['shuo',-13387],
|
||||
['si',-13383],
|
||||
['song',-13367],
|
||||
['sou',-13359],
|
||||
['su',-13356],
|
||||
['suan',-13343],
|
||||
['sui',-13340],
|
||||
['sun',-13329],
|
||||
['suo',-13326],
|
||||
['ta',-13318],
|
||||
['tai',-13147],
|
||||
['tan',-13138],
|
||||
['tang',-13120],
|
||||
['tao',-13107],
|
||||
['te',-13096],
|
||||
['teng',-13095],
|
||||
['ti',-13091],
|
||||
['tian',-13076],
|
||||
['tiao',-13068],
|
||||
['tie',-13063],
|
||||
['ting',-13060],
|
||||
['tong',-12888],
|
||||
['tou',-12875],
|
||||
['tu',-12871],
|
||||
['tuan',-12860],
|
||||
['tui',-12858],
|
||||
['tun',-12852],
|
||||
['tuo',-12849],
|
||||
['wa',-12838],
|
||||
['wai',-12831],
|
||||
['wan',-12829],
|
||||
['wang',-12812],
|
||||
['wei',-12802],
|
||||
['wen',-12607],
|
||||
['weng',-12597],
|
||||
['wo',-12594],
|
||||
['wu',-12585],
|
||||
['xi',-12556],
|
||||
['xia',-12359],
|
||||
['xian',-12346],
|
||||
['xiang',-12320],
|
||||
['xiao',-12300],
|
||||
['xie',-12120],
|
||||
['xin',-12099],
|
||||
['xing',-12089],
|
||||
['xiong',-12074],
|
||||
['xiu',-12067],
|
||||
['xu',-12058],
|
||||
['xuan',-12039],
|
||||
['xue',-11867],
|
||||
['xun',-11861],
|
||||
['ya',-11847],
|
||||
['yan',-11831],
|
||||
['yang',-11798],
|
||||
['yao',-11781],
|
||||
['ye',-11604],
|
||||
['yi',-11589],
|
||||
['yin',-11536],
|
||||
['ying',-11358],
|
||||
['yo',-11340],
|
||||
['yo',-11340],
|
||||
['yong',-11339],
|
||||
['you',-11324],
|
||||
['yu',-11303],
|
||||
['yuan',-11097],
|
||||
['yue',-11077],
|
||||
['yun',-11067],
|
||||
['za',-11055],
|
||||
['zai',-11052],
|
||||
['zan',-11045],
|
||||
['zang',-11041],
|
||||
['zao',-11038],
|
||||
['ze',-11024],
|
||||
['zei',-11020],
|
||||
['zen',-11019],
|
||||
['zeng',-11018],
|
||||
['zha',-11014],
|
||||
['zhai',-10838],
|
||||
['zhan',-10832],
|
||||
['zhang',-10815],
|
||||
['zhao',-10800],
|
||||
['zhe',-10790],
|
||||
['zhen',-10780],
|
||||
['zheng',-10764],
|
||||
['zhi',-10587],
|
||||
['zhong',-10544],
|
||||
['zhou',-10533],
|
||||
['zhu',-10519],
|
||||
['zhua',-10331],
|
||||
['zhuai',-10329],
|
||||
['zhuan',-10328],
|
||||
['zhuang',-10322],
|
||||
['zhui',-10315],
|
||||
['zhun',-10309],
|
||||
['zhuo',-10307],
|
||||
['zi',-10296],
|
||||
['zong',-10281],
|
||||
['zou',-10274],
|
||||
['zu',-10270],
|
||||
['zuan',-10262],
|
||||
['zui',-10260],
|
||||
['zun',-10256],
|
||||
['zuo',-10254]
|
||||
];
|
||||
|
||||
protected static $py_mult_list = [
|
||||
'19969' => 'DZ',
|
||||
'19975' => 'WM',
|
||||
'19988' => 'QJ',
|
||||
'20048' => 'YL',
|
||||
'20056' => 'SC',
|
||||
'20060' => 'NM',
|
||||
'20094' => 'QG',
|
||||
'20127' => 'QJ',
|
||||
'20167' => 'QC',
|
||||
'20193' => 'YG',
|
||||
'20250' => 'KH',
|
||||
'20256' => 'ZC',
|
||||
'20282' => 'SC',
|
||||
'20285' => 'QJG',
|
||||
'20291' => 'TD',
|
||||
'20314' => 'YD',
|
||||
'20340' => 'NE',
|
||||
'20375' => 'TD',
|
||||
'20389' => 'YJ',
|
||||
'20391' => 'CZ',
|
||||
'20415' => 'PB',
|
||||
'20446' => 'YS',
|
||||
'20447' => 'SQ',
|
||||
'20504' => 'TC',
|
||||
'20608' => 'KG',
|
||||
'20854' => 'QJ',
|
||||
'20857' => 'ZC',
|
||||
'20911' => 'PF',
|
||||
'20504' => 'TC',
|
||||
'20608' => 'KG',
|
||||
'20854' => 'QJ',
|
||||
'20857' => 'ZC',
|
||||
'20911' => 'PF',
|
||||
'20985' => 'AW',
|
||||
'21032' => 'PB',
|
||||
'21048' => 'XQ',
|
||||
'21049' => 'SC',
|
||||
'21089' => 'YS',
|
||||
'21119' => 'JC',
|
||||
'21242' => 'SB',
|
||||
'21273' => 'SC',
|
||||
'21305' => 'YP',
|
||||
'21306' => 'QO',
|
||||
'21330' => 'ZC',
|
||||
'21333' => 'SDC',
|
||||
'21345' => 'QK',
|
||||
'21378' => 'CA',
|
||||
'21397' => 'SC',
|
||||
'21414' => 'XS',
|
||||
'21442' => 'SC',
|
||||
'21477' => 'JG',
|
||||
'21480' => 'TD',
|
||||
'21484' => 'ZS',
|
||||
'21494' => 'YX',
|
||||
'21505' => 'YX',
|
||||
'21512' => 'HG',
|
||||
'21523' => 'XH',
|
||||
'21537' => 'PB',
|
||||
'21542' => 'PF',
|
||||
'21549' => 'KH',
|
||||
'21571' => 'E',
|
||||
'21574' => 'DA',
|
||||
'21588' => 'TD',
|
||||
'21589' => 'O',
|
||||
'21618' => 'ZC',
|
||||
'21621' => 'KHA',
|
||||
'21632' => 'ZJ',
|
||||
'21654' => 'KG',
|
||||
'21679' => 'LKG',
|
||||
'21683' => 'KH',
|
||||
'21710' => 'A',
|
||||
'21719' => 'YH',
|
||||
'21734' => 'WOE',
|
||||
'21769' => 'A',
|
||||
'21780' => 'WN',
|
||||
'21804' => 'XH',
|
||||
'21834' => 'A',
|
||||
'21899' => 'ZD',
|
||||
'21903' => 'RN',
|
||||
'21908' => 'WO',
|
||||
'21939' => 'ZC',
|
||||
'21956' => 'SA',
|
||||
'21964' => 'YA',
|
||||
'21970' => 'TD',
|
||||
'22003' => 'A',
|
||||
'22031' => 'JG',
|
||||
'22040' => 'XS',
|
||||
'22060' => 'ZC',
|
||||
'22066' => 'ZC',
|
||||
'22079' => 'MH',
|
||||
'22129' => 'XJ',
|
||||
'22179' => 'XA',
|
||||
'22237' => 'NJ',
|
||||
'22244' => 'TD',
|
||||
'22280' => 'JQ',
|
||||
'22300' => 'YH',
|
||||
'22313' => 'XW',
|
||||
'22331' => 'YQ',
|
||||
'22343' => 'YJ',
|
||||
'22351' => 'PH',
|
||||
'22395' => 'DC',
|
||||
'22412' => 'TD',
|
||||
'22484' => 'PB',
|
||||
'22500' => 'PB',
|
||||
'22534' => 'ZD',
|
||||
'22549' => 'DH',
|
||||
'22561' => 'PB',
|
||||
'22612' => 'TD',
|
||||
'22771' => 'KQ',
|
||||
'22831' => 'HB',
|
||||
'22841' => 'JG',
|
||||
'22855' => 'QJ',
|
||||
'22865' => 'XQ',
|
||||
'23013' => 'ML',
|
||||
'23081' => 'WM',
|
||||
'23487' => 'SX',
|
||||
'23558' => 'QJ',
|
||||
'23561' => 'YW',
|
||||
'23586' => 'YW',
|
||||
'23614' => 'YW',
|
||||
'23615' => 'SN',
|
||||
'23631' => 'PB',
|
||||
'23646' => 'ZS',
|
||||
'23663' => 'ZT',
|
||||
'23673' => 'YG',
|
||||
'23762' => 'TD',
|
||||
'23769' => 'ZS',
|
||||
'23780' => 'QJ',
|
||||
'23884' => 'QK',
|
||||
'24055' => 'XH',
|
||||
'24113' => 'DC',
|
||||
'24162' => 'ZC',
|
||||
'24191' => 'GA',
|
||||
'24273' => 'QJ',
|
||||
'24324' => 'NL',
|
||||
'24377' => 'TD',
|
||||
'24378' => 'QJ',
|
||||
'24439' => 'PF',
|
||||
'24554' => 'ZS',
|
||||
'24683' => 'TD',
|
||||
'24694' => 'WE',
|
||||
'24733' => 'LK',
|
||||
'24925' => 'TN',
|
||||
'25094' => 'ZG',
|
||||
'25100' => 'XQ',
|
||||
'25103' => 'XH',
|
||||
'25153' => 'PB',
|
||||
'25170' => 'PB',
|
||||
'25179' => 'KG',
|
||||
'25203' => 'PB',
|
||||
'25240' => 'ZS',
|
||||
'25282' => 'FB',
|
||||
'25303' => 'NA',
|
||||
'25324' => 'KG',
|
||||
'25341' => 'ZY',
|
||||
'25373' => 'WZ',
|
||||
'25375' => 'XJ',
|
||||
'25384' => 'A',
|
||||
'25457' => 'A',
|
||||
'25528' => 'SD',
|
||||
'25530' => 'SC',
|
||||
'25552' => 'TD',
|
||||
'25774' => 'ZC',
|
||||
'25874' => 'ZC',
|
||||
'26044' => 'YW',
|
||||
'26080' => 'WM',
|
||||
'26292' => 'PB',
|
||||
'26333' => 'PB',
|
||||
'26355' => 'ZY',
|
||||
'26366' => 'CZ',
|
||||
'26397' => 'ZC',
|
||||
'26399' => 'QJ',
|
||||
'26415' => 'ZS',
|
||||
'26451' => 'SB',
|
||||
'26526' => 'ZC',
|
||||
'26552' => 'JG',
|
||||
'26561' => 'TD',
|
||||
'26588' => 'JG',
|
||||
'26597' => 'CZ',
|
||||
'26629' => 'ZS',
|
||||
'26638' => 'YL',
|
||||
'26646' => 'XQ',
|
||||
'26653' => 'KG',
|
||||
'26657' => 'XJ',
|
||||
'26727' => 'HG',
|
||||
'26894' => 'ZC',
|
||||
'26937' => 'ZS',
|
||||
'26946' => 'ZC',
|
||||
'26999' => 'KJ',
|
||||
'27099' => 'KJ',
|
||||
'27449' => 'YQ',
|
||||
'27481' => 'XS',
|
||||
'27542' => 'ZS',
|
||||
'27663' => 'ZS',
|
||||
'27748' => 'TS',
|
||||
'27784' => 'SC',
|
||||
'27788' => 'ZD',
|
||||
'27795' => 'TD',
|
||||
'27812' => 'O',
|
||||
'27850' => 'PB',
|
||||
'27852' => 'MB',
|
||||
'27895' => 'SL',
|
||||
'27898' => 'PL',
|
||||
'27973' => 'QJ',
|
||||
'27981' => 'KH',
|
||||
'27986' => 'HX',
|
||||
'27994' => 'XJ',
|
||||
'28044' => 'YC',
|
||||
'28065' => 'WG',
|
||||
'28177' => 'SM',
|
||||
'28267' => 'QJ',
|
||||
'28291' => 'KH',
|
||||
'28337' => 'ZQ',
|
||||
'28463' => 'TL',
|
||||
'28548' => 'DC',
|
||||
'28601' => 'TD',
|
||||
'28689' => 'PB',
|
||||
'28805' => 'JG',
|
||||
'28820' => 'QG',
|
||||
'28846' => 'PB',
|
||||
'28952' => 'TD',
|
||||
'28975' => 'ZC',
|
||||
'29100' => 'A',
|
||||
'29325' => 'QJ',
|
||||
'29575' => 'SL',
|
||||
'29602' => 'FB',
|
||||
'30010' => 'TD',
|
||||
'30044' => 'CX',
|
||||
'30058' => 'PF',
|
||||
'30091' => 'YSP',
|
||||
'30111' => 'YN',
|
||||
'30229' => 'XJ',
|
||||
'30427' => 'SC',
|
||||
'30465' => 'SX',
|
||||
'30631' => 'YQ',
|
||||
'30655' => 'QJ',
|
||||
'30684' => 'QJG',
|
||||
'30707' => 'SD',
|
||||
'30729' => 'XH',
|
||||
'30796' => 'LG',
|
||||
'30917' => 'PB',
|
||||
'31074' => 'NM',
|
||||
'31085' => 'JZ',
|
||||
'31109' => 'SC',
|
||||
'31181' => 'ZC',
|
||||
'31192' => 'MLB',
|
||||
'31293' => 'JQ',
|
||||
'31400' => 'YX',
|
||||
'31584' => 'YJ',
|
||||
'31896' => 'ZN',
|
||||
'31909' => 'ZY',
|
||||
'31995' => 'XJ',
|
||||
'32321' => 'PF',
|
||||
'32327' => 'ZY',
|
||||
'32418' => 'HG',
|
||||
'32420' => 'XQ',
|
||||
'32421' => 'HG',
|
||||
'32438' => 'LG',
|
||||
'32473' => 'GJ',
|
||||
'32488' => 'TD',
|
||||
'32521' => 'QJ',
|
||||
'32527' => 'PB',
|
||||
'32562' => 'ZSQ',
|
||||
'32564' => 'JZ',
|
||||
'32735' => 'ZD',
|
||||
'32793' => 'PB',
|
||||
'33071' => 'PF',
|
||||
'33098' => 'XL',
|
||||
'33100' => 'YA',
|
||||
'33152' => 'PB',
|
||||
'33261' => 'CX',
|
||||
'33324' => 'BP',
|
||||
'33333' => 'TD',
|
||||
'33406' => 'YA',
|
||||
'33426' => 'WM',
|
||||
'33432' => 'PB',
|
||||
'33445' => 'JG',
|
||||
'33486' => 'ZN',
|
||||
'33493' => 'TS',
|
||||
'33507' => 'QJ',
|
||||
'33540' => 'QJ',
|
||||
'33544' => 'ZC',
|
||||
'33564' => 'XQ',
|
||||
'33617' => 'YT',
|
||||
'33632' => 'QJ',
|
||||
'33636' => 'XH',
|
||||
'33637' => 'YX',
|
||||
'33694' => 'WG',
|
||||
'33705' => 'PF',
|
||||
'33728' => 'YW',
|
||||
'33882' => 'SR',
|
||||
'34067' => 'WM',
|
||||
'34074' => 'YW',
|
||||
'34121' => 'QJ',
|
||||
'34255' => 'ZC',
|
||||
'34259' => 'XL',
|
||||
'34425' => 'JH',
|
||||
'34430' => 'XH',
|
||||
'34485' => 'KH',
|
||||
'34503' => 'YS',
|
||||
'34532' => 'HG',
|
||||
'34552' => 'XS',
|
||||
'34558' => 'YE',
|
||||
'34593' => 'ZL',
|
||||
'34660' => 'YQ',
|
||||
'34892' => 'XH',
|
||||
'34928' => 'SC',
|
||||
'34999' => 'QJ',
|
||||
'35048' => 'PB',
|
||||
'35059' => 'SC',
|
||||
'35098' => 'ZC',
|
||||
'35203' => 'TQ',
|
||||
'35265' => 'JX',
|
||||
'35299' => 'JX',
|
||||
'35782' => 'SZ',
|
||||
'35828' => 'YS',
|
||||
'35830' => 'E',
|
||||
'35843' => 'TD',
|
||||
'35895' => 'YG',
|
||||
'35977' => 'MH',
|
||||
'36158' => 'JG',
|
||||
'36228' => 'QJ',
|
||||
'36426' => 'XQ',
|
||||
'36466' => 'DC',
|
||||
'36710' => 'JC',
|
||||
'36711' => 'ZYG',
|
||||
'36767' => 'PB',
|
||||
'36866' => 'SK',
|
||||
'36951' => 'YW',
|
||||
'37034' => 'YX',
|
||||
'37063' => 'XH',
|
||||
'37218' => 'ZC',
|
||||
'37325' => 'ZC',
|
||||
'38063' => 'PB',
|
||||
'38079' => 'TD',
|
||||
'38085' => 'QY',
|
||||
'38107' => 'DC',
|
||||
'38116' => 'TD',
|
||||
'38123' => 'YD',
|
||||
'38224' => 'HG',
|
||||
'38241' => 'XTC',
|
||||
'38271' => 'ZC',
|
||||
'38415' => 'YE',
|
||||
'38426' => 'KH',
|
||||
'38461' => 'YD',
|
||||
'38463' => 'AE',
|
||||
'38466' => 'PB',
|
||||
'38477' => 'XJ',
|
||||
'38518' => 'YT',
|
||||
'38551' => 'WK',
|
||||
'38585' => 'ZC',
|
||||
'38704' => 'XS',
|
||||
'38739' => 'LJ',
|
||||
'38761' => 'GJ',
|
||||
'38808' => 'SQ',
|
||||
'39048' => 'JG',
|
||||
'39049' => 'XJ',
|
||||
'39052' => 'HG',
|
||||
'39076' => 'CZ',
|
||||
'39271' => 'XT',
|
||||
'39534' => 'TD',
|
||||
'39552' => 'TD',
|
||||
'39584' => 'PB',
|
||||
'39647' => 'SB',
|
||||
'39730' => 'LG',
|
||||
'39748' => 'TPB',
|
||||
'40109' => 'ZQ',
|
||||
'40479' => 'ND',
|
||||
'40516' => 'HG',
|
||||
'40536' => 'HG',
|
||||
'40583' => 'QJ',
|
||||
'40765' => 'YQ',
|
||||
'40784' => 'QJ',
|
||||
'40840' => 'YK',
|
||||
'40863' => 'QJG'
|
||||
];
|
||||
|
||||
protected static $code = 'utf-8';
|
||||
|
||||
public static function getstr($str)
|
||||
{
|
||||
$code = static::$code;
|
||||
$arr = array();
|
||||
for ($i = 0, $len = mb_strlen($str, $code); $i < $len; $i++) {
|
||||
$single = mb_substr($str, $i, 1, $code);
|
||||
$ch = static::utf8_unicode($single, $code); // 获得unicode码
|
||||
$w = static::$py_mult_list[$ch];
|
||||
$arr[] = ($w) ? $w : static::getfirstchar($single);
|
||||
}
|
||||
|
||||
$result = array("");
|
||||
foreach ($arr as $v) {
|
||||
if ($v) {
|
||||
$result = static::makePY_list($v, $result);
|
||||
}
|
||||
}
|
||||
return implode('|', $result);
|
||||
}
|
||||
|
||||
public static function makePY_list($str, $arr)
|
||||
{
|
||||
for ($i = 0, $len = strlen($str); $i < $len; $i++) {
|
||||
foreach ($arr as $t) {
|
||||
$re[] = $t . $str[$i];
|
||||
}
|
||||
}
|
||||
return $re;
|
||||
}
|
||||
|
||||
// 读取utf8字符的unicode码
|
||||
public static function utf8_unicode($c, $charset = "utf-8")
|
||||
{
|
||||
if ($charset != "utf-8") {
|
||||
$c = iconv($charset, "utf-8", $c);
|
||||
}
|
||||
switch (strlen($c)) {
|
||||
case 1:
|
||||
return ord($c);
|
||||
case 2:
|
||||
$n = (ord($c[0]) & 0x3f) << 6;
|
||||
$n+= ord($c[1]) & 0x3f;
|
||||
return $n;
|
||||
case 3:
|
||||
$n = (ord($c[0]) & 0x1f) << 12;
|
||||
$n+= (ord($c[1]) & 0x3f) << 6;
|
||||
$n+= ord($c[2]) & 0x3f;
|
||||
return $n;
|
||||
case 4:
|
||||
$n = (ord($c[0]) & 0x0f) << 18;
|
||||
$n+= (ord($c[1]) & 0x3f) << 12;
|
||||
$n+= (ord($c[2]) & 0x3f) << 6;
|
||||
$n+= ord($c[3]) & 0x3f;
|
||||
return $n;
|
||||
}
|
||||
}
|
||||
|
||||
// 获得单个汉字拼音首字母
|
||||
public static function getfirstchar($s0)
|
||||
{
|
||||
$fchar = ord($s0{0});
|
||||
|
||||
if ($fchar >= ord('A') and $fchar <= ord('z')) {
|
||||
return strtoupper($s0{0});
|
||||
}
|
||||
|
||||
$s1 = iconv('UTF-8', 'gb2312', $s0);
|
||||
$s2 = iconv('gb2312', 'UTF-8', $s1);
|
||||
if ($s2 == $s0) {
|
||||
$s = $s1;
|
||||
} else {
|
||||
$s = $s0;
|
||||
}
|
||||
$asc = ord($s{0}) * 256 + ord($s{1}) - 65536;
|
||||
if ($asc >= - 20319 and $asc <= - 20284) {
|
||||
return "A";
|
||||
}
|
||||
if ($asc >= - 20283 and $asc <= - 19776) {
|
||||
return "B";
|
||||
}
|
||||
if ($asc >= - 19775 and $asc <= - 19219) {
|
||||
return "C";
|
||||
}
|
||||
if ($asc >= - 19218 and $asc <= - 18711) {
|
||||
return "D";
|
||||
}
|
||||
if ($asc >= - 18710 and $asc <= - 18527) {
|
||||
return "E";
|
||||
}
|
||||
if ($asc >= - 18526 and $asc <= - 18240) {
|
||||
return "F";
|
||||
}
|
||||
if ($asc >= - 18239 and $asc <= - 17923) {
|
||||
return "G";
|
||||
}
|
||||
if ($asc >= - 17922 and $asc <= - 17418) {
|
||||
return "H";
|
||||
}
|
||||
if ($asc >= - 17417 and $asc <= - 16475) {
|
||||
return "J";
|
||||
}
|
||||
if ($asc >= - 16474 and $asc <= - 16213) {
|
||||
return "K";
|
||||
}
|
||||
if ($asc >= - 16212 and $asc <= - 15641) {
|
||||
return "L";
|
||||
}
|
||||
if ($asc >= - 15640 and $asc <= - 15166) {
|
||||
return "M";
|
||||
}
|
||||
if ($asc >= - 15165 and $asc <= - 14923) {
|
||||
return "N";
|
||||
}
|
||||
if ($asc >= - 14922 and $asc <= - 14915) {
|
||||
return "O";
|
||||
}
|
||||
if ($asc >= - 14914 and $asc <= - 14631) {
|
||||
return "P";
|
||||
}
|
||||
if ($asc >= - 14630 and $asc <= - 14150) {
|
||||
return "Q";
|
||||
}
|
||||
if ($asc >= - 14149 and $asc <= - 14091) {
|
||||
return "R";
|
||||
}
|
||||
if ($asc >= - 14090 and $asc <= - 13319) {
|
||||
return "S";
|
||||
}
|
||||
if ($asc >= - 13318 and $asc <= - 12839) {
|
||||
return "T";
|
||||
}
|
||||
if ($asc >= - 12838 and $asc <= - 12557) {
|
||||
return "W";
|
||||
}
|
||||
if ($asc >= - 12556 and $asc <= - 11848) {
|
||||
return "X";
|
||||
}
|
||||
if ($asc >= - 11847 and $asc <= - 11056) {
|
||||
return "Y";
|
||||
}
|
||||
if ($asc >= - 11055 and $asc <= - 10247) {
|
||||
return "Z";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将ASCII编码转化为字符串.
|
||||
*
|
||||
* @param integer $num
|
||||
* @return string
|
||||
*/
|
||||
protected static function num2str($num)
|
||||
{
|
||||
if ($num > 0 && $num < 160) {
|
||||
return chr($num);
|
||||
} elseif ($num < -20319 || $num > -10247) {
|
||||
return '';
|
||||
} else {
|
||||
$total = sizeof(static::$lib) - 1;
|
||||
for ($i = $total; $i >= 0; $i--) {
|
||||
if (static::$lib[$i][1] <= $num) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return static::$lib[$i][0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字转化并输出拼音
|
||||
*
|
||||
* @param string $str 所要转化拼音的汉字
|
||||
* @param boolean $utf8 汉字编码是否为utf8
|
||||
* @return string
|
||||
*/
|
||||
public static function output($str, $utf8 = true)
|
||||
{
|
||||
// 参数分析
|
||||
if ($str == '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 编码转换.
|
||||
$str = ($utf8==true) ? iconv('utf-8', 'gbk', $str) : $str;
|
||||
$num = strlen($str);
|
||||
$pinyin = '';
|
||||
|
||||
for ($i=0; $i<$num; $i++) {
|
||||
$temp = ord(substr($str, $i, 1));
|
||||
if ($temp > 160) {
|
||||
$temp2 = ord(substr($str, ++$i, 1));
|
||||
$temp = $temp * 256 + $temp2-65536;
|
||||
}
|
||||
$pinyin .= static::num2str($temp);
|
||||
}
|
||||
// 输出的拼音编码转换.
|
||||
return ($utf8 == true) ? iconv('gbk', 'utf-8', $pinyin) : $pinyin;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,156 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
/**
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use App\Support\Base32;
|
||||
|
||||
class Totp
|
||||
{
|
||||
protected $passCodeLength;
|
||||
protected $secretLength;
|
||||
protected $pinModulo;
|
||||
|
||||
/**
|
||||
* @param int $passCodeLength
|
||||
* @param int $secretLength
|
||||
*/
|
||||
public function __construct($passCodeLength = 6, $secretLength = 10)
|
||||
{
|
||||
$this->passCodeLength = $passCodeLength;
|
||||
$this->secretLength = $secretLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* get TimeStamp
|
||||
* period.
|
||||
* @return integer
|
||||
**/
|
||||
public function getTimeStamp()
|
||||
{
|
||||
return floor(time() / 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $secret
|
||||
* @param $code
|
||||
* @return bool
|
||||
*/
|
||||
public function generateByTime($secret, $code)
|
||||
{
|
||||
for ($i = -1; $i <= 1; $i++) {
|
||||
if ($this->generateByCounter($secret, $this->getTimeStamp() + $i) == $code) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $secret
|
||||
* @param null $time
|
||||
* @return string
|
||||
*/
|
||||
public function generateByCounter($secret, $time = null)
|
||||
{
|
||||
if ($time === null) {
|
||||
$time = $this->getTimeStamp();
|
||||
}
|
||||
|
||||
$secret = Base32::decode($secret);
|
||||
|
||||
$time = pack("N", $time);
|
||||
$time = str_pad($time, 8, chr(0), STR_PAD_LEFT);
|
||||
|
||||
$hash = hash_hmac('sha1', $time, $secret, true);
|
||||
$offset = ord(substr($hash, -1));
|
||||
$offset = $offset & 0xF;
|
||||
|
||||
$truncatedHash = self::hashToInt($hash, $offset) & 0x7FFFFFFF;
|
||||
$pinValue = str_pad($truncatedHash % pow(10, $this->passCodeLength), $this->passCodeLength, "0", STR_PAD_LEFT);
|
||||
|
||||
return $pinValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $bytes
|
||||
* @param $start
|
||||
* @return integer
|
||||
*/
|
||||
protected static function hashToInt($bytes, $start)
|
||||
{
|
||||
$input = substr($bytes, $start, strlen($bytes) - $start);
|
||||
$val2 = unpack("N", substr($input, 0, 4));
|
||||
|
||||
return $val2[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $user
|
||||
* @param string $hostname
|
||||
* @param string $secret
|
||||
* @return string
|
||||
*/
|
||||
public function getURL($user, $hostname, $secret)
|
||||
{
|
||||
$encoderURL = sprintf("otpauth://totp/%s@%s%%3Fsecret%%3D%s", $user, $hostname, $secret);
|
||||
return $encoderURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function generateSecret($secret = null)
|
||||
{
|
||||
if ($secret === null) {
|
||||
$secret = '';
|
||||
for ($i = 1; $i <= $this->secretLength; $i++) {
|
||||
$c = rand(0, 255);
|
||||
$secret .= pack("c", $c);
|
||||
}
|
||||
}
|
||||
return Base32::encode($secret);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$secret = '2222222222222222';
|
||||
$code = "181419";
|
||||
|
||||
$g = new TimeAuthenticator();
|
||||
|
||||
print "Current Code is: ";
|
||||
print $g->generateByCounter($secret);
|
||||
|
||||
print "\n";
|
||||
|
||||
print "Check if $code is valid: ";
|
||||
|
||||
if ($g->generateByTime($secret, $code))
|
||||
{
|
||||
print "YES \n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "NO \n";
|
||||
}
|
||||
|
||||
$secret = $g->generateSecret();
|
||||
print "Get a new Secret: $secret \n";
|
||||
|
||||
print "The QR Code for this secret (to scan with the Google Authenticator App: \n";
|
||||
print $g->getURL('fvzone','gmail.com', $secret);
|
||||
print "\n";
|
||||
*/
|
||||
@@ -0,0 +1,204 @@
|
||||
<?php namespace App\Support;
|
||||
|
||||
/**
|
||||
* This class provides a streamlined interface to the Sabre VObject classes
|
||||
*/
|
||||
class VObject
|
||||
{
|
||||
/** @var Sabre\VObject\Component */
|
||||
protected $vobject;
|
||||
|
||||
/**
|
||||
* @returns Sabre\VObject\Component
|
||||
*/
|
||||
public function getVObject()
|
||||
{
|
||||
return $this->vobject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parses the VObject
|
||||
* @param string VObject as string
|
||||
* @returns VObject or null
|
||||
*/
|
||||
public static function parse($data)
|
||||
{
|
||||
try {
|
||||
\Sabre\VObject\Property::$classMap['LAST-MODIFIED'] = 'Sabre\VObject\Property\DateTime';
|
||||
$vobject = \Sabre\VObject\Reader::read($data);
|
||||
if ($vobject instanceof \Sabre\VObject\Component) {
|
||||
$vobject = new VObject($vobject);
|
||||
}
|
||||
return $vobject;
|
||||
} catch (\Exception $e) {
|
||||
//OC_Wang_Log::write('vobject', $e->getMessage(), OC_Wang_Log::ERROR);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Escapes semicolons
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function escapeSemicolons($value)
|
||||
{
|
||||
foreach ($value as &$i) {
|
||||
$i = implode("\\\\;", explode(';', $i));
|
||||
}
|
||||
return implode(';', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates an array out of a multivalue property
|
||||
* @param string $value
|
||||
* @return array
|
||||
*/
|
||||
public static function unescapeSemicolons($value)
|
||||
{
|
||||
$array = explode(';', $value);
|
||||
for ($i=0;$i<count($array);$i++) {
|
||||
if (substr($array[$i], -2, 2)=="\\\\") {
|
||||
if (isset($array[$i+1])) {
|
||||
$array[$i] = substr($array[$i], 0, count($array[$i])-2).';'.$array[$i+1];
|
||||
unset($array[$i+1]);
|
||||
} else {
|
||||
$array[$i] = substr($array[$i], 0, count($array[$i])-2).';';
|
||||
}
|
||||
$i = $i - 1;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constuctor
|
||||
* @param Sabre\VObject\Component or string
|
||||
*/
|
||||
public function __construct($vobject_or_name)
|
||||
{
|
||||
if (is_object($vobject_or_name)) {
|
||||
$this->vobject = $vobject_or_name;
|
||||
} else {
|
||||
$this->vobject = new \Sabre\VObject\Component($vobject_or_name);
|
||||
}
|
||||
}
|
||||
|
||||
public function add($item, $itemValue = null)
|
||||
{
|
||||
if ($item instanceof VObject) {
|
||||
$item = $item->getVObject();
|
||||
}
|
||||
$this->vobject->add($item, $itemValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add property to vobject
|
||||
* @param object $name of property
|
||||
* @param object $value of property
|
||||
* @param object $parameters of property
|
||||
* @returns VObject_Property newly created
|
||||
*/
|
||||
public function addProperty($name, $value, $parameters=array())
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$value = VObject::escapeSemicolons($value);
|
||||
}
|
||||
$property = new \Sabre\VObject\Property($name, $value);
|
||||
foreach ($parameters as $name => $value) {
|
||||
$property->parameters[] = new \Sabre\VObject\Parameter($name, $value);
|
||||
}
|
||||
|
||||
$this->vobject->add($property);
|
||||
return $property;
|
||||
}
|
||||
|
||||
public function setUID()
|
||||
{
|
||||
$uid = substr(md5(rand().time()), 0, 10);
|
||||
$this->vobject->add('UID', $uid);
|
||||
}
|
||||
|
||||
public function setString($name, $string)
|
||||
{
|
||||
if ($string != '') {
|
||||
$string = strtr($string, array("\r\n"=>"\n"));
|
||||
$this->vobject->__set($name, $string);
|
||||
} else {
|
||||
$this->vobject->__unset($name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets or unsets the Date and Time for a property.
|
||||
* When $datetime is set to 'now', use the current time
|
||||
* When $datetime is null, unset the property
|
||||
*
|
||||
* @param string property name
|
||||
* @param DateTime $datetime
|
||||
* @param int $dateType
|
||||
* @return void
|
||||
*/
|
||||
public function setDateTime($name, $datetime, $dateType=\Sabre\VObject\Property\DateTime::LOCALTZ)
|
||||
{
|
||||
if ($datetime == 'now') {
|
||||
$datetime = new \DateTime();
|
||||
}
|
||||
if ($datetime instanceof \DateTime) {
|
||||
$datetime_element = new \Sabre\VObject\Property\DateTime($name);
|
||||
$datetime_element->setDateTime($datetime, $dateType);
|
||||
$this->vobject->__set($name, $datetime_element);
|
||||
} else {
|
||||
$this->vobject->__unset($name);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAsString($name)
|
||||
{
|
||||
return $this->vobject->__isset($name) ?
|
||||
$this->vobject->__get($name)->value :
|
||||
'';
|
||||
}
|
||||
|
||||
public function getAsArray($name)
|
||||
{
|
||||
$values = array();
|
||||
if ($this->vobject->__isset($name)) {
|
||||
$values = explode(',', $this->getAsString($name));
|
||||
$values = array_map('trim', $values);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
public function &__get($name)
|
||||
{
|
||||
if ($name == 'children') {
|
||||
return $this->vobject->children;
|
||||
}
|
||||
$return = $this->vobject->__get($name);
|
||||
if ($return instanceof \Sabre\VObject\Component) {
|
||||
$return = new VObject($return);
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function __set($name, $value)
|
||||
{
|
||||
return $this->vobject->__set($name, $value);
|
||||
}
|
||||
|
||||
public function __unset($name)
|
||||
{
|
||||
return $this->vobject->__unset($name);
|
||||
}
|
||||
|
||||
public function __isset($name)
|
||||
{
|
||||
return $this->vobject->__isset($name);
|
||||
}
|
||||
|
||||
public function __call($function, $arguments)
|
||||
{
|
||||
return call_user_func_array(array($this->vobject, $function), $arguments);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user