Skip to content

Commit

Permalink
Import Magento 1.4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSaferite committed Feb 18, 2010
1 parent 473b844 commit 61c419b
Show file tree
Hide file tree
Showing 1,857 changed files with 33,056 additions and 99,669 deletions.
67 changes: 29 additions & 38 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public static function getVersionInfo()
'minor' => '4',
'revision' => '0',
'patch' => '0',
'stability' => 'rc',
'number' => '1',
'stability' => '',
'number' => '',
);
}

Expand Down Expand Up @@ -599,14 +599,7 @@ public static function run($code = '', $type = 'store', $options=array())
header('Location: ' . self::getBaseUrl());
die();
} catch (Mage_Core_Model_Store_Exception $e) {
$baseUrl = rtrim(self::getScriptSystemUrl('errors'), '/') . '/errors/404.php';
if (!headers_sent()) {
header('Location: ' . $baseUrl);
} else {
print '<script type="text/javascript">';
print "window.location.href = '{$baseUrl}';";
print '</script>';
}
require_once(self::getBaseDir() . DS . 'errors' . DS . '404.php');
die();
} catch (Exception $e) {
if (self::isInstalled() || self::$_isDownloader) {
Expand Down Expand Up @@ -672,19 +665,24 @@ public static function log($message, $level = null, $file = '')
return;
}

if (!self::$_isDeveloperMode) {
if (!self::getStoreConfig('dev/log/active')) {
return;
try {
$logActive = self::getStoreConfig('dev/log/active');
if (empty($file)) {
$file = self::getStoreConfig('dev/log/file');
}
}
catch (Exception $e) {
$logActive = true;
}

if (!self::$_isDeveloperMode && !$logActive) {
return;
}

static $loggers = array();

$level = is_null($level) ? Zend_Log::DEBUG : $level;
if (empty($file)) {
$file = self::getStoreConfig('dev/log/file');
$file = empty($file) ? 'system.log' : $file;
}
$file = empty($file) ? 'system.log' : $file;

try {
if (!isset($loggers[$file])) {
Expand Down Expand Up @@ -770,37 +768,30 @@ public static function printException(Exception $e, $extra = '')
print $e->getTraceAsString();
print '</pre>';
} else {
self::getConfig()->createDirIfNotExists(self::getBaseDir('var') . DS . 'report');
$reportId = abs(intval(microtime(true) * rand(100, 1000)));
$reportFile = self::getBaseDir('var') . DS . 'report' . DS . $reportId;

$reportData = array(
!empty($extra) ? $extra . "\n\n" : '' . $e->getMessage(),
$e->getTraceAsString()
);
if (isset($_SERVER) && isset($_SERVER['REQUEST_URI'])) {
$reportData[] = $_SERVER['REQUEST_URI'];
}
$reportData = serialize($reportData);

file_put_contents($reportFile, $reportData);
chmod($reportFile, 0777);
// retrieve server data
if (isset($_SERVER)) {
if (isset($_SERVER['REQUEST_URI'])) {
$reportData['url'] = $_SERVER['REQUEST_URI'];
}
if (isset($_SERVER['SCRIPT_NAME'])) {
$reportData['script_name'] = $_SERVER['SCRIPT_NAME'];
}
}

$storeCode = 'default';
// attempt to specify store as a skin
try {
$storeCode = self::app()->getStore()->getCode();
} catch (Exception $e) {
$reportData['skin'] = $storeCode;
}
catch (Exception $e) {}

$baseUrl = self::getScriptSystemUrl('errors', true);
$reportUrl = rtrim($baseUrl, '/') . '/errors/report.php?id=' . $reportId . '&s=' . $storeCode;

if (!headers_sent()) {
header('Location: ' . $reportUrl);
} else {
print '<script type="text/javascript">';
print "window.location.href = '{$reportUrl}';";
print '</script>';
}
require_once(self::getBaseDir() . DS . 'errors' . DS . 'report.php');
}

die();
Expand Down
11 changes: 11 additions & 0 deletions app/code/core/Mage/Admin/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,15 @@ public function actionPreDispatchAdmin($event)

$session->refreshAcl();
}

/**
* Unset session first visit flag after displaying page
*
* @param Varien_Event_Observer $event
*/
public function actionPostDispatchAdmin($event)
{
$session = Mage::getSingleton('admin/session');
$session->unsetData('is_first_visit');
}
}
10 changes: 3 additions & 7 deletions app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,10 @@ protected function _beforeSave()
$data['username'] = $this->getUsername();
}

if ($this->getPassword()) {
$data['password'] = $this->_getEncodedPassword($this->getPassword());
}

if ($this->getNewPassword()) {
if ($this->getNewPassword()) { // change password
$data['password'] = $this->_getEncodedPassword($this->getNewPassword());
} elseif ($this->getPassword()) {
$data['new_password'] = $this->getPassword();
} elseif ($this->getPassword() && $this->getPassword() != $this->getOrigData('password')) { // new user password
$data['password'] = $this->_getEncodedPassword($this->getPassword());
}

if ( !is_null($this->getIsActive()) ) {
Expand Down
112 changes: 112 additions & 0 deletions app/code/core/Mage/AdminNotification/Model/Survey.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category Mage
* @package Mage_AdminNotification
* @copyright Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/


/**
* AdminNotification survey model
*
* @category Mage
* @package Mage_AdminNotification
* @author Magento Core Team <[email protected]>
*/
class Mage_AdminNotification_Model_Survey
{
protected static $_flagCode = 'admin_notification_survey';
protected static $_flagModel = null;

const SURVEY_URL = 'www.magentocommerce.com/instsurvey.html';

/**
* Check if survey url valid (exists) or not
*
* @return boolen
*/
public static function isSurveyUrlValid()
{
$curl = new Varien_Http_Adapter_Curl();
$curl->setConfig(array('timeout' => 5))
->write(Zend_Http_Client::GET, self::getSurveyUrl(), '1.0');
$response = $curl->read();
if (Zend_Http_Response::extractCode($response) == 200) {
return true;
}
return false;
}

/**
* Return survey url
*
* @return string
*/
public static function getSurveyUrl()
{
$host = Mage::app()->getRequest()->isSecure()?'https://':'http://';
return $host . self::SURVEY_URL;
}

/**
* Return core flag model
*
* @return Mage_Core_Model_Flag
*/
protected static function _getFlagModel()
{
if (self::$_flagModel === null) {
self::$_flagModel = Mage::getModel('core/flag', array('flag_code' => self::$_flagCode))->loadSelf();
}
return self::$_flagModel;
}

/**
* Check if survey question was already asked
* or survey url was viewed during installation process
*
* @return boolean
*/
public static function isSurveyViewed()
{
$flagData = self::_getFlagModel()->getFlagData();
if (isset($flagData['survey_viewed']) && $flagData['survey_viewed'] == 1) {
return true;
}
return false;
}

/**
* Save survey viewed flag in core flag
*
* @param boolean $viewed
*/
public static function saveSurveyViewed($viewed)
{
$flagData = self::_getFlagModel()->getFlagData();
if (is_null($flagData)) {
$flagData = array();
}
$flagData = array_merge($flagData, array('survey_viewed' => (bool)$viewed));
self::_getFlagModel()->setFlagData($flagData)->save();
}
}
7 changes: 7 additions & 0 deletions app/code/core/Mage/AdminNotification/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@
</observers>
</controller_action_predispatch>
</events>
<layout>
<updates>
<adminnotification>
<file>adminnotification.xml</file>
</adminnotification>
</updates>
</layout>
</adminhtml>

<default>
Expand Down
2 changes: 2 additions & 0 deletions app/code/core/Mage/Adminhtml/Block/Api/Tab/Roleinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected function _initForm()
)
);

$fieldset->addField('in_role_user_old', 'hidden', array('name' => 'in_role_user_old'));

$form->setValues($this->getRole()->getData());
$this->setForm($form);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function getRoot($parentNodeCategory=null, $recursionLevel=3)
}

$tree = Mage::getResourceSingleton('catalog/category_tree')
->load($rootId, $recursionLevel);
->load(null, $recursionLevel);

if ($this->getCategory()) {
$tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ protected function _prepareForm() {
$form->setDataObject($this->getCategory());

$fieldset = $form->addFieldset('fieldset_group_' . $group->getId(), array(
'legend' => Mage::helper('catalog')->__($group->getAttributeGroupName())
'legend' => Mage::helper('catalog')->__($group->getAttributeGroupName()),
'class' => 'fieldset-wide',
));

if ($this->getAddHiddenFields()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function __construct()
}

$this->_updateButton('save', 'label', Mage::helper('catalog')->__('Save Attribute'));
$this->_updateButton('save', 'onclick', 'saveAttribute()');

if (! Mage::registry('entity_attribute')->getIsUserDefined()) {
$this->_removeButton('delete');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ protected function _prepareForm()
$form->getElement('apply_to')->addClass('no-display ignore-validate');
}

// define field dependencies
$this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')
->addFieldMap("is_wysiwyg_enabled", 'wysiwyg_enabled')
->addFieldMap("is_html_allowed_on_front", 'html_allowed_on_front')
->addFieldDependence('html_allowed_on_front', 'wysiwyg_enabled', '0')
);

return $this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ protected function _prepareForm()
$form->setDataObject(Mage::registry('product'));

$fieldset = $form->addFieldset('group_fields'.$group->getId(),
array('legend'=>Mage::helper('catalog')->__($group->getAttributeGroupName()))
);
array(
'legend'=>Mage::helper('catalog')->__($group->getAttributeGroupName()),
'class'=>'fieldset-wide',
));

$attributes = $this->getGroupAttributes();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,11 @@ protected function _getSelectedNodes()
{
if ($this->_selectedNodes === null) {
$this->_selectedNodes = array();
$root = $this->getRoot();
foreach ($this->getCategoryIds() as $categoryId) {
$this->_selectedNodes[] = $this->getRoot()->getTree()->getNodeById($categoryId);
if ($root) {
$this->_selectedNodes[] = $root->getTree()->getNodeById($categoryId);
}
}
}

Expand Down
Loading

0 comments on commit 61c419b

Please sign in to comment.