Библиотека для cis, online, cms1
This commit is contained in:
commit
3c2e614d87
269 changed files with 39854 additions and 0 deletions
52
core/formats/dot.php
Normal file
52
core/formats/dot.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Ãåíåðàöèÿ ôàéëîâ Grpahviz dot
|
||||
*/
|
||||
class Dot
|
||||
{
|
||||
static function getHeader ()
|
||||
{
|
||||
$header =
|
||||
"digraph G {\n"
|
||||
. "\toverlap=false; splines=true;\n"
|
||||
. "\tfontname = \"Verdana\"\n"
|
||||
. "\tfontsize = 8\n"
|
||||
. "\tnode [\n"
|
||||
. "\t\tfontname = \"Verdana\"\n"
|
||||
. "\t\tfontsize = 8\n"
|
||||
. "\t\tshape = \"record\"\n"
|
||||
. "\t]\n"
|
||||
. "\tedge [\n"
|
||||
. "\t\tfontname = \"Verdana\"\n"
|
||||
. "\t\tfontsize = 8\n"
|
||||
. "\t]\n";
|
||||
|
||||
return $header;
|
||||
}
|
||||
|
||||
static function getFooter ()
|
||||
{
|
||||
$footer = "}\n";
|
||||
return $footer;
|
||||
}
|
||||
|
||||
function assocToDot (array $array, array $label)
|
||||
{
|
||||
$result = array (self::getHeader());
|
||||
// Ìåòêè
|
||||
foreach ($label as $value) {
|
||||
$result [] = "\t\"{$value[0]}\" [ label = \"{$value[1]}\" ] \n";
|
||||
}
|
||||
// Àññîöèàöèè
|
||||
foreach ($array as $key => $value) {
|
||||
foreach ($value as $n) {
|
||||
$result [] = "\t\"$key\" -> \"$n\"\n";
|
||||
}
|
||||
}
|
||||
$result [] = self::getFooter();
|
||||
return implode("", $result);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
86
core/formats/helix.php
Normal file
86
core/formats/helix.php
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
|
||||
define ('URL_CLIP', 0);
|
||||
define ('URL_DIRECTORY', 1);
|
||||
|
||||
class HAuthorize {
|
||||
public $password;
|
||||
public $uuid;
|
||||
public $uuid_writeable;
|
||||
|
||||
public function __construct () {
|
||||
$this->uuid = "*";
|
||||
$this->uuid_writeable = 1;
|
||||
}
|
||||
|
||||
public function getString () {
|
||||
return "{$this->password};{$this->uuid};{$this->uuid_writeable}";
|
||||
}
|
||||
|
||||
public function setPassword ($username, $realm, $password) {
|
||||
$this->password = md5 ("$username:$realm:$password");
|
||||
}
|
||||
}
|
||||
|
||||
class HPermission {
|
||||
public $url;
|
||||
public $url_type;
|
||||
public $permission_type;
|
||||
public $expires;
|
||||
public $debitted_time;
|
||||
|
||||
public function __construct ($url, $url_type) {
|
||||
$this->url = $url;
|
||||
$this->url_type = $url_type;
|
||||
$this->expires = "*"; // MM/DD/YYYY:HH:MM:SS
|
||||
$this->permission_type = 0;
|
||||
$this->debitted_time = 0;
|
||||
}
|
||||
|
||||
public function getString () {
|
||||
return "{$this->url};{$this->url_type};{$this->permission_type};{$this->expires};{$this->debitted_time}";
|
||||
}
|
||||
}
|
||||
|
||||
class HFile {
|
||||
public $authorize;
|
||||
public $permission = array ();
|
||||
|
||||
public function addAuthorize ($name, $realm, $password) {
|
||||
$this->authorize = new HAuthorize ();
|
||||
$this->authorize->setPassword ($name, $realm, $password);
|
||||
}
|
||||
|
||||
public function addPermission ($url, $url_type) {
|
||||
$this->permission[] = new HPermission ($url, $url_type);
|
||||
}
|
||||
|
||||
public function write ($name) {
|
||||
$file = fopen ($name, 'w');
|
||||
fwrite ($file, $this->getString ());
|
||||
fclose ($file);
|
||||
}
|
||||
|
||||
public function writeFTP ($ftp, $path) {
|
||||
$file = tmpfile ();
|
||||
fwrite ($file, $this->getString ());
|
||||
fseek ($file, 0);
|
||||
|
||||
ftp_fput ($ftp, $path, $file, FTP_BINARY);
|
||||
|
||||
fclose ($file);
|
||||
}
|
||||
|
||||
public function getString () {
|
||||
$result = array ();
|
||||
$result[] = $this->authorize->getString ();
|
||||
$result[] = "\n";
|
||||
foreach ($this->permission as $p) {
|
||||
$result[] = $p->getString ();
|
||||
$result[] = "\n";
|
||||
}
|
||||
return implode ("", $result);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue