".strtoupper($page["title"]).""; return array($step,$id_trail); } static function getGETstring(){ $getstring = ""; foreach($_GET as $key => $value){ if (!preg_match("/delete/i", $key)) { $getstring .= $key."=".$value."&"; } } return $getstring; } function arrayOutput($testArray){ //OUTPOUTS DATA OF ARRAY IN FORMAT echo "
";
			print_r($testArray);
		echo "
"; } function showFeedBack($message, $valid =true){ switch ($message){ case "formsucces": $message = "Gegevens zijn succesvol opgeslagen."; $valid = true; break; case "formfail": $message = "Er is helaas een fout opgetreden, probeer het a.u.b opnieuw."; $valid = false; break; case "uploadsucces": $message = "Bestand succesvol opgeslagen."; $valid = true; break; case "uploadfail": $message = "Bestand niet succesvol opgeslagen, probeer het a.u.b opnieuw."; $valid = false; break; default: $message = $message; } if($valid) $styleclass = "formResult"; else $styleclass = "formResultError"; $fb_string= "
".date("H:i:s")." · ".$message."
"; return $fb_string; } function delete_directory($dirname) { if (is_dir($dirname) && substr(sprintf('%o', fileperms($dirname)), -4) == "0777") $dir_handle = opendir($dirname); if (!$dir_handle) return false; while($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($dirname."/".$file)) unlink($dirname."/".$file); else delete_directory($dirname.'/'.$file); } } closedir($dir_handle); rmdir($dirname); return true; } function truncate($text,$numb) { $text = html_entity_decode($text, ENT_QUOTES); if (strlen($text) > $numb) { $text = substr($text, 0, $numb); $text = substr($text,0,strrpos($text," ")); //This strips the full stop: if ((substr($text, -1)) == ".") { $text = substr($text,0,(strrpos($text,"."))); } $etc = '...'; $text = $text.$etc; } $text = htmlentities($text, ENT_QUOTES); return $text; } /* function nl2brArray($array){ foreach ($array as $key => $value){ $array[$key] = nl2br($value); } return $array; } function decodeHTMLarray($array){ foreach ($array as $key => $value){ $array[$key] = str_replace("\n","",$value); $array[$key] = html_entity_decode($value); } return $array; } function stripSlashesArray($array){ //STRIPS SLASHES FOR VALUES IN ARRAY foreach ($array as $key => $value){ $array[$key] = stripslashes($value); } return $array; } function addSlashesArray($array){ //ADDS SLASHES FOR VALUES IN ARRAY foreach ($array as $key => $value){ $array[$key] = addslashes($value); } return $array; } function log_action($target_file,$data,$header=""){ if(!file_exists($target_file)){ $header .= "\n--------------------------------------------------------------------------------------------\n"; $data = $header.$data; } $handle = fopen($target_file,"a"); if ($handle) { fwrite($handle, $data); fclose($handle); } } function parseURL($url, $link=false){ if(!empty($url) && substr_count($url, " ") == 0){ if(substr($url,0,7) == "http://"){ $url = $url; }else{ $url = "http://".$url; } if($link){ $url = "".$url.""; } return $url; } } function parseDate($timestamp, $showtime=false){ //$months = @array(); $months = array(0=>"Jan",1=>"Feb",2=>"Mrt",3=>"Apr", 4=>"Mei", 5=>"Jun", 6=>"Jul", 7=>"Aug", 8=>"Sep", 9=>"Okt",10=>"Nov",11=>"Dec"); if(substr($timestamp,0,8) == date("Ymd")){ $date = "Vandaag"; }else if(substr($timestamp,0,8) == date("Ymd")-1){ $date = "Gisteren"; }else{ $date = substr($timestamp,6,2)." ".$months[intval(substr($timestamp,4,2)-1)]." ".substr($timestamp,0,4); } if($showtime && strlen($date) > 4){ $date.= " - ".substr($timestamp,8,2).":".substr($timestamp,10,2).""; } return $date; } function TimeToDate($timestamp, $showTime=true){ if(date("Ymd") == date("Ymd",$timestamp)){ $date = "Vandaag"; }else if(date("Yz")-1 == date("Yz",$timestamp)){ $date = "Gisteren"; }else{ $months = array(0=>"Jan",1=>"Feb",2=>"Mrt",3=>"Apr", 4=>"Mei", 5=>"Jun", 6=>"Jul", 7=>"Aug", 8=>"Sep", 9=>"Okt",10=>"Nov",11=>"Dec"); $day = date("j", $timestamp); $month = date("n", $timestamp); $date = $day." ".$months[$month-1]; if(date("Y") !== date("Y", $timestamp)) $date .= " ".date("Y", $timestamp); } //$date = date("j M Y", $timestamp); if($showTime){ $date .= " - ".date("H:i", $timestamp); } return $date; } function buildQuery($QueryType, $table, $data, $condition=""){ if($QueryType == "INSERT"){ $fields = array_keys($data); $values = array_values($data); $query = $QueryType." INTO ".$table." (".implode(", ", $fields).") VALUES "; $query .= " ('".implode("', '",$values)."')"; }else if($QueryType == "UPDATE"){ $query = $QueryType." ".$table." SET "; foreach ($data as $field => $value){ $query .= $field."='".$value."', " ; } $query = substr($query, 0, -2); $query.= $condition; } return $query; } function pass($format="L,l,C,L,l,C"){ // GENERATES PASSWORD $ww_kleineletters = explode(",",'a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,w,x,y,z'); $ww_hoofdletters = explode(",",'A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z'); $ww = ""; // Een random wachtwoord genereren $format=explode(",",$format); shuffle($format); array_push($format, $format[3], $format[5]); //toevoegen 2 willekeurige while($char=array_pop($format)) { switch ($char) { case "l": // Een kleine-letter genereren $ww .=$ww_kleineletters[array_rand($ww_kleineletters,1)]; break; case "L": // Een hoofd-letter genereren $ww .=$ww_hoofdletters[array_rand($ww_hoofdletters,1)]; break; case "C": // Een cijfer genereren $ww .= rand(0,9); break; } } return($ww); } */ } ?>query("SELECT id FROM ".$table." ".$condition." ORDER BY rank ASC"); $index = 0; while($item = @mysqli_fetch_array($items_rsc)){ $db->query("UPDATE ".$table." SET rank =".$index." WHERE id=".$item["id"]); $index++; } } function arrayOutput($testArray){ //OUTPOUTS DATA OF ARRAY IN FORMAT echo "
";
		print_r($testArray);
		echo "
"; } static function createPathStep($page_id,$db){ $page = mysqli_fetch_array($db->query("SELECT id, title, subpage_of FROM pages WHERE id=".$page_id)); if($page["subpage_of"] !== "0"){ $step = CMSutilities::createPathStep($page["subpage_of"],$db); } $step .= " > ".$page["title"].""; return $step; } }Error: Unable to connect to MySQL. Debugging errno: 2002 Debugging error: php_network_getaddresses: getaddrinfo failed: Name or service not known