function handleLogin() { $handleLogin = !is_session_authenticated() && isset($_REQUEST['doLogin']) && !empty($_REQUEST['username']) && !empty($_REQUEST['password']) ? true : false; if ($handleLogin) { $isAuthenticated = authenticate($_REQUEST['username'], $_REQUEST['password'], $realms); $realmsCnt = count($realms); // if the login information uniquely identifies a user, mark as authenticated session and move on if ($isAuthenticated && 1 === $realmsCnt) { $ok = set_current_respondent($_REQUEST['username'], current($realms), $_REQUEST['password']); if ($ok) { set_session_authentication($isAuthenticated); blur('/public/dashboard.php'); assert('false; // NOTREACHED'); } // if the login is recognized but not-unique, we can't figure out what to do... panic // NOTE: if email were mandatory, then we could use that as a key... } else { if ($isAuthenticated && 2 <= $realmsCnt) { $GLOBALS['errmsg'] = mkerror(_('Please contact an administrator: multi-realm')); // otherwise, not recognized, throw error } else { $GLOBALS['errmsg'] = mkerror(_('Incorrect User ID or Password, or your account has been disabled/expired.')); } } } }
function resizeVideoImage($filename, $max_width, $max_height = '', $newfilename = '', $blur) { if (file_exists($newfilename)) { return $newfilename; } if ($newfilename == "") { $newfilename = 'new' . $filename; } // Get new sizes list($width, $height) = getimagesize($filename); //-- dont resize if the width of the image is smaller or equal than the new size. if ($width <= $max_width) { $max_width = $width; } $percent = $max_width / $width; $newwidth = $width * $percent; if ($max_height == '') { $newheight = $height * $percent; } else { $newheight = $max_height; } // Load $thumb = imagecreatetruecolor($newwidth, $newheight); $ext = strtolower(substr($filename, -3)); if ($ext == 'jpg' || $ext == 'jpeg') { $source = imagecreatefromjpeg($filename); } if ($ext == 'gif') { $source = imagecreatefromgif($filename); } if ($ext == 'png') { $source = imagecreatefrompng($filename); } // Resize int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) imagecopyresampled($thumb, $source, 0, 0, 0, 100, $newwidth, 180, $width, 180); if ($blur == 'True') { blur($thumb); blur($thumb); } // Output if ($ext == 'jpg' || $ext == 'jpeg') { return imagejpeg($thumb, $newfilename, 100); } if ($ext == 'gif') { return imagegif($thumb, $newfilename); } if ($ext == 'png') { return imagepng($thumb, $newfilename); } }
$thres = $arraysh[2]; } UnsharpMask($output, $cant, $radio, $thres); } /** Rotate */ if ($_GET['r']) { $arrayr = explode("|", $_GET['r']); $grados = $arrayr[0]; $back = '0x' . $arrayr[1]; $rotate = imagerotate($output, $grados, $back); imagejpeg($rotate, NULL, $thumbnail_quality); } /** Add Blur */ if ($_GET['bl']) { $blcant = $_GET['bl']; blur($output, $blcant); } /** Add Pixelate */ if ($_GET['px']) { $pxcant = $_GET['px']; pixelate($output, $pxcant); } /** Add Scatter */ if ($_GET['sc']) { scatter($output); } /** Make Duotone */ if ($_GET['duo']) { $arraynoi = explode("|", $_GET['duo']); $noir = $arraynoi[0]; $noig = $arraynoi[1];
//接收文件目录 $file_name = $_FILES['uploadedfile']['name']; $init_string = $file_name; $edit_group = explode("@", $file_name)[0]; $edit_type = explode("@", $file_name)[1]; $file_name = explode("@", $file_name)[2]; $now_time = time(); $target_path = $target_path . $now_time . "_" . basename($file_name); if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { if ($edit_group == '1') { switch ($edit_type) { case '1': grayscale('./upload/' . $now_time . "_" . $file_name, './edit/' . $now_time . "_" . $file_name); break; case '2': blur('./upload/' . $now_time . "_" . $file_name, './edit/' . $now_time . "_" . $file_name); break; case '3': gammaCorrection('./upload/' . $now_time . "_" . $file_name, './edit/' . $now_time . "_" . $file_name); break; case '4': colorize('./upload/' . $now_time . "_" . $file_name, './edit/' . $now_time . "_" . $file_name, explode("@", $init_string)[3]); break; case '5': imageWatermarking('./upload/' . $now_time . "_" . $file_name, './edit/' . $now_time . "_" . $file_name); break; default: break; } $url = "/edit/" . $now_time . "_" . $file_name; echo $url;
} define('ESP-HANDLER-PREFIX', true); $GLOBALS['errmsg'] = ''; if (isset($_REQUEST['results']) || isset($_REQUEST['results'])) { $GLOBALS['errmsg'] = mkerror(_('Error processing survey: Security violation.')); return; } if (isset($sid) && !empty($sid)) { $sid = intval($sid); } else { if (isset($_REQUEST['sid']) && !empty($_REQUEST['sid'])) { $sid = intval($_REQUEST['sid']); } } if (!isset($sid) || empty($sid)) { blur('/public/dashboard.php'); assert('false; // NOTREACHED'); } if (!isset($_css)) { $_css = ""; } if (!isset($_title)) { $_title = ""; } if (!isset($survey_name)) { $survey_name = ""; } if (empty($_REQUEST['rid'])) { $request_rid = 0; } else { $request_rid = intval($_REQUEST['rid']) ? intval($_REQUEST['rid']) : 0;
$prevHeight = $originalHeight; // scale way down and gradually scale back up, blurring all the way for ($i = 0; $i < $blurFactor; $i += 1) { // determine dimensions of next image $nextWidth = $smallestWidth * pow(2, $i); $nextHeight = $smallestHeight * pow(2, $i); // resize previous image to next size $nextImage = imagecreatetruecolor($nextWidth, $nextHeight); imagecopyresized($nextImage, $prevImage, 0, 0, 0, 0, $nextWidth, $nextHeight, $prevWidth, $prevHeight); // apply blur filter imagefilter($nextImage, IMG_FILTER_GAUSSIAN_BLUR); // now the new image becomes the previous image for the next step $prevImage = $nextImage; $prevWidth = $nextWidth; $prevHeight = $nextHeight; } // scale back to original size and blur one more time imagecopyresized($gdImageResource, $nextImage, 0, 0, 0, 0, $originalWidth, $originalHeight, $nextWidth, $nextHeight); imagefilter($gdImageResource, IMG_FILTER_GAUSSIAN_BLUR); // clean up imagedestroy($prevImage); // return result return $gdImageResource; } if ($do_blur) { header('Content-Type: image/jpeg'); $image = imagecreatefromjpeg($_GET['src']); $new_image = blur($image, $blurFactor); imagejpeg($new_image); imagedestroy($new_image); }