smarty_dir.'Smarty.class.php'); class Functions { var $mysql; var $queries = 0; var $simplequeries = 0; function Functions(){ global $var; global $smarty; global $PHP_SELF; $this->mysql = mysql_connect($var->mysql_host, $var->mysql_user, $var->mysql_pass) or die("Could not connect to mysql server: " . mysql_error()); $smarty->template_dir = $var->smarty_template_dir; $smarty->compile_dir = $var->smarty_compile_dir; $smarty->config_dir = $var->smarty_config_dir; $smarty->cache_dir = $var->smarty_cache_dir; $smarty->left_delimiter = $var->smarty_left; $smarty->right_delimiter = $var->smarty_right; $smarty->cache = 0; $smarty->assign("page", $PHP_SELF); mysql_select_db($var->mysql_db) or die("Could not select database $var->mysql_db"); } function get_var($varname, $esc = 0){ global $HTTP_GET_VARS; global $HTTP_POST_VARS; global $HTTP_SESSION_VARS; if (isset($HTTP_GET_VARS["$varname"])) return $esc ? $HTTP_GET_VARS["$varname"] : $HTTP_GET_VARS["$varname"]; if (isset($HTTP_POST_VARS["$varname"])) return $esc ? $HTTP_POST_VARS["$varname"] : $HTTP_POST_VARS["$varname"]; if (isset($_SESSION["$varname"])) return $esc ? $_SESSION["$varname"] : $_SESSION["$varname"]; if (isset($HTTP_SESSION_VARS["$varname"])) return $esc ? $HTTP_SESSION_VARS["$varname"] : $HTTP_SESSION_VARS["$varname"]; } function get_var_esc($varname){ return $this->get_var($varname, 1); } function set_var($varname, $value){ $HTTP_GET_VARS["$varname"] = $value; $HTTP_POST_VARS["$varname"] = $value; $HTTP_SESSION_VARS["$varname"] = $value; $_SESSION["$varname"] = $value; } function del_var($arr){ foreach ($arr as $var){ $this->set_var($var, ''); } } function reload_vars(){ global $smarty; foreach ($HTTP_POST_VARS as $name => $value){ $smarty->assign($name,$value); } } function simplequery($query){ $this->simplequeries++; $this->queries++; $result = mysql_query($query) or die("Query ($query) failed : " . mysql_error()); $line = ''; if ($result) $line = mysql_fetch_array($result, MYSQL_ASSOC); return $line; } function query($query){ $this->queries++; $result = mysql_query($query) or die("Query ($query) failed : " . mysql_error()); return $result; } function debugquery($query){ $this->queries++; print $query; return $this->query($query); } function insert($query){ $result = $this->query($query); return mysql_insert_id(); } function log($table, $id, $action){ $res = $this->simplequery("SELECT id FROM object WHERE objecttype='$table' AND value='$id'"); if ($res) $oid = $res["id"]; else $oid = $this->insert("INSERT INTO object (objecttype, value) VALUES ('$table', '$id')"); $this->insert("INSERT INTO history (object_id, korisnici_id, datum, action) VALUES ('$oid', '".$this->get_var("userid")."', NOW(), '$action')"); } function reload_form($arr) { global $smarty; foreach($arr as $k){ $smarty->assign($k, $this->get_var($k)); } } function get_time($prefix){ return mktime($this->get_var($prefix."Hour"),$this->get_var($prefix."Minute"),0,$this->get_var($prefix."Month"),$this->get_var($prefix."Day"),$this->get_var($prefix."Year")); } function get_date($prefix){ return mktime($this->get_var($prefix."Month"),$this->get_var($prefix."Day"),$this->get_var($prefix."Year")); } //**************************** SinDK admin functions ********************************* // to shorten the news for listing function get_short_news ($id_news) { $row = $this->simplequery("SELECT * FROM news WHERE id_news='$id_news'"); if (ereg("{",$row["news_text"])){ $my_array1=explode("{",$row["news_text"]); $my_array2=explode("}",$my_array1[1]); $short_news=$my_array2[0]." ..."; } else $short_news=substr ($row["news_text"],0, 300)." ..."; return $short_news; } // to shorten the opinion for listing function get_short_opinion ($id_opinion) { $row = $this->simplequery("SELECT * FROM opinion WHERE id_opinion='$id_opinion'"); if (ereg("{",$row["opinion_text"])){ $my_array1=explode("{",$row["opinion_text"]); $my_array2=explode("}",$my_array1[1]); $short_opinion=$my_array2[0]." ..."; } else $short_opinion=substr ($row["opinion_text"],0, 300)." ..."; return $short_opinion; } // to resize the images of news for listing function get_short_image ($id_news, $size) { if ( is_file("../templates/img/news/".$id_news."_1.jpg")) { $short_image=""; } else {$short_image="";} return $short_image; } // to resize the images of opinions for listing function get_short_image_opinion ($id_opinion, $size) { if ( is_file("../templates/img/opinion/".$id_opinion."_1.jpg")) { $short_image=""; } else {$short_image="";} return $short_image; } // page numbers of other pages - used with news and opinions function pagelister_navbar ($page, $numpages, $link) { $return_string="

Pages: "; for($i = 1; $i <= $numpages; $i++) { #loop to print << 1 2 3... $numpages >> if($i == 1 && $page > 1) #Prints the << first to goto the previous page (not on page 1) $return_string=$return_string."«  "; if($i == $page) #Doesn't print a link itself, just prints page number $return_string=$return_string." $i "; if($i != $page) #Other links that aren't this page go here $return_string=$return_string." $i "; if($i == $numpages && $page != $numpages) # Link for next page >> (not on last page) $return_string=$return_string."  »"; }; $return_string=$return_string."

"; return $return_string; } // to show the date in Hungarian order (year. month. day. - time) function date_conversion ($timestamp, $time) { $year=substr($timestamp,0,4); $month=substr($timestamp,5,2); $month_day=substr($timestamp,8,2); if ($time) {$time_str=substr($timestamp,11,8);} else {$time_str="";} $datum_str="$year. $month. $month_day. $time_str"; return $datum_str; } // to display the text of the news in a proper, formatted way function tinymce_htmlspecialchars($string) { //$string = ereg_replace ("<","<",$string); //$string = ereg_replace (">",">",$string); $string = ereg_replace ("\"","'",$string); $string = stripslashes ($string); $string = ereg_replace ("../templates/articles/images","templates/articles/images",$string); $string = ereg_replace ("tiny_mce/plugins/emotions","admin/tiny_mce/plugins/emotions",$string); return $string; } //**************************** SinDK admin functions ********************************* }//End of class session_start(); $smarty = new Smarty() or die("Smarty init failed"); $func = new Functions(); ?>
Notice: Undefined variable: func in /home/studyindenmark/public_html/english/tanulas_daniaban.php on line 5

Fatal error: Uncaught Error: Call to a member function query() on null in /home/studyindenmark/public_html/english/tanulas_daniaban.php:5 Stack trace: #0 {main} thrown in /home/studyindenmark/public_html/english/tanulas_daniaban.php on line 5