new pisilinux web sites

This commit is contained in:
Erkan IŞIK
2026-07-01 16:44:17 +03:00
commit b58488b586
21740 changed files with 2066209 additions and 0 deletions
@@ -0,0 +1,35 @@
<?php namespace ZN\Cryptography\Encode;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Config;
class EncodeExtends
{
/**
* Keeps config
*
* @var array
*/
protected static $config;
/**
* Magic constructor
*
* @param void
*
* @return void
*/
public function __construct()
{
self::$config = Config::default('ZN\Cryptography\CryptographyDefaultConfiguration')
::get('Cryptography');
}
}
@@ -0,0 +1,39 @@
<?php namespace ZN\Cryptography\Encode;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\IS;
class GoldenAlgorithm extends EncodeExtends
{
/**
* Generates encrypted data.
*
* @param string $data
* @param string $additional = 'default'
*
* @return string
*/
public static function create(string $data, string $additional = 'default') : string
{
$algo = self::$config['type'];
if( ! IS::hash($algo) )
{
$algo = 'md5';
}
$additional = hash($algo, $additional);
$data = hash($algo, $data);
return hash($algo, $data . $additional);
}
}
@@ -0,0 +1,42 @@
<?php namespace ZN\Cryptography\Encode;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
class RandomPassword
{
/**
* Generates random encrypted data.
*
* @param int $count = 0
* @param string $chars = 'alnum' - options[alnum|numeric|string|alpha|special|all]
*
* @return string
*/
public static function create(int $count = 6, string $chars = 'alnum') : string
{
$password = '';
$alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOQPRSTUVWXYZ';
$numeric = '1234567890';
$special = '*-+/?!.;,:\'\\#$%&{}[]()';
switch( $chars )
{
case 'numeric' : $characters = $numeric; break;
case 'string' :
case 'alpha' : $characters = $alpha; break;
case 'special' : $characters = $special; break;
case 'all' : $characters = $alpha . $numeric . $special; break;
case 'alnum' :
default : $characters = $alpha . $numeric;
}
return substr(str_shuffle($characters), 0, $count);
}
}
@@ -0,0 +1,49 @@
<?php namespace ZN\Cryptography\Encode;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Config;
use ZN\Base;
use ZN\IS;
class SuperAlgorithm extends EncodeExtends
{
/**
* Generates encrypted data.
*
* @param string $data
*
* @return string
*/
public static function create(string $data) : string
{
$projectKey = Config::get('Project', 'key');
$algo = self::$config['type'];
if( ! IS::hash($algo) )
{
$algo = 'md5';
}
if( empty($projectKey) )
{
$additional = hash($algo, Base::host());
}
else
{
$additional = hash($algo, $projectKey);
}
$data = hash($algo, $data);
return hash($algo, $data . $additional);
}
}
@@ -0,0 +1,43 @@
<?php namespace ZN\Cryptography\Encode;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\IS;
use ZN\Singleton;
use ZN\Cryptography\Exception\InvalidArgumentException;
class Type extends EncodeExtends
{
/**
* The specified algorithm encrypts the data according to the type.
*
* @param string $data
* @param string $type = 'md5'
*
* @return string
*/
public static function create(string $data, string $type = 'md5') : string
{
$algos = ['golden', 'super'];
if( ! IS::hash($type) && ! in_array($type, $algos) )
{
throw new InvalidArgumentException;
}
if( in_array($type, $algos) )
{
return Singleton::class('ZN\Cryptography\Encode')->$type($data);
}
return hash($type, $data);
}
}