75 or $ex_temp>225){ return 0; }else{ return 1; } } function is_time_between($startTime, $endTime, $checkTime) { // Convert times to timestamps $startTimestamp = strtotime($startTime); $endTimestamp = strtotime($endTime); $checkTimestamp = strtotime($checkTime); // If end time is less than start time, it means the range crosses midnight if ($endTimestamp < $startTimestamp) { // Check if the time is between start time and midnight or between midnight and end time return ($checkTimestamp >= $startTimestamp || $checkTimestamp <= $endTimestamp); } else { // Normal case: check if the time is between start and end time return ($checkTimestamp >= $startTimestamp && $checkTimestamp <= $endTimestamp); } } ?> load_user()"; test_queue($link); ?> ");?>
Datei drucken

',':',';','?','*','"','|','%']; $filetype = strtolower(pathinfo($_FILES['file_upload']['name'],PATHINFO_EXTENSION)); $path = "/var/www/html/user_files/$username/"; $print_on=$_POST["queue_printer"]; $filename=basename( $_FILES['file_upload']['name']); $filename=str_replace($unwanted_chr,"_",$filename); $path = $path . $filename; if(!in_array($filetype,$ok_ft)) { echo("
"); sys0_log("Could not upload file for ".$_SESSION["username"]." because of unknown file extension",$_SESSION["username"],"PRINT::UPLOAD::FILE::FAILED");//notes,username,type } else { if(move_uploaded_file($_FILES['file_upload']['tmp_name'], $path)) { $sql="INSERT INTO queue (from_userid,filepath,print_on) VALUES (?,?,?)"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_bind_param($stmt, "isi", $userid,$path,$print_on); mysqli_stmt_execute($stmt); echo("
"); sys0_log("user ".$_SESSION["username"]." uploaded ".basename($path)." to the queue",$_SESSION["username"],"PRINT::UPLOAD::QUEUE");//notes,username,type } else { echo("
"); } } unset($_FILES['file']); } if(isset($_GET["cloudprint"])){ $print_on=$_POST["queue_printer"]; if(!isset($_GET["pc"])) $path = "/var/www/html/user_files/$username/".$_GET["cloudprint"]; else $path = "/var/www/html/user_files/public/".$_GET["cloudprint"]; $sql="INSERT INTO queue (from_userid,filepath,print_on) VALUES (?,?,?)"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_bind_param($stmt, "isi", $userid,$path,$print_on); mysqli_stmt_execute($stmt); echo("
"); sys0_log("user ".$_SESSION["username"]." uploaded ".basename($path)." to the queue",$_SESSION["username"],"PRINT::UPLOAD::QUEUE"); } } else { $sql="select printer_url, free, system_status,apikey,printer_url from printer where id=$printer_id"; //echo $sql; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); mysqli_stmt_bind_result($stmt, $url,$free,$status,$apikey,$printer_url); mysqli_stmt_fetch($stmt); if($free!=1 or $status!=0) { echo("
"); sys0_log("Could not start job for ".$_SESSION["username"]." with file ".basename($path)."",$_SESSION["username"],"PRINT::JOB::START::FAILED");//notes,username,type exit; } if(!empty($_FILES['file_upload'])) { $ok_ft=array("gcode",""); $unwanted_chr=[' ','(',')','/','\\','<','>',':',';','?','*','"','|','%']; $filetype = strtolower(pathinfo($_FILES['file_upload']['name'],PATHINFO_EXTENSION)); $path = "/var/www/html/user_files/$username/"; $filename=basename( $_FILES['file_upload']['name']); $filename=str_replace($unwanted_chr,"_",$filename); $path = $path . $filename; //if(in_array($filetype,$unwanted_ft)) if(!in_array($filetype,$ok_ft)) { echo("
"); sys0_log("Could not upload file for ".$_SESSION["username"]." because of unknown file extension",$_SESSION["username"],"PRINT::UPLOAD::FILE::FAILED");//notes,username,type } else { //check if print key is valid: $print_key=htmlspecialchars($_POST["print_key"]); $sql="SELECT id from print_key where print_key='$print_key'"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); //if(mysqli_stmt_num_rows($stmt) == 1){ turned off because user does not need to have a printer key if(true){ mysqli_stmt_close($stmt); if(move_uploaded_file($_FILES['file_upload']['tmp_name'], $path)) { echo("
"); echo("
"); if(check_file($path) or isset($_POST["ignore_unsafe"])){ exec('curl -k -H "X-Api-Key: '.$apikey.'" -F "select=true" -F "print=true" -F "file=@'.$path.'" "'.$printer_url.'/api/files/local" > /var/www/html/user_files/'.$username.'/json.json'); //file is on printer and ready to be printed $userid=$_SESSION["id"]; echo("
"); sys0_log("user ".$_SESSION["username"]." uploaded ".basename($path)." to printer ".$_POST["printer"]."",$_SESSION["username"],"PRINT::UPLOAD::PRINTER");//notes,username,type $fg=file_get_contents("/var/www/html/user_files/$username/json.json"); $json=json_decode($fg,true); if($json['effectivePrint']==false or $json["effectiveSelect"]==false) { echo("
"); sys0_log("Could not start job for ".$_SESSION["username"]."with file ".basename($path)."",$_SESSION["username"],"PRINT::JOB::START::FAILED");//notes,username,type } else { $sql="update printer set free=0, printing=1,mail_sent=0, used_by_userid=$userid where id=$printer_id"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); //delete printer key: $sql="DELETE from print_key where print_key='$print_key'"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); } }else{ $warning=true; echo("
"); } } else { echo("
"); } } else{ echo("
"); } } unset($_FILES['file']); } if(isset($_GET["cloudprint"])){ if(!isset($_GET["pc"])) $path = "/var/www/html/user_files/$username/".$_GET["cloudprint"]; else $path = "/var/www/html/user_files/public/".$_GET["cloudprint"]; //check if print key is valid: $print_key=htmlspecialchars($_POST["print_key"]); $sql="SELECT id from print_key where print_key='$print_key'"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); //if(mysqli_stmt_num_rows($stmt) == 1){ turned off because user does not need to have a printer key if(true){ mysqli_stmt_close($stmt); echo("
"); if(check_file($path) or isset($_POST["ignore_unsafe"])){ exec('curl -k -H "X-Api-Key: '.$apikey.'" -F "select=true" -F "print=true" -F "file=@'.$path.'" "'.$printer_url.'/api/files/local" > /var/www/html/user_files/'.$username.'/json.json'); //file is on printer and ready to be printed $userid=$_SESSION["id"]; echo("
"); sys0_log("user ".$_SESSION["username"]." uploaded ".basename($path)." to printer ".$_POST["printer"]."",$_SESSION["username"],"PRINT::UPLOAD::PRINTER");//notes,username,type $fg=file_get_contents("/var/www/html/user_files/$username/json.json"); $json=json_decode($fg,true); //echo('curl -k -H "X-Api-Key: '.$apikey.'" -F "select=true" -F "print=true" -F "file=@'.$path.'" "'.$printer_url.'/api/files/local" > /var/www/html/system0/html/user_files/'.$username.'/json.json'); //echo("


"); //var_dump($json); if($json['effectivePrint']==false or $json["effectiveSelect"]==false) { echo("
"); sys0_log("Could not start job for ".$_SESSION["username"]."with file ".basename($path)."",$_SESSION["username"],"PRINT::JOB::START::FAILED");//notes,username,type } else { $sql="update printer set free=0, printing=1,mail_sent=0, used_by_userid=$userid where id=$printer_id"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); //delete printer key: $sql="DELETE from print_key where print_key='$print_key'"; $stmt = mysqli_prepare($link, $sql); mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); } }else{ $warning=true; echo("
"); } } else{ echo("
"); } } } } ?>

Datei drucken

prepare($sql); $stmt->execute(); $result = $stmt->get_result(); //$row = $result->fetch_assoc(); $time_now=date("H:i"); while ($row = $result->fetch_assoc()) { if (is_time_between($row["time_from"], $row["time_to"], $time_now)) { $reservation_conflict = true; $for_class[]=$row["for_class"]; //break; } } if(!isset($for_class)) $for_class[]=0; if ($reservation_conflict && !in_array($class,$for_class) && $class!=0) { echo "
"; $block=true; }else{ $block=false; } ?>
'); echo('
'); echo(''); echo(' '); echo('
'); echo('
'); } else{ echo ('
'); echo('
'); echo("

Cloudfile: ".$_GET["cloudprint"]."

"); echo('
'); echo('
'); } ?>

'); echo(''); echo(''); echo('
'); } ?>

"); echo("
"); } ?> '); echo('
'); echo(''); echo(''); echo('
'); }else{ echo "
"; } ?> Nur freie Drucker anzeigen.'); }else{ echo('
Auf einem Drucker Drucken, welcher besetzt ist.
'); } } ?>