Skip to content

Commit 7652d08

Browse files
committed
Merge branch 'magento-1.7-beta' into magento-1.7
2 parents ce07759 + 3254aef commit 7652d08

File tree

7,193 files changed

+167358
-54738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,193 files changed

+167358
-54738
lines changed

.htaccess

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,35 @@
122122

123123
#RewriteBase /magento/
124124

125+
############################################
126+
## uncomment next line to enable light API calls processing
127+
128+
# RewriteRule ^api/([a-z][0-9a-z_]+)/?$ api.php?type=$1 [QSA,L]
129+
130+
############################################
131+
## rewrite API2 calls to api.php (by now it is REST only)
132+
133+
RewriteRule ^api/rest api.php?type=rest [QSA,L]
134+
125135
############################################
126136
## workaround for HTTP authorization
127137
## in CGI environment
128138

129139
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
130140

141+
############################################
142+
## TRACE and TRACK HTTP methods disabled to prevent XSS attacks
143+
144+
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
145+
RewriteRule .* - [L,R=405]
146+
147+
############################################
148+
## redirect for mobile user agents
149+
150+
#RewriteCond %{REQUEST_URI} !^/mobiledirectoryhere/.*$
151+
#RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
152+
#RewriteRule ^(.*)$ /mobiledirectoryhere/ [L,R=302]
153+
131154
############################################
132155
## always send 404 on missing files in these folders
133156

RELEASE_NOTES.txt

Lines changed: 2069 additions & 0 deletions
Large diffs are not rendered by default.

api.php

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* Magento
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to [email protected] so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade Magento to newer
18+
* versions in the future. If you wish to customize Magento for your
19+
* needs please refer to http://www.magentocommerce.com for more information.
20+
*
21+
* @category Mage
22+
* @package Mage_Api2
23+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
24+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25+
*/
26+
27+
if (version_compare(phpversion(), '5.2.0', '<')) {
28+
echo 'It looks like you have an invalid PHP version. Magento supports PHP 5.2.0 or newer';
29+
exit;
30+
}
31+
error_reporting(E_ALL | E_STRICT);
32+
33+
$mageFilename = getcwd() . '/app/Mage.php';
34+
35+
if (!file_exists($mageFilename)) {
36+
echo 'Mage file not found';
37+
exit;
38+
}
39+
require $mageFilename;
40+
41+
if (!Mage::isInstalled()) {
42+
echo 'Application is not installed yet, please complete install wizard first.';
43+
exit;
44+
}
45+
46+
if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
47+
Mage::setIsDeveloperMode(true);
48+
}
49+
50+
#ini_set('display_errors', 1);
51+
52+
// emulate index.php entry point for correct URLs generation in API
53+
Mage::register('custom_entry_point', true);
54+
Mage::$headersSentThrowsException = false;
55+
Mage::init('admin');
56+
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
57+
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_ADMINHTML, Mage_Core_Model_App_Area::PART_EVENTS);
58+
59+
// query parameter "type" is set by .htaccess rewrite rule
60+
$apiAlias = Mage::app()->getRequest()->getParam('type');
61+
62+
// check request could be processed by API2
63+
if (in_array($apiAlias, Mage_Api2_Model_Server::getApiTypes())) {
64+
/** @var $server Mage_Api2_Model_Server */
65+
$server = Mage::getSingleton('api2/server');
66+
67+
$server->run();
68+
} else {
69+
/* @var $server Mage_Api_Model_Server */
70+
$server = Mage::getSingleton('api/server');
71+
$adapterCode = $server->getAdapterCodeByAlias($apiAlias);
72+
73+
// if no adapters found in aliases - find it by default, by code
74+
if (null === $adapterCode) {
75+
$adapterCode = $apiAlias;
76+
}
77+
try {
78+
$server->initialize($adapterCode);
79+
$server->run();
80+
81+
Mage::app()->getResponse()->sendResponse();
82+
} catch (Exception $e) {
83+
Mage::logException($e);
84+
85+
echo $e->getMessage();
86+
exit;
87+
}
88+
}

app/Mage.php

Lines changed: 91 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
if (defined('COMPILER_INCLUDE_PATH')) {
3434
$appPath = COMPILER_INCLUDE_PATH;
3535
set_include_path($appPath . PS . Mage::registry('original_include_path'));
36-
include_once "Mage_Core_functions.php";
37-
include_once "Varien_Autoload.php";
36+
include_once COMPILER_INCLUDE_PATH . DS . "Mage_Core_functions.php";
37+
include_once COMPILER_INCLUDE_PATH . DS . "Varien_Autoload.php";
3838
} else {
3939
/**
4040
* Set include path
@@ -129,6 +129,22 @@ final class Mage
129129
*/
130130
static private $_isInstalled;
131131

132+
/**
133+
* Magento edition constants
134+
*/
135+
const EDITION_COMMUNITY = 'Community';
136+
const EDITION_ENTERPRISE = 'Enterprise';
137+
const EDITION_PROFESSIONAL = 'Professional';
138+
const EDITION_GO = 'Go';
139+
140+
/**
141+
* Current Magento edition.
142+
*
143+
* @var string
144+
* @static
145+
*/
146+
static private $_currentEdition = self::EDITION_COMMUNITY;
147+
132148
/**
133149
* Gets the current Magento version string
134150
* @link http://www.magentocommerce.com/blog/new-community-edition-release-process/
@@ -138,7 +154,8 @@ final class Mage
138154
public static function getVersion()
139155
{
140156
$i = self::getVersionInfo();
141-
return trim("{$i['major']}.{$i['minor']}.{$i['revision']}" . ($i['patch'] != '' ? ".{$i['patch']}" : "") . "-{$i['stability']}{$i['number']}", '.-');
157+
return trim("{$i['major']}.{$i['minor']}.{$i['revision']}" . ($i['patch'] != '' ? ".{$i['patch']}" : "")
158+
. "-{$i['stability']}{$i['number']}", '.-');
142159
}
143160

144161
/**
@@ -151,27 +168,40 @@ public static function getVersionInfo()
151168
{
152169
return array(
153170
'major' => '1',
154-
'minor' => '6',
155-
'revision' => '1',
171+
'minor' => '7',
172+
'revision' => '0',
156173
'patch' => '0',
157174
'stability' => '',
158175
'number' => '',
159176
);
160177
}
161178

179+
/**
180+
* Get current Magento edition
181+
*
182+
* @static
183+
* @return string
184+
*/
185+
public static function getEdition()
186+
{
187+
return self::$_currentEdition;
188+
}
189+
162190
/**
163191
* Set all my static data to defaults
164192
*
165193
*/
166194
public static function reset()
167195
{
168196
self::$_registry = array();
197+
self::$_appRoot = null;
169198
self::$_app = null;
170199
self::$_config = null;
171200
self::$_events = null;
172201
self::$_objects = null;
173202
self::$_isDownloader = false;
174203
self::$_isDeveloperMode = false;
204+
self::$_isInstalled = null;
175205
// do not reset $headersSentThrowsException
176206
}
177207

@@ -343,6 +373,7 @@ public static function getStoreConfigFlag($path, $store = null)
343373
* Get base URL path by type
344374
*
345375
* @param string $type
376+
* @param null|bool $secure
346377
* @return string
347378
*/
348379
public static function getBaseUrl($type = Mage_Core_Model_Store::URL_TYPE_LINK, $secure = null)
@@ -404,17 +435,16 @@ public static function addObserver($eventName, $callback, $data = array(), $obse
404435
* Dispatch event
405436
*
406437
* Calls all observer callbacks registered for this event
407-
* and multiobservers matching event name pattern
438+
* and multiple observers matching event name pattern
408439
*
409440
* @param string $name
410-
* @param array $args
441+
* @param array $data
411442
* @return Mage_Core_Model_App
412443
*/
413444
public static function dispatchEvent($name, array $data = array())
414445
{
415446
Varien_Profiler::start('DISPATCH EVENT:'.$name);
416447
$result = self::app()->dispatchEvent($name, $data);
417-
#$result = self::registry('events')->dispatch($name, $data);
418448
Varien_Profiler::stop('DISPATCH EVENT:'.$name);
419449
return $result;
420450
}
@@ -424,8 +454,8 @@ public static function dispatchEvent($name, array $data = array())
424454
*
425455
* @link Mage_Core_Model_Config::getModelInstance
426456
* @param string $modelClass
427-
* @param array $arguments
428-
* @return Mage_Core_Model_Abstract
457+
* @param array|object $arguments
458+
* @return Mage_Core_Model_Abstract|false
429459
*/
430460
public static function getModel($modelClass = '', $arguments = array())
431461
{
@@ -519,7 +549,7 @@ public static function helper($name)
519549
}
520550

521551
/**
522-
* Retreive resource helper object
552+
* Retrieve resource helper object
523553
*
524554
* @param string $moduleName
525555
* @return Mage_Core_Model_Resource_Helper_Abstract
@@ -554,6 +584,7 @@ public static function exception($module = 'Mage_Core', $message = '', $code = 0
554584
*
555585
* @param string $message
556586
* @param string $messageStorage
587+
* @throws Mage_Core_Exception
557588
*/
558589
public static function throwException($message, $messageStorage = null)
559590
{
@@ -577,7 +608,8 @@ public static function app($code = '', $type = 'store', $options = array())
577608
self::$_app = new Mage_Core_Model_App();
578609
self::setRoot();
579610
self::$_events = new Varien_Event_Collection();
580-
self::$_config = new Mage_Core_Model_Config($options);
611+
self::_setIsInstalled($options);
612+
self::_setConfigModel($options);
581613

582614
Varien_Profiler::start('self::app::init');
583615
self::$_app->init($code, $type, $options);
@@ -599,7 +631,8 @@ public static function init($code = '', $type = 'store', $options = array(), $mo
599631
try {
600632
self::setRoot();
601633
self::$_app = new Mage_Core_Model_App();
602-
self::$_config = new Mage_Core_Model_Config();
634+
self::_setIsInstalled($options);
635+
self::_setConfigModel($options);
603636

604637
if (!empty($modules)) {
605638
self::$_app->initSpecified($code, $type, $options, $modules);
@@ -630,9 +663,19 @@ public static function run($code = '', $type = 'store', $options = array())
630663
try {
631664
Varien_Profiler::start('mage');
632665
self::setRoot();
666+
if (isset($options['edition'])) {
667+
self::$_currentEdition = $options['edition'];
668+
}
633669
self::$_app = new Mage_Core_Model_App();
670+
if (isset($options['request'])) {
671+
self::$_app->setRequest($options['request']);
672+
}
673+
if (isset($options['response'])) {
674+
self::$_app->setResponse($options['response']);
675+
}
634676
self::$_events = new Varien_Event_Collection();
635-
self::$_config = new Mage_Core_Model_Config($options);
677+
self::_setIsInstalled($options);
678+
self::_setConfigModel($options);
636679
self::$_app->run(array(
637680
'scope_code' => $code,
638681
'scope_type' => $type,
@@ -663,6 +706,40 @@ public static function run($code = '', $type = 'store', $options = array())
663706
}
664707
}
665708

709+
/**
710+
* Set application isInstalled flag based on given options
711+
*
712+
* @param array $options
713+
*/
714+
protected static function _setIsInstalled($options = array())
715+
{
716+
if (isset($options['is_installed']) && $options['is_installed']) {
717+
self::$_isInstalled = true;
718+
}
719+
}
720+
721+
/**
722+
* Set application Config model
723+
*
724+
* @param array $options
725+
*/
726+
protected static function _setConfigModel($options = array())
727+
{
728+
if (isset($options['config_model']) && class_exists($options['config_model'])) {
729+
$alternativeConfigModelName = $options['config_model'];
730+
unset($options['config_model']);
731+
$alternativeConfigModel = new $alternativeConfigModelName($options);
732+
} else {
733+
$alternativeConfigModel = null;
734+
}
735+
736+
if (!is_null($alternativeConfigModel) && ($alternativeConfigModel instanceof Mage_Core_Model_Config)) {
737+
self::$_config = $alternativeConfigModel;
738+
} else {
739+
self::$_config = new Mage_Core_Model_Config($options);
740+
}
741+
}
742+
666743
/**
667744
* Retrieve application installation flag
668745
*

app/code/community/Phoenix/Moneybookers/Block/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @category Phoenix
1616
* @package Phoenix_Moneybookers
17-
* @copyright Copyright (c) 2011 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
17+
* @copyright Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
1818
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1919
*/
2020
class Phoenix_Moneybookers_Block_Form extends Mage_Payment_Block_Form

app/code/community/Phoenix/Moneybookers/Block/Info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @category Phoenix
1616
* @package Phoenix_Moneybookers
17-
* @copyright Copyright (c) 2011 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
17+
* @copyright Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
1818
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1919
*/
2020
class Phoenix_Moneybookers_Block_Info extends Mage_Payment_Block_Info

app/code/community/Phoenix/Moneybookers/Block/Jsinit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @category Phoenix
1616
* @package Phoenix_Moneybookers
17-
* @copyright Copyright (c) 2011 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
17+
* @copyright Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
1818
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1919
*/
2020
class Phoenix_Moneybookers_Block_Jsinit extends Mage_Adminhtml_Block_Template

app/code/community/Phoenix/Moneybookers/Block/Payment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @category Phoenix
1616
* @package Phoenix_Moneybookers
17-
* @copyright Copyright (c) 2011 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
17+
* @copyright Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
1818
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1919
*/
2020
class Phoenix_Moneybookers_Block_Payment extends Mage_Core_Block_Template

app/code/community/Phoenix/Moneybookers/Block/Placeform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @category Phoenix
1616
* @package Phoenix_Moneybookers
17-
* @copyright Copyright (c) 2011 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
17+
* @copyright Copyright (c) 2012 Phoenix Medien GmbH & Co. KG (http://www.phoenix-medien.de)
1818
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
1919
*/
2020
class Phoenix_Moneybookers_Block_Placeform extends Mage_Core_Block_Template

0 commit comments

Comments
 (0)