Skip to content

Commit

Permalink
Import Magento Release 1.7.0.0-alpha1
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSaferite committed Feb 5, 2012
1 parent ce07759 commit 7aa9a6f
Show file tree
Hide file tree
Showing 1,223 changed files with 93,395 additions and 39,655 deletions.
627 changes: 627 additions & 0 deletions RELEASE_NOTES.txt

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
if (defined('COMPILER_INCLUDE_PATH')) {
$appPath = COMPILER_INCLUDE_PATH;
set_include_path($appPath . PS . Mage::registry('original_include_path'));
include_once "Mage_Core_functions.php";
include_once "Varien_Autoload.php";
include_once COMPILER_INCLUDE_PATH . DS . "Mage_Core_functions.php";
include_once COMPILER_INCLUDE_PATH . DS . "Varien_Autoload.php";
} else {
/**
* Set include path
Expand Down Expand Up @@ -138,7 +138,8 @@ final class Mage
public static function getVersion()
{
$i = self::getVersionInfo();
return trim("{$i['major']}.{$i['minor']}.{$i['revision']}" . ($i['patch'] != '' ? ".{$i['patch']}" : "") . "-{$i['stability']}{$i['number']}", '.-');
return trim("{$i['major']}.{$i['minor']}.{$i['revision']}" . ($i['patch'] != '' ? ".{$i['patch']}" : "")
. "-{$i['stability']}{$i['number']}", '.-');
}

/**
Expand All @@ -151,11 +152,11 @@ public static function getVersionInfo()
{
return array(
'major' => '1',
'minor' => '6',
'revision' => '1',
'minor' => '7',
'revision' => '0',
'patch' => '0',
'stability' => '',
'number' => '',
'stability' => 'alpha',
'number' => '1',
);
}

Expand All @@ -166,12 +167,14 @@ public static function getVersionInfo()
public static function reset()
{
self::$_registry = array();
self::$_appRoot = null;
self::$_app = null;
self::$_config = null;
self::$_events = null;
self::$_objects = null;
self::$_isDownloader = false;
self::$_isDeveloperMode = false;
self::$_isInstalled = null;
// do not reset $headersSentThrowsException
}

Expand Down Expand Up @@ -424,7 +427,7 @@ public static function dispatchEvent($name, array $data = array())
*
* @link Mage_Core_Model_Config::getModelInstance
* @param string $modelClass
* @param array $arguments
* @param array|object $arguments
* @return Mage_Core_Model_Abstract
*/
public static function getModel($modelClass = '', $arguments = array())
Expand Down Expand Up @@ -631,6 +634,12 @@ public static function run($code = '', $type = 'store', $options = array())
Varien_Profiler::start('mage');
self::setRoot();
self::$_app = new Mage_Core_Model_App();
if (isset($options['request'])) {
self::$_app->setRequest($options['request']);
}
if (isset($options['response'])) {
self::$_app->setResponse($options['response']);
}
self::$_events = new Varien_Event_Collection();
self::$_config = new Mage_Core_Model_Config($options);
self::$_app->run(array(
Expand Down
6 changes: 4 additions & 2 deletions app/code/core/Mage/Admin/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/
class Mage_Admin_Model_Observer
{
const FLAG_NO_LOGIN = 'no-login';
/**
* Handler for controller_action_predispatch event
*
Expand All @@ -51,7 +52,8 @@ public function actionPreDispatchAdmin($observer)
'forgotpassword',
'resetpassword',
'resetpasswordpost',
'logout'
'logout',
'refresh' // captcha refresh
);
if (in_array($requestedActionName, $openActions)) {
$request->setDispatched(true);
Expand All @@ -64,7 +66,7 @@ public function actionPreDispatchAdmin($observer)
$postLogin = $request->getPost('login');
$username = isset($postLogin['username']) ? $postLogin['username'] : '';
$password = isset($postLogin['password']) ? $postLogin['password'] : '';
$user = $session->login($username, $password, $request);
$session->login($username, $password, $request);
$request->setPost('login', null);
}
if (!$request->getParam('forwarded')) {
Expand Down
60 changes: 51 additions & 9 deletions app/code/core/Mage/Admin/Model/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,42 +53,86 @@ class Mage_Admin_Model_Roles extends Mage_Core_Model_Abstract
*/
protected $_eventPrefix = 'admin_roles';

/**
* Constructor
*/
protected function _construct()
{
$this->_init('admin/roles');
}

/**
* Update object into database
*
* @return Mage_Admin_Model_Roles
*/
public function update()
{
$this->getResource()->update($this);
return $this;
}

/**
* Retrieve users collection
*
* @return Mage_Admin_Model_Resource_Roles_User_Collection
*/
public function getUsersCollection()
{
return Mage::getResourceModel('admin/roles_user_collection');
}

/**
* Return tree of acl resources
*
* @return array|null|Varien_Simplexml_Element
*/
public function getResourcesTree()
{
return $this->_buildResourcesArray(null, null, null, null, true);
}

/**
* Return list of acl resources
*
* @return array|null|Varien_Simplexml_Element
*/
public function getResourcesList()
{
return $this->_buildResourcesArray();
}

/**
* Return list of acl resources in 2D format
*
* @return array|null|Varien_Simplexml_Element
*/
public function getResourcesList2D()
{
return $this->_buildResourcesArray(null, null, null, true);
}

/**
* Return users for role
*
* @return array|false
*/
public function getRoleUsers()
{
return $this->getResource()->getRoleUsers($this);
}

/**
* Build resources array process
*
* @param null|Varien_Simplexml_Element $resource
* @param null $parentName
* @param int $level
* @param null $represent2Darray
* @param bool $rawNodes
* @param string $module
* @return array|null|Varien_Simplexml_Element
*/
protected function _buildResourcesArray(Varien_Simplexml_Element $resource = null,
$parentName = null, $level = 0, $represent2Darray = null, $rawNodes = false, $module = 'adminhtml')
{
Expand All @@ -99,7 +143,7 @@ protected function _buildResourcesArray(Varien_Simplexml_Element $resource = nul
$level = -1;
} else {
$resourceName = $parentName;
if ($resource->getName() != 'title' && $resource->getName() != 'sort_order' && $resource->getName() != 'children') {
if (!in_array($resource->getName(), array('title', 'sort_order', 'children', 'disabled'))) {
$resourceName = (is_null($parentName) ? '' : $parentName . '/') . $resource->getName();

//assigning module for its' children nodes
Expand All @@ -121,22 +165,20 @@ protected function _buildResourcesArray(Varien_Simplexml_Element $resource = nul
}
}

//check children and run recursion if they exists
$children = $resource->children();
if (empty($children)) {
if ($rawNodes) {
return $resource;
} else {
return $result;
foreach ($children as $key => $child) {
if (1 == $child->disabled) {
$resource->{$key} = null;
continue;
}
}
foreach ($children as $child) {
$this->_buildResourcesArray($child, $resourceName, $level + 1, $represent2Darray, $rawNodes, $module);
}

if ($rawNodes) {
return $resource;
} else {
return $result;
}
}

}
16 changes: 8 additions & 8 deletions app/code/core/Mage/Admin/Model/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function login($username, $password, $request = null)
}

try {
/* @var $user Mage_Admin_Model_User */
/** @var $user Mage_Admin_Model_User */
$user = Mage::getModel('admin/user');
$user->login($username, $password);
if ($user->getId()) {
Expand All @@ -98,19 +98,19 @@ public function login($username, $password, $request = null)
$this->setIsFirstPageAfterLogin(true);
$this->setUser($user);
$this->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
if ($requestUri = $this->_getRequestUri($request)) {

$requestUri = $this->_getRequestUri($request);
if ($requestUri) {
Mage::dispatchEvent('admin_session_user_login_success', array('user' => $user));
header('Location: ' . $requestUri);
exit;
}
} else {
Mage::throwException(Mage::helper('adminhtml')->__('Invalid User Name or Password.'));
}
else {
Mage::throwException(Mage::helper('adminhtml')->__('Invalid Username or Password.'));
}
}
catch (Mage_Core_Exception $e) {
} catch (Mage_Core_Exception $e) {
Mage::dispatchEvent('admin_session_user_login_failed',
array('user_name' => $username, 'exception' => $e));
array('user_name' => $username, 'exception' => $e));
if ($request && !$request->getParam('messageSent')) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
$request->setParam('messageSent', true);
Expand Down
8 changes: 6 additions & 2 deletions app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ public function authenticate($username, $password)
$result = false;

try {
Mage::dispatchEvent('admin_user_authenticate_before', array(
'username' => $username,
'user' => $this
));
$this->loadByUsername($username);
$sensitive = ($config) ? $username == $this->getUsername() : true;

Expand Down Expand Up @@ -556,7 +560,7 @@ public function changeResetPasswordLinkToken($newResetPasswordLinkToken) {
throw Mage::exception('Mage_Core', Mage::helper('adminhtml')->__('Invalid password reset token.'));
}
$this->setRpToken($newResetPasswordLinkToken);
$currentDate = Varien_Date::now(true);
$currentDate = Varien_Date::now();
$this->setRpTokenCreatedAt($currentDate);

return $this;
Expand All @@ -578,7 +582,7 @@ public function isResetPasswordLinkTokenExpired()

$tokenExpirationPeriod = Mage::helper('admin')->getResetPasswordLinkExpirationPeriod();

$currentDate = Varien_Date::now(true);
$currentDate = Varien_Date::now();
$currentTimestamp = Varien_Date::toTimestamp($currentDate);
$tokenTimestamp = Varien_Date::toTimestamp($resetPasswordLinkTokenCreatedAt);
if ($tokenTimestamp > $currentTimestamp) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<emails>
<forgot_email_template>admin_emails_forgot_email_template</forgot_email_template>
<forgot_email_identity>general</forgot_email_identity>
<password_reset_link_expiration_period>3</password_reset_link_expiration_period>
<password_reset_link_expiration_period>1</password_reset_link_expiration_period>
</emails>
</admin>
</default>
Expand Down
12 changes: 6 additions & 6 deletions app/code/core/Mage/Admin/sql/admin_setup/install-1.6.0.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
'primary' => true,
), 'Assert ID')
->addColumn('assert_type', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array(
'nullable' => false,
'default' => '',
'nullable' => true,
'default' => null,
), 'Assert Type')
->addColumn('assert_data', Varien_Db_Ddl_Table::TYPE_TEXT, '64k', array(
), 'Assert Data')
Expand Down Expand Up @@ -85,8 +85,8 @@
'default' => '0',
), 'User ID')
->addColumn('role_name', Varien_Db_Ddl_Table::TYPE_TEXT, 50, array(
'nullable' => false,
'default' => '',
'nullable' => true,
'default' => null,
), 'Role Name')
->addIndex($installer->getIdxName('admin/role', array('parent_id', 'sort_order')),
array('parent_id', 'sort_order'))
Expand All @@ -112,8 +112,8 @@
'default' => '0',
), 'Role ID')
->addColumn('resource_id', Varien_Db_Ddl_Table::TYPE_TEXT, 255, array(
'nullable' => false,
'default' => '',
'nullable' => true,
'default' => null,
), 'Resource ID')
->addColumn('privileges', Varien_Db_Ddl_Table::TYPE_TEXT, 20, array(
'nullable' => true,
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/AdminNotification/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ public function isReadablePopupObject()
$this->_popupReadable = true;
}
}

$curl->close();
}
return $this->_popupReadable;
}
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/AdminNotification/Model/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static function isSurveyUrlValid()
$curl->setConfig(array('timeout' => 5))
->write(Zend_Http_Client::GET, self::getSurveyUrl(), '1.0');
$response = $curl->read();
$curl->close();

if (Zend_Http_Response::extractCode($response) == 200) {
return true;
}
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/Adminhtml/Block/Api/Tab/Rolesedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public function __construct() {
$selrids = array();

foreach ($rules_set->getItems() as $item) {
if (array_key_exists(strtolower($item->getResource_id()), $resources) && $item->getPermission() == 'allow') {
if (array_key_exists(strtolower($item->getResource_id()), $resources)
&& $item->getApiPermission() == 'allow')
{
$resources[$item->getResource_id()]['checked'] = true;
array_push($selrids, $item->getResource_id());
}
Expand Down
Loading

0 comments on commit 7aa9a6f

Please sign in to comment.