USER_NAME_LENGTH){ $names = explode(' ', $username ); // check if firstname is not to big else lastname not to big if(strlen($names[0]) <= USER_NAME_LENGTH){ $username = $names[0]; }elseif(strlen($names[1]) <= USER_NAME_LENGTH) { $username = $names[1]; } } return $username; } /* * Name : get_file_extension($file_name, &$mimetype) * Parameters : - file_name * - mimetype * Description : Get extenstion of the file */ function get_file_extension($file_name, &$mimetype) { // Get extenstion of the filename $ext = strtolower(substr(strrchr($file_name,'.'),1)); // Set mimetype switch($ext){ case 'pdf': $mimetype = 'application/pdf'; break; case 'doc': $mimetype = 'application/msword'; break; case 'docx': $mimetype = 'application/msword'; break; case 'odt': $mimetype = 'application/vnd.oasis.opendocument.text'; break; case 'ods': $mimetype = 'application/vnd.oasis.opendocument.spreadsheet'; break; case 'xls': $mimetype = 'application/vnd.ms-excel'; break; case 'mp3': $mimetype = 'audio/mpeg'; break; case 'mp4': $mimetype = 'video/mp4'; break; case 'txt': $mimetype = 'application/msword'; break; case 'jpg': $mimetype = 'image/jpeg'; break; case 'jpeg': $mimetype = 'image/jpeg'; break; case 'png': $mimetype = 'image/png'; break; case 'gif': $mimetype = 'image/gif'; break; case 'csv': $mimetype ='text/csv'; break; case 'html': $mimetype ='text/html'; break; case 'flv': $mimetype ='video/x-flv'; break; case 'mpg': $mimetype - 'video/mpeg'; break; case 'avi': $mimetype - 'video/x-msvideo'; break; case 'wma': $mimetype = 'audio/x-ms-wma'; break; default: $mimetype = "not supported"; break; } return $ext; } /* * Name : delete_characters($name) * Parameters : - name * Description : Delete unwanted characters */ function delete_characters($name) { // Characters to delete from the string $deleted_chars = array("\"","?","*",":", "|", "<", ">"," ","#","&","'"); $new_name = str_replace($deleted_chars, "_", $name); // delete backslash return stripslashes($new_name); } /* * Name : cut_name($name) * Parameters : - name * Description : Cut name */ function cut_name($name, $cut_size=20) { if(strlen($name) > $cut_size ){ $new_name = substr($name, 0 , $cut_size); $new_name .= ".."; return $new_name; } return $name; } /* * Name : check_project($project_id) * Parameters : - project_id * Description : Check if user have the correct project rights */ function check_project($project_id){ $project = db_fetch_project($project_id,"",1); // Check for non-released/released projects // normal project => planning status must be finished (and non-RS3000) // rc project => planning and design status must be validated if (($project['status'] != "afgesloten") && ((($project['type'] == "normaal") && ($project['pstatus'] == "gereed"))) ||(($project['type'] == "rc") && (($project['pstatus'] == "gevalideerd") && ($project['ostatus'] == "gevalideerd")))) { return 1; } return 0; } /* * Name : preload_images($path) * Parameters : - path * Description : preload the images from the selected images path */ function preload_images($path){ GLOBAL $_PAGE_INFO; // Check if images are loaded already if(!isset($_SESSION[$_PAGE_INFO['id']]['preload_images'][' ' . $path . ' '])){ // Get all filenames of the images $file_images = get_all_files("app/html/images/" . $path . "/",""); // Create divs to pre load al images once foreach($file_images as $file_image){ echo "
"; } $_SESSION[$_PAGE_INFO['id']]['preload_images'][' ' . $path . ' '] = TRUE; } } /* * Name : place_header($info) * Parameters : $info[text_header] * $info[text_login_button] * $info[id_login_button] * $info[id_connection_icon] * Description : place header */ function place_header($info){ echo "