Commit b43140e6 by Bagus Pambudi

tambah captcha dan menghapus file di public

parent e7912e43
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Support\Facades\Validator;
class LoginController extends Controller
{
......@@ -36,4 +37,17 @@ class LoginController extends Controller
{
$this->middleware('guest')->except('logout');
}
protected function validator(array $data)
{
return Validator::make($data, [
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'captcha' => ['required','captcha'],
]);
}
public function reloadCaptcha()
{
return response()->json('captcha', captcha_img());
}
}
......@@ -18,6 +18,7 @@
"laravel/tinker": "^1.0",
"laravelcollective/html": "^5.8.0",
"maatwebsite/excel": "^3.1",
"mews/captcha": "^3.2",
"milon/barcode": "^6.0",
"statickidz/php-google-translate-free": "^1.1",
"toolkito/larasap": "master",
......
......@@ -175,6 +175,7 @@ return [
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
Mews\Captcha\CaptchaServiceProvider::class,
],
......@@ -228,6 +229,7 @@ return [
'View' => Illuminate\Support\Facades\View::class,
'Image' => Intervention\Image\Facades\Image::class,
'InseoHelper' => App\Helpers\InseoHelper::class,
'Captcha' => Mews\Captcha\Facades\Captcha::class,
],
......
<?php
return [
'disable' => env('CAPTCHA_DISABLE', false),
'characters' => ['2', '3', '4', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'm', 'n', 'p', 'q', 'r', 't', 'u', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'M', 'N', 'P', 'Q', 'R', 'T', 'U', 'X', 'Y', 'Z'],
'default' => [
'length' => 9,
'width' => 120,
'height' => 36,
'quality' => 90,
'math' => true,
'expire' => 60,
'encrypt' => false,
],
'math' => [
'length' => 9,
'width' => 120,
'height' => 36,
'quality' => 90,
'math' => true,
],
'flat' => [
'length' => 6,
'width' => 160,
'height' => 46,
'quality' => 90,
'lines' => 6,
'bgImage' => false,
'bgColor' => '#ecf2f4',
'fontColors' => ['#2c3e50', '#c0392b', '#16a085', '#c0392b', '#8e44ad', '#303f9f', '#f57c00', '#795548'],
'contrast' => -5,
],
'mini' => [
'length' => 3,
'width' => 60,
'height' => 32,
],
'inverse' => [
'length' => 5,
'width' => 120,
'height' => 36,
'quality' => 90,
'sensitive' => true,
'angle' => 12,
'sharpen' => 10,
'blur' => 2,
'invert' => true,
'contrast' => -5,
]
];
<%
'
' jQuery File Tree ASP (VBS) Connector
' Copyright 2008 Chazzuka
' programmer@chazzuka.com
' http://www.chazzuka.com/
'
' retrive base directory
dim BaseFileDir:BaseFileDir=Request.Form("dir")
' if blank give default value
if len(BaseFileDir)=0 then BaseFileDir="/userfiles/"
dim ObjFSO,BaseFile,Html
' resolve the absolute path
BaseFile = Server.MapPath(BaseFileDir)&"\"
' create FSO
Set ObjFSO = Server.CreateObject("Scripting.FileSystemObject")
' if given folder is exists
if ObjFSO.FolderExists(BaseFile) then
dim ObjFolder,ObjSubFolder,ObjFile,i__Name,i__Ext
Html = Html + "<ul class=""jqueryFileTree"" style=""display: none;"">"&VBCRLF
Set ObjFolder = ObjFSO.GetFolder(BaseFile)
' LOOP THROUGH SUBFOLDER
For Each ObjSubFolder In ObjFolder.SubFolders
i__Name=ObjSubFolder.name
Html = Html + "<li class=""directory collapsed"">"&_
"<a href=""#"" rel="""+(BaseFileDir+i__Name+"/")+""">"&_
(i__Name)+"</a></li>"&VBCRLF
Next
'LOOP THROUGH FILES
For Each ObjFile In ObjFolder.Files
' name
i__Name=ObjFile.name
' extension
i__Ext = LCase(Mid(i__Name, InStrRev(i__Name, ".", -1, 1) + 1))
Html = Html + "<li class=""file ext_"&i__Ext&""">"&_
"<a href=""#"" rel="""+(BaseFileDir+i__Name)+""">"&_
(i__name)+"</a></li>"&VBCRLF
Next
Html = Html + "</ul>"&VBCRLF
end if
Response.Write Html
%>
\ No newline at end of file
<%@ Page Language="C#" AutoEventWireup="true" %>
<%
//
// jQuery File Tree ASP Connector
//
// Version 1.0
//
// Copyright (c)2008 Andrew Sweeny
// asweeny@fit.edu
// 24 March 2008
//
string dir;
if(Request.Form["dir"] == null || Request.Form["dir"].Length <= 0)
dir = "/";
else
dir = Server.UrlDecode(Request.Form["dir"]);
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(dir);
Response.Write("<ul class=\"jqueryFileTree\" style=\"display: none;\">\n");
foreach (System.IO.DirectoryInfo di_child in di.GetDirectories())
Response.Write("\t<li class=\"directory collapsed\"><a href=\"#\" rel=\"" + dir + di_child.Name + "/\">" + di_child.Name + "</a></li>\n");
foreach (System.IO.FileInfo fi in di.GetFiles())
{
string ext = "";
if(fi.Extension.Length > 1)
ext = fi.Extension.Substring(1).ToLower();
Response.Write("\t<li class=\"file ext_" + ext + "\"><a href=\"#\" rel=\"" + dir + fi.Name + "\">" + fi.Name + "</a></li>\n");
}
Response.Write("</ul>");
%>
\ No newline at end of file
<!---
jQuery File Tree
ColdFusion connector script
By Tjarko Rikkerink (http://carlosgallupa.com/)
--->
<cfparam name="form.dir" default="/somedir" />
<cfdirectory action="LIST" directory="#expandpath('#URLDecode(form.dir)#')#" name="qDir" sort="type, name" type="all" listinfo="all" recurse="no">
<ul class="jqueryFileTree" style="display: none;">
<cfoutput query="qDir">
<cfif type eq "dir">
<li class="directory collapsed"><a href="##" rel="#URLDecode(form.dir)##name#/">#name#</a></li>
<cfelseif type eq "file">
<li class="file ext_#listLast(name,'.')#"><a href="##" rel="#URLDecode(form.dir)##name#">#name# (#round(size/1024)#KB)</a></li>
</cfif>
</cfoutput>
</ul>
\ No newline at end of file
<%@ page
import="java.io.File,java.io.FilenameFilter,java.util.Arrays"%>
<%
/**
* jQuery File Tree JSP Connector
* Version 1.0
* Copyright 2008 Joshua Gould
* 21 April 2008
*/
String dir = request.getParameter("dir");
if (dir == null) {
return;
}
if (dir.charAt(dir.length()-1) == '\\') {
dir = dir.substring(0, dir.length()-1) + "/";
} else if (dir.charAt(dir.length()-1) != '/') {
dir += "/";
}
dir = java.net.URLDecoder.decode(dir, "UTF-8");
if (new File(dir).exists()) {
String[] files = new File(dir).list(new FilenameFilter() {
public boolean accept(File dir, String name) {
return name.charAt(0) != '.';
}
});
Arrays.sort(files, String.CASE_INSENSITIVE_ORDER);
out.print("<ul class=\"jqueryFileTree\" style=\"display: none;\">");
// All dirs
for (String file : files) {
if (new File(dir, file).isDirectory()) {
out.print("<li class=\"directory collapsed\"><a href=\"#\" rel=\"" + dir + file + "/\">"
+ file + "</a></li>");
}
}
// All files
for (String file : files) {
if (!new File(dir, file).isDirectory()) {
int dotIndex = file.lastIndexOf('.');
String ext = dotIndex > 0 ? file.substring(dotIndex + 1) : "";
out.print("<li class=\"file ext_" + ext + "\"><a href=\"#\" rel=\"" + dir + file + "\">"
+ file + "</a></li>");
}
}
out.print("</ul>");
}
%>
\ No newline at end of file
<?php
//
// jQuery File Tree PHP Connector
//
// Version 1.01
//
// Cory S.N. LaViska
// A Beautiful Site (http://abeautifulsite.net/)
// 24 March 2008
//
// History:
//
// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
// 1.00 - released (24 March 2008)
//
// Output a list of files for jQuery File Tree
//
$root = '/var/www/aqvatariusv/aqvatarius.com/development/s/assets/uploads';
$_POST['dir'] = urldecode($_POST['dir']);
if( file_exists($root . $_POST['dir']) ) {
$files = scandir($root . $_POST['dir']);
natcasesort($files);
if( count($files) > 2 ) { /* The 2 accounts for . and .. */
echo "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
// All dirs
foreach( $files as $file ) {
if( file_exists($root . $_POST['dir'] . $file) && $file != '.' && $file != '..' && is_dir($root . $_POST['dir'] . $file) && substr($file, 0, 1) != '.') {
echo "<li class=\"directory collapsed\"><a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "/\">" . htmlentities($file) . "</a></li>";
}
}
// All files
foreach( $files as $file ) {
if( file_exists($root . $_POST['dir'] . $file) && $file != '.' && $file != '..' && !is_dir($root . $_POST['dir'] . $file) ) {
$ext = preg_replace('/^.*\./', '', $file);
echo "<li class=\"file ext_$ext\"><a href=\"#\" rel=\"" . htmlentities($_POST['dir'] . $file) . "\">" . htmlentities($file) . "</a></li>";
}
}
echo "</ul>";
}
}
?>
\ No newline at end of file
#!/usr/bin/perl
use strict;
use HTML::Entities ();
#-----------------------------------------------------------
# jQuery File Tree Perl Connector
#
# Version 1.0
#
# Oleg Burlaca
# http://www.burlaca.com/2009/02/jquery-file-tree-connector/
# 12 February 2009
#-----------------------------------------------------------
# for security reasons, specify a root folder
# to prevent the whole filesystem to be shown
# for ex: the root folder of your webbrowser
my $root = "/var/www/html/";
#----------------------------------------------------------
my $params = &getCGIParams();
print "Content-type: text/html\n\n";
my $dir = $params->{dir};
my $fullDir = $root . $dir;
exit if ! -e $fullDir;
opendir(BIN, $fullDir) or die "Can't open $dir: $!";
my (@folders, @files);
my $total = 0;
while( defined (my $file = readdir BIN) ) {
next if $file eq '.' or $file eq '..';
$total++;
if (-d "$fullDir/$file") {
push (@folders, $file);
} else {
push (@files, $file);
}
}
closedir(BIN);
return if $total == 0;
print "<ul class=\"jqueryFileTree\" style=\"display: none;\">";
# print Folders
foreach my $file (sort @folders) {
next if ! -e $fullDir . $file;
print '<li class="directory collapsed"><a href="#" rel="' .
&HTML::Entities::encode($dir . $file) . '/">' .
&HTML::Entities::encode($file) . '</a></li>';
}
# print Files
foreach my $file (sort @files) {
next if ! -e $fullDir . $file;
$file =~ /\.(.+)$/;
my $ext = $1;
print '<li class="file ext_' . $ext . '"><a href="#" rel="' .
&HTML::Entities::encode($dir . $file) . '/">' .
&HTML::Entities::encode($file) . '</a></li>';
}
print "</ul>\n";
#--------------------------------------------------------------------------------------------------
sub getCGIParams {
my $line;
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $line, $ENV{'CONTENT_LENGTH'});
} else {
$line = $ENV{'QUERY_STRING'};
}
my (@pairs) = split(/&/, $line);
my ($name, $value, %F);
foreach (@pairs) {
($name, $value) = split(/=/);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
if (! exists $F{$name}) {
$F{$name} = $value;
} elsif (exists $F{$name} and ref($F{$name}) ne 'ARRAY') {
my $prev_value = $F{$name};
delete $F{$name};
$F{$name} = [ $prev_value, $value ];
} else { push @{ $F{$name} }, $value }
}
return \%F;
}
#--------------------------------------------------------------------------------------------------
\ No newline at end of file
#
# jQuery File Tree
# Python/Django connector script
# By Martin Skou
#
import os
import urllib
def dirlist(request):
r=['<ul class="jqueryFileTree" style="display: none;">']
try:
r=['<ul class="jqueryFileTree" style="display: none;">']
d=urllib.unquote(request.POST.get('dir','c:\\temp'))
for f in os.listdir(d):
ff=os.path.join(d,f)
if os.path.isdir(ff):
r.append('<li class="directory collapsed"><a href="#" rel="%s/">%s</a></li>' % (ff,f))
else:
e=os.path.splitext(f)[1][1:] # get .ext and remove dot
r.append('<li class="file ext_%s"><a href="#" rel="%s">%s</a></li>' % (e,ff,f))
r.append('</ul>')
except Exception,e:
r.append('Could not load directory: %s' % str(e))
r.append('</ul>')
return HttpResponse(''.join(r))
\ No newline at end of file
#
# jQuery File Tree Ruby Connector
#
# Version 1.01
#
# Erik Lax
# http://datahack.se
# 13 July 2008
#
# History
#
# 1.01 Initial Release
#
# Output a list of files for jQuery File Tree
#
#<settings>
#root = "/absolute/path/"
# or
root = File.expand_path(".")
#</settings>
#<code>
require "cgi"
cgi = CGI.new
cgi.header("type" => "text/html")
dir = cgi.params["dir"].to_s
puts "<ul class=\"jqueryFileTree\" style=\"display: none;\">"
begin
path = root + "/" + dir
# chdir() to user requested dir (root + "/" + dir)
Dir.chdir(File.expand_path(path).untaint);
# check that our base path still begins with root path
if Dir.pwd[0,root.length] == root then
#loop through all directories
Dir.glob("*") {
|x|
if not File.directory?(x.untaint) then next end
puts "<li class=\"directory collapsed\"><a href=\"#\" rel=\"#{dir}#{x}/\">#{x}</a></li>";
}
#loop through all files
Dir.glob("*") {
|x|
if not File.file?(x.untaint) then next end
ext = File.extname(x)[1..-1]
puts "<li class=\"file ext_#{ext}\"><a href=\"#\" rel=\"#{dir}#{x}\">#{x}</a></li>"
}
else
#only happens when someone tries to go outside your root directory...
puts "You are way out of your league"
end
rescue
puts "Internal Error"
end
puts "</ul>"
#</code>
[
//
// jQuery File Tree Lasso Connector
//
// Version 1.00
//
// Jason Huck
// http://devblog.jasonhuck.com/
// 1 May 2008
//
// History:
//
// 1.00 - released (1 May 2008)
//
// Output a list of files for jQuery File Tree
//
!action_param('dir') ? abort;
var('dir') = action_param('dir');
var('files') = file_listdirectory($dir);
'<ul class="jqueryFileTree" style="display: none;">';
iterate($files, local('file'));
#file->beginswith('.') ? loop_continue;
if(#file->endswith('/'));
'<li class="directory collapsed"><a href="#" rel="' + $dir + #file + '">' + #file + '</a></li>';
else;
local('ext') = #file->split('.')->last;
'<li class="file ext_' + #ext + '"><a href="#" rel="' + $dir + #file + '">' + #file + '</a></li>';
/if;
/iterate;
'</ul>';
]
<?LassoScript
//
// jQuery File Tree LASSO Connector
//
// Version 1.00
//
// Marc Sabourdin
// CysNET (http://www.marcsabourdin.com/)
// 23 May 2008
//
// History:
//
// 1.00 - released (23 May 2008)
//
// Output a list of files for jQuery File Tree
//
Encode_set:-EncodeNone;
Variable:'root' = 'path_to_desired_and_Lasso_allowed_root';
Variable:'_POST.dir' = (action_param:'dir');
Variable:'files';
if:( file_exists: ($root + $_POST.dir) )&&( File_IsDirectory:($root + $_POST.dir) );
$files = (File_ListDirectory:($root + $_POST.dir));
$files->(Sort);
if:( $files->(Size) > 0 );
output:'<ul class="jqueryFileTree" style="display: none;">';
// All dirs
Iterate:($files),(Local:'file');
if:( file_exists:($root + $_POST.dir + #file) )&&( #file != '.' )&&( #file != '..' )&&( File_IsDirectory:($root + $_POST.dir + #file) );
output:'<li class="directory collapsed"><a href="#" rel="' + (String_replace:($_POST.dir + #file),-Find=' ',-Replace='__') + '">' + (Encode_HTML:(#file)) + '</a></li>';
/if;
/Iterate;
// All files
Local:'ext';
Iterate:($files),(Local:'file');
if:( file_exists:($root + $_POST.dir + #file) )&&( #file != '.' )&&( #file != '..' )&&( (File_IsDirectory:($root + $_POST.dir + #file))==false );
#ext = (#file)->(Split:'.')->Last;
output:'<li class="file ext_' + (#ext) + '"><a href="' + ($_POST.dir + #file) + '">' + (Encode_HTML:(#file)) + '</a></li>';
/if;
/Iterate;
output:'</ul>';
/if;
/if;
/Encode_set;
?>
\ No newline at end of file
<!DOCTYPE HTML>
<!--
/*
* jQuery File Upload Plugin postMessage API 1.2.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery File Upload Plugin postMessage API</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
<script>
/*jslint unparam: true, regexp: true */
/*global $, Blob, FormData, location */
'use strict';
var origin = /^http:\/\/example.org/,
target = new RegExp('^(http(s)?:)?\\/\\/' + location.host + '\\/');
$(window).on('message', function (e) {
e = e.originalEvent;
var s = e.data,
xhr = $.ajaxSettings.xhr(),
f;
if (!origin.test(e.origin)) {
throw new Error('Origin "' + e.origin + '" does not match ' + origin);
}
if (!target.test(e.data.url)) {
throw new Error('Target "' + e.data.url + '" does not match ' + target);
}
$(xhr.upload).on('progress', function (ev) {
ev = ev.originalEvent;
e.source.postMessage({
id: s.id,
type: ev.type,
timeStamp: ev.timeStamp,
lengthComputable: ev.lengthComputable,
loaded: ev.loaded,
total: ev.total
}, e.origin);
});
s.xhr = function () {
return xhr;
};
if (!(s.data instanceof Blob)) {
f = new FormData();
$.each(s.data, function (i, v) {
f.append(v.name, v.value);
});
s.data = f;
}
$.ajax(s).always(function (result, statusText, jqXHR) {
if (!jqXHR.done) {
jqXHR = result;
result = null;
}
e.source.postMessage({
id: s.id,
status: jqXHR.status,
statusText: statusText,
result: result,
headers: jqXHR.getAllResponseHeaders()
}, e.origin);
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML>
<!--
/*
* jQuery Iframe Transport Plugin Redirect Page 2.0.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Iframe Transport Plugin Redirect Page</title>
</head>
<body>
<script>
document.body.innerText=document.body.textContent=decodeURIComponent(window.location.search.slice(1));
</script>
</body>
</html>
# The following directives force the content-type application/octet-stream
# and force browsers to display a download dialog for non-image files.
# This prevents the execution of script files in the context of the website:
ForceType application/octet-stream
Header set Content-Disposition attachment
<FilesMatch "(?i)\.(gif|jpe?g|png)$">
ForceType none
Header unset Content-Disposition
</FilesMatch>
# The following directive prevents browsers from MIME-sniffing the content-type.
# This is an important complement to the ForceType directive above:
Header set X-Content-Type-Options nosniff
# Uncomment the following lines to prevent unauthorized download of files:
#AuthName "Authorization required"
#AuthType Basic
#require valid-user
<?php
/*
* jQuery File Upload Plugin PHP Example 5.14
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
error_reporting(E_ALL | E_STRICT);
require('UploadHandler.php');
$upload_handler = new UploadHandler();
<?php
$ds = DIRECTORY_SEPARATOR;
$storeFolder = 'uploads';
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;
$targetFile = $targetPath. $_FILES['file']['name'];
move_uploaded_file($tempFile,$targetFile);
}
?>
/*
* YUI Compressor
* Author: Julien Lecomte <jlecomte@yahoo-inc.com>
* Copyright (c) 2007, Yahoo! Inc. All rights reserved.
* Code licensed under the BSD License:
* http://developer.yahoo.net/yui/license.txt
*/
package com.yahoo.platform.yui.compressor;
import jargs.gnu.CmdLineParser;
import org.mozilla.javascript.ErrorReporter;
import org.mozilla.javascript.EvaluatorException;
import java.io.*;
import java.nio.charset.Charset;
public class YUICompressor {
public static void main(String args[]) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option typeOpt = parser.addStringOption("type");
CmdLineParser.Option verboseOpt = parser.addBooleanOption('v', "verbose");
CmdLineParser.Option nomungeOpt = parser.addBooleanOption("nomunge");
CmdLineParser.Option linebreakOpt = parser.addStringOption("line-break");
CmdLineParser.Option preserveSemiOpt = parser.addBooleanOption("preserve-semi");
CmdLineParser.Option disableOptimizationsOpt = parser.addBooleanOption("disable-optimizations");
CmdLineParser.Option helpOpt = parser.addBooleanOption('h', "help");
CmdLineParser.Option charsetOpt = parser.addStringOption("charset");
CmdLineParser.Option outputFilenameOpt = parser.addStringOption('o', "output");
Reader in = null;
Writer out = null;
try {
parser.parse(args);
Boolean help = (Boolean) parser.getOptionValue(helpOpt);
if (help != null && help.booleanValue()) {
usage();
System.exit(0);
}
boolean verbose = parser.getOptionValue(verboseOpt) != null;
String charset = (String) parser.getOptionValue(charsetOpt);
if (charset == null || !Charset.isSupported(charset)) {
charset = System.getProperty("file.encoding");
if (charset == null) {
charset = "UTF-8";
}
if (verbose) {
System.err.println("\n[INFO] Using charset " + charset);
}
}
String[] fileArgs = parser.getRemainingArgs();
String type = (String) parser.getOptionValue(typeOpt);
if (fileArgs.length == 0) {
if (type == null || !type.equalsIgnoreCase("js") && !type.equalsIgnoreCase("css")) {
usage();
System.exit(1);
}
in = new InputStreamReader(System.in, charset);
} else {
if (type != null && !type.equalsIgnoreCase("js") && !type.equalsIgnoreCase("css")) {
usage();
System.exit(1);
}
String inputFilename = fileArgs[0];
if (type == null) {
int idx = inputFilename.lastIndexOf('.');
if (idx >= 0 && idx < inputFilename.length() - 1) {
type = inputFilename.substring(idx + 1);
}
}
if (type == null || !type.equalsIgnoreCase("js") && !type.equalsIgnoreCase("css")) {
usage();
System.exit(1);
}
in = new InputStreamReader(new FileInputStream(inputFilename), charset);
}
int linebreakpos = -1;
String linebreakstr = (String) parser.getOptionValue(linebreakOpt);
if (linebreakstr != null) {
try {
linebreakpos = Integer.parseInt(linebreakstr, 10);
} catch (NumberFormatException e) {
usage();
System.exit(1);
}
}
String outputFilename = (String) parser.getOptionValue(outputFilenameOpt);
if (type.equalsIgnoreCase("js")) {
try {
JavaScriptCompressor compressor = new JavaScriptCompressor(in, new ErrorReporter() {
public void warning(String message, String sourceName,
int line, String lineSource, int lineOffset) {
if (line < 0) {
System.err.println("\n[WARNING] " + message);
} else {
System.err.println("\n[WARNING] " + line + ':' + lineOffset + ':' + message);
}
}
public void error(String message, String sourceName,
int line, String lineSource, int lineOffset) {
if (line < 0) {
System.err.println("\n[ERROR] " + message);
} else {
System.err.println("\n[ERROR] " + line + ':' + lineOffset + ':' + message);
}
}
public EvaluatorException runtimeError(String message, String sourceName,
int line, String lineSource, int lineOffset) {
error(message, sourceName, line, lineSource, lineOffset);
return new EvaluatorException(message);
}
});
// Close the input stream first, and then open the output stream,
// in case the output file should override the input file.
in.close(); in = null;
if (outputFilename == null) {
out = new OutputStreamWriter(System.out, charset);
} else {
out = new OutputStreamWriter(new FileOutputStream(outputFilename), charset);
}
boolean munge = parser.getOptionValue(nomungeOpt) == null;
boolean preserveAllSemiColons = parser.getOptionValue(preserveSemiOpt) != null;
boolean disableOptimizations = parser.getOptionValue(disableOptimizationsOpt) != null;
compressor.compress(out, linebreakpos, munge, verbose,
preserveAllSemiColons, disableOptimizations);
} catch (EvaluatorException e) {
e.printStackTrace();
// Return a special error code used specifically by the web front-end.
System.exit(2);
}
} else if (type.equalsIgnoreCase("css")) {
CssCompressor compressor = new CssCompressor(in);
// Close the input stream first, and then open the output stream,
// in case the output file should override the input file.
in.close(); in = null;
if (outputFilename == null) {
out = new OutputStreamWriter(System.out, charset);
} else {
out = new OutputStreamWriter(new FileOutputStream(outputFilename), charset);
}
compressor.compress(out, linebreakpos);
}
} catch (CmdLineParser.OptionException e) {
usage();
System.exit(1);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private static void usage() {
System.out.println(
"\nUsage: java -jar yuicompressor-x.y.z.jar [options] [input file]\n\n"
+ "Global Options\n"
+ " -h, --help Displays this information\n"
+ " --type <js|css> Specifies the type of the input file\n"
+ " --charset <charset> Read the input file using <charset>\n"
+ " --line-break <column> Insert a line break after the specified column number\n"
+ " -v, --verbose Display informational messages and warnings\n"
+ " -o <file> Place the output into <file>. Defaults to stdout.\n\n"
+ "JavaScript Options\n"
+ " --nomunge Minify only, do not obfuscate\n"
+ " --preserve-semi Preserve all semicolons\n"
+ " --disable-optimizations Disable all micro optimizations\n\n"
+ "If no input file is specified, it defaults to stdin. In this case, the 'type'\n"
+ "option is required. Otherwise, the 'type' option is required only if the input\n"
+ "file extension is neither 'js' nor 'css'.");
}
}
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.</description>
</book>
<book id="bk104">
<author>Corets, Eva</author>
<title>Oberon's Legacy</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-03-10</publish_date>
<description>In post-apocalypse England, the mysterious
agent known only as Oberon helps to create a new life
for the inhabitants of London. Sequel to Maeve
Ascendant.</description>
</book>
<book id="bk105">
<author>Corets, Eva</author>
<title>The Sundered Grail</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2001-09-10</publish_date>
<description>The two daughters of Maeve, half-sisters,
battle one another for control of England. Sequel to
Oberon's Legacy.</description>
</book>
<book id="bk106">
<author>Randall, Cynthia</author>
<title>Lover Birds</title>
<genre>Romance</genre>
<price>4.95</price>
<publish_date>2000-09-02</publish_date>
<description>When Carla meets Paul at an ornithology
conference, tempers fly as feathers get ruffled.</description>
</book>
<book id="bk107">
<author>Thurman, Paula</author>
<title>Splish Splash</title>
<genre>Romance</genre>
<price>4.95</price>
<publish_date>2000-11-02</publish_date>
<description>A deep sea diver finds true love twenty
thousand leagues beneath the sea.</description>
</book>
<book id="bk108">
<author>Knorr, Stefan</author>
<title>Creepy Crawlies</title>
<genre>Horror</genre>
<price>4.95</price>
<publish_date>2000-12-06</publish_date>
<description>An anthology of horror stories about roaches,
centipedes, scorpions and other insects.</description>
</book>
<book id="bk109">
<author>Kress, Peter</author>
<title>Paradox Lost</title>
<genre>Science Fiction</genre>
<price>6.95</price>
<publish_date>2000-11-02</publish_date>
<description>After an inadvertant trip through a Heisenberg
Uncertainty Device, James Salway discovers the problems
of being quantum.</description>
</book>
<book id="bk110">
<author>O'Brien, Tim</author>
<title>Microsoft .NET: The Programming Bible</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-09</publish_date>
<description>Microsoft's .NET initiative is explored in
detail in this deep programmer's reference.</description>
</book>
<book id="bk111">
<author>O'Brien, Tim</author>
<title>MSXML3: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>36.95</price>
<publish_date>2000-12-01</publish_date>
<description>The Microsoft MSXML3 parser is covered in
detail, with attention to XML DOM interfaces, XSLT processing,
SAX and more.</description>
</book>
<book id="bk112">
<author>Galos, Mike</author>
<title>Visual Studio 7: A Comprehensive Guide</title>
<genre>Computer</genre>
<price>49.95</price>
<publish_date>2001-04-16</publish_date>
<description>Microsoft Visual Studio 7 is explored in depth,
looking at how Visual Basic, Visual C++, C#, and ASP+ are
integrated into a comprehensive development
environment.</description>
</book>
</catalog>
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>Google</title><script>window.google={kEI:"k9KXS8-NG8iQ-Aau-rnpDA",kEXPI:"24030,24059",kCSI:{e:"24030,24059",ei:"k9KXS8-NG8iQ-Aau-rnpDA",expi:"24030,24059"},ml:function(){},kHL:"en",time:function(){return(new Date).getTime()},log:function(b,d,c){var a=new Image,e=google,g=e.lc,f=e.li;a.onerror=(a.onload=(a.onabort=function(){delete g[f]}));g[f]=a;c=c||"/gen_204?atyp=i&ct="+b+"&cad="+d+"&zx="+google.time();a.src=c;e.li=f+1},lc:[],li:0,Toolbelt:{}};
window.google.sn="webhp";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{}catch(u){}window.google.jsrt_kill=1;
var _gjwl=location;function _gjuc(){var e=_gjwl.href.indexOf("#");if(e>=0){var a=_gjwl.href.substring(e);if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0){a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var f=a.substring(d,b);if(f.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(f=="cad=h")return 0;c=b}_gjwl.href="/search?"+a+"&cad=h";return 1}}}return 0}function _gjp(){!(window._gjwl.hash&&
window._gjuc())&&setTimeout(_gjp,500)};
window._gjp && _gjp()</script><style>td{line-height:.8em;}.gac_m td{line-height:17px;}form{margin-bottom:20px;}body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}em{font-weight:bold;font-style:normal}.lst{font:17px arial,sans-serif;margin-bottom:.2em;vertical-align:bottom;}input{font-family:inherit}.lsb,.gac_sb{font-size:15px;height:1.85em!important;margin:.2em;}#gbar{height:22px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#guser{padding-bottom:7px !important;text-align:right}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{color:#00c !important}</style><script>google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/nav_logo7.png'" topmargin=3 marginheight=3><textarea id=csi style=display:none></textarea><iframe name=wgjf style=display:none></iframe><div id=ghead><div id=gbar><nobr><b class=gb1>Web</b> <a onclick=gbar.qs(this) href="http://images.google.com/imghp?hl=en&tab=wi" class=gb1>Images</a> <a onclick=gbar.qs(this) href="http://video.google.com/?hl=en&tab=wv" class=gb1>Videos</a> <a onclick=gbar.qs(this) href="http://maps.google.com/maps?hl=en&tab=wl" class=gb1>Maps</a> <a onclick=gbar.qs(this) href="http://news.google.com/nwshp?hl=en&tab=wn" class=gb1>News</a> <a onclick=gbar.qs(this) href="http://www.google.com/prdhp?hl=en&tab=wf" class=gb1>Shopping</a> <a href="http://mail.google.com/mail/?hl=en&tab=wm" class=gb1>Gmail</a> <a href="http://www.google.com/intl/en/options/" class=gb1 style="text-decoration:none"><u>more</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl%3Den%26source%3Diglk&usg=AFQjCNFA18XPfgb7dKnXfKz7x7g1GDH1tg" class=gb4>iGoogle</a> | <a href="/preferences?hl=en" class=gb4>Search settings</a> | <a href="https://www.google.com/accounts/Login?hl=en&continue=http://www.google.com/intl/en/" class=gb4>Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div> <center><br clear=all id=lgpd><img alt="Google" height=110 src="http://www.google.com/intl/en_ALL/images/logo.gif" width=276 id=logo onload="window.lol&&lol()"><br><br><form action="http://www.google.com/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input name=source type=hidden value=hp><input type=hidden name=ie value="ISO-8859-1"><input autocomplete="off" maxlength=2048 name=q size=55 class=lst title="Google Search" value=""><br><input name=btnG type=submit value="Google Search" class=lsb><input name=btnI type=submit value="I&#39;m Feeling Lucky" class=lsb></td><td nowrap width=25% align=left><font size=-2>&nbsp;&nbsp;<a href="/advanced_search?hl=en">Advanced Search</a><br>&nbsp;&nbsp;<a href="/language_tools?hl=en">Language Tools</a></font></td></tr></table></form><br><span id=footer><center id=fctr><br><font size=-1><a href="/intl/en/ads/">Advertising&nbsp;Programs</a> - <a href="/services/">Business Solutions</a> - <a href="/intl/en/about.html">About Google</a> - <b><a href="http://www.google.ru/">Go to Google Russia</a></b></font><p><font size=-2>&copy;2010 - <a href="/intl/en/privacy.html">Privacy</a></font></p></center></span> <div id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement("script");a.src="/extern_js/f/CgJlbiAAKzAKOF1ACCwrMA44DCwrMBc4BiwrMBg4BSwrMCU4yogBLCswJjgJLCswJzgELCswPDgCLCswQDgLLCswRDgCLCswRTgBLA/OamgJXCMX7I.js";(document.getElementById("xjsd")||document.body).appendChild(a);if(google.timers&&google.timers.load.t)google.timers.load.t.xjsls=(new Date).getTime();},0);
;google.neegg=1;google.y.first.push(function(){google.ac.m=1;google.ac.b=true;google.ac.i(document.f,document.f.q,'','','',{o:1});google.History&&google.History.initialize('/intl/en/')});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);google.fade=null;}</script></div><script>(function(){
var b,d,e,f;function g(a,c){if(a.removeEventListener){a.removeEventListener("load",c,false);a.removeEventListener("error",c,false)}else{a.detachEvent("onload",c);a.detachEvent("onerror",c)}}function h(a){f=(new Date).getTime();++d;a=a||window.event;var c=a.target||a.srcElement;g(c,h)}var i=document.getElementsByTagName("img");b=i.length;d=0;for(var j=0,k;j<b;++j){k=i[j];g(k,h);if(k.complete||typeof k.src!="string"||!k.src)++d;else if(k.addEventListener){k.addEventListener("load",h,false);k.addEventListener("error",
h,false)}else{k.attachEvent("onload",h);k.attachEvent("onerror",h)}}e=b-d;function l(){google.timers.load.t.ol=(new Date).getTime();google.timers.load.t.iml=f;google.kCSI.imc=d;google.kCSI.imn=b;google.kCSI.imp=e;google.report&&google.report(google.timers.load,google.kCSI)}if(window.addEventListener)window.addEventListener("load",l,false);else if(window.attachEvent)window.attachEvent("onload",l);google.timers.load.t.prt=(f=(new Date).getTime());
})();
</script>
#!/bin/bash
#
# Plugin to monitor http load time for sites
#
# Parameters:
#
# config
# autoconf
#
# Configuration variables
#
# sites - site names seperated by space e.g. "google.com mail.ru"
#
#
#%# family=auto
#%# capabilities=autoconf
CURL=${curl:-curl}
if [ "$1" = "autoconf" ]; then
if [ -x $CURL ]; then
echo no
exit 1
fi
if [ "X${SITES}" = "X" ]; then
echo no
exit 1
fi
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Page load time"
echo "graph_args --base 1000"
#echo "graph_args --base 1000 --upper-limit 5"
echo "graph_vlabel time in seconds"
echo "graph_category http"
echo "graph_scale no"
echo "graph_info Amount on seconds taken to load website from this host."
I=0
for S in $SITES
do
let I+=1
echo "site${I}.label ${S}"
echo "site${I}.min 0"
echo "site${I}.draw LINE2"
echo "site${I}.max 800"
done
exit 0
fi
I=0
for S in $SITES
do
let I+=1
#echo $CURL -s -w "site${I}.value %{time_total}\n" -o /dev/null http://${S}/
$CURL -L -s -w "site${I}.value %{time_total}\n" -o /dev/null http://${S}/
done
exit 0
CREATE OR REPLACE VIEW el_user_view AS
SELECT m.uid AS uid,
a1.value AS login,
a2.value AS pass,
a3.value AS f_name,
a4.value AS l_name,
a5.value AS s_name,
a6.value AS email,
a7.value AS phone_mobile,
a8.value AS phone_home,
a9.value AS city,
a10.value AS metro,
a11.value AS crtime,
a12.value AS mtime,
a13.value AS atime,
a14.value AS visits
FROM el_user_profile_data AS m
INNER JOIN el_user_profile_data AS a1 ON (m.uid=a1.uid AND a1.field=\'login\')
INNER JOIN el_user_profile_data AS a2 ON (m.uid=a2.uid AND a2.field=\'pass\')
INNER JOIN el_user_profile_data AS a3 ON (m.uid=a3.uid AND a3.field=\'f_name\')
INNER JOIN el_user_profile_data AS a4 ON (m.uid=a4.uid AND a4.field=\'l_name\')
INNER JOIN el_user_profile_data AS a5 ON (m.uid=a5.uid AND a5.field=\'s_name\')
INNER JOIN el_user_profile_data AS a6 ON (m.uid=a6.uid AND a6.field=\'email\')
INNER JOIN el_user_profile_data AS a7 ON (m.uid=a7.uid AND a7.field=\'phone_mobile\')
INNER JOIN el_user_profile_data AS a8 ON (m.uid=a8.uid AND a8.field=\'phone_home\')
INNER JOIN el_user_profile_data AS a9 ON (m.uid=a9.uid AND a9.field=\'city\')
INNER JOIN el_user_profile_data AS a10 ON (m.uid=a10.uid AND a10.field=\'metro\')
INNER JOIN el_user_profile_data AS a11 ON (m.uid=a11.uid AND a11.field=\'crtime\')
INNER JOIN el_user_profile_data AS a12 ON (m.uid=a12.uid AND a12.field=\'mtime\')
INNER JOIN el_user_profile_data AS a13 ON (m.uid=a13.uid AND a13.field=\'atime\')
INNER JOIN el_user_profile_data AS a14 ON (m.uid=a14.uid AND a14.field=\'visits\')
GROUP by m.uid
SELECT uid, MAX( IF( b = \'login\', val, NULL ) ) login, MAX( IF( b = \'email\', val, NULL ) ) email, MAX( IF( b = \'f_name\', val, NULL ) ) f_name, MAX( IF( b = \'mtime\', val, NULL ) ) mtime
FROM (
SELECT uid, field b, value val
FROM el_user_profile_data_test
) AS t
GROUP BY uid
Спасибо за подробный ответ.
1. На сколько я понимаю, приминимо к моей ситуации запрос будет выглядеть таким образом:
SELECT uid,
MAX(IF(field=\'login\', value, NULL)) login,
MAX(IF(field=\'email\', value, NULL)) email,
MAX(IF(field=\'f_name\', value, NULL)) f_name,
MAX(IF(field=\'mtime\', value, NULL)) mtime
FROM el_user_profile_data_test
GROUP BY uid
Есть создать VIEW от этого запроса, то случайные выборки или объединения уже занимаю 6 секунд вместо 4, смущает что не используются идексы и explain говорит Using temporary; Using filesort. Будут ли вообще в такой ситуации индексы работать?
Почитав отзывы о VIEW в MySQL складывается мнение, что он ещё пока сыроват.
2. По поводу того что это религиозная война я полностью согласна, но одно дело работать с одним объектом данных или с 3мя и более (User, Address, Stats...), может есть ещё какой-то вариант оптимизировать скорость работы не разбивая структуры на отдельные сущности? Может ввести отдельную таблицу где будут храниться ID пользователей
\ No newline at end of file
......@@ -30,6 +30,7 @@ return [
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'captcha' => 'Invalid captcha!',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_equals' => 'The :attribute must be a date equal to :date.',
......
......@@ -51,6 +51,28 @@
</div>
</div>
<div class="form-group row">
<label for="captcha" class="col-md-4 col-form-label text-md-right">Captcha</label>
<div class="col-md-6 captcha">
<span>{!! captcha_img() !!}</span>
<button type="button" class="btn btn-danger" class="reload" id="reload">
&#x21bb;
</button>
</div>
</div>
<div class="form-group row">
<label for="captcha" class="col-md-4 col-form-label text-md-right">Enter Captcha</label>
<div class="col-md-6">
<input id="captcha" type="text" class="form-control @error('captcha') is-invalid @enderror" name="captcha" required autocomplete="" placeholder="Enter Captcha" name="captcha">
@error('captcha')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
......@@ -71,3 +93,18 @@
</div>
</div>
@endsection
@push('scripts')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
$('.reload').click(function () {
console.log('tes');
$.ajax({
type: 'GET',
url: 'reload-captcha',
success: function (data) {
$(".captcha span").html(data.captcha);
}
});
});
</script>
@endpush
\ No newline at end of file
......@@ -76,5 +76,6 @@
@yield('content')
</main>
</div>
@stack('scripts')
</body>
</html>
......@@ -11,7 +11,8 @@
|
*/
Auth::routes();
Auth::routes(['register' => false]);
// Route::get('reload-captcha', 'App\Http\Controllers\Auth\LoginController@reloadCaptcha')->name('reload-captcha');
Route::post('/change-language', 'TranslateController@changeLocale')->name('language');
Route::get('/home', 'HomeController@index')->name('home');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment