mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-02 19:27:52 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -21,7 +21,7 @@ define('ROOT', rtrim(str_replace(array('admin'), array(''), dirname(__FILE__)),
|
|||||||
define('BACKEND', true);
|
define('BACKEND', true);
|
||||||
define('MONSTRA_ACCESS', true);
|
define('MONSTRA_ACCESS', true);
|
||||||
|
|
||||||
// Load bootstrap file
|
// Load Monstra engine _init.php file
|
||||||
require_once ROOT. DS .'engine'. DS .'_init.php';
|
require_once ROOT. DS .'engine'. DS .'_init.php';
|
||||||
|
|
||||||
// Errors var when users login failed
|
// Errors var when users login failed
|
||||||
@@ -33,7 +33,7 @@ $users = new Table('users');
|
|||||||
// Admin login
|
// Admin login
|
||||||
if (Request::post('login_submit')) {
|
if (Request::post('login_submit')) {
|
||||||
|
|
||||||
$user = $users->select("[login='" . trim(Request::post('login')) . "']", null);
|
$user = $users->select("[login='" . trim(Request::post('login')) . "']", null);
|
||||||
if (count($user) !== 0) {
|
if (count($user) !== 0) {
|
||||||
if ($user['login'] == Request::post('login')) {
|
if ($user['login'] == Request::post('login')) {
|
||||||
if (trim($user['password']) == Security::encryptPassword(Request::post('password'))) {
|
if (trim($user['password']) == Security::encryptPassword(Request::post('password'))) {
|
||||||
|
@@ -58,6 +58,10 @@ class ClassLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add class to mapping.
|
* Add class to mapping.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* ClassLoader::mapClass('ClassName', 'path/to/class');
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $className Class name
|
* @param string $className Class name
|
||||||
@@ -70,6 +74,10 @@ class ClassLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add multiple classes to mapping.
|
* Add multiple classes to mapping.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* ClassLoader::mapClasses(array('ClassName' => 'path/to/class','ClassName' => 'path/to/class'));
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $classes Array of classes to map (key = class name and value = class path)
|
* @param array $classes Array of classes to map (key = class name and value = class path)
|
||||||
@@ -83,6 +91,10 @@ class ClassLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a PSR-0 directory path.
|
* Adds a PSR-0 directory path.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* ClassLoader::directory('path/to/classes');
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $path Path to PSR-0 directory
|
* @param string $path Path to PSR-0 directory
|
||||||
@@ -94,6 +106,10 @@ class ClassLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a namespace.
|
* Registers a namespace.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* ClassLoader::registerNamespace('Namespace', '/path/to/namespace/');
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $namespace Namespace
|
* @param string $namespace Namespace
|
||||||
@@ -106,6 +122,10 @@ class ClassLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an alias for a class.
|
* Set an alias for a class.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* ClassLoader::registerNamespace('ClassNameAlias', 'ClassName');
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $alias Class alias
|
* @param string $alias Class alias
|
||||||
@@ -151,6 +171,10 @@ class ClassLoader
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoloader.
|
* Autoloader.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* ClassLoader::load();
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $className Class name
|
* @param string $className Class name
|
||||||
|
@@ -27,17 +27,27 @@ class Registry
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an object with this name is in the registry.
|
* Checks if an object with this name is in the registry.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* if (Registry::exists('var')) {
|
||||||
|
* // Do something...
|
||||||
|
* }
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
* @param string $name The name of the registry item to check for existence.
|
* @param string $name The name of the registry item to check for existence.
|
||||||
*/
|
*/
|
||||||
public static function exists($name)
|
public static function exists($name)
|
||||||
{
|
{
|
||||||
return isset(Gelato::$registry[(string) $name]);
|
return isset(Registry::$registry[(string) $name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a given value under a given name.
|
* Registers a given value under a given name.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* Registry::set('var', 'value');
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @param string $name The name of the value to store.
|
* @param string $name The name of the value to store.
|
||||||
* @param mixed[optional] $value The value that needs to be stored.
|
* @param mixed[optional] $value The value that needs to be stored.
|
||||||
@@ -49,16 +59,20 @@ class Registry
|
|||||||
|
|
||||||
// delete item
|
// delete item
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
unset(Gelato::$registry[$name]);
|
unset(Registry::$registry[$name]);
|
||||||
} else {
|
} else {
|
||||||
Gelato::$registry[$name] = $value;
|
Registry::$registry[$name] = $value;
|
||||||
|
|
||||||
return Gelato::get($name);
|
return Registry::get($name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch an item from the registry.
|
* Fetch an item from the registry.
|
||||||
|
*
|
||||||
|
* <code>
|
||||||
|
* $var = Registry::get('var', 'value');
|
||||||
|
* </code>
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @param string $name The name of the item to fetch.
|
* @param string $name The name of the item to fetch.
|
||||||
@@ -67,11 +81,11 @@ class Registry
|
|||||||
{
|
{
|
||||||
$name = (string) $name;
|
$name = (string) $name;
|
||||||
|
|
||||||
if ( ! isset(Gelato::$registry[$name])) {
|
if ( ! isset(Registry::$registry[$name])) {
|
||||||
throw new RuntimeException('No item "' . $name . '" exists in the registry.');
|
throw new RuntimeException('No item "' . $name . '" exists in the registry.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return Gelato::$registry[$name];
|
return Registry::$registry[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user