Корпоративный сайт Главного федерального инспектора по УР

Дипломная работа - Компьютеры, программирование

Другие дипломы по предмету Компьютеры, программирование

abtable]).$this->constructColumns().$this->constructValues();;DELETE:">$answer = $this->direction.implode (,,$this->dataArray [table]).$this->constructColumns().$this->constructValues();;DELETE:

$answer = $this->direction. FROM.implode (,,$this->dataArray [table]).$this->constructWhere();;:

$this->ERROR=true;$this->ERROR_STR.= [getQuery]:не определено направление [select||update||insert] ;

break;

}; return $answer;

}function getUsingColumn() {return array_unique ($this->queryColumn);}function getTextSQL() {return $this->getQuery();}

// - SEND-function errorHandler() {$this->dataArray[errorHandler] = func_get_args(); return $this;}function perform() {

$query = $this->getQuery();(!$this->ERROR) {($query!=) {($this->cache) {

$md5_name = md5 ($query.$_ENV[config] [system_password]);

$filename = $_ENV[config] [cache_query_dir].$md5_name..txt;($handler=@fopen ($filename, r)) {

$this->ans = $_ENV[ext]->getCacheArray(&$handler);

} else {

$this->ans = $_ENV[db]->send_query($query);

$_ENV[ext]->cacheArray ($this->ans,$filename);

}

} else {

$this->ans = @$_ENV[db]->send_query($query);

}($this->ans) {foreach ($this->ans[0] as $key=>$value) {$this->alias ($key,$key);}}

} else {

$this->ERROR=true;$this->ERROR_STR.= [send]:запрос пуст ;

}

}; return $this;

}function copy(&$tmp) {$tmp = $this->ans; return $this;}function error (&$flag,&$error,$jxNotice=false) {(!$this->checker) {$this->check();}($this->ERROR) {

$flag = true;

$error= ;($jxNotice) {

$_ENV[ajax]->jxCode (alert (\".str_replace (ERROR_STR). \););

}

} else {$flag = false;}; return $this;}function cache() {$this->cache=true; return $this;}function group($key) {(!$this->ERROR) {

$array = func_get_args();($this->sort_deptch==0) {$this->ans=$this->grouper ($this->ans,$key,$array);}{$this->ans=$this->grouper2 ($this->ans,$key,$array, 0);};

$this->sort_deptch++;

}; return $this;

}function grouper2 ($arrays,$key,$array,$deptch) {// - group in deptch-($i=0;$igrouper2 ($arrays[$i] [group],$key,$array,$b);}

}; return $arrays;

}function grouper ($arrays,$key,$array) {// - group local array-

$dop = array(); for ($i=2;$i<sizeof($array);$i++) {$dop[] = $array[$i];}

$uniq_key = array();$uniq_key2 = array();($i=0;$i$tmp_value) {if ($tmp_key==$key) {$uniq_key[]=$tmp_value;}}}

$uniq_key = array_unique ($uniq_key);($uniq_key as $tmp_key => $value) {$uniq_key2 []=$value;};$uniq_key = $uniq_key2;

$uniq_key2 = array();($i=0;$i<sizeof ($uniq_key);$i++) {

$uniq_key2 [$i] [meta] [$key] = $uniq_key[$i];($j=0;$j<sizeof($arrays);$j++) {($arrays[$j] [$key]==$uniq_key[$i]) {

$uniq_key2 [$i] [group][] = $arrays[$j];(sizeof ($uniq_key2 [$i] [group])==1) {($g=0;$g<sizeof($dop);$g++) {$uniq_key2 [$i] [meta] [$dop[$g]] = $arrays[$j] [$dop[$g]];}

}

}

}

}; return $uniq_key2;

}function alias() {$arg=func_get_args(); for ($i=0;$iERROR) {

$arg = func_get_args();$this->inner_tag_name = $arg[0];

$this->use_xml_tag = array();($i=1;$iuse_xml_tag[]=$arg[$i];}

$this->dom = new DOMDocument (1.0, UTF-8);

$this->root = $this->dom->createElement(dbQuery);

$this->dom->appendChild ($this->root);

$this->recursiveXML ($this->ans,$this->root);

$this->ans = $this->dom->saveXML();

}; return $this;

}function recursiveXML ($array,&$ref_parent) {($i=0;$i<sizeof($array);$i++) {(is_array ($array[$i] [meta]) || is_array ($array[$i] [group])) {

$counter_foreach = 0;$arg = array();($array[$i] [meta] as $key => $value) {($counter_foreach==0) {$tag_name=$this->alias_ar[$key];$arg[]=$key;$arg[]=$value;} else {$arg[]=$key;$arg[]=$value;}

$counter_foreach++;

}

$tmp = $this->addTag ($tag_name, ,$arg);$ref_parent->appendChild($tmp);(sizeof ($array[$i] [group])!=0) {$this->recursiveXML ($array[$i] [group],$tmp);}

} else {

$arg = array();($j=0;$juse_xml_tag[$j]==$key) {$arg[]=$key;$arg[]=$value; break;}}

};$tmp=$this->addTag ($this->inner_tag_name, ,$arg);$ref_parent->appendChild($tmp);

}

}

}function addTag ($tag_name,$value) {

$jx = $this->dom->createElement ($tag_name,$value);

$args = func_get_args();(sizeof ($args[2])!=0) {

$args = $args[2];($i=0;$ialias_ar [$args[$i]];}{$atr = $args[$i];}

$id_att= $this->dom->createAttribute($atr);

$jx_id = $this->dom->createTextNode ($args [$i+1]);

$id_att->appendChild ($jx_id);

$jx->appendChild ($id_att);

}

}; return $jx;

}

}postgreSQL {__construct() {

$this->hostname = $_ENV[config] [db_hostname];

$this->database = $_ENV[config] [db_database];

$this->username = $_ENV[config] [db_username];

$this->password = $_ENV[config] [db_password];

$this->port = $_ENV[config] [db_port];

$this->link = pg_connect (host=$this->hostname port=$this->port dbname=$this->database user=$this->username password=$this->password) or $this->access=false;

}function send_query($query) {

$args=func_get_args();

$result = pg_query ($this->link,$query);($result) {

$ar = array();

$row_counter = 0;($row = pg_fetch_assoc($result)) {

$counter = 0;($row as $key => $value) {

$ar [$row_counter] [$key]=htmlspecialchars_decode ($value, ENT_QUOTES);

$counter++;

}

$row_counter++;

};($args[1]) {row:return $ar [$args[2]]; break;:return $ar; break;

}

} else {return false;}

}function dataQuery() {return new dataQuery($ans);}function convertKeyToIndex($ans) {

$ar=array();($i=0;$i $value) {$ar[$i][]=$value;}}$ar;

}

}

$_ENV[db] = new postgreSQL();

?>

TABLE public.audio (_audio serial NOT NULL,text NOT NULL,

text text,_file varchar(255) NOT NULL,_add date NOT NULL,

/* Keys */audio_pkeyKEY (id_audio),audio_audio_file_key(audio_file)

) WITH (= FALSE

);

TABLE public.audioTO postgres;

TABLE public.block (_block serial NOT NULL,_page integer NOT NULL,_city integer,_position integer,_title text NOT NULL,_content text NOT NULL,

/* Keys */block_pkeyKEY (id_block),

/* Checks */block_block_content_check(block_content :text),

/* Foreign keys */block_id_city_fkeyKEY (id_city)public.city (id_city)DELETE SET NULLUPDATE CASCADE

) WITH (= FALSE

);

TRIGGER block_ftsINSERT OR UPDATEpublic.blockEACH ROWPROCEDURE public.block_fts();

TRIGGER check_block_bitINSERT OR DELETEpublic.blockEACH ROWPROCEDURE public.trg_check_block_bit();

TABLE public.blockTO postgres;

TABLE public.block_fts (_block integer NOT NULL,_fts tsvector,

/* Keys */block_fts_pkeyKEY (id_block),

/* Foreign keys */block_fts_id_block_fkeyKEY (id_block)public.block (id_block)DELETE CASCADEUPDATE CASCADE

) WITH (= FALSE

);

TABLE public.block_ftsTO postgres;

TABLE public.block_image (_block_image serial NOT NULL,_block integer NOT NULL,text NOT NULL,

/* Keys */block_image_pkeyKEY (id_block_image),block_image_file_key(file),

/* Checks */block_image_file_check(file <> :text),

/* Foreign keys */block_image_id_block_fkeyKEY (id_block)public.block (id_block)DELETE CASCADEUPDATE CASCADE

) WITH (= FALSE

);

TABLE public.block_imageTO postgres;

TABLE public.city (_city serial NOT NULL,_name varchar NOT NULL,_yes bit(1) NOT NULL DEFAULT B0: bit,

/* Keys */city_pkeyKEY (id_city),

/* Checks */city_city_name_check((city_name):text <> :text)