'.$str.""); } ?>

0) { $kod .= "-"; } $kod .= dechex(ord($slovo[$a])); } return $kod; } function kod2slovo($kod) { $kody = split("-", $kod); $slovo = ""; foreach ($kody as $value) { $slovo .= chr(hexdec($value)); } return $slovo; } function preklad($cinsky) { global $dbv; //var $preklad; $slovicka = $dbv->getSlovickoByCinsky($cinsky); if (sizeof($slovicka) == 0) { $preklad = null; } else { $preklad = $cinsky." "; foreach ($slovicka as $value) { $preklad .= " [".$value["vyslovnost"]."] - ".$value["preklady"]."\n"; } /*$preklad = ""; foreach ($slovicka as $value) { $preklad .= $value["cinsky"]." [".$value["vyslovnost"]."] - ".$value["preklady"]."\n"; }*/ } return $preklad; } ?> Elektronická kniha

Kategorie

Překlad DBName = $DBName; $dbLink = $this->checkError(@mysql_connect($dbserver, $dblogin, $dbpass)); $this->DBNameBackup = $DBName; if ($dbLink) { $this->DBLink = $dbLink; $this->checkError(mysql_query("SET CHARACTER SET UTF8")); $this->checkError(mysql_query("SET NAMES UTF8")); $this->checkError(@mysql_select_db($DBName, $this->DBLink)); } } function checkError($value) { if (mysql_error()) { echo(mysql_error()); } return $value; } function freeResult($hResult) { return $this->checkError(mysql_free_result($hResult)); } function fetchRow($hResult) { return $this->checkError(mysql_fetch_assoc($hResult)); } function fetchRows($hResult) { $rows = Array(); while ($data = $this->fetchRow($hResult)) { $rows[] = $data; } return $rows; } function query($strQuery) { $res = mysql_query($strQuery, $this->DBLink); if (!$res) { $this->checkError(mysql_select_db($this->DBNameBackup, $this->DBLink)); return $this->checkError(mysql_query($strQuery, $this->DBLink)); } else { return $res; } } function getZaznamSQL($sqlcommand) { if ($result = $this->query($sqlcommand)) { $row = $this->fetchRow($result); $this->freeResult($result); return $row; } else { return false; } } function getZaznamySQL($sqlcommand) { if ($result = $this->query($sqlcommand)) { $rows = $this->fetchRows($result); $this->freeResult($result); return $rows; } else return Array(); } function sqlExecute($sqlcommand) { if ($this->query($sqlcommand)) return true; else return false; } //type: one, list, exe function addFunction($name, $sqlcommand, $type = "one", $param_array = false) { //$dbvrstvaStr $promene = Array(); $mam = true; $idx = 0; while ($mam) { $zac = "#".$idx."#"; $poz = strpos($sqlcommand, $zac); if ($poz) { $poz += strlen($zac); $poz2 = strpos($sqlcommand, "#", $poz); if ($poz2) { $prom = substr($sqlcommand, $poz, $poz2 - $poz); $promene[$prom] = $zac.$prom."#"; } else { ob_end_clean(); echo("chyba v definici db funkce ".$name); die; } } else { $mam = false; } $idx++; } $fce = "function ".$name."("; if ($param_array) { $fce .= "\$pole"; foreach ($promene as $key=>$value) { $sqlcommand = str_replace($value, "\".mysql_real_escape_string(\$pole[\"".$key."\"]).\"", $sqlcommand); } } else { $idx = 0; foreach ($promene as $key=>$value) { if ($idx > 0) { $fce .= ", "; } $fce .= "$".$key; $idx++; $sqlcommand = str_replace($value, "\".mysql_real_escape_string($".$key.").\"", $sqlcommand); } } $fce .= ") {\n"; $fce .= " global \$db;\n"; $fce .= " return \$db->"; if ($type=="one") { $fce .= "getZaznamSQL(\"".$sqlcommand."\");"; } else if ($type=="list") { $fce .= "getZaznamySQL(\"".$sqlcommand."\");"; } else { $fce .= "sqlExecute(\"".$sqlcommand."\");"; } $fce .= "\n}\n\n"; $this->dbvStr .= $fce; /*$this->dbvCnt++; $trida = "class DBV".$this->dbvCnt." {\n\n".$this->dbvStr."\n}"; eval($trida); exec("\$dbv = new DBV".$this->dbvCnt."();");*/ //echo("
".$trida."
"); //echo("
".$fce."
"); //$fce = "function ".$name." () {}"; //$aaa = "class dbv".$dbvCnt." {}"); } function createDBV() { $this->dbvCnt++; $trida = "class DBV".$this->dbvCnt." {\n\n".$this->dbvStr."\n}"; eval($trida); eval("global \$dbv; \$dbv = new DBV".$this->dbvCnt."();"); //generovani i do souboru $file = fopen("dbv-generated.php", 'wt'); if (fwrite($file, "class DBV {\n\n".$this->dbvStr."}")) { fclose($file); } } } ?>