"start", 'title' => "Start", 'link' => ''), array('identifier' => "menu", 'title' => "Menu", 'link' => 'menu'), array('identifier' => "pages", 'title' => "Pagina's", 'link' => 'pages'), //array('identifier' => "users", 'title' => "Gebruikers",'link' => 'users'), array('identifier' => "albums", 'title' => "Fotoalbums", 'link' => 'albums'), array('identifier' => "settings", 'title' => "Instellingen", 'link' => 'settings'), array('identifier' => "logout", 'title' => "Uitloggen", 'link' => 'access/logout') ); $_messages = array( 'notfound' => "Geen inhoud gevonden.", 'testmessage' => "Hello world!", 'norights' => "Je hebt geen rechten om dit item te verwijderen", 'succesdelete' => "Het item is verwijderd." ); /* ####################################################################################### hieronder niet wijzigen */ ####################################################################################### // output $op = array(); $op['content'] = ""; $op['status'] = false; $op['statushandler'] = ''; ?> * @version 1.0 * @package Automate Framework */ class Automate{ //public vars var $debug; var $status; var $template; //private vars // constructor function Automate(){ $this->debug = false; $this->template = "view/page.view.php"; } // methods function Status(){ if($_SESSION["debug"]!="" AND $this->debug){ $str = ''; foreach ($_SESSION["debug"] as $debug){ $str .= $debug . '
'; } $this->Note("debug", $str); } if($_SESSION["error"]!=""){ $str = ''; foreach ($_SESSION["error"] as $error){ $str .= $error . '
'; } $this->Note("error",$str); return false; }else if($_SESSION["notice"]!=""){ $str = ''; foreach ($_SESSION["notice"] as $notice){ $str .= $notice . '
'; } $this->Note("notice", $str); } return true; } function clean_status(){ unset($_SESSION["notice"]); unset($_SESSION["error"]); unset($_SESSION["debug"]); } function Note($type, $str){ $this->status .= '
' . $str . '
'; } // debug functions function debugmode($type = E_ALL){ $this->debug = true; error_reporting($type); } function isValidContent($html){ global $_messages; if($html=="") notice($_messages['notfound']); return $html; } } ?>'; foreach($m as $item){ $current==$item['identifier'] ? $t = ' id="current"' : $t = ""; if(strpos($item['link'],"http://") === false){ $item['link'] = CMS_BASE . $item['link']; } $str .= '
  • ' . $item['title'] . '
  • ' . "\n"; } $str .= ''; return $str; } function blub($obj){ ob_start(); echo "
    ";
      print_r($obj);
      echo "
    "; $return = ob_get_contents(); ob_end_clean(); debug($return); } function notice($n){ $_SESSION['notice'][] = $n; } function error($n){ $_SESSION['error'][] = $n; } function debug($n){ $_SESSION['debug'][] = $n;} function cut($string, $number, $trail = "...") { $output = ""; $words = explode(" ",$string); for($i=0;$i<$number;$i++){ $output .= $words[$i] . " "; } return $output . $trail; } /** * Supermodel functions */ function clean_sql($input, $isInt=false){ if ( $isInt == true ) { return intval($input); } else { return mysql_escape_string(stripslashes($input)); } } function clean($input){ $input = mysql_escape_string($input); return strip_tags($input); } //img function clean_filename($input){ $input = strtolower($input); $input = str_replace(" ","-",$input); $input = str_replace("'","",$input); $input = str_replace(",","",$input); $input = str_replace("&","",$input); $input = str_replace("?","",$input); $input = str_replace("!","",$input); return $input; } // super_save_image function super_save_img($postfile, $dest_path, $new_width, $crop_height = 0){ $base_path = CONTENT; $new_name = clean_filename($postfile['name']); $img = $base_path . $dest_path . $new_name; $img = make_unique($base_path . $dest_path, $new_name); copy($postfile['tmp_name'], $img); // size $dimensions = getimagesize($img); $curr_width = $dimensions[0]; $curr_height = $dimensions[1]; $part = $curr_width/$new_width; $new_height = $curr_height/$part; resize($img, $img, $new_width, $new_height); if($crop_height>0){ // crop? if (!class_exists("CropCanvas")){ require(ABSOLUTE . '/automate/crop.class.php'); } $cc =& new CropCanvas(); $cc->loadImage($img); $cc->cropToSize($new_width, $crop_height); $cc->saveImage($img, 90); $cc->flushImages(true); unset($cc); } return end(explode("/",$img)); } function super_del_img($path,$file){ if($file == "") return; $base_path = CONTENT; $file = $base_path . $path . $file; if(file_exists($file)){ unlink($file); } } function super_copy($postfile, $dest_path){ $base_path = CONTENT; $new_name = clean_filename($postfile['name']); $file = $base_path . $dest_path . $new_name; $file = make_unique($base_path . $dest_path, $file, false); copy($postfile['tmp_name'], $file); return end(explode("/",$file)); } function make_unique($path, $filename, $returnPath=true){ $i = 2; $end = end(explode(".", $path . $filename)); $start = str_replace("." . $end, "", $filename); if(file_exists($path . $filename)){ while( $i < 40 ) { $new = $start . "_" . $i . "." . $end; if( !file_exists($path . $new) ) { $filename = $new; break 1; } else{ $i++; } } } if ( $returnPath == true ) { return $path . $filename; } else { return $filename; } } function resize($filename, $dest, $width, $height, $type=''){ if(@imagecreatefromgif($filename)){ $img=imagecreatefromgif($filename); $type_r='gif'; } elseif(@imagecreatefromjpeg($filename)){ $img=imagecreatefromjpeg($filename); $type_r='jpg'; } elseif(@imagecreatefrompng($filename)){ $img=imagecreatefrompng($filename); $type_r='png'; } elseif(@imagecreatefromwbmp($filename)){ $img=imagecreatefromwbmp($filename); $type_r='bmp'; } else{ return 'Cannot open file'; } $type=($type=='')?$type_r:''; $img_n=imagecreatetruecolor ($width, $height); imagecopyresampled($img_n, $img, 0, 0, 0, 0, $width, $height, imagesx($img), imagesy($img)); if($type=='gif'){ imagegif($img_n, $dest); } elseif($type=='jpg'){ imagejpeg($img_n, $dest, 100); } elseif($type=='png'){ imagepng($img_n, $dest); } elseif($type=='bmp'){ imagewbmp($img_n, $dest); } Return true; } function get_title($identifier){ global $_menu; foreach($_menu as $item){ if($item['identifier']==$identifier){ return $item['title']; } } return $identifier; } if( !function_exists('json_encode') ) { function json_encode($data) { $json = new Services_JSON(); return( $json->encode($data) ); } } // Future-friendly json_decode if( !function_exists('json_decode') ) { function json_decode($data) { $json = new Services_JSON(); return( $json->decode($data) ); } } /********************************************* * Publish On : Jan 10th, 2004 * * Scripter : Hermawan Haryanto * * Version : 1.0 * * License : GPL (General Public License) * **********************************************/ function sendmail ($from_name, $from_email, $to_name, $to_email, $subject, $text_message="", $html_message, $attachment="") { $from = "$from_name <$from_email>"; $to = "$to_name <$to_email>"; $main_boundary = "----=_NextPart_".md5(rand()); $text_boundary = "----=_NextPart_".md5(rand()); $html_boundary = "----=_NextPart_".md5(rand()); $headers = "From: $from\n"; $headers .= "Reply-To: $from\n"; $headers .= "X-Mailer: Hermawan Haryanto (http://hermawan.com)\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"$main_boundary\"\n"; $message .= "\n--$main_boundary\n"; $message .= "Content-Type: multipart/alternative;\n\tboundary=\"$text_boundary\"\n"; $message .= "\n--$text_boundary\n"; $message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n"; $message .= "Content-Transfer-Encoding: 7bit\n\n"; $message .= ($text_message!="")?"$text_message":"Text portion of HTML Email"; $message .= "\n--$text_boundary\n"; $message .= "Content-Type: multipart/related;\n\tboundary=\"$html_boundary\"\n"; $message .= "\n--$html_boundary\n"; $message .= "Content-Type: text/html; charset=\"ISO-8859-1\"\n"; $message .= "Content-Transfer-Encoding: quoted-printable\n\n"; $message .= str_replace ("=", "=3D", $html_message)."\n"; if (isset ($attachment) && $attachment != "" && count ($attachment) >= 1) { for ($i=0; $i