- function post_redirect_get($last, $next) { //TODO prepracovat, tohle je uplna picovina...
- //header('Location: '.$_SERVER['REQUEST_URI']); //TODO redirect (need templating system or ob_start() first!!!)
- echo 'Hotovo. Poslední vložený záznam naleznete '.$this->html->link('zde', $last).'.<br />'.
- 'Další záznam přidáte '.$this->html->link('zde', $next).'.';
- die();
+ function post_redirect_get($location, $message='') {
+ $location = $this->html->internal_url($location).'?message='.urlencode($message);
+ header('Location: '.$location);
+ die("Location: $location");
+ }
+
+ function safe_include($dir,$name,$vars=array(),$ext='.inc.php') {
+ if(preg_match('/[^a-zA-Z0-9-]/',$name)) die(trigger_error('SAFE INCLUDE: Securityfuck.'));
+ $filename="$dir/$name$ext";
+ if(!is_file($filename)) die(trigger_error('SAFE INCLUDE: Fuckfound.'));
+ foreach($vars as $var => $val) $$var=$val;
+ ob_start();
+ include($filename);
+ $out=ob_get_contents();
+ ob_end_clean();
+ return $out;