Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
b71ecb43
Commit
b71ecb43
authored
Oct 21, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed packages directory. refactoring.
parent
80f810de
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
107 additions
and
168 deletions
+107
-168
laravel/bootstrap/constants.php
+2
-1
laravel/bootstrap/core.php
+26
-9
laravel/cookie.php
+4
-0
laravel/database/connection.php
+0
-2
laravel/database/query.php
+1
-2
laravel/lang.php
+14
-14
laravel/loader.php
+0
-92
laravel/paginator.php
+11
-6
laravel/security/crypter.php
+17
-11
laravel/url.php
+3
-6
laravel/validation/validator.php
+29
-23
packages/.gitignore
+0
-0
public/index.php
+0
-2
No files found.
laravel/bootstrap/constants.php
View file @
b71ecb43
...
...
@@ -25,7 +25,6 @@ function constants($constants)
$constants
=
array
(
'APP_PATH'
=>
realpath
(
$application
)
.
'/'
,
'BASE_PATH'
=>
realpath
(
"
$laravel
/.."
)
.
'/'
,
'PACKAGE_PATH'
=>
realpath
(
$packages
)
.
'/'
,
'PUBLIC_PATH'
=>
realpath
(
$public
)
.
'/'
,
'STORAGE_PATH'
=>
realpath
(
$storage
)
.
'/'
,
'SYS_PATH'
=>
realpath
(
$laravel
)
.
'/'
,
...
...
@@ -33,6 +32,8 @@ $constants = array(
constants
(
$constants
);
unset
(
$application
,
$public
,
$storage
,
$laravel
);
/**
* Register all of the other framework paths. All of these paths
* are built on top of the core paths above. We still allow the
...
...
laravel/bootstrap/core.php
View file @
b71ecb43
...
...
@@ -9,7 +9,6 @@ require 'constants.php';
*/
require
SYS_PATH
.
'arr'
.
EXT
;
require
SYS_PATH
.
'config'
.
EXT
;
require
SYS_PATH
.
'loader'
.
EXT
;
/**
* Load some core configuration files by default so we don't have to
...
...
@@ -35,18 +34,36 @@ IoC::$container = $container;
unset
(
$container
);
/**
* Register the application auto-loader. The auto-loader
is responsibl
e
*
for the lazy-loading of all of the Laravel core classes, as well as
* the developer created libraries and models.
* Register the application auto-loader. The auto-loader
closur
e
*
is responsible for the lazy-loading of all of the Laravel core
*
classes, as well as
the developer created libraries and models.
*/
spl_autoload_register
(
array
(
'Laravel\\Loader'
,
'load'
))
;
$aliases
=
Config
::
$items
[
'application'
][
'aliases'
]
;
Loader
::
$aliases
=
Config
::
$items
[
'application'
][
'aliases'
];
spl_autoload_register
(
function
(
$class
)
use
(
$aliases
)
{
if
(
array_key_exists
(
$class
,
$aliases
))
{
return
class_alias
(
$aliases
[
$class
],
$class
);
}
$file
=
strtolower
(
str_replace
(
'\\'
,
'/'
,
$class
));
foreach
(
array
(
BASE_PATH
,
MODEL_PATH
,
LIBRARY_PATH
)
as
$path
)
{
if
(
file_exists
(
$path
=
$path
.
$file
.
EXT
))
{
require_once
$path
;
return
;
}
}
});
unset
(
$aliases
);
/**
* Define a few convenient global functions. These functions primarily
* exists to provide a short way of accessing functions commonly used
* in views, allowing the reduction of code noise.
* Define a few convenient global functions.
*/
function
e
(
$value
)
{
...
...
laravel/cookie.php
View file @
b71ecb43
...
...
@@ -104,6 +104,10 @@ class Cookie {
* been modified by the user, since they serve as a fingerprint of the cookie
* contents. The application key is used to salt the salts.
*
* When the cookie is read using the "get" method, the value will be extracted
* from the cookie and hashed, if the hash in the cookie and the hashed value
* do not match, we know the cookie has been changed on the client.
*
* @param string $name
* @param string $value
* @return string
...
...
laravel/database/connection.php
View file @
b71ecb43
...
...
@@ -139,8 +139,6 @@ class Connection {
*/
public
function
query
(
$sql
,
$bindings
=
array
())
{
// Remove expressions from the bindings since they injected into
// the query as raw strings and are not bound parameters.
foreach
(
$bindings
as
$key
=>
$value
)
{
if
(
$value
instanceof
Expression
)
unset
(
$bindings
[
$key
]);
...
...
laravel/database/query.php
View file @
b71ecb43
...
...
@@ -24,8 +24,7 @@ class Query {
public
$selects
;
/**
* If the query is performing an aggregate function, this will contain
* the column and and function to use when aggregating.
* The aggregating column and function.
*
* @var array
*/
...
...
laravel/lang.php
View file @
b71ecb43
...
...
@@ -3,41 +3,41 @@
class
Lang
{
/**
* All of the loaded language lines.
*
* The array is keyed by [$language.$file].
* The key of the language line being retrieved.
*
* @var
array
* @var
string
*/
protected
static
$lines
=
array
()
;
protected
$key
;
/**
* The
paths containing the language files
.
* The
replacements that should be made on the language line
.
*
* @var array
*/
protected
static
$paths
=
array
(
LANG_PATH
)
;
protected
$replacements
;
/**
* The
key of the language line being
retrieved.
* The
language in which the line should be
retrieved.
*
* @var string
*/
protected
$
key
;
protected
$
language
;
/**
* The replacements that should be made on the language line.
* All of the loaded language lines.
*
* The array is keyed by [$language.$file].
*
* @var array
*/
protected
$replacements
;
protected
static
$lines
=
array
()
;
/**
* The
language in which the line should be retrieved
.
* The
paths containing the language files
.
*
* @var
string
* @var
array
*/
protected
$language
;
protected
static
$paths
=
array
(
LANG_PATH
)
;
/**
* Create a new Lang instance.
...
...
laravel/loader.php
deleted
100644 → 0
View file @
80f810de
<?php
namespace
Laravel
;
class
Loader
{
/**
* The paths that will be searched by the loader.
*
* @var array
*/
public
static
$paths
=
array
(
BASE_PATH
,
MODEL_PATH
,
LIBRARY_PATH
,
APP_PATH
);
/**
* The class aliases defined for the application.
*
* @var array
*/
public
static
$aliases
=
array
();
/**
* Load the file for a given class.
*
* <code>
* // Load the file for the "User" class
* Loader::load('User');
*
* // Load the file for the "Repositories\User" class
* Loader::load('Repositories\\User');
* </code>
*
* @param string $class
* @return void
*/
public
static
function
load
(
$class
)
{
// All Laravel core classes follow a namespace to directory convention.
// We will replace all of the namespace slashes with directory slashes.
$file
=
strtolower
(
str_replace
(
'\\'
,
'/'
,
$class
));
// Check to determine if an alias exists. If it does, we will define the
// alias and bail out. Aliases are defined for most used core classes.
if
(
array_key_exists
(
$class
,
static
::
$aliases
))
{
return
class_alias
(
static
::
$aliases
[
$class
],
$class
);
}
foreach
(
static
::
$paths
as
$path
)
{
if
(
file_exists
(
$path
=
$path
.
$file
.
EXT
))
{
require_once
$path
;
return
;
}
}
}
/**
* Register a class alias with the auto-loader.
*
* @param string $alias
* @param string $class
* @return void
*/
public
static
function
alias
(
$alias
,
$class
)
{
static
::
$aliases
[
$alias
]
=
$class
;
}
/**
* Register a path with the auto-loader.
*
* @param string $path
* @return void
*/
public
static
function
path
(
$path
)
{
static
::
$paths
[]
=
rtrim
(
$path
,
'/'
)
.
'/'
;
}
/**
* Remove an alias from the auto-loader's alias registrations.
*
* @param string $alias
* @return void
*/
public
static
function
forget_alias
(
$alias
)
{
unset
(
static
::
$aliases
[
$alias
]);
}
}
\ No newline at end of file
laravel/paginator.php
View file @
b71ecb43
...
...
@@ -89,7 +89,11 @@ class Paginator {
*/
public
static
function
make
(
$results
,
$total
,
$per_page
)
{
return
new
static
(
$results
,
static
::
page
(
$total
,
$per_page
),
$total
,
$per_page
,
ceil
(
$total
/
$per_page
));
$page
=
static
::
page
(
$total
,
$per_page
);
$last_page
=
ceil
(
$total
/
$per_page
);
return
new
static
(
$results
,
$page
,
$total
,
$per_page
,
$last_page
);
}
/**
...
...
@@ -202,7 +206,9 @@ class Paginator {
*/
protected
function
backwards
(
$element
,
$text
,
$last
)
{
return
$this
->
element
(
$element
,
$text
,
$last
,
function
(
$page
)
{
return
$page
<=
1
;
});
$disabler
=
function
(
$page
)
{
return
$page
<=
1
;
};
return
$this
->
element
(
$element
,
$text
,
$last
,
$disabler
);
}
/**
...
...
@@ -217,7 +223,9 @@ class Paginator {
*/
protected
function
forwards
(
$element
,
$text
,
$last
)
{
return
$this
->
element
(
$element
,
$text
,
$last
,
function
(
$page
,
$last
)
{
return
$page
>=
$last
;
});
$disabler
=
function
(
$page
,
$last
)
{
return
$page
>=
$last
;
};
return
$this
->
element
(
$element
,
$text
,
$last
,
$disabler
);
}
/**
...
...
@@ -257,9 +265,6 @@ class Paginator {
*/
protected
function
appendage
(
$element
,
$page
)
{
// The appendage string contains the query string, but it also contains a
// place-holder for the page number. This will be used to insert the
// correct page number based on the element being created.
if
(
is_null
(
$this
->
appendage
))
{
$this
->
appendage
=
'?page=%s'
.
http_build_query
((
array
)
$this
->
appends
);
...
...
laravel/security/crypter.php
View file @
b71ecb43
...
...
@@ -24,8 +24,11 @@ class Crypter {
/**
* Encrypt a string using Mcrypt.
*
* The string will be encrypted using the cipher and mode specified when the
* crypter instance was created, and the final result will be base64 encoded.
* The given string will be encrypted using AES-256 encryption for a high
* degree of security. The returned string will also be base64 encoded.
*
* Mcrypt must be installed on your machine before using this method, and
* an application key must be specified in the application configuration.
*
* <code>
* // Encrypt a string using the Mcrypt PHP extension
...
...
@@ -47,31 +50,34 @@ class Crypter {
/**
* Decrypt a string using Mcrypt.
*
* The given encrypted value must have been encrypted using Laravel and
* the application key specified in the application configuration file.
*
* Mcrypt must be installed on your machine before using this method.
*
* @param string $value
* @return string
*/
public
static
function
decrypt
(
$value
)
{
list
(
$iv
,
$value
)
=
static
::
parse
(
base64_decode
(
$value
,
true
));
if
((
$value
=
base64_decode
(
$value
))
===
false
)
{
throw
new
\Exception
(
'Decryption error. Input value is not valid base64 data.'
);
}
$value
=
mcrypt_decrypt
(
static
::
$cipher
,
static
::
key
(),
$value
,
static
::
$mode
,
$iv
);
list
(
$iv
,
$value
)
=
static
::
parse
(
$value
);
return
rtrim
(
$value
,
"
\0
"
);
return
rtrim
(
mcrypt_decrypt
(
static
::
$cipher
,
static
::
key
(),
$value
,
static
::
$mode
,
$iv
)
,
"
\0
"
);
}
/**
* Parse an encrypted
value into the input vector and the actual value
.
* Parse an encrypted
string into its input vector and value segments
.
*
* @param string $value
* @return array
*/
protected
static
function
parse
(
$value
)
{
if
(
$value
===
false
)
{
throw
new
\Exception
(
'Decryption error. Input value is not valid base64 data.'
);
}
return
array
(
substr
(
$value
,
0
,
static
::
iv_size
()),
substr
(
$value
,
static
::
iv_size
()));
}
...
...
laravel/url.php
View file @
b71ecb43
...
...
@@ -20,10 +20,6 @@ class URL {
{
if
(
filter_var
(
$url
,
FILTER_VALIDATE_URL
)
!==
false
)
return
$url
;
// First, we build the base URL for the application, as well as handle the generation
// of links using SSL. It is possible for the developer to disable the generation
// of SSL links throughout the application, making it more convenient to create
// applications without SSL on the development box.
$base
=
Config
::
$items
[
'application'
][
'url'
]
.
'/'
.
Config
::
$items
[
'application'
][
'index'
];
if
(
$https
and
Config
::
$items
[
'application'
][
'ssl'
])
...
...
@@ -99,8 +95,9 @@ class URL {
$uri
=
preg_replace
(
'/\(.+?\)/'
,
$parameter
,
$uri
,
1
);
}
// Before generating the route URL, we will replace all remaining optional
// wildcard segments that were not replaced by parameters with spaces.
// Replace all remaining optional segments with spaces. Since the
// segments are, obviously, optional, some of them may not have
// been assigned values from the parameter array.
return
static
::
to
(
str_replace
(
array
(
'/(:any?)'
,
'/(:num?)'
),
''
,
$uri
),
$https
);
}
...
...
laravel/validation/validator.php
View file @
b71ecb43
...
...
@@ -163,11 +163,11 @@ class Validator {
{
list
(
$rule
,
$parameters
)
=
$this
->
parse
(
$rule
);
// Verify that the attribute and rule combination is actually
validatable before
//
attempting to call the validation rule. Unless the rule implicitly requires
// the attribute to exist, we will not call any rules for attributes that are
// not in the validator's attribute array.
if
(
!
$this
->
validatable
(
$rule
,
$attribute
,
$value
=
Arr
::
get
(
$this
->
attributes
,
$attribute
)
))
return
;
// Verify that the attribute and rule combination is actually
//
validatable before attempting to call the validation rule.
$value
=
Arr
::
get
(
$this
->
attributes
,
$attribute
);
if
(
!
$this
->
validatable
(
$rule
,
$attribute
,
$value
))
return
;
if
(
!
$this
->
{
'validate_'
.
$rule
}(
$attribute
,
$value
,
$parameters
,
$this
))
{
...
...
@@ -178,9 +178,9 @@ class Validator {
/**
* Determine if an attribute is validatable.
*
* To be considered validatable, the attribute must either exist, or the
rule being
*
checked must implicitly validate "required", such as the "required" rule or
the
* "
accepted" rule. No other rules have implicit "required" validation
.
* To be considered validatable, the attribute must either exist, or the
*
rule being checked must implicitly validate "required", such as
the
* "
required" rule or the "accepted" rule
.
*
* @param string $rule
* @param string $attribute
...
...
@@ -508,25 +508,25 @@ class Validator {
*/
protected
function
message
(
$attribute
,
$rule
)
{
// First we'll check for developer specified, attribute specific messages.
These messages
//
take first priority if they have been specified
. They allow the fine-grained tuning
// First we'll check for developer specified, attribute specific messages.
//
These messages take first priority
. They allow the fine-grained tuning
// of error messages for each rule.
if
(
array_key_exists
(
$attribute
.
'_'
.
$rule
,
$this
->
messages
))
{
return
$this
->
messages
[
$attribute
.
'_'
.
$rule
];
}
// Next we'll check for developer specified, rule specific
messages. These allow the
//
developer to override the error message for an entire rule, regardless of th
e
// attribute being validated by that rule.
// Next we'll check for developer specified, rule specific
error messages.
//
These allow the developer to override the error message for an entir
e
//
rule, regardless of the
attribute being validated by that rule.
elseif
(
array_key_exists
(
$rule
,
$this
->
messages
))
{
return
$this
->
messages
[
$rule
];
}
// If the rule being validated is a "size" rule and the attribute is not
a number,
//
we will need to gather the specific size message for the type of attribut
e
// being validated, either a file or a string.
// If the rule being validated is a "size" rule and the attribute is not
//
a number, we will need to gather the specific size message for th
e
//
type of attribute
being validated, either a file or a string.
elseif
(
in_array
(
$rule
,
$this
->
size_rules
)
and
!
$this
->
has_rule
(
$attribute
,
$this
->
numeric_rules
))
{
$line
=
(
array_key_exists
(
$attribute
,
Input
::
file
()))
?
"file"
:
"string"
;
...
...
@@ -534,9 +534,9 @@ class Validator {
return
Lang
::
line
(
"validation.
{
$rule
}
.
{
$line
}
"
)
->
get
(
$this
->
language
);
}
// If no developer specified messages have been set, and no other special
messages
//
apply to the rule, we will just pull the default validation message from the
// validation language file.
// If no developer specified messages have been set, and no other special
//
messages apply to the rule, we will just pull the default validation
//
message from the
validation language file.
else
{
return
Lang
::
line
(
"validation.
{
$rule
}
"
)
->
get
(
$this
->
language
);
...
...
@@ -558,9 +558,10 @@ class Validator {
if
(
in_array
(
$rule
,
$this
->
size_rules
))
{
// Even though every size rule will not have a place-holder for min, max, and size,
// we will go ahead and make replacements for all of them just for convenience.
// Except for "between" every replacement should be the first parameter.
// Even though every size rule will not have a place-holder for min,
// max, and size, we will go ahead and make replacements for all of
// them just for convenience. Except for "between" every replacement
// should be the first parameter.
$max
=
(
$rule
==
'between'
)
?
$parameters
[
1
]
:
$parameters
[
0
];
$replace
=
array
(
$parameters
[
0
],
$parameters
[
0
],
$max
);
...
...
@@ -621,10 +622,15 @@ class Validator {
*/
protected
function
parse
(
$rule
)
{
$parameters
=
array
();
// The format for specifying validation rules and parameters follows
// a {rule}:{parameters} convention. For instance, "max:3" specifies
// that the value may only be 3 characters in length.
$parameters
=
((
$colon
=
strpos
(
$rule
,
':'
))
!==
false
)
?
explode
(
','
,
substr
(
$rule
,
$colon
+
1
))
:
array
();
if
((
$colon
=
strpos
(
$rule
,
':'
))
!==
false
)
{
$parameters
=
explode
(
','
,
substr
(
$rule
,
$colon
+
1
));
}
return
array
(
is_numeric
(
$colon
)
?
substr
(
$rule
,
0
,
$colon
)
:
$rule
,
$parameters
);
}
...
...
packages/.gitignore
deleted
100644 → 0
View file @
80f810de
public/index.php
View file @
b71ecb43
...
...
@@ -33,8 +33,6 @@ $application = '../application';
$laravel
=
'../laravel'
;
$packages
=
'../packages'
;
$storage
=
'../storage'
;
$public
=
__DIR__
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment